linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: Remove data-less gpiochip_add() function
@ 2024-06-10 13:53 Andrew Davis
  2024-06-11  6:36 ` Greg Kroah-Hartman
  2024-06-11 20:07 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Davis @ 2024-06-10 13:53 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet,
	Rui Miguel Silva, Johan Hovold, Alex Elder, Greg Kroah-Hartman
  Cc: linux-gpio, linux-doc, linux-kernel, greybus-dev, Andrew Davis

GPIO chips should be added with driver-private data associated with the
chip. If none is needed, NULL can be used. All users already do this
except one, fix that here. With no more users of the base gpiochip_add()
we can drop this function so no more users show up later.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 Documentation/driver-api/gpio/driver.rst | 5 ++---
 drivers/staging/greybus/gpio.c           | 2 +-
 include/linux/gpio/driver.h              | 4 ----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/Documentation/driver-api/gpio/driver.rst b/Documentation/driver-api/gpio/driver.rst
index e541bd2e898b5..ae433261e11a0 100644
--- a/Documentation/driver-api/gpio/driver.rst
+++ b/Documentation/driver-api/gpio/driver.rst
@@ -69,9 +69,8 @@ driver code:
 
 The code implementing a gpio_chip should support multiple instances of the
 controller, preferably using the driver model. That code will configure each
-gpio_chip and issue gpiochip_add(), gpiochip_add_data(), or
-devm_gpiochip_add_data().  Removing a GPIO controller should be rare; use
-gpiochip_remove() when it is unavoidable.
+gpio_chip and issue gpiochip_add_data() or devm_gpiochip_add_data(). Removing
+a GPIO controller should be rare; use gpiochip_remove() when it is unavoidable.
 
 Often a gpio_chip is part of an instance-specific structure with states not
 exposed by the GPIO interfaces, such as addressing, power management, and more.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 2a115a8fc263f..5217aacfcf54c 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -579,7 +579,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
 	if (ret)
 		goto exit_line_free;
 
-	ret = gpiochip_add(gpio);
+	ret = gpiochip_add_data(gpio, NULL);
 	if (ret) {
 		dev_err(&gbphy_dev->dev, "failed to add gpio chip: %d\n", ret);
 		goto exit_line_free;
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 0032bb6e7d8fe..6d31388dde0ab 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -632,10 +632,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 	devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL)
 #endif /* CONFIG_LOCKDEP */
 
-static inline int gpiochip_add(struct gpio_chip *gc)
-{
-	return gpiochip_add_data(gc, NULL);
-}
 void gpiochip_remove(struct gpio_chip *gc);
 int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
 				    void *data, struct lock_class_key *lock_key,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpiolib: Remove data-less gpiochip_add() function
  2024-06-10 13:53 [PATCH] gpiolib: Remove data-less gpiochip_add() function Andrew Davis
@ 2024-06-11  6:36 ` Greg Kroah-Hartman
  2024-06-11 20:07 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2024-06-11  6:36 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet,
	Rui Miguel Silva, Johan Hovold, Alex Elder, linux-gpio, linux-doc,
	linux-kernel, greybus-dev

On Mon, Jun 10, 2024 at 08:53:13AM -0500, Andrew Davis wrote:
> GPIO chips should be added with driver-private data associated with the
> chip. If none is needed, NULL can be used. All users already do this
> except one, fix that here. With no more users of the base gpiochip_add()
> we can drop this function so no more users show up later.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  Documentation/driver-api/gpio/driver.rst | 5 ++---
>  drivers/staging/greybus/gpio.c           | 2 +-
>  include/linux/gpio/driver.h              | 4 ----
>  3 files changed, 3 insertions(+), 8 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpiolib: Remove data-less gpiochip_add() function
  2024-06-10 13:53 [PATCH] gpiolib: Remove data-less gpiochip_add() function Andrew Davis
  2024-06-11  6:36 ` Greg Kroah-Hartman
@ 2024-06-11 20:07 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-06-11 20:07 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Jonathan Corbet,
	Rui Miguel Silva, Johan Hovold, Alex Elder, Greg Kroah-Hartman,
	Andrew Davis
  Cc: Bartosz Golaszewski, linux-gpio, linux-doc, linux-kernel,
	greybus-dev

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 10 Jun 2024 08:53:13 -0500, Andrew Davis wrote:
> GPIO chips should be added with driver-private data associated with the
> chip. If none is needed, NULL can be used. All users already do this
> except one, fix that here. With no more users of the base gpiochip_add()
> we can drop this function so no more users show up later.
> 
> 

Applied, thanks!

[1/1] gpiolib: Remove data-less gpiochip_add() function
      commit: 3ff1180a39fbc43ae69d4238e6922c57e3278910

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-11 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 13:53 [PATCH] gpiolib: Remove data-less gpiochip_add() function Andrew Davis
2024-06-11  6:36 ` Greg Kroah-Hartman
2024-06-11 20:07 ` Bartosz Golaszewski

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).