[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180227052011.GB26781@1wt.eu>
Date: Tue, 27 Feb 2018 06:20:11 +0100
From: Willy Tarreau <w@....eu>
To: Robert Abel <rabel@...ertabel.eu>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands
On Tue, Feb 27, 2018 at 12:05:10AM +0100, Robert Abel wrote:
> Hi Miguel,
>
> On 26 Feb 2018 17:49, Miguel Ojeda wrote:
> > On Mon, Feb 26, 2018 at 12:54 AM, Robert Abel <rabel@...ertabel.eu> wrote:
> >> + /* clamp new x/y coordinates */
> >> + if (tmp_addr.x >= lcd->width)
> >> + tmp_addr.x = lcd->width - 1;
> >
> > tmp_addr.x = min(tmp_addr.x, lcd->width - 1);
>
> Had throught of that, too. However, it introduces a warning about type
> mismatch, because lcd->width is int while tmp_addr.x is unsigned long
> int. I didn't fell like saving a line warranted much bigger changes to
> the lcd struct.
The you can use min_t() :
tmp_addr.x = min_t(unsigned, tmp_addr.x, lcd->width - 1);
Willy
Powered by blists - more mailing lists