aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sis900.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/sis900.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/sis900.c')
-rw-r--r--drivers/net/sis900.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 28f6c04a8ef3..9a363dc0db41 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -436,7 +436,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
436 if (ret) 436 if (ret)
437 goto err_out; 437 goto err_out;
438 438
439 sis_priv = net_dev->priv; 439 sis_priv = netdev_priv(net_dev);
440 net_dev->base_addr = ioaddr; 440 net_dev->base_addr = ioaddr;
441 net_dev->irq = pci_dev->irq; 441 net_dev->irq = pci_dev->irq;
442 sis_priv->pci_dev = pci_dev; 442 sis_priv->pci_dev = pci_dev;
@@ -569,7 +569,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
569 569
570static int __devinit sis900_mii_probe(struct net_device * net_dev) 570static int __devinit sis900_mii_probe(struct net_device * net_dev)
571{ 571{
572 struct sis900_private * sis_priv = net_dev->priv; 572 struct sis900_private *sis_priv = netdev_priv(net_dev);
573 const char *dev_name = pci_name(sis_priv->pci_dev); 573 const char *dev_name = pci_name(sis_priv->pci_dev);
574 u16 poll_bit = MII_STAT_LINK, status = 0; 574 u16 poll_bit = MII_STAT_LINK, status = 0;
575 unsigned long timeout = jiffies + 5 * HZ; 575 unsigned long timeout = jiffies + 5 * HZ;
@@ -697,7 +697,7 @@ static int __devinit sis900_mii_probe(struct net_device * net_dev)
697 697
698static u16 sis900_default_phy(struct net_device * net_dev) 698static u16 sis900_default_phy(struct net_device * net_dev)
699{ 699{
700 struct sis900_private * sis_priv = net_dev->priv; 700 struct sis900_private *sis_priv = netdev_priv(net_dev);
701 struct mii_phy *phy = NULL, *phy_home = NULL, 701 struct mii_phy *phy = NULL, *phy_home = NULL,
702 *default_phy = NULL, *phy_lan = NULL; 702 *default_phy = NULL, *phy_lan = NULL;
703 u16 status; 703 u16 status;
@@ -998,7 +998,7 @@ static void sis900_poll(struct net_device *dev)
998static int 998static int
999sis900_open(struct net_device *net_dev) 999sis900_open(struct net_device *net_dev)
1000{ 1000{
1001 struct sis900_private *sis_priv = net_dev->priv; 1001 struct sis900_private *sis_priv = netdev_priv(net_dev);
1002 long ioaddr = net_dev->base_addr; 1002 long ioaddr = net_dev->base_addr;
1003 int ret; 1003 int ret;
1004 1004
@@ -1054,7 +1054,7 @@ sis900_open(struct net_device *net_dev)
1054static void 1054static void
1055sis900_init_rxfilter (struct net_device * net_dev) 1055sis900_init_rxfilter (struct net_device * net_dev)
1056{ 1056{
1057 struct sis900_private *sis_priv = net_dev->priv; 1057 struct sis900_private *sis_priv = netdev_priv(net_dev);
1058 long ioaddr = net_dev->base_addr; 1058 long ioaddr = net_dev->base_addr;
1059 u32 rfcrSave; 1059 u32 rfcrSave;
1060 u32 i; 1060 u32 i;
@@ -1092,7 +1092,7 @@ sis900_init_rxfilter (struct net_device * net_dev)
1092static void 1092static void
1093sis900_init_tx_ring(struct net_device *net_dev) 1093sis900_init_tx_ring(struct net_device *net_dev)
1094{ 1094{
1095 struct sis900_private *sis_priv = net_dev->priv; 1095 struct sis900_private *sis_priv = netdev_priv(net_dev);
1096 long ioaddr = net_dev->base_addr; 1096 long ioaddr = net_dev->base_addr;
1097 int i; 1097 int i;
1098 1098
@@ -1126,7 +1126,7 @@ sis900_init_tx_ring(struct net_device *net_dev)
1126static void 1126static void
1127sis900_init_rx_ring(struct net_device *net_dev) 1127sis900_init_rx_ring(struct net_device *net_dev)
1128{ 1128{
1129 struct sis900_private *sis_priv = net_dev->priv; 1129 struct sis900_private *sis_priv = netdev_priv(net_dev);
1130 long ioaddr = net_dev->base_addr; 1130 long ioaddr = net_dev->base_addr;
1131 int i; 1131 int i;
1132 1132
@@ -1197,7 +1197,7 @@ sis900_init_rx_ring(struct net_device *net_dev)
1197 1197
1198static void sis630_set_eq(struct net_device *net_dev, u8 revision) 1198static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1199{ 1199{
1200 struct sis900_private *sis_priv = net_dev->priv; 1200 struct sis900_private *sis_priv = netdev_priv(net_dev);
1201 u16 reg14h, eq_value=0, max_value=0, min_value=0; 1201 u16 reg14h, eq_value=0, max_value=0, min_value=0;
1202 int i, maxcount=10; 1202 int i, maxcount=10;
1203 1203
@@ -1270,7 +1270,7 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
1270static void sis900_timer(unsigned long data) 1270static void sis900_timer(unsigned long data)
1271{ 1271{
1272 struct net_device *net_dev = (struct net_device *)data; 1272 struct net_device *net_dev = (struct net_device *)data;
1273 struct sis900_private *sis_priv = net_dev->priv; 1273 struct sis900_private *sis_priv = netdev_priv(net_dev);
1274 struct mii_phy *mii_phy = sis_priv->mii; 1274 struct mii_phy *mii_phy = sis_priv->mii;
1275 static const int next_tick = 5*HZ; 1275 static const int next_tick = 5*HZ;
1276 u16 status; 1276 u16 status;
@@ -1340,7 +1340,7 @@ static void sis900_timer(unsigned long data)
1340 1340
1341static void sis900_check_mode(struct net_device *net_dev, struct mii_phy *mii_phy) 1341static void sis900_check_mode(struct net_device *net_dev, struct mii_phy *mii_phy)
1342{ 1342{
1343 struct sis900_private *sis_priv = net_dev->priv; 1343 struct sis900_private *sis_priv = netdev_priv(net_dev);
1344 long ioaddr = net_dev->base_addr; 1344 long ioaddr = net_dev->base_addr;
1345 int speed, duplex; 1345 int speed, duplex;
1346 1346
@@ -1419,7 +1419,7 @@ static void sis900_set_mode (long ioaddr, int speed, int duplex)
1419 1419
1420static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr) 1420static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr)
1421{ 1421{
1422 struct sis900_private *sis_priv = net_dev->priv; 1422 struct sis900_private *sis_priv = netdev_priv(net_dev);
1423 int i = 0; 1423 int i = 0;
1424 u32 status; 1424 u32 status;
1425 1425
@@ -1454,7 +1454,7 @@ static void sis900_auto_negotiate(struct net_device *net_dev, int phy_addr)
1454 1454
1455static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex) 1455static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex)
1456{ 1456{
1457 struct sis900_private *sis_priv = net_dev->priv; 1457 struct sis900_private *sis_priv = netdev_priv(net_dev);
1458 struct mii_phy *phy = sis_priv->mii; 1458 struct mii_phy *phy = sis_priv->mii;
1459 int phy_addr = sis_priv->cur_phy; 1459 int phy_addr = sis_priv->cur_phy;
1460 u32 status; 1460 u32 status;
@@ -1509,7 +1509,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
1509 1509
1510static void sis900_tx_timeout(struct net_device *net_dev) 1510static void sis900_tx_timeout(struct net_device *net_dev)
1511{ 1511{
1512 struct sis900_private *sis_priv = net_dev->priv; 1512 struct sis900_private *sis_priv = netdev_priv(net_dev);
1513 long ioaddr = net_dev->base_addr; 1513 long ioaddr = net_dev->base_addr;
1514 unsigned long flags; 1514 unsigned long flags;
1515 int i; 1515 int i;
@@ -1568,7 +1568,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1568static int 1568static int
1569sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) 1569sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1570{ 1570{
1571 struct sis900_private *sis_priv = net_dev->priv; 1571 struct sis900_private *sis_priv = netdev_priv(net_dev);
1572 long ioaddr = net_dev->base_addr; 1572 long ioaddr = net_dev->base_addr;
1573 unsigned int entry; 1573 unsigned int entry;
1574 unsigned long flags; 1574 unsigned long flags;
@@ -1638,7 +1638,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1638static irqreturn_t sis900_interrupt(int irq, void *dev_instance) 1638static irqreturn_t sis900_interrupt(int irq, void *dev_instance)
1639{ 1639{
1640 struct net_device *net_dev = dev_instance; 1640 struct net_device *net_dev = dev_instance;
1641 struct sis900_private *sis_priv = net_dev->priv; 1641 struct sis900_private *sis_priv = netdev_priv(net_dev);
1642 int boguscnt = max_interrupt_work; 1642 int boguscnt = max_interrupt_work;
1643 long ioaddr = net_dev->base_addr; 1643 long ioaddr = net_dev->base_addr;
1644 u32 status; 1644 u32 status;
@@ -1700,7 +1700,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance)
1700 1700
1701static int sis900_rx(struct net_device *net_dev) 1701static int sis900_rx(struct net_device *net_dev)
1702{ 1702{
1703 struct sis900_private *sis_priv = net_dev->priv; 1703 struct sis900_private *sis_priv = netdev_priv(net_dev);
1704 long ioaddr = net_dev->base_addr; 1704 long ioaddr = net_dev->base_addr;
1705 unsigned int entry = sis_priv->cur_rx % NUM_RX_DESC; 1705 unsigned int entry = sis_priv->cur_rx % NUM_RX_DESC;
1706 u32 rx_status = sis_priv->rx_ring[entry].cmdsts; 1706 u32 rx_status = sis_priv->rx_ring[entry].cmdsts;
@@ -1849,7 +1849,7 @@ refill_rx_ring:
1849 1849
1850static void sis900_finish_xmit (struct net_device *net_dev) 1850static void sis900_finish_xmit (struct net_device *net_dev)
1851{ 1851{
1852 struct sis900_private *sis_priv = net_dev->priv; 1852 struct sis900_private *sis_priv = netdev_priv(net_dev);
1853 1853
1854 for (; sis_priv->dirty_tx != sis_priv->cur_tx; sis_priv->dirty_tx++) { 1854 for (; sis_priv->dirty_tx != sis_priv->cur_tx; sis_priv->dirty_tx++) {
1855 struct sk_buff *skb; 1855 struct sk_buff *skb;
@@ -1918,7 +1918,7 @@ static void sis900_finish_xmit (struct net_device *net_dev)
1918static int sis900_close(struct net_device *net_dev) 1918static int sis900_close(struct net_device *net_dev)
1919{ 1919{
1920 long ioaddr = net_dev->base_addr; 1920 long ioaddr = net_dev->base_addr;
1921 struct sis900_private *sis_priv = net_dev->priv; 1921 struct sis900_private *sis_priv = netdev_priv(net_dev);
1922 struct sk_buff *skb; 1922 struct sk_buff *skb;
1923 int i; 1923 int i;
1924 1924
@@ -1973,7 +1973,7 @@ static int sis900_close(struct net_device *net_dev)
1973static void sis900_get_drvinfo(struct net_device *net_dev, 1973static void sis900_get_drvinfo(struct net_device *net_dev,
1974 struct ethtool_drvinfo *info) 1974 struct ethtool_drvinfo *info)
1975{ 1975{
1976 struct sis900_private *sis_priv = net_dev->priv; 1976 struct sis900_private *sis_priv = netdev_priv(net_dev);
1977 1977
1978 strcpy (info->driver, SIS900_MODULE_NAME); 1978 strcpy (info->driver, SIS900_MODULE_NAME);
1979 strcpy (info->version, SIS900_DRV_VERSION); 1979 strcpy (info->version, SIS900_DRV_VERSION);
@@ -1982,26 +1982,26 @@ static void sis900_get_drvinfo(struct net_device *net_dev,
1982 1982
1983static u32 sis900_get_msglevel(struct net_device *net_dev) 1983static u32 sis900_get_msglevel(struct net_device *net_dev)
1984{ 1984{
1985 struct sis900_private *sis_priv = net_dev->priv; 1985 struct sis900_private *sis_priv = netdev_priv(net_dev);
1986 return sis_priv->msg_enable; 1986 return sis_priv->msg_enable;
1987} 1987}
1988 1988
1989static void sis900_set_msglevel(struct net_device *net_dev, u32 value) 1989static void sis900_set_msglevel(struct net_device *net_dev, u32 value)
1990{ 1990{
1991 struct sis900_private *sis_priv = net_dev->priv; 1991 struct sis900_private *sis_priv = netdev_priv(net_dev);
1992 sis_priv->msg_enable = value; 1992 sis_priv->msg_enable = value;
1993} 1993}
1994 1994
1995static u32 sis900_get_link(struct net_device *net_dev) 1995static u32 sis900_get_link(struct net_device *net_dev)
1996{ 1996{
1997 struct sis900_private *sis_priv = net_dev->priv; 1997 struct sis900_private *sis_priv = netdev_priv(net_dev);
1998 return mii_link_ok(&sis_priv->mii_info); 1998 return mii_link_ok(&sis_priv->mii_info);
1999} 1999}
2000 2000
2001static int sis900_get_settings(struct net_device *net_dev, 2001static int sis900_get_settings(struct net_device *net_dev,
2002 struct ethtool_cmd *cmd) 2002 struct ethtool_cmd *cmd)
2003{ 2003{
2004 struct sis900_private *sis_priv = net_dev->priv; 2004 struct sis900_private *sis_priv = netdev_priv(net_dev);
2005 spin_lock_irq(&sis_priv->lock); 2005 spin_lock_irq(&sis_priv->lock);
2006 mii_ethtool_gset(&sis_priv->mii_info, cmd); 2006 mii_ethtool_gset(&sis_priv->mii_info, cmd);
2007 spin_unlock_irq(&sis_priv->lock); 2007 spin_unlock_irq(&sis_priv->lock);
@@ -2011,7 +2011,7 @@ static int sis900_get_settings(struct net_device *net_dev,
2011static int sis900_set_settings(struct net_device *net_dev, 2011static int sis900_set_settings(struct net_device *net_dev,
2012 struct ethtool_cmd *cmd) 2012 struct ethtool_cmd *cmd)
2013{ 2013{
2014 struct sis900_private *sis_priv = net_dev->priv; 2014 struct sis900_private *sis_priv = netdev_priv(net_dev);
2015 int rt; 2015 int rt;
2016 spin_lock_irq(&sis_priv->lock); 2016 spin_lock_irq(&sis_priv->lock);
2017 rt = mii_ethtool_sset(&sis_priv->mii_info, cmd); 2017 rt = mii_ethtool_sset(&sis_priv->mii_info, cmd);
@@ -2021,7 +2021,7 @@ static int sis900_set_settings(struct net_device *net_dev,
2021 2021
2022static int sis900_nway_reset(struct net_device *net_dev) 2022static int sis900_nway_reset(struct net_device *net_dev)
2023{ 2023{
2024 struct sis900_private *sis_priv = net_dev->priv; 2024 struct sis900_private *sis_priv = netdev_priv(net_dev);
2025 return mii_nway_restart(&sis_priv->mii_info); 2025 return mii_nway_restart(&sis_priv->mii_info);
2026} 2026}
2027 2027
@@ -2038,7 +2038,7 @@ static int sis900_nway_reset(struct net_device *net_dev)
2038 2038
2039static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol) 2039static int sis900_set_wol(struct net_device *net_dev, struct ethtool_wolinfo *wol)
2040{ 2040{
2041 struct sis900_private *sis_priv = net_dev->priv; 2041 struct sis900_private *sis_priv = netdev_priv(net_dev);
2042 long pmctrl_addr = net_dev->base_addr + pmctrl; 2042 long pmctrl_addr = net_dev->base_addr + pmctrl;
2043 u32 cfgpmcsr = 0, pmctrl_bits = 0; 2043 u32 cfgpmcsr = 0, pmctrl_bits = 0;
2044 2044
@@ -2109,7 +2109,7 @@ static const struct ethtool_ops sis900_ethtool_ops = {
2109 2109
2110static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd) 2110static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
2111{ 2111{
2112 struct sis900_private *sis_priv = net_dev->priv; 2112 struct sis900_private *sis_priv = netdev_priv(net_dev);
2113 struct mii_ioctl_data *data = if_mii(rq); 2113 struct mii_ioctl_data *data = if_mii(rq);
2114 2114
2115 switch(cmd) { 2115 switch(cmd) {
@@ -2143,7 +2143,7 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
2143 2143
2144static int sis900_set_config(struct net_device *dev, struct ifmap *map) 2144static int sis900_set_config(struct net_device *dev, struct ifmap *map)
2145{ 2145{
2146 struct sis900_private *sis_priv = dev->priv; 2146 struct sis900_private *sis_priv = netdev_priv(dev);
2147 struct mii_phy *mii_phy = sis_priv->mii; 2147 struct mii_phy *mii_phy = sis_priv->mii;
2148 2148
2149 u16 status; 2149 u16 status;
@@ -2266,7 +2266,7 @@ static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
2266static void set_rx_mode(struct net_device *net_dev) 2266static void set_rx_mode(struct net_device *net_dev)
2267{ 2267{
2268 long ioaddr = net_dev->base_addr; 2268 long ioaddr = net_dev->base_addr;
2269 struct sis900_private * sis_priv = net_dev->priv; 2269 struct sis900_private *sis_priv = netdev_priv(net_dev);
2270 u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */ 2270 u16 mc_filter[16] = {0}; /* 256/128 bits multicast hash table */
2271 int i, table_entries; 2271 int i, table_entries;
2272 u32 rx_mode; 2272 u32 rx_mode;
@@ -2341,7 +2341,7 @@ static void set_rx_mode(struct net_device *net_dev)
2341 2341
2342static void sis900_reset(struct net_device *net_dev) 2342static void sis900_reset(struct net_device *net_dev)
2343{ 2343{
2344 struct sis900_private * sis_priv = net_dev->priv; 2344 struct sis900_private *sis_priv = netdev_priv(net_dev);
2345 long ioaddr = net_dev->base_addr; 2345 long ioaddr = net_dev->base_addr;
2346 int i = 0; 2346 int i = 0;
2347 u32 status = TxRCMP | RxRCMP; 2347 u32 status = TxRCMP | RxRCMP;
@@ -2374,7 +2374,7 @@ static void sis900_reset(struct net_device *net_dev)
2374static void __devexit sis900_remove(struct pci_dev *pci_dev) 2374static void __devexit sis900_remove(struct pci_dev *pci_dev)
2375{ 2375{
2376 struct net_device *net_dev = pci_get_drvdata(pci_dev); 2376 struct net_device *net_dev = pci_get_drvdata(pci_dev);
2377 struct sis900_private * sis_priv = net_dev->priv; 2377 struct sis900_private *sis_priv = netdev_priv(net_dev);
2378 struct mii_phy *phy = NULL; 2378 struct mii_phy *phy = NULL;
2379 2379
2380 while (sis_priv->first_mii) { 2380 while (sis_priv->first_mii) {
@@ -2418,7 +2418,7 @@ static int sis900_suspend(struct pci_dev *pci_dev, pm_message_t state)
2418static int sis900_resume(struct pci_dev *pci_dev) 2418static int sis900_resume(struct pci_dev *pci_dev)
2419{ 2419{
2420 struct net_device *net_dev = pci_get_drvdata(pci_dev); 2420 struct net_device *net_dev = pci_get_drvdata(pci_dev);
2421 struct sis900_private *sis_priv = net_dev->priv; 2421 struct sis900_private *sis_priv = netdev_priv(net_dev);
2422 long ioaddr = net_dev->base_addr; 2422 long ioaddr = net_dev->base_addr;
2423 2423
2424 if(!netif_running(net_dev)) 2424 if(!netif_running(net_dev))