linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de, jic23@kernel.org,
	marek.belisko@gmail.com, shubhrajyoti@ti.com
Subject: Re: [PATCH 1/9] iio: fix access to hmc5843 private data
Date: Tue, 15 May 2012 09:29:02 +0100	[thread overview]
Message-ID: <4FB213CE.3040202@cam.ac.uk> (raw)
In-Reply-To: <1337034454-29717-2-git-send-email-pmeerw@pmeerw.net>

On 5/14/2012 11:27 PM, Peter Meerwald wrote:
> From: Peter Meerwald<p.meerwald@bct-electronic.com>
>
> i2c_get_clientdata(client) points to iio_dev, not hmc5843_data; fixes
> issue similar to 62d2feb9803f18c4e3c8a1a2c7e30a54df8a1d72
>
> Signed-off-by: Peter Meerwald<pmeerw@pmeerw.net>
> Acked-by: Shubhrajyoti D<shubhrajyoti@ti.com>
I acked this last time as well... Though as you've made me look at it
again, trivial nitpick below ;)
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
>   drivers/staging/iio/magnetometer/hmc5843.c |   14 +++++++++-----
>   1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
> index 3ec6518..9725cf8 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843.c
> @@ -250,7 +250,8 @@ static IIO_DEVICE_ATTR(operating_mode,
>   static s32 hmc5843_set_meas_conf(struct i2c_client *client,
>   				      u8 meas_conf)
>   {
> -	struct hmc5843_data *data = i2c_get_clientdata(client);
> +	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +	struct hmc5843_data *data = iio_priv(indio_dev);
>   	u8 reg_val;
>   	reg_val = (meas_conf&  MEAS_CONF_MASK) |  (data->rate<<  RATE_OFFSET);
>   	return i2c_smbus_write_byte_data(client, HMC5843_CONFIG_REG_A, reg_val);
> @@ -272,7 +273,7 @@ static ssize_t hmc5843_set_measurement_configuration(struct device *dev,
>   {
>   	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>   	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
> -	struct hmc5843_data *data = i2c_get_clientdata(client);
> +	struct hmc5843_data *data = iio_priv(indio_dev);
>   	unsigned long meas_conf = 0;
>   	int error = strict_strtoul(buf, 10,&meas_conf);
>   	if (error)
> @@ -314,7 +315,8 @@ 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)
>   {
> -	struct hmc5843_data *data = i2c_get_clientdata(client);
> +	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +	struct hmc5843_data *data = iio_priv(indio_dev);
>   	u8 reg_val;
>
>   	reg_val = (data->meas_conf) |  (rate<<  RATE_OFFSET);
> @@ -600,8 +602,10 @@ static int hmc5843_suspend(struct device *dev)
>
>   static int hmc5843_resume(struct device *dev)
>   {
> -	struct hmc5843_data *data = i2c_get_clientdata(to_i2c_client(dev));
> -	hmc5843_configure(to_i2c_client(dev), data->operating_mode);
> +	struct i2c_client *client = to_i2c_client(dev);
> +	struct iio_dev *indio_dev = i2c_get_clientdata(client);
> +	struct hmc5843_data *data = iio_priv(indio_dev);
ideally blank line here.
> +	hmc5843_configure(client, data->operating_mode);
and here.
>   	return 0;
>   }
>


  reply	other threads:[~2012-05-15  8:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 22:27 iio: v3, add support for HMC5883/HMC5883L to HMC5843 driver Peter Meerwald
2012-05-14 22:27 ` [PATCH 1/9] iio: fix access to hmc5843 private data Peter Meerwald
2012-05-15  8:29   ` Jonathan Cameron [this message]
2012-05-14 22:27 ` [PATCH 2/9] iio: change strict_strtoul() to kstrtoul() in hmc5843 Peter Meerwald
2012-05-14 22:27 ` [PATCH 3/9] iio: rename and prefix CONSTANTs to distinguish between HMC5843 and HMC5883 Peter Meerwald
2012-05-14 22:27 ` [PATCH 4/9] iio: rework sampling rate setting in hmc5843 Peter Meerwald
2012-05-14 22:27 ` [PATCH 5/9] iio: add check for measurement configuration value passed to hmc5843 Peter Meerwald
2012-05-14 22:27 ` [PATCH 6/9] iio: cleanup and move comments in hmc5843 Peter Meerwald
2012-05-14 22:27 ` [PATCH 7/9] iio: rename function/data to consistently start with hmc5843_ Peter Meerwald
2012-05-14 22:27 ` [PATCH 8/9] iio: reorganize hmc5843_set_rate() Peter Meerwald
2012-05-15  8:39   ` Jonathan Cameron
2012-05-14 22:27 ` [PATCH 9/9] iio: add support for hmc5883/hmc5883l to hmc5843 magnetometer driver Peter Meerwald
2012-05-15 12:03   ` Jonathan Cameron
2012-05-15 15:30     ` Peter Meerwald
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16 16:22 iio, add support for HMC5883/HMC5883L to HMC5843 driver Peter Meerwald
2012-05-16 16:22 ` [PATCH 1/9] iio: fix access to hmc5843 private data Peter Meerwald

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=4FB213CE.3040202@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=marek.belisko@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --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;
as well as URLs for NNTP newsgroup(s).