i3c: Add stub functions when I3C support is disabled
Frank Li
reviewerPATCH 1/1 i3c: Add stub functions when I3C support is disabled
When I3C is disabled, unused functions are removed by the linker because the driver relies on regmap and no I3C devices are registered, so normal I3C paths are never called.
However, some drivers may still call low-level I3C transfer helpers. Provide stub implementations to avoid adding conditional ifdefs everywhere.
Add stubs for i3c_device_do_xfers() and i3c_device_get_supported_xfer_mode() only. Other stubs will be introduced when they are actually needed.
--- include/linux/i3c/device.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
include/linux/i3c/device.h +15 -1
@@ -308,8 +308,23 @@ static __always_inline void i3c_i2c_driver_unregister(struct i3c_driver *i3cdrv, i3c_i2c_driver_unregister, \ __i2cdrv) +#if IS_ENABLED (CONFIG_I3C )int i3c_device_do_xfers (struct i3c_device *dev,struct i3c_xfer *xfers,int nxfers,enum i3c_xfer_mode mode); +u32 i3c_device_get_supported_xfer_mode (struct i3c_device *dev); +#else +static inline int +i3c_device_do_xfers (struct i3c_device *dev,struct i3c_xfer *xfers, +int nxfers,enum i3c_xfer_mode mode) +{ +return -EOPNOTSUPP ; +} + +static inline u32 i3c_device_get_supported_xfer_mode (struct i3c_device *dev) +{ +return 0 ; +} +#endif static inline int i3c_device_do_priv_xfers(struct i3c_device *dev, struct i3c_xfer *xfers,
@@ -358,6 +373,5 @@ int i3c_device_request_ibi(struct i3c_device *dev,void i3c_device_free_ibi (struct i3c_device *dev);int i3c_device_enable_ibi (struct i3c_device *dev);int i3c_device_disable_ibi (struct i3c_device *dev); -u32 i3c_device_get_supported_xfer_mode (struct i3c_device *dev);#endif /* I3C_DEV_H */
Signature · 1 line
2.34.1
Quoted 8 lines · Frank Li
When I3C is disabled, unused functions are removed by the linker because the driver relies on regmap and no I3C devices are registered, so normal I3C paths are never called.
However, some drivers may still call low-level I3C transfer helpers. Provide stub implementations to avoid adding conditional ifdefs everywhere.
[...]
Applied, thanks!
[1/1] i3c: Add stub functions when I3C support is disabled
https://git.kernel.org/i3c/c/8564f88df202
Best regards,
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 8 lines · On Wed, 14 Jan 2026 16:02:06 +0100 Alexandre Belloni…
Quoted 7 lines · Frank Li
When I3C is disabled, unused functions are removed by the linker because the driver relies on regmap and no I3C devices are registered, so normal I3C paths are never called.
However, some drivers may still call low-level I3C transfer helpers. Provide stub implementations to avoid adding conditional ifdefs everywhere.
Quoted 9 lines
Quoted 1 line
[...]
Applied, thanks!
[1/1] i3c: Add stub functions when I3C support is disabled
https://git.kernel.org/i3c/c/8564f88df202Best regards,
Hi Alexandre,
This is going to make for an 'interesting' merge window as I'm getting build failures without that patch. I don't suppose you'd mind doing an immutable branch?
If not, maybe best bet is some local ifdefs that we back out next merge window. I don't really want to kick the driver back a cycle just for this.
Thanks,
Jonathan
Alexandre Belloni
maintainerHello,
Quoted 18 lines · Jonathan Cameron
Quoted 15 lines · On Wed, 14 Jan 2026 16:02:06 +0100 Alexandre Belloni…
Quoted 8 lines · Frank Li
When I3C is disabled, unused functions are removed by the linker because the driver relies on regmap and no I3C devices are registered, so normal I3C paths are never called.
However, some drivers may still call low-level I3C transfer helpers. Provide stub implementations to avoid adding conditional ifdefs everywhere.
[...]
Applied, thanks!
[1/1] i3c: Add stub functions when I3C support is disabled
https://git.kernel.org/i3c/c/8564f88df202
Quoted 9 lines
Quoted 2 lines
Best regards,
Hi Alexandre,
This is going to make for an 'interesting' merge window as I'm getting build failures without that patch. I don't suppose you'd mind doing an immutable branch?
I just sent it, let me know if this works for you.
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Jonathan Cameron
maintainerQuoted 24 lines · On Wed, 21 Jan 2026 00:02:18 +0100 Alexandre Belloni…
Hello,
Quoted 21 lines · Jonathan Cameron
Quoted 17 lines · On Wed, 14 Jan 2026 16:02:06 +0100 Alexandre Belloni…
Quoted 8 lines · Frank Li
When I3C is disabled, unused functions are removed by the linker because the driver relies on regmap and no I3C devices are registered, so normal I3C paths are never called.
However, some drivers may still call low-level I3C transfer helpers. Provide stub implementations to avoid adding conditional ifdefs everywhere.
[...]
Applied, thanks!
[1/1] i3c: Add stub functions when I3C support is disabled
https://git.kernel.org/i3c/c/8564f88df202Best regards,
Quoted 9 lines
Quoted 6 lines
Hi Alexandre,
This is going to make for an 'interesting' merge window as I'm getting build failures without that patch. I don't suppose you'd mind doing an immutable branch?
I just sent it, let me know if this works for you.
Thanks. I've dropped the temp fix and merged that ib.
Looks good.
Jonathan