All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFD] does abi of sysfs of gpio change?
@ 2016-02-24 14:35 Bamvor Zhang Jian
  2016-02-25 15:12 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Bamvor Zhang Jian @ 2016-02-24 14:35 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij
  Cc: Grant Likely, Markus Pargmann, Johan Hovold, Michael Welling,
	Alexandre Courbot, Bamvor Zhang Jian

Hi, guys

I am working on writing a gpio mockup driver(for test the gpio framework).
I found that in the lastest for-next branch of linux-gpio, the path of gpiochip
in device directory is changed from
`/sys/devices/platform/gpio-mockup/gpio/gpiochip*`
to
`/sys/devices/platform/gpio-mockup/gpiochip*/gpio`.

And secondly, the name of gpiochip in the devices directory is changed from
gpiochipBASE to gpiochipSEQ, e.g. there are two gpiochip([0,31],[32,63]) in my
device. It changed from
`/sys/devices/platform/gpio-mockup/gpio/gpiochip0`
`/sys/devices/platform/gpio-mockup/gpio/gpiochip32`
to
`/sys/devices/platform/gpio-mockup/gpiochip0/gpio`
`/sys/devices/platform/gpio-mockup/gpiochip1/gpio`

IIUC, this change may break the script which depend on it.
Is it intended to do it?

And it could be fix by reverting one line from commit 5031fbdf5365
("gpio: move sysfs mock device to the gpio_device").

Regards

Bamvor

>From be7699ddea0fd0e2b0712cc8f50318595cad553c Mon Sep 17 00:00:00 2001
From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Date: Wed, 24 Feb 2016 22:17:19 +0800
Subject: [PATCH] fix abi changes of sysfs

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
---
drivers/gpio/gpiolib-sysfs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index c563094..db39464 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -721,6 +721,7 @@ EXPORT_SYMBOL_GPL(gpiod_unexport);
int gpiochip_sysfs_register(struct gpio_device *gdev)
{
   struct device   *dev;
+   struct device   *parent;
   struct gpio_chip *chip = gdev->chip;

   /*
@@ -733,7 +734,12 @@ int gpiochip_sysfs_register(struct gpio_device *gdev)
       return 0;

   /* use chip->base for the ID; it's already known to be unique */
-   dev = device_create_with_groups(&gpio_class, &gdev->dev,
+   if (chip->parent)
+       parent = chip->parent;
+   else
+       parent = &gdev->dev;
+
+   dev = device_create_with_groups(&gpio_class, parent,
                   MKDEV(0, 0),
                   chip, gpiochip_groups,
                   "gpiochip%d", chip->base);
--
2.6.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFD] does abi of sysfs of gpio change?
  2016-02-24 14:35 [RFD] does abi of sysfs of gpio change? Bamvor Zhang Jian
@ 2016-02-25 15:12 ` Linus Walleij
  2016-02-26  7:14   ` Bamvor Zhang Jian
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2016-02-25 15:12 UTC (permalink / raw)
  To: Bamvor Zhang Jian
  Cc: linux-gpio, Grant Likely, Markus Pargmann, Johan Hovold,
	Michael Welling, Alexandre Courbot

On Wed, Feb 24, 2016 at 3:35 PM, Bamvor Zhang Jian
<bamvor.zhangjian@linaro.org> wrote:

> I am working on writing a gpio mockup driver(for test the gpio framework).
> I found that in the lastest for-next branch of linux-gpio, the path of gpiochip
> in device directory is changed from
> `/sys/devices/platform/gpio-mockup/gpio/gpiochip*`
> to
> `/sys/devices/platform/gpio-mockup/gpiochip*/gpio`.
(...)
> IIUC, this change may break the script which depend on it.
> Is it intended to do it?

No, I screwed up :(

> From be7699ddea0fd0e2b0712cc8f50318595cad553c Mon Sep 17 00:00:00 2001
> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
> Date: Wed, 24 Feb 2016 22:17:19 +0800
> Subject: [PATCH] fix abi changes of sysfs

It was impossible to extract this patch because of some
HTML formatting, but I rewrote the patch, adding some extra
comments and commit message, and applied. Check the result
in my devel branch.

I also have a bad conscience for not looking at you patches,
I've been swamped, sorry :(

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFD] does abi of sysfs of gpio change?
  2016-02-25 15:12 ` Linus Walleij
@ 2016-02-26  7:14   ` Bamvor Zhang Jian
  0 siblings, 0 replies; 3+ messages in thread
From: Bamvor Zhang Jian @ 2016-02-26  7:14 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-gpio, Grant Likely, Markus Pargmann, Johan Hovold,
	Michael Welling, Alexandre Courbot

Hi, Linus

On 25 February 2016 at 23:12, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Feb 24, 2016 at 3:35 PM, Bamvor Zhang Jian
> <bamvor.zhangjian@linaro.org> wrote:
>
>> I am working on writing a gpio mockup driver(for test the gpio framework).
>> I found that in the lastest for-next branch of linux-gpio, the path of gpiochip
>> in device directory is changed from
>> `/sys/devices/platform/gpio-mockup/gpio/gpiochip*`
>> to
>> `/sys/devices/platform/gpio-mockup/gpiochip*/gpio`.
> (...)
>> IIUC, this change may break the script which depend on it.
>> Is it intended to do it?
>
> No, I screwed up :(
>
>> From be7699ddea0fd0e2b0712cc8f50318595cad553c Mon Sep 17 00:00:00 2001
>> From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
>> Date: Wed, 24 Feb 2016 22:17:19 +0800
>> Subject: [PATCH] fix abi changes of sysfs
>
> It was impossible to extract this patch because of some
> HTML formatting, but I rewrote the patch, adding some extra
> comments and commit message, and applied. Check the result
> in my devel branch.
I test this patch in your devel branch. It works for me.
And I found that I could not boot qemu-system-aarch64 on your
devel branch. It works if I rebase those(105) patches to 4.5-rc4.
It is ok before 4.5 either.
Maybe there is some bug for support qemu in 4.5-rc1. But It is
not relative the patches of gpio in devel branch.
>
> I also have a bad conscience for not looking at you patches,
> I've been swamped, sorry :(
Glad to know I could help. I find other issue when I try to test
my gpio mockup driver base on the latest code.
I will start a new thread to discuss it.

Regards

Bamvor
>
> Yours,
> Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-26  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-24 14:35 [RFD] does abi of sysfs of gpio change? Bamvor Zhang Jian
2016-02-25 15:12 ` Linus Walleij
2016-02-26  7:14   ` Bamvor Zhang Jian

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.