LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Tirdea, Irina" <irina.tirdea@intel.com>
To: Hartmut Knaack <knaack.h@gmx.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Baluta, Daniel" <daniel.baluta@intel.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Jonathan Cameron <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"Tirdea, Irina" <irina.tirdea@intel.com>
Subject: RE: [PATCH v3 3/3] iio: add driver for Freescale MMA9553
Date: Wed, 8 Apr 2015 15:47:40 +0000	[thread overview]
Message-ID: <1F3AC3675D538145B1661F571FE1805F19A4E15F@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <1F3AC3675D538145B1661F571FE1805F19A4D5C1@irsmsx105.ger.corp.intel.com>



> -----Original Message-----
> From: linux-iio-owner@vger.kernel.org [mailto:linux-iio-owner@vger.kernel.org] On Behalf Of Tirdea, Irina
> Sent: 06 April, 2015 17:33
> To: Hartmut Knaack; Jonathan Cameron; linux-iio@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; Baluta, Daniel; Lars-Peter Clausen; Peter Meerwald
> Subject: RE: [PATCH v3 3/3] iio: add driver for Freescale MMA9553
> 
> 
> 
> > -----Original Message-----
> > From: Hartmut Knaack [mailto:knaack.h@gmx.de]
> > Sent: 05 April, 2015 2:18
> > To: Tirdea, Irina; Jonathan Cameron; linux-iio@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org; Baluta, Daniel; Lars-Peter Clausen; Peter Meerwald
> > Subject: Re: [PATCH v3 3/3] iio: add driver for Freescale MMA9553
> >
> > Irina Tirdea schrieb am 27.01.2015 um 19:41:
> > > Add support for Freescale MMA9553L Intelligent Pedometer Platform.
> > >
> > > The following functionalities are supported:
> > >  - step counter (counts the number of steps using a HW register)
> > >  - step detector (generates an iio event at every step the user takes)
> > >  - activity recognition (rest, walking, jogging, running)
> > >  - speed
> > >  - calories
> > >  - distance
> > >
<snip>
> > > +static int mma9553_read_activity_stepcnt(struct mma9553_data *data,
> > > +					 u8 *activity, u16 *stepcnt)
> > > +{
> > > +	u32 status_stepcnt;
> > > +	u16 status;
> > > +	int ret;
> > > +
> > > +	ret = mma9551_read_status_words(data->client, MMA9551_APPID_PEDOMETER,
> > > +					MMA9553_REG_STATUS, sizeof(u32),
> > > +					(u16 *) &status_stepcnt);
> > > +	if (ret < 0) {
> > > +		dev_err(&data->client->dev,
> > > +			"error reading status and stepcnt\n");
> > > +		return ret;
> > > +	}
> > > +
> >
> > I think this could be done a bit simpler by using u16 buf[2] instead of
> > status_stepcnt (making status obsolete). That's what it would boil down
> > to:
> > 	*activity = mma9553_get_bits(buf[0], MMA9553_MASK_STATUS_ACTIVITY);
> > 	*stepcnt = buf[1];
> >
> That does look more simple. Will change it accordingly.
This does not only look more simple, it actually fixes an endianness bug on big endian hosts.
Thanks for the suggestion!

Irina
<snip>

      reply	other threads:[~2015-04-08 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-27 18:41 [PATCH v3 0/3] Add MMA9553 driver & PM support for MMA9551 Irina Tirdea
2015-01-27 18:41 ` [PATCH v3 1/3] iio: core: Introduce IIO_CHAN_INFO_DEBOUNCE_COUNT and _TIME Irina Tirdea
2015-01-29 18:39   ` Jonathan Cameron
2015-01-27 18:41 ` [PATCH v3 2/3] iio: Documentation: Fix calibheight unit Irina Tirdea
2015-01-29 18:43   ` Jonathan Cameron
2015-01-27 18:41 ` [PATCH v3 3/3] iio: add driver for Freescale MMA9553 Irina Tirdea
2015-01-29 18:46   ` Jonathan Cameron
2015-04-04 23:17   ` Hartmut Knaack
2015-04-06 14:33     ` Tirdea, Irina
2015-04-08 15:47       ` Tirdea, Irina [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=1F3AC3675D538145B1661F571FE1805F19A4E15F@irsmsx105.ger.corp.intel.com \
    --to=irina.tirdea@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --subject='RE: [PATCH v3 3/3] iio: add driver for Freescale MMA9553' \
    /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

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).