linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 21/24] staging:iio:magnetometer: Use dev_to_iio_dev()
Date: Fri, 11 May 2012 14:58:44 +0200	[thread overview]
Message-ID: <1336741127-29552-21-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1336741127-29552-1-git-send-email-lars@metafoo.de>

Replace open-coded instances of getting a iio_dev struct from a device struct
with dev_to_iio_dev().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/magnetometer/ak8975.c  |    4 ++--
 drivers/staging/iio/magnetometer/hmc5843.c |   16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c
index 93026c5..5834e4a 100644
--- a/drivers/staging/iio/magnetometer/ak8975.c
+++ b/drivers/staging/iio/magnetometer/ak8975.c
@@ -242,7 +242,7 @@ static int ak8975_setup(struct i2c_client *client)
 static ssize_t show_mode(struct device *dev, struct device_attribute *devattr,
 			 char *buf)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ak8975_data *data = iio_priv(indio_dev);
 
 	return sprintf(buf, "%u\n", data->mode);
@@ -255,7 +255,7 @@ static ssize_t show_mode(struct device *dev, struct device_attribute *devattr,
 static ssize_t store_mode(struct device *dev, struct device_attribute *devattr,
 			  const char *buf, size_t count)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct ak8975_data *data = iio_priv(indio_dev);
 	struct i2c_client *client = data->client;
 	bool value;
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index 3ec6518..e3e65ea 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -184,7 +184,7 @@ static ssize_t hmc5843_show_operating_mode(struct device *dev,
 					struct device_attribute *attr,
 					char *buf)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct hmc5843_data *data = iio_priv(indio_dev);
 	return sprintf(buf, "%d\n", data->operating_mode);
 }
@@ -194,7 +194,7 @@ static ssize_t hmc5843_set_operating_mode(struct device *dev,
 				const char *buf,
 				size_t count)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
 	struct hmc5843_data *data = iio_priv(indio_dev);
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
@@ -260,7 +260,7 @@ static ssize_t hmc5843_show_measurement_configuration(struct device *dev,
 						struct device_attribute *attr,
 						char *buf)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct hmc5843_data *data = iio_priv(indio_dev);
 	return sprintf(buf, "%d\n", data->meas_conf);
 }
@@ -270,7 +270,7 @@ static ssize_t hmc5843_set_measurement_configuration(struct device *dev,
 						const char *buf,
 						size_t count)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
 	struct hmc5843_data *data = i2c_get_clientdata(client);
 	unsigned long meas_conf = 0;
@@ -331,7 +331,7 @@ static ssize_t set_sampling_frequency(struct device *dev,
 					const char *buf, size_t count)
 {
 
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
 	struct hmc5843_data *data = iio_priv(indio_dev);
 	unsigned long rate = 0;
@@ -369,7 +369,7 @@ exit:
 static ssize_t show_sampling_frequency(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
 	s32 rate;
@@ -404,7 +404,7 @@ static ssize_t show_range(struct device *dev,
 				char *buf)
 {
 	u8 range;
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct hmc5843_data *data = iio_priv(indio_dev);
 
 	range = data->range;
@@ -416,7 +416,7 @@ static ssize_t set_range(struct device *dev,
 			const char *buf,
 			size_t count)
 {
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
 	struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
 	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
 	struct hmc5843_data *data = iio_priv(indio_dev);
-- 
1.7.10

  parent reply	other threads:[~2012-05-11 12:58 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 12:58 [PATCH 01/24] iio: Add dev_to_iio_dev() helper function Lars-Peter Clausen
2012-05-11 12:58 ` [PATCH 02/24] iio: Use dev_to_iio_dev() Lars-Peter Clausen
2012-05-12  8:26   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 03/24] staging:iio:adis16203_read_ring_data: Pass IIO device directly Lars-Peter Clausen
2012-05-12  8:28   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 04/24] staging:iio:adis16204_read_ring_data: " Lars-Peter Clausen
2012-05-12  8:28   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 05/24] staging:iio:adis16209_read_ring_data: " Lars-Peter Clausen
2012-05-12  8:30   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 06/24] staging:iio:adis16240_read_ring_data: " Lars-Peter Clausen
2012-05-12  8:31   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 07/24] staging:iio:__lis3l02dq_write_data_ready_config: " Lars-Peter Clausen
2012-05-12  8:34   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 08/24] staging:iio:adis16260_read_ring_data: " Lars-Peter Clausen
2012-05-12  8:35   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 09/24] staging:iio:ade7758_spi_read_burst: " Lars-Peter Clausen
2012-05-12  8:35   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 10/24] staging:iio:adis16400_ring: " Lars-Peter Clausen
2012-05-12  8:36   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 11/24] staging:iio:adc: Use dev_to_iio_dev() Lars-Peter Clausen
2012-05-12  8:40   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 12/24] staging:iio:accel: " Lars-Peter Clausen
2012-05-12  8:43   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 13/24] staging:iio:addac: " Lars-Peter Clausen
2012-05-12  8:44   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 14/24] staging:iio:cdc: " Lars-Peter Clausen
2012-05-12  8:45   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 15/24] staging:iio:dac: " Lars-Peter Clausen
2012-05-12  8:45   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 16/24] staging:iio:frequency: " Lars-Peter Clausen
2012-05-12  8:46   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 17/24] staging:iio:gyro: " Lars-Peter Clausen
2012-05-12  8:46   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 18/24] staging:iio:impedance-analyzer: " Lars-Peter Clausen
2012-05-12  8:47   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 19/24] staging:iio:imu: " Lars-Peter Clausen
2012-05-12  8:47   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 20/24] staging:iio:light: " Lars-Peter Clausen
2012-05-12  8:48   ` Jonathan Cameron
2012-05-11 12:58 ` Lars-Peter Clausen [this message]
2012-05-12  8:49   ` [PATCH 21/24] staging:iio:magnetometer: " Jonathan Cameron
2012-05-11 12:58 ` [PATCH 22/24] staging:iio:resolver: " Lars-Peter Clausen
2012-05-12  8:49   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 23/24] staging:iio:meter: " Lars-Peter Clausen
2012-05-12  8:50   ` Jonathan Cameron
2012-05-11 12:58 ` [PATCH 24/24] iio: Free up drvdata for driver usage Lars-Peter Clausen
2012-05-12  8:51   ` Jonathan Cameron
2012-05-12  9:08 ` [PATCH 01/24] iio: Add dev_to_iio_dev() helper function 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=1336741127-29552-21-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    /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).