[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251223-i2c-adap-dev-config-v1-0-4829b1cf0834@oss.qualcomm.com>
Date: Tue, 23 Dec 2025 11:04:38 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Mukesh Kumar Savaliya <mukesh.savaliya@....qualcomm.com>,
Viken Dadhaniya <viken.dadhaniya@....qualcomm.com>,
Andi Shyti <andi.shyti@...nel.org>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Ray Jui <rjui@...adcom.com>, Scott Branden <sbranden@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Vignesh R <vigneshr@...com>, Aaro Koskinen <aaro.koskinen@....fi>,
Janusz Krzysztofik <jmkrzyszt@...il.com>,
Tony Lindgren <tony@...mide.com>,
Andreas Kemnade <andreas@...nade.info>,
Kevin Hilman <khilman@...libre.com>, Roger Quadros <rogerq@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Patrice Chotard <patrice.chotard@...s.st.com>,
Shawn Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Linus Walleij <linusw@...nel.org>
Cc: Bartosz Golaszewski <brgl@...nel.org>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-omap@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
linux-rpi-kernel@...ts.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Subject: [PATCH 00/12] i2c: configure parent device and OF node through the
adapter struct
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/.
[1] https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
---
Bartosz Golaszewski (12):
i2c: allow setting the parent device and OF node through the adapter struct
i2c: qcom-geni: set device parent and of_node through the adapter struct
i2c: bcm-kona: set device parent and of_node through the adapter struct
i2c: keba: set device parent and of_node through the adapter struct
i2c: omap: set device parent and of_node through the adapter struct
i2c: rcar: set device parent and of_node through the adapter struct
i2c: st: set device parent and of_node through the adapter struct
i2c: mxs: set device parent and of_node through the adapter struct
i2c: highlander: set device parent and of_node through the adapter struct
i2c: gpio: set device parent and of_node through the adapter struct
i2c: nomadik: set device parent and of_node through the adapter struct
i2c: bcm2835: set device parent and of_node through the adapter struct
drivers/i2c/busses/i2c-bcm-kona.c | 4 ++--
drivers/i2c/busses/i2c-bcm2835.c | 4 ++--
drivers/i2c/busses/i2c-gpio.c | 2 +-
drivers/i2c/busses/i2c-highlander.c | 2 +-
drivers/i2c/busses/i2c-keba.c | 2 +-
drivers/i2c/busses/i2c-mxs.c | 4 ++--
drivers/i2c/busses/i2c-nomadik.c | 4 ++--
drivers/i2c/busses/i2c-omap.c | 4 ++--
drivers/i2c/busses/i2c-qcom-geni.c | 4 ++--
drivers/i2c/busses/i2c-rcar.c | 4 ++--
drivers/i2c/busses/i2c-st.c | 4 ++--
drivers/i2c/i2c-core-base.c | 5 +++++
include/linux/i2c.h | 4 ++++
13 files changed, 28 insertions(+), 19 deletions(-)
---
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
change-id: 20251223-i2c-adap-dev-config-9403ab811795
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
Powered by blists - more mailing lists