提交 cabb7667 编写于 作者: J Jeff Garzik

[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: NJeff Garzik <jeff@garzik.org>
上级 e54f4893
...@@ -229,7 +229,8 @@ static int rx_copybreak = 200; ...@@ -229,7 +229,8 @@ static int rx_copybreak = 200;
module_param(rx_copybreak, int, 0644); module_param(rx_copybreak, int, 0644);
MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); 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 int velocity_get_pci_info(struct velocity_info *, struct pci_dev *pdev);
static void velocity_print_info(struct velocity_info *vptr); static void velocity_print_info(struct velocity_info *vptr);
static int velocity_open(struct net_device *dev); static int velocity_open(struct net_device *dev);
...@@ -294,9 +295,9 @@ static void velocity_unregister_notifier(void) ...@@ -294,9 +295,9 @@ static void velocity_unregister_notifier(void)
* Internal board variants. At the moment we have only one * Internal board variants. At the moment we have only one
*/ */
static struct velocity_info_tbl chip_info_table[] = { static const struct velocity_info_tbl chip_info_table[] __devinitdata = {
{CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 256, 1, 0x00FFFFFFUL}, {CHIP_TYPE_VT6110, "VIA Networking Velocity Family Gigabit Ethernet Adapter", 1, 0x00FFFFFFUL},
{0, NULL} { }
}; };
/* /*
...@@ -685,7 +686,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi ...@@ -685,7 +686,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
static int first = 1; static int first = 1;
struct net_device *dev; struct net_device *dev;
int i; 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 velocity_info *vptr;
struct mac_regs __iomem * regs; struct mac_regs __iomem * regs;
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -742,7 +743,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi ...@@ -742,7 +743,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
goto err_disable; goto err_disable;
} }
regs = ioremap(vptr->memaddr, vptr->io_size); regs = ioremap(vptr->memaddr, VELOCITY_IO_SIZE);
if (regs == NULL) { if (regs == NULL) {
ret = -EIO; ret = -EIO;
goto err_release_res; goto err_release_res;
...@@ -860,13 +861,14 @@ static void __devinit velocity_print_info(struct velocity_info *vptr) ...@@ -860,13 +861,14 @@ static void __devinit velocity_print_info(struct velocity_info *vptr)
* discovered. * 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)); memset(vptr, 0, sizeof(struct velocity_info));
vptr->pdev = pdev; vptr->pdev = pdev;
vptr->chip_id = info->chip_id; vptr->chip_id = info->chip_id;
vptr->io_size = info->io_size;
vptr->num_txq = info->txqueue; vptr->num_txq = info->txqueue;
vptr->multicast_limit = MCAM_SIZE; vptr->multicast_limit = MCAM_SIZE;
spin_lock_init(&vptr->lock); spin_lock_init(&vptr->lock);
...@@ -904,7 +906,7 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc ...@@ -904,7 +906,7 @@ static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pc
return -EINVAL; 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"); dev_printk(KERN_ERR, &pdev->dev, "region #1 is too small.\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver" #define VELOCITY_FULL_DRV_NAM "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"
#define VELOCITY_VERSION "1.13" #define VELOCITY_VERSION "1.13"
#define VELOCITY_IO_SIZE 256
#define PKT_BUF_SZ 1540 #define PKT_BUF_SZ 1540
#define MAX_UNITS 8 #define MAX_UNITS 8
...@@ -1191,7 +1193,6 @@ enum chip_type { ...@@ -1191,7 +1193,6 @@ enum chip_type {
struct velocity_info_tbl { struct velocity_info_tbl {
enum chip_type chip_id; enum chip_type chip_id;
char *name; char *name;
int io_size;
int txqueue; int txqueue;
u32 flags; u32 flags;
}; };
...@@ -1751,7 +1752,6 @@ struct velocity_info { ...@@ -1751,7 +1752,6 @@ struct velocity_info {
struct mac_regs __iomem * mac_regs; struct mac_regs __iomem * mac_regs;
unsigned long memaddr; unsigned long memaddr;
unsigned long ioaddr; unsigned long ioaddr;
u32 io_size;
u8 rev_id; u8 rev_id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册