mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-01 19:26:45 +07:00
c40d04df15
Disintegrate asm/system.h for Microblaze. Not compiled. Signed-off-by: David Howells <dhowells@redhat.com> cc: microblaze-uclinux@itee.uq.edu.au
27 lines
533 B
C
27 lines
533 B
C
#ifndef _ASM_MICROBLAZE_ATOMIC_H
|
|
#define _ASM_MICROBLAZE_ATOMIC_H
|
|
|
|
#include <asm/cmpxchg.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 */
|