mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 15:43:59 +08:00
eacb6ec9ae
This tiny patch adds generic atomic64 support for the Microblaze architecture. The patch is against the latest linux-2.6-microblaze tree. It also fixes the kernel build for microblaze: Error log: CC kernel/trace/trace_clock.o kernel/trace/trace_clock.c:117: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'trace_counter' kernel/trace/trace_clock.c: In function 'trace_clock_counter': kernel/trace/trace_clock.c:126: error: implicit declaration of function 'atomic64_add_return' kernel/trace/trace_clock.c:126: error: 'trace_counter' undeclared (first use in this function) kernel/trace/trace_clock.c:126: error: (Each undeclared identifier is reported only once kernel/trace/trace_clock.c:126: error: for each function it appears in.) make[2]: *** [kernel/trace/trace_clock.o] Error 1 make[1]: *** [kernel/trace] Error 2 make: *** [kernel] Error 2 Signed-off-by: Ariane Keller <ariane.keller@tik.ee.ethz.ch> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch> Signed-off-by: Michal Simek <monstr@monstr.eu>
26 lines
508 B
C
26 lines
508 B
C
#ifndef _ASM_MICROBLAZE_ATOMIC_H
|
|
#define _ASM_MICROBLAZE_ATOMIC_H
|
|
|
|
#include <asm-generic/atomic.h>
|
|
#include <asm-generic/atomic64.h>
|
|
|
|
/*
|
|
* Atomically test *v and decrement if it is greater than 0.
|
|
* The function returns the old value of *v minus 1.
|
|
*/
|
|
static inline int atomic_dec_if_positive(atomic_t *v)
|
|
{
|
|
unsigned long flags;
|
|
int res;
|
|
|
|
local_irq_save(flags);
|
|
res = v->counter - 1;
|
|
if (res >= 0)
|
|
v->counter = res;
|
|
local_irq_restore(flags);
|
|
|
|
return res;
|
|
}
|
|
|
|
#endif /* _ASM_MICROBLAZE_ATOMIC_H */
|