linux-stable/drivers/auxdisplay/hd44780_common.c
Lars Poeschel b26deabb1d 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>
2020-11-04 11:04:03 +01:00

37 lines
690 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
#include <linux/module.h>
#include <linux/slab.h>
#include "charlcd.h"
#include "hd44780_common.h"
int hd44780_common_print(struct charlcd *lcd, int c)
{
struct hd44780_common *hdc = lcd->drvdata;
if (lcd->addr.x < hdc->bwidth) {
hdc->write_data(hdc, c);
return 0;
}
return 1;
}
EXPORT_SYMBOL_GPL(hd44780_common_print);
struct hd44780_common *hd44780_common_alloc(void)
{
struct hd44780_common *hd;
hd = kzalloc(sizeof(*hd), GFP_KERNEL);
if (!hd)
return NULL;
hd->ifwidth = 8;
hd->bwidth = DEFAULT_LCD_BWIDTH;
hd->hwidth = DEFAULT_LCD_HWIDTH;
return hd;
}
EXPORT_SYMBOL_GPL(hd44780_common_alloc);
MODULE_LICENSE("GPL");