We want to convert the legacy gpio-keys platform device on BCM47XX boards to use software nodes. To do this properly and allow referencing the GPIO controller by address rather than relying on name-based matching (which is being removed from the gpiolib core), we need to associate the GPIO controller with a software node. Introduce ssb_gpio_swnode, register it, and associate it with the gpio_chip. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov --- drivers/ssb/driver_gpio.c | 27 ++++++++++++++++++++++++--- include/linux/ssb/ssb.h | 3 +++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c index 905657c925bc..8aebc4145454 100644 --- a/drivers/ssb/driver_gpio.c +++ b/drivers/ssb/driver_gpio.c @@ -15,8 +15,14 @@ #include #include #include +#include #include +const struct software_node ssb_gpio_swnode = { + .name = "ssb-gpio", +}; +EXPORT_SYMBOL_GPL(ssb_gpio_swnode); + /************************************************** * Shared @@ -232,6 +238,7 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus) chip->to_irq = ssb_gpio_to_irq; #endif chip->ngpio = 16; + chip->fwnode = software_node_fwnode(&ssb_gpio_swnode); /* There is just one SoC in one device and its GPIO addresses should be * deterministic to address them more easily. The other buses could get * a random base number. @@ -429,6 +436,7 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus) chip->to_irq = ssb_gpio_to_irq; #endif chip->ngpio = 5; + chip->fwnode = software_node_fwnode(&ssb_gpio_swnode); /* There is just one SoC in one device and its GPIO addresses should be * deterministic to address them more easily. The other buses could get * a random base number. @@ -464,11 +472,23 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus) int ssb_gpio_init(struct ssb_bus *bus) { + int err; + + err = software_node_register(&ssb_gpio_swnode); + if (err) + return err; + if (ssb_chipco_available(&bus->chipco)) - return ssb_gpio_chipco_init(bus); + err = ssb_gpio_chipco_init(bus); else if (ssb_extif_available(&bus->extif)) - return ssb_gpio_extif_init(bus); - return -1; + err = ssb_gpio_extif_init(bus); + else + err = -1; + + if (err) + software_node_unregister(&ssb_gpio_swnode); + + return err; } int ssb_gpio_unregister(struct ssb_bus *bus) @@ -476,6 +496,7 @@ int ssb_gpio_unregister(struct ssb_bus *bus) if (ssb_chipco_available(&bus->chipco) || ssb_extif_available(&bus->extif)) { gpiochip_remove(&bus->gpio); + software_node_unregister(&ssb_gpio_swnode); return 0; } return -1; diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 7fee9afa9458..b2b265674a4a 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -671,4 +671,7 @@ int ssb_pcibios_plat_dev_init(struct pci_dev *dev); int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); #endif /* CONFIG_SSB_EMBEDDED */ +struct software_node; +extern const struct software_node ssb_gpio_swnode; + #endif /* LINUX_SSB_H_ */ -- 2.55.0.rc0.799.gd6f94ed593-goog