Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ed731d2 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman
Browse files

staging:iio: use pollfunc allocation helpers in remaining drivers.



Some didn't get converted the first time around.

Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 58f0a255
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -344,8 +344,7 @@ void lis3l02dq_remove_trigger(struct iio_dev *indio_dev)

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);
}

@@ -448,18 +447,17 @@ int lis3l02dq_configure_ring(struct iio_dev *indio_dev)
	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;
+10 −14
Original line number Diff line number Diff line
@@ -164,20 +164,18 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
	/* 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;
@@ -185,8 +183,7 @@ int ad7298_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:
@@ -200,7 +197,6 @@ void ad7298_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_dealloc_pollfunc(indio_dev->pollfunc);
	iio_sw_rb_free(indio_dev->ring);
}
+10 −16
Original line number Diff line number Diff line
@@ -125,21 +125,17 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev)
	}
	/* Effectively select the ring buffer implementation */
	indio_dev->ring->access = &ring_sw_access_funcs;
	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->thread = &ad7476_trigger_handler;
	indio_dev->pollfunc->type = IRQF_ONESHOT;
	indio_dev->pollfunc->name
		= kasprintf(GFP_KERNEL, "%s_consumer%d",
	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->name == NULL) {
	if (indio_dev->pollfunc == NULL) {
		ret = -ENOMEM;
		goto error_free_pollfunc;
		goto error_deallocate_sw_rb;
	}

	/* Ring buffer functions - here trigger setup related */
@@ -149,8 +145,7 @@ int ad7476_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_pollfunc:
	kfree(indio_dev->pollfunc);

error_deallocate_sw_rb:
	iio_sw_rb_free(indio_dev->ring);
error_ret:
@@ -165,7 +160,6 @@ void ad7476_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_dealloc_pollfunc(indio_dev->pollfunc);
	iio_sw_rb_free(indio_dev->ring);
}
+9 −15
Original line number Diff line number Diff line
@@ -169,22 +169,18 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)

	/* 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;
@@ -195,8 +191,7 @@ 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:
@@ -210,7 +205,6 @@ 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_dealloc_pollfunc(indio_dev->pollfunc);
	iio_sw_rb_free(indio_dev->ring);
}
+8 −16
Original line number Diff line number Diff line
@@ -166,30 +166,23 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev)
	}
	/* 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:
@@ -204,7 +197,6 @@ void ad7887_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_dealloc_pollfunc(indio_dev->pollfunc);
	iio_sw_rb_free(indio_dev->ring);
}
Loading