X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fchar%2Fspecialix.c;h=c0e08c7bca2f4ef713c966eeed532164d33282e6;hb=95f6fb578970c9dbfcaa436ff98d2f3c6bdea953;hp=20946f5127e0ca97b8b902fe3e22ae464722bcbf;hpb=706b75ddbe36d20d071424f9867385c319b67f8d;p=linux-2.6-omap-h63xx.git diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 20946f5127e..c0e08c7bca2 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -178,9 +178,6 @@ static int sx_poll = HZ; ASYNC_SPD_HI | ASYNC_SPEED_VHI | ASYNC_SESSION_LOCKOUT | \ ASYNC_PGRP_LOCKOUT | ASYNC_CALLOUT_NOHUP) -#undef RS_EVENT_WRITE_WAKEUP -#define RS_EVENT_WRITE_WAKEUP 0 - static struct tty_driver *specialix_driver; static struct specialix_board sx_board[SX_NBOARD] = { @@ -345,18 +342,6 @@ static inline void sx_release_io_range(struct specialix_board * bp) } -/* Must be called with enabled interrupts */ -/* Ugly. Very ugly. Don't use this for anything else than initialization - code */ -static inline void sx_long_delay(unsigned long delay) -{ - unsigned long i; - - for (i = jiffies + delay; time_after(i, jiffies); ) ; -} - - - /* Set the IRQ using the RTS lines that run to the PAL on the board.... */ static int sx_set_irq ( struct specialix_board *bp) { @@ -397,7 +382,7 @@ static int sx_init_CD186x(struct specialix_board * bp) spin_lock_irqsave(&bp->lock, flags); sx_out_off(bp, CD186x_CCR, CCR_HARDRESET); /* Reset CD186x chip */ spin_unlock_irqrestore(&bp->lock, flags); - sx_long_delay(HZ/20); /* Delay 0.05 sec */ + msleep(50); /* Delay 0.05 sec */ spin_lock_irqsave(&bp->lock, flags); sx_out_off(bp, CD186x_GIVR, SX_ID); /* Set ID for this chip */ sx_out_off(bp, CD186x_GICR, 0); /* Clear all bits */ @@ -459,10 +444,9 @@ void missed_irq (unsigned long data) if (irq) { printk (KERN_INFO "Missed interrupt... Calling int from timer. \n"); sx_interrupt (((struct specialix_board *)data)->irq, - (void*)data, NULL); + (void*)data); } - missed_irq_timer.expires = jiffies + sx_poll; - add_timer (&missed_irq_timer); + mod_timer(&missed_irq_timer, jiffies + sx_poll); } #endif @@ -534,7 +518,7 @@ static int sx_probe(struct specialix_board *bp) sx_wait_CCR(bp); sx_out(bp, CD186x_CCR, CCR_TXEN); /* Enable transmitter */ sx_out(bp, CD186x_IER, IER_TXRDY); /* Enable tx empty intr */ - sx_long_delay(HZ/20); + msleep(50); irqs = probe_irq_off(irqs); dprintk (SX_DEBUG_INIT, "SRSR = %02x, ", sx_in(bp, CD186x_SRSR)); @@ -597,11 +581,8 @@ static int sx_probe(struct specialix_board *bp) dprintk (SX_DEBUG_INIT, " GFCR = 0x%02x\n", sx_in_off(bp, CD186x_GFRCR) ); #ifdef SPECIALIX_TIMER - init_timer (&missed_irq_timer); - missed_irq_timer.function = missed_irq; - missed_irq_timer.data = (unsigned long) bp; - missed_irq_timer.expires = jiffies + sx_poll; - add_timer (&missed_irq_timer); + setup_timer(&missed_irq_timer, missed_irq, (unsigned long)bp); + mod_timer(&missed_irq_timer, jiffies + sx_poll); #endif printk(KERN_INFO"sx%d: specialix IO8+ board detected at 0x%03x, IRQ %d, CD%d Rev. %c.\n", @@ -618,17 +599,6 @@ static int sx_probe(struct specialix_board *bp) * Interrupt processing routines. * */ -static inline void sx_mark_event(struct specialix_port * port, int event) -{ - func_enter(); - - set_bit(event, &port->event); - schedule_work(&port->tqueue); - - func_exit(); -} - - static inline struct specialix_port * sx_get_port(struct specialix_board * bp, unsigned char const * what) { @@ -825,7 +795,7 @@ static inline void sx_transmit(struct specialix_board * bp) sx_out(bp, CD186x_IER, port->IER); } if (port->xmit_cnt <= port->wakeup_chars) - sx_mark_event(port, RS_EVENT_WRITE_WAKEUP); + tty_wakeup(tty); func_exit(); } @@ -855,7 +825,7 @@ static inline void sx_check_modem(struct specialix_board * bp) wake_up_interruptible(&port->open_wait); } else { dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n"); - schedule_work(&port->tqueue_hangup); + tty_hangup(tty); } } @@ -865,7 +835,7 @@ static inline void sx_check_modem(struct specialix_board * bp) tty->hw_stopped = 0; port->IER |= IER_TXRDY; if (port->xmit_cnt <= port->wakeup_chars) - sx_mark_event(port, RS_EVENT_WRITE_WAKEUP); + tty_wakeup(tty); } else { tty->hw_stopped = 1; port->IER &= ~IER_TXRDY; @@ -877,7 +847,7 @@ static inline void sx_check_modem(struct specialix_board * bp) tty->hw_stopped = 0; port->IER |= IER_TXRDY; if (port->xmit_cnt <= port->wakeup_chars) - sx_mark_event(port, RS_EVENT_WRITE_WAKEUP); + tty_wakeup(tty); } else { tty->hw_stopped = 1; port->IER &= ~IER_TXRDY; @@ -1634,7 +1604,6 @@ static void sx_close(struct tty_struct * tty, struct file * filp) tty_ldisc_flush(tty); spin_lock_irqsave(&port->lock, flags); tty->closing = 0; - port->event = 0; port->tty = NULL; spin_unlock_irqrestore(&port->lock, flags); if (port->blocked_open) { @@ -2251,32 +2220,6 @@ static void sx_start(struct tty_struct * tty) func_exit(); } - -/* - * This routine is called from the work-queue when the interrupt - * routine has signalled that a hangup has occurred. The path of - * hangup processing is: - * - * serial interrupt routine -> (workqueue) -> - * do_sx_hangup() -> tty->hangup() -> sx_hangup() - * - */ -static void do_sx_hangup(struct work_struct *work) -{ - struct specialix_port *port = - container_of(work, struct specialix_port, tqueue_hangup); - struct tty_struct *tty; - - func_enter(); - - tty = port->tty; - if (tty) - tty_hangup(tty); /* FIXME: module removal race here */ - - func_exit(); -} - - static void sx_hangup(struct tty_struct * tty) { struct specialix_port *port = (struct specialix_port *)tty->driver_data; @@ -2294,7 +2237,6 @@ static void sx_hangup(struct tty_struct * tty) sx_shutdown_port(bp, port); spin_lock_irqsave(&port->lock, flags); - port->event = 0; bp->count -= port->count; if (bp->count < 0) { printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n", @@ -2336,28 +2278,6 @@ static void sx_set_termios(struct tty_struct * tty, struct ktermios * old_termio } } - -static void do_softint(struct work_struct *work) -{ - struct specialix_port *port = - container_of(work, struct specialix_port, tqueue); - struct tty_struct *tty; - - func_enter(); - - if(!(tty = port->tty)) { - func_exit(); - return; - } - - if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) { - tty_wakeup(tty); - //wake_up_interruptible(&tty->write_wait); - } - - func_exit(); -} - static const struct tty_operations sx_ops = { .open = sx_open, .close = sx_close, @@ -2415,8 +2335,6 @@ static int sx_init_drivers(void) memset(sx_port, 0, sizeof(sx_port)); for (i = 0; i < SX_NPORT * SX_NBOARD; i++) { sx_port[i].magic = SPECIALIX_MAGIC; - INIT_WORK(&sx_port[i].tqueue, do_softint); - INIT_WORK(&sx_port[i].tqueue_hangup, do_sx_hangup); sx_port[i].close_delay = 50 * HZ/100; sx_port[i].closing_wait = 3000 * HZ/100; init_waitqueue_head(&sx_port[i].open_wait); @@ -2561,7 +2479,7 @@ static void __exit specialix_exit_module(void) if (sx_board[i].flags & SX_BOARD_PRESENT) sx_release_io_range(&sx_board[i]); #ifdef SPECIALIX_TIMER - del_timer (&missed_irq_timer); + del_timer_sync(&missed_irq_timer); #endif func_exit();