]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/gpio/gpiolib-of.c
Merge tag 'gpio-v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[mirror_ubuntu-artful-kernel.git] / drivers / gpio / gpiolib-of.c
index 5236966b1bdfc4008466cf25a583218a60fe4b12..92b185f19232f7fc3f1207bc320ce6ca887f117f 100644 (file)
 
 #include "gpiolib.h"
 
-static int of_gpiochip_match_node(struct gpio_chip *chip, void *data)
+static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
 {
-       return chip->gpiodev->dev.of_node == data;
+       struct of_phandle_args *gpiospec = data;
+
+       return chip->gpiodev->dev.of_node == gpiospec->np &&
+                               chip->of_xlate(chip, gpiospec, NULL) >= 0;
 }
 
-static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np)
+static struct gpio_chip *of_find_gpiochip_by_xlate(
+                                       struct of_phandle_args *gpiospec)
 {
-       return gpiochip_find(np, of_gpiochip_match_node);
+       return gpiochip_find(gpiospec, of_gpiochip_match_node_and_xlate);
 }
 
 static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip,
@@ -79,7 +83,7 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
                return ERR_PTR(ret);
        }
 
-       chip = of_find_gpiochip_by_node(gpiospec.np);
+       chip = of_find_gpiochip_by_xlate(&gpiospec);
        if (!chip) {
                desc = ERR_PTR(-EPROBE_DEFER);
                goto out;