Skip to content

Commit

Permalink
staging:iio: Remove legacy event handling.
Browse files Browse the repository at this point in the history
This requires all drivers using the channel registration code and
events to change in one go.

V3: remove unwanted irq enable from event handler.
V2: rebase related fixes to move to new IIO_CHAN macro. All trivial.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 72148f6 commit aaf370d
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 600 deletions.
36 changes: 9 additions & 27 deletions drivers/staging/iio/accel/lis3l02dq_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,9 @@ static IIO_DEV_ATTR_SAMP_FREQ(S_IWUSR | S_IRUGO,

static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("280 560 1120 4480");

static irqreturn_t lis3l02dq_event_handler(int irq, void *_int_info)
static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
{
struct iio_interrupt *int_info = _int_info;
struct iio_dev *indio_dev = int_info->dev_info;
struct iio_dev *indio_dev = private;
struct iio_sw_ring_helper_state *h
= iio_dev_get_devdata(indio_dev);
struct lis3l02dq_state *st = lis3l02dq_h_to_s(h);
Expand All @@ -442,14 +441,11 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *_int_info)

static struct iio_chan_spec lis3l02dq_channels[] = {
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_X, LIS3L02DQ_INFO_MASK,
0, 0, IIO_ST('s', 12, 16, 0),
LIS3L02DQ_EVENT_MASK, NULL),
0, 0, IIO_ST('s', 12, 16, 0), LIS3L02DQ_EVENT_MASK),
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_Y, LIS3L02DQ_INFO_MASK,
1, 1, IIO_ST('s', 12, 16, 0),
LIS3L02DQ_EVENT_MASK, NULL),
1, 1, IIO_ST('s', 12, 16, 0), LIS3L02DQ_EVENT_MASK),
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_Z, LIS3L02DQ_INFO_MASK,
2, 2, IIO_ST('s', 12, 16, 0),
LIS3L02DQ_EVENT_MASK, NULL),
2, 2, IIO_ST('s', 12, 16, 0), LIS3L02DQ_EVENT_MASK),
IIO_CHAN_SOFT_TIMESTAMP(3)
};

Expand Down Expand Up @@ -508,7 +504,7 @@ int lis3l02dq_disable_all_events(struct iio_dev *indio_dev)
goto error_ret;

if (irqtofree)
free_irq(st->us->irq, indio_dev->interrupts[0]);
free_irq(st->us->irq, indio_dev);

ret = control;
error_ret:
Expand All @@ -517,7 +513,6 @@ int lis3l02dq_disable_all_events(struct iio_dev *indio_dev)

static int lis3l02dq_write_event_config(struct iio_dev *indio_dev,
int event_code,
struct iio_event_handler_list *list_el,
int state)
{
struct iio_sw_ring_helper_state *h
Expand Down Expand Up @@ -559,7 +554,7 @@ static int lis3l02dq_write_event_config(struct iio_dev *indio_dev,
&lis3l02dq_event_handler,
IRQF_TRIGGER_RISING,
"lis3l02dq_event",
indio_dev->interrupts[0]);
indio_dev);
if (ret)
goto error_ret;
}
Expand All @@ -580,7 +575,7 @@ static int lis3l02dq_write_event_config(struct iio_dev *indio_dev,

/* remove interrupt handler if nothing is still on */
if (!(val & 0x3f))
free_irq(st->us->irq, indio_dev->interrupts[0]);
free_irq(st->us->irq, indio_dev);
}

error_ret:
Expand Down Expand Up @@ -743,16 +738,9 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)

if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) {
st->inter = 0;
ret = iio_register_interrupt_line(spi->irq,
st->help.indio_dev,
0,
IRQF_TRIGGER_RISING,
"lis3l02dq");
if (ret)
goto error_uninitialize_ring;
ret = lis3l02dq_probe_trigger(st->help.indio_dev);
if (ret)
goto error_unregister_line;
goto error_uninitialize_ring;
}

/* Get the device into a sane initial state */
Expand All @@ -764,9 +752,6 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi)
error_remove_trigger:
if (st->help.indio_dev->modes & INDIO_RING_TRIGGERED)
lis3l02dq_remove_trigger(st->help.indio_dev);
error_unregister_line:
if (st->help.indio_dev->modes & INDIO_RING_TRIGGERED)
iio_unregister_interrupt_line(st->help.indio_dev, 0);
error_uninitialize_ring:
iio_ring_buffer_unregister(st->help.indio_dev->ring);
error_unreg_ring_funcs:
Expand Down Expand Up @@ -831,9 +816,6 @@ static int lis3l02dq_remove(struct spi_device *spi)
flush_scheduled_work();

lis3l02dq_remove_trigger(indio_dev);
if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0)
iio_unregister_interrupt_line(indio_dev, 0);

iio_ring_buffer_unregister(indio_dev->ring);
lis3l02dq_unconfigure_ring(indio_dev);
iio_device_unregister(indio_dev);
Expand Down
27 changes: 10 additions & 17 deletions drivers/staging/iio/accel/sca3000_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,11 @@ static IIO_DEV_ATTR_REV(sca3000_show_rev);

static struct iio_chan_spec sca3000_channels[] = {
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_X, SCA3000_INFO_MASK,
0, 0, IIO_ST('s', 11, 16, 5),
SCA3000_EVENT_MASK, NULL),
0, 0, IIO_ST('s', 11, 16, 5), SCA3000_EVENT_MASK),
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_Y, SCA3000_INFO_MASK,
1, 1, IIO_ST('s', 11, 16, 5),
SCA3000_EVENT_MASK, NULL),
1, 1, IIO_ST('s', 11, 16, 5), SCA3000_EVENT_MASK),
IIO_CHAN(IIO_ACCEL, 1, 0, 0, NULL, 0, IIO_MOD_Z, SCA3000_INFO_MASK,
2, 2, IIO_ST('s', 11, 16, 5),
SCA3000_EVENT_MASK, NULL),
2, 2, IIO_ST('s', 11, 16, 5), SCA3000_EVENT_MASK),
};

static u8 sca3000_addresses[3][3] = {
Expand Down Expand Up @@ -977,7 +974,6 @@ static ssize_t sca3000_set_free_fall_mode(struct device *dev,
**/
static int sca3000_write_event_config(struct iio_dev *indio_dev,
int e,
struct iio_event_handler_list *list_el,
int state)
{
struct sca3000_state *st = indio_dev->dev_data;
Expand Down Expand Up @@ -1032,23 +1028,20 @@ static int sca3000_write_event_config(struct iio_dev *indio_dev,
return ret;
}

/* Shared event handler for all events as single event status register */
IIO_EVENT_SH(all, NULL);

/* Free fall detector related event attribute */
IIO_EVENT_ATTR_NAMED_SH(accel_xayaz_mag_falling_en,
accel_x&y&z_mag_falling_en,
iio_event_all,
sca3000_query_free_fall_mode,
sca3000_set_free_fall_mode,
0);
static IIO_DEVICE_ATTR_NAMED(accel_xayaz_mag_falling_en,
accel_x&y&z_mag_falling_en,
S_IRUGO | S_IWUSR,
sca3000_query_free_fall_mode,
sca3000_set_free_fall_mode,
0);

static IIO_CONST_ATTR_NAMED(accel_xayaz_mag_falling_period,
accel_x&y&z_mag_falling_period,
"0.226");

static struct attribute *sca3000_event_attributes[] = {
&iio_event_attr_accel_xayaz_mag_falling_en.dev_attr.attr,
&iio_dev_attr_accel_xayaz_mag_falling_en.dev_attr.attr,
&iio_const_attr_accel_xayaz_mag_falling_period.dev_attr.attr,
NULL,
};
Expand Down
4 changes: 0 additions & 4 deletions drivers/staging/iio/adc/max1363.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ struct max1363_chip_info {
* @mask_low: bitmask for enabled low thresholds
* @thresh_high: high threshold values
* @thresh_low: low threshold values
* @last_timestamp: timestamp of last event interrupt
* @thresh_work: bh work structure for event handling
*/
struct max1363_state {
struct i2c_client *client;
Expand All @@ -213,8 +211,6 @@ struct max1363_state {
/* 4x unipolar first then the fours bipolar ones */
s16 thresh_high[8];
s16 thresh_low[8];
s64 last_timestamp;
struct work_struct thresh_work;
};

const struct max1363_mode
Expand Down
Loading

0 comments on commit aaf370d

Please sign in to comment.