From: Dan Carpenter <dan.carpenter@oracle.com>
To: Josef Gajdusek <atx@atalax.net>
Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
gregkh@linuxfoundation.org, pmeerw@pmeerw.net,
linux-kernel@vger.kernel.org, jic23@kernel.org
Subject: Re: [PATCH v2 2/5] staging:iio:hmc5843: Split hmc5843.c to multiple files
Date: Tue, 8 Jul 2014 11:23:51 +0300 [thread overview]
Message-ID: <20140708082351.GE25880@mwanda> (raw)
In-Reply-To: <20140707203636.GD10383@dashie>
When you compare the old and new versions of hmc5843_read_raw() then it
appears there is a bug fix or something which hasn't been documentented
in the changelog.
> -static int hmc5843_read_raw(struct iio_dev *indio_dev,
> - struct iio_chan_spec const *chan,
> - int *val, int *val2, long mask)
> -{
> - struct hmc5843_data *data = iio_priv(indio_dev);
> - int rval;
> - int ret;
> -
> - switch (mask) {
> - case IIO_CHAN_INFO_RAW:
> - return hmc5843_read_measurement(data, chan->scan_index, val);
> - case IIO_CHAN_INFO_SCALE:
> - ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_B, &rval);
> - if (ret < 0)
> - return ret;
> - *val = 0;
> - *val2 = data->variant->regval_to_nanoscale[rval >> HMC5843_RANGE_GAIN_OFFSET];
> - return IIO_VAL_INT_PLUS_NANO;
> - case IIO_CHAN_INFO_SAMP_FREQ:
> - ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_A, &rval);
> - if (ret < 0)
> - return ret;
> - rval &= HMC5843_RATE_MASK;
^^^^^^^^^^^^^^^^^^^^^^^^^
HMC5843_RATE_MASK is 0x1c.
> - *val = data->variant->regval_to_samp_freq[rval][0];
> - *val2 = data->variant->regval_to_samp_freq[rval][1];
> - return IIO_VAL_INT_PLUS_MICRO;
> - }
> - return -EINVAL;
> -}
> +static int hmc5843_read_raw(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + int *val, int *val2, long mask)
> +{
> + struct hmc5843_data *data = iio_priv(indio_dev);
> + int rval;
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_RAW:
> + return hmc5843_read_measurement(data, chan->scan_index, val);
> + case IIO_CHAN_INFO_SCALE:
> + ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_B, &rval);
> + if (ret < 0)
> + return ret;
> + rval >>= HMC5843_RANGE_GAIN_OFFSET;
> + *val = 0;
> + *val2 = data->variant->regval_to_nanoscale[rval];
> + return IIO_VAL_INT_PLUS_NANO;
> + case IIO_CHAN_INFO_SAMP_FREQ:
> + ret = regmap_read(data->regmap, HMC5843_CONFIG_REG_A, &rval);
> + if (ret < 0)
> + return ret;
> + rval >>= HMC5843_RATE_OFFSET;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
HMC5843_RATE_OFFSET is 0x02.
> + *val = data->variant->regval_to_samp_freq[rval][0];
> + *val2 = data->variant->regval_to_samp_freq[rval][1];
> + return IIO_VAL_INT_PLUS_MICRO;
> + }
> + return -EINVAL;
> +}
Ideally this patch would be a straight move and no code changes.
regards,
dan carpenter
next prev parent reply other threads:[~2014-07-08 8:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 20:33 [PATCH v2 0/5] staging:iio:hmc5843: Few adjustments and support for hmc5983 Josef Gajdusek
2014-07-07 20:34 ` [PATCH v2 1/5] staging:iio:hmc5843: Added regmap support Josef Gajdusek
2014-07-07 20:36 ` [PATCH v2 2/5] staging:iio:hmc5843: Split hmc5843.c to multiple files Josef Gajdusek
2014-07-08 8:23 ` Dan Carpenter [this message]
2014-07-08 13:20 ` Josef Gajdusek
2014-07-07 20:37 ` [PATCH v2 3/5] staging:iio:hmc5843: register <-> value arrays now can have different lengths Josef Gajdusek
2014-07-07 20:37 ` [PATCH v2 4/5] staging:iio:hmc5843: Add support for i2c hmc5983 Josef Gajdusek
2014-07-07 20:38 ` [PATCH v2 5/5] staging:iio:hmc5843: Add support for spi hmc5983 Josef Gajdusek
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=20140708082351.GE25880@mwanda \
--to=dan.carpenter@oracle.com \
--cc=atx@atalax.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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;
as well as URLs for NNTP newsgroup(s).