diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:38:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:38:36 -0500 |
commit | 8f15ea42b64941001a401cf855a0869e24f3a845 (patch) | |
tree | 27c7534ad70ebda6986491daeac0ebe0f1ca54ed /drivers/net/tulip | |
parent | 4cf1653aa90c6320dc8032443b5e322820aa28b1 (diff) |
netdevice: safe convert to netdev_priv() #part-3
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/tulip')
-rw-r--r-- | drivers/net/tulip/de2104x.c | 44 | ||||
-rw-r--r-- | drivers/net/tulip/eeprom.c | 2 | ||||
-rw-r--r-- | drivers/net/tulip/uli526x.c | 2 |
3 files changed, 24 insertions, 24 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index e23a5084c6ca..3aa60fad68c7 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -483,7 +483,7 @@ rx_next: | |||
483 | static irqreturn_t de_interrupt (int irq, void *dev_instance) | 483 | static irqreturn_t de_interrupt (int irq, void *dev_instance) |
484 | { | 484 | { |
485 | struct net_device *dev = dev_instance; | 485 | struct net_device *dev = dev_instance; |
486 | struct de_private *de = dev->priv; | 486 | struct de_private *de = netdev_priv(dev); |
487 | u32 status; | 487 | u32 status; |
488 | 488 | ||
489 | status = dr32(MacStatus); | 489 | status = dr32(MacStatus); |
@@ -589,7 +589,7 @@ next: | |||
589 | 589 | ||
590 | static int de_start_xmit (struct sk_buff *skb, struct net_device *dev) | 590 | static int de_start_xmit (struct sk_buff *skb, struct net_device *dev) |
591 | { | 591 | { |
592 | struct de_private *de = dev->priv; | 592 | struct de_private *de = netdev_priv(dev); |
593 | unsigned int entry, tx_free; | 593 | unsigned int entry, tx_free; |
594 | u32 mapping, len, flags = FirstFrag | LastFrag; | 594 | u32 mapping, len, flags = FirstFrag | LastFrag; |
595 | struct de_desc *txd; | 595 | struct de_desc *txd; |
@@ -652,7 +652,7 @@ static int de_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
652 | 652 | ||
653 | static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) | 653 | static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) |
654 | { | 654 | { |
655 | struct de_private *de = dev->priv; | 655 | struct de_private *de = netdev_priv(dev); |
656 | u16 hash_table[32]; | 656 | u16 hash_table[32]; |
657 | struct dev_mc_list *mclist; | 657 | struct dev_mc_list *mclist; |
658 | int i; | 658 | int i; |
@@ -683,7 +683,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev) | |||
683 | 683 | ||
684 | static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) | 684 | static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) |
685 | { | 685 | { |
686 | struct de_private *de = dev->priv; | 686 | struct de_private *de = netdev_priv(dev); |
687 | struct dev_mc_list *mclist; | 687 | struct dev_mc_list *mclist; |
688 | int i; | 688 | int i; |
689 | u16 *eaddrs; | 689 | u16 *eaddrs; |
@@ -711,7 +711,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev) | |||
711 | 711 | ||
712 | static void __de_set_rx_mode (struct net_device *dev) | 712 | static void __de_set_rx_mode (struct net_device *dev) |
713 | { | 713 | { |
714 | struct de_private *de = dev->priv; | 714 | struct de_private *de = netdev_priv(dev); |
715 | u32 macmode; | 715 | u32 macmode; |
716 | unsigned int entry; | 716 | unsigned int entry; |
717 | u32 mapping; | 717 | u32 mapping; |
@@ -796,7 +796,7 @@ out: | |||
796 | static void de_set_rx_mode (struct net_device *dev) | 796 | static void de_set_rx_mode (struct net_device *dev) |
797 | { | 797 | { |
798 | unsigned long flags; | 798 | unsigned long flags; |
799 | struct de_private *de = dev->priv; | 799 | struct de_private *de = netdev_priv(dev); |
800 | 800 | ||
801 | spin_lock_irqsave (&de->lock, flags); | 801 | spin_lock_irqsave (&de->lock, flags); |
802 | __de_set_rx_mode(dev); | 802 | __de_set_rx_mode(dev); |
@@ -820,7 +820,7 @@ static void __de_get_stats(struct de_private *de) | |||
820 | 820 | ||
821 | static struct net_device_stats *de_get_stats(struct net_device *dev) | 821 | static struct net_device_stats *de_get_stats(struct net_device *dev) |
822 | { | 822 | { |
823 | struct de_private *de = dev->priv; | 823 | struct de_private *de = netdev_priv(dev); |
824 | 824 | ||
825 | /* The chip only need report frame silently dropped. */ | 825 | /* The chip only need report frame silently dropped. */ |
826 | spin_lock_irq(&de->lock); | 826 | spin_lock_irq(&de->lock); |
@@ -1354,7 +1354,7 @@ static void de_free_rings (struct de_private *de) | |||
1354 | 1354 | ||
1355 | static int de_open (struct net_device *dev) | 1355 | static int de_open (struct net_device *dev) |
1356 | { | 1356 | { |
1357 | struct de_private *de = dev->priv; | 1357 | struct de_private *de = netdev_priv(dev); |
1358 | int rc; | 1358 | int rc; |
1359 | 1359 | ||
1360 | if (netif_msg_ifup(de)) | 1360 | if (netif_msg_ifup(de)) |
@@ -1399,7 +1399,7 @@ err_out_free: | |||
1399 | 1399 | ||
1400 | static int de_close (struct net_device *dev) | 1400 | static int de_close (struct net_device *dev) |
1401 | { | 1401 | { |
1402 | struct de_private *de = dev->priv; | 1402 | struct de_private *de = netdev_priv(dev); |
1403 | unsigned long flags; | 1403 | unsigned long flags; |
1404 | 1404 | ||
1405 | if (netif_msg_ifdown(de)) | 1405 | if (netif_msg_ifdown(de)) |
@@ -1422,7 +1422,7 @@ static int de_close (struct net_device *dev) | |||
1422 | 1422 | ||
1423 | static void de_tx_timeout (struct net_device *dev) | 1423 | static void de_tx_timeout (struct net_device *dev) |
1424 | { | 1424 | { |
1425 | struct de_private *de = dev->priv; | 1425 | struct de_private *de = netdev_priv(dev); |
1426 | 1426 | ||
1427 | printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", | 1427 | printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", |
1428 | dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), | 1428 | dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), |
@@ -1573,7 +1573,7 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd) | |||
1573 | 1573 | ||
1574 | static void de_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) | 1574 | static void de_get_drvinfo (struct net_device *dev,struct ethtool_drvinfo *info) |
1575 | { | 1575 | { |
1576 | struct de_private *de = dev->priv; | 1576 | struct de_private *de = netdev_priv(dev); |
1577 | 1577 | ||
1578 | strcpy (info->driver, DRV_NAME); | 1578 | strcpy (info->driver, DRV_NAME); |
1579 | strcpy (info->version, DRV_VERSION); | 1579 | strcpy (info->version, DRV_VERSION); |
@@ -1588,7 +1588,7 @@ static int de_get_regs_len(struct net_device *dev) | |||
1588 | 1588 | ||
1589 | static int de_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1589 | static int de_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
1590 | { | 1590 | { |
1591 | struct de_private *de = dev->priv; | 1591 | struct de_private *de = netdev_priv(dev); |
1592 | int rc; | 1592 | int rc; |
1593 | 1593 | ||
1594 | spin_lock_irq(&de->lock); | 1594 | spin_lock_irq(&de->lock); |
@@ -1600,7 +1600,7 @@ static int de_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1600 | 1600 | ||
1601 | static int de_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 1601 | static int de_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
1602 | { | 1602 | { |
1603 | struct de_private *de = dev->priv; | 1603 | struct de_private *de = netdev_priv(dev); |
1604 | int rc; | 1604 | int rc; |
1605 | 1605 | ||
1606 | spin_lock_irq(&de->lock); | 1606 | spin_lock_irq(&de->lock); |
@@ -1612,14 +1612,14 @@ static int de_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
1612 | 1612 | ||
1613 | static u32 de_get_msglevel(struct net_device *dev) | 1613 | static u32 de_get_msglevel(struct net_device *dev) |
1614 | { | 1614 | { |
1615 | struct de_private *de = dev->priv; | 1615 | struct de_private *de = netdev_priv(dev); |
1616 | 1616 | ||
1617 | return de->msg_enable; | 1617 | return de->msg_enable; |
1618 | } | 1618 | } |
1619 | 1619 | ||
1620 | static void de_set_msglevel(struct net_device *dev, u32 msglvl) | 1620 | static void de_set_msglevel(struct net_device *dev, u32 msglvl) |
1621 | { | 1621 | { |
1622 | struct de_private *de = dev->priv; | 1622 | struct de_private *de = netdev_priv(dev); |
1623 | 1623 | ||
1624 | de->msg_enable = msglvl; | 1624 | de->msg_enable = msglvl; |
1625 | } | 1625 | } |
@@ -1627,7 +1627,7 @@ static void de_set_msglevel(struct net_device *dev, u32 msglvl) | |||
1627 | static int de_get_eeprom(struct net_device *dev, | 1627 | static int de_get_eeprom(struct net_device *dev, |
1628 | struct ethtool_eeprom *eeprom, u8 *data) | 1628 | struct ethtool_eeprom *eeprom, u8 *data) |
1629 | { | 1629 | { |
1630 | struct de_private *de = dev->priv; | 1630 | struct de_private *de = netdev_priv(dev); |
1631 | 1631 | ||
1632 | if (!de->ee_data) | 1632 | if (!de->ee_data) |
1633 | return -EOPNOTSUPP; | 1633 | return -EOPNOTSUPP; |
@@ -1641,7 +1641,7 @@ static int de_get_eeprom(struct net_device *dev, | |||
1641 | 1641 | ||
1642 | static int de_nway_reset(struct net_device *dev) | 1642 | static int de_nway_reset(struct net_device *dev) |
1643 | { | 1643 | { |
1644 | struct de_private *de = dev->priv; | 1644 | struct de_private *de = netdev_priv(dev); |
1645 | u32 status; | 1645 | u32 status; |
1646 | 1646 | ||
1647 | if (de->media_type != DE_MEDIA_TP_AUTO) | 1647 | if (de->media_type != DE_MEDIA_TP_AUTO) |
@@ -1660,7 +1660,7 @@ static int de_nway_reset(struct net_device *dev) | |||
1660 | static void de_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 1660 | static void de_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
1661 | void *data) | 1661 | void *data) |
1662 | { | 1662 | { |
1663 | struct de_private *de = dev->priv; | 1663 | struct de_private *de = netdev_priv(dev); |
1664 | 1664 | ||
1665 | regs->version = (DE_REGS_VER << 2) | de->de21040; | 1665 | regs->version = (DE_REGS_VER << 2) | de->de21040; |
1666 | 1666 | ||
@@ -1954,7 +1954,7 @@ static int __devinit de_init_one (struct pci_dev *pdev, | |||
1954 | dev->tx_timeout = de_tx_timeout; | 1954 | dev->tx_timeout = de_tx_timeout; |
1955 | dev->watchdog_timeo = TX_TIMEOUT; | 1955 | dev->watchdog_timeo = TX_TIMEOUT; |
1956 | 1956 | ||
1957 | de = dev->priv; | 1957 | de = netdev_priv(dev); |
1958 | de->de21040 = ent->driver_data == 0 ? 1 : 0; | 1958 | de->de21040 = ent->driver_data == 0 ? 1 : 0; |
1959 | de->pdev = pdev; | 1959 | de->pdev = pdev; |
1960 | de->dev = dev; | 1960 | de->dev = dev; |
@@ -2076,7 +2076,7 @@ err_out_free: | |||
2076 | static void __devexit de_remove_one (struct pci_dev *pdev) | 2076 | static void __devexit de_remove_one (struct pci_dev *pdev) |
2077 | { | 2077 | { |
2078 | struct net_device *dev = pci_get_drvdata(pdev); | 2078 | struct net_device *dev = pci_get_drvdata(pdev); |
2079 | struct de_private *de = dev->priv; | 2079 | struct de_private *de = netdev_priv(dev); |
2080 | 2080 | ||
2081 | BUG_ON(!dev); | 2081 | BUG_ON(!dev); |
2082 | unregister_netdev(dev); | 2082 | unregister_netdev(dev); |
@@ -2093,7 +2093,7 @@ static void __devexit de_remove_one (struct pci_dev *pdev) | |||
2093 | static int de_suspend (struct pci_dev *pdev, pm_message_t state) | 2093 | static int de_suspend (struct pci_dev *pdev, pm_message_t state) |
2094 | { | 2094 | { |
2095 | struct net_device *dev = pci_get_drvdata (pdev); | 2095 | struct net_device *dev = pci_get_drvdata (pdev); |
2096 | struct de_private *de = dev->priv; | 2096 | struct de_private *de = netdev_priv(dev); |
2097 | 2097 | ||
2098 | rtnl_lock(); | 2098 | rtnl_lock(); |
2099 | if (netif_running (dev)) { | 2099 | if (netif_running (dev)) { |
@@ -2128,7 +2128,7 @@ static int de_suspend (struct pci_dev *pdev, pm_message_t state) | |||
2128 | static int de_resume (struct pci_dev *pdev) | 2128 | static int de_resume (struct pci_dev *pdev) |
2129 | { | 2129 | { |
2130 | struct net_device *dev = pci_get_drvdata (pdev); | 2130 | struct net_device *dev = pci_get_drvdata (pdev); |
2131 | struct de_private *de = dev->priv; | 2131 | struct de_private *de = netdev_priv(dev); |
2132 | int retval = 0; | 2132 | int retval = 0; |
2133 | 2133 | ||
2134 | rtnl_lock(); | 2134 | rtnl_lock(); |
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c index 0dcced1263b9..391acd32a6a5 100644 --- a/drivers/net/tulip/eeprom.c +++ b/drivers/net/tulip/eeprom.c | |||
@@ -337,7 +337,7 @@ int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_l | |||
337 | { | 337 | { |
338 | int i; | 338 | int i; |
339 | unsigned retval = 0; | 339 | unsigned retval = 0; |
340 | struct tulip_private *tp = dev->priv; | 340 | struct tulip_private *tp = netdev_priv(dev); |
341 | void __iomem *ee_addr = tp->base_addr + CSR9; | 341 | void __iomem *ee_addr = tp->base_addr + CSR9; |
342 | int read_cmd = location | (EE_READ_CMD << addr_len); | 342 | int read_cmd = location | (EE_READ_CMD << addr_len); |
343 | 343 | ||
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 35c57f6e630b..00cbc5251dcc 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c | |||
@@ -890,7 +890,7 @@ static struct net_device_stats * uli526x_get_stats(struct net_device *dev) | |||
890 | 890 | ||
891 | static void uli526x_set_filter_mode(struct net_device * dev) | 891 | static void uli526x_set_filter_mode(struct net_device * dev) |
892 | { | 892 | { |
893 | struct uli526x_board_info *db = dev->priv; | 893 | struct uli526x_board_info *db = netdev_priv(dev); |
894 | unsigned long flags; | 894 | unsigned long flags; |
895 | 895 | ||
896 | ULI526X_DBUG(0, "uli526x_set_filter_mode()", 0); | 896 | ULI526X_DBUG(0, "uli526x_set_filter_mode()", 0); |