diff options
Diffstat (limited to 'drivers/tty/serial/68328serial.c')
-rw-r--r-- | drivers/tty/serial/68328serial.c | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c index be0ebce36e54..d5bfd41707e7 100644 --- a/drivers/tty/serial/68328serial.c +++ b/drivers/tty/serial/68328serial.c | |||
@@ -262,7 +262,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status) | |||
262 | 262 | ||
263 | static void receive_chars(struct m68k_serial *info, unsigned short rx) | 263 | static void receive_chars(struct m68k_serial *info, unsigned short rx) |
264 | { | 264 | { |
265 | struct tty_struct *tty = info->port.tty; | 265 | struct tty_struct *tty = info->tty; |
266 | m68328_uart *uart = &uart_addr[info->line]; | 266 | m68328_uart *uart = &uart_addr[info->line]; |
267 | unsigned char ch, flag; | 267 | unsigned char ch, flag; |
268 | 268 | ||
@@ -329,7 +329,7 @@ static void transmit_chars(struct m68k_serial *info) | |||
329 | goto clear_and_return; | 329 | goto clear_and_return; |
330 | } | 330 | } |
331 | 331 | ||
332 | if((info->xmit_cnt <= 0) || info->port.tty->stopped) { | 332 | if((info->xmit_cnt <= 0) || info->tty->stopped) { |
333 | /* That's peculiar... TX ints off */ | 333 | /* That's peculiar... TX ints off */ |
334 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; | 334 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; |
335 | goto clear_and_return; | 335 | goto clear_and_return; |
@@ -383,7 +383,7 @@ static void do_softint(struct work_struct *work) | |||
383 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); | 383 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); |
384 | struct tty_struct *tty; | 384 | struct tty_struct *tty; |
385 | 385 | ||
386 | tty = info->port.tty; | 386 | tty = info->tty; |
387 | if (!tty) | 387 | if (!tty) |
388 | return; | 388 | return; |
389 | #if 0 | 389 | #if 0 |
@@ -393,28 +393,6 @@ static void do_softint(struct work_struct *work) | |||
393 | #endif | 393 | #endif |
394 | } | 394 | } |
395 | 395 | ||
396 | /* | ||
397 | * This routine is called from the scheduler tqueue when the interrupt | ||
398 | * routine has signalled that a hangup has occurred. The path of | ||
399 | * hangup processing is: | ||
400 | * | ||
401 | * serial interrupt routine -> (scheduler tqueue) -> | ||
402 | * do_serial_hangup() -> tty->hangup() -> rs_hangup() | ||
403 | * | ||
404 | */ | ||
405 | static void do_serial_hangup(struct work_struct *work) | ||
406 | { | ||
407 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); | ||
408 | struct tty_struct *tty; | ||
409 | |||
410 | tty = info->port.tty; | ||
411 | if (!tty) | ||
412 | return; | ||
413 | |||
414 | tty_hangup(tty); | ||
415 | } | ||
416 | |||
417 | |||
418 | static int startup(struct m68k_serial * info) | 396 | static int startup(struct m68k_serial * info) |
419 | { | 397 | { |
420 | m68328_uart *uart = &uart_addr[info->line]; | 398 | m68328_uart *uart = &uart_addr[info->line]; |
@@ -451,8 +429,8 @@ static int startup(struct m68k_serial * info) | |||
451 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; | 429 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; |
452 | #endif | 430 | #endif |
453 | 431 | ||
454 | if (info->port.tty) | 432 | if (info->tty) |
455 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); | 433 | clear_bit(TTY_IO_ERROR, &info->tty->flags); |
456 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 434 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
457 | 435 | ||
458 | /* | 436 | /* |
@@ -486,8 +464,8 @@ static void shutdown(struct m68k_serial * info) | |||
486 | info->xmit_buf = 0; | 464 | info->xmit_buf = 0; |
487 | } | 465 | } |
488 | 466 | ||
489 | if (info->port.tty) | 467 | if (info->tty) |
490 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); | 468 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
491 | 469 | ||
492 | info->flags &= ~S_INITIALIZED; | 470 | info->flags &= ~S_INITIALIZED; |
493 | local_irq_restore(flags); | 471 | local_irq_restore(flags); |
@@ -553,9 +531,9 @@ static void change_speed(struct m68k_serial *info) | |||
553 | unsigned cflag; | 531 | unsigned cflag; |
554 | int i; | 532 | int i; |
555 | 533 | ||
556 | if (!info->port.tty || !info->port.tty->termios) | 534 | if (!info->tty || !info->tty->termios) |
557 | return; | 535 | return; |
558 | cflag = info->port.tty->termios->c_cflag; | 536 | cflag = info->tty->termios->c_cflag; |
559 | if (!(port = info->port)) | 537 | if (!(port = info->port)) |
560 | return; | 538 | return; |
561 | 539 | ||
@@ -967,10 +945,9 @@ static void send_break(struct m68k_serial * info, unsigned int duration) | |||
967 | local_irq_restore(flags); | 945 | local_irq_restore(flags); |
968 | } | 946 | } |
969 | 947 | ||
970 | static int rs_ioctl(struct tty_struct *tty, struct file * file, | 948 | static int rs_ioctl(struct tty_struct *tty, |
971 | unsigned int cmd, unsigned long arg) | 949 | unsigned int cmd, unsigned long arg) |
972 | { | 950 | { |
973 | int error; | ||
974 | struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; | 951 | struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; |
975 | int retval; | 952 | int retval; |
976 | 953 | ||
@@ -1104,7 +1081,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1104 | tty_ldisc_flush(tty); | 1081 | tty_ldisc_flush(tty); |
1105 | tty->closing = 0; | 1082 | tty->closing = 0; |
1106 | info->event = 0; | 1083 | info->event = 0; |
1107 | info->port.tty = NULL; | 1084 | info->tty = NULL; |
1108 | #warning "This is not and has never been valid so fix it" | 1085 | #warning "This is not and has never been valid so fix it" |
1109 | #if 0 | 1086 | #if 0 |
1110 | if (tty->ldisc.num != ldiscs[N_TTY].num) { | 1087 | if (tty->ldisc.num != ldiscs[N_TTY].num) { |
@@ -1142,7 +1119,7 @@ void rs_hangup(struct tty_struct *tty) | |||
1142 | info->event = 0; | 1119 | info->event = 0; |
1143 | info->count = 0; | 1120 | info->count = 0; |
1144 | info->flags &= ~S_NORMAL_ACTIVE; | 1121 | info->flags &= ~S_NORMAL_ACTIVE; |
1145 | info->port.tty = NULL; | 1122 | info->tty = NULL; |
1146 | wake_up_interruptible(&info->open_wait); | 1123 | wake_up_interruptible(&info->open_wait); |
1147 | } | 1124 | } |
1148 | 1125 | ||
@@ -1261,7 +1238,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) | |||
1261 | 1238 | ||
1262 | info->count++; | 1239 | info->count++; |
1263 | tty->driver_data = info; | 1240 | tty->driver_data = info; |
1264 | info->port.tty = tty; | 1241 | info->tty = tty; |
1265 | 1242 | ||
1266 | /* | 1243 | /* |
1267 | * Start up serial port | 1244 | * Start up serial port |
@@ -1338,7 +1315,7 @@ rs68328_init(void) | |||
1338 | info = &m68k_soft[i]; | 1315 | info = &m68k_soft[i]; |
1339 | info->magic = SERIAL_MAGIC; | 1316 | info->magic = SERIAL_MAGIC; |
1340 | info->port = (int) &uart_addr[i]; | 1317 | info->port = (int) &uart_addr[i]; |
1341 | info->port.tty = NULL; | 1318 | info->tty = NULL; |
1342 | info->irq = uart_irqs[i]; | 1319 | info->irq = uart_irqs[i]; |
1343 | info->custom_divisor = 16; | 1320 | info->custom_divisor = 16; |
1344 | info->close_delay = 50; | 1321 | info->close_delay = 50; |
@@ -1348,7 +1325,6 @@ rs68328_init(void) | |||
1348 | info->count = 0; | 1325 | info->count = 0; |
1349 | info->blocked_open = 0; | 1326 | info->blocked_open = 0; |
1350 | INIT_WORK(&info->tqueue, do_softint); | 1327 | INIT_WORK(&info->tqueue, do_softint); |
1351 | INIT_WORK(&info->tqueue_hangup, do_serial_hangup); | ||
1352 | init_waitqueue_head(&info->open_wait); | 1328 | init_waitqueue_head(&info->open_wait); |
1353 | init_waitqueue_head(&info->close_wait); | 1329 | init_waitqueue_head(&info->close_wait); |
1354 | info->line = i; | 1330 | info->line = i; |