From: Jonathan Cameron <jic23@cam.ac.uk>
To: "Datta, Shubhrajyoti" <shubhrajyoti@ti.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"sfking@fdwdc.com" <sfking@fdwdc.com>
Subject: Re: [RFC][PATCH]add Honeywell hmc5843 3-Axis Magnetometer (digital compass) driver.
Date: Thu, 01 Jul 2010 10:47:23 +0100 [thread overview]
Message-ID: <4C2C642B.8080702@cam.ac.uk> (raw)
In-Reply-To: <0680EC522D0CC943BC586913CF3768C003B360303F@dbde02.ent.ti.com>
On 07/01/10 07:40, Datta, Shubhrajyoti wrote:
>
> nitpick: move comment up to above the function.
>> + /* Return the measurement value from the specified channel */
>> + struct i2c_client *client = to_i2c_client(dev);
>> + s16 coordinate_val;
>> + struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
>> + s32 result;
> nitpick: New line after defs and before code.
>> + result = i2c_smbus_read_byte_data(client, HMC5843_STATUS_REG);
>> + while (!(result & DATA_READY))
>> + result = i2c_smbus_read_byte_data(client, HMC5843_STATUS_REG);
>> +
>> + result = i2c_smbus_read_word_data(client, this_attr->address);
>> + if (result > 0) {
> as coordinate_val is an s16 which not type cast to that?
>> + coordinate_val = (int)swab16((u16)result);
> curious line break below...
>> + return sprintf(buf, "%d\n",
>> + coordinate_val);
> So, this is a raw value? (e.g. it will need scaling in userspace)
>
>
> Would you prefer to convert in SI units and then report?
That depends on whether it is a linear conversion. If it is
linear the you can provide additional attributes to allow
userspace to rescale it. Either option is fine here.
Call it _input if in SI units or _raw if it is a value that needs
conversion.
Jonathan
>
>> + }
>> + return result;
>> +}
>
>
prev parent reply other threads:[~2010-07-01 9:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0680EC522D0CC943BC586913CF3768C003B3553F73@dbde02.ent.ti.com>
2010-06-30 18:24 ` [RFC][PATCH]add Honeywell hmc5843 3-Axis Magnetometer (digital compass) driver Datta, Shubhrajyoti
2010-06-30 19:52 ` Jonathan Cameron
2010-07-01 6:40 ` Datta, Shubhrajyoti
2010-07-01 9:47 ` Jonathan Cameron [this message]
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=4C2C642B.8080702@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=sfking@fdwdc.com \
--cc=shubhrajyoti@ti.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