Re: commit f34fd6ee1be8 breaks current dwapb gpio DT users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jisheng Zhang wrote:
> Hi Emil, Linus,
>
> commit f34fd6ee1be8 ("gpio: dwapb: Use generic request, free and
> set_config") breaks all current dwapb gpio DT users, for example, getting
> cd-gpios will always fail as -EPROBE_DEFER. Before the commit,
> dwapb_gpio_set_config() returns -ENOTSUPP for !PIN_CONFIG_INPUT_DEBOUNCE
> then gpio_set_config_with_argument_optional() will happily ignore
> -ENOTSUPP. After the commit, dwapb_gpio_set_config() will return
> -EPROBE_DEFER unless the gpio-ranges are set in DT.
>
> The key problem here is: almost all dwapb gpio DT users don't set
> the gpio-ranges DT property, so I guess current dwapb gpio DT users
> have this problem and the commit also breaks old DT compatbility.
> So could we getback to previous behavior?

Hi Jisheng

It seems like the gpiochip_generic_request() and gpiochip_generic_free()
functions have guards to handle when gpio-ranges are not set that
gpiochip_generic_config() lacks. Could you try the patch below?

Otherwise I'm also fine with just reverting the patch if this is not the right
solution.

/Emil

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8b3a0f45b574..e434e8cc1229 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2042,6 +2042,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
 int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
                            unsigned long config)
 {
+#ifdef CONFIG_PINCTRL
+       if (list_empty(&gc->gpiodev->pin_ranges))
+               return -ENOTSUPP;
+#endif
+
        return pinctrl_gpio_set_config(gc, offset, config);
 }
 EXPORT_SYMBOL_GPL(gpiochip_generic_config);




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux