Skip to content

Commit 99bca61

Browse files
lipnitsktsbogend
authored andcommitted
MIPS: pci-legacy: use generic pci_enable_resources
Follow the reasoning from commit 842de40 ("PCI: add generic pci_enable_resources()"): The only functional difference from the MIPS version is that the generic one uses "!r->parent" to check for resource collisions instead of "!r->start && r->end". That should have no effect on any pci-legacy driver. Suggested-by: Bjorn Helgaas <[email protected]> Signed-off-by: Ilya Lipnitskiy <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 0af83d2 commit 99bca61

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

arch/mips/pci/pci-legacy.c

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -241,47 +241,11 @@ static int __init pcibios_init(void)
241241

242242
subsys_initcall(pcibios_init);
243243

244-
static int pcibios_enable_resources(struct pci_dev *dev, int mask)
245-
{
246-
u16 cmd, old_cmd;
247-
int idx;
248-
struct resource *r;
249-
250-
pci_read_config_word(dev, PCI_COMMAND, &cmd);
251-
old_cmd = cmd;
252-
for (idx=0; idx < PCI_NUM_RESOURCES; idx++) {
253-
/* Only set up the requested stuff */
254-
if (!(mask & (1<<idx)))
255-
continue;
256-
257-
r = &dev->resource[idx];
258-
if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
259-
continue;
260-
if ((idx == PCI_ROM_RESOURCE) &&
261-
(!(r->flags & IORESOURCE_ROM_ENABLE)))
262-
continue;
263-
if (!r->start && r->end) {
264-
pci_err(dev,
265-
"can't enable device: resource collisions\n");
266-
return -EINVAL;
267-
}
268-
if (r->flags & IORESOURCE_IO)
269-
cmd |= PCI_COMMAND_IO;
270-
if (r->flags & IORESOURCE_MEM)
271-
cmd |= PCI_COMMAND_MEMORY;
272-
}
273-
if (cmd != old_cmd) {
274-
pci_info(dev, "enabling device (%04x -> %04x)\n", old_cmd, cmd);
275-
pci_write_config_word(dev, PCI_COMMAND, cmd);
276-
}
277-
return 0;
278-
}
279-
280244
int pcibios_enable_device(struct pci_dev *dev, int mask)
281245
{
282-
int err;
246+
int err = pci_enable_resources(dev, mask);
283247

284-
if ((err = pcibios_enable_resources(dev, mask)) < 0)
248+
if (err < 0)
285249
return err;
286250

287251
return pcibios_plat_dev_init(dev);

0 commit comments

Comments
 (0)