* regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
@ 2023-08-08 8:28 Marek Behún
2023-08-08 14:01 ` Andy Shevchenko
2023-08-11 10:16 ` Andy Shevchenko
0 siblings, 2 replies; 7+ messages in thread
From: Marek Behún @ 2023-08-08 8:28 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, Linus Walleij
Cc: linux-kernel
Hi,
the commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0ce9ce408b6
causes a regression on my mvebu arm board (haven't tested on other
systems), wherein if I export a GPIO to sysfs and then unexport it, it
does not disasppear from the /sys/class/gpio directory, and subsequent
writes to the export and unexport files for the gpio fail.
$ cd /sys/class/gpio
$ ls
export gpiochip0 gpiochip32 gpiochip512 unexport
$ echo 43 >export
$ ls
export gpio43 gpiochip0 gpiochip32 gpiochip512
unexport
$ cat gpio43/value
1
$ echo 43 >unexport
$ ls
export gpio43 gpiochip0 gpiochip32 gpiochip512
unexport
$ echo 43 >unexport
ash: write error: Invalid argument
$ echo 43 >export
ash: write error: Operation not permitted
Marek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-08 8:28 regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing") Marek Behún
@ 2023-08-08 14:01 ` Andy Shevchenko
2023-08-11 10:16 ` Andy Shevchenko
1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-08 14:01 UTC (permalink / raw)
To: Marek Behún
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Tue, Aug 08, 2023 at 10:28:28AM +0200, Marek Behún wrote:
> Hi,
>
> the commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0ce9ce408b6
>
> causes a regression on my mvebu arm board (haven't tested on other
> systems), wherein if I export a GPIO to sysfs and then unexport it, it
> does not disasppear from the /sys/class/gpio directory, and subsequent
> writes to the export and unexport files for the gpio fail.
Thank you for the report. I'll look into this ASAP.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-08 8:28 regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing") Marek Behún
2023-08-08 14:01 ` Andy Shevchenko
@ 2023-08-11 10:16 ` Andy Shevchenko
2023-08-14 7:39 ` Marek Behún
1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-11 10:16 UTC (permalink / raw)
To: Marek Behún
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Tue, Aug 08, 2023 at 10:28:28AM +0200, Marek Behún wrote:
> Hi,
>
> the commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0ce9ce408b6
>
> causes a regression on my mvebu arm board (haven't tested on other
> systems), wherein if I export a GPIO to sysfs and then unexport it, it
> does not disasppear from the /sys/class/gpio directory, and subsequent
> writes to the export and unexport files for the gpio fail.
>
> $ cd /sys/class/gpio
> $ ls
> export gpiochip0 gpiochip32 gpiochip512 unexport
> $ echo 43 >export
> $ ls
> export gpio43 gpiochip0 gpiochip32 gpiochip512
> unexport
> $ cat gpio43/value
> 1
> $ echo 43 >unexport
> $ ls
> export gpio43 gpiochip0 gpiochip32 gpiochip512
> unexport
> $ echo 43 >unexport
> ash: write error: Invalid argument
> $ echo 43 >export
> ash: write error: Operation not permitted
Can you test the following change (I'll submit a formal patch if it works)?
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 530dfd19d7b5..b10a9b5598b2 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -515,8 +515,9 @@ static ssize_t unexport_store(const struct class *class,
* they may be undone on its behalf too.
*/
if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) {
+ gpiod_unexport(desc);
+ gpiod_free(desc);
status = 0;
- gpiod_free(desc);
}
done:
if (status)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-11 10:16 ` Andy Shevchenko
@ 2023-08-14 7:39 ` Marek Behún
2023-08-14 11:18 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Marek Behún @ 2023-08-14 7:39 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Fri, 11 Aug 2023 13:16:46 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Aug 08, 2023 at 10:28:28AM +0200, Marek Behún wrote:
> > Hi,
> >
> > the commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b0ce9ce408b6
> >
> > causes a regression on my mvebu arm board (haven't tested on other
> > systems), wherein if I export a GPIO to sysfs and then unexport it, it
> > does not disasppear from the /sys/class/gpio directory, and subsequent
> > writes to the export and unexport files for the gpio fail.
> >
> > $ cd /sys/class/gpio
> > $ ls
> > export gpiochip0 gpiochip32 gpiochip512 unexport
> > $ echo 43 >export
> > $ ls
> > export gpio43 gpiochip0 gpiochip32 gpiochip512
> > unexport
> > $ cat gpio43/value
> > 1
> > $ echo 43 >unexport
> > $ ls
> > export gpio43 gpiochip0 gpiochip32 gpiochip512
> > unexport
> > $ echo 43 >unexport
> > ash: write error: Invalid argument
> > $ echo 43 >export
> > ash: write error: Operation not permitted
>
> Can you test the following change (I'll submit a formal patch if it works)?
>
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 530dfd19d7b5..b10a9b5598b2 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -515,8 +515,9 @@ static ssize_t unexport_store(const struct class *class,
> * they may be undone on its behalf too.
> */
> if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) {
> + gpiod_unexport(desc);
> + gpiod_free(desc);
> status = 0;
> - gpiod_free(desc);
> }
> done:
> if (status)
>
tested, works.
Please add Fixes tag when sending the patch
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-14 7:39 ` Marek Behún
@ 2023-08-14 11:18 ` Andy Shevchenko
2023-08-14 11:55 ` Marek Behún
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-14 11:18 UTC (permalink / raw)
To: Marek Behún
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Mon, Aug 14, 2023 at 09:39:34AM +0200, Marek Behún wrote:
> On Fri, 11 Aug 2023 13:16:46 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> tested, works.
I convert this to the Tested-by tag, I hope you won't object.
But tell me if it's the case.
> Please add Fixes tag when sending the patch
Sure, it's done locally that day already :-)
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-14 11:18 ` Andy Shevchenko
@ 2023-08-14 11:55 ` Marek Behún
2023-08-14 12:26 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Marek Behún @ 2023-08-14 11:55 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Mon, 14 Aug 2023 14:18:25 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Aug 14, 2023 at 09:39:34AM +0200, Marek Behún wrote:
> > On Fri, 11 Aug 2023 13:16:46 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> ...
>
> > tested, works.
>
> I convert this to the Tested-by tag, I hope you won't object.
> But tell me if it's the case.
Yes, Tested-by, maybe even Reported-by.
Marek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing")
2023-08-14 11:55 ` Marek Behún
@ 2023-08-14 12:26 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-14 12:26 UTC (permalink / raw)
To: Marek Behún
Cc: Bartosz Golaszewski, linux-gpio, Linus Walleij, linux-kernel
On Mon, Aug 14, 2023 at 01:55:56PM +0200, Marek Behún wrote:
> On Mon, 14 Aug 2023 14:18:25 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > On Mon, Aug 14, 2023 at 09:39:34AM +0200, Marek Behún wrote:
> > > On Fri, 11 Aug 2023 13:16:46 +0300
> > > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
...
> > > tested, works.
> >
> > I convert this to the Tested-by tag, I hope you won't object.
> > But tell me if it's the case.
>
> Yes, Tested-by, maybe even Reported-by.
Both. As they are about different phases of the flow.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-14 12:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 8:28 regression from commit b0ce9ce408b6 ("gpiolib: Do not unexport GPIO on freeing") Marek Behún
2023-08-08 14:01 ` Andy Shevchenko
2023-08-11 10:16 ` Andy Shevchenko
2023-08-14 7:39 ` Marek Behún
2023-08-14 11:18 ` Andy Shevchenko
2023-08-14 11:55 ` Marek Behún
2023-08-14 12:26 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).