summaryrefslogtreecommitdiff
path: root/drivers/leds/ledtrig-gpio.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-gpio.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-gpio.c')
-rw-r--r--drivers/leds/ledtrig-gpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c
index ecc4bf3f37a9..f057c101b896 100644
--- a/drivers/leds/ledtrig-gpio.c
+++ b/drivers/leds/ledtrig-gpio.c
@@ -200,6 +200,7 @@ static void gpio_trig_activate(struct led_classdev *led)
gpio_data->led = led;
led->trigger_data = gpio_data;
INIT_WORK(&gpio_data->work, gpio_trig_work);
+ led->activated = true;
return;
@@ -217,7 +218,7 @@ static void gpio_trig_deactivate(struct led_classdev *led)
{
struct gpio_trig_data *gpio_data = led->trigger_data;
- if (gpio_data) {
+ if (led->activated) {
device_remove_file(led->dev, &dev_attr_gpio);
device_remove_file(led->dev, &dev_attr_inverted);
device_remove_file(led->dev, &dev_attr_desired_brightness);
@@ -225,6 +226,7 @@ static void gpio_trig_deactivate(struct led_classdev *led)
if (gpio_data->gpio != 0)
free_irq(gpio_to_irq(gpio_data->gpio), led);
kfree(gpio_data);
+ led->activated = false;
}
}