leds: use led_brightness_set in led_trigger_event
PATCH 1/1 leds: use led_brightness_set in led_trigger_event
Fix led_trigger_event() to use led_brightness_set() instead of led_set_brightness(), so that any pending blink timer is stopped before setting the new brightness value. Without this fix LED status may be overridden by a pending timer.
This allows a trigger to use a mix of led_trigger_event(), led_trigger_blink() and led_trigger_blink_oneshot() without races.
---
Hi Bryan,
I found this one while working on another patch but I think it's also needed by other drivers which mixes led_trigger_blink() and led_trigger_event(), such as power_supply_leds.
Without this a led don't stop blinking as it should when calling led_trigger_event().
Should not cause any harm on other drivers.
(I'm starting to find the whole led_set_brightness/led_brightness_set thing a bit confusing BTW...)
Fabio
drivers/leds/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/led-triggers.c +1 -1
@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig,struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); -led_set_brightness (led_cdev, brightness); +led_brightness_set (led_cdev, brightness); }read_unlock (&trig->leddev_list_lock); }
Signature · 1 line
1.7.11.rc1.9.gf623ca1.dirty
Quoted 13 lines · Fabio Baltieri
Fix
led_trigger_event()to useled_brightness_set()instead ofled_set_brightness(), so that any pending blink timer is stopped before setting the new brightness value. Without this fix LED status may be overridden by a pending timer.This allows a trigger to use a mix of
led_trigger_event(),led_trigger_blink()andled_trigger_blink_oneshot()without races.Signed-off-by Fabio Baltieri <[email protected]>Cc Bryan Wu <[email protected]>---
Hi Bryan,
Quoted 6 lines
I found this one while working on another patch but I think it's also needed by other drivers which mixes
led_trigger_blink()andled_trigger_event(), such aspower_supply_leds.Without this a led don't stop blinking as it should when calling
led_trigger_event().
Good find. This is very subtle race though because both timer and oneshot triggers call led_brightness_set() from their deactivate routines. Is this when these events triggered using oneshot trigger?
Quoted 5 lines
Should not cause any harm on other drivers.
(I'm starting to find the whole led_set_brightness/led_brightness_set thing a bit confusing BTW...)
I agree with the names are confusing. :) It found it confusing as well. Probably why we have this bug hiding until led_trigger_blink() came along.
led_brightness_set() calls led_set_brightness(). led_set_brightness() takes cares about whether the driver is in suspend state and invokes driver's brightness_set interface. Maybe led_clear_blink_timer() would be a better name for this led_brightness_set() routine.
I can volunteer to make this change if we agree that this will be a good one to clear this naming confusion.
-- Shuah
Quoted 11 lines
Fabio
drivers/leds/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/leds/led-triggers.c +0
-0
drivers/leds/led-triggers.c void led_trigger_event(struct led_trigger *trig, · line 227
Quoted 5 lines
drivers/leds/led-triggers.c +1
-1@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig,struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); -led_set_brightness (led_cdev, brightness); +led_brightness_set (led_cdev, brightness);
This is in-line with led_trigger_set() which is calling led_bightness_set() correctly. Also led_classdev_unregister() calls it I think for the same reason so the blink timer can be stopped.
Quoted 3 lines
drivers/leds/led-triggers.c +0
-0}read_unlock (&trig->leddev_list_lock); }
Quoted 18 lines · Shuah Khan
Quoted 17 lines · Fabio Baltieri
Fix
led_trigger_event()to useled_brightness_set()instead ofled_set_brightness(), so that any pending blink timer is stopped before setting the new brightness value. Without this fix LED status may be overridden by a pending timer.This allows a trigger to use a mix of
led_trigger_event(),led_trigger_blink()andled_trigger_blink_oneshot()without races.Signed-off-by Fabio Baltieri <[email protected]>Cc Bryan Wu <[email protected]>---
Hi Bryan,I found this one while working on another patch but I think it's also needed by other drivers which mixes
led_trigger_blink()andled_trigger_event(), such aspower_supply_leds.
Quoted 6 lines
Quoted 2 lines
Without this a led don't stop blinking as it should when calling
led_trigger_event().Good find. This is very subtle race though because both timer and oneshot triggers call
led_brightness_set()from their deactivate routines. Is this when these events triggered using oneshot trigger?
Actually that was when mixing blink (both timer and oneshot, they use the same timer) and standard trigger-event-set. It should be safe if only internal (core) functions call set_brightness.
Quoted 6 lines
Quoted 5 lines
Should not cause any harm on other drivers.
(I'm starting to find the whole led_set_brightness/led_brightness_set thing a bit confusing BTW...)
Quoted 8 lines
I agree with the names are confusing. :) It found it confusing as well. Probably why we have this bug hiding until
led_trigger_blink()came along.
led_brightness_set()callsled_set_brightness().led_set_brightness()takes cares about whether the driver is in suspend state and invokes driver'sbrightness_setinterface. Maybeled_clear_blink_timer()would be a better name for thisled_brightness_set()routine.
I think maybe we should just rename the function to led_set_brightness() for the safe one (the one whichh also deactivate the time) and _led_set_brightness() for the internal one, to put some emphasis to the "internal" nature of the second.
Quoted 2 lines
I can volunteer to make this change if we agree that this will be a good one to clear this naming confusion.
That would save some headache in the future! :-)
Fabio
Quoted 29 lines
-- Shuah
Quoted 11 lines
Fabio
drivers/leds/led-triggers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/leds/led-triggers.c +0
-0drivers/leds/led-triggers.c void led_trigger_event(struct led_trigger *trig, · line 227
Quoted 5 lines
drivers/leds/led-triggers.c +1
-1@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig,struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); -led_set_brightness (led_cdev, brightness); +led_brightness_set (led_cdev, brightness);This is in-line with
led_trigger_set()which is callingled_bightness_set()correctly. Alsoled_classdev_unregister()calls it I think for the same reason so the blink timer can be stopped.Quoted 3 lines
drivers/leds/led-triggers.c +0
-0}read_unlock (&trig->leddev_list_lock); }
Quoted 45 lines · Fabio Baltieri
Quoted 18 lines · Shuah Khan
Quoted 17 lines · Fabio Baltieri
Fix
led_trigger_event()to useled_brightness_set()instead ofled_set_brightness(), so that any pending blink timer is stopped before setting the new brightness value. Without this fix LED status may be overridden by a pending timer.This allows a trigger to use a mix of
led_trigger_event(),led_trigger_blink()andled_trigger_blink_oneshot()without races.Signed-off-by Fabio Baltieri <[email protected]>Cc Bryan Wu <[email protected]>---
Hi Bryan,I found this one while working on another patch but I think it's also needed by other drivers which mixes
led_trigger_blink()andled_trigger_event(), such aspower_supply_leds.Quoted 6 lines
Quoted 2 lines
Without this a led don't stop blinking as it should when calling
led_trigger_event().Good find. This is very subtle race though because both timer and oneshot triggers call
led_brightness_set()from their deactivate routines. Is this when these events triggered using oneshot trigger?Actually that was when mixing blink (both timer and oneshot, they use the same timer) and standard trigger-event-set. It should be safe if only internal (core) functions call
set_brightness.Quoted 6 lines
Quoted 5 lines
Should not cause any harm on other drivers.
(I'm starting to find the whole led_set_brightness/led_brightness_set thing a bit confusing BTW...)
Quoted 8 lines
I agree with the names are confusing. :) It found it confusing as well. Probably why we have this bug hiding until
led_trigger_blink()came along.
led_brightness_set()callsled_set_brightness().led_set_brightness()takes cares about whether the driver is in suspend state and invokes driver'sbrightness_setinterface. Maybeled_clear_blink_timer()would be a better name for thisled_brightness_set()routine.
Quoted 5 lines
I think maybe we should just rename the function to
led_set_brightness()for the safe one (the one whichh also deactivate the time) and_led_set_brightness()for the internal one, to put some emphasis to the "internal" nature of the second.
Thanks for catching this. It's a good idea we sort out those confusing name. Probably __led_set_bringness() is more conventional than _led_set_brightness().
And might also need to revisit other function names.
Quoted 3 lines
Quoted 2 lines
I can volunteer to make this change if we agree that this will be a good one to clear this naming confusion.
OK, good Shuah, please go ahead and submit patches and I will hold this patch for a while and wait for the final fixing.
-Bryan
Quoted 33 lines
That would save some headache in the future! :-)
Fabio
Quoted 29 lines
-- Shuah
Quoted 11 lines
Fabio
drivers/leds/led-triggers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)drivers/leds/led-triggers.c +0
-0drivers/leds/led-triggers.c void led_trigger_event(struct led_trigger *trig, · line 227
Quoted 5 lines
drivers/leds/led-triggers.c +1
-1@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig, struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); - led_set_brightness(led_cdev, brightness); + led_brightness_set(led_cdev, brightness);This is in-line with
led_trigger_set()which is callingled_bightness_set()correctly. Alsoled_classdev_unregister()calls it I think for the same reason so the blink timer can be stopped.Quoted 3 lines
drivers/leds/led-triggers.c +0
-0} read_unlock(&trig->leddev_list_lock); }
Signature · 4 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com
Quoted 5 lines
Thanks for catching this. It's a good idea we sort out those confusing name. Probably
__led_set_bringness()is more conventional than_led_set_brightness().
Quoted 9 lines
And might also need to revisit other function names.
Quoted 3 lines
Quoted 2 lines
I can volunteer to make this change if we agree that this will be a good one to clear this naming confusion.
OK, good Shuah, please go ahead and submit patches and I will hold this patch for a while and wait for the final fixing.
Thanks. __led_set_brightness() sounds good. Will base patches off of linux-leds devel unless that is not the right one.
-- Shuah
PATCH 1/1 leds: Rename led_set_brightness() to __led_set_brightness()
Rename leds internal interface led_set_brightness() to __led_set_brightness() to reduce confusion between led_set_brightness() and the external interface led_brightness_set(). led_brightness_set() cancels the timer and then calls led_set_brightness().
---
Bryan,
This is the first patch that renames led_set_brightness() to __led_set_brightness(). Will send another patch that renames led_brightness_set() to led_set_brightness().
-- Shuah
drivers/leds/led-class.c | 6 +++--- drivers/leds/led-core.c | 4 ++-- drivers/leds/led-triggers.c | 2 +- drivers/leds/leds.h | 2 +- drivers/leds/ledtrig-backlight.c | 8 ++++---- drivers/leds/ledtrig-default-on.c | 2 +- drivers/leds/ledtrig-gpio.c | 6 +++--- drivers/leds/ledtrig-heartbeat.c | 2 +- drivers/leds/ledtrig-oneshot.c | 4 ++-- drivers/leds/ledtrig-transient.c | 8 ++++---- 10 files changed, 22 insertions(+), 22 deletions(-)
drivers/leds/led-class.c +3 -3
@@ -53,7 +53,7 @@ static ssize_t led_brightness_store(struct device *dev,if (state ==LED_OFF )led_trigger_remove (led_cdev); -led_set_brightness (led_cdev, state); +__led_set_brightness (led_cdev, state);return size; }
@@ -82,7 +82,7 @@ static void led_timer_function(unsigned long data)unsigned long delay;if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { -led_set_brightness (led_cdev,LED_OFF ); +__led_set_brightness (led_cdev,LED_OFF );return ; }
@@ -105,7 +105,7 @@ static void led_timer_function(unsigned long data) delay = led_cdev->blink_delay_off; } -led_set_brightness (led_cdev, brightness); +__led_set_brightness (led_cdev, brightness);/* Return in next iteration if led is in one-shot mode and we are in * the final blink state so that the led is toggled each delay_on +
drivers/leds/led-core.c +2 -2
@@ -45,7 +45,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev,/* never off - just set to brightness */ if (!delay_off) { -led_set_brightness (led_cdev, led_cdev->blink_brightness); +__led_set_brightness (led_cdev, led_cdev->blink_brightness);return ; }
@@ -111,6 +111,6 @@ void led_brightness_set(struct led_classdev *led_cdev, led_cdev->blink_delay_on =0 ; led_cdev->blink_delay_off =0 ; -led_set_brightness (led_cdev, brightness); +__led_set_brightness (led_cdev, brightness); }EXPORT_SYMBOL (led_brightness_set);
drivers/leds/led-triggers.c +1 -1
@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig,struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); -led_set_brightness (led_cdev, brightness); +__led_set_brightness (led_cdev, brightness); }read_unlock (&trig->leddev_list_lock); }
drivers/leds/leds.h +1 -1
@@ -17,7 +17,7 @@#include <linux/rwsem.h> #include <linux/leds.h> -static inline void led_set_brightness (struct led_classdev *led_cdev, +static inline void __led_set_brightness (struct led_classdev *led_cdev,enum led_brightness value) {if (value > led_cdev->max_brightness)
drivers/leds/ledtrig-backlight.c +4 -4
@@ -46,9 +46,9 @@ static int fb_notifier_callback(struct notifier_block *p,if ((n->old_status ==UNBLANK ) ^ n->invert) { n->brightness = led->brightness; -led_set_brightness (led,LED_OFF ); +__led_set_brightness (led,LED_OFF ); }else { -led_set_brightness (led, n->brightness); +__led_set_brightness (led, n->brightness); } n->old_status = new_status;
@@ -87,9 +87,9 @@ static ssize_t bl_trig_invert_store(struct device *dev,/* After inverting, we need to update the LED. */ if ((n->old_status ==BLANK ) ^ n->invert) -led_set_brightness (led,LED_OFF ); +__led_set_brightness (led,LED_OFF );else -led_set_brightness (led, n->brightness); +__led_set_brightness (led, n->brightness);return num; }
drivers/leds/ledtrig-default-on.c +1 -1
@@ -19,7 +19,7 @@static void defon_trig_activate (struct led_classdev *led_cdev) { -led_set_brightness (led_cdev, led_cdev->max_brightness); +__led_set_brightness (led_cdev, led_cdev->max_brightness); }static struct led_trigger defon_led_trigger = {
drivers/leds/ledtrig-gpio.c +3 -3
@@ -54,12 +54,12 @@ static void gpio_trig_work(struct work_struct *work)if (tmp) {if (gpio_data->desired_brightness) -led_set_brightness (gpio_data->led, +__led_set_brightness (gpio_data->led, gpio_data->desired_brightness);else -led_set_brightness (gpio_data->led,LED_FULL ); +__led_set_brightness (gpio_data->led,LED_FULL ); }else { -led_set_brightness (gpio_data->led,LED_OFF ); +__led_set_brightness (gpio_data->led,LED_OFF ); } }
drivers/leds/ledtrig-heartbeat.c +1 -1
@@ -67,7 +67,7 @@ static void led_heartbeat_function(unsigned long data)break ; } -led_set_brightness (led_cdev, brightness); +__led_set_brightness (led_cdev, brightness);mod_timer (&heartbeat_data->timer, jiffies + delay); }
drivers/leds/ledtrig-oneshot.c +2 -2
@@ -63,9 +63,9 @@ static ssize_t led_invert_store(struct device *dev, oneshot_data->invert = !!state;if (oneshot_data->invert) -led_set_brightness (led_cdev,LED_FULL ); +__led_set_brightness (led_cdev,LED_FULL );else -led_set_brightness (led_cdev,LED_OFF ); +__led_set_brightness (led_cdev,LED_OFF );return size; }
drivers/leds/ledtrig-transient.c +4 -4
@@ -41,7 +41,7 @@ static void transient_timer_function(unsigned long data)struct transient_trig_data *transient_data = led_cdev->trigger_data; transient_data->activate =0 ; -led_set_brightness (led_cdev, transient_data->restore_state); +__led_set_brightness (led_cdev, transient_data->restore_state); } static ssize_t transient_activate_show(struct device *dev,
@@ -72,7 +72,7 @@ static ssize_t transient_activate_store(struct device *dev,if (state ==0 && transient_data->activate ==1 ) {del_timer (&transient_data->timer); transient_data->activate = state; -led_set_brightness (led_cdev, transient_data->restore_state); +__led_set_brightness (led_cdev, transient_data->restore_state);return size; }
@@ -80,7 +80,7 @@ static ssize_t transient_activate_store(struct device *dev,if (state ==1 && transient_data->activate ==0 && transient_data->duration !=0 ) { transient_data->activate = state; -led_set_brightness (led_cdev, transient_data->state); +__led_set_brightness (led_cdev, transient_data->state); transient_data->restore_state = (transient_data->state ==LED_FULL ) ?LED_OFF :LED_FULL ; mod_timer(&transient_data->timer,
@@ -203,7 +203,7 @@ static void transient_trig_deactivate(struct led_classdev *led_cdev)if (led_cdev->activated) {del_timer_sync (&transient_data->timer); -led_set_brightness (led_cdev, transient_data->restore_state); +__led_set_brightness (led_cdev, transient_data->restore_state);device_remove_file (led_cdev->dev, &dev_attr_activate);device_remove_file (led_cdev->dev, &dev_attr_duration);device_remove_file (led_cdev->dev, &dev_attr_state);
Signature · 1 line
1.7.9.5
Re: [PATCH] leds: Rename led_set_brightness() to __led_set_brightness()
Quoted 7 lines · Shuah Khan
Rename leds internal interface
led_set_brightness()to__led_set_brightness()to reduce confusion betweenled_set_brightness()and the external interfaceled_brightness_set().led_brightness_set()cancels the timer and then callsled_set_brightness().Signed-off-by Shuah Khan <[email protected]>
Quoted 8 lines
---
Bryan,
This is the first patch that renames
led_set_brightness()to__led_set_brightness(). Will send another patch that renamesled_brightness_set()toled_set_brightness().-- Shuah
OK, thanks, applied to devel and for-next
Quoted 227 lines
drivers/leds/led-class.c | 6 +++---
drivers/leds/led-core.c| 4 ++--drivers/leds/led-triggers.c| 2 +-drivers/leds/leds.h| 2 +-drivers/leds/ledtrig-backlight.c| 8 ++++----drivers/leds/ledtrig-default-on.c| 2 +-drivers/leds/ledtrig-gpio.c| 6 +++---drivers/leds/ledtrig-heartbeat.c| 2 +-drivers/leds/ledtrig-oneshot.c| 4 ++--drivers/leds/ledtrig-transient.c| 8 ++++----10 files changed, 22 insertions(+), 22 deletions(-)drivers/leds/led-class.c +3
-3@@ -53,7 +53,7 @@ static ssize_t led_brightness_store(struct device *dev, if (state == LED_OFF) led_trigger_remove(led_cdev); - led_set_brightness(led_cdev, state); + __led_set_brightness(led_cdev, state); return size; }@@ -82,7 +82,7 @@ static void led_timer_function(unsigned long data) unsigned long delay; if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { - led_set_brightness(led_cdev, LED_OFF); + __led_set_brightness(led_cdev, LED_OFF); return; }@@ -105,7 +105,7 @@ static void led_timer_function(unsigned long data) delay = led_cdev->blink_delay_off; } - led_set_brightness(led_cdev, brightness); + __led_set_brightness(led_cdev, brightness); /* Return in next iteration if led is in one-shot mode and we are in* the final blink state so that the led is toggled each delay_on + drivers/leds/led-core.c +2
-2@@ -45,7 +45,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, /* never off - just set to brightness */ if (!delay_off) { - led_set_brightness(led_cdev, led_cdev->blink_brightness); + __led_set_brightness(led_cdev, led_cdev->blink_brightness); return; }@@ -111,6 +111,6 @@ void led_brightness_set(struct led_classdev *led_cdev, led_cdev->blink_delay_on = 0; led_cdev->blink_delay_off = 0; - led_set_brightness(led_cdev, brightness); + __led_set_brightness(led_cdev, brightness); } EXPORT_SYMBOL(led_brightness_set);drivers/leds/led-triggers.c +1
-1@@ -224,7 +224,7 @@ void led_trigger_event(struct led_trigger *trig, struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); - led_set_brightness(led_cdev, brightness); + __led_set_brightness(led_cdev, brightness); } read_unlock(&trig->leddev_list_lock); }drivers/leds/leds.h +1
-1@@ -17,7 +17,7 @@ #include <linux/rwsem.h> #include <linux/leds.h> -static inline void led_set_brightness (struct led_classdev *led_cdev, +static inline void __led_set_brightness (struct led_classdev *led_cdev, enum led_brightness value) { if (value > led_cdev->max_brightness)drivers/leds/ledtrig-backlight.c +3
-3@@ -46,9 +46,9 @@ static int fb_notifier_callback(struct notifier_block *p, if ((n->old_status == UNBLANK) ^ n->invert) { n->brightness = led->brightness; - led_set_brightness(led, LED_OFF); + __led_set_brightness(led, LED_OFF); } else { - led_set_brightness(led, n->brightness); + __led_set_brightness(led, n->brightness); } n->old_status = new_status;@@ -87,9 +87,9 @@ static ssize_t bl_trig_invert_store(struct device *dev, /* After inverting, we need to update the LED. */ if ((n->old_status == BLANK) ^ n->invert) - led_set_brightness(led, LED_OFF); + __led_set_brightness(led, LED_OFF);else
-led_set_brightness(led, n->brightness);
+__led_set_brightness(led, n->brightness);return num;
}drivers/leds/ledtrig-default-on.c +1
-1@@ -19,7 +19,7 @@ static void defon_trig_activate(struct led_classdev *led_cdev) { - led_set_brightness(led_cdev, led_cdev->max_brightness); + __led_set_brightness(led_cdev, led_cdev->max_brightness); } static struct led_trigger defon_led_trigger = {drivers/leds/ledtrig-gpio.c +1
-1@@ -54,12 +54,12 @@ static void gpio_trig_work(struct work_struct *work) if (tmp) { if (gpio_data->desired_brightness) - led_set_brightness(gpio_data->led, + __led_set_brightness(gpio_data->led, gpio_data->desired_brightness);else
-led_set_brightness(gpio_data->led, LED_FULL);
+__led_set_brightness(gpio_data->led, LED_FULL); } else {
-led_set_brightness(gpio_data->led, LED_OFF);
+__led_set_brightness(gpio_data->led, LED_OFF); }
}drivers/leds/ledtrig-heartbeat.c +1
-1@@ -67,7 +67,7 @@ static void led_heartbeat_function(unsigned long data) break; } - led_set_brightness(led_cdev, brightness); + __led_set_brightness(led_cdev, brightness); mod_timer(&heartbeat_data->timer, jiffies + delay); }drivers/leds/ledtrig-oneshot.c +1
-1@@ -63,9 +63,9 @@ static ssize_t led_invert_store(struct device *dev, oneshot_data->invert = !!state; if (oneshot_data->invert) - led_set_brightness(led_cdev, LED_FULL); + __led_set_brightness(led_cdev, LED_FULL);else
-led_set_brightness(led_cdev, LED_OFF);
+__led_set_brightness(led_cdev, LED_OFF);return size;
}drivers/leds/ledtrig-transient.c +2
-2@@ -41,7 +41,7 @@ static void transient_timer_function(unsigned long data) struct transient_trig_data *transient_data = led_cdev->trigger_data; transient_data->activate = 0; - led_set_brightness(led_cdev, transient_data->restore_state); + __led_set_brightness(led_cdev, transient_data->restore_state); } static ssize_t transient_activate_show(struct device *dev,@@ -72,7 +72,7 @@ static ssize_t transient_activate_store(struct device *dev, if (state == 0 && transient_data->activate == 1) { del_timer(&transient_data->timer); transient_data->activate = state; - led_set_brightness(led_cdev, transient_data->restore_state); + __led_set_brightness(led_cdev, transient_data->restore_state); return size; }@@ -80,7 +80,7 @@ static ssize_t transient_activate_store(struct device *dev,if (state == 1 &&
transient_data->activate== 0 &&transient_data->duration!= 0) {transient_data->activate= state;
-led_set_brightness(led_cdev, transient_data->state);
+__led_set_brightness(led_cdev, transient_data->state);transient_data->restore_state= (transient_data->state==LED_FULL) ?LED_OFF:LED_FULL; mod_timer(&transient_data->timer,drivers/leds/ledtrig-transient.c +1
-2@@ -203,7 +203,7 @@ static void transient_trig_deactivate(struct led_classdev *led_cdev) if (led_cdev->activated) { del_timer_sync(&transient_data->timer); - led_set_brightness(led_cdev, transient_data->restore_state); + __led_set_brightness(led_cdev, transient_data->restore_state); device_remove_file(led_cdev->dev, &dev_attr_activate); device_remove_file(led_cdev->dev, &dev_attr_duration); device_remove_file(led_cdev->dev, &dev_attr_state); --1.7.9.5
Signature · 4 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com