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

staging:iio:adc: 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 ea19ed3b
...@@ -655,7 +655,7 @@ static ssize_t ad7192_read_frequency(struct device *dev, ...@@ -655,7 +655,7 @@ static ssize_t ad7192_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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
return sprintf(buf, "%d\n", st->mclk / return sprintf(buf, "%d\n", st->mclk /
...@@ -667,7 +667,7 @@ static ssize_t ad7192_write_frequency(struct device *dev, ...@@ -667,7 +667,7 @@ static ssize_t ad7192_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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
unsigned long lval; unsigned long lval;
int div, ret; int div, ret;
...@@ -706,7 +706,7 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, ...@@ -706,7 +706,7 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
static ssize_t ad7192_show_scale_available(struct device *dev, static ssize_t ad7192_show_scale_available(struct device *dev,
struct device_attribute *attr, char *buf) 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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
int i, len = 0; int i, len = 0;
...@@ -730,7 +730,7 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev, ...@@ -730,7 +730,7 @@ static ssize_t ad7192_show_ac_excitation(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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX)); return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX));
...@@ -740,7 +740,7 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev, ...@@ -740,7 +740,7 @@ static ssize_t ad7192_show_bridge_switch(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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW)); return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW));
...@@ -751,7 +751,7 @@ static ssize_t ad7192_set(struct device *dev, ...@@ -751,7 +751,7 @@ static ssize_t ad7192_set(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 ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret; int ret;
......
...@@ -384,7 +384,7 @@ static ssize_t ad7280_show_balance_sw(struct device *dev, ...@@ -384,7 +384,7 @@ static ssize_t ad7280_show_balance_sw(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
...@@ -398,7 +398,7 @@ static ssize_t ad7280_store_balance_sw(struct device *dev, ...@@ -398,7 +398,7 @@ static ssize_t ad7280_store_balance_sw(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
bool readin; bool readin;
...@@ -429,7 +429,7 @@ static ssize_t ad7280_show_balance_timer(struct device *dev, ...@@ -429,7 +429,7 @@ static ssize_t ad7280_show_balance_timer(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
int ret; int ret;
...@@ -453,7 +453,7 @@ static ssize_t ad7280_store_balance_timer(struct device *dev, ...@@ -453,7 +453,7 @@ static ssize_t ad7280_store_balance_timer(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
unsigned long val; unsigned long val;
...@@ -599,7 +599,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev, ...@@ -599,7 +599,7 @@ static ssize_t ad7280_read_channel_config(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
unsigned val; unsigned val;
...@@ -629,7 +629,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev, ...@@ -629,7 +629,7 @@ static ssize_t ad7280_write_channel_config(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 ad7280_state *st = iio_priv(indio_dev); struct ad7280_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
......
...@@ -132,7 +132,7 @@ static ssize_t ad7291_store_reset(struct device *dev, ...@@ -132,7 +132,7 @@ static ssize_t ad7291_store_reset(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 ad7291_chip_info *chip = iio_priv(indio_dev); struct ad7291_chip_info *chip = iio_priv(indio_dev);
return ad7291_i2c_write(chip, AD7291_COMMAND, return ad7291_i2c_write(chip, AD7291_COMMAND,
...@@ -214,7 +214,7 @@ static inline ssize_t ad7291_show_hyst(struct device *dev, ...@@ -214,7 +214,7 @@ static inline ssize_t ad7291_show_hyst(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 ad7291_chip_info *chip = iio_priv(indio_dev); struct ad7291_chip_info *chip = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
u16 data; u16 data;
...@@ -232,7 +232,7 @@ static inline ssize_t ad7291_set_hyst(struct device *dev, ...@@ -232,7 +232,7 @@ static inline ssize_t ad7291_set_hyst(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 ad7291_chip_info *chip = iio_priv(indio_dev); struct ad7291_chip_info *chip = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
u16 data; u16 data;
......
...@@ -113,7 +113,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, ...@@ -113,7 +113,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
static ssize_t ad7606_show_range(struct device *dev, static ssize_t ad7606_show_range(struct device *dev,
struct device_attribute *attr, char *buf) 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 ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
return sprintf(buf, "%u\n", st->range); return sprintf(buf, "%u\n", st->range);
...@@ -122,7 +122,7 @@ static ssize_t ad7606_show_range(struct device *dev, ...@@ -122,7 +122,7 @@ static ssize_t ad7606_show_range(struct device *dev,
static ssize_t ad7606_store_range(struct device *dev, static ssize_t ad7606_store_range(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, 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 ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
unsigned long lval; unsigned long lval;
...@@ -147,7 +147,7 @@ static IIO_CONST_ATTR(in_voltage_range_available, "5000 10000"); ...@@ -147,7 +147,7 @@ static IIO_CONST_ATTR(in_voltage_range_available, "5000 10000");
static ssize_t ad7606_show_oversampling_ratio(struct device *dev, static ssize_t ad7606_show_oversampling_ratio(struct device *dev,
struct device_attribute *attr, char *buf) 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 ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
return sprintf(buf, "%u\n", st->oversampling); return sprintf(buf, "%u\n", st->oversampling);
...@@ -168,7 +168,7 @@ static int ad7606_oversampling_get_index(unsigned val) ...@@ -168,7 +168,7 @@ static int ad7606_oversampling_get_index(unsigned val)
static ssize_t ad7606_store_oversampling_ratio(struct device *dev, static ssize_t ad7606_store_oversampling_ratio(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, 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 ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
unsigned long lval; unsigned long lval;
int ret; int ret;
......
...@@ -524,7 +524,7 @@ static ssize_t ad7793_read_frequency(struct device *dev, ...@@ -524,7 +524,7 @@ static ssize_t ad7793_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 ad7793_state *st = iio_priv(indio_dev); struct ad7793_state *st = iio_priv(indio_dev);
return sprintf(buf, "%d\n", return sprintf(buf, "%d\n",
...@@ -536,7 +536,7 @@ static ssize_t ad7793_write_frequency(struct device *dev, ...@@ -536,7 +536,7 @@ static ssize_t ad7793_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 ad7793_state *st = iio_priv(indio_dev); struct ad7793_state *st = iio_priv(indio_dev);
long lval; long lval;
int i, ret; int i, ret;
...@@ -578,7 +578,7 @@ static IIO_CONST_ATTR_SAMP_FREQ_AVAIL( ...@@ -578,7 +578,7 @@ static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
static ssize_t ad7793_show_scale_available(struct device *dev, static ssize_t ad7793_show_scale_available(struct device *dev,
struct device_attribute *attr, char *buf) 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 ad7793_state *st = iio_priv(indio_dev); struct ad7793_state *st = iio_priv(indio_dev);
int i, len = 0; int i, len = 0;
......
...@@ -113,7 +113,7 @@ static ssize_t ad7816_show_mode(struct device *dev, ...@@ -113,7 +113,7 @@ static ssize_t ad7816_show_mode(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
if (chip->mode) if (chip->mode)
...@@ -127,7 +127,7 @@ static ssize_t ad7816_store_mode(struct device *dev, ...@@ -127,7 +127,7 @@ static ssize_t ad7816_store_mode(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
if (strcmp(buf, "full")) { if (strcmp(buf, "full")) {
...@@ -159,7 +159,7 @@ static ssize_t ad7816_show_channel(struct device *dev, ...@@ -159,7 +159,7 @@ static ssize_t ad7816_show_channel(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
return sprintf(buf, "%d\n", chip->channel_id); return sprintf(buf, "%d\n", chip->channel_id);
...@@ -170,7 +170,7 @@ static ssize_t ad7816_store_channel(struct device *dev, ...@@ -170,7 +170,7 @@ static ssize_t ad7816_store_channel(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
unsigned long data; unsigned long data;
int ret; int ret;
...@@ -208,7 +208,7 @@ static ssize_t ad7816_show_value(struct device *dev, ...@@ -208,7 +208,7 @@ static ssize_t ad7816_show_value(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
u16 data; u16 data;
s8 value; s8 value;
...@@ -263,7 +263,7 @@ static ssize_t ad7816_show_oti(struct device *dev, ...@@ -263,7 +263,7 @@ static ssize_t ad7816_show_oti(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
int value; int value;
...@@ -284,7 +284,7 @@ static inline ssize_t ad7816_set_oti(struct device *dev, ...@@ -284,7 +284,7 @@ static inline ssize_t ad7816_set_oti(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 ad7816_chip_info *chip = iio_priv(indio_dev); struct ad7816_chip_info *chip = iio_priv(indio_dev);
long value; long value;
u8 data; u8 data;
......
...@@ -182,7 +182,7 @@ static ssize_t ad799x_read_frequency(struct device *dev, ...@@ -182,7 +182,7 @@ static ssize_t ad799x_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 ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
int ret; int ret;
...@@ -201,7 +201,7 @@ static ssize_t ad799x_write_frequency(struct device *dev, ...@@ -201,7 +201,7 @@ static ssize_t ad799x_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 ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
long val; long val;
...@@ -294,7 +294,7 @@ static ssize_t ad799x_read_channel_config(struct device *dev, ...@@ -294,7 +294,7 @@ static ssize_t ad799x_read_channel_config(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 ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
...@@ -312,7 +312,7 @@ static ssize_t ad799x_write_channel_config(struct device *dev, ...@@ -312,7 +312,7 @@ static ssize_t ad799x_write_channel_config(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 ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
......
...@@ -175,7 +175,7 @@ static ssize_t adt7310_show_mode(struct device *dev, ...@@ -175,7 +175,7 @@ static ssize_t adt7310_show_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u8 config; u8 config;
...@@ -198,7 +198,7 @@ static ssize_t adt7310_store_mode(struct device *dev, ...@@ -198,7 +198,7 @@ static ssize_t adt7310_store_mode(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u16 config; u16 config;
int ret; int ret;
...@@ -242,7 +242,7 @@ static ssize_t adt7310_show_resolution(struct device *dev, ...@@ -242,7 +242,7 @@ static ssize_t adt7310_show_resolution(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
int bits; int bits;
...@@ -264,7 +264,7 @@ static ssize_t adt7310_store_resolution(struct device *dev, ...@@ -264,7 +264,7 @@ static ssize_t adt7310_store_resolution(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
unsigned long data; unsigned long data;
u16 config; u16 config;
...@@ -300,7 +300,7 @@ static ssize_t adt7310_show_id(struct device *dev, ...@@ -300,7 +300,7 @@ static ssize_t adt7310_show_id(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u8 id; u8 id;
int ret; int ret;
...@@ -350,7 +350,7 @@ static ssize_t adt7310_show_value(struct device *dev, ...@@ -350,7 +350,7 @@ static ssize_t adt7310_show_value(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u8 status; u8 status;
u16 data; u16 data;
...@@ -424,7 +424,7 @@ static ssize_t adt7310_show_event_mode(struct device *dev, ...@@ -424,7 +424,7 @@ static ssize_t adt7310_show_event_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
...@@ -443,7 +443,7 @@ static ssize_t adt7310_set_event_mode(struct device *dev, ...@@ -443,7 +443,7 @@ static ssize_t adt7310_set_event_mode(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u16 config; u16 config;
int ret; int ret;
...@@ -476,7 +476,7 @@ static ssize_t adt7310_show_fault_queue(struct device *dev, ...@@ -476,7 +476,7 @@ static ssize_t adt7310_show_fault_queue(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
...@@ -492,7 +492,7 @@ static ssize_t adt7310_set_fault_queue(struct device *dev, ...@@ -492,7 +492,7 @@ static ssize_t adt7310_set_fault_queue(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
unsigned long data; unsigned long data;
int ret; int ret;
...@@ -522,7 +522,7 @@ static inline ssize_t adt7310_show_t_bound(struct device *dev, ...@@ -522,7 +522,7 @@ static inline ssize_t adt7310_show_t_bound(struct device *dev,
u8 bound_reg, u8 bound_reg,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
u16 data; u16 data;
int ret; int ret;
...@@ -540,7 +540,7 @@ static inline ssize_t adt7310_set_t_bound(struct device *dev, ...@@ -540,7 +540,7 @@ static inline ssize_t adt7310_set_t_bound(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
long tmp1, tmp2; long tmp1, tmp2;
u16 data; u16 data;
...@@ -660,7 +660,7 @@ static ssize_t adt7310_show_t_hyst(struct device *dev, ...@@ -660,7 +660,7 @@ static ssize_t adt7310_show_t_hyst(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
u8 t_hyst; u8 t_hyst;
...@@ -677,7 +677,7 @@ static inline ssize_t adt7310_set_t_hyst(struct device *dev, ...@@ -677,7 +677,7 @@ static inline ssize_t adt7310_set_t_hyst(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7310_chip_info *chip = iio_priv(dev_info); struct adt7310_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
unsigned long data; unsigned long data;
......
...@@ -144,7 +144,7 @@ static ssize_t adt7410_show_mode(struct device *dev, ...@@ -144,7 +144,7 @@ static ssize_t adt7410_show_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u8 config; u8 config;
...@@ -167,7 +167,7 @@ static ssize_t adt7410_store_mode(struct device *dev, ...@@ -167,7 +167,7 @@ static ssize_t adt7410_store_mode(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u16 config; u16 config;
int ret; int ret;
...@@ -211,7 +211,7 @@ static ssize_t adt7410_show_resolution(struct device *dev, ...@@ -211,7 +211,7 @@ static ssize_t adt7410_show_resolution(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
int bits; int bits;
...@@ -233,7 +233,7 @@ static ssize_t adt7410_store_resolution(struct device *dev, ...@@ -233,7 +233,7 @@ static ssize_t adt7410_store_resolution(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
unsigned long data; unsigned long data;
u16 config; u16 config;
...@@ -269,7 +269,7 @@ static ssize_t adt7410_show_id(struct device *dev, ...@@ -269,7 +269,7 @@ static ssize_t adt7410_show_id(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u8 id; u8 id;
int ret; int ret;
...@@ -319,7 +319,7 @@ static ssize_t adt7410_show_value(struct device *dev, ...@@ -319,7 +319,7 @@ static ssize_t adt7410_show_value(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u8 status; u8 status;
u16 data; u16 data;
...@@ -392,7 +392,7 @@ static ssize_t adt7410_show_event_mode(struct device *dev, ...@@ -392,7 +392,7 @@ static ssize_t adt7410_show_event_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
...@@ -411,7 +411,7 @@ static ssize_t adt7410_set_event_mode(struct device *dev, ...@@ -411,7 +411,7 @@ static ssize_t adt7410_set_event_mode(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u16 config; u16 config;
int ret; int ret;
...@@ -444,7 +444,7 @@ static ssize_t adt7410_show_fault_queue(struct device *dev, ...@@ -444,7 +444,7 @@ static ssize_t adt7410_show_fault_queue(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
...@@ -460,7 +460,7 @@ static ssize_t adt7410_set_fault_queue(struct device *dev, ...@@ -460,7 +460,7 @@ static ssize_t adt7410_set_fault_queue(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
unsigned long data; unsigned long data;
int ret; int ret;
...@@ -490,7 +490,7 @@ static inline ssize_t adt7410_show_t_bound(struct device *dev, ...@@ -490,7 +490,7 @@ static inline ssize_t adt7410_show_t_bound(struct device *dev,
u8 bound_reg, u8 bound_reg,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
u16 data; u16 data;
int ret; int ret;
...@@ -508,7 +508,7 @@ static inline ssize_t adt7410_set_t_bound(struct device *dev, ...@@ -508,7 +508,7 @@ static inline ssize_t adt7410_set_t_bound(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
long tmp1, tmp2; long tmp1, tmp2;
u16 data; u16 data;
...@@ -628,7 +628,7 @@ static ssize_t adt7410_show_t_hyst(struct device *dev, ...@@ -628,7 +628,7 @@ static ssize_t adt7410_show_t_hyst(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
u8 t_hyst; u8 t_hyst;
...@@ -645,7 +645,7 @@ static inline ssize_t adt7410_set_t_hyst(struct device *dev, ...@@ -645,7 +645,7 @@ static inline ssize_t adt7410_set_t_hyst(struct device *dev,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *dev_info = dev_get_drvdata(dev); struct iio_dev *dev_info = dev_to_iio_dev(dev);
struct adt7410_chip_info *chip = iio_priv(dev_info); struct adt7410_chip_info *chip = iio_priv(dev_info);
int ret; int ret;
unsigned long data; unsigned long data;
......
...@@ -499,7 +499,7 @@ static ssize_t max1363_monitor_show_freq(struct device *dev, ...@@ -499,7 +499,7 @@ static ssize_t max1363_monitor_show_freq(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct max1363_state *st = iio_priv(dev_get_drvdata(dev)); struct max1363_state *st = iio_priv(dev_to_iio_dev(dev));
return sprintf(buf, "%d\n", max1363_monitor_speeds[st->monitor_speed]); return sprintf(buf, "%d\n", max1363_monitor_speeds[st->monitor_speed]);
} }
...@@ -508,7 +508,7 @@ static ssize_t max1363_monitor_store_freq(struct device *dev, ...@@ -508,7 +508,7 @@ static ssize_t max1363_monitor_store_freq(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 max1363_state *st = iio_priv(indio_dev); struct max1363_state *st = iio_priv(indio_dev);
int i, ret; int i, ret;
unsigned long val; unsigned long val;
......
...@@ -231,7 +231,7 @@ static ssize_t spear_adc_read_frequency(struct device *dev, ...@@ -231,7 +231,7 @@ static ssize_t spear_adc_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 spear_adc_info *info = iio_priv(indio_dev); struct spear_adc_info *info = iio_priv(indio_dev);
return sprintf(buf, "%d\n", info->current_clk); return sprintf(buf, "%d\n", info->current_clk);
...@@ -242,7 +242,7 @@ static ssize_t spear_adc_write_frequency(struct device *dev, ...@@ -242,7 +242,7 @@ static ssize_t spear_adc_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 spear_adc_info *info = iio_priv(indio_dev); struct spear_adc_info *info = iio_priv(indio_dev);
u32 clk_high, clk_low, count; u32 clk_high, clk_low, count;
u32 apb_clk = clk_get_rate(info->clk); u32 apb_clk = clk_get_rate(info->clk);
......
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