summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-06-23 18:55:11 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-23 18:55:11 -0700
commit8dac324845379809bea5d35ece79521094f3e6f4 (patch)
tree902107ff3d314917e02668b1ee119661fd24332f /include
parentf875aa02c8594625486193f4226747c1079a6a05 (diff)
[PATCH] abs() fixes
OK, the pending abs() disaster has hit: drivers/usb/class/audio.c:404: warning: static declaration of 'abs' follows non-static declaration This is due to the declaration in kernel.h. AFAIK there's not even a matching definition for that. The patch implements abs() as a macro in kernel.h and kills off various private implementations. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-ppc64/system.h2
-rw-r--r--include/linux/kernel.h11
2 files changed, 10 insertions, 3 deletions
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index 06ecd1bb285d..47c78eef463c 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -128,8 +128,6 @@ static inline void flush_altivec_to_thread(struct task_struct *t)
}
#endif
-extern int abs(int);
-
extern struct task_struct *__switch_to(struct task_struct *,
struct task_struct *);
#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9eb023020b44..d6ed9b926c6f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -54,6 +54,16 @@ void __might_sleep(char *file, int line);
#define might_sleep_if(cond) do {} while (0)
#endif
+#define abs(x) ({ \
+ int __x = (x); \
+ (__x < 0) ? -__x : __x; \
+ })
+
+#define labs(x) ({ \
+ long __x = (x); \
+ (__x < 0) ? -__x : __x; \
+ })
+
extern struct notifier_block *panic_notifier_list;
NORET_TYPE void panic(const char * fmt, ...)
__attribute__ ((NORET_AND format (printf, 1, 2)));
@@ -61,7 +71,6 @@ asmlinkage NORET_TYPE void do_exit(long error_code)
ATTRIB_NORET;
NORET_TYPE void complete_and_exit(struct completion *, long)
ATTRIB_NORET;
-extern int abs(int);
extern unsigned long simple_strtoul(const char *,char **,unsigned int);
extern long simple_strtol(const char *,char **,unsigned int);
extern unsigned long long simple_strtoull(const char *,char **,unsigned int);