Message ID | CAFy1UST8fzsM6tq4_yAZ1XbPyaMg4a0kBm5-_8r0E8NpgwGYag@mail.gmail.com |
---|---|
State | New |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);