Skip to content

Commit 09965a1

Browse files
committed
auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common"
Commit 2545c1c ("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>
1 parent 72e1c44 commit 09965a1

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

drivers/auxdisplay/charlcd.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,18 +595,19 @@ static int charlcd_init(struct charlcd *lcd)
595595
return 0;
596596
}
597597

598-
struct charlcd *charlcd_alloc(void)
598+
struct charlcd *charlcd_alloc(unsigned int drvdata_size)
599599
{
600600
struct charlcd_priv *priv;
601601
struct charlcd *lcd;
602602

603-
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
603+
priv = kzalloc(sizeof(*priv) + drvdata_size, GFP_KERNEL);
604604
if (!priv)
605605
return NULL;
606606

607607
priv->esc_seq.len = -1;
608608

609609
lcd = &priv->lcd;
610+
lcd->drvdata = priv->drvdata;
610611

611612
return lcd;
612613
}

drivers/auxdisplay/charlcd.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct charlcd {
5151
unsigned long y;
5252
} addr;
5353

54-
void *drvdata;
54+
void *drvdata; /* Set by charlcd_alloc() */
5555
};
5656

5757
/**
@@ -95,7 +95,8 @@ struct charlcd_ops {
9595
};
9696

9797
void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
98-
struct charlcd *charlcd_alloc(void);
98+
99+
struct charlcd *charlcd_alloc(unsigned int drvdata_size);
99100
void charlcd_free(struct charlcd *lcd);
100101

101102
int charlcd_register(struct charlcd *lcd);

drivers/auxdisplay/hd44780.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int hd44780_probe(struct platform_device *pdev)
226226
if (!hdc)
227227
return -ENOMEM;
228228

229-
lcd = charlcd_alloc();
229+
lcd = charlcd_alloc(0);
230230
if (!lcd)
231231
goto fail1;
232232

drivers/auxdisplay/lcd2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static int lcd2s_i2c_probe(struct i2c_client *i2c)
307307
if (err < 0)
308308
return err;
309309

310-
lcd = charlcd_alloc();
310+
lcd = charlcd_alloc(0);
311311
if (!lcd)
312312
return -ENOMEM;
313313

drivers/auxdisplay/panel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ static void lcd_init(void)
835835
if (!hdc)
836836
return;
837837

838-
charlcd = charlcd_alloc();
838+
charlcd = charlcd_alloc(0);
839839
if (!charlcd) {
840840
kfree(hdc);
841841
return;

0 commit comments

Comments
 (0)