From patchwork Sat May 20 17:52:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 100234 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp811466qge; Sat, 20 May 2017 10:55:03 -0700 (PDT) X-Received: by 10.99.112.66 with SMTP id a2mr16353133pgn.7.1495302903704; Sat, 20 May 2017 10:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495302903; cv=none; d=google.com; s=arc-20160816; b=cW2GFsc8s/eu+SHQFBgFELycB85cKkkZri01ijT8z6jEjKd2J5LTxO3+AvYjucImhO SXP+9Zg1oAISf+45zT6QilvPVpt0RuhaNArP2tarZ06LGlTjqRCfCL7//svTtLJb1Vtr SA0+1/JTF/jGQct/xqb5Y7w6X5RUV/w8oyJXMDcL5yED+3MeN5ApcBHLQfZlkPiDevQ8 SN8EKgYNg6y7TSB8EzGSTIG8wxZTe/Euwj2Dn/6AhZeeSb0GsZsO9ULGUmFIdIrFcOWV aCWfv8GNU+wImwgES2HaS8mlVnm0I1P971InU0mL6QbNq0XM+yNV3Pjmm7B4mQKGSCsf ZujQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=I4Xt5tuUGWYCdf5Vq428X8rALoOKkxQkAQ0uib9KCdo=; b=ezSCf4nV6bBW5KPx+aPztTX+vmdf5LsAvfsUSyJQHsMRc8WCctfHgbQyvr3Di/sY7A BmxjVYA4mMH3H9AfXh+eRYTcj2Wx27sM4ZZkIIeuB+siFNlpVD3HtTT7IXJfxCey5QoT M/fyk9mZBM1JeKk29E66pHSWPODydlvUMt5x7Z0Ouxkr8MPKWbHQ9uiZ+67pfxJMF2Ut fymh52D1f8dpgctBZxmOQj4KGNRyvPAfiPidE27Bma7dTeWCUWBnelN7wTICglip2kDT uOxZnc3MqxwItuEvMjGRaHAP5xZC9aTn5y6KCyAfZrkq3RwnPuiasxuw+SikphpwvrtB 1ZbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z135si11590112pgz.5.2017.05.20.10.55.03; Sat, 20 May 2017 10:55:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752010AbdETRyk (ORCPT + 4 others); Sat, 20 May 2017 13:54:40 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:43458 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbdETRyj (ORCPT ); Sat, 20 May 2017 13:54:39 -0400 X-Greylist: delayed 2865 seconds by postgrey-1.27 at vger.kernel.org; Sat, 20 May 2017 13:54:39 EDT Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-07.nifty.com with ESMTP id v4KHqFdD028553; Sun, 21 May 2017 02:52:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v4KHqFdD028553 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1495302757; bh=uN33A6MfeiCkQqW1DrCTFxy5Gz79FRVNLR9f5fPR2U4=; h=From:To:Cc:Subject:Date:From; b=lcMD8WggdcXRqeAi1rNXnizM+HQu9XYS3nJ84m20m+PnLZjcxgJ7QXdHaNPZ6zEx8 vxNgQAEJxKLxRLTtzFhOSV4dA10ptNxPg3NUrOdQ6AT4RPMcJkUsRz3zsw4jkMl97S Zlk5SluWSTMCIh1oH1dqvTLbs6uVG8yRb4wvu0MKttx+DtE2h54x7IdE9VQevh0Jhx nzlDZgzcqDc3U1P5KqK8UQbYJJ/da2XKFMvmcxmQnmrt1JJ6aPq8Eelm2tE9gvOezb bHtrCoKJAYhSqC3x++BwHcj/obdrEo+5E1nSSV+D5XuISdX0et0VBLlyEI8MftA9fi zSoR6PEgDpbSw== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Cc: Masahiro Yamada , Patrice Chotard , Alan Stern , Felipe Balbi , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Li Yang , Tony Prisk , Greg Kroah-Hartman , John Youn , linux-arm-kernel@lists.infradead.org, kernel@stlinux.com Subject: [PATCH] usb: remove NULL pointer check for clk_disable_unprepare Date: Sun, 21 May 2017 02:52:13 +0900 Message-Id: <1495302733-6669-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org After long term efforts of fixing non-common clock implementations, clk_disable() is a no-op for a NULL pointer input, and this is now tree-wide consistent. All clock consumers can safely call clk_disable(_unprepare) without NULL pointer check. Signed-off-by: Masahiro Yamada --- drivers/usb/dwc2/platform.c | 3 +-- drivers/usb/gadget/udc/fsl_mxc_udc.c | 3 +-- drivers/usb/host/ehci-mxc.c | 8 ++------ drivers/usb/host/ehci-platform.c | 3 +-- drivers/usb/host/ehci-spear.c | 3 +-- drivers/usb/host/ehci-st.c | 3 +-- drivers/usb/host/fsl-mph-dr-of.c | 3 +-- drivers/usb/host/ohci-platform.c | 3 +-- drivers/usb/host/ohci-spear.c | 3 +-- drivers/usb/host/ohci-st.c | 3 +-- drivers/usb/misc/usb3503.c | 9 +++------ 11 files changed, 14 insertions(+), 30 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index daf0d37..8c5bf81 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -182,8 +182,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg) if (ret) return ret; - if (hsotg->clk) - clk_disable_unprepare(hsotg->clk); + clk_disable_unprepare(hsotg->clk); ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); diff --git a/drivers/usb/gadget/udc/fsl_mxc_udc.c b/drivers/usb/gadget/udc/fsl_mxc_udc.c index f16e149..59dbcf7 100644 --- a/drivers/usb/gadget/udc/fsl_mxc_udc.c +++ b/drivers/usb/gadget/udc/fsl_mxc_udc.c @@ -118,8 +118,7 @@ int fsl_udc_clk_finalize(struct platform_device *pdev) void fsl_udc_clk_release(void) { - if (mxc_per_clk) - clk_disable_unprepare(mxc_per_clk); + clk_disable_unprepare(mxc_per_clk); clk_disable_unprepare(mxc_ahb_clk); clk_disable_unprepare(mxc_ipg_clk); } diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index c7a9b31..1db5ef9 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -155,9 +155,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) if (pdata && pdata->exit) pdata->exit(pdev); err_init: - if (priv->phyclk) - clk_disable_unprepare(priv->phyclk); - + clk_disable_unprepare(priv->phyclk); clk_disable_unprepare(priv->ahbclk); err_clk_ahb: clk_disable_unprepare(priv->usbclk); @@ -183,9 +181,7 @@ static int ehci_mxc_drv_remove(struct platform_device *pdev) clk_disable_unprepare(priv->usbclk); clk_disable_unprepare(priv->ahbclk); - - if (priv->phyclk) - clk_disable_unprepare(priv->phyclk); + clk_disable_unprepare(priv->phyclk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index bc7b9be..2d41447 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -127,8 +127,7 @@ static void ehci_platform_power_off(struct platform_device *dev) } for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ehci_platform_hc_driver; diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1f25c79..57257aa 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -138,8 +138,7 @@ static int spear_ehci_hcd_drv_remove(struct platform_device *pdev) usb_remove_hcd(hcd); - if (sehci->clk) - clk_disable_unprepare(sehci->clk); + clk_disable_unprepare(sehci->clk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ehci-st.c b/drivers/usb/host/ehci-st.c index be4a278..f3c433d 100644 --- a/drivers/usb/host/ehci-st.c +++ b/drivers/usb/host/ehci-st.c @@ -130,8 +130,7 @@ static void st_ehci_platform_power_off(struct platform_device *dev) phy_exit(priv->phy); for (clk = USB_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index e90ddb5..ec5562d 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -325,8 +325,7 @@ static void fsl_usb2_mpc5121_exit(struct platform_device *pdev) pdata->regs = NULL; - if (pdata->clk) - clk_disable_unprepare(pdata->clk); + clk_disable_unprepare(pdata->clk); } static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = { diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 6368fce..200137a 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -94,8 +94,7 @@ static void ohci_platform_power_off(struct platform_device *dev) } for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ohci_platform_hc_driver; diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 56478ed..4037130 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -111,8 +111,7 @@ static int spear_ohci_hcd_drv_remove(struct platform_device *pdev) struct spear_ohci *sohci_p = to_spear_ohci(hcd); usb_remove_hcd(hcd); - if (sohci_p->clk) - clk_disable_unprepare(sohci_p->clk); + clk_disable_unprepare(sohci_p->clk); usb_put_hcd(hcd); return 0; diff --git a/drivers/usb/host/ohci-st.c b/drivers/usb/host/ohci-st.c index 02816a1..05ede9d 100644 --- a/drivers/usb/host/ohci-st.c +++ b/drivers/usb/host/ohci-st.c @@ -112,8 +112,7 @@ static void st_ohci_platform_power_off(struct platform_device *dev) phy_exit(priv->phy); for (clk = USB_MAX_CLKS - 1; clk >= 0; clk--) - if (priv->clks[clk]) - clk_disable_unprepare(priv->clks[clk]); + clk_disable_unprepare(priv->clks[clk]); } static struct hc_driver __read_mostly ohci_platform_hc_driver; diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index 8e7737d..1d4d1e4 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -335,8 +335,7 @@ static int usb3503_i2c_remove(struct i2c_client *i2c) struct usb3503 *hub; hub = i2c_get_clientdata(i2c); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; } @@ -359,8 +358,7 @@ static int usb3503_platform_remove(struct platform_device *pdev) struct usb3503 *hub; hub = platform_get_drvdata(pdev); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; } @@ -373,8 +371,7 @@ static int usb3503_i2c_suspend(struct device *dev) usb3503_switch_mode(hub, USB3503_MODE_STANDBY); - if (hub->clk) - clk_disable_unprepare(hub->clk); + clk_disable_unprepare(hub->clk); return 0; }