1

gpiolib: Remove data-less gpiochip_add() function

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>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240610135313.142571-1-afd@ti.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Andrew Davis 2024-06-10 08:53:13 -05:00 committed by Bartosz Golaszewski
parent 4134271539
commit 3ff1180a39
3 changed files with 3 additions and 8 deletions

View File

@ -69,9 +69,8 @@ driver code:
The code implementing a gpio_chip should support multiple instances of the The code implementing a gpio_chip should support multiple instances of the
controller, preferably using the driver model. That code will configure each controller, preferably using the driver model. That code will configure each
gpio_chip and issue gpiochip_add(), gpiochip_add_data(), or gpio_chip and issue gpiochip_add_data() or devm_gpiochip_add_data(). Removing
devm_gpiochip_add_data(). Removing a GPIO controller should be rare; use a GPIO controller should be rare; use gpiochip_remove() when it is unavoidable.
gpiochip_remove() when it is unavoidable.
Often a gpio_chip is part of an instance-specific structure with states not 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. exposed by the GPIO interfaces, such as addressing, power management, and more.

View File

@ -579,7 +579,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
if (ret) if (ret)
goto exit_line_free; goto exit_line_free;
ret = gpiochip_add(gpio); ret = gpiochip_add_data(gpio, NULL);
if (ret) { if (ret) {
dev_err(&gbphy_dev->dev, "failed to add gpio chip: %d\n", ret); dev_err(&gbphy_dev->dev, "failed to add gpio chip: %d\n", ret);
goto exit_line_free; goto exit_line_free;

View File

@ -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) devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL)
#endif /* CONFIG_LOCKDEP */ #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); void gpiochip_remove(struct gpio_chip *gc);
int devm_gpiochip_add_data_with_key(struct device *dev, 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, void *data, struct lock_class_key *lock_key,