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/depca.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/depca.c')
-rw-r--r-- | drivers/net/depca.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index fda1226d8ec1..ec34f03cb982 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -600,7 +600,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device) | |||
600 | return -ENXIO; | 600 | return -ENXIO; |
601 | } | 601 | } |
602 | 602 | ||
603 | lp = (struct depca_private *) dev->priv; | 603 | lp = netdev_priv(dev); |
604 | mem_start = lp->mem_start; | 604 | mem_start = lp->mem_start; |
605 | 605 | ||
606 | if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) | 606 | if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) |
@@ -820,7 +820,7 @@ out_priv: | |||
820 | 820 | ||
821 | static int depca_open(struct net_device *dev) | 821 | static int depca_open(struct net_device *dev) |
822 | { | 822 | { |
823 | struct depca_private *lp = (struct depca_private *) dev->priv; | 823 | struct depca_private *lp = netdev_priv(dev); |
824 | u_long ioaddr = dev->base_addr; | 824 | u_long ioaddr = dev->base_addr; |
825 | s16 nicsr; | 825 | s16 nicsr; |
826 | int status = 0; | 826 | int status = 0; |
@@ -865,7 +865,7 @@ static int depca_open(struct net_device *dev) | |||
865 | /* Initialize the lance Rx and Tx descriptor rings. */ | 865 | /* Initialize the lance Rx and Tx descriptor rings. */ |
866 | static void depca_init_ring(struct net_device *dev) | 866 | static void depca_init_ring(struct net_device *dev) |
867 | { | 867 | { |
868 | struct depca_private *lp = (struct depca_private *) dev->priv; | 868 | struct depca_private *lp = netdev_priv(dev); |
869 | u_int i; | 869 | u_int i; |
870 | u_long offset; | 870 | u_long offset; |
871 | 871 | ||
@@ -923,7 +923,7 @@ static void depca_tx_timeout(struct net_device *dev) | |||
923 | */ | 923 | */ |
924 | static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) | 924 | static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) |
925 | { | 925 | { |
926 | struct depca_private *lp = (struct depca_private *) dev->priv; | 926 | struct depca_private *lp = netdev_priv(dev); |
927 | u_long ioaddr = dev->base_addr; | 927 | u_long ioaddr = dev->base_addr; |
928 | int status = 0; | 928 | int status = 0; |
929 | 929 | ||
@@ -971,7 +971,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id) | |||
971 | return IRQ_NONE; | 971 | return IRQ_NONE; |
972 | } | 972 | } |
973 | 973 | ||
974 | lp = (struct depca_private *) dev->priv; | 974 | lp = netdev_priv(dev); |
975 | ioaddr = dev->base_addr; | 975 | ioaddr = dev->base_addr; |
976 | 976 | ||
977 | spin_lock(&lp->lock); | 977 | spin_lock(&lp->lock); |
@@ -1009,7 +1009,7 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id) | |||
1009 | /* Called with lp->lock held */ | 1009 | /* Called with lp->lock held */ |
1010 | static int depca_rx(struct net_device *dev) | 1010 | static int depca_rx(struct net_device *dev) |
1011 | { | 1011 | { |
1012 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1012 | struct depca_private *lp = netdev_priv(dev); |
1013 | int i, entry; | 1013 | int i, entry; |
1014 | s32 status; | 1014 | s32 status; |
1015 | 1015 | ||
@@ -1106,7 +1106,7 @@ static int depca_rx(struct net_device *dev) | |||
1106 | */ | 1106 | */ |
1107 | static int depca_tx(struct net_device *dev) | 1107 | static int depca_tx(struct net_device *dev) |
1108 | { | 1108 | { |
1109 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1109 | struct depca_private *lp = netdev_priv(dev); |
1110 | int entry; | 1110 | int entry; |
1111 | s32 status; | 1111 | s32 status; |
1112 | u_long ioaddr = dev->base_addr; | 1112 | u_long ioaddr = dev->base_addr; |
@@ -1147,7 +1147,7 @@ static int depca_tx(struct net_device *dev) | |||
1147 | 1147 | ||
1148 | static int depca_close(struct net_device *dev) | 1148 | static int depca_close(struct net_device *dev) |
1149 | { | 1149 | { |
1150 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1150 | struct depca_private *lp = netdev_priv(dev); |
1151 | s16 nicsr; | 1151 | s16 nicsr; |
1152 | u_long ioaddr = dev->base_addr; | 1152 | u_long ioaddr = dev->base_addr; |
1153 | 1153 | ||
@@ -1183,7 +1183,7 @@ static int depca_close(struct net_device *dev) | |||
1183 | 1183 | ||
1184 | static void LoadCSRs(struct net_device *dev) | 1184 | static void LoadCSRs(struct net_device *dev) |
1185 | { | 1185 | { |
1186 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1186 | struct depca_private *lp = netdev_priv(dev); |
1187 | u_long ioaddr = dev->base_addr; | 1187 | u_long ioaddr = dev->base_addr; |
1188 | 1188 | ||
1189 | outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */ | 1189 | outw(CSR1, DEPCA_ADDR); /* initialisation block address LSW */ |
@@ -1200,7 +1200,7 @@ static void LoadCSRs(struct net_device *dev) | |||
1200 | 1200 | ||
1201 | static int InitRestartDepca(struct net_device *dev) | 1201 | static int InitRestartDepca(struct net_device *dev) |
1202 | { | 1202 | { |
1203 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1203 | struct depca_private *lp = netdev_priv(dev); |
1204 | u_long ioaddr = dev->base_addr; | 1204 | u_long ioaddr = dev->base_addr; |
1205 | int i, status = 0; | 1205 | int i, status = 0; |
1206 | 1206 | ||
@@ -1232,7 +1232,7 @@ static int InitRestartDepca(struct net_device *dev) | |||
1232 | */ | 1232 | */ |
1233 | static void set_multicast_list(struct net_device *dev) | 1233 | static void set_multicast_list(struct net_device *dev) |
1234 | { | 1234 | { |
1235 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1235 | struct depca_private *lp = netdev_priv(dev); |
1236 | u_long ioaddr = dev->base_addr; | 1236 | u_long ioaddr = dev->base_addr; |
1237 | 1237 | ||
1238 | netif_stop_queue(dev); | 1238 | netif_stop_queue(dev); |
@@ -1261,7 +1261,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1261 | */ | 1261 | */ |
1262 | static void SetMulticastFilter(struct net_device *dev) | 1262 | static void SetMulticastFilter(struct net_device *dev) |
1263 | { | 1263 | { |
1264 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1264 | struct depca_private *lp = netdev_priv(dev); |
1265 | struct dev_mc_list *dmi = dev->mc_list; | 1265 | struct dev_mc_list *dmi = dev->mc_list; |
1266 | char *addrs; | 1266 | char *addrs; |
1267 | int i, j, bit, byte; | 1267 | int i, j, bit, byte; |
@@ -1429,7 +1429,7 @@ static int __init depca_mca_probe(struct device *device) | |||
1429 | 1429 | ||
1430 | dev->irq = irq; | 1430 | dev->irq = irq; |
1431 | dev->base_addr = iobase; | 1431 | dev->base_addr = iobase; |
1432 | lp = dev->priv; | 1432 | lp = netdev_priv(dev); |
1433 | lp->depca_bus = DEPCA_BUS_MCA; | 1433 | lp->depca_bus = DEPCA_BUS_MCA; |
1434 | lp->adapter = depca_mca_adapter_type[mdev->index]; | 1434 | lp->adapter = depca_mca_adapter_type[mdev->index]; |
1435 | lp->mem_start = mem_start; | 1435 | lp->mem_start = mem_start; |
@@ -1532,7 +1532,7 @@ static int __init depca_isa_probe (struct platform_device *device) | |||
1532 | dev->base_addr = ioaddr; | 1532 | dev->base_addr = ioaddr; |
1533 | dev->irq = irq; /* Use whatever value the user gave | 1533 | dev->irq = irq; /* Use whatever value the user gave |
1534 | * us, and 0 if he didn't. */ | 1534 | * us, and 0 if he didn't. */ |
1535 | lp = dev->priv; | 1535 | lp = netdev_priv(dev); |
1536 | lp->depca_bus = DEPCA_BUS_ISA; | 1536 | lp->depca_bus = DEPCA_BUS_ISA; |
1537 | lp->adapter = adapter; | 1537 | lp->adapter = adapter; |
1538 | lp->mem_start = mem_start; | 1538 | lp->mem_start = mem_start; |
@@ -1578,7 +1578,7 @@ static int __init depca_eisa_probe (struct device *device) | |||
1578 | 1578 | ||
1579 | dev->base_addr = ioaddr; | 1579 | dev->base_addr = ioaddr; |
1580 | dev->irq = irq; | 1580 | dev->irq = irq; |
1581 | lp = dev->priv; | 1581 | lp = netdev_priv(dev); |
1582 | lp->depca_bus = DEPCA_BUS_EISA; | 1582 | lp->depca_bus = DEPCA_BUS_EISA; |
1583 | lp->adapter = edev->id.driver_data; | 1583 | lp->adapter = edev->id.driver_data; |
1584 | lp->mem_start = mem_start; | 1584 | lp->mem_start = mem_start; |
@@ -1603,7 +1603,7 @@ static int __devexit depca_device_remove (struct device *device) | |||
1603 | int bus; | 1603 | int bus; |
1604 | 1604 | ||
1605 | dev = device->driver_data; | 1605 | dev = device->driver_data; |
1606 | lp = dev->priv; | 1606 | lp = netdev_priv(dev); |
1607 | 1607 | ||
1608 | unregister_netdev (dev); | 1608 | unregister_netdev (dev); |
1609 | iounmap (lp->sh_mem); | 1609 | iounmap (lp->sh_mem); |
@@ -1745,7 +1745,7 @@ static int __init DevicePresent(u_long ioaddr) | |||
1745 | static int __init get_hw_addr(struct net_device *dev) | 1745 | static int __init get_hw_addr(struct net_device *dev) |
1746 | { | 1746 | { |
1747 | u_long ioaddr = dev->base_addr; | 1747 | u_long ioaddr = dev->base_addr; |
1748 | struct depca_private *lp = dev->priv; | 1748 | struct depca_private *lp = netdev_priv(dev); |
1749 | int i, k, tmp, status = 0; | 1749 | int i, k, tmp, status = 0; |
1750 | u_short j, x, chksum; | 1750 | u_short j, x, chksum; |
1751 | 1751 | ||
@@ -1780,7 +1780,7 @@ static int __init get_hw_addr(struct net_device *dev) | |||
1780 | */ | 1780 | */ |
1781 | static int load_packet(struct net_device *dev, struct sk_buff *skb) | 1781 | static int load_packet(struct net_device *dev, struct sk_buff *skb) |
1782 | { | 1782 | { |
1783 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1783 | struct depca_private *lp = netdev_priv(dev); |
1784 | int i, entry, end, len, status = 0; | 1784 | int i, entry, end, len, status = 0; |
1785 | 1785 | ||
1786 | entry = lp->tx_new; /* Ring around buffer number. */ | 1786 | entry = lp->tx_new; /* Ring around buffer number. */ |
@@ -1835,7 +1835,7 @@ static int load_packet(struct net_device *dev, struct sk_buff *skb) | |||
1835 | 1835 | ||
1836 | static void depca_dbg_open(struct net_device *dev) | 1836 | static void depca_dbg_open(struct net_device *dev) |
1837 | { | 1837 | { |
1838 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1838 | struct depca_private *lp = netdev_priv(dev); |
1839 | u_long ioaddr = dev->base_addr; | 1839 | u_long ioaddr = dev->base_addr; |
1840 | struct depca_init *p = &lp->init_block; | 1840 | struct depca_init *p = &lp->init_block; |
1841 | int i; | 1841 | int i; |
@@ -1906,7 +1906,7 @@ static void depca_dbg_open(struct net_device *dev) | |||
1906 | */ | 1906 | */ |
1907 | static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1907 | static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1908 | { | 1908 | { |
1909 | struct depca_private *lp = (struct depca_private *) dev->priv; | 1909 | struct depca_private *lp = netdev_priv(dev); |
1910 | struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru; | 1910 | struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru; |
1911 | int i, status = 0; | 1911 | int i, status = 0; |
1912 | u_long ioaddr = dev->base_addr; | 1912 | u_long ioaddr = dev->base_addr; |