public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] i2c: provide and use i2c_adapter_dev()
@ 2025-12-23 10:08 Bartosz Golaszewski
  2025-12-23 10:08 ` [PATCH 1/6] i2c: provide i2c_adapter_dev() Bartosz Golaszewski
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:08 UTC (permalink / raw)
  To: Wolfram Sang, Jean Delvare, Andi Shyti, Shyam Sundar S K,
	Nirujogi Pratap, Bin Du, Mika Westerberg, Andy Shevchenko,
	Jan Dabros, Gregory CLEMENT, Hans Hu
  Cc: Bartosz Golaszewski, linux-i2c, linux-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.

Other series address more generic problems - like printk helpers and
parent/of_node setting - but there are still some more specific
use-cases of drivers dereferencing the internal struct device of
i2c_adapters. We need to hide the fact that the device is embedded in
i2c_adapter before we can move it out so provide a helper that provides
the address of struct device without showing how it's stored and use it
in some drivers.

[1] https://lore.kernel.org/all/20251106152330.11733-1-tzungbi@kernel.org/

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Bartosz Golaszewski (6):
      i2c: provide i2c_adapter_dev()
      i2c: piix4: use i2c_adapter_dev()
      i2c: amd-asf-plat: use i2c_adapter_dev()
      i2c: designware-amdisp: use i2c_adapter_dev()
      i2c: mv64xxx: use i2c_adapter_dev()
      i2c: viai2c-zhaoxin: use i2c_adapter_dev()

 drivers/i2c/busses/i2c-amd-asf-plat.c      | 4 ++--
 drivers/i2c/busses/i2c-designware-amdisp.c | 2 +-
 drivers/i2c/busses/i2c-mv64xxx.c           | 4 ++--
 drivers/i2c/busses/i2c-piix4.c             | 6 +++---
 drivers/i2c/busses/i2c-viai2c-zhaoxin.c    | 2 +-
 include/linux/i2c.h                        | 5 +++++
 6 files changed, 14 insertions(+), 9 deletions(-)
---
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
change-id: 20251222-i2c-adapter-dev-wrapper-c882660190a2

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


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

end of thread, other threads:[~2026-01-13 10:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 10:08 [PATCH 0/6] i2c: provide and use i2c_adapter_dev() Bartosz Golaszewski
2025-12-23 10:08 ` [PATCH 1/6] i2c: provide i2c_adapter_dev() Bartosz Golaszewski
2025-12-23 10:08 ` [PATCH 2/6] i2c: piix4: use i2c_adapter_dev() Bartosz Golaszewski
2026-01-12  9:44   ` Jean Delvare
2026-01-13 10:24     ` Wolfram Sang
2025-12-23 10:08 ` [PATCH 3/6] i2c: amd-asf-plat: " Bartosz Golaszewski
2025-12-23 11:21   ` Shyam Sundar S K
2025-12-23 10:08 ` [PATCH 4/6] i2c: designware-amdisp: " Bartosz Golaszewski
2025-12-27 14:29   ` Andy Shevchenko
2025-12-27 14:30     ` Andy Shevchenko
2026-01-05 19:26   ` Nirujogi, Pratap
2026-01-05 21:42     ` Andy Shevchenko
2025-12-23 10:08 ` [PATCH 5/6] i2c: mv64xxx: " Bartosz Golaszewski
2026-01-05 13:51   ` Gregory CLEMENT
2025-12-23 10:08 ` [PATCH 6/6] i2c: viai2c-zhaoxin: " Bartosz Golaszewski
2025-12-27 14:31   ` Andy Shevchenko

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