[PATCH] PCI: remove bogus resource collision error

When attempting to hotadd a PCI card with a bridge on it, I saw
the kernel reporting resource collision errors even when there were
really no collisions. The problem is that the code doesn't skip
over "invalid" resources with their resource type flag not set.
Others have reported similar problems at boot time and for
non-bridge PCI card hotplug too, where the code flags a
resource collision for disabled ROMs. This patch fixes both
problems.

Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Rajesh Shah and committed by Linus Torvalds ed6d14f9 5a49f203

+5 -2
+5 -2
arch/i386/pci/i386.c
··· 221 221 continue; 222 222 223 223 r = &dev->resource[idx]; 224 + if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) 225 + continue; 226 + if ((idx == PCI_ROM_RESOURCE) && 227 + (!(r->flags & IORESOURCE_ROM_ENABLE))) 228 + continue; 224 229 if (!r->start && r->end) { 225 230 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev)); 226 231 return -EINVAL; ··· 235 230 if (r->flags & IORESOURCE_MEM) 236 231 cmd |= PCI_COMMAND_MEMORY; 237 232 } 238 - if (dev->resource[PCI_ROM_RESOURCE].start) 239 - cmd |= PCI_COMMAND_MEMORY; 240 233 if (cmd != old_cmd) { 241 234 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd); 242 235 pci_write_config_word(dev, PCI_COMMAND, cmd);