Return-Path: Message-ID: <4C7BD2B0.20508@iis.fraunhofer.de> Date: Mon, 30 Aug 2010 17:48:00 +0200 From: Manuel Stahl MIME-Version: 1.0 To: Jonathan Cameron CC: linux-iio@vger.kernel.org Subject: Re: [PATCH 2/3] staging:iio sync drivers with current ABI References: <1283165728-2231-2-git-send-email-manuel.stahl@iis.fraunhofer.de> <1283177032-7014-2-git-send-email-manuel.stahl@iis.fraunhofer.de> <4C7BC3C2.8090104@cam.ac.uk> <4C7BC78D.7030109@iis.fraunhofer.de> <4C7BD157.8020003@cam.ac.uk> In-Reply-To: <4C7BD157.8020003@cam.ac.uk> Content-Type: multipart/mixed; boundary="------------080402030004020808050306" List-ID: This is a multi-part message in MIME format. --------------080402030004020808050306 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by iis.fhg.de id RAA11126 Am 30.08.2010 17:42, schrieb Jonathan Cameron: > On 08/30/10 16:00, Manuel Stahl wrote: >> Am 30.08.2010 16:44, schrieb Jonathan Cameron: >>> On 08/30/10 15:03, Manuel Stahl wrote: >>> >>> Youch, I hadn't registered just how far away this lot were from the a= bi. >>> Thanks for doing this. >>> >>> I sometimes wonder if it would be better to loose all the macros and = move >>> over to abi doc based enforcement (like hwmon does). What do people = think? >>> As can be seen in this patch, it makes very little difference in the = length of >>> code. Disadvantage is that it does add a review burden. >> >> I think we should keep the macros. Then we can simply search for >> IIO_DEVICE_ATTR and IIO_CONST_ATTR in the drivers, as these are >> suspicious for declaring proprietary attributes. When the well known >> macros change they produce compile errors. Also good for finding >> broken drivers. > A good point. As a general rule, lets say we don't introduce new ones = into the > headers until either: > > 1) There are two drivers using them and they are something we are sure = will stay in drivers > (I'm still unconvinced by the reset attribute in many of Analog's d= rivers) I think this is the case for supply, so we could add a macro for this one. > 2) They are obviously general elements. e.g. when we had the first mag= netometer we > introduced the magn parameters. Let has also start being militant = about the necessity to > also document any new ones. Either the first user updates the docs= or someone else has > to within a few days... I'll do them when I think pestering people = about it will delay > an otherwise good driver. Good point. >>>> static IIO_DEV_ATTR_ACCEL_X(adis16300_read_14bit_signed, >>>> ADIS16300_XACCL_OUT); >>>> @@ -532,17 +537,17 @@ static IIO_DEV_ATTR_ACCEL_Y(adis16300_read_14b= it_signed, >>>> ADIS16300_YACCL_OUT); >>>> static IIO_DEV_ATTR_ACCEL_Z(adis16300_read_14bit_signed, >>>> ADIS16300_ZACCL_OUT); >>>> -static IIO_CONST_ATTR(accel_scale, "0.0006 g"); >>>> +static IIO_CONST_ATTR_ACCEL_SCALE("0.0006 g"); >>> Abi says that units should be m/s^2. Also we shouldn't have units >>> in the attributes. I've been meaning to clear them out. They >>> just make userspace code more complex for no gain. >> >> Ups, you're right with m/s^2, nevertheless is worth an extra patch. Su= re, the units don't need to be there, but parsing is the same with or wit= hout (scanf just ignores the chars). > Cool. Can I leave this one to you? Ok, guess I also introduced the mess here. >>>> static IIO_DEV_ATTR_INCLI_X(adis16300_read_13bit_signed, >>>> ADIS16300_XINCLI_OUT); >>>> static IIO_DEV_ATTR_INCLI_Y(adis16300_read_13bit_signed, >>>> ADIS16300_YINCLI_OUT); >>>> -static IIO_CONST_ATTR(incli_scale, "0.044 d"); >>>> +static IIO_CONST_ATTR_INCLI_SCALE("0.044 deg"); >>>> >>>> static IIO_DEV_ATTR_TEMP_RAW(adis16300_read_12bit_unsigned); >>>> -static IIO_CONST_ATTR(temp_offset, "198.16 K"); >>>> -static IIO_CONST_ATTR(temp_scale, "0.14 K"); >>>> +static IIO_CONST_ATTR_TEMP_OFFSET("198.16 K"); >>>> +static IIO_CONST_ATTR_TEMP_SCALE("0.14 K"); >>> These need to be suitable for conversion to milli degrees C to match >>> hwmon. >> I think scientific devices should stick to SI units. > I'd normally agree, but hwmon beat us in defining the interface and I > agree with Greg and Andrew Morton that the kernel is gaining too many > incompatible interfaces. Hence for temp we follow them. Same ought > to be true for in[m] and current measurements. Guess I'll do an audit > of this sometime soon and make sure they are all the same. We already have a major difference here, that is we allow floating point=20 values as output. Also we have no _input postfix, which, I agree, should=20 be compatible if it was there. Hwmon is tuned to fixed point values, but=20 that it too limited for the range of devices we want to address with=20 IIO. They simply don't care if they loose some bit of precision. Regards, --=20 Dipl.-Inf. Manuel Stahl Fraunhofer-Institut f=FCr Integrierte Schaltungen IIS - Leistungsoptimierte Systeme - Nordostpark 93 Telefon +49 (0)911/58061-6419 90411 N=FCrnberg Fax +49 (0)911/58061-6398 http://www.iis.fraunhofer.de manuel.stahl@iis.fraunhofer.de --------------080402030004020808050306 Content-Type: text/x-vcard; charset=utf-8; name="manuel_stahl.vcf" Content-Disposition: attachment; filename="manuel_stahl.vcf" Content-Transfer-Encoding: quoted-printable begin:vcard fn:Manuel Stahl n:Stahl;Manuel email;internet:manuel.stahl@iis.fraunhofer.de tel;work:+49 911 58061-6419 x-mozilla-html:FALSE version:2.1 end:vcard --------------080402030004020808050306--