All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	 Geert Uytterhoeven <geert@linux-m68k.org>,
	netdev@vger.kernel.org, linux-scsi@vger.kernel.org,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	 "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Martin K. Petersen" <mkp@kernel.org>
Subject: Re: [PATCH] zorro: use module_driver() to avoid repeated boilerplate code
Date: Sun, 6 Sep 2026 08:29:09 +0200	[thread overview]
Message-ID: <ap0Hpa5BNKgMg9rO@monoceros> (raw)
In-Reply-To: <20260906034037.81379-1-enelsonmoore@gmail.com>

[-- 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 --]

  reply	other threads:[~2026-09-06  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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) [this message]
2026-09-06 10:17 ` Simon Horman

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=ap0Hpa5BNKgMg9rO@monoceros \
    --to=u.kleine-koenig@baylibre.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=enelsonmoore@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=kuba@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mkp@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.