Skip to content

Commit 5e62844

Browse files
author
Bartosz Golaszewski
committed
gpio: mark unsafe gpio_chip manipulators as deprecated
We still have some functions that return the address of the GPIO chip associated with the GPIO device. This is dangerous and the users should find a better solution. Let's add appropriate comments to the kernel docs. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: Andy Shevchenko <[email protected]>
1 parent f067372 commit 5e62844

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpio/gpiolib.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ EXPORT_SYMBOL_GPL(desc_to_gpio);
211211
/**
212212
* gpiod_to_chip - Return the GPIO chip to which a GPIO descriptor belongs
213213
* @desc: descriptor to return the chip of
214+
*
215+
* *DEPRECATED*
216+
* This function is unsafe and should not be used. Using the chip address
217+
* without taking the SRCU read lock may result in dereferencing a dangling
218+
* pointer.
214219
*/
215220
struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
216221
{
@@ -275,6 +280,7 @@ EXPORT_SYMBOL(gpio_device_get_label);
275280
* Returns:
276281
* Address of the GPIO chip backing this device.
277282
*
283+
* *DEPRECATED*
278284
* Until we can get rid of all non-driver users of struct gpio_chip, we must
279285
* provide a way of retrieving the pointer to it from struct gpio_device. This
280286
* is *NOT* safe as the GPIO API is considered to be hot-unpluggable and the

0 commit comments

Comments
 (0)