lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2wZYuadSwbqxpge@google.com>
Date:   Wed, 9 Nov 2022 13:19:30 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v1 1/2] gpiolib: of: Prepare of_mm_gpiochip_add_data()
 for fwnode

On Wed, Nov 09, 2022 at 05:07:33PM +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@...ux.intel.com>
> ---
>  drivers/gpio/gpiolib-of.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 4be3c21aa718..feeb9e8e846d 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -919,14 +919,15 @@ int of_mm_gpiochip_add_data(struct device_node *np,
>  			    struct of_mm_gpio_chip *mm_gc,
>  			    void *data)
>  {
> +	struct fwnode_handle *fwnode = of_fwnode_handle(np);
>  	int ret = -ENOMEM;
>  	struct gpio_chip *gc = &mm_gc->gc;
>  
> -	gc->label = kasprintf(GFP_KERNEL, "%pOF", np);
> +	gc->label = kasprintf(GFP_KERNEL, "%pfw", fwnode);
>  	if (!gc->label)
>  		goto err0;
>  
> -	mm_gc->regs = of_iomap(np, 0);
> +	mm_gc->regs = fwnode_iomap(fwnode, 0);
>  	if (!mm_gc->regs)
>  		goto err1;
>  
> @@ -935,8 +936,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(fwnode);

Can we reduce the patch to

	fwnode_handle_put(mm_gc->gc.fwnode);
	mm_gc->gc.fwnode = fwnode_handle_get(of_fwnode_handle(np));

?

I do not see a reason for converting the rest of invocations to fwnode
given that this is clearly an OF API.

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ