#include <linux/pci.h>
#include <linux/init.h>
-#include <linux/dmi.h>
#include "pci.h"
/*
{
unsigned long flags;
- if ((bus > 255) || (devfn > 255) || (reg > 255)) {
- *value = -1;
+ if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
return -EINVAL;
- }
spin_lock_irqsave(&pci_config_lock, flags);
unsigned long flags;
int dev, fn;
- if ((bus > 255) || (devfn > 255) || (reg > 255)) {
- *value = -1;
+ if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
return -EINVAL;
- }
dev = PCI_SLOT(devfn);
fn = PCI_FUNC(devfn);
if (pci_probe & PCI_NO_CHECKS)
return 1;
- /* Assume Type 1 works for newer systems.
- This handles machines that don't have anything on PCI Bus 0. */
- if (dmi_get_year(DMI_BIOS_DATE) >= 2001)
- return 1;
for (devfn = 0; devfn < 0x100; devfn++) {
if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x))
return works;
}
-void __init pci_direct_init(void)
+static int __init pci_direct_init(void)
{
struct resource *region, *region2;
if (pci_check_type1()) {
printk(KERN_INFO "PCI: Using configuration type 1\n");
raw_pci_ops = &pci_direct_conf1;
- return;
+ return 0;
}
release_resource(region);
type2:
if ((pci_probe & PCI_PROBE_CONF2) == 0)
- return;
+ goto out;
region = request_region(0xCF8, 4, "PCI conf2");
if (!region)
- return;
+ goto out;
region2 = request_region(0xC000, 0x1000, "PCI conf2");
if (!region2)
goto fail2;
if (pci_check_type2()) {
printk(KERN_INFO "PCI: Using configuration type 2\n");
raw_pci_ops = &pci_direct_conf2;
- return;
+ return 0;
}
release_resource(region2);
fail2:
release_resource(region);
+
+ out:
+ return 0;
}
+
+arch_initcall(pci_direct_init);