Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1532984
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/12] usb: phy: msm: Replace the extcon API |
| Date | 2016-11-30 07:10 +0100 |
| Message-ID | <sJ6fD-2kZ-3@gated-at.bofh.it> (permalink) |
| References | <sJ65X-214-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <cw00.choi@samsung.com>
---
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);
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/12] extcon: Replace the deprecated extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:00 +0100
[PATCH 09/12] usb: phy: omap-otg: Replace the extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:00 +0100
Re: [PATCH 09/12] usb: phy: omap-otg: Replace the extcon API Felipe Balbi <balbi@kernel.org> - 2016-11-30 11:50 +0100
[PATCH 02/12] phy: sun4i-usb: Replace the deprecated extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:10 +0100
[PATCH 08/12] usb: phy: msm: Replace the extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:10 +0100
Re: [PATCH 08/12] usb: phy: msm: Replace the extcon API Felipe Balbi <balbi@kernel.org> - 2016-11-30 11:50 +0100
[PATCH 12/12] usb: renesas_usbhs: Replace the deprecated extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:10 +0100
Re: [PATCH 12/12] usb: renesas_usbhs: Replace the deprecated extcon API Felipe Balbi <balbi@kernel.org> - 2016-11-30 11:50 +0100
RE: [PATCH 12/12] usb: renesas_usbhs: Replace the deprecated extcon API Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-12-06 02:40 +0100
[PATCH 10/12] usb: phy: qcom-8x16-usb: Replace the extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:10 +0100
Re: [PATCH 10/12] usb: phy: qcom-8x16-usb: Replace the extcon API Felipe Balbi <balbi@kernel.org> - 2016-11-30 11:50 +0100
[PATCH 06/12] usb: dwc3: omap: Replace the extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-11-30 07:10 +0100
Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API Felipe Balbi <balbi@kernel.org> - 2016-11-30 11:40 +0100
Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-02 09:00 +0100
Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API Felipe Balbi <balbi@kernel.org> - 2016-12-02 10:10 +0100
Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API Chanwoo Choi <cwchoi00@gmail.com> - 2016-12-02 14:30 +0100
csiph-web