[PATCH v2 3/8] i2c: stub device_i2c_driver if I2C is disabled
Michael Tretter
m.tretter at pengutronix.de
Thu Dec 23 08:03:59 PST 2021
This allows drivers that support multiple buses to keep the code for
registering their I2C variant even if I2C is disabled.
Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
---
Changelog:
v2:
- new patch
---
include/i2c/i2c.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h
index af6287602ca5..7207b1180e1d 100644
--- a/include/i2c/i2c.h
+++ b/include/i2c/i2c.h
@@ -333,9 +333,14 @@ static inline int i2c_driver_register(struct driver_d *drv)
return register_driver(drv);
}
+#ifdef CONFIG_I2C
#define coredevice_i2c_driver(drv) \
register_driver_macro(coredevice, i2c, drv)
#define device_i2c_driver(drv) \
register_driver_macro(device, i2c, drv)
+#else
+#define coredevice_i2c_driver(drv)
+#define device_i2c_driver(drv)
+#endif
#endif /* I2C_I2C_H */
--
2.30.2
More information about the barebox
mailing list