linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
@ 2019-03-29  9:10 Geert Uytterhoeven
  2019-03-29  9:41 ` Ulrich Hecht
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-03-29  9:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht
  Cc: Eugeniu Rosca, Dirk Behme, linux-serial, linux-renesas-soc,
	Geert Uytterhoeven

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>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Hecht @ 2019-03-29  9:41 UTC (permalink / raw)
  To: Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht
  Cc: Eugeniu Rosca, Dirk Behme, linux-serial, linux-renesas-soc


> On March 29, 2019 at 10:10 AM Geert Uytterhoeven <geert+renesas@glider.be> 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>
> ---
>  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
>

Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>

CU
Uli

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
  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
  2019-04-01  6:06 ` Dirk Behme
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2019-03-29 10:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht, Eugeniu Rosca,
	Dirk Behme, linux-serial, linux-renesas-soc

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

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: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
  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
  2019-04-01  6:06 ` Dirk Behme
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2019-03-29 10:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht, Eugeniu Rosca,
	Dirk Behme, linux-serial, linux-renesas-soc

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment
  2019-03-29  9:10 [PATCH] serial: sh-sci: Fix HSCIF RX sampling point adjustment Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2019-03-29 10:42 ` Simon Horman
@ 2019-04-01  6:06 ` Dirk Behme
  3 siblings, 0 replies; 5+ messages in thread
From: Dirk Behme @ 2019-04-01  6:06 UTC (permalink / raw)
  To: Geert Uytterhoeven, Greg Kroah-Hartman, Jiri Slaby, Ulrich Hecht
  Cc: Eugeniu Rosca, linux-serial, linux-renesas-soc

On 29.03.2019 10:10, 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>

Acked-by: Dirk Behme <dirk.behme@de.bosch.com>

> ---
>   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;
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-01  6:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-04-01  6:06 ` Dirk Behme

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).