aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-02-20 15:47:56 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:38 -0400
commit2097890c43a8fe90763f31b0010fd6963f5512c8 (patch)
tree7daf617d0518639fb9b1e752c435ab8c9acf2173 /drivers/usb/serial
parent3d01f0fe6b66dd34511eaf35e06764b8997187bc (diff)
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: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/usb-serial.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 2138ba8aeb69..aea861e9173e 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -401,11 +401,13 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in
401 struct usb_serial_port *port = tty->driver_data; 401 struct usb_serial_port *port = tty->driver_data;
402 int retval = -ENODEV; 402 int retval = -ENODEV;
403 403
404 lock_kernel();
404 if (!port) 405 if (!port)
405 goto exit; 406 goto exit;
406 407
407 dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); 408 dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
408 409
410 /* Caution - port->open_count is BKL protected */
409 if (!port->open_count) { 411 if (!port->open_count) {
410 dbg ("%s - port not open", __FUNCTION__); 412 dbg ("%s - port not open", __FUNCTION__);
411 goto exit; 413 goto exit;
@@ -416,8 +418,8 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in
416 retval = port->serial->type->ioctl(port, file, cmd, arg); 418 retval = port->serial->type->ioctl(port, file, cmd, arg);
417 else 419 else
418 retval = -ENOIOCTLCMD; 420 retval = -ENOIOCTLCMD;
419
420exit: 421exit:
422 unlock_kernel();
421 return retval; 423 return retval;
422} 424}
423 425
@@ -446,19 +448,24 @@ static void serial_break (struct tty_struct *tty, int break_state)
446{ 448{
447 struct usb_serial_port *port = tty->driver_data; 449 struct usb_serial_port *port = tty->driver_data;
448 450
449 if (!port) 451 lock_kernel();
452 if (!port) {
453 unlock_kernel();
450 return; 454 return;
455 }
451 456
452 dbg("%s - port %d", __FUNCTION__, port->number); 457 dbg("%s - port %d", __FUNCTION__, port->number);
453 458
454 if (!port->open_count) { 459 if (!port->open_count) {
455 dbg("%s - port not open", __FUNCTION__); 460 dbg("%s - port not open", __FUNCTION__);
461 unlock_kernel();
456 return; 462 return;
457 } 463 }
458 464
459 /* pass on to the driver specific version of this function if it is available */ 465 /* pass on to the driver specific version of this function if it is available */
460 if (port->serial->type->break_ctl) 466 if (port->serial->type->break_ctl)
461 port->serial->type->break_ctl(port, break_state); 467 port->serial->type->break_ctl(port, break_state);
468 unlock_kernel();
462} 469}
463 470
464static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data) 471static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)