Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242572
b: refs/heads/master
c: f722e17
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen committed Feb 22, 2011
1 parent 3022092 commit e044a52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6ccc442b12102414c1343f0adacaa8a1aaa516c
refs/heads/master: f722e17fdb2c97bbec2563636dd88489cdb1428b
2 changes: 1 addition & 1 deletion trunk/drivers/power/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
attr = &power_supply_attrs[psy->properties[j]];

ret = power_supply_show_property(dev, attr, prop_buf);
if (ret == -ENODEV) {
if (ret == -ENODEV || ret == -ENODATA) {
/* When a battery is absent, we expect -ENODEV. Don't abort;
send the uevent with at least the the PRESENT=0 property */
ret = 0;
Expand Down
25 changes: 6 additions & 19 deletions trunk/drivers/power/twl4030_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,8 @@ struct twl4030_bci {
struct power_supply usb;
struct otg_transceiver *transceiver;
struct notifier_block otg_nb;
struct work_struct work;
int irq_chg;
int irq_bci;

unsigned long event;
};

/*
Expand Down Expand Up @@ -261,11 +258,14 @@ static irqreturn_t twl4030_bci_interrupt(int irq, void *arg)
return IRQ_HANDLED;
}

static void twl4030_bci_usb_work(struct work_struct *data)
static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
void *priv)
{
struct twl4030_bci *bci = container_of(data, struct twl4030_bci, work);
struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);

switch (bci->event) {
dev_dbg(bci->dev, "OTG notify %lu\n", val);

switch (val) {
case USB_EVENT_VBUS:
case USB_EVENT_CHARGER:
twl4030_charger_enable_usb(bci, true);
Expand All @@ -274,17 +274,6 @@ static void twl4030_bci_usb_work(struct work_struct *data)
twl4030_charger_enable_usb(bci, false);
break;
}
}

static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
void *priv)
{
struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);

dev_dbg(bci->dev, "OTG notify %lu\n", val);

bci->event = val;
schedule_work(&bci->work);

return NOTIFY_OK;
}
Expand Down Expand Up @@ -477,8 +466,6 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
goto fail_bci_irq;
}

INIT_WORK(&bci->work, twl4030_bci_usb_work);

bci->transceiver = otg_get_transceiver();
if (bci->transceiver != NULL) {
bci->otg_nb.notifier_call = twl4030_bci_usb_ncb;
Expand Down

0 comments on commit e044a52

Please sign in to comment.