[PATCH] reset: gpio: Parent the reset-gpio device to the GPIO controller
From: Abel Vesa
Date: Mon Oct 26 2026 - 08:26:35 EST
The reset-gpio auxiliary device is a child of the GPIO device providing
the reset line. That GPIO device is unregistered when its controller is
unbound, which removes the sysfs directory of the reset-gpio device with
it, while the reset-gpio device itself stays registered. When the
controller is bound again, probing the reset-gpio device fails:
reset_gpio reset.gpio.0: really_probe: driver_sysfs_add failed
and so do the consumers of its reset line. This happens for example with
the LPASS LPI pin controller, which goes away together with the ADSP.
Make the controller the parent instead, which stays registered while it
is unbound and gets a new GPIO device when it is bound again. Keep using
the GPIO device if it has no parent.
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
Prepared with help from an LLM-based assistant.
---
drivers/reset/core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 38e189d04d09..a1b82e093915 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -1015,7 +1015,7 @@ static int __reset_add_reset_gpio_device(struct fwnode_handle *fwnode,
struct property_entry properties[3] = { };
unsigned int offset, flags, lflags;
struct reset_gpio_lookup *rgpio_dev;
- struct device *parent;
+ struct device *parent, *aux_parent;
int ret, prop = 0;
/*
@@ -1093,7 +1093,15 @@ static int __reset_add_reset_gpio_device(struct fwnode_handle *fwnode,
goto err_put_fwnode;
}
- ret = reset_create_gpio_aux_device(rgpio_dev, parent);
+ /*
+ * The GPIO device goes away when its controller is unbound, which would
+ * leave the reset-gpio device without a place in sysfs. Hang it off the
+ * controller instead, which stays around and gets a new GPIO device
+ * when it is bound again. gpiolib parents the GPIO device to the chip's
+ * parent device, if any; otherwise fall back to the GPIO device itself.
+ */
+ aux_parent = parent->parent ?: parent;
+ ret = reset_create_gpio_aux_device(rgpio_dev, aux_parent);
if (ret)
goto err_del_swnode;
---
base-commit: bd1ecbb61afefc6a8b876ccbc31e9228b44e9eab
change-id: 20261023-b4-reset-gpio-parent-to-gpio-controller-6401488d80ad
Best regards,
--
Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>