drm/exynos/hdmi: use optional regulator_get for hdmi-en 08/93508/6
authorAndrzej Hajda <a.hajda@samsung.com>
Mon, 24 Oct 2016 09:40:48 +0000 (11:40 +0200)
committerInki Dae <inki.dae@samsung.com>
Wed, 16 Nov 2016 23:07:20 +0000 (15:07 -0800)
hdmi-en is an optional regulator so it should be better handled by
devm_regulator_get_optional call.

Change-Id: I2cbb12c54c43b10ebac76a00a5ef954c2ae627f6
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_hdmi.c

index 96cd9e5e3c0d4d026397e1ce00eadf00be77419e..91b7a305e75b3ea30fa4778e07a31564a0f82eb8 100644 (file)
@@ -2150,19 +2150,15 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
                return ret;
        }
 
-       hdata->reg_hdmi_en = devm_regulator_get(dev, "hdmi-en");
-       if (IS_ERR(hdata->reg_hdmi_en) && PTR_ERR(hdata->reg_hdmi_en) != -ENOENT) {
-               DRM_ERROR("failed to get hdmi-en regulator\n");
-               return PTR_ERR(hdata->reg_hdmi_en);
-       }
-       if (!IS_ERR(hdata->reg_hdmi_en)) {
+       hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en");
+       if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) {
+               if (IS_ERR(hdata->reg_hdmi_en))
+                       return PTR_ERR(hdata->reg_hdmi_en);
+
                ret = regulator_enable(hdata->reg_hdmi_en);
-               if (ret) {
+               if (ret)
                        DRM_ERROR("failed to enable hdmi-en regulator\n");
-                       return ret;
-               }
-       } else
-               hdata->reg_hdmi_en = NULL;
+       }
 
        return hdmi_bridge_init(hdata);
 }
@@ -2417,7 +2413,7 @@ static int hdmi_remove(struct platform_device *pdev)
 
        pm_runtime_disable(&pdev->dev);
 
-       if (hdata->reg_hdmi_en)
+       if (!IS_ERR(hdata->reg_hdmi_en))
                regulator_disable(hdata->reg_hdmi_en);
 
        if (hdata->hdmiphy_port)