Skip to content

Commit

Permalink
auxdisplay: charlcd: replace last device specific stuff
Browse files Browse the repository at this point in the history
These are the last bits left in charlcd.c that are device specific and
they are removed now.
In detail this is:
* bwidth, which is the width of the display buffer per line. This is
  replaced by width of the display.
* hwidth, which is the size of the display buffer as a whole. This is
  replaced by looping all chars of a line by all lines.
* the hd44780_common header include can go away.

Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
poeschel authored and ojeda committed Nov 4, 2020
1 parent 377cf2c commit 6e49eea
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/auxdisplay/charlcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <generated/utsrelease.h>

#include "charlcd.h"
#include "hd44780_common.h"

/* Keep the backlight on this many seconds for each flash */
#define LCD_BL_TEMPO_PERIOD 4
Expand Down Expand Up @@ -112,16 +111,14 @@ static void charlcd_home(struct charlcd *lcd)

static void charlcd_print(struct charlcd *lcd, char c)
{
struct hd44780_common *hdc = lcd->drvdata;

if (lcd->char_conv)
c = lcd->char_conv[(unsigned char)c];

if (!lcd->ops->print(lcd, c))
lcd->addr.x++;

/* prevents the cursor from wrapping onto the next line */
if (lcd->addr.x == hdc->bwidth)
if (lcd->addr.x == lcd->width)
lcd->ops->gotoxy(lcd);
}

Expand Down Expand Up @@ -195,7 +192,6 @@ static bool parse_xy(const char *s, unsigned long *x, unsigned long *y)
static inline int handle_lcd_special_code(struct charlcd *lcd)
{
struct charlcd_priv *priv = charlcd_to_priv(lcd);
struct hd44780_common *hdc = lcd->drvdata;

/* LCD special codes */

Expand Down Expand Up @@ -323,7 +319,7 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)

xs = lcd->addr.x;
ys = lcd->addr.y;
for (x = lcd->addr.x; x < hdc->bwidth; x++)
for (x = lcd->addr.x; x < lcd->width; x++)
lcd->ops->print(lcd, ' ');

/* restore cursor position */
Expand Down Expand Up @@ -366,7 +362,6 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
static void charlcd_write_char(struct charlcd *lcd, char c)
{
struct charlcd_priv *priv = charlcd_to_priv(lcd);
struct hd44780_common *hdc = lcd->drvdata;

/* first, we'll test if we're in escape mode */
if ((c != '\n') && priv->esc_seq.len >= 0) {
Expand Down Expand Up @@ -407,7 +402,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
* flush the remainder of the current line and
* go to the beginning of the next line
*/
for (; lcd->addr.x < hdc->bwidth; lcd->addr.x++)
for (; lcd->addr.x < lcd->width; lcd->addr.x++)
lcd->ops->print(lcd, ' ');

lcd->addr.x = 0;
Expand Down

0 comments on commit 6e49eea

Please sign in to comment.