]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: hdmi: make clock_refcount atomic
authorSantosh Reddy Galma <galmar@nvidia.com>
Wed, 19 Aug 2015 14:08:45 +0000 (19:38 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 25 Aug 2015 17:25:25 +0000 (10:25 -0700)
remove clock_refcount_lock mutex variable in tegra_hdmi
structure as it is not significant and make clock_refcount
variable atomic. Handle clock_refcount properly in
tegra_hdmi_get() and tegra_hdmi_put().

Bug 200132061

Change-Id: I21eff40e0c2884ca1f7bcac692ac23b32319f6fb
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: http://git-master/r/785977
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venu Byravarasu <vbyravarasu@nvidia.com>
drivers/video/tegra/dc/hdmi2.0.c
drivers/video/tegra/dc/hdmi2.0.h

index 7b3ed5a17390198a853993ba3633d3ac7e487bea..add6e67e07f6d98d1b23a24e3dfa79e256fa97b8 100644 (file)
@@ -1046,8 +1046,7 @@ static int tegra_dc_hdmi_init(struct tegra_dc *dc)
                /* TODO: seamless boot mode needs initialize the state */
        } else {
                hdmi->enabled = false;
-               hdmi->clock_refcount = 0;
-               mutex_init(&hdmi->clock_refcount_lock);
+               atomic_set(&hdmi->clock_refcount, 0);
        }
        atomic_set(&hdmi->suspended, 0);
 
@@ -1883,30 +1882,19 @@ static void tegra_hdmi_get(struct tegra_dc *dc)
 {
        struct tegra_hdmi *hdmi = tegra_dc_get_outdata(dc);
 
-       mutex_lock(&hdmi->clock_refcount_lock);
-
-       if (hdmi->clock_refcount++)
-               goto fail;
-       _tegra_hdmi_clock_enable(hdmi);
-
-fail:
-       mutex_unlock(&hdmi->clock_refcount_lock);
+       if (atomic_inc_return(&hdmi->clock_refcount) == 1)
+               _tegra_hdmi_clock_enable(hdmi);
 }
 
 static void tegra_hdmi_put(struct tegra_dc *dc)
 {
        struct tegra_hdmi *hdmi = tegra_dc_get_outdata(dc);
 
-       if (WARN_ONCE(hdmi->clock_refcount <= 0,
+       if (WARN_ONCE(atomic_read(&hdmi->clock_refcount) <= 0,
                "hdmi: clock refcount imbalance"))
-               goto fail;
-       if (--hdmi->clock_refcount != 0)
-               goto fail;
-
-       _tegra_hdmi_clock_disable(hdmi);
-
-fail:
-       mutex_unlock(&hdmi->clock_refcount_lock);
+               return;
+       if (atomic_dec_return(&hdmi->clock_refcount) == 0)
+               _tegra_hdmi_clock_disable(hdmi);
 }
 
 /* TODO: add support for other deep colors */
index 9d25cb4f35bc77e63df0e51bd2d7203c00bddf51..eb28874c83b62b6f86d88fd6ef71045616e0f246 100644 (file)
@@ -282,8 +282,7 @@ struct tegra_hdmi {
        struct tegra_dc_sor_data *sor;
        struct hdmi_avi_infoframe avi;
        bool enabled;
-       int clock_refcount;
-       struct mutex clock_refcount_lock;
+       atomic_t clock_refcount;
 
        bool dvi;