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>
This commit is contained in:

committed by
Linus Torvalds

parent
b00961824a
commit
03c091e5b7
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user