Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249812
b: refs/heads/master
c: 13cfac2
h: refs/heads/master
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 8dbe04f commit 6996335
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70d4fd3fcd47e01c29754d59fffaaee47a690a50
refs/heads/master: 13cfac2038438bf98a649a5c92ed56e4534a0d84
2 changes: 1 addition & 1 deletion trunk/drivers/staging/iio/adc/ad7606.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ad7606_platform_data {
*/

struct ad7606_chip_info {
char name[10];
const char *name;
u8 bits;
char sign;
u16 int_vref_mv;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/staging/iio/adc/ad7606_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ struct ad7606_state *ad7606_probe(struct device *dev, int irq,
st->indio_dev->dev_data = (void *)(st);
st->indio_dev->driver_module = THIS_MODULE;
st->indio_dev->modes = INDIO_DIRECT_MODE;
st->indio_dev->name = st->chip_info->name;

init_waitqueue_head(&st->wq_data_avail);

Expand Down
28 changes: 22 additions & 6 deletions trunk/drivers/staging/iio/adc/ad7606_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,19 @@ static int ad7606_ring_preenable(struct iio_dev *indio_dev)
}

/**
* ad7606_poll_func_th() th of trigger launched polling to ring buffer
* ad7606_trigger_handler_th() th of trigger launched polling to ring buffer
*
**/
static void ad7606_poll_func_th(struct iio_dev *indio_dev, s64 time)
static irqreturn_t ad7606_trigger_handler_th(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->private_data;
struct ad7606_state *st = indio_dev->dev_data;
gpio_set_value(st->pdata->gpio_convst, 1);

return;
return IRQ_HANDLED;
}

/**
* ad7606_poll_bh_to_ring() bh of trigger launched polling to ring buffer
* @work_s: the work struct through which this was scheduled
Expand Down Expand Up @@ -245,10 +248,20 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)

/* Effectively select the ring buffer implementation */
iio_ring_sw_register_funcs(&indio_dev->ring->access);
ret = iio_alloc_pollfunc(indio_dev, NULL, &ad7606_poll_func_th);
if (ret)
indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;

}
indio_dev->pollfunc->private_data = indio_dev;
indio_dev->pollfunc->h = &ad7606_trigger_handler_th;
indio_dev->pollfunc->name =
kasprintf(GFP_KERNEL, "%s_consumer%d", indio_dev->name,
indio_dev->id);
if (indio_dev->pollfunc->name == NULL) {
ret = -ENOMEM;
goto error_free_poll_func;
}
/* Ring buffer functions - here trigger setup related */

indio_dev->ring->preenable = &ad7606_ring_preenable;
Expand All @@ -262,6 +275,8 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
/* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
error_free_poll_func:
kfree(indio_dev->pollfunc);
error_deallocate_sw_rb:
iio_sw_rb_free(indio_dev->ring);
error_ret:
Expand All @@ -275,6 +290,7 @@ void ad7606_ring_cleanup(struct iio_dev *indio_dev)
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
kfree(indio_dev->pollfunc->name);
kfree(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}

0 comments on commit 6996335

Please sign in to comment.