* [PATCH] zorro: use module_driver() to avoid repeated boilerplate code
@ 2026-09-06 3:40 Ethan Nelson-Moore
2026-09-06 6:29 ` Uwe Kleine-König (The Capable Hub)
2026-09-06 10:17 ` Simon Horman
0 siblings, 2 replies; 3+ messages in thread
From: Ethan Nelson-Moore @ 2026-09-06 3:40 UTC (permalink / raw)
To: Uwe Kleine-König (The Capable Hub), Jakub Kicinski,
Geert Uytterhoeven, netdev, linux-scsi
Cc: Ethan Nelson-Moore, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, James E.J. Bottomley, Martin K. Petersen
Many Zorro drivers have module_init and module_exit functions that only
call zorro_register_driver() and zorro_unregister_driver(). The
module_driver() macro automatically generates these functions given the
register and unregister functions. Switch to it to simplify the code.
Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
drivers/net/ethernet/8390/hydra.c | 13 +------------
drivers/net/ethernet/8390/zorro8390.c | 13 +------------
drivers/net/ethernet/amd/a2065.c | 13 +------------
drivers/net/ethernet/amd/ariadne.c | 13 +------------
drivers/scsi/a2091.c | 12 +-----------
drivers/scsi/gvp11.c | 12 +-----------
drivers/scsi/zorro7xx.c | 13 +------------
drivers/scsi/zorro_esp.c | 13 +------------
8 files changed, 8 insertions(+), 94 deletions(-)
diff --git a/drivers/net/ethernet/8390/hydra.c b/drivers/net/ethernet/8390/hydra.c
index 9a59915436d2..2edf97e500df 100644
--- a/drivers/net/ethernet/8390/hydra.c
+++ b/drivers/net/ethernet/8390/hydra.c
@@ -257,18 +257,7 @@ static void hydra_remove_one(struct zorro_dev *z)
free_netdev(dev);
}
-static int __init hydra_init_module(void)
-{
- return zorro_register_driver(&hydra_driver);
-}
-
-static void __exit hydra_cleanup_module(void)
-{
- zorro_unregister_driver(&hydra_driver);
-}
-
-module_init(hydra_init_module);
-module_exit(hydra_cleanup_module);
+module_driver(hydra_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("Zorro-II Hydra 8390 ethernet driver");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/8390/zorro8390.c b/drivers/net/ethernet/8390/zorro8390.c
index cb1d5ed20874..0f66f28e50b4 100644
--- a/drivers/net/ethernet/8390/zorro8390.c
+++ b/drivers/net/ethernet/8390/zorro8390.c
@@ -430,18 +430,7 @@ static struct zorro_driver zorro8390_driver = {
.remove = zorro8390_remove_one,
};
-static int __init zorro8390_init_module(void)
-{
- return zorro_register_driver(&zorro8390_driver);
-}
-
-static void __exit zorro8390_cleanup_module(void)
-{
- zorro_unregister_driver(&zorro8390_driver);
-}
-
-module_init(zorro8390_init_module);
-module_exit(zorro8390_cleanup_module);
+module_driver(zorro8390_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("Zorro NS8390-based ethernet driver");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/amd/a2065.c b/drivers/net/ethernet/amd/a2065.c
index 672c4996b30e..93f2261f4bfe 100644
--- a/drivers/net/ethernet/amd/a2065.c
+++ b/drivers/net/ethernet/amd/a2065.c
@@ -768,18 +768,7 @@ static void a2065_remove_one(struct zorro_dev *z)
free_netdev(dev);
}
-static int __init a2065_init_module(void)
-{
- return zorro_register_driver(&a2065_driver);
-}
-
-static void __exit a2065_cleanup_module(void)
-{
- zorro_unregister_driver(&a2065_driver);
-}
-
-module_init(a2065_init_module);
-module_exit(a2065_cleanup_module);
+module_driver(a2065_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("Commodore A2065 Ethernet driver");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/amd/ariadne.c b/drivers/net/ethernet/amd/ariadne.c
index ec6e7e8c14fe..662eba9e8ffd 100644
--- a/drivers/net/ethernet/amd/ariadne.c
+++ b/drivers/net/ethernet/amd/ariadne.c
@@ -777,18 +777,7 @@ static struct zorro_driver ariadne_driver = {
.remove = ariadne_remove_one,
};
-static int __init ariadne_init_module(void)
-{
- return zorro_register_driver(&ariadne_driver);
-}
-
-static void __exit ariadne_cleanup_module(void)
-{
- zorro_unregister_driver(&ariadne_driver);
-}
-
-module_init(ariadne_init_module);
-module_exit(ariadne_cleanup_module);
+module_driver(ariadne_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("Ariadne Ethernet Driver");
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index f81e53b53e20..421330a7b6a7 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -288,17 +288,7 @@ static struct zorro_driver a2091_driver = {
.remove = a2091_remove,
};
-static int __init a2091_init(void)
-{
- return zorro_register_driver(&a2091_driver);
-}
-module_init(a2091_init);
-
-static void __exit a2091_exit(void)
-{
- zorro_unregister_driver(&a2091_driver);
-}
-module_exit(a2091_exit);
+module_driver(a2091_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("Commodore A2091/A590 SCSI");
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 79bd64e12adc..eba868ac355d 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -461,17 +461,7 @@ static struct zorro_driver gvp11_driver = {
.remove = gvp11_remove,
};
-static int __init gvp11_init(void)
-{
- return zorro_register_driver(&gvp11_driver);
-}
-module_init(gvp11_init);
-
-static void __exit gvp11_exit(void)
-{
- zorro_unregister_driver(&gvp11_driver);
-}
-module_exit(gvp11_exit);
+module_driver(gvp11_driver, zorro_register_driver, zorro_unregister_driver);
MODULE_DESCRIPTION("GVP Series II SCSI");
MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 21c769dc1ecb..80e156b04b99 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -173,15 +173,4 @@ static struct zorro_driver zorro7xx_driver = {
.remove = zorro7xx_remove_one,
};
-static int __init zorro7xx_scsi_init(void)
-{
- return zorro_register_driver(&zorro7xx_driver);
-}
-
-static void __exit zorro7xx_scsi_exit(void)
-{
- zorro_unregister_driver(&zorro7xx_driver);
-}
-
-module_init(zorro7xx_scsi_init);
-module_exit(zorro7xx_scsi_exit);
+module_driver(zorro7xx_driver, zorro_register_driver, zorro_unregister_driver);
diff --git a/drivers/scsi/zorro_esp.c b/drivers/scsi/zorro_esp.c
index 178d46140674..121bcbbce52d 100644
--- a/drivers/scsi/zorro_esp.c
+++ b/drivers/scsi/zorro_esp.c
@@ -946,15 +946,4 @@ static struct zorro_driver zorro_esp_driver = {
.remove = zorro_esp_remove,
};
-static int __init zorro_esp_scsi_init(void)
-{
- return zorro_register_driver(&zorro_esp_driver);
-}
-
-static void __exit zorro_esp_scsi_exit(void)
-{
- zorro_unregister_driver(&zorro_esp_driver);
-}
-
-module_init(zorro_esp_scsi_init);
-module_exit(zorro_esp_scsi_exit);
+module_driver(zorro_esp_driver, zorro_register_driver, zorro_unregister_driver);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] zorro: use module_driver() to avoid repeated boilerplate code
2026-09-06 3:40 [PATCH] zorro: use module_driver() to avoid repeated boilerplate code Ethan Nelson-Moore
@ 2026-09-06 6:29 ` Uwe Kleine-König (The Capable Hub)
2026-09-06 10:17 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-09-06 6:29 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: Jakub Kicinski, Geert Uytterhoeven, netdev, linux-scsi,
Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
James E.J. Bottomley, Martin K. Petersen
[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]
On Sat, Sep 05, 2026 at 08:40:19PM -0700, Ethan Nelson-Moore wrote:
> Many Zorro drivers have module_init and module_exit functions that only
> call zorro_register_driver() and zorro_unregister_driver(). The
> module_driver() macro automatically generates these functions given the
> register and unregister functions. Switch to it to simplify the code.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
> drivers/net/ethernet/8390/hydra.c | 13 +------------
> drivers/net/ethernet/8390/zorro8390.c | 13 +------------
> drivers/net/ethernet/amd/a2065.c | 13 +------------
> drivers/net/ethernet/amd/ariadne.c | 13 +------------
> drivers/scsi/a2091.c | 12 +-----------
> drivers/scsi/gvp11.c | 12 +-----------
> drivers/scsi/zorro7xx.c | 13 +------------
> drivers/scsi/zorro_esp.c | 13 +------------
> 8 files changed, 8 insertions(+), 94 deletions(-)
>
> diff --git a/drivers/net/ethernet/8390/hydra.c b/drivers/net/ethernet/8390/hydra.c
> index 9a59915436d2..2edf97e500df 100644
> --- a/drivers/net/ethernet/8390/hydra.c
> +++ b/drivers/net/ethernet/8390/hydra.c
> @@ -257,18 +257,7 @@ static void hydra_remove_one(struct zorro_dev *z)
> free_netdev(dev);
> }
>
> -static int __init hydra_init_module(void)
> -{
> - return zorro_register_driver(&hydra_driver);
> -}
> -
> -static void __exit hydra_cleanup_module(void)
> -{
> - zorro_unregister_driver(&hydra_driver);
> -}
> -
> -module_init(hydra_init_module);
> -module_exit(hydra_cleanup_module);
> +module_driver(hydra_driver, zorro_register_driver, zorro_unregister_driver);
If there was
#define module_zorro_driver(__platform_driver) \
module_driver(__platform_driver, zorro_register_driver, zorro_unregister_driver)
this could be reduced to just
+module_zorro_driver(hydra_driver);
.
With or without that addition I like the patch.
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] zorro: use module_driver() to avoid repeated boilerplate code
2026-09-06 3:40 [PATCH] zorro: use module_driver() to avoid repeated boilerplate code Ethan Nelson-Moore
2026-09-06 6:29 ` Uwe Kleine-König (The Capable Hub)
@ 2026-09-06 10:17 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-09-06 10:17 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: Uwe Kleine-König (The Capable Hub), Jakub Kicinski,
Geert Uytterhoeven, netdev, linux-scsi, Andrew Lunn,
David S. Miller, Eric Dumazet, Paolo Abeni, James E.J. Bottomley,
Martin K. Petersen
On Sat, Sep 05, 2026 at 08:40:19PM -0700, Ethan Nelson-Moore wrote:
> Many Zorro drivers have module_init and module_exit functions that only
> call zorro_register_driver() and zorro_unregister_driver(). The
> module_driver() macro automatically generates these functions given the
> register and unregister functions. Switch to it to simplify the code.
>
> Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
> ---
> drivers/net/ethernet/8390/hydra.c | 13 +------------
> drivers/net/ethernet/8390/zorro8390.c | 13 +------------
> drivers/net/ethernet/amd/a2065.c | 13 +------------
> drivers/net/ethernet/amd/ariadne.c | 13 +------------
> drivers/scsi/a2091.c | 12 +-----------
> drivers/scsi/gvp11.c | 12 +-----------
> drivers/scsi/zorro7xx.c | 13 +------------
> drivers/scsi/zorro_esp.c | 13 +------------
> 8 files changed, 8 insertions(+), 94 deletions(-)
I think it would be best to split this patch up on a per-subsystem
of per driver basis. And send patches to appropriate subsystems.
In particular, please break out the net/ changes into a patchset
for net-next.
--
pw-bot: changes-requested
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-06 10:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 3:40 [PATCH] zorro: use module_driver() to avoid repeated boilerplate code Ethan Nelson-Moore
2026-09-06 6:29 ` Uwe Kleine-König (The Capable Hub)
2026-09-06 10:17 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox