Messages in this thread | | | Date | Wed, 30 Mar 2005 16:01:45 +0100 | From | Russell King <> | Subject | Re: [ patch 3/5] drivers/serial/jsm: new serial device driver |
| |
On Fri, Mar 11, 2005 at 05:34:18PM -0500, Wen Xiong wrote: > diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_neo.c linux-2.6.11.new/drivers/serial/jsm/jsm_neo.c > --- linux-2.6.11.org/drivers/serial/jsm/jsm_neo.c 1969-12-31 18:00:00.000000000 -0600 > +++ linux-2.6.11.new/drivers/serial/jsm/jsm_neo.c 2005-03-11 16:26:47.442988256 -0600 > +/* > + * neo_param() > + * Send any/all changes to the line to the UART. > + */ > +static void neo_param(struct jsm_channel *ch) > +{ > + u8 lcr = 0; > + u8 uart_lcr = 0; > + u8 ier = 0; > + u32 baud = 9600; > + int quot = 0; > + struct jsm_board *bd; > + > + bd = ch->ch_bd; > + if (!bd) > + return; > + > + /* > + * If baud rate is zero, flush queues, and set mval to drop DTR. > + */
The modem signal side of this is already handled for you.
> + const u64 bauds[4][16] = { > + { > + 0, 50, 75, 110, > + 134, 150, 200, 300, > + 600, 1200, 1800, 2400, > + 4800, 9600, 19200, 38400 }, > + { > + 0, 57600, 115200, 230400, > + 460800, 150, 200, 921600, > + 600, 1200, 1800, 2400, > + 4800, 9600, 19200, 38400 }, > + { > + 0, 57600, 76800, 115200, > + 131657, 153600, 230400, 460800, > + 921600, 1200, 1800, 2400, > + 4800, 9600, 19200, 38400 }, > + { > + 0, 57600, 115200, 230400, > + 460800, 150, 200, 921600, > + 600, 1200, 1800, 2400, > + 4800, 9600, 19200, 38400 } > + }; > + > + baud = C_BAUD(ch->uart_port.info->tty) & 0xff; > + > + if (ch->ch_c_cflag & CBAUDEX) > + iindex = 1;
This is buggy. You're making invalid assumptions about the given baud rate flags in the termios. Use the helper functions provided please.
-- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |