aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tehuti.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-11-13 02:38:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-13 02:38:36 -0500
commit8f15ea42b64941001a401cf855a0869e24f3a845 (patch)
tree27c7534ad70ebda6986491daeac0ebe0f1ca54ed /drivers/net/tehuti.c
parent4cf1653aa90c6320dc8032443b5e322820aa28b1 (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/tehuti.c')
-rw-r--r--drivers/net/tehuti.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 30d5065f8166..7e36a10423f9 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -251,7 +251,7 @@ static void bdx_isr_extra(struct bdx_priv *priv, u32 isr)
251static irqreturn_t bdx_isr_napi(int irq, void *dev) 251static irqreturn_t bdx_isr_napi(int irq, void *dev)
252{ 252{
253 struct net_device *ndev = dev; 253 struct net_device *ndev = dev;
254 struct bdx_priv *priv = ndev->priv; 254 struct bdx_priv *priv = netdev_priv(ndev);
255 u32 isr; 255 u32 isr;
256 256
257 ENTER; 257 ENTER;
@@ -559,7 +559,7 @@ static int bdx_close(struct net_device *ndev)
559 struct bdx_priv *priv = NULL; 559 struct bdx_priv *priv = NULL;
560 560
561 ENTER; 561 ENTER;
562 priv = ndev->priv; 562 priv = netdev_priv(ndev);
563 563
564 napi_disable(&priv->napi); 564 napi_disable(&priv->napi);
565 565
@@ -588,7 +588,7 @@ static int bdx_open(struct net_device *ndev)
588 int rc; 588 int rc;
589 589
590 ENTER; 590 ENTER;
591 priv = ndev->priv; 591 priv = netdev_priv(ndev);
592 bdx_reset(priv); 592 bdx_reset(priv);
593 if (netif_running(ndev)) 593 if (netif_running(ndev))
594 netif_stop_queue(priv->ndev); 594 netif_stop_queue(priv->ndev);
@@ -633,7 +633,7 @@ static int bdx_range_check(struct bdx_priv *priv, u32 offset)
633 633
634static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) 634static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
635{ 635{
636 struct bdx_priv *priv = ndev->priv; 636 struct bdx_priv *priv = netdev_priv(ndev);
637 u32 data[3]; 637 u32 data[3];
638 int error; 638 int error;
639 639
@@ -698,7 +698,7 @@ static int bdx_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
698 */ 698 */
699static void __bdx_vlan_rx_vid(struct net_device *ndev, uint16_t vid, int enable) 699static void __bdx_vlan_rx_vid(struct net_device *ndev, uint16_t vid, int enable)
700{ 700{
701 struct bdx_priv *priv = ndev->priv; 701 struct bdx_priv *priv = netdev_priv(ndev);
702 u32 reg, bit, val; 702 u32 reg, bit, val;
703 703
704 ENTER; 704 ENTER;
@@ -748,7 +748,7 @@ static void bdx_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid)
748static void 748static void
749bdx_vlan_rx_register(struct net_device *ndev, struct vlan_group *grp) 749bdx_vlan_rx_register(struct net_device *ndev, struct vlan_group *grp)
750{ 750{
751 struct bdx_priv *priv = ndev->priv; 751 struct bdx_priv *priv = netdev_priv(ndev);
752 752
753 ENTER; 753 ENTER;
754 DBG("device='%s', group='%p'\n", ndev->name, grp); 754 DBG("device='%s', group='%p'\n", ndev->name, grp);
@@ -787,7 +787,7 @@ static int bdx_change_mtu(struct net_device *ndev, int new_mtu)
787 787
788static void bdx_setmulti(struct net_device *ndev) 788static void bdx_setmulti(struct net_device *ndev)
789{ 789{
790 struct bdx_priv *priv = ndev->priv; 790 struct bdx_priv *priv = netdev_priv(ndev);
791 791
792 u32 rxf_val = 792 u32 rxf_val =
793 GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB | GMAC_RX_FILTER_OSEN; 793 GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB | GMAC_RX_FILTER_OSEN;
@@ -847,7 +847,7 @@ static void bdx_setmulti(struct net_device *ndev)
847 847
848static int bdx_set_mac(struct net_device *ndev, void *p) 848static int bdx_set_mac(struct net_device *ndev, void *p)
849{ 849{
850 struct bdx_priv *priv = ndev->priv; 850 struct bdx_priv *priv = netdev_priv(ndev);
851 struct sockaddr *addr = p; 851 struct sockaddr *addr = p;
852 852
853 ENTER; 853 ENTER;
@@ -929,7 +929,7 @@ static void bdx_update_stats(struct bdx_priv *priv)
929 929
930static struct net_device_stats *bdx_get_stats(struct net_device *ndev) 930static struct net_device_stats *bdx_get_stats(struct net_device *ndev)
931{ 931{
932 struct bdx_priv *priv = ndev->priv; 932 struct bdx_priv *priv = netdev_priv(ndev);
933 struct net_device_stats *net_stat = &priv->net_stats; 933 struct net_device_stats *net_stat = &priv->net_stats;
934 return net_stat; 934 return net_stat;
935} 935}
@@ -1623,7 +1623,7 @@ static inline int bdx_tx_space(struct bdx_priv *priv)
1623 */ 1623 */
1624static int bdx_tx_transmit(struct sk_buff *skb, struct net_device *ndev) 1624static int bdx_tx_transmit(struct sk_buff *skb, struct net_device *ndev)
1625{ 1625{
1626 struct bdx_priv *priv = ndev->priv; 1626 struct bdx_priv *priv = netdev_priv(ndev);
1627 struct txd_fifo *f = &priv->txd_fifo0; 1627 struct txd_fifo *f = &priv->txd_fifo0;
1628 int txd_checksum = 7; /* full checksum */ 1628 int txd_checksum = 7; /* full checksum */
1629 int txd_lgsnd = 0; 1629 int txd_lgsnd = 0;
@@ -2026,7 +2026,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2026 ndev->features |= NETIF_F_HIGHDMA; 2026 ndev->features |= NETIF_F_HIGHDMA;
2027 2027
2028 /************** priv ****************/ 2028 /************** priv ****************/
2029 priv = nic->priv[port] = ndev->priv; 2029 priv = nic->priv[port] = netdev_priv(ndev);
2030 2030
2031 memset(priv, 0, sizeof(struct bdx_priv)); 2031 memset(priv, 0, sizeof(struct bdx_priv));
2032 priv->pBdxRegs = nic->regs + port * 0x8000; 2032 priv->pBdxRegs = nic->regs + port * 0x8000;
@@ -2149,7 +2149,7 @@ static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
2149{ 2149{
2150 u32 rdintcm; 2150 u32 rdintcm;
2151 u32 tdintcm; 2151 u32 tdintcm;
2152 struct bdx_priv *priv = netdev->priv; 2152 struct bdx_priv *priv = netdev_priv(netdev);
2153 2153
2154 rdintcm = priv->rdintcm; 2154 rdintcm = priv->rdintcm;
2155 tdintcm = priv->tdintcm; 2155 tdintcm = priv->tdintcm;
@@ -2180,7 +2180,7 @@ static int bdx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
2180static void 2180static void
2181bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) 2181bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
2182{ 2182{
2183 struct bdx_priv *priv = netdev->priv; 2183 struct bdx_priv *priv = netdev_priv(netdev);
2184 2184
2185 strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver)); 2185 strlcat(drvinfo->driver, BDX_DRV_NAME, sizeof(drvinfo->driver));
2186 strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version)); 2186 strlcat(drvinfo->version, BDX_DRV_VERSION, sizeof(drvinfo->version));
@@ -2222,7 +2222,7 @@ bdx_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *ecoal)
2222{ 2222{
2223 u32 rdintcm; 2223 u32 rdintcm;
2224 u32 tdintcm; 2224 u32 tdintcm;
2225 struct bdx_priv *priv = netdev->priv; 2225 struct bdx_priv *priv = netdev_priv(netdev);
2226 2226
2227 rdintcm = priv->rdintcm; 2227 rdintcm = priv->rdintcm;
2228 tdintcm = priv->tdintcm; 2228 tdintcm = priv->tdintcm;
@@ -2251,7 +2251,7 @@ bdx_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ecoal)
2251{ 2251{
2252 u32 rdintcm; 2252 u32 rdintcm;
2253 u32 tdintcm; 2253 u32 tdintcm;
2254 struct bdx_priv *priv = netdev->priv; 2254 struct bdx_priv *priv = netdev_priv(netdev);
2255 int rx_coal; 2255 int rx_coal;
2256 int tx_coal; 2256 int tx_coal;
2257 int rx_max_coal; 2257 int rx_max_coal;
@@ -2309,7 +2309,7 @@ static inline int bdx_tx_fifo_size_to_packets(int tx_size)
2309static void 2309static void
2310bdx_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) 2310bdx_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
2311{ 2311{
2312 struct bdx_priv *priv = netdev->priv; 2312 struct bdx_priv *priv = netdev_priv(netdev);
2313 2313
2314 /*max_pending - the maximum-sized FIFO we allow */ 2314 /*max_pending - the maximum-sized FIFO we allow */
2315 ring->rx_max_pending = bdx_rx_fifo_size_to_packets(3); 2315 ring->rx_max_pending = bdx_rx_fifo_size_to_packets(3);
@@ -2326,7 +2326,7 @@ bdx_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
2326static int 2326static int
2327bdx_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) 2327bdx_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
2328{ 2328{
2329 struct bdx_priv *priv = netdev->priv; 2329 struct bdx_priv *priv = netdev_priv(netdev);
2330 int rx_size = 0; 2330 int rx_size = 0;
2331 int tx_size = 0; 2331 int tx_size = 0;
2332 2332
@@ -2387,7 +2387,7 @@ static void bdx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
2387 */ 2387 */
2388static int bdx_get_stats_count(struct net_device *netdev) 2388static int bdx_get_stats_count(struct net_device *netdev)
2389{ 2389{
2390 struct bdx_priv *priv = netdev->priv; 2390 struct bdx_priv *priv = netdev_priv(netdev);
2391 BDX_ASSERT(ARRAY_SIZE(bdx_stat_names) 2391 BDX_ASSERT(ARRAY_SIZE(bdx_stat_names)
2392 != sizeof(struct bdx_stats) / sizeof(u64)); 2392 != sizeof(struct bdx_stats) / sizeof(u64));
2393 return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); 2393 return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
@@ -2402,7 +2402,7 @@ static int bdx_get_stats_count(struct net_device *netdev)
2402static void bdx_get_ethtool_stats(struct net_device *netdev, 2402static void bdx_get_ethtool_stats(struct net_device *netdev,
2403 struct ethtool_stats *stats, u64 *data) 2403 struct ethtool_stats *stats, u64 *data)
2404{ 2404{
2405 struct bdx_priv *priv = netdev->priv; 2405 struct bdx_priv *priv = netdev_priv(netdev);
2406 2406
2407 if (priv->stats_flag) { 2407 if (priv->stats_flag) {
2408 2408