usb: phy: msm-usb: Replace deprecated API of extcon
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 1 Jul 2015 04:11:34 +0000 (13:11 +0900)
committerFelipe Balbi <balbi@ti.com>
Wed, 29 Jul 2015 14:59:18 +0000 (09:59 -0500)
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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/phy/phy-msm-usb.c
include/linux/usb/msm_hsusb.h

index 00c49bb1bd29a8ac9a63d6f6a69aea6a71e837d8..61d86d8bf5b71825cc8ce2e2bd853172bc4dbef2 100644 (file)
@@ -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);
index e55a1504266ec0333853793fa17e947feac02efd..5df2c8f59aa0a1b1e9616936b3177af908b70610 100644 (file)
@@ -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;
 };
 
 /**