gpu: nvgpu: Remove unnecessary use of ACCESS_ONCE()

ACCESS_ONCE() is used for making sure that in a given place of code
access a variable exactly once. It prevents compiler rearranging the
read from happening earlier.

Remove its use from cases where rearranging of the read does not
create problems.

Change-Id: I340f375e8fecc31f3a3fab543256069cb4c682dc
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1531649
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-08-02 14:53:10 -07:00
committed by mobile promotions
parent a0a3a6323a
commit 2e07e06330
2 changed files with 6 additions and 12 deletions

View File

@@ -206,7 +206,7 @@ int nvgpu_pmu_enable_elpg(struct gk20a *g)
pg_engine_id++) {
if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_MS &&
ACCESS_ONCE(pmu->mscg_stat) == PMU_MSCG_DISABLED)
pmu->mscg_stat == PMU_MSCG_DISABLED)
continue;
if (BIT(pg_engine_id) & pg_engine_id_list)
@@ -281,7 +281,7 @@ int nvgpu_pmu_disable_elpg(struct gk20a *g)
pg_engine_id++) {
if (pg_engine_id == PMU_PG_ELPG_ENGINE_ID_MS &&
ACCESS_ONCE(pmu->mscg_stat) == PMU_MSCG_DISABLED)
pmu->mscg_stat == PMU_MSCG_DISABLED)
continue;
if (BIT(pg_engine_id) & pg_engine_id_list) {

View File

@@ -352,11 +352,8 @@ int nvgpu_lpwr_enable_pg(struct gk20a *g, bool pstate_lock)
is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g,
present_pstate);
if (is_mscg_supported && g->mscg_enabled) {
if (!ACCESS_ONCE(pmu->mscg_stat)) {
WRITE_ONCE(pmu->mscg_stat, PMU_MSCG_ENABLED);
/* make status visible */
smp_mb();
}
if (!pmu->mscg_stat)
pmu->mscg_stat = PMU_MSCG_ENABLED;
}
is_rppg_supported = nvgpu_lpwr_is_rppg_supported(g,
@@ -402,11 +399,8 @@ int nvgpu_lpwr_disable_pg(struct gk20a *g, bool pstate_lock)
is_mscg_supported = nvgpu_lpwr_is_mscg_supported(g,
present_pstate);
if (is_mscg_supported && g->mscg_enabled) {
if (ACCESS_ONCE(pmu->mscg_stat)) {
WRITE_ONCE(pmu->mscg_stat, PMU_MSCG_DISABLED);
/* make status visible */
smp_mb();
}
if (pmu->mscg_stat)
pmu->mscg_stat = PMU_MSCG_DISABLED;
}
exit_unlock: