From: Jonathan Cameron <jic23@cam.ac.uk>
To: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Cc: linux-iio@vger.kernel.org, Shubhrajyoti Datta <shubhrajyoti@ti.com>
Subject: Re: [PATCH 3/3] staging:iio:hmc5843 change ABI to comply with documentation
Date: Mon, 30 Aug 2010 15:58:22 +0100 [thread overview]
Message-ID: <4C7BC70E.6090901@cam.ac.uk> (raw)
In-Reply-To: <1283177032-7014-3-git-send-email-manuel.stahl@iis.fraunhofer.de>
This one would benefit from an ack from Shubhrajyoti Datta (cc'd)
It's his driver and whilst to my eye this looks fine it would
be good to have his input on the scale numbers.
If he doesn't reply for a bit send it on anyway ;) (as it is
fairly trivial)
I actually promised to fix this myself in the original review
but I'm happy you beat me to it ;)
One issue inline... Fix that and feel free to add my sign-off.
Thanks,
Jonathan
On 08/30/10 15:03, Manuel Stahl wrote:
> Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
> ---
> drivers/staging/iio/magnetometer/hmc5843.c | 32 ++++++++++++++--------------
> 1 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
> index 92f6c6f..66aab5a 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843.c
> @@ -95,15 +95,15 @@
> #define CONF_NOT_USED 0x03
> #define MEAS_CONF_MASK 0x03
>
> -static const int regval_to_counts_per_mg[] = {
> - 1620,
> - 1300,
> - 970,
> - 780,
> - 530,
> - 460,
> - 390,
> - 280
> +static const char *regval_to_scale[] = {
> + "0.0000006173",
> + "0.0000007692",
> + "0.0000010309",
> + "0.0000012821",
> + "0.0000018868",
> + "0.0000021739",
> + "0.0000025641",
> + "0.0000035714",
> };
> static const int regval_to_input_field_mg[] = {
> 700,
> @@ -322,7 +322,7 @@ static IIO_DEVICE_ATTR(meas_conf,
> * 6 | 50
> * 7 | Not used
> */
> -static IIO_CONST_ATTR_AVAIL_SAMP_FREQ("0.5 1 2 5 10 20 50");
> +static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("0.5 1 2 5 10 20 50");
>
> static s32 hmc5843_set_rate(struct i2c_client *client,
> u8 rate)
> @@ -459,17 +459,17 @@ static IIO_DEVICE_ATTR(magn_range,
> set_range,
> HMC5843_CONFIG_REG_B);
>
> -static ssize_t show_gain(struct device *dev,
> +static ssize_t show_scale(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> {
> struct iio_dev *indio_dev = dev_get_drvdata(dev);
> struct hmc5843_data *data = indio_dev->dev_data;
> - return sprintf(buf, "%d\n", regval_to_counts_per_mg[data->range]);
> + return strlen(strcpy(buf, regval_to_scale[data->range]));
That leaves us without a trailing "\n". Makes for messy use of cat ;)
Probably easier to use
return sprintf(buf, "%s\n", regval_to_scale[data->range]);
> }
> -static IIO_DEVICE_ATTR(magn_gain,
> +static IIO_DEVICE_ATTR(magn_scale,
> S_IRUGO,
> - show_gain,
> + show_scale,
> NULL , 0);
>
> static struct attribute *hmc5843_attributes[] = {
> @@ -477,11 +477,11 @@ static struct attribute *hmc5843_attributes[] = {
> &iio_dev_attr_operating_mode.dev_attr.attr,
> &iio_dev_attr_sampling_frequency.dev_attr.attr,
> &iio_dev_attr_magn_range.dev_attr.attr,
> - &iio_dev_attr_magn_gain.dev_attr.attr,
> + &iio_dev_attr_magn_scale.dev_attr.attr,
> &iio_dev_attr_magn_x_raw.dev_attr.attr,
> &iio_dev_attr_magn_y_raw.dev_attr.attr,
> &iio_dev_attr_magn_z_raw.dev_attr.attr,
> - &iio_const_attr_available_sampling_frequency.dev_attr.attr,
> + &iio_const_attr_sampling_frequency_available.dev_attr.attr,
> NULL
> };
>
next prev parent reply other threads:[~2010-08-30 14:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 8:57 [IIO] Cleanup userspace Manuel Stahl
[not found] ` <4C77AC01.3090204@cam.ac.uk>
[not found] ` <4C77B68B.4060805@iis.fraunhofer.de>
2010-08-27 14:24 ` Jonathan Cameron
2010-08-27 14:31 ` Manuel Stahl
2010-08-27 15:09 ` Jonathan Cameron
2010-08-30 10:55 ` [PATCH 1/2] staging:iio rename ring attributes Manuel Stahl
2010-08-30 12:28 ` Jonathan Cameron
2010-08-30 10:55 ` [PATCH 2/2] staging:iio move scan_elements into ring buffer Manuel Stahl
2010-08-30 12:58 ` Jonathan Cameron
2010-08-30 13:37 ` Manuel Stahl
2010-08-30 14:09 ` Jonathan Cameron
[not found] ` <4C7BD886.3060109@cam.ac.uk>
2010-08-30 16:31 ` Manuel Stahl
2010-08-30 16:48 ` Jonathan Cameron
2010-08-30 14:03 ` [PATCH 1/3] staging:iio update documentation Manuel Stahl
2010-08-30 14:23 ` Jonathan Cameron
2010-08-30 14:24 ` Manuel Stahl
2010-08-30 14:49 ` Jonathan Cameron
2010-08-30 14:03 ` [PATCH 2/3] staging:iio sync drivers with current ABI Manuel Stahl
2010-08-30 14:44 ` Jonathan Cameron
2010-08-30 15:00 ` Manuel Stahl
2010-08-30 15:42 ` Jonathan Cameron
2010-08-30 15:48 ` Manuel Stahl
2010-08-30 16:07 ` Jonathan Cameron
2010-08-30 16:28 ` Manuel Stahl
2010-08-30 16:43 ` Jonathan Cameron
2010-08-30 14:03 ` [PATCH 3/3] staging:iio:hmc5843 change ABI to comply with documentation Manuel Stahl
2010-08-30 14:58 ` Jonathan Cameron [this message]
2010-08-31 12:16 ` Datta, Shubhrajyoti
2010-09-04 17:26 ` [IIO] Cleanup userspace Jonathan Cameron
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=4C7BC70E.6090901@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=manuel.stahl@iis.fraunhofer.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.