leds: change ledtrig-timer to use activated flag
authorShuah Khan <shuahkhan@gmail.com>
Tue, 29 May 2012 22:07:28 +0000 (15:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 May 2012 23:22:31 +0000 (16:22 -0700)
Change existing timer trigger to use the new ->activated flag to set
activate successful status in activate routine and check it in deactivate
routine 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>
drivers/leds/ledtrig-timer.c

index b32d5eae82271974aef59c14e7f156542cd236b6..9010f7abaf2cac05b5d65c118af6fcbb70a8f34e 100644 (file)
@@ -87,8 +87,7 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
 
        led_blink_set(led_cdev, &led_cdev->blink_delay_on,
                      &led_cdev->blink_delay_off);
-
-       led_cdev->trigger_data = (void *)1;
+       led_cdev->activated = true;
 
        return;
 
@@ -98,9 +97,10 @@ err_out_delayon:
 
 static void timer_trig_deactivate(struct led_classdev *led_cdev)
 {
-       if (led_cdev->trigger_data) {
+       if (led_cdev->activated) {
                device_remove_file(led_cdev->dev, &dev_attr_delay_on);
                device_remove_file(led_cdev->dev, &dev_attr_delay_off);
+               led_cdev->activated = false;
        }
 
        /* Stop blinking */