Re: [PATCH] 2.4.4-ac11 network drivers cleaning
> > printk("%s\n", version); > > > > Not quite as optimal but safer. > > I disagree. Don't work around an escape bug in a version string, fix > it... A % in a version string might be quite reasonable. You are asking to have an accident by avoiding it. If you want to fight over 4 bytes, then add a single constant "%s\n", and #define putk() from it - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] 2.4.4-ac11 network drivers cleaning
> > On Sat, 19 May 2001 17:58:49 -0400, > Jeff Garzik <[EMAIL PROTECTED]> wrote: > >Finally, I don't know if I mentioned this earlier, but to be complete > >and optimal, version strings should be a single variable 'version', such > >that it can be passed directly to printk like > > > > printk(version); > > Nit pick. That has random side effects if version contains any '%' > characters. Make it It should not. I see no reason for a literal % in the version string. > > printk("%s\n", version); > > Not quite as optimal but safer. It is simpler to remove the %s from version. I don't think any of them require it. If one add a % he should know what he is doing. -- === Andrzej M. Krzysztofowicz [EMAIL PROTECTED] tel. (0-58) 347 14 61 Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] 2.4.4-ac11 network drivers cleaning
Keith Owens wrote: > > On Sat, 19 May 2001 17:58:49 -0400, > Jeff Garzik <[EMAIL PROTECTED]> wrote: > >Finally, I don't know if I mentioned this earlier, but to be complete > >and optimal, version strings should be a single variable 'version', such > >that it can be passed directly to printk like > > > > printk(version); > > Nit pick. That has random side effects if version contains any '%' > characters. Make it > > printk("%s\n", version); > > Not quite as optimal but safer. I disagree. Don't work around an escape bug in a version string, fix it... -- Jeff Garzik | "Do you have to make light of everything?!" Building 1024| "I'm extremely serious about nailing your MandrakeSoft | step-daughter, but other than that, yes." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] 2.4.4-ac11 network drivers cleaning
On Sat, 19 May 2001 17:58:49 -0400, Jeff Garzik <[EMAIL PROTECTED]> wrote: >Finally, I don't know if I mentioned this earlier, but to be complete >and optimal, version strings should be a single variable 'version', such >that it can be passed directly to printk like > > printk(version); Nit pick. That has random side effects if version contains any '%' characters. Make it printk("%s\n", version); Not quite as optimal but safer. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] 2.4.4-ac11 network drivers cleaning
Patch looks decent. Adding module descriptions was quite nice. One flaw that is repeated multiple times is that you add #ifdef MODULE printk(version); #endif in an ISA driver's probe routine. This instead should always be the first operation of init_module. Also make sure to go through the 'ac' patch and review the earlier version string changes. Some of them were buggy, like static const char version[] __initdata = "..."; const combined with __[dev]initdata causes a section type conflict. A few of those popped up after the earlier patch was applied to 'ac'. Finally, I don't know if I mentioned this earlier, but to be complete and optimal, version strings should be a single variable 'version', such that it can be passed directly to printk like printk(version); Some net drivers are already like this, as I'm sure you know. Some net drivers have 'version', 'version2', 'version3' instead of just one long string. Some net drivers add KERN_xxx at printk time, instead of adding it to the 'version' var. Some net drivers do the following, which is really silly considering you know all strings at compile time: printk(KERN_INFO "%s\n", version); -- Jeff Garzik | "Do you have to make light of everything?!" Building 1024| "I'm extremely serious about nailing your MandrakeSoft | step-daughter, but other than that, yes." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] 2.4.4-ac11 network drivers cleaning
>From kufel!root Sat May 19 23:39:35 2001 Return-Path: Received: from kufel.UUCP (uucp@localhost) by green.mif.pg.gda.pl (8.9.3/8.9.3) with UUCP id XAA02226 for green.mif.pg.gda.pl!ankry; Sat, 19 May 2001 23:39:35 +0200 Received: (from root@localhost) by kufel.dom (8.9.3/8.9.3) id XAA02243 for ankry@green; Sat, 19 May 2001 23:40:52 +0200 Date: Sat, 19 May 2001 23:40:52 +0200 From: root Message-Id: <[EMAIL PROTECTED]> To: kufel!green.mif.pg.gda.pl!ankry Subject: 3com Hi Alan, The following patch is a preliminary attempt for cleaning network drivers in 2.4 (drivers for 3Com boards for beginning). It contains: - cleaning version printing as Jeff suggests (modular - always, built in - if detected) - added MODULE_PARM_DESC (the main reason I've created the patch) - made version __initdata - a comment fix (3c501) - added KERN_* markers to some printk's (only a few) - enabled modular isapnp usage by 3c509 BTW, Looking at the "options" parameter in some drivers I found that using it might be ugly in some cases and do not allow specyfic settings. For example it is difficult to set 10Mbps/half-duplex not changing media type in some drivers as it requires "options=0" setting, which is simply ignored. Parameters like duplex setting should be IMO three-state (full/half/not changed) while there's only one bit in "options" assigned to them currently. Jeff, Alan, what do you think of changing the method for media/link type setting and unifying it across drivers ? Of course, I think of it as a 2.5 project... Andrzej ** diff -ur linux-2.4.4-ac11/drivers/net/3c501.c linux/drivers/net/3c501.c --- linux-2.4.4-ac11/drivers/net/3c501.cTue May 1 21:14:30 2001 +++ linux/drivers/net/3c501.c Fri May 18 23:44:28 2001 @@ -238,6 +238,10 @@ SET_MODULE_OWNER(dev); +#ifdef MODULE + printk(version); +#endif /* MODULE */ + if (base_addr > 0x1ff) /* Check a single specified location. */ return el1_probe1(dev, base_addr); else if (base_addr != 0)/* Don't probe at all. */ @@ -251,7 +255,7 @@ } /** - * el1_probe: + * el1_probe1: * @dev: The device structure to use * @ioaddr: An I/O address to probe at. * @@ -270,6 +274,7 @@ unsigned char station_addr[6]; int autoirq = 0; int i; + static int printed_version; /* * Reserve I/O resource for exclusive use by this driver @@ -340,15 +345,17 @@ if (autoirq) dev->irq = autoirq; +#ifndef MODULE + if (!printed_version++) + printk(version); +#endif /* MODULE */ + printk(KERN_INFO "%s: %s EtherLink at %#lx, using %sIRQ %d.\n", dev->name, mname, dev->base_addr, autoirq ? "auto":"assigned ", dev->irq); #ifdef CONFIG_IP_MULTICAST printk(KERN_WARNING "WARNING: Use of the 3c501 in a multicast kernel is NOT recommended.\n"); -#endif - - if (el_debug) - printk(version); +#endif /* CONFIG_IP_MULTICAST */ /* * Initialize the device structure. @@ -925,6 +932,8 @@ static int irq=5; MODULE_PARM(io, "i"); MODULE_PARM(irq, "i"); +MODULE_PARM_DESC(io, "EtherLink I/O base address"); +MODULE_PARM_DESC(irq, "EtherLink IRQ number"); /** * init_module: diff -ur linux-2.4.4-ac11/drivers/net/3c503.c linux/drivers/net/3c503.c --- linux-2.4.4-ac11/drivers/net/3c503.cTue May 1 21:14:30 2001 +++ linux/drivers/net/3c503.c Fri May 18 23:45:06 2001 @@ -178,8 +178,10 @@ goto out; } -if (ei_debug && version_printed++ == 0) +#ifndef MODULE +if (version_printed++ == 0) printk(version); +#endif /* MODULE */ dev->base_addr = ioaddr; /* Allocate dev->priv and fill in 8390 specific dev fields. */ @@ -615,6 +617,8 @@ MODULE_PARM(io, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); MODULE_PARM(xcvr, "1-" __MODULE_STRING(MAX_EL2_CARDS) "i"); +MODULE_PARM_DESC(io, "EtherLink II I/O base address(es)"); +MODULE_PARM_DESC(irq, "EtherLink II IRQ number(s) (assigned)"); /* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ @@ -623,6 +627,7 @@ { int this_dev, found = 0; + printk(version); for (this_dev = 0; this_dev < MAX_EL2_CARDS; this_dev++) { struct net_device *dev = &dev_el2[this_dev]; dev->irq = irq[this_dev]; diff -ur linux-2.4.4-ac11/drivers/net/3c505.c linux/drivers/net/3c505.c --- linux-2.4.4-ac11/drivers/net/3c505.cSat Apr 28 20:34:50 2001 +++ linux/drivers/net/3c505.c Fri May 18 19:38:44 2001 @@ -1621,6 +1621,9 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i"); MODULE_PARM(dma, "1-" __MODULE_STRING(ELP_MAX