diff options
author | Dmitry Osipenko <digetx@gmail.com> | 2019-05-02 02:38:08 +0300 |
---|---|---|
committer | MyungJoo Ham <myungjoo.ham@samsung.com> | 2019-08-24 14:11:12 +0300 |
commit | 151531f79a2daa30141c9fdb23e0cff00195b17a (patch) | |
tree | 02328144f0d0e452ab747527981e171eb031ee7d /drivers/devfreq | |
parent | 8fda5c1fab4f8df22bad43ba93a5ba83594ac256 (diff) | |
download | linux-151531f79a2daa30141c9fdb23e0cff00195b17a.tar.xz |
PM / devfreq: tegra: Avoid inconsistency of current frequency value
The frequency value potentially could change in-between. It doesn't
cause any real problem at all right now, but that could change in the
future. Hence let's avoid the inconsistency.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r-- | drivers/devfreq/tegra-devfreq.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/devfreq/tegra-devfreq.c b/drivers/devfreq/tegra-devfreq.c index 7e9145bd3686..f23f7b35863b 100644 --- a/drivers/devfreq/tegra-devfreq.c +++ b/drivers/devfreq/tegra-devfreq.c @@ -497,13 +497,15 @@ static int tegra_devfreq_get_dev_status(struct device *dev, { struct tegra_devfreq *tegra = dev_get_drvdata(dev); struct tegra_devfreq_device *actmon_dev; + unsigned long cur_freq; - stat->current_frequency = tegra->cur_freq * KHZ; + cur_freq = READ_ONCE(tegra->cur_freq); /* To be used by the tegra governor */ stat->private_data = tegra; /* The below are to be used by the other governors */ + stat->current_frequency = cur_freq * KHZ; actmon_dev = &tegra->devices[MCALL]; @@ -514,7 +516,7 @@ static int tegra_devfreq_get_dev_status(struct device *dev, stat->busy_time *= 100 / BUS_SATURATION_RATIO; /* Number of cycles in a sampling period */ - stat->total_time = ACTMON_SAMPLING_PERIOD * tegra->cur_freq; + stat->total_time = ACTMON_SAMPLING_PERIOD * cur_freq; stat->busy_time = min(stat->busy_time, stat->total_time); |