Commit 66ce7d5c authored by Lars Poeschel's avatar Lars Poeschel Committed by Miguel Ojeda

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: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarLars Poeschel <poeschel@lemonage.de>
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent 3cea11cd
......@@ -101,7 +101,7 @@ static void long_sleep(int ms)
}
/* turn the backlight on or off */
static void charlcd_backlight(struct charlcd *lcd, int on)
static void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on)
{
struct charlcd_priv *priv = charlcd_to_priv(lcd);
......
......@@ -9,6 +9,11 @@
#ifndef _CHARLCD_H
#define _CHARLCD_H
enum charlcd_onoff {
CHARLCD_OFF = 0,
CHARLCD_ON,
};
struct charlcd {
const struct charlcd_ops *ops;
const unsigned char *char_conv; /* Optional */
......@@ -30,7 +35,7 @@ struct charlcd_ops {
/* Optional */
void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */
void (*clear_fast)(struct charlcd *lcd);
void (*backlight)(struct charlcd *lcd, int on);
void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
};
struct charlcd *charlcd_alloc(unsigned int drvdata_size);
......
......@@ -37,7 +37,7 @@ struct hd44780 {
struct gpio_desc *pins[PIN_NUM];
};
static void hd44780_backlight(struct charlcd *lcd, int on)
static void hd44780_backlight(struct charlcd *lcd, enum charlcd_onoff on)
{
struct hd44780 *hd = lcd->drvdata;
......
......@@ -708,7 +708,7 @@ static void lcd_send_serial(int byte)
}
/* turn the backlight on or off */
static void lcd_backlight(struct charlcd *charlcd, int on)
static void lcd_backlight(struct charlcd *charlcd, enum charlcd_onoff on)
{
if (lcd.pins.bl == PIN_NONE)
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment