summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2020-02-25 01:40:50 +0300
committerThierry Reding <treding@nvidia.com>2020-03-13 13:23:09 +0300
commitf0c69bdfb0728a7cd0e065c7db434465bd50904c (patch)
tree8cd524fd7a65c8a31f371f5ccb5ac0eea93504ac
parent51da5f1cd83444024db3f1d96eccf269e25a46bc (diff)
downloadlinux-f0c69bdfb0728a7cd0e065c7db434465bd50904c.tar.xz
ARM: tegra: cpuidle: Make abort_flag atomic
Replace memory accessors with atomic API just to make code consistent with the abort_barrier. The new variant may be even more correct now since atomic_read() will prevent compiler from generating wrong things like carrying abort_flag value in a register instead of re-fetching it from memory. Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com> Tested-by: Peter Geis <pgwipeout@gmail.com> Tested-by: Jasper Korten <jja2000@gmail.com> Tested-by: David Heidelberg <david@ixit.cz> Tested-by: Nicolas Chauvet <kwizart@gmail.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index d6b9b4cf2635..97cae472b097 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -32,7 +32,7 @@
#include "sleep.h"
#ifdef CONFIG_PM_SLEEP
-static bool abort_flag;
+static atomic_t abort_flag;
static atomic_t abort_barrier;
static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
@@ -171,13 +171,14 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
bool entered_lp2 = false;
if (tegra_pending_sgi())
- WRITE_ONCE(abort_flag, true);
+ atomic_set(&abort_flag, 1);
cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
- if (abort_flag) {
+ if (atomic_read(&abort_flag)) {
cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
- abort_flag = false; /* clean flag for next coming */
+ /* clean flag for next coming */
+ atomic_set(&abort_flag, 0);
return -EINTR;
}