All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers into SSDT
Date: Tue, 22 Dec 2015 16:00:52 +0100	[thread overview]
Message-ID: <20151222160052.179e9999@nial.brq.redhat.com> (raw)
In-Reply-To: <20151222164436-mutt-send-email-mst@redhat.com>

On Tue, 22 Dec 2015 16:47:18 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Tue, Dec 22, 2015 at 03:38:24PM +0100, Igor Mammedov wrote:
> > On Tue, 22 Dec 2015 11:37:40 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > [...]
> > > > > > +        for (i = 4; i <= 0xF; i++) {
> > > > > > +            char *name = g_strdup_printf("_L0%X", i);
> > > > > > +            method = aml_method(name, 0, AML_NOTSERIALIZED);
> > > > > > +            aml_append(scope, method);
> > > > > > +            g_free(name);
> > > > > > +        }
> > > > > 
> > > > > How about we make aml_method accept ... format instead?
> > > > actually instead of making aml_method(format,...) it would be
> > > > easier to make it accept Aml* so we could reuse aml_name(format,...)
> > > > in the end it would look like:
> > > > 
> > > >  Aml gpe_name = aml_name("_L0%X", i);
> > > >  aml_method(gpe_name, AML_NOTSERIALIZED);
> > > > 
> > > > in addition name object could be reused in other places
> > > > that reference that method.
> > > 
> > > Except most methods are simple, so maybe do both APIs.
> > > Avoiding string duplication is a good idea,
> > > but using string constants works just as well.
> > I don't like having 2 APIs, one with 'Aml* name' and other
> > with 'const char *name' in C. I'd prefer to have just one
> > that suits the majority use cases and
> > 
> > I'm not so comfortable with using format string here directly
> > as it would look weird (at least to me):
> >    aml_method("_L0%X", i, argcount, AML_NOTSERIALIZED);
> >      - static format string check at compile time won't work here
> >    or
> >    aml_method(argcount, AML_NOTSERIALIZED, "_L0%X", i);
> >      - that should be fine except of that argument order doesn't
> >        match the way it's in spec, which I'd prefer to keep
> 
> Just add ... at the end:
> 
> aml_method("_L0%X", argcount, AML_NOTSERIALIZED, i);
ok, I'll try to do it.

> 
> looks a bit weird if you have to use it, but
> it's uncommon, and the common case looks simple.
> 
> > so it leaves for me 2 options:
> >   1: use aml_method(aml_name("_L0%X", i), argcount, AML_NOTSERIALIZED)
> >       It's a bit of code churn and not sure if we really need it
> >       but I can do if asked for it.
> > 
> >   2: just leave it as is for now, because the most of method names
> >      are just string constants. These "_L0%X" will be gone after
> >      cleanup, leaving us with only handlers that use string const and
> >      do some work.
> > 
> >      I can replace g_strdup_printf() with static buffer here if you
> >      dislike alloc/free in this patch.
> 
> So how about just open-coding this loop for now?
> That's just about 10 lines of code,
> not a big deal.
sure

> 
> As you say, will be gone after refactoring.
> 

  reply	other threads:[~2015-12-22 15:01 UTC|newest]

Thread overview: 165+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 23:40 [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 01/74] tests: acpi: print ASL diff in verbose mode Igor Mammedov
2015-12-10 12:50   ` Marcel Apfelbaum
2015-12-22 15:28   ` Michael S. Tsirkin
2015-12-22 15:54     ` Igor Mammedov
2015-12-22 16:18       ` Michael S. Tsirkin
2015-12-22 16:36         ` Igor Mammedov
2015-12-22 16:59       ` Michael S. Tsirkin
2015-12-22 17:22         ` Igor Mammedov
2015-12-22 19:05           ` Michael S. Tsirkin
2015-12-09 23:40 ` [Qemu-devel] [PATCH 02/74] acpi: add aml_derefof Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 03/74] acpi: add aml_sizeof Igor Mammedov
2015-12-09 23:40 ` [Qemu-devel] [PATCH 04/74] acpi: add aml_lgreater_equal() Igor Mammedov
2015-12-10 12:52   ` Marcel Apfelbaum
2015-12-11  2:39   ` Shannon Zhao
2015-12-09 23:40 ` [Qemu-devel] [PATCH 05/74] acpi: add aml_mutex(), aml_acquire(), aml_release() Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 06/74] acpi: add aml_create_qword_field() Igor Mammedov
2015-12-10 12:53   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 07/74] acpi: aml: add helper for Opcode Arg2 Arg2 [Dst] AML pattern Igor Mammedov
2015-12-10  1:59   ` Shannon Zhao
2015-12-10 11:08     ` Igor Mammedov
2015-12-10 13:12   ` Marcel Apfelbaum
2015-12-11  2:36   ` Shannon Zhao
2015-12-09 23:41 ` [Qemu-devel] [PATCH 08/74] acpi: extend aml_add() to accept target argument Igor Mammedov
2015-12-10 12:59   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 09/74] acpi: add aml_decrement() and aml_subtract() Igor Mammedov
2015-12-10 13:01   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 10/74] acpi: add aml_call0() helper Igor Mammedov
2015-12-10 13:04   ` Marcel Apfelbaum
2015-12-10 13:41     ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 11/74] acpi: add aml_to_integer() Igor Mammedov
2015-12-10 13:05   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 12/74] acpi: extend aml_shiftright() to accept target argument Igor Mammedov
2015-12-10 13:08   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 13/74] acpi: add aml_alias() Igor Mammedov
2015-12-10 13:13   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 14/74] acpi: add aml_sleep() Igor Mammedov
2015-12-10 13:14   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 15/74] acpi: support serialized method Igor Mammedov
2015-12-11  2:58   ` Shannon Zhao
2015-12-09 23:41 ` [Qemu-devel] [PATCH 16/74] acpi: add aml_lor() Igor Mammedov
2015-12-10 13:25   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 17/74] acpi: add aml_lgreater() Igor Mammedov
2015-12-10 13:26   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 18/74] acpi: extend aml_field() to support LockRule Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 19/74] acpi: add aml_to_hexstring() Igor Mammedov
2015-12-10 13:41   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 20/74] acpi: add aml_to_buffer() Igor Mammedov
2015-12-10 13:42   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 21/74] acpi add aml_dma() Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 22/74] acpi: extend aml_or() to accept target argument Igor Mammedov
2015-12-10 13:43   ` Marcel Apfelbaum
2015-12-09 23:41 ` [Qemu-devel] [PATCH 23/74] acpi: extend aml_and() " Igor Mammedov
2015-12-10  2:07   ` Shannon Zhao
2015-12-10 11:16     ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 24/74] acpi: extend aml_interrupt() to support multiple irqs Igor Mammedov
2015-12-10  1:50   ` Shannon Zhao
2015-12-10 11:34     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-11  1:51       ` Shannon Zhao
2015-12-22 15:17   ` [Qemu-devel] [PATCH " Michael S. Tsirkin
2015-12-22 15:37     ` Igor Mammedov
2015-12-22 15:58       ` Michael S. Tsirkin
2015-12-22 16:19         ` Igor Mammedov
2015-12-22 16:43           ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 25/74] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Igor Mammedov
2015-12-10 12:45   ` Marcel Apfelbaum
2015-12-10 13:43     ` Igor Mammedov
2015-12-16 13:25   ` Marcel Apfelbaum
2015-12-16 14:25     ` Igor Mammedov
2015-12-17 12:14       ` Marcel Apfelbaum
2015-12-17 13:47         ` Igor Mammedov
2015-12-17 14:12           ` Marcel Apfelbaum
2015-12-17 16:59             ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 26/74] pc: acpi: memhp: move MHPD._STA method into SSDT Igor Mammedov
2015-12-16 12:08   ` Marcel Apfelbaum
2015-12-16 14:30     ` Igor Mammedov
2015-12-16 14:47   ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-20 10:32     ` Marcel Apfelbaum
2015-12-20 13:41     ` Michael S. Tsirkin
2015-12-21 10:52       ` Igor Mammedov
2015-12-21 17:31       ` Igor Mammedov
2015-12-22 15:11         ` Michael S. Tsirkin
2015-12-22 15:45           ` Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 27/74] pc: acpi: memhp: move MHPD.MLCK mutex " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 28/74] pc: acpi: memhp: move MHPD.MSCN method " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 29/74] pc: acpi: memhp: move MHPD.MRST " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 30/74] pc: acpi: memhp: move MHPD.MPXM " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 31/74] pc: acpi: memhp: move MHPD.MOST " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 32/74] pc: acpi: memhp: move MHPD.MEJ0 " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 33/74] pc: acpi: memhp: move MHPD.MCRS " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 34/74] pc: acpi: memhp: move MHPD Device " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 35/74] pc: acpi: factor out memhp code from build_ssdt() into separate function Igor Mammedov
2015-12-19 20:18   ` Michael S. Tsirkin
2015-12-21 11:01     ` Igor Mammedov
2015-12-21 11:38       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 36/74] pc: acpi: memhp: move \_GPE._E03 into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 37/74] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 38/74] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 39/74] pc: acpi: cpuhp: move CPEJ() method to SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 40/74] pc: acpi: cpuhp: move CPMA() method into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 41/74] pc: acpi: cpuhp: move CPST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 42/74] pc: acpi: cpuhp: move PRSC() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 43/74] pc: acpi: cpuhp: move \_GPE._E02() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 44/74] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 45/74] pc: acpi: move HPET from DSDT to SSDT Igor Mammedov
2015-12-19 19:50   ` Michael S. Tsirkin
2015-12-21 11:02     ` Igor Mammedov
2015-12-21 11:42       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 46/74] pc: acpi: move DBUG() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 47/74] pc: acpi: move RTC device " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 48/74] pc: acpi: move KBD " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 49/74] pc: acpi: move MOU " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 50/74] pc: acpi: move FDC0 " Igor Mammedov
2015-12-19 19:44   ` Michael S. Tsirkin
2015-12-21 12:42     ` Igor Mammedov
2015-12-21 12:54       ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 51/74] pc: acpi: move LPT " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 52/74] pc: acpi: move COM devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 53/74] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 54/74] pc: acpi: move remaining GPE handlers " Igor Mammedov
2015-12-19 19:30   ` Michael S. Tsirkin
2015-12-19 20:34   ` Michael S. Tsirkin
2015-12-21 12:45     ` Igor Mammedov
2015-12-21 15:35     ` Igor Mammedov
2015-12-22  9:37       ` Michael S. Tsirkin
2015-12-22 14:38         ` Igor Mammedov
2015-12-22 14:47           ` Michael S. Tsirkin
2015-12-22 15:00             ` Igor Mammedov [this message]
2015-12-09 23:41 ` [Qemu-devel] [PATCH 55/74] pc: acpi: pci: move link devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 56/74] pc: acpi: piix4: move IQCR() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 57/74] pc: acpi: piix4: move IQST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 58/74] pc: acpi: piix4: move PCI0._PRT() " Igor Mammedov
2015-12-10 12:32   ` Marcel Apfelbaum
2015-12-10 13:50     ` Igor Mammedov
2015-12-10 16:17     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2015-12-13 15:19       ` Marcel Apfelbaum
2015-12-14 13:20         ` Igor Mammedov
2015-12-19 19:23       ` Michael S. Tsirkin
2015-12-21 12:55         ` Igor Mammedov
2015-12-22  9:34           ` Michael S. Tsirkin
2015-12-22 14:12             ` Igor Mammedov
2015-12-22 14:52               ` Michael S. Tsirkin
2015-12-09 23:41 ` [Qemu-devel] [PATCH 59/74] pc: acpi: piix4: move remaining PCI hotplug bits " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 60/74] pc: acpi: piix4: acpi move PCI0 device to SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 61/74] pc: acpi: q35: move GSI links " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 62/74] pc: acpi: q35: move link devices " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 63/74] pc: acpi: q35: move IQCR() into SSDT Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 64/74] pc: acpi: q35: move IQST() " Igor Mammedov
2015-12-09 23:41 ` [Qemu-devel] [PATCH 65/74] pc: acpi: q35: move ISA bridge " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 66/74] pc: acpi: q35: move _PRT() " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 67/74] pc: acpi: q35: move PRTA routing table " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 68/74] pc: acpi: q35: move PRTP " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 69/74] pc: acpi: q35: move _PIC() method " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 70/74] pc: acpi: q35: move PCI0._OSC() " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 71/74] pc: acpi: q35: move PCI0 device definition " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 72/74] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 73/74] pc: acpi: switch to AML API composed DSDT Igor Mammedov
2015-12-09 23:42 ` [Qemu-devel] [PATCH 74/74] pc: acpi: remove unused ASL templates and related blobs/utils Igor Mammedov
2015-12-10 15:53 ` [Qemu-devel] [PATCH 00/74] pc: acpi: convert DSDT to AML API and drop ASL templates support Marcel Apfelbaum
2015-12-10 16:31   ` Igor Mammedov
2015-12-13 15:24     ` Marcel Apfelbaum
2015-12-10 16:44 ` Igor Mammedov
2015-12-19 20:38 ` Michael S. Tsirkin
2015-12-21 13:00   ` Igor Mammedov
2015-12-21 13:12     ` Shannon Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151222160052.179e9999@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.