[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVGE2_JZMy0MMt1FnwxqoxM92fFOrvCzMnfOOjWCVSZbg@mail.gmail.com>
Date: Mon, 16 Jul 2018 22:32:54 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: Niklas Söderlund
<niklas.soderlund+renesas@...natech.se>,
netdev <netdev@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH 3/3] ravb: fix byte order for TX descriptor tag field
lower bits
Hi Sergei,
On Mon, Jul 16, 2018 at 10:22 PM Sergei Shtylyov
<sergei.shtylyov@...entembedded.com> wrote:
> On 07/16/2018 10:52 PM, Sergei Shtylyov wrote:
> >> The wrong helper is used to swap the bytes when adding the lower bits of
> >> the TX descriptors tag field in the shared ds_tagl variable. The
> >> variable contains the DS[11:0] field and then the TAG[3:0] bits.
> >>
> >> The mistake was highlighted by the sparse warning:
> >>
> >> ravb_main.c:1622:31: left side has type restricted __le16
> >> ravb_main.c:1622:31: right side has type unsigned short
> >> ravb_main.c:1622:31: warning: invalid assignment: |=
> >> ravb_main.c:1622:34: warning: cast to restricted __le16
> >
> > Again, it's good that it's not a real bug! :-)
>
> Wait! It seems to be, according to your subject. I hope you understand that
Niklas' patch fixes the sparse warning.
> cpu_to_le16() and le16_to_cpu() do the same thing?
While they do the same thing, they don't take the same parameter types,
nor return the same types.
E.g. cpu_to_le16() takes a u16 and returns an __le16, le16_to_cpu() takes
an __le16, and returns a u16.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists