All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: balbi@kernel.org, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	chanwoo@kernel.org, Chanwoo Choi <cw00.choi@samsung.com>
Subject: [PATCH v2 1/6] usb: dwc3: omap: Replace the extcon API
Date: Fri, 30 Dec 2016 13:08:10 +0900	[thread overview]
Message-ID: <1483070895-8213-2-git-send-email-cw00.choi@samsung.com> (raw)
In-Reply-To: <1483070895-8213-1-git-send-email-cw00.choi@samsung.com>

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>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.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

  parent reply	other threads:[~2016-12-30  4:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161230040816epcas5p4616cb93324a5d60bc2a763817e34e37d@epcas5p4.samsung.com>
2016-12-30  4:08 ` [PATCH v2 0/6] usb: Replace the deprecated extcon API Chanwoo Choi
     [not found]   ` <CGME20161230040816epcas5p4c76ef8f364678a34e2a0ff67b0119ef9@epcas5p4.samsung.com>
2016-12-30  4:08     ` Chanwoo Choi [this message]
2017-01-16 10:31       ` [PATCH v2 1/6] usb: dwc3: omap: Replace the " Felipe Balbi
2017-01-16 10:31         ` Felipe Balbi
     [not found]   ` <CGME20161230040816epcas5p4dc9f57b63a2e428a47f313d32146c5d7@epcas5p4.samsung.com>
2016-12-30  4:08     ` [PATCH v2 2/6] usb: phy: msm: " Chanwoo Choi
     [not found]   ` <CGME20161230040816epcas5p47433110fddafafca1a8b8a64acee1835@epcas5p4.samsung.com>
2016-12-30  4:08     ` [PATCH v2 3/6] usb: phy: omap-otg: " Chanwoo Choi
     [not found]   ` <CGME20161230040817epcas5p430bfef6b76d46ab5e69d5f45816b1af4@epcas5p4.samsung.com>
2016-12-30  4:08     ` [PATCH v2 4/6] usb: phy: qcom-8x16-usb: " Chanwoo Choi
     [not found]   ` <CGME20161230040817epcas5p403afe9ebb60e55eee9a5c47c27b82b65@epcas5p4.samsung.com>
2016-12-30  4:08     ` [PATCH v2 5/6] usb: phy: tahvo: Replace the deprecated " Chanwoo Choi
     [not found]   ` <CGME20161230040817epcas5p48322c725a69442bebf3a36b3ba069c33@epcas5p4.samsung.com>
2016-12-30  4:08     ` [PATCH v2 6/6] usb: renesas_usbhs: " Chanwoo Choi
2017-01-10  8:18   ` [PATCH v2 0/6] usb: " Chanwoo Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483070895-8213-2-git-send-email-cw00.choi@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=balbi@kernel.org \
    --cc=chanwoo@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.