[v2,1/2] gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode

Message ID 20221114184626.64214-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v2,1/2] gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode |

Commit Message

Andy Shevchenko Nov. 14, 2022, 6:46 p.m. UTC
  GPIO library is getting rid of of_node, fwnode should be utilized instead.
Prepare of_mm_gpiochip_add_data() for fwnode.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
v2: added tag (Linus), modified according to Dmitry's suggestion
 drivers/gpio/gpiolib-of.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2
  

Comments

Dmitry Torokhov Nov. 14, 2022, 7:22 p.m. UTC | #1
On Mon, Nov 14, 2022 at 08:46:25PM +0200, Andy Shevchenko wrote:
> GPIO library is getting rid of of_node, fwnode should be utilized instead.
> Prepare of_mm_gpiochip_add_data() for fwnode.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
> v2: added tag (Linus), modified according to Dmitry's suggestion
>  drivers/gpio/gpiolib-of.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 4be3c21aa718..d30a5210dfdd 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -935,8 +935,8 @@ int of_mm_gpiochip_add_data(struct device_node *np,
>  	if (mm_gc->save_regs)
>  		mm_gc->save_regs(mm_gc);
>  
> -	of_node_put(mm_gc->gc.of_node);
> -	mm_gc->gc.of_node = of_node_get(np);
> +	fwnode_handle_put(mm_gc->gc.fwnode);
> +	mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np));
>  
>  	ret = gpiochip_add_data(gc, data);
>  	if (ret)
> 
> base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2
> -- 
> 2.35.1
> 

Thanks.
  
Bartosz Golaszewski Nov. 15, 2022, 11:01 a.m. UTC | #2
On Mon, Nov 14, 2022 at 7:46 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> GPIO library is getting rid of of_node, fwnode should be utilized instead.
> Prepare of_mm_gpiochip_add_data() for fwnode.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> v2: added tag (Linus), modified according to Dmitry's suggestion
>  drivers/gpio/gpiolib-of.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 4be3c21aa718..d30a5210dfdd 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -935,8 +935,8 @@ int of_mm_gpiochip_add_data(struct device_node *np,
>         if (mm_gc->save_regs)
>                 mm_gc->save_regs(mm_gc);
>
> -       of_node_put(mm_gc->gc.of_node);
> -       mm_gc->gc.of_node = of_node_get(np);
> +       fwnode_handle_put(mm_gc->gc.fwnode);
> +       mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np));
>
>         ret = gpiochip_add_data(gc, data);
>         if (ret)
>
> base-commit: 8dab99c9eab3162bfb4326c35579a3388dbf68f2
> --
> 2.35.1
>

Both applied, thanks!

Bart
  

Patch

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 4be3c21aa718..d30a5210dfdd 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -935,8 +935,8 @@  int of_mm_gpiochip_add_data(struct device_node *np,
 	if (mm_gc->save_regs)
 		mm_gc->save_regs(mm_gc);
 
-	of_node_put(mm_gc->gc.of_node);
-	mm_gc->gc.of_node = of_node_get(np);
+	fwnode_handle_put(mm_gc->gc.fwnode);
+	mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np));
 
 	ret = gpiochip_add_data(gc, data);
 	if (ret)