mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Subject: [PATCH 3/8] amba: add *_amba_driver helper macros
Date: Mon,  9 Nov 2020 14:44:25 +0100	[thread overview]
Message-ID: <20201109134430.21156-4-r.czerwinski@pengutronix.de> (raw)
In-Reply-To: <20201109134430.21156-1-r.czerwinski@pengutronix.de>

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>
---
 drivers/clocksource/amba-sp804.c | 2 +-
 drivers/mci/mmci.c               | 7 +------
 drivers/serial/amba-pl011.c      | 8 +-------
 include/linux/amba/bus.h         | 7 +++++++
 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);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-11-09 13:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09 13:44 [PATCH 0/8] QEMU virt machine support via mach-vexpress Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 1/8] ARM: MMU: add zero_page_{access,faulting} Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 2/8] mtd: cfi_flash: allow 0x0 mapping Rouven Czerwinski
2020-11-09 13:52   ` Lucas Stach
2020-11-10  6:33     ` Rouven Czerwinski
2020-11-10  7:48       ` Sascha Hauer
2020-11-10  9:15         ` Sascha Hauer
2020-11-10  9:36           ` Ahmad Fatoum
2020-11-10  9:43             ` Ahmad Fatoum
2020-11-12 10:06               ` Sascha Hauer
2020-11-12 10:09                 ` Rouven Czerwinski
2020-11-09 13:44 ` Rouven Czerwinski [this message]
2020-11-09 13:44 ` [PATCH 4/8] ARM: vexpress: remove unused KConfig file Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 5/8] ARM: vexpress: convert to board driver Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 6/8] ARM: vexpress: move Options to ARCH_VEXPRESS Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 7/8] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
2020-11-09 13:44 ` [PATCH 8/8] ARM: vexpress: enable VIRT board, MMU and cmds Rouven Czerwinski
2020-11-12 10:30 ` [PATCH 0/8] QEMU virt machine support via mach-vexpress Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201109134430.21156-4-r.czerwinski@pengutronix.de \
    --to=r.czerwinski@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox