diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4e10b10d3ddd..d8938b9b794a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1308,6 +1308,18 @@ struct gpio_chip *gpiochip_find(void *data, | |||
1308 | } | 1308 | } |
1309 | EXPORT_SYMBOL_GPL(gpiochip_find); | 1309 | EXPORT_SYMBOL_GPL(gpiochip_find); |
1310 | 1310 | ||
1311 | static int gpiochip_match_name(struct gpio_chip *chip, void *data) | ||
1312 | { | ||
1313 | const char *name = data; | ||
1314 | |||
1315 | return !strcmp(chip->label, name); | ||
1316 | } | ||
1317 | |||
1318 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
1319 | { | ||
1320 | return gpiochip_find((void *)name, gpiochip_match_name); | ||
1321 | } | ||
1322 | |||
1311 | #ifdef CONFIG_PINCTRL | 1323 | #ifdef CONFIG_PINCTRL |
1312 | 1324 | ||
1313 | /** | 1325 | /** |
@@ -2260,23 +2272,6 @@ void gpiod_add_table(struct gpiod_lookup *table, size_t size) | |||
2260 | mutex_unlock(&gpio_lookup_lock); | 2272 | mutex_unlock(&gpio_lookup_lock); |
2261 | } | 2273 | } |
2262 | 2274 | ||
2263 | /* | ||
2264 | * Caller must have a acquired gpio_lookup_lock | ||
2265 | */ | ||
2266 | static struct gpio_chip *find_chip_by_name(const char *name) | ||
2267 | { | ||
2268 | struct gpio_chip *chip = NULL; | ||
2269 | |||
2270 | list_for_each_entry(chip, &gpio_lookup_list, list) { | ||
2271 | if (chip->label == NULL) | ||
2272 | continue; | ||
2273 | if (!strcmp(chip->label, name)) | ||
2274 | break; | ||
2275 | } | ||
2276 | |||
2277 | return chip; | ||
2278 | } | ||
2279 | |||
2280 | #ifdef CONFIG_OF | 2275 | #ifdef CONFIG_OF |
2281 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, | 2276 | static struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, |
2282 | unsigned int idx, unsigned long *flags) | 2277 | unsigned int idx, unsigned long *flags) |