aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2009-10-28 07:01:46 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-28 07:01:46 -0400
commit516b4df1ce49304c188704decf60275c72d4cae1 (patch)
tree95b2653b5d08b249bf539da17306660aedf9db8e /drivers/net
parentea84e5555a56e2013687b19b012bcf959d601128 (diff)
via-velocity: Remove private device list
via-velocity maintains a list of its devices in order to determine whether a netdev notification applies to one of them. That can be determined simply by checking the netdev_ops pointer, so the list can be removed. Compile-tested only. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/via-velocity.c39
-rw-r--r--drivers/net/via-velocity.h2
2 files changed, 3 insertions, 38 deletions
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 144db6395c95..158f411bd555 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -364,11 +364,6 @@ static int rx_copybreak = 200;
364module_param(rx_copybreak, int, 0644); 364module_param(rx_copybreak, int, 0644);
365MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); 365MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
366 366
367#ifdef CONFIG_PM
368static DEFINE_SPINLOCK(velocity_dev_list_lock);
369static LIST_HEAD(velocity_dev_list);
370#endif
371
372/* 367/*
373 * Internal board variants. At the moment we have only one 368 * Internal board variants. At the moment we have only one
374 */ 369 */
@@ -417,14 +412,6 @@ static void __devexit velocity_remove1(struct pci_dev *pdev)
417 struct net_device *dev = pci_get_drvdata(pdev); 412 struct net_device *dev = pci_get_drvdata(pdev);
418 struct velocity_info *vptr = netdev_priv(dev); 413 struct velocity_info *vptr = netdev_priv(dev);
419 414
420#ifdef CONFIG_PM
421 unsigned long flags;
422
423 spin_lock_irqsave(&velocity_dev_list_lock, flags);
424 if (!list_empty(&velocity_dev_list))
425 list_del(&vptr->list);
426 spin_unlock_irqrestore(&velocity_dev_list_lock, flags);
427#endif
428 unregister_netdev(dev); 415 unregister_netdev(dev);
429 iounmap(vptr->mac_regs); 416 iounmap(vptr->mac_regs);
430 pci_release_regions(pdev); 417 pci_release_regions(pdev);
@@ -2577,7 +2564,6 @@ static void __devinit velocity_init_info(struct pci_dev *pdev,
2577 vptr->tx.numq = info->txqueue; 2564 vptr->tx.numq = info->txqueue;
2578 vptr->multicast_limit = MCAM_SIZE; 2565 vptr->multicast_limit = MCAM_SIZE;
2579 spin_lock_init(&vptr->lock); 2566 spin_lock_init(&vptr->lock);
2580 INIT_LIST_HEAD(&vptr->list);
2581} 2567}
2582 2568
2583/** 2569/**
@@ -2776,15 +2762,6 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi
2776 /* and leave the chip powered down */ 2762 /* and leave the chip powered down */
2777 2763
2778 pci_set_power_state(pdev, PCI_D3hot); 2764 pci_set_power_state(pdev, PCI_D3hot);
2779#ifdef CONFIG_PM
2780 {
2781 unsigned long flags;
2782
2783 spin_lock_irqsave(&velocity_dev_list_lock, flags);
2784 list_add(&vptr->list, &velocity_dev_list);
2785 spin_unlock_irqrestore(&velocity_dev_list_lock, flags);
2786 }
2787#endif
2788 velocity_nics++; 2765 velocity_nics++;
2789out: 2766out:
2790 return ret; 2767 return ret;
@@ -3240,20 +3217,10 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi
3240{ 3217{
3241 struct in_ifaddr *ifa = (struct in_ifaddr *) ptr; 3218 struct in_ifaddr *ifa = (struct in_ifaddr *) ptr;
3242 struct net_device *dev = ifa->ifa_dev->dev; 3219 struct net_device *dev = ifa->ifa_dev->dev;
3243 struct velocity_info *vptr;
3244 unsigned long flags;
3245 3220
3246 if (dev_net(dev) != &init_net) 3221 if (dev_net(dev) == &init_net &&
3247 return NOTIFY_DONE; 3222 dev->netdev_ops == &velocity_netdev_ops)
3248 3223 velocity_get_ip(netdev_priv(dev));
3249 spin_lock_irqsave(&velocity_dev_list_lock, flags);
3250 list_for_each_entry(vptr, &velocity_dev_list, list) {
3251 if (vptr->dev == dev) {
3252 velocity_get_ip(vptr);
3253 break;
3254 }
3255 }
3256 spin_unlock_irqrestore(&velocity_dev_list_lock, flags);
3257 3224
3258 return NOTIFY_DONE; 3225 return NOTIFY_DONE;
3259} 3226}
diff --git a/drivers/net/via-velocity.h b/drivers/net/via-velocity.h
index 2f00c13ab502..ce894ffa7c91 100644
--- a/drivers/net/via-velocity.h
+++ b/drivers/net/via-velocity.h
@@ -1499,8 +1499,6 @@ struct velocity_opt {
1499#define GET_RD_BY_IDX(vptr, idx) (vptr->rd_ring[idx]) 1499#define GET_RD_BY_IDX(vptr, idx) (vptr->rd_ring[idx])
1500 1500
1501struct velocity_info { 1501struct velocity_info {
1502 struct list_head list;
1503
1504 struct pci_dev *pdev; 1502 struct pci_dev *pdev;
1505 struct net_device *dev; 1503 struct net_device *dev;
1506 1504