From patchwork Wed Jul 8 04:47:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 6740351 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 8434A9F2F0 for ; Wed, 8 Jul 2015 04:47:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6195720782 for ; Wed, 8 Jul 2015 04:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1584E20721 for ; Wed, 8 Jul 2015 04:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750922AbbGHErf (ORCPT ); Wed, 8 Jul 2015 00:47:35 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34352 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbbGHEre (ORCPT ); Wed, 8 Jul 2015 00:47:34 -0400 Received: by pabvl15 with SMTP id vl15so124689092pab.1; Tue, 07 Jul 2015 21:47:34 -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=kR5KVXVnRwbWI2mXMVwiNhjgGG/kVHWoSGvR8/X2DDk=; b=Xi399uwSPwPK5Xt6z/3KpCJO1Iyfn0YkBFEpTu8zZoKG082x1p8qkAx00oVz39LFd9 UGsFRA57glWukLv+4wYbDssQE6V0VIKZEYTRoeTmrhr4kQpQE9QDq9RRWNJzEaVJuIj+ T9i84x8sFMV9AzY1aJ49HO/fFvbdEM9glcTZcE6Lr4R5X8V8af0uektLj61IIIFxFii7 /yrWqTMVIMyhpWtSYYuliS9VwTzHm/Plqpxe8w9RRNpjMMYQzLMS8H7zkivZI7u12u17 9mPjGd5nYHXJdTv6Z3A6G5JXi3WCOsNpuJP8caMdBfyudT3M0xYV039OWcWTbcCox2Tn E/0g== X-Received: by 10.70.43.136 with SMTP id w8mr16223173pdl.157.1436330854142; Tue, 07 Jul 2015 21:47:34 -0700 (PDT) Received: from vaishali-Ideapad-Z570 ([150.107.241.167]) by smtp.gmail.com with ESMTPSA id ks7sm817177pbc.34.2015.07.07.21.47.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Jul 2015 21:47:33 -0700 (PDT) Date: Wed, 8 Jul 2015 10:17:28 +0530 From: Vaishali Thakkar To: "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: Use module_platform_driver Message-ID: <20150708044728.GA11024@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.6 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_platform_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 platform_driver_register(&x); } @b depends on a@ identifier e, a.x; @@ -static e(...) { platform_driver_unregister(&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_platform_driver; @@ -module_exit(e); +module_platform_driver(x); Signed-off-by: Vaishali Thakkar --- drivers/scsi/jazz_esp.c | 14 +------------- drivers/scsi/mac_esp.c | 14 +------------- drivers/scsi/qlogicpti.c | 14 +------------- drivers/scsi/sni_53c710.c | 14 +------------- drivers/scsi/sun3x_esp.c | 14 +------------- drivers/scsi/sun_esp.c | 14 +------------- 6 files changed, 6 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 9aaa74e..003c455 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c @@ -229,20 +229,8 @@ static struct platform_driver esp_jazz_driver = { }, }; -static int __init jazz_esp_init(void) -{ - return platform_driver_register(&esp_jazz_driver); -} - -static void __exit jazz_esp_exit(void) -{ - platform_driver_unregister(&esp_jazz_driver); -} - MODULE_DESCRIPTION("JAZZ ESP SCSI driver"); MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - -module_init(jazz_esp_init); -module_exit(jazz_esp_exit); +module_platform_driver(esp_jazz_driver); diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index 14c0334..30906ae 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c @@ -620,21 +620,9 @@ static struct platform_driver esp_mac_driver = { }, }; -static int __init mac_esp_init(void) -{ - return platform_driver_register(&esp_mac_driver); -} - -static void __exit mac_esp_exit(void) -{ - platform_driver_unregister(&esp_mac_driver); -} - MODULE_DESCRIPTION("Mac ESP SCSI driver"); MODULE_AUTHOR("Finn Thain "); MODULE_LICENSE("GPL v2"); MODULE_VERSION(DRV_VERSION); MODULE_ALIAS("platform:" DRV_MODULE_NAME); - -module_init(mac_esp_init); -module_exit(mac_esp_exit); +module_platform_driver(esp_mac_driver); diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 676385f..a63c6ea 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -1460,21 +1460,9 @@ static struct platform_driver qpti_sbus_driver = { .remove = qpti_sbus_remove, }; -static int __init qpti_init(void) -{ - return platform_driver_register(&qpti_sbus_driver); -} - -static void __exit qpti_exit(void) -{ - platform_driver_unregister(&qpti_sbus_driver); -} - MODULE_DESCRIPTION("QlogicISP SBUS driver"); MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); MODULE_LICENSE("GPL"); MODULE_VERSION("2.1"); MODULE_FIRMWARE("qlogic/isp1000.bin"); - -module_init(qpti_init); -module_exit(qpti_exit); +module_platform_driver(qpti_sbus_driver); diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 7627807..eb74dbb 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -139,16 +139,4 @@ static struct platform_driver snirm710_driver = { .name = "snirm_53c710", }, }; - -static int __init snirm710_init(void) -{ - return platform_driver_register(&snirm710_driver); -} - -static void __exit snirm710_exit(void) -{ - platform_driver_unregister(&snirm710_driver); -} - -module_init(snirm710_init); -module_exit(snirm710_exit); +module_platform_driver(snirm710_driver); diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c index e26e81d..c1214bf 100644 --- a/drivers/scsi/sun3x_esp.c +++ b/drivers/scsi/sun3x_esp.c @@ -298,21 +298,9 @@ static struct platform_driver esp_sun3x_driver = { }, }; -static int __init sun3x_esp_init(void) -{ - return platform_driver_register(&esp_sun3x_driver); -} - -static void __exit sun3x_esp_exit(void) -{ - platform_driver_unregister(&esp_sun3x_driver); -} - MODULE_DESCRIPTION("Sun3x ESP SCSI driver"); MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - -module_init(sun3x_esp_init); -module_exit(sun3x_esp_exit); +module_platform_driver(esp_sun3x_driver); MODULE_ALIAS("platform:sun3x_esp"); diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index 7b6d4c2..ecbe4c2 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c @@ -639,20 +639,8 @@ static struct platform_driver esp_sbus_driver = { .remove = esp_sbus_remove, }; -static int __init sunesp_init(void) -{ - return platform_driver_register(&esp_sbus_driver); -} - -static void __exit sunesp_exit(void) -{ - platform_driver_unregister(&esp_sbus_driver); -} - MODULE_DESCRIPTION("Sun ESP SCSI driver"); MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); - -module_init(sunesp_init); -module_exit(sunesp_exit); +module_platform_driver(esp_sbus_driver);