staging: r8188eu: use a delayed worker for led updates
authorMartin Kaiser <martin@kaiser.cx>
Fri, 26 Nov 2021 11:41:35 +0000 (12:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Dec 2021 14:14:41 +0000 (15:14 +0100)
commitd7f79cdfe09067bc464b5b0293bfcc23cb29a2e4
treec385d0c43b7cc299275fd0451b36835a2deaf59a
parent505cf656383439ac6031fda6ae1906d8a1b368ea
staging: r8188eu: use a delayed worker for led updates

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>
Link: https://lore.kernel.org/r/20211126114135.18228-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_led.c
drivers/staging/r8188eu/include/rtw_led.h