mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jochen Mades <jochen@mades.net>
To: Lukas Wunner <lukas@wunner.de>
Cc: gregkh@linuxfoundation.org, Russell King <linux@armlinux.org.uk>,
	Jiri Slaby <jirislaby@kernel.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Lino Sanfilippo <LinoSanfilippo@gmx.de>,
	Philipp Rosenberger <p.rosenberger@kunbus.com>
Subject: Re: [PATCH] Bugfix RTS line config in RS485 mode is overwritten in pl011_set_mctrl() function.
Date: Thu, 13 Jan 2022 11:12:12 +0100 (CET)	[thread overview]
Message-ID: <1489312180.3256431.1642068732902@webmail.strato.com> (raw)
In-Reply-To: <20220102100710.GA29858@wunner.de>

[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]

Hi Lukas,

> Patch is correct, but commit message could be improved:
> 
> * Subject should be in imperative mood (by convention), it should be
>   prepended by "serial: pl011: " (in line with previous commits touching
>   this driver, use "git log --oneline amba-pl011.c") and the trailing dot
>   is unnecessary, e.g.:
> 
>   "serial: pl011: Fix incorrect rs485 RTS polarity on set_mctrl"
> 
> * Commit message should be wrapped at 72 characters (so that it appears
>   centered when displayed with "git log" on an 80 chars terminal).
>   The reference to "0001-serial-amba-pl011-add-RS485-support.patch"
>   should be replaced with a reference to the offending commit, e.g.:
>
>   "Commit 8d479237727c ("serial: amba-pl011: add RS485 support") sought
>   to keep RTS deasserted on set_mctrl if rs485 is enabled.  However it
>   did so only if deasserted RTS polarity is high.  Fix it in case it's
>   low."
>
>   Feel free to copy this to a v2 of your patch and amend as you see fit.
> 

Find attached the patch with the new subject and corretced commit message.

> * Add tags for the offending commit:
> 
>   Fixes: 8d479237727c ("serial: amba-pl011: add RS485 support")
>   Cc: stable@vger.kernel.org # v5.15+
> 
> * Be sure to cc the author of the offending commit.

Sorry I don't know how to do that correctly. Can you please give support/hints?

 
> Thanks,
> 
> Lukas
> 
> > ---
> >  drivers/tty/serial/amba-pl011.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> > index 537f37ac4..1749c1498 100644
> > --- a/drivers/tty/serial/amba-pl011.c
> > +++ b/drivers/tty/serial/amba-pl011.c
> > @@ -1646,8 +1646,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
> >  	    container_of(port, struct uart_amba_port, port);
> >  	unsigned int cr;
> >  
> > -	if (port->rs485.flags & SER_RS485_ENABLED)
> > -		mctrl &= ~TIOCM_RTS;
> > +	if (port->rs485.flags & SER_RS485_ENABLED) {
> > +		if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
> > +			mctrl &= ~TIOCM_RTS;
> > +		else
> > +			mctrl |= TIOCM_RTS;
> > +	}
> >  
> >  	cr = pl011_read(uap, REG_CR);

[-- Attachment #2: 0001-serial-pl011-Fix-incorrect-rs485-RTS-polarity-on-set.patch --]
[-- Type: application/octet-stream, Size: 1210 bytes --]

From 90690b3e8afbdfbbb5ceb0f6cef40ed282b1c004 Mon Sep 17 00:00:00 2001
From: jmades <jochen@mades.net>
Date: Mon, 27 Dec 2021 08:37:26 +0000
Subject: [PATCH] serial: pl011: Fix incorrect rs485 RTS polarity on set_mctrl

Commit 8d479237727c ("serial: amba-pl011: add RS485 support") sought
to keep RTS deasserted on set_mctrl if rs485 is enabled. However it did
so only if deasserted RTS polarity is high. Fix it in case it's low.

Signed-off-by: jmades <jochen@mades.net>
---
 drivers/tty/serial/amba-pl011.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 537f37ac4..1749c1498 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1646,8 +1646,12 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
 	    container_of(port, struct uart_amba_port, port);
 	unsigned int cr;
 
-	if (port->rs485.flags & SER_RS485_ENABLED)
-		mctrl &= ~TIOCM_RTS;
+	if (port->rs485.flags & SER_RS485_ENABLED) {
+		if (port->rs485.flags & SER_RS485_RTS_AFTER_SEND)
+			mctrl &= ~TIOCM_RTS;
+		else
+			mctrl |= TIOCM_RTS;
+	}
 
 	cr = pl011_read(uap, REG_CR);
 
-- 
2.20.1


  parent reply	other threads:[~2022-01-13 10:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 17:15 jmades
2022-01-02 10:07 ` Lukas Wunner
2022-01-02 15:06   ` Lino Sanfilippo
2022-01-02 18:28     ` Lukas Wunner
2022-01-03 13:44       ` Lino Sanfilippo
2022-01-11 10:00       ` Jochen Mades
2022-01-12  1:41         ` Lino Sanfilippo
2022-01-13 10:12   ` Jochen Mades [this message]
2022-01-13 10:20     ` Greg KH
2022-01-23  4:32     ` Lukas Wunner

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=1489312180.3256431.1642068732902@webmail.strato.com \
    --to=jochen@mades.net \
    --cc=LinoSanfilippo@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lukas@wunner.de \
    --cc=p.rosenberger@kunbus.com \
    /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

all inboxes | Powered by JetHome®