summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/charlcd.c
diff options
context:
space:
mode:
authorLars Poeschel <poeschel@lemonage.de>2020-11-03 10:58:11 +0100
committerMiguel Ojeda <ojeda@kernel.org>2020-11-04 11:04:03 +0100
commitb26deabb1d915fe87d395081bbd3058b938dee89 (patch)
treeea623cab5ff65fe59f1e514c85ea41692e0bb5e6 /drivers/auxdisplay/charlcd.c
parent11588b59cf620305e78523f57918b986b5e32214 (diff)
auxdisplay: hd44780_common_print
We create a hd44780_common_print function. It is derived from the original charlcd_print. charlcd_print becomes a device independent print function, that then only calls via its ops function pointers, into the print function offered by drivers. Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'drivers/auxdisplay/charlcd.c')
-rw-r--r--drivers/auxdisplay/charlcd.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 1b37d4bc38f9..72ed004a8980 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -167,18 +167,15 @@ 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->addr.x < hdc->bwidth) {
- if (lcd->char_conv)
- c = lcd->char_conv[(unsigned char)c];
- hdc->write_data(hdc, 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)
- charlcd_gotoxy(lcd);
- }
+ /* prevents the cursor from wrapping onto the next line */
+ if (lcd->addr.x == lcd->width)
+ charlcd_gotoxy(lcd);
}
static void charlcd_clear_fast(struct charlcd *lcd)
@@ -192,7 +189,7 @@ static void charlcd_clear_fast(struct charlcd *lcd)
lcd->ops->clear_fast(lcd);
else
for (pos = 0; pos < min(2, lcd->height) * hdc->hwidth; pos++)
- hdc->write_data(hdc, ' ');
+ lcd->ops->print(lcd, ' ');
charlcd_home(lcd);
}
@@ -433,12 +430,16 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
processed = 1;
break;
case 'k': { /* kill end of line */
- int x;
+ int x, xs, ys;
+ xs = lcd->addr.x;
+ ys = lcd->addr.y;
for (x = lcd->addr.x; x < hdc->bwidth; x++)
- hdc->write_data(hdc, ' ');
+ lcd->ops->print(lcd, ' ');
/* restore cursor position */
+ lcd->addr.x = xs;
+ lcd->addr.y = ys;
charlcd_gotoxy(lcd);
processed = 1;
break;
@@ -591,7 +592,8 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
* go to the beginning of the next line
*/
for (; lcd->addr.x < hdc->bwidth; lcd->addr.x++)
- hdc->write_data(hdc, ' ');
+ lcd->ops->print(lcd, ' ');
+
lcd->addr.x = 0;
lcd->addr.y = (lcd->addr.y + 1) % lcd->height;
charlcd_gotoxy(lcd);