diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-06-23 18:55:11 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-23 18:55:11 -0700 |
| commit | 8dac324845379809bea5d35ece79521094f3e6f4 (patch) | |
| tree | 902107ff3d314917e02668b1ee119661fd24332f /include/linux | |
| parent | f875aa02c8594625486193f4226747c1079a6a05 (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/linux')
| -rw-r--r-- | include/linux/kernel.h | 11 |
1 files changed, 10 insertions, 1 deletions
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); |
