All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Chao Peng <chao.p.peng@linux.intel.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	gor Mammedov <imammedo@redhat.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Haozhong Zhang <haozhong.zhang@intel.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 01/12] pc: make smbus configurable
Date: Tue, 6 Sep 2016 17:18:17 -0300	[thread overview]
Message-ID: <20160906201817.GF24695@thinpad.lan.raisama.net> (raw)
In-Reply-To: <1472120105-29235-2-git-send-email-chao.p.peng@linux.intel.com>

On Thu, Aug 25, 2016 at 06:14:54AM -0400, Chao Peng wrote:
> Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
> ---
>  hw/i386/pc.c         | 23 +++++++++++++++++++++++
>  hw/i386/pc_q35.c     | 12 +++++++-----
>  include/hw/i386/pc.h |  3 +++
>  3 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 022dd1b..66e1961 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -2005,6 +2005,27 @@ static HotplugHandler *pc_get_hotpug_handler(MachineState *machine,
>          pcmc->get_hotplug_handler(machine, dev) : NULL;
>  }
>  
> +static void pc_machine_get_prop_bool(Object *obj, Visitor *v, const char *name,
> +                                     void *opaque, Error **errp)
> +{
> +    bool value = *(bool *)opaque;
> +
> +    visit_type_bool(v, name, &value, errp);
> +}
> +
> +static void pc_machine_set_prop_bool(Object *obj, Visitor *v, const char *name,
> +                                     void *opaque, Error **errp)
> +{
> +    visit_type_bool(v, name, (bool *)opaque, errp);
> +}
> +
> +#define PC_MACHINE_DEFINE_PROP_BOOL(pcms, prop, field, defval)      \
> +        pcms->field = defval;                                       \
> +        object_property_add(OBJECT(pcms), prop, "bool",             \
> +                            pc_machine_get_prop_bool,               \
> +                            pc_machine_set_prop_bool,               \
> +                            NULL, &pcms->field, &error_abort);

This is triggers checkpatch.pl error:

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#76: FILE: hw/i386/pc.c:2022:
+#define PC_MACHINE_DEFINE_PROP_BOOL(pcms, prop, field, defval)      \
+        pcms->field = defval;                                       \
+        object_property_add(OBJECT(pcms), prop, "bool",             \
+                            pc_machine_get_prop_bool,               \
+                            pc_machine_set_prop_bool,               \
+                            NULL, &pcms->field, &error_abort);


> +
>  static void
>  pc_machine_get_hotplug_memory_region_size(Object *obj, Visitor *v,
>                                            const char *name, void *opaque,
> @@ -2168,6 +2189,8 @@ static void pc_machine_initfn(Object *obj)
>      pcms->acpi_nvdimm_state.is_enabled = false;
>      object_property_add_bool(obj, PC_MACHINE_NVDIMM, pc_machine_get_nvdimm,
>                               pc_machine_set_nvdimm, &error_abort);
> +
> +    PC_MACHINE_DEFINE_PROP_BOOL(pcms, PC_MACHINE_SMBUS, smbus, true);

I suggest using object_class_property_add_bool() and registering
properties at class_init.

>  }
>  
[...]

-- 
Eduardo

  reply	other threads:[~2016-09-06 21:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 10:14 [Qemu-devel] [RFC PATCH v2 00/12] Guest startup time optimization Chao Peng
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 01/12] pc: make smbus configurable Chao Peng
2016-09-06 20:18   ` Eduardo Habkost [this message]
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 02/12] pc: make sata configurable Chao Peng
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 03/12] pc: make pic configurable Chao Peng
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 04/12] pc: make pit configurable Chao Peng
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 05/12] acpi: build static _PRT Chao Peng
2016-08-29 17:06   ` Paolo Bonzini
2016-08-25 10:14 ` [Qemu-devel] [RFC PATCH v2 06/12] acpi: expose data structurs and functions of BIOS linker loader Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 07/12] acpi: expose acpi_checksum() Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 08/12] acpi: patch guest ACPI when there is no firmware Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 09/12] ich9: enable pm registers " Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 10/12] q35: initialize MMCFG base " Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 11/12] pc: support direct loading protected/long mode kernel Chao Peng
2016-08-25 10:15 ` [Qemu-devel] [RFC PATCH v2 12/12] pc: skip firmware Chao Peng
2016-08-29 17:08   ` Paolo Bonzini
2016-09-02 11:08 ` [Qemu-devel] [RFC PATCH v2 00/12] Guest startup time optimization Paolo Bonzini
2016-09-05  2:37   ` Michael S. Tsirkin
2016-09-06 10:48   ` Chao Peng
2016-09-06 11:53     ` Michael S. Tsirkin
2016-09-06 14:28       ` Chao Peng
2016-09-12 15:15         ` Gerd Hoffmann
2016-09-12 17:57           ` [Qemu-devel] [SeaBIOS] " Peter Stuge
2016-09-06 14:21     ` [Qemu-devel] " Paolo Bonzini
2016-09-06 14:31       ` Chao Peng
2016-09-06 14:45       ` Michael S. Tsirkin

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=20160906201817.GF24695@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=haozhong.zhang@intel.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.