Skip to content

Commit 3ff1180

Browse files
glneoBartosz Golaszewski
authored andcommitted
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 <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 4134271 commit 3ff1180

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

Documentation/driver-api/gpio/driver.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ driver code:
6969

7070
The code implementing a gpio_chip should support multiple instances of the
7171
controller, preferably using the driver model. That code will configure each
72-
gpio_chip and issue gpiochip_add(), gpiochip_add_data(), or
73-
devm_gpiochip_add_data(). Removing a GPIO controller should be rare; use
74-
gpiochip_remove() when it is unavoidable.
72+
gpio_chip and issue gpiochip_add_data() or devm_gpiochip_add_data(). Removing
73+
a GPIO controller should be rare; use gpiochip_remove() when it is unavoidable.
7574

7675
Often a gpio_chip is part of an instance-specific structure with states not
7776
exposed by the GPIO interfaces, such as addressing, power management, and more.

drivers/staging/greybus/gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
579579
if (ret)
580580
goto exit_line_free;
581581

582-
ret = gpiochip_add(gpio);
582+
ret = gpiochip_add_data(gpio, NULL);
583583
if (ret) {
584584
dev_err(&gbphy_dev->dev, "failed to add gpio chip: %d\n", ret);
585585
goto exit_line_free;

include/linux/gpio/driver.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
632632
devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL)
633633
#endif /* CONFIG_LOCKDEP */
634634

635-
static inline int gpiochip_add(struct gpio_chip *gc)
636-
{
637-
return gpiochip_add_data(gc, NULL);
638-
}
639635
void gpiochip_remove(struct gpio_chip *gc);
640636
int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
641637
void *data, struct lock_class_key *lock_key,

0 commit comments

Comments
 (0)