Re: [PATCH] auxdisplay: Remove in_interrupt() usage.
From: Miguel Ojeda
Date: Mon Feb 08 2021 - 15:11:53 EST
Hi Sebastian,
On Mon, Feb 8, 2021 at 6:59 PM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
>
> charlcd_write() is invoked as a VFS->write() callback and as such it is
> always invoked from preemptible context and may sleep.
>
> charlcd_puts() is invoked from register/unregister callback which is
> preemtible. The reboot notifier callback is also invoked from
preemtible -> preemptible
> preemptible context.
>
> Therefore there is no need to use `in_interrupt()' to figure out if it
> is save to sleep because it always is.
save -> safe
Does it hurt to have `in_interrupt()`? Future patches could make it so
that it is no longer a preemptible context. Should it be moved to e.g.
a `WARN_ON()` instead?
> Using `schedule()' to schedule (an be friendly to others) is
an -> and
> discouraged and `cond_resched()' should be used instead.
>
> Remove `in_interrupt()' and use `cond_resched()' to schedule every 32
> iteration if needed.
>
> Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@xxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Cc'ing Geert and Willy too.
Thanks for the patch!
Cheers,
Miguel