Commit 7b88e553 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Miguel Ojeda

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent afcb5a81
...@@ -365,26 +365,25 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) ...@@ -365,26 +365,25 @@ static int img_ascii_lcd_probe(struct platform_device *pdev)
{ {
const struct of_device_id *match; const struct of_device_id *match;
const struct img_ascii_lcd_config *cfg; const struct img_ascii_lcd_config *cfg;
struct device *dev = &pdev->dev;
struct img_ascii_lcd_ctx *ctx; struct img_ascii_lcd_ctx *ctx;
int err; int err;
match = of_match_device(img_ascii_lcd_matches, &pdev->dev); match = of_match_device(img_ascii_lcd_matches, dev);
if (!match) if (!match)
return -ENODEV; return -ENODEV;
cfg = match->data; cfg = match->data;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx) + cfg->num_chars, ctx = devm_kzalloc(dev, sizeof(*ctx) + cfg->num_chars, GFP_KERNEL);
GFP_KERNEL);
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
if (cfg->external_regmap) { if (cfg->external_regmap) {
ctx->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node); ctx->regmap = syscon_node_to_regmap(dev->parent->of_node);
if (IS_ERR(ctx->regmap)) if (IS_ERR(ctx->regmap))
return PTR_ERR(ctx->regmap); return PTR_ERR(ctx->regmap);
if (of_property_read_u32(pdev->dev.of_node, "offset", if (of_property_read_u32(dev->of_node, "offset", &ctx->offset))
&ctx->offset))
return -EINVAL; return -EINVAL;
} else { } else {
ctx->base = devm_platform_ioremap_resource(pdev, 0); ctx->base = devm_platform_ioremap_resource(pdev, 0);
...@@ -408,7 +407,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) ...@@ -408,7 +407,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev)
if (err) if (err)
goto out_del_timer; goto out_del_timer;
err = device_create_file(&pdev->dev, &dev_attr_message); err = device_create_file(dev, &dev_attr_message);
if (err) if (err)
goto out_del_timer; goto out_del_timer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment