[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180627000612.27263-5-paul.burton@mips.com>
Date: Tue, 26 Jun 2018 17:06:05 -0700
From: Paul Burton <paul.burton@...s.com>
To: netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>, paul.burton@...s.com
Subject: [PATCH v7 04/11] net: pch_gbe: Remove irq_sem
The pch_gbe driver uses an irq_sem variable to implement a sempahore
that seems to inconsistently count the number of times we enable or
disable interrupts, and only write to the interrupt enable register when
this count hits 0. This makes absolutely no sense to me, both from the
perspective of how the implementation is modifying the variable & more
fundamentally the fact that we know when we want or do not want
interrupts enabled without any need for the semaphore.
This patch removes irq_sem, so pch_gbe_irq_enable() &
pch_gbe_irq_disable() will both always write to the INT_EN register.
Signed-off-by: Paul Burton <paul.burton@...s.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: David S. Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
---
Changes in v7: New patch
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | 2 --
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 7 +------
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
index be218ac81f21..1bb0ea4f5503 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
@@ -555,7 +555,6 @@ struct pch_gbe_privdata {
/**
* struct pch_gbe_adapter - board specific private data structure
* @stats_lock: Spinlock structure for status
- * @irq_sem: Semaphore for interrupt
* @netdev: Pointer of network device structure
* @pdev: Pointer of pci device structure
* @napi: NAPI structure
@@ -574,7 +573,6 @@ struct pch_gbe_privdata {
struct pch_gbe_adapter {
spinlock_t stats_lock;
- atomic_t irq_sem;
struct net_device *netdev;
struct pci_dev *pdev;
int irq;
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 5157cea16773..ee38bba8b9ce 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -761,7 +761,6 @@ static void pch_gbe_irq_disable(struct pch_gbe_adapter *adapter)
{
struct pch_gbe_hw *hw = &adapter->hw;
- atomic_inc(&adapter->irq_sem);
iowrite32(0, &hw->reg->INT_EN);
ioread32(&hw->reg->INT_ST);
synchronize_irq(adapter->irq);
@@ -778,8 +777,7 @@ static void pch_gbe_irq_enable(struct pch_gbe_adapter *adapter)
{
struct pch_gbe_hw *hw = &adapter->hw;
- if (likely(atomic_dec_and_test(&adapter->irq_sem)))
- iowrite32(PCH_GBE_INT_ENABLE_MASK, &hw->reg->INT_EN);
+ iowrite32(PCH_GBE_INT_ENABLE_MASK, &hw->reg->INT_EN);
ioread32(&hw->reg->INT_ST);
netdev_dbg(adapter->netdev, "INT_EN reg : 0x%08x\n",
ioread32(&hw->reg->INT_EN));
@@ -1345,7 +1343,6 @@ static irqreturn_t pch_gbe_intr(int irq, void *data)
(adapter->rx_stop_flag)) {
if (likely(napi_schedule_prep(&adapter->napi))) {
/* Enable only Rx Descriptor empty */
- atomic_inc(&adapter->irq_sem);
int_en = ioread32(&hw->reg->INT_EN);
int_en &=
~(PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT);
@@ -1954,7 +1951,6 @@ void pch_gbe_down(struct pch_gbe_adapter *adapter)
/* signal that we're down so the interrupt handler does not
* reschedule our watchdog timer */
napi_disable(&adapter->napi);
- atomic_set(&adapter->irq_sem, 0);
pch_gbe_irq_disable(adapter);
pch_gbe_free_irq(adapter);
@@ -2000,7 +1996,6 @@ static int pch_gbe_sw_init(struct pch_gbe_adapter *adapter)
}
spin_lock_init(&adapter->hw.miim_lock);
spin_lock_init(&adapter->stats_lock);
- atomic_set(&adapter->irq_sem, 0);
pch_gbe_irq_disable(adapter);
pch_gbe_init_stats(adapter);
--
2.18.0
Powered by blists - more mailing lists