summaryrefslogtreecommitdiffstats
path: root/drivers/leds/ledtrig-backlight.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-backlight.c
parentb00961824a33aadec4a825eaeccfbe3db8ec7032 (diff)
downloadblackbird-op-linux-03c091e5b726ada6aaf9af1d0e973679099101e4.tar.gz
blackbird-op-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-backlight.c')
-rw-r--r--drivers/leds/ledtrig-backlight.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/leds/ledtrig-backlight.c b/drivers/leds/ledtrig-backlight.c
index 2b513a2ad7de..e2726867c5d4 100644
--- a/drivers/leds/ledtrig-backlight.c
+++ b/drivers/leds/ledtrig-backlight.c
@@ -120,6 +120,7 @@ static void bl_trig_activate(struct led_classdev *led)
ret = fb_register_client(&n->notifier);
if (ret)
dev_err(led->dev, "unable to register backlight trigger\n");
+ led->activated = true;
return;
@@ -133,10 +134,11 @@ static void bl_trig_deactivate(struct led_classdev *led)
struct bl_trig_notifier *n =
(struct bl_trig_notifier *) led->trigger_data;
- if (n) {
+ if (led->activated) {
device_remove_file(led->dev, &dev_attr_inverted);
fb_unregister_client(&n->notifier);
kfree(n);
+ led->activated = false;
}
}
OpenPOWER on IntegriCloud