[PATCH v2 00/13] i2c: add and start using i2c_adapter-specific printk helpers

From: Bartosz Golaszewski

Date: Mon Feb 23 2026 - 04:00:13 EST


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 device printk() helpers
(dev_err() et al). It introduces a set of i2c-specific helpers and
starts using them across bus drivers. 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: [1] https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@xxxxxxxxxx/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
Changes in v2:
- Add a patch renaming an existing i2c_dbg() macro in a media driver
- Link to v1: https://lore.kernel.org/r/20251223-i2c-printk-helpers-v1-0-46a08306afdb@xxxxxxxxxxxxxxxx

---
Bartosz Golaszewski (13):
media: saa7134: rename i2c_dbg() to saa7134_i2c_dbg()
i2c: add i2c_adapter-specific printk helpers
i2c: sun6i-p2wi: use i2c_adapter-specific printk helpers
i2c: mlxbf: use i2c_adapter-specific printk helpers
i2c: isch: use i2c_adapter-specific printk helpers
i2c: ali1535: use i2c_adapter-specific printk helpers
i2c: scmi: use i2c_adapter-specific printk helpers
i2c: ali15x3: use i2c_adapter-specific printk helpers
i2c: powermac: use i2c_adapter-specific printk helpers
i2c: owl: use i2c_adapter-specific printk helpers
i2c: nforce2: use i2c_adapter-specific printk helpers
i2c: amd756: use i2c_adapter-specific printk helpers
i2c: piix4: use i2c_adapter-specific printk helpers

drivers/i2c/busses/i2c-ali1535.c | 20 ++++++++++----------
drivers/i2c/busses/i2c-ali15x3.c | 20 ++++++++++----------
drivers/i2c/busses/i2c-amd756.c | 24 ++++++++++++------------
drivers/i2c/busses/i2c-isch.c | 32 ++++++++++++++++----------------
drivers/i2c/busses/i2c-mlxbf.c | 19 +++++++++----------
drivers/i2c/busses/i2c-nforce2.c | 14 +++++++-------
drivers/i2c/busses/i2c-owl.c | 4 ++--
drivers/i2c/busses/i2c-piix4.c | 8 ++++----
drivers/i2c/busses/i2c-powermac.c | 26 +++++++++++++-------------
drivers/i2c/busses/i2c-scmi.c | 6 +++---
drivers/i2c/busses/i2c-sun6i-p2wi.c | 8 ++++----
drivers/media/pci/saa7134/saa7134-i2c.c | 26 +++++++++++++-------------
include/linux/i2c.h | 6 ++++++
13 files changed, 109 insertions(+), 104 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20251222-i2c-printk-helpers-a69f4403ca70

Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>