Skip to content

Commit

Permalink
x86: atomic64: Export APIs to modules
Browse files Browse the repository at this point in the history
atomic64_t primitives are used by a handful of drivers,
so export the APIs consistently. These were inlined
before.

Also mark atomic64_32.o a core object, so that the symbols
are available even if not linked to core kernel pieces.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
LKML-Reference: <tip-05118ab8859492ac9ddda0154cf90e37b0a4a0b0@git.kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jul 3, 2009
1 parent 67d7178 commit 1fde902
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o
lib-y += memcpy_$(BITS).o

ifeq ($(CONFIG_X86_32),y)
lib-y += atomic64_32.o
obj-y += atomic64_32.o
lib-y += checksum_32.o
lib-y += strstr_32.o
lib-y += semaphore_32.o string_32.o
Expand Down
18 changes: 18 additions & 0 deletions arch/x86/lib/atomic64_32.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <linux/compiler.h>
#include <linux/module.h>
#include <linux/types.h>

#include <asm/processor.h>
#include <asm/cmpxchg.h>
#include <asm/atomic.h>
Expand All @@ -21,6 +23,7 @@ u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val)
{
return cmpxchg8b(&ptr->counter, old_val, new_val);
}
EXPORT_SYMBOL(atomic64_cmpxchg);

/**
* atomic64_xchg - xchg atomic64 variable
Expand All @@ -41,6 +44,7 @@ u64 atomic64_xchg(atomic64_t *ptr, u64 new_val)

return old_val;
}
EXPORT_SYMBOL(atomic64_xchg);

/**
* atomic64_set - set atomic64 variable
Expand All @@ -53,6 +57,7 @@ void atomic64_set(atomic64_t *ptr, u64 new_val)
{
atomic64_xchg(ptr, new_val);
}
EXPORT_SYMBOL(atomic64_read);

/**
* atomic64_read - read atomic64 variable
Expand All @@ -74,6 +79,7 @@ u64 atomic64_read(atomic64_t *ptr)

return res;
}
EXPORT_SYMBOL(atomic64_read);

/**
* atomic64_add_return - add and return
Expand Down Expand Up @@ -103,21 +109,25 @@ noinline u64 atomic64_add_return(u64 delta, atomic64_t *ptr)

return new_val;
}
EXPORT_SYMBOL(atomic64_add_return);

u64 atomic64_sub_return(u64 delta, atomic64_t *ptr)
{
return atomic64_add_return(-delta, ptr);
}
EXPORT_SYMBOL(atomic64_sub_return);

u64 atomic64_inc_return(atomic64_t *ptr)
{
return atomic64_add_return(1, ptr);
}
EXPORT_SYMBOL(atomic64_inc_return);

u64 atomic64_dec_return(atomic64_t *ptr)
{
return atomic64_sub_return(1, ptr);
}
EXPORT_SYMBOL(atomic64_dec_return);

/**
* atomic64_add - add integer to atomic64 variable
Expand All @@ -130,6 +140,7 @@ void atomic64_add(u64 delta, atomic64_t *ptr)
{
atomic64_add_return(delta, ptr);
}
EXPORT_SYMBOL(atomic64_add);

/**
* atomic64_sub - subtract the atomic64 variable
Expand All @@ -142,6 +153,7 @@ void atomic64_sub(u64 delta, atomic64_t *ptr)
{
atomic64_add(-delta, ptr);
}
EXPORT_SYMBOL(atomic64_sub);

/**
* atomic64_sub_and_test - subtract value from variable and test result
Expand All @@ -158,6 +170,7 @@ int atomic64_sub_and_test(u64 delta, atomic64_t *ptr)

return old_val == 0;
}
EXPORT_SYMBOL(atomic64_sub_and_test);

/**
* atomic64_inc - increment atomic64 variable
Expand All @@ -169,6 +182,7 @@ void atomic64_inc(atomic64_t *ptr)
{
atomic64_add(1, ptr);
}
EXPORT_SYMBOL(atomic64_inc);

/**
* atomic64_dec - decrement atomic64 variable
Expand All @@ -180,6 +194,7 @@ void atomic64_dec(atomic64_t *ptr)
{
atomic64_sub(1, ptr);
}
EXPORT_SYMBOL(atomic64_dec);

/**
* atomic64_dec_and_test - decrement and test
Expand All @@ -193,6 +208,7 @@ int atomic64_dec_and_test(atomic64_t *ptr)
{
return atomic64_sub_and_test(1, ptr);
}
EXPORT_SYMBOL(atomic64_dec_and_test);

/**
* atomic64_inc_and_test - increment and test
Expand All @@ -206,6 +222,7 @@ int atomic64_inc_and_test(atomic64_t *ptr)
{
return atomic64_sub_and_test(-1, ptr);
}
EXPORT_SYMBOL(atomic64_inc_and_test);

/**
* atomic64_add_negative - add and test if negative
Expand All @@ -222,3 +239,4 @@ int atomic64_add_negative(u64 delta, atomic64_t *ptr)

return old_val < 0;
}
EXPORT_SYMBOL(atomic64_add_negative);

0 comments on commit 1fde902

Please sign in to comment.