public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Ethan Nelson-Moore <enelsonmoore@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Subject: [PATCH] scsi: replace trivial module_init/exit functions with module_pci_driver
Date: Tue,  9 Dec 2025 22:44:05 -0800	[thread overview]
Message-ID: <20251210064405.27152-1-enelsonmoore@gmail.com> (raw)

Several SCSI drivers unnecessarily use module_init/exit instead of
module_pci_driver. Most of these drivers also print unnecessary version
messages on load, even though their versions are accessible through
MODULE_VERSION (or sysfs, in the case of hptiop). Replace these
init/exit functions with module_pci_driver.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
---
 drivers/scsi/3w-9xxx.c           | 18 +-----------------
 drivers/scsi/3w-sas.c            | 18 +-----------------
 drivers/scsi/3w-xxxx.c           | 18 +-----------------
 drivers/scsi/arcmsr/arcmsr_hba.c | 14 +-------------
 drivers/scsi/hptiop.c            | 15 +--------------
 drivers/scsi/nsp32.c             | 20 +-------------------
 drivers/scsi/stex.c              | 17 +----------------
 drivers/scsi/vmw_pvscsi.c        | 15 +--------------
 8 files changed, 8 insertions(+), 127 deletions(-)

diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index a377a6f6900a..f05ea5053ac4 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -2286,20 +2286,4 @@ static struct pci_driver twa_driver = {
 	.shutdown	= twa_shutdown
 };
 
-/* This function is called on driver initialization */
-static int __init twa_init(void)
-{
-	printk(KERN_WARNING "3ware 9000 Storage Controller device driver for Linux v%s.\n", TW_DRIVER_VERSION);
-
-	return pci_register_driver(&twa_driver);
-} /* End twa_init() */
-
-/* This function is called on driver exit */
-static void __exit twa_exit(void)
-{
-	pci_unregister_driver(&twa_driver);
-} /* End twa_exit() */
-
-module_init(twa_init);
-module_exit(twa_exit);
-
+module_pci_driver(twa_driver);
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index e319be7d369c..6ad32f48c96c 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1840,20 +1840,4 @@ static struct pci_driver twl_driver = {
 	.shutdown	= twl_shutdown
 };
 
-/* This function is called on driver initialization */
-static int __init twl_init(void)
-{
-	printk(KERN_INFO "LSI 3ware SAS/SATA-RAID Controller device driver for Linux v%s.\n", TW_DRIVER_VERSION);
-
-	return pci_register_driver(&twl_driver);
-} /* End twl_init() */
-
-/* This function is called on driver exit */
-static void __exit twl_exit(void)
-{
-	pci_unregister_driver(&twl_driver);
-} /* End twl_exit() */
-
-module_init(twl_init);
-module_exit(twl_exit);
-
+module_pci_driver(twl_driver);
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 0306a228c702..634b0c2792ff 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -2411,20 +2411,4 @@ static struct pci_driver tw_driver = {
 	.shutdown	= tw_shutdown,
 };
 
-/* This function is called on driver initialization */
-static int __init tw_init(void)
-{
-	printk(KERN_WARNING "3ware Storage Controller device driver for Linux v%s.\n", TW_DRIVER_VERSION);
-
-	return pci_register_driver(&tw_driver);
-} /* End tw_init() */
-
-/* This function is called on driver exit */
-static void __exit tw_exit(void)
-{
-	pci_unregister_driver(&tw_driver);
-} /* End tw_exit() */
-
-module_init(tw_init);
-module_exit(tw_exit);
-
+module_pci_driver(tw_driver);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index f0c5a30ce51b..bcc2dd8f597f 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1775,19 +1775,7 @@ static void arcmsr_shutdown(struct pci_dev *pdev)
 	arcmsr_flush_adapter_cache(acb);
 }
 
-static int __init arcmsr_module_init(void)
-{
-	int error = 0;
-	error = pci_register_driver(&arcmsr_pci_driver);
-	return error;
-}
-
-static void __exit arcmsr_module_exit(void)
-{
-	pci_unregister_driver(&arcmsr_pci_driver);
-}
-module_init(arcmsr_module_init);
-module_exit(arcmsr_module_exit);
+module_pci_driver(arcmsr_pci_driver);
 
 static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb,
 						u32 intmask_org)
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 21f1d9871a33..087a14bdd997 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1680,20 +1680,7 @@ static struct pci_driver hptiop_pci_driver = {
 	.shutdown   = hptiop_shutdown,
 };
 
-static int __init hptiop_module_init(void)
-{
-	printk(KERN_INFO "%s %s\n", driver_name_long, driver_ver);
-	return pci_register_driver(&hptiop_pci_driver);
-}
-
-static void __exit hptiop_module_exit(void)
-{
-	pci_unregister_driver(&hptiop_pci_driver);
-}
-
-
-module_init(hptiop_module_init);
-module_exit(hptiop_module_exit);
+module_pci_driver(hptiop_pci_driver);
 
 MODULE_LICENSE("GPL");
 
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index abc4ce9eae74..0318e37a5f88 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -178,8 +178,6 @@ static nsp32_sync_table nsp32_sync_table_pci[] = {
 /* module entry point */
 static int nsp32_probe (struct pci_dev *, const struct pci_device_id *);
 static void nsp32_remove(struct pci_dev *);
-static int  __init init_nsp32  (void);
-static void __exit exit_nsp32  (void);
 
 /* struct struct scsi_host_template */
 static int	   nsp32_show_info   (struct seq_file *, struct Scsi_Host *);
@@ -3385,20 +3383,4 @@ static struct pci_driver nsp32_driver = {
 #endif
 };
 
-/*********************************************************************
- * Moule entry point
- */
-static int __init init_nsp32(void) {
-	nsp32_msg(KERN_INFO, "loading...");
-	return pci_register_driver(&nsp32_driver);
-}
-
-static void __exit exit_nsp32(void) {
-	nsp32_msg(KERN_INFO, "unloading...");
-	pci_unregister_driver(&nsp32_driver);
-}
-
-module_init(init_nsp32);
-module_exit(exit_nsp32);
-
-/* end */
+module_pci_driver(nsp32_driver);
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 93c223e0a777..6f18c22f75c1 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -2012,19 +2012,4 @@ static struct pci_driver stex_pci_driver = {
 	.resume		= stex_resume,
 };
 
-static int __init stex_init(void)
-{
-	printk(KERN_INFO DRV_NAME
-		": Promise SuperTrak EX Driver version: %s\n",
-		 ST_DRIVER_VERSION);
-
-	return pci_register_driver(&stex_pci_driver);
-}
-
-static void __exit stex_exit(void)
-{
-	pci_unregister_driver(&stex_pci_driver);
-}
-
-module_init(stex_init);
-module_exit(stex_exit);
+module_pci_driver(stex_pci_driver);
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 32242d86cf5b..963279ea1c7b 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -1606,17 +1606,4 @@ static struct pci_driver pvscsi_pci_driver = {
 	.shutdown       = pvscsi_shutdown,
 };
 
-static int __init pvscsi_init(void)
-{
-	pr_info("%s - version %s\n",
-		PVSCSI_LINUX_DRIVER_DESC, PVSCSI_DRIVER_VERSION_STRING);
-	return pci_register_driver(&pvscsi_pci_driver);
-}
-
-static void __exit pvscsi_exit(void)
-{
-	pci_unregister_driver(&pvscsi_pci_driver);
-}
-
-module_init(pvscsi_init);
-module_exit(pvscsi_exit);
+module_pci_driver(pvscsi_pci_driver);
-- 
2.43.0


                 reply	other threads:[~2025-12-10  6:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251210064405.27152-1-enelsonmoore@gmail.com \
    --to=enelsonmoore@gmail.com \
    --cc=linux-scsi@vger.kernel.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