linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Ulrich Hecht <ulrich.hecht+renesas@gmail.com>,
	Eugeniu Rosca <erosca@de.adit-jv.com>,
	Dirk Behme <dirk.behme@de.bosch.com>,
	linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
Date: Fri, 29 Mar 2019 11:42:04 +0100	[thread overview]
Message-ID: <20190329104204.vw72ltile6a725kn@verge.net.au> (raw)
In-Reply-To: <20190329091026.18958-1-geert+renesas@glider.be>

On Fri, Mar 29, 2019 at 10:10:26AM +0100, Geert Uytterhoeven wrote:
> The calculation of the sampling point has min() and max() exchanged.
> Fix this by using the clamp() helper instead.
> 
> Fixes: 63ba1e00f178a448 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

> ---
>  drivers/tty/serial/sh-sci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 060fcd42b6d56010..2bdaeba5d527a6ce 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -2529,7 +2529,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
>  				 * last stop bit; we can increase the error
>  				 * margin by shifting the sampling point.
>  				 */
> -				int shift = min(-8, max(7, deviation / 2));
> +				int shift = clamp(deviation / 2, -8, 7);
>  
>  				hssrr |= (shift << HSCIF_SRHP_SHIFT) &
>  					 HSCIF_SRHP_MASK;
> -- 
> 2.17.1
> 

  parent reply	other threads:[~2019-03-29 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29  9:10 [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment Geert Uytterhoeven
2019-03-29  9:41 ` Ulrich Hecht
2019-03-29 10:06 ` Wolfram Sang
2019-03-29 10:42 ` Simon Horman [this message]
2019-04-01  6:06 ` Dirk Behme

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=20190329104204.vw72ltile6a725kn@verge.net.au \
    --to=horms@verge.net.au \
    --cc=dirk.behme@de.bosch.com \
    --cc=erosca@de.adit-jv.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=ulrich.hecht+renesas@gmail.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;
as well as URLs for NNTP newsgroup(s).