From d7e2190c7fa5cee75eebc95cdf60681afe91ce7a Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Sat, 4 Jul 2009 13:44:36 +0800 Subject: [PATCH] pci: device_identify method returns int --- sys/bus/pci/i386/legacy.c | 19 +++++++++---------- sys/bus/pci/i386/pci_bus.c | 12 ++++++------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/sys/bus/pci/i386/legacy.c b/sys/bus/pci/i386/legacy.c index 21bebc5f08..ccc1115335 100644 --- a/sys/bus/pci/i386/legacy.c +++ b/sys/bus/pci/i386/legacy.c @@ -57,14 +57,13 @@ struct legacy_device { #define DEVTOAT(dev) ((struct legacy_device *)device_get_ivars(dev)) -static void legacy_identify(driver_t *driver, device_t parent); -static int legacy_probe(device_t); -static int legacy_attach(device_t); -static int legacy_print_child(device_t, device_t); -static device_t legacy_add_child(device_t bus, device_t parent, int order, const char *name, - int unit); -static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); -static int legacy_write_ivar(device_t, device_t, int, uintptr_t); +static int legacy_identify(driver_t *, device_t); +static int legacy_probe(device_t); +static int legacy_attach(device_t); +static int legacy_print_child(device_t, device_t); +static device_t legacy_add_child(device_t, device_t, int, const char *, int); +static int legacy_read_ivar(device_t, device_t, int, uintptr_t *); +static int legacy_write_ivar(device_t, device_t, int, uintptr_t); static device_method_t legacy_methods[] = { /* Device interface */ @@ -100,16 +99,16 @@ static devclass_t legacy_devclass; DRIVER_MODULE(legacy, nexus, legacy_driver, legacy_devclass, 0, 0); -static void +static int legacy_identify(driver_t *driver, device_t parent) { - /* * Add child device with order of 11 so it gets probed * after ACPI (which is at order 10). */ if (BUS_ADD_CHILD(parent, parent, 11, "legacy", 0) == NULL) panic("legacy: could not attach"); + return (0); } static int diff --git a/sys/bus/pci/i386/pci_bus.c b/sys/bus/pci/i386/pci_bus.c index ca8e7cc249..9387d5e3cc 100644 --- a/sys/bus/pci/i386/pci_bus.c +++ b/sys/bus/pci/i386/pci_bus.c @@ -329,7 +329,7 @@ legacy_pcib_is_host_bridge(int bus, int slot, int func, * Scan the first pci bus for host-pci bridges and add pcib instances * to the nexus for each bridge. */ -static void +static int legacy_pcib_identify(driver_t *driver, device_t parent) { int bus, slot, func; @@ -342,19 +342,18 @@ legacy_pcib_identify(driver_t *driver, device_t parent) devclass_t pci_devclass; if (pci_cfgregopen() == 0) - return; + return ENXIO; /* * Check to see if we haven't already had a PCI bus added * via some other means. If we have, bail since otherwise * we're going to end up duplicating it. */ if ((pci_devclass = devclass_find("pci")) && - devclass_get_device(pci_devclass, 0)) - return; - + devclass_get_device(pci_devclass, 0)) + return ENXIO; bus = 0; - retry: +retry: for (slot = 0; slot <= PCI_SLOTMAX; slot++) { func = 0; hdrtype = legacy_pcib_read_config(0, bus, slot, func, @@ -449,6 +448,7 @@ legacy_pcib_identify(driver_t *driver, device_t parent) child = BUS_ADD_CHILD(parent, parent, 100, "pcib", 0); legacy_set_pcibus(child, 0); } + return 0; } static int -- 2.41.0