From owner-svn-src-all@FreeBSD.ORG Wed Nov 10 18:50:13 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 4675E106564A; Wed, 10 Nov 2010 18:50:13 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29A4A8FC23; Wed, 10 Nov 2010 18:50:13 +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 oAAIoDKa033930; Wed, 10 Nov 2010 18:50:13 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAAIoDTc033925; Wed, 10 Nov 2010 18:50:13 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201011101850.oAAIoDTc033925@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 10 Nov 2010 18:50:13 +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: r215097 - in head/sys: amd64/acpica dev/acpica i386/acpica x86/acpica 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: Wed, 10 Nov 2010 18:50:13 -0000 Author: jkim Date: Wed Nov 10 18:50:12 2010 New Revision: 215097 URL: http://svn.freebsd.org/changeset/base/215097 Log: Make APM emulation look more closer to its origin. Use device_get_softc(9) instead of hardcoding acpi(4) unit number as we have device_t for it. Modified: head/sys/amd64/acpica/acpi_machdep.c head/sys/dev/acpica/acpivar.h head/sys/i386/acpica/acpi_machdep.c head/sys/x86/acpica/acpi_apm.c Modified: head/sys/amd64/acpica/acpi_machdep.c ============================================================================== --- head/sys/amd64/acpica/acpi_machdep.c Wed Nov 10 18:45:32 2010 (r215096) +++ head/sys/amd64/acpica/acpi_machdep.c Wed Nov 10 18:50:12 2010 (r215097) @@ -61,10 +61,9 @@ acpi_machdep_init(device_t dev) { struct acpi_softc *sc; - sc = devclass_get_softc(devclass_find("acpi"), 0); + sc = device_get_softc(dev); - /* Create a clone for /dev/acpi also. */ - sc->acpi_clone = acpi_apm_create_clone(sc->acpi_dev_t, sc); + acpi_apm_init(sc); if (intr_model != ACPI_INTR_PIC) acpi_SetIntrModel(intr_model); Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Wed Nov 10 18:45:32 2010 (r215096) +++ head/sys/dev/acpica/acpivar.h Wed Nov 10 18:50:12 2010 (r215097) @@ -397,7 +397,7 @@ int acpi_device_pwr_for_sleep(device_t int *dstate); /* APM emulation */ -struct apm_clone_data *acpi_apm_create_clone(struct cdev *, struct acpi_softc *); +void acpi_apm_init(struct acpi_softc *); /* Misc. */ static __inline struct acpi_softc * Modified: head/sys/i386/acpica/acpi_machdep.c ============================================================================== --- head/sys/i386/acpica/acpi_machdep.c Wed Nov 10 18:45:32 2010 (r215096) +++ head/sys/i386/acpica/acpi_machdep.c Wed Nov 10 18:50:12 2010 (r215097) @@ -61,10 +61,9 @@ acpi_machdep_init(device_t dev) { struct acpi_softc *sc; - sc = devclass_get_softc(devclass_find("acpi"), 0); + sc = device_get_softc(dev); - /* Create a clone for /dev/acpi also. */ - sc->acpi_clone = acpi_apm_create_clone(sc->acpi_dev_t, sc); + acpi_apm_init(sc); acpi_install_wakeup_handler(sc); if (intr_model == ACPI_INTR_PIC) Modified: head/sys/x86/acpica/acpi_apm.c ============================================================================== --- head/sys/x86/acpica/acpi_apm.c Wed Nov 10 18:45:32 2010 (r215096) +++ head/sys/x86/acpica/acpi_apm.c Wed Nov 10 18:50:12 2010 (r215097) @@ -29,10 +29,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include #include #include @@ -477,14 +477,13 @@ apmreadfilt(struct knote *kn, long hint) return (sleeping); } -struct apm_clone_data * -acpi_apm_create_clone(struct cdev *dev, struct acpi_softc *acpi_sc) +void +acpi_apm_init(struct acpi_softc *sc) { - struct apm_clone_data *clone; - STAILQ_INIT(&acpi_sc->apm_cdevs); - clone = apm_create_clone(dev, acpi_sc); + /* Create a clone for /dev/acpi also. */ + STAILQ_INIT(&sc->apm_cdevs); + sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc); clone_setup(&apm_clones); EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000); - return (clone); }