lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1F3AC3675D538145B1661F571FE1805F19A4E15F@irsmsx105.ger.corp.intel.com>
Date:	Wed, 8 Apr 2015 15:47:40 +0000
From:	"Tirdea, Irina" <irina.tirdea@...el.com>
To:	Hartmut Knaack <knaack.h@....de>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Baluta, Daniel" <daniel.baluta@...el.com>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Peter Meerwald <pmeerw@...erw.net>,
	Jonathan Cameron <jic23@...nel.org>,
	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
	"Tirdea, Irina" <irina.tirdea@...el.com>
Subject: RE: [PATCH v3 3/3] iio: add driver for Freescale MMA9553



> -----Original Message-----
> From: linux-iio-owner@...r.kernel.org [mailto:linux-iio-owner@...r.kernel.org] On Behalf Of Tirdea, Irina
> Sent: 06 April, 2015 17:33
> To: Hartmut Knaack; Jonathan Cameron; linux-iio@...r.kernel.org
> Cc: linux-kernel@...r.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@....de]
> > Sent: 05 April, 2015 2:18
> > To: Tirdea, Irina; Jonathan Cameron; linux-iio@...r.kernel.org
> > Cc: linux-kernel@...r.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>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ