Skip to content

Commit 12df2a6

Browse files
arndbgregkh
authored andcommitted
i3c: fix module_i3c_i2c_driver() with I3C=n
[ Upstream commit 5523a46 ] When CONFIG_I3C is disabled and the i3c_i2c_driver_register() happens to not be inlined, any driver calling it still references the i3c_driver instance, which then causes a link failure: x86_64-linux-ld: drivers/hwmon/lm75.o: in function `lm75_i3c_reg_read': lm75.c:(.text+0xc61): undefined reference to `i3cdev_to_dev' x86_64-linux-ld: lm75.c:(.text+0xd25): undefined reference to `i3c_device_do_priv_xfers' x86_64-linux-ld: lm75.c:(.text+0xdd8): undefined reference to `i3c_device_do_priv_xfers' This issue was part of the original i3c code, but only now caused problems when i3c support got added to lm75. Change the 'inline' annotations in the header to '__always_inline' to ensure that the dead-code-elimination pass in the compiler can optimize it out as intended. Fixes: 6071d10 ("hwmon: (lm75) add I3C support for P3T1755") Fixes: 3a379bb ("i3c: Add core I3C infrastructure") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1a86faf commit 12df2a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/i3c/device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void i3c_driver_unregister(struct i3c_driver *drv);
245245
*
246246
* Return: 0 if both registrations succeeds, a negative error code otherwise.
247247
*/
248-
static inline int i3c_i2c_driver_register(struct i3c_driver *i3cdrv,
248+
static __always_inline int i3c_i2c_driver_register(struct i3c_driver *i3cdrv,
249249
struct i2c_driver *i2cdrv)
250250
{
251251
int ret;
@@ -270,7 +270,7 @@ static inline int i3c_i2c_driver_register(struct i3c_driver *i3cdrv,
270270
* Note that when CONFIG_I3C is not enabled, this function only unregisters the
271271
* @i2cdrv.
272272
*/
273-
static inline void i3c_i2c_driver_unregister(struct i3c_driver *i3cdrv,
273+
static __always_inline void i3c_i2c_driver_unregister(struct i3c_driver *i3cdrv,
274274
struct i2c_driver *i2cdrv)
275275
{
276276
if (IS_ENABLED(CONFIG_I3C))

0 commit comments

Comments
 (0)