Re: [PATCH] de4x5.c [was Re: pre-2.1.116-1 breaks Cyrix 6x86 support]

Gabriel Paubert (paubert@iram.es)
Tue, 11 Aug 1998 23:46:09 +0200 (METDST)


On 11 Aug 1998, Zlatko Calusic wrote:

> Linus Torvalds <torvalds@transmeta.com> writes:
>
> > On Tue, 11 Aug 1998, Alan Cox wrote:
> > > > I'd be much happier with somebody finding the cause for de4x5 trying to
> > > > probe the same device 8 times..
> > >
> > > Because the kernel boot code will call "safe" probes multiple times to
> > > look for eth1,2,3,4 for 'safe' - ie PCI/Zorro/nubus devices. So the
> > > de4x5 init should either expect to be called up to 8 times on init or
> > > set an internal static "just return" value
> >
> > Ahh, ok. So the code is actually fine, the only part that people object to
> > is the printout. If so, then just removing the printk's sounds like the
> > proper solution.
> >
>
> Cool!
>
> But, what about compatibility (or should I say compilability?) with
> egcs. It is impossible to compile kernel with egcs without David's
> patch. Oops at boot stage with something like DE4 in some of the
> registers. Tried many times with different compilers/optimizations and
> always failed. Works like a charm now with the patch applied.
>

[And earlier to me]
> I saw lots of your messages in the archives, about problems with egcs
> and so, but never really found magic "string.h/egcs" patch. Now, it
> looks, I have it, hiding somewhere in that small patch. :)

There is none, believe it or not, what makes the patch work with egcs and
friends is the following (someone published a patch to string.h but I
never tested it):

- c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
+ static c_char *de4x5_signatures[] = DE4X5_SIGNATURE;

the side effect is that it reduces register pressure in the code. Qualify
it as kludge, bandaid, black magic, whatever you want... :-)

Note that it makes the code slighly more efficient since the compiler
no more initializes an array of pointers at runtime. So it's (marginally)
better and should be included if only for this reason.

Gabriel

diff -urN --exclude-from=exclude linux-old/drivers/net/de4x5.c linux/drivers/net/de4x5.c
--- linux-old/drivers/net/de4x5.c Fri Jul 17 19:14:25 1998
+++ linux/drivers/net/de4x5.c Tue Aug 4 15:58:35 1998
@@ -3898,7 +3923,7 @@
static int
EISA_signature(char *name, s32 eisa_id)
{
- c_char *signatures[] = DE4X5_SIGNATURE;
+ static c_char *signatures[] = DE4X5_SIGNATURE;
char ManCode[DE4X5_STRLEN];
union {
s32 ID;
@@ -3933,7 +3958,7 @@
static int
PCI_signature(char *name, struct bus_type *lp)
{
- c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
+ static c_char *de4x5_signatures[] = DE4X5_SIGNATURE;
int i, status = 0, siglen = sizeof(de4x5_signatures)/sizeof(c_char *);

if (lp->chipset == DC21040) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html