aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/console.c3
-rw-r--r--drivers/usb/serial/usb-serial.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 72ab3bbf0f2e..04007c31d88d 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -192,8 +192,9 @@ static int usb_console_setup(struct console *co, char *options)
192 kfree (termios); 192 kfree (termios);
193 kfree (tty); 193 kfree (tty);
194 } 194 }
195 port->console = 1;
195 196
196 return retval; 197 return 0;
197} 198}
198 199
199static void usb_console_write(struct console *co, const char *buf, unsigned count) 200static void usb_console_write(struct console *co, const char *buf, unsigned count)
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 497e29a700ca..5c33e2471be8 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -264,19 +264,21 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
264 } 264 }
265 265
266 --port->open_count; 266 --port->open_count;
267 if (port->open_count == 0) { 267 if (port->open_count == 0)
268 /* only call the device specific close if this 268 /* only call the device specific close if this
269 * port is being closed by the last owner */ 269 * port is being closed by the last owner */
270 port->serial->type->close(port, filp); 270 port->serial->type->close(port, filp);
271 271
272 if (port->open_count == (port->console? 1 : 0)) {
272 if (port->tty) { 273 if (port->tty) {
273 if (port->tty->driver_data) 274 if (port->tty->driver_data)
274 port->tty->driver_data = NULL; 275 port->tty->driver_data = NULL;
275 port->tty = NULL; 276 port->tty = NULL;
276 } 277 }
278 }
277 279
280 if (port->open_count == 0)
278 module_put(port->serial->type->driver.owner); 281 module_put(port->serial->type->driver.owner);
279 }
280 282
281 mutex_unlock(&port->mutex); 283 mutex_unlock(&port->mutex);
282 usb_serial_put(port->serial); 284 usb_serial_put(port->serial);