Patchwork MIPS: Initialize an atomic_t properly with ATOMIC_INIT(0).

login
register
mail settings
Submitter Robert P. J. Day
Date 2010-02-27 05:02:51
Message ID <alpine.LFD.2.00.1002271201230.20373@localhost>
Download mbox | patch
Permalink /patch/1008/
State Accepted
Delegated to: Ralf Baechle
Headers show

Comments

Robert P. J. Day - 2010-02-27 05:02:51
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

  AFAIK, the technically correct way to initialize atomic variables is
with ATOMIC_INIT(n).



========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================
Ralf Baechle - 2010-03-11 10:03:48
On Sat, Feb 27, 2010 at 12:02:51PM -0500, Robert P. J. Day wrote:

>   AFAIK, the technically correct way to initialize atomic variables is
> with ATOMIC_INIT(n).

Indeed, applied.

Thanks!

  Ralf

Patch

diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 23499b5..0a5ad2d 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -181,7 +181,7 @@  static int vpemask[2][8] = {
 	{0, 0, 0, 0, 0, 0, 0, 1}
 };
 int tcnoprog[NR_CPUS];
-static atomic_t idle_hook_initialized = {0};
+static atomic_t idle_hook_initialized = ATOMIC_INIT(0);
 static int clock_hang_reported[NR_CPUS];

 #endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */