summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-08-28 09:22:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-29 10:09:59 +0200
commit77e74ddca1a30ea1ac4bb9de55917f6b69290b41 (patch)
treebd3204786362f0f7f8ad6e1eeb76e30a2a73a666 /drivers/mfd
parentd877a4436bb960e6b942510c3de37b9bd048c1ba (diff)
downloadbarebox-77e74ddca1a30ea1ac4bb9de55917f6b69290b41.tar.gz
barebox-77e74ddca1a30ea1ac4bb9de55917f6b69290b41.tar.xz
treewide: Use driver macro
We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/mc13xxx.c31
-rw-r--r--drivers/mfd/syscon.c6
2 files changed, 10 insertions, 27 deletions
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index a5877dbda1..1f321a3272 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -399,37 +399,24 @@ static __maybe_unused struct of_device_id mc13xxx_dt_ids[] = {
{ }
};
-static struct driver_d mc13xxx_i2c_driver = {
+static __maybe_unused struct driver_d mc13xxx_i2c_driver = {
.name = "mc13xxx-i2c",
.probe = mc13xxx_probe,
.id_table = mc13xxx_ids,
.of_compatible = DRV_OF_COMPAT(mc13xxx_dt_ids),
};
-static struct driver_d mc13xxx_spi_driver = {
+#if IS_ENABLED(CONFIG_I2C)
+coredevice_i2c_driver(mc13xxx_i2c_driver);
+#endif
+
+static __maybe_unused struct driver_d mc13xxx_spi_driver = {
.name = "mc13xxx-spi",
.probe = mc13xxx_probe,
.id_table = mc13xxx_ids,
.of_compatible = DRV_OF_COMPAT(mc13xxx_dt_ids),
};
-static int __init mc13xxx_init(void)
-{
- int err_spi = 0, err_i2c = 0;
-
- if (IS_ENABLED(CONFIG_I2C))
- err_spi = i2c_driver_register(&mc13xxx_i2c_driver);
-
- if (IS_ENABLED(CONFIG_SPI))
- err_i2c = spi_driver_register(&mc13xxx_spi_driver);
-
- if (err_spi)
- return err_spi;
-
- if (err_i2c)
- return err_i2c;
-
- return 0;
-
-}
-coredevice_initcall(mc13xxx_init);
+#if IS_ENABLED(CONFIG_SPI)
+coredevice_spi_driver(mc13xxx_spi_driver);
+#endif
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index a464dfc506..25e308b2d6 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -267,11 +267,7 @@ static struct driver_d syscon_driver = {
.id_table = syscon_ids,
};
-static int __init syscon_init(void)
-{
- return platform_driver_register(&syscon_driver);
-}
-core_initcall(syscon_init);
+core_platform_driver(syscon_driver);
MODULE_AUTHOR("Dong Aisheng <dong.aisheng@linaro.org>");
MODULE_DESCRIPTION("System Control driver");