aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpiolib-of.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index ecad3f0e3b77..193f15d50bba 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -26,14 +26,18 @@
26 26
27#include "gpiolib.h" 27#include "gpiolib.h"
28 28
29static int of_gpiochip_match_node(struct gpio_chip *chip, void *data) 29static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
30{ 30{
31 return chip->gpiodev->dev.of_node == data; 31 struct of_phandle_args *gpiospec = data;
32
33 return chip->gpiodev->dev.of_node == gpiospec->np &&
34 chip->of_xlate(chip, gpiospec, NULL) >= 0;
32} 35}
33 36
34static struct gpio_chip *of_find_gpiochip_by_node(struct device_node *np) 37static struct gpio_chip *of_find_gpiochip_by_xlate(
38 struct of_phandle_args *gpiospec)
35{ 39{
36 return gpiochip_find(np, of_gpiochip_match_node); 40 return gpiochip_find(gpiospec, of_gpiochip_match_node_and_xlate);
37} 41}
38 42
39static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip, 43static 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,
79 return ERR_PTR(ret); 83 return ERR_PTR(ret);
80 } 84 }
81 85
82 chip = of_find_gpiochip_by_node(gpiospec.np); 86 chip = of_find_gpiochip_by_xlate(&gpiospec);
83 if (!chip) { 87 if (!chip) {
84 desc = ERR_PTR(-EPROBE_DEFER); 88 desc = ERR_PTR(-EPROBE_DEFER);
85 goto out; 89 goto out;