Re: [PATCH v2] staging: r8188eu: use a delayed worker for led updates

Michael Straube
2021-11-27T07:42:11Z

On 11/26/21 12:41, Martin Kaiser wrote:
> The led layer uses a combination of timer and worker for periodic led
> updates, e.g. for blinking. The reason seems to be that blocking
> operations like a usb read are not allowed in a timer handler.
>
> Replace the combination of timer and worker with a delayed worker.
>
> Convert the timeout defines from milliseconds to jiffies to make them
> usable as delays for the delayed worker. Shorten the names of the defines
> and rename the work item to make checkpatch happy.
>
> Other layers may call SwLedControlMode1 to update the led state. Such
> an update may result in cancelling the delayed worker. SwLedControlMode1
> might be called in interrupt context, we must use cancel_delayed_work to
> cancel the worker. cancel_delayed_work_sync waits until the worker is
> finished, this is not allowed in interrupt context.
>
> DeInitLed871x is called when the driver is removed or when the system
> goes into standby. We may use cancel_delayed_work_sync here to cancel
> the delayed worker.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
> v2:
> - do not block if we cancel a delayed worker in interrupt context
>

Hi Martin,

v2 works for me without any sleeping/scheduling while atomic bugs.

Thanks,
Michael