[PATCH 2/5] drivers: serial: jsm: Add the Classic board implementation

Greg KH gregkh at linuxfoundation.org
Thu Nov 6 19:18:08 UTC 2014


On Mon, Nov 03, 2014 at 07:52:38PM +0100, Konrad Zapalowicz wrote:
> This commit adds the Digi Classic board implementation to the
> staging/jsm driver.
> 
> The code here is taken from the staging/dgnc driver and modified to
> match the serial/jsm state. This work is mostly based on the changes
> that has been done to the code handling the Digi Neo cards with the
> inspiration coming from the diff between staging/dgnc and serial/jsm
> as well as the LKML history for the jsm_neo.c
> 
> The code compiles now and has no sparse and checkpatch errors or
> warnings.

The compiler does give me one warning for this file:

> +/*
> + * cls_param()
> + * Send any/all changes to the line to the UART.
> + */
> +static void cls_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;
> +	int i;
> +	unsigned int cflag;
> +
> +	bd = ch->ch_bd;
> +	if (!bd)
> +		return;
> +
> +	/*
> +	 * If baud rate is zero, flush queues, and set mval to drop DTR.
> +	 */
> +	if ((ch->ch_c_cflag & (CBAUD)) == 0) {
> +		ch->ch_r_head = 0;
> +		ch->ch_r_tail = 0;
> +		ch->ch_e_head = 0;
> +		ch->ch_e_tail = 0;
> +
> +		cls_flush_uart_write(ch);
> +		cls_flush_uart_read(ch);
> +
> +		/* The baudrate is B0 so all modem lines are to be dropped. */
> +		ch->ch_flags |= (CH_BAUD0);
> +		ch->ch_mostat &= ~(UART_MCR_RTS | UART_MCR_DTR);
> +		cls_assert_modem_signals(ch);
> +		return;
> +	}
> +
> +	static struct {
> +		unsigned int rate;
> +		unsigned int cflag;
> +	} baud_rates[] = {
> +		{ 921600, B921600 },
> +		{ 460800, B460800 },
> +		{ 230400, B230400 },
> +		{ 115200, B115200 },
> +		{  57600, B57600  },
> +		{  38400, B38400  },
> +		{  19200, B19200  },
> +		{   9600, B9600   },
> +		{   4800, B4800   },
> +		{   2400, B2400   },
> +		{   1200, B1200   },
> +		{    600, B600    },
> +		{    300, B300    },
> +		{    200, B200    },
> +		{    150, B150    },
> +		{    134, B134    },
> +		{    110, B110    },
> +		{     75, B75     },
> +		{     50, B50     },
> +	};

baud_rates needs to be up above the code, as gcc tells me:

drivers/tty/serial/jsm/jsm_cls.c: In function ‘cls_param’:
drivers/tty/serial/jsm/jsm_cls.c:701:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  static struct {
  ^

Can you fix that up and resend the series?  I've taken the first patch in this
series, as that is an easy one to accept, so no need to resend that one.

thanks,

greg k-h


More information about the devel mailing list