From owner-svn-src-all@FreeBSD.ORG Sat Sep 11 08:09:14 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90A0A106564A; Sat, 11 Sep 2010 08:09:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FBCC8FC0C; Sat, 11 Sep 2010 08:09:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8B89E9s066964; Sat, 11 Sep 2010 08:09:14 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8B89EJl066961; Sat, 11 Sep 2010 08:09:14 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009110809.o8B89EJl066961@svn.freebsd.org> From: Andriy Gapon Date: Sat, 11 Sep 2010 08:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212457 - head/sys/dev/acpi_support X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2010 08:09:14 -0000 Author: avg Date: Sat Sep 11 08:09:14 2010 New Revision: 212457 URL: http://svn.freebsd.org/changeset/base/212457 Log: make acpi_hp device a child of acpi_wmi to properly reflect dependency between the devices/drivers PR: kern/147858 Suggested by: jhb Tested by: Maciej Suszko MFC after: 1 week Modified: head/sys/dev/acpi_support/acpi_hp.c head/sys/dev/acpi_support/acpi_wmi.c Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_hp.c Sat Sep 11 08:09:14 2010 (r212457) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -336,7 +335,7 @@ static driver_t acpi_hp_driver = { static devclass_t acpi_hp_devclass; -DRIVER_MODULE(acpi_hp, acpi, acpi_hp_driver, acpi_hp_devclass, +DRIVER_MODULE(acpi_hp, acpi_wmi, acpi_hp_driver, acpi_hp_devclass, 0, 0); MODULE_DEPEND(acpi_hp, acpi_wmi, 1, 1, 1); MODULE_DEPEND(acpi_hp, acpi, 1, 1, 1); @@ -453,16 +452,7 @@ acpi_hp_identify(driver_t *driver, devic if (device_find_child(parent, "acpi_hp", -1) != NULL) return; - /* Make sure acpi_wmi driver is present. */ - if (devclass_find("acpi_wmi") == NULL) - return; - - /* - * Add our device with late order, so that it is hopefully - * probed after acpi_wmi. - * XXX User proper constant instead of UINT_MAX for order. - */ - if (BUS_ADD_CHILD(parent, UINT_MAX, "acpi_hp", -1) == NULL) + if (BUS_ADD_CHILD(parent, 0, "acpi_hp", -1) == NULL) device_printf(parent, "add acpi_hp child failed\n"); } @@ -470,11 +460,7 @@ static int acpi_hp_probe(device_t dev) { - /* Skip auto-enumerated devices from ACPI namespace. */ - if (acpi_get_handle(dev) != NULL) - return (ENXIO); device_set_desc(dev, "HP ACPI-WMI Mapping"); - return (0); } @@ -482,7 +468,6 @@ static int acpi_hp_attach(device_t dev) { struct acpi_hp_softc *sc; - devclass_t wmi_devclass; int arg; ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); @@ -505,14 +490,7 @@ acpi_hp_attach(device_t dev) sc->verbose = 0; memset(sc->cmi_order, 0, sizeof(sc->cmi_order)); - if (!(wmi_devclass = devclass_find("acpi_wmi"))) { - device_printf(dev, "Couldn't find acpi_wmi devclass\n"); - return (EINVAL); - } - if (!(sc->wmi_dev = devclass_get_device(wmi_devclass, 0))) { - device_printf(dev, "Couldn't find acpi_wmi device\n"); - return (EINVAL); - } + sc->wmi_dev = device_get_parent(dev); if (!ACPI_WMI_PROVIDES_GUID_STRING(sc->wmi_dev, ACPI_HP_WMI_BIOS_GUID)) { device_printf(dev, Modified: head/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 07:24:10 2010 (r212456) +++ head/sys/dev/acpi_support/acpi_wmi.c Sat Sep 11 08:09:14 2010 (r212457) @@ -173,6 +173,10 @@ static device_method_t acpi_wmi_methods[ DEVMETHOD(device_attach, acpi_wmi_attach), DEVMETHOD(device_detach, acpi_wmi_detach), + /* bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + /* acpi_wmi interface */ DEVMETHOD(acpi_wmi_provides_guid_string, acpi_wmi_provides_guid_string_method), @@ -269,6 +273,11 @@ acpi_wmi_attach(device_t dev) } ACPI_SERIAL_END(acpi_wmi); + if (ret == 0) { + bus_generic_probe(dev); + ret = bus_generic_attach(dev); + } + return (ret); }