diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/of/base.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index ab32561117c1..ef2f1d0dd80a 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
| @@ -1080,30 +1080,6 @@ int of_property_count_strings(struct device_node *np, const char *propname) | |||
| 1080 | } | 1080 | } |
| 1081 | EXPORT_SYMBOL_GPL(of_property_count_strings); | 1081 | EXPORT_SYMBOL_GPL(of_property_count_strings); |
| 1082 | 1082 | ||
| 1083 | /** | ||
| 1084 | * of_parse_phandle - Resolve a phandle property to a device_node pointer | ||
| 1085 | * @np: Pointer to device node holding phandle property | ||
| 1086 | * @phandle_name: Name of property holding a phandle value | ||
| 1087 | * @index: For properties holding a table of phandles, this is the index into | ||
| 1088 | * the table | ||
| 1089 | * | ||
| 1090 | * Returns the device_node pointer with refcount incremented. Use | ||
| 1091 | * of_node_put() on it when done. | ||
| 1092 | */ | ||
| 1093 | struct device_node *of_parse_phandle(const struct device_node *np, | ||
| 1094 | const char *phandle_name, int index) | ||
| 1095 | { | ||
| 1096 | const __be32 *phandle; | ||
| 1097 | int size; | ||
| 1098 | |||
| 1099 | phandle = of_get_property(np, phandle_name, &size); | ||
| 1100 | if ((!phandle) || (size < sizeof(*phandle) * (index + 1))) | ||
| 1101 | return NULL; | ||
| 1102 | |||
| 1103 | return of_find_node_by_phandle(be32_to_cpup(phandle + index)); | ||
| 1104 | } | ||
| 1105 | EXPORT_SYMBOL(of_parse_phandle); | ||
| 1106 | |||
| 1107 | static int __of_parse_phandle_with_args(const struct device_node *np, | 1083 | static int __of_parse_phandle_with_args(const struct device_node *np, |
| 1108 | const char *list_name, | 1084 | const char *list_name, |
| 1109 | const char *cells_name, int index, | 1085 | const char *cells_name, int index, |
| @@ -1207,6 +1183,30 @@ static int __of_parse_phandle_with_args(const struct device_node *np, | |||
| 1207 | } | 1183 | } |
| 1208 | 1184 | ||
| 1209 | /** | 1185 | /** |
| 1186 | * of_parse_phandle - Resolve a phandle property to a device_node pointer | ||
| 1187 | * @np: Pointer to device node holding phandle property | ||
| 1188 | * @phandle_name: Name of property holding a phandle value | ||
| 1189 | * @index: For properties holding a table of phandles, this is the index into | ||
| 1190 | * the table | ||
| 1191 | * | ||
| 1192 | * Returns the device_node pointer with refcount incremented. Use | ||
| 1193 | * of_node_put() on it when done. | ||
| 1194 | */ | ||
| 1195 | struct device_node *of_parse_phandle(const struct device_node *np, | ||
| 1196 | const char *phandle_name, int index) | ||
| 1197 | { | ||
| 1198 | const __be32 *phandle; | ||
| 1199 | int size; | ||
| 1200 | |||
| 1201 | phandle = of_get_property(np, phandle_name, &size); | ||
| 1202 | if ((!phandle) || (size < sizeof(*phandle) * (index + 1))) | ||
| 1203 | return NULL; | ||
| 1204 | |||
| 1205 | return of_find_node_by_phandle(be32_to_cpup(phandle + index)); | ||
| 1206 | } | ||
| 1207 | EXPORT_SYMBOL(of_parse_phandle); | ||
| 1208 | |||
| 1209 | /** | ||
| 1210 | * of_parse_phandle_with_args() - Find a node pointed by phandle in a list | 1210 | * of_parse_phandle_with_args() - Find a node pointed by phandle in a list |
| 1211 | * @np: pointer to a device tree node containing a list | 1211 | * @np: pointer to a device tree node containing a list |
| 1212 | * @list_name: property name that contains a list | 1212 | * @list_name: property name that contains a list |
