Message ID | 20211203133003.31786-4-brgl@bgdev.pl |
---|---|
State | Accepted |
Commit | ac627260cf525300d5d13e67279a89911f1ad928 |
Headers | show |
Series | gpio-sim: configfs-based GPIO simulator | expand |
On Mon, Dec 6, 2021 at 2:55 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Fri, Dec 03, 2021 at 02:29:59PM +0100, Bartosz Golaszewski wrote: > > If the driver sets the fwnode in struct gpio_chip, let it take > > precedence over the of_node. > > By the way, have you tried this on pure DT-less/ACPI-less platform > (CONFIG_OF=n, CONFIG_ACPI=n)? I believe gpio-sim in that case won't work, > because this doesn't affect swnode case, right? > Works just fine on a BeagleBone Black - both the regular GPIO controllers as well as DT-instantiated gpio-sim. Bart
On Mon, Dec 06, 2021 at 03:03:31PM +0100, Bartosz Golaszewski wrote: > On Mon, Dec 6, 2021 at 2:55 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > > On Fri, Dec 03, 2021 at 02:29:59PM +0100, Bartosz Golaszewski wrote: > > > If the driver sets the fwnode in struct gpio_chip, let it take > > > precedence over the of_node. > > > > By the way, have you tried this on pure DT-less/ACPI-less platform > > (CONFIG_OF=n, CONFIG_ACPI=n)? I believe gpio-sim in that case won't work, > > because this doesn't affect swnode case, right? > > > > Works just fine on a BeagleBone Black - both the regular GPIO > controllers as well as DT-instantiated gpio-sim. Yeah, I realized that myself why.
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 0ad288ab6262..91dcf2c6cdd8 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -1046,6 +1046,9 @@ void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev) if (gc->parent) gdev->dev.of_node = gc->parent->of_node; + if (gc->fwnode) + gc->of_node = to_of_node(gc->fwnode); + /* If the gpiochip has an assigned OF node this takes precedence */ if (gc->of_node) gdev->dev.of_node = gc->of_node;
If the driver sets the fwnode in struct gpio_chip, let it take precedence over the of_node. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> --- drivers/gpio/gpiolib-of.c | 3 +++ 1 file changed, 3 insertions(+)