From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Cox Subject: Re: [PATCH 1/1] iio: ak8975: Add Ak8975 magnetometer sensor Date: Thu, 2 Sep 2010 23:41:24 +0100 Message-ID: <20100902234124.584b9bf7@lxorguk.ukuu.org.uk> References: <1283463351-15816-1-git-send-email-achew@nvidia.com> <20100902231942.21375cc0@lxorguk.ukuu.org.uk> <643E69AA4436674C8F39DCC2C05F763816B85AD096@HQMAIL03.nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <643E69AA4436674C8F39DCC2C05F763816B85AD096@HQMAIL03.nvidia.com> Sender: linux-kernel-owner@vger.kernel.org To: Andrew Chew Cc: "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "linux-i2c@vger.kernel.org" , "akpm@linux-foundation.org" , "khali@linux-fr.org" , Laxman Dewangan List-Id: linux-i2c@vger.kernel.org On Thu, 2 Sep 2010 15:16:20 -0700 Andrew Chew wrote: > > > +static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode, > > store_mode, 0); > > > +static IIO_DEVICE_ATTR(magn_x_calibscale, S_IRUGO, > > show_calibscale, NULL, 0); > > > +static IIO_DEVICE_ATTR(magn_y_calibscale, S_IRUGO, > > show_calibscale, NULL, 1); > > > +static IIO_DEVICE_ATTR(magn_z_calibscale, S_IRUGO, > > show_calibscale, NULL, 2); > > > +static IIO_DEV_ATTR_MAGN_X(show_raw, AK8975_REG_HXL); > > > +static IIO_DEV_ATTR_MAGN_Y(show_raw, AK8975_REG_HYL); > > > +static IIO_DEV_ATTR_MAGN_Z(show_raw, AK8975_REG_HZL); > > > > This seems odd as an interface as it's raw when the maths to provide > > non-raw (and thus abstract and easy for user space) data is trivial > > enough to do in kernel > > IIO guys want to do normalization maths above the kernel-level magnetometer IIO layer. This interface came before me, so I'm just following current conventions. That will make a generic IIO <-> input bridge very hard to do right. I can see why IIO wants to do that but you need both if so and this also needs discussion.