Messages in this thread | | | Date | Mon, 12 May 2008 11:44:07 +0100 | From | Alan Cox <> | Subject | Re: [PATCH 1/1] [serial/core]: This patch leaves RTS alone when CRTSCTS is not set. |
| |
> + * 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
| |