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/ibmveth.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/ibmveth.c')
-rw-r--r-- | drivers/net/ibmveth.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 2c409570c5d8..02ecfdb4df6b 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -527,7 +527,7 @@ retry: | |||
527 | 527 | ||
528 | static int ibmveth_open(struct net_device *netdev) | 528 | static int ibmveth_open(struct net_device *netdev) |
529 | { | 529 | { |
530 | struct ibmveth_adapter *adapter = netdev->priv; | 530 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
531 | u64 mac_address = 0; | 531 | u64 mac_address = 0; |
532 | int rxq_entries = 1; | 532 | int rxq_entries = 1; |
533 | unsigned long lpar_rc; | 533 | unsigned long lpar_rc; |
@@ -666,7 +666,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
666 | 666 | ||
667 | static int ibmveth_close(struct net_device *netdev) | 667 | static int ibmveth_close(struct net_device *netdev) |
668 | { | 668 | { |
669 | struct ibmveth_adapter *adapter = netdev->priv; | 669 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
670 | long lpar_rc; | 670 | long lpar_rc; |
671 | 671 | ||
672 | ibmveth_debug_printk("close starting\n"); | 672 | ibmveth_debug_printk("close starting\n"); |
@@ -722,7 +722,7 @@ static u32 netdev_get_link(struct net_device *dev) { | |||
722 | 722 | ||
723 | static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data) | 723 | static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data) |
724 | { | 724 | { |
725 | struct ibmveth_adapter *adapter = dev->priv; | 725 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
726 | 726 | ||
727 | if (data) | 727 | if (data) |
728 | adapter->rx_csum = 1; | 728 | adapter->rx_csum = 1; |
@@ -741,7 +741,7 @@ static void ibmveth_set_rx_csum_flags(struct net_device *dev, u32 data) | |||
741 | 741 | ||
742 | static void ibmveth_set_tx_csum_flags(struct net_device *dev, u32 data) | 742 | static void ibmveth_set_tx_csum_flags(struct net_device *dev, u32 data) |
743 | { | 743 | { |
744 | struct ibmveth_adapter *adapter = dev->priv; | 744 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
745 | 745 | ||
746 | if (data) { | 746 | if (data) { |
747 | dev->features |= NETIF_F_IP_CSUM; | 747 | dev->features |= NETIF_F_IP_CSUM; |
@@ -753,7 +753,7 @@ static void ibmveth_set_tx_csum_flags(struct net_device *dev, u32 data) | |||
753 | static int ibmveth_set_csum_offload(struct net_device *dev, u32 data, | 753 | static int ibmveth_set_csum_offload(struct net_device *dev, u32 data, |
754 | void (*done) (struct net_device *, u32)) | 754 | void (*done) (struct net_device *, u32)) |
755 | { | 755 | { |
756 | struct ibmveth_adapter *adapter = dev->priv; | 756 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
757 | u64 set_attr, clr_attr, ret_attr; | 757 | u64 set_attr, clr_attr, ret_attr; |
758 | long ret; | 758 | long ret; |
759 | int rc1 = 0, rc2 = 0; | 759 | int rc1 = 0, rc2 = 0; |
@@ -805,7 +805,7 @@ static int ibmveth_set_csum_offload(struct net_device *dev, u32 data, | |||
805 | 805 | ||
806 | static int ibmveth_set_rx_csum(struct net_device *dev, u32 data) | 806 | static int ibmveth_set_rx_csum(struct net_device *dev, u32 data) |
807 | { | 807 | { |
808 | struct ibmveth_adapter *adapter = dev->priv; | 808 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
809 | 809 | ||
810 | if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum)) | 810 | if ((data && adapter->rx_csum) || (!data && !adapter->rx_csum)) |
811 | return 0; | 811 | return 0; |
@@ -815,7 +815,7 @@ static int ibmveth_set_rx_csum(struct net_device *dev, u32 data) | |||
815 | 815 | ||
816 | static int ibmveth_set_tx_csum(struct net_device *dev, u32 data) | 816 | static int ibmveth_set_tx_csum(struct net_device *dev, u32 data) |
817 | { | 817 | { |
818 | struct ibmveth_adapter *adapter = dev->priv; | 818 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
819 | int rc = 0; | 819 | int rc = 0; |
820 | 820 | ||
821 | if (data && (dev->features & NETIF_F_IP_CSUM)) | 821 | if (data && (dev->features & NETIF_F_IP_CSUM)) |
@@ -833,7 +833,7 @@ static int ibmveth_set_tx_csum(struct net_device *dev, u32 data) | |||
833 | 833 | ||
834 | static u32 ibmveth_get_rx_csum(struct net_device *dev) | 834 | static u32 ibmveth_get_rx_csum(struct net_device *dev) |
835 | { | 835 | { |
836 | struct ibmveth_adapter *adapter = dev->priv; | 836 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
837 | return adapter->rx_csum; | 837 | return adapter->rx_csum; |
838 | } | 838 | } |
839 | 839 | ||
@@ -862,7 +862,7 @@ static void ibmveth_get_ethtool_stats(struct net_device *dev, | |||
862 | struct ethtool_stats *stats, u64 *data) | 862 | struct ethtool_stats *stats, u64 *data) |
863 | { | 863 | { |
864 | int i; | 864 | int i; |
865 | struct ibmveth_adapter *adapter = dev->priv; | 865 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
866 | 866 | ||
867 | for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++) | 867 | for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++) |
868 | data[i] = IBMVETH_GET_STAT(adapter, ibmveth_stats[i].offset); | 868 | data[i] = IBMVETH_GET_STAT(adapter, ibmveth_stats[i].offset); |
@@ -889,7 +889,7 @@ static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
889 | 889 | ||
890 | static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) | 890 | static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev) |
891 | { | 891 | { |
892 | struct ibmveth_adapter *adapter = netdev->priv; | 892 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
893 | union ibmveth_buf_desc desc; | 893 | union ibmveth_buf_desc desc; |
894 | unsigned long lpar_rc; | 894 | unsigned long lpar_rc; |
895 | unsigned long correlator; | 895 | unsigned long correlator; |
@@ -1044,7 +1044,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) | |||
1044 | static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance) | 1044 | static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance) |
1045 | { | 1045 | { |
1046 | struct net_device *netdev = dev_instance; | 1046 | struct net_device *netdev = dev_instance; |
1047 | struct ibmveth_adapter *adapter = netdev->priv; | 1047 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
1048 | unsigned long lpar_rc; | 1048 | unsigned long lpar_rc; |
1049 | 1049 | ||
1050 | if (netif_rx_schedule_prep(netdev, &adapter->napi)) { | 1050 | if (netif_rx_schedule_prep(netdev, &adapter->napi)) { |
@@ -1058,7 +1058,7 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance) | |||
1058 | 1058 | ||
1059 | static void ibmveth_set_multicast_list(struct net_device *netdev) | 1059 | static void ibmveth_set_multicast_list(struct net_device *netdev) |
1060 | { | 1060 | { |
1061 | struct ibmveth_adapter *adapter = netdev->priv; | 1061 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
1062 | unsigned long lpar_rc; | 1062 | unsigned long lpar_rc; |
1063 | 1063 | ||
1064 | if((netdev->flags & IFF_PROMISC) || (netdev->mc_count > adapter->mcastFilterSize)) { | 1064 | if((netdev->flags & IFF_PROMISC) || (netdev->mc_count > adapter->mcastFilterSize)) { |
@@ -1106,7 +1106,7 @@ static void ibmveth_set_multicast_list(struct net_device *netdev) | |||
1106 | 1106 | ||
1107 | static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | 1107 | static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) |
1108 | { | 1108 | { |
1109 | struct ibmveth_adapter *adapter = dev->priv; | 1109 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
1110 | struct vio_dev *viodev = adapter->vdev; | 1110 | struct vio_dev *viodev = adapter->vdev; |
1111 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; | 1111 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; |
1112 | int i; | 1112 | int i; |
@@ -1158,7 +1158,7 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | |||
1158 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1158 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1159 | static void ibmveth_poll_controller(struct net_device *dev) | 1159 | static void ibmveth_poll_controller(struct net_device *dev) |
1160 | { | 1160 | { |
1161 | ibmveth_replenish_task(dev->priv); | 1161 | ibmveth_replenish_task(netdev_priv(dev)); |
1162 | ibmveth_interrupt(dev->irq, dev); | 1162 | ibmveth_interrupt(dev->irq, dev); |
1163 | } | 1163 | } |
1164 | #endif | 1164 | #endif |
@@ -1240,7 +1240,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
1240 | if(!netdev) | 1240 | if(!netdev) |
1241 | return -ENOMEM; | 1241 | return -ENOMEM; |
1242 | 1242 | ||
1243 | adapter = netdev->priv; | 1243 | adapter = netdev_priv(netdev); |
1244 | dev->dev.driver_data = netdev; | 1244 | dev->dev.driver_data = netdev; |
1245 | 1245 | ||
1246 | adapter->vdev = dev; | 1246 | adapter->vdev = dev; |
@@ -1336,7 +1336,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_ | |||
1336 | static int __devexit ibmveth_remove(struct vio_dev *dev) | 1336 | static int __devexit ibmveth_remove(struct vio_dev *dev) |
1337 | { | 1337 | { |
1338 | struct net_device *netdev = dev->dev.driver_data; | 1338 | struct net_device *netdev = dev->dev.driver_data; |
1339 | struct ibmveth_adapter *adapter = netdev->priv; | 1339 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
1340 | int i; | 1340 | int i; |
1341 | 1341 | ||
1342 | for(i = 0; i<IbmVethNumBufferPools; i++) | 1342 | for(i = 0; i<IbmVethNumBufferPools; i++) |
@@ -1470,7 +1470,7 @@ const char * buf, size_t count) | |||
1470 | kobj); | 1470 | kobj); |
1471 | struct net_device *netdev = | 1471 | struct net_device *netdev = |
1472 | container_of(kobj->parent, struct device, kobj)->driver_data; | 1472 | container_of(kobj->parent, struct device, kobj)->driver_data; |
1473 | struct ibmveth_adapter *adapter = netdev->priv; | 1473 | struct ibmveth_adapter *adapter = netdev_priv(netdev); |
1474 | long value = simple_strtol(buf, NULL, 10); | 1474 | long value = simple_strtol(buf, NULL, 10); |
1475 | long rc; | 1475 | long rc; |
1476 | 1476 | ||