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/irda/vlsi_ir.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/irda/vlsi_ir.c')
-rw-r--r-- | drivers/net/irda/vlsi_ir.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index a3d27d78fc89..0d30f8d659a1 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
@@ -178,7 +178,7 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev) | |||
178 | 178 | ||
179 | static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev) | 179 | static void vlsi_proc_ndev(struct seq_file *seq, struct net_device *ndev) |
180 | { | 180 | { |
181 | vlsi_irda_dev_t *idev = ndev->priv; | 181 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
182 | u8 byte; | 182 | u8 byte; |
183 | u16 word; | 183 | u16 word; |
184 | unsigned delta1, delta2; | 184 | unsigned delta1, delta2; |
@@ -346,7 +346,7 @@ static void vlsi_proc_ring(struct seq_file *seq, struct vlsi_ring *r) | |||
346 | static int vlsi_seq_show(struct seq_file *seq, void *v) | 346 | static int vlsi_seq_show(struct seq_file *seq, void *v) |
347 | { | 347 | { |
348 | struct net_device *ndev = seq->private; | 348 | struct net_device *ndev = seq->private; |
349 | vlsi_irda_dev_t *idev = ndev->priv; | 349 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
350 | unsigned long flags; | 350 | unsigned long flags; |
351 | 351 | ||
352 | seq_printf(seq, "\n%s %s\n\n", DRIVER_NAME, DRIVER_VERSION); | 352 | seq_printf(seq, "\n%s %s\n\n", DRIVER_NAME, DRIVER_VERSION); |
@@ -543,7 +543,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd) | |||
543 | struct sk_buff *skb; | 543 | struct sk_buff *skb; |
544 | int ret = 0; | 544 | int ret = 0; |
545 | struct net_device *ndev = (struct net_device *)pci_get_drvdata(r->pdev); | 545 | struct net_device *ndev = (struct net_device *)pci_get_drvdata(r->pdev); |
546 | vlsi_irda_dev_t *idev = ndev->priv; | 546 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
547 | 547 | ||
548 | pci_dma_sync_single_for_cpu(r->pdev, rd_get_addr(rd), r->len, r->dir); | 548 | pci_dma_sync_single_for_cpu(r->pdev, rd_get_addr(rd), r->len, r->dir); |
549 | /* dma buffer now owned by the CPU */ | 549 | /* dma buffer now owned by the CPU */ |
@@ -637,7 +637,7 @@ static void vlsi_fill_rx(struct vlsi_ring *r) | |||
637 | 637 | ||
638 | static void vlsi_rx_interrupt(struct net_device *ndev) | 638 | static void vlsi_rx_interrupt(struct net_device *ndev) |
639 | { | 639 | { |
640 | vlsi_irda_dev_t *idev = ndev->priv; | 640 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
641 | struct vlsi_ring *r = idev->rx_ring; | 641 | struct vlsi_ring *r = idev->rx_ring; |
642 | struct ring_descr *rd; | 642 | struct ring_descr *rd; |
643 | int ret; | 643 | int ret; |
@@ -855,7 +855,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase) | |||
855 | 855 | ||
856 | static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) | 856 | static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
857 | { | 857 | { |
858 | vlsi_irda_dev_t *idev = ndev->priv; | 858 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
859 | struct vlsi_ring *r = idev->tx_ring; | 859 | struct vlsi_ring *r = idev->tx_ring; |
860 | struct ring_descr *rd; | 860 | struct ring_descr *rd; |
861 | unsigned long flags; | 861 | unsigned long flags; |
@@ -1062,7 +1062,7 @@ drop: | |||
1062 | 1062 | ||
1063 | static void vlsi_tx_interrupt(struct net_device *ndev) | 1063 | static void vlsi_tx_interrupt(struct net_device *ndev) |
1064 | { | 1064 | { |
1065 | vlsi_irda_dev_t *idev = ndev->priv; | 1065 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1066 | struct vlsi_ring *r = idev->tx_ring; | 1066 | struct vlsi_ring *r = idev->tx_ring; |
1067 | struct ring_descr *rd; | 1067 | struct ring_descr *rd; |
1068 | unsigned iobase; | 1068 | unsigned iobase; |
@@ -1261,7 +1261,7 @@ static inline void vlsi_clear_regs(unsigned iobase) | |||
1261 | static int vlsi_init_chip(struct pci_dev *pdev) | 1261 | static int vlsi_init_chip(struct pci_dev *pdev) |
1262 | { | 1262 | { |
1263 | struct net_device *ndev = pci_get_drvdata(pdev); | 1263 | struct net_device *ndev = pci_get_drvdata(pdev); |
1264 | vlsi_irda_dev_t *idev = ndev->priv; | 1264 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1265 | unsigned iobase; | 1265 | unsigned iobase; |
1266 | u16 ptr; | 1266 | u16 ptr; |
1267 | 1267 | ||
@@ -1375,14 +1375,14 @@ static int vlsi_stop_hw(vlsi_irda_dev_t *idev) | |||
1375 | 1375 | ||
1376 | static struct net_device_stats * vlsi_get_stats(struct net_device *ndev) | 1376 | static struct net_device_stats * vlsi_get_stats(struct net_device *ndev) |
1377 | { | 1377 | { |
1378 | vlsi_irda_dev_t *idev = ndev->priv; | 1378 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1379 | 1379 | ||
1380 | return &idev->stats; | 1380 | return &idev->stats; |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | static void vlsi_tx_timeout(struct net_device *ndev) | 1383 | static void vlsi_tx_timeout(struct net_device *ndev) |
1384 | { | 1384 | { |
1385 | vlsi_irda_dev_t *idev = ndev->priv; | 1385 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1386 | 1386 | ||
1387 | 1387 | ||
1388 | vlsi_reg_debug(ndev->base_addr, __func__); | 1388 | vlsi_reg_debug(ndev->base_addr, __func__); |
@@ -1407,7 +1407,7 @@ static void vlsi_tx_timeout(struct net_device *ndev) | |||
1407 | 1407 | ||
1408 | static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | 1408 | static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) |
1409 | { | 1409 | { |
1410 | vlsi_irda_dev_t *idev = ndev->priv; | 1410 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1411 | struct if_irda_req *irq = (struct if_irda_req *) rq; | 1411 | struct if_irda_req *irq = (struct if_irda_req *) rq; |
1412 | unsigned long flags; | 1412 | unsigned long flags; |
1413 | u16 fifocnt; | 1413 | u16 fifocnt; |
@@ -1457,7 +1457,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | |||
1457 | static irqreturn_t vlsi_interrupt(int irq, void *dev_instance) | 1457 | static irqreturn_t vlsi_interrupt(int irq, void *dev_instance) |
1458 | { | 1458 | { |
1459 | struct net_device *ndev = dev_instance; | 1459 | struct net_device *ndev = dev_instance; |
1460 | vlsi_irda_dev_t *idev = ndev->priv; | 1460 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1461 | unsigned iobase; | 1461 | unsigned iobase; |
1462 | u8 irintr; | 1462 | u8 irintr; |
1463 | int boguscount = 5; | 1463 | int boguscount = 5; |
@@ -1498,7 +1498,7 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance) | |||
1498 | 1498 | ||
1499 | static int vlsi_open(struct net_device *ndev) | 1499 | static int vlsi_open(struct net_device *ndev) |
1500 | { | 1500 | { |
1501 | vlsi_irda_dev_t *idev = ndev->priv; | 1501 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1502 | int err = -EAGAIN; | 1502 | int err = -EAGAIN; |
1503 | char hwname[32]; | 1503 | char hwname[32]; |
1504 | 1504 | ||
@@ -1557,7 +1557,7 @@ errout: | |||
1557 | 1557 | ||
1558 | static int vlsi_close(struct net_device *ndev) | 1558 | static int vlsi_close(struct net_device *ndev) |
1559 | { | 1559 | { |
1560 | vlsi_irda_dev_t *idev = ndev->priv; | 1560 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1561 | 1561 | ||
1562 | netif_stop_queue(ndev); | 1562 | netif_stop_queue(ndev); |
1563 | 1563 | ||
@@ -1580,7 +1580,7 @@ static int vlsi_close(struct net_device *ndev) | |||
1580 | 1580 | ||
1581 | static int vlsi_irda_init(struct net_device *ndev) | 1581 | static int vlsi_irda_init(struct net_device *ndev) |
1582 | { | 1582 | { |
1583 | vlsi_irda_dev_t *idev = ndev->priv; | 1583 | vlsi_irda_dev_t *idev = netdev_priv(ndev); |
1584 | struct pci_dev *pdev = idev->pdev; | 1584 | struct pci_dev *pdev = idev->pdev; |
1585 | 1585 | ||
1586 | ndev->irq = pdev->irq; | 1586 | ndev->irq = pdev->irq; |
@@ -1655,7 +1655,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1655 | goto out_disable; | 1655 | goto out_disable; |
1656 | } | 1656 | } |
1657 | 1657 | ||
1658 | idev = ndev->priv; | 1658 | idev = netdev_priv(ndev); |
1659 | 1659 | ||
1660 | spin_lock_init(&idev->lock); | 1660 | spin_lock_init(&idev->lock); |
1661 | mutex_init(&idev->mtx); | 1661 | mutex_init(&idev->mtx); |
@@ -1712,7 +1712,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev) | |||
1712 | 1712 | ||
1713 | unregister_netdev(ndev); | 1713 | unregister_netdev(ndev); |
1714 | 1714 | ||
1715 | idev = ndev->priv; | 1715 | idev = netdev_priv(ndev); |
1716 | mutex_lock(&idev->mtx); | 1716 | mutex_lock(&idev->mtx); |
1717 | if (idev->proc_entry) { | 1717 | if (idev->proc_entry) { |
1718 | remove_proc_entry(ndev->name, vlsi_proc_root); | 1718 | remove_proc_entry(ndev->name, vlsi_proc_root); |
@@ -1747,7 +1747,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1747 | __func__, pci_name(pdev)); | 1747 | __func__, pci_name(pdev)); |
1748 | return 0; | 1748 | return 0; |
1749 | } | 1749 | } |
1750 | idev = ndev->priv; | 1750 | idev = netdev_priv(ndev); |
1751 | mutex_lock(&idev->mtx); | 1751 | mutex_lock(&idev->mtx); |
1752 | if (pdev->current_state != 0) { /* already suspended */ | 1752 | if (pdev->current_state != 0) { /* already suspended */ |
1753 | if (state.event > pdev->current_state) { /* simply go deeper */ | 1753 | if (state.event > pdev->current_state) { /* simply go deeper */ |
@@ -1786,7 +1786,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev) | |||
1786 | __func__, pci_name(pdev)); | 1786 | __func__, pci_name(pdev)); |
1787 | return 0; | 1787 | return 0; |
1788 | } | 1788 | } |
1789 | idev = ndev->priv; | 1789 | idev = netdev_priv(ndev); |
1790 | mutex_lock(&idev->mtx); | 1790 | mutex_lock(&idev->mtx); |
1791 | if (pdev->current_state == 0) { | 1791 | if (pdev->current_state == 0) { |
1792 | mutex_unlock(&idev->mtx); | 1792 | mutex_unlock(&idev->mtx); |