]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix ppc64 build problem
authorAnton Blanchard <anton@samba.org>
Fri, 13 Feb 2004 23:29:48 +0000 (15:29 -0800)
committerAnton Blanchard <anton@samba.org>
Fri, 13 Feb 2004 23:29:48 +0000 (15:29 -0800)
From: Paul Mackerras <paulus@samba.org>

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
arch/ppc64/boot/zlib.c

index 55ffaef76aaebc5a6416f6c70162ec9d77dd06d0..7b607d1862cb07a9c4fb9a1203447c8bdedde63b 100644 (file)
@@ -11,9 +11,6 @@
 #include <linux/string.h>
 #include <linux/ctype.h>
 
-#define BITS_PER_LONG 32
-#include <asm/div64.h>
-
 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;
index 4616aadfa430456ca08937cd68e4fdddc847dc35..9d5e4e9832d2a8bea9760f8af922ec4d815fbd88 100644 (file)
@@ -102,9 +102,8 @@ extern char *z_errmsg[]; /* indexed by 1-zlib_error */
 
          /* functions */
 
-#include <linux/string.h>
+extern void *memcpy(void *, const void *, unsigned long);
 #define zmemcpy memcpy
-#define zmemzero(dest, len)    memset(dest, 0, len)
 
 /* Diagnostic functions */
 #ifdef DEBUG_ZLIB