Skip to content

Commit

Permalink
usb: phy: omap-otg: Replace deprecated API of extcon
Browse files Browse the repository at this point in the history
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)

[ balbi@ti.com : fix build break ]

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Chanwoo Choi authored and Felipe Balbi committed Jul 29, 2015
1 parent 5960387 commit a2fd242
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/usb/phy/phy-omap-otg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
otg_dev->extcon = extcon;

otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
if (!otg_dev)
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down

0 comments on commit a2fd242

Please sign in to comment.