From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755057AbbBTP1r (ORCPT ); Fri, 20 Feb 2015 10:27:47 -0500 Received: from mga03.intel.com ([134.134.136.65]:57720 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755019AbbBTP1p (ORCPT ); Fri, 20 Feb 2015 10:27:45 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,615,1418112000"; d="scan'208";a="654855824" From: "Pandruvada, Srinivas" To: "pmeerw@pmeerw.net" CC: "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "Tirdea, Irina" , "jic23@kernel.org" , "Reus, Adriana" Subject: Re: [PATCH 2/2] iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler Thread-Topic: [PATCH 2/2] iio: accel: kxcjk-1013: optimize i2c transfers in trigger handler Thread-Index: AQHQShWFHRdFOESi7kCiRU0qJoA+DZz0LsiAgAXNUICAADFSgIAABvkAgAABGIA= Date: Fri, 20 Feb 2015 15:27:43 +0000 Message-ID: <1424446063.2916.17.camel@spandruv-mobl2> References: <1424110909-16878-1-git-send-email-irina.tirdea@intel.com> <1424110909-16878-3-git-send-email-irina.tirdea@intel.com> <1F3AC3675D538145B1661F571FE1805F19A20D9C@irsmsx105.ger.corp.intel.com> <1424444331.2916.2.camel@spandruv-mobl2> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.254.23.254] Content-Type: text/plain; charset="utf-8" Content-ID: <26B0673318775E4DA36BCCDAC016C8E8@intel.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t1KFRp6s002975 On Fri, 2015-02-20 at 16:23 +0100, Peter Meerwald wrote: > > > > > + > > > > > + 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 You are right. > > p. > ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥