Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163877
b: refs/heads/master
c: 7bd032d
h: refs/heads/master
i:
  163875: 78bd271
v: v3
  • Loading branch information
Alan Stern authored and Live-CD User committed Sep 19, 2009
1 parent 70e5193 commit 54648ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 320348c8d5c9b591282633ddb8959b42f7fc7a1c
refs/heads/master: 7bd032dc2793afcbaf4a350056768da84cdbd89b
28 changes: 19 additions & 9 deletions trunk/drivers/usb/serial/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/serial.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>

Expand Down Expand Up @@ -63,7 +64,7 @@ static int usb_console_setup(struct console *co, char *options)
char *s;
struct usb_serial *serial;
struct usb_serial_port *port;
int retval = 0;
int retval;
struct tty_struct *tty = NULL;
struct ktermios *termios = NULL, dummy;

Expand Down Expand Up @@ -116,13 +117,17 @@ static int usb_console_setup(struct console *co, char *options)
return -ENODEV;
}

port = serial->port[0];
retval = usb_autopm_get_interface(serial->interface);
if (retval)
goto error_get_interface;

port = serial->port[co->index - serial->minor];
tty_port_tty_set(&port->port, NULL);

info->port = port;

++port->port.count;
if (port->port.count == 1) {
if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) {
if (serial->type->set_termios) {
/*
* allocate a fake tty so the driver can initialize
Expand Down Expand Up @@ -168,25 +173,30 @@ static int usb_console_setup(struct console *co, char *options)
kfree(termios);
kfree(tty);
}
set_bit(ASYNCB_INITIALIZED, &port->port.flags);
}
/* Now that any required fake tty operations are completed restore
* the tty port count */
--port->port.count;
/* The console is special in terms of closing the device so
* indicate this port is now acting as a system console. */
port->console = 1;
retval = 0;

out:
mutex_unlock(&serial->disc_mutex);
return retval;
free_termios:

free_termios:
kfree(termios);
tty_port_tty_set(&port->port, NULL);
free_tty:
free_tty:
kfree(tty);
reset_open_count:
reset_open_count:
port->port.count = 0;
goto out;
usb_autopm_put_interface(serial->interface);
error_get_interface:
usb_serial_put(serial);
mutex_unlock(&serial->disc_mutex);
return retval;
}

static void usb_console_write(struct console *co,
Expand Down

0 comments on commit 54648ad

Please sign in to comment.