[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <805637056.1640115.1554131118962@webmail.strato.com>
Date: Mon, 1 Apr 2019 17:05:18 +0200 (CEST)
From: Ulrich Hecht <uli@...nd.eu>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Ulrich Hecht <uli+renesas@...nd.eu>
Cc: Eugeniu Rosca <erosca@...adit-jv.com>,
Dirk Behme <dirk.behme@...bosch.com>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] serial: sh-sci: Fix HSCIF RX sampling point calculation
> On April 1, 2019 at 1:25 PM Geert Uytterhoeven <geert+renesas@...der.be> wrote:
>
>
> There are several issues with the formula used for calculating the
> deviation from the intended rate:
> 1. While min_err and last_stop are signed, srr and baud are unsigned.
> Hence the signed values are promoted to unsigned, which will lead
> to a bogus value of deviation if min_err is negative,
> 2. Srr is the register field value, which is one less than the actual
> sampling rate factor,
> 3. The divisions do not use rounding.
>
> Fix this by casting unsigned variables to int, adding one to srr, and
> using a single DIV_ROUND_CLOSEST().
>
> Fixes: 63ba1e00f178a448 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
Reviewed-by: Ulrich Hecht <uli+renesas@...nd.eu>
CU
Uli
Powered by blists - more mailing lists