]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/vc4: vec: Switch to devm_pm_runtime_enable
authorMaxime Ripard <maxime@cerno.tech>
Mon, 11 Jul 2022 17:39:31 +0000 (19:39 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 13 Jul 2022 08:46:12 +0000 (10:46 +0200)
devm_pm_runtime_enable() simplifies the driver a bit since it will call
pm_runtime_disable() automatically through a device-managed action.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-62-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_vec.c

index df6adef960502f1a8d9f8536dd4accdda23c41ba..d356ffa5286691aacda101d7e87decfaf63a1a37 100644 (file)
@@ -583,42 +583,32 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
                return ret;
        }
 
-       pm_runtime_enable(dev);
+       ret = devm_pm_runtime_enable(dev);
+       if (ret)
+               return ret;
 
        ret = drmm_encoder_init(drm, &vec->encoder.base,
                                NULL,
                                DRM_MODE_ENCODER_TVDAC,
                                NULL);
        if (ret)
-               goto err_put_runtime_pm;
+               return ret;
 
        drm_encoder_helper_add(&vec->encoder.base, &vc4_vec_encoder_helper_funcs);
 
        ret = vc4_vec_connector_init(drm, vec);
        if (ret)
-               goto err_put_runtime_pm;
+               return ret;
 
        dev_set_drvdata(dev, vec);
 
        vc4_debugfs_add_regset32(drm, "vec_regs", &vec->regset);
 
        return 0;
-
-err_put_runtime_pm:
-       pm_runtime_disable(dev);
-
-       return ret;
-}
-
-static void vc4_vec_unbind(struct device *dev, struct device *master,
-                          void *data)
-{
-       pm_runtime_disable(dev);
 }
 
 static const struct component_ops vc4_vec_ops = {
        .bind   = vc4_vec_bind,
-       .unbind = vc4_vec_unbind,
 };
 
 static int vc4_vec_dev_probe(struct platform_device *pdev)