summaryrefslogtreecommitdiffstats
path: root/include/i2c
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2018-10-18 12:19:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-10-19 13:54:36 +0200
commitd8fcbad91a22be905b5fd8aec26ce1cc3b950d98 (patch)
tree9a9b9bbd795a5316966ea82b1349c75098e9dacb /include/i2c
parent891098f3bf12f90524cc0f5e7694a450e0c11f7f (diff)
downloadbarebox-d8fcbad91a22be905b5fd8aec26ce1cc3b950d98.tar.gz
barebox-d8fcbad91a22be905b5fd8aec26ce1cc3b950d98.tar.xz
i2c: introduce device_i2c_driver() macro
Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/i2c')
-rw-r--r--include/i2c/i2c.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h
index cf784ca1f1..17b507ca22 100644
--- a/include/i2c/i2c.h
+++ b/include/i2c/i2c.h
@@ -17,6 +17,7 @@
#define I2C_I2C_H
#include <driver.h>
+#include <init.h>
#include <linux/types.h>
struct i2c_adapter;
@@ -297,4 +298,7 @@ static inline int i2c_driver_register(struct driver_d *drv)
return register_driver(drv);
}
+#define device_i2c_driver(drv) \
+ register_driver_macro(device, i2c, drv)
+
#endif /* I2C_I2C_H */