diff options
author | Alan Cox <alan@redhat.com> | 2009-01-02 08:48:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 13:19:42 -0500 |
commit | 6b447f04a9aecdf2a30c1a97e4b034ac7931bb70 (patch) | |
tree | 61a92b936c0c8e42ebf93e01acbc15aceb9bd864 /drivers/usb | |
parent | eeb4613436f0f19a38f667ea3078821040559c68 (diff) |
tty: Drop the lock_kernel in the private ioctl hook
We don't need the BKL here any more so it can go. In a couple of spots the
driver requirements are not clear so push the lock down into the driver.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 9 | ||||
-rw-r--r-- | drivers/usb/serial/kl5kusb105.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/mct_u232.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/mos7840.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 7 |
5 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index fb6f2933b01b..ef6cfa5a447f 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1054,6 +1054,8 @@ static int set_serial_info(struct tty_struct *tty, | |||
1054 | 1054 | ||
1055 | if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) | 1055 | if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) |
1056 | return -EFAULT; | 1056 | return -EFAULT; |
1057 | |||
1058 | lock_kernel(); | ||
1057 | old_priv = *priv; | 1059 | old_priv = *priv; |
1058 | 1060 | ||
1059 | /* Do error checking and permission checking */ | 1061 | /* Do error checking and permission checking */ |
@@ -1069,8 +1071,10 @@ static int set_serial_info(struct tty_struct *tty, | |||
1069 | } | 1071 | } |
1070 | 1072 | ||
1071 | if ((new_serial.baud_base != priv->baud_base) && | 1073 | if ((new_serial.baud_base != priv->baud_base) && |
1072 | (new_serial.baud_base < 9600)) | 1074 | (new_serial.baud_base < 9600)) { |
1075 | unlock_kernel(); | ||
1073 | return -EINVAL; | 1076 | return -EINVAL; |
1077 | } | ||
1074 | 1078 | ||
1075 | /* Make the changes - these are privileged changes! */ | 1079 | /* Make the changes - these are privileged changes! */ |
1076 | 1080 | ||
@@ -1098,8 +1102,11 @@ check_and_exit: | |||
1098 | (priv->flags & ASYNC_SPD_MASK)) || | 1102 | (priv->flags & ASYNC_SPD_MASK)) || |
1099 | (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && | 1103 | (((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) && |
1100 | (old_priv.custom_divisor != priv->custom_divisor))) { | 1104 | (old_priv.custom_divisor != priv->custom_divisor))) { |
1105 | unlock_kernel(); | ||
1101 | change_speed(tty, port); | 1106 | change_speed(tty, port); |
1102 | } | 1107 | } |
1108 | else | ||
1109 | unlock_kernel(); | ||
1103 | return 0; | 1110 | return 0; |
1104 | 1111 | ||
1105 | } /* set_serial_info */ | 1112 | } /* set_serial_info */ |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index dc36a052766f..fcd9082f3e7f 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -878,6 +878,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state) | |||
878 | 878 | ||
879 | dbg("%sstate=%d", __func__, break_state); | 879 | dbg("%sstate=%d", __func__, break_state); |
880 | 880 | ||
881 | /* LOCKING */ | ||
881 | if (break_state) | 882 | if (break_state) |
882 | lcr |= MCT_U232_SET_BREAK; | 883 | lcr |= MCT_U232_SET_BREAK; |
883 | 884 | ||
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 07710cf31d0d..82930a7d5093 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -721,10 +721,10 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state) | |||
721 | 721 | ||
722 | spin_lock_irqsave(&priv->lock, flags); | 722 | spin_lock_irqsave(&priv->lock, flags); |
723 | lcr = priv->last_lcr; | 723 | lcr = priv->last_lcr; |
724 | spin_unlock_irqrestore(&priv->lock, flags); | ||
725 | 724 | ||
726 | if (break_state) | 725 | if (break_state) |
727 | lcr |= MCT_U232_SET_BREAK; | 726 | lcr |= MCT_U232_SET_BREAK; |
727 | spin_unlock_irqrestore(&priv->lock, flags); | ||
728 | 728 | ||
729 | mct_u232_set_line_ctrl(serial, lcr); | 729 | mct_u232_set_line_ctrl(serial, lcr); |
730 | } /* mct_u232_break_ctl */ | 730 | } /* mct_u232_break_ctl */ |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index fda4a6421c44..96a8c7713212 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1343,6 +1343,7 @@ static void mos7840_break(struct tty_struct *tty, int break_state) | |||
1343 | else | 1343 | else |
1344 | data = mos7840_port->shadowLCR & ~LCR_SET_BREAK; | 1344 | data = mos7840_port->shadowLCR & ~LCR_SET_BREAK; |
1345 | 1345 | ||
1346 | /* FIXME: no locking on shadowLCR anywhere in driver */ | ||
1346 | mos7840_port->shadowLCR = data; | 1347 | mos7840_port->shadowLCR = data; |
1347 | dbg("mcs7840_break mos7840_port->shadowLCR is %x\n", | 1348 | dbg("mcs7840_break mos7840_port->shadowLCR is %x\n", |
1348 | mos7840_port->shadowLCR); | 1349 | mos7840_port->shadowLCR); |
@@ -2214,10 +2215,12 @@ static int mos7840_set_modem_info(struct moschip_port *mos7840_port, | |||
2214 | break; | 2215 | break; |
2215 | } | 2216 | } |
2216 | 2217 | ||
2218 | lock_kernel(); | ||
2217 | mos7840_port->shadowMCR = mcr; | 2219 | mos7840_port->shadowMCR = mcr; |
2218 | 2220 | ||
2219 | Data = mos7840_port->shadowMCR; | 2221 | Data = mos7840_port->shadowMCR; |
2220 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); | 2222 | status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, Data); |
2223 | unlock_kernel(); | ||
2221 | if (status < 0) { | 2224 | if (status < 0) { |
2222 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); | 2225 | dbg("setting MODEM_CONTROL_REGISTER Failed\n"); |
2223 | return -1; | 2226 | return -1; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 8d5189096470..080ade223d53 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -382,9 +382,7 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file, | |||
382 | /* pass on to the driver specific version of this function | 382 | /* pass on to the driver specific version of this function |
383 | if it is available */ | 383 | if it is available */ |
384 | if (port->serial->type->ioctl) { | 384 | if (port->serial->type->ioctl) { |
385 | lock_kernel(); | ||
386 | retval = port->serial->type->ioctl(tty, file, cmd, arg); | 385 | retval = port->serial->type->ioctl(tty, file, cmd, arg); |
387 | unlock_kernel(); | ||
388 | } else | 386 | } else |
389 | retval = -ENOIOCTLCMD; | 387 | retval = -ENOIOCTLCMD; |
390 | return retval; | 388 | return retval; |
@@ -413,11 +411,8 @@ static int serial_break(struct tty_struct *tty, int break_state) | |||
413 | WARN_ON(!port->port.count); | 411 | WARN_ON(!port->port.count); |
414 | /* pass on to the driver specific version of this function | 412 | /* pass on to the driver specific version of this function |
415 | if it is available */ | 413 | if it is available */ |
416 | if (port->serial->type->break_ctl) { | 414 | if (port->serial->type->break_ctl) |
417 | lock_kernel(); | ||
418 | port->serial->type->break_ctl(tty, break_state); | 415 | port->serial->type->break_ctl(tty, break_state); |
419 | unlock_kernel(); | ||
420 | } | ||
421 | return 0; | 416 | return 0; |
422 | } | 417 | } |
423 | 418 | ||