From patchwork Wed Nov 30 05:57:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9453757 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 39B636071E for ; Wed, 30 Nov 2016 06:10:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3DA1FF1D for ; Wed, 30 Nov 2016 06:10:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20BBF283E9; Wed, 30 Nov 2016 06:10:18 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable 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 967621FF1D for ; Wed, 30 Nov 2016 06:10:17 +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 1cBy3d-0004WJ-BL; Wed, 30 Nov 2016 06:07:53 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBxuC-0002l5-Ut for linux-arm-kernel@lists.infradead.org; Wed, 30 Nov 2016 05:58:12 +0000 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OHF00UR7XW6ES20@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 30 Nov 2016 14:57:43 +0900 (KST) X-AuditID: cbfee61b-f796f6d000004092-0b-583e6a566532 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id B6.62.16530.65A6E385; Wed, 30 Nov 2016 14:57:42 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OHF00E2UXW50C70@mmp1.samsung.com>; Wed, 30 Nov 2016 14:57:42 +0900 (KST) From: Chanwoo Choi To: balbi@kernel.org, gregkh@linuxfoundation.org, kishon@ti.com, sre@kernel.org Subject: [PATCH 08/12] usb: phy: msm: Replace the extcon API Date: Wed, 30 Nov 2016 14:57:36 +0900 Message-id: <1480485460-2663-9-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1480485460-2663-1-git-send-email-cw00.choi@samsung.com> References: <1480485460-2663-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t9jAd2wLLsIg/ubbSz+31nEanGs7Qm7 xcQbV1gsrn95zmrRvHg9m8WFpz1sFpseX2O1uLxrDpvF7CX9LBafe48wWmx9+Y7JYtGyVmaL rZv2Mlv8uXeH1eL07hKLn4fOM1l83fuZzUHQY8Oj1aweTzZdZPTYtKqTzWP/3DXsHpuX1Hts fLeDyePbmYksHn1bVjF6HL+xncnj8ya5AK4oN5uM1MSU1CKF1Lzk/JTMvHRbpdAQN10LJYW8 xNxUW6UIXd+QICWFssScUiDPyAANODgHuAcr6dsluGUcPCRasFO24sKSd2wNjKskuhg5OSQE TCROblrDDGGLSVy4t56ti5GLQ0hgKaPE8sZ7UM4PRomJ3ZeZQKrYBLQk9r+4wQZiiwj4S+xo nMMCUsQs8IhJ4srL7SwgCWEBG4nZWx+DjWURUJX4fbaXHcTmFXCROP74LiPEOjmJD3seAcU5 ODgFXCUmfU8BCQsBlaxZuJhpAiPvAkaGVYwSqQXJBcVJ6blGeanlesWJucWleel6yfm5mxjB UfZMegfj4V3uhxgFOBiVeHgXzLGNEGJNLCuuzD3EKMHBrCTC65ZmFyHEm5JYWZValB9fVJqT WnyI0RToronMUqLJ+cAEkFcSb2hibmJubGBhbmlpYqQkzts4+1m4kEB6YklqdmpqQWoRTB8T B6dUA2PPkXquF1ZnHBbIfVh8dUNoUu6q30nO1/7m89Zfsmk+oHjpUc/jKcp9dzSN8/R0L2X6 HIv+8ryfOWTm6qgnnjbBggdtTpk5aNrvlJ4tn/Nw2gdWjoDUo79/8kU2cZa71qx4f+PM0T+8 6R+zlmhziTOVBhZ7fGo/Ma+qxkAq/sqZLaWLIh7cO6zEUpyRaKjFXFScCAAkol97yAIAAA== X-MTR: 20000000000000000@CPGS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161129_215809_466408_DF8A524B X-CRM114-Status: GOOD ( 11.76 ) 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: Peter.Chen@nxp.com, linux-pm@vger.kernel.org, yoshihiro.shimoda.uh@renesas.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, cw00.choi@samsung.com, wens@csie.org, chanwoo@kernel.org, maxime.ripard@free-electrons.com, linux-omap@vger.kernel.org, b-liu@ti.com, 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 This patch uses the resource-managed extcon API for extcon_register_notifier() and replaces the deprecated extcon API as following: - extcon_get_cable_state_() -> extcon_get_state() Signed-off-by: Chanwoo Choi Acked-by: Felipe Balbi --- drivers/usb/phy/phy-msm-usb.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 8a34759727bb..a15a89d4235d 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1742,14 +1742,14 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) if (!IS_ERR(ext_vbus)) { motg->vbus.extcon = ext_vbus; motg->vbus.nb.notifier_call = msm_otg_vbus_notifier; - ret = extcon_register_notifier(ext_vbus, EXTCON_USB, - &motg->vbus.nb); + ret = devm_extcon_register_notifier(&pdev->dev, ext_vbus, + EXTCON_USB, &motg->vbus.nb); if (ret < 0) { dev_err(&pdev->dev, "register VBUS notifier failed\n"); return ret; } - ret = extcon_get_cable_state_(ext_vbus, EXTCON_USB); + ret = extcon_get_state(ext_vbus, EXTCON_USB); if (ret) set_bit(B_SESS_VLD, &motg->inputs); else @@ -1759,16 +1759,14 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) if (!IS_ERR(ext_id)) { motg->id.extcon = ext_id; motg->id.nb.notifier_call = msm_otg_id_notifier; - ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST, - &motg->id.nb); + ret = devm_extcon_register_notifier(&pdev->dev, ext_id, + EXTCON_USB_HOST, &motg->id.nb); if (ret < 0) { dev_err(&pdev->dev, "register ID notifier failed\n"); - extcon_unregister_notifier(motg->vbus.extcon, - EXTCON_USB, &motg->vbus.nb); return ret; } - ret = extcon_get_cable_state_(ext_id, EXTCON_USB_HOST); + ret = extcon_get_state(ext_id, EXTCON_USB_HOST); if (ret) clear_bit(ID, &motg->inputs); else @@ -1883,10 +1881,9 @@ static int msm_otg_probe(struct platform_device *pdev) */ if (motg->phy_number) { phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4); - if (!phy_select) { - ret = -ENOMEM; - goto unregister_extcon; - } + if (!phy_select) + return -ENOMEM; + /* Enable second PHY with the OTG port */ writel(0x1, phy_select); } @@ -1897,7 +1894,7 @@ static int msm_otg_probe(struct platform_device *pdev) if (motg->irq < 0) { dev_err(&pdev->dev, "platform_get_irq failed\n"); ret = motg->irq; - goto unregister_extcon; + return motg->irq; } regs[0].supply = "vddcx"; @@ -1906,7 +1903,7 @@ static int msm_otg_probe(struct platform_device *pdev) ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs); if (ret) - goto unregister_extcon; + return ret; motg->vddcx = regs[0].consumer; motg->v3p3 = regs[1].consumer; @@ -2003,11 +2000,6 @@ static int msm_otg_probe(struct platform_device *pdev) clk_disable_unprepare(motg->clk); if (!IS_ERR(motg->core_clk)) clk_disable_unprepare(motg->core_clk); -unregister_extcon: - extcon_unregister_notifier(motg->id.extcon, - EXTCON_USB_HOST, &motg->id.nb); - extcon_unregister_notifier(motg->vbus.extcon, - EXTCON_USB, &motg->vbus.nb); return ret; } @@ -2029,9 +2021,6 @@ static int msm_otg_remove(struct platform_device *pdev) */ gpiod_set_value_cansleep(motg->switch_gpio, 0); - extcon_unregister_notifier(motg->id.extcon, EXTCON_USB_HOST, &motg->id.nb); - extcon_unregister_notifier(motg->vbus.extcon, EXTCON_USB, &motg->vbus.nb); - msm_otg_debugfs_cleanup(); cancel_delayed_work_sync(&motg->chg_work); cancel_work_sync(&motg->sm_work);