Some didn't get converted the first time around.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
void lis3l02dq_unconfigure_ring(struct iio_dev *indio_dev)
{
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
lis3l02dq_free_buf(indio_dev->ring);
}
iio_scan_mask_set(ring, 2);
/* Functions are NULL as we set handler below */
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
+ &lis3l02dq_trigger_handler,
+ 0,
+ indio_dev,
+ "lis3l02dq_consumer%d",
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_iio_sw_rb_free;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->thread = &lis3l02dq_trigger_handler;
- indio_dev->pollfunc->h = &iio_pollfunc_store_time;
- indio_dev->pollfunc->type = 0;
- indio_dev->pollfunc->name
- = kasprintf(GFP_KERNEL, "lis3l02dq_consumer%d", indio_dev->id);
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(NULL,
+ &ad7298_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "ad7298_consumer%d",
+ indio_dev->id);
+
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->thread = &ad7298_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- indio_dev->pollfunc->name =
- kasprintf(GFP_KERNEL, "ad7298_consumer%d", 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->setup_ops = &ad7298_ring_setup_ops;
indio_dev->ring->scan_timestamp = true;
/* 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:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
}
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
- indio_dev->pollfunc = kzalloc(sizeof(indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc
+ = iio_alloc_pollfunc(NULL,
+ &ad7476_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "%s_consumer%d",
+ spi_get_device_id(st->spi)->name,
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->thread = &ad7476_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- indio_dev->pollfunc->name
- = kasprintf(GFP_KERNEL, "%s_consumer%d",
- spi_get_device_id(st->spi)->name,
- indio_dev->id);
- if (indio_dev->pollfunc->name == NULL) {
- ret = -ENOMEM;
- goto error_free_pollfunc;
- }
/* Ring buffer functions - here trigger setup related */
indio_dev->ring->setup_ops = &ad7476_ring_setup_ops;
/* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
-error_free_pollfunc:
- kfree(indio_dev->pollfunc);
+
error_deallocate_sw_rb:
iio_sw_rb_free(indio_dev->ring);
error_ret:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(&ad7606_trigger_handler_th_bh,
+ &ad7606_trigger_handler_th_bh,
+ 0,
+ indio_dev,
+ "%s_consumer%d",
+ indio_dev->name,
+ indio_dev->id);
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_bh;
- indio_dev->pollfunc->thread = &ad7606_trigger_handler_th_bh;
- 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->setup_ops = &ad7606_ring_setup_ops;
/* 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:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
}
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
+ &ad7887_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "ad7887_consumer%d",
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;
}
-
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->h = &iio_pollfunc_store_time;
- indio_dev->pollfunc->thread = &ad7887_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- indio_dev->pollfunc->name =
- kasprintf(GFP_KERNEL, "ad7887_consumer%d", indio_dev->id);
- if (indio_dev->pollfunc->name == NULL) {
- ret = -ENOMEM;
- goto error_free_pollfunc;
- }
/* Ring buffer functions - here trigger setup related */
indio_dev->ring->setup_ops = &ad7887_ring_setup_ops;
/* Flag that polled ring buffering is possible */
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
-error_free_pollfunc:
- kfree(indio_dev->pollfunc);
+
error_deallocate_sw_rb:
iio_sw_rb_free(indio_dev->ring);
error_ret:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
}
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(NULL,
+ &ad799x_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "%s_consumer%d",
+ indio_dev->name,
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->thread = &ad799x_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- 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->setup_ops = &ad799x_buf_setup_ops;
indio_dev->ring->scan_timestamp = true;
/* 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:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
ret = -ENOMEM;
goto error_ret;
}
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(NULL,
+ &max1363_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "%s_consumer%d",
+ st->client->name,
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_deallocate_sw_rb;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->thread = &max1363_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- indio_dev->pollfunc->name =
- kasprintf(GFP_KERNEL, "%s_consumer%d",
- st->client->name, indio_dev->id);
- if (indio_dev->pollfunc->name == NULL) {
- ret = -ENOMEM;
- goto error_free_pollfunc;
- }
/* Effectively select the ring buffer implementation */
indio_dev->ring->access = &ring_sw_access_funcs;
/* Ring buffer functions - here trigger setup related */
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
-error_free_pollfunc:
- kfree(indio_dev->pollfunc);
+
error_deallocate_sw_rb:
iio_sw_rb_free(indio_dev->ring);
error_ret:
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
void adis16260_unconfigure_ring(struct iio_dev *indio_dev)
{
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
iio_scan_mask_set(ring, ADIS16260_SCAN_TEMP);
iio_scan_mask_set(ring, ADIS16260_SCAN_ANGL);
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
+ &adis16260_trigger_handler,
+ IRQF_ONESHOT,
+ indio_dev,
+ "adis16260_consumer%d",
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_iio_sw_rb_free;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->h = &iio_pollfunc_store_time;
- indio_dev->pollfunc->thread = &adis16260_trigger_handler;
- indio_dev->pollfunc->type = IRQF_ONESHOT;
- indio_dev->pollfunc->name =
- kasprintf(GFP_KERNEL, "adis16260_consumer%d", indio_dev->id);
- if (indio_dev->pollfunc->name == NULL) {
- ret = -ENOMEM;
- goto error_free_pollfunc;
- }
indio_dev->modes |= INDIO_RING_TRIGGERED;
return 0;
-error_free_pollfunc:
- kfree(indio_dev->pollfunc);
+
error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring);
return ret;
iio_trigger_dettach_poll_func(indio_dev->trig,
indio_dev->pollfunc);
}
- kfree(indio_dev->pollfunc->name);
- kfree(indio_dev->pollfunc);
+ iio_dealloc_pollfunc(indio_dev->pollfunc);
iio_sw_rb_free(indio_dev->ring);
}
indio_dev->ring->setup_ops = &ade7758_ring_setup_ops;
indio_dev->ring->owner = THIS_MODULE;
- indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL);
+ indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
+ &ade7758_trigger_handler,
+ 0,
+ indio_dev,
+ "ade7759_consumer%d",
+ indio_dev->id);
if (indio_dev->pollfunc == NULL) {
ret = -ENOMEM;
goto error_iio_sw_rb_free;
}
- indio_dev->pollfunc->private_data = indio_dev;
- indio_dev->pollfunc->h = &iio_pollfunc_store_time;
- indio_dev->pollfunc->thread = &ade7758_trigger_handler;
- indio_dev->pollfunc->name
- = kasprintf(GFP_KERNEL, "ade7759_consumer%d", indio_dev->id);
- if (indio_dev->pollfunc->name == NULL) {
- ret = -ENOMEM;
- goto error_free_pollfunc;
- }
+
indio_dev->modes |= INDIO_RING_TRIGGERED;
st->tx_buf[0] = ADE7758_READ_REG(ADE7758_RSTATUS);
return 0;
-error_free_pollfunc:
- kfree(indio_dev->pollfunc);
error_iio_sw_rb_free:
iio_sw_rb_free(indio_dev->ring);
return ret;