aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-06-27 09:25:28 -0400
committerJeff Garzik <jeff@garzik.org>2006-07-05 13:40:50 -0400
commitcabb7667dc150320ccd9d6f64fbd7a34766bc775 (patch)
treec28164566792d67370b77daf2b5a20bcf4763e98
parente54f48933f414fa447c26d16524a4c9a8e2facc6 (diff)
[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[]. Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/via-velocity.c20
-rw-r--r--drivers/net/via-velocity.h4
2 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 019dcf2457b4..7e3b2a318146 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -229,7 +229,8 @@ static int rx_copybreak = 200;
229module_param(rx_copybreak, int, 0644); 229module_param(rx_copybreak, int, 0644);
230MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); 230MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
231 231
232static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info); 232static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr,
233 const struct velocity_info_tbl *info);
233static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev); 234static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev);
234static void velocity_print_info(struct velocity_info *vptr); 235static void velocity_print_info(struct velocity_info *vptr);
235static int velocity_open(struct net_device *dev); 236static int velocity_open(struct net_device *dev);
@@ -294,9 +295,9 @@ static void velocity_unregister_notifier(void)
294 * Internal board variants. At the moment we have only one 295 * Internal board variants. At the moment we have only one
295 */ 296 */
296 297
297static struct velocity_info_tbl chip_info_table[] = { 298static const struct velocity_info_tbl chip_info_table[] __devinitdata = {
298 {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL}, 299 {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
299 {0, NULL} 300 { }
300}; 301};
301 302
302/* 303/*
@@ -685,7 +686,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
685 static int first = 1; 686 static int first = 1;
686 struct net_device *dev; 687 struct net_device *dev;
687 int i; 688 int i;
688 struct velocity_info_tbl *info = &chip_info_table[ent->driver_data]; 689 const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data];
689 struct velocity_info *vptr; 690 struct velocity_info *vptr;
690 struct mac_regs __iomem * regs; 691 struct mac_regs __iomem * regs;
691 int ret = -ENOMEM; 692 int ret = -ENOMEM;
@@ -742,7 +743,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
742 goto err_disable; 743 goto err_disable;
743 } 744 }
744 745
745 regs = ioremap(vptr->memaddr, vptr->io_size); 746 regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE);
746 if (regs == NULL) { 747 if (regs == NULL) {
747 ret = -EIO; 748 ret = -EIO;
748 goto err_release_res; 749 goto err_release_res;
@@ -860,13 +861,14 @@ static void __devinit velocity_print_info(struct velocity_info *vptr)
860 * discovered. 861 * discovered.
861 */ 862 */
862 863
863static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info) 864static void __devinit velocity_init_info(struct pci_dev *pdev,
865 struct velocity_info *vptr,
866 const struct velocity_info_tbl *info)
864{ 867{
865 memset(vptr, 0, sizeof(struct velocity_info)); 868 memset(vptr, 0, sizeof(struct velocity_info));
866 869
867 vptr->pdev = pdev; 870 vptr->pdev = pdev;
868 vptr->chip_id = info->chip_id; 871 vptr->chip_id = info->chip_id;
869 vptr->io_size = info->io_size;
870 vptr->num_txq = info->txqueue; 872 vptr->num_txq = info->txqueue;
871 vptr->multicast_limit = MCAM_SIZE; 873 vptr->multicast_limit = MCAM_SIZE;
872 spin_lock_init(&vptr->lock); 874 spin_lock_init(&vptr->lock);
@@ -904,7 +906,7 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc
904 return -EINVAL; 906 return -EINVAL;
905 } 907 }
906 908
907 if (pci_resource_len(pdev, 1) < 256) { 909 if (pci_resource_len(pdev, 1) < VELOCITY_IO_SIZE) {
908 dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n"); 910 dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n");
909 return -EINVAL; 911 return -EINVAL;
910 } 912 }
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index f1b2640ebdc6..496c3d597444 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -31,6 +31,8 @@
31#define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver" 31#define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"
32#define VELOCITY_VERSION "1.13" 32#define VELOCITY_VERSION "1.13"
33 33
34#define VELOCITY_IO_SIZE 256
35
34#define PKT_BUF_SZ 1540 36#define PKT_BUF_SZ 1540
35 37
36#define MAX_UNITS 8 38#define MAX_UNITS 8
@@ -1191,7 +1193,6 @@ enum chip_type {
1191struct velocity_info_tbl { 1193struct velocity_info_tbl {
1192 enum chip_type chip_id; 1194 enum chip_type chip_id;
1193 char *name; 1195 char *name;
1194 int io_size;
1195 int txqueue; 1196 int txqueue;
1196 u32 flags; 1197 u32 flags;
1197}; 1198};
@@ -1751,7 +1752,6 @@ struct velocity_info {
1751 struct mac_regs __iomem * mac_regs; 1752 struct mac_regs __iomem * mac_regs;
1752 unsigned long memaddr; 1753 unsigned long memaddr;
1753 unsigned long ioaddr; 1754 unsigned long ioaddr;
1754 u32 io_size;
1755 1755
1756 u8 rev_id; 1756 u8 rev_id;
1757 1757