Commit e8ef49f0 authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Greg Kroah-Hartman

staging: iio: adc: properly indent to match open paranthesis

Indent parameters and arguments passed to function calls to match
open paranthesis
Signed-off-by: default avatarIoana Ciornei <ciorneiioana@gmail.com>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0e4f0075
...@@ -201,7 +201,7 @@ static int ad7192_calibrate_all(struct ad7192_state *st) ...@@ -201,7 +201,7 @@ static int ad7192_calibrate_all(struct ad7192_state *st)
} }
static int ad7192_setup(struct ad7192_state *st, static int ad7192_setup(struct ad7192_state *st,
const struct ad7192_platform_data *pdata) const struct ad7192_platform_data *pdata)
{ {
struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi); struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
unsigned long long scale_uv; unsigned long long scale_uv;
...@@ -224,7 +224,7 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -224,7 +224,7 @@ static int ad7192_setup(struct ad7192_state *st,
if (id != st->devid) if (id != st->devid)
dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n",
id); id);
switch (pdata->clock_source_sel) { switch (pdata->clock_source_sel) {
case AD7192_CLK_EXT_MCLK1_2: case AD7192_CLK_EXT_MCLK1_2:
...@@ -307,8 +307,8 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -307,8 +307,8 @@ static int ad7192_setup(struct ad7192_state *st,
} }
static ssize_t ad7192_read_frequency(struct device *dev, 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_to_iio_dev(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);
...@@ -318,9 +318,9 @@ static ssize_t ad7192_read_frequency(struct device *dev, ...@@ -318,9 +318,9 @@ static ssize_t ad7192_read_frequency(struct device *dev,
} }
static ssize_t ad7192_write_frequency(struct device *dev, static ssize_t ad7192_write_frequency(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -359,8 +359,9 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO, ...@@ -359,8 +359,9 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,
ad7192_read_frequency, ad7192_read_frequency,
ad7192_write_frequency); ad7192_write_frequency);
static ssize_t ad7192_show_scale_available(struct device *dev, static ssize_t
struct device_attribute *attr, char *buf) ad7192_show_scale_available(struct device *dev,
struct device_attribute *attr, char *buf)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -383,8 +384,8 @@ static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO, ...@@ -383,8 +384,8 @@ static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
ad7192_show_scale_available, NULL, 0); ad7192_show_scale_available, NULL, 0);
static ssize_t ad7192_show_ac_excitation(struct device *dev, 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_to_iio_dev(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);
...@@ -393,8 +394,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev, ...@@ -393,8 +394,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
} }
static ssize_t ad7192_show_bridge_switch(struct device *dev, 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_to_iio_dev(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);
...@@ -403,9 +404,9 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev, ...@@ -403,9 +404,9 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev,
} }
static ssize_t ad7192_set(struct device *dev, static ssize_t ad7192_set(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -529,10 +530,10 @@ static int ad7192_read_raw(struct iio_dev *indio_dev, ...@@ -529,10 +530,10 @@ static int ad7192_read_raw(struct iio_dev *indio_dev,
} }
static int ad7192_write_raw(struct iio_dev *indio_dev, static int ad7192_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int val, int val,
int val2, int val2,
long mask) long mask)
{ {
struct ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
int ret, i; int ret, i;
...@@ -556,7 +557,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev, ...@@ -556,7 +557,7 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
if (tmp == st->conf) if (tmp == st->conf)
break; break;
ad_sd_write_reg(&st->sd, AD7192_REG_CONF, ad_sd_write_reg(&st->sd, AD7192_REG_CONF,
3, st->conf); 3, st->conf);
ad7192_calibrate_all(st); ad7192_calibrate_all(st);
break; break;
} }
...@@ -571,8 +572,8 @@ static int ad7192_write_raw(struct iio_dev *indio_dev, ...@@ -571,8 +572,8 @@ static int ad7192_write_raw(struct iio_dev *indio_dev,
} }
static int ad7192_write_raw_get_fmt(struct iio_dev *indio_dev, static int ad7192_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
long mask) long mask)
{ {
return IIO_VAL_INT_PLUS_NANO; return IIO_VAL_INT_PLUS_NANO;
} }
......
...@@ -224,24 +224,24 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr, ...@@ -224,24 +224,24 @@ static int ad7280_write(struct ad7280_state *st, unsigned devaddr,
} }
static int ad7280_read(struct ad7280_state *st, unsigned devaddr, static int ad7280_read(struct ad7280_state *st, unsigned devaddr,
unsigned addr) unsigned addr)
{ {
int ret; int ret;
unsigned tmp; unsigned tmp;
/* turns off the read operation on all parts */ /* turns off the read operation on all parts */
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
AD7280A_CTRL_HB_CONV_INPUT_ALL | AD7280A_CTRL_HB_CONV_INPUT_ALL |
AD7280A_CTRL_HB_CONV_RES_READ_NO | AD7280A_CTRL_HB_CONV_RES_READ_NO |
st->ctrl_hb); st->ctrl_hb);
if (ret) if (ret)
return ret; return ret;
/* turns on the read operation on the addressed part */ /* turns on the read operation on the addressed part */
ret = ad7280_write(st, devaddr, AD7280A_CONTROL_HB, 0, ret = ad7280_write(st, devaddr, AD7280A_CONTROL_HB, 0,
AD7280A_CTRL_HB_CONV_INPUT_ALL | AD7280A_CTRL_HB_CONV_INPUT_ALL |
AD7280A_CTRL_HB_CONV_RES_READ_ALL | AD7280A_CTRL_HB_CONV_RES_READ_ALL |
st->ctrl_hb); st->ctrl_hb);
if (ret) if (ret)
return ret; return ret;
...@@ -272,17 +272,17 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr, ...@@ -272,17 +272,17 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr,
return ret; return ret;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
AD7280A_CTRL_HB_CONV_INPUT_ALL | AD7280A_CTRL_HB_CONV_INPUT_ALL |
AD7280A_CTRL_HB_CONV_RES_READ_NO | AD7280A_CTRL_HB_CONV_RES_READ_NO |
st->ctrl_hb); st->ctrl_hb);
if (ret) if (ret)
return ret; return ret;
ret = ad7280_write(st, devaddr, AD7280A_CONTROL_HB, 0, ret = ad7280_write(st, devaddr, AD7280A_CONTROL_HB, 0,
AD7280A_CTRL_HB_CONV_INPUT_ALL | AD7280A_CTRL_HB_CONV_INPUT_ALL |
AD7280A_CTRL_HB_CONV_RES_READ_ALL | AD7280A_CTRL_HB_CONV_RES_READ_ALL |
AD7280A_CTRL_HB_CONV_START_CS | AD7280A_CTRL_HB_CONV_START_CS |
st->ctrl_hb); st->ctrl_hb);
if (ret) if (ret)
return ret; return ret;
...@@ -300,7 +300,7 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr, ...@@ -300,7 +300,7 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned devaddr,
} }
static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt, static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt,
unsigned *array) unsigned *array)
{ {
int i, ret; int i, ret;
unsigned tmp, sum = 0; unsigned tmp, sum = 0;
...@@ -311,10 +311,10 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt, ...@@ -311,10 +311,10 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned cnt,
return ret; return ret;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
AD7280A_CTRL_HB_CONV_INPUT_ALL | AD7280A_CTRL_HB_CONV_INPUT_ALL |
AD7280A_CTRL_HB_CONV_RES_READ_ALL | AD7280A_CTRL_HB_CONV_RES_READ_ALL |
AD7280A_CTRL_HB_CONV_START_CS | AD7280A_CTRL_HB_CONV_START_CS |
st->ctrl_hb); st->ctrl_hb);
if (ret) if (ret)
return ret; return ret;
...@@ -342,24 +342,24 @@ static int ad7280_chain_setup(struct ad7280_state *st) ...@@ -342,24 +342,24 @@ static int ad7280_chain_setup(struct ad7280_state *st)
int ret; int ret;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_LB, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_LB, 1,
AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN | AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN |
AD7280A_CTRL_LB_LOCK_DEV_ADDR | AD7280A_CTRL_LB_LOCK_DEV_ADDR |
AD7280A_CTRL_LB_MUST_SET | AD7280A_CTRL_LB_MUST_SET |
AD7280A_CTRL_LB_SWRST | AD7280A_CTRL_LB_SWRST |
st->ctrl_lb); st->ctrl_lb);
if (ret) if (ret)
return ret; return ret;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_LB, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_LB, 1,
AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN | AD7280A_CTRL_LB_DAISY_CHAIN_RB_EN |
AD7280A_CTRL_LB_LOCK_DEV_ADDR | AD7280A_CTRL_LB_LOCK_DEV_ADDR |
AD7280A_CTRL_LB_MUST_SET | AD7280A_CTRL_LB_MUST_SET |
st->ctrl_lb); st->ctrl_lb);
if (ret) if (ret)
return ret; return ret;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_READ, 1, ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_READ, 1,
AD7280A_CONTROL_LB << 2); AD7280A_CONTROL_LB << 2);
if (ret) if (ret)
return ret; return ret;
...@@ -379,8 +379,8 @@ static int ad7280_chain_setup(struct ad7280_state *st) ...@@ -379,8 +379,8 @@ static int ad7280_chain_setup(struct ad7280_state *st)
} }
static ssize_t ad7280_show_balance_sw(struct device *dev, 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_to_iio_dev(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);
...@@ -392,9 +392,9 @@ static ssize_t ad7280_show_balance_sw(struct device *dev, ...@@ -392,9 +392,9 @@ static ssize_t ad7280_show_balance_sw(struct device *dev,
} }
static ssize_t ad7280_store_balance_sw(struct device *dev, static ssize_t ad7280_store_balance_sw(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -424,8 +424,8 @@ static ssize_t ad7280_store_balance_sw(struct device *dev, ...@@ -424,8 +424,8 @@ static ssize_t ad7280_store_balance_sw(struct device *dev,
} }
static ssize_t ad7280_show_balance_timer(struct device *dev, 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_to_iio_dev(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);
...@@ -435,7 +435,7 @@ static ssize_t ad7280_show_balance_timer(struct device *dev, ...@@ -435,7 +435,7 @@ static ssize_t ad7280_show_balance_timer(struct device *dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
ret = ad7280_read(st, this_attr->address >> 8, ret = ad7280_read(st, this_attr->address >> 8,
this_attr->address & 0xFF); this_attr->address & 0xFF);
mutex_unlock(&indio_dev->mlock); mutex_unlock(&indio_dev->mlock);
if (ret < 0) if (ret < 0)
...@@ -447,9 +447,9 @@ static ssize_t ad7280_show_balance_timer(struct device *dev, ...@@ -447,9 +447,9 @@ static ssize_t ad7280_show_balance_timer(struct device *dev,
} }
static ssize_t ad7280_store_balance_timer(struct device *dev, static ssize_t ad7280_store_balance_timer(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -492,8 +492,8 @@ static int ad7280_channel_init(struct ad7280_state *st) ...@@ -492,8 +492,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
return -ENOMEM; return -ENOMEM;
for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) for (dev = 0, cnt = 0; dev <= st->slave_num; dev++)
for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6; ch++, for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6;
cnt++) { ch++, cnt++) {
if (ch < AD7280A_AUX_ADC_1) { if (ch < AD7280A_AUX_ADC_1) {
st->channels[cnt].type = IIO_VOLTAGE; st->channels[cnt].type = IIO_VOLTAGE;
st->channels[cnt].differential = 1; st->channels[cnt].differential = 1;
...@@ -566,9 +566,9 @@ static int ad7280_attr_init(struct ad7280_state *st) ...@@ -566,9 +566,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
ad7280_store_balance_sw; ad7280_store_balance_sw;
st->iio_attr[cnt].dev_attr.attr.name = st->iio_attr[cnt].dev_attr.attr.name =
kasprintf(GFP_KERNEL, kasprintf(GFP_KERNEL,
"in%d-in%d_balance_switch_en", "in%d-in%d_balance_switch_en",
(dev * AD7280A_CELLS_PER_DEV) + ch, dev * AD7280A_CELLS_PER_DEV + ch,
(dev * AD7280A_CELLS_PER_DEV) + ch + 1); dev * AD7280A_CELLS_PER_DEV + ch + 1);
ad7280_attributes[cnt] = ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr; &st->iio_attr[cnt].dev_attr.attr;
cnt++; cnt++;
...@@ -582,9 +582,10 @@ static int ad7280_attr_init(struct ad7280_state *st) ...@@ -582,9 +582,10 @@ static int ad7280_attr_init(struct ad7280_state *st)
st->iio_attr[cnt].dev_attr.store = st->iio_attr[cnt].dev_attr.store =
ad7280_store_balance_timer; ad7280_store_balance_timer;
st->iio_attr[cnt].dev_attr.attr.name = st->iio_attr[cnt].dev_attr.attr.name =
kasprintf(GFP_KERNEL, "in%d-in%d_balance_timer", kasprintf(GFP_KERNEL,
(dev * AD7280A_CELLS_PER_DEV) + ch, "in%d-in%d_balance_timer",
(dev * AD7280A_CELLS_PER_DEV) + ch + 1); dev * AD7280A_CELLS_PER_DEV + ch,
dev * AD7280A_CELLS_PER_DEV + ch + 1);
ad7280_attributes[cnt] = ad7280_attributes[cnt] =
&st->iio_attr[cnt].dev_attr.attr; &st->iio_attr[cnt].dev_attr.attr;
} }
...@@ -595,8 +596,8 @@ static int ad7280_attr_init(struct ad7280_state *st) ...@@ -595,8 +596,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
} }
static ssize_t ad7280_read_channel_config(struct device *dev, 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_to_iio_dev(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);
...@@ -624,9 +625,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev, ...@@ -624,9 +625,9 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
} }
static ssize_t ad7280_write_channel_config(struct device *dev, static ssize_t ad7280_write_channel_config(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -698,39 +699,41 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) ...@@ -698,39 +699,41 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
if (((channels[i] >> 11) & 0xFFF) >= if (((channels[i] >> 11) & 0xFFF) >=
st->cell_threshhigh) st->cell_threshhigh)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_EVENT_CODE(IIO_VOLTAGE, IIO_EVENT_CODE(IIO_VOLTAGE,
1, 1,
0, 0,
IIO_EV_DIR_RISING, IIO_EV_DIR_RISING,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
0, 0, 0), 0, 0, 0),
iio_get_time_ns()); iio_get_time_ns());
else if (((channels[i] >> 11) & 0xFFF) <= else if (((channels[i] >> 11) & 0xFFF) <=
st->cell_threshlow) st->cell_threshlow)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_EVENT_CODE(IIO_VOLTAGE, IIO_EVENT_CODE(IIO_VOLTAGE,
1, 1,
0, 0,
IIO_EV_DIR_FALLING, IIO_EV_DIR_FALLING,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
0, 0, 0), 0, 0, 0),
iio_get_time_ns()); iio_get_time_ns());
} else { } else {
if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh) if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(
0, IIO_TEMP,
IIO_EV_TYPE_THRESH, 0,
IIO_EV_DIR_RISING), IIO_EV_TYPE_THRESH,
iio_get_time_ns()); IIO_EV_DIR_RISING),
iio_get_time_ns());
else if (((channels[i] >> 11) & 0xFFF) <= else if (((channels[i] >> 11) & 0xFFF) <=
st->aux_threshlow) st->aux_threshlow)
iio_push_event(indio_dev, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(
0, IIO_TEMP,
IIO_EV_TYPE_THRESH, 0,
IIO_EV_DIR_FALLING), IIO_EV_TYPE_THRESH,
iio_get_time_ns()); IIO_EV_DIR_FALLING),
iio_get_time_ns());
} }
} }
...@@ -955,7 +958,7 @@ static int ad7280_remove(struct spi_device *spi) ...@@ -955,7 +958,7 @@ static int ad7280_remove(struct spi_device *spi)
iio_device_unregister(indio_dev); iio_device_unregister(indio_dev);
ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1, ad7280_write(st, AD7280A_DEVADDR_MASTER, AD7280A_CONTROL_HB, 1,
AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb); AD7280A_CTRL_HB_PWRDN_SW | st->ctrl_hb);
kfree(st->channels); kfree(st->channels);
kfree(st->iio_attr); kfree(st->iio_attr);
......
...@@ -108,7 +108,7 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, ...@@ -108,7 +108,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_to_iio_dev(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);
...@@ -117,7 +117,8 @@ static ssize_t ad7606_show_range(struct device *dev, ...@@ -117,7 +117,8 @@ 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_to_iio_dev(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);
...@@ -145,7 +146,8 @@ static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR, ...@@ -145,7 +146,8 @@ static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR,
static IIO_CONST_ATTR(in_voltage_range_available, "5000 10000"); 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_to_iio_dev(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);
...@@ -166,7 +168,8 @@ static int ad7606_oversampling_get_index(unsigned val) ...@@ -166,7 +168,8 @@ 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_to_iio_dev(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);
...@@ -460,9 +463,9 @@ static const struct iio_info ad7606_info_range = { ...@@ -460,9 +463,9 @@ static const struct iio_info ad7606_info_range = {
}; };
struct iio_dev *ad7606_probe(struct device *dev, int irq, struct iio_dev *ad7606_probe(struct device *dev, int irq,
void __iomem *base_address, void __iomem *base_address,
unsigned id, unsigned id,
const struct ad7606_bus_ops *bops) const struct ad7606_bus_ops *bops)
{ {
struct ad7606_platform_data *pdata = dev->platform_data; struct ad7606_platform_data *pdata = dev->platform_data;
struct ad7606_state *st; struct ad7606_state *st;
...@@ -529,7 +532,7 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq, ...@@ -529,7 +532,7 @@ struct iio_dev *ad7606_probe(struct device *dev, int irq,
dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n"); dev_warn(st->dev, "failed to RESET: no RESET GPIO specified\n");
ret = request_irq(irq, ad7606_interrupt, ret = request_irq(irq, ad7606_interrupt,
IRQF_TRIGGER_FALLING, st->chip_info->name, indio_dev); IRQF_TRIGGER_FALLING, st->chip_info->name, indio_dev);
if (ret) if (ret)
goto error_free_gpios; goto error_free_gpios;
...@@ -591,7 +594,7 @@ void ad7606_resume(struct iio_dev *indio_dev) ...@@ -591,7 +594,7 @@ void ad7606_resume(struct iio_dev *indio_dev)
if (gpio_is_valid(st->pdata->gpio_stby)) { if (gpio_is_valid(st->pdata->gpio_stby)) {
if (gpio_is_valid(st->pdata->gpio_range)) if (gpio_is_valid(st->pdata->gpio_range))
gpio_set_value(st->pdata->gpio_range, gpio_set_value(st->pdata->gpio_range,
st->range == 10000); st->range == 10000);
gpio_set_value(st->pdata->gpio_stby, 1); gpio_set_value(st->pdata->gpio_stby, 1);
ad7606_reset(st); ad7606_reset(st);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "ad7606.h" #include "ad7606.h"
static int ad7606_par16_read_block(struct device *dev, static int ad7606_par16_read_block(struct device *dev,
int count, void *buf) int count, void *buf)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct iio_dev *indio_dev = platform_get_drvdata(pdev);
...@@ -32,7 +32,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = { ...@@ -32,7 +32,7 @@ static const struct ad7606_bus_ops ad7606_par16_bops = {
}; };
static int ad7606_par8_read_block(struct device *dev, static int ad7606_par8_read_block(struct device *dev,
int count, void *buf) int count, void *buf)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct iio_dev *indio_dev = platform_get_drvdata(pdev);
...@@ -69,9 +69,9 @@ static int ad7606_par_probe(struct platform_device *pdev) ...@@ -69,9 +69,9 @@ static int ad7606_par_probe(struct platform_device *pdev)
remap_size = resource_size(res); remap_size = resource_size(res);
indio_dev = ad7606_probe(&pdev->dev, irq, addr, indio_dev = ad7606_probe(&pdev->dev, irq, addr,
platform_get_device_id(pdev)->driver_data, platform_get_device_id(pdev)->driver_data,
remap_size > 1 ? &ad7606_par16_bops : remap_size > 1 ? &ad7606_par16_bops :
&ad7606_par8_bops); &ad7606_par8_bops);
if (IS_ERR(indio_dev)) if (IS_ERR(indio_dev))
return PTR_ERR(indio_dev); return PTR_ERR(indio_dev);
......
...@@ -44,8 +44,8 @@ static int ad7606_spi_probe(struct spi_device *spi) ...@@ -44,8 +44,8 @@ static int ad7606_spi_probe(struct spi_device *spi)
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
indio_dev = ad7606_probe(&spi->dev, spi->irq, NULL, indio_dev = ad7606_probe(&spi->dev, spi->irq, NULL,
spi_get_device_id(spi)->driver_data, spi_get_device_id(spi)->driver_data,
&ad7606_spi_bops); &ad7606_spi_bops);
if (IS_ERR(indio_dev)) if (IS_ERR(indio_dev))
return PTR_ERR(indio_dev); return PTR_ERR(indio_dev);
......
...@@ -62,7 +62,7 @@ static struct ad7780_state *ad_sigma_delta_to_ad7780(struct ad_sigma_delta *sd) ...@@ -62,7 +62,7 @@ static struct ad7780_state *ad_sigma_delta_to_ad7780(struct ad_sigma_delta *sd)
} }
static int ad7780_set_mode(struct ad_sigma_delta *sigma_delta, static int ad7780_set_mode(struct ad_sigma_delta *sigma_delta,
enum ad_sigma_delta_mode mode) enum ad_sigma_delta_mode mode)
{ {
struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta); struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta);
unsigned val; unsigned val;
...@@ -107,13 +107,13 @@ static int ad7780_read_raw(struct iio_dev *indio_dev, ...@@ -107,13 +107,13 @@ static int ad7780_read_raw(struct iio_dev *indio_dev,
} }
static int ad7780_postprocess_sample(struct ad_sigma_delta *sigma_delta, static int ad7780_postprocess_sample(struct ad_sigma_delta *sigma_delta,
unsigned int raw_sample) unsigned int raw_sample)
{ {
struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta); struct ad7780_state *st = ad_sigma_delta_to_ad7780(sigma_delta);
const struct ad7780_chip_info *chip_info = st->chip_info; const struct ad7780_chip_info *chip_info = st->chip_info;
if ((raw_sample & AD7780_ERR) || if ((raw_sample & AD7780_ERR) ||
((raw_sample & chip_info->pattern_mask) != chip_info->pattern)) ((raw_sample & chip_info->pattern_mask) != chip_info->pattern))
return -EIO; return -EIO;
if (raw_sample & AD7780_GAIN) if (raw_sample & AD7780_GAIN)
...@@ -207,8 +207,10 @@ static int ad7780_probe(struct spi_device *spi) ...@@ -207,8 +207,10 @@ static int ad7780_probe(struct spi_device *spi)
if (pdata && gpio_is_valid(pdata->gpio_pdrst)) { if (pdata && gpio_is_valid(pdata->gpio_pdrst)) {
ret = devm_gpio_request_one(&spi->dev, pdata->gpio_pdrst, ret = devm_gpio_request_one(&spi->dev,
GPIOF_OUT_INIT_LOW, "AD7780 /PDRST"); pdata->gpio_pdrst,
GPIOF_OUT_INIT_LOW,
"AD7780 /PDRST");
if (ret) { if (ret) {
dev_err(&spi->dev, "failed to request GPIO PDRST\n"); dev_err(&spi->dev, "failed to request GPIO PDRST\n");
goto error_disable_reg; goto error_disable_reg;
......
...@@ -110,8 +110,8 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data) ...@@ -110,8 +110,8 @@ static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)
} }
static ssize_t ad7816_show_mode(struct device *dev, 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_to_iio_dev(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);
...@@ -122,9 +122,9 @@ static ssize_t ad7816_show_mode(struct device *dev, ...@@ -122,9 +122,9 @@ static ssize_t ad7816_show_mode(struct device *dev,
} }
static ssize_t ad7816_store_mode(struct device *dev, static ssize_t ad7816_store_mode(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -146,8 +146,8 @@ static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, ...@@ -146,8 +146,8 @@ static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
0); 0);
static ssize_t ad7816_show_available_modes(struct device *dev, static ssize_t ad7816_show_available_modes(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "full\npower-save\n"); return sprintf(buf, "full\npower-save\n");
} }
...@@ -156,8 +156,8 @@ static IIO_DEVICE_ATTR(available_modes, S_IRUGO, ad7816_show_available_modes, ...@@ -156,8 +156,8 @@ static IIO_DEVICE_ATTR(available_modes, S_IRUGO, ad7816_show_available_modes,
NULL, 0); NULL, 0);
static ssize_t ad7816_show_channel(struct device *dev, 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_to_iio_dev(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);
...@@ -166,9 +166,9 @@ static ssize_t ad7816_show_channel(struct device *dev, ...@@ -166,9 +166,9 @@ static ssize_t ad7816_show_channel(struct device *dev,
} }
static ssize_t ad7816_store_channel(struct device *dev, static ssize_t ad7816_store_channel(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -205,8 +205,8 @@ static IIO_DEVICE_ATTR(channel, S_IRUGO | S_IWUSR, ...@@ -205,8 +205,8 @@ static IIO_DEVICE_ATTR(channel, S_IRUGO | S_IWUSR,
static ssize_t ad7816_show_value(struct device *dev, 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_to_iio_dev(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);
...@@ -260,8 +260,8 @@ static irqreturn_t ad7816_event_handler(int irq, void *private) ...@@ -260,8 +260,8 @@ static irqreturn_t ad7816_event_handler(int irq, void *private)
} }
static ssize_t ad7816_show_oti(struct device *dev, 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_to_iio_dev(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);
...@@ -280,9 +280,9 @@ static ssize_t ad7816_show_oti(struct device *dev, ...@@ -280,9 +280,9 @@ static ssize_t ad7816_show_oti(struct device *dev,
} }
static inline ssize_t ad7816_set_oti(struct device *dev, static inline ssize_t ad7816_set_oti(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, const char *buf,
size_t len) size_t len)
{ {
struct iio_dev *indio_dev = dev_to_iio_dev(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);
...@@ -299,7 +299,7 @@ static inline ssize_t ad7816_set_oti(struct device *dev, ...@@ -299,7 +299,7 @@ static inline ssize_t ad7816_set_oti(struct device *dev,
return -EINVAL; return -EINVAL;
} else if (chip->channel_id == 0) { } else if (chip->channel_id == 0) {
if (ret || value < AD7816_BOUND_VALUE_MIN || if (ret || value < AD7816_BOUND_VALUE_MIN ||
value > AD7816_BOUND_VALUE_MAX) value > AD7816_BOUND_VALUE_MAX)
return -EINVAL; return -EINVAL;
data = (u8)(value - AD7816_BOUND_VALUE_MIN + data = (u8)(value - AD7816_BOUND_VALUE_MIN +
...@@ -371,7 +371,7 @@ static int ad7816_probe(struct spi_device *spi_dev) ...@@ -371,7 +371,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
chip->busy_pin = pins[2]; chip->busy_pin = pins[2];
ret = devm_gpio_request(&spi_dev->dev, chip->rdwr_pin, ret = devm_gpio_request(&spi_dev->dev, chip->rdwr_pin,
spi_get_device_id(spi_dev)->name); spi_get_device_id(spi_dev)->name);
if (ret) { if (ret) {
dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n", dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n",
chip->rdwr_pin); chip->rdwr_pin);
...@@ -379,7 +379,7 @@ static int ad7816_probe(struct spi_device *spi_dev) ...@@ -379,7 +379,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
} }
gpio_direction_input(chip->rdwr_pin); gpio_direction_input(chip->rdwr_pin);
ret = devm_gpio_request(&spi_dev->dev, chip->convert_pin, ret = devm_gpio_request(&spi_dev->dev, chip->convert_pin,
spi_get_device_id(spi_dev)->name); spi_get_device_id(spi_dev)->name);
if (ret) { if (ret) {
dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n", dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n",
chip->convert_pin); chip->convert_pin);
...@@ -387,7 +387,7 @@ static int ad7816_probe(struct spi_device *spi_dev) ...@@ -387,7 +387,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
} }
gpio_direction_input(chip->convert_pin); gpio_direction_input(chip->convert_pin);
ret = devm_gpio_request(&spi_dev->dev, chip->busy_pin, ret = devm_gpio_request(&spi_dev->dev, chip->busy_pin,
spi_get_device_id(spi_dev)->name); spi_get_device_id(spi_dev)->name);
if (ret) { if (ret) {
dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n", dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n",
chip->busy_pin); chip->busy_pin);
...@@ -417,7 +417,7 @@ static int ad7816_probe(struct spi_device *spi_dev) ...@@ -417,7 +417,7 @@ static int ad7816_probe(struct spi_device *spi_dev)
return ret; return ret;
dev_info(&spi_dev->dev, "%s temperature sensor and ADC registered.\n", dev_info(&spi_dev->dev, "%s temperature sensor and ADC registered.\n",
indio_dev->name); indio_dev->name);
return 0; return 0;
} }
......
...@@ -67,10 +67,10 @@ struct lpc32xx_adc_info { ...@@ -67,10 +67,10 @@ struct lpc32xx_adc_info {
}; };
static int lpc32xx_read_raw(struct iio_dev *indio_dev, static int lpc32xx_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int *val, int *val,
int *val2, int *val2,
long mask) long mask)
{ {
struct lpc32xx_adc_info *info = iio_priv(indio_dev); struct lpc32xx_adc_info *info = iio_priv(indio_dev);
...@@ -79,10 +79,10 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, ...@@ -79,10 +79,10 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
clk_enable(info->clk); clk_enable(info->clk);
/* Measurement setup */ /* Measurement setup */
__raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, __raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm,
LPC32XX_ADC_SELECT(info->adc_base)); LPC32XX_ADC_SELECT(info->adc_base));
/* Trigger conversion */ /* Trigger conversion */
__raw_writel(AD_PDN_CTRL | AD_STROBE, __raw_writel(AD_PDN_CTRL | AD_STROBE,
LPC32XX_ADC_CTRL(info->adc_base)); LPC32XX_ADC_CTRL(info->adc_base));
wait_for_completion(&info->completion); /* set by ISR */ wait_for_completion(&info->completion); /* set by ISR */
clk_disable(info->clk); clk_disable(info->clk);
*val = info->value; *val = info->value;
...@@ -166,7 +166,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev) ...@@ -166,7 +166,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
} }
retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
MOD_NAME, info); MOD_NAME, info);
if (retval < 0) { if (retval < 0) {
dev_err(&pdev->dev, "failed requesting interrupt\n"); dev_err(&pdev->dev, "failed requesting interrupt\n");
return retval; return retval;
......
This diff is collapsed.
...@@ -191,8 +191,8 @@ static int spear_adc_write_raw(struct iio_dev *indio_dev, ...@@ -191,8 +191,8 @@ static int spear_adc_write_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if ((val < SPEAR_ADC_CLK_MIN) || if ((val < SPEAR_ADC_CLK_MIN) ||
(val > SPEAR_ADC_CLK_MAX) || (val > SPEAR_ADC_CLK_MAX) ||
(val2 != 0)) { (val2 != 0)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
......
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