Skip to content

Commit

Permalink
atomic: use <linux/atomic.h>
Browse files Browse the repository at this point in the history
This allows us to move duplicated code in <asm/atomic.h>
(atomic_inc_not_zero() for now) to <linux/atomic.h>

Signed-off-by: Arun Sharma <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: David Miller <[email protected]>
Cc: Eric Dumazet <[email protected]>
Acked-by: Mike Frysinger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Arun Sharma authored and torvalds committed Jul 26, 2011
1 parent 148817b commit 6006349
Show file tree
Hide file tree
Showing 439 changed files with 427 additions and 448 deletions.
1 change: 0 additions & 1 deletion arch/alpha/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
return c != (u);
}

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

/**
* atomic64_add_unless - add unless the number is a given value
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/include/asm/local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _ALPHA_LOCAL_H

#include <linux/percpu.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

typedef struct
{
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/init.h>

#include <asm/hwrpb.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/irq.h>
#include <asm/irq_regs.h>
#include <asm/pal.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include <asm/hwrpb.h>
#include <asm/ptrace.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

#include <asm/io.h>
#include <asm/irq.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/lib/dec_and_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <linux/spinlock.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

asm (".text \n\
.global _atomic_dec_and_lock \n\
Expand Down
1 change: 0 additions & 1 deletion arch/arm/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
c = old;
return c != u;
}
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

#define atomic_inc(v) atomic_add(1, v)
#define atomic_dec(v) atomic_sub(1, v)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <linux/clockchips.h>
#include <linux/completion.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>
#include <asm/cpu.h>
#include <asm/cputype.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <linux/init.h>
#include <linux/sched.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>
#include <asm/system.h>
#include <asm/unistd.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-at91/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <linux/io.h>

#include <asm/irq.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/mach/time.h>
#include <asm/mach/irq.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-bcmring/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <linux/mm.h>
#include <linux/pfn.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <mach/dma.h>

/* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-cns3xxx/include/mach/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __CNS3XXX_PM_H
#define __CNS3XXX_PM_H

#include <asm/atomic.h>
#include <linux/atomic.h>

void cns3xxx_pwr_clk_en(unsigned int block);
void cns3xxx_pwr_clk_dis(unsigned int block);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-cns3xxx/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <mach/system.h>
#include <mach/cns3xxx.h>
#include <mach/pm.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap1/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <linux/io.h>

#include <asm/irq.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/mach/time.h>
#include <asm/mach/irq.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2440/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <linux/io.h>

#include <mach/hardware.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/irq.h>

#include <mach/regs-clock.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2440/s3c2442.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <linux/io.h>

#include <mach/hardware.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/irq.h>

#include <mach/regs-clock.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2440/s3c244x-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <linux/io.h>

#include <mach/hardware.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/irq.h>

#include <mach/regs-clock.h>
Expand Down
1 change: 0 additions & 1 deletion arch/avr32/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0)

#define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0)
#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)

#define smp_mb__before_atomic_dec() barrier()
Expand Down
1 change: 0 additions & 1 deletion arch/blackfin/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ static inline void atomic_set_mask(int mask, atomic_t *v)
c = old; \
c != (u); \
})
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

/*
* atomic_inc_and_test - increment and test
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/include/asm/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <linux/interrupt.h>
#include <mach/dma.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/blackfin.h>
#include <asm/page.h>
#include <asm-generic/dma.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/include/asm/ipipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <asm/ptrace.h>
#include <asm/irq.h>
#include <asm/bitops.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/traps.h>
#include <asm/bitsperlong.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# include <asm-generic/spinlock.h>
#else

#include <asm/atomic.h>
#include <linux/atomic.h>

asmlinkage int __raw_spin_is_locked_asm(volatile int *ptr);
asmlinkage void __raw_spin_lock_asm(volatile int *ptr);
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>

#ifdef CONFIG_DYNAMIC_FTRACE
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/kernel/ipipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <linux/unistd.h>
#include <linux/io.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/irq_handler.h>

DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/kernel/nmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/smp.h>
#include <linux/timer.h>
#include <asm/blackfin.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>
#include <asm/bfin_watchdog.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-common/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/seq_file.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cacheflush.h>
#include <asm/irq_handler.h>
#include <asm/mmu_context.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/drivers/cryptocop.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

#include <linux/list.h>
#include <linux/interrupt.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <asm/mmu_context.h>
#include <hwregs/asm/mmu_defs_asm.h>
#include <hwregs/supp_reg.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

#include <linux/err.h>
#include <linux/init.h>
Expand Down
1 change: 0 additions & 1 deletion arch/cris/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
cris_atomic_restore(v, flags);
return ret != u;
}
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

/* Atomic operations are already serializing */
#define smp_mb__before_atomic_dec() barrier()
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/include/asm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <arch/bitops.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <linux/compiler.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This file handles the architecture-dependent parts of process handling..
*/

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
Expand Down
1 change: 0 additions & 1 deletion arch/frv/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
return c != (u);
}

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

#include <asm-generic/atomic-long.h>
#endif /* _ASM_ATOMIC_H */
2 changes: 1 addition & 1 deletion arch/frv/include/asm/hardirq.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef __ASM_HARDIRQ_H
#define __ASM_HARDIRQ_H

#include <asm/atomic.h>
#include <linux/atomic.h>

extern atomic_t irq_err_count;
static inline void ack_bad_irq(int irq)
Expand Down
2 changes: 1 addition & 1 deletion arch/frv/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <linux/module.h>
#include <linux/bitops.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/system.h>
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
local_irq_restore(flags);
return ret != u;
}
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *v)
{
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
return c != (u);
}

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

static __inline__ long atomic64_add_unless(atomic64_t *v, long a, long u)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#include <asm/percpu.h>
#include <asm/rse.h>
#include <asm/unwind.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#ifdef CONFIG_NUMA
#include <asm/nodedata.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/kernel.h>
#include <linux/bitops.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/intrinsics.h>
#include <asm/system.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <linux/bitops.h>
#include <linux/kexec.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/current.h>
#include <asm/delay.h>
#include <asm/machvec.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <linux/percpu.h>
#include <linux/bitops.h>

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/cache.h>
#include <asm/current.h>
#include <asm/delay.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/kernel/uncached.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <asm/pal.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/tlbflush.h>
#include <asm/sn/arch.h>

Expand Down
1 change: 0 additions & 1 deletion arch/m32r/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
return c != (u);
}

#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/m32r/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#ifndef __ASSEMBLY__

#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/pgalloc.h>
#include <asm/mmu.h>
#include <asm/tlbflush.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/m32r/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

#include <linux/compiler.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/page.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion arch/m32r/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include <asm/cacheflush.h>
#include <asm/pgalloc.h>
#include <asm/atomic.h>
#include <linux/atomic.h>
#include <asm/io.h>
#include <asm/mmu_context.h>
#include <asm/m32r.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/m32r/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/atomic.h>
#include <linux/atomic.h>

#include <asm/smp.h>

Expand Down
Loading

0 comments on commit 6006349

Please sign in to comment.