aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/leds/led-class.c3
-rw-r--r--drivers/leds/leds.h7
-rw-r--r--drivers/leds/ledtrig-timer.c3
3 files changed, 12 insertions, 1 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index d5a4ade88991..dc3d3d83191a 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -131,7 +131,8 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
131 if (!led_cdev->blink_brightness) 131 if (!led_cdev->blink_brightness)
132 led_cdev->blink_brightness = led_cdev->max_brightness; 132 led_cdev->blink_brightness = led_cdev->max_brightness;
133 133
134 if (delay_on == led_cdev->blink_delay_on && 134 if (led_get_trigger_data(led_cdev) &&
135 delay_on == led_cdev->blink_delay_on &&
135 delay_off == led_cdev->blink_delay_off) 136 delay_off == led_cdev->blink_delay_off)
136 return; 137 return;
137 138
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 2dd8ecbfdc31..e77c7f8dcdd4 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -40,10 +40,17 @@ void led_trigger_set_default(struct led_classdev *led_cdev);
40void led_trigger_set(struct led_classdev *led_cdev, 40void led_trigger_set(struct led_classdev *led_cdev,
41 struct led_trigger *trigger); 41 struct led_trigger *trigger);
42void led_trigger_remove(struct led_classdev *led_cdev); 42void led_trigger_remove(struct led_classdev *led_cdev);
43
44static inline void *led_get_trigger_data(struct led_classdev *led_cdev)
45{
46 return led_cdev->trigger_data;
47}
48
43#else 49#else
44#define led_trigger_set_default(x) do {} while (0) 50#define led_trigger_set_default(x) do {} while (0)
45#define led_trigger_set(x, y) do {} while (0) 51#define led_trigger_set(x, y) do {} while (0)
46#define led_trigger_remove(x) do {} while (0) 52#define led_trigger_remove(x) do {} while (0)
53#define led_get_trigger_data(x) (NULL)
47#endif 54#endif
48 55
49ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, 56ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index b09bcbeade9c..d87c9d02f786 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -91,6 +91,9 @@ static void timer_trig_activate(struct led_classdev *led_cdev)
91 if (rc) 91 if (rc)
92 goto err_out_delayon; 92 goto err_out_delayon;
93 93
94 led_blink_set(led_cdev, &led_cdev->blink_delay_on,
95 &led_cdev->blink_delay_off);
96
94 led_cdev->trigger_data = (void *)1; 97 led_cdev->trigger_data = (void *)1;
95 98
96 return; 99 return;