Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283428
b: refs/heads/master
c: 1c74529
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Anton Vorontsov committed Aug 23, 2011
1 parent f390eaf commit 26926e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf7a8c03db792894f436db5f3ffc44d947b9b068
refs/heads/master: 1c74529dbecf8839d3ed360690f937d68c14e55b
11 changes: 11 additions & 0 deletions trunk/drivers/power/pda_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ static struct timer_list supply_timer;
static struct timer_list polling_timer;
static int polling;

#ifdef CONFIG_USB_OTG_UTILS
static struct otg_transceiver *transceiver;
static struct notifier_block otg_nb;
#endif

static struct regulator *ac_draw;

enum {
Expand Down Expand Up @@ -317,13 +320,15 @@ static int pda_power_probe(struct platform_device *pdev)
ret = PTR_ERR(ac_draw);
}

#ifdef CONFIG_USB_OTG_UTILS
transceiver = otg_get_transceiver();
if (transceiver && !pdata->is_usb_online) {
pdata->is_usb_online = otg_is_usb_online;
}
if (transceiver && !pdata->is_ac_online) {
pdata->is_ac_online = otg_is_ac_online;
}
#endif

if (pdata->is_ac_online) {
ret = power_supply_register(&pdev->dev, &pda_psy_ac);
Expand Down Expand Up @@ -367,6 +372,7 @@ static int pda_power_probe(struct platform_device *pdev)
}
}

#ifdef CONFIG_USB_OTG_UTILS
if (transceiver && pdata->use_otg_notifier) {
otg_nb.notifier_call = otg_handle_notification;
ret = otg_register_notifier(transceiver, &otg_nb);
Expand All @@ -376,6 +382,7 @@ static int pda_power_probe(struct platform_device *pdev)
}
polling = 0;
}
#endif

if (polling) {
dev_dbg(dev, "will poll for status\n");
Expand All @@ -389,17 +396,21 @@ static int pda_power_probe(struct platform_device *pdev)

return 0;

#ifdef CONFIG_USB_OTG_UTILS
otg_reg_notifier_failed:
if (pdata->is_usb_online && usb_irq)
free_irq(usb_irq->start, &pda_psy_usb);
#endif
usb_irq_failed:
if (pdata->is_usb_online)
power_supply_unregister(&pda_psy_usb);
usb_supply_failed:
if (pdata->is_ac_online && ac_irq)
free_irq(ac_irq->start, &pda_psy_ac);
#ifdef CONFIG_USB_OTG_UTILS
if (transceiver)
otg_put_transceiver(transceiver);
#endif
ac_irq_failed:
if (pdata->is_ac_online)
power_supply_unregister(&pda_psy_ac);
Expand Down

0 comments on commit 26926e2

Please sign in to comment.