]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/gpio/gpiolib-of.c
Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
[karo-tx-linux.git] / drivers / gpio / gpiolib-of.c
index d542a141811a00b2f49589ba8db583b7b30c0ac0..5150df6cba0815623c9fc7c86e96ff2ad099f0ed 100644 (file)
@@ -88,41 +88,6 @@ int of_get_named_gpio_flags(struct device_node *np, const char *propname,
 }
 EXPORT_SYMBOL(of_get_named_gpio_flags);
 
-/**
- * of_gpio_named_count - Count GPIOs for a device
- * @np:                device node to count GPIOs for
- * @propname:  property name containing gpio specifier(s)
- *
- * The function returns the count of GPIOs specified for a node.
- *
- * Note that the empty GPIO specifiers counts too. For example,
- *
- * gpios = <0
- *          &pio1 1 2
- *          0
- *          &pio2 3 4>;
- *
- * defines four GPIOs (so this function will return 4), two of which
- * are not specified.
- */
-unsigned int of_gpio_named_count(struct device_node *np, const char* propname)
-{
-       unsigned int cnt = 0;
-
-       do {
-               int ret;
-
-               ret = of_parse_phandle_with_args(np, propname, "#gpio-cells",
-                                                cnt, NULL);
-               /* A hole in the gpios = <> counts anyway. */
-               if (ret < 0 && ret != -EEXIST)
-                       break;
-       } while (++cnt);
-
-       return cnt;
-}
-EXPORT_SYMBOL(of_gpio_named_count);
-
 /**
  * of_gpio_simple_xlate - translate gpio_spec to the GPIO number and flags
  * @gc:                pointer to the gpio_chip structure
@@ -228,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
        if (!np)
                return;
 
-       do {
+       for (;; index++) {
                ret = of_parse_phandle_with_args(np, "gpio-ranges",
                                "#gpio-range-cells", index, &pinspec);
                if (ret)
@@ -250,15 +215,14 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
                 * on the same GPIO chip.
                 */
                ret = gpiochip_add_pin_range(chip,
-                                            pinctrl_dev_get_name(pctldev),
+                                            pinctrl_dev_get_devname(pctldev),
                                             0, /* offset in gpiochip */
                                             pinspec.args[0],
                                             pinspec.args[1]);
 
                if (ret)
                        break;
-
-       } while (index++);
+       }
 }
 
 #else