diff options
Diffstat (limited to 'arch/sparc')
| -rw-r--r-- | arch/sparc/Kconfig | 7 | ||||
| -rw-r--r-- | arch/sparc/kernel/time.c | 4 | ||||
| -rw-r--r-- | arch/sparc/lib/atomic32.c | 15 |
3 files changed, 24 insertions, 2 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index bd992c0048f0..fbcc00c6c06e 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
| @@ -178,6 +178,13 @@ config ARCH_HAS_ILOG2_U64 | |||
| 178 | bool | 178 | bool |
| 179 | default n | 179 | default n |
| 180 | 180 | ||
| 181 | config EMULATED_CMPXCHG | ||
| 182 | bool | ||
| 183 | default y | ||
| 184 | help | ||
| 185 | Sparc32 does not have a CAS instruction like sparc64. cmpxchg() | ||
| 186 | is emulated, and therefore it is not completely atomic. | ||
| 187 | |||
| 181 | config SUN_PM | 188 | config SUN_PM |
| 182 | bool | 189 | bool |
| 183 | default y | 190 | default y |
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c index f1401b57ccc7..7b4612da74a6 100644 --- a/arch/sparc/kernel/time.c +++ b/arch/sparc/kernel/time.c | |||
| @@ -148,7 +148,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ | 150 | /* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ |
| 151 | static void __init kick_start_clock(void) | 151 | static void __devinit kick_start_clock(void) |
| 152 | { | 152 | { |
| 153 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; | 153 | struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs; |
| 154 | unsigned char sec; | 154 | unsigned char sec; |
| @@ -223,7 +223,7 @@ static __inline__ int has_low_battery(void) | |||
| 223 | return (data1 == data2); /* Was the write blocked? */ | 223 | return (data1 == data2); /* Was the write blocked? */ |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static void __init mostek_set_system_time(void) | 226 | static void __devinit mostek_set_system_time(void) |
| 227 | { | 227 | { |
| 228 | unsigned int year, mon, day, hour, min, sec; | 228 | unsigned int year, mon, day, hour, min, sec; |
| 229 | struct mostek48t02 *mregs; | 229 | struct mostek48t02 *mregs; |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index 559335f4917d..617d29832e19 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | * atomic32.c: 32-bit atomic_t implementation | 2 | * atomic32.c: 32-bit atomic_t implementation |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2004 Keith M Wesolowski | 4 | * Copyright (C) 2004 Keith M Wesolowski |
| 5 | * Copyright (C) 2007 Kyle McMartin | ||
| 5 | * | 6 | * |
| 6 | * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf | 7 | * Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf |
| 7 | */ | 8 | */ |
| @@ -117,3 +118,17 @@ unsigned long ___change_bit(unsigned long *addr, unsigned long mask) | |||
| 117 | return old & mask; | 118 | return old & mask; |
| 118 | } | 119 | } |
| 119 | EXPORT_SYMBOL(___change_bit); | 120 | EXPORT_SYMBOL(___change_bit); |
| 121 | |||
| 122 | unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) | ||
| 123 | { | ||
| 124 | unsigned long flags; | ||
| 125 | u32 prev; | ||
| 126 | |||
| 127 | spin_lock_irqsave(ATOMIC_HASH(addr), flags); | ||
| 128 | if ((prev = *ptr) == old) | ||
| 129 | *ptr = new; | ||
| 130 | spin_unlock_irqrestore(ATOMIC_HASH(addr), flags); | ||
| 131 | |||
| 132 | return (unsigned long)prev; | ||
| 133 | } | ||
| 134 | EXPORT_SYMBOL(__cmpxchg_u32); | ||
