Skip to contentSkip to conversation

use NR_IRQS for irq count

PATCH Applied Glauber Costa 2 participants 6 messages Apr 8, 2008 – Apr 10, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use NR_IRQS for irq count

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

---
 irqhook/irqhook_main.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
irqhook/irqhook_main.c +7 -9
index 5f414d1..828c70a 100644
@@ -31,15 +31,13 @@ #define ERROR(fmt, args...) printk("<1>"
 static spinlock_t irqh_lock;
 static wait_queue_head_t irqh_proc_list;
 
-enum {NINTR = 256};
-
-static DECLARE_BITMAP(pending, NINTR);
-static DECLARE_BITMAP(handled, NINTR);
+static DECLARE_BITMAP(pending, NR_IRQS);
+static DECLARE_BITMAP(handled, NR_IRQS);
 
 #define irqh_on(which, bit)	test_bit(bit, which)
 #define irqh_set(which, bit)	set_bit(bit, which)
 #define irqh_clear(which, bit)	clear_bit(bit, which)
-#define irqh_ffs(which)		find_first_bit(which, NINTR)
+#define irqh_ffs(which)		find_first_bit(which, NR_IRQS)
 
 static irqreturn_t
 irqh_interrupt(int irq, void *p)
@@ -92,7 +90,7 @@ irqh_dev_write(struct file *fp, const ch
 		if (pdp) {
 			if (pci_enable_device(pdp))
 				ERROR("device not enabled\n");
-			if ((unsigned)(n = pdp->irq) >= NINTR) {
+			if ((unsigned)(n = pdp->irq) >= NR_IRQS) {
 				ERROR("device has invalid IRQ set\n");
 				return -EINVAL;
 			}
@@ -107,7 +105,7 @@ irqh_dev_write(struct file *fp, const ch
 		irqh_set(handled, n);
 		goto done;
 	}
-	if ((unsigned)n >= NINTR)
+	if ((unsigned)n >= NR_IRQS)
 		return -EINVAL;
 	if (arg[0] == '-') {
 		if (pdp)
@@ -135,7 +133,7 @@ irqh_dev_read(struct file *fp, char *buf
 		return -EINVAL;
 	spin_lock_irq(&irqh_lock);
 	while (!signal_pending(current)) {
-		if ((n = irqh_ffs(pending)) < NINTR) {
+		if ((n = irqh_ffs(pending)) < NR_IRQS) {
 			if ((m = sprintf(b, "%d", n) + 1) > size)
 				m = size;
 			if (copy_to_user(buf, b, m))
@@ -203,7 +201,7 @@ irqh_cleanup(void)
 
 	DPRINTK("ENTER\n");
 	
-	while ((n = irqh_ffs(handled)) < NINTR) {
+	while ((n = irqh_ffs(handled)) < NR_IRQS) {
 		irqh_clear(handled, n);
 		free_irq(n, (void *)irqh_interrupt);
 	}
Signature · 1 line
1.4.2
Applied
#1 lore raw
Quoted 3 lines · * On Tuesday 08 April 2008 22:34:36 Glauber Costa wrote:

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Thanks, applied.

Going forward, we're going to use the in-kernel approach for interrupt injection (which already has this change). The irqhook module will stay around for testing / debugging purposes (will be used with -no-kvm-irqchip).

Amit.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

#2 lore raw
Quoted 5 lines · Amit Shah
Quoted 3 lines · * On Tuesday 08 April 2008 22:34:36 Glauber Costa wrote:

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Quoted 7 lines

Thanks, applied.

Going forward, we're going to use the in-kernel approach for interrupt injection (which already has this change). The irqhook module will stay around for testing / debugging purposes (will be used with -no-kvm-irqchip).

Amit.

Is it already in your tree?

#3 lore raw
Quoted 8 lines · * On Wednesday 09 Apr 2008 17:41:10 Glauber Costa wrote:
Quoted 7 lines · Amit Shah
Quoted 3 lines · * On Tuesday 08 April 2008 22:34:36 Glauber Costa wrote:

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Thanks, applied.

Quoted 8 lines
Quoted 6 lines

Going forward, we're going to use the in-kernel approach for interrupt injection (which already has this change). The irqhook module will stay around for testing / debugging purposes (will be used with -no-kvm-irqchip).

Amit.

Is it already in your tree?

Yes, it's in the new tree I just sent the link to.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

#4 lore raw
In reply to Glauber Costa
Quoted 8 lines · * On Wednesday 09 Apr 2008 17:41:10 Glauber Costa wrote:
Quoted 7 lines · Amit Shah
Quoted 3 lines · * On Tuesday 08 April 2008 22:34:36 Glauber Costa wrote:

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Thanks, applied.

Quoted 8 lines
Quoted 6 lines

Going forward, we're going to use the in-kernel approach for interrupt injection (which already has this change). The irqhook module will stay around for testing / debugging purposes (will be used with -no-kvm-irqchip).

Amit.

Is it already in your tree?

Yes, it's in the new tree I just sent the link to.

Applied
#5 lore raw
In reply to Glauber Costa
Quoted 3 lines · * On Tuesday 08 April 2008 22:34:36 Glauber Costa wrote:

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Thanks, applied.

Going forward, we're going to use the in-kernel approach for interrupt injection (which already has this change). The irqhook module will stay around for testing / debugging purposes (will be used with -no-kvm-irqchip).

Amit.