staging:iio:adis16220: Use kobj_to_dev instead of open-coding it
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 7 Aug 2012 07:55:00 +0000 (08:55 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 14 Aug 2012 19:27:41 +0000 (20:27 +0100)
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/accel/adis16220_core.c

index 575f1af25d5d2dafdaaa04df7347a7b92bf18029..c31e1ec2e66a15a6846c7ad218639f3bd5ff578f 100644 (file)
@@ -372,8 +372,7 @@ static ssize_t adis16220_accel_bin_read(struct file *filp, struct kobject *kobj,
                                        loff_t off,
                                        size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
-       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+       struct iio_dev *indio_dev = dev_to_iio_dev(kobj_to_dev(kobj));
 
        return adis16220_capture_buffer_read(indio_dev, buf,
                                        off, count,
@@ -394,8 +393,7 @@ static ssize_t adis16220_adc1_bin_read(struct file *filp, struct kobject *kobj,
                                char *buf, loff_t off,
                                size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
-       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+       struct iio_dev *indio_dev = dev_to_iio_dev(kobj_to_dev(kobj));
 
        return adis16220_capture_buffer_read(indio_dev, buf,
                                        off, count,
@@ -416,8 +414,7 @@ static ssize_t adis16220_adc2_bin_read(struct file *filp, struct kobject *kobj,
                                char *buf, loff_t off,
                                size_t count)
 {
-       struct device *dev = container_of(kobj, struct device, kobj);
-       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+       struct iio_dev *indio_dev = dev_to_iio_dev(kobj_to_dev(kobj));
 
        return adis16220_capture_buffer_read(indio_dev, buf,
                                        off, count,