Commit be63a940 authored by Anton Blanchard's avatar Anton Blanchard

[PATCH] Fix ppc64 build problem

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.
parent d1c0dfc8
......@@ -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;
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment