aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-heartbeat.c
diff options
context:
space:
mode:
authorShuah Khan <shuahkhan@gmail.com>2012-05-29 18:07:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:31 -0400
commit03c091e5b726ada6aaf9af1d0e973679099101e4 (patch)
treeacbe5d242a76b2296d15804c4cc2766ca1295d4b /drivers/leds/ledtrig-heartbeat.c
parentb00961824a33aadec4a825eaeccfbe3db8ec7032 (diff)
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)
83 led_heartbeat_function, (unsigned long) led_cdev); 83 led_heartbeat_function, (unsigned long) led_cdev);
84 heartbeat_data->phase = 0; 84 heartbeat_data->phase = 0;
85 led_heartbeat_function(heartbeat_data->timer.data); 85 led_heartbeat_function(heartbeat_data->timer.data);
86 led_cdev->activated = true;
86} 87}
87 88
88static void heartbeat_trig_deactivate(struct led_classdev *led_cdev) 89static void heartbeat_trig_deactivate(struct led_classdev *led_cdev)
89{ 90{
90 struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data; 91 struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;
91 92
92 if (heartbeat_data) { 93 if (led_cdev->activated) {
93 del_timer_sync(&heartbeat_data->timer); 94 del_timer_sync(&heartbeat_data->timer);
94 kfree(heartbeat_data); 95 kfree(heartbeat_data);
96 led_cdev->activated = false;
95 } 97 }
96} 98}
97 99