diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-07-21 07:39:34 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-07-21 18:04:50 -0400 |
commit | 99a85464693faa9b6829cb753b328c2e4434d94b (patch) | |
tree | 0ad4af4721167fd8fa7505ebb1d8b97c3a02bfdd | |
parent | 8b9d6802583a1ef6977e4b059f9fa848e6882253 (diff) |
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>
-rw-r--r-- | drivers/acpi/property.c | 34 | ||||
-rw-r--r-- | include/linux/acpi.h | 40 |
2 files changed, 40 insertions, 34 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 04c60a25ee87..043bfcacee66 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include "internal.h" | 20 | #include "internal.h" |
21 | 21 | ||
22 | static int acpi_data_get_property_array(struct acpi_device_data *data, | 22 | static int acpi_data_get_property_array(const struct acpi_device_data *data, |
23 | const char *name, | 23 | const char *name, |
24 | acpi_object_type type, | 24 | acpi_object_type type, |
25 | const union acpi_object **obj); | 25 | const union acpi_object **obj); |
@@ -417,7 +417,7 @@ void acpi_free_properties(struct acpi_device *adev) | |||
417 | * %-EINVAL if the property doesn't exist, | 417 | * %-EINVAL if the property doesn't exist, |
418 | * %-EPROTO if the property value type doesn't match @type. | 418 | * %-EPROTO if the property value type doesn't match @type. |
419 | */ | 419 | */ |
420 | static int acpi_data_get_property(struct acpi_device_data *data, | 420 | static int acpi_data_get_property(const struct acpi_device_data *data, |
421 | const char *name, acpi_object_type type, | 421 | const char *name, acpi_object_type type, |
422 | const union acpi_object **obj) | 422 | const union acpi_object **obj) |
423 | { | 423 | { |
@@ -459,20 +459,21 @@ static int acpi_data_get_property(struct acpi_device_data *data, | |||
459 | * @type: Expected property type. | 459 | * @type: Expected property type. |
460 | * @obj: Location to store the property value (if not %NULL). | 460 | * @obj: Location to store the property value (if not %NULL). |
461 | */ | 461 | */ |
462 | int acpi_dev_get_property(struct acpi_device *adev, const char *name, | 462 | int acpi_dev_get_property(const struct acpi_device *adev, const char *name, |
463 | acpi_object_type type, const union acpi_object **obj) | 463 | acpi_object_type type, const union acpi_object **obj) |
464 | { | 464 | { |
465 | return adev ? acpi_data_get_property(&adev->data, name, type, obj) : -EINVAL; | 465 | return adev ? acpi_data_get_property(&adev->data, name, type, obj) : -EINVAL; |
466 | } | 466 | } |
467 | EXPORT_SYMBOL_GPL(acpi_dev_get_property); | 467 | EXPORT_SYMBOL_GPL(acpi_dev_get_property); |
468 | 468 | ||
469 | static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *fwnode) | 469 | static const struct acpi_device_data * |
470 | acpi_device_data_of_node(const struct fwnode_handle *fwnode) | ||
470 | { | 471 | { |
471 | if (is_acpi_device_node(fwnode)) { | 472 | if (is_acpi_device_node(fwnode)) { |
472 | struct acpi_device *adev = to_acpi_device_node(fwnode); | 473 | const struct acpi_device *adev = to_acpi_device_node(fwnode); |
473 | return &adev->data; | 474 | return &adev->data; |
474 | } else if (is_acpi_data_node(fwnode)) { | 475 | } else if (is_acpi_data_node(fwnode)) { |
475 | struct acpi_data_node *dn = to_acpi_data_node(fwnode); | 476 | const struct acpi_data_node *dn = to_acpi_data_node(fwnode); |
476 | return &dn->data; | 477 | return &dn->data; |
477 | } | 478 | } |
478 | return NULL; | 479 | return NULL; |
@@ -484,8 +485,8 @@ static struct acpi_device_data *acpi_device_data_of_node(struct fwnode_handle *f | |||
484 | * @propname: Name of the property. | 485 | * @propname: Name of the property. |
485 | * @valptr: Location to store a pointer to the property value (if not %NULL). | 486 | * @valptr: Location to store a pointer to the property value (if not %NULL). |
486 | */ | 487 | */ |
487 | int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, | 488 | int acpi_node_prop_get(const struct fwnode_handle *fwnode, |
488 | void **valptr) | 489 | const char *propname, void **valptr) |
489 | { | 490 | { |
490 | return acpi_data_get_property(acpi_device_data_of_node(fwnode), | 491 | return acpi_data_get_property(acpi_device_data_of_node(fwnode), |
491 | propname, ACPI_TYPE_ANY, | 492 | propname, ACPI_TYPE_ANY, |
@@ -511,7 +512,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, | |||
511 | * %-EPROTO if the property is not a package or the type of its elements | 512 | * %-EPROTO if the property is not a package or the type of its elements |
512 | * doesn't match @type. | 513 | * doesn't match @type. |
513 | */ | 514 | */ |
514 | static int acpi_data_get_property_array(struct acpi_device_data *data, | 515 | static int acpi_data_get_property_array(const struct acpi_device_data *data, |
515 | const char *name, | 516 | const char *name, |
516 | acpi_object_type type, | 517 | acpi_object_type type, |
517 | const union acpi_object **obj) | 518 | const union acpi_object **obj) |
@@ -571,13 +572,13 @@ static int acpi_data_get_property_array(struct acpi_device_data *data, | |||
571 | * | 572 | * |
572 | * Return: %0 on success, negative error code on failure. | 573 | * Return: %0 on success, negative error code on failure. |
573 | */ | 574 | */ |
574 | int __acpi_node_get_property_reference(struct fwnode_handle *fwnode, | 575 | int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
575 | const char *propname, size_t index, size_t num_args, | 576 | const char *propname, size_t index, size_t num_args, |
576 | struct acpi_reference_args *args) | 577 | struct acpi_reference_args *args) |
577 | { | 578 | { |
578 | const union acpi_object *element, *end; | 579 | const union acpi_object *element, *end; |
579 | const union acpi_object *obj; | 580 | const union acpi_object *obj; |
580 | struct acpi_device_data *data; | 581 | const struct acpi_device_data *data; |
581 | struct acpi_device *device; | 582 | struct acpi_device *device; |
582 | int ret, idx = 0; | 583 | int ret, idx = 0; |
583 | 584 | ||
@@ -673,7 +674,7 @@ int __acpi_node_get_property_reference(struct fwnode_handle *fwnode, | |||
673 | } | 674 | } |
674 | EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); | 675 | EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); |
675 | 676 | ||
676 | static int acpi_data_prop_read_single(struct acpi_device_data *data, | 677 | static int acpi_data_prop_read_single(const struct acpi_device_data *data, |
677 | const char *propname, | 678 | const char *propname, |
678 | enum dev_prop_type proptype, void *val) | 679 | enum dev_prop_type proptype, void *val) |
679 | { | 680 | { |
@@ -812,7 +813,7 @@ static int acpi_copy_property_array_string(const union acpi_object *items, | |||
812 | return nval; | 813 | return nval; |
813 | } | 814 | } |
814 | 815 | ||
815 | static int acpi_data_prop_read(struct acpi_device_data *data, | 816 | static int acpi_data_prop_read(const struct acpi_device_data *data, |
816 | const char *propname, | 817 | const char *propname, |
817 | enum dev_prop_type proptype, | 818 | enum dev_prop_type proptype, |
818 | void *val, size_t nval) | 819 | void *val, size_t nval) |
@@ -866,7 +867,7 @@ static int acpi_data_prop_read(struct acpi_device_data *data, | |||
866 | return ret; | 867 | return ret; |
867 | } | 868 | } |
868 | 869 | ||
869 | int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | 870 | int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, |
870 | enum dev_prop_type proptype, void *val, size_t nval) | 871 | enum dev_prop_type proptype, void *val, size_t nval) |
871 | { | 872 | { |
872 | return adev ? acpi_data_prop_read(&adev->data, propname, proptype, val, nval) : -EINVAL; | 873 | 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, | |||
884 | * of the property. Otherwise, read at most @nval values to the array at the | 885 | * of the property. Otherwise, read at most @nval values to the array at the |
885 | * location pointed to by @val. | 886 | * location pointed to by @val. |
886 | */ | 887 | */ |
887 | int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, | 888 | int acpi_node_prop_read(const struct fwnode_handle *fwnode, |
888 | enum dev_prop_type proptype, void *val, size_t nval) | 889 | const char *propname, enum dev_prop_type proptype, |
890 | void *val, size_t nval) | ||
889 | { | 891 | { |
890 | return acpi_data_prop_read(acpi_device_data_of_node(fwnode), | 892 | return acpi_data_prop_read(acpi_device_data_of_node(fwnode), |
891 | propname, proptype, val, nval); | 893 | propname, proptype, val, nval); |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 71b763f0bee9..4d9fb610f114 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -1003,13 +1003,14 @@ struct acpi_reference_args { | |||
1003 | }; | 1003 | }; |
1004 | 1004 | ||
1005 | #ifdef CONFIG_ACPI | 1005 | #ifdef CONFIG_ACPI |
1006 | int acpi_dev_get_property(struct acpi_device *adev, const char *name, | 1006 | int acpi_dev_get_property(const struct acpi_device *adev, const char *name, |
1007 | acpi_object_type type, const union acpi_object **obj); | 1007 | acpi_object_type type, const union acpi_object **obj); |
1008 | int __acpi_node_get_property_reference(struct fwnode_handle *fwnode, | 1008 | int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
1009 | const char *name, size_t index, size_t num_args, | 1009 | const char *name, size_t index, size_t num_args, |
1010 | struct acpi_reference_args *args); | 1010 | struct acpi_reference_args *args); |
1011 | 1011 | ||
1012 | static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, | 1012 | static inline int acpi_node_get_property_reference( |
1013 | const struct fwnode_handle *fwnode, | ||
1013 | const char *name, size_t index, | 1014 | const char *name, size_t index, |
1014 | struct acpi_reference_args *args) | 1015 | struct acpi_reference_args *args) |
1015 | { | 1016 | { |
@@ -1017,13 +1018,15 @@ static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, | |||
1017 | MAX_ACPI_REFERENCE_ARGS, args); | 1018 | MAX_ACPI_REFERENCE_ARGS, args); |
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, | 1021 | int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname, |
1021 | void **valptr); | 1022 | void **valptr); |
1022 | int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | 1023 | int acpi_dev_prop_read_single(struct acpi_device *adev, |
1023 | enum dev_prop_type proptype, void *val); | 1024 | const char *propname, enum dev_prop_type proptype, |
1024 | int acpi_node_prop_read(struct fwnode_handle *fwnode, const char *propname, | 1025 | void *val); |
1025 | enum dev_prop_type proptype, void *val, size_t nval); | 1026 | int acpi_node_prop_read(const struct fwnode_handle *fwnode, |
1026 | int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | 1027 | const char *propname, enum dev_prop_type proptype, |
1028 | void *val, size_t nval); | ||
1029 | int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, | ||
1027 | enum dev_prop_type proptype, void *val, size_t nval); | 1030 | enum dev_prop_type proptype, void *val, size_t nval); |
1028 | 1031 | ||
1029 | struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, | 1032 | 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, | |||
1100 | } | 1103 | } |
1101 | 1104 | ||
1102 | static inline int | 1105 | static inline int |
1103 | __acpi_node_get_property_reference(struct fwnode_handle *fwnode, | 1106 | __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
1104 | const char *name, size_t index, size_t num_args, | 1107 | const char *name, size_t index, size_t num_args, |
1105 | struct acpi_reference_args *args) | 1108 | struct acpi_reference_args *args) |
1106 | { | 1109 | { |
1107 | return -ENXIO; | 1110 | return -ENXIO; |
1108 | } | 1111 | } |
1109 | 1112 | ||
1110 | static inline int acpi_node_get_property_reference(struct fwnode_handle *fwnode, | 1113 | static inline int |
1111 | const char *name, size_t index, | 1114 | acpi_node_get_property_reference(const struct fwnode_handle *fwnode, |
1112 | struct acpi_reference_args *args) | 1115 | const char *name, size_t index, |
1116 | struct acpi_reference_args *args) | ||
1113 | { | 1117 | { |
1114 | return -ENXIO; | 1118 | return -ENXIO; |
1115 | } | 1119 | } |
1116 | 1120 | ||
1117 | static inline int acpi_node_prop_get(struct fwnode_handle *fwnode, | 1121 | static inline int acpi_node_prop_get(const struct fwnode_handle *fwnode, |
1118 | const char *propname, | 1122 | const char *propname, |
1119 | void **valptr) | 1123 | void **valptr) |
1120 | { | 1124 | { |
1121 | return -ENXIO; | 1125 | return -ENXIO; |
1122 | } | 1126 | } |
1123 | 1127 | ||
1124 | static inline int acpi_dev_prop_get(struct acpi_device *adev, | 1128 | static inline int acpi_dev_prop_get(const struct acpi_device *adev, |
1125 | const char *propname, | 1129 | const char *propname, |
1126 | void **valptr) | 1130 | void **valptr) |
1127 | { | 1131 | { |
1128 | return -ENXIO; | 1132 | return -ENXIO; |
1129 | } | 1133 | } |
1130 | 1134 | ||
1131 | static inline int acpi_dev_prop_read_single(struct acpi_device *adev, | 1135 | static inline int acpi_dev_prop_read_single(const struct acpi_device *adev, |
1132 | const char *propname, | 1136 | const char *propname, |
1133 | enum dev_prop_type proptype, | 1137 | enum dev_prop_type proptype, |
1134 | void *val) | 1138 | void *val) |
@@ -1136,7 +1140,7 @@ static inline int acpi_dev_prop_read_single(struct acpi_device *adev, | |||
1136 | return -ENXIO; | 1140 | return -ENXIO; |
1137 | } | 1141 | } |
1138 | 1142 | ||
1139 | static inline int acpi_node_prop_read(struct fwnode_handle *fwnode, | 1143 | static inline int acpi_node_prop_read(const struct fwnode_handle *fwnode, |
1140 | const char *propname, | 1144 | const char *propname, |
1141 | enum dev_prop_type proptype, | 1145 | enum dev_prop_type proptype, |
1142 | void *val, size_t nval) | 1146 | void *val, size_t nval) |
@@ -1144,7 +1148,7 @@ static inline int acpi_node_prop_read(struct fwnode_handle *fwnode, | |||
1144 | return -ENXIO; | 1148 | return -ENXIO; |
1145 | } | 1149 | } |
1146 | 1150 | ||
1147 | static inline int acpi_dev_prop_read(struct acpi_device *adev, | 1151 | static inline int acpi_dev_prop_read(const struct acpi_device *adev, |
1148 | const char *propname, | 1152 | const char *propname, |
1149 | enum dev_prop_type proptype, | 1153 | enum dev_prop_type proptype, |
1150 | void *val, size_t nval) | 1154 | void *val, size_t nval) |