Re: [PATCH v2 1/2] iio: Improve the kernel-doc of iio_trigger_poll

From: Mehdi Djait
Date: Thu Mar 02 2023 - 11:18:23 EST


Hello Andy,

On Thu, Mar 02, 2023 at 05:54:05PM +0200, Andy Shevchenko wrote:
> On Thu, Mar 02, 2023 at 02:04:35PM +0100, Mehdi Djait wrote:
> > Move the kernel-doc of the function to industrialio-trigger.c
> > Add a note on the context where the function is expected to be called.
>
> ...
>
> > v2:
> > - Changed the expected context of from interrupt to hard IRQ context
>
> Thank you for an update.
>
> But it seems I messed up with this and my previous remark shouldn't be
> taken into consideration.
>
> The "relevant hardware interrupt handler" may be hard and threaded IRQ context,
> which looks like your first version was correct.
>
> Let's wait for Jonathan opinion on this as he is a native speaker.

If I understood the function correctly I think you were right. It should
be hard IRQ context

The relevant functions calls:
iio_trigger_poll --> generic_handle_irq --> handle_irq_desc

handle_irq_desc: returns Operation not permitted if !in_hardirq() && handle_enforce_irqctx
and it is the reason why the sysfs trigger uses the irq_framework to call iio_trigger_poll
from hard IRQ context [1][2]

[1] https://lwn.net/Articles/411605/
[2] https://lore.kernel.org/all/1346922337-17088-1-git-send-email-lars@xxxxxxxxxx/

--
Kind Regards
Mehdi Djait