public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [RFC] PCI: read revision ID by default
@ 2007-06-08 22:46 Auke Kok
  2007-06-08 22:46 ` [PATCH 2/2] [RFC] PCI: Change all drivers to use pci_device->revision Auke Kok
  2007-06-09  6:59 ` [PATCH 1/2] [RFC] PCI: read revision ID by default Grant Grundler
  0 siblings, 2 replies; 7+ messages in thread
From: Auke Kok @ 2007-06-08 22:46 UTC (permalink / raw)
  To: linux-kernel, linux-pci, gregkh

Currently there are 97 occurrences where drivers need the pci
revision ID. We can do this once for all devices. Even the pci
subsystem needs the revision several times for quirks. The extra
u8 member pads out nicely in the pci_dev struct.

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---

 drivers/pci/probe.c |    3 +++
 include/linux/pci.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e48fcf0..0fdb71d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -918,6 +918,9 @@ pci_scan_device(struct pci_bus *bus, int devfn)
 	dev->cfg_size = pci_cfg_space_size(dev);
 	dev->error_state = pci_channel_io_normal;
 
+	/* read the PCI revision: 1 byte */
+	pci_read_config_byte(dev, PCI_REVISION_ID, &dev->revision);
+
 	/* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer)
 	   set this higher, assuming the system even supports it.  */
 	dev->dma_mask = 0xffffffff;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fbf3766..9847936 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -138,6 +138,7 @@ struct pci_dev {
 	unsigned short	subsystem_vendor;
 	unsigned short	subsystem_device;
 	unsigned int	class;		/* 3 bytes: (base,sub,prog-if) */
+	u8		revision;	/* PCI revision, low byte of class word */
 	u8		hdr_type;	/* PCI header type (`multi' flag masked out) */
 	u8		rom_base_reg;	/* which config register controls the ROM */
 	u8		pin;  		/* which interrupt pin this device uses */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-06-11 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-08 22:46 [PATCH 1/2] [RFC] PCI: read revision ID by default Auke Kok
2007-06-08 22:46 ` [PATCH 2/2] [RFC] PCI: Change all drivers to use pci_device->revision Auke Kok
2007-06-11 15:19   ` Dave Jones
2007-06-09  6:59 ` [PATCH 1/2] [RFC] PCI: read revision ID by default Grant Grundler
2007-06-09  8:02   ` David Miller
2007-06-09 19:31     ` Kok, Auke
2007-06-09 19:48   ` Kok, Auke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox