From patchwork Tue Nov 22 13:49:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majunath Goudar X-Patchwork-Id: 9441143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E554A600BA for ; Tue, 22 Nov 2016 13:51:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D85A82522B for ; Tue, 22 Nov 2016 13:51:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCC6628518; Tue, 22 Nov 2016 13:51:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 110B02522B for ; Tue, 22 Nov 2016 13:51:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9BSU-00025k-GP; Tue, 22 Nov 2016 13:50:02 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c9BSQ-0001rN-Cg for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2016 13:50:00 +0000 Received: by mail-wm0-x241.google.com with SMTP id g23so3960967wme.1 for ; Tue, 22 Nov 2016 05:49:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=UAdDNJAOJnbZMybGRCbMuYOGwxQSJIPiliHUnpjqeog=; b=nxrudxLrHVbwjJDD1NfL2C34ADdv5VelM8WrvDdupYcE3akNtKnqyAYqLTMrXu7mKd ijpFaPWXovy49EYXDGCOr3UQmXet+rhQXF2ENSmLeSpMMw77wV2/LSNnWRaqu+04I5RF hn+/yLyvzZuvF4weIh/tyOWXJnvFLWsZyWOnVG13mZtdNzTt0vkCMaX6zIT6FQQDMWHo YvmK2qD5vfLUORC/uaErhW6rU9o6KdFjBtv/b2POwS4BuBRWSpVksfEyII1PBjYtffBI QKg09tq0+E5Wno1HhY7t7LIfGlFnax30h1uELvJCi6WqnQBVPhb3WPHoZqTTPGDEKTGj jdWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UAdDNJAOJnbZMybGRCbMuYOGwxQSJIPiliHUnpjqeog=; b=Nqq3gqrdCKF5HdNVGl7zZKVUFLKn5JgNqdnafP16BtRFdmVeO4StK8boJlWzBhTdUO YMgcxRpUbT4kv4+9CiLrBln+Q5xy5cPGXueqYh9friTtKaPBVZp6Y1+OHlaeSGj2CvPU MgAQSqGLXB/eXqavgRC3xC9XEy4ztxGqoibAVs5oWdz7t+4rBE/YIVACebPav9LFuBra cwhFp/mWNryG5YYSvqfkLt45/O/0KjcLl5nhla0R2G/tzSDtVH1Im1cOuTdVvTWANiI8 pNmSclcVFIJ3Th5Cybr/469Nbwf+66BrjQZjqBuQG1fSHb++4tAwHHz7E+j/JbrpFOZY +exQ== X-Gm-Message-State: AKaTC00HfXoeVEQ8yZ4vN1ZUD1/oWhWk/uT4/RoP7kZV4j130bWL2u+QdvvcKvTqYsepaQ== X-Received: by 10.194.203.135 with SMTP id kq7mr17082770wjc.26.1479822574406; Tue, 22 Nov 2016 05:49:34 -0800 (PST) Received: from manjunath-Aspire-5830T.chello.ie ([79.97.63.33]) by smtp.gmail.com with ESMTPSA id ef10sm11457309wjd.22.2016.11.22.05.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Nov 2016 05:49:33 -0800 (PST) From: csmanjuvijay@gmail.com To: csmanjuvijay@gmail.com Subject: [PATCH] USB: OHCI: use module_platform_driver macro Date: Tue, 22 Nov 2016 13:49:22 +0000 Message-Id: <1479822562-18719-1-git-send-email-csmanjuvijay@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161122_054958_660390_F7653287 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Zapolskiy , Alan Stern , Sylvain Lemieux , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Manjunath Goudar Use the module_platform_driver macro to do module init/exit. This eliminates a lot of boilerplate.This also removes checkpatch.pl errors. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Vladimir Zapolskiy Cc: Sylvain Lemieux Cc: Alan Stern Cc: Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/usb/host/ohci-nxp.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index b7d4756..9908647 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -56,8 +56,6 @@ static struct hc_driver __read_mostly ohci_nxp_hc_driver; static struct i2c_client *isp1301_i2c_client; -extern int usb_disabled(void); - static struct clk *usb_host_clk; static void isp1301_configure_lpc32xx(void) @@ -127,6 +125,7 @@ static inline void isp1301_vbus_off(void) static void ohci_nxp_start_hc(void) { unsigned long tmp = __raw_readl(USB_OTG_STAT_CONTROL) | HOST_EN; + __raw_writel(tmp, USB_OTG_STAT_CONTROL); isp1301_vbus_on(); } @@ -134,6 +133,7 @@ static void ohci_nxp_start_hc(void) static void ohci_nxp_stop_hc(void) { unsigned long tmp; + isp1301_vbus_off(); tmp = __raw_readl(USB_OTG_STAT_CONTROL) & ~HOST_EN; __raw_writel(tmp, USB_OTG_STAT_CONTROL); @@ -142,11 +142,17 @@ static void ohci_nxp_stop_hc(void) static int ohci_hcd_nxp_probe(struct platform_device *pdev) { struct usb_hcd *hcd = 0; - const struct hc_driver *driver = &ohci_nxp_hc_driver; struct resource *res; int ret = 0, irq; struct device_node *isp1301_node; + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_DESC "\n", hcd_name); + + ohci_init_driver(&ohci_nxp_hc_driver, NULL); + if (pdev->dev.of_node) { isp1301_node = of_parse_phandle(pdev->dev.of_node, "transceiver", 0); @@ -155,9 +161,8 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) } isp1301_i2c_client = isp1301_get_client(isp1301_node); - if (!isp1301_i2c_client) { + if (!isp1301_i2c_client) return -EPROBE_DEFER; - } ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) @@ -165,6 +170,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name); if (usb_disabled()) { + dev_err(&pdev->dev, "USB is disabled\n"); ret = -ENODEV; goto fail_disable; @@ -186,7 +192,8 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) isp1301_configure(); - hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); + hcd = usb_create_hcd(&ohci_nxp_hc_driver, &pdev->dev, + dev_name(&pdev->dev)); if (!hcd) { dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); ret = -ENOMEM; @@ -260,24 +267,7 @@ static struct platform_driver ohci_hcd_nxp_driver = { .probe = ohci_hcd_nxp_probe, .remove = ohci_hcd_nxp_remove, }; - -static int __init ohci_nxp_init(void) -{ - if (usb_disabled()) - return -ENODEV; - - pr_info("%s: " DRIVER_DESC "\n", hcd_name); - - ohci_init_driver(&ohci_nxp_hc_driver, NULL); - return platform_driver_register(&ohci_hcd_nxp_driver); -} -module_init(ohci_nxp_init); - -static void __exit ohci_nxp_cleanup(void) -{ - platform_driver_unregister(&ohci_hcd_nxp_driver); -} -module_exit(ohci_nxp_cleanup); +module_platform_driver(ohci_hcd_nxp_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL v2");