From be63a940115222f9bc4ba62ec9a33a366a78a321 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 13 Feb 2004 15:29:48 -0800 Subject: [PATCH] [PATCH] Fix ppc64 build problem From: Paul Mackerras Recent changes in include/linux/*.h meant that likely() isn't defined here (since we don't set __KERNEL__), and thus we don't get some prototypes and we can't use do_div. This fixes the resulting compile errors and warnings. Remove %L handling from sprintf - we don't need it, and it meant we needed do_div from asm/div64.h, which gives problems when __KERNEL__ isn't defined. Also add a prototype for strlen to kill a warning. --- arch/ppc64/boot/prom.c | 20 ++++++++++---------- arch/ppc64/boot/zlib.c | 3 +-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/ppc64/boot/prom.c b/arch/ppc64/boot/prom.c index 55ffaef76aaeb..7b607d1862cb0 100644 --- a/arch/ppc64/boot/prom.c +++ b/arch/ppc64/boot/prom.c @@ -11,9 +11,6 @@ #include #include -#define BITS_PER_LONG 32 -#include - int (*prom)(void *); void *chosen_handle; @@ -28,6 +25,9 @@ void chrpboot(int a1, int a2, void *prom); /* in main.c */ void printk(char *fmt, ...); +/* there is no convenient header to get this from... -- paulus */ +extern unsigned long strlen(const char *); + int write(void *handle, void *ptr, int nb) { @@ -352,7 +352,7 @@ static int skip_atoi(const char **s) #define SPECIAL 32 /* 0x */ #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ -static char * number(char * str, long long num, int base, int size, int precision, int type) +static char * number(char * str, long num, int base, int size, int precision, int type) { char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; @@ -388,8 +388,10 @@ static char * number(char * str, long long num, int base, int size, int precisio i = 0; if (num == 0) tmp[i++]='0'; - else while (num != 0) - tmp[i++] = digits[do_div(num,base)]; + else while (num != 0) { + tmp[i++] = digits[num % base]; + num /= base; + } if (i > precision) precision = i; size -= precision; @@ -424,7 +426,7 @@ int sprintf(char * buf, const char *fmt, ...); int vsprintf(char *buf, const char *fmt, va_list args) { int len; - unsigned long long num; + unsigned long num; int i, base; char * str; const char *s; @@ -575,9 +577,7 @@ int vsprintf(char *buf, const char *fmt, va_list args) --fmt; continue; } - if (qualifier == 'L') - num = va_arg(args, long long); - else if (qualifier == 'l') { + if (qualifier == 'l') { num = va_arg(args, unsigned long); if (flags & SIGN) num = (signed long) num; diff --git a/arch/ppc64/boot/zlib.c b/arch/ppc64/boot/zlib.c index 4616aadfa4304..9d5e4e9832d2a 100644 --- a/arch/ppc64/boot/zlib.c +++ b/arch/ppc64/boot/zlib.c @@ -102,9 +102,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */ /* functions */ -#include +extern void *memcpy(void *, const void *, unsigned long); #define zmemcpy memcpy -#define zmemzero(dest, len) memset(dest, 0, len) /* Diagnostic functions */ #ifdef DEBUG_ZLIB -- 2.53.0