diff options
Diffstat (limited to 'drivers/char/synclink_gt.c')
-rw-r--r-- | drivers/char/synclink_gt.c | 58 |
1 files changed, 39 insertions, 19 deletions
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 | /* |