From owner-cvs-all@FreeBSD.ORG Thu Jun 17 19:37:37 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB0B716A4CF for ; Thu, 17 Jun 2004 19:37:37 +0000 (GMT) Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD4DE43D2F for ; Thu, 17 Jun 2004 19:37:37 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 21378 invoked from network); 17 Jun 2004 19:37:16 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 17 Jun 2004 19:37:15 -0000 Received: from 10.50.41.233 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i5HJbCma081980; Thu, 17 Jun 2004 15:37:12 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: "M. Warner Losh" Date: Thu, 17 Jun 2004 15:38:08 -0400 User-Agent: KMail/1.6 References: <200406152008.50656.jhb@FreeBSD.org> <200406171247.04461.jhb@FreeBSD.org> <20040617.132522.102576979.imp@bsdimp.com> In-Reply-To: <20040617.132522.102576979.imp@bsdimp.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200406171538.08813.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: cvs-src@FreeBSD.org cc: njl@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/i386 bios.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2004 19:37:38 -0000 On Thursday 17 June 2004 03:25 pm, M. Warner Losh wrote: > In message: <200406171247.04461.jhb@FreeBSD.org> > > John Baldwin writes: > : On Tuesday 15 June 2004 11:02 pm, M. Warner Losh wrote: > : > In message: <200406152008.50656.jhb@FreeBSD.org> > : > > : > John Baldwin writes: > : > : On Monday 14 June 2004 10:12 pm, Nate Lawson wrote: > : > : > njl 2004-06-15 02:12:12 UTC > : > : > > : > : > FreeBSD src repository > : > : > > : > : > Modified files: > : > : > sys/i386/i386 bios.c > : > : > Log: > : > : > We only need the devclass_find() result, not the softc. > : > : > : > : The devclass still exists if there is no acpi0 device due to 'set > : > : hint.acpi.0.disabled=1'. Perhaps devclass_get_device() is more > : > : appropriate than devclass_get_softc() though. > : > > : > The hint is insufficient to create the devclass, I believe. It exists > : > because there's a node in the tree or could be a node in the tree. > : > devclass_get_device() and checking to see if it is attached might be > : > even better. > : > : The devclass exists even if there is no acpi0 device is my point. If > : acpi.ko is loaded or compiled into the kernel, then the driver is going > : to be loaded and the devclass added to the kernel's list. > > I think we're saying basically the same thing and arguing over how it > gets there :-) > > Fetching the softc likely isn't the right answer. > device_is_attached(dev) is likely a better way to go. Yes, using that instead of getting the softc would be fine. However, it would need to check that the passed in dev is NULL in that case. You would need to do: device_t acpidev; acpidev = devclass_get_device(devclass_find("acpi"), 0); if (acpidev != NULL && device_is_attached(acpidev)) return; rather than: if (devclass_get_softc(devclass_find("acpi"), 0) != NULL) return; Which requires an extra variable, etc. If device_is_attached() checked for NULL argument you could do: if (device_is_attached(devclass_get_device(devclass_find("acpi"), 0))) return; -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org