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

staging:iio: Rename IIO_EVENT_CODE_EXTRACT_NUM to IIO_EVENT_CODE_EXTRACT_CHAN

We name this field "chan" throughout IIO with the exception of this one macro.
Rename it to be more consistent.
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 6da507bc
...@@ -321,7 +321,7 @@ static int ad7291_read_event_value(struct iio_dev *indio_dev, ...@@ -321,7 +321,7 @@ static int ad7291_read_event_value(struct iio_dev *indio_dev,
switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
reg = ad7291_limit_regs[IIO_EVENT_CODE_EXTRACT_NUM(event_code)] reg = ad7291_limit_regs[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)]
[!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == [!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_RISING)]; IIO_EV_DIR_RISING)];
...@@ -359,7 +359,7 @@ static int ad7291_write_event_value(struct iio_dev *indio_dev, ...@@ -359,7 +359,7 @@ static int ad7291_write_event_value(struct iio_dev *indio_dev,
case IIO_VOLTAGE: case IIO_VOLTAGE:
if (val > AD7291_VALUE_MASK || val < 0) if (val > AD7291_VALUE_MASK || val < 0)
return -EINVAL; return -EINVAL;
reg = ad7291_limit_regs[IIO_EVENT_CODE_EXTRACT_NUM(event_code)] reg = ad7291_limit_regs[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)]
[!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == [!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_RISING)]; IIO_EV_DIR_RISING)];
return ad7291_i2c_write(chip, reg, val); return ad7291_i2c_write(chip, reg, val);
...@@ -386,7 +386,7 @@ static int ad7291_read_event_config(struct iio_dev *indio_dev, ...@@ -386,7 +386,7 @@ static int ad7291_read_event_config(struct iio_dev *indio_dev,
switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) { switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
if (chip->c_mask & if (chip->c_mask &
(1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM(event_code)))) (1 << (15 - IIO_EVENT_CODE_EXTRACT_CHAN(event_code))))
return 1; return 1;
else else
return 0; return 0;
...@@ -418,12 +418,12 @@ static int ad7291_write_event_config(struct iio_dev *indio_dev, ...@@ -418,12 +418,12 @@ static int ad7291_write_event_config(struct iio_dev *indio_dev,
switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) { switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
if ((!state) && (chip->c_mask & (1 << (15 - if ((!state) && (chip->c_mask & (1 << (15 -
IIO_EVENT_CODE_EXTRACT_NUM(event_code))))) IIO_EVENT_CODE_EXTRACT_CHAN(event_code)))))
chip->c_mask &= ~(1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM chip->c_mask &= ~(1 << (15 - IIO_EVENT_CODE_EXTRACT_CHAN
(event_code))); (event_code)));
else if (state && (!(chip->c_mask & (1 << (15 - else if (state && (!(chip->c_mask & (1 << (15 -
IIO_EVENT_CODE_EXTRACT_NUM(event_code)))))) IIO_EVENT_CODE_EXTRACT_CHAN(event_code))))))
chip->c_mask |= (1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM chip->c_mask |= (1 << (15 - IIO_EVENT_CODE_EXTRACT_CHAN
(event_code))); (event_code)));
else else
break; break;
......
...@@ -256,7 +256,7 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, ...@@ -256,7 +256,7 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,
struct ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
int direction = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == int direction = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_FALLING); IIO_EV_DIR_FALLING);
int number = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int number = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
ret = ad799x_i2c_write16(st, ret = ad799x_i2c_write16(st,
...@@ -275,7 +275,7 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, ...@@ -275,7 +275,7 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev,
struct ad799x_state *st = iio_priv(indio_dev); struct ad799x_state *st = iio_priv(indio_dev);
int direction = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == int direction = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_FALLING); IIO_EV_DIR_FALLING);
int number = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int number = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
u16 valin; u16 valin;
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
......
...@@ -543,9 +543,9 @@ static int max1363_read_thresh(struct iio_dev *indio_dev, ...@@ -543,9 +543,9 @@ static int max1363_read_thresh(struct iio_dev *indio_dev,
{ {
struct max1363_state *st = iio_priv(indio_dev); struct max1363_state *st = iio_priv(indio_dev);
if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_FALLING) if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_FALLING)
*val = st->thresh_low[IIO_EVENT_CODE_EXTRACT_NUM(event_code)]; *val = st->thresh_low[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)];
else else
*val = st->thresh_high[IIO_EVENT_CODE_EXTRACT_NUM(event_code)]; *val = st->thresh_high[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)];
return 0; return 0;
} }
...@@ -568,10 +568,10 @@ static int max1363_write_thresh(struct iio_dev *indio_dev, ...@@ -568,10 +568,10 @@ static int max1363_write_thresh(struct iio_dev *indio_dev,
switch (IIO_EVENT_CODE_EXTRACT_DIR(event_code)) { switch (IIO_EVENT_CODE_EXTRACT_DIR(event_code)) {
case IIO_EV_DIR_FALLING: case IIO_EV_DIR_FALLING:
st->thresh_low[IIO_EVENT_CODE_EXTRACT_NUM(event_code)] = val; st->thresh_low[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)] = val;
break; break;
case IIO_EV_DIR_RISING: case IIO_EV_DIR_RISING:
st->thresh_high[IIO_EVENT_CODE_EXTRACT_NUM(event_code)] = val; st->thresh_high[IIO_EVENT_CODE_EXTRACT_CHAN(event_code)] = val;
break; break;
} }
...@@ -622,7 +622,7 @@ static int max1363_read_event_config(struct iio_dev *indio_dev, ...@@ -622,7 +622,7 @@ static int max1363_read_event_config(struct iio_dev *indio_dev,
struct max1363_state *st = iio_priv(indio_dev); struct max1363_state *st = iio_priv(indio_dev);
int val; int val;
int number = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int number = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_FALLING) if (IIO_EVENT_CODE_EXTRACT_DIR(event_code) == IIO_EV_DIR_FALLING)
val = (1 << number) & st->mask_low; val = (1 << number) & st->mask_low;
...@@ -775,7 +775,7 @@ static int max1363_write_event_config(struct iio_dev *indio_dev, ...@@ -775,7 +775,7 @@ static int max1363_write_event_config(struct iio_dev *indio_dev,
int ret = 0; int ret = 0;
struct max1363_state *st = iio_priv(indio_dev); struct max1363_state *st = iio_priv(indio_dev);
u16 unifiedmask; u16 unifiedmask;
int number = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int number = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
unifiedmask = st->mask_low | st->mask_high; unifiedmask = st->mask_low | st->mask_high;
......
...@@ -167,7 +167,7 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev, u64 event_code) ...@@ -167,7 +167,7 @@ static int ad7150_write_event_params(struct iio_dev *indio_dev, u64 event_code)
u16 value; u16 value;
u8 sens, timeout; u8 sens, timeout;
struct ad7150_chip_info *chip = iio_priv(indio_dev); struct ad7150_chip_info *chip = iio_priv(indio_dev);
int chan = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int chan = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_RISING); IIO_EV_DIR_RISING);
...@@ -279,7 +279,7 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev, ...@@ -279,7 +279,7 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev,
u64 event_code, u64 event_code,
int *val) int *val)
{ {
int chan = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int chan = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
struct ad7150_chip_info *chip = iio_priv(indio_dev); struct ad7150_chip_info *chip = iio_priv(indio_dev);
int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_RISING); IIO_EV_DIR_RISING);
...@@ -309,7 +309,7 @@ static int ad7150_write_event_value(struct iio_dev *indio_dev, ...@@ -309,7 +309,7 @@ static int ad7150_write_event_value(struct iio_dev *indio_dev,
{ {
int ret; int ret;
struct ad7150_chip_info *chip = iio_priv(indio_dev); struct ad7150_chip_info *chip = iio_priv(indio_dev);
int chan = IIO_EVENT_CODE_EXTRACT_NUM(event_code); int chan = IIO_EVENT_CODE_EXTRACT_CHAN(event_code);
int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) == int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(event_code) ==
IIO_EV_DIR_RISING); IIO_EV_DIR_RISING);
...@@ -347,7 +347,7 @@ static ssize_t ad7150_show_timeout(struct device *dev, ...@@ -347,7 +347,7 @@ static ssize_t ad7150_show_timeout(struct device *dev,
u8 value; u8 value;
/* use the event code for consistency reasons */ /* use the event code for consistency reasons */
int chan = IIO_EVENT_CODE_EXTRACT_NUM(this_attr->address); int chan = IIO_EVENT_CODE_EXTRACT_CHAN(this_attr->address);
int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address) int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address)
== IIO_EV_DIR_RISING); == IIO_EV_DIR_RISING);
...@@ -373,7 +373,7 @@ static ssize_t ad7150_store_timeout(struct device *dev, ...@@ -373,7 +373,7 @@ static ssize_t ad7150_store_timeout(struct device *dev,
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7150_chip_info *chip = iio_priv(indio_dev); struct ad7150_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);
int chan = IIO_EVENT_CODE_EXTRACT_NUM(this_attr->address); int chan = IIO_EVENT_CODE_EXTRACT_CHAN(this_attr->address);
int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address) == int rising = !!(IIO_EVENT_CODE_EXTRACT_DIR(this_attr->address) ==
IIO_EV_DIR_RISING); IIO_EV_DIR_RISING);
u8 data; u8 data;
......
...@@ -96,7 +96,7 @@ enum iio_event_direction { ...@@ -96,7 +96,7 @@ enum iio_event_direction {
/* Event code number extraction depends on which type of event we have. /* Event code number extraction depends on which type of event we have.
* Perhaps review this function in the future*/ * Perhaps review this function in the future*/
#define IIO_EVENT_CODE_EXTRACT_NUM(mask) ((__s16)(mask & 0xFFFF)) #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF) #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
......
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