All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: Glauber Costa <gcosta@redhat.com>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH] use NR_IRQS for irq count
Date: Tue,  8 Apr 2008 14:04:36 -0300	[thread overview]
Message-ID: <12076742761764-git-send-email-gcosta@redhat.com> (raw)

Instead of artificially limiting irq numbers, use arch provided NR_IRQS

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 irqhook/irqhook_main.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/irqhook/irqhook_main.c b/irqhook/irqhook_main.c
index 5f414d1..828c70a 100644
--- a/irqhook/irqhook_main.c
+++ b/irqhook/irqhook_main.c
@@ -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);
 	}
-- 
1.4.2

             reply	other threads:[~2008-04-08 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-08 17:04 Glauber Costa [this message]
2008-04-09  4:43 ` [PATCH] use NR_IRQS for irq count Amit Shah
2008-04-09  4:43 ` Amit Shah
2008-04-09 12:11   ` Glauber Costa
2008-04-10  9:11     ` Amit Shah
2008-04-10  9:11     ` Amit Shah

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=12076742761764-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.