diff options
| author | Dmitry Rokosov <ddrokosov@salutedevices.com> | 2024-09-04 01:39:30 +0300 |
|---|---|---|
| committer | Lee Jones <lee@kernel.org> | 2024-11-06 08:11:19 +0000 |
| commit | 32360bf6a5d4016669c3545e7b0ec939937f5331 (patch) | |
| tree | 4c98d0520190b9ca0ac53a0d602b05b571b957ed /include/linux | |
| parent | 64dd44a658065ab5595bbfe2cb4d8fd30c9e34a2 (diff) | |
leds: Introduce ordered workqueue for LEDs events instead of system_wq
This allows to setup ordered workqueue for LEDs events. This may be
useful, because default 'system_wq' does not guarantee execution order
of each work_struct, thus for several brightness update requests (for
multiple LEDs), real brightness switch could be in random order.
Yes, for sysfs-based LEDs we have flush_work() call inside
brightness_store() operation, but it's blocking call, so userspace
caller can be blocked at a long time, which means LEDs animation stream
can be broken.
Ordered workqueue has the same behaviour as system_wq + flush_work(),
but all scheduled works are async and userspace caller is not blocked,
which it better for userspace animation scheduling.
Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Link: https://lore.kernel.org/r/20240903223936.21292-1-ddrokosov@salutedevices.com
[Lee: Couple of style fix-ups]
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/leds.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/leds.h b/include/linux/leds.h index e5968c3ed4ae..9f34b9facaad 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -171,6 +171,7 @@ struct led_classdev { int new_blink_brightness; void (*flash_resume)(struct led_classdev *led_cdev); + struct workqueue_struct *wq; /* LED workqueue */ struct work_struct set_brightness_work; int delayed_set_value; unsigned long delayed_delay_on; |
