From patchwork Sat Jul 4 03:49:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 6717271 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF1EA9F38C for ; Sat, 4 Jul 2015 03:49:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB17C20807 for ; Sat, 4 Jul 2015 03:49:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACFAB207E4 for ; Sat, 4 Jul 2015 03:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755317AbbGDDtS (ORCPT ); Fri, 3 Jul 2015 23:49:18 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:34923 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755070AbbGDDtQ (ORCPT ); Fri, 3 Jul 2015 23:49:16 -0400 Received: by pdbci14 with SMTP id ci14so72383524pdb.2; Fri, 03 Jul 2015 20:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=b1fWNQ1FRWLO5ov+cQm296Zs0HaguJkbQpSWrN0Saas=; b=ibrbBi4IrG8m+kt7kwAMAMLCzF+3QrASWegw48YIXrcHEjQA6UwO6RzY3/VT4HcTdH R4WPiw38YAmVqBC9qPFKcDVAhYzsRokqsVsZZ06uWaefFO7w/GPf99ILV0SS1pmeXID7 RQgNAmitDT5TlVEndCXioihtutHEn0xrjFsk2Yry3BcjYm2o5Rz//qGEIQyIa0+8RMZG MgEtcrvM52LVDA6l8EEkma+BxjATZByQFqtvgw+CirZMC+6k0TYPi94Ec3aW48MHkWgm 7T5+12bDB1GQUcpICtvRm7bPaKlhwY4qhAmwTiEgTyuBFt9efpd/dWW+0qYlCzW+kGA5 3TSw== X-Received: by 10.70.64.162 with SMTP id p2mr83881566pds.54.1435981756128; Fri, 03 Jul 2015 20:49:16 -0700 (PDT) Received: from vaishali-Ideapad-Z570 ([43.249.235.75]) by mx.google.com with ESMTPSA id i5sm10622685pat.42.2015.07.03.20.49.13 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Jul 2015 20:49:14 -0700 (PDT) Date: Sat, 4 Jul 2015 09:19:09 +0530 From: Vaishali Thakkar To: "Juergen E. Fischer" Cc: "James E.J. Bottomley" , YOKOTA Hiroshi , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: Use module_pcmcia_driver Message-ID: <20150704034909.GA5052@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/scsi/pcmcia/aha152x_stub.c | 14 +------------- drivers/scsi/pcmcia/fdomain_stub.c | 14 +------------- drivers/scsi/pcmcia/nsp_cs.c | 15 +-------------- drivers/scsi/pcmcia/nsp_cs.h | 4 ---- drivers/scsi/pcmcia/qlogic_stub.c | 13 +------------ drivers/scsi/pcmcia/sym53c500_cs.c | 16 +--------------- 6 files changed, 5 insertions(+), 71 deletions(-) diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 7d1609f..df82a34 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -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); diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 714b248..ba84769 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -194,16 +194,4 @@ static struct pcmcia_driver fdomain_cs_driver = { .id_table = fdomain_ids, .resume = fdomain_resume, }; - -static int __init init_fdomain_cs(void) -{ - return pcmcia_register_driver(&fdomain_cs_driver); -} - -static void __exit exit_fdomain_cs(void) -{ - pcmcia_unregister_driver(&fdomain_cs_driver); -} - -module_init(init_fdomain_cs); -module_exit(exit_fdomain_cs); +module_pcmcia_driver(fdomain_cs_driver); diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 5fb6eef..f323049 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -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 */ diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index afd64f0..ea5122f 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h @@ -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); diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index c670dc7..1f601a7 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -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); diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 20011c8..a3b63be 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -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);