public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: "open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] iio: proximity: pulsedlight v2: Tidy up an endian issue
Date: Fri, 18 Oct 2019 19:58:20 +0100	[thread overview]
Message-ID: <20191018195820.19037af4@archlinux> (raw)
In-Reply-To: <CAJCx=gnYkdwOOspqa_WynyPsDo8pLhPN3_5UNj6Z2bGWoxr_2A@mail.gmail.com>

On Sun, 13 Oct 2019 20:58:26 +0300
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sun, Oct 13, 2019 at 1:28 PM <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Sparse identified the following
> > CHECK   drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
> > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
> > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
> > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c:144:24: warning: cast to restricted __be16
> >
> > This cleans up by adding a local variable to hold the value whilst
> > it is __be16 before applying endian converstion into eventual destination.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>  
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Applied. Thanks,

Jonathan

> 
> > ---
> >  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > index 47af54f14756..5b369645ef49 100644
> > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > @@ -136,12 +136,13 @@ static inline int lidar_write_power(struct lidar_data *data, int val)
> >
> >  static int lidar_read_measurement(struct lidar_data *data, u16 *reg)
> >  {
> > +       __be16 value;
> >         int ret = data->xfer(data, LIDAR_REG_DATA_HBYTE |
> >                         (data->i2c_enabled ? LIDAR_REG_DATA_WORD_READ : 0),
> > -                       (u8 *) reg, 2);
> > +                       (u8 *) &value, 2);
> >
> >         if (!ret)
> > -               *reg = be16_to_cpu(*reg);
> > +               *reg = be16_to_cpu(value);
> >
> >         return ret;
> >  }
> > --
> > 2.23.0
> >  


      reply	other threads:[~2019-10-18 18:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-13 10:26 [PATCH] iio: proximity: pulsedlight v2: Tidy up an endian issue jic23
2019-10-13 17:58 ` Matt Ranostay
2019-10-18 18:58   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018195820.19037af4@archlinux \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox