aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds/trigger/ledtrig-transient.c
AgeCommit message (Collapse)AuthorFilesLines
2022-12-25treewide: Convert del_timer*() to timer_shutdown*()Steven Rostedt (Google)1-1/+1
Due to several bugs caused by timers being re-armed after they are shutdown and just before they are freed, a new state of timers was added called "shutdown". After a timer is set to this state, then it can no longer be re-armed. The following script was run to find all the trivial locations where del_timer() or del_timer_sync() is called in the same function that the object holding the timer is freed. It also ignores any locations where the timer->function is modified between the del_timer*() and the free(), as that is not considered a "trivial" case. This was created by using a coccinelle script and the following commands: $ cat timer.cocci @@ expression ptr, slab; identifier timer, rfield; @@ ( - del_timer(&ptr->timer); + timer_shutdown(&ptr->timer); | - del_timer_sync(&ptr->timer); + timer_shutdown_sync(&ptr->timer); ) ... when strict when != ptr->timer ( kfree_rcu(ptr, rfield); | kmem_cache_free(slab, ptr); | kfree(ptr); ) $ spatch timer.cocci . > /tmp/t.patch $ patch -p1 < /tmp/t.patch Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Steven Rostedt (Google) <[email protected]> Acked-by: Pavel Machek <[email protected]> [ LED ] Acked-by: Kalle Valo <[email protected]> [ wireless ] Acked-by: Paolo Abeni <[email protected]> [ networking ] Signed-off-by: Linus Torvalds <[email protected]>
2019-06-28docs: leds: convert to ReSTMauro Carvalho Chehab1-1/+1
Rename the leds documentation files to ReST, add an index for them and adjust in order to produce a nice html output via the Sphinx build system. At its new index.rst, let's add a :orphan: while this is not linked to the main index.rst file, in order to avoid build warnings. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2018-07-05leds: transient trigger: simplifications from core changesUwe Kleine-König1-68/+30
The trigger core learned error handling for the activate callback and can handle device attributes now. This allows simplifying the driver considerably. Note that .deactivate() is only called when .activate() succeeded, so the check for .activated can go away. Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2018-07-05leds: triggers: let struct led_trigger::activate() return an error codeUwe Kleine-König1-3/+5
Given that activating a trigger can fail, let the callback return an indication. This prevents to have a trigger active according to the "trigger" sysfs attribute but not functional. All users are changed accordingly to return 0 for now. There is no intended change in behaviour. Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2018-01-11leds: ledtrig-transient: Add SPDX license identifiersShuah Khan1-20/+13
Replace GPL license statements with SPDX GPL-2.0 license identifiers and correct the module license to GPLv2. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2017-10-25leds: Convert timers to use timer_setup()Kees Cook1-5/+7
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Richard Purdie <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Jacek Anaszewski <[email protected]>
2016-01-04leds: ledtrig-transient: fix duration to be msec instead of jiffiesRob Herring1-1/+1
The transient trigger duration is documented to be in msec units, but is actually in jiffies units. Other time based triggers are in msec units as well. Fix the timer setup to convert from msec. This could break an existing userspace that worked around this problem, but exposing jiffies to userspace is just wrong and would break anyway if HZ is changed. Signed-off-by: Rob Herring <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Richard Purdie <[email protected]> Cc: [email protected] Signed-off-by: Jacek Anaszewski <[email protected]>
2016-01-04leds: core: Add led_set_brightness_nosleep{nopm} functionsJacek Anaszewski1-4/+4
This patch adds led_set_brightness_nosleep() and led_set_brightness_nopm() functions, that guarantee setting LED brightness in a non-blocking way. The latter is used from pm_ops context and doesn't modify the brightness cached in the struct led_classdev. Its execution always ends up with a call to brightness setting op - either directly or through a set_brightness_work, regardless of LED_SUSPENDED flag state. The patch also replaces led_set_brightness_async() with led_set_brightness_nosleep() in all places where the most vital was setting brightness in a non sleeping way but not necessarily asynchronously, which is not needed for non-blocking drivers. Signed-off-by: Jacek Anaszewski <[email protected]> Acked-by: Sakari Ailus <[email protected]>
2014-11-14leds: Add support for setting brightness in a synchronous wayJacek Anaszewski1-4/+6
There are use cases when setting a LED brightness has to have immediate effect (e.g. setting a torch LED brightness). This patch extends LED subsystem to support such operations. The LED subsystem internal API __led_set_brightness is changed to led_set_brightness_async and new led_set_brightness_sync API is added. Signed-off-by: Jacek Anaszewski <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Richard Purdie <[email protected]> Signed-off-by: Bryan Wu <[email protected]>
2013-04-01leds: move LED trigger drivers into new subdirectoryKim, Milo1-0/+237
For better driver management, new subdirectory, 'trigger' is created. All LED trigger drivers are moved into this directory. Internal header, 'leds.h' is included in each LED trigger drivers. Fix the location of header file, "leds.h" -> "../leds.h" in driver files. One exception is here, 'ledtrig-timer.c'. There is no need to include 'leds.h'. so '#include "leds.h"' line was removed. Signed-off-by: Milo(Woogyom) Kim <[email protected]> Signed-off-by: Bryan Wu <[email protected]>