[PATCH v2 00/12] i2c: configure parent device and OF node through the adapter struct
Wolfram Sang
wsa+renesas at sang-engineering.com
Thu Feb 26 12:24:00 PST 2026
On Mon, Feb 23, 2026 at 10:05:46AM +0100, Bartosz Golaszewski wrote:
> It's been another year of discussing the object life-time problems at
> conferences. I2C is one of the offenders and its problems are more
> complex than those of some other subsystems. It seems the revocable[1]
> API may make its way into the kernel this year but even with it in
> place, I2C won't be able to use it as there's currently nothing to
> *revoke*. The struct device is embedded within the i2c_adapter struct
> whose lifetime is tied to the provider device being bound to its driver.
>
> Fixing this won't be fast and easy but nothing's going to happen if we
> don't start chipping away at it. The ultimate goal in order to be able
> to use an SRCU-based solution (revocable or otherwise) is to convert the
> embedded struct device in struct i2c_adapter into an __rcu pointer that
> can be *revoked*. To that end we need to hide all dereferences of
> adap->dev in drivers.
>
> This series addresses the usage of adap->dev in probe() callbacks where
> drivers assign the parent device address and the associated OF-node
> directly to the struct device embedded in i2c_adapter. We extend the
> latter struct to accept the parent struct device and of_node directly
> and make it assign it to its internal struct device inside
> i2c_register_adapter(). For now just 12 patches but I'll keep on doing it
> if these get accepted. Once these get upstream for v6.20/7.0, we'll be
> able to also start converting i2c drivers outside of drivers/i2c/.
>
> Link: https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at oss.qualcomm.com>
Also applied (and squashed) to for-current. Tags are retained BTW.
More information about the linux-arm-kernel
mailing list