Re: [PATCH 1/1] [serial/core]: This patch leaves RTS alone whenCRTSCTS is not set.

From: Alan Cox
Date: Mon May 12 2008 - 06:55:34 EST


> + * Setup the RTS (in the case of hardware flow control)
> + * and DTR signals once the port is open and ready to
> + * respond.
> */
> - if (info->tty->termios->c_cflag & CBAUD)
> - uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
> + if (info->tty->termios->c_cflag & CBAUD) {
> + uart_set_mctrl(port, TIOCM_DTR);
> + if (info->flags & UIF_CTS_FLOW)
> + uart_set_mctrl(port, TIOCM_RTS);
> + }

Seems fine but we've now got 5 line blocks of duplicated code - and code
we will need to complicate further in future if we add other flow control
systems.

statc void uart_set_flow_control(port, int onoff)
{
..
}

Would be worth writing and using for these cases

(Yes I am being fussy: I am currently trying to stamp out lots of code
duplication in the tty and serial layers so I don't want more added as it
is getting out of hand)

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/