industrialio-trigger.c (4ad682e04c1694aba95627f60e89f83178c277c2) industrialio-trigger.c (f700e55ef6ef9ec723164659ed4385900981c872)
1// SPDX-License-Identifier: GPL-2.0-only
2/* The industrial I/O core, trigger handling functions
3 *
4 * Copyright (c) 2008 Jonathan Cameron
5 */
6
7#include <linux/kernel.h>
8#include <linux/idr.h>

--- 208 unchanged lines hidden (view full) ---

217
218irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private)
219{
220 iio_trigger_poll(private);
221 return IRQ_HANDLED;
222}
223EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
224
1// SPDX-License-Identifier: GPL-2.0-only
2/* The industrial I/O core, trigger handling functions
3 *
4 * Copyright (c) 2008 Jonathan Cameron
5 */
6
7#include <linux/kernel.h>
8#include <linux/idr.h>

--- 208 unchanged lines hidden (view full) ---

217
218irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private)
219{
220 iio_trigger_poll(private);
221 return IRQ_HANDLED;
222}
223EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
224
225void iio_trigger_poll_chained(struct iio_trigger *trig)
225/**
226 * iio_trigger_poll_nested() - Call the threaded trigger handler of the
227 * consumers
228 * @trig: trigger which occurred
229 *
230 * This function should only be called from a kernel thread context.
231 */
232void iio_trigger_poll_nested(struct iio_trigger *trig)
226{
227 int i;
228
229 if (!atomic_read(&trig->use_count)) {
230 atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
231
232 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
233 if (trig->subirqs[i].enabled)
234 handle_nested_irq(trig->subirq_base + i);
235 else
236 iio_trigger_notify_done(trig);
237 }
238 }
239}
233{
234 int i;
235
236 if (!atomic_read(&trig->use_count)) {
237 atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
238
239 for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) {
240 if (trig->subirqs[i].enabled)
241 handle_nested_irq(trig->subirq_base + i);
242 else
243 iio_trigger_notify_done(trig);
244 }
245 }
246}
240EXPORT_SYMBOL(iio_trigger_poll_chained);
247EXPORT_SYMBOL(iio_trigger_poll_nested);
241
242void iio_trigger_notify_done(struct iio_trigger *trig)
243{
244 if (atomic_dec_and_test(&trig->use_count) && trig->ops &&
245 trig->ops->reenable)
246 trig->ops->reenable(trig);
247}
248EXPORT_SYMBOL(iio_trigger_notify_done);

--- 508 unchanged lines hidden ---
248
249void iio_trigger_notify_done(struct iio_trigger *trig)
250{
251 if (atomic_dec_and_test(&trig->use_count) && trig->ops &&
252 trig->ops->reenable)
253 trig->ops->reenable(trig);
254}
255EXPORT_SYMBOL(iio_trigger_notify_done);

--- 508 unchanged lines hidden ---