* [PATCH]: remove warnings on promlib
@ 2002-12-18 1:43 Juan Quintela
2002-12-18 17:00 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Juan Quintela @ 2002-12-18 1:43 UTC (permalink / raw)
To: linux-mips, Ralf Baechle
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
diff -u -r1.1.2.1 promlib.c
--- arch/mips/lib/promlib.c 28 Sep 2002 22:28:38 -0000 1.1.2.1
+++ arch/mips/lib/promlib.c 18 Dec 2002 00:49:18 -0000
@@ -1,3 +1,7 @@
+
+#include <asm/sgialib.h>
+#include <linux/kernel.h>
+
#include <stdarg.h>
void prom_printf(char *fmt, ...)
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH]: remove warnings on promlib 2002-12-18 1:43 [PATCH]: remove warnings on promlib Juan Quintela @ 2002-12-18 17:00 ` Maciej W. Rozycki 2002-12-19 10:17 ` Juan Quintela 0 siblings, 1 reply; 5+ messages in thread From: Maciej W. Rozycki @ 2002-12-18 17:00 UTC (permalink / raw) To: Juan Quintela; +Cc: linux-mips, Ralf Baechle On 18 Dec 2002, Juan Quintela wrote: > Index: arch/mips/lib/promlib.c > =================================================================== > RCS file: /home/cvs/linux/arch/mips/lib/promlib.c,v > retrieving revision 1.1.2.1 > diff -u -r1.1.2.1 promlib.c > --- arch/mips/lib/promlib.c 28 Sep 2002 22:28:38 -0000 1.1.2.1 > +++ arch/mips/lib/promlib.c 18 Dec 2002 00:49:18 -0000 > @@ -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 -- + Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: macro@ds2.pg.gda.pl, PGP key available + ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: remove warnings on promlib 2002-12-18 17:00 ` Maciej W. Rozycki @ 2002-12-19 10:17 ` Juan Quintela 2002-12-19 11:07 ` Juan Quintela 2002-12-19 12:04 ` Maciej W. Rozycki 0 siblings, 2 replies; 5+ messages in thread From: Juan Quintela @ 2002-12-19 10:17 UTC (permalink / raw) To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle >>>>> "maciej" == Maciej W Rozycki <macro@ds2.pg.gda.pl> writes: maciej> On 18 Dec 2002, Juan Quintela wrote: >> Index: arch/mips/lib/promlib.c >> =================================================================== >> RCS file: /home/cvs/linux/arch/mips/lib/promlib.c,v >> retrieving revision 1.1.2.1 >> diff -u -r1.1.2.1 promlib.c >> --- arch/mips/lib/promlib.c 28 Sep 2002 22:28:38 -0000 1.1.2.1 >> +++ arch/mips/lib/promlib.c 18 Dec 2002 00:49:18 -0000 >> @@ -1,3 +1,7 @@ >> + >> +#include <asm/sgialib.h> >> +#include <linux/kernel.h> >> + >> #include <stdarg.h> >> >> void 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. diff -uNp build/include/asm-mips/prom.h.orig build/include/asm-mips/prom.h --- build/include/asm-mips/prom.h.orig 1970-01-01 01:00:00.000000000 +0100 +++ build/include/asm-mips/prom.h 2002-12-18 19:00:47.000000000 +0100 @@ -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 (dm@engr.sgi.com) + * Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org) + */ +#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 diff -u -r1.10.2.3 init.c --- arch/mips/arc/init.c 1 Aug 2002 22:26:40 -0000 1.10.2.3 +++ arch/mips/arc/init.c 19 Dec 2002 09:21:07 -0000 @@ -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 diff -u -r1.1.2.1 promlib.c --- arch/mips/lib/promlib.c 28 Sep 2002 22:28:38 -0000 1.1.2.1 +++ arch/mips/lib/promlib.c 19 Dec 2002 09:21:08 -0000 @@ -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 diff -u -r1.1.2.8 ip22-system.c --- arch/mips/sgi-ip22/ip22-system.c 18 Dec 2002 19:11:09 -0000 1.1.2.8 +++ arch/mips/sgi-ip22/ip22-system.c 19 Dec 2002 09:21:09 -0000 @@ -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 diff -u -r1.10.2.3 sgialib.h --- include/asm-mips/sgialib.h 1 Aug 2002 22:26:40 -0000 1.10.2.3 +++ include/asm-mips/sgialib.h 19 Dec 2002 09:21:15 -0000 @@ -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 32 struct prom_pmemblock { -- In theory, practice and theory are the same, but in practice they are different -- Larry McVoy ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: remove warnings on promlib 2002-12-19 10:17 ` Juan Quintela @ 2002-12-19 11:07 ` Juan Quintela 2002-12-19 12:04 ` Maciej W. Rozycki 1 sibling, 0 replies; 5+ messages in thread From: Juan Quintela @ 2002-12-19 11:07 UTC (permalink / raw) To: Maciej W. Rozycki; +Cc: linux-mips, Ralf Baechle >>>>> "juan" == Juan Quintela <quintela@mandrakesoft.com> 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 diff -u -r1.33.2.6 sgiserial.c --- drivers/sgi/char/sgiserial.c 7 Nov 2002 01:47:46 -0000 1.33.2.6 +++ drivers/sgi/char/sgiserial.c 19 Dec 2002 10:38:07 -0000 @@ -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> -- In theory, practice and theory are the same, but in practice they are different -- Larry McVoy ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: remove warnings on promlib 2002-12-19 10:17 ` Juan Quintela 2002-12-19 11:07 ` Juan Quintela @ 2002-12-19 12:04 ` Maciej W. Rozycki 1 sibling, 0 replies; 5+ messages in thread From: Maciej W. Rozycki @ 2002-12-19 12:04 UTC (permalink / raw) To: Juan Quintela; +Cc: linux-mips, Ralf Baechle On 19 Dec 2002, Juan Quintela wrote: > Something like that? Sure. > Once there, s/vsprintf/vsnprintf/. > > If anybody calls prom_printf with more than 1024 chars, we were b0rked > :(( And thanks for fixing this. > 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. -- + Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: macro@ds2.pg.gda.pl, PGP key available + ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-12-19 12:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2002-12-18 1:43 [PATCH]: remove warnings on promlib Juan Quintela 2002-12-18 17:00 ` Maciej W. Rozycki 2002-12-19 10:17 ` Juan Quintela 2002-12-19 11:07 ` Juan Quintela 2002-12-19 12:04 ` Maciej W. Rozycki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox