public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, Matthew Wilcox <matthew@wil.cx>
Subject: Re: First steps towards making NO_IRQ a generic concept
Date: Thu, 3 Nov 2005 07:51:41 -0700	[thread overview]
Message-ID: <20051103145141.GX23749@parisc-linux.org> (raw)
In-Reply-To: <20051103144926.GV23749@parisc-linux.org>


Introduce PCI_NO_IRQ and pci_valid_irq()
Explicitly initialise pci_dev->irq with PCI_NO_IRQ, allowing us to change
the value of PCI_NO_IRQ when all drivers have been audited.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>

---

 drivers/pci/probe.c |    7 +++++--
 include/linux/pci.h |    9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

applies-to: 734b9ec7d20002b1acdc9f4f7142efa2e5340e0d
bc63ebe08e89a7be876a0538e2c563e2cb1d9617
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index fce2cb2..35ba70b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -571,9 +571,12 @@ static void pci_read_irq(struct pci_dev 
 	unsigned char irq;
 
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq);
-	if (irq)
+	if (irq) {
 		pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
-	dev->irq = irq;
+		dev->irq = irq;
+	} else {
+		dev->irq = PCI_NO_IRQ;
+	}
 }
 
 /**
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3596ac9..4e009e2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -140,6 +140,15 @@ struct pci_dev {
 	struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
 };
 
+/*
+ * The PCI subsystem has traditionally filled in 0 when no interrupt has been
+ * assigned.  While we should move to using NO_IRQ instead, many drivers
+ * remain to be converted.  Once all drivers are using PCI_NO_IRQ, switching
+ * over should be a simple search-and-replace.
+ */
+#define PCI_NO_IRQ		0
+#define pci_valid_irq(irq)	(irq != PCI_NO_IRQ)
+
 #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
 #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
---
0.99.8.GIT

  parent reply	other threads:[~2005-11-03 14:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-03 14:49 First steps towards making NO_IRQ a generic concept Matthew Wilcox
2005-11-03 14:51 ` Matthew Wilcox
2005-11-03 15:44   ` Ingo Molnar
2005-11-03 16:02     ` Matthew Wilcox
2005-11-03 16:20       ` Ingo Molnar
2005-11-03 17:05         ` Matthew Wilcox
2005-11-03 20:53           ` Ingo Molnar
2005-11-03 14:51 ` Matthew Wilcox [this message]
2005-11-03 17:15   ` Arjan van de Ven
2005-11-03 14:52 ` Matthew Wilcox
2005-11-03 14:52 ` Matthew Wilcox

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=20051103145141.GX23749@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox