Skip to contentSkip to conversation

gpiolib: acpi: make fwnode take precedence in struct gpio_chip

PATCH Applied Andy Shevchenko 4 participants 6 messages Dec 23, 2021 – Jan 3, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gpiolib: acpi: make fwnode take precedence in struct gpio_chip

If the driver sets the fwnode in struct gpio_chip, let it take precedence over the parent's fwnode.

This is a follow up to the commit 9126a738edc1 ("gpiolib: of: make fwnode take precedence in struct gpio_chip").

---
 drivers/gpio/gpiolib-acpi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpio/gpiolib-acpi.c +3 -0
index c7a0e56593e7..c0f6a25c3279 100644
@@ -1339,6 +1339,9 @@ void acpi_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)
 	/* Set default fwnode to parent's one if present */
 	if (gc->parent)
 		ACPI_COMPANION_SET(&gdev->dev, ACPI_COMPANION(gc->parent));
+
+	if (gc->fwnode)
+		device_set_node(&gdev->dev, gc->fwnode);
 }
 
 static int acpi_gpio_package_count(const union acpi_object *obj)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 gpio: dwapb: Switch to use fwnode instead of of_node

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it and hence rectify the ACPI case which uses software nodes.

Note, in this case it's rather logical fix that doesn't affect functionality, thus no backporting required.

---
 drivers/gpio/gpio-dwapb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-dwapb.c +1 -4
index ec0767d7800d..b0f3aca61974 100644
@@ -15,7 +15,6 @@
 #include <linux/irq.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 #include <linux/reset.h>
@@ -515,9 +514,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
 		return err;
 	}
 
-#ifdef CONFIG_OF_GPIO
-	port->gc.of_node = to_of_node(pp->fwnode);
-#endif
+	port->gc.fwnode = pp->fwnode;
 	port->gc.ngpio = pp->ngpio;
 	port->gc.base = pp->gpio_base;
 
Signature · 1 line
2.34.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH v1 2/2] gpio: dwapb: Switch to use fwnode instead of of_node

Quoted 6 lines · Andy Shevchenko

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it and hence rectify the ACPI case which uses software nodes.

Note, in this case it's rather logical fix that doesn't affect functionality, thus no backporting required.

Thanks for the patch.

-Sergey

Quoted 32 lines
---
 drivers/gpio/gpio-dwapb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-dwapb.c +1 -4
index ec0767d7800d..b0f3aca61974 100644
@@ -15,7 +15,6 @@
 #include <linux/irq.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 #include <linux/reset.h>
@@ -515,9 +514,7 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
 		return err;
 	}
 
-#ifdef CONFIG_OF_GPIO
-	port->gc.of_node = to_of_node(pp->fwnode);
-#endif
+	port->gc.fwnode = pp->fwnode;
 	port->gc.ngpio = pp->ngpio;
 	port->gc.base = pp->gpio_base;
 
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v1 2/2] gpio: dwapb: Switch to use fwnode instead of of_node

In reply to Andy Shevchenko
Quoted 10 lines · Andy Shevchenko

GPIO library now accepts fwnode as a firmware node, so switch the driver to use it and hence rectify the ACPI case which uses software nodes.

Note, in this case it's rather logical fix that doesn't affect functionality, thus no backporting required.

---

Applied, thanks!

Bart