X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fser_a2232.c;h=6b4e9d155f5053bdd154f8b5434810d69d0da2d1;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=58f82dad289cd0c3b90933ff8ae21bb1d1e12a56;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index 58f82dad2..6b4e9d155 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c @@ -109,12 +109,6 @@ /************************* End of Includes **************************/ /***************************** Prototypes ***************************/ -/* Helper functions */ -static __inline__ volatile struct a2232status *a2232stat(unsigned int board, - unsigned int portonboard); -static __inline__ volatile struct a2232memory *a2232mem (unsigned int board); -static __inline__ void a2232_receive_char( struct a2232_port *port, - int ch, int err ); /* The interrupt service routine */ static irqreturn_t a2232_vbl_inter(int irq, void *data, struct pt_regs *fp); /* Initialize the port structures */ @@ -178,6 +172,51 @@ static int nr_a2232; static struct zorro_dev *zd_a2232[MAX_A2232_BOARDS]; /***************************** End of Global variables **************/ +/* Helper functions */ + +static inline volatile struct a2232memory *a2232mem(unsigned int board) +{ + return (volatile struct a2232memory *)ZTWO_VADDR(zd_a2232[board]->resource.start); +} + +static inline volatile struct a2232status *a2232stat(unsigned int board, + unsigned int portonboard) +{ + volatile struct a2232memory *mem = a2232mem(board); + return &(mem->Status[portonboard]); +} + +static inline void a2232_receive_char(struct a2232_port *port, int ch, int err) +{ +/* Mostly stolen from other drivers. + Maybe one could implement a more efficient version by not only + transferring one character at a time. +*/ + struct tty_struct *tty = port->gs.tty; + + if (tty->flip.count >= TTY_FLIPBUF_SIZE) + return; + + tty->flip.count++; + +#if 0 + switch(err) { + case TTY_BREAK: + break; + case TTY_PARITY: + break; + case TTY_OVERRUN: + break; + case TTY_FRAME: + break; + } +#endif + + *tty->flip.flag_buf_ptr++ = err; + *tty->flip.char_buf_ptr++ = ch; + tty_flip_buffer_push(tty); +} + /***************************** Functions ****************************/ /*** BEGIN OF REAL_DRIVER FUNCTIONS ***/ @@ -470,49 +509,6 @@ static int a2232_open(struct tty_struct * tty, struct file * filp) } /*** END OF FUNCTIONS EXPECTED BY TTY DRIVER STRUCTS ***/ -static __inline__ volatile struct a2232status *a2232stat(unsigned int board, unsigned int portonboard) -{ - volatile struct a2232memory *mem = a2232mem(board); - return &(mem->Status[portonboard]); -} - -static __inline__ volatile struct a2232memory *a2232mem (unsigned int board) -{ - return (volatile struct a2232memory *) ZTWO_VADDR( zd_a2232[board]->resource.start ); -} - -static __inline__ void a2232_receive_char( struct a2232_port *port, - int ch, int err ) -{ -/* Mostly stolen from other drivers. - Maybe one could implement a more efficient version by not only - transferring one character at a time. -*/ - struct tty_struct *tty = port->gs.tty; - - if (tty->flip.count >= TTY_FLIPBUF_SIZE) - return; - - tty->flip.count++; - -#if 0 - switch(err) { - case TTY_BREAK: - break; - case TTY_PARITY: - break; - case TTY_OVERRUN: - break; - case TTY_FRAME: - break; - } -#endif - - *tty->flip.flag_buf_ptr++ = err; - *tty->flip.char_buf_ptr++ = ch; - tty_flip_buffer_push(tty); -} - static irqreturn_t a2232_vbl_inter(int irq, void *data, struct pt_regs *fp) { #if A2232_IOBUFLEN != 256 @@ -603,10 +599,7 @@ int ch, err, n, p; /* WakeUp if output buffer runs low */ if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { - if ((port->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && port->gs.tty->ldisc.write_wakeup){ - (port->gs.tty->ldisc.write_wakeup)(port->gs.tty); - } - wake_up_interruptible(&port->gs.tty->write_wait); + tty_wakeup(port->gs.tty); } } // if the port is used } // for every port on the board