From: Adrian Ambrozewicz <aambrozewicz@nvidia.com>
To: Saravana Kannan <saravanak@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>, Rob Herring <robh@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>, Lee Jones <lee@kernel.org>,
Pavel Machek <pavel@kernel.org>,
Herve Codina <herve.codina@bootlin.com>,
driver-core@lists.linux.dev, devicetree@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-leds@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: fw_devlink: consumers are not linked again when a gpiochip is re-added
Date: Wed, 25 Nov 2026 13:07:40 +0200 [thread overview]
Message-ID: <20261125110739.3760281-2-aambrozewicz@nvidia.com> (raw)
Hi Saravana,
When a gpiochip is removed and added again for the same DT node, its
consumers do not follow it. We hit it with a USB GPIO expander in DT
(emulated so far). gpio-sim shows it on v7.3-rc7 (arm64 QEMU virt):
gpio-sim {
compatible = "gpio-simulator";
sim: bank0 {
gpio-controller;
#gpio-cells = <2>;
ngpios = <16>;
gpio-sim,label = "sim-bank0";
};
};
leds {
compatible = "gpio-leds";
power_led { gpios = <&sim 2 GPIO_ACTIVE_LOW>; };
fault_led { gpios = <&sim 6 GPIO_ACTIVE_HIGH>; };
uid_led { gpios = <&sim 9 GPIO_ACTIVE_HIGH>; };
};
regulator-own {
compatible = "regulator-fixed";
regulator-name = "own_node_consumer";
gpio = <&sim 4 GPIO_ACTIVE_HIGH>;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
enable-active-high;
regulator-always-on;
regulator-boot-on;
};
# echo gpio-sim > /sys/bus/platform/drivers/gpio-sim/unbind
# echo gpio-sim > /sys/bus/platform/drivers/gpio-sim/bind
regulator-own has a managed link to the gpiochip. It is unbound with
gpio-sim and not probed again: nothing re-queues it, and its fwnode link
went with the first device link (drivers/base/core.c:2331, :2373).
leds has no device link to the gpiochip even before the unbind. From the
code, references in child nodes get SYNC_STATE_ONLY links (:2221), which
are dropped when leds binds (:1440). It stays bound and holds no line on
the new chip. Each new link is refused because leds has probed
(:851-859):
leds-gpio leds: Failed to create device link (0x180) with supplier gpiochip2 for /leds/uid_led
The leds half does not need the device to go: with the same consumers on
QEMU virt's PL061 GPIO controller and only its driver rebound,
regulator-own is probed again, but leds holds no line on the new
gpiochip. From the code, an I2C expander on a rebound I2C controller
hits both halves.
Herve reported the leds case in 2024 and you called it a generic gap for
class devices [1]; in August you offered to write class device support
for device links [2]. The regulator case matches your 2023 suggestion
[3], though from the code a re-queued consumer would have no device link
afterwards. I found no later series for either.
Is the class device series still planned, and would it cover a gpiochip
that is removed and added again? Herve's leds-gpio link, ported to
v7.3-rc7, only gets leds unbound when the GPIO goes; nothing probes it
again when the chip returns. Would that be acceptable meanwhile? I can
test either with this reproducer.
[1] https://lore.kernel.org/all/CAGETcx_=g1dCH=YMUkc7VquUmLs=bNZMspUxH+V49uhcV0Bx2w@mail.gmail.com/
[2] https://lore.kernel.org/all/CACRMN=fEPoyEk1oi4QRMX0whMEF=xQv=kkd62bueKTKWtxDedA@mail.gmail.com/
[3] https://lore.kernel.org/all/CAGETcx_fXa6Zt_gkTQKw8Wt11EmSt8ZQ6TxKi5P+5ii3EvwsdA@mail.gmail.com/
Thanks,
Adrian
reply other threads:[~2026-11-25 11:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261125110739.3760281-2-aambrozewicz@nvidia.com \
--to=aambrozewicz@nvidia.com \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=herve.codina@bootlin.com \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®