Skip to content

Commit

Permalink
Fix pattern handling optimalization
Browse files Browse the repository at this point in the history
Check for zero duration before skipping step. This fixes pattern

    echo "0 1000 10 2550 0 1000" > pattern

which should do [  .-xXx-.] but does [   Xx-.]

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Suggested-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
  • Loading branch information
pavelmachek authored and jacek-anaszewski committed Oct 25, 2018
1 parent 8dbac65 commit 1b50bb4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/leds/trigger/ledtrig-pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,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 {
Expand Down

0 comments on commit 1b50bb4

Please sign in to comment.