This introduces fwnode_gpiod_get_index() that iterates through common gpio suffixes when trying to locate a GPIO within a given firmware node. We also switch devm_fwnode_gpiod_get_index() to call fwnode_gpiod_get_index() instead of iterating through GPIO suffixes on its own.
Showing the changes to include/linux/gpio (1 of 3 files). Show all
Unified · Split
| @@ -176,6 +176,10 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · 175 unmodified lines | |||
| 176 | const char *propname, int index, | 176 | const char *propname, int index, |
| 177 | enum gpiod_flags dflags, | 177 | enum gpiod_flags dflags, |
| 178 | const char *label); | 178 | const char *label); |
| 179 | struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, | ||
| 180 | const char *con_id, int index, | ||
| 181 | enum gpiod_flags flags, | ||
| 182 | const char *label); | ||
| 179 | struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, | 183 | struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, |
| 180 | struct fwnode_handle *child, | 184 | struct fwnode_handle *child, |
| 181 | const char *con_id, int index, | 185 | const char *con_id, int index, |
| @@ -531,6 +535,15 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, · 349 unmodified lines | |||
| 531 | return ERR_PTR(-ENOSYS); | 535 | return ERR_PTR(-ENOSYS); |
| 532 | } | 536 | } |
| 533 | 537 | ||
| 538 | static inline | ||
| 539 | struct gpio_desc *fwnode_gpiod_get_index(struct fwnode_handle *fwnode, | ||
| 540 | const char *con_id, int index, | ||
| 541 | enum gpiod_flags flags, | ||
| 542 | const char *label) | ||
| 543 | { | ||
| 544 | return ERR_PTR(-ENOSYS); | ||
| 545 | } | ||
| 546 | |||
| 534 | static inline | 547 | static inline |
| 535 | struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, | 548 | struct gpio_desc *devm_fwnode_gpiod_get_index(struct device *dev, |
| 536 | struct fwnode_handle *fwnode, | 549 | struct fwnode_handle *fwnode, |