lkml.org 
[lkml]   [2019]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short
On Sun, Jul 21, 2019 at 2:53 PM Hennie Muller <hm@bitlabs.co.za> wrote:

> cpu_to_be16 returns a __be16 value. This does not break anything
> but does cause sparse to generate unnecessary warnings.
>
> Signed-off-by: Hennie Muller <hm@bitlabs.co.za>
(...)

> - gbmsg->val = cpu_to_be16(dir << offset);
> - gbmsg->mask = cpu_to_be16(0x0001 << offset);
> + gbmsg->val = (__force u16)cpu_to_be16(dir << offset);
> + gbmsg->mask = (__force u16)cpu_to_be16(0x0001 << offset);

Ugh I don't understand this.

Arnd: you know this better than me: is this the right thing to do
to get rid of sparse warnings from the code?

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2019-08-05 11:12    [W:0.191 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site