| .. | .. |
|---|
| 553 | 553 | |
|---|
| 554 | 554 | tty = tty_port_tty_get(&port->port); |
|---|
| 555 | 555 | if (tty == NULL) { |
|---|
| 556 | | - word_count = byte_count >> 1; |
|---|
| 557 | 556 | while (byte_count > 1) { |
|---|
| 558 | 557 | inw(base); |
|---|
| 559 | 558 | byte_count -= 2; |
|---|
| .. | .. |
|---|
| 1091 | 1090 | } |
|---|
| 1092 | 1091 | |
|---|
| 1093 | 1092 | static int isicom_set_serial_info(struct tty_struct *tty, |
|---|
| 1094 | | - struct serial_struct __user *info) |
|---|
| 1093 | + struct serial_struct *ss) |
|---|
| 1095 | 1094 | { |
|---|
| 1096 | 1095 | struct isi_port *port = tty->driver_data; |
|---|
| 1097 | | - struct serial_struct newinfo; |
|---|
| 1098 | 1096 | int reconfig_port; |
|---|
| 1099 | 1097 | |
|---|
| 1100 | | - if (copy_from_user(&newinfo, info, sizeof(newinfo))) |
|---|
| 1101 | | - return -EFAULT; |
|---|
| 1098 | + if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) |
|---|
| 1099 | + return -ENODEV; |
|---|
| 1102 | 1100 | |
|---|
| 1103 | 1101 | mutex_lock(&port->port.mutex); |
|---|
| 1104 | 1102 | reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != |
|---|
| 1105 | | - (newinfo.flags & ASYNC_SPD_MASK)); |
|---|
| 1103 | + (ss->flags & ASYNC_SPD_MASK)); |
|---|
| 1106 | 1104 | |
|---|
| 1107 | 1105 | 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) != |
|---|
| 1106 | + if ((ss->close_delay != port->port.close_delay) || |
|---|
| 1107 | + (ss->closing_wait != port->port.closing_wait) || |
|---|
| 1108 | + ((ss->flags & ~ASYNC_USR_MASK) != |
|---|
| 1111 | 1109 | (port->port.flags & ~ASYNC_USR_MASK))) { |
|---|
| 1112 | 1110 | mutex_unlock(&port->port.mutex); |
|---|
| 1113 | 1111 | return -EPERM; |
|---|
| 1114 | 1112 | } |
|---|
| 1115 | 1113 | port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | |
|---|
| 1116 | | - (newinfo.flags & ASYNC_USR_MASK)); |
|---|
| 1114 | + (ss->flags & ASYNC_USR_MASK)); |
|---|
| 1117 | 1115 | } else { |
|---|
| 1118 | | - port->port.close_delay = newinfo.close_delay; |
|---|
| 1119 | | - port->port.closing_wait = newinfo.closing_wait; |
|---|
| 1116 | + port->port.close_delay = ss->close_delay; |
|---|
| 1117 | + port->port.closing_wait = ss->closing_wait; |
|---|
| 1120 | 1118 | port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) | |
|---|
| 1121 | | - (newinfo.flags & ASYNC_FLAGS)); |
|---|
| 1119 | + (ss->flags & ASYNC_FLAGS)); |
|---|
| 1122 | 1120 | } |
|---|
| 1123 | 1121 | if (reconfig_port) { |
|---|
| 1124 | 1122 | unsigned long flags; |
|---|
| .. | .. |
|---|
| 1130 | 1128 | return 0; |
|---|
| 1131 | 1129 | } |
|---|
| 1132 | 1130 | |
|---|
| 1133 | | -static int isicom_get_serial_info(struct isi_port *port, |
|---|
| 1134 | | - struct serial_struct __user *info) |
|---|
| 1135 | | -{ |
|---|
| 1136 | | - struct serial_struct out_info; |
|---|
| 1137 | | - |
|---|
| 1138 | | - mutex_lock(&port->port.mutex); |
|---|
| 1139 | | - memset(&out_info, 0, sizeof(out_info)); |
|---|
| 1140 | | -/* out_info.type = ? */ |
|---|
| 1141 | | - out_info.line = port - isi_ports; |
|---|
| 1142 | | - out_info.port = port->card->base; |
|---|
| 1143 | | - out_info.irq = port->card->irq; |
|---|
| 1144 | | - out_info.flags = port->port.flags; |
|---|
| 1145 | | -/* out_info.baud_base = ? */ |
|---|
| 1146 | | - out_info.close_delay = port->port.close_delay; |
|---|
| 1147 | | - out_info.closing_wait = port->port.closing_wait; |
|---|
| 1148 | | - mutex_unlock(&port->port.mutex); |
|---|
| 1149 | | - if (copy_to_user(info, &out_info, sizeof(out_info))) |
|---|
| 1150 | | - return -EFAULT; |
|---|
| 1151 | | - return 0; |
|---|
| 1152 | | -} |
|---|
| 1153 | | - |
|---|
| 1154 | | -static int isicom_ioctl(struct tty_struct *tty, |
|---|
| 1155 | | - unsigned int cmd, unsigned long arg) |
|---|
| 1131 | +static int isicom_get_serial_info(struct tty_struct *tty, |
|---|
| 1132 | + struct serial_struct *ss) |
|---|
| 1156 | 1133 | { |
|---|
| 1157 | 1134 | struct isi_port *port = tty->driver_data; |
|---|
| 1158 | | - void __user *argp = (void __user *)arg; |
|---|
| 1159 | 1135 | |
|---|
| 1160 | 1136 | if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) |
|---|
| 1161 | 1137 | return -ENODEV; |
|---|
| 1162 | 1138 | |
|---|
| 1163 | | - switch (cmd) { |
|---|
| 1164 | | - case TIOCGSERIAL: |
|---|
| 1165 | | - return isicom_get_serial_info(port, argp); |
|---|
| 1166 | | - |
|---|
| 1167 | | - case TIOCSSERIAL: |
|---|
| 1168 | | - return isicom_set_serial_info(tty, argp); |
|---|
| 1169 | | - |
|---|
| 1170 | | - default: |
|---|
| 1171 | | - return -ENOIOCTLCMD; |
|---|
| 1172 | | - } |
|---|
| 1139 | + mutex_lock(&port->port.mutex); |
|---|
| 1140 | +/* ss->type = ? */ |
|---|
| 1141 | + ss->line = port - isi_ports; |
|---|
| 1142 | + ss->port = port->card->base; |
|---|
| 1143 | + ss->irq = port->card->irq; |
|---|
| 1144 | + ss->flags = port->port.flags; |
|---|
| 1145 | +/* ss->baud_base = ? */ |
|---|
| 1146 | + ss->close_delay = port->port.close_delay; |
|---|
| 1147 | + ss->closing_wait = port->port.closing_wait; |
|---|
| 1148 | + mutex_unlock(&port->port.mutex); |
|---|
| 1173 | 1149 | return 0; |
|---|
| 1174 | 1150 | } |
|---|
| 1175 | 1151 | |
|---|
| .. | .. |
|---|
| 1273 | 1249 | .flush_chars = isicom_flush_chars, |
|---|
| 1274 | 1250 | .write_room = isicom_write_room, |
|---|
| 1275 | 1251 | .chars_in_buffer = isicom_chars_in_buffer, |
|---|
| 1276 | | - .ioctl = isicom_ioctl, |
|---|
| 1277 | 1252 | .set_termios = isicom_set_termios, |
|---|
| 1278 | 1253 | .throttle = isicom_throttle, |
|---|
| 1279 | 1254 | .unthrottle = isicom_unthrottle, |
|---|
| .. | .. |
|---|
| 1284 | 1259 | .tiocmget = isicom_tiocmget, |
|---|
| 1285 | 1260 | .tiocmset = isicom_tiocmset, |
|---|
| 1286 | 1261 | .break_ctl = isicom_send_break, |
|---|
| 1262 | + .get_serial = isicom_get_serial_info, |
|---|
| 1263 | + .set_serial = isicom_set_serial_info, |
|---|
| 1287 | 1264 | }; |
|---|
| 1288 | 1265 | |
|---|
| 1289 | 1266 | static const struct tty_port_operations isicom_port_ops = { |
|---|
| .. | .. |
|---|
| 1537 | 1514 | static int isicom_probe(struct pci_dev *pdev, |
|---|
| 1538 | 1515 | const struct pci_device_id *ent) |
|---|
| 1539 | 1516 | { |
|---|
| 1540 | | - unsigned int uninitialized_var(signature), index; |
|---|
| 1517 | + unsigned int signature, index; |
|---|
| 1541 | 1518 | int retval = -EPERM; |
|---|
| 1542 | 1519 | struct isi_board *board = NULL; |
|---|
| 1543 | 1520 | |
|---|