From 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Fri, 8 Jun 2007 15:46:36 -0700 Subject: PCI: Change all drivers to use pci_device->revision Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok Acked-by: Dave Jones Signed-off-by: Greg Kroah-Hartman --- drivers/video/kyro/STG4000InitDevice.c | 5 ++--- drivers/video/matrox/matroxfb_base.c | 4 +--- drivers/video/sis/sis_main.c | 2 +- drivers/video/sstfb.c | 2 +- drivers/video/tgafb.c | 3 +-- 5 files changed, 6 insertions(+), 10 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/kyro/STG4000InitDevice.c b/drivers/video/kyro/STG4000InitDevice.c index ab5285a7f1d6..1d3f2080aa6f 100644 --- a/drivers/video/kyro/STG4000InitDevice.c +++ b/drivers/video/kyro/STG4000InitDevice.c @@ -247,7 +247,6 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev) u32 ulCoreClock; u32 tmp; u32 ulChipSpeed; - u8 rev; STG_WRITE_REG(IntMask, 0xFFFF); @@ -276,9 +275,9 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev) PMX2_SOFTRESET_ROM_RST); pci_read_config_word(pDev, PCI_CONFIG_SUBSYS_ID, &sub); - pci_read_config_byte(pDev, PCI_REVISION_ID, &rev); - ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub, (u32)rev); + ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub, + (u32)pDev->revision); if (ulChipSpeed == 0) return -EINVAL; diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index c8559a756b75..886e475f22f2 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c @@ -1994,7 +1994,6 @@ static void matroxfb_unregister_device(struct matrox_fb_info* minfo) { static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) { struct board* b; - u_int8_t rev; u_int16_t svid; u_int16_t sid; struct matrox_fb_info* minfo; @@ -2005,11 +2004,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm #endif DBG(__FUNCTION__) - pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); svid = pdev->subsystem_vendor; sid = pdev->subsystem_device; for (b = dev_list; b->vendor; b++) { - if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < rev)) continue; + if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < pdev->revision)) continue; if (b->svid) if ((b->svid != svid) || (b->sid != sid)) continue; break; diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index a30e1e13d8be..93d07ef85276 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -5789,7 +5789,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ivideo->warncount = 0; ivideo->chip_id = pdev->device; ivideo->chip_vendor = pdev->vendor; - pci_read_config_byte(pdev, PCI_REVISION_ID, &ivideo->revision_id); + ivideo->revision_id = pdev->revision; ivideo->SiS_Pr.ChipRevision = ivideo->revision_id; pci_read_config_word(pdev, PCI_COMMAND, ®16); ivideo->sisvga_enabled = reg16 & 0x01; diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 62fa5500361d..5eff28ce4f4d 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c @@ -1348,7 +1348,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, f_ddprintk("found device : %s\n", spec->name); par->dev = pdev; - pci_read_config_byte(pdev, PCI_REVISION_ID, &par->revision); + par->revision = pdev->revision; fix->mmio_start = pci_resource_start(pdev,0); fix->mmio_len = 0x400000; diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c index f0fde6ea7c36..5c0dab628099 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/tgafb.c @@ -1625,8 +1625,7 @@ tgafb_register(struct device *dev) par->tga_regs_base = mem_base + TGA_REGS_OFFSET; par->tga_type = tga_type; if (tga_bus_pci) - pci_read_config_byte(to_pci_dev(dev), PCI_REVISION_ID, - &par->tga_chip_rev); + par->tga_chip_rev = (to_pci_dev(dev))->revision; if (tga_bus_tc) par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff; -- cgit v1.2.3