ACPI: Constify internal fwnode arguments

Constify internal ACPI fwnode arguments in preparation for the same in
fwnode API.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Sakari Ailus 2017-07-21 14:39:34 +03:00 committed by Rafael J. Wysocki
parent 8b9d680258
commit 99a8546469
2 changed files with 40 additions and 34 deletions

View File

@ -19,7 +19,7 @@
#include "internal.h" #include "internal.h"
static int acpi_data_get_property_array(struct acpi_device_data *data, static int acpi_data_get_property_array(const struct acpi_device_data *data,
const char *name, const char *name,
acpi_object_type type, acpi_object_type type,
const union acpi_object **obj); const union acpi_object **obj);
@ -417,7 +417,7 @@ void acpi_free_properties(struct acpi_device *adev)
* %-EINVAL if the property doesn't exist, * %-EINVAL if the property doesn't exist,
* %-EPROTO if the property value type doesn't match @type. * %-EPROTO if the property value type doesn't match @type.
*/ */
static int acpi_data_get_property(struct acpi_device_data *data, static int acpi_data_get_property(const struct acpi_device_data *data,
const char *name, acpi_object_type type, const char *name, acpi_object_type type,
const union acpi_object **obj) const union acpi_object **obj)
{ {
@ -459,20 +459,21 @@ static int acpi_data_get_property(struct acpi_device_data *data,
* @type: Expected property type. * @type: Expected property type.
* @obj: Location to store the property value (if not %NULL). * @obj: Location to store the property value (if not %NULL).
*/ */
int acpi_dev_get_property(struct acpi_device *adev, const char *name, int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
acpi_object_type type, const union acpi_object **obj) acpi_object_type type, const union acpi_object **obj)
{ {
return adev ? acpi_data_get_property(&adev->data, name, type, obj) : -EINVAL; return adev ? acpi_data_get_property(&adev->data, name, type, obj) : -EINVAL;
} }
EXPORT_SYMBOL_GPL(acpi_dev_get_property); EXPORT_SYMBOL_GPL(acpi_dev_get_property);
static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *fwnode) static const struct acpi_device_data *
acpi_device_data_of_node(const struct fwnode_handle *fwnode)
{ {
if (is_acpi_device_node(fwnode)) { if (is_acpi_device_node(fwnode)) {
struct acpi_device *adev = to_acpi_device_node(fwnode); const struct acpi_device *adev = to_acpi_device_node(fwnode);
return &adev->data; return &adev->data;
} else if (is_acpi_data_node(fwnode)) { } else if (is_acpi_data_node(fwnode)) {
struct acpi_data_node *dn = to_acpi_data_node(fwnode); const struct acpi_data_node *dn = to_acpi_data_node(fwnode);
return &dn->data; return &dn->data;
} }
return NULL; return NULL;
@ -484,8 +485,8 @@ static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *f
* @propname: Name of the property. * @propname: Name of the property.
* @valptr: Location to store a pointer to the property value (if not %NULL). * @valptr: Location to store a pointer to the property value (if not %NULL).
*/ */
int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, int acpi_node_prop_get(const struct fwnode_handle *fwnode,
void **valptr) const char *propname, void **valptr)
{ {
return acpi_data_get_property(acpi_device_data_of_node(fwnode), return acpi_data_get_property(acpi_device_data_of_node(fwnode),
propname, ACPI_TYPE_ANY, propname, ACPI_TYPE_ANY,
@ -511,7 +512,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname,
* %-EPROTO if the property is not a package or the type of its elements * %-EPROTO if the property is not a package or the type of its elements
* doesn't match @type. * doesn't match @type.
*/ */
static int acpi_data_get_property_array(struct acpi_device_data *data, static int acpi_data_get_property_array(const struct acpi_device_data *data,
const char *name, const char *name,
acpi_object_type type, acpi_object_type type,
const union acpi_object **obj) const union acpi_object **obj)
@ -571,13 +572,13 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,
* *
* Return: %0 on success, negative error code on failure. * Return: %0 on success, negative error code on failure.
*/ */
int __acpi_node_get_property_reference(struct fwnode_handle *fwnode, int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *propname, size_t index, size_t num_args, const char *propname, size_t index, size_t num_args,
struct acpi_reference_args *args) struct acpi_reference_args *args)
{ {
const union acpi_object *element, *end; const union acpi_object *element, *end;
const union acpi_object *obj; const union acpi_object *obj;
struct acpi_device_data *data; const struct acpi_device_data *data;
struct acpi_device *device; struct acpi_device *device;
int ret, idx = 0; int ret, idx = 0;
@ -673,7 +674,7 @@ int __acpi_node_get_property_reference(struct fwnode_handle *fwnode,
} }
EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference);
static int acpi_data_prop_read_single(struct acpi_device_data *data, static int acpi_data_prop_read_single(const struct acpi_device_data *data,
const char *propname, const char *propname,
enum dev_prop_type proptype, void *val) enum dev_prop_type proptype, void *val)
{ {
@ -812,7 +813,7 @@ static int acpi_copy_property_array_string(const union acpi_object *items,
return nval; return nval;
} }
static int acpi_data_prop_read(struct acpi_device_data *data, static int acpi_data_prop_read(const struct acpi_device_data *data,
const char *propname, const char *propname,
enum dev_prop_type proptype, enum dev_prop_type proptype,
void *val, size_t nval) void *val, size_t nval)
@ -866,7 +867,7 @@ static int acpi_data_prop_read(struct acpi_device_data *data,
return ret; return ret;
} }
int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval) enum dev_prop_type proptype, void *val, size_t nval)
{ {
return adev ? acpi_data_prop_read(&adev->data, propname, proptype, val, nval) : -EINVAL; return adev ? acpi_data_prop_read(&adev->data, propname, proptype, val, nval) : -EINVAL;
@ -884,8 +885,9 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
* of the property. Otherwise, read at most @nval values to the array at the * of the property. Otherwise, read at most @nval values to the array at the
* location pointed to by @val. * location pointed to by @val.
*/ */
int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, int acpi_node_prop_read(const struct fwnode_handle *fwnode,
enum dev_prop_type proptype, void *val, size_t nval) const char *propname, enum dev_prop_type proptype,
void *val, size_t nval)
{ {
return acpi_data_prop_read(acpi_device_data_of_node(fwnode), return acpi_data_prop_read(acpi_device_data_of_node(fwnode),
propname, proptype, val, nval); propname, proptype, val, nval);

View File

@ -1003,13 +1003,14 @@ struct acpi_reference_args {
}; };
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
int acpi_dev_get_property(struct acpi_device *adev, const char *name, int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
acpi_object_type type, const union acpi_object **obj); acpi_object_type type, const union acpi_object **obj);
int __acpi_node_get_property_reference(struct fwnode_handle *fwnode, int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *name, size_t index, size_t num_args, const char *name, size_t index, size_t num_args,
struct acpi_reference_args *args); struct acpi_reference_args *args);
static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, static inline int acpi_node_get_property_reference(
const struct fwnode_handle *fwnode,
const char *name, size_t index, const char *name, size_t index,
struct acpi_reference_args *args) struct acpi_reference_args *args)
{ {
@ -1017,13 +1018,15 @@ static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode,
MAX_ACPI_REFERENCE_ARGS, args); MAX_ACPI_REFERENCE_ARGS, args);
} }
int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
void **valptr); void **valptr);
int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, int acpi_dev_prop_read_single(struct acpi_device *adev,
enum dev_prop_type proptype, void *val); const char *propname, enum dev_prop_type proptype,
int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, void *val);
enum dev_prop_type proptype, void *val, size_t nval); int acpi_node_prop_read(const struct fwnode_handle *fwnode,
int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, const char *propname, enum dev_prop_type proptype,
void *val, size_t nval);
int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname,
enum dev_prop_type proptype, void *val, size_t nval); enum dev_prop_type proptype, void *val, size_t nval);
struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode,
@ -1100,35 +1103,36 @@ static inline int acpi_dev_get_property(struct acpi_device *adev,
} }
static inline int static inline int
__acpi_node_get_property_reference(struct fwnode_handle *fwnode, __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
const char *name, size_t index, size_t num_args, const char *name, size_t index, size_t num_args,
struct acpi_reference_args *args) struct acpi_reference_args *args)
{ {
return -ENXIO; return -ENXIO;
} }
static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, static inline int
const char *name, size_t index, acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
struct acpi_reference_args *args) const char *name, size_t index,
struct acpi_reference_args *args)
{ {
return -ENXIO; return -ENXIO;
} }
static inline int acpi_node_prop_get(struct fwnode_handle *fwnode, static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode,
const char *propname, const char *propname,
void **valptr) void **valptr)
{ {
return -ENXIO; return -ENXIO;
} }
static inline int acpi_dev_prop_get(struct acpi_device *adev, static inline int acpi_dev_prop_get(const struct acpi_device *adev,
const char *propname, const char *propname,
void **valptr) void **valptr)
{ {
return -ENXIO; return -ENXIO;
} }
static inline int acpi_dev_prop_read_single(struct acpi_device *adev, static inline int acpi_dev_prop_read_single(const struct acpi_device *adev,
const char *propname, const char *propname,
enum dev_prop_type proptype, enum dev_prop_type proptype,
void *val) void *val)
@ -1136,7 +1140,7 @@ static inline int acpi_dev_prop_read_single(struct acpi_device *adev,
return -ENXIO; return -ENXIO;
} }
static inline int acpi_node_prop_read(struct fwnode_handle *fwnode, static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode,
const char *propname, const char *propname,
enum dev_prop_type proptype, enum dev_prop_type proptype,
void *val, size_t nval) void *val, size_t nval)
@ -1144,7 +1148,7 @@ static inline int acpi_node_prop_read(struct fwnode_handle *fwnode,
return -ENXIO; return -ENXIO;
} }
static inline int acpi_dev_prop_read(struct acpi_device *adev, static inline int acpi_dev_prop_read(const struct acpi_device *adev,
const char *propname, const char *propname,
enum dev_prop_type proptype, enum dev_prop_type proptype,
void *val, size_t nval) void *val, size_t nval)