aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/riscom8.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-02-07 03:16:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:34 -0500
commitb98e70de7836cf0ea49b6714b2455381865b1260 (patch)
tree2d738af030c1c2c478f707fbe4a8b7da55c2db2d /drivers/char/riscom8.c
parent3099bbc59435928fbd1f4ebd835f825bca755bbb (diff)
Char: riscom8, remove wakeup and hangup bottomhalves
Both of them may be called directly from the code, don't add special code and variables and schedule a work for them. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/riscom8.c')
-rw-r--r--drivers/char/riscom8.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 9b19abf29a2b..8fc4fe4e38f1 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -78,8 +78,6 @@
78 ASYNC_SPD_HI | ASYNC_SPEED_VHI | ASYNC_SESSION_LOCKOUT | \ 78 ASYNC_SPD_HI | ASYNC_SPEED_VHI | ASYNC_SESSION_LOCKOUT | \
79 ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP) 79 ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP)
80 80
81#define RS_EVENT_WRITE_WAKEUP 0
82
83static struct tty_driver *riscom_driver; 81static struct tty_driver *riscom_driver;
84 82
85static DEFINE_SPINLOCK(riscom_lock); 83static DEFINE_SPINLOCK(riscom_lock);
@@ -314,12 +312,6 @@ out_release:
314 * 312 *
315 */ 313 */
316 314
317static inline void rc_mark_event(struct riscom_port * port, int event)
318{
319 set_bit(event, &port->event);
320 schedule_work(&port->tqueue);
321}
322
323static inline struct riscom_port * rc_get_port(struct riscom_board const * bp, 315static inline struct riscom_port * rc_get_port(struct riscom_board const * bp,
324 unsigned char const * what) 316 unsigned char const * what)
325{ 317{
@@ -486,7 +478,7 @@ static inline void rc_transmit(struct riscom_board const * bp)
486 rc_out(bp, CD180_IER, port->IER); 478 rc_out(bp, CD180_IER, port->IER);
487 } 479 }
488 if (port->xmit_cnt <= port->wakeup_chars) 480 if (port->xmit_cnt <= port->wakeup_chars)
489 rc_mark_event(port, RS_EVENT_WRITE_WAKEUP); 481 tty_wakeup(tty);
490} 482}
491 483
492static inline void rc_check_modem(struct riscom_board const * bp) 484static inline void rc_check_modem(struct riscom_board const * bp)
@@ -505,7 +497,7 @@ static inline void rc_check_modem(struct riscom_board const * bp)
505 if (rc_in(bp, CD180_MSVR) & MSVR_CD) 497 if (rc_in(bp, CD180_MSVR) & MSVR_CD)
506 wake_up_interruptible(&port->open_wait); 498 wake_up_interruptible(&port->open_wait);
507 else 499 else
508 schedule_work(&port->tqueue_hangup); 500 tty_hangup(tty);
509 } 501 }
510 502
511#ifdef RISCOM_BRAIN_DAMAGED_CTS 503#ifdef RISCOM_BRAIN_DAMAGED_CTS
@@ -514,7 +506,7 @@ static inline void rc_check_modem(struct riscom_board const * bp)
514 tty->hw_stopped = 0; 506 tty->hw_stopped = 0;
515 port->IER |= IER_TXRDY; 507 port->IER |= IER_TXRDY;
516 if (port->xmit_cnt <= port->wakeup_chars) 508 if (port->xmit_cnt <= port->wakeup_chars)
517 rc_mark_event(port, RS_EVENT_WRITE_WAKEUP); 509 tty_wakeup(tty);
518 } else { 510 } else {
519 tty->hw_stopped = 1; 511 tty->hw_stopped = 1;
520 port->IER &= ~IER_TXRDY; 512 port->IER &= ~IER_TXRDY;
@@ -526,7 +518,7 @@ static inline void rc_check_modem(struct riscom_board const * bp)
526 tty->hw_stopped = 0; 518 tty->hw_stopped = 0;
527 port->IER |= IER_TXRDY; 519 port->IER |= IER_TXRDY;
528 if (port->xmit_cnt <= port->wakeup_chars) 520 if (port->xmit_cnt <= port->wakeup_chars)
529 rc_mark_event(port, RS_EVENT_WRITE_WAKEUP); 521 tty_wakeup(tty);
530 } else { 522 } else {
531 tty->hw_stopped = 1; 523 tty->hw_stopped = 1;
532 port->IER &= ~IER_TXRDY; 524 port->IER &= ~IER_TXRDY;
@@ -1091,7 +1083,6 @@ static void rc_close(struct tty_struct * tty, struct file * filp)
1091 tty_ldisc_flush(tty); 1083 tty_ldisc_flush(tty);
1092 1084
1093 tty->closing = 0; 1085 tty->closing = 0;
1094 port->event = 0;
1095 port->tty = NULL; 1086 port->tty = NULL;
1096 if (port->blocked_open) { 1087 if (port->blocked_open) {
1097 if (port->close_delay) { 1088 if (port->close_delay) {
@@ -1526,25 +1517,6 @@ static void rc_start(struct tty_struct * tty)
1526 spin_unlock_irqrestore(&riscom_lock, flags); 1517 spin_unlock_irqrestore(&riscom_lock, flags);
1527} 1518}
1528 1519
1529/*
1530 * This routine is called from the work queue when the interrupt
1531 * routine has signalled that a hangup has occurred. The path of
1532 * hangup processing is:
1533 *
1534 * serial interrupt routine -> (workqueue) ->
1535 * do_rc_hangup() -> tty->hangup() -> rc_hangup()
1536 *
1537 */
1538static void do_rc_hangup(struct work_struct *ugly_api)
1539{
1540 struct riscom_port *port = container_of(ugly_api, struct riscom_port, tqueue_hangup);
1541 struct tty_struct *tty;
1542
1543 tty = port->tty;
1544 if (tty)
1545 tty_hangup(tty); /* FIXME: module removal race still here */
1546}
1547
1548static void rc_hangup(struct tty_struct * tty) 1520static void rc_hangup(struct tty_struct * tty)
1549{ 1521{
1550 struct riscom_port *port = (struct riscom_port *)tty->driver_data; 1522 struct riscom_port *port = (struct riscom_port *)tty->driver_data;
@@ -1556,7 +1528,6 @@ static void rc_hangup(struct tty_struct * tty)
1556 bp = port_Board(port); 1528 bp = port_Board(port);
1557 1529
1558 rc_shutdown_port(bp, port); 1530 rc_shutdown_port(bp, port);
1559 port->event = 0;
1560 port->count = 0; 1531 port->count = 0;
1561 port->flags &= ~ASYNC_NORMAL_ACTIVE; 1532 port->flags &= ~ASYNC_NORMAL_ACTIVE;
1562 port->tty = NULL; 1533 port->tty = NULL;
@@ -1586,18 +1557,6 @@ static void rc_set_termios(struct tty_struct * tty, struct ktermios * old_termio
1586 } 1557 }
1587} 1558}
1588 1559
1589static void do_softint(struct work_struct *ugly_api)
1590{
1591 struct riscom_port *port = container_of(ugly_api, struct riscom_port, tqueue);
1592 struct tty_struct *tty;
1593
1594 if(!(tty = port->tty))
1595 return;
1596
1597 if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event))
1598 tty_wakeup(tty);
1599}
1600
1601static const struct tty_operations riscom_ops = { 1560static const struct tty_operations riscom_ops = {
1602 .open = rc_open, 1561 .open = rc_open,
1603 .close = rc_close, 1562 .close = rc_close,
@@ -1650,8 +1609,6 @@ static int __init rc_init_drivers(void)
1650 memset(rc_port, 0, sizeof(rc_port)); 1609 memset(rc_port, 0, sizeof(rc_port));
1651 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { 1610 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) {
1652 rc_port[i].magic = RISCOM8_MAGIC; 1611 rc_port[i].magic = RISCOM8_MAGIC;
1653 INIT_WORK(&rc_port[i].tqueue, do_softint);
1654 INIT_WORK(&rc_port[i].tqueue_hangup, do_rc_hangup);
1655 rc_port[i].close_delay = 50 * HZ/100; 1612 rc_port[i].close_delay = 50 * HZ/100;
1656 rc_port[i].closing_wait = 3000 * HZ/100; 1613 rc_port[i].closing_wait = 3000 * HZ/100;
1657 init_waitqueue_head(&rc_port[i].open_wait); 1614 init_waitqueue_head(&rc_port[i].open_wait);