Skip to content

Commit 7b88e55

Browse files
geertuojeda
authored andcommitted
auxdisplay: img-ascii-lcd: Add helper variable dev
img_ascii_lcd_probe() has many users of "pdev->dev". Add a shorthand to simplify the code. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent afcb5a8 commit 7b88e55

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/auxdisplay/img-ascii-lcd.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,26 +365,25 @@ static int img_ascii_lcd_probe(struct platform_device *pdev)
365365
{
366366
const struct of_device_id *match;
367367
const struct img_ascii_lcd_config *cfg;
368+
struct device *dev = &pdev->dev;
368369
struct img_ascii_lcd_ctx *ctx;
369370
int err;
370371

371-
match = of_match_device(img_ascii_lcd_matches, &pdev->dev);
372+
match = of_match_device(img_ascii_lcd_matches, dev);
372373
if (!match)
373374
return -ENODEV;
374375

375376
cfg = match->data;
376-
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx) + cfg->num_chars,
377-
GFP_KERNEL);
377+
ctx = devm_kzalloc(dev, sizeof(*ctx) + cfg->num_chars, GFP_KERNEL);
378378
if (!ctx)
379379
return -ENOMEM;
380380

381381
if (cfg->external_regmap) {
382-
ctx->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node);
382+
ctx->regmap = syscon_node_to_regmap(dev->parent->of_node);
383383
if (IS_ERR(ctx->regmap))
384384
return PTR_ERR(ctx->regmap);
385385

386-
if (of_property_read_u32(pdev->dev.of_node, "offset",
387-
&ctx->offset))
386+
if (of_property_read_u32(dev->of_node, "offset", &ctx->offset))
388387
return -EINVAL;
389388
} else {
390389
ctx->base = devm_platform_ioremap_resource(pdev, 0);
@@ -408,7 +407,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev)
408407
if (err)
409408
goto out_del_timer;
410409

411-
err = device_create_file(&pdev->dev, &dev_attr_message);
410+
err = device_create_file(dev, &dev_attr_message);
412411
if (err)
413412
goto out_del_timer;
414413

0 commit comments

Comments
 (0)