public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] i2c: configure parent device and OF node through the adapter struct
@ 2026-02-23  9:05 Bartosz Golaszewski
  2026-02-23  9:05 ` [PATCH v2 01/12] i2c: allow setting the " Bartosz Golaszewski
                   ` (13 more replies)
  0 siblings, 14 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23  9:05 UTC (permalink / raw)
  To: Wolfram Sang, Mukesh Kumar Savaliya, Viken Dadhaniya, Andi Shyti,
	Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Vignesh R, Aaro Koskinen,
	Janusz Krzysztofik, Tony Lindgren, Andreas Kemnade, Kevin Hilman,
	Roger Quadros, Geert Uytterhoeven, Magnus Damm, Patrice Chotard,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Linus Walleij, Frank Li
  Cc: Bartosz Golaszewski, linux-i2c, linux-kernel, linux-arm-msm,
	linux-omap, linux-renesas-soc, linux-arm-kernel, imx,
	linux-rpi-kernel, Bartosz Golaszewski

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@oss.qualcomm.com>
---
Changes in v2:
- fix a NULL-pointer dereference in gpio-rcar (Geert)
- rebase on top of v7.0-rc1
- collect tags
- Link to v1: https://lore.kernel.org/r/20251223-i2c-adap-dev-config-v1-0-4829b1cf0834@oss.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       | 6 +++---
 drivers/i2c/busses/i2c-st.c         | 4 ++--
 drivers/i2c/i2c-core-base.c         | 5 +++++
 include/linux/i2c.h                 | 4 ++++
 13 files changed, 29 insertions(+), 20 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20251223-i2c-adap-dev-config-9403ab811795

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-03-02  8:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23  9:05 [PATCH v2 00/12] i2c: configure parent device and OF node through the adapter struct Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 01/12] i2c: allow setting the " Bartosz Golaszewski
2026-03-02  7:47   ` Kalle Niemi
2026-03-02  8:55     ` Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 02/12] i2c: qcom-geni: set device parent and of_node " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 03/12] i2c: bcm-kona: " Bartosz Golaszewski
2026-02-23 17:30   ` Florian Fainelli
2026-02-23  9:05 ` [PATCH v2 04/12] i2c: keba: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 05/12] i2c: omap: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 06/12] i2c: rcar: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 07/12] i2c: st: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 08/12] i2c: mxs: " Bartosz Golaszewski
2026-02-23 17:19   ` Frank Li
2026-02-23  9:05 ` [PATCH v2 09/12] i2c: highlander: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 10/12] i2c: gpio: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 11/12] i2c: nomadik: " Bartosz Golaszewski
2026-02-23  9:05 ` [PATCH v2 12/12] i2c: bcm2835: " Bartosz Golaszewski
2026-02-23 11:32   ` Dave Stevenson
2026-02-23 17:31   ` Florian Fainelli
2026-02-23 14:08 ` [PATCH v2 00/12] i2c: configure parent device and OF node " Geert Uytterhoeven
2026-02-23 14:43   ` Bartosz Golaszewski
2026-02-26 20:24 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox