]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
USB: serial: introduce a flag into the usb serial layer to tell drivers that their...
authorOliver Neukum <oliver@neukum.org>
Thu, 5 Feb 2009 15:54:25 +0000 (16:54 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Mar 2009 23:20:29 +0000 (16:20 -0700)
This patch introduces a flag into the usb serial layer to tell drivers
that their URBs are killed due to suspension. That is necessary to let
drivers know whether they should report an error back.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Hi Greg,

this is for 2.6.30. Patches to use this in drivers are under development.

Regards
Oliver

drivers/usb/serial/usb-serial.c
include/linux/usb/serial.h

index cfcfd5ab06ceb5838f6bdc274e78a30697714d1a..c6aaa6dc75644dff1fc832b9305deec01b83d24f 100644 (file)
@@ -1067,6 +1067,8 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
        struct usb_serial_port *port;
        int i, r = 0;
 
+       serial->suspending = 1;
+
        for (i = 0; i < serial->num_ports; ++i) {
                port = serial->port[i];
                if (port)
@@ -1084,8 +1086,10 @@ int usb_serial_resume(struct usb_interface *intf)
 {
        struct usb_serial *serial = usb_get_intfdata(intf);
 
+       serial->suspending = 0;
        if (serial->type->resume)
                return serial->type->resume(serial);
+
        return 0;
 }
 EXPORT_SYMBOL(usb_serial_resume);
index 0b8617a9176d3de30ed506cffca9a8aa544d59b0..b95842542590df07a4618af175cef8cdf6a6aa0d 100644 (file)
@@ -130,7 +130,8 @@ struct usb_serial {
        struct usb_device               *dev;
        struct usb_serial_driver        *type;
        struct usb_interface            *interface;
-       unsigned char                   disconnected;
+       unsigned char                   disconnected:1;
+       unsigned char                   suspending:1;
        unsigned char                   minor;
        unsigned char                   num_ports;
        unsigned char                   num_port_pointers;