From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, pkrempa@redhat.com,
qemu-block@nongnu.org, mst@redhat.com, mreitz@redhat.com,
pbonzini@redhat.com, lersek@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH 2/6] qom: Move compat_props machinery from qdev to QOM
Date: Tue, 05 Mar 2019 07:52:39 +0100 [thread overview]
Message-ID: <87r2blx16w.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <47968abb-fc4e-4546-3cb5-339da5f7a268@redhat.com> ("Philippe Mathieu-Daudé"'s message of "Mon, 4 Mar 2019 16:57:10 +0100")
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> On 2/25/19 7:37 PM, Markus Armbruster wrote:
>> See the previous commit for rationale.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> hw/core/qdev.c | 39 ---------------------------------------
>> include/hw/qdev-core.h | 4 ----
>> include/qom/object.h | 3 +++
>> qom/object.c | 39 +++++++++++++++++++++++++++++++++++++++
>> 4 files changed, 42 insertions(+), 43 deletions(-)
>>
>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>> index 1a86c7990a..25dffad3ed 100644
>> --- a/hw/core/qdev.c
>> +++ b/hw/core/qdev.c
>> @@ -970,45 +970,6 @@ static void device_initfn(Object *obj)
>> QLIST_INIT(&dev->gpios);
>> }
>>
>> -/*
>> - * Global property defaults
>> - * Slot 0: accelerator's global property defaults
>> - * Slot 1: machine's global property defaults
>> - * Each is a GPtrArray of of GlobalProperty.
>> - * Applied in order, later entries override earlier ones.
>> - */
>> -static GPtrArray *object_compat_props[2];
>> -
>> -/*
>> - * Set machine's global property defaults to @compat_props.
>> - * May be called at most once.
>> - */
>> -void object_set_machine_compat_props(GPtrArray *compat_props)
>> -{
>> - assert(!object_compat_props[1]);
>> - object_compat_props[1] = compat_props;
>> -}
>> -
>> -/*
>> - * Set accelerator's global property defaults to @compat_props.
>> - * May be called at most once.
>> - */
>> -void object_set_accelerator_compat_props(GPtrArray *compat_props)
>> -{
>> - assert(!object_compat_props[0]);
>> - object_compat_props[0] = compat_props;
>> -}
>> -
>> -void object_apply_compat_props(Object *obj)
>> -{
>> - int i;
>> -
>> - for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
>> - object_apply_global_props(obj, object_compat_props[i],
>> - &error_abort);
>> - }
>> -}
>> -
>> static void device_post_init(Object *obj)
>> {
>> /*
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index bced1f2666..f2f0006234 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -418,10 +418,6 @@ const char *qdev_fw_name(DeviceState *dev);
>>
>> Object *qdev_get_machine(void);
>>
>> -void object_set_machine_compat_props(GPtrArray *compat_props);
>> -void object_set_accelerator_compat_props(GPtrArray *compat_props);
>> -void object_apply_compat_props(Object *obj);
>> -
>> /* FIXME: make this a link<> */
>> void qdev_set_parent_bus(DeviceState *dev, BusState *bus);
>>
>> diff --git a/include/qom/object.h b/include/qom/object.h
>> index e0262962b5..288cdddf44 100644
>> --- a/include/qom/object.h
>> +++ b/include/qom/object.h
>> @@ -677,6 +677,9 @@ Object *object_new_with_propv(const char *typename,
>>
>> void object_apply_global_props(Object *obj, const GPtrArray *props,
>> Error **errp);
>> +void object_set_machine_compat_props(GPtrArray *compat_props);
>> +void object_set_accelerator_compat_props(GPtrArray *compat_props);
>> +void object_apply_compat_props(Object *obj);
>
> Documentation comments are in .c, OK :(
I chose to move the comments along with the code. If we want the
function comments in object.h for local consistency, we should also
rewrite to conform to the style used there. Separate patch, so this one
can remain pure code motion.
>>
>> /**
>> * object_set_props:
>> diff --git a/qom/object.c b/qom/object.c
>> index b8c732063b..adb9b7fe91 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -408,6 +408,45 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp
>> }
>> }
>>
>> +/*
>> + * Global property defaults
>> + * Slot 0: accelerator's global property defaults
>> + * Slot 1: machine's global property defaults
>> + * Each is a GPtrArray of of GlobalProperty.
>> + * Applied in order, later entries override earlier ones.
>> + */
>> +static GPtrArray *object_compat_props[2];
>> +
>> +/*
>> + * Set machine's global property defaults to @compat_props.
>> + * May be called at most once.
>> + */
>> +void object_set_machine_compat_props(GPtrArray *compat_props)
>> +{
>> + assert(!object_compat_props[1]);
>> + object_compat_props[1] = compat_props;
>> +}
>> +
>> +/*
>> + * Set accelerator's global property defaults to @compat_props.
>> + * May be called at most once.
>> + */
>> +void object_set_accelerator_compat_props(GPtrArray *compat_props)
>> +{
>> + assert(!object_compat_props[0]);
>> + object_compat_props[0] = compat_props;
>> +}
>> +
>
> Can you add a comment for this one too? (no need to respin)
Separate patch, so this one can remain pure code motion. If we decide
to move (reformatted) function comments to object.h, the additional
comment can be added in that patch.
>> +void object_apply_compat_props(Object *obj)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
>> + object_apply_global_props(obj, object_compat_props[i],
>> + &error_abort);
>> + }
>> +}
>> +
>> static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
>> {
>> Object *obj = data;
>>
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Thanks!
next prev parent reply other threads:[~2019-03-05 6:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 18:37 [Qemu-devel] [RFC PATCH 0/6] pc: Support firmware configuration with -blockdev Markus Armbruster
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 1/6] qdev: Fix latent bug with compat_props and onboard devices Markus Armbruster
2019-02-26 12:28 ` Marc-André Lureau
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 2/6] qom: Move compat_props machinery from qdev to QOM Markus Armbruster
2019-02-26 12:44 ` Marc-André Lureau
2019-03-04 15:57 ` Philippe Mathieu-Daudé
2019-03-05 6:52 ` Markus Armbruster [this message]
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 3/6] vl: Fix latent bug with -global and onboard devices Markus Armbruster
2019-02-26 12:45 ` Marc-André Lureau
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 4/6] sysbus: Fix latent bug with " Markus Armbruster
2019-02-26 12:48 ` Marc-André Lureau
2019-03-04 16:03 ` Philippe Mathieu-Daudé
2019-03-04 18:45 ` Thomas Huth
2019-03-05 6:54 ` Markus Armbruster
2019-03-05 7:17 ` Thomas Huth
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 5/6] vl: Create block backends before setting machine properties Markus Armbruster
2019-03-04 16:14 ` Philippe Mathieu-Daudé
2019-03-05 10:38 ` Markus Armbruster
2019-03-05 11:34 ` Philippe Mathieu-Daudé
2019-03-05 14:07 ` Markus Armbruster
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev Markus Armbruster
2019-02-26 9:43 ` Laszlo Ersek
2019-02-26 12:35 ` Markus Armbruster
2019-02-26 16:21 ` Laszlo Ersek
2019-03-04 17:50 ` Markus Armbruster
2019-03-05 17:08 ` Laszlo Ersek
2019-03-06 6:12 ` Markus Armbruster
2019-03-04 19:14 ` Philippe Mathieu-Daudé
2019-03-04 19:52 ` Philippe Mathieu-Daudé
2019-03-05 11:31 ` Markus Armbruster
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=87r2blx16w.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=lersek@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--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.