Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756758AbcK3F6m (ORCPT ); Wed, 30 Nov 2016 00:58:42 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:60608 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300AbcK3F6A (ORCPT ); Wed, 30 Nov 2016 00:58:00 -0500 X-AuditID: cbfee61a-f79916d0000062de-f4-583e6a564496 From: Chanwoo Choi To: balbi@kernel.org, gregkh@linuxfoundation.org, kishon@ti.com, sre@kernel.org Cc: Peter.Chen@nxp.com, wens@csie.org, yoshihiro.shimoda.uh@renesas.com, maxime.ripard@free-electrons.com, b-liu@ti.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, cw00.choi@samsung.com, chanwoo@kernel.org Subject: [PATCH 05/12] usb: chipdata: Replace the extcon API Date: Wed, 30 Nov 2016 14:57:33 +0900 Message-id: <1480485460-2663-6-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+NgFtrCIsWRmVeSWpSXmKPExsVy+t9jAd2wLLsIg9kfFCz+31nEanGs7Qm7 xcQbV1gsrn95zmrRvHg9m8WFpz1sFpseX2O1uLxrDpvF7CX9LBafe48wWmx9+Y7JYtGyVmaL rZv2Mlv8uXeH1eL07hKLn4fOM1l83fuZzUHQY8Oj1aweTzZdZPTYtKqTzWP/3DXsHpuX1Hts fLeDyePbmYksHn1bVjF6HL+xncnj8ya5AK4oN5uM1MSU1CKF1Lzk/JTMvHRbpdAQN10LJYW8 xNxUW6UIXd+QICWFssScUiDPyAANODgHuAcr6dsluGVMXriBseCpeMWNHokGxm3CXYycHBIC JhLfZ6xngbDFJC7cW8/WxcjFISSwlFHiyOeDzBDOD0aJP5+eMYFUsQloSex/cYMNxBYR8JfY 0TiHBaSIWeARk8SVl9vBRgkL2EhM7/0OZHNwsAioSkz6LwgS5hVwkbj67hwzxDY5iQ97HrGD lHAKuEpM+p4CEhYCKlmzcDHTBEbeBYwMqxglUguSC4qT0nMN81LL9YoTc4tL89L1kvNzNzGC Y+yZ1A7Gg7vcDzEKcDAq8fBO6LONEGJNLCuuzD3EKMHBrCTC65ZmFyHEm5JYWZValB9fVJqT WnyI0RTorInMUqLJ+cD4zyuJNzQxNzE3NrAwt7Q0MVIS522c/SxcSCA9sSQ1OzW1ILUIpo+J g1OqgXFC/al8Nukrry+ZVV+ecLXphbPuoWaVn3vWWNqfmVd0nt+/yn1Ly7aTbsa6fF/PHvIX u7ze+Zzm2SNsX+sZZAxmSCxeW7PG1lk+vFajReVpw5KM9OuahYWds07YsZRw3mD9Uthv+K1l ld4xg9B5ajxSLnJTUhqeqz7X50n3sHRbkWB57N+1BiWW4oxEQy3mouJEAHLVmtDHAgAA X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2948 Lines: 95 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 --- drivers/usb/chipidea/core.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 69426e644d17..a5b44963eaea 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev, cable->edev = ext_vbus; if (!IS_ERR(ext_vbus)) { - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB); + ret = extcon_get_state(cable->edev, EXTCON_USB); if (ret) cable->state = true; else @@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev, cable->edev = ext_id; if (!IS_ERR(ext_id)) { - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST); + ret = extcon_get_state(cable->edev, EXTCON_USB_HOST); if (ret) cable->state = false; else @@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci) id = &ci->platdata->id_extcon; id->ci = ci; if (!IS_ERR(id->edev)) { - ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST, - &id->nb); + ret = devm_extcon_register_notifier(ci->dev, id->edev, + EXTCON_USB_HOST, &id->nb); if (ret < 0) { dev_err(ci->dev, "register ID failed\n"); return ret; @@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci) vbus = &ci->platdata->vbus_extcon; vbus->ci = ci; if (!IS_ERR(vbus->edev)) { - ret = extcon_register_notifier(vbus->edev, EXTCON_USB, - &vbus->nb); + ret = devm_extcon_register_notifier(ci->dev, vbus->edev, + EXTCON_USB, &vbus->nb); if (ret < 0) { - extcon_unregister_notifier(id->edev, EXTCON_USB_HOST, - &id->nb); dev_err(ci->dev, "register VBUS failed\n"); return ret; } @@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci) return 0; } -static void ci_extcon_unregister(struct ci_hdrc *ci) -{ - struct ci_hdrc_cable *cable; - - cable = &ci->platdata->id_extcon; - if (!IS_ERR(cable->edev)) - extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST, - &cable->nb); - - cable = &ci->platdata->vbus_extcon; - if (!IS_ERR(cable->edev)) - extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb); -} - static DEFINE_IDA(ci_ida); struct platform_device *ci_hdrc_add_device(struct device *dev, @@ -1053,7 +1037,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) if (!ret) return 0; - ci_extcon_unregister(ci); stop: ci_role_destroy(ci); deinit_phy: @@ -1073,7 +1056,6 @@ static int ci_hdrc_remove(struct platform_device *pdev) } dbg_remove_files(ci); - ci_extcon_unregister(ci); ci_role_destroy(ci); ci_hdrc_enter_lpm(ci, true); ci_usb_phy_exit(ci); -- 1.9.1