On 05/11/2012 01:58 PM, Lars-Peter Clausen wrote: > 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@xxxxxxxxxx> Acked-by: Jonathan Cameron <jic23@xxxxxxxxxx> > --- > drivers/staging/iio/accel/adis16201_core.c | 2 +- > drivers/staging/iio/accel/adis16203_core.c | 2 +- > drivers/staging/iio/accel/adis16204_core.c | 4 ++-- > drivers/staging/iio/accel/adis16209_core.c | 2 +- > drivers/staging/iio/accel/adis16220_core.c | 14 +++++++------- > drivers/staging/iio/accel/adis16240_core.c | 6 +++--- > drivers/staging/iio/accel/lis3l02dq_core.c | 4 ++-- > drivers/staging/iio/accel/sca3000_core.c | 22 +++++++++++----------- > drivers/staging/iio/accel/sca3000_ring.c | 6 +++--- > 9 files changed, 31 insertions(+), 31 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c > index 6266780..02b3409 100644 > --- a/drivers/staging/iio/accel/adis16201_core.c > +++ b/drivers/staging/iio/accel/adis16201_core.c > @@ -171,7 +171,7 @@ static ssize_t adis16201_write_reset(struct device *dev, > ret = strtobool(buf, &res); > if (ret || !res) > return ret; > - return adis16201_reset(dev_get_drvdata(dev)); > + return adis16201_reset(dev_to_iio_dev(dev)); > } > > int adis16201_set_irq(struct iio_dev *indio_dev, bool enable) > diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c > index 42d7eea..15d46bf 100644 > --- a/drivers/staging/iio/accel/adis16203_core.c > +++ b/drivers/staging/iio/accel/adis16203_core.c > @@ -182,7 +182,7 @@ static ssize_t adis16203_write_reset(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > if (len < 1) > return -EINVAL; > switch (buf[0]) { > diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c > index eacda58..ac9d95e 100644 > --- a/drivers/staging/iio/accel/adis16204_core.c > +++ b/drivers/staging/iio/accel/adis16204_core.c > @@ -173,7 +173,7 @@ static ssize_t adis16204_read_14bit_signed(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 iio_dev_attr *this_attr = to_iio_dev_attr(attr); > s16 val = 0; > ssize_t ret; > @@ -211,7 +211,7 @@ static ssize_t adis16204_write_reset(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > if (len < 1) > return -EINVAL; > diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c > index 8e8dbe6..f6fd0d3 100644 > --- a/drivers/staging/iio/accel/adis16209_core.c > +++ b/drivers/staging/iio/accel/adis16209_core.c > @@ -157,7 +157,7 @@ static ssize_t adis16209_write_reset(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > if (len < 1) > return -EINVAL; > diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c > index e8c513d..6a9ac89 100644 > --- a/drivers/staging/iio/accel/adis16220_core.c > +++ b/drivers/staging/iio/accel/adis16220_core.c > @@ -145,7 +145,7 @@ static ssize_t adis16220_read_16bit(struct device *dev, > char *buf) > { > struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > ssize_t ret; > s16 val = 0; > > @@ -164,7 +164,7 @@ static ssize_t adis16220_write_16bit(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); > int ret; > u16 val; > @@ -208,7 +208,7 @@ static ssize_t adis16220_write_reset(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > bool val; > int ret; > > @@ -228,7 +228,7 @@ static ssize_t adis16220_write_capture(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > bool val; > int ret; > > @@ -393,7 +393,7 @@ static ssize_t adis16220_accel_bin_read(struct file *filp, struct kobject *kobj, > size_t count) > { > struct device *dev = container_of(kobj, struct device, kobj); > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > return adis16220_capture_buffer_read(indio_dev, buf, > off, count, > @@ -415,7 +415,7 @@ static ssize_t adis16220_adc1_bin_read(struct file *filp, struct kobject *kobj, > size_t count) > { > struct device *dev = container_of(kobj, struct device, kobj); > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > return adis16220_capture_buffer_read(indio_dev, buf, > off, count, > @@ -437,7 +437,7 @@ static ssize_t adis16220_adc2_bin_read(struct file *filp, struct kobject *kobj, > size_t count) > { > struct device *dev = container_of(kobj, struct device, kobj); > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > return adis16220_capture_buffer_read(indio_dev, buf, > off, count, > diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c > index f043bbd..8b15eae 100644 > --- a/drivers/staging/iio/accel/adis16240_core.c > +++ b/drivers/staging/iio/accel/adis16240_core.c > @@ -154,7 +154,7 @@ static ssize_t adis16240_spi_read_signed(struct device *dev, > char *buf, > unsigned bits) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > int ret; > s16 val = 0; > unsigned shift = 16 - bits; > @@ -177,7 +177,7 @@ static ssize_t adis16240_read_12bit_signed(struct device *dev, > char *buf) > { > ssize_t ret; > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > /* Take the iio_dev status lock */ > mutex_lock(&indio_dev->mlock); > @@ -203,7 +203,7 @@ static ssize_t adis16240_write_reset(struct device *dev, > struct device_attribute *attr, > const char *buf, size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > > if (len < 1) > return -EINVAL; > diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c > index a778043..9d26348 100644 > --- a/drivers/staging/iio/accel/lis3l02dq_core.c > +++ b/drivers/staging/iio/accel/lis3l02dq_core.c > @@ -297,7 +297,7 @@ static ssize_t lis3l02dq_read_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); > int ret, len = 0; > s8 t; > ret = lis3l02dq_spi_read_reg_8(indio_dev, > @@ -328,7 +328,7 @@ static ssize_t lis3l02dq_write_frequency(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > unsigned long val; > int ret; > u8 t; > diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c > index 3c5aea5..6ec5c20 100644 > --- a/drivers/staging/iio/accel/sca3000_core.c > +++ b/drivers/staging/iio/accel/sca3000_core.c > @@ -241,7 +241,7 @@ error_ret: > static int sca3000_check_status(struct device *dev) > { > int ret; > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > > mutex_lock(&st->lock); > @@ -268,7 +268,7 @@ static ssize_t sca3000_show_rev(struct device *dev, > char *buf) > { > int len = 0, ret; > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > > mutex_lock(&st->lock); > @@ -296,7 +296,7 @@ sca3000_show_available_measurement_modes(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 sca3000_state *st = iio_priv(indio_dev); > int len = 0; > > @@ -328,7 +328,7 @@ sca3000_show_measurement_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 sca3000_state *st = iio_priv(indio_dev); > int len = 0, ret; > > @@ -379,7 +379,7 @@ sca3000_store_measurement_mode(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > int ret; > u8 mask = 0x03; > @@ -517,7 +517,7 @@ static ssize_t sca3000_read_av_freq(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 sca3000_state *st = iio_priv(indio_dev); > int len = 0, ret, val; > > @@ -588,7 +588,7 @@ static ssize_t sca3000_read_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 sca3000_state *st = iio_priv(indio_dev); > int ret, len = 0, base_freq = 0, val; > > @@ -630,7 +630,7 @@ static ssize_t sca3000_set_frequency(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > int ret, base_freq = 0; > int ctrlval; > @@ -690,7 +690,7 @@ static ssize_t sca3000_read_temp(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 sca3000_state *st = iio_priv(indio_dev); > int ret; > int val; > @@ -911,7 +911,7 @@ static ssize_t sca3000_query_free_fall_mode(struct device *dev, > char *buf) > { > int ret, len; > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > int val; > > @@ -939,7 +939,7 @@ static ssize_t sca3000_set_free_fall_mode(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > long val; > int ret; > diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c > index 889bc86..b7e1a00 100644 > --- a/drivers/staging/iio/accel/sca3000_ring.c > +++ b/drivers/staging/iio/accel/sca3000_ring.c > @@ -157,7 +157,7 @@ static ssize_t sca3000_query_ring_int(struct device *dev, > { > struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); > int ret, val; > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > > mutex_lock(&st->lock); > @@ -178,7 +178,7 @@ static ssize_t sca3000_set_ring_int(struct device *dev, > const char *buf, > size_t len) > { > - struct iio_dev *indio_dev = dev_get_drvdata(dev); > + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > struct sca3000_state *st = iio_priv(indio_dev); > struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); > long val; > @@ -219,7 +219,7 @@ static ssize_t sca3000_show_buffer_scale(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 sca3000_state *st = iio_priv(indio_dev); > > return sprintf(buf, "0.%06d\n", 4*st->info->scale); -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html