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

staging:iio:magnetometer: 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 96f691f9
...@@ -242,7 +242,7 @@ static int ak8975_setup(struct i2c_client *client) ...@@ -242,7 +242,7 @@ static int ak8975_setup(struct i2c_client *client)
static ssize_t show_mode(struct device *dev, struct device_attribute *devattr, static ssize_t show_mode(struct device *dev, struct device_attribute *devattr,
char *buf) 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); struct ak8975_data *data = iio_priv(indio_dev);
return sprintf(buf, "%u\n", data->mode); return sprintf(buf, "%u\n", data->mode);
...@@ -255,7 +255,7 @@ static ssize_t show_mode(struct device *dev, struct device_attribute *devattr, ...@@ -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, static ssize_t store_mode(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count) 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 ak8975_data *data = iio_priv(indio_dev);
struct i2c_client *client = data->client; struct i2c_client *client = data->client;
bool value; bool value;
......
...@@ -184,7 +184,7 @@ static ssize_t hmc5843_show_operating_mode(struct device *dev, ...@@ -184,7 +184,7 @@ static ssize_t hmc5843_show_operating_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 hmc5843_data *data = iio_priv(indio_dev); struct hmc5843_data *data = iio_priv(indio_dev);
return sprintf(buf, "%d\n", data->operating_mode); return sprintf(buf, "%d\n", data->operating_mode);
} }
...@@ -194,7 +194,7 @@ static ssize_t hmc5843_set_operating_mode(struct device *dev, ...@@ -194,7 +194,7 @@ static ssize_t hmc5843_set_operating_mode(struct device *dev,
const char *buf, const char *buf,
size_t count) 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 i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct hmc5843_data *data = iio_priv(indio_dev); struct hmc5843_data *data = 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);
...@@ -260,7 +260,7 @@ static ssize_t hmc5843_show_measurement_configuration(struct device *dev, ...@@ -260,7 +260,7 @@ static ssize_t hmc5843_show_measurement_configuration(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 hmc5843_data *data = iio_priv(indio_dev); struct hmc5843_data *data = iio_priv(indio_dev);
return sprintf(buf, "%d\n", data->meas_conf); return sprintf(buf, "%d\n", data->meas_conf);
} }
...@@ -270,7 +270,7 @@ static ssize_t hmc5843_set_measurement_configuration(struct device *dev, ...@@ -270,7 +270,7 @@ static ssize_t hmc5843_set_measurement_configuration(struct device *dev,
const char *buf, const char *buf,
size_t count) 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 i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct hmc5843_data *data = i2c_get_clientdata(client); struct hmc5843_data *data = i2c_get_clientdata(client);
unsigned long meas_conf = 0; unsigned long meas_conf = 0;
...@@ -331,7 +331,7 @@ static ssize_t set_sampling_frequency(struct device *dev, ...@@ -331,7 +331,7 @@ static ssize_t set_sampling_frequency(struct device *dev,
const char *buf, size_t count) 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 i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct hmc5843_data *data = iio_priv(indio_dev); struct hmc5843_data *data = iio_priv(indio_dev);
unsigned long rate = 0; unsigned long rate = 0;
...@@ -369,7 +369,7 @@ static ssize_t set_sampling_frequency(struct device *dev, ...@@ -369,7 +369,7 @@ static ssize_t set_sampling_frequency(struct device *dev,
static ssize_t show_sampling_frequency(struct device *dev, static ssize_t show_sampling_frequency(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 i2c_client *client = to_i2c_client(indio_dev->dev.parent); struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
s32 rate; s32 rate;
...@@ -404,7 +404,7 @@ static ssize_t show_range(struct device *dev, ...@@ -404,7 +404,7 @@ static ssize_t show_range(struct device *dev,
char *buf) char *buf)
{ {
u8 range; 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); struct hmc5843_data *data = iio_priv(indio_dev);
range = data->range; range = data->range;
...@@ -416,7 +416,7 @@ static ssize_t set_range(struct device *dev, ...@@ -416,7 +416,7 @@ static ssize_t set_range(struct device *dev,
const char *buf, const char *buf,
size_t count) 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 i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
struct hmc5843_data *data = iio_priv(indio_dev); struct hmc5843_data *data = iio_priv(indio_dev);
......
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