I'm about halfway through the video directory, making all the pci
drivers that access resources/irq use pci_enable_device first.
Here's the first 8 patches (1 patch per driver); if you prefer, I'll
send you the rest when I'm done, or I can just tell you and you
can grab 'em off http://incandescent.mp3revolution.net/kernel/video/.
The sis driver was checking sisvga_enabled before enabling the device;
I assumed that nothing harmful would happen if it enabled the device
in all cases. If someone who's familiar w/ the sis driver could tell
me if that assumption is correct or not..
--
"... being a Linux user is sort of like living in a house inhabited
by a large family of carpenters and architects. Every morning when
you wake up, the house is a little different. Maybe there is a new
turret, or some walls have moved. Or perhaps someone has temporarily
removed the floor under your bed." - Unix for Dummies, 2nd Edition
-- found in the .sig of Rob Riggs, rriggs@tesser.com
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="igafb.diff"
diff -urN linux.ac/drivers/video/igafb.c linux.dilinger/drivers/video/igafb.c
--- linux.ac/drivers/video/igafb.c Tue Mar 27 06:15:20 2001
+++ linux.dilinger/drivers/video/igafb.c Tue Mar 27 20:28:12 2001
@@ -598,6 +598,7 @@
unsigned long addr;
extern int con_is_present(void);
int iga2000 = 0;
+ int err;
/* Do not attach when we have a serial console. */
if (!con_is_present())
@@ -616,6 +617,10 @@
}
iga2000 = 1;
}
+
+ err = pci_enable_device(pdev);
+ if (err)
+ return err;
info = kmalloc(sizeof(struct fb_info_iga), GFP_ATOMIC);
if (!info) {
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="matrox.diff"
diff -urN linux.ac/drivers/video/matrox/matroxfb_base.c linux.dilinger/drivers/video/matrox/matroxfb_base.c
--- linux.ac/drivers/video/matrox/matroxfb_base.c Tue Mar 27 06:15:20 2001
+++ linux.dilinger/drivers/video/matrox/matroxfb_base.c Tue Mar 27 20:23:09 2001
@@ -2027,9 +2027,9 @@
return -1;
}
pci_read_config_dword(pdev, PCI_COMMAND, &cmd);
- if (pci_enable_device(pdev)) {
- return -1;
- }
+ err = pci_enable_device(pdev);
+ if (err)
+ return err;
#ifdef CONFIG_FB_MATROX_MULTIHEAD
minfo = (struct matrox_fb_info*)kmalloc(sizeof(*minfo), GFP_KERNEL);
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pm2fb.diff"
diff -urN linux.ac/drivers/video/pm2fb.c linux.dilinger/drivers/video/pm2fb.c
--- linux.ac/drivers/video/pm2fb.c Tue Mar 27 06:15:20 2001
+++ linux.dilinger/drivers/video/pm2fb.c Tue Mar 27 20:18:29 2001
@@ -1041,28 +1041,25 @@
#endif
memset(pci, 0, sizeof(struct pm2pci_par));
- if (!pci_present()) {
- DPRINTK("no PCI bus found.\n");
- return 0;
- }
DPRINTK("scanning PCI bus for known chipsets...\n");
- pci_for_each_dev(dev) {
- for (i = 0; pm2pci_cards[i].vendor; i++)
- if (pm2pci_cards[i].vendor == dev->vendor &&
- pm2pci_cards[i].device == dev->device) {
- pci->dev = dev;
- p->type = pm2pci_cards[i].type;
- DPRINTK("... found %s\n", pm2pci_cards[i].name);
- break;
- }
- if (pci->dev)
+ for (i = 0; pm2pci_cards[i].vendor; i++) {
+ dev = pci_find_device(pm2pci_cards[i].vendor, pm2pci_cards[i].device, NULL);
+ if (dev) {
+ pci->dev = dev;
+ p->type = pm2pci_cards[i].type;
+ DPRINTK("... found %s\n", pm2pci_cards[i].name);
break;
+ }
}
if (!pci->dev) {
DPRINTK("no PCI board found.\n");
return 0;
}
+ i = pci_enable_device(pci->dev);
+ if (i)
+ return i;
+
DPRINTK("PCI board @%08lx %08lx %08lx rom %08lx\n",
pci->dev->resource[0].start,
pci->dev->resource[1].start,
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="radeonfb.diff"
diff -urN linux.ac/drivers/video/radeonfb.c linux.dilinger/drivers/video/radeonfb.c
--- linux.ac/drivers/video/radeonfb.c Tue Mar 27 06:15:19 2001
+++ linux.dilinger/drivers/video/radeonfb.c Tue Mar 27 20:07:25 2001
@@ -500,6 +500,10 @@
u32 tmp;
int i, j;
+ i = pci_enable_device(pdev);
+ if (i)
+ return i;
+
rinfo = kmalloc (sizeof (struct radeonfb_info), GFP_KERNEL);
if (!rinfo) {
printk ("radeonfb: could not allocate memory\n");
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="riva.diff"
diff -urN linux.ac/drivers/video/riva/fbdev.c linux.dilinger/drivers/video/riva/fbdev.c
--- linux.ac/drivers/video/riva/fbdev.c Tue Mar 27 06:15:18 2001
+++ linux.dilinger/drivers/video/riva/fbdev.c Tue Mar 27 20:02:44 2001
@@ -1845,6 +1845,9 @@
assert(pd != NULL);
assert(rci != NULL);
+ if (pci_enable_device(pd))
+ goto err_out;
+
rinfo = kmalloc(sizeof(struct rivafb_info), GFP_KERNEL);
if (!rinfo)
goto err_out;
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="sis.diff"
diff -urN linux.ac/drivers/video/sis/sis_main.c linux.dilinger/drivers/video/sis/sis_main.c
--- linux.ac/drivers/video/sis/sis_main.c Tue Mar 27 06:15:18 2001
+++ linux.dilinger/drivers/video/sis/sis_main.c Tue Mar 27 19:59:10 2001
@@ -2017,7 +2017,7 @@
{
struct pci_dev *pdev = NULL;
struct board *b;
- int pdev_valid = 0;
+ int err = -1;
unsigned long rom_vbase;
u32 reg32;
u16 reg16;
@@ -2035,14 +2035,16 @@
}
#endif
- if (sisfb_off)
- return -ENXIO;
+ do {
+ if (sisfb_off) {
+ err = -ENXIO;
+ break;
+ }
- pci_for_each_dev(pdev) {
for (b = sisdev_list; b->vendor; b++) {
- if ((b->vendor == pdev->vendor)
- && (b->device == pdev->device)) {
- pdev_valid = 1;
+ pdev = pci_find_device(b->vendor, b->device, NULL);
+ if (pdev) {
+ err = 0;
strcpy(fb_info.modename, b->name);
ivideo.chip_id = pdev->device;
pci_read_config_byte(pdev, PCI_REVISION_ID, &ivideo.revision_id);
@@ -2053,12 +2055,18 @@
}
}
- if (pdev_valid)
- break;
- }
+ /* Note: old behavior was to call pci_enable_device iff
+ * sisvga_enabled wasn't set. Since we access resources
+ * regardless of sisvga_enabled, we enable the device
+ * in all cases. If this is wrong, have it check
+ * if !sisvga_enabled here. */
+ if (!err)
+ err = pci_enable_device(pdev);
+
+ } while (0);
- if (!pdev_valid)
- return -1;
+ if (err)
+ return err;
switch (ivideo.chip_id) {
case PCI_DEVICE_ID_SI_300:
@@ -2107,9 +2115,6 @@
= pci_resource_start(pdev, 2) + 0x30;
sisfb_mmio_size = pci_resource_len(pdev, 1);
-
- if (!sisvga_enabled)
- if (pci_enable_device(pdev)) return -EIO;
#ifdef NOBIOS
sishw_ext.VirtualRomBase = rom_vbase = (unsigned long) rom_data;
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tdfxfb.diff"
diff -urN linux.ac/drivers/video/tdfxfb.c linux.dilinger/drivers/video/tdfxfb.c
--- linux.ac/drivers/video/tdfxfb.c Tue Mar 27 19:08:41 2001
+++ linux.dilinger/drivers/video/tdfxfb.c Tue Mar 27 19:12:49 2001
@@ -1848,6 +1848,7 @@
int __init tdfxfb_init(void) {
struct pci_dev *pdev = NULL;
struct fb_var_screeninfo var;
+ int err;
while ((pdev = pci_find_device(PCI_VENDOR_ID_3DFX, PCI_ANY_ID, pdev))) {
if(((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
@@ -1862,6 +1863,10 @@
pdev->device == PCI_DEVICE_ID_3DFX_BANSHEE
? BANSHEE_MAX_PIXCLOCK
: VOODOO3_MAX_PIXCLOCK;
+
+ err = pci_enable_device(pdef);
+ if (err)
+ return err;
fb_info.regbase_phys = pci_resource_start(pdev, 0);
fb_info.regbase_size = 1 << 24;
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tgafb.diff"
diff -urN linux.ac/drivers/video/tgafb.c linux.dilinger/drivers/video/tgafb.c
--- linux.ac/drivers/video/tgafb.c Tue Mar 27 19:06:00 2001
+++ linux.dilinger/drivers/video/tgafb.c Tue Mar 27 19:07:54 2001
@@ -921,10 +921,15 @@
int __init tgafb_init(void)
{
struct pci_dev *pdev;
+ int err;
pdev = pci_find_device(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TGA, NULL);
if (!pdev)
return -ENXIO;
+
+ err = pci_enable_device(pdev);
+ if (err)
+ return err;
/* divine board type */
--82I3+IH0IqGh5yIs--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/