summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRouven Czerwinski <r.czerwinski@pengutronix.de>2020-11-09 14:44:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-12 11:28:20 +0100
commitbae260ab38cc98b7482f271dc9a9b1c24cbdaf93 (patch)
treee20fa7587ef4e6188ac4abe763124f0e5ace6900
parentb93dfbbac6769c2f129777d4cbfaa0f466297a77 (diff)
downloadbarebox-bae260ab38cc98b7482f271dc9a9b1c24cbdaf93.tar.gz
barebox-bae260ab38cc98b7482f271dc9a9b1c24cbdaf93.tar.xz
amba: add *_amba_driver helper macros
Reuse the flexible register_driver_macro() to add {device,coredevice,console}_amba_driver to get rid of the init boilerplate code used within the amba drivers. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/clocksource/amba-sp804.c2
-rw-r--r--drivers/mci/mmci.c7
-rw-r--r--drivers/serial/amba-pl011.c8
-rw-r--r--include/linux/amba/bus.h7
4 files changed, 10 insertions, 14 deletions
diff --git a/drivers/clocksource/amba-sp804.c b/drivers/clocksource/amba-sp804.c
index 8ed5ae4be0..0c0ecaa83a 100644
--- a/drivers/clocksource/amba-sp804.c
+++ b/drivers/clocksource/amba-sp804.c
@@ -85,4 +85,4 @@ struct amba_driver sp804_driver = {
.id_table = sp804_ids,
};
-coredevice_platform_driver(sp804_driver);
+coredevice_amba_driver(sp804_driver);
diff --git a/drivers/mci/mmci.c b/drivers/mci/mmci.c
index f45557d4f7..53f25dff96 100644
--- a/drivers/mci/mmci.c
+++ b/drivers/mci/mmci.c
@@ -709,9 +709,4 @@ static struct amba_driver mmci_driver = {
.id_table = mmci_ids,
};
-static int mmci_init(void)
-{
- amba_driver_register(&mmci_driver);
- return 0;
-}
-device_initcall(mmci_init);
+device_amba_driver(mmci_driver);
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 865ecdddb2..9261d20f2a 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -237,10 +237,4 @@ struct amba_driver pl011_driver = {
.id_table = pl011_ids,
};
-static int pl011_init(void)
-{
- amba_driver_register(&pl011_driver);
- return 0;
-}
-
-console_initcall(pl011_init);
+console_amba_driver(pl011_driver);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 7b3e603322..390220a3de 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -60,6 +60,13 @@ extern struct bus_type amba_bustype;
#define to_amba_device(d) container_of(d, struct amba_device, dev)
+#define device_amba_driver(drv) \
+ register_driver_macro(device,amba,drv)
+#define coredevice_amba_driver(drv) \
+ register_driver_macro(coredevice,amba,drv)
+#define console_amba_driver(drv) \
+ register_driver_macro(console,amba,drv)
+
int amba_driver_register(struct amba_driver *);
void amba_driver_unregister(struct amba_driver *);
struct amba_device *amba_device_alloc(const char *, int id, resource_size_t, size_t);