public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb:hub set hub->change_bits when over-current happens
@ 2014-01-07  2:33 沈光
  2014-01-07  2:40 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: 沈光 @ 2014-01-07  2:33 UTC (permalink / raw)
  To: Sarah Sharp; +Cc: linux-usb, linux-kernel

set hub->change_bits when we plug in a device which causes
over-current condition, so that hub_events() will check it.

Signed-off-by: Shen Guang <shenguang10@gmail.com>
---
 drivers/usb/core/hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bd9dc35..98b5679 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1154,7 +1154,8 @@ static void hub_activate(struct usb_hub *hub,
enum hub_activation_type type)
                        /* Tell khubd to disconnect the device or
                         * check for a new connection
                         */
-                       if (udev || (portstatus & USB_PORT_STAT_CONNECTION))
+                       if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
+                               (portstatus & USB_PORT_STAT_OVERCURRENT))
                                set_bit(port1, hub->change_bits);

                } else if (portstatus & USB_PORT_STAT_ENABLE) {
--
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] usb:hub set hub->change_bits when over-current happens
@ 2014-01-08  6:45 Shen Guang
  2014-01-08 17:15 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Shen Guang @ 2014-01-08  6:45 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-kernel

When we are doing compliance test with xHCI, we found that if we
enable CONFIG_USB_SUSPEND and plug in a bad device which causes
over-current condition to the root port, software will not be noticed.
The reason is that current code don't set hub->change_bits in
hub_activate() when over-current happens, and then hub_events() will
not check the port status because it thinks nothing changed.
If CONFIG_USB_SUSPEND is disabled, the interrupt pipe of the hub will
report the change and set hub->event_bits, and then hub_events() will
check what events happened.In this case over-current can be detected.

Signed-off-by: Shen Guang <shenguang10@gmail.com>
---
 drivers/usb/core/hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bd9dc35..98b5679 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1154,7 +1154,8 @@ static void hub_activate(struct usb_hub *hub,
enum hub_activation_type type)
                        /* Tell khubd to disconnect the device or
                         * check for a new connection
                         */
-                       if (udev || (portstatus & USB_PORT_STAT_CONNECTION))
+                       if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
+                               (portstatus & USB_PORT_STAT_OVERCURRENT))
                                set_bit(port1, hub->change_bits);

                } else if (portstatus & USB_PORT_STAT_ENABLE) {
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-03-19 13:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07  2:33 [PATCH] usb:hub set hub->change_bits when over-current happens 沈光
2014-01-07  2:40 ` Greg KH
2014-01-07  3:35   ` 沈光
2014-01-07  3:53     ` Greg KH
2014-01-07  6:38       ` Shen Guang
2014-01-07 15:25         ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2014-01-08  6:45 Shen Guang
2014-01-08 17:15 ` Greg KH
2014-01-08 17:49   ` Alan Stern
2014-01-08 18:19     ` Sarah Sharp
2014-03-19 13:03       ` Yuvaraj Cd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox