summaryrefslogtreecommitdiffstats
path: root/drivers/video
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 /drivers/video
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 'drivers/video')
-rw-r--r--drivers/video/mtl017.c10
-rw-r--r--drivers/video/ssd1307fb.c10
-rw-r--r--drivers/video/tc358767.c8
3 files changed, 3 insertions, 25 deletions
diff --git a/drivers/video/mtl017.c b/drivers/video/mtl017.c
index 1a1f686223..085ea110ba 100644
--- a/drivers/video/mtl017.c
+++ b/drivers/video/mtl017.c
@@ -16,7 +16,6 @@
*
*/
#include <common.h>
-#include <init.h>
#include <driver.h>
#include <xfuncs.h>
#include <errno.h>
@@ -270,11 +269,4 @@ static struct driver_d twl_driver = {
.name = "mtl017",
.probe = mtl017_probe,
};
-
-static int mtl017_init(void)
-{
- i2c_driver_register(&twl_driver);
- return 0;
-}
-
-device_initcall(mtl017_init);
+device_i2c_driver(twl_driver);
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 54e02e7220..d68f0c5056 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -18,7 +18,6 @@
*/
#include <common.h>
-#include <init.h>
#include <fb.h>
#include <i2c/i2c.h>
#include <of_device.h>
@@ -581,11 +580,4 @@ static struct driver_d ssd1307fb_driver = {
.probe = ssd1307fb_probe,
.of_compatible = DRV_OF_COMPAT(ssd1307fb_of_match),
};
-
-static int ssd1307_init(void)
-{
- i2c_driver_register(&ssd1307fb_driver);
- return 0;
-}
-
-device_initcall(ssd1307_init);
+device_i2c_driver(ssd1307fb_driver);
diff --git a/drivers/video/tc358767.c b/drivers/video/tc358767.c
index 125e8236c1..e64dde1ddf 100644
--- a/drivers/video/tc358767.c
+++ b/drivers/video/tc358767.c
@@ -20,7 +20,6 @@
*/
#include <common.h>
-#include <init.h>
#include <driver.h>
#include <malloc.h>
#include <errno.h>
@@ -1434,9 +1433,4 @@ static struct driver_d tc_driver = {
.name = "tc358767",
.probe = tc_probe,
};
-
-static int tc_init(void)
-{
- return i2c_driver_register(&tc_driver);
-}
-device_initcall(tc_init);
+device_i2c_driver(tc_driver);