Skip to contentSkip to conversation

cleanups for Becker-derived drivers

PATCH New Jeff Garzik 1 participant 1 message Jun 27, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanups for Becker-derived drivers

Just checked this into netdev-2.6.git#upstream...

Jeff

commit 5e4860c2f5dd64bdc9dedc657c246129659b5bbe

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 09:25:28 2006 -0400

[netdrvr] via-velocity: remove io_size struct member, it is invariant

Replace io_size struct members with VELOCITY_IO_SIZE constant.

Also, constify chip_info_table[].

commit 8a8b0fe4ac1cf49e4d1f170de20bc1c91206dc9c

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 09:20:08 2006 -0400

[netdrvr] via-velocity: misc. cleanups

- const-ify pci_device_id table
- clean up pci_device_id table with PCI_DEVICE()
- don't store internal pointer in pci_device_id table, use pci_device_id::driver_data as an integer index
- use dev_printk() for messages where eth%d prefix is unavailable
- formatting fixes

commit d573eb578808b9531e50b38222c56cf8792b4d86

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 09:12:38 2006 -0400

[netdrvr] minor cleanups in Becker-derived drivers

- fealnx: convert #define to enum
- fealnx, sundance: mark chip info table __devinitdata
- fealnx: use dev_printk() during probe
- fealnx: formatting cleanups
- starfire: remove obsolete comment
- sundance, via-rhine: add some whitespace where useful, in tables
- sundance: prefer "{ }" table terminator
- via-rhine: mark PCI probe table const

commit c66fdbba1d9c058ea4a93c2be84c142cd24710ad

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 08:56:23 2006 -0400

[netdrvr] via-velocity: use netdev_priv() where appropriate

commit 61c874a20369c61840bbe70c77b8703a7e70834b

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 08:54:34 2006 -0400

[netdrvr] Remove Becker-template 'io_size' member, when invariant

Becker-derived drivers often have the 'io_size' member in their chip info struct, indicating the minimum required size of the I/O resource (usually a PCI BAR). For many situations, this number is either constant or irrelevant (due to pci_iomap convenience behavior).

This change removes the io_size invariant member, and replaces it with a compile-time constant.

Drivers updated: fealnx, gt96100eth, winbond-840, yellowfin

Additionally,
- gt96100eth: unused 'drv_flags' removed from gt96100eth
- winbond-840: unused struct match_info removed
- winbond-840: mark pci_id_tbl[] const, __devinitdata

commit 5a60e801d0db1421e1f5753e96edd63975023ace

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 07:57:22 2006 -0400

[netdrvr] Remove Linux-specific changelogs from several Becker template drivers

When in-kernel net drivers branched from Donald Becker's vanilla driver set, in the days before BitKeeper and git, a driver changelog was maintained in the driver source code. These days, the kernel's changelog is far superior and much more accurate, so the in-driver changelogs are removed.

Another relic of the Becker/kernel split was version numbering, using "foo-LKx.y.z" notation, resulting in weird version numbers like "1.17b-LK1.1.9". These drivers are for older hardware, and see few changes these days, so the version numbers were all bumped to something more simple.

Finally, in xircom_tulip_cb specifically, an additional cleanup removes the always-enabled CARDBUS cpp macro.

commit 45d2b49000fa6cd65e2409bf7c121b374c4974cd

Author: Jeff Garzik <[email protected]>
Date:   Tue Jun 27 07:38:33 2006 -0400

[netdrvr] epic100: minor cleanups

- Remove in-source changelog, it's in the global kernel history.
- convert silly and useless version to useful one
- replace invariant pci_id_tbl[]::io_size uses with EPIC_TOTAL_SIZE
- remove now-unused io_size member from pci_id_tbl[]
- current kernel style prefers dev_printk() for the rare ethernet driver messages that cannot print an 'eth%d' prefix.

 drivers/net/dl2k.c                  |   43 ------------
 drivers/net/epic100.c               |   71 ++------------------
 drivers/net/fealnx.c                |   20 +++--
 drivers/net/gt96100eth.c            |    3 
 drivers/net/gt96100eth.h            |    2 
 drivers/net/hamachi.c               |   13 ---
 drivers/net/natsemi.c               |  117 ----------------------------------
 drivers/net/starfire.c              |  123 ------------------------------------
 drivers/net/sundance.c              |  106 ++++---------------------------
 drivers/net/tulip/winbond-840.c     |   29 +++-----
 drivers/net/tulip/xircom_tulip_cb.c |   27 +------
 drivers/net/via-rhine.c             |  121 ++---------------------------------
 drivers/net/via-velocity.c          |  102 ++++++++++++++---------------
 drivers/net/via-velocity.h          |    4 -
 drivers/net/yellowfin.c             |   39 ++---------
 15 files changed, 132 insertions(+), 688 deletions(-)
drivers/net/dl2k.c +2 -41
index 038447f..be997cb 100644
@@ -9,49 +9,10 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 */
-/*
-    Rev		Date		Description
-    ==========================================================================
-    0.01	2001/05/03	Created DL2000-based linux driver
-    0.02	2001/05/21	Added VLAN and hardware checksum support.
-    1.00	2001/06/26	Added jumbo frame support.
-    1.01	2001/08/21	Added two parameters, rx_coalesce and rx_timeout.
-    1.02	2001/10/08	Supported fiber media.
-    				Added flow control parameters.
-    1.03	2001/10/12	Changed the default media to 1000mbps_fd for 
-    				the fiber devices.
-    1.04	2001/11/08	Fixed Tx stopped when tx very busy.
-    1.05	2001/11/22	Fixed Tx stopped when unidirectional tx busy.
-    1.06	2001/12/13	Fixed disconnect bug at 10Mbps mode.
-    				Fixed tx_full flag incorrect.
-				Added tx_coalesce paramter.
-    1.07	2002/01/03	Fixed miscount of RX frame error.
-    1.08	2002/01/17	Fixed the multicast bug.
-    1.09	2002/03/07	Move rx-poll-now to re-fill loop.	
-    				Added rio_timer() to watch rx buffers. 
-    1.10	2002/04/16	Fixed miscount of carrier error.
-    1.11	2002/05/23	Added ISR schedule scheme
-    				Fixed miscount of rx frame error for DGE-550SX.
-    				Fixed VLAN bug.
-    1.12	2002/06/13	Lock tx_coalesce=1 on 10/100Mbps mode.
-    1.13	2002/08/13	1. Fix disconnection (many tx:carrier/rx:frame
-    				   errs) with some mainboards.
-    				2. Use definition "DRV_NAME" "DRV_VERSION" 
-				   "DRV_RELDATE" for flexibility.	
-    1.14	2002/08/14	Support ethtool.	
-    1.15	2002/08/27	Changed the default media to Auto-Negotiation
-				for the fiber devices.    
-    1.16	2002/09/04      More power down time for fiber devices auto-
-    				negotiation.
-				Fix disconnect bug after ifup and ifdown.
-    1.17	2002/10/03	Fix RMON statistics overflow. 
-			     	Always use I/O mapping to access eeprom, 
-				avoid system freezing with some chipsets.
 
-*/
 #define DRV_NAME	"D-Link DL2000-based linux driver"
-#define DRV_VERSION	"v1.17b"
-#define DRV_RELDATE	"2006/03/10"
+#define DRV_VERSION	"v1.18"
+#define DRV_RELDATE	"2006/06/27"
 #include "dl2k.h"
 #include <linux/dma-mapping.h>
 
drivers/net/epic100.c +10 -61

113 lines not on this page · raw message

drivers/net/fealnx.c +11 -9
index 13eca7e..958ea51 100644
@@ -124,7 +124,9 @@ MODULE_PARM_DESC(multicast_filter_limit,
 MODULE_PARM_DESC(options, "fealnx: Bits 0-3: media type, bit 17: full duplex");
 MODULE_PARM_DESC(full_duplex, "fealnx full duplex setting(s) (1)");
 
-#define MIN_REGION_SIZE 136
+enum {
+	MIN_REGION_SIZE		= 136,
+};
 
 /* A chip capabilities table, matching the entries in pci_tbl[] above. */
 enum chip_capability_flags {
@@ -146,14 +148,13 @@ enum phy_type_flags {
 
 struct chip_info {
 	char *chip_name;
-	int io_size;
 	int flags;
 };
 
-static const struct chip_info skel_netdrv_tbl[] = {
-	{"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
-	{"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
-	{"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
+static const struct chip_info skel_netdrv_tbl[] __devinitdata = {
+ 	{ "100/10M Ethernet PCI Adapter",	HAS_MII_XCVR },
+	{ "100/10M Ethernet PCI Adapter",	HAS_CHIP_XCVR },
+	{ "1000/100/10M Ethernet PCI Adapter",	HAS_MII_XCVR },
 };
 
 /* Offsets to the Command and Status Registers. */
@@ -504,13 +505,14 @@ #endif
 	
 	len = pci_resource_len(pdev, bar);
 	if (len < MIN_REGION_SIZE) {
-		printk(KERN_ERR "%s: region size %ld too small, aborting\n",
-		       boardname, len);
+		dev_printk(KERN_ERR, &pdev->dev,
+			   "region size %ld too small, aborting\n", len);
 		return -ENODEV;
 	}
 
 	i = pci_request_regions(pdev, boardname);
-	if (i) return i;
+	if (i)
+		return i;
 	
 	irq = pdev->irq;
 
drivers/net/gt96100eth.c +1 -2
index 2d24354..243c9a5 100644
@@ -699,7 +699,6 @@ static int __init gt96100_probe1(struct 
 	memset(gp, 0, sizeof(*gp)); // clear it
 
 	gp->port_num = port_num;
-	gp->io_size = GT96100_ETH_IO_SIZE;
 	gp->port_offset = port_num * GT96100_ETH_IO_SIZE;
 	gp->phy_addr = phy_addr;
 	gp->chip_rev = chip_rev;
@@ -1531,7 +1530,7 @@ static void gt96100_cleanup_module(void)
 				+ sizeof(gt96100_td_t) * TX_RING_SIZE,
 				gp->rx_ring);
 			free_netdev(gtif->dev);
-			release_region(gtif->iobase, gp->io_size);
+			release_region(gtif->iobase, GT96100_ETH_IO_SIZE);
 		}
 	}
 }
drivers/net/gt96100eth.h +0 -2
index 395869c..cda81c9 100644
@@ -332,7 +332,6 @@ struct gt96100_private {
 	mib_counters_t mib;
 	struct net_device_stats stats;
 
-	int io_size;
 	int port_num;  // 0 or 1
 	int chip_rev;
 	u32 port_offset;
@@ -341,7 +340,6 @@ struct gt96100_private {
 	u32 last_psr; // last value of the port status register
 
 	int options;     /* User-settable misc. driver options. */
-	int drv_flags;
 	struct timer_list timer;
 	spinlock_t lock; /* Serialise access to device */
 };
drivers/net/hamachi.c +3 -10
index 0ea4cb4..2b91099 100644
@@ -20,22 +20,15 @@
 
 	Support and updates available at
 	http://www.scyld.com/network/hamachi.html
+	[link no longer provides useful info -jgarzik]
 	or
 	http://www.parl.clemson.edu/~keithu/hamachi.html
 
-
-
-	Linux kernel changelog:
-
-	LK1.0.1:
-	- fix lack of pci_dev<->dev association
-	- ethtool support (jgarzik)
-
 */
 
 #define DRV_NAME	"hamachi"
-#define DRV_VERSION	"1.01+LK1.0.1"
-#define DRV_RELDATE	"5/18/2001"
+#define DRV_VERSION	"2.0"
+#define DRV_RELDATE	"June 27, 2006"
 
 
 /* A few user-configurable values. */
drivers/net/natsemi.c +3 -114

131 lines not on this page · raw message

drivers/net/starfire.c +3 -120

139 lines not on this page · raw message

drivers/net/sundance.c +14 -92

134 lines not on this page · raw message

drivers/net/tulip/winbond-840.c +13 -16
index 602a6e5..a1e3159 100644
@@ -224,24 +224,21 @@ static const struct pci_device_id w840_p
 };
 MODULE_DEVICE_TABLE(pci, w840_pci_tbl);
 
+enum {
+	netdev_res_size		= 128,	/* size of PCI BAR resource */
+};
+
 struct pci_id_info {
         const char *name;
-        struct match_info {
-                int     pci, pci_mask, subsystem, subsystem_mask;
-                int revision, revision_mask;                            /* Only 8 bits. */
-        } id;
-        int io_size;                            /* Needed for I/O region check or ioremap(). */
-        int drv_flags;                          /* Driver use, intended as capability flags. */
+        int drv_flags;		/* Driver use, intended as capability flags. */
 };
-static struct pci_id_info pci_id_tbl[] = {
-	{"Winbond W89c840",			/* Sometime a Level-One switch card. */
-	 { 0x08401050, 0xffffffff, 0x81530000, 0xffff0000 },
-	   128, CanHaveMII | HasBrokenTx | FDXOnNoMII},
-	{"Winbond W89c840", { 0x08401050, 0xffffffff, },
-	   128, CanHaveMII | HasBrokenTx},
-	{"Compex RL100-ATX", { 0x201111F6, 0xffffffff,},
-	   128, CanHaveMII | HasBrokenTx},
-	{NULL,},					/* 0 terminated list. */
+
+static const struct pci_id_info pci_id_tbl[] __devinitdata = {
+	{ 				/* Sometime a Level-One switch card. */
+	  "Winbond W89c840",	CanHaveMII | HasBrokenTx | FDXOnNoMII},
+	{ "Winbond W89c840",	CanHaveMII | HasBrokenTx},
+	{ "Compex RL100-ATX",	CanHaveMII | HasBrokenTx},
+	{ }	/* terminate list. */
 };
 
 /* This driver was written to use PCI memory space, however some x86 systems
@@ -399,7 +396,7 @@ static int __devinit w840_probe1 (struct
 #ifdef USE_IO_OPS
 	bar = 0;
 #endif
-	ioaddr = pci_iomap(pdev, bar, pci_id_tbl[chip_idx].io_size);
+	ioaddr = pci_iomap(pdev, bar, netdev_res_size);
 	if (!ioaddr)
 		goto err_out_free_res;
 
drivers/net/tulip/xircom_tulip_cb.c +4 -23
index 887d724..8b5f5d8 100644
@@ -10,26 +10,11 @@
 	410 Severn Ave., Suite 210
 	Annapolis MD 21403
 
-	-----------------------------------------------------------
-
-	Linux kernel-specific changes:
-
-	LK1.0 (Ion Badulescu)
-	- Major cleanup
-	- Use 2.4 PCI API
-	- Support ethtool
-	- Rewrite perfect filter/hash code
-	- Use interrupts for media changes
-
-	LK1.1 (Ion Badulescu)
-	- Disallow negotiation of unsupported full-duplex modes
 */
 
 #define DRV_NAME	"xircom_tulip_cb"
-#define DRV_VERSION	"0.91+LK1.1"
-#define DRV_RELDATE	"October 11, 2001"
-
-#define CARDBUS 1
+#define DRV_VERSION	"0.92"
+#define DRV_RELDATE	"June 27, 2006"
 
 /* A few user-configurable values. */
 
@@ -307,10 +292,10 @@ struct xircom_private {
 	struct xircom_tx_desc tx_ring[TX_RING_SIZE];
 	/* The saved address of a sent-in-place packet/buffer, for skfree(). */
 	struct sk_buff* tx_skbuff[TX_RING_SIZE];
-#ifdef CARDBUS
+
 	/* The X3201-3 requires 4-byte aligned tx bufs */
 	struct sk_buff* tx_aligned_skbuff[TX_RING_SIZE];
-#endif
+
 	/* The addresses of receive-in-place skbuffs. */
 	struct sk_buff* rx_skbuff[RX_RING_SIZE];
 	u16 setup_frame[PKT_SETUP_SZ / sizeof(u16)];	/* Pseudo-Tx frame to init address table. */
@@ -909,10 +894,8 @@ static void xircom_init_ring(struct net_
 		tp->tx_skbuff[i] = NULL;
 		tp->tx_ring[i].status = 0;
 		tp->tx_ring[i].buffer2 = virt_to_bus(&tp->tx_ring[i+1]);
-#ifdef CARDBUS
 		if (tp->chip_id == X3201_3)
 			tp->tx_aligned_skbuff[i] = dev_alloc_skb(PKT_BUF_SZ);
-#endif /* CARDBUS */
 	}
 	tp->tx_ring[i-1].buffer2 = virt_to_bus(&tp->tx_ring[0]);
 }
@@ -932,12 +915,10 @@ xircom_start_xmit(struct sk_buff *skb, s
 	entry = tp->cur_tx % TX_RING_SIZE;
 
 	tp->tx_skbuff[entry] = skb;
-#ifdef CARDBUS
 	if (tp->chip_id == X3201_3) {
 		memcpy(tp->tx_aligned_skbuff[entry]->data,skb->data,skb->len);
 		tp->tx_ring[entry].buffer1 = virt_to_bus(tp->tx_aligned_skbuff[entry]->data);
 	} else
-#endif
 		tp->tx_ring[entry].buffer1 = virt_to_bus(skb->data);
 
 	if (tp->cur_tx - tp->dirty_tx < TX_RING_SIZE/2) {/* Typical path */
drivers/net/via-rhine.c +8 -113

137 lines not on this page · raw message

drivers/net/via-velocity.c +50 -52

292 lines not on this page · raw message

drivers/net/via-velocity.h +2 -2
index f1b2640..496c3d5 100644
@@ -31,6 +31,8 @@ #define VELOCITY_NAME          "via-velo
 #define VELOCITY_FULL_DRV_NAM  "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"
 #define VELOCITY_VERSION       "1.13"
 
+#define VELOCITY_IO_SIZE	256
+
 #define PKT_BUF_SZ          1540
 
 #define MAX_UNITS           8
@@ -1191,7 +1193,6 @@ enum chip_type {
 struct velocity_info_tbl {
 	enum chip_type chip_id;
 	char *name;
-	int io_size;
 	int txqueue;
 	u32 flags;
 };
@@ -1751,7 +1752,6 @@ struct velocity_info {
 	struct mac_regs __iomem * mac_regs;
 	unsigned long memaddr;
 	unsigned long ioaddr;
-	u32 io_size;
 
 	u8 rev_id;
 
drivers/net/yellowfin.c +8 -31
index 569305f..116636b 100644
@@ -19,37 +19,13 @@
 
 	Support and updates available at
 	http://www.scyld.com/network/yellowfin.html
+	[link no longer provides useful info -jgarzik]
 
-
-	Linux kernel changelog:
-	-----------------------
-
-	LK1.1.1 (jgarzik): Port to 2.4 kernel
-
-	LK1.1.2 (jgarzik):
-	* Merge in becker version 1.05
-
-	LK1.1.3 (jgarzik):
-	* Various cleanups
-	* Update yellowfin_timer to correctly calculate duplex.
-	(suggested by Manfred Spraul)
-
-	LK1.1.4 ([email protected]):
-	* Fix three endian-ness bugs
-	* Support dual function SYM53C885E ethernet chip
-	
-	LK1.1.5 ([email protected]):
-	* Fix forced full-duplex bug I introduced
-
-	LK1.1.6 ([email protected]):
-	* Only print warning on truly "oversized" packets
-	* Fix theoretical bug on gigabit cards - return to 1.1.3 behavior
-	
 */
 
 #define DRV_NAME	"yellowfin"
-#define DRV_VERSION	"1.05+LK1.1.6"
-#define DRV_RELDATE	"Feb 11, 2002"
+#define DRV_VERSION	"2.0"
+#define DRV_RELDATE	"Jun 27, 2006"
 
 #define PFX DRV_NAME ": "
 
@@ -239,8 +215,11 @@ enum capability_flags {
 	HasMACAddrBug=32, /* Only on early revs.  */
 	DontUseEeprom=64, /* Don't read the MAC from the EEPROm. */
 };
+
 /* The PCI I/O space extent. */
-#define YELLOWFIN_SIZE 0x100
+enum {
+	YELLOWFIN_SIZE	= 0x100,
+};
 
 struct pci_id_info {
         const char *name;
@@ -248,16 +227,14 @@ struct pci_id_info {
                 int     pci, pci_mask, subsystem, subsystem_mask;
                 int revision, revision_mask;                            /* Only 8 bits. */
         } id;
-        int io_size;                            /* Needed for I/O region check or ioremap(). */
         int drv_flags;                          /* Driver use, intended as capability flags. */
 };
 
 static const struct pci_id_info pci_id_tbl[] = {
 	{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
-	 YELLOWFIN_SIZE,
 	 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
 	{"Symbios SYM83C885", { 0x07011000, 0xffffffff},
-	 YELLOWFIN_SIZE, HasMII | DontUseEeprom },
+	  HasMII | DontUseEeprom },
 	{ }
 };