diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:53:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:39 -0400 |
commit | 1f8cabb7055b98300aa0798ee0f6513dfc130cc2 (patch) | |
tree | 79c4991f74a2f3865ab7a7cd23f52e809dc1e5fb /drivers | |
parent | 341339e7aff33e3aa73d6c49dbd5a79be0bbec04 (diff) |
synclink series: Prepare for BKL pushdown
As these are quite complex I've simply pushed the BKL down into the ioctl
handler not tried to do anything neater.
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/synclink.c | 6 | ||||
-rw-r--r-- | drivers/char/synclink_gt.c | 58 | ||||
-rw-r--r-- | drivers/char/synclinkmp.c | 12 |
3 files changed, 55 insertions, 21 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index fadab1d9510f..1c9c440f59ce 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -2942,6 +2942,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file, | |||
2942 | unsigned int cmd, unsigned long arg) | 2942 | unsigned int cmd, unsigned long arg) |
2943 | { | 2943 | { |
2944 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; | 2944 | struct mgsl_struct * info = (struct mgsl_struct *)tty->driver_data; |
2945 | int ret; | ||
2945 | 2946 | ||
2946 | if (debug_level >= DEBUG_LEVEL_INFO) | 2947 | if (debug_level >= DEBUG_LEVEL_INFO) |
2947 | printk("%s(%d):mgsl_ioctl %s cmd=%08X\n", __FILE__,__LINE__, | 2948 | printk("%s(%d):mgsl_ioctl %s cmd=%08X\n", __FILE__,__LINE__, |
@@ -2956,7 +2957,10 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file, | |||
2956 | return -EIO; | 2957 | return -EIO; |
2957 | } | 2958 | } |
2958 | 2959 | ||
2959 | return mgsl_ioctl_common(info, cmd, arg); | 2960 | lock_kernel(); |
2961 | ret = mgsl_ioctl_common(info, cmd, arg); | ||
2962 | unlock_kernel(); | ||
2963 | return ret; | ||
2960 | } | 2964 | } |
2961 | 2965 | ||
2962 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg) | 2966 | static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg) |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index f3d8d72e5ea4..6473ae023466 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1097,6 +1097,7 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1097 | struct serial_icounter_struct __user *p_cuser; /* user space */ | 1097 | struct serial_icounter_struct __user *p_cuser; /* user space */ |
1098 | unsigned long flags; | 1098 | unsigned long flags; |
1099 | void __user *argp = (void __user *)arg; | 1099 | void __user *argp = (void __user *)arg; |
1100 | int ret; | ||
1100 | 1101 | ||
1101 | if (sanity_check(info, tty->name, "ioctl")) | 1102 | if (sanity_check(info, tty->name, "ioctl")) |
1102 | return -ENODEV; | 1103 | return -ENODEV; |
@@ -1108,37 +1109,54 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1108 | return -EIO; | 1109 | return -EIO; |
1109 | } | 1110 | } |
1110 | 1111 | ||
1112 | lock_kernel(); | ||
1113 | |||
1111 | switch (cmd) { | 1114 | switch (cmd) { |
1112 | case MGSL_IOCGPARAMS: | 1115 | case MGSL_IOCGPARAMS: |
1113 | return get_params(info, argp); | 1116 | ret = get_params(info, argp); |
1117 | break; | ||
1114 | case MGSL_IOCSPARAMS: | 1118 | case MGSL_IOCSPARAMS: |
1115 | return set_params(info, argp); | 1119 | ret = set_params(info, argp); |
1120 | break; | ||
1116 | case MGSL_IOCGTXIDLE: | 1121 | case MGSL_IOCGTXIDLE: |
1117 | return get_txidle(info, argp); | 1122 | ret = get_txidle(info, argp); |
1123 | break; | ||
1118 | case MGSL_IOCSTXIDLE: | 1124 | case MGSL_IOCSTXIDLE: |
1119 | return set_txidle(info, (int)arg); | 1125 | ret = set_txidle(info, (int)arg); |
1126 | break; | ||
1120 | case MGSL_IOCTXENABLE: | 1127 | case MGSL_IOCTXENABLE: |
1121 | return tx_enable(info, (int)arg); | 1128 | ret = tx_enable(info, (int)arg); |
1129 | break; | ||
1122 | case MGSL_IOCRXENABLE: | 1130 | case MGSL_IOCRXENABLE: |
1123 | return rx_enable(info, (int)arg); | 1131 | ret = rx_enable(info, (int)arg); |
1132 | break; | ||
1124 | case MGSL_IOCTXABORT: | 1133 | case MGSL_IOCTXABORT: |
1125 | return tx_abort(info); | 1134 | ret = tx_abort(info); |
1135 | break; | ||
1126 | case MGSL_IOCGSTATS: | 1136 | case MGSL_IOCGSTATS: |
1127 | return get_stats(info, argp); | 1137 | ret = get_stats(info, argp); |
1138 | break; | ||
1128 | case MGSL_IOCWAITEVENT: | 1139 | case MGSL_IOCWAITEVENT: |
1129 | return wait_mgsl_event(info, argp); | 1140 | ret = wait_mgsl_event(info, argp); |
1141 | break; | ||
1130 | case TIOCMIWAIT: | 1142 | case TIOCMIWAIT: |
1131 | return modem_input_wait(info,(int)arg); | 1143 | ret = modem_input_wait(info,(int)arg); |
1144 | break; | ||
1132 | case MGSL_IOCGIF: | 1145 | case MGSL_IOCGIF: |
1133 | return get_interface(info, argp); | 1146 | ret = get_interface(info, argp); |
1147 | break; | ||
1134 | case MGSL_IOCSIF: | 1148 | case MGSL_IOCSIF: |
1135 | return set_interface(info,(int)arg); | 1149 | ret = set_interface(info,(int)arg); |
1150 | break; | ||
1136 | case MGSL_IOCSGPIO: | 1151 | case MGSL_IOCSGPIO: |
1137 | return set_gpio(info, argp); | 1152 | ret = set_gpio(info, argp); |
1153 | break; | ||
1138 | case MGSL_IOCGGPIO: | 1154 | case MGSL_IOCGGPIO: |
1139 | return get_gpio(info, argp); | 1155 | ret = get_gpio(info, argp); |
1156 | break; | ||
1140 | case MGSL_IOCWAITGPIO: | 1157 | case MGSL_IOCWAITGPIO: |
1141 | return wait_gpio(info, argp); | 1158 | ret = wait_gpio(info, argp); |
1159 | break; | ||
1142 | case TIOCGICOUNT: | 1160 | case TIOCGICOUNT: |
1143 | spin_lock_irqsave(&info->lock,flags); | 1161 | spin_lock_irqsave(&info->lock,flags); |
1144 | cnow = info->icount; | 1162 | cnow = info->icount; |
@@ -1155,12 +1173,14 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1155 | put_user(cnow.parity, &p_cuser->parity) || | 1173 | put_user(cnow.parity, &p_cuser->parity) || |
1156 | put_user(cnow.brk, &p_cuser->brk) || | 1174 | put_user(cnow.brk, &p_cuser->brk) || |
1157 | put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) | 1175 | put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) |
1158 | return -EFAULT; | 1176 | ret = -EFAULT; |
1159 | return 0; | 1177 | ret = 0; |
1178 | break; | ||
1160 | default: | 1179 | default: |
1161 | return -ENOIOCTLCMD; | 1180 | ret = -ENOIOCTLCMD; |
1162 | } | 1181 | } |
1163 | return 0; | 1182 | unlock_kernel(); |
1183 | return ret; | ||
1164 | } | 1184 | } |
1165 | 1185 | ||
1166 | /* | 1186 | /* |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index e98c3e6f8216..b716a73a236f 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -1303,7 +1303,7 @@ static void tx_release(struct tty_struct *tty) | |||
1303 | * | 1303 | * |
1304 | * Return Value: 0 if success, otherwise error code | 1304 | * Return Value: 0 if success, otherwise error code |
1305 | */ | 1305 | */ |
1306 | static int ioctl(struct tty_struct *tty, struct file *file, | 1306 | static int do_ioctl(struct tty_struct *tty, struct file *file, |
1307 | unsigned int cmd, unsigned long arg) | 1307 | unsigned int cmd, unsigned long arg) |
1308 | { | 1308 | { |
1309 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; | 1309 | SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; |
@@ -1393,6 +1393,16 @@ static int ioctl(struct tty_struct *tty, struct file *file, | |||
1393 | return 0; | 1393 | return 0; |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | static int ioctl(struct tty_struct *tty, struct file *file, | ||
1397 | unsigned int cmd, unsigned long arg) | ||
1398 | { | ||
1399 | int ret; | ||
1400 | lock_kernel(); | ||
1401 | ret = do_ioctl(tty, file, cmd, arg); | ||
1402 | unlock_kernel(); | ||
1403 | return ret; | ||
1404 | } | ||
1405 | |||
1396 | /* | 1406 | /* |
1397 | * /proc fs routines.... | 1407 | * /proc fs routines.... |
1398 | */ | 1408 | */ |