Skip to content

Commit 66ce7d5

Browse files
poeschelojeda
authored andcommitted
auxdisplay: Use an enum for charlcd backlight on/off ops
We use an enum for calling the functions in charlcd, that turn the backlight on or off. This enum is generic and can be used for other charlcd turn on / turn off operations as well. Reviewed-by: Willy Tarreau <[email protected]> Signed-off-by: Lars Poeschel <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 3cea11c commit 66ce7d5

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

drivers/auxdisplay/charlcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void long_sleep(int ms)
101101
}
102102

103103
/* turn the backlight on or off */
104-
static void charlcd_backlight(struct charlcd *lcd, int on)
104+
static void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on)
105105
{
106106
struct charlcd_priv *priv = charlcd_to_priv(lcd);
107107

drivers/auxdisplay/charlcd.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#ifndef _CHARLCD_H
1010
#define _CHARLCD_H
1111

12+
enum charlcd_onoff {
13+
CHARLCD_OFF = 0,
14+
CHARLCD_ON,
15+
};
16+
1217
struct charlcd {
1318
const struct charlcd_ops *ops;
1419
const unsigned char *char_conv; /* Optional */
@@ -30,7 +35,7 @@ struct charlcd_ops {
3035
/* Optional */
3136
void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */
3237
void (*clear_fast)(struct charlcd *lcd);
33-
void (*backlight)(struct charlcd *lcd, int on);
38+
void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
3439
};
3540

3641
struct charlcd *charlcd_alloc(unsigned int drvdata_size);

drivers/auxdisplay/hd44780.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct hd44780 {
3737
struct gpio_desc *pins[PIN_NUM];
3838
};
3939

40-
static void hd44780_backlight(struct charlcd *lcd, int on)
40+
static void hd44780_backlight(struct charlcd *lcd, enum charlcd_onoff on)
4141
{
4242
struct hd44780 *hd = lcd->drvdata;
4343

drivers/auxdisplay/panel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ static void lcd_send_serial(int byte)
708708
}
709709

710710
/* turn the backlight on or off */
711-
static void lcd_backlight(struct charlcd *charlcd, int on)
711+
static void lcd_backlight(struct charlcd *charlcd, enum charlcd_onoff on)
712712
{
713713
if (lcd.pins.bl == PIN_NONE)
714714
return;

0 commit comments

Comments
 (0)