From owner-cvs-src@FreeBSD.ORG Fri May 21 10:27:46 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EE3416A4CF for ; Fri, 21 May 2004 10:27:46 -0700 (PDT) Received: from mail4.speakeasy.net (mail4.speakeasy.net [216.254.0.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 42CDD43D1F for ; Fri, 21 May 2004 10:27:46 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 19597 invoked from network); 21 May 2004 17:26:50 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 21 May 2004 17:26:50 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i4LHQlSh078023; Fri, 21 May 2004 13:26:47 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Nate Lawson Date: Fri, 21 May 2004 13:27:16 -0400 User-Agent: KMail/1.6 References: <200405181653.i4IGrU6g062365@repoman.freebsd.org> In-Reply-To: <200405181653.i4IGrU6g062365@repoman.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200405211327.16382.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/acpica acpivar.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2004 17:27:46 -0000 On Tuesday 18 May 2004 12:53 pm, Nate Lawson wrote: > njl 2004/05/18 09:53:29 PDT > > FreeBSD src repository > > Modified files: > sys/dev/acpica acpivar.h > Log: > Use the simpler __BUS_ACCESSOR macros for ivars instead of defining them > ourselves. This breaks probing of non-ACPI PCI busses. The problem is that acpi_get_handle() no longer returns NULL if there is no handle. The previous acpi_get_handle() did this: +static __inline ACPI_HANDLE +acpi_get_handle(device_t dev) +{ + uintptr_t up; + + if (BUS_READ_IVAR(device_get_parent(dev), dev, ACPI_IVAR_HANDLE, &up)) + return (NULL); + return ((ACPI_HANDLE)up); +} The __BUS_ACCESSOR() macros do not check for any errors from BUS_READ_IVAR() and just return whatever stack garbage there is if the handle doesn't exist: #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \ \ static __inline type varp ## _get_ ## var(device_t dev) \ { \ uintptr_t v; \ BUS_READ_IVAR(device_get_parent(dev), dev, \ ivarp ## _IVAR_ ## ivar, &v); \ return ((type) v); \ } \ __BUS_ACCESSOR() is thus not suitable for cases where the ivar might not exist such as acpi_get_handle() and acpi_get_private(). -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org