Commit ce298d40 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:dac:ad5504 move from old to new event handling.

Untested, but fairly trivial change here.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bdab1001
...@@ -261,35 +261,18 @@ static struct attribute_group ad5504_ev_attribute_group = { ...@@ -261,35 +261,18 @@ static struct attribute_group ad5504_ev_attribute_group = {
.attrs = ad5504_ev_attributes, .attrs = ad5504_ev_attributes,
}; };
static void ad5504_interrupt_bh(struct work_struct *work_s) static irqreturn_t ad5504_event_handler(int irq, void *private)
{ {
struct ad5504_state *st = container_of(work_s, iio_push_event(private, 0,
struct ad5504_state, work_alarm); IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_TEMP,
0,
iio_push_event(st->indio_dev, 0, IIO_EV_TYPE_THRESH,
IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_TEMP, IIO_EV_DIR_RISING),
0, iio_get_time_ns());
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING), return IRQ_HANDLED;
st->last_timestamp);
enable_irq(st->spi->irq);
}
static int ad5504_interrupt(struct iio_dev *dev_info,
int index,
s64 timestamp,
int no_test)
{
struct ad5504_state *st = dev_info->dev_data;
st->last_timestamp = timestamp;
schedule_work(&st->work_alarm);
return 0;
} }
IIO_EVENT_SH(ad5504, &ad5504_interrupt);
static int __devinit ad5504_probe(struct spi_device *spi) static int __devinit ad5504_probe(struct spi_device *spi)
{ {
struct ad5504_platform_data *pdata = spi->dev.platform_data; struct ad5504_platform_data *pdata = spi->dev.platform_data;
...@@ -342,18 +325,14 @@ static int __devinit ad5504_probe(struct spi_device *spi) ...@@ -342,18 +325,14 @@ static int __devinit ad5504_probe(struct spi_device *spi)
goto error_free_dev; goto error_free_dev;
if (spi->irq) { if (spi->irq) {
INIT_WORK(&st->work_alarm, ad5504_interrupt_bh); ret = request_threaded_irq(spi->irq,
NULL,
ret = iio_register_interrupt_line(spi->irq, &ad5504_event_handler,
st->indio_dev, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
0, spi_get_device_id(st->spi)->name,
IRQF_TRIGGER_FALLING, st->indio_dev);
spi_get_device_id(st->spi)->name);
if (ret) if (ret)
goto error_unreg_iio_device; goto error_unreg_iio_device;
iio_add_event_to_list(&iio_event_ad5504,
&st->indio_dev->interrupts[0]->ev_list);
} }
return 0; return 0;
...@@ -379,7 +358,7 @@ static int __devexit ad5504_remove(struct spi_device *spi) ...@@ -379,7 +358,7 @@ static int __devexit ad5504_remove(struct spi_device *spi)
struct ad5504_state *st = spi_get_drvdata(spi); struct ad5504_state *st = spi_get_drvdata(spi);
if (spi->irq) if (spi->irq)
iio_unregister_interrupt_line(st->indio_dev, 0); free_irq(spi->irq, st->indio_dev);
iio_device_unregister(st->indio_dev); iio_device_unregister(st->indio_dev);
......
...@@ -45,8 +45,6 @@ struct ad5504_platform_data { ...@@ -45,8 +45,6 @@ struct ad5504_platform_data {
* @us: spi_device * @us: spi_device
* @reg: supply regulator * @reg: supply regulator
* @vref_mv: actual reference voltage used * @vref_mv: actual reference voltage used
* @work_alarm: bh work structure for event handling
* @last_timestamp: timestamp of last event interrupt
* @pwr_down_mask power down mask * @pwr_down_mask power down mask
* @pwr_down_mode current power down mode * @pwr_down_mode current power down mode
*/ */
...@@ -56,8 +54,6 @@ struct ad5504_state { ...@@ -56,8 +54,6 @@ struct ad5504_state {
struct spi_device *spi; struct spi_device *spi;
struct regulator *reg; struct regulator *reg;
unsigned short vref_mv; unsigned short vref_mv;
struct work_struct work_alarm;
s64 last_timestamp;
unsigned pwr_down_mask; unsigned pwr_down_mask;
unsigned pwr_down_mode; unsigned pwr_down_mode;
}; };
......
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