summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/panel.c
diff options
context:
space:
mode:
authorLars Poeschel <poeschel@lemonage.de>2020-11-03 10:58:05 +0100
committerMiguel Ojeda <ojeda@kernel.org>2020-11-04 11:04:02 +0100
commit718e05ed92ecac0d9d3954bcc8064527c3ce7565 (patch)
treee724e59f1c8e189aa82ef9585a10c412f4e13007 /drivers/auxdisplay/panel.c
parent66ce7d5c1e124b497f45aead50df1dc3c2873382 (diff)
auxdisplay: Introduce hd44780_common.[ch]
There is some hd44780 specific code in charlcd and this code is used by multiple drivers. To make charlcd independent from this device specific code this has to be moved to a place where the multiple drivers can share their common code. This common place is now introduced as hd44780_common. 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/panel.c')
-rw-r--r--drivers/auxdisplay/panel.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
index de623ae219f1..c3a60e190a7a 100644
--- a/drivers/auxdisplay/panel.c
+++ b/drivers/auxdisplay/panel.c
@@ -56,6 +56,7 @@
#include <linux/uaccess.h>
#include "charlcd.h"
+#include "hd44780_common.h"
#define LCD_MAXBYTES 256 /* max burst write */
@@ -895,10 +896,20 @@ static const struct charlcd_ops charlcd_tilcd_ops = {
static void lcd_init(void)
{
struct charlcd *charlcd;
+ struct hd44780_common *hdc;
+
+ hdc = hd44780_common_alloc();
+ if (!hdc)
+ return;
charlcd = charlcd_alloc(0);
- if (!charlcd)
+ if (!charlcd) {
+ kfree(hdc);
return;
+ }
+
+ hdc->hd44780 = &lcd;
+ charlcd->drvdata = hdc;
/*
* Init lcd struct with load-time values to preserve exact
@@ -1620,7 +1631,7 @@ err_lcd_unreg:
if (lcd.enabled)
charlcd_unregister(lcd.charlcd);
err_unreg_device:
- charlcd_free(lcd.charlcd);
+ kfree(lcd.charlcd);
lcd.charlcd = NULL;
parport_unregister_device(pprt);
pprt = NULL;
@@ -1647,7 +1658,8 @@ static void panel_detach(struct parport *port)
if (lcd.enabled) {
charlcd_unregister(lcd.charlcd);
lcd.initialized = false;
- charlcd_free(lcd.charlcd);
+ kfree(lcd.charlcd->drvdata);
+ kfree(lcd.charlcd);
lcd.charlcd = NULL;
}