Skip to content

Commit 249a32b

Browse files
liubiingregkh
authored andcommitted
usb: core: handle hub C_PORT_OVER_CURRENT condition
Based on USB2.0 Spec Section 11.12.5, "If a hub has per-port power switching and per-port current limiting, an over-current on one port may still cause the power on another port to fall below specific minimums. In this case, the affected port is placed in the Power-Off state and C_PORT_OVER_CURRENT is set for the port, but PORT_OVER_CURRENT is not set." so let's check C_PORT_OVER_CURRENT too for over current condition. Fixes: 08d1dec ("usb:hub set hub->change_bits when over-current happens") Cc: <[email protected]> Tested-by: Alessandro Antenucci <[email protected]> Signed-off-by: Bin Liu <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d89b766 commit 249a32b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/usb/core/hub.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,10 +1142,14 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
11421142

11431143
if (!udev || udev->state == USB_STATE_NOTATTACHED) {
11441144
/* Tell hub_wq to disconnect the device or
1145-
* check for a new connection
1145+
* check for a new connection or over current condition.
1146+
* Based on USB2.0 Spec Section 11.12.5,
1147+
* C_PORT_OVER_CURRENT could be set while
1148+
* PORT_OVER_CURRENT is not. So check for any of them.
11461149
*/
11471150
if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
1148-
(portstatus & USB_PORT_STAT_OVERCURRENT))
1151+
(portstatus & USB_PORT_STAT_OVERCURRENT) ||
1152+
(portchange & USB_PORT_STAT_C_OVERCURRENT))
11491153
set_bit(port1, hub->change_bits);
11501154

11511155
} else if (portstatus & USB_PORT_STAT_ENABLE) {

0 commit comments

Comments
 (0)