Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isicom: switch to ->[sg]et_serial()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro b60f38c6 a7b06fcf

+25 -47
+25 -47
drivers/tty/isicom.c
··· 1091 1091 } 1092 1092 1093 1093 static int isicom_set_serial_info(struct tty_struct *tty, 1094 - struct serial_struct __user *info) 1094 + struct serial_struct *ss) 1095 1095 { 1096 1096 struct isi_port *port = tty->driver_data; 1097 - struct serial_struct newinfo; 1098 1097 int reconfig_port; 1099 1098 1100 - if (copy_from_user(&newinfo, info, sizeof(newinfo))) 1101 - return -EFAULT; 1099 + if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) 1100 + return -ENODEV; 1102 1101 1103 1102 mutex_lock(&port->port.mutex); 1104 1103 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != 1105 - (newinfo.flags & ASYNC_SPD_MASK)); 1104 + (ss->flags & ASYNC_SPD_MASK)); 1106 1105 1107 1106 if (!capable(CAP_SYS_ADMIN)) { 1108 - if ((newinfo.close_delay != port->port.close_delay) || 1109 - (newinfo.closing_wait != port->port.closing_wait) || 1110 - ((newinfo.flags & ~ASYNC_USR_MASK) != 1107 + if ((ss->close_delay != port->port.close_delay) || 1108 + (ss->closing_wait != port->port.closing_wait) || 1109 + ((ss->flags & ~ASYNC_USR_MASK) != 1111 1110 (port->port.flags & ~ASYNC_USR_MASK))) { 1112 1111 mutex_unlock(&port->port.mutex); 1113 1112 return -EPERM; 1114 1113 } 1115 1114 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | 1116 - (newinfo.flags & ASYNC_USR_MASK)); 1115 + (ss->flags & ASYNC_USR_MASK)); 1117 1116 } else { 1118 - port->port.close_delay = newinfo.close_delay; 1119 - port->port.closing_wait = newinfo.closing_wait; 1117 + port->port.close_delay = ss->close_delay; 1118 + port->port.closing_wait = ss->closing_wait; 1120 1119 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | 1121 - (newinfo.flags & ASYNC_FLAGS)); 1120 + (ss->flags & ASYNC_FLAGS)); 1122 1121 } 1123 1122 if (reconfig_port) { 1124 1123 unsigned long flags; ··· 1129 1130 return 0; 1130 1131 } 1131 1132 1132 - static int isicom_get_serial_info(struct isi_port *port, 1133 - struct serial_struct __user *info) 1134 - { 1135 - struct serial_struct out_info; 1136 - 1137 - mutex_lock(&port->port.mutex); 1138 - memset(&out_info, 0, sizeof(out_info)); 1139 - /* out_info.type = ? */ 1140 - out_info.line = port - isi_ports; 1141 - out_info.port = port->card->base; 1142 - out_info.irq = port->card->irq; 1143 - out_info.flags = port->port.flags; 1144 - /* out_info.baud_base = ? */ 1145 - out_info.close_delay = port->port.close_delay; 1146 - out_info.closing_wait = port->port.closing_wait; 1147 - mutex_unlock(&port->port.mutex); 1148 - if (copy_to_user(info, &out_info, sizeof(out_info))) 1149 - return -EFAULT; 1150 - return 0; 1151 - } 1152 - 1153 - static int isicom_ioctl(struct tty_struct *tty, 1154 - unsigned int cmd, unsigned long arg) 1133 + static int isicom_get_serial_info(struct tty_struct *tty, 1134 + struct serial_struct *ss) 1155 1135 { 1156 1136 struct isi_port *port = tty->driver_data; 1157 - void __user *argp = (void __user *)arg; 1158 1137 1159 1138 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) 1160 1139 return -ENODEV; 1161 1140 1162 - switch (cmd) { 1163 - case TIOCGSERIAL: 1164 - return isicom_get_serial_info(port, argp); 1165 - 1166 - case TIOCSSERIAL: 1167 - return isicom_set_serial_info(tty, argp); 1168 - 1169 - default: 1170 - return -ENOIOCTLCMD; 1171 - } 1141 + mutex_lock(&port->port.mutex); 1142 + /* ss->type = ? */ 1143 + ss->line = port - isi_ports; 1144 + ss->port = port->card->base; 1145 + ss->irq = port->card->irq; 1146 + ss->flags = port->port.flags; 1147 + /* ss->baud_base = ? */ 1148 + ss->close_delay = port->port.close_delay; 1149 + ss->closing_wait = port->port.closing_wait; 1150 + mutex_unlock(&port->port.mutex); 1172 1151 return 0; 1173 1152 } 1174 1153 ··· 1250 1273 .flush_chars = isicom_flush_chars, 1251 1274 .write_room = isicom_write_room, 1252 1275 .chars_in_buffer = isicom_chars_in_buffer, 1253 - .ioctl = isicom_ioctl, 1254 1276 .set_termios = isicom_set_termios, 1255 1277 .throttle = isicom_throttle, 1256 1278 .unthrottle = isicom_unthrottle, ··· 1260 1284 .tiocmget = isicom_tiocmget, 1261 1285 .tiocmset = isicom_tiocmset, 1262 1286 .break_ctl = isicom_send_break, 1287 + .get_serial = isicom_get_serial_info, 1288 + .set_serial = isicom_set_serial_info, 1263 1289 }; 1264 1290 1265 1291 static const struct tty_port_operations isicom_port_ops = {