diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-07-21 07:39:36 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-07-21 18:04:51 -0400 |
commit | 37ba983cfb47cc7b353146422c437468fcb29c61 (patch) | |
tree | 060594741d16d202705d46c69fd543d8b2548e31 | |
parent | 39e5aeed835dece823e6cc57f6842b8f1f4799e1 (diff) |
device property: Constify fwnode property API
Make fwnode arguments to the fwnode property API const.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/property.c | 52 | ||||
-rw-r--r-- | drivers/base/property.c | 64 | ||||
-rw-r--r-- | drivers/of/property.c | 34 | ||||
-rw-r--r-- | include/linux/acpi.h | 20 | ||||
-rw-r--r-- | include/linux/fwnode.h | 26 | ||||
-rw-r--r-- | include/linux/property.h | 63 |
6 files changed, 142 insertions, 117 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 043bfcacee66..f8d60051efb8 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -898,7 +898,7 @@ int acpi_node_prop_read(const struct fwnode_handle *fwnode, | |||
898 | * @fwnode: Firmware node to find the next child node for. | 898 | * @fwnode: Firmware node to find the next child node for. |
899 | * @child: Handle to one of the device's child nodes or a null handle. | 899 | * @child: Handle to one of the device's child nodes or a null handle. |
900 | */ | 900 | */ |
901 | struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, | 901 | struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, |
902 | struct fwnode_handle *child) | 902 | struct fwnode_handle *child) |
903 | { | 903 | { |
904 | const struct acpi_device *adev = to_acpi_device_node(fwnode); | 904 | const struct acpi_device *adev = to_acpi_device_node(fwnode); |
@@ -967,7 +967,7 @@ struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, | |||
967 | * Returns parent node of an ACPI device or data firmware node or %NULL if | 967 | * Returns parent node of an ACPI device or data firmware node or %NULL if |
968 | * not available. | 968 | * not available. |
969 | */ | 969 | */ |
970 | struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode) | 970 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode) |
971 | { | 971 | { |
972 | if (is_acpi_data_node(fwnode)) { | 972 | if (is_acpi_data_node(fwnode)) { |
973 | /* All data nodes have parent pointer so just return that */ | 973 | /* All data nodes have parent pointer so just return that */ |
@@ -996,8 +996,8 @@ struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode) | |||
996 | * %NULL if there is no next endpoint, ERR_PTR() in case of error. In case | 996 | * %NULL if there is no next endpoint, ERR_PTR() in case of error. In case |
997 | * of success the next endpoint is returned. | 997 | * of success the next endpoint is returned. |
998 | */ | 998 | */ |
999 | struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 999 | struct fwnode_handle *acpi_graph_get_next_endpoint( |
1000 | struct fwnode_handle *prev) | 1000 | const struct fwnode_handle *fwnode, struct fwnode_handle *prev) |
1001 | { | 1001 | { |
1002 | struct fwnode_handle *port = NULL; | 1002 | struct fwnode_handle *port = NULL; |
1003 | struct fwnode_handle *endpoint; | 1003 | struct fwnode_handle *endpoint; |
@@ -1044,7 +1044,8 @@ struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode, | |||
1044 | * the child node on success, NULL otherwise. | 1044 | * the child node on success, NULL otherwise. |
1045 | */ | 1045 | */ |
1046 | static struct fwnode_handle *acpi_graph_get_child_prop_value( | 1046 | static struct fwnode_handle *acpi_graph_get_child_prop_value( |
1047 | struct fwnode_handle *fwnode, const char *prop_name, unsigned int val) | 1047 | const struct fwnode_handle *fwnode, const char *prop_name, |
1048 | unsigned int val) | ||
1048 | { | 1049 | { |
1049 | struct fwnode_handle *child; | 1050 | struct fwnode_handle *child; |
1050 | 1051 | ||
@@ -1073,17 +1074,18 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value( | |||
1073 | * fields requested by the caller. Returns %0 in case of success and | 1074 | * fields requested by the caller. Returns %0 in case of success and |
1074 | * negative errno otherwise. | 1075 | * negative errno otherwise. |
1075 | */ | 1076 | */ |
1076 | int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode, | 1077 | int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode, |
1077 | struct fwnode_handle **parent, | 1078 | struct fwnode_handle **parent, |
1078 | struct fwnode_handle **port, | 1079 | struct fwnode_handle **port, |
1079 | struct fwnode_handle **endpoint) | 1080 | struct fwnode_handle **endpoint) |
1080 | { | 1081 | { |
1082 | struct fwnode_handle *fwnode; | ||
1081 | unsigned int port_nr, endpoint_nr; | 1083 | unsigned int port_nr, endpoint_nr; |
1082 | struct acpi_reference_args args; | 1084 | struct acpi_reference_args args; |
1083 | int ret; | 1085 | int ret; |
1084 | 1086 | ||
1085 | memset(&args, 0, sizeof(args)); | 1087 | memset(&args, 0, sizeof(args)); |
1086 | ret = acpi_node_get_property_reference(fwnode, "remote-endpoint", 0, | 1088 | ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0, |
1087 | &args); | 1089 | &args); |
1088 | if (ret) | 1090 | if (ret) |
1089 | return ret; | 1091 | return ret; |
@@ -1125,7 +1127,7 @@ int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode, | |||
1125 | return 0; | 1127 | return 0; |
1126 | } | 1128 | } |
1127 | 1129 | ||
1128 | static bool acpi_fwnode_device_is_available(struct fwnode_handle *fwnode) | 1130 | static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode) |
1129 | { | 1131 | { |
1130 | if (!is_acpi_device_node(fwnode)) | 1132 | if (!is_acpi_device_node(fwnode)) |
1131 | return false; | 1133 | return false; |
@@ -1133,16 +1135,17 @@ static bool acpi_fwnode_device_is_available(struct fwnode_handle *fwnode) | |||
1133 | return acpi_device_is_present(to_acpi_device_node(fwnode)); | 1135 | return acpi_device_is_present(to_acpi_device_node(fwnode)); |
1134 | } | 1136 | } |
1135 | 1137 | ||
1136 | static bool acpi_fwnode_property_present(struct fwnode_handle *fwnode, | 1138 | static bool acpi_fwnode_property_present(const struct fwnode_handle *fwnode, |
1137 | const char *propname) | 1139 | const char *propname) |
1138 | { | 1140 | { |
1139 | return !acpi_node_prop_get(fwnode, propname, NULL); | 1141 | return !acpi_node_prop_get(fwnode, propname, NULL); |
1140 | } | 1142 | } |
1141 | 1143 | ||
1142 | static int acpi_fwnode_property_read_int_array(struct fwnode_handle *fwnode, | 1144 | static int |
1143 | const char *propname, | 1145 | acpi_fwnode_property_read_int_array(const struct fwnode_handle *fwnode, |
1144 | unsigned int elem_size, | 1146 | const char *propname, |
1145 | void *val, size_t nval) | 1147 | unsigned int elem_size, void *val, |
1148 | size_t nval) | ||
1146 | { | 1149 | { |
1147 | enum dev_prop_type type; | 1150 | enum dev_prop_type type; |
1148 | 1151 | ||
@@ -1166,16 +1169,17 @@ static int acpi_fwnode_property_read_int_array(struct fwnode_handle *fwnode, | |||
1166 | return acpi_node_prop_read(fwnode, propname, type, val, nval); | 1169 | return acpi_node_prop_read(fwnode, propname, type, val, nval); |
1167 | } | 1170 | } |
1168 | 1171 | ||
1169 | static int acpi_fwnode_property_read_string_array(struct fwnode_handle *fwnode, | 1172 | static int |
1170 | const char *propname, | 1173 | acpi_fwnode_property_read_string_array(const struct fwnode_handle *fwnode, |
1171 | const char **val, size_t nval) | 1174 | const char *propname, const char **val, |
1175 | size_t nval) | ||
1172 | { | 1176 | { |
1173 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, | 1177 | return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING, |
1174 | val, nval); | 1178 | val, nval); |
1175 | } | 1179 | } |
1176 | 1180 | ||
1177 | static struct fwnode_handle * | 1181 | static struct fwnode_handle * |
1178 | acpi_fwnode_get_named_child_node(struct fwnode_handle *fwnode, | 1182 | acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode, |
1179 | const char *childname) | 1183 | const char *childname) |
1180 | { | 1184 | { |
1181 | struct fwnode_handle *child; | 1185 | struct fwnode_handle *child; |
@@ -1192,7 +1196,7 @@ acpi_fwnode_get_named_child_node(struct fwnode_handle *fwnode, | |||
1192 | } | 1196 | } |
1193 | 1197 | ||
1194 | static struct fwnode_handle * | 1198 | static struct fwnode_handle * |
1195 | acpi_fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 1199 | acpi_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
1196 | struct fwnode_handle *prev) | 1200 | struct fwnode_handle *prev) |
1197 | { | 1201 | { |
1198 | struct fwnode_handle *endpoint; | 1202 | struct fwnode_handle *endpoint; |
@@ -1205,7 +1209,7 @@ acpi_fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, | |||
1205 | } | 1209 | } |
1206 | 1210 | ||
1207 | static struct fwnode_handle * | 1211 | static struct fwnode_handle * |
1208 | acpi_fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode) | 1212 | acpi_fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode) |
1209 | { | 1213 | { |
1210 | struct fwnode_handle *endpoint = NULL; | 1214 | struct fwnode_handle *endpoint = NULL; |
1211 | 1215 | ||
@@ -1214,7 +1218,13 @@ acpi_fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode) | |||
1214 | return endpoint; | 1218 | return endpoint; |
1215 | } | 1219 | } |
1216 | 1220 | ||
1217 | static int acpi_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode, | 1221 | static struct fwnode_handle * |
1222 | acpi_fwnode_get_parent(struct fwnode_handle *fwnode) | ||
1223 | { | ||
1224 | return acpi_node_get_parent(fwnode); | ||
1225 | } | ||
1226 | |||
1227 | static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | ||
1218 | struct fwnode_endpoint *endpoint) | 1228 | struct fwnode_endpoint *endpoint) |
1219 | { | 1229 | { |
1220 | struct fwnode_handle *port_fwnode = fwnode_get_parent(fwnode); | 1230 | struct fwnode_handle *port_fwnode = fwnode_get_parent(fwnode); |
@@ -1242,7 +1252,7 @@ static int acpi_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode, | |||
1242 | acpi_fwnode_graph_get_next_endpoint, \ | 1252 | acpi_fwnode_graph_get_next_endpoint, \ |
1243 | .graph_get_remote_endpoint = \ | 1253 | .graph_get_remote_endpoint = \ |
1244 | acpi_fwnode_graph_get_remote_endpoint, \ | 1254 | acpi_fwnode_graph_get_remote_endpoint, \ |
1245 | .graph_get_port_parent = acpi_node_get_parent, \ | 1255 | .graph_get_port_parent = acpi_fwnode_get_parent, \ |
1246 | .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ | 1256 | .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ |
1247 | }; \ | 1257 | }; \ |
1248 | EXPORT_SYMBOL_GPL(ops) | 1258 | EXPORT_SYMBOL_GPL(ops) |
diff --git a/drivers/base/property.c b/drivers/base/property.c index 8fde824ad418..673e2353a2fb 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
@@ -193,18 +193,18 @@ struct fwnode_handle *dev_fwnode(struct device *dev) | |||
193 | } | 193 | } |
194 | EXPORT_SYMBOL_GPL(dev_fwnode); | 194 | EXPORT_SYMBOL_GPL(dev_fwnode); |
195 | 195 | ||
196 | static bool pset_fwnode_property_present(struct fwnode_handle *fwnode, | 196 | static bool pset_fwnode_property_present(const struct fwnode_handle *fwnode, |
197 | const char *propname) | 197 | const char *propname) |
198 | { | 198 | { |
199 | return !!pset_prop_get(to_pset_node(fwnode), propname); | 199 | return !!pset_prop_get(to_pset_node(fwnode), propname); |
200 | } | 200 | } |
201 | 201 | ||
202 | static int pset_fwnode_read_int_array(struct fwnode_handle *fwnode, | 202 | static int pset_fwnode_read_int_array(const struct fwnode_handle *fwnode, |
203 | const char *propname, | 203 | const char *propname, |
204 | unsigned int elem_size, void *val, | 204 | unsigned int elem_size, void *val, |
205 | size_t nval) | 205 | size_t nval) |
206 | { | 206 | { |
207 | struct property_set *node = to_pset_node(fwnode); | 207 | const struct property_set *node = to_pset_node(fwnode); |
208 | 208 | ||
209 | if (!val) | 209 | if (!val) |
210 | return pset_prop_count_elems_of_size(node, propname, elem_size); | 210 | return pset_prop_count_elems_of_size(node, propname, elem_size); |
@@ -223,9 +223,10 @@ static int pset_fwnode_read_int_array(struct fwnode_handle *fwnode, | |||
223 | return -ENXIO; | 223 | return -ENXIO; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int pset_fwnode_property_read_string_array(struct fwnode_handle *fwnode, | 226 | static int |
227 | const char *propname, | 227 | pset_fwnode_property_read_string_array(const struct fwnode_handle *fwnode, |
228 | const char **val, size_t nval) | 228 | const char *propname, |
229 | const char **val, size_t nval) | ||
229 | { | 230 | { |
230 | return pset_prop_read_string_array(to_pset_node(fwnode), propname, | 231 | return pset_prop_read_string_array(to_pset_node(fwnode), propname, |
231 | val, nval); | 232 | val, nval); |
@@ -255,7 +256,8 @@ EXPORT_SYMBOL_GPL(device_property_present); | |||
255 | * @fwnode: Firmware node whose property to check | 256 | * @fwnode: Firmware node whose property to check |
256 | * @propname: Name of the property | 257 | * @propname: Name of the property |
257 | */ | 258 | */ |
258 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname) | 259 | bool fwnode_property_present(const struct fwnode_handle *fwnode, |
260 | const char *propname) | ||
259 | { | 261 | { |
260 | bool ret; | 262 | bool ret; |
261 | 263 | ||
@@ -437,7 +439,7 @@ int device_property_match_string(struct device *dev, const char *propname, | |||
437 | } | 439 | } |
438 | EXPORT_SYMBOL_GPL(device_property_match_string); | 440 | EXPORT_SYMBOL_GPL(device_property_match_string); |
439 | 441 | ||
440 | static int fwnode_property_read_int_array(struct fwnode_handle *fwnode, | 442 | static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode, |
441 | const char *propname, | 443 | const char *propname, |
442 | unsigned int elem_size, void *val, | 444 | unsigned int elem_size, void *val, |
443 | size_t nval) | 445 | size_t nval) |
@@ -473,7 +475,7 @@ static int fwnode_property_read_int_array(struct fwnode_handle *fwnode, | |||
473 | * %-EOVERFLOW if the size of the property is not as expected, | 475 | * %-EOVERFLOW if the size of the property is not as expected, |
474 | * %-ENXIO if no suitable firmware interface is present. | 476 | * %-ENXIO if no suitable firmware interface is present. |
475 | */ | 477 | */ |
476 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, | 478 | int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, |
477 | const char *propname, u8 *val, size_t nval) | 479 | const char *propname, u8 *val, size_t nval) |
478 | { | 480 | { |
479 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u8), | 481 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u8), |
@@ -499,7 +501,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u8_array); | |||
499 | * %-EOVERFLOW if the size of the property is not as expected, | 501 | * %-EOVERFLOW if the size of the property is not as expected, |
500 | * %-ENXIO if no suitable firmware interface is present. | 502 | * %-ENXIO if no suitable firmware interface is present. |
501 | */ | 503 | */ |
502 | int fwnode_property_read_u16_array(struct fwnode_handle *fwnode, | 504 | int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode, |
503 | const char *propname, u16 *val, size_t nval) | 505 | const char *propname, u16 *val, size_t nval) |
504 | { | 506 | { |
505 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u16), | 507 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u16), |
@@ -525,7 +527,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u16_array); | |||
525 | * %-EOVERFLOW if the size of the property is not as expected, | 527 | * %-EOVERFLOW if the size of the property is not as expected, |
526 | * %-ENXIO if no suitable firmware interface is present. | 528 | * %-ENXIO if no suitable firmware interface is present. |
527 | */ | 529 | */ |
528 | int fwnode_property_read_u32_array(struct fwnode_handle *fwnode, | 530 | int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode, |
529 | const char *propname, u32 *val, size_t nval) | 531 | const char *propname, u32 *val, size_t nval) |
530 | { | 532 | { |
531 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u32), | 533 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u32), |
@@ -551,7 +553,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u32_array); | |||
551 | * %-EOVERFLOW if the size of the property is not as expected, | 553 | * %-EOVERFLOW if the size of the property is not as expected, |
552 | * %-ENXIO if no suitable firmware interface is present. | 554 | * %-ENXIO if no suitable firmware interface is present. |
553 | */ | 555 | */ |
554 | int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, | 556 | int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode, |
555 | const char *propname, u64 *val, size_t nval) | 557 | const char *propname, u64 *val, size_t nval) |
556 | { | 558 | { |
557 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u64), | 559 | return fwnode_property_read_int_array(fwnode, propname, sizeof(u64), |
@@ -577,7 +579,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_u64_array); | |||
577 | * %-EOVERFLOW if the size of the property is not as expected, | 579 | * %-EOVERFLOW if the size of the property is not as expected, |
578 | * %-ENXIO if no suitable firmware interface is present. | 580 | * %-ENXIO if no suitable firmware interface is present. |
579 | */ | 581 | */ |
580 | int fwnode_property_read_string_array(struct fwnode_handle *fwnode, | 582 | int fwnode_property_read_string_array(const struct fwnode_handle *fwnode, |
581 | const char *propname, const char **val, | 583 | const char *propname, const char **val, |
582 | size_t nval) | 584 | size_t nval) |
583 | { | 585 | { |
@@ -609,7 +611,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_string_array); | |||
609 | * %-EPROTO or %-EILSEQ if the property is not a string, | 611 | * %-EPROTO or %-EILSEQ if the property is not a string, |
610 | * %-ENXIO if no suitable firmware interface is present. | 612 | * %-ENXIO if no suitable firmware interface is present. |
611 | */ | 613 | */ |
612 | int fwnode_property_read_string(struct fwnode_handle *fwnode, | 614 | int fwnode_property_read_string(const struct fwnode_handle *fwnode, |
613 | const char *propname, const char **val) | 615 | const char *propname, const char **val) |
614 | { | 616 | { |
615 | int ret = fwnode_property_read_string_array(fwnode, propname, val, 1); | 617 | int ret = fwnode_property_read_string_array(fwnode, propname, val, 1); |
@@ -633,7 +635,7 @@ EXPORT_SYMBOL_GPL(fwnode_property_read_string); | |||
633 | * %-EPROTO if the property is not an array of strings, | 635 | * %-EPROTO if the property is not an array of strings, |
634 | * %-ENXIO if no suitable firmware interface is present. | 636 | * %-ENXIO if no suitable firmware interface is present. |
635 | */ | 637 | */ |
636 | int fwnode_property_match_string(struct fwnode_handle *fwnode, | 638 | int fwnode_property_match_string(const struct fwnode_handle *fwnode, |
637 | const char *propname, const char *string) | 639 | const char *propname, const char *string) |
638 | { | 640 | { |
639 | const char **values; | 641 | const char **values; |
@@ -940,7 +942,7 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_parent); | |||
940 | * Return parent firmware node of the given node if possible or %NULL if no | 942 | * Return parent firmware node of the given node if possible or %NULL if no |
941 | * parent was available. | 943 | * parent was available. |
942 | */ | 944 | */ |
943 | struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode) | 945 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode) |
944 | { | 946 | { |
945 | return fwnode_call_ptr_op(fwnode, get_parent); | 947 | return fwnode_call_ptr_op(fwnode, get_parent); |
946 | } | 948 | } |
@@ -951,8 +953,9 @@ EXPORT_SYMBOL_GPL(fwnode_get_parent); | |||
951 | * @fwnode: Firmware node to find the next child node for. | 953 | * @fwnode: Firmware node to find the next child node for. |
952 | * @child: Handle to one of the node's child nodes or a %NULL handle. | 954 | * @child: Handle to one of the node's child nodes or a %NULL handle. |
953 | */ | 955 | */ |
954 | struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode, | 956 | struct fwnode_handle * |
955 | struct fwnode_handle *child) | 957 | fwnode_get_next_child_node(const struct fwnode_handle *fwnode, |
958 | struct fwnode_handle *child) | ||
956 | { | 959 | { |
957 | return fwnode_call_ptr_op(fwnode, get_next_child_node, child); | 960 | return fwnode_call_ptr_op(fwnode, get_next_child_node, child); |
958 | } | 961 | } |
@@ -983,8 +986,9 @@ EXPORT_SYMBOL_GPL(device_get_next_child_node); | |||
983 | * @fwnode: Firmware node to find the named child node for. | 986 | * @fwnode: Firmware node to find the named child node for. |
984 | * @childname: String to match child node name against. | 987 | * @childname: String to match child node name against. |
985 | */ | 988 | */ |
986 | struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode, | 989 | struct fwnode_handle * |
987 | const char *childname) | 990 | fwnode_get_named_child_node(const struct fwnode_handle *fwnode, |
991 | const char *childname) | ||
988 | { | 992 | { |
989 | return fwnode_call_ptr_op(fwnode, get_named_child_node, childname); | 993 | return fwnode_call_ptr_op(fwnode, get_named_child_node, childname); |
990 | } | 994 | } |
@@ -1030,7 +1034,7 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put); | |||
1030 | * fwnode_device_is_available - check if a device is available for use | 1034 | * fwnode_device_is_available - check if a device is available for use |
1031 | * @fwnode: Pointer to the fwnode of the device. | 1035 | * @fwnode: Pointer to the fwnode of the device. |
1032 | */ | 1036 | */ |
1033 | bool fwnode_device_is_available(struct fwnode_handle *fwnode) | 1037 | bool fwnode_device_is_available(const struct fwnode_handle *fwnode) |
1034 | { | 1038 | { |
1035 | return fwnode_call_bool_op(fwnode, device_is_available); | 1039 | return fwnode_call_bool_op(fwnode, device_is_available); |
1036 | } | 1040 | } |
@@ -1168,7 +1172,7 @@ EXPORT_SYMBOL(device_get_mac_address); | |||
1168 | * are available. | 1172 | * are available. |
1169 | */ | 1173 | */ |
1170 | struct fwnode_handle * | 1174 | struct fwnode_handle * |
1171 | fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 1175 | fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
1172 | struct fwnode_handle *prev) | 1176 | struct fwnode_handle *prev) |
1173 | { | 1177 | { |
1174 | return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev); | 1178 | return fwnode_call_ptr_op(fwnode, graph_get_next_endpoint, prev); |
@@ -1182,7 +1186,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); | |||
1182 | * Return: the firmware node of the device the @endpoint belongs to. | 1186 | * Return: the firmware node of the device the @endpoint belongs to. |
1183 | */ | 1187 | */ |
1184 | struct fwnode_handle * | 1188 | struct fwnode_handle * |
1185 | fwnode_graph_get_port_parent(struct fwnode_handle *endpoint) | 1189 | fwnode_graph_get_port_parent(const struct fwnode_handle *endpoint) |
1186 | { | 1190 | { |
1187 | struct fwnode_handle *port, *parent; | 1191 | struct fwnode_handle *port, *parent; |
1188 | 1192 | ||
@@ -1202,7 +1206,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent); | |||
1202 | * Extracts firmware node of a remote device the @fwnode points to. | 1206 | * Extracts firmware node of a remote device the @fwnode points to. |
1203 | */ | 1207 | */ |
1204 | struct fwnode_handle * | 1208 | struct fwnode_handle * |
1205 | fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode) | 1209 | fwnode_graph_get_remote_port_parent(const struct fwnode_handle *fwnode) |
1206 | { | 1210 | { |
1207 | struct fwnode_handle *endpoint, *parent; | 1211 | struct fwnode_handle *endpoint, *parent; |
1208 | 1212 | ||
@@ -1221,7 +1225,8 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port_parent); | |||
1221 | * | 1225 | * |
1222 | * Extracts firmware node of a remote port the @fwnode points to. | 1226 | * Extracts firmware node of a remote port the @fwnode points to. |
1223 | */ | 1227 | */ |
1224 | struct fwnode_handle *fwnode_graph_get_remote_port(struct fwnode_handle *fwnode) | 1228 | struct fwnode_handle * |
1229 | fwnode_graph_get_remote_port(const struct fwnode_handle *fwnode) | ||
1225 | { | 1230 | { |
1226 | return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode)); | 1231 | return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode)); |
1227 | } | 1232 | } |
@@ -1234,7 +1239,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port); | |||
1234 | * Extracts firmware node of a remote endpoint the @fwnode points to. | 1239 | * Extracts firmware node of a remote endpoint the @fwnode points to. |
1235 | */ | 1240 | */ |
1236 | struct fwnode_handle * | 1241 | struct fwnode_handle * |
1237 | fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode) | 1242 | fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode) |
1238 | { | 1243 | { |
1239 | return fwnode_call_ptr_op(fwnode, graph_get_remote_endpoint); | 1244 | return fwnode_call_ptr_op(fwnode, graph_get_remote_endpoint); |
1240 | } | 1245 | } |
@@ -1249,8 +1254,9 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_endpoint); | |||
1249 | * Return: Remote fwnode handle associated with remote endpoint node linked | 1254 | * Return: Remote fwnode handle associated with remote endpoint node linked |
1250 | * to @node. Use fwnode_node_put() on it when done. | 1255 | * to @node. Use fwnode_node_put() on it when done. |
1251 | */ | 1256 | */ |
1252 | struct fwnode_handle *fwnode_graph_get_remote_node(struct fwnode_handle *fwnode, | 1257 | struct fwnode_handle * |
1253 | u32 port_id, u32 endpoint_id) | 1258 | fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port_id, |
1259 | u32 endpoint_id) | ||
1254 | { | 1260 | { |
1255 | struct fwnode_handle *endpoint = NULL; | 1261 | struct fwnode_handle *endpoint = NULL; |
1256 | 1262 | ||
@@ -1286,7 +1292,7 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_node); | |||
1286 | * information in @endpoint. The caller must hold a reference to | 1292 | * information in @endpoint. The caller must hold a reference to |
1287 | * @fwnode. | 1293 | * @fwnode. |
1288 | */ | 1294 | */ |
1289 | int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode, | 1295 | int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, |
1290 | struct fwnode_endpoint *endpoint) | 1296 | struct fwnode_endpoint *endpoint) |
1291 | { | 1297 | { |
1292 | memset(endpoint, 0, sizeof(*endpoint)); | 1298 | memset(endpoint, 0, sizeof(*endpoint)); |
diff --git a/drivers/of/property.c b/drivers/of/property.c index 2d5988820405..ae46a6f0ea36 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c | |||
@@ -815,23 +815,23 @@ static void of_fwnode_put(struct fwnode_handle *fwnode) | |||
815 | of_node_put(to_of_node(fwnode)); | 815 | of_node_put(to_of_node(fwnode)); |
816 | } | 816 | } |
817 | 817 | ||
818 | static bool of_fwnode_device_is_available(struct fwnode_handle *fwnode) | 818 | static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode) |
819 | { | 819 | { |
820 | return of_device_is_available(to_of_node(fwnode)); | 820 | return of_device_is_available(to_of_node(fwnode)); |
821 | } | 821 | } |
822 | 822 | ||
823 | static bool of_fwnode_property_present(struct fwnode_handle *fwnode, | 823 | static bool of_fwnode_property_present(const struct fwnode_handle *fwnode, |
824 | const char *propname) | 824 | const char *propname) |
825 | { | 825 | { |
826 | return of_property_read_bool(to_of_node(fwnode), propname); | 826 | return of_property_read_bool(to_of_node(fwnode), propname); |
827 | } | 827 | } |
828 | 828 | ||
829 | static int of_fwnode_property_read_int_array(struct fwnode_handle *fwnode, | 829 | static int of_fwnode_property_read_int_array(const struct fwnode_handle *fwnode, |
830 | const char *propname, | 830 | const char *propname, |
831 | unsigned int elem_size, void *val, | 831 | unsigned int elem_size, void *val, |
832 | size_t nval) | 832 | size_t nval) |
833 | { | 833 | { |
834 | struct device_node *node = to_of_node(fwnode); | 834 | const struct device_node *node = to_of_node(fwnode); |
835 | 835 | ||
836 | if (!val) | 836 | if (!val) |
837 | return of_property_count_elems_of_size(node, propname, | 837 | return of_property_count_elems_of_size(node, propname, |
@@ -851,24 +851,26 @@ static int of_fwnode_property_read_int_array(struct fwnode_handle *fwnode, | |||
851 | return -ENXIO; | 851 | return -ENXIO; |
852 | } | 852 | } |
853 | 853 | ||
854 | static int of_fwnode_property_read_string_array(struct fwnode_handle *fwnode, | 854 | static int |
855 | const char *propname, | 855 | of_fwnode_property_read_string_array(const struct fwnode_handle *fwnode, |
856 | const char **val, size_t nval) | 856 | const char *propname, const char **val, |
857 | size_t nval) | ||
857 | { | 858 | { |
858 | struct device_node *node = to_of_node(fwnode); | 859 | const struct device_node *node = to_of_node(fwnode); |
859 | 860 | ||
860 | return val ? | 861 | return val ? |
861 | of_property_read_string_array(node, propname, val, nval) : | 862 | of_property_read_string_array(node, propname, val, nval) : |
862 | of_property_count_strings(node, propname); | 863 | of_property_count_strings(node, propname); |
863 | } | 864 | } |
864 | 865 | ||
865 | static struct fwnode_handle *of_fwnode_get_parent(struct fwnode_handle *fwnode) | 866 | static struct fwnode_handle * |
867 | of_fwnode_get_parent(const struct fwnode_handle *fwnode) | ||
866 | { | 868 | { |
867 | return of_fwnode_handle(of_get_parent(to_of_node(fwnode))); | 869 | return of_fwnode_handle(of_get_parent(to_of_node(fwnode))); |
868 | } | 870 | } |
869 | 871 | ||
870 | static struct fwnode_handle * | 872 | static struct fwnode_handle * |
871 | of_fwnode_get_next_child_node(struct fwnode_handle *fwnode, | 873 | of_fwnode_get_next_child_node(const struct fwnode_handle *fwnode, |
872 | struct fwnode_handle *child) | 874 | struct fwnode_handle *child) |
873 | { | 875 | { |
874 | return of_fwnode_handle(of_get_next_available_child(to_of_node(fwnode), | 876 | return of_fwnode_handle(of_get_next_available_child(to_of_node(fwnode), |
@@ -876,10 +878,10 @@ of_fwnode_get_next_child_node(struct fwnode_handle *fwnode, | |||
876 | } | 878 | } |
877 | 879 | ||
878 | static struct fwnode_handle * | 880 | static struct fwnode_handle * |
879 | of_fwnode_get_named_child_node(struct fwnode_handle *fwnode, | 881 | of_fwnode_get_named_child_node(const struct fwnode_handle *fwnode, |
880 | const char *childname) | 882 | const char *childname) |
881 | { | 883 | { |
882 | struct device_node *node = to_of_node(fwnode); | 884 | const struct device_node *node = to_of_node(fwnode); |
883 | struct device_node *child; | 885 | struct device_node *child; |
884 | 886 | ||
885 | for_each_available_child_of_node(node, child) | 887 | for_each_available_child_of_node(node, child) |
@@ -890,7 +892,7 @@ of_fwnode_get_named_child_node(struct fwnode_handle *fwnode, | |||
890 | } | 892 | } |
891 | 893 | ||
892 | static struct fwnode_handle * | 894 | static struct fwnode_handle * |
893 | of_fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 895 | of_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
894 | struct fwnode_handle *prev) | 896 | struct fwnode_handle *prev) |
895 | { | 897 | { |
896 | return of_fwnode_handle(of_graph_get_next_endpoint(to_of_node(fwnode), | 898 | return of_fwnode_handle(of_graph_get_next_endpoint(to_of_node(fwnode), |
@@ -898,7 +900,7 @@ of_fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode, | |||
898 | } | 900 | } |
899 | 901 | ||
900 | static struct fwnode_handle * | 902 | static struct fwnode_handle * |
901 | of_fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode) | 903 | of_fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode) |
902 | { | 904 | { |
903 | return of_fwnode_handle(of_parse_phandle(to_of_node(fwnode), | 905 | return of_fwnode_handle(of_parse_phandle(to_of_node(fwnode), |
904 | "remote-endpoint", 0)); | 906 | "remote-endpoint", 0)); |
@@ -921,10 +923,10 @@ of_fwnode_graph_get_port_parent(struct fwnode_handle *fwnode) | |||
921 | return of_fwnode_handle(of_get_next_parent(np)); | 923 | return of_fwnode_handle(of_get_next_parent(np)); |
922 | } | 924 | } |
923 | 925 | ||
924 | static int of_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode, | 926 | static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, |
925 | struct fwnode_endpoint *endpoint) | 927 | struct fwnode_endpoint *endpoint) |
926 | { | 928 | { |
927 | struct device_node *node = to_of_node(fwnode); | 929 | const struct device_node *node = to_of_node(fwnode); |
928 | struct device_node *port_node = of_get_parent(node); | 930 | struct device_node *port_node = of_get_parent(node); |
929 | 931 | ||
930 | endpoint->local_fwnode = fwnode; | 932 | endpoint->local_fwnode = fwnode; |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4d9fb610f114..8b9edf87b98d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -1029,13 +1029,14 @@ int acpi_node_prop_read(const struct fwnode_handle *fwnode, | |||
1029 | int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, | 1029 | int acpi_dev_prop_read(const struct acpi_device *adev, const char *propname, |
1030 | enum dev_prop_type proptype, void *val, size_t nval); | 1030 | enum dev_prop_type proptype, void *val, size_t nval); |
1031 | 1031 | ||
1032 | struct fwnode_handle *acpi_get_next_subnode(struct fwnode_handle *fwnode, | 1032 | struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, |
1033 | struct fwnode_handle *child); | 1033 | struct fwnode_handle *child); |
1034 | struct fwnode_handle *acpi_node_get_parent(struct fwnode_handle *fwnode); | 1034 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); |
1035 | 1035 | ||
1036 | struct fwnode_handle *acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 1036 | struct fwnode_handle * |
1037 | struct fwnode_handle *prev); | 1037 | acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
1038 | int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode, | 1038 | struct fwnode_handle *prev); |
1039 | int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode, | ||
1039 | struct fwnode_handle **remote, | 1040 | struct fwnode_handle **remote, |
1040 | struct fwnode_handle **port, | 1041 | struct fwnode_handle **port, |
1041 | struct fwnode_handle **endpoint); | 1042 | struct fwnode_handle **endpoint); |
@@ -1157,26 +1158,27 @@ static inline int acpi_dev_prop_read(const struct acpi_device *adev, | |||
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | static inline struct fwnode_handle * | 1160 | static inline struct fwnode_handle * |
1160 | acpi_get_next_subnode(struct fwnode_handle *fwnode, struct fwnode_handle *child) | 1161 | acpi_get_next_subnode(const struct fwnode_handle *fwnode, |
1162 | struct fwnode_handle *child) | ||
1161 | { | 1163 | { |
1162 | return NULL; | 1164 | return NULL; |
1163 | } | 1165 | } |
1164 | 1166 | ||
1165 | static inline struct fwnode_handle * | 1167 | static inline struct fwnode_handle * |
1166 | acpi_node_get_parent(struct fwnode_handle *fwnode) | 1168 | acpi_node_get_parent(const struct fwnode_handle *fwnode) |
1167 | { | 1169 | { |
1168 | return NULL; | 1170 | return NULL; |
1169 | } | 1171 | } |
1170 | 1172 | ||
1171 | static inline struct fwnode_handle * | 1173 | static inline struct fwnode_handle * |
1172 | acpi_graph_get_next_endpoint(struct fwnode_handle *fwnode, | 1174 | acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode, |
1173 | struct fwnode_handle *prev) | 1175 | struct fwnode_handle *prev) |
1174 | { | 1176 | { |
1175 | return ERR_PTR(-ENXIO); | 1177 | return ERR_PTR(-ENXIO); |
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | static inline int | 1180 | static inline int |
1179 | acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode, | 1181 | acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode, |
1180 | struct fwnode_handle **remote, | 1182 | struct fwnode_handle **remote, |
1181 | struct fwnode_handle **port, | 1183 | struct fwnode_handle **port, |
1182 | struct fwnode_handle **endpoint) | 1184 | struct fwnode_handle **endpoint) |
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index c5dbc48b55dd..7b50ee4edcfc 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h | |||
@@ -55,30 +55,32 @@ struct fwnode_endpoint { | |||
55 | struct fwnode_operations { | 55 | struct fwnode_operations { |
56 | void (*get)(struct fwnode_handle *fwnode); | 56 | void (*get)(struct fwnode_handle *fwnode); |
57 | void (*put)(struct fwnode_handle *fwnode); | 57 | void (*put)(struct fwnode_handle *fwnode); |
58 | bool (*device_is_available)(struct fwnode_handle *fwnode); | 58 | bool (*device_is_available)(const struct fwnode_handle *fwnode); |
59 | bool (*property_present)(struct fwnode_handle *fwnode, | 59 | bool (*property_present)(const struct fwnode_handle *fwnode, |
60 | const char *propname); | 60 | const char *propname); |
61 | int (*property_read_int_array)(struct fwnode_handle *fwnode, | 61 | int (*property_read_int_array)(const struct fwnode_handle *fwnode, |
62 | const char *propname, | 62 | const char *propname, |
63 | unsigned int elem_size, void *val, | 63 | unsigned int elem_size, void *val, |
64 | size_t nval); | 64 | size_t nval); |
65 | int (*property_read_string_array)(struct fwnode_handle *fwnode_handle, | 65 | int |
66 | const char *propname, | 66 | (*property_read_string_array)(const struct fwnode_handle *fwnode_handle, |
67 | const char **val, size_t nval); | 67 | const char *propname, const char **val, |
68 | struct fwnode_handle *(*get_parent)(struct fwnode_handle *fwnode); | 68 | size_t nval); |
69 | struct fwnode_handle *(*get_parent)(const struct fwnode_handle *fwnode); | ||
69 | struct fwnode_handle * | 70 | struct fwnode_handle * |
70 | (*get_next_child_node)(struct fwnode_handle *fwnode, | 71 | (*get_next_child_node)(const struct fwnode_handle *fwnode, |
71 | struct fwnode_handle *child); | 72 | struct fwnode_handle *child); |
72 | struct fwnode_handle * | 73 | struct fwnode_handle * |
73 | (*get_named_child_node)(struct fwnode_handle *fwnode, const char *name); | 74 | (*get_named_child_node)(const struct fwnode_handle *fwnode, |
75 | const char *name); | ||
74 | struct fwnode_handle * | 76 | struct fwnode_handle * |
75 | (*graph_get_next_endpoint)(struct fwnode_handle *fwnode, | 77 | (*graph_get_next_endpoint)(const struct fwnode_handle *fwnode, |
76 | struct fwnode_handle *prev); | 78 | struct fwnode_handle *prev); |
77 | struct fwnode_handle * | 79 | struct fwnode_handle * |
78 | (*graph_get_remote_endpoint)(struct fwnode_handle *fwnode); | 80 | (*graph_get_remote_endpoint)(const struct fwnode_handle *fwnode); |
79 | struct fwnode_handle * | 81 | struct fwnode_handle * |
80 | (*graph_get_port_parent)(struct fwnode_handle *fwnode); | 82 | (*graph_get_port_parent)(struct fwnode_handle *fwnode); |
81 | int (*graph_parse_endpoint)(struct fwnode_handle *fwnode, | 83 | int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, |
82 | struct fwnode_endpoint *endpoint); | 84 | struct fwnode_endpoint *endpoint); |
83 | }; | 85 | }; |
84 | 86 | ||
diff --git a/include/linux/property.h b/include/linux/property.h index 7e77039e6b81..edff3f89e755 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -51,46 +51,48 @@ int device_property_read_string(struct device *dev, const char *propname, | |||
51 | int device_property_match_string(struct device *dev, | 51 | int device_property_match_string(struct device *dev, |
52 | const char *propname, const char *string); | 52 | const char *propname, const char *string); |
53 | 53 | ||
54 | bool fwnode_device_is_available(struct fwnode_handle *fwnode); | 54 | bool fwnode_device_is_available(const struct fwnode_handle *fwnode); |
55 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); | 55 | bool fwnode_property_present(const struct fwnode_handle *fwnode, |
56 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, | 56 | const char *propname); |
57 | int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, | ||
57 | const char *propname, u8 *val, | 58 | const char *propname, u8 *val, |
58 | size_t nval); | 59 | size_t nval); |
59 | int fwnode_property_read_u16_array(struct fwnode_handle *fwnode, | 60 | int fwnode_property_read_u16_array(const struct fwnode_handle *fwnode, |
60 | const char *propname, u16 *val, | 61 | const char *propname, u16 *val, |
61 | size_t nval); | 62 | size_t nval); |
62 | int fwnode_property_read_u32_array(struct fwnode_handle *fwnode, | 63 | int fwnode_property_read_u32_array(const struct fwnode_handle *fwnode, |
63 | const char *propname, u32 *val, | 64 | const char *propname, u32 *val, |
64 | size_t nval); | 65 | size_t nval); |
65 | int fwnode_property_read_u64_array(struct fwnode_handle *fwnode, | 66 | int fwnode_property_read_u64_array(const struct fwnode_handle *fwnode, |
66 | const char *propname, u64 *val, | 67 | const char *propname, u64 *val, |
67 | size_t nval); | 68 | size_t nval); |
68 | int fwnode_property_read_string_array(struct fwnode_handle *fwnode, | 69 | int fwnode_property_read_string_array(const struct fwnode_handle *fwnode, |
69 | const char *propname, const char **val, | 70 | const char *propname, const char **val, |
70 | size_t nval); | 71 | size_t nval); |
71 | int fwnode_property_read_string(struct fwnode_handle *fwnode, | 72 | int fwnode_property_read_string(const struct fwnode_handle *fwnode, |
72 | const char *propname, const char **val); | 73 | const char *propname, const char **val); |
73 | int fwnode_property_match_string(struct fwnode_handle *fwnode, | 74 | int fwnode_property_match_string(const struct fwnode_handle *fwnode, |
74 | const char *propname, const char *string); | 75 | const char *propname, const char *string); |
75 | 76 | ||
76 | struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode); | 77 | struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode); |
77 | struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode); | 78 | struct fwnode_handle *fwnode_get_next_parent( |
78 | struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode, | 79 | struct fwnode_handle *fwnode); |
79 | struct fwnode_handle *child); | 80 | struct fwnode_handle *fwnode_get_next_child_node( |
81 | const struct fwnode_handle *fwnode, struct fwnode_handle *child); | ||
80 | 82 | ||
81 | #define fwnode_for_each_child_node(fwnode, child) \ | 83 | #define fwnode_for_each_child_node(fwnode, child) \ |
82 | for (child = fwnode_get_next_child_node(fwnode, NULL); child; \ | 84 | for (child = fwnode_get_next_child_node(fwnode, NULL); child; \ |
83 | child = fwnode_get_next_child_node(fwnode, child)) | 85 | child = fwnode_get_next_child_node(fwnode, child)) |
84 | 86 | ||
85 | struct fwnode_handle *device_get_next_child_node(struct device *dev, | 87 | struct fwnode_handle *device_get_next_child_node( |
86 | struct fwnode_handle *child); | 88 | struct device *dev, struct fwnode_handle *child); |
87 | 89 | ||
88 | #define device_for_each_child_node(dev, child) \ | 90 | #define device_for_each_child_node(dev, child) \ |
89 | for (child = device_get_next_child_node(dev, NULL); child; \ | 91 | for (child = device_get_next_child_node(dev, NULL); child; \ |
90 | child = device_get_next_child_node(dev, child)) | 92 | child = device_get_next_child_node(dev, child)) |
91 | 93 | ||
92 | struct fwnode_handle *fwnode_get_named_child_node(struct fwnode_handle *fwnode, | 94 | struct fwnode_handle *fwnode_get_named_child_node( |
93 | const char *childname); | 95 | const struct fwnode_handle *fwnode, const char *childname); |
94 | struct fwnode_handle *device_get_named_child_node(struct device *dev, | 96 | struct fwnode_handle *device_get_named_child_node(struct device *dev, |
95 | const char *childname); | 97 | const char *childname); |
96 | 98 | ||
@@ -129,31 +131,31 @@ static inline int device_property_read_u64(struct device *dev, | |||
129 | return device_property_read_u64_array(dev, propname, val, 1); | 131 | return device_property_read_u64_array(dev, propname, val, 1); |
130 | } | 132 | } |
131 | 133 | ||
132 | static inline bool fwnode_property_read_bool(struct fwnode_handle *fwnode, | 134 | static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode, |
133 | const char *propname) | 135 | const char *propname) |
134 | { | 136 | { |
135 | return fwnode_property_present(fwnode, propname); | 137 | return fwnode_property_present(fwnode, propname); |
136 | } | 138 | } |
137 | 139 | ||
138 | static inline int fwnode_property_read_u8(struct fwnode_handle *fwnode, | 140 | static inline int fwnode_property_read_u8(const struct fwnode_handle *fwnode, |
139 | const char *propname, u8 *val) | 141 | const char *propname, u8 *val) |
140 | { | 142 | { |
141 | return fwnode_property_read_u8_array(fwnode, propname, val, 1); | 143 | return fwnode_property_read_u8_array(fwnode, propname, val, 1); |
142 | } | 144 | } |
143 | 145 | ||
144 | static inline int fwnode_property_read_u16(struct fwnode_handle *fwnode, | 146 | static inline int fwnode_property_read_u16(const struct fwnode_handle *fwnode, |
145 | const char *propname, u16 *val) | 147 | const char *propname, u16 *val) |
146 | { | 148 | { |
147 | return fwnode_property_read_u16_array(fwnode, propname, val, 1); | 149 | return fwnode_property_read_u16_array(fwnode, propname, val, 1); |
148 | } | 150 | } |
149 | 151 | ||
150 | static inline int fwnode_property_read_u32(struct fwnode_handle *fwnode, | 152 | static inline int fwnode_property_read_u32(const struct fwnode_handle *fwnode, |
151 | const char *propname, u32 *val) | 153 | const char *propname, u32 *val) |
152 | { | 154 | { |
153 | return fwnode_property_read_u32_array(fwnode, propname, val, 1); | 155 | return fwnode_property_read_u32_array(fwnode, propname, val, 1); |
154 | } | 156 | } |
155 | 157 | ||
156 | static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, | 158 | static inline int fwnode_property_read_u64(const struct fwnode_handle *fwnode, |
157 | const char *propname, u64 *val) | 159 | const char *propname, u64 *val) |
158 | { | 160 | { |
159 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); | 161 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); |
@@ -274,19 +276,20 @@ int device_get_phy_mode(struct device *dev); | |||
274 | void *device_get_mac_address(struct device *dev, char *addr, int alen); | 276 | void *device_get_mac_address(struct device *dev, char *addr, int alen); |
275 | 277 | ||
276 | struct fwnode_handle *fwnode_graph_get_next_endpoint( | 278 | struct fwnode_handle *fwnode_graph_get_next_endpoint( |
277 | struct fwnode_handle *fwnode, struct fwnode_handle *prev); | 279 | const struct fwnode_handle *fwnode, struct fwnode_handle *prev); |
278 | struct fwnode_handle * | 280 | struct fwnode_handle * |
279 | fwnode_graph_get_port_parent(struct fwnode_handle *fwnode); | 281 | fwnode_graph_get_port_parent(const struct fwnode_handle *fwnode); |
280 | struct fwnode_handle *fwnode_graph_get_remote_port_parent( | 282 | struct fwnode_handle *fwnode_graph_get_remote_port_parent( |
281 | struct fwnode_handle *fwnode); | 283 | const struct fwnode_handle *fwnode); |
282 | struct fwnode_handle *fwnode_graph_get_remote_port( | 284 | struct fwnode_handle *fwnode_graph_get_remote_port( |
283 | struct fwnode_handle *fwnode); | 285 | const struct fwnode_handle *fwnode); |
284 | struct fwnode_handle *fwnode_graph_get_remote_endpoint( | 286 | struct fwnode_handle *fwnode_graph_get_remote_endpoint( |
285 | struct fwnode_handle *fwnode); | 287 | const struct fwnode_handle *fwnode); |
286 | struct fwnode_handle *fwnode_graph_get_remote_node(struct fwnode_handle *fwnode, | 288 | struct fwnode_handle * |
287 | u32 port, u32 endpoint); | 289 | fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port, |
290 | u32 endpoint); | ||
288 | 291 | ||
289 | int fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode, | 292 | int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, |
290 | struct fwnode_endpoint *endpoint); | 293 | struct fwnode_endpoint *endpoint); |
291 | 294 | ||
292 | #endif /* _LINUX_PROPERTY_H_ */ | 295 | #endif /* _LINUX_PROPERTY_H_ */ |