From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJNSa-0002Mr-H7 for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:31:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJNSU-0002RX-J4 for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:31:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJNSU-0002RL-9r for qemu-devel@nongnu.org; Thu, 05 Feb 2015 09:31:06 -0500 Message-ID: <54D37EA2.7050500@redhat.com> Date: Thu, 05 Feb 2015 16:30:58 +0200 From: Marcel Apfelbaum MIME-Version: 1.0 References: <20150123132424.GA4579@redhat.com> <20150123144030.21142ed1@nial.brq.redhat.com> <20150123135511.GF4579@redhat.com> <20150123185620.604b83ab@nial.brq.redhat.com> <20150124163350.GC6293@redhat.com> <20150126105721.60641e59@nial.brq.redhat.com> <20150126160920.79a09b37@nial.brq.redhat.com> <20150126153400.GB3536@hawk.usersys.redhat.com> <20150126161755.GA5487@redhat.com> <20150127232909.6c045626@igors-macbook-pro.local> <20150128075626.GA16660@redhat.com> In-Reply-To: <20150128075626.GA16660@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 01/47] acpi: introduce AML composer aml_append() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Igor Mammedov Cc: pbonzini@redhat.com, Andrew Jones , claudio.fontana@huawei.com, qemu-devel@nongnu.org, marcel.a@redhat.com On 01/28/2015 09:56 AM, Michael S. Tsirkin wrote: >> I've tried redo series with passing alloc list as first argument, >> looks ugly as hell > > I tried too. Not too bad at all. See below: > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index f66da5d..820504a 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -491,14 +491,14 @@ static void acpi_set_pci_info(void) > } > } > > -static void build_append_pcihp_notify_entry(AcpiAml *method, int slot) > +static void build_append_pcihp_notify_entry(AmlPool *p, AcpiAml *method, int slot) > { > - AcpiAml if_ctx; > + AcpiAml *if_ctx; > int32_t devfn = PCI_DEVFN(slot, 0); > > - if_ctx = acpi_if(acpi_and(acpi_arg0(), acpi_int(0x1U << slot))); > - aml_append(&if_ctx, acpi_notify(acpi_name("S%.02X", devfn), acpi_arg1())); > - aml_append(method, if_ctx); > + if_ctx = acpi_if(p, acpi_and(p, acpi_arg0(), acpi_int(p, 0x1U << slot))); > + aml_append(p, if_ctx, acpi_notify(p, acpi_name(p, "S%.02X", devfn), acpi_arg1(p))); > + aml_append(p, method, if_ctx); > } > > static void build_append_pci_bus_devices(AcpiAml *parent_scope, PCIBus *bus, > > What exactly is the problem? A tiny bit more verbose but the lifetime > of all objects is now explicit. A matter of taste, but I personally don't like this p everywhere, it makes everything hard to read. I am still wondering about the static variable that will hold all of the instances and will be explicitly freed at the end. Thanks, Marcel > >