aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-02-07 03:16:37 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:34 -0500
commitd2e7a4b66d762cad383c5469c1e8b6076792ab6a (patch)
tree8516adc2f15b67cfc5b802912b379357928eb48f /drivers/char
parent1386a820b32285583414a8db3a99305e7ebe8377 (diff)
Char: esp, remove hangup and wakeup bottomhalves
There is no need to schedule a bottomhalf for either of them. One is fast and the another schedules a bottomhalf itself. 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')
-rw-r--r--drivers/char/esp.c58
1 files changed, 5 insertions, 53 deletions
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index b5df2dc40491..c01e26d9ee5e 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -242,17 +242,6 @@ static void rs_start(struct tty_struct *tty)
242 * ----------------------------------------------------------------------- 242 * -----------------------------------------------------------------------
243 */ 243 */
244 244
245/*
246 * This routine is used by the interrupt handler to schedule
247 * processing in the software interrupt portion of the driver.
248 */
249static inline void rs_sched_event(struct esp_struct *info,
250 int event)
251{
252 info->event |= 1 << event;
253 schedule_work(&info->tqueue);
254}
255
256static DEFINE_SPINLOCK(pio_lock); 245static DEFINE_SPINLOCK(pio_lock);
257 246
258static inline struct esp_pio_buffer *get_pio_buffer(void) 247static inline struct esp_pio_buffer *get_pio_buffer(void)
@@ -474,7 +463,8 @@ static inline void transmit_chars_pio(struct esp_struct *info,
474 } 463 }
475 464
476 if (info->xmit_cnt < WAKEUP_CHARS) { 465 if (info->xmit_cnt < WAKEUP_CHARS) {
477 rs_sched_event(info, ESP_EVENT_WRITE_WAKEUP); 466 if (info->tty)
467 tty_wakeup(info->tty);
478 468
479#ifdef SERIAL_DEBUG_INTR 469#ifdef SERIAL_DEBUG_INTR
480 printk("THRE..."); 470 printk("THRE...");
@@ -512,7 +502,8 @@ static inline void transmit_chars_dma(struct esp_struct *info, int num_bytes)
512 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1); 502 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1);
513 503
514 if (info->xmit_cnt < WAKEUP_CHARS) { 504 if (info->xmit_cnt < WAKEUP_CHARS) {
515 rs_sched_event(info, ESP_EVENT_WRITE_WAKEUP); 505 if (info->tty)
506 tty_wakeup(info->tty);
516 507
517#ifdef SERIAL_DEBUG_INTR 508#ifdef SERIAL_DEBUG_INTR
518 printk("THRE..."); 509 printk("THRE...");
@@ -604,7 +595,7 @@ static inline void check_modem_status(struct esp_struct *info)
604#ifdef SERIAL_DEBUG_OPEN 595#ifdef SERIAL_DEBUG_OPEN
605 printk("scheduling hangup..."); 596 printk("scheduling hangup...");
606#endif 597#endif
607 schedule_work(&info->tqueue_hangup); 598 tty_hangup(info->tty);
608 } 599 }
609 } 600 }
610} 601}
@@ -720,41 +711,6 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
720 * ------------------------------------------------------------------- 711 * -------------------------------------------------------------------
721 */ 712 */
722 713
723static void do_softint(struct work_struct *work)
724{
725 struct esp_struct *info =
726 container_of(work, struct esp_struct, tqueue);
727 struct tty_struct *tty;
728
729 tty = info->tty;
730 if (!tty)
731 return;
732
733 if (test_and_clear_bit(ESP_EVENT_WRITE_WAKEUP, &info->event)) {
734 tty_wakeup(tty);
735 }
736}
737
738/*
739 * This routine is called from the scheduler tqueue when the interrupt
740 * routine has signalled that a hangup has occurred. The path of
741 * hangup processing is:
742 *
743 * serial interrupt routine -> (scheduler tqueue) ->
744 * do_serial_hangup() -> tty->hangup() -> esp_hangup()
745 *
746 */
747static void do_serial_hangup(struct work_struct *work)
748{
749 struct esp_struct *info =
750 container_of(work, struct esp_struct, tqueue_hangup);
751 struct tty_struct *tty;
752
753 tty = info->tty;
754 if (tty)
755 tty_hangup(tty);
756}
757
758/* 714/*
759 * --------------------------------------------------------------- 715 * ---------------------------------------------------------------
760 * Low level utility subroutines for the serial driver: routines to 716 * Low level utility subroutines for the serial driver: routines to
@@ -2038,7 +1994,6 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
2038 tty->driver->flush_buffer(tty); 1994 tty->driver->flush_buffer(tty);
2039 tty_ldisc_flush(tty); 1995 tty_ldisc_flush(tty);
2040 tty->closing = 0; 1996 tty->closing = 0;
2041 info->event = 0;
2042 info->tty = NULL; 1997 info->tty = NULL;
2043 1998
2044 if (info->blocked_open) { 1999 if (info->blocked_open) {
@@ -2106,7 +2061,6 @@ static void esp_hangup(struct tty_struct *tty)
2106 2061
2107 rs_flush_buffer(tty); 2062 rs_flush_buffer(tty);
2108 shutdown(info); 2063 shutdown(info);
2109 info->event = 0;
2110 info->count = 0; 2064 info->count = 0;
2111 info->flags &= ~ASYNC_NORMAL_ACTIVE; 2065 info->flags &= ~ASYNC_NORMAL_ACTIVE;
2112 info->tty = NULL; 2066 info->tty = NULL;
@@ -2492,8 +2446,6 @@ static int __init espserial_init(void)
2492 info->magic = ESP_MAGIC; 2446 info->magic = ESP_MAGIC;
2493 info->close_delay = 5*HZ/10; 2447 info->close_delay = 5*HZ/10;
2494 info->closing_wait = 30*HZ; 2448 info->closing_wait = 30*HZ;
2495 INIT_WORK(&info->tqueue, do_softint);
2496 INIT_WORK(&info->tqueue_hangup, do_serial_hangup);
2497 info->config.rx_timeout = rx_timeout; 2449 info->config.rx_timeout = rx_timeout;
2498 info->config.flow_on = flow_on; 2450 info->config.flow_on = flow_on;
2499 info->config.flow_off = flow_off; 2451 info->config.flow_off = flow_off;