devm_pm_runtime_enable() simplifies the driver a bit since it will call
pm_runtime_disable() automatically through a device-managed action.

Signed-off-by: Maxime Ripard <max...@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index b4fd581861ea..b31487547070 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -3225,7 +3225,12 @@ static int vc4_hdmi_bind(struct device *dev, struct 
device *master, void *data)
 
        pm_runtime_get_noresume(dev);
        pm_runtime_set_active(dev);
-       pm_runtime_enable(dev);
+
+       ret = devm_pm_runtime_enable(dev);
+       if (ret) {
+               vc4_hdmi_runtime_suspend(dev);
+               return ret;
+       }
 
        if (vc4_hdmi->variant->reset)
                vc4_hdmi->variant->reset(vc4_hdmi);
@@ -3270,20 +3275,12 @@ static int vc4_hdmi_bind(struct device *dev, struct 
device *master, void *data)
 
 err_put_runtime_pm:
        pm_runtime_put_sync(dev);
-       pm_runtime_disable(dev);
 
        return ret;
 }
 
-static void vc4_hdmi_unbind(struct device *dev, struct device *master,
-                           void *data)
-{
-       pm_runtime_disable(dev);
-}
-
 static const struct component_ops vc4_hdmi_ops = {
        .bind   = vc4_hdmi_bind,
-       .unbind = vc4_hdmi_unbind,
 };
 
 static int vc4_hdmi_dev_probe(struct platform_device *pdev)
-- 
2.36.1

Reply via email to