: remove warnings on promlib
PATCH 1/1 : remove warnings on promlib
Hi
remove compile warnings about undefined symbols.
Later, Juan.
Index: arch/mips/lib/promlib.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/lib/promlib.c,v retrieving revision 1.1.2.1
mips/lib/promlib.c +4 -0
@@ -1,3 +1,7 @@ + +#include <asm/sgialib.h> +#include <linux/kernel.h> +#include <stdarg.h> void prom_printf (char *fmt, ...)
Signature · 2 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
Quoted 8 lines · Juan Quintela
Index:
arch/mips/lib/promlib.c
===================================================================
RCS file:/home/cvs/linux/arch/mips/lib/promlib.c,vretrieving revision 1.1.2.1
diff -u -r1.1.2.1promlib.c
mips/lib/promlib.c line 7
Quoted 7 lines
mips/lib/promlib.c +4
-0@@ -1,3 +1,7 @@ + +#include <asm/sgialib.h> +#include <linux/kernel.h> +#include <stdarg.h> void prom_printf (char *fmt, ...)
A few comments:
1. <linux> includes first, <asm> ones following (hmm, shouldn't that be obvious...).
2. <linux/kernel.h> is obviously OK for vsprintf().
3. I would hesitate using <asm/sgialib.h> here being too much platform specific. Either a separate generic <asm/prom.h> should be created for primitives like prom_putchar(), prom_getchar(), etc. or a private conservative declaration should be used here. The reason is the functions are much platform-specific, e.g. they may be pointers or even macros -- see <asm/dec/prom.h> for a not-so-trivial example (luckily, DECstations support prom_printf() directly, so they don't have to use promlib.c).
Maciej
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"maciej" == Maciej W Rozycki <[email protected]> writes:
Quoted 14 lines · Juan Quintela
Quoted 14 lines
Index:
arch/mips/lib/promlib.c
===================================================================
RCS file:/home/cvs/linux/arch/mips/lib/promlib.c,vretrieving revision 1.1.2.1
diff -u -r1.1.2.1promlib.cmips/lib/promlib.c +4
-0@@ -1,3 +1,7 @@ + +#include <asm/sgialib.h> +#include <linux/kernel.h> +#include <stdarg.h>
Quoted 1 line
mips/lib/promlib.c line 7
Quoted 1 line
mips/lib/promlib.c +0
-0void prom_printf (char *fmt, ...)
maciej> A few comments:
maciej> 1. <linux> includes first, <asm> ones following (hmm, shouldn't that be maciej> obvious...).
maciej> 2. <linux/kernel.h> is obviously OK for vsprintf().
maciej> 3. I would hesitate using <asm/sgialib.h> here being too much platform maciej> specific. Either a separate generic <asm/prom.h> should be created for maciej> primitives like prom_putchar(), prom_getchar(), etc. or a private maciej> conservative declaration should be used here. The reason is the functions maciej> are much platform-specific, e.g. they may be pointers or even macros -- maciej> see <asm/dec/prom.h> for a not-so-trivial example (luckily, DECstations maciej> support prom_printf() directly, so they don't have to use promlib.c).
Something like that?
Once there, s/vsprintf/vsnprintf/.
If anybody calls prom_printf with more than 1024 chars, we were b0rked :((
I didn't did the changes for the other users of prom_* that was using asm/sgialib.h, but change is trivial.
Later, Juan.
include/asm-mips/prom.h renamed from include/asm-mips/prom.h.orig +21 -0
@@ -0,0 +1,21 @@ +/* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Interface with the low level prom consoles. +* +* Copyright (C) 1996 David S. Miller ([email protected]) +* Copyright (C) 2001, 2002 Ralf Baechle ([email protected]) +*/ +#ifndef _ASM_PROM_H +#define _ASM_PROM_H + +/* Simple char-by-char console I/O. */ +extern void prom_putchar (char c); +extern char prom_getchar (void ); + +/* Generic printf() console I/O. */ +extern void prom_printf (char *fmt, ...); + +#endif /* _ASM_PROM_H */
Index: arch/mips/arc/init.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/arc/init.c,v
retrieving revision 1.10.2.3
mips/arc/init.c +1 -0
@@ -11,6 +11,7 @@#include <linux/kernel.h> #include <asm/sgialib.h> +#include <asm/prom.h> #undef DEBUG_PROM_INIT
Index: arch/mips/lib/promlib.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/lib/promlib.c,v retrieving revision 1.1.2.1
mips/lib/promlib.c +9 -2
@@ -1,13 +1,20 @@ + + +#include <linux/kernel.h> +#include <asm/prom.h> +#include <stdarg.h> +#define BUFSIZE 1024 +void prom_printf (char *fmt, ...) {va_list args; -char ppbuf[1024 ]; +char ppbuf[BUFSIZE ];char *bptr;va_start (args, fmt); -vsprintf (ppbuf, fmt, args); +vsnprintf (ppbuf,BUFSIZE , fmt, args); bptr = ppbuf;
Index: arch/mips/sgi-ip22/ip22-system.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sgi-ip22/ip22-system.c,v retrieving revision 1.1.2.8
mips/sgi-ip22/ip22-system.c +1 -0
@@ -11,6 +11,7 @@#include <asm/cpu.h> #include <asm/sgi/sgi.h> #include <asm/sgialib.h> +#include <asm/prom.h> enum sgi_mach sgimach;
Index: include/asm-mips/sgialib.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/sgialib.h,v retrieving revision 1.10.2.3
asm-mips/sgialib.h +0 -7
@@ -30,13 +30,6 @@/* Init the PROM library and it's internal data structures. */ extern void prom_init (int argc,char **argv,char **envp,int *prom_vec); -/* Simple char-by-char console I/O. */ -extern void prom_putchar (char c); -extern char prom_getchar (void ); - -/* Generic printf() using ARCS console I/O. */ -extern void prom_printf (char *fmt, ...); -/* Memory descriptor management. */ #define PROM_MAX_PMEMBLOCKS 32struct prom_pmemblock {
Signature · 2 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"juan" == Juan Quintela <[email protected]> writes:
You also want that bit:
Index: drivers/sgi/char/sgiserial.c
===================================================================
RCS file: /home/cvs/linux/drivers/sgi/char/Attic/sgiserial.c,v retrieving revision 1.33.2.6
sgi/char/sgiserial.c +1 -0
@@ -40,6 +40,7 @@#include <asm/sgialib.h> #include <asm/system.h> #include <asm/bitops.h> +#include <asm/prom.h> #include <asm/sgi/sgihpc.h> #include <asm/sgi/sgint23.h> #include <asm/uaccess.h>
Signature · 2 lines
In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
Quoted 1 line · Juan Quintela
Something like that?
Sure.
Quoted 4 lines
Once there, s/vsprintf/vsnprintf/.
If anybody calls
prom_printfwith more than 1024 chars, we were b0rked :((
And thanks for fixing this.
Quoted 2 lines
I didn't did the changes for the other users of prom_* that was using
asm/sgialib.h, but change is trivial.
Well, it's usually quite easy to do such stuff to offload maintainers of
the respective files. And sometimes there are ones that lack an active maintainer but "just work". Alternatively, <asm/sgialib.h> itself might include <asm/prom.h> to ease the transition.
Signature · 3 lines
+ Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: [email protected], PGP key available +