gpiolib: Drop cargo-culted comment
PATCH 1/1 gpiolib: Drop cargo-culted comment
This comment about the gpio_lock is just completely confusing and misleading. This refers to a gpio_desc that would in 2008 be used to hold the list of gpio_chips, but nowadays gpio_desc refers to descriptors of individual GPIO lines and this comment is completely unparseable. Delete it.
--- drivers/gpio/gpiolib.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpio/gpiolib.c +0 -4
@@ -86,10 +86,6 @@ static struct bus_type gpio_bus_type = {*/ #define FASTPATH_NGPIO CONFIG_GPIOLIB_FASTPATH_LIMIT -/* gpio_lock prevents conflicts during gpio_desc[] table updates. -* While any GPIO is requested, its gpio_chip is not removable; -* each GPIO's "requested" flag serves as a lock and refcount. -*/ DEFINE_SPINLOCK (gpio_lock);static DEFINE_MUTEX (gpio_lookup_lock);
---
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20231125-dropcomment-89e5b7b4cc3f
Best regards,
Signature · 1 line
Linus Walleij <[email protected]>
Quoted 16 lines · Linus Walleij
This comment about the
gpio_lockis just completely confusing and misleading. This refers to agpio_descthat would in 2008 be used to hold the list ofgpio_chips, but nowadaysgpio_descrefers to descriptors of individual GPIO lines and this comment is completely unparseable. Delete it.Signed-off-by Linus Walleij <[email protected]>--- drivers/gpio/gpiolib.c | 4 ---- 1 file changed, 4 deletions(-)drivers/gpio/gpiolib.c +0
-0
drivers/gpio/gpiolib.c static struct bus_type gpio_bus_type = { · line 92
Quoted 7 lines
drivers/gpio/gpiolib.c +0
-4@@ -86,10 +86,6 @@ static struct bus_type gpio_bus_type = {*/ #define FASTPATH_NGPIO CONFIG_GPIOLIB_FASTPATH_LIMIT -/* gpio_lock prevents conflicts during gpio_desc[] table updates. -* While any GPIO is requested, its gpio_chip is not removable; -* each GPIO's "requested" flag serves as a lock and refcount. -*/
Perhaps provide a comment as to what the gpio_lock DOES cover?
Quoted 12 lines
drivers/gpio/gpiolib.c +0
-1DEFINE_SPINLOCK (gpio_lock);static DEFINE_MUTEX (gpio_lookup_lock); ---base-commit:
b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20231125-dropcomment-89e5b7b4cc3fBest regards,
--
Linus Walleij <[email protected]>
Quoted 8 lines · Kent Gibson
Quoted 4 lines · Linus Walleij
-/*
gpio_lockprevents conflicts during gpio_desc[] table updates.
- * While any GPIO is requested, itsgpio_chipis not removable;
- * each GPIO's "requested" flag serves as a lock and refcount.
- */Perhaps provide a comment as to what the
gpio_lockDOES cover?
Normally yes, but Bartosz just said he is going to replace this spinlock with a mutex so it's better if he adds it then.
Yours,
Linus Walleij
Quoted 8 lines · Linus Walleij
Quoted 7 lines · Kent Gibson
Quoted 4 lines · Linus Walleij
-/*
gpio_lockprevents conflicts during gpio_desc[] table updates.
- * While any GPIO is requested, itsgpio_chipis not removable;
- * each GPIO's "requested" flag serves as a lock and refcount.
- */
Quoted 5 lines
Quoted 1 line
Perhaps provide a comment as to what the
gpio_lockDOES cover?Normally yes, but Bartosz just said he is going to replace this spinlock with a mutex so it's better if he adds it then.
If that is happening soon then leave it to Bart to change both the comment and lock.
If not, then we now have an undocumented lock. If the coverage of the spinlock and proposed mutex are the same why not describe what the lock covers now? Then Bart wont have to update the comment.
Cheers,
Kent.
Quoted 19 lines · Kent Gibson
Quoted 8 lines · Linus Walleij
Quoted 7 lines · Kent Gibson
Quoted 4 lines · Linus Walleij
-/*
gpio_lockprevents conflicts during gpio_desc[] table updates.
- * While any GPIO is requested, itsgpio_chipis not removable;
- * each GPIO's "requested" flag serves as a lock and refcount.
- */Quoted 5 lines
Quoted 1 line
Perhaps provide a comment as to what the
gpio_lockDOES cover?Normally yes, but Bartosz just said he is going to replace this spinlock with a mutex so it's better if he adds it then.
If that is happening soon then leave it to Bart to change both the comment and lock.
Quoted 7 lines
If not, then we now have an undocumented lock. If the coverage of the spinlock and proposed mutex are the same why not describe what the lock covers now? Then Bart wont have to update the comment.
Cheers,
Kent.
Yeah, I think we should maybe leave some temporary FIXME comment once the mutex patch is in saying this must go as well but it'll take more time because the problem is quite tricky.
Bart