提交 5aa96188 编写于 作者: J Jonathan Cameron 提交者: Greg Kroah-Hartman

staging:iio: remove broken support for multiple event interfaces.

We don't have a use case for these.  Two drivers appeared to use them
but both report all events on the first.

V2: Remove now irrelevant comment.
V3: Include fixup for adc/ad7280a.c
Signed-off-by: NJonathan Cameron <jic23@cam.ac.uk>
Acked-by: NMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 b3874069
...@@ -452,7 +452,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -452,7 +452,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
&t); &t);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_HIGH)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Z, IIO_MOD_Z,
...@@ -461,7 +461,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -461,7 +461,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
timestamp); timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_LOW) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Z_LOW)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Z, IIO_MOD_Z,
...@@ -470,7 +470,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -470,7 +470,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
timestamp); timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_HIGH) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_HIGH)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Y, IIO_MOD_Y,
...@@ -479,7 +479,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -479,7 +479,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
timestamp); timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_LOW) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_Y_LOW)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Y, IIO_MOD_Y,
...@@ -488,7 +488,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -488,7 +488,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
timestamp); timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_HIGH) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_HIGH)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_X, IIO_MOD_X,
...@@ -497,7 +497,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private) ...@@ -497,7 +497,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
timestamp); timestamp);
if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_LOW) if (t & LIS3L02DQ_REG_WAKE_UP_SRC_INTERRUPT_X_LOW)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_X, IIO_MOD_X,
...@@ -651,7 +651,6 @@ static const struct attribute_group lis3l02dq_attribute_group = { ...@@ -651,7 +651,6 @@ static const struct attribute_group lis3l02dq_attribute_group = {
}; };
static const struct iio_info lis3l02dq_info = { static const struct iio_info lis3l02dq_info = {
.num_interrupt_lines = 1,
.read_raw = &lis3l02dq_read_raw, .read_raw = &lis3l02dq_read_raw,
.write_raw = &lis3l02dq_write_raw, .write_raw = &lis3l02dq_write_raw,
.read_event_value = &lis3l02dq_read_thresh, .read_event_value = &lis3l02dq_read_thresh,
......
...@@ -815,7 +815,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private) ...@@ -815,7 +815,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private)
sca3000_ring_int_process(val, indio_dev->ring); sca3000_ring_int_process(val, indio_dev->ring);
if (val & SCA3000_INT_STATUS_FREE_FALL) if (val & SCA3000_INT_STATUS_FREE_FALL)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_X_AND_Y_AND_Z, IIO_MOD_X_AND_Y_AND_Z,
...@@ -824,7 +824,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private) ...@@ -824,7 +824,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private)
last_timestamp); last_timestamp);
if (val & SCA3000_INT_STATUS_Y_TRIGGER) if (val & SCA3000_INT_STATUS_Y_TRIGGER)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Y, IIO_MOD_Y,
...@@ -833,7 +833,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private) ...@@ -833,7 +833,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private)
last_timestamp); last_timestamp);
if (val & SCA3000_INT_STATUS_X_TRIGGER) if (val & SCA3000_INT_STATUS_X_TRIGGER)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_X, IIO_MOD_X,
...@@ -842,7 +842,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private) ...@@ -842,7 +842,7 @@ static irqreturn_t sca3000_event_handler(int irq, void *private)
last_timestamp); last_timestamp);
if (val & SCA3000_INT_STATUS_Z_TRIGGER) if (val & SCA3000_INT_STATUS_Z_TRIGGER)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_MOD_EVENT_CODE(IIO_ACCEL, IIO_MOD_EVENT_CODE(IIO_ACCEL,
0, 0,
IIO_MOD_Z, IIO_MOD_Z,
...@@ -1103,7 +1103,6 @@ static int sca3000_clean_setup(struct sca3000_state *st) ...@@ -1103,7 +1103,6 @@ static int sca3000_clean_setup(struct sca3000_state *st)
static const struct iio_info sca3000_info = { static const struct iio_info sca3000_info = {
.attrs = &sca3000_attribute_group, .attrs = &sca3000_attribute_group,
.read_raw = &sca3000_read_raw, .read_raw = &sca3000_read_raw,
.num_interrupt_lines = 1,
.event_attrs = &sca3000_event_attribute_group, .event_attrs = &sca3000_event_attribute_group,
.read_event_value = &sca3000_read_thresh, .read_event_value = &sca3000_read_thresh,
.write_event_value = &sca3000_write_thresh, .write_event_value = &sca3000_write_thresh,
......
...@@ -653,30 +653,34 @@ static irqreturn_t ad7150_event_handler(int irq, void *private) ...@@ -653,30 +653,34 @@ static irqreturn_t ad7150_event_handler(int irq, void *private)
ad7150_i2c_read(chip, AD7150_STATUS, &int_status, 1); ad7150_i2c_read(chip, AD7150_STATUS, &int_status, 1);
if ((int_status & AD7150_STATUS_OUT1) && !(chip->old_state & AD7150_STATUS_OUT1)) if ((int_status & AD7150_STATUS_OUT1) &&
iio_push_event(indio_dev, 0, !(chip->old_state & AD7150_STATUS_OUT1))
iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
timestamp); timestamp);
else if ((!(int_status & AD7150_STATUS_OUT1)) && (chip->old_state & AD7150_STATUS_OUT1)) else if ((!(int_status & AD7150_STATUS_OUT1)) &&
iio_push_event(indio_dev, 0, (chip->old_state & AD7150_STATUS_OUT1))
iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if ((int_status & AD7150_STATUS_OUT2) && !(chip->old_state & AD7150_STATUS_OUT2)) if ((int_status & AD7150_STATUS_OUT2) &&
iio_push_event(indio_dev, 0, !(chip->old_state & AD7150_STATUS_OUT2))
iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
1, 1,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
timestamp); timestamp);
else if ((!(int_status & AD7150_STATUS_OUT2)) && (chip->old_state & AD7150_STATUS_OUT2)) else if ((!(int_status & AD7150_STATUS_OUT2)) &&
iio_push_event(indio_dev, 0, (chip->old_state & AD7150_STATUS_OUT2))
iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
1, 1,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -705,7 +709,6 @@ static struct attribute_group ad7150_event_attribute_group = { ...@@ -705,7 +709,6 @@ static struct attribute_group ad7150_event_attribute_group = {
static const struct iio_info ad7150_info = { static const struct iio_info ad7150_info = {
.attrs = &ad7150_attribute_group, .attrs = &ad7150_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &ad7150_event_attribute_group, .event_attrs = &ad7150_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -691,7 +691,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) ...@@ -691,7 +691,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) { if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) {
if (((channels[i] >> 11) & 0xFFF) >= if (((channels[i] >> 11) & 0xFFF) >=
st->cell_threshhigh) st->cell_threshhigh)
iio_push_event(dev_info, 0, iio_push_event(dev_info,
IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF, IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -699,7 +699,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) ...@@ -699,7 +699,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
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(dev_info, 0, iio_push_event(dev_info,
IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF, IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -707,7 +707,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) ...@@ -707,7 +707,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
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(dev_info, 0, iio_push_event(dev_info,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -715,7 +715,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) ...@@ -715,7 +715,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
iio_get_time_ns()); 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(dev_info, 0, iio_push_event(dev_info,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -809,7 +809,6 @@ static int ad7280_read_raw(struct iio_dev *dev_info, ...@@ -809,7 +809,6 @@ static int ad7280_read_raw(struct iio_dev *dev_info,
static const struct iio_info ad7280_info = { static const struct iio_info ad7280_info = {
.read_raw = &ad7280_read_raw, .read_raw = &ad7280_read_raw,
.num_interrupt_lines = 1,
.event_attrs = &ad7280_event_attrs_group, .event_attrs = &ad7280_event_attrs_group,
.attrs = &ad7280_attrs_group, .attrs = &ad7280_attrs_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
......
...@@ -479,28 +479,28 @@ static irqreturn_t ad7291_event_handler(int irq, void *private) ...@@ -479,28 +479,28 @@ static irqreturn_t ad7291_event_handler(int irq, void *private)
ad7291_i2c_write(chip, AD7291_COMMAND, command); ad7291_i2c_write(chip, AD7291_COMMAND, command);
if (t_status & (1 << 0)) if (t_status & (1 << 0))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if (t_status & (1 << 1)) if (t_status & (1 << 1))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
timestamp); timestamp);
if (t_status & (1 << 2)) if (t_status & (1 << 2))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if (t_status & (1 << 3)) if (t_status & (1 << 3))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -509,14 +509,14 @@ static irqreturn_t ad7291_event_handler(int irq, void *private) ...@@ -509,14 +509,14 @@ static irqreturn_t ad7291_event_handler(int irq, void *private)
for (i = 0; i < AD7291_VOLTAGE_LIMIT_COUNT*2; i += 2) { for (i = 0; i < AD7291_VOLTAGE_LIMIT_COUNT*2; i += 2) {
if (v_status & (1 << i)) if (v_status & (1 << i))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
i/2, i/2,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if (v_status & (1 << (i + 1))) if (v_status & (1 << (i + 1)))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
i/2, i/2,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -780,7 +780,6 @@ static struct attribute_group ad7291_event_attribute_group = { ...@@ -780,7 +780,6 @@ static struct attribute_group ad7291_event_attribute_group = {
static const struct iio_info ad7291_info = { static const struct iio_info ad7291_info = {
.attrs = &ad7291_attribute_group, .attrs = &ad7291_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &ad7291_event_attribute_group, .event_attrs = &ad7291_event_attribute_group,
}; };
......
...@@ -540,12 +540,12 @@ static irqreturn_t ad774x_event_handler(int irq, void *private) ...@@ -540,12 +540,12 @@ static irqreturn_t ad774x_event_handler(int irq, void *private)
ad774x_i2c_read(chip, AD774X_STATUS, &int_status, 1); ad774x_i2c_read(chip, AD774X_STATUS, &int_status, 1);
if (int_status & AD774X_STATUS_RDYCAP) if (int_status & AD774X_STATUS_RDYCAP)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_EVENT_CODE_CAP_RDY, IIO_EVENT_CODE_CAP_RDY,
iio_get_time_ns()); iio_get_time_ns());
if (int_status & AD774X_STATUS_RDYVT) if (int_status & AD774X_STATUS_RDYVT)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_EVENT_CODE_VT_RDY, IIO_EVENT_CODE_VT_RDY,
iio_get_time_ns()); iio_get_time_ns());
...@@ -569,7 +569,6 @@ static struct attribute_group ad774x_event_attribute_group = { ...@@ -569,7 +569,6 @@ static struct attribute_group ad774x_event_attribute_group = {
static const struct iio_info ad774x_info = { static const struct iio_info ad774x_info = {
.attrs = &ad774x_event_attribute_group, .attrs = &ad774x_event_attribute_group,
.event_attrs = &ad774x_event_attribute_group, .event_attrs = &ad774x_event_attribute_group,
.num_interrupt_lines = 1,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
/* /*
......
...@@ -254,9 +254,7 @@ static const struct attribute_group ad7816_attribute_group = { ...@@ -254,9 +254,7 @@ static const struct attribute_group ad7816_attribute_group = {
static irqreturn_t ad7816_event_handler(int irq, void *private) static irqreturn_t ad7816_event_handler(int irq, void *private)
{ {
iio_push_event(private, 0, iio_push_event(private, IIO_EVENT_CODE_AD7816_OTI, iio_get_time_ns());
IIO_EVENT_CODE_AD7816_OTI,
iio_get_time_ns());
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -334,7 +332,6 @@ static struct attribute_group ad7816_event_attribute_group = { ...@@ -334,7 +332,6 @@ static struct attribute_group ad7816_event_attribute_group = {
static const struct iio_info ad7816_info = { static const struct iio_info ad7816_info = {
.attrs = &ad7816_attribute_group, .attrs = &ad7816_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &ad7816_event_attribute_group, .event_attrs = &ad7816_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -334,7 +334,7 @@ static irqreturn_t ad799x_event_handler(int irq, void *private) ...@@ -334,7 +334,7 @@ static irqreturn_t ad799x_event_handler(int irq, void *private)
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if (status & (1 << i)) if (status & (1 << i))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
i & 0x1 ? i & 0x1 ?
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
(i >> 1), (i >> 1),
...@@ -474,14 +474,12 @@ static const struct iio_info ad7991_info = { ...@@ -474,14 +474,12 @@ static const struct iio_info ad7991_info = {
static const struct iio_info ad7992_info = { static const struct iio_info ad7992_info = {
.read_raw = &ad799x_read_raw, .read_raw = &ad799x_read_raw,
.num_interrupt_lines = 1,
.event_attrs = &ad7992_event_attrs_group, .event_attrs = &ad7992_event_attrs_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
static const struct iio_info ad7993_4_7_8_info = { static const struct iio_info ad7993_4_7_8_info = {
.read_raw = &ad799x_read_raw, .read_raw = &ad799x_read_raw,
.num_interrupt_lines = 1,
.event_attrs = &ad7993_4_7_8_event_attrs_group, .event_attrs = &ad7993_4_7_8_event_attrs_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -400,19 +400,19 @@ static irqreturn_t adt7310_event_handler(int irq, void *private) ...@@ -400,19 +400,19 @@ static irqreturn_t adt7310_event_handler(int irq, void *private)
return ret; return ret;
if (status & ADT7310_STAT_T_HIGH) if (status & ADT7310_STAT_T_HIGH)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
timestamp); timestamp);
if (status & ADT7310_STAT_T_LOW) if (status & ADT7310_STAT_T_LOW)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if (status & ADT7310_STAT_T_CRIT) if (status & ADT7310_STAT_T_CRIT)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
...@@ -750,7 +750,6 @@ static struct attribute_group adt7310_event_attribute_group[ADT7310_IRQS] = { ...@@ -750,7 +750,6 @@ static struct attribute_group adt7310_event_attribute_group[ADT7310_IRQS] = {
static const struct iio_info adt7310_info = { static const struct iio_info adt7310_info = {
.attrs = &adt7310_attribute_group, .attrs = &adt7310_attribute_group,
.num_interrupt_lines = ADT7310_IRQS,
.event_attrs = adt7310_event_attribute_group, .event_attrs = adt7310_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -366,19 +366,19 @@ static irqreturn_t adt7410_event_handler(int irq, void *private) ...@@ -366,19 +366,19 @@ static irqreturn_t adt7410_event_handler(int irq, void *private)
return IRQ_HANDLED; return IRQ_HANDLED;
if (status & ADT7410_STAT_T_HIGH) if (status & ADT7410_STAT_T_HIGH)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
timestamp); timestamp);
if (status & ADT7410_STAT_T_LOW) if (status & ADT7410_STAT_T_LOW)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
timestamp); timestamp);
if (status & ADT7410_STAT_T_CRIT) if (status & ADT7410_STAT_T_CRIT)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
...@@ -717,7 +717,6 @@ static struct attribute_group adt7410_event_attribute_group[ADT7410_IRQS] = { ...@@ -717,7 +717,6 @@ static struct attribute_group adt7410_event_attribute_group[ADT7410_IRQS] = {
static const struct iio_info adt7410_info = { static const struct iio_info adt7410_info = {
.attrs = &adt7410_attribute_group, .attrs = &adt7410_attribute_group,
.num_interrupt_lines = ADT7410_IRQS,
.event_attrs = adt7410_event_attribute_group, .event_attrs = adt7410_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -265,7 +265,7 @@ static const struct attribute_group adt75_attribute_group = { ...@@ -265,7 +265,7 @@ static const struct attribute_group adt75_attribute_group = {
static irqreturn_t adt75_event_handler(int irq, void *private) static irqreturn_t adt75_event_handler(int irq, void *private)
{ {
iio_push_event(private, 0, iio_push_event(private,
IIO_EVENT_CODE_ADT75_OTI, IIO_EVENT_CODE_ADT75_OTI,
iio_get_time_ns()); iio_get_time_ns());
...@@ -535,7 +535,6 @@ static struct attribute_group adt75_event_attribute_group = { ...@@ -535,7 +535,6 @@ static struct attribute_group adt75_event_attribute_group = {
static const struct iio_info adt75_info = { static const struct iio_info adt75_info = {
.attrs = &adt75_attribute_group, .attrs = &adt75_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &adt75_event_attribute_group, .event_attrs = &adt75_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -615,8 +615,7 @@ static irqreturn_t max1363_event_handler(int irq, void *private) ...@@ -615,8 +615,7 @@ static irqreturn_t max1363_event_handler(int irq, void *private)
i2c_master_recv(st->client, &rx, 1); i2c_master_recv(st->client, &rx, 1);
mask = rx; mask = rx;
for_each_set_bit(loc, &mask, 8) for_each_set_bit(loc, &mask, 8)
iio_push_event(indio_dev, 0, max1363_event_codes[loc], iio_push_event(indio_dev, max1363_event_codes[loc], timestamp);
timestamp);
i2c_master_send(st->client, tx, 2); i2c_master_send(st->client, tx, 2);
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -845,7 +844,6 @@ static const struct iio_info max1363_info = { ...@@ -845,7 +844,6 @@ static const struct iio_info max1363_info = {
.write_event_config = &max1363_write_event_config, .write_event_config = &max1363_write_event_config,
.read_raw = &max1363_read_raw, .read_raw = &max1363_read_raw,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
.num_interrupt_lines = 1,
.event_attrs = &max1363_event_attribute_group, .event_attrs = &max1363_event_attribute_group,
}; };
......
...@@ -1777,43 +1777,43 @@ static irqreturn_t adt7316_event_handler(int irq, void *private) ...@@ -1777,43 +1777,43 @@ static irqreturn_t adt7316_event_handler(int irq, void *private)
time = iio_get_time_ns(); time = iio_get_time_ns();
if (stat1 & (1 << 0)) if (stat1 & (1 << 0))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
time); time);
if (stat1 & (1 << 1)) if (stat1 & (1 << 1))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
time); time);
if (stat1 & (1 << 2)) if (stat1 & (1 << 2))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), IIO_EV_DIR_RISING),
time); time);
if (stat1 & (1 << 3)) if (stat1 & (1 << 3))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1, IIO_UNMOD_EVENT_CODE(IIO_TEMP, 1,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING), IIO_EV_DIR_FALLING),
time); time);
if (stat1 & (1 << 5)) if (stat1 & (1 << 5))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, 1, IIO_UNMOD_EVENT_CODE(IIO_IN, 1,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_EITHER), IIO_EV_DIR_EITHER),
time); time);
if (stat1 & (1 << 6)) if (stat1 & (1 << 6))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, 2, IIO_UNMOD_EVENT_CODE(IIO_IN, 2,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_EITHER), IIO_EV_DIR_EITHER),
time); time);
if (stat1 & (1 << 7)) if (stat1 & (1 << 7))
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, 3, IIO_UNMOD_EVENT_CODE(IIO_IN, 3,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_EITHER), IIO_EV_DIR_EITHER),
...@@ -1822,7 +1822,7 @@ static irqreturn_t adt7316_event_handler(int irq, void *private) ...@@ -1822,7 +1822,7 @@ static irqreturn_t adt7316_event_handler(int irq, void *private)
ret = chip->bus.read(chip->bus.client, ADT7316_INT_STAT2, &stat2); ret = chip->bus.read(chip->bus.client, ADT7316_INT_STAT2, &stat2);
if (!ret) { if (!ret) {
if (stat2 & ADT7316_INT_MASK2_VDD) if (stat2 & ADT7316_INT_MASK2_VDD)
iio_push_event(indio_dev, 0, iio_push_event(indio_dev,
IIO_UNMOD_EVENT_CODE(IIO_IN, IIO_UNMOD_EVENT_CODE(IIO_IN,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -2110,14 +2110,12 @@ EXPORT_SYMBOL(adt7316_enable); ...@@ -2110,14 +2110,12 @@ EXPORT_SYMBOL(adt7316_enable);
static const struct iio_info adt7316_info = { static const struct iio_info adt7316_info = {
.attrs = &adt7316_attribute_group, .attrs = &adt7316_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &adt7316_event_attribute_group, .event_attrs = &adt7316_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
static const struct iio_info adt7516_info = { static const struct iio_info adt7516_info = {
.attrs = &adt7516_attribute_group, .attrs = &adt7516_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &adt7516_event_attribute_group, .event_attrs = &adt7516_event_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -252,7 +252,7 @@ static struct attribute_group ad5504_ev_attribute_group = { ...@@ -252,7 +252,7 @@ static struct attribute_group ad5504_ev_attribute_group = {
static irqreturn_t ad5504_event_handler(int irq, void *private) static irqreturn_t ad5504_event_handler(int irq, void *private)
{ {
iio_push_event(private, 0, iio_push_event(private,
IIO_UNMOD_EVENT_CODE(IIO_TEMP, IIO_UNMOD_EVENT_CODE(IIO_TEMP,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -264,14 +264,12 @@ static irqreturn_t ad5504_event_handler(int irq, void *private) ...@@ -264,14 +264,12 @@ static irqreturn_t ad5504_event_handler(int irq, void *private)
static const struct iio_info ad5504_info = { static const struct iio_info ad5504_info = {
.attrs = &ad5504_attribute_group, .attrs = &ad5504_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &ad5504_ev_attribute_group, .event_attrs = &ad5504_ev_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
static const struct iio_info ad5501_info = { static const struct iio_info ad5501_info = {
.attrs = &ad5501_attribute_group, .attrs = &ad5501_attribute_group,
.num_interrupt_lines = 1,
.event_attrs = &ad5504_ev_attribute_group, .event_attrs = &ad5504_ev_attribute_group,
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
......
...@@ -183,7 +183,6 @@ struct iio_dev; ...@@ -183,7 +183,6 @@ struct iio_dev;
* struct iio_info - constant information about device * struct iio_info - constant information about device
* @driver_module: module structure used to ensure correct * @driver_module: module structure used to ensure correct
* ownership of chrdevs etc * ownership of chrdevs etc
* @num_interrupt_lines:number of physical interrupt lines from device
* @event_attrs: event control attributes * @event_attrs: event control attributes
* @attrs: general purpose device attributes * @attrs: general purpose device attributes
* @read_raw: function to request a value from the device. * @read_raw: function to request a value from the device.
...@@ -207,7 +206,6 @@ struct iio_dev; ...@@ -207,7 +206,6 @@ struct iio_dev;
**/ **/
struct iio_info { struct iio_info {
struct module *driver_module; struct module *driver_module;
int num_interrupt_lines;
struct attribute_group *event_attrs; struct attribute_group *event_attrs;
const struct attribute_group *attrs; const struct attribute_group *attrs;
...@@ -252,7 +250,7 @@ struct iio_info { ...@@ -252,7 +250,7 @@ struct iio_info {
* @currentmode: [DRIVER] current operating mode * @currentmode: [DRIVER] current operating mode
* @dev: [DRIVER] device structure, should be assigned a parent * @dev: [DRIVER] device structure, should be assigned a parent
* and owner * and owner
* @event_interfaces: [INTERN] event chrdevs associated with interrupt lines * @event_interface: [INTERN] event chrdevs associated with interrupt lines
* @ring: [DRIVER] any ring buffer present * @ring: [DRIVER] any ring buffer present
* @mlock: [INTERN] lock used to prevent simultaneous device state * @mlock: [INTERN] lock used to prevent simultaneous device state
* changes * changes
...@@ -272,7 +270,7 @@ struct iio_dev { ...@@ -272,7 +270,7 @@ struct iio_dev {
int currentmode; int currentmode;
struct device dev; struct device dev;
struct iio_event_interface *event_interfaces; struct iio_event_interface *event_interface;
struct iio_ring_buffer *ring; struct iio_ring_buffer *ring;
struct mutex mlock; struct mutex mlock;
...@@ -309,10 +307,7 @@ void iio_device_unregister(struct iio_dev *dev_info); ...@@ -309,10 +307,7 @@ void iio_device_unregister(struct iio_dev *dev_info);
* @ev_code: What event * @ev_code: What event
* @timestamp: When the event occurred * @timestamp: When the event occurred
**/ **/
int iio_push_event(struct iio_dev *dev_info, int iio_push_event(struct iio_dev *dev_info, int ev_code, s64 timestamp);
int ev_line,
int ev_code,
s64 timestamp);
extern struct bus_type iio_bus_type; extern struct bus_type iio_bus_type;
......
...@@ -146,13 +146,9 @@ struct iio_event_interface { ...@@ -146,13 +146,9 @@ struct iio_event_interface {
unsigned long flags; unsigned long flags;
}; };
int iio_push_event(struct iio_dev *dev_info, int iio_push_event(struct iio_dev *dev_info, int ev_code, s64 timestamp)
int ev_line,
int ev_code,
s64 timestamp)
{ {
struct iio_event_interface *ev_int struct iio_event_interface *ev_int = dev_info->event_interface;
= &dev_info->event_interfaces[ev_line];
struct iio_detected_event_list *ev; struct iio_detected_event_list *ev;
int ret = 0; int ret = 0;
...@@ -291,19 +287,19 @@ static void iio_device_free_chrdev_minor(int val) ...@@ -291,19 +287,19 @@ static void iio_device_free_chrdev_minor(int val)
static int iio_event_getfd(struct iio_dev *indio_dev) static int iio_event_getfd(struct iio_dev *indio_dev)
{ {
if (indio_dev->event_interfaces == NULL) if (indio_dev->event_interface == NULL)
return -ENODEV; return -ENODEV;
mutex_lock(&indio_dev->event_interfaces->event_list_lock); mutex_lock(&indio_dev->event_interface->event_list_lock);
if (test_and_set_bit(IIO_BUSY_BIT_POS, if (test_and_set_bit(IIO_BUSY_BIT_POS,
&indio_dev->event_interfaces->flags)) { &indio_dev->event_interface->flags)) {
mutex_unlock(&indio_dev->event_interfaces->event_list_lock); mutex_unlock(&indio_dev->event_interface->event_list_lock);
return -EBUSY; return -EBUSY;
} }
mutex_unlock(&indio_dev->event_interfaces->event_list_lock); mutex_unlock(&indio_dev->event_interface->event_list_lock);
return anon_inode_getfd("iio:event", return anon_inode_getfd("iio:event",
&iio_event_chrdev_fileops, &iio_event_chrdev_fileops,
&indio_dev->event_interfaces[0], O_RDONLY); indio_dev->event_interface, O_RDONLY);
} }
static void iio_setup_ev_int(struct iio_event_interface *ev_int) static void iio_setup_ev_int(struct iio_event_interface *ev_int)
...@@ -910,13 +906,9 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info, ...@@ -910,13 +906,9 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
&iio_ev_state_show, &iio_ev_state_show,
iio_ev_state_store, iio_ev_state_store,
mask, mask,
/*HACK. - limits us to one
event interface - fix by
extending the bitmask - but
how far*/
0, 0,
&dev_info->dev, &dev_info->dev,
&dev_info->event_interfaces[0]. &dev_info->event_interface->
dev_attr_list); dev_attr_list);
kfree(postfix); kfree(postfix);
if (ret) if (ret)
...@@ -935,8 +927,8 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info, ...@@ -935,8 +927,8 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
mask, mask,
0, 0,
&dev_info->dev, &dev_info->dev,
&dev_info->event_interfaces[0] &dev_info->event_interface->
.dev_attr_list); dev_attr_list);
kfree(postfix); kfree(postfix);
if (ret) if (ret)
goto error_ret; goto error_ret;
...@@ -947,12 +939,11 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info, ...@@ -947,12 +939,11 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
return ret; return ret;
} }
static inline void __iio_remove_event_config_attrs(struct iio_dev *dev_info, static inline void __iio_remove_event_config_attrs(struct iio_dev *dev_info)
int i)
{ {
struct iio_dev_attr *p, *n; struct iio_dev_attr *p, *n;
list_for_each_entry_safe(p, n, list_for_each_entry_safe(p, n,
&dev_info->event_interfaces[i]. &dev_info->event_interface->
dev_attr_list, l) { dev_attr_list, l) {
sysfs_remove_file_from_group(&dev_info->dev.kobj, sysfs_remove_file_from_group(&dev_info->dev.kobj,
&p->dev_attr.attr, &p->dev_attr.attr,
...@@ -962,25 +953,23 @@ static inline void __iio_remove_event_config_attrs(struct iio_dev *dev_info, ...@@ -962,25 +953,23 @@ static inline void __iio_remove_event_config_attrs(struct iio_dev *dev_info,
} }
} }
static inline int __iio_add_event_config_attrs(struct iio_dev *dev_info, int i) static inline int __iio_add_event_config_attrs(struct iio_dev *dev_info)
{ {
int j; int j;
int ret; int ret;
INIT_LIST_HEAD(&dev_info->event_interfaces[i].dev_attr_list); INIT_LIST_HEAD(&dev_info->event_interface->dev_attr_list);
/* Dynically created from the channels array */ /* Dynically created from the channels array */
if (dev_info->channels) { for (j = 0; j < dev_info->num_channels; j++) {
for (j = 0; j < dev_info->num_channels; j++) {
ret = iio_device_add_event_sysfs(dev_info, ret = iio_device_add_event_sysfs(dev_info,
&dev_info &dev_info->channels[j]);
->channels[j]); if (ret)
if (ret) goto error_clear_attrs;
goto error_clear_attrs;
}
} }
return 0; return 0;
error_clear_attrs: error_clear_attrs:
__iio_remove_event_config_attrs(dev_info, i); __iio_remove_event_config_attrs(dev_info);
return ret; return ret;
} }
...@@ -994,42 +983,49 @@ static struct attribute_group iio_events_dummy_group = { ...@@ -994,42 +983,49 @@ static struct attribute_group iio_events_dummy_group = {
.attrs = iio_events_dummy_attrs .attrs = iio_events_dummy_attrs
}; };
static bool iio_check_for_dynamic_events(struct iio_dev *dev_info)
{
int j;
for (j = 0; j < dev_info->num_channels; j++)
if (dev_info->channels[j].event_mask != 0)
return true;
return false;
}
static int iio_device_register_eventset(struct iio_dev *dev_info) static int iio_device_register_eventset(struct iio_dev *dev_info)
{ {
int ret = 0, i, j; int ret = 0;
if (dev_info->info->num_interrupt_lines == 0) if (!(dev_info->info->event_attrs ||
iio_check_for_dynamic_events(dev_info)))
return 0; return 0;
dev_info->event_interfaces = dev_info->event_interface =
kzalloc(sizeof(struct iio_event_interface) kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL);
*dev_info->info->num_interrupt_lines, if (dev_info->event_interface == NULL) {
GFP_KERNEL);
if (dev_info->event_interfaces == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto error_ret; goto error_ret;
} }
for (i = 0; i < dev_info->info->num_interrupt_lines; i++) { iio_setup_ev_int(dev_info->event_interface);
iio_setup_ev_int(&dev_info->event_interfaces[i]); if (dev_info->info->event_attrs != NULL)
if (dev_info->info->event_attrs != NULL) ret = sysfs_create_group(&dev_info->dev.kobj,
ret = sysfs_create_group(&dev_info->dev.kobj, dev_info->info->event_attrs);
&dev_info->info else
->event_attrs[i]); ret = sysfs_create_group(&dev_info->dev.kobj,
else &iio_events_dummy_group);
ret = sysfs_create_group(&dev_info->dev.kobj, if (ret) {
&iio_events_dummy_group); dev_err(&dev_info->dev,
if (ret) { "Failed to register sysfs for event attrs");
dev_err(&dev_info->dev, goto error_free_setup_event_lines;
"Failed to register sysfs for event attrs"); }
goto error_free_setup_event_lines; if (dev_info->channels) {
} ret = __iio_add_event_config_attrs(dev_info);
ret = __iio_add_event_config_attrs(dev_info, i);
if (ret) { if (ret) {
if (dev_info->info->event_attrs != NULL) if (dev_info->info->event_attrs != NULL)
sysfs_remove_group(&dev_info->dev.kobj, sysfs_remove_group(&dev_info->dev.kobj,
&dev_info->info dev_info->info
->event_attrs[i]); ->event_attrs);
else else
sysfs_remove_group(&dev_info->dev.kobj, sysfs_remove_group(&dev_info->dev.kobj,
&iio_events_dummy_group); &iio_events_dummy_group);
...@@ -1040,16 +1036,14 @@ static int iio_device_register_eventset(struct iio_dev *dev_info) ...@@ -1040,16 +1036,14 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
return 0; return 0;
error_free_setup_event_lines: error_free_setup_event_lines:
for (j = 0; j < i; j++) { __iio_remove_event_config_attrs(dev_info);
__iio_remove_event_config_attrs(dev_info, j); if (dev_info->info->event_attrs != NULL)
if (dev_info->info->event_attrs != NULL) { sysfs_remove_group(&dev_info->dev.kobj,
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->event_attrs);
&dev_info->info->event_attrs[j]); else
sysfs_remove_group(&dev_info->dev.kobj, sysfs_remove_group(&dev_info->dev.kobj,
&iio_events_dummy_group); &iio_events_dummy_group);
} kfree(dev_info->event_interface);
}
kfree(dev_info->event_interfaces);
error_ret: error_ret:
return ret; return ret;
...@@ -1057,20 +1051,16 @@ static int iio_device_register_eventset(struct iio_dev *dev_info) ...@@ -1057,20 +1051,16 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
static void iio_device_unregister_eventset(struct iio_dev *dev_info) static void iio_device_unregister_eventset(struct iio_dev *dev_info)
{ {
int i; if (dev_info->event_interface == NULL)
if (dev_info->info->num_interrupt_lines == 0)
return; return;
for (i = 0; i < dev_info->info->num_interrupt_lines; i++) { __iio_remove_event_config_attrs(dev_info);
__iio_remove_event_config_attrs(dev_info, i); if (dev_info->info->event_attrs != NULL)
if (dev_info->info->event_attrs != NULL) sysfs_remove_group(&dev_info->dev.kobj,
sysfs_remove_group(&dev_info->dev.kobj, dev_info->info->event_attrs);
&dev_info->info->event_attrs[i]); else
else sysfs_remove_group(&dev_info->dev.kobj,
sysfs_remove_group(&dev_info->dev.kobj, &iio_events_dummy_group);
&iio_events_dummy_group); kfree(dev_info->event_interface);
}
kfree(dev_info->event_interfaces);
} }
static void iio_dev_release(struct device *device) static void iio_dev_release(struct device *device)
......
...@@ -595,7 +595,7 @@ static irqreturn_t tsl2563_event_handler(int irq, void *private) ...@@ -595,7 +595,7 @@ static irqreturn_t tsl2563_event_handler(int irq, void *private)
struct iio_dev *dev_info = private; struct iio_dev *dev_info = private;
struct tsl2563_chip *chip = iio_priv(dev_info); struct tsl2563_chip *chip = iio_priv(dev_info);
iio_push_event(dev_info, 0, iio_push_event(dev_info,
IIO_UNMOD_EVENT_CODE(IIO_LIGHT, IIO_UNMOD_EVENT_CODE(IIO_LIGHT,
0, 0,
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
...@@ -680,7 +680,6 @@ static const struct iio_info tsl2563_info_no_irq = { ...@@ -680,7 +680,6 @@ static const struct iio_info tsl2563_info_no_irq = {
static const struct iio_info tsl2563_info = { static const struct iio_info tsl2563_info = {
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
.num_interrupt_lines = 1,
.read_raw = &tsl2563_read_raw, .read_raw = &tsl2563_read_raw,
.write_raw = &tsl2563_write_raw, .write_raw = &tsl2563_write_raw,
.read_event_value = &tsl2563_read_thresh, .read_event_value = &tsl2563_read_thresh,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册