lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347454546-23236-13-git-send-email-siglesias@igalia.com>
Date:	Wed, 12 Sep 2012 14:55:35 +0200
From:	Samuel Iglesias Gonsalvez <siglesias@...lia.com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	industrypack-devel@...ts.sourceforge.net,
	Jens Taprogge <jens.taprogge@...rogge.org>,
	Samuel Iglesias Gonsalvez <siglesias@...lia.com>
Subject: [PATCH 13/24] Staging: ipack/bridges/tpci200: Cleanup in tpci200_slot_irq() and tpci200_interrupt()

From: Jens Taprogge <jens.taprogge@...rogge.org>

Minor cleanup.  No functional changes.

Signed-off-by: Jens Taprogge <jens.taprogge@...rogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@...lia.com>
---
 drivers/staging/ipack/bridges/tpci200.c |   58 +++++++++++++++++--------------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 0cbaf3a..4eaa2aa 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -102,9 +102,13 @@ static void tpci200_unregister(struct tpci200_board *tpci200)
 
 static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
 {
-	irqreturn_t ret = slot_irq->handler(slot_irq->arg);
+	irqreturn_t ret;
 
-	/* Dummy reads */
+	if (!slot_irq)
+		return -ENODEV;
+	ret = slot_irq->handler(slot_irq->arg);
+
+	/* Clear the IPack device interrupt */
 	readw(slot_irq->holder->io_space.address + 0xC0);
 	readw(slot_irq->holder->io_space.address + 0xC2);
 
@@ -114,37 +118,37 @@ static irqreturn_t tpci200_slot_irq(struct slot_irq *slot_irq)
 static irqreturn_t tpci200_interrupt(int irq, void *dev_id)
 {
 	struct tpci200_board *tpci200 = (struct tpci200_board *) dev_id;
-	int i;
-	unsigned short status_reg;
 	struct slot_irq *slot_irq;
+	irqreturn_t ret;
+	u16 status_reg;
+	int i;
 
 	/* Read status register */
-	status_reg = readw(&tpci200->info->interface_regs->status);
-
-	if (status_reg & TPCI200_SLOT_INT_MASK) {
-		/* callback to the IRQ handler for the corresponding slot */
-		rcu_read_lock();
-		for (i = 0; i < TPCI200_NB_SLOT; i++) {
-			if (!(status_reg & ((TPCI200_A_INT0 | TPCI200_A_INT1) << (2*i))))
-				continue;
-			slot_irq = rcu_dereference(tpci200->slots[i].irq);
-			if (slot_irq) {
-				tpci200_slot_irq(slot_irq);
-			} else {
-				dev_info(&tpci200->info->pdev->dev,
-					 "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
-					 tpci200->number, i);
-				tpci200_clear_mask(tpci200,
-					&tpci200->info->interface_regs->control[i],
-					TPCI200_INT0_EN | TPCI200_INT1_EN);
-			}
-		}
-		rcu_read_unlock();
+	status_reg = ioread16(&tpci200->info->interface_regs->status);
 
-		return IRQ_HANDLED;
-	} else {
+	/* Did we cause the interrupt? */
+	if (!(status_reg & TPCI200_SLOT_INT_MASK))
 		return IRQ_NONE;
+
+	/* callback to the IRQ handler for the corresponding slot */
+	rcu_read_lock();
+	for (i = 0; i < TPCI200_NB_SLOT; i++) {
+		if (!(status_reg & ((TPCI200_A_INT0 | TPCI200_A_INT1) << (2 * i))))
+			continue;
+		slot_irq = rcu_dereference(tpci200->slots[i].irq);
+		ret = tpci200_slot_irq(slot_irq);
+		if (ret == -ENODEV) {
+			dev_info(&tpci200->info->pdev->dev,
+				 "No registered ISR for slot [%d:%d]!. IRQ will be disabled.\n",
+				 tpci200->number, i);
+			tpci200_clear_mask(tpci200,
+				&tpci200->info->interface_regs->control[i],
+				TPCI200_INT0_EN | TPCI200_INT1_EN);
+		}
 	}
+	rcu_read_unlock();
+
+	return IRQ_HANDLED;
 }
 
 static int tpci200_register(struct tpci200_board *tpci200)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ