[PATCH 0/2] Add subsys_i2c_driver() helpers and convert MFD I2C drivers

From: Peng Fan

Date: Tue Dec 01 2026 - 04:46:11 EST


Many I2C drivers open-code their own init/exit functions because they need
to be registered at the subsys_initcall() level when built in, which
prevents them from using module_i2c_driver(). The recently added
subsys_driver() and subsys_platform_driver() helpers address this for
platform drivers; this series adds the I2C equivalents and converts the
MFD users.

Patch 1 adds two macros in <linux/i2c.h>:

- subsys_i2c_driver() for drivers that need an unregister path. It
replaces the subsys_initcall()/module_exit() pair.

- subsys_i2c_driver_probe() for drivers without an exit callback. It
replaces a bare subsys_initcall().

Patch 2 converts 34 MFD driver files: some use subsys_i2c_driver() and
some use subsys_i2c_driver_probe(). The error messages around i2c_add_driver()
are dropped because registration failures are already reported by the
driver core, and initcall_debug can be used to see initcall return values.
No functional change is intended.

Because patch 2 depends on patch 1, I can resend the conversion after the
helper is merged, or the MFD maintainer can take both patches through an
immutable branch.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
Peng Fan (2):
i2c: add subsys_i2c_driver() macro
mfd: Convert to subsys_i2c_driver()

drivers/mfd/88pm800.c | 13 +------------
drivers/mfd/88pm805.c | 13 +------------
drivers/mfd/88pm860x-core.c | 18 +-----------------
drivers/mfd/aat2870-core.c | 7 +------
drivers/mfd/act8945a.c | 13 +------------
drivers/mfd/as3711.c | 7 +------
drivers/mfd/da903x.c | 13 +------------
drivers/mfd/da9052-i2c.c | 21 +--------------------
drivers/mfd/da9055-i2c.c | 21 +--------------------
drivers/mfd/lm3533-core.c | 13 +------------
drivers/mfd/lochnagar-i2c.c | 13 +------------
drivers/mfd/lp8788.c | 13 +------------
drivers/mfd/max77843.c | 7 +------
drivers/mfd/max8907.c | 19 +------------------
drivers/mfd/max8925-i2c.c | 13 +------------
drivers/mfd/max8997.c | 7 +------
drivers/mfd/max8998.c | 7 +------
drivers/mfd/mc13xxx-i2c.c | 13 +------------
drivers/mfd/palmas.c | 13 +------------
drivers/mfd/rc5t583.c | 7 +------
drivers/mfd/rohm-bd718x7.c | 13 +------------
drivers/mfd/rohm-bd96801.c | 14 +-------------
drivers/mfd/rsmu_i2c.c | 13 +------------
drivers/mfd/tc3589x.c | 13 +------------
drivers/mfd/tps6105x.c | 13 +------------
drivers/mfd/tps65010.c | 15 +--------------
drivers/mfd/tps6507x.c | 13 +------------
drivers/mfd/tps65090.c | 7 +------
drivers/mfd/tps65217.c | 13 +------------
drivers/mfd/tps6586x.c | 13 +------------
drivers/mfd/tps65910.c | 7 +------
drivers/mfd/wm831x-i2c.c | 13 +------------
drivers/mfd/wm8350-i2c.c | 7 +------
drivers/mfd/wm8400-core.c | 15 +--------------
include/linux/i2c.h | 23 +++++++++++++++++++++++
35 files changed, 57 insertions(+), 386 deletions(-)
---
base-commit: e5aad2bdbbee783611d32599f89cea3f12f9593d
change-id: 20261201-add-i2c-subsys-mfd-120cdb5f68a1

Best regards,
--
Peng Fan <peng.fan@xxxxxxx>