aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2009-08-28 10:01:57 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-29 18:42:58 -0400
commit09943a1819a240ff4a72f924d0038818fcdd0a90 (patch)
tree7cb2e3833a2ec97b71e7b0bd7cb79fb31781cda8 /drivers/net/tg3.c
parent8ef0442f98850333196bc56415192e52a6267878 (diff)
tg3: Convert ISR parameter to tnapi
This patch migrates the ISR parameter from struct net_device to struct tg3_napi. Checkpatch complains about the existence of the preexisting IRQF_SAMPLE_RANDOM flag. I've opted to keep this patch conservative and let it continue to exist until the flag gets officially purged from the kernel. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index b308c409e474..bf9a33305319 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -4757,14 +4757,14 @@ static inline void tg3_full_unlock(struct tg3 *tp)
4757 */ 4757 */
4758static irqreturn_t tg3_msi_1shot(int irq, void *dev_id) 4758static irqreturn_t tg3_msi_1shot(int irq, void *dev_id)
4759{ 4759{
4760 struct net_device *dev = dev_id; 4760 struct tg3_napi *tnapi = dev_id;
4761 struct tg3 *tp = netdev_priv(dev); 4761 struct tg3 *tp = tnapi->tp;
4762 4762
4763 prefetch(tp->hw_status); 4763 prefetch(tp->hw_status);
4764 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); 4764 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
4765 4765
4766 if (likely(!tg3_irq_sync(tp))) 4766 if (likely(!tg3_irq_sync(tp)))
4767 napi_schedule(&tp->napi[0].napi); 4767 napi_schedule(&tnapi->napi);
4768 4768
4769 return IRQ_HANDLED; 4769 return IRQ_HANDLED;
4770} 4770}
@@ -4775,8 +4775,8 @@ static irqreturn_t tg3_msi_1shot(int irq, void *dev_id)
4775 */ 4775 */
4776static irqreturn_t tg3_msi(int irq, void *dev_id) 4776static irqreturn_t tg3_msi(int irq, void *dev_id)
4777{ 4777{
4778 struct net_device *dev = dev_id; 4778 struct tg3_napi *tnapi = dev_id;
4779 struct tg3 *tp = netdev_priv(dev); 4779 struct tg3 *tp = tnapi->tp;
4780 4780
4781 prefetch(tp->hw_status); 4781 prefetch(tp->hw_status);
4782 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); 4782 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
@@ -4789,15 +4789,15 @@ static irqreturn_t tg3_msi(int irq, void *dev_id)
4789 */ 4789 */
4790 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); 4790 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
4791 if (likely(!tg3_irq_sync(tp))) 4791 if (likely(!tg3_irq_sync(tp)))
4792 napi_schedule(&tp->napi[0].napi); 4792 napi_schedule(&tnapi->napi);
4793 4793
4794 return IRQ_RETVAL(1); 4794 return IRQ_RETVAL(1);
4795} 4795}
4796 4796
4797static irqreturn_t tg3_interrupt(int irq, void *dev_id) 4797static irqreturn_t tg3_interrupt(int irq, void *dev_id)
4798{ 4798{
4799 struct net_device *dev = dev_id; 4799 struct tg3_napi *tnapi = dev_id;
4800 struct tg3 *tp = netdev_priv(dev); 4800 struct tg3 *tp = tnapi->tp;
4801 struct tg3_hw_status *sblk = tp->hw_status; 4801 struct tg3_hw_status *sblk = tp->hw_status;
4802 unsigned int handled = 1; 4802 unsigned int handled = 1;
4803 4803
@@ -4831,7 +4831,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
4831 sblk->status &= ~SD_STATUS_UPDATED; 4831 sblk->status &= ~SD_STATUS_UPDATED;
4832 if (likely(tg3_has_work(tp))) { 4832 if (likely(tg3_has_work(tp))) {
4833 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); 4833 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
4834 napi_schedule(&tp->napi[0].napi); 4834 napi_schedule(&tnapi->napi);
4835 } else { 4835 } else {
4836 /* No work, shared interrupt perhaps? re-enable 4836 /* No work, shared interrupt perhaps? re-enable
4837 * interrupts, and flush that PCI write 4837 * interrupts, and flush that PCI write
@@ -4845,8 +4845,8 @@ out:
4845 4845
4846static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id) 4846static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
4847{ 4847{
4848 struct net_device *dev = dev_id; 4848 struct tg3_napi *tnapi = dev_id;
4849 struct tg3 *tp = netdev_priv(dev); 4849 struct tg3 *tp = tnapi->tp;
4850 struct tg3_hw_status *sblk = tp->hw_status; 4850 struct tg3_hw_status *sblk = tp->hw_status;
4851 unsigned int handled = 1; 4851 unsigned int handled = 1;
4852 4852
@@ -4889,7 +4889,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
4889 4889
4890 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); 4890 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
4891 4891
4892 napi_schedule(&tp->napi[0].napi); 4892 napi_schedule(&tnapi->napi);
4893 4893
4894out: 4894out:
4895 return IRQ_RETVAL(handled); 4895 return IRQ_RETVAL(handled);
@@ -4898,8 +4898,8 @@ out:
4898/* ISR for interrupt test */ 4898/* ISR for interrupt test */
4899static irqreturn_t tg3_test_isr(int irq, void *dev_id) 4899static irqreturn_t tg3_test_isr(int irq, void *dev_id)
4900{ 4900{
4901 struct net_device *dev = dev_id; 4901 struct tg3_napi *tnapi = dev_id;
4902 struct tg3 *tp = netdev_priv(dev); 4902 struct tg3 *tp = tnapi->tp;
4903 struct tg3_hw_status *sblk = tp->hw_status; 4903 struct tg3_hw_status *sblk = tp->hw_status;
4904 4904
4905 if ((sblk->status & SD_STATUS_UPDATED) || 4905 if ((sblk->status & SD_STATUS_UPDATED) ||
@@ -7697,7 +7697,7 @@ static int tg3_request_irq(struct tg3 *tp)
7697{ 7697{
7698 irq_handler_t fn; 7698 irq_handler_t fn;
7699 unsigned long flags; 7699 unsigned long flags;
7700 struct net_device *dev = tp->dev; 7700 char *name = tp->dev->name;
7701 7701
7702 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 7702 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
7703 fn = tg3_msi; 7703 fn = tg3_msi;
@@ -7710,11 +7710,12 @@ static int tg3_request_irq(struct tg3 *tp)
7710 fn = tg3_interrupt_tagged; 7710 fn = tg3_interrupt_tagged;
7711 flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM; 7711 flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM;
7712 } 7712 }
7713 return (request_irq(tp->pdev->irq, fn, flags, dev->name, dev)); 7713 return request_irq(tp->pdev->irq, fn, flags, name, &tp->napi[0]);
7714} 7714}
7715 7715
7716static int tg3_test_interrupt(struct tg3 *tp) 7716static int tg3_test_interrupt(struct tg3 *tp)
7717{ 7717{
7718 struct tg3_napi *tnapi = &tp->napi[0];
7718 struct net_device *dev = tp->dev; 7719 struct net_device *dev = tp->dev;
7719 int err, i, intr_ok = 0; 7720 int err, i, intr_ok = 0;
7720 7721
@@ -7723,10 +7724,10 @@ static int tg3_test_interrupt(struct tg3 *tp)
7723 7724
7724 tg3_disable_ints(tp); 7725 tg3_disable_ints(tp);
7725 7726
7726 free_irq(tp->pdev->irq, dev); 7727 free_irq(tp->pdev->irq, tnapi);
7727 7728
7728 err = request_irq(tp->pdev->irq, tg3_test_isr, 7729 err = request_irq(tp->pdev->irq, tg3_test_isr,
7729 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); 7730 IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, tnapi);
7730 if (err) 7731 if (err)
7731 return err; 7732 return err;
7732 7733
@@ -7754,7 +7755,7 @@ static int tg3_test_interrupt(struct tg3 *tp)
7754 7755
7755 tg3_disable_ints(tp); 7756 tg3_disable_ints(tp);
7756 7757
7757 free_irq(tp->pdev->irq, dev); 7758 free_irq(tp->pdev->irq, tnapi);
7758 7759
7759 err = tg3_request_irq(tp); 7760 err = tg3_request_irq(tp);
7760 7761
@@ -7772,7 +7773,6 @@ static int tg3_test_interrupt(struct tg3 *tp)
7772 */ 7773 */
7773static int tg3_test_msi(struct tg3 *tp) 7774static int tg3_test_msi(struct tg3 *tp)
7774{ 7775{
7775 struct net_device *dev = tp->dev;
7776 int err; 7776 int err;
7777 u16 pci_cmd; 7777 u16 pci_cmd;
7778 7778
@@ -7803,7 +7803,8 @@ static int tg3_test_msi(struct tg3 *tp)
7803 "the PCI maintainer and include system chipset information.\n", 7803 "the PCI maintainer and include system chipset information.\n",
7804 tp->dev->name); 7804 tp->dev->name);
7805 7805
7806 free_irq(tp->pdev->irq, dev); 7806 free_irq(tp->pdev->irq, &tp->napi[0]);
7807
7807 pci_disable_msi(tp->pdev); 7808 pci_disable_msi(tp->pdev);
7808 7809
7809 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI; 7810 tp->tg3_flags2 &= ~TG3_FLG2_USING_MSI;
@@ -7823,7 +7824,7 @@ static int tg3_test_msi(struct tg3 *tp)
7823 tg3_full_unlock(tp); 7824 tg3_full_unlock(tp);
7824 7825
7825 if (err) 7826 if (err)
7826 free_irq(tp->pdev->irq, dev); 7827 free_irq(tp->pdev->irq, &tp->napi[0]);
7827 7828
7828 return err; 7829 return err;
7829} 7830}
@@ -8002,7 +8003,7 @@ static int tg3_open(struct net_device *dev)
8002 return 0; 8003 return 0;
8003 8004
8004err_out2: 8005err_out2:
8005 free_irq(tp->pdev->irq, dev); 8006 free_irq(tp->pdev->irq, &tp->napi[0]);
8006 8007
8007err_out1: 8008err_out1:
8008 napi_disable(&tp->napi[0].napi); 8009 napi_disable(&tp->napi[0].napi);
@@ -8266,7 +8267,7 @@ static int tg3_close(struct net_device *dev)
8266 8267
8267 tg3_full_unlock(tp); 8268 tg3_full_unlock(tp);
8268 8269
8269 free_irq(tp->pdev->irq, dev); 8270 free_irq(tp->pdev->irq, &tp->napi[0]);
8270 8271
8271 tg3_ints_fini(tp); 8272 tg3_ints_fini(tp);
8272 8273