With the introduction of static keys, anything using tracepoints blows up in the following manner: include/trace/events/oom.h:8:13: error: initializer element is not constant include/trace/events/oom.h:8:13: error: (near initialization for '__tracepoint_oom_score_adj_update') include/trace/events/oom.h:8:13: error: initializer element is not constant include/trace/events/oom.h:8:13: error: (near initialization for '__tracepoint_oom_score_adj_update.key') This is a result of the STATIC_KEY_INIT_xxx defs wrapping ATOMIC_INIT() which on sh includes an atomic_t typecast. Given that we don't really need the typecast for anything anymore, the simplest solution is simply to kill off the cast. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			1.8 KiB
			
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			1.8 KiB
			
		
	
	
	
		
			C
		
	
	
	
	
	
#ifndef __ASM_SH_ATOMIC_H
 | 
						|
#define __ASM_SH_ATOMIC_H
 | 
						|
 | 
						|
/*
 | 
						|
 * Atomic operations that C can't guarantee us.  Useful for
 | 
						|
 * resource counting etc..
 | 
						|
 *
 | 
						|
 */
 | 
						|
 | 
						|
#include <linux/compiler.h>
 | 
						|
#include <linux/types.h>
 | 
						|
#include <asm/cmpxchg.h>
 | 
						|
 | 
						|
#define ATOMIC_INIT(i)	{ (i) }
 | 
						|
 | 
						|
#define atomic_read(v)		(*(volatile int *)&(v)->counter)
 | 
						|
#define atomic_set(v,i)		((v)->counter = (i))
 | 
						|
 | 
						|
#if defined(CONFIG_GUSA_RB)
 | 
						|
#include <asm/atomic-grb.h>
 | 
						|
#elif defined(CONFIG_CPU_SH4A)
 | 
						|
#include <asm/atomic-llsc.h>
 | 
						|
#else
 | 
						|
#include <asm/atomic-irq.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
 | 
						|
#define atomic_dec_return(v)		atomic_sub_return(1, (v))
 | 
						|
#define atomic_inc_return(v)		atomic_add_return(1, (v))
 | 
						|
#define atomic_inc_and_test(v)		(atomic_inc_return(v) == 0)
 | 
						|
#define atomic_sub_and_test(i,v)	(atomic_sub_return((i), (v)) == 0)
 | 
						|
#define atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0)
 | 
						|
 | 
						|
#define atomic_inc(v)			atomic_add(1, (v))
 | 
						|
#define atomic_dec(v)			atomic_sub(1, (v))
 | 
						|
 | 
						|
#define atomic_xchg(v, new)		(xchg(&((v)->counter), new))
 | 
						|
#define atomic_cmpxchg(v, o, n)		(cmpxchg(&((v)->counter), (o), (n)))
 | 
						|
 | 
						|
/**
 | 
						|
 * __atomic_add_unless - add unless the number is a given value
 | 
						|
 * @v: pointer of type atomic_t
 | 
						|
 * @a: the amount to add to v...
 | 
						|
 * @u: ...unless v is equal to u.
 | 
						|
 *
 | 
						|
 * Atomically adds @a to @v, so long as it was not @u.
 | 
						|
 * Returns the old value of @v.
 | 
						|
 */
 | 
						|
static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 | 
						|
{
 | 
						|
	int c, old;
 | 
						|
	c = atomic_read(v);
 | 
						|
	for (;;) {
 | 
						|
		if (unlikely(c == (u)))
 | 
						|
			break;
 | 
						|
		old = atomic_cmpxchg((v), c, c + (a));
 | 
						|
		if (likely(old == c))
 | 
						|
			break;
 | 
						|
		c = old;
 | 
						|
	}
 | 
						|
 | 
						|
	return c;
 | 
						|
}
 | 
						|
 | 
						|
#define smp_mb__before_atomic_dec()	smp_mb()
 | 
						|
#define smp_mb__after_atomic_dec()	smp_mb()
 | 
						|
#define smp_mb__before_atomic_inc()	smp_mb()
 | 
						|
#define smp_mb__after_atomic_inc()	smp_mb()
 | 
						|
 | 
						|
#endif /* __ASM_SH_ATOMIC_H */
 |