[PATCH 1/2] Add hub port switchable when checking port power

2015-01-18 Thread Chechun Kuo
In check_port_resume_type, we will check port power status to determine whether 
the status should change to -ENODEV.
If all ports power control of the hub are handled at once, the port power 
status may not represent the real case and cause resume fail.
At this patch, we add hub_is_port_power_switchable as well as checking the port 
power.

Signed-off-by: Chechun Kuo vichy@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 b649fef..a50b257 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2904,7 +2904,8 @@ static int check_port_resume_type(struct usb_device *udev,
}
/* Is the device still present? */
else if (status || port_is_suspended(hub, portstatus) ||
-   !port_is_power_on(hub, portstatus) ||
+   (hub_is_port_power_switchable(hub)
+!port_is_power_on(hub, portstatus)) ||
!(portstatus  USB_PORT_STAT_CONNECTION)) {
if (status = 0)
status = -ENODEV;
-- 
1.9.1

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


[PATCH 2/2] Add HCS_PPC when getting root hub status

2015-01-18 Thread Chechun Kuo
for some platform ehci controller, it is possible there is no port power 
control capability in the root hub.
And we add port power control determination when getting root hub port status.

Signed-off-by: Chechun Kuo vichy@gmail.com
---
 drivers/usb/host/ehci-hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 5728829..1923984 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -1118,7 +1118,7 @@ int ehci_hub_control(
status |= USB_PORT_STAT_OVERCURRENT;
if (temp  PORT_RESET)
status |= USB_PORT_STAT_RESET;
-   if (temp  PORT_POWER)
+   if (HCS_PPC(ehci-hcs_params)  (temp  PORT_POWER))
status |= USB_PORT_STAT_POWER;
if (test_bit(wIndex, ehci-port_c_suspend))
status |= USB_PORT_STAT_C_SUSPEND  16;
-- 
1.9.1

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


[PATCH 1/1] HID: usbhid: add usb_clear_halt determination for next hid_start_in

2014-08-22 Thread CheChun Kuo
HID IR device will not response to any command send from host when it 
is finishing paring and tring to reset itself.
During this period of time, usb_cleaer_halt will be fail and if hid_start_in 
soon again, we has the possibility trap in infinite loop.

Signed-off-by: CheChun Kuo vichy@gmail.com
---
 drivers/hid/usbhid/hid-core.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 79cf503..256b102 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -122,7 +122,8 @@ static void hid_reset(struct work_struct *work)
dev_dbg(usbhid-intf-dev, clear halt\n);
rc = usb_clear_halt(hid_to_usb_dev(hid), usbhid-urbin-pipe);
clear_bit(HID_CLEAR_HALT, usbhid-iofl);
-   hid_start_in(hid);
+   if (rc == 0)
+   hid_start_in(hid);
}
 
else if (test_bit(HID_RESET_PENDING, usbhid-iofl)) {
-- 
1.7.9.5

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