From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyIW2-0006pv-NR for qemu-devel@nongnu.org; Tue, 09 Dec 2014 05:59:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyIVw-0004QE-H9 for qemu-devel@nongnu.org; Tue, 09 Dec 2014 05:59:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyIVw-0004Q9-7f for qemu-devel@nongnu.org; Tue, 09 Dec 2014 05:59:32 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB9AxU43022289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 9 Dec 2014 05:59:31 -0500 Date: Tue, 9 Dec 2014 11:59:27 +0100 From: Igor Mammedov Message-ID: <20141209115927.3925ae68@nial.usersys.redhat.com> In-Reply-To: <20141208205403.GF29909@redhat.com> References: <1418054888-11310-1-git-send-email-imammedo@redhat.com> <1418054888-11310-8-git-send-email-imammedo@redhat.com> <20141208205403.GF29909@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/9] acpi: replace opencoded notify codes with named values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, marcel.a@redhat.com On Mon, 8 Dec 2014 22:54:03 +0200 "Michael S. Tsirkin" wrote: > On Mon, Dec 08, 2014 at 04:08:06PM +0000, Igor Mammedov wrote: > > Signed-off-by: Igor Mammedov > > I'm not sure this makes sense for these constants. > > Device Check seems more readable than ACPI_DEV_CHK. > If your object here is readability, please do not > abbreviate. > > Generally ability to match spec names exactly is > what made me prefer code comments to enums for one-off constants. > Looking up "Device Check" works in any spec version, > I don't have to dig up the exact one, find table by name, > break my eyes trying to locate the correct line in > a huge table. > Just text search, and the correct line is highlighted. > > Why look in another spec version you might ask? > Well it's definitely helpful to understand legacy > guest quirks. > > sure, lets drop it. > > --- > > hw/i386/acpi-build.c | 4 ++-- > > include/hw/acpi/acpi_gen_utils.h | 6 ++++++ > > 2 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > index 0f6202d..a33d130 100644 > > --- a/hw/i386/acpi-build.c > > +++ b/hw/i386/acpi-build.c > > @@ -840,10 +840,10 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) > > build_append_namestring(method, "BNUM"); > > build_append_namestring(method, "DVNT"); > > build_append_namestring(method, "PCIU"); > > - build_append_int(method, 1); /* Device Check */ > > + build_append_int(method, ACPI_DEV_CHK); > > build_append_namestring(method, "DVNT"); > > build_append_namestring(method, "PCID"); > > - build_append_int(method, 3); /* Eject Request */ > > + build_append_int(method, ACPI_DEV_EJ); > > } > > > > /* Notify about child bus events in any case */ > > diff --git a/include/hw/acpi/acpi_gen_utils.h b/include/hw/acpi/acpi_gen_utils.h > > index fd50625..ce76dc1 100644 > > --- a/include/hw/acpi/acpi_gen_utils.h > > +++ b/include/hw/acpi/acpi_gen_utils.h > > @@ -5,6 +5,12 @@ > > #include > > #include "qemu/compiler.h" > > > > +/* ACPI 5.0: table "Device Object Notification Values" */ > > +enum { > > + ACPI_DEV_CHK = 1, > > + ACPI_DEV_EJ = 3, > > +}; > > + > > GArray *build_alloc_array(void); > > void build_free_array(GArray *array); > > void build_prepend_byte(GArray *array, uint8_t val); > > -- > > 1.8.3.1 >