diff options
author | Paul Bolle <pebolle@tiscali.nl> | 2011-03-11 12:03:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-11 17:18:52 -0500 |
commit | 752d57a8b7b97423bffa3452638aa0fd3c3bb9d1 (patch) | |
tree | e4589fb70401448c0f0393b2fdafe8f4d6923fd6 /drivers/usb/core/hub.c | |
parent | 0dfeefbc93e38c3a9bd6d4e579cc5a76d3f13dc2 (diff) |
USB: Only treat lasting over-current conditions as errors
On a laptop I see these errors on (most) resumes:
hub 3-0:1.0: over-current change on port 1
hub 3-0:1.0: over-current change on port 2
Since over-current conditions can disappear quite quickly it's better to
downgrade that message to debug level, recheck for an over-current
condition a little later and only print and over-current condition error
if that condition (still) exists when it's rechecked.
Add similar logic to hub over-current changes. (That code is untested,
as those changes do not occur on this laptop.)
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r-- | drivers/usb/core/hub.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 395754edd063..b574f9131b43 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -3408,12 +3408,19 @@ static void hub_events(void) | |||
3408 | } | 3408 | } |
3409 | 3409 | ||
3410 | if (portchange & USB_PORT_STAT_C_OVERCURRENT) { | 3410 | if (portchange & USB_PORT_STAT_C_OVERCURRENT) { |
3411 | dev_err (hub_dev, | 3411 | u16 status = 0; |
3412 | "over-current change on port %d\n", | 3412 | u16 unused; |
3413 | i); | 3413 | |
3414 | dev_dbg(hub_dev, "over-current change on port " | ||
3415 | "%d\n", i); | ||
3414 | clear_port_feature(hdev, i, | 3416 | clear_port_feature(hdev, i, |
3415 | USB_PORT_FEAT_C_OVER_CURRENT); | 3417 | USB_PORT_FEAT_C_OVER_CURRENT); |
3418 | msleep(100); /* Cool down */ | ||
3416 | hub_power_on(hub, true); | 3419 | hub_power_on(hub, true); |
3420 | hub_port_status(hub, i, &status, &unused); | ||
3421 | if (status & USB_PORT_STAT_OVERCURRENT) | ||
3422 | dev_err(hub_dev, "over-current " | ||
3423 | "condition on port %d\n", i); | ||
3417 | } | 3424 | } |
3418 | 3425 | ||
3419 | if (portchange & USB_PORT_STAT_C_RESET) { | 3426 | if (portchange & USB_PORT_STAT_C_RESET) { |
@@ -3445,10 +3452,17 @@ static void hub_events(void) | |||
3445 | hub->limited_power = 0; | 3452 | hub->limited_power = 0; |
3446 | } | 3453 | } |
3447 | if (hubchange & HUB_CHANGE_OVERCURRENT) { | 3454 | if (hubchange & HUB_CHANGE_OVERCURRENT) { |
3448 | dev_dbg (hub_dev, "overcurrent change\n"); | 3455 | u16 status = 0; |
3449 | msleep(500); /* Cool down */ | 3456 | u16 unused; |
3457 | |||
3458 | dev_dbg(hub_dev, "over-current change\n"); | ||
3450 | clear_hub_feature(hdev, C_HUB_OVER_CURRENT); | 3459 | clear_hub_feature(hdev, C_HUB_OVER_CURRENT); |
3460 | msleep(500); /* Cool down */ | ||
3451 | hub_power_on(hub, true); | 3461 | hub_power_on(hub, true); |
3462 | hub_hub_status(hub, &status, &unused); | ||
3463 | if (status & HUB_STATUS_OVERCURRENT) | ||
3464 | dev_err(hub_dev, "over-current " | ||
3465 | "condition\n"); | ||
3452 | } | 3466 | } |
3453 | } | 3467 | } |
3454 | 3468 | ||