Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532988

[PATCH 06/12] usb: dwc3: omap: Replace the extcon API

From Chanwoo Choi <cw00.choi@samsung.com>
Newsgroups linux.kernel
Subject [PATCH 06/12] usb: dwc3: omap: Replace the extcon API
Date 2016-11-30 07:10 +0100
Message-ID <sJ6fE-2kZ-15@gated-at.bofh.it> (permalink)
References <sJ65X-214-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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/dwc3/dwc3-omap.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 29e80cc9b634..2d2e9aa1db08 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -425,20 +425,20 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
 		}
 
 		omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-		ret = extcon_register_notifier(edev, EXTCON_USB,
-						&omap->vbus_nb);
+		ret = devm_extcon_register_notifier(omap->dev, edev,
+						EXTCON_USB, &omap->vbus_nb);
 		if (ret < 0)
 			dev_vdbg(omap->dev, "failed to register notifier for USB\n");
 
 		omap->id_nb.notifier_call = dwc3_omap_id_notifier;
-		ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
-						&omap->id_nb);
+		ret = devm_extcon_register_notifier(omap->dev, edev,
+						EXTCON_USB_HOST, &omap->id_nb);
 		if (ret < 0)
 			dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n");
 
-		if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
+		if (extcon_get_state(edev, EXTCON_USB) == true)
 			dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-		if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
+		if (extcon_get_state(edev, EXTCON_USB_HOST) == true)
 			dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
 
 		omap->edev = edev;
@@ -527,17 +527,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 	ret = of_platform_populate(node, NULL, NULL, dev);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to create dwc3 core\n");
-		goto err2;
+		goto err1;
 	}
 
 	dwc3_omap_enable_irqs(omap);
 
 	return 0;
 
-err2:
-	extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-	extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
-
 err1:
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
@@ -549,8 +545,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
 {
 	struct dwc3_omap	*omap = platform_get_drvdata(pdev);
 
-	extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-	extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
 	dwc3_omap_disable_irqs(omap);
 	of_platform_depopulate(omap->dev);
 	pm_runtime_put_sync(&pdev->dev);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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