summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/hd44780_common.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/hd44780_common.c
parent11588b59cf620305e78523f57918b986b5e32214 (diff)
downloadlwn-b26deabb1d915fe87d395081bbd3058b938dee89.tar.gz
lwn-b26deabb1d915fe87d395081bbd3058b938dee89.zip
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/hd44780_common.c')
-rw-r--r--drivers/auxdisplay/hd44780_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/auxdisplay/hd44780_common.c b/drivers/auxdisplay/hd44780_common.c
index 4968461f0c4a..1dfcb2cdbc70 100644
--- a/drivers/auxdisplay/hd44780_common.c
+++ b/drivers/auxdisplay/hd44780_common.c
@@ -2,8 +2,22 @@
#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;