linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Greg Ungerer <gerg@uclinux.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	arm@kernel.org, Arnd Bergmann <arnd@arndb.de>,
	"David S. Miller" <davem@davemloft.net>,
	YueHaibing <yuehaibing@huawei.com>,
	Yang Wei <yang.wei9@zte.com.cn>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq
Date: Mon, 15 Apr 2019 22:24:14 +0200	[thread overview]
Message-ID: <20190415202501.941196-2-arnd@arndb.de> (raw)
In-Reply-To: <20190415202501.941196-1-arnd@arndb.de>

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


  reply	other threads:[~2019-04-15 20:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
2019-04-15 20:24 ` Arnd Bergmann [this message]
2019-04-15 20:24 ` [PATCH 3/6] ARM: ks8695: net: move machine header contents Arnd Bergmann
2019-04-15 20:24 ` [PATCH 4/6] ARM: ks8695: move gpio code back into platform Arnd Bergmann
2019-04-23 10:44   ` Linus Walleij
2019-04-15 20:24 ` [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack Arnd Bergmann
2019-04-20  2:06   ` Greg Ungerer
2019-04-15 20:24 ` [PATCH 6/6] ARM: ks8695: split up uart register headers Arnd Bergmann
2019-04-15 20:54 ` [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Guenter Roeck
2019-04-15 20:58   ` Arnd Bergmann
2019-04-16 13:21 ` [PATCH 1/6 v2] " Arnd Bergmann
2019-04-16 18:09   ` Guenter Roeck
2019-04-20  2:36 ` [PATCH 1/6] " Greg Ungerer
2019-05-03  7:02 ` Greg Ungerer
2019-05-03  7:16   ` Linus Walleij
2019-05-03 17:06     ` Guenter Roeck
2019-05-04 14:26       ` Greg Ungerer
2019-07-22 14:44         ` Arnd Bergmann
2019-07-22 20:13           ` Olof Johansson
2019-07-29 12:53           ` Greg Ungerer
2019-07-29 15:45             ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190415202501.941196-2-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=arm@kernel.org \
    --cc=davem@davemloft.net \
    --cc=gerg@uclinux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yang.wei9@zte.com.cn \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).