[patch]wrong order of events in usb serial suspension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a subdriver vetos a suspension we already have killed all URBs,
which we cannot undo in the generic layer because we don't know what
damage we have done.

Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>

Hi Greg,

this affects only the autosuspend support for the option driver,
so it needs to go only into the development tree.

	Regards
		Oliver

--

commit bb521ef5aafd9745e3a04970e90f4db7cbc20416
Author: Oliver Neukum <oliver@xxxxxxxxxx>
Date:   Mon Jul 20 23:15:51 2009 +0200

    usb: fix order of calls in usb serial suspend
    
    if a subdriver has an additional suspend method, it must be called
    first to allow the subdriver to return -EBUSY, because the second
    half cannot be easily undone.

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index c6f69c0..b739516 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1180,15 +1180,19 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
 
 	serial->suspending = 1;
 
+	if (serial->type->suspend) {
+		r = serial->type->suspend(serial, message);
+		if (r < 0)
+			goto err_out;
+	}
+
 	for (i = 0; i < serial->num_ports; ++i) {
 		port = serial->port[i];
 		if (port)
 			kill_traffic(port);
 	}
 
-	if (serial->type->suspend)
-		r = serial->type->suspend(serial, message);
-
+err_out:
 	return r;
 }
 EXPORT_SYMBOL(usb_serial_suspend);


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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux