LED fixes for 4.20-rc2
-----BEGIN PGP SIGNATURE----- iJEEABYIADkWIQQUwxxKyE5l/npt8ARiEGxRG/Sl2wUCW+SJrBscamFjZWsuYW5h c3pld3NraUBnbWFpbC5jb20ACgkQYhBsURv0pdtTfAEAg9TNQi+IAth1TuEfbsrO ykB2PDEPD0wZnWh/sEIYhdAA/3zhYeqPq4X9PLhtRZQ2fJFE2Uw/4BTmSAqffD+L 2ZwG =MA3z -----END PGP SIGNATURE----- Merge tag 'led-fixes-for-4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds Pull LED fixes from Jacek Anaszewski: "All three fixes are related to the newly added pattern trigger: - remove mutex_lock() from timer callback, which would trigger problems related to sleeping in atomic context, the removal is harmless since mutex protection turned out to be redundant in this case - fix pattern parsing to properly handle intervals with brightness == 0 - fix typos in the ABI documentation" * tag 'led-fixes-for-4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: Documentation: ABI: led-trigger-pattern: Fix typos leds: trigger: Fix sleeping function called from invalid context Fix pattern handling optimalization
This commit is contained in:
commit
6a1ac56c23
|
@ -37,8 +37,8 @@ Description:
|
|||
0-| / \/ \/
|
||||
+---0----1----2----3----4----5----6------------> time (s)
|
||||
|
||||
2. To make the LED go instantly from one brigntess value to another,
|
||||
we should use use zero-time lengths (the brightness must be same as
|
||||
2. To make the LED go instantly from one brightness value to another,
|
||||
we should use zero-time lengths (the brightness must be same as
|
||||
the previous tuple's). So the format should be:
|
||||
"brightness_1 duration_1 brightness_1 0 brightness_2 duration_2
|
||||
brightness_2 0 ...". For example:
|
||||
|
|
|
@ -75,8 +75,6 @@ static void pattern_trig_timer_function(struct timer_list *t)
|
|||
{
|
||||
struct pattern_trig_data *data = from_timer(data, t, timer);
|
||||
|
||||
mutex_lock(&data->lock);
|
||||
|
||||
for (;;) {
|
||||
if (!data->is_indefinite && !data->repeat)
|
||||
break;
|
||||
|
@ -87,9 +85,10 @@ static void pattern_trig_timer_function(struct timer_list *t)
|
|||
data->curr->brightness);
|
||||
mod_timer(&data->timer,
|
||||
jiffies + msecs_to_jiffies(data->curr->delta_t));
|
||||
|
||||
/* Skip the tuple with zero duration */
|
||||
pattern_trig_update_patterns(data);
|
||||
if (!data->next->delta_t) {
|
||||
/* Skip the tuple with zero duration */
|
||||
pattern_trig_update_patterns(data);
|
||||
}
|
||||
/* Select next tuple */
|
||||
pattern_trig_update_patterns(data);
|
||||
} else {
|
||||
|
@ -116,8 +115,6 @@ static void pattern_trig_timer_function(struct timer_list *t)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&data->lock);
|
||||
}
|
||||
|
||||
static int pattern_trig_start_pattern(struct led_classdev *led_cdev)
|
||||
|
@ -176,14 +173,10 @@ static ssize_t repeat_store(struct device *dev, struct device_attribute *attr,
|
|||
if (res < -1 || res == 0)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Clear previous patterns' performence firstly, and remove the timer
|
||||
* without mutex lock to avoid dead lock.
|
||||
*/
|
||||
del_timer_sync(&data->timer);
|
||||
|
||||
mutex_lock(&data->lock);
|
||||
|
||||
del_timer_sync(&data->timer);
|
||||
|
||||
if (data->is_hw_pattern)
|
||||
led_cdev->pattern_clear(led_cdev);
|
||||
|
||||
|
@ -234,14 +227,10 @@ static ssize_t pattern_trig_store_patterns(struct led_classdev *led_cdev,
|
|||
struct pattern_trig_data *data = led_cdev->trigger_data;
|
||||
int ccount, cr, offset = 0, err = 0;
|
||||
|
||||
/*
|
||||
* Clear previous patterns' performence firstly, and remove the timer
|
||||
* without mutex lock to avoid dead lock.
|
||||
*/
|
||||
del_timer_sync(&data->timer);
|
||||
|
||||
mutex_lock(&data->lock);
|
||||
|
||||
del_timer_sync(&data->timer);
|
||||
|
||||
if (data->is_hw_pattern)
|
||||
led_cdev->pattern_clear(led_cdev);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user