Commit f700e55e authored by Mehdi Djait's avatar Mehdi Djait Committed by Jonathan Cameron

iio: Rename iio_trigger_poll_chained and add kernel-doc

Rename the function to iio_trigger_poll_nested. Add kernel-doc with
a note on the context where the function is expected to be called.
Signed-off-by: default avatarMehdi Djait <mehdi.djait.k@gmail.com>
Link: https://lore.kernel.org/r/841b533cba28ca25a8e87280c44e45979166e8e2.1677761379.git.mehdi.djait.k@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 4ad682e0
...@@ -1688,7 +1688,7 @@ static irqreturn_t bma400_interrupt(int irq, void *private) ...@@ -1688,7 +1688,7 @@ static irqreturn_t bma400_interrupt(int irq, void *private)
if (FIELD_GET(BMA400_INT_DRDY_MSK, le16_to_cpu(data->status))) { if (FIELD_GET(BMA400_INT_DRDY_MSK, le16_to_cpu(data->status))) {
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -899,7 +899,7 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private) ...@@ -899,7 +899,7 @@ static irqreturn_t kx022a_irq_thread_handler(int irq, void *private)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
if (data->trigger_enabled) { if (data->trigger_enabled) {
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
......
...@@ -1067,7 +1067,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p) ...@@ -1067,7 +1067,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p)
return IRQ_NONE; return IRQ_NONE;
if (src & MMA8452_INT_DRDY) { if (src & MMA8452_INT_DRDY) {
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
......
...@@ -951,7 +951,7 @@ static irqreturn_t msa311_irq_thread(int irq, void *p) ...@@ -951,7 +951,7 @@ static irqreturn_t msa311_irq_thread(int irq, void *p)
} }
if (new_data_int_enabled) if (new_data_int_enabled)
iio_trigger_poll_chained(msa311->new_data_trig); iio_trigger_poll_nested(msa311->new_data_trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -477,7 +477,7 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id) ...@@ -477,7 +477,7 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id)
if (iio_buffer_enabled(indio_dev)) { if (iio_buffer_enabled(indio_dev)) {
gpiod_set_value(st->gpio_convst, 0); gpiod_set_value(st->gpio_convst, 0);
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
} else { } else {
complete(&st->completion); complete(&st->completion);
} }
......
...@@ -1194,7 +1194,7 @@ static void at91_dma_buffer_done(void *data) ...@@ -1194,7 +1194,7 @@ static void at91_dma_buffer_done(void *data)
{ {
struct iio_dev *indio_dev = data; struct iio_dev *indio_dev = data;
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
} }
static int at91_adc_dma_start(struct iio_dev *indio_dev) static int at91_adc_dma_start(struct iio_dev *indio_dev)
......
...@@ -678,7 +678,7 @@ static irqreturn_t max11410_interrupt(int irq, void *dev_id) ...@@ -678,7 +678,7 @@ static irqreturn_t max11410_interrupt(int irq, void *dev_id)
struct max11410_state *st = iio_priv(indio_dev); struct max11410_state *st = iio_priv(indio_dev);
if (iio_buffer_enabled(indio_dev)) if (iio_buffer_enabled(indio_dev))
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
else else
complete(&st->completion); complete(&st->completion);
......
...@@ -85,7 +85,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p) ...@@ -85,7 +85,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p)
*/ */
if (sdata->hw_irq_trigger && if (sdata->hw_irq_trigger &&
st_sensors_new_samples_available(indio_dev, sdata)) { st_sensors_new_samples_available(indio_dev, sdata)) {
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
} else { } else {
dev_dbg(indio_dev->dev.parent, "spurious IRQ\n"); dev_dbg(indio_dev->dev.parent, "spurious IRQ\n");
return IRQ_NONE; return IRQ_NONE;
...@@ -110,7 +110,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p) ...@@ -110,7 +110,7 @@ static irqreturn_t st_sensors_irq_thread(int irq, void *p)
dev_dbg(indio_dev->dev.parent, dev_dbg(indio_dev->dev.parent,
"more samples came in during polling\n"); "more samples came in during polling\n");
sdata->hw_timestamp = iio_get_time_ns(indio_dev); sdata->hw_timestamp = iio_get_time_ns(indio_dev);
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -813,7 +813,7 @@ static irqreturn_t fxas21002c_data_rdy_thread(int irq, void *private) ...@@ -813,7 +813,7 @@ static irqreturn_t fxas21002c_data_rdy_thread(int irq, void *private)
if (!data_ready) if (!data_ready)
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(data->dready_trig); iio_trigger_poll_nested(data->dready_trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -939,7 +939,7 @@ static irqreturn_t mpu3050_irq_thread(int irq, void *p) ...@@ -939,7 +939,7 @@ static irqreturn_t mpu3050_irq_thread(int irq, void *p)
if (!(val & MPU3050_INT_STATUS_RAW_RDY)) if (!(val & MPU3050_INT_STATUS_RAW_RDY))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(p); iio_trigger_poll_nested(p);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -68,7 +68,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private) ...@@ -68,7 +68,7 @@ static irqreturn_t hts221_trigger_handler_thread(int irq, void *private)
if (!(status & HTS221_RH_DRDY_MASK)) if (!(status & HTS221_RH_DRDY_MASK))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(hw->trig); iio_trigger_poll_nested(hw->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -222,7 +222,14 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private) ...@@ -222,7 +222,14 @@ irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private)
} }
EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
void iio_trigger_poll_chained(struct iio_trigger *trig) /**
* iio_trigger_poll_nested() - Call the threaded trigger handler of the
* consumers
* @trig: trigger which occurred
*
* This function should only be called from a kernel thread context.
*/
void iio_trigger_poll_nested(struct iio_trigger *trig)
{ {
int i; int i;
...@@ -237,7 +244,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig) ...@@ -237,7 +244,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig)
} }
} }
} }
EXPORT_SYMBOL(iio_trigger_poll_chained); EXPORT_SYMBOL(iio_trigger_poll_nested);
void iio_trigger_notify_done(struct iio_trigger *trig) void iio_trigger_notify_done(struct iio_trigger *trig)
{ {
......
...@@ -108,7 +108,7 @@ static void acpi_als_notify(struct acpi_device *device, u32 event) ...@@ -108,7 +108,7 @@ static void acpi_als_notify(struct acpi_device *device, u32 event)
if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev)) { if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev)) {
switch (event) { switch (event) {
case ACPI_ALS_NOTIFY_ILLUMINANCE: case ACPI_ALS_NOTIFY_ILLUMINANCE:
iio_trigger_poll_chained(als->trig); iio_trigger_poll_nested(als->trig);
break; break;
default: default:
/* Unhandled event */ /* Unhandled event */
......
...@@ -431,7 +431,7 @@ static irqreturn_t rpr0521_drdy_irq_thread(int irq, void *private) ...@@ -431,7 +431,7 @@ static irqreturn_t rpr0521_drdy_irq_thread(int irq, void *private)
struct rpr0521_data *data = iio_priv(indio_dev); struct rpr0521_data *data = iio_priv(indio_dev);
if (rpr0521_is_triggered(data)) { if (rpr0521_is_triggered(data)) {
iio_trigger_poll_chained(data->drdy_trigger0); iio_trigger_poll_nested(data->drdy_trigger0);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -161,7 +161,7 @@ static irqreturn_t st_uvis25_trigger_handler_thread(int irq, void *private) ...@@ -161,7 +161,7 @@ static irqreturn_t st_uvis25_trigger_handler_thread(int irq, void *private)
if (!(status & ST_UVIS25_REG_UV_DA_MASK)) if (!(status & ST_UVIS25_REG_UV_DA_MASK))
return IRQ_NONE; return IRQ_NONE;
iio_trigger_poll_chained(hw->trig); iio_trigger_poll_nested(hw->trig);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -1078,7 +1078,7 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p) ...@@ -1078,7 +1078,7 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p)
} }
if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev)) if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev))
iio_trigger_poll_chained(indio_dev->trig); iio_trigger_poll_nested(indio_dev->trig);
end: end:
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -89,7 +89,7 @@ static irqreturn_t vcnl4035_drdy_irq_thread(int irq, void *private) ...@@ -89,7 +89,7 @@ static irqreturn_t vcnl4035_drdy_irq_thread(int irq, void *private)
IIO_EV_TYPE_THRESH, IIO_EV_TYPE_THRESH,
IIO_EV_DIR_EITHER), IIO_EV_DIR_EITHER),
iio_get_time_ns(indio_dev)); iio_get_time_ns(indio_dev));
iio_trigger_poll_chained(data->drdy_trigger0); iio_trigger_poll_nested(data->drdy_trigger0);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -118,7 +118,7 @@ static int lmp91000_read(struct lmp91000_data *data, int channel, int *val) ...@@ -118,7 +118,7 @@ static int lmp91000_read(struct lmp91000_data *data, int channel, int *val)
data->chan_select = channel != LMP91000_REG_MODECN_3LEAD; data->chan_select = channel != LMP91000_REG_MODECN_3LEAD;
iio_trigger_poll_chained(data->trig); iio_trigger_poll_nested(data->trig);
ret = wait_for_completion_timeout(&data->completion, HZ); ret = wait_for_completion_timeout(&data->completion, HZ);
reinit_completion(&data->completion); reinit_completion(&data->completion);
......
...@@ -829,7 +829,7 @@ static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data) ...@@ -829,7 +829,7 @@ static irqreturn_t zpa2326_handle_threaded_irq(int irq, void *data)
} }
/* New sample available: dispatch internal trigger consumers. */ /* New sample available: dispatch internal trigger consumers. */
iio_trigger_poll_chained(priv->trigger); iio_trigger_poll_nested(priv->trigger);
if (cont) if (cont)
/* /*
......
...@@ -257,7 +257,7 @@ static void as3935_event_work(struct work_struct *work) ...@@ -257,7 +257,7 @@ static void as3935_event_work(struct work_struct *work)
switch (val) { switch (val) {
case AS3935_EVENT_INT: case AS3935_EVENT_INT:
iio_trigger_poll_chained(st->trig); iio_trigger_poll_nested(st->trig);
break; break;
case AS3935_DISTURB_INT: case AS3935_DISTURB_INT:
case AS3935_NOISE_INT: case AS3935_NOISE_INT:
......
...@@ -46,7 +46,7 @@ static int iio_loop_thread(void *data) ...@@ -46,7 +46,7 @@ static int iio_loop_thread(void *data)
set_freezable(); set_freezable();
do { do {
iio_trigger_poll_chained(trig); iio_trigger_poll_nested(trig);
} while (likely(!kthread_freezable_should_stop(NULL))); } while (likely(!kthread_freezable_should_stop(NULL)));
return 0; return 0;
......
...@@ -152,7 +152,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info); ...@@ -152,7 +152,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info);
int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig); int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig);
void iio_trigger_poll(struct iio_trigger *trig); void iio_trigger_poll(struct iio_trigger *trig);
void iio_trigger_poll_chained(struct iio_trigger *trig); void iio_trigger_poll_nested(struct iio_trigger *trig);
irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment