mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Meerwald <pmeerw@pmeerw.net>
To: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
Cc: "Tirdea, Irina" <irina.tirdea@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jic23@kernel.org" <jic23@kernel.org>,
	"Reus, Adriana" <adriana.reus@intel.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 2/2] iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler
Date: Fri, 20 Feb 2015 16:23:48 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1502201621430.2739@pmeerw.net> (raw)
In-Reply-To: <1424444331.2916.2.camel@spandruv-mobl2>


> > > > +
> > > > +		values[i] = data & 0xFF;
> > > > +		values[i+1] = data >> 8;
> > > 
> > > this is incorrect; it forces the data to be little endian, however, the
> > > endianness (as specified in the driver's .scan_type) is IIO_CPU -- the
> > > code breaks for big-endian CPUs
> > > 
> > > since _read_i2c_block_data() can't do endianness conversion (and the chip
> > > does i2c endianness, i.e. little-endian), the .scan_type should become
> > > IIO_LE and above code is correct again but still ugly :)
> > > 
> > > bottom line: change .scan_type to IIO_LE
> > > 
> > Good point. Changing the endianess to IIO_LE is correct for either kxcjk1013_read_block_data or i2c_smbus_read_i2c_block_data.
> > Will fix this in the next version. Thanks for catching this!
> > 
> I don't think changing to IIO_LE is good idea as when i2c_read_bock..
> then the scan type will be CPU. So better to fix endianness in this
> function.

the chip has little-endian data registers; i2c_read_block() just transfers 
the data (no endianness conversion), so the data will still be 
little-endian

p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)

  reply	other threads:[~2015-02-20 15:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 18:21 [PATCH 0/2] kxcjk-1013 driver optimizations Irina Tirdea
2015-02-16 18:21 ` [PATCH 1/2] iio: accel: kxcjk-1013: use available_scan_masks Irina Tirdea
2015-02-16 18:21 ` [PATCH 2/2] iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler Irina Tirdea
2015-02-16 19:26   ` Peter Meerwald
2015-02-20 12:02     ` Tirdea, Irina
2015-02-20 14:58       ` Pandruvada, Srinivas
2015-02-20 15:23         ` Peter Meerwald [this message]
2015-02-20 15:27           ` Pandruvada, Srinivas
2015-02-21 18:29       ` Jonathan Cameron
2015-02-24 17:25         ` Tirdea, Irina
2015-02-16 19:14 ` [PATCH 0/2] kxcjk-1013 driver optimizations Peter Meerwald
2015-02-20 12:03   ` Tirdea, Irina
2015-02-21 18:26     ` Jonathan Cameron
2015-02-24 17:22       ` Tirdea, Irina

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=alpine.DEB.2.02.1502201621430.2739@pmeerw.net \
    --to=pmeerw@pmeerw.net \
    --cc=adriana.reus@intel.com \
    --cc=irina.tirdea@intel.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@intel.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

all inboxes | Powered by JetHome®