From: Jonathan Cameron Date: Mon, 18 Apr 2011 11:59:01 +0000 (+0100) Subject: staging:iio:adis16203 replace unnecessary event line registration. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9e558ff5448715a8cca1439e3188611b31ea72ec;p=openwrt%2Fstaging%2Fblogic.git staging:iio:adis16203 replace unnecessary event line registration. Whilst the adis16203 does indeed support events, currently the driver does not. The trigger code should never use that infrastructure. Untested, but identical in form to those that have been so should be fine. Signed-off-by: Jonathan Cameron Acked-by: Michael Hennerich Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index e5a2a477b113..4043a9745a7a 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c @@ -394,14 +394,6 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, adis16203_write_reset, 0); static IIO_CONST_ATTR(name, "adis16203"); -static struct attribute *adis16203_event_attributes[] = { - NULL -}; - -static struct attribute_group adis16203_event_attribute_group = { - .attrs = adis16203_event_attributes, -}; - static struct attribute *adis16203_attributes[] = { &iio_dev_attr_in0_supply_raw.dev_attr.attr, &iio_const_attr_in0_supply_scale.dev_attr.attr, @@ -455,8 +447,6 @@ static int __devinit adis16203_probe(struct spi_device *spi) } st->indio_dev->dev.parent = &spi->dev; - st->indio_dev->num_interrupt_lines = 1; - st->indio_dev->event_attrs = &adis16203_event_attribute_group; st->indio_dev->attrs = &adis16203_attribute_group; st->indio_dev->dev_data = (void *)(st); st->indio_dev->driver_module = THIS_MODULE; @@ -478,17 +468,9 @@ static int __devinit adis16203_probe(struct spi_device *spi) } if (spi->irq) { - ret = iio_register_interrupt_line(spi->irq, - st->indio_dev, - 0, - IRQF_TRIGGER_RISING, - "adis16203"); - if (ret) - goto error_uninitialize_ring; - ret = adis16203_probe_trigger(st->indio_dev); if (ret) - goto error_unregister_line; + goto error_uninitialize_ring; } /* Get the device into a sane initial state */ @@ -499,9 +481,6 @@ static int __devinit adis16203_probe(struct spi_device *spi) error_remove_trigger: adis16203_remove_trigger(st->indio_dev); -error_unregister_line: - if (spi->irq) - iio_unregister_interrupt_line(st->indio_dev, 0); error_uninitialize_ring: adis16203_uninitialize_ring(st->indio_dev->ring); error_unreg_ring_funcs: @@ -529,9 +508,6 @@ static int adis16203_remove(struct spi_device *spi) flush_scheduled_work(); adis16203_remove_trigger(indio_dev); - if (spi->irq) - iio_unregister_interrupt_line(indio_dev, 0); - adis16203_uninitialize_ring(indio_dev->ring); iio_device_unregister(indio_dev); adis16203_unconfigure_ring(indio_dev); diff --git a/drivers/staging/iio/accel/adis16203_trigger.c b/drivers/staging/iio/accel/adis16203_trigger.c index 50be51c25dc2..dbc75bde9705 100644 --- a/drivers/staging/iio/accel/adis16203_trigger.c +++ b/drivers/staging/iio/accel/adis16203_trigger.c @@ -15,21 +15,13 @@ /** * adis16203_data_rdy_trig_poll() the event handler for the data rdy trig **/ -static int adis16203_data_rdy_trig_poll(struct iio_dev *dev_info, - int index, - s64 timestamp, - int no_test) +static irqreturn_t adis16203_data_rdy_trig_poll(int irq, void *private) { - struct adis16203_state *st = iio_dev_get_devdata(dev_info); - struct iio_trigger *trig = st->trig; - - iio_trigger_poll(trig, timestamp); - + disable_irq_nosync(irq); + iio_trigger_poll(private, iio_get_time_ns()); return IRQ_HANDLED; } -IIO_EVENT_SH(data_rdy_trig, &adis16203_data_rdy_trig_poll); - static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); static struct attribute *adis16203_trigger_attrs[] = { @@ -49,20 +41,9 @@ static int adis16203_data_rdy_trigger_set_state(struct iio_trigger *trig, { struct adis16203_state *st = trig->private_data; struct iio_dev *indio_dev = st->indio_dev; - int ret = 0; dev_dbg(&indio_dev->dev, "%s (%d)\n", __func__, state); - ret = adis16203_set_irq(&st->indio_dev->dev, state); - if (state == false) { - iio_remove_event_from_list(&iio_event_data_rdy_trig, - &indio_dev->interrupts[0] - ->ev_list); - flush_scheduled_work(); - } else { - iio_add_event_to_list(&iio_event_data_rdy_trig, - &indio_dev->interrupts[0]->ev_list); - } - return ret; + return adis16203_set_irq(&st->indio_dev->dev, state); } /** @@ -82,12 +63,24 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev) struct adis16203_state *st = indio_dev->dev_data; st->trig = iio_allocate_trigger(); + if (st->trig == NULL) { + ret = -ENOMEM; + goto error_ret; + } + + ret = request_irq(st->us->irq, + adis16203_data_rdy_trig_poll, + IRQF_TRIGGER_RISING, + "adis16203", + st->trig); + if (ret) + goto error_free_trig; st->trig->name = kasprintf(GFP_KERNEL, "adis16203-dev%d", indio_dev->id); if (!st->trig->name) { ret = -ENOMEM; - goto error_free_trig; + goto error_free_irq; } st->trig->dev.parent = &st->us->dev; st->trig->owner = THIS_MODULE; @@ -106,9 +99,11 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev) error_free_trig_name: kfree(st->trig->name); +error_free_irq: + free_irq(st->us->irq, st->trig); error_free_trig: iio_free_trigger(st->trig); - +error_ret: return ret; } @@ -118,5 +113,6 @@ void adis16203_remove_trigger(struct iio_dev *indio_dev) iio_trigger_unregister(state->trig); kfree(state->trig->name); + free_irq(state->us->irq, state->trig); iio_free_trigger(state->trig); }