Thread (11 messages) 11 messages, 5 authors, 2013-03-15

Re: [PATCH v2 2/7] USB: serial: handle suspend failure path correctly

From: Ming Lei <hidden>
Date: 2013-03-15 03:04:16
Also in: netdev

On Thu, Mar 14, 2013 at 7:10 PM, Johan Hovold [off-list ref] wrote:
On Fri, Mar 08, 2013 at 12:15:19AM +0800, Ming Lei wrote:
quoted
This patch kills traffic even though type->suspend returns
failure inside usb_serial_suspend from system sleep context
because USB core ignores the failiure and lets system sleep
go ahread, so the serial URB traffic need to be killed
in this case.

Cc: Johan Hovold <redacted>
Signed-off-by: Ming Lei <redacted>
---
 drivers/usb/serial/usb-serial.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index a19ed74..9d0b9c8 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1142,10 +1142,11 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)

      if (serial->type->suspend) {
              r = serial->type->suspend(serial, message);
-             if (r < 0) {
+             if (r < 0 && PMSG_IS_AUTO(message)) {
                      serial->suspending = 0;
                      goto err_out;
              }
+             /* TODO: resume() might need to handle suspend failure */
      }

      for (i = 0; i < serial->num_ports; ++i) {
Sorry for the late reply.

The usb-serial subdriver suspend callbacks do not and must not return
non-zero if !PMSG_IS_AUTO(message) so adding code to handle that case
merely obfuscates this fact.

I'd rather see this documented with a comment just as Bjørn suggested
for cdc_mbim and qmi_wwan.
No problem, will do it in v3.

Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help