[9610] bts: fixed calling function on debugfs
authorTaekki Kim <taekki.kim@samsung.com>
Thu, 12 Oct 2017 10:50:00 +0000 (19:50 +0900)
committerJaehyoung Choi <jkkkkk.choi@samsung.com>
Fri, 11 May 2018 05:02:35 +0000 (14:02 +0900)
In debugfs, the bts set functions should only be called
when the current scenario and setting scenario are the
same. However, the bts set functions were always called.

Change-Id: I9add896fd84092d59b7fe71e2a00de515c0846e4
Signed-off-by: Taekki Kim <taekki.kim@samsung.com>
drivers/bts/bts-exynos9610.c

index 846c943557a5b6b5cd96f8e2646e5e258d13cf50..ae61159f34d59df1e1532f8e78ba0b5949133aa2 100644 (file)
@@ -1403,7 +1403,8 @@ static ssize_t exynos_dmc_timeout_write(struct file *file, const char __user *us
 
        spin_lock(&bts_lock);
        drex->table[scen].stat.drex_timeout[qos] = timeout;
-       bts_set_drex_table(drex);
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -1482,7 +1483,8 @@ static ssize_t exynos_mo_write(struct file *file, const char __user *user_buf,
        else
                bts->table[scen].stat.wmo = mo;
 
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -1561,7 +1563,8 @@ static ssize_t exynos_max_mo_write(struct file *file, const char __user *user_bu
        else
                bts->table[scen].stat.max_wmo = mo;
 
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -1640,7 +1643,8 @@ static ssize_t exynos_full_mo_write(struct file *file, const char __user *user_b
        else
                bts->table[scen].stat.full_wmo = mo;
 
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -1713,7 +1717,8 @@ static ssize_t exynos_prio_write(struct file *file, const char __user *user_buf,
 
        spin_lock(&bts_lock);
        bts->table[scen].stat.priority = prio;
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -1922,7 +1927,8 @@ static ssize_t exynos_timeout_write(struct file *file, const char __user *user_b
        else
                bts->table[scen].stat.timeout_w = timeout;
 
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -1996,7 +2002,8 @@ static ssize_t exynos_timeout_en_write(struct file *file, const char __user *use
 
        spin_lock(&bts_lock);
        bts->table[scen].stat.timeout_en = timeout_en;
-       bts_setqos(bts->va_base, &bts->table[scen].stat);
+       if (scen == bts->top_scen)
+               bts_setqos(bts->va_base, &bts->table[scen].stat);
        spin_unlock(&bts_lock);
 
 out:
@@ -2073,7 +2080,8 @@ static ssize_t exynos_write_flush_write(struct file *file, const char __user *us
 
        spin_lock(&bts_lock);
        drex->table[scen].stat.write_flush_config[set] = config;
-       bts_set_drex_table(drex);
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -2165,7 +2173,9 @@ static ssize_t exynos_vc_timer_th_write(struct file *file, const char __user *us
                drex->table[scen].stat.vc_timer_th[set] |=
                                        (threshold & BTS_VC_TIMER_TH_MASK);
        }
-       bts_set_drex_table(drex);
+
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -2240,7 +2250,8 @@ static ssize_t exynos_cutoff_con_write(struct file *file, const char __user *use
 
        spin_lock(&bts_lock);
        drex->table[scen].stat.cutoff_con = control;
-       bts_set_drex_table(drex);
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -2315,7 +2326,8 @@ static ssize_t exynos_brb_cutoff_write(struct file *file, const char __user *use
 
        spin_lock(&bts_lock);
        drex->table[scen].stat.brb_cutoff_config = config;
-       bts_set_drex_table(drex);
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -2390,7 +2402,8 @@ static ssize_t exynos_rdbuf_cutoff_write(struct file *file, const char __user *u
 
        spin_lock(&bts_lock);
        drex->table[scen].stat.rdbuf_cutoff_config = config;
-       bts_set_drex_table(drex);
+       if (scen == drex->top_scen)
+               bts_set_drex_table(drex);
        spin_unlock(&bts_lock);
 
 out:
@@ -2465,7 +2478,8 @@ static ssize_t exynos_rreq_thrt_con_write(struct file *file, const char __user *
 
        spin_lock(&bts_lock);
        drex_pf->table[scen].stat.pf_rreq_thrt_con = control;
-       bts_set_drex_pf_table(drex_pf);
+       if (scen == drex_pf->top_scen)
+               bts_set_drex_pf_table(drex_pf);
        spin_unlock(&bts_lock);
 
 out:
@@ -2540,7 +2554,8 @@ static ssize_t exynos_allow_mo_region_write(struct file *file, const char __user
 
        spin_lock(&bts_lock);
        drex_pf->table[scen].stat.allow_mo_for_region = config;
-       bts_set_drex_pf_table(drex_pf);
+       if (scen == drex_pf->top_scen)
+               bts_set_drex_pf_table(drex_pf);
        spin_unlock(&bts_lock);
 
 out:
@@ -2632,7 +2647,9 @@ static ssize_t exynos_pf_qos_timer_write(struct file *file, const char __user *u
                drex_pf->table[scen].stat.pf_qos_timer[set] |=
                                        (timeout & BTS_PF_TIMER_MASK);
        }
-       bts_set_drex_pf_table(drex_pf);
+
+       if (scen == drex_pf->top_scen)
+               bts_set_drex_pf_table(drex_pf);
        spin_unlock(&bts_lock);
 
 out: