mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] usb: Replace deprecated API of extcon
@ 2015-07-01  4:11 Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 1/5] usb: dwc3: omap: " Chanwoo Choi
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb; +Cc: cw00.choi, myungjoo.ham

This patch removes the deprecated API of extcon framwork
and then use the new extcon API with the unique id to indicate
the each external connector.

Th deprecated API with cable name as following:
- int extcon_register_interest(struct extcon_specific_cable_nb *obj,
				const char *extcon_name,
				const char *cable_name,
				struct notifier_block *nb);
- int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
- int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name);
- int extcon_set_cable_state(struct extcon_dev *edev, const char *cable_name,
				bool cable_state);

The recommeded API with unique id of each external connector as following:
- int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
				struct notifier_block *nb);
- int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
				struct notifier_block *nb);
- int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id);
- int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
				bool cable_state);

Depends on:
This patch-set is based on latest linux.git[1] because this patch-set have
the dependency of extcon patches for Linux v4.2.
[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/

Chanwoo Choi (5):
  usb: dwc3: omap: Replace deprecated API of extcon
  usb: phy: omap-otg: Replace deprecated API of extcon
  usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API
  usb: renesas_usbhs: Replace deprecated API of extcon
  usb: phy: msm-usb: Replace deprecated API of extcon

 drivers/usb/dwc3/dwc3-omap.c       | 32 +++++++++++++-------------------
 drivers/usb/phy/phy-msm-usb.c      | 20 ++++++++++----------
 drivers/usb/phy/phy-omap-otg.c     | 22 +++++++++++-----------
 drivers/usb/phy/phy-tahvo.c        | 27 +++++++++++++--------------
 drivers/usb/renesas_usbhs/common.c |  2 +-
 include/linux/usb/msm_hsusb.h      |  2 +-
 6 files changed, 49 insertions(+), 56 deletions(-)

-- 
1.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] usb: dwc3: omap: Replace deprecated API of extcon
  2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
@ 2015-07-01  4:11 ` Chanwoo Choi
  2015-07-06 17:23   ` Felipe Balbi
  2015-07-01  4:11 ` [PATCH 2/5] usb: phy: omap-otg: " Chanwoo Choi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb; +Cc: cw00.choi, myungjoo.ham

This patch removes the deprecated notifier API of extcon framwork
and then use the new extcon API with the unique id to indicate
the each external connector (USB, USB-HOST).

Alter deprecated API as following:
- extcon_register_interest() -> extcon_register_notifier()
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/usb/dwc3/dwc3-omap.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 6b486a36863c..651a0e803882 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -128,8 +128,7 @@ struct dwc3_omap {
 
 	u32			dma_status:1;
 
-	struct extcon_specific_cable_nb extcon_vbus_dev;
-	struct extcon_specific_cable_nb extcon_id_dev;
+	struct extcon_dev	*edev;
 	struct notifier_block	vbus_nb;
 	struct notifier_block	id_nb;
 
@@ -454,23 +453,23 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
 		}
 
 		omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-		ret = extcon_register_interest(&omap->extcon_vbus_dev,
-					       edev->name, "USB",
-					       &omap->vbus_nb);
+		ret = extcon_register_notifier(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_interest(&omap->extcon_id_dev,
-					       edev->name, "USB-HOST",
-					       &omap->id_nb);
+		ret = extcon_register_notifier(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, "USB") == true)
+		if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
 			dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-		if (extcon_get_cable_state(edev, "USB-HOST") == true)
+		if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
 			dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
+
+		omap->edev = edev;
 	}
 
 	return 0;
@@ -565,11 +564,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 	return 0;
 
 err3:
-	if (omap->extcon_vbus_dev.edev)
-		extcon_unregister_interest(&omap->extcon_vbus_dev);
-	if (omap->extcon_id_dev.edev)
-		extcon_unregister_interest(&omap->extcon_id_dev);
-
+	extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
+	extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
 err2:
 	dwc3_omap_disable_irqs(omap);
 
@@ -586,10 +582,8 @@ static int dwc3_omap_remove(struct platform_device *pdev)
 {
 	struct dwc3_omap	*omap = platform_get_drvdata(pdev);
 
-	if (omap->extcon_vbus_dev.edev)
-		extcon_unregister_interest(&omap->extcon_vbus_dev);
-	if (omap->extcon_id_dev.edev)
-		extcon_unregister_interest(&omap->extcon_id_dev);
+	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.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/5] usb: phy: omap-otg: Replace deprecated API of extcon
  2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 1/5] usb: dwc3: omap: " Chanwoo Choi
@ 2015-07-01  4:11 ` Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 3/5] usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API Chanwoo Choi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb; +Cc: cw00.choi, myungjoo.ham

This patch removes the deprecated notifier API of extcon framwork
and then use the new extcon API with the unique id to indicate
the each external connector (USB, USB-HOST).

Alter deprecated API as following:
- extcon_register_interest() -> extcon_register_notifier()
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/usb/phy/phy-omap-otg.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 56ee7603034b..12af8b1595ee 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -30,8 +30,7 @@ struct otg_device {
 	void __iomem			*base;
 	bool				id;
 	bool				vbus;
-	struct extcon_specific_cable_nb	vbus_dev;
-	struct extcon_specific_cable_nb	id_dev;
+	struct extcon_dev		*extcon;
 	struct notifier_block		vbus_nb;
 	struct notifier_block		id_nb;
 };
@@ -106,6 +105,7 @@ static int omap_otg_probe(struct platform_device *pdev)
 	extcon = extcon_get_extcon_dev(config->extcon);
 	if (!extcon)
 		return -EPROBE_DEFER;
+	otd_dev->extcon = extcon;
 
 	otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
 	if (!otg_dev)
@@ -118,20 +118,19 @@ static int omap_otg_probe(struct platform_device *pdev)
 	otg_dev->id_nb.notifier_call = omap_otg_id_notifier;
 	otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier;
 
-	ret = extcon_register_interest(&otg_dev->id_dev, config->extcon,
-				       "USB-HOST", &otg_dev->id_nb);
+	ret = extcon_register_notifier(extcon, EXTCON_USB_HOST, &otg_dev->id_nb);
 	if (ret)
 		return ret;
 
-	ret = extcon_register_interest(&otg_dev->vbus_dev, config->extcon,
-				       "USB", &otg_dev->vbus_nb);
+	ret = extcon_register_notifier(extcon, EXTCON_USB, &otg_dev->vbus_nb);
 	if (ret) {
-		extcon_unregister_interest(&otg_dev->id_dev);
+		extcon_unregister_notifier(extcon, EXTCON_USB_HOST,
+					&otg_dev->id_nb);
 		return ret;
 	}
 
-	otg_dev->id = extcon_get_cable_state(extcon, "USB-HOST");
-	otg_dev->vbus = extcon_get_cable_state(extcon, "USB");
+	otg_dev->id = extcon_get_cable_state_(extcon, EXTCON_USB_HOST);
+	otg_dev->vbus = extcon_get_cable_state_(extcon, EXTCON_USB);
 	omap_otg_set_mode(otg_dev);
 
 	rev = readl(otg_dev->base);
@@ -147,9 +146,10 @@ static int omap_otg_probe(struct platform_device *pdev)
 static int omap_otg_remove(struct platform_device *pdev)
 {
 	struct otg_device *otg_dev = platform_get_drvdata(pdev);
+	struct extcon_dev *edev = otg_dev->extcon;
 
-	extcon_unregister_interest(&otg_dev->id_dev);
-	extcon_unregister_interest(&otg_dev->vbus_dev);
+	extcon_unregister_notifier(edev, EXTCON_USB_HOST,&otg_dev->id_nb);
+	extcon_unregister_notifier(edev, EXTCON_USB, &otg_dev->vbus_nb);
 
 	return 0;
 }
-- 
1.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/5] usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API
  2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 1/5] usb: dwc3: omap: " Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 2/5] usb: phy: omap-otg: " Chanwoo Choi
@ 2015-07-01  4:11 ` Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 4/5] usb: renesas_usbhs: Replace deprecated API of extcon Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 5/5] usb: phy: msm-usb: " Chanwoo Choi
  4 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb; +Cc: cw00.choi, myungjoo.ham

This patch uses the devm_extcon_dev_[allocate|register]() to manage the
resource automatically and replace deprecated API as following:
- extcon_[set|get]_cable_state(*edev, char *) -> extcon_[set|get]_cable_state_(*edev, id)

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/usb/phy/phy-tahvo.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b40d6a87d694..ab5d364f6e8c 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -57,7 +57,7 @@ struct tahvo_usb {
 	struct clk		*ick;
 	int			irq;
 	int			tahvo_mode;
-	struct extcon_dev	extcon;
+	struct extcon_dev	*extcon;
 };
 
 static const unsigned int tahvo_cable[] = {
@@ -121,7 +121,7 @@ static void check_vbus_state(struct tahvo_usb *tu)
 	prev_state = tu->vbus_state;
 	tu->vbus_state = reg & TAHVO_STAT_VBUS;
 	if (prev_state != tu->vbus_state) {
-		extcon_set_cable_state(&tu->extcon, "USB", tu->vbus_state);
+		extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
 		sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
 	}
 }
@@ -130,7 +130,7 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
 {
 	struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-	extcon_set_cable_state(&tu->extcon, "USB-HOST", true);
+	extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, true);
 
 	/* Power up the transceiver in USB host mode */
 	retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
@@ -149,7 +149,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
 {
 	struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-	extcon_set_cable_state(&tu->extcon, "USB-HOST", false);
+	extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, false);
 
 	/* Power up transceiver and set it in USB peripheral mode */
 	retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT |
@@ -365,11 +365,13 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 	 */
 	tu->vbus_state = retu_read(rdev, TAHVO_REG_IDSR) & TAHVO_STAT_VBUS;
 
-	tu->extcon.name = DRIVER_NAME;
-	tu->extcon.supported_cable = tahvo_cable;
-	tu->extcon.dev.parent = &pdev->dev;
+	tu->extcon = devm_extcon_dev_allocate(&pdev->dev, tahvo_cable);
+	if (IS_ERR(tu->extcon)) {
+		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
+		return -ENOMEM;
+	}
 
-	ret = extcon_dev_register(&tu->extcon);
+	ret = devm_extcon_dev_register(&pdev->dev, tu->extcon);
 	if (ret) {
 		dev_err(&pdev->dev, "could not register extcon device: %d\n",
 			ret);
@@ -377,9 +379,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 	}
 
 	/* Set the initial cable state. */
-	extcon_set_cable_state(&tu->extcon, "USB-HOST",
+	extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST,
 			       tu->tahvo_mode == TAHVO_MODE_HOST);
-	extcon_set_cable_state(&tu->extcon, "USB", tu->vbus_state);
+	extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
 
 	/* Create OTG interface */
 	tahvo_usb_power_off(tu);
@@ -396,7 +398,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
 	if (ret < 0) {
 		dev_err(&pdev->dev, "cannot register USB transceiver: %d\n",
 			ret);
-		goto err_extcon_unreg;
+		goto err_disable_clk;
 	}
 
 	dev_set_drvdata(&pdev->dev, tu);
@@ -424,8 +426,6 @@ err_free_irq:
 	free_irq(tu->irq, tu);
 err_remove_phy:
 	usb_remove_phy(&tu->phy);
-err_extcon_unreg:
-	extcon_dev_unregister(&tu->extcon);
 err_disable_clk:
 	if (!IS_ERR(tu->ick))
 		clk_disable(tu->ick);
@@ -440,7 +440,6 @@ static int tahvo_usb_remove(struct platform_device *pdev)
 	sysfs_remove_group(&pdev->dev.kobj, &tahvo_attr_group);
 	free_irq(tu->irq, tu);
 	usb_remove_phy(&tu->phy);
-	extcon_dev_unregister(&tu->extcon);
 	if (!IS_ERR(tu->ick))
 		clk_disable(tu->ick);
 
-- 
1.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/5] usb: renesas_usbhs: Replace deprecated API of extcon
  2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
                   ` (2 preceding siblings ...)
  2015-07-01  4:11 ` [PATCH 3/5] usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API Chanwoo Choi
@ 2015-07-01  4:11 ` Chanwoo Choi
  2015-07-01  4:11 ` [PATCH 5/5] usb: phy: msm-usb: " Chanwoo Choi
  4 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb
  Cc: cw00.choi, myungjoo.ham, Yoshihiro Shimoda, Sergei Shtylyov,
	Peter Chen, Varka Bhadram, Takeshi Kihara

This patch removes the deprecated API of extcon and then use the new extcon API
with the unique id to indicate the each external connector (USB-HOST).
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Varka Bhadram <varkab@cdac.in>
Cc: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/usb/renesas_usbhs/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index e8bf40808b39..7b98e1d9194c 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -388,7 +388,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
 
 	if (enable && !mod) {
 		if (priv->edev) {
-			cable = extcon_get_cable_state(priv->edev, "USB-HOST");
+			cable = extcon_get_cable_state_(priv->edev, EXTCON_USB_HOST);
 			if ((cable > 0 && id != USBHS_HOST) ||
 			    (!cable && id != USBHS_GADGET)) {
 				dev_info(&pdev->dev,
-- 
1.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/5] usb: phy: msm-usb: Replace deprecated API of extcon
  2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
                   ` (3 preceding siblings ...)
  2015-07-01  4:11 ` [PATCH 4/5] usb: renesas_usbhs: Replace deprecated API of extcon Chanwoo Choi
@ 2015-07-01  4:11 ` Chanwoo Choi
  4 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-01  4:11 UTC (permalink / raw)
  To: balbi, gregkh, linux-kernel, linux-usb; +Cc: cw00.choi, myungjoo.ham

This patch removes the deprecated notifier API of extcon framwork
and then use the new extcon API with the unique id to indicate
the each external connector (USB, USB-HOST).

Alter deprecated API as following:
- extcon_register_interest() -> extcon_register_notifier()
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/usb/phy/phy-msm-usb.c | 20 ++++++++++----------
 include/linux/usb/msm_hsusb.h |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 00c49bb1bd29..61d86d8bf5b7 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1561,15 +1561,16 @@ 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_interest(&motg->vbus.conn, ext_vbus->name,
-					       "USB", &motg->vbus.nb);
+		ret = extcon_register_notifier(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, "USB");
+		ret = extcon_get_cable_state_(ext_vbus, EXTCON_USB);
 		if (ret)
 			set_bit(B_SESS_VLD, &motg->inputs);
 		else
@@ -1577,15 +1578,16 @@ 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_interest(&motg->id.conn, ext_id->name,
-					       "USB-HOST", &motg->id.nb);
+		ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
+						&motg->id.nb);
 		if (ret < 0) {
 			dev_err(&pdev->dev, "register ID notifier failed\n");
 			return ret;
 		}
 
-		ret = extcon_get_cable_state(ext_id, "USB-HOST");
+		ret = extcon_get_cable_state_(ext_id, EXTCON_USB_HOST);
 		if (ret)
 			clear_bit(ID, &motg->inputs);
 		else
@@ -1805,10 +1807,8 @@ static int msm_otg_remove(struct platform_device *pdev)
 	if (phy->otg->host || phy->otg->gadget)
 		return -EBUSY;
 
-	if (motg->id.conn.edev)
-		extcon_unregister_interest(&motg->id.conn);
-	if (motg->vbus.conn.edev)
-		extcon_unregister_interest(&motg->vbus.conn);
+	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);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index e55a1504266e..5df2c8f59aa0 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -128,7 +128,7 @@ struct msm_otg_platform_data {
  */
 struct msm_usb_cable {
 	struct notifier_block		nb;
-	struct extcon_specific_cable_nb conn;
+	struct extcon_dev		*extcon;
 };
 
 /**
-- 
1.8.5.5


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] usb: dwc3: omap: Replace deprecated API of extcon
  2015-07-01  4:11 ` [PATCH 1/5] usb: dwc3: omap: " Chanwoo Choi
@ 2015-07-06 17:23   ` Felipe Balbi
  2015-07-10 15:53     ` Chanwoo Choi
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2015-07-06 17:23 UTC (permalink / raw)
  To: Chanwoo Choi; +Cc: balbi, gregkh, linux-kernel, linux-usb, myungjoo.ham

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

On Wed, Jul 01, 2015 at 01:11:30PM +0900, Chanwoo Choi wrote:
> This patch removes the deprecated notifier API of extcon framwork
> and then use the new extcon API with the unique id to indicate
> the each external connector (USB, USB-HOST).
> 
> Alter deprecated API as following:
> - extcon_register_interest() -> extcon_register_notifier()
> - extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)
> 
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

Are there any dependences for this commit or can I take it through my
tree for v4.3 ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] usb: dwc3: omap: Replace deprecated API of extcon
  2015-07-06 17:23   ` Felipe Balbi
@ 2015-07-10 15:53     ` Chanwoo Choi
  0 siblings, 0 replies; 8+ messages in thread
From: Chanwoo Choi @ 2015-07-10 15:53 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Greg KH, linux-kernel, linux-usb, myungjoo.ham

Hi Felipe,

On Mon, Jul 6, 2015 at 7:23 PM, Felipe Balbi <balbi@ti.com> wrote:
> On Wed, Jul 01, 2015 at 01:11:30PM +0900, Chanwoo Choi wrote:
>> This patch removes the deprecated notifier API of extcon framwork
>> and then use the new extcon API with the unique id to indicate
>> the each external connector (USB, USB-HOST).
>>
>> Alter deprecated API as following:
>> - extcon_register_interest() -> extcon_register_notifier()
>> - extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)
>>
>> Cc: Felipe Balbi <balbi@ti.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>
> Are there any dependences for this commit or can I take it through my
> tree for v4.3 ?

This patch-set is based on v4.2-rc1 without any dependency.
I agree about your opinion.

I'm sorry about delayed reply because I'm on vacation.

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-07-10 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01  4:11 [PATCH 0/5] usb: Replace deprecated API of extcon Chanwoo Choi
2015-07-01  4:11 ` [PATCH 1/5] usb: dwc3: omap: " Chanwoo Choi
2015-07-06 17:23   ` Felipe Balbi
2015-07-10 15:53     ` Chanwoo Choi
2015-07-01  4:11 ` [PATCH 2/5] usb: phy: omap-otg: " Chanwoo Choi
2015-07-01  4:11 ` [PATCH 3/5] usb: phy: tahvo: Use devm_extcon_dev_[allocate|register]() and replace deprecated API Chanwoo Choi
2015-07-01  4:11 ` [PATCH 4/5] usb: renesas_usbhs: Replace deprecated API of extcon Chanwoo Choi
2015-07-01  4:11 ` [PATCH 5/5] usb: phy: msm-usb: " Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®