diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:39:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:39:10 -0500 |
commit | 524ad0a79126efabf58d0a49eace6155ab5b4549 (patch) | |
tree | 927e79d7d28d2c563c5beba74f06527df564e31c /drivers/net/znet.c | |
parent | 8f15ea42b64941001a401cf855a0869e24f3a845 (diff) |
netdevice: safe convert to netdev_priv() #part-4
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/znet.c')
-rw-r--r-- | drivers/net/znet.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/znet.c b/drivers/net/znet.c index d7588bf6d6dd..f0b15c9347d0 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c | |||
@@ -167,7 +167,7 @@ static void znet_tx_timeout (struct net_device *dev); | |||
167 | /* Request needed resources */ | 167 | /* Request needed resources */ |
168 | static int znet_request_resources (struct net_device *dev) | 168 | static int znet_request_resources (struct net_device *dev) |
169 | { | 169 | { |
170 | struct znet_private *znet = dev->priv; | 170 | struct znet_private *znet = netdev_priv(dev); |
171 | unsigned long flags; | 171 | unsigned long flags; |
172 | 172 | ||
173 | if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) | 173 | if (request_irq (dev->irq, &znet_interrupt, 0, "ZNet", dev)) |
@@ -201,7 +201,7 @@ static int znet_request_resources (struct net_device *dev) | |||
201 | 201 | ||
202 | static void znet_release_resources (struct net_device *dev) | 202 | static void znet_release_resources (struct net_device *dev) |
203 | { | 203 | { |
204 | struct znet_private *znet = dev->priv; | 204 | struct znet_private *znet = netdev_priv(dev); |
205 | unsigned long flags; | 205 | unsigned long flags; |
206 | 206 | ||
207 | release_region (znet->sia_base, znet->sia_size); | 207 | release_region (znet->sia_base, znet->sia_size); |
@@ -216,7 +216,7 @@ static void znet_release_resources (struct net_device *dev) | |||
216 | /* Keep the magical SIA stuff in a single function... */ | 216 | /* Keep the magical SIA stuff in a single function... */ |
217 | static void znet_transceiver_power (struct net_device *dev, int on) | 217 | static void znet_transceiver_power (struct net_device *dev, int on) |
218 | { | 218 | { |
219 | struct znet_private *znet = dev->priv; | 219 | struct znet_private *znet = netdev_priv(dev); |
220 | unsigned char v; | 220 | unsigned char v; |
221 | 221 | ||
222 | /* Turn on/off the 82501 SIA, using zenith-specific magic. */ | 222 | /* Turn on/off the 82501 SIA, using zenith-specific magic. */ |
@@ -235,7 +235,7 @@ static void znet_transceiver_power (struct net_device *dev, int on) | |||
235 | Also used from hardware_init. */ | 235 | Also used from hardware_init. */ |
236 | static void znet_set_multicast_list (struct net_device *dev) | 236 | static void znet_set_multicast_list (struct net_device *dev) |
237 | { | 237 | { |
238 | struct znet_private *znet = dev->priv; | 238 | struct znet_private *znet = netdev_priv(dev); |
239 | short ioaddr = dev->base_addr; | 239 | short ioaddr = dev->base_addr; |
240 | struct i82593_conf_block *cfblk = &znet->i593_init; | 240 | struct i82593_conf_block *cfblk = &znet->i593_init; |
241 | 241 | ||
@@ -386,7 +386,7 @@ static int __init znet_probe (void) | |||
386 | if (!dev) | 386 | if (!dev) |
387 | return -ENOMEM; | 387 | return -ENOMEM; |
388 | 388 | ||
389 | znet = dev->priv; | 389 | znet = netdev_priv(dev); |
390 | 390 | ||
391 | netinfo = (struct netidblk *)p; | 391 | netinfo = (struct netidblk *)p; |
392 | dev->base_addr = netinfo->iobase1; | 392 | dev->base_addr = netinfo->iobase1; |
@@ -530,7 +530,7 @@ static void znet_tx_timeout (struct net_device *dev) | |||
530 | static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) | 530 | static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) |
531 | { | 531 | { |
532 | int ioaddr = dev->base_addr; | 532 | int ioaddr = dev->base_addr; |
533 | struct znet_private *znet = dev->priv; | 533 | struct znet_private *znet = netdev_priv(dev); |
534 | unsigned long flags; | 534 | unsigned long flags; |
535 | short length = skb->len; | 535 | short length = skb->len; |
536 | 536 | ||
@@ -600,7 +600,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
600 | static irqreturn_t znet_interrupt(int irq, void *dev_id) | 600 | static irqreturn_t znet_interrupt(int irq, void *dev_id) |
601 | { | 601 | { |
602 | struct net_device *dev = dev_id; | 602 | struct net_device *dev = dev_id; |
603 | struct znet_private *znet = dev->priv; | 603 | struct znet_private *znet = netdev_priv(dev); |
604 | int ioaddr; | 604 | int ioaddr; |
605 | int boguscnt = 20; | 605 | int boguscnt = 20; |
606 | int handled = 0; | 606 | int handled = 0; |
@@ -678,7 +678,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id) | |||
678 | 678 | ||
679 | static void znet_rx(struct net_device *dev) | 679 | static void znet_rx(struct net_device *dev) |
680 | { | 680 | { |
681 | struct znet_private *znet = dev->priv; | 681 | struct znet_private *znet = netdev_priv(dev); |
682 | int ioaddr = dev->base_addr; | 682 | int ioaddr = dev->base_addr; |
683 | int boguscount = 1; | 683 | int boguscount = 1; |
684 | short next_frame_end_offset = 0; /* Offset of next frame start. */ | 684 | short next_frame_end_offset = 0; /* Offset of next frame start. */ |
@@ -827,7 +827,7 @@ static void show_dma(struct net_device *dev) | |||
827 | { | 827 | { |
828 | short ioaddr = dev->base_addr; | 828 | short ioaddr = dev->base_addr; |
829 | unsigned char stat = inb (ioaddr); | 829 | unsigned char stat = inb (ioaddr); |
830 | struct znet_private *znet = dev->priv; | 830 | struct znet_private *znet = netdev_priv(dev); |
831 | unsigned long flags; | 831 | unsigned long flags; |
832 | short dma_port = ((znet->tx_dma&3)<<2) + IO_DMA2_BASE; | 832 | short dma_port = ((znet->tx_dma&3)<<2) + IO_DMA2_BASE; |
833 | unsigned addr = inb(dma_port); | 833 | unsigned addr = inb(dma_port); |
@@ -850,7 +850,7 @@ static void hardware_init(struct net_device *dev) | |||
850 | { | 850 | { |
851 | unsigned long flags; | 851 | unsigned long flags; |
852 | short ioaddr = dev->base_addr; | 852 | short ioaddr = dev->base_addr; |
853 | struct znet_private *znet = dev->priv; | 853 | struct znet_private *znet = netdev_priv(dev); |
854 | 854 | ||
855 | znet->rx_cur = znet->rx_start; | 855 | znet->rx_cur = znet->rx_start; |
856 | znet->tx_cur = znet->tx_start; | 856 | znet->tx_cur = znet->tx_start; |
@@ -912,7 +912,7 @@ static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset) | |||
912 | static __exit void znet_cleanup (void) | 912 | static __exit void znet_cleanup (void) |
913 | { | 913 | { |
914 | if (znet_dev) { | 914 | if (znet_dev) { |
915 | struct znet_private *znet = znet_dev->priv; | 915 | struct znet_private *znet = netdev_priv(znet_dev); |
916 | 916 | ||
917 | unregister_netdev (znet_dev); | 917 | unregister_netdev (znet_dev); |
918 | kfree (znet->rx_start); | 918 | kfree (znet->rx_start); |