Date: Thu, 17 Jun 2004 16:15:42 -0400 From: John Baldwin <jhb@FreeBSD.org> To: "M. Warner Losh" <imp@bsdimp.com> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/i386 bios.c Message-ID: <200406171615.42468.jhb@FreeBSD.org> In-Reply-To: <20040617.134314.34763501.imp@bsdimp.com> References: <200406171247.04461.jhb@FreeBSD.org> <200406171538.08813.jhb@FreeBSD.org> <20040617.134314.34763501.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 17 June 2004 03:43 pm, M. Warner Losh wrote: > In message: <200406171538.08813.jhb@FreeBSD.org> > > John Baldwin <jhb@FreeBSD.org> writes: > : On Thursday 17 June 2004 03:25 pm, M. Warner Losh wrote: > : > In message: <200406171247.04461.jhb@FreeBSD.org> > : > > : > John Baldwin <jhb@FreeBSD.org> writes: > : > : On Tuesday 15 June 2004 11:02 pm, M. Warner Losh wrote: > : > : > In message: <200406152008.50656.jhb@FreeBSD.org> > : > : > > : > : > John Baldwin <jhb@freebsd.org> 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; > > True. > > : 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; > > Easy enough to arrange... I went ahead and did this, I just haven't compiled or booted with it yet: >Index: bios.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/bios.c,v retrieving revision 1.69 diff -u -r1.69 bios.c --- bios.c 17 Jun 2004 17:27:37 -0000 1.69 +++ bios.c 17 Jun 2004 20:14:19 -0000 @@ -555,8 +555,9 @@ if (pt == NULL) return; - /* ACPI already active */ - if (devclass_get_softc(devclass_find("acpi"), 0) != NULL) + /* Check to see if ACPI is already active. */ + dev = devclass_get_device(devclass_find("acpi"), 0); + if (dev != NULL && device_is_attached(dev)) return; -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406171615.42468.jhb>