diff options
author | Marco Felsch <m.felsch@pengutronix.de> | 2018-10-18 12:19:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-10-19 13:54:36 +0200 |
commit | d8fcbad91a22be905b5fd8aec26ce1cc3b950d98 (patch) | |
tree | 9a9b9bbd795a5316966ea82b1349c75098e9dacb /drivers/gpio | |
parent | 891098f3bf12f90524cc0f5e7694a450e0c11f7f (diff) | |
download | barebox-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/gpio')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 8 | ||||
-rw-r--r-- | drivers/gpio/gpio-sx150x.c | 8 |
2 files changed, 2 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 53e8c7650d..98a7a6c97c 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -14,7 +14,6 @@ */ #include <common.h> -#include <init.h> #include <malloc.h> #include <driver.h> #include <xfuncs.h> @@ -508,9 +507,4 @@ static struct driver_d pca953x_driver = { .of_compatible = DRV_OF_COMPAT(pca953x_dt_ids), .id_table = pca953x_id, }; - -static int __init pca953x_init(void) -{ - return i2c_driver_register(&pca953x_driver); -} -device_initcall(pca953x_init); +device_i2c_driver(pca953x_driver); diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c index 7b8cfb5042..76535187b0 100644 --- a/drivers/gpio/gpio-sx150x.c +++ b/drivers/gpio/gpio-sx150x.c @@ -17,7 +17,6 @@ */ #include <common.h> -#include <init.h> #include <malloc.h> #include <driver.h> #include <xfuncs.h> @@ -266,9 +265,4 @@ static struct driver_d sx150x_driver = { .probe = sx150x_probe, .of_compatible = sx150x_dt_ids, }; - -static int __init sx150x_init(void) -{ - return i2c_driver_register(&sx150x_driver); -} -device_initcall(sx150x_init); +device_i2c_driver(sx150x_driver); |