瀏覽代碼

gpio: devres: Use global array of gpio suffixes

We have already a global array of possible GPIO suffixes. Use it here instead
of another copy of them.

Unfortunately this will not reduce the memory footprint, though allows to easy
maintain list in only one place.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Andy Shevchenko 8 年之前
父節點
當前提交
200d0177b4
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      drivers/gpio/devres.c

+ 5 - 4
drivers/gpio/devres.c

@@ -21,6 +21,8 @@
 #include <linux/device.h>
 #include <linux/device.h>
 #include <linux/gfp.h>
 #include <linux/gfp.h>
 
 
+#include "gpiolib.h"
+
 static void devm_gpiod_release(struct device *dev, void *res)
 static void devm_gpiod_release(struct device *dev, void *res)
 {
 {
 	struct gpio_desc **desc = res;
 	struct gpio_desc **desc = res;
@@ -135,7 +137,6 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
 					    const char *con_id,
 					    const char *con_id,
 					    struct fwnode_handle *child)
 					    struct fwnode_handle *child)
 {
 {
-	static const char * const suffixes[] = { "gpios", "gpio" };
 	char prop_name[32]; /* 32 is max size of property name */
 	char prop_name[32]; /* 32 is max size of property name */
 	struct gpio_desc **dr;
 	struct gpio_desc **dr;
 	struct gpio_desc *desc;
 	struct gpio_desc *desc;
@@ -146,13 +147,13 @@ struct gpio_desc *devm_get_gpiod_from_child(struct device *dev,
 	if (!dr)
 	if (!dr)
 		return ERR_PTR(-ENOMEM);
 		return ERR_PTR(-ENOMEM);
 
 
-	for (i = 0; i < ARRAY_SIZE(suffixes); i++) {
+	for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
 		if (con_id)
 		if (con_id)
 			snprintf(prop_name, sizeof(prop_name), "%s-%s",
 			snprintf(prop_name, sizeof(prop_name), "%s-%s",
-					    con_id, suffixes[i]);
+					    con_id, gpio_suffixes[i]);
 		else
 		else
 			snprintf(prop_name, sizeof(prop_name), "%s",
 			snprintf(prop_name, sizeof(prop_name), "%s",
-							       suffixes[i]);
+					    gpio_suffixes[i]);
 
 
 		desc = fwnode_get_named_gpiod(child, prop_name);
 		desc = fwnode_get_named_gpiod(child, prop_name);
 		if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
 		if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))