Commit 2097890c authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

USB: usb-serial: Prepare for BKL push down

Take the lock in usb-serial instead. As it relies on the BKL internally
we can't push it any deeper yet.
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3d01f0fe
...@@ -401,11 +401,13 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in ...@@ -401,11 +401,13 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
int retval = -ENODEV; int retval = -ENODEV;
lock_kernel();
if (!port) if (!port)
goto exit; goto exit;
dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
/* Caution - port->open_count is BKL protected */
if (!port->open_count) { if (!port->open_count) {
dbg ("%s - port not open", __FUNCTION__); dbg ("%s - port not open", __FUNCTION__);
goto exit; goto exit;
...@@ -416,8 +418,8 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in ...@@ -416,8 +418,8 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in
retval = port->serial->type->ioctl(port, file, cmd, arg); retval = port->serial->type->ioctl(port, file, cmd, arg);
else else
retval = -ENOIOCTLCMD; retval = -ENOIOCTLCMD;
exit: exit:
unlock_kernel();
return retval; return retval;
} }
...@@ -446,19 +448,24 @@ static void serial_break (struct tty_struct *tty, int break_state) ...@@ -446,19 +448,24 @@ static void serial_break (struct tty_struct *tty, int break_state)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
if (!port) lock_kernel();
if (!port) {
unlock_kernel();
return; return;
}
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if (!port->open_count) { if (!port->open_count) {
dbg("%s - port not open", __FUNCTION__); dbg("%s - port not open", __FUNCTION__);
unlock_kernel();
return; return;
} }
/* pass on to the driver specific version of this function if it is available */ /* pass on to the driver specific version of this function if it is available */
if (port->serial->type->break_ctl) if (port->serial->type->break_ctl)
port->serial->type->break_ctl(port, break_state); port->serial->type->break_ctl(port, break_state);
unlock_kernel();
} }
static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment