pcmcia: Use module_pcmcia_driver for scsi drivers

Use module_pcmcia_driver for drivers whose init and exit functions
only register and unregister, respectively.

A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:

@a@
identifier f, x;
@@
-static f(...) { return pcmcia_register_driver(&x); }

@b depends on a@
identifier e, a.x;
@@
-static e(...) { pcmcia_unregister_driver(&x); }

@c depends on a && b@
identifier a.f;
declarer name module_init;
@@
-module_init(f);

@d depends on a && b && c@
identifier b.e, a.x;
declarer name module_exit;
declarer name module_pcmcia_driver;
@@
-module_exit(e);
+module_pcmcia_driver(x);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
[linux@dominikbrodowski.net:
 - updated commit message
 - drop change to fdomain which got removed in the meantime]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Vaishali Thakkar 2015-07-04 09:19:09 +05:30 committed by Dominik Brodowski
parent ddc9a1d90a
commit dc245cfa82
5 changed files with 4 additions and 58 deletions

View File

@ -220,16 +220,4 @@ static struct pcmcia_driver aha152x_cs_driver = {
.id_table = aha152x_ids,
.resume = aha152x_resume,
};
static int __init init_aha152x_cs(void)
{
return pcmcia_register_driver(&aha152x_cs_driver);
}
static void __exit exit_aha152x_cs(void)
{
pcmcia_unregister_driver(&aha152x_cs_driver);
}
module_init(init_aha152x_cs);
module_exit(exit_aha152x_cs);
module_pcmcia_driver(aha152x_cs_driver);

View File

@ -1742,19 +1742,6 @@ static struct pcmcia_driver nsp_driver = {
.suspend = nsp_cs_suspend,
.resume = nsp_cs_resume,
};
static int __init nsp_cs_init(void)
{
return pcmcia_register_driver(&nsp_driver);
}
static void __exit nsp_cs_exit(void)
{
pcmcia_unregister_driver(&nsp_driver);
}
module_init(nsp_cs_init)
module_exit(nsp_cs_exit)
module_pcmcia_driver(nsp_driver);
/* end */

View File

@ -326,10 +326,6 @@ static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht);
/* Interrupt handler */
//static irqreturn_t nspintr(int irq, void *dev_id);
/* Module entry point*/
static int __init nsp_cs_init(void);
static void __exit nsp_cs_exit(void);
/* Debug */
#ifdef NSP_DEBUG
static void show_command (struct scsi_cmnd *SCpnt);

View File

@ -300,18 +300,7 @@ static struct pcmcia_driver qlogic_cs_driver = {
.resume = qlogic_resume,
};
static int __init init_qlogic_cs(void)
{
return pcmcia_register_driver(&qlogic_cs_driver);
}
static void __exit exit_qlogic_cs(void)
{
pcmcia_unregister_driver(&qlogic_cs_driver);
}
MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
MODULE_DESCRIPTION("Driver for the PCMCIA Qlogic FAS SCSI controllers");
MODULE_LICENSE("GPL");
module_init(init_qlogic_cs);
module_exit(exit_qlogic_cs);
module_pcmcia_driver(qlogic_cs_driver);

View File

@ -880,18 +880,4 @@ static struct pcmcia_driver sym53c500_cs_driver = {
.id_table = sym53c500_ids,
.resume = sym53c500_resume,
};
static int __init
init_sym53c500_cs(void)
{
return pcmcia_register_driver(&sym53c500_cs_driver);
}
static void __exit
exit_sym53c500_cs(void)
{
pcmcia_unregister_driver(&sym53c500_cs_driver);
}
module_init(init_sym53c500_cs);
module_exit(exit_sym53c500_cs);
module_pcmcia_driver(sym53c500_cs_driver);