aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-06-08 18:46:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:10 -0400
commit44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch)
tree6e16d3ec80c87490dc743f72da086356f2906ace /drivers/video
parentb8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff)
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 <auke-jan.h.kok@intel.com> Acked-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/kyro/STG4000InitDevice.c5
-rw-r--r--drivers/video/matrox/matroxfb_base.c4
-rw-r--r--drivers/video/sis/sis_main.c2
-rw-r--r--drivers/video/sstfb.c2
-rw-r--r--drivers/video/tgafb.c3
5 files changed, 6 insertions, 10 deletions
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)
247 u32 ulCoreClock; 247 u32 ulCoreClock;
248 u32 tmp; 248 u32 tmp;
249 u32 ulChipSpeed; 249 u32 ulChipSpeed;
250 u8 rev;
251 250
252 STG_WRITE_REG(IntMask, 0xFFFF); 251 STG_WRITE_REG(IntMask, 0xFFFF);
253 252
@@ -276,9 +275,9 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev)
276 PMX2_SOFTRESET_ROM_RST); 275 PMX2_SOFTRESET_ROM_RST);
277 276
278 pci_read_config_word(pDev, PCI_CONFIG_SUBSYS_ID, &sub); 277 pci_read_config_word(pDev, PCI_CONFIG_SUBSYS_ID, &sub);
279 pci_read_config_byte(pDev, PCI_REVISION_ID, &rev);
280 278
281 ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub, (u32)rev); 279 ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub,
280 (u32)pDev->revision);
282 281
283 if (ulChipSpeed == 0) 282 if (ulChipSpeed == 0)
284 return -EINVAL; 283 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) {
1994 1994
1995static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) { 1995static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) {
1996 struct board* b; 1996 struct board* b;
1997 u_int8_t rev;
1998 u_int16_t svid; 1997 u_int16_t svid;
1999 u_int16_t sid; 1998 u_int16_t sid;
2000 struct matrox_fb_info* minfo; 1999 struct matrox_fb_info* minfo;
@@ -2005,11 +2004,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
2005#endif 2004#endif
2006 DBG(__FUNCTION__) 2005 DBG(__FUNCTION__)
2007 2006
2008 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
2009 svid = pdev->subsystem_vendor; 2007 svid = pdev->subsystem_vendor;
2010 sid = pdev->subsystem_device; 2008 sid = pdev->subsystem_device;
2011 for (b = dev_list; b->vendor; b++) { 2009 for (b = dev_list; b->vendor; b++) {
2012 if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < rev)) continue; 2010 if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < pdev->revision)) continue;
2013 if (b->svid) 2011 if (b->svid)
2014 if ((b->svid != svid) || (b->sid != sid)) continue; 2012 if ((b->svid != svid) || (b->sid != sid)) continue;
2015 break; 2013 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)
5789 ivideo->warncount = 0; 5789 ivideo->warncount = 0;
5790 ivideo->chip_id = pdev->device; 5790 ivideo->chip_id = pdev->device;
5791 ivideo->chip_vendor = pdev->vendor; 5791 ivideo->chip_vendor = pdev->vendor;
5792 pci_read_config_byte(pdev, PCI_REVISION_ID, &ivideo->revision_id); 5792 ivideo->revision_id = pdev->revision;
5793 ivideo->SiS_Pr.ChipRevision = ivideo->revision_id; 5793 ivideo->SiS_Pr.ChipRevision = ivideo->revision_id;
5794 pci_read_config_word(pdev, PCI_COMMAND, &reg16); 5794 pci_read_config_word(pdev, PCI_COMMAND, &reg16);
5795 ivideo->sisvga_enabled = reg16 & 0x01; 5795 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,
1348 f_ddprintk("found device : %s\n", spec->name); 1348 f_ddprintk("found device : %s\n", spec->name);
1349 1349
1350 par->dev = pdev; 1350 par->dev = pdev;
1351 pci_read_config_byte(pdev, PCI_REVISION_ID, &par->revision); 1351 par->revision = pdev->revision;
1352 1352
1353 fix->mmio_start = pci_resource_start(pdev,0); 1353 fix->mmio_start = pci_resource_start(pdev,0);
1354 fix->mmio_len = 0x400000; 1354 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)
1625 par->tga_regs_base = mem_base + TGA_REGS_OFFSET; 1625 par->tga_regs_base = mem_base + TGA_REGS_OFFSET;
1626 par->tga_type = tga_type; 1626 par->tga_type = tga_type;
1627 if (tga_bus_pci) 1627 if (tga_bus_pci)
1628 pci_read_config_byte(to_pci_dev(dev), PCI_REVISION_ID, 1628 par->tga_chip_rev = (to_pci_dev(dev))->revision;
1629 &par->tga_chip_rev);
1630 if (tga_bus_tc) 1629 if (tga_bus_tc)
1631 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff; 1630 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff;
1632 1631