From cabb7667dc150320ccd9d6f64fbd7a34766bc775 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 27 Jun 2006 09:25:28 -0400 Subject: [PATCH] [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 --- drivers/net/via-velocity.c | 20 +++++++++++--------- drivers/net/via-velocity.h | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 019dcf2457..7e3b2a3181 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -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; } diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h index f1b2640ebd..496c3d5974 100644 --- a/drivers/net/via-velocity.h +++ b/drivers/net/via-velocity.h @@ -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; -- 2.39.5