Re: [PATCH v3 08/14] reset: handle removing supplier before consumers

From: Philipp Zabel

Date: Mon Mar 09 2026 - 03:47:41 EST


On Fr, 2026-03-06 at 18:22 +0100, Bartosz Golaszewski wrote:
> Except for the reset-gpio, all reset drivers use device tree - and as
> such - benefit from the device links set up by driver core. This means,
> that no reset supplier will be unbound before all its consumers have
> been. For this reason, nobody bothered making the reset core resiliant
> to the object life-time issues that are plagueing the kernel. In this
> case: reset control handles referencing the reset provider device with
> no serialization or NULL-pointer checking.
>
> We now want to make the reset core fwnode-agnostic but before we do, we
> must make sure it can survive unbinding of suppliers with consumers
> still holding reset control handles.
>
> To that end: use SRCU to protect the rcdev pointer inside struct
> reset_control. We protect all sections using the pointer with SRCU
> read-only critical sections and synchronize SRCU after every
> modification of the pointer.
>
> This is in line with what the GPIO subsystem does and what the proposed
> revocable API tries to generalize. When and if the latter makes its way
> into the kernel, reset core could potentially also be generalized to use
> it.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>

Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

regards
Philipp