linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alison Schofield <amsfield22@gmail.com>
To: sayli karnik <karniksayli1995@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	outreachy-kernel@googlegroups.com,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org
Subject: Re: [Outreachy kernel] [PATCH] iio: imu: bmi160: bmi160_core: Fix sparse warning
Date: Mon, 3 Oct 2016 10:16:02 -0700	[thread overview]
Message-ID: <20161003171601.GC3132@d830.WORKGROUP> (raw)
In-Reply-To: <CAKG5xWi6M5jemARfENuVgigaqUbvdJmeVbwpR3kWDM9d8LBW-w@mail.gmail.com>

On Mon, Oct 03, 2016 at 07:07:39PM +0530, sayli karnik wrote:
> On Mon, Oct 3, 2016 at 4:55 AM, Alison Schofield <amsfield22@gmail.com> wrote:
> > On Sun, Oct 02, 2016 at 05:53:08PM +0200, Lars-Peter Clausen wrote:
> >> On 10/02/2016 07:00 AM, Alison Schofield wrote:
> >> [...]
> >> >> ---
> >> >>  drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
> >> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >> >>
> >> >> diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
> >> >> index e0251b8..5355507 100644
> >> >> --- a/drivers/iio/imu/bmi160/bmi160_core.c
> >> >> +++ b/drivers/iio/imu/bmi160/bmi160_core.c
> >> >> @@ -398,7 +398,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
> >> >>    struct iio_poll_func *pf = p;
> >> >>    struct iio_dev *indio_dev = pf->indio_dev;
> >> >>    struct bmi160_data *data = iio_priv(indio_dev);
> >> >> -  s16 buf[16]; /* 3 sens x 3 axis x s16 + 3 x s16 pad + 4 x s16 tstamp */
> >> >> +  __le16 buf[16];
> >> >> +  /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */
> >> >>    int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
> >> >>    __le16 sample;
> >> >
> >> > Wondering about this option below.  Data was read into an __le16, so that
> >> > was good diligence on drivers part.  Seems we can use le16_to_cpu() for the
> >> > conversion into the buf.
> >> >
> >> > --- a/drivers/iio/imu/bmi160/bmi160_core.c
> >> > +++ b/drivers/iio/imu/bmi160/bmi160_core.c
> >> > @@ -408,7 +408,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
> >> >                                    &sample, sizeof(__le16));
> >> >             if (ret < 0)
> >> >                     goto done;
> >> > -           buf[j++] = sample;
> >> > +           buf[j++] = le16_to_cpu(sample);
> >> >     }
> >>
> >> This conversion is usually skipped on purpose and delayed until it is
> >> actually needed by the user. The IIO channel is accordingly marked that it
> >> will produce LE data.
> > Thanks Lars.  I knew that for buffers, overlooked it, now I'll know it
> > better!
> >
> > So, Sayli, you probably got this from the analysis of the last patch.
> > In buffered mode, we'll go ahead and return the data in it's 'native'
> > order.  So, my suggestion to convert it here, is wrong.  Ignore ;)
> >
> Oh I see! So should I resend the patch with an updated
> description?(cosmetic/bug fix)

Yes.  In the commit message, you can leave out the subdirs (imu: bmc160:)
so that you have more space for a descriptive message of the change.
alisons

> 
> thanks,
> sayli
> 
> > alisons
> >
> >>

  reply	other threads:[~2016-10-03 17:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161001110418.GA25515@sayli-HP-15-Notebook-PC>
2016-10-02  5:00 ` [Outreachy kernel] [PATCH] iio: imu: bmi160: bmi160_core: Fix sparse warning Alison Schofield
2016-10-02 15:53   ` Lars-Peter Clausen
2016-10-02 23:25     ` Alison Schofield
2016-10-03 13:37       ` sayli karnik
2016-10-03 17:16         ` Alison Schofield [this message]
     [not found]           ` <CAKG5xWj7RSTpeGcnJtA-2PJk5NVFO_2DV-Fgo938wAafvhS8PA@mail.gmail.com>
2016-10-04 23:47             ` Alison Schofield
2016-10-05 18:00               ` sayli karnik
2016-10-09  7:43                 ` Jonathan Cameron
2016-10-10 22:50                   ` sayli karnik
2016-10-11 11:17                     ` Daniel Baluta

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=20161003171601.GC3132@d830.WORKGROUP \
    --to=amsfield22@gmail.com \
    --cc=jic23@kernel.org \
    --cc=karniksayli1995@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).