Commit f72e0834 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Greg Kroah-Hartman

staging:iio:gyro: Use dev_to_iio_dev()

Replace open-coded instances of getting a iio_dev struct from a device struct
with dev_to_iio_dev().
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b671bb3b
...@@ -149,7 +149,7 @@ static ssize_t adis16260_read_frequency_available(struct device *dev, ...@@ -149,7 +149,7 @@ static ssize_t adis16260_read_frequency_available(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct adis16260_state *st = iio_priv(indio_dev); struct adis16260_state *st = iio_priv(indio_dev);
if (spi_get_device_id(st->us)->driver_data) if (spi_get_device_id(st->us)->driver_data)
return sprintf(buf, "%s\n", "0.129 ~ 256"); return sprintf(buf, "%s\n", "0.129 ~ 256");
...@@ -161,7 +161,7 @@ static ssize_t adis16260_read_frequency(struct device *dev, ...@@ -161,7 +161,7 @@ static ssize_t adis16260_read_frequency(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct adis16260_state *st = iio_priv(indio_dev); struct adis16260_state *st = iio_priv(indio_dev);
int ret, len = 0; int ret, len = 0;
u16 t; u16 t;
...@@ -186,7 +186,7 @@ static ssize_t adis16260_write_frequency(struct device *dev, ...@@ -186,7 +186,7 @@ static ssize_t adis16260_write_frequency(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct adis16260_state *st = iio_priv(indio_dev); struct adis16260_state *st = iio_priv(indio_dev);
long val; long val;
int ret; int ret;
...@@ -237,7 +237,7 @@ static ssize_t adis16260_write_reset(struct device *dev, ...@@ -237,7 +237,7 @@ static ssize_t adis16260_write_reset(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t len) 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) if (len < 1)
return -EINVAL; return -EINVAL;
switch (buf[0]) { switch (buf[0]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment