diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:53:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:40 -0400 |
commit | e52384426064bca0669a954736206adca7595d48 (patch) | |
tree | d635f52999075e82b97842250a026d17582bd249 /drivers/serial | |
parent | c0754c99a6bcfcba7e1d68b75e3f25cb367af0fa (diff) |
serial_core: Prepare for BKL push down
Instead of checking for the BKL in these methods, take it ourselves. That
avoids propogating it into the serial drivers and we can then fix them later
on.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/serial_core.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 977ce820ce30..f7263e104d81 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -914,14 +914,14 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state) | |||
914 | struct uart_state *state = tty->driver_data; | 914 | struct uart_state *state = tty->driver_data; |
915 | struct uart_port *port = state->port; | 915 | struct uart_port *port = state->port; |
916 | 916 | ||
917 | BUG_ON(!kernel_locked()); | 917 | lock_kernel(); |
918 | |||
919 | mutex_lock(&state->mutex); | 918 | mutex_lock(&state->mutex); |
920 | 919 | ||
921 | if (port->type != PORT_UNKNOWN) | 920 | if (port->type != PORT_UNKNOWN) |
922 | port->ops->break_ctl(port, break_state); | 921 | port->ops->break_ctl(port, break_state); |
923 | 922 | ||
924 | mutex_unlock(&state->mutex); | 923 | mutex_unlock(&state->mutex); |
924 | unlock_kernel(); | ||
925 | } | 925 | } |
926 | 926 | ||
927 | static int uart_do_autoconfig(struct uart_state *state) | 927 | static int uart_do_autoconfig(struct uart_state *state) |
@@ -1059,7 +1059,7 @@ static int uart_get_count(struct uart_state *state, | |||
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | /* | 1061 | /* |
1062 | * Called via sys_ioctl under the BKL. We can use spin_lock_irq() here. | 1062 | * Called via sys_ioctl. We can use spin_lock_irq() here. |
1063 | */ | 1063 | */ |
1064 | static int | 1064 | static int |
1065 | uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, | 1065 | uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, |
@@ -1069,8 +1069,8 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, | |||
1069 | void __user *uarg = (void __user *)arg; | 1069 | void __user *uarg = (void __user *)arg; |
1070 | int ret = -ENOIOCTLCMD; | 1070 | int ret = -ENOIOCTLCMD; |
1071 | 1071 | ||
1072 | BUG_ON(!kernel_locked()); | ||
1073 | 1072 | ||
1073 | lock_kernel(); | ||
1074 | /* | 1074 | /* |
1075 | * These ioctls don't rely on the hardware to be present. | 1075 | * These ioctls don't rely on the hardware to be present. |
1076 | */ | 1076 | */ |
@@ -1143,6 +1143,7 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, | |||
1143 | out_up: | 1143 | out_up: |
1144 | mutex_unlock(&state->mutex); | 1144 | mutex_unlock(&state->mutex); |
1145 | out: | 1145 | out: |
1146 | unlock_kernel(); | ||
1146 | return ret; | 1147 | return ret; |
1147 | } | 1148 | } |
1148 | 1149 | ||
@@ -1153,7 +1154,6 @@ static void uart_set_termios(struct tty_struct *tty, | |||
1153 | unsigned long flags; | 1154 | unsigned long flags; |
1154 | unsigned int cflag = tty->termios->c_cflag; | 1155 | unsigned int cflag = tty->termios->c_cflag; |
1155 | 1156 | ||
1156 | BUG_ON(!kernel_locked()); | ||
1157 | 1157 | ||
1158 | /* | 1158 | /* |
1159 | * These are the bits that are used to setup various | 1159 | * These are the bits that are used to setup various |
@@ -1165,9 +1165,11 @@ static void uart_set_termios(struct tty_struct *tty, | |||
1165 | if ((cflag ^ old_termios->c_cflag) == 0 && | 1165 | if ((cflag ^ old_termios->c_cflag) == 0 && |
1166 | tty->termios->c_ospeed == old_termios->c_ospeed && | 1166 | tty->termios->c_ospeed == old_termios->c_ospeed && |
1167 | tty->termios->c_ispeed == old_termios->c_ispeed && | 1167 | tty->termios->c_ispeed == old_termios->c_ispeed && |
1168 | RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) | 1168 | RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) { |
1169 | return; | 1169 | return; |
1170 | } | ||
1170 | 1171 | ||
1172 | lock_kernel(); | ||
1171 | uart_change_speed(state, old_termios); | 1173 | uart_change_speed(state, old_termios); |
1172 | 1174 | ||
1173 | /* Handle transition to B0 status */ | 1175 | /* Handle transition to B0 status */ |
@@ -1200,7 +1202,7 @@ static void uart_set_termios(struct tty_struct *tty, | |||
1200 | } | 1202 | } |
1201 | spin_unlock_irqrestore(&state->port->lock, flags); | 1203 | spin_unlock_irqrestore(&state->port->lock, flags); |
1202 | } | 1204 | } |
1203 | 1205 | unlock_kernel(); | |
1204 | #if 0 | 1206 | #if 0 |
1205 | /* | 1207 | /* |
1206 | * No need to wake up processes in open wait, since they | 1208 | * No need to wake up processes in open wait, since they |