usb-serial: fix shutdown / device_unregister order
authorJim Radford <radford@blackbean.org>
Wed, 28 Feb 2007 16:14:13 +0000 (08:14 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 10 Mar 2007 03:52:24 +0000 (19:52 -0800)
Ensure that the ->port_remove() callbacks get called before the
->shutdown() callback which makeing the order symmetric with
->attach() being called before ->port_probe().

Signed-off-by: Jim Radford <radford@blackbean.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/usb-serial.c

index 6bf22a28adb823db701965aef720e74dfc6c54eb..7f93abdac99444044fc3593477fb5c85276a20ff 100644 (file)
@@ -135,11 +135,6 @@ static void destroy_serial(struct kref *kref)
 
        dbg("%s - %s", __FUNCTION__, serial->type->description);
 
-       serial->type->shutdown(serial);
-
-       /* return the minor range that this device had */
-       return_serial(serial);
-
        for (i = 0; i < serial->num_ports; ++i)
                serial->port[i]->open_count = 0;
 
@@ -150,6 +145,12 @@ static void destroy_serial(struct kref *kref)
                        serial->port[i] = NULL;
                }
 
+       if (serial->type->shutdown)
+               serial->type->shutdown(serial);
+
+       /* return the minor range that this device had */
+       return_serial(serial);
+
        /* If this is a "fake" port, we have to clean it up here, as it will
         * not get cleaned up in port_release() as it was never registered with
         * the driver core */