[netdrvr] via-velocity: remove io_size struct member, it is invariant
authorJeff Garzik <jeff@garzik.org>
Tue, 27 Jun 2006 13:25:28 +0000 (09:25 -0400)
committerJeff Garzik <jeff@garzik.org>
Wed, 5 Jul 2006 17:40:50 +0000 (13:40 -0400)
Replace io_size struct members with VELOCITY_IO_SIZE constant.

Also, constify chip_info_table[].

Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/via-velocity.c
drivers/net/via-velocity.h

index 019dcf2457b4a089cd2e15813245f7f67698c282..7e3b2a31814633d27a875f08f9165dba196aa63d 100644 (file)
@@ -229,7 +229,8 @@ static int rx_copybreak = 200;
 module_param(rx_copybreak, int, 0644);
 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
 
-static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info);
+static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr,
+                              const struct velocity_info_tbl *info);
 static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev);
 static void velocity_print_info(struct velocity_info *vptr);
 static int velocity_open(struct net_device *dev);
@@ -294,9 +295,9 @@ static void velocity_unregister_notifier(void)
  *     Internal board variants. At the moment we have only one
  */
 
-static struct velocity_info_tbl chip_info_table[] = {
-       {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL},
-       {0, NULL}
+static const struct velocity_info_tbl chip_info_table[] __devinitdata = {
+       {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
+       { }
 };
 
 /*
@@ -685,7 +686,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
        static int first = 1;
        struct net_device *dev;
        int i;
-       struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
+       const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
        struct velocity_info *vptr;
        struct mac_regs __iomem * regs;
        int ret = -ENOMEM;
@@ -742,7 +743,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
                goto err_disable;
        }
 
-       regs = ioremap(vptr->memaddr, vptr->io_size);
+       regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE);
        if (regs == NULL) {
                ret = -EIO;
                goto err_release_res;
@@ -860,13 +861,14 @@ static void __devinit velocity_print_info(struct velocity_info *vptr)
  *     discovered.
  */
 
-static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info)
+static void __devinit velocity_init_info(struct pci_dev *pdev,
+                                        struct velocity_info *vptr,
+                                        const struct velocity_info_tbl *info)
 {
        memset(vptr, 0, sizeof(struct velocity_info));
 
        vptr->pdev = pdev;
        vptr->chip_id = info->chip_id;
-       vptr->io_size = info->io_size;
        vptr->num_txq = info->txqueue;
        vptr->multicast_limit = MCAM_SIZE;
        spin_lock_init(&vptr->lock);
@@ -904,7 +906,7 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc
                return -EINVAL;
        }
 
-       if (pci_resource_len(pdev, 1) < 256) {
+       if (pci_resource_len(pdev, 1) < VELOCITY_IO_SIZE) {
                dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n");
                return -EINVAL;
        }
index f1b2640ebdc660a1ce605ad3796f413339244119..496c3d5974444734f5aa6fa7ee3196e911943336 100644 (file)
@@ -31,6 +31,8 @@
 #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;