* [PATCH] gpiolib: Drop cargo-culted comment
@ 2023-11-24 23:25 Linus Walleij
2023-11-25 2:40 ` Kent Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2023-11-24 23:25 UTC (permalink / raw)
To: Bartosz Golaszewski, Andy Shevchenko
Cc: linux-gpio, linux-kernel, Linus Walleij
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.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
| 4 ----
1 file changed, 4 deletions(-)
--git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 95d2a7b2ea3e..1c47af866bf6 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -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,
--
Linus Walleij <linus.walleij@linaro.org>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Drop cargo-culted comment
2023-11-24 23:25 [PATCH] gpiolib: Drop cargo-culted comment Linus Walleij
@ 2023-11-25 2:40 ` Kent Gibson
2023-11-25 23:05 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Kent Gibson @ 2023-11-25 2:40 UTC (permalink / raw)
To: Linus Walleij
Cc: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote:
> 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.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/gpio/gpiolib.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 95d2a7b2ea3e..1c47af866bf6 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -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?
> DEFINE_SPINLOCK(gpio_lock);
>
> static DEFINE_MUTEX(gpio_lookup_lock);
>
> ---
> base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
> change-id: 20231125-dropcomment-89e5b7b4cc3f
>
> Best regards,
> --
> Linus Walleij <linus.walleij@linaro.org>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Drop cargo-culted comment
2023-11-25 2:40 ` Kent Gibson
@ 2023-11-25 23:05 ` Linus Walleij
2023-11-26 0:14 ` Kent Gibson
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2023-11-25 23:05 UTC (permalink / raw)
To: Kent Gibson
Cc: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote:
> On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote:
> > -/* 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?
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Drop cargo-culted comment
2023-11-25 23:05 ` Linus Walleij
@ 2023-11-26 0:14 ` Kent Gibson
2023-11-27 19:44 ` Bartosz Golaszewski
0 siblings, 1 reply; 5+ messages in thread
From: Kent Gibson @ 2023-11-26 0:14 UTC (permalink / raw)
To: Linus Walleij
Cc: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
On Sun, Nov 26, 2023 at 12:05:08AM +0100, Linus Walleij wrote:
> On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote:
> > On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote:
>
> > > -/* 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?
>
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Drop cargo-culted comment
2023-11-26 0:14 ` Kent Gibson
@ 2023-11-27 19:44 ` Bartosz Golaszewski
0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2023-11-27 19:44 UTC (permalink / raw)
To: Kent Gibson; +Cc: Linus Walleij, Andy Shevchenko, linux-gpio, linux-kernel
On Sun, Nov 26, 2023 at 1:14 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> On Sun, Nov 26, 2023 at 12:05:08AM +0100, Linus Walleij wrote:
> > On Sat, Nov 25, 2023 at 3:40 AM Kent Gibson <warthog618@gmail.com> wrote:
> > > On Sat, Nov 25, 2023 at 12:25:47AM +0100, Linus Walleij wrote:
> >
> > > > -/* 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?
> >
> > 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.
>
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-27 19:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-24 23:25 [PATCH] gpiolib: Drop cargo-culted comment Linus Walleij
2023-11-25 2:40 ` Kent Gibson
2023-11-25 23:05 ` Linus Walleij
2023-11-26 0:14 ` Kent Gibson
2023-11-27 19:44 ` Bartosz Golaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.