Skip to content

Commit f60ef67

Browse files
lategoodbyemairacanal
authored andcommitted
drm/vc4: v3d: simplify clock retrieval
Common pattern of handling deferred probe can be simplified with dev_err_probe() and devm_clk_get_optional(). This results in much less code. Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Maíra Canal <[email protected]> Signed-off-by: Maíra Canal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 59ac702 commit f60ef67

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/gpu/drm/vc4/vc4_v3d.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -441,21 +441,9 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
441441
vc4->v3d = v3d;
442442
v3d->vc4 = vc4;
443443

444-
v3d->clk = devm_clk_get(dev, NULL);
445-
if (IS_ERR(v3d->clk)) {
446-
int ret = PTR_ERR(v3d->clk);
447-
448-
if (ret == -ENOENT) {
449-
/* bcm2835 didn't have a clock reference in the DT. */
450-
ret = 0;
451-
v3d->clk = NULL;
452-
} else {
453-
if (ret != -EPROBE_DEFER)
454-
dev_err(dev, "Failed to get V3D clock: %d\n",
455-
ret);
456-
return ret;
457-
}
458-
}
444+
v3d->clk = devm_clk_get_optional(dev, NULL);
445+
if (IS_ERR(v3d->clk))
446+
return dev_err_probe(dev, PTR_ERR(v3d->clk), "Failed to get V3D clock\n");
459447

460448
ret = platform_get_irq(pdev, 0);
461449
if (ret < 0)

0 commit comments

Comments
 (0)