projects
/
profile
/
ivi
/
kernel-x86-ivi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ff8973d
)
USB: power availability check for berry_charge
author
Oliver Neukum
<oliver@neukum.org>
Fri, 1 Feb 2008 21:44:40 +0000
(22:44 +0100)
committer
Greg Kroah-Hartman
<gregkh@suse.de>
Wed, 7 Jan 2009 17:59:51 +0000
(09:59 -0800)
this introduces a sanity check into berry_charge to give up before
damage is done if we lack juice.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/berry_charge.c
patch
|
blob
|
history
diff --git
a/drivers/usb/misc/berry_charge.c
b/drivers/usb/misc/berry_charge.c
index
24e2dc3
..
c05a85b
100644
(file)
--- a/
drivers/usb/misc/berry_charge.c
+++ b/
drivers/usb/misc/berry_charge.c
@@
-123,6
+123,11
@@
static int berry_probe(struct usb_interface *intf,
{
struct usb_device *udev = interface_to_usbdev(intf);
+ if (udev->bus_mA < 500) {
+ dbg(&udev->dev, "Not enough power to charge available\n");
+ return -ENODEV;
+ }
+
dbg(&udev->dev, "Power is set to %dmA\n",
udev->actconfig->desc.bMaxPower * 2);