summaryrefslogtreecommitdiff
path: root/arch/tile/lib
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2010-06-26 01:04:17 +0400
committerChris Metcalf <cmetcalf@tilera.com>2010-07-06 21:41:51 +0400
commit0707ad30d10110aebc01a5a64fb63f4b32d20b73 (patch)
tree64d8ba73e605ac26e56808d1d77701b3f83cf8b2 /arch/tile/lib
parentc78095bd8c77fca2619769ff8efb639fd100e373 (diff)
downloadlinux-0707ad30d10110aebc01a5a64fb63f4b32d20b73.tar.xz
arch/tile: Miscellaneous cleanup changes.
This commit is primarily changes caused by reviewing "sparse" and "checkpatch" output on our sources, so is somewhat noisy, since things like "printk() -> pr_err()" (or whatever) throughout the codebase tend to get tedious to read. Rather than trying to tease apart precisely which things changed due to which type of code review, this commit includes various cleanups in the code: - sparse: Add declarations in headers for globals. - sparse: Fix __user annotations. - sparse: Using gfp_t consistently instead of int. - sparse: removing functions not actually used. - checkpatch: Clean up printk() warnings by using pr_info(), etc.; also avoid partial-line printks except in bootup code. - checkpatch: Use exposed structs rather than typedefs. - checkpatch: Change some C99 comments to C89 comments. In addition, a couple of minor other changes are rolled in to this commit: - Add support for a "raise" instruction to cause SIGFPE, etc., to be raised. - Remove some compat code that is unnecessary when we fully eliminate some of the deprecated syscalls from the generic syscall ABI. - Update the tile_defconfig to reflect current config contents. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/tile/lib')
-rw-r--r--arch/tile/lib/atomic_32.c53
-rw-r--r--arch/tile/lib/cpumask.c1
-rw-r--r--arch/tile/lib/exports.c1
-rw-r--r--arch/tile/lib/memcpy_tile64.c6
-rw-r--r--arch/tile/lib/memmove_32.c2
-rw-r--r--arch/tile/lib/memset_32.c3
-rw-r--r--arch/tile/lib/spinlock_common.h2
-rw-r--r--arch/tile/lib/uaccess.c3
8 files changed, 29 insertions, 42 deletions
diff --git a/arch/tile/lib/atomic_32.c b/arch/tile/lib/atomic_32.c
index be1e8acd105d..8040b42a8eea 100644
--- a/arch/tile/lib/atomic_32.c
+++ b/arch/tile/lib/atomic_32.c
@@ -18,27 +18,10 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <asm/atomic.h>
+#include <asm/futex.h>
#include <arch/chip.h>
-/* The routines in atomic_asm.S are private, so we only declare them here. */
-extern struct __get_user __atomic_cmpxchg(volatile int *p,
- int *lock, int o, int n);
-extern struct __get_user __atomic_xchg(volatile int *p, int *lock, int n);
-extern struct __get_user __atomic_xchg_add(volatile int *p, int *lock, int n);
-extern struct __get_user __atomic_xchg_add_unless(volatile int *p,
- int *lock, int o, int n);
-extern struct __get_user __atomic_or(volatile int *p, int *lock, int n);
-extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n);
-extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n);
-
-extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n);
-extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n);
-extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n);
-extern u64 __atomic64_xchg_add_unless(volatile u64 *p,
- int *lock, u64 o, u64 n);
-
-
-/* See <asm/atomic.h> */
+/* See <asm/atomic_32.h> */
#if ATOMIC_LOCKS_FOUND_VIA_TABLE()
/*
@@ -209,7 +192,7 @@ u64 _atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n)
EXPORT_SYMBOL(_atomic64_cmpxchg);
-static inline int *__futex_setup(__user int *v)
+static inline int *__futex_setup(int __user *v)
{
/*
* Issue a prefetch to the counter to bring it into cache.
@@ -217,37 +200,37 @@ static inline int *__futex_setup(__user int *v)
* since it might fault; instead we do a prefetch into the L2.
*/
__insn_prefetch(v);
- return __atomic_hashed_lock(v);
+ return __atomic_hashed_lock((int __force *)v);
}
-struct __get_user futex_set(int *v, int i)
+struct __get_user futex_set(int __user *v, int i)
{
- return __atomic_xchg(v, __futex_setup(v), i);
+ return __atomic_xchg((int __force *)v, __futex_setup(v), i);
}
-struct __get_user futex_add(int *v, int n)
+struct __get_user futex_add(int __user *v, int n)
{
- return __atomic_xchg_add(v, __futex_setup(v), n);
+ return __atomic_xchg_add((int __force *)v, __futex_setup(v), n);
}
-struct __get_user futex_or(int *v, int n)
+struct __get_user futex_or(int __user *v, int n)
{
- return __atomic_or(v, __futex_setup(v), n);
+ return __atomic_or((int __force *)v, __futex_setup(v), n);
}
-struct __get_user futex_andn(int *v, int n)
+struct __get_user futex_andn(int __user *v, int n)
{
- return __atomic_andn(v, __futex_setup(v), n);
+ return __atomic_andn((int __force *)v, __futex_setup(v), n);
}
-struct __get_user futex_xor(int *v, int n)
+struct __get_user futex_xor(int __user *v, int n)
{
- return __atomic_xor(v, __futex_setup(v), n);
+ return __atomic_xor((int __force *)v, __futex_setup(v), n);
}
-struct __get_user futex_cmpxchg(int *v, int o, int n)
+struct __get_user futex_cmpxchg(int __user *v, int o, int n)
{
- return __atomic_cmpxchg(v, __futex_setup(v), o, n);
+ return __atomic_cmpxchg((int __force *)v, __futex_setup(v), o, n);
}
/*
@@ -260,7 +243,7 @@ struct __get_user futex_cmpxchg(int *v, int o, int n)
* invoked in is the context of the "_atomic_xxx()" routines called
* by the functions in this file.
*/
-struct __get_user __atomic_bad_address(int *addr)
+struct __get_user __atomic_bad_address(int __user *addr)
{
if (unlikely(!access_ok(VERIFY_WRITE, addr, sizeof(int))))
panic("Bad address used for kernel atomic op: %p\n", addr);
@@ -271,7 +254,7 @@ struct __get_user __atomic_bad_address(int *addr)
#if CHIP_HAS_CBOX_HOME_MAP()
static int __init noatomichash(char *str)
{
- printk("noatomichash is deprecated.\n");
+ pr_warning("noatomichash is deprecated.\n");
return 1;
}
__setup("noatomichash", noatomichash);
diff --git a/arch/tile/lib/cpumask.c b/arch/tile/lib/cpumask.c
index af745b3b2559..fdc403614d12 100644
--- a/arch/tile/lib/cpumask.c
+++ b/arch/tile/lib/cpumask.c
@@ -15,6 +15,7 @@
#include <linux/cpumask.h>
#include <linux/ctype.h>
#include <linux/errno.h>
+#include <linux/smp.h>
/*
* Allow cropping out bits beyond the end of the array.
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c
index af8e70e2a0ce..6bc7b52b4aa0 100644
--- a/arch/tile/lib/exports.c
+++ b/arch/tile/lib/exports.c
@@ -21,6 +21,7 @@
EXPORT_SYMBOL(__get_user_1);
EXPORT_SYMBOL(__get_user_2);
EXPORT_SYMBOL(__get_user_4);
+EXPORT_SYMBOL(__get_user_8);
EXPORT_SYMBOL(__put_user_1);
EXPORT_SYMBOL(__put_user_2);
EXPORT_SYMBOL(__put_user_4);
diff --git a/arch/tile/lib/memcpy_tile64.c b/arch/tile/lib/memcpy_tile64.c
index 4f0047342469..dfedea7b266b 100644
--- a/arch/tile/lib/memcpy_tile64.c
+++ b/arch/tile/lib/memcpy_tile64.c
@@ -60,8 +60,8 @@ typedef unsigned long (*memcpy_t)(void *, const void *, unsigned long);
static void memcpy_multicache(void *dest, const void *source,
pte_t dst_pte, pte_t src_pte, int len)
{
- int idx, i;
- unsigned long flags, newsrc, newdst, endsrc;
+ int idx;
+ unsigned long flags, newsrc, newdst;
pmd_t *pmdp;
pte_t *ptep;
int cpu = get_cpu();
@@ -121,7 +121,7 @@ static void memcpy_multicache(void *dest, const void *source,
*/
sim_allow_multiple_caching(0);
local_irq_restore(flags);
- put_cpu_no_resched();
+ put_cpu();
}
/*
diff --git a/arch/tile/lib/memmove_32.c b/arch/tile/lib/memmove_32.c
index f09d8c4523ec..fd615ae6ade7 100644
--- a/arch/tile/lib/memmove_32.c
+++ b/arch/tile/lib/memmove_32.c
@@ -42,7 +42,7 @@ void *memmove(void *dest, const void *src, size_t n)
in = (const uint8_t *)src;
out = (uint8_t *)dest;
stride = 1;
- }
+ }
/* Manually software-pipeline this loop. */
x = *in;
diff --git a/arch/tile/lib/memset_32.c b/arch/tile/lib/memset_32.c
index 8593bc82398a..bfde5d864df1 100644
--- a/arch/tile/lib/memset_32.c
+++ b/arch/tile/lib/memset_32.c
@@ -245,7 +245,8 @@ void *memset(void *s, int c, size_t n)
wh += CACHE_LINE_SIZE_IN_WORDS;
} while (--i);
- for (j = x * (CACHE_LINE_SIZE_IN_WORDS / 4); j != 0; j--) {
+ for (j = x * (CACHE_LINE_SIZE_IN_WORDS / 4);
+ j != 0; j--) {
*out32++ = v32;
*out32++ = v32;
*out32++ = v32;
diff --git a/arch/tile/lib/spinlock_common.h b/arch/tile/lib/spinlock_common.h
index 8dffebde6630..c10109809132 100644
--- a/arch/tile/lib/spinlock_common.h
+++ b/arch/tile/lib/spinlock_common.h
@@ -35,7 +35,7 @@ relax(int iterations)
}
/* Perform bounded exponential backoff.*/
-void delay_backoff(int iterations)
+static void delay_backoff(int iterations)
{
u32 exponent, loops;
diff --git a/arch/tile/lib/uaccess.c b/arch/tile/lib/uaccess.c
index 9ae182568b77..f8d398c9ee7f 100644
--- a/arch/tile/lib/uaccess.c
+++ b/arch/tile/lib/uaccess.c
@@ -18,14 +18,15 @@
int __range_ok(unsigned long addr, unsigned long size)
{
unsigned long limit = current_thread_info()->addr_limit.seg;
- __chk_user_ptr(addr);
return !((addr < limit && size <= limit - addr) ||
is_arch_mappable_range(addr, size));
}
EXPORT_SYMBOL(__range_ok);
+#ifdef CONFIG_DEBUG_COPY_FROM_USER
void copy_from_user_overflow(void)
{
WARN(1, "Buffer overflow detected!\n");
}
EXPORT_SYMBOL(copy_from_user_overflow);
+#endif