Skip to content

Commit a2060f2

Browse files
poeschelojeda
authored andcommitted
auxdisplay: Call charlcd_backlight in place
This moves the call to charlcd_backlight from the end of the switch into the actual case statement that originates the change of the backlight. This is more consistent to what is now found in this switch. Reviewed-by: Willy Tarreau <[email protected]> Signed-off-by: Lars Poeschel <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 339acb0 commit a2060f2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/auxdisplay/charlcd.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,16 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
259259
break;
260260
case '+': /* Back light ON */
261261
priv->flags |= LCD_FLAG_L;
262+
if (priv->flags != oldflags)
263+
charlcd_backlight(lcd, CHARLCD_ON);
264+
262265
processed = 1;
263266
break;
264267
case '-': /* Back light OFF */
265268
priv->flags &= ~LCD_FLAG_L;
269+
if (priv->flags != oldflags)
270+
charlcd_backlight(lcd, CHARLCD_OFF);
271+
266272
processed = 1;
267273
break;
268274
case '*': /* Flash back light */
@@ -363,14 +369,6 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
363369
break;
364370
}
365371

366-
/* TODO: This indent party here got ugly, clean it! */
367-
/* Check whether one flag was changed */
368-
if (oldflags == priv->flags)
369-
return processed;
370-
371-
if ((oldflags ^ priv->flags) & LCD_FLAG_L)
372-
charlcd_backlight(lcd, !!(priv->flags & LCD_FLAG_L));
373-
374372
return processed;
375373
}
376374

0 commit comments

Comments
 (0)