aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-10 04:44:47 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:25 -0500
commit0aa5de8590d684274f57647a870851f101bb3543 (patch)
tree5f0e5366fd14714eccbb98e3e7f827a6768358a5
parent52c9ae0ac7576c94f6a2371b44039e7ba12a0439 (diff)
[PATCH] Char: isicom, remove tty_{hang,wake}up bottomhalves
- tty_hangup() itself schedules work, so there is no need to schedule hangup in the driver - tty_wakeup(): it's safe to call it while in atomic, so that its schedule_work might be also wiped out 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>
-rw-r--r--drivers/char/isicom.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 01084abffddf..26d3f78bf8ed 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -213,8 +213,6 @@ struct isi_port {
213 struct tty_struct * tty; 213 struct tty_struct * tty;
214 wait_queue_head_t close_wait; 214 wait_queue_head_t close_wait;
215 wait_queue_head_t open_wait; 215 wait_queue_head_t open_wait;
216 struct work_struct hangup_tq;
217 struct work_struct bh_tqueue;
218 unsigned char * xmit_buf; 216 unsigned char * xmit_buf;
219 int xmit_head; 217 int xmit_head;
220 int xmit_tail; 218 int xmit_tail;
@@ -510,7 +508,7 @@ static void isicom_tx(unsigned long _data)
510 if (port->xmit_cnt <= 0) 508 if (port->xmit_cnt <= 0)
511 port->status &= ~ISI_TXOK; 509 port->status &= ~ISI_TXOK;
512 if (port->xmit_cnt <= WAKEUP_CHARS) 510 if (port->xmit_cnt <= WAKEUP_CHARS)
513 schedule_work(&port->bh_tqueue); 511 tty_wakeup(tty);
514 unlock_card(&isi_card[card]); 512 unlock_card(&isi_card[card]);
515 } 513 }
516 514
@@ -524,21 +522,6 @@ sched_again:
524 mod_timer(&tx, jiffies + msecs_to_jiffies(10)); 522 mod_timer(&tx, jiffies + msecs_to_jiffies(10));
525} 523}
526 524
527/* Interrupt handlers */
528
529
530static void isicom_bottomhalf(struct work_struct *work)
531{
532 struct isi_port *port = container_of(work, struct isi_port, bh_tqueue);
533 struct tty_struct *tty = port->tty;
534
535 if (!tty)
536 return;
537
538 tty_wakeup(tty);
539 wake_up_interruptible(&tty->write_wait);
540}
541
542/* 525/*
543 * Main interrupt handler routine 526 * Main interrupt handler routine
544 */ 527 */
@@ -609,7 +592,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
609 pr_dbg("interrupt: DCD->low.\n" 592 pr_dbg("interrupt: DCD->low.\n"
610 ); 593 );
611 port->status &= ~ISI_DCD; 594 port->status &= ~ISI_DCD;
612 schedule_work(&port->hangup_tq); 595 tty_hangup(tty);
613 } 596 }
614 } else if (header & ISI_DCD) { 597 } else if (header & ISI_DCD) {
615 /* Carrier has been detected */ 598 /* Carrier has been detected */
@@ -631,7 +614,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
631 /* start tx ing */ 614 /* start tx ing */
632 port->status |= (ISI_TXOK 615 port->status |= (ISI_TXOK
633 | ISI_CTS); 616 | ISI_CTS);
634 schedule_work(&port->bh_tqueue); 617 tty_wakeup(tty);
635 } 618 }
636 } else if (!(header & ISI_CTS)) { 619 } else if (!(header & ISI_CTS)) {
637 port->tty->hw_stopped = 1; 620 port->tty->hw_stopped = 1;
@@ -1460,17 +1443,6 @@ static void isicom_start(struct tty_struct *tty)
1460 port->status |= ISI_TXOK; 1443 port->status |= ISI_TXOK;
1461} 1444}
1462 1445
1463/* hangup et all */
1464static void do_isicom_hangup(struct work_struct *work)
1465{
1466 struct isi_port *port = container_of(work, struct isi_port, hangup_tq);
1467 struct tty_struct *tty;
1468
1469 tty = port->tty;
1470 if (tty)
1471 tty_hangup(tty);
1472}
1473
1474static void isicom_hangup(struct tty_struct *tty) 1446static void isicom_hangup(struct tty_struct *tty)
1475{ 1447{
1476 struct isi_port *port = tty->driver_data; 1448 struct isi_port *port = tty->driver_data;
@@ -1858,8 +1830,6 @@ static int __init isicom_init(void)
1858 port->channel = channel; 1830 port->channel = channel;
1859 port->close_delay = 50 * HZ/100; 1831 port->close_delay = 50 * HZ/100;
1860 port->closing_wait = 3000 * HZ/100; 1832 port->closing_wait = 3000 * HZ/100;
1861 INIT_WORK(&port->hangup_tq, do_isicom_hangup);
1862 INIT_WORK(&port->bh_tqueue, isicom_bottomhalf);
1863 port->status = 0; 1833 port->status = 0;
1864 init_waitqueue_head(&port->open_wait); 1834 init_waitqueue_head(&port->open_wait);
1865 init_waitqueue_head(&port->close_wait); 1835 init_waitqueue_head(&port->close_wait);