linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1 1/2] gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode
Date: Mon, 7 Nov 2022 10:14:29 -0800	[thread overview]
Message-ID: <Y2lLBchlwBozRcDq@google.com> (raw)
In-Reply-To: <20221107161027.43384-1-andriy.shevchenko@linux.intel.com>

On Mon, Nov 07, 2022 at 06:10:26PM +0200, Andy Shevchenko wrote:
> GPIO library is getting rid of of_node, fwnode should be utilized instead.
> Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

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

> ---
>  drivers/gpio/gpiolib-of.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index be9c34cca322..000020eb78d8 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -1104,9 +1104,11 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { return 0; }
>  
>  int of_gpiochip_add(struct gpio_chip *chip)
>  {
> +	struct device_node *np;
>  	int ret;
>  
> -	if (!chip->of_node)
> +	np = to_of_node(chip->fwnode);
> +	if (!np)
>  		return 0;
>  
>  	if (!chip->of_xlate) {
> @@ -1123,18 +1125,18 @@ int of_gpiochip_add(struct gpio_chip *chip)
>  	if (ret)
>  		return ret;
>  
> -	of_node_get(chip->of_node);
> +	fwnode_handle_get(chip->fwnode);
>  
>  	ret = of_gpiochip_scan_gpios(chip);
>  	if (ret)
> -		of_node_put(chip->of_node);
> +		fwnode_handle_put(chip->fwnode);
>  
>  	return ret;
>  }
>  
>  void of_gpiochip_remove(struct gpio_chip *chip)
>  {
> -	of_node_put(chip->of_node);
> +	fwnode_handle_put(chip->fwnode);
>  }
>  
>  void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)
> -- 
> 2.35.1
> 

-- 
Dmitry

  parent reply	other threads:[~2022-11-07 18:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 16:10 [PATCH v1 1/2] gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode Andy Shevchenko
2022-11-07 16:10 ` [PATCH v1 2/2] gpiolib: of: Integrate of_gpiochip_init_valid_mask() into gpiochip_init_valid_mask() Andy Shevchenko
2022-11-07 18:20   ` Dmitry Torokhov
2022-11-07 21:09     ` Andy Shevchenko
2022-11-07 21:40       ` Dmitry Torokhov
2022-11-08  8:41         ` Andy Shevchenko
2022-11-08 13:23           ` Andy Shevchenko
2022-11-07 18:14 ` Dmitry Torokhov [this message]
2022-11-09 13:13 ` [PATCH v1 1/2] gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode Bartosz Golaszewski
2022-11-09 13:13   ` Bartosz Golaszewski
2022-11-09 13:23     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2lLBchlwBozRcDq@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).