Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

+13 -11
+11 -9
drivers/net/via-velocity.c
··· 229 229 module_param(rx_copybreak, int, 0644); 230 230 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); 231 231 232 - static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info); 232 + static void velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, 233 + const struct velocity_info_tbl *info); 233 234 static int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev); 234 235 static void velocity_print_info(struct velocity_info *vptr); 235 236 static int velocity_open(struct net_device *dev); ··· 295 294 * Internal board variants. At the moment we have only one 296 295 */ 297 296 298 - static struct velocity_info_tbl chip_info_table[] = { 299 - {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL}, 300 - {0, NULL} 297 + static const struct velocity_info_tbl chip_info_table[] __devinitdata = { 298 + {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL}, 299 + { } 301 300 }; 302 301 303 302 /* ··· 686 685 static int first = 1; 687 686 struct net_device *dev; 688 687 int i; 689 - struct velocity_info_tbl *info = &chip_info_table[ent->driver_data]; 688 + const struct velocity_info_tbl *info = &chip_info_table[ent->driver_data]; 690 689 struct velocity_info *vptr; 691 690 struct mac_regs __iomem * regs; 692 691 int ret = -ENOMEM; ··· 743 742 goto err_disable; 744 743 } 745 744 746 - regs = ioremap(vptr->memaddr, vptr->io_size); 745 + regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE); 747 746 if (regs == NULL) { 748 747 ret = -EIO; 749 748 goto err_release_res; ··· 861 860 * discovered. 862 861 */ 863 862 864 - static void __devinit velocity_init_info(struct pci_dev *pdev, struct velocity_info *vptr, struct velocity_info_tbl *info) 863 + static void __devinit velocity_init_info(struct pci_dev *pdev, 864 + struct velocity_info *vptr, 865 + const struct velocity_info_tbl *info) 865 866 { 866 867 memset(vptr, 0, sizeof(struct velocity_info)); 867 868 868 869 vptr->pdev = pdev; 869 870 vptr->chip_id = info->chip_id; 870 - vptr->io_size = info->io_size; 871 871 vptr->num_txq = info->txqueue; 872 872 vptr->multicast_limit = MCAM_SIZE; 873 873 spin_lock_init(&vptr->lock); ··· 906 904 return -EINVAL; 907 905 } 908 906 909 - if (pci_resource_len(pdev, 1) < 256) { 907 + if (pci_resource_len(pdev, 1) < VELOCITY_IO_SIZE) { 910 908 dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n"); 911 909 return -EINVAL; 912 910 }
+2 -2
drivers/net/via-velocity.h
··· 31 31 #define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver" 32 32 #define VELOCITY_VERSION "1.13" 33 33 34 + #define VELOCITY_IO_SIZE 256 35 + 34 36 #define PKT_BUF_SZ 1540 35 37 36 38 #define MAX_UNITS 8 ··· 1193 1191 struct velocity_info_tbl { 1194 1192 enum chip_type chip_id; 1195 1193 char *name; 1196 - int io_size; 1197 1194 int txqueue; 1198 1195 u32 flags; 1199 1196 }; ··· 1752 1751 struct mac_regs __iomem * mac_regs; 1753 1752 unsigned long memaddr; 1754 1753 unsigned long ioaddr; 1755 - u32 io_size; 1756 1754 1757 1755 u8 rev_id; 1758 1756