X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=drivers%2Fchar%2Fspecialix.c;h=d2d6b01dcd05a1168dbd7795ebd13d5c5be32dc9;hp=0bbfce43031c9d6be2e4041db9c8fc6f1eea0203;hb=f17a2686b11453680e9662ef8bdc8d948d0dce18;hpb=78b9c0f91cf908616b8f9f356e1d1220e727ea88 diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 0bbfce43031c..d2d6b01dcd05 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -85,6 +85,7 @@ #include #include #include +#include #include #include #include @@ -183,7 +184,6 @@ static int sx_poll = HZ; static struct tty_driver *specialix_driver; static unsigned char * tmp_buf; -static DECLARE_MUTEX(tmp_buf_sem); static unsigned long baud_table[] = { 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, @@ -665,7 +665,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) struct specialix_port *port; struct tty_struct *tty; unsigned char status; - unsigned char ch; + unsigned char ch, flag; func_enter(); @@ -676,8 +676,6 @@ static inline void sx_receive_exc(struct specialix_board * bp) return; } tty = port->tty; - dprintk (SX_DEBUG_RX, "port: %p count: %d BUFF_SIZE: %d\n", - port, tty->flip.count, TTY_FLIPBUF_SIZE); status = sx_in(bp, CD186x_RCSR); @@ -691,7 +689,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) /* This flip buffer check needs to be below the reading of the status register to reset the chip's IRQ.... */ - if (tty->flip.count >= TTY_FLIPBUF_SIZE) { + if (tty_buffer_request_room(tty, 1) == 0) { dprintk(SX_DEBUG_FIFO, "sx%d: port %d: Working around flip buffer overflow.\n", board_No(bp), port_No(port)); func_exit(); @@ -712,26 +710,24 @@ static inline void sx_receive_exc(struct specialix_board * bp) } else if (status & RCSR_BREAK) { dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", board_No(bp), port_No(port)); - *tty->flip.flag_buf_ptr++ = TTY_BREAK; + flag = TTY_BREAK; if (port->flags & ASYNC_SAK) do_SAK(tty); } else if (status & RCSR_PE) - *tty->flip.flag_buf_ptr++ = TTY_PARITY; + flag = TTY_PARITY; else if (status & RCSR_FE) - *tty->flip.flag_buf_ptr++ = TTY_FRAME; + flag = TTY_FRAME; else if (status & RCSR_OE) - *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; + flag = TTY_OVERRUN; else - *tty->flip.flag_buf_ptr++ = 0; - - *tty->flip.char_buf_ptr++ = ch; - tty->flip.count++; - schedule_delayed_work(&tty->flip.work, 1); + flag = TTY_NORMAL; + if(tty_insert_flip_char(tty, ch, flag)) + tty_flip_buffer_push(tty); func_exit(); } @@ -755,18 +751,11 @@ static inline void sx_receive(struct specialix_board * bp) dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); port->hits[count > 8 ? 9 : count]++; - while (count--) { - if (tty->flip.count >= TTY_FLIPBUF_SIZE) { - printk(KERN_INFO "sx%d: port %d: Working around flip buffer overflow.\n", - board_No(bp), port_No(port)); - break; - } - *tty->flip.char_buf_ptr++ = sx_in(bp, CD186x_RDR); - *tty->flip.flag_buf_ptr++ = 0; - tty->flip.count++; - } - schedule_delayed_work(&tty->flip.work, 1); + tty_buffer_request_room(tty, count); + while (count--) + tty_insert_flip_char(tty, sx_in(bp, CD186x_RDR), TTY_NORMAL); + tty_flip_buffer_push(tty); func_exit(); } @@ -1694,7 +1683,7 @@ static int sx_write(struct tty_struct * tty, bp = port_Board(port); - if (!tty || !port->xmit_buf || !tmp_buf) { + if (!port->xmit_buf || !tmp_buf) { func_exit(); return 0; } @@ -1744,7 +1733,7 @@ static void sx_put_char(struct tty_struct * tty, unsigned char ch) return; } dprintk (SX_DEBUG_TX, "check tty: %p %p\n", tty, port->xmit_buf); - if (!tty || !port->xmit_buf) { + if (!port->xmit_buf) { func_exit(); return; } @@ -2488,7 +2477,7 @@ static int __init specialix_init(void) #endif for (i = 0; i < SX_NBOARD; i++) - sx_board[i].lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&sx_board[i].lock); if (sx_init_drivers()) { func_exit(); @@ -2566,8 +2555,6 @@ static int __init specialix_init_module(void) func_enter(); - init_MUTEX(&tmp_buf_sem); /* Init de the semaphore - pvdl */ - if (iobase[0] || iobase[1] || iobase[2] || iobase[3]) { for(i = 0; i < SX_NBOARD; i++) { sx_board[i].base = iobase[i];