From radford@blackbean.org Wed Feb 28 08:14:28 2007 From: Jim Radford Date: Wed, 28 Feb 2007 08:14:13 -0800 Subject: usb-serial: fix shutdown / device_unregister order To: Greg KH Cc: linux-usb-devel@lists.sourceforge.net Message-ID: <20070228161413.GA1110@blackbean.org> Content-Disposition: inline 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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- gregkh-2.6.orig/drivers/usb/serial/usb-serial.c +++ gregkh-2.6/drivers/usb/serial/usb-serial.c @@ -135,11 +135,6 @@ static void destroy_serial(struct 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 * 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 */