[PATCH] gpio: swnode: remove deprecated lookup mechanism
From: Bartosz Golaszewski
Date: Mon Jun 29 2026 - 06:56:20 EST
GPIO software node lookup should rely exclusively on matching the
addresses of the referenced firmware nodes. Commit e5d527be7e69 ("gpio:
swnode: don't use the swnode's name as the key for GPIO lookup") tried to
enforce this but had to be reverted: it broke existing users who abused
the software node mechanism by creating "dummy" software nodes named
after the device they want to get GPIOs from, without ever attaching them
to the actual GPIO devices. Those users relied on GPIOLIB matching the
label of the GPIO controller against the name of the software node rather
than on a real firmware node link.
All such users have now been coverted to using attached software nodes
via the fwnode address lookup path and the kernel documentation has been
updated to recommend it as the correct approach. This allows us to remove
the old behavior.
This will allow us to leverage the upcoming support for fw_devlink for
software nodes in GPIO core.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib-swnode.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/drivers/gpio/gpiolib-swnode.c b/drivers/gpio/gpiolib-swnode.c
index 8d9591aa9304d1eac931d1cb19597ae4b99c40a2..4aa3f3406caaf7e049aa1da153d790e65de3008c 100644
--- a/drivers/gpio/gpiolib-swnode.c
+++ b/drivers/gpio/gpiolib-swnode.c
@@ -41,27 +41,7 @@ static struct gpio_device *swnode_get_gpio_device(struct fwnode_handle *fwnode)
return ERR_PTR(-ENOENT);
fwnode_lookup:
- gdev = gpio_device_find_by_fwnode(fwnode);
- if (!gdev && gdev_node && gdev_node->name)
- /*
- * FIXME: We shouldn't need to compare the GPIO controller's
- * label against the software node that is supposedly attached
- * to it. However there are currently GPIO users that - knowing
- * the expected label of the GPIO chip whose pins they want to
- * control - set up dummy software nodes named after those GPIO
- * controllers, which aren't actually attached to them. In this
- * case gpio_device_find_by_fwnode() will fail as no device on
- * the GPIO bus is actually associated with the fwnode we're
- * looking for.
- *
- * As a fallback: continue checking the label if we have no
- * match. However, the situation described above is an abuse
- * of the software node API and should be phased out and the
- * following line - eventually removed.
- */
- gdev = gpio_device_find_by_label(gdev_node->name);
-
- return gdev ?: ERR_PTR(-EPROBE_DEFER);
+ return gpio_device_find_by_fwnode(fwnode) ?: ERR_PTR(-EPROBE_DEFER);
}
static int swnode_gpio_get_reference(const struct fwnode_handle *fwnode,
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260625-gpio-swnode-drop-label-matching-a975ad5f0e40
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>