mbox series

[v3,0/4] gpiolib: get rid of exessive ->of_gpio_ranges_fallback()

Message ID 20230113215352.44272-1-andriy.shevchenko@linux.intel.com
Headers show
Series gpiolib: get rid of exessive ->of_gpio_ranges_fallback() | expand

Message

Andy Shevchenko Jan. 13, 2023, 9:53 p.m. UTC
The ->of_gpio_ranges_fallback() repeats the idea that lies behind
->add_pin_ranges(), while the latter covers more cases that the former
hook. Drop the former one for good.

Changelog v3:
- moved check of the property presense to GPIO library
- split out the refcount fix in a separate patch
- added cover letter

Andy Shevchenko (4):
  gpiolib: Check "gpio-ranges" before calling ->add_pin_ranges()
  pinctrl: bcm2835: Remove of_node_put() in
    bcm2835_of_gpio_ranges_fallback()
  pinctrl: bcm2835: Switch to use ->add_pin_ranges()
  Revert "gpiolib: of: Introduce hook for missing gpio-ranges"

 drivers/gpio/gpiolib-of.c             |  5 -----
 drivers/gpio/gpiolib.c                |  8 ++++++++
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 ++++------
 include/linux/gpio/driver.h           | 12 ------------
 4 files changed, 12 insertions(+), 23 deletions(-)

Comments

Stefan Wahren Jan. 14, 2023, 11:03 a.m. UTC | #1
Hi Andy,

Am 13.01.23 um 22:53 schrieb Andy Shevchenko:
> Remove wrong of_node_put() in bcm2835_of_gpio_ranges_fallback(),
> there is no counterpart of_node_get() for it.
>
> Fixes: d2b67744fd99 ("pinctrl: bcm2835: implement hook for missing gpio-ranges")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

thanks for fixing. It seems that i got confused by function name and 
usage in other driver.

Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>

> ---
>   drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> index 7857e612a100..c7cdccdb4332 100644
> --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> @@ -363,8 +363,6 @@ static int bcm2835_of_gpio_ranges_fallback(struct gpio_chip *gc,
>   {
>   	struct pinctrl_dev *pctldev = of_pinctrl_get(np);
>   
> -	of_node_put(np);
> -
>   	if (!pctldev)
>   		return 0;
>
Andy Shevchenko Jan. 14, 2023, 11:10 a.m. UTC | #2
On Sat, Jan 14, 2023 at 12:03:07PM +0100, Stefan Wahren wrote:
> Am 13.01.23 um 22:53 schrieb Andy Shevchenko:
> > Remove wrong of_node_put() in bcm2835_of_gpio_ranges_fallback(),
> > there is no counterpart of_node_get() for it.
> > 
> > Fixes: d2b67744fd99 ("pinctrl: bcm2835: implement hook for missing gpio-ranges")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> thanks for fixing. It seems that i got confused by function name and usage
> in other driver.

You're welcome! Would be nice if you or somebody else have a chance to test
the series.

> Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>

Thank you!
Florian Fainelli Jan. 14, 2023, 4:36 p.m. UTC | #3
On 1/14/2023 3:10 AM, Andy Shevchenko wrote:
> On Sat, Jan 14, 2023 at 12:03:07PM +0100, Stefan Wahren wrote:
>> Am 13.01.23 um 22:53 schrieb Andy Shevchenko:
>>> Remove wrong of_node_put() in bcm2835_of_gpio_ranges_fallback(),
>>> there is no counterpart of_node_get() for it.
>>>
>>> Fixes: d2b67744fd99 ("pinctrl: bcm2835: implement hook for missing gpio-ranges")
>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>
>> thanks for fixing. It seems that i got confused by function name and usage
>> in other driver.
> 
> You're welcome! Would be nice if you or somebody else have a chance to test
> the series.

Yes I should be able to do that in the next few days.
Bartosz Golaszewski Jan. 16, 2023, 9:36 a.m. UTC | #4
On Fri, Jan 13, 2023 at 10:53 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The ->of_gpio_ranges_fallback() repeats the idea that lies behind
> ->add_pin_ranges(), while the latter covers more cases that the former
> hook. Drop the former one for good.
>
> Changelog v3:
> - moved check of the property presense to GPIO library
> - split out the refcount fix in a separate patch
> - added cover letter
>
> Andy Shevchenko (4):
>   gpiolib: Check "gpio-ranges" before calling ->add_pin_ranges()
>   pinctrl: bcm2835: Remove of_node_put() in
>     bcm2835_of_gpio_ranges_fallback()
>   pinctrl: bcm2835: Switch to use ->add_pin_ranges()
>   Revert "gpiolib: of: Introduce hook for missing gpio-ranges"
>
>  drivers/gpio/gpiolib-of.c             |  5 -----
>  drivers/gpio/gpiolib.c                |  8 ++++++++
>  drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 ++++------
>  include/linux/gpio/driver.h           | 12 ------------
>  4 files changed, 12 insertions(+), 23 deletions(-)
>
> --
> 2.39.0
>

For GPIO part:

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Stefan Wahren Jan. 19, 2023, 5:28 p.m. UTC | #5
Hi Andy,

Am 13.01.23 um 22:53 schrieb Andy Shevchenko:
> The ->of_gpio_ranges_fallback() repeats the idea that lies behind
> ->add_pin_ranges(), while the latter covers more cases that the former
> hook. Drop the former one for good.

i successful tested booting of this series with multi_v7_defconfig on 
Raspberry Pi 4 (with and without gpio-ranges in DTB):

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>

>
> Changelog v3:
> - moved check of the property presense to GPIO library
> - split out the refcount fix in a separate patch
> - added cover letter
>
> Andy Shevchenko (4):
>    gpiolib: Check "gpio-ranges" before calling ->add_pin_ranges()
>    pinctrl: bcm2835: Remove of_node_put() in
>      bcm2835_of_gpio_ranges_fallback()
>    pinctrl: bcm2835: Switch to use ->add_pin_ranges()
>    Revert "gpiolib: of: Introduce hook for missing gpio-ranges"
>
>   drivers/gpio/gpiolib-of.c             |  5 -----
>   drivers/gpio/gpiolib.c                |  8 ++++++++
>   drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 ++++------
>   include/linux/gpio/driver.h           | 12 ------------
>   4 files changed, 12 insertions(+), 23 deletions(-)
>
Andy Shevchenko Jan. 19, 2023, 5:41 p.m. UTC | #6
On Thu, Jan 19, 2023 at 06:28:27PM +0100, Stefan Wahren wrote:
> Hi Andy,
> 
> Am 13.01.23 um 22:53 schrieb Andy Shevchenko:
> > The ->of_gpio_ranges_fallback() repeats the idea that lies behind
> > ->add_pin_ranges(), while the latter covers more cases that the former
> > hook. Drop the former one for good.
> 
> i successful tested booting of this series with multi_v7_defconfig on
> Raspberry Pi 4 (with and without gpio-ranges in DTB):
> 
> Tested-by: Stefan Wahren <stefan.wahren@i2se.com>

Thank you!
Florian Fainelli Jan. 19, 2023, 7:06 p.m. UTC | #7
On 1/13/23 13:53, Andy Shevchenko wrote:
> The ->of_gpio_ranges_fallback() repeats the idea that lies behind
> ->add_pin_ranges(), while the latter covers more cases that the former
> hook. Drop the former one for good.
> 
> Changelog v3:
> - moved check of the property presense to GPIO library
> - split out the refcount fix in a separate patch
> - added cover letter

Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks!