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>
---

 25-akpm/arch/ppc64/kernel/ppc_ksyms.c |    4 ----
 25-akpm/drivers/usb/class/audio.c     |   14 --------------
 25-akpm/include/asm-ppc64/system.h    |    2 --
 25-akpm/include/linux/kernel.h        |    6 +++++-
 4 files changed, 5 insertions(+), 21 deletions(-)

diff -puN include/linux/kernel.h~abs-fix include/linux/kernel.h
--- 25/include/linux/kernel.h~abs-fix	2004-06-23 21:44:29.699550816 -0700
+++ 25-akpm/include/linux/kernel.h	2004-06-23 21:44:29.708549448 -0700
@@ -54,6 +54,11 @@ void __might_sleep(char *file, int line)
 #define might_sleep_if(cond) do {} while (0)
 #endif
 
+#define abs(x) ({				\
+		typeof(x) __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 +66,6 @@ asmlinkage NORET_TYPE void do_exit(long 
 	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);
diff -puN drivers/usb/class/audio.c~abs-fix drivers/usb/class/audio.c
--- 25/drivers/usb/class/audio.c~abs-fix	2004-06-23 21:44:29.701550512 -0700
+++ 25-akpm/drivers/usb/class/audio.c	2004-06-23 21:44:29.711548992 -0700
@@ -212,9 +212,6 @@
 
 #define dprintk(x)
 
-#undef abs
-extern int abs(int __x) __attribute_const__; /* Shut up warning */
-
 /* --------------------------------------------------------------------- */
 
 /*
@@ -398,17 +395,6 @@ struct usb_audio_state {
 
 /* --------------------------------------------------------------------- */
 
-/* prevent picking up a bogus abs macro */
-#undef abs
-static inline int abs(int x)
-{
-        if (x < 0)
-		return -x;
-	return x;
-}
-                                
-/* --------------------------------------------------------------------- */
-
 static inline unsigned ld2(unsigned int x)
 {
 	unsigned r = 0;
diff -puN include/asm-ppc64/system.h~abs-fix include/asm-ppc64/system.h
--- 25/include/asm-ppc64/system.h~abs-fix	2004-06-23 21:44:29.703550208 -0700
+++ 25-akpm/include/asm-ppc64/system.h	2004-06-23 21:44:29.712548840 -0700
@@ -128,8 +128,6 @@ static inline void flush_altivec_to_thre
 }
 #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 -puN arch/ppc64/kernel/ppc_ksyms.c~abs-fix arch/ppc64/kernel/ppc_ksyms.c
--- 25/arch/ppc64/kernel/ppc_ksyms.c~abs-fix	2004-06-23 21:44:29.705549904 -0700
+++ 25-akpm/arch/ppc64/kernel/ppc_ksyms.c	2004-06-23 21:44:29.712548840 -0700
@@ -47,8 +47,6 @@
 
 extern int do_signal(sigset_t *, struct pt_regs *);
 
-int abs(int);
-
 EXPORT_SYMBOL(do_signal);
 
 EXPORT_SYMBOL(isa_io_base);
@@ -157,8 +155,6 @@ EXPORT_SYMBOL_NOVERS(memscan);
 EXPORT_SYMBOL_NOVERS(memcmp);
 EXPORT_SYMBOL_NOVERS(memchr);
 
-EXPORT_SYMBOL(abs);
-
 EXPORT_SYMBOL(timer_interrupt);
 EXPORT_SYMBOL(irq_desc);
 EXPORT_SYMBOL(get_wchan);
_