diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:38:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:38:14 -0500 |
commit | 4cf1653aa90c6320dc8032443b5e322820aa28b1 (patch) | |
tree | 7920008d3f953defdcda8c81d39da963290d93ad /drivers/net/epic100.c | |
parent | 454d7c9b14e20fd1949e2686e9de4a2926e01476 (diff) |
netdevice: safe convert to netdev_priv() #part-2
We have some reasons to kill netdev->priv:
1. netdev->priv is equal to netdev_priv().
2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
netdev_priv() is more flexible than netdev->priv.
But we cann't kill netdev->priv, because so many drivers reference to it
directly.
This patch is a safe convert for netdev->priv to netdev_priv(netdev).
Since all of the netdev->priv is only for read.
But it is too big to be sent in one mail.
I split it to 4 parts and make every part smaller than 100,000 bytes,
which is max size allowed by vger.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/epic100.c')
-rw-r--r-- | drivers/net/epic100.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 6f399bdc5f72..4a951b8cb4d7 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -371,7 +371,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
371 | #endif | 371 | #endif |
372 | 372 | ||
373 | pci_set_drvdata(pdev, dev); | 373 | pci_set_drvdata(pdev, dev); |
374 | ep = dev->priv; | 374 | ep = netdev_priv(dev); |
375 | ep->mii.dev = dev; | 375 | ep->mii.dev = dev; |
376 | ep->mii.mdio_read = mdio_read; | 376 | ep->mii.mdio_read = mdio_read; |
377 | ep->mii.mdio_write = mdio_write; | 377 | ep->mii.mdio_write = mdio_write; |
@@ -654,7 +654,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int value) | |||
654 | 654 | ||
655 | static int epic_open(struct net_device *dev) | 655 | static int epic_open(struct net_device *dev) |
656 | { | 656 | { |
657 | struct epic_private *ep = dev->priv; | 657 | struct epic_private *ep = netdev_priv(dev); |
658 | long ioaddr = dev->base_addr; | 658 | long ioaddr = dev->base_addr; |
659 | int i; | 659 | int i; |
660 | int retval; | 660 | int retval; |
@@ -766,7 +766,7 @@ static int epic_open(struct net_device *dev) | |||
766 | static void epic_pause(struct net_device *dev) | 766 | static void epic_pause(struct net_device *dev) |
767 | { | 767 | { |
768 | long ioaddr = dev->base_addr; | 768 | long ioaddr = dev->base_addr; |
769 | struct epic_private *ep = dev->priv; | 769 | struct epic_private *ep = netdev_priv(dev); |
770 | 770 | ||
771 | netif_stop_queue (dev); | 771 | netif_stop_queue (dev); |
772 | 772 | ||
@@ -789,7 +789,7 @@ static void epic_pause(struct net_device *dev) | |||
789 | static void epic_restart(struct net_device *dev) | 789 | static void epic_restart(struct net_device *dev) |
790 | { | 790 | { |
791 | long ioaddr = dev->base_addr; | 791 | long ioaddr = dev->base_addr; |
792 | struct epic_private *ep = dev->priv; | 792 | struct epic_private *ep = netdev_priv(dev); |
793 | int i; | 793 | int i; |
794 | 794 | ||
795 | /* Soft reset the chip. */ | 795 | /* Soft reset the chip. */ |
@@ -841,7 +841,7 @@ static void epic_restart(struct net_device *dev) | |||
841 | 841 | ||
842 | static void check_media(struct net_device *dev) | 842 | static void check_media(struct net_device *dev) |
843 | { | 843 | { |
844 | struct epic_private *ep = dev->priv; | 844 | struct epic_private *ep = netdev_priv(dev); |
845 | long ioaddr = dev->base_addr; | 845 | long ioaddr = dev->base_addr; |
846 | int mii_lpa = ep->mii_phy_cnt ? mdio_read(dev, ep->phys[0], MII_LPA) : 0; | 846 | int mii_lpa = ep->mii_phy_cnt ? mdio_read(dev, ep->phys[0], MII_LPA) : 0; |
847 | int negotiated = mii_lpa & ep->mii.advertising; | 847 | int negotiated = mii_lpa & ep->mii.advertising; |
@@ -863,7 +863,7 @@ static void check_media(struct net_device *dev) | |||
863 | static void epic_timer(unsigned long data) | 863 | static void epic_timer(unsigned long data) |
864 | { | 864 | { |
865 | struct net_device *dev = (struct net_device *)data; | 865 | struct net_device *dev = (struct net_device *)data; |
866 | struct epic_private *ep = dev->priv; | 866 | struct epic_private *ep = netdev_priv(dev); |
867 | long ioaddr = dev->base_addr; | 867 | long ioaddr = dev->base_addr; |
868 | int next_tick = 5*HZ; | 868 | int next_tick = 5*HZ; |
869 | 869 | ||
@@ -884,7 +884,7 @@ static void epic_timer(unsigned long data) | |||
884 | 884 | ||
885 | static void epic_tx_timeout(struct net_device *dev) | 885 | static void epic_tx_timeout(struct net_device *dev) |
886 | { | 886 | { |
887 | struct epic_private *ep = dev->priv; | 887 | struct epic_private *ep = netdev_priv(dev); |
888 | long ioaddr = dev->base_addr; | 888 | long ioaddr = dev->base_addr; |
889 | 889 | ||
890 | if (debug > 0) { | 890 | if (debug > 0) { |
@@ -913,7 +913,7 @@ static void epic_tx_timeout(struct net_device *dev) | |||
913 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ | 913 | /* Initialize the Rx and Tx rings, along with various 'dev' bits. */ |
914 | static void epic_init_ring(struct net_device *dev) | 914 | static void epic_init_ring(struct net_device *dev) |
915 | { | 915 | { |
916 | struct epic_private *ep = dev->priv; | 916 | struct epic_private *ep = netdev_priv(dev); |
917 | int i; | 917 | int i; |
918 | 918 | ||
919 | ep->tx_full = 0; | 919 | ep->tx_full = 0; |
@@ -959,7 +959,7 @@ static void epic_init_ring(struct net_device *dev) | |||
959 | 959 | ||
960 | static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) | 960 | static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) |
961 | { | 961 | { |
962 | struct epic_private *ep = dev->priv; | 962 | struct epic_private *ep = netdev_priv(dev); |
963 | int entry, free_count; | 963 | int entry, free_count; |
964 | u32 ctrl_word; | 964 | u32 ctrl_word; |
965 | unsigned long flags; | 965 | unsigned long flags; |
@@ -1087,7 +1087,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
1087 | static irqreturn_t epic_interrupt(int irq, void *dev_instance) | 1087 | static irqreturn_t epic_interrupt(int irq, void *dev_instance) |
1088 | { | 1088 | { |
1089 | struct net_device *dev = dev_instance; | 1089 | struct net_device *dev = dev_instance; |
1090 | struct epic_private *ep = dev->priv; | 1090 | struct epic_private *ep = netdev_priv(dev); |
1091 | long ioaddr = dev->base_addr; | 1091 | long ioaddr = dev->base_addr; |
1092 | unsigned int handled = 0; | 1092 | unsigned int handled = 0; |
1093 | int status; | 1093 | int status; |
@@ -1155,7 +1155,7 @@ out: | |||
1155 | 1155 | ||
1156 | static int epic_rx(struct net_device *dev, int budget) | 1156 | static int epic_rx(struct net_device *dev, int budget) |
1157 | { | 1157 | { |
1158 | struct epic_private *ep = dev->priv; | 1158 | struct epic_private *ep = netdev_priv(dev); |
1159 | int entry = ep->cur_rx % RX_RING_SIZE; | 1159 | int entry = ep->cur_rx % RX_RING_SIZE; |
1160 | int rx_work_limit = ep->dirty_rx + RX_RING_SIZE - ep->cur_rx; | 1160 | int rx_work_limit = ep->dirty_rx + RX_RING_SIZE - ep->cur_rx; |
1161 | int work_done = 0; | 1161 | int work_done = 0; |
@@ -1306,7 +1306,7 @@ rx_action: | |||
1306 | static int epic_close(struct net_device *dev) | 1306 | static int epic_close(struct net_device *dev) |
1307 | { | 1307 | { |
1308 | long ioaddr = dev->base_addr; | 1308 | long ioaddr = dev->base_addr; |
1309 | struct epic_private *ep = dev->priv; | 1309 | struct epic_private *ep = netdev_priv(dev); |
1310 | struct sk_buff *skb; | 1310 | struct sk_buff *skb; |
1311 | int i; | 1311 | int i; |
1312 | 1312 | ||
@@ -1356,7 +1356,7 @@ static int epic_close(struct net_device *dev) | |||
1356 | 1356 | ||
1357 | static struct net_device_stats *epic_get_stats(struct net_device *dev) | 1357 | static struct net_device_stats *epic_get_stats(struct net_device *dev) |
1358 | { | 1358 | { |
1359 | struct epic_private *ep = dev->priv; | 1359 | struct epic_private *ep = netdev_priv(dev); |
1360 | long ioaddr = dev->base_addr; | 1360 | long ioaddr = dev->base_addr; |
1361 | 1361 | ||
1362 | if (netif_running(dev)) { | 1362 | if (netif_running(dev)) { |
@@ -1377,7 +1377,7 @@ static struct net_device_stats *epic_get_stats(struct net_device *dev) | |||
1377 | static void set_rx_mode(struct net_device *dev) | 1377 | static void set_rx_mode(struct net_device *dev) |
1378 | { | 1378 | { |
1379 | long ioaddr = dev->base_addr; | 1379 | long ioaddr = dev->base_addr; |
1380 | struct epic_private *ep = dev->priv; | 1380 | struct epic_private *ep = netdev_priv(dev); |
1381 | unsigned char mc_filter[8]; /* Multicast hash filter */ | 1381 | unsigned char mc_filter[8]; /* Multicast hash filter */ |
1382 | int i; | 1382 | int i; |
1383 | 1383 | ||
@@ -1416,7 +1416,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1416 | 1416 | ||
1417 | static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) | 1417 | static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info) |
1418 | { | 1418 | { |
1419 | struct epic_private *np = dev->priv; | 1419 | struct epic_private *np = netdev_priv(dev); |
1420 | 1420 | ||
1421 | strcpy (info->driver, DRV_NAME); | 1421 | strcpy (info->driver, DRV_NAME); |
1422 | strcpy (info->version, DRV_VERSION); | 1422 | strcpy (info->version, DRV_VERSION); |
@@ -1425,7 +1425,7 @@ static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo * | |||
1425 | 1425 | ||
1426 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1426 | static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1427 | { | 1427 | { |
1428 | struct epic_private *np = dev->priv; | 1428 | struct epic_private *np = netdev_priv(dev); |
1429 | int rc; | 1429 | int rc; |
1430 | 1430 | ||
1431 | spin_lock_irq(&np->lock); | 1431 | spin_lock_irq(&np->lock); |
@@ -1437,7 +1437,7 @@ static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1437 | 1437 | ||
1438 | static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1438 | static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1439 | { | 1439 | { |
1440 | struct epic_private *np = dev->priv; | 1440 | struct epic_private *np = netdev_priv(dev); |
1441 | int rc; | 1441 | int rc; |
1442 | 1442 | ||
1443 | spin_lock_irq(&np->lock); | 1443 | spin_lock_irq(&np->lock); |
@@ -1449,13 +1449,13 @@ static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1449 | 1449 | ||
1450 | static int netdev_nway_reset(struct net_device *dev) | 1450 | static int netdev_nway_reset(struct net_device *dev) |
1451 | { | 1451 | { |
1452 | struct epic_private *np = dev->priv; | 1452 | struct epic_private *np = netdev_priv(dev); |
1453 | return mii_nway_restart(&np->mii); | 1453 | return mii_nway_restart(&np->mii); |
1454 | } | 1454 | } |
1455 | 1455 | ||
1456 | static u32 netdev_get_link(struct net_device *dev) | 1456 | static u32 netdev_get_link(struct net_device *dev) |
1457 | { | 1457 | { |
1458 | struct epic_private *np = dev->priv; | 1458 | struct epic_private *np = netdev_priv(dev); |
1459 | return mii_link_ok(&np->mii); | 1459 | return mii_link_ok(&np->mii); |
1460 | } | 1460 | } |
1461 | 1461 | ||
@@ -1504,7 +1504,7 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
1504 | 1504 | ||
1505 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1505 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1506 | { | 1506 | { |
1507 | struct epic_private *np = dev->priv; | 1507 | struct epic_private *np = netdev_priv(dev); |
1508 | long ioaddr = dev->base_addr; | 1508 | long ioaddr = dev->base_addr; |
1509 | struct mii_ioctl_data *data = if_mii(rq); | 1509 | struct mii_ioctl_data *data = if_mii(rq); |
1510 | int rc; | 1510 | int rc; |
@@ -1532,7 +1532,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1532 | static void __devexit epic_remove_one (struct pci_dev *pdev) | 1532 | static void __devexit epic_remove_one (struct pci_dev *pdev) |
1533 | { | 1533 | { |
1534 | struct net_device *dev = pci_get_drvdata(pdev); | 1534 | struct net_device *dev = pci_get_drvdata(pdev); |
1535 | struct epic_private *ep = dev->priv; | 1535 | struct epic_private *ep = netdev_priv(dev); |
1536 | 1536 | ||
1537 | pci_free_consistent(pdev, TX_TOTAL_SIZE, ep->tx_ring, ep->tx_ring_dma); | 1537 | pci_free_consistent(pdev, TX_TOTAL_SIZE, ep->tx_ring, ep->tx_ring_dma); |
1538 | pci_free_consistent(pdev, RX_TOTAL_SIZE, ep->rx_ring, ep->rx_ring_dma); | 1538 | pci_free_consistent(pdev, RX_TOTAL_SIZE, ep->rx_ring, ep->rx_ring_dma); |