diff options
Diffstat (limited to 'drivers/usb/serial/garmin_gps.c')
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index f1c90cfe7251..d74e43d69230 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -1020,19 +1020,26 @@ static void garmin_close (struct usb_serial_port *port, struct file * filp) | |||
1020 | if (!serial) | 1020 | if (!serial) |
1021 | return; | 1021 | return; |
1022 | 1022 | ||
1023 | garmin_clear(garmin_data_p); | 1023 | mutex_lock(&port->serial->disc_mutex); |
1024 | if (!port->serial->disconnected) | ||
1025 | garmin_clear(garmin_data_p); | ||
1024 | 1026 | ||
1025 | /* shutdown our urbs */ | 1027 | /* shutdown our urbs */ |
1026 | usb_kill_urb (port->read_urb); | 1028 | usb_kill_urb (port->read_urb); |
1027 | usb_kill_urb (port->write_urb); | 1029 | usb_kill_urb (port->write_urb); |
1028 | 1030 | ||
1029 | if (noResponseFromAppLayer(garmin_data_p) || | 1031 | if (!port->serial->disconnected) { |
1030 | ((garmin_data_p->flags & CLEAR_HALT_REQUIRED) != 0)) { | 1032 | if (noResponseFromAppLayer(garmin_data_p) || |
1031 | process_resetdev_request(port); | 1033 | ((garmin_data_p->flags & CLEAR_HALT_REQUIRED) != 0)) { |
1032 | garmin_data_p->state = STATE_RESET; | 1034 | process_resetdev_request(port); |
1035 | garmin_data_p->state = STATE_RESET; | ||
1036 | } else { | ||
1037 | garmin_data_p->state = STATE_DISCONNECTED; | ||
1038 | } | ||
1033 | } else { | 1039 | } else { |
1034 | garmin_data_p->state = STATE_DISCONNECTED; | 1040 | garmin_data_p->state = STATE_DISCONNECTED; |
1035 | } | 1041 | } |
1042 | mutex_unlock(&port->serial->disc_mutex); | ||
1036 | } | 1043 | } |
1037 | 1044 | ||
1038 | 1045 | ||