mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
staging:iio:dac: 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: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d30a7f9df0
commit
ac3f851ef8
@ -251,7 +251,7 @@ static ssize_t ad5360_read_dac_powerdown(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 ad5360_state *st = iio_priv(indio_dev);
|
||||
|
||||
return sprintf(buf, "%d\n", (bool)(st->ctrl & AD5360_SF_CTRL_PWR_DOWN));
|
||||
@ -279,7 +279,7 @@ static int ad5360_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
|
||||
static ssize_t ad5360_write_dac_powerdown(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 pwr_down;
|
||||
int ret;
|
||||
|
||||
|
@ -168,7 +168,7 @@ static const struct ad5380_chip_info ad5380_chip_info_tbl[] = {
|
||||
static ssize_t ad5380_read_dac_powerdown(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 ad5380_state *st = iio_priv(indio_dev);
|
||||
|
||||
return sprintf(buf, "%d\n", st->pwr_down);
|
||||
@ -177,7 +177,7 @@ static ssize_t ad5380_read_dac_powerdown(struct device *dev,
|
||||
static ssize_t ad5380_write_dac_powerdown(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);
|
||||
struct ad5380_state *st = iio_priv(indio_dev);
|
||||
bool pwr_down;
|
||||
int ret;
|
||||
@ -213,7 +213,7 @@ static const char ad5380_powerdown_modes[][15] = {
|
||||
static ssize_t ad5380_read_powerdown_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 ad5380_state *st = iio_priv(indio_dev);
|
||||
unsigned int mode;
|
||||
int ret;
|
||||
@ -230,7 +230,7 @@ static ssize_t ad5380_read_powerdown_mode(struct device *dev,
|
||||
static ssize_t ad5380_write_powerdown_mode(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);
|
||||
struct ad5380_state *st = iio_priv(indio_dev);
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
@ -125,7 +125,7 @@ static int ad5504_write_raw(struct iio_dev *indio_dev,
|
||||
static ssize_t ad5504_read_powerdown_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 ad5504_state *st = iio_priv(indio_dev);
|
||||
|
||||
const char mode[][14] = {"20kohm_to_gnd", "three_state"};
|
||||
@ -137,7 +137,7 @@ static ssize_t ad5504_write_powerdown_mode(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);
|
||||
struct ad5504_state *st = iio_priv(indio_dev);
|
||||
int ret;
|
||||
|
||||
@ -155,7 +155,7 @@ static ssize_t ad5504_read_dac_powerdown(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 ad5504_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
@ -169,7 +169,7 @@ static ssize_t ad5504_write_dac_powerdown(struct device *dev,
|
||||
{
|
||||
long readin;
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct ad5504_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
|
@ -141,7 +141,7 @@ static int ad5624r_write_raw(struct iio_dev *indio_dev,
|
||||
static ssize_t ad5624r_read_powerdown_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 ad5624r_state *st = iio_priv(indio_dev);
|
||||
|
||||
char mode[][15] = {"", "1kohm_to_gnd", "100kohm_to_gnd", "three_state"};
|
||||
@ -153,7 +153,7 @@ static ssize_t ad5624r_write_powerdown_mode(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);
|
||||
struct ad5624r_state *st = iio_priv(indio_dev);
|
||||
int ret;
|
||||
|
||||
@ -173,7 +173,7 @@ static ssize_t ad5624r_read_dac_powerdown(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 ad5624r_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
@ -187,7 +187,7 @@ static ssize_t ad5624r_write_dac_powerdown(struct device *dev,
|
||||
{
|
||||
long readin;
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct ad5624r_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
|
@ -173,7 +173,7 @@ static int ad5686_spi_read(struct ad5686_state *st, u8 addr)
|
||||
static ssize_t ad5686_read_powerdown_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 ad5686_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
@ -187,7 +187,7 @@ static ssize_t ad5686_write_powerdown_mode(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);
|
||||
struct ad5686_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
unsigned mode;
|
||||
@ -211,7 +211,7 @@ static ssize_t ad5686_read_dac_powerdown(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 ad5686_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
@ -225,7 +225,7 @@ static ssize_t ad5686_write_dac_powerdown(struct device *dev,
|
||||
{
|
||||
bool readin;
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct ad5686_state *st = iio_priv(indio_dev);
|
||||
struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
|
||||
|
||||
|
@ -94,7 +94,7 @@ static const struct iio_chan_spec ad5791_channels[] = {
|
||||
static ssize_t ad5791_read_powerdown_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 ad5791_state *st = iio_priv(indio_dev);
|
||||
|
||||
const char mode[][14] = {"6kohm_to_gnd", "three_state"};
|
||||
@ -106,7 +106,7 @@ static ssize_t ad5791_write_powerdown_mode(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);
|
||||
struct ad5791_state *st = iio_priv(indio_dev);
|
||||
int ret;
|
||||
|
||||
@ -124,7 +124,7 @@ static ssize_t ad5791_read_dac_powerdown(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 ad5791_state *st = iio_priv(indio_dev);
|
||||
|
||||
return sprintf(buf, "%d\n", st->pwr_down);
|
||||
@ -136,7 +136,7 @@ static ssize_t ad5791_write_dac_powerdown(struct device *dev,
|
||||
{
|
||||
long readin;
|
||||
int ret;
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct ad5791_state *st = iio_priv(indio_dev);
|
||||
|
||||
ret = strict_strtol(buf, 10, &readin);
|
||||
|
@ -59,7 +59,7 @@ static ssize_t max517_set_value(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count, int channel)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct max517_data *data = iio_priv(indio_dev);
|
||||
struct i2c_client *client = data->client;
|
||||
u8 outbuf[4]; /* 1x or 2x command + value */
|
||||
@ -128,7 +128,7 @@ static ssize_t max517_show_scale(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf, int channel)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
|
||||
struct max517_data *data = iio_priv(indio_dev);
|
||||
/* Corresponds to Vref / 2^(bits) */
|
||||
unsigned int scale_uv = (data->vref_mv[channel - 1] * 1000) >> 8;
|
||||
|
Loading…
Reference in New Issue
Block a user