diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-11-13 02:37:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-13 02:37:49 -0500 |
commit | 454d7c9b14e20fd1949e2686e9de4a2926e01476 (patch) | |
tree | fae8bd1bfb5fd496977a0639ad71c54a2ee278ae /drivers/net/mace.c | |
parent | 7a12122c7a00347da9669cfcde82954c9e3d6f5e (diff) |
netdevice: safe convert to netdev_priv() #part-1
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/mace.c')
-rw-r--r-- | drivers/net/mace.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index b52f0507845f..feebbd92aff2 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -143,7 +143,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i | |||
143 | } | 143 | } |
144 | SET_NETDEV_DEV(dev, &mdev->ofdev.dev); | 144 | SET_NETDEV_DEV(dev, &mdev->ofdev.dev); |
145 | 145 | ||
146 | mp = dev->priv; | 146 | mp = netdev_priv(dev); |
147 | mp->mdev = mdev; | 147 | mp->mdev = mdev; |
148 | macio_set_drvdata(mdev, dev); | 148 | macio_set_drvdata(mdev, dev); |
149 | 149 | ||
@@ -164,7 +164,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i | |||
164 | in_8(&mp->mace->chipid_lo); | 164 | in_8(&mp->mace->chipid_lo); |
165 | 165 | ||
166 | 166 | ||
167 | mp = (struct mace_data *) dev->priv; | 167 | mp = netdev_priv(dev); |
168 | mp->maccc = ENXMT | ENRCV; | 168 | mp->maccc = ENXMT | ENRCV; |
169 | 169 | ||
170 | mp->tx_dma = ioremap(macio_resource_start(mdev, 1), 0x1000); | 170 | mp->tx_dma = ioremap(macio_resource_start(mdev, 1), 0x1000); |
@@ -275,7 +275,7 @@ static int __devexit mace_remove(struct macio_dev *mdev) | |||
275 | 275 | ||
276 | macio_set_drvdata(mdev, NULL); | 276 | macio_set_drvdata(mdev, NULL); |
277 | 277 | ||
278 | mp = dev->priv; | 278 | mp = netdev_priv(dev); |
279 | 279 | ||
280 | unregister_netdev(dev); | 280 | unregister_netdev(dev); |
281 | 281 | ||
@@ -311,7 +311,7 @@ static void dbdma_reset(volatile struct dbdma_regs __iomem *dma) | |||
311 | 311 | ||
312 | static void mace_reset(struct net_device *dev) | 312 | static void mace_reset(struct net_device *dev) |
313 | { | 313 | { |
314 | struct mace_data *mp = (struct mace_data *) dev->priv; | 314 | struct mace_data *mp = netdev_priv(dev); |
315 | volatile struct mace __iomem *mb = mp->mace; | 315 | volatile struct mace __iomem *mb = mp->mace; |
316 | int i; | 316 | int i; |
317 | 317 | ||
@@ -366,7 +366,7 @@ static void mace_reset(struct net_device *dev) | |||
366 | 366 | ||
367 | static void __mace_set_address(struct net_device *dev, void *addr) | 367 | static void __mace_set_address(struct net_device *dev, void *addr) |
368 | { | 368 | { |
369 | struct mace_data *mp = (struct mace_data *) dev->priv; | 369 | struct mace_data *mp = netdev_priv(dev); |
370 | volatile struct mace __iomem *mb = mp->mace; | 370 | volatile struct mace __iomem *mb = mp->mace; |
371 | unsigned char *p = addr; | 371 | unsigned char *p = addr; |
372 | int i; | 372 | int i; |
@@ -387,7 +387,7 @@ static void __mace_set_address(struct net_device *dev, void *addr) | |||
387 | 387 | ||
388 | static int mace_set_address(struct net_device *dev, void *addr) | 388 | static int mace_set_address(struct net_device *dev, void *addr) |
389 | { | 389 | { |
390 | struct mace_data *mp = (struct mace_data *) dev->priv; | 390 | struct mace_data *mp = netdev_priv(dev); |
391 | volatile struct mace __iomem *mb = mp->mace; | 391 | volatile struct mace __iomem *mb = mp->mace; |
392 | unsigned long flags; | 392 | unsigned long flags; |
393 | 393 | ||
@@ -422,7 +422,7 @@ static inline void mace_clean_rings(struct mace_data *mp) | |||
422 | 422 | ||
423 | static int mace_open(struct net_device *dev) | 423 | static int mace_open(struct net_device *dev) |
424 | { | 424 | { |
425 | struct mace_data *mp = (struct mace_data *) dev->priv; | 425 | struct mace_data *mp = netdev_priv(dev); |
426 | volatile struct mace __iomem *mb = mp->mace; | 426 | volatile struct mace __iomem *mb = mp->mace; |
427 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; | 427 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; |
428 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; | 428 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; |
@@ -492,7 +492,7 @@ static int mace_open(struct net_device *dev) | |||
492 | 492 | ||
493 | static int mace_close(struct net_device *dev) | 493 | static int mace_close(struct net_device *dev) |
494 | { | 494 | { |
495 | struct mace_data *mp = (struct mace_data *) dev->priv; | 495 | struct mace_data *mp = netdev_priv(dev); |
496 | volatile struct mace __iomem *mb = mp->mace; | 496 | volatile struct mace __iomem *mb = mp->mace; |
497 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; | 497 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; |
498 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; | 498 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; |
@@ -512,7 +512,7 @@ static int mace_close(struct net_device *dev) | |||
512 | 512 | ||
513 | static inline void mace_set_timeout(struct net_device *dev) | 513 | static inline void mace_set_timeout(struct net_device *dev) |
514 | { | 514 | { |
515 | struct mace_data *mp = (struct mace_data *) dev->priv; | 515 | struct mace_data *mp = netdev_priv(dev); |
516 | 516 | ||
517 | if (mp->timeout_active) | 517 | if (mp->timeout_active) |
518 | del_timer(&mp->tx_timeout); | 518 | del_timer(&mp->tx_timeout); |
@@ -525,7 +525,7 @@ static inline void mace_set_timeout(struct net_device *dev) | |||
525 | 525 | ||
526 | static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) | 526 | static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) |
527 | { | 527 | { |
528 | struct mace_data *mp = (struct mace_data *) dev->priv; | 528 | struct mace_data *mp = netdev_priv(dev); |
529 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; | 529 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; |
530 | volatile struct dbdma_cmd *cp, *np; | 530 | volatile struct dbdma_cmd *cp, *np; |
531 | unsigned long flags; | 531 | unsigned long flags; |
@@ -580,7 +580,7 @@ static int mace_xmit_start(struct sk_buff *skb, struct net_device *dev) | |||
580 | 580 | ||
581 | static void mace_set_multicast(struct net_device *dev) | 581 | static void mace_set_multicast(struct net_device *dev) |
582 | { | 582 | { |
583 | struct mace_data *mp = (struct mace_data *) dev->priv; | 583 | struct mace_data *mp = netdev_priv(dev); |
584 | volatile struct mace __iomem *mb = mp->mace; | 584 | volatile struct mace __iomem *mb = mp->mace; |
585 | int i, j; | 585 | int i, j; |
586 | u32 crc; | 586 | u32 crc; |
@@ -655,7 +655,7 @@ static void mace_handle_misc_intrs(struct mace_data *mp, int intr, struct net_de | |||
655 | static irqreturn_t mace_interrupt(int irq, void *dev_id) | 655 | static irqreturn_t mace_interrupt(int irq, void *dev_id) |
656 | { | 656 | { |
657 | struct net_device *dev = (struct net_device *) dev_id; | 657 | struct net_device *dev = (struct net_device *) dev_id; |
658 | struct mace_data *mp = (struct mace_data *) dev->priv; | 658 | struct mace_data *mp = netdev_priv(dev); |
659 | volatile struct mace __iomem *mb = mp->mace; | 659 | volatile struct mace __iomem *mb = mp->mace; |
660 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; | 660 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; |
661 | volatile struct dbdma_cmd *cp; | 661 | volatile struct dbdma_cmd *cp; |
@@ -801,7 +801,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
801 | static void mace_tx_timeout(unsigned long data) | 801 | static void mace_tx_timeout(unsigned long data) |
802 | { | 802 | { |
803 | struct net_device *dev = (struct net_device *) data; | 803 | struct net_device *dev = (struct net_device *) data; |
804 | struct mace_data *mp = (struct mace_data *) dev->priv; | 804 | struct mace_data *mp = netdev_priv(dev); |
805 | volatile struct mace __iomem *mb = mp->mace; | 805 | volatile struct mace __iomem *mb = mp->mace; |
806 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; | 806 | volatile struct dbdma_regs __iomem *td = mp->tx_dma; |
807 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; | 807 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; |
@@ -872,7 +872,7 @@ static irqreturn_t mace_txdma_intr(int irq, void *dev_id) | |||
872 | static irqreturn_t mace_rxdma_intr(int irq, void *dev_id) | 872 | static irqreturn_t mace_rxdma_intr(int irq, void *dev_id) |
873 | { | 873 | { |
874 | struct net_device *dev = (struct net_device *) dev_id; | 874 | struct net_device *dev = (struct net_device *) dev_id; |
875 | struct mace_data *mp = (struct mace_data *) dev->priv; | 875 | struct mace_data *mp = netdev_priv(dev); |
876 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; | 876 | volatile struct dbdma_regs __iomem *rd = mp->rx_dma; |
877 | volatile struct dbdma_cmd *cp, *np; | 877 | volatile struct dbdma_cmd *cp, *np; |
878 | int i, nb, stat, next; | 878 | int i, nb, stat, next; |