mn10300: use generic pci_enable_resources()

Use the generic pci_enable_resources() instead of the arch-specific code.

Unlike this arch-specific code, the generic version:

- checks PCI_NUM_RESOURCES (11), not 6, resources
- skips resources that have neither IORESOURCE_IO nor IORESOURCE_MEM set
- skips ROM resources unless IORESOURCE_ROM_ENABLE is set
- checks for resource collisions with "!r->parent"

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Bjorn Helgaas and committed by Linus Torvalds 126cda50 e716381f

+2 -41
-39
arch/mn10300/unit-asb2305/pci-asb2305.c
··· 218 218 pcibios_allocate_resources(1); 219 219 } 220 220 221 - int pcibios_enable_resources(struct pci_dev *dev, int mask) 222 - { 223 - u16 cmd, old_cmd; 224 - int idx; 225 - struct resource *r; 226 - 227 - pci_read_config_word(dev, PCI_COMMAND, &cmd); 228 - old_cmd = cmd; 229 - 230 - for (idx = 0; idx < 6; idx++) { 231 - /* Only set up the requested stuff */ 232 - if (!(mask & (1 << idx))) 233 - continue; 234 - 235 - r = &dev->resource[idx]; 236 - 237 - if (!r->start && r->end) { 238 - printk(KERN_ERR 239 - "PCI: Device %s not available because of" 240 - " resource collisions\n", 241 - pci_name(dev)); 242 - return -EINVAL; 243 - } 244 - 245 - if (r->flags & IORESOURCE_IO) 246 - cmd |= PCI_COMMAND_IO; 247 - if (r->flags & IORESOURCE_MEM) 248 - cmd |= PCI_COMMAND_MEMORY; 249 - } 250 - 251 - if (dev->resource[PCI_ROM_RESOURCE].start) 252 - cmd |= PCI_COMMAND_MEMORY; 253 - 254 - if (cmd != old_cmd) 255 - pci_write_config_word(dev, PCI_COMMAND, cmd); 256 - 257 - return 0; 258 - } 259 - 260 221 /* 261 222 * If we set up a device for bus mastering, we need to check the latency 262 223 * timer as certain crappy BIOSes forget to set it properly.
-1
arch/mn10300/unit-asb2305/pci-asb2305.h
··· 34 34 extern unsigned int pcibios_max_latency; 35 35 36 36 extern void pcibios_resource_survey(void); 37 - extern int pcibios_enable_resources(struct pci_dev *dev, int mask); 38 37 39 38 /* pci.c */ 40 39
+2 -1
arch/mn10300/unit-asb2305/pci.c
··· 440 440 { 441 441 int err; 442 442 443 - err = pcibios_enable_resources(dev, mask); 443 + err = pci_enable_resources(dev, mask); 444 444 if (err == 0) 445 445 pcibios_enable_irq(dev); 446 446 return err; ··· 455 455 456 456 bus->number = 0; 457 457 458 + o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); 458 459 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); 459 460 x |= PCI_COMMAND_MASTER | 460 461 PCI_COMMAND_IO | PCI_COMMAND_MEMORY |