summaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-heartbeat.c
diff options
context:
space:
mode:
authorShuah Khan <shuahkhan@gmail.com>2012-05-29 15:07:28 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 16:22:31 -0700
commit03c091e5b726ada6aaf9af1d0e973679099101e4 (patch)
treeacbe5d242a76b2296d15804c4cc2766ca1295d4b /drivers/leds/ledtrig-heartbeat.c
parentb00961824a33aadec4a825eaeccfbe3db8ec7032 (diff)
downloadlinux-03c091e5b726ada6aaf9af1d0e973679099101e4.tar.gz
linux-03c091e5b726ada6aaf9af1d0e973679099101e4.tar.bz2
linux-03c091e5b726ada6aaf9af1d0e973679099101e4.zip
leds: change existing triggers to use activated flag
Change existing triggers backlight, gpio, and heartbeat to use the new ->activated flag to set activate successful status in their activate routines and check it in their deactivate routines to do cleanup. Signed-off-by: Shuah Khan <shuahkhan@gmail.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Bryan Wu <bryan.wu@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds/ledtrig-heartbeat.c')
-rw-r--r--drivers/leds/ledtrig-heartbeat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c
index 759c0bba4a8f..1aacf4c6c3e4 100644
--- a/drivers/leds/ledtrig-heartbeat.c
+++ b/drivers/leds/ledtrig-heartbeat.c
@@ -83,15 +83,17 @@ static void heartbeat_trig_activate(struct led_classdev *led_cdev)
led_heartbeat_function, (unsigned long) led_cdev);
heartbeat_data->phase = 0;
led_heartbeat_function(heartbeat_data->timer.data);
+ led_cdev->activated = true;
}
static void heartbeat_trig_deactivate(struct led_classdev *led_cdev)
{
struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;
- if (heartbeat_data) {
+ if (led_cdev->activated) {
del_timer_sync(&heartbeat_data->timer);
kfree(heartbeat_data);
+ led_cdev->activated = false;
}
}