Merge tag 'pinctrl-v6.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-block.git] / drivers / gpio / gpiolib.c
index 2db68ed3a29fb76d5de5990b7aa9a7f2ad628aab..99a2c77c3711b6e3371fdfd4e60957b30447b1b8 100644 (file)
@@ -532,6 +532,14 @@ static void gpiochip_free_valid_mask(struct gpio_chip *gc)
 
 static int gpiochip_add_pin_ranges(struct gpio_chip *gc)
 {
+       /*
+        * Device Tree platforms are supposed to use "gpio-ranges"
+        * property. This check ensures that the ->add_pin_ranges()
+        * won't be called for them.
+        */
+       if (device_property_present(&gc->gpiodev->dev, "gpio-ranges"))
+               return 0;
+
        if (gc->add_pin_ranges)
                return gc->add_pin_ranges(gc);