]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common"
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 24 Feb 2025 17:27:38 +0000 (19:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:42:01 +0000 (14:42 +0200)
[ Upstream commit 09965a142078080fe7807bab0f6f1890cb5987a4 ]

Commit 2545c1c948a6 ("auxdisplay: Move hwidth and bwidth to struct
hd44780_common") makes charlcd_alloc() argument-less effectively dropping
the single allocation for the struct charlcd_priv object along with
the driver specific one. Restore that behaviour here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/auxdisplay/charlcd.c
drivers/auxdisplay/charlcd.h
drivers/auxdisplay/hd44780.c
drivers/auxdisplay/lcd2s.c
drivers/auxdisplay/panel.c

index 6d309e4971b617ded2c7eecc26fbe3a88ed2a015..e243291a7e77c933095340605f961c099a2103a1 100644 (file)
@@ -594,18 +594,19 @@ static int charlcd_init(struct charlcd *lcd)
        return 0;
 }
 
-struct charlcd *charlcd_alloc(void)
+struct charlcd *charlcd_alloc(unsigned int drvdata_size)
 {
        struct charlcd_priv *priv;
        struct charlcd *lcd;
 
-       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+       priv = kzalloc(sizeof(*priv) + drvdata_size, GFP_KERNEL);
        if (!priv)
                return NULL;
 
        priv->esc_seq.len = -1;
 
        lcd = &priv->lcd;
+       lcd->drvdata = priv->drvdata;
 
        return lcd;
 }
index eed80063a6d20d0bf67a4ac88daf107ccb4b462e..4bbf106b2dd8a24799865c4beb774f8bf1bfdb93 100644 (file)
@@ -49,7 +49,7 @@ struct charlcd {
                unsigned long y;
        } addr;
 
-       void *drvdata;
+       void *drvdata;                  /* Set by charlcd_alloc() */
 };
 
 /**
@@ -93,7 +93,8 @@ struct charlcd_ops {
 };
 
 void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
-struct charlcd *charlcd_alloc(void);
+
+struct charlcd *charlcd_alloc(unsigned int drvdata_size);
 void charlcd_free(struct charlcd *lcd);
 
 int charlcd_register(struct charlcd *lcd);
index 8b690f59df27d6667ea11caf7b1a483b33497715..ebaf0ff518f4c2472752b4cc549772715fff93ec 100644 (file)
@@ -226,7 +226,7 @@ static int hd44780_probe(struct platform_device *pdev)
        if (!hdc)
                return -ENOMEM;
 
-       lcd = charlcd_alloc();
+       lcd = charlcd_alloc(0);
        if (!lcd)
                goto fail1;
 
index 6422be0dfe20e65add8516ba14ac1ec5a0139675..0ecf6a9469f24c22f0a21ce414df9b01ef394cae 100644 (file)
@@ -307,7 +307,7 @@ static int lcd2s_i2c_probe(struct i2c_client *i2c)
        if (err < 0)
                return err;
 
-       lcd = charlcd_alloc();
+       lcd = charlcd_alloc(0);
        if (!lcd)
                return -ENOMEM;
 
index eba04c0de7eb3f0d323d32f482a6ac1ff1e70d49..0f3999b665e70fb6b1d74e78fafb948c666ae436 100644 (file)
@@ -835,7 +835,7 @@ static void lcd_init(void)
        if (!hdc)
                return;
 
-       charlcd = charlcd_alloc();
+       charlcd = charlcd_alloc(0);
        if (!charlcd) {
                kfree(hdc);
                return;