All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: linux-gpio@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/8] gpiolib: remove gpio_to_chip
Date: Tue, 9 Nov 2021 12:32:30 +0200	[thread overview]
Message-ID: <YYpOPs+/RuUq+ld8@smile.fi.intel.com> (raw)
In-Reply-To: <20211109100207.2474024-8-arnd@kernel.org>

On Tue, Nov 09, 2021 at 11:02:06AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> There are only two callers of this helper, remove them by
> open-coding the call to the gpiod version.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/pinctrl/core.c    | 5 ++---
>  drivers/soc/fsl/qe/gpio.c | 4 +---
>  include/linux/gpio.h      | 7 -------
>  3 files changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index 976607758e98..8d3c00782178 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -28,7 +28,6 @@

>  #ifdef CONFIG_GPIOLIB

I'm wondering if we need this ifdeffery at all.

>  #include "../gpio/gpiolib.h"
> -#include <linux/gpio.h>
>  #endif
>  
>  #include "core.h"
> @@ -324,7 +323,7 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
>  {
>  	struct pinctrl_dev *pctldev;
>  	struct pinctrl_gpio_range *range = NULL;
> -	struct gpio_chip *chip = gpio_to_chip(gpio);
> +	struct gpio_chip *chip = gpiod_to_chip(gpio_to_desc(gpio));
>  
>  	if (WARN(!chip, "no gpio_chip for gpio%i?", gpio))
>  		return false;
> @@ -1657,7 +1656,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
>  			}
>  		}
>  		if (gpio_num >= 0)
> -			chip = gpio_to_chip(gpio_num);
> +			chip = gpiod_to_chip(gpio_to_desc(gpio_num));
>  		else
>  			chip = NULL;
>  		if (chip)
> diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
> index 99f7de43c3c6..a6aa55055e9a 100644
> --- a/drivers/soc/fsl/qe/gpio.c
> +++ b/drivers/soc/fsl/qe/gpio.c
> @@ -15,8 +15,6 @@
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>  #include <linux/gpio/driver.h>
> -/* FIXME: needed for gpio_to_chip() get rid of this */
> -#include <linux/gpio.h>
>  #include <linux/slab.h>
>  #include <linux/export.h>
>  #include <soc/fsl/qe/qe.h>
> @@ -173,7 +171,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
>  	err = of_get_gpio(np, index);
>  	if (err < 0)
>  		goto err0;
> -	gc = gpio_to_chip(err);
> +	gc = gpiod_to_chip(gpio_to_desc(err));
>  	if (WARN_ON(!gc)) {
>  		err = -ENODEV;
>  		goto err0;
> diff --git a/include/linux/gpio.h b/include/linux/gpio.h
> index 7ceb93678689..61fb427b4e70 100644
> --- a/include/linux/gpio.h
> +++ b/include/linux/gpio.h
> @@ -96,12 +96,6 @@ static inline bool gpio_is_valid(int number)
>  
>  struct device;
>  
> -/* caller holds gpio_lock *OR* gpio is marked as requested */
> -static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
> -{
> -	return gpiod_to_chip(gpio_to_desc(gpio));
> -}
> -
>  /* Always use the library code for GPIO management calls,
>   * or when sleeping may be involved.
>   */
> @@ -158,7 +152,6 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
>  #include <linux/bug.h>
>  
>  struct device;
> -struct gpio_chip;
>  
>  static inline bool gpio_is_valid(int number)
>  {
> -- 
> 2.29.2
> 

-- 
With Best Regards,
Andy Shevchenko



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: linux-gpio@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/8] gpiolib: remove gpio_to_chip
Date: Tue, 9 Nov 2021 12:32:30 +0200	[thread overview]
Message-ID: <YYpOPs+/RuUq+ld8@smile.fi.intel.com> (raw)
In-Reply-To: <20211109100207.2474024-8-arnd@kernel.org>

On Tue, Nov 09, 2021 at 11:02:06AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> There are only two callers of this helper, remove them by
> open-coding the call to the gpiod version.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/pinctrl/core.c    | 5 ++---
>  drivers/soc/fsl/qe/gpio.c | 4 +---
>  include/linux/gpio.h      | 7 -------
>  3 files changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index 976607758e98..8d3c00782178 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -28,7 +28,6 @@

>  #ifdef CONFIG_GPIOLIB

I'm wondering if we need this ifdeffery at all.

>  #include "../gpio/gpiolib.h"
> -#include <linux/gpio.h>
>  #endif
>  
>  #include "core.h"
> @@ -324,7 +323,7 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
>  {
>  	struct pinctrl_dev *pctldev;
>  	struct pinctrl_gpio_range *range = NULL;
> -	struct gpio_chip *chip = gpio_to_chip(gpio);
> +	struct gpio_chip *chip = gpiod_to_chip(gpio_to_desc(gpio));
>  
>  	if (WARN(!chip, "no gpio_chip for gpio%i?", gpio))
>  		return false;
> @@ -1657,7 +1656,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
>  			}
>  		}
>  		if (gpio_num >= 0)
> -			chip = gpio_to_chip(gpio_num);
> +			chip = gpiod_to_chip(gpio_to_desc(gpio_num));
>  		else
>  			chip = NULL;
>  		if (chip)
> diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
> index 99f7de43c3c6..a6aa55055e9a 100644
> --- a/drivers/soc/fsl/qe/gpio.c
> +++ b/drivers/soc/fsl/qe/gpio.c
> @@ -15,8 +15,6 @@
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>  #include <linux/gpio/driver.h>
> -/* FIXME: needed for gpio_to_chip() get rid of this */
> -#include <linux/gpio.h>
>  #include <linux/slab.h>
>  #include <linux/export.h>
>  #include <soc/fsl/qe/qe.h>
> @@ -173,7 +171,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
>  	err = of_get_gpio(np, index);
>  	if (err < 0)
>  		goto err0;
> -	gc = gpio_to_chip(err);
> +	gc = gpiod_to_chip(gpio_to_desc(err));
>  	if (WARN_ON(!gc)) {
>  		err = -ENODEV;
>  		goto err0;
> diff --git a/include/linux/gpio.h b/include/linux/gpio.h
> index 7ceb93678689..61fb427b4e70 100644
> --- a/include/linux/gpio.h
> +++ b/include/linux/gpio.h
> @@ -96,12 +96,6 @@ static inline bool gpio_is_valid(int number)
>  
>  struct device;
>  
> -/* caller holds gpio_lock *OR* gpio is marked as requested */
> -static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
> -{
> -	return gpiod_to_chip(gpio_to_desc(gpio));
> -}
> -
>  /* Always use the library code for GPIO management calls,
>   * or when sleeping may be involved.
>   */
> @@ -158,7 +152,6 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
>  #include <linux/bug.h>
>  
>  struct device;
> -struct gpio_chip;
>  
>  static inline bool gpio_is_valid(int number)
>  {
> -- 
> 2.29.2
> 

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-09 10:32 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 10:01 [PATCH v2 0/8] gpiolib header cleanup Arnd Bergmann
2021-11-09 10:01 ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 1/8] gpiolib: remove irq_to_gpio() definition Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 2/8] gpiolib: remove empty asm/gpio.h files Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 3/8] gpiolib: coldfire: remove custom asm/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 4/8] gpiolib: remove asm-generic/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:19   ` Andy Shevchenko
2021-11-09 10:19     ` Andy Shevchenko
2021-11-09 10:02 ` [PATCH v2 5/8] gpiolib: shrink further Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:24   ` Andy Shevchenko
2021-11-09 10:24     ` Andy Shevchenko
2021-11-09 11:18     ` Arnd Bergmann
2021-11-09 11:18       ` Arnd Bergmann
2021-11-09 22:17       ` Linus Walleij
2021-11-09 22:17         ` Linus Walleij
2021-11-10 12:39         ` Arnd Bergmann
2021-11-10 12:39           ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 6/8] gpiolib: remove legacy gpio_export Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:30   ` Andy Shevchenko
2021-11-09 10:30     ` Andy Shevchenko
2021-11-09 10:50     ` Arnd Bergmann
2021-11-09 10:50       ` Arnd Bergmann
2021-11-09 20:42       ` Linus Walleij
2021-11-09 20:42         ` Linus Walleij
2021-11-09 22:46         ` Arnd Bergmann
2021-11-09 22:46           ` Arnd Bergmann
2021-11-10  0:03           ` Linus Walleij
2021-11-10  0:03             ` Linus Walleij
2021-11-09 20:33     ` Linus Walleij
2021-11-09 20:33       ` Linus Walleij
2021-11-09 10:02 ` [PATCH v2 7/8] gpiolib: remove gpio_to_chip Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:32   ` Andy Shevchenko [this message]
2021-11-09 10:32     ` Andy Shevchenko
2021-11-09 10:54     ` Arnd Bergmann
2021-11-09 10:54       ` Arnd Bergmann
2021-11-09 10:02 ` [PATCH v2 8/8] gpiolib: split linux/gpio/driver.h out of linux/gpio.h Arnd Bergmann
2021-11-09 10:02   ` Arnd Bergmann
2021-11-09 10:34   ` Andy Shevchenko
2021-11-09 10:34     ` 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=YYpOPs+/RuUq+ld8@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.