Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1680511

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu

From Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu
Date 2017-07-03 19:20 +0200
Message-ID <tZdaW-4tv-17@gated-at.bofh.it> (permalink)
References <tYwIG-7BU-25@gated-at.bofh.it> <tZ9K2-27f-31@gated-at.bofh.it> <tZcye-40A-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

On Mon, Jul 03, 2017 at 07:37:59PM +0300, Andy Shevchenko wrote:
> On Mon, Jul 3, 2017 at 4:36 PM, Sebastian Reichel
> <sebastian.reichel@collabora.co.uk> wrote:
> > On Sat, Jul 01, 2017 at 09:28:10PM +0200, Julia Lawall wrote:
> 
> >  * drivers/gpio/gpio-pca953x.c (line 190-192)
> 
> It has double conversion there:
> 1. LE CPU: Read as LE and converted to LE (no-op), so, just u16
> 2. BE CPU: Read as BE and converted to LE, makes it __le16
> 
> Looks like the conversion is not needed, only get_unaligned() is necessary.
>
> P.S. What about lines 244-245 there? I think they are no-op.
> Interesting that those two parts were added in quite different
> commits.

val[0] = (u16)ret & 0xFF;
val[1] = (u16)ret >> 8;

looks like cpu_to_be16()?

-- Sebastian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-07-03 15:40 +0200
  Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-03 18:40 +0200
    Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-07-03 19:20 +0200
      Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-03 19:40 +0200
        Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Sebastian Reichel <sebastian.reichel@collabora.co.uk> - 2017-07-03 20:30 +0200
          Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Julia Lawall <julia.lawall@lip6.fr> - 2017-07-04 11:20 +0200
            Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-04 12:00 +0200
              Re: [PATCH] coccinelle: api: detect unnecessary le16_to_cpu Julia Lawall <julia.lawall@lip6.fr> - 2017-07-04 12:00 +0200

csiph-web