From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Bryan Wu <cooloney@kernel.org>
Cc: linux-kernel@vger.kernel.org, Oleksiy Kebkal <kebkal@gmail.com>,
Oleksiy Kebkal <lesha@evologics.de>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] [serial/core]: This patch leaves RTS alone when CRTSCTS is not set.
Date: Mon, 12 May 2008 12:18:39 +0100 [thread overview]
Message-ID: <20080512111839.GA15305@flint.arm.linux.org.uk> (raw)
In-Reply-To: <1210587614-10016-1-git-send-email-cooloney@kernel.org>
On Mon, May 12, 2008 at 06:20:14PM +0800, Bryan Wu wrote:
> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
> index eab0327..903360b 100644
> --- a/drivers/serial/serial_core.c
> +++ b/drivers/serial/serial_core.c
> @@ -179,11 +179,15 @@ static int uart_startup(struct uart_state *state, int init_hw)
> uart_change_speed(state, NULL);
>
> /*
> - * Setup the RTS and DTR signals once the
> - * port is open and ready to respond.
> + * 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)
We have access to termios->c_cflag here, please use that in preference
to testing info->flags.
> + uart_set_mctrl(port, TIOCM_RTS);
> + }
> }
>
> if (info->flags & UIF_CTS_FLOW) {
> @@ -224,10 +228,14 @@ static void uart_shutdown(struct uart_state *state)
> info->flags &= ~UIF_INITIALIZED;
>
> /*
> - * Turn off DTR and RTS early.
> + * Turn off DTR and RTS (in the case of hardware flow control)
> + * early.
> */
> - if (!info->tty || (info->tty->termios->c_cflag & HUPCL))
> - uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> + if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
> + uart_clear_mctrl(port, TIOCM_DTR);
> + if (info->flags & UIF_CTS_FLOW)
Ditto.
> + uart_clear_mctrl(port, TIOCM_RTS);
> + }
>
> /*
> * clear delta_msr_wait queue to avoid mem leaks: we may free
> @@ -1190,14 +1198,16 @@ static void uart_set_termios(struct tty_struct *tty,
> uart_change_speed(state, old_termios);
>
> /* Handle transition to B0 status */
> - if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
> - uart_clear_mctrl(state->port, TIOCM_RTS | TIOCM_DTR);
> + if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD)) {
> + uart_clear_mctrl(state->port, TIOCM_DTR);
> + if (state->info->flags & UIF_CTS_FLOW)
Ditto.
> + uart_clear_mctrl(state->port, TIOCM_RTS);
> + }
>
> /* Handle transition away from B0 status */
> if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
> unsigned int mask = TIOCM_DTR;
> - if (!(cflag & CRTSCTS) ||
> - !test_bit(TTY_THROTTLED, &tty->flags))
> + if (!test_bit(TTY_THROTTLED, &tty->flags))
> mask |= TIOCM_RTS;
This is inconsistent with your other changes - with your change, it will
always set RTS when switching away from B0 status.
> uart_set_mctrl(state->port, mask);
> }
> @@ -1441,10 +1451,14 @@ static void uart_update_termios(struct uart_state *state)
> uart_change_speed(state, NULL);
>
> /*
> - * And finally enable the RTS and DTR signals.
> + * And finally enable the RTS (in the of case hardware flow
> + * control) and DTR signals.
> */
> - if (tty->termios->c_cflag & CBAUD)
> - uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> + if (tty->termios->c_cflag & CBAUD) {
> + uart_set_mctrl(port, TIOCM_DTR);
> + if (state->info->flags & UIF_CTS_FLOW)
We have access to termios->c_cflag here, please use that in preference
to testing info->flags.
> + uart_set_mctrl(port, TIOCM_RTS);
> + }
> }
> }
>
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
prev parent reply other threads:[~2008-05-12 11:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 10:20 [PATCH 1/1] [serial/core]: This patch leaves RTS alone when CRTSCTS is not set Bryan Wu
2008-05-12 10:44 ` Alan Cox
2008-05-12 11:18 ` Russell King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080512111839.GA15305@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cooloney@kernel.org \
--cc=kebkal@gmail.com \
--cc=lesha@evologics.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox