lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq
Date
Rather than poking the registers manually, better use the exported
interfaces for it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/micrel/ks8695net.c | 30 ++-----------------------
1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
index 6006d47707cb..3b6375adff08 100644
--- a/drivers/net/ethernet/micrel/ks8695net.c
+++ b/drivers/net/ethernet/micrel/ks8695net.c
@@ -402,25 +402,6 @@ ks8695_tx_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}

-/**
- * ks8695_get_rx_enable_bit - Get rx interrupt enable/status bit
- * @ksp: Private data for the KS8695 Ethernet
- *
- * For KS8695 document:
- * Interrupt Enable Register (offset 0xE204)
- * Bit29 : WAN MAC Receive Interrupt Enable
- * Bit16 : LAN MAC Receive Interrupt Enable
- * Interrupt Status Register (Offset 0xF208)
- * Bit29: WAN MAC Receive Status
- * Bit16: LAN MAC Receive Status
- * So, this Rx interrupt enable/status bit number is equal
- * as Rx IRQ number.
- */
-static inline u32 ks8695_get_rx_enable_bit(struct ks8695_priv *ksp)
-{
- return ksp->rx_irq;
-}
-
/**
* ks8695_rx_irq - Receive IRQ handler
* @irq: The IRQ which went off (ignored)
@@ -438,11 +419,7 @@ ks8695_rx_irq(int irq, void *dev_id)
spin_lock(&ksp->rx_lock);

if (napi_schedule_prep(&ksp->napi)) {
- unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
- unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
- /*disable rx interrupt*/
- status &= ~mask_bit;
- writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+ disable_irq(ksp->rx_irq);
__napi_schedule(&ksp->napi);
}

@@ -561,8 +538,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
static int ks8695_poll(struct napi_struct *napi, int budget)
{
struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
- unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
- unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
int work_done;

work_done = ks8695_rx(ksp, budget);
@@ -571,8 +546,7 @@ static int ks8695_poll(struct napi_struct *napi, int budget)
unsigned long flags;

spin_lock_irqsave(&ksp->rx_lock, flags);
- /* enable rx interrupt */
- writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
+ enable_irq(ksp->rx_irq);
spin_unlock_irqrestore(&ksp->rx_lock, flags);
}
return work_done;
--
2.20.0
\
 
 \ /
  Last update: 2019-04-15 22:36    [W:0.067 / U:8.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site