qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, "Laurent Vivier" <lvivier@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v2 04/11] qom: call parent first on post_init()
Date: Mon, 17 Jul 2017 15:02:13 -0300	[thread overview]
Message-ID: <20170717180213.GY6020@localhost.localdomain> (raw)
In-Reply-To: <1500279971-13875-5-git-send-email-peterx@redhat.com>

On Mon, Jul 17, 2017 at 04:26:04PM +0800, Peter Xu wrote:
> It makes more sense to call the post_init() hook of the parent first
> then the child, just like what we do in the rest of the hooks.

I suggest documenting the existing instance_post_init users in
the commit message (TYPE_DEVICE and TYPE_ARM_CPU, as far as I can
see), and explain why they won't be affected (or if they are
affected, why the new behavior is better).

Also, can you please update the @instance_post_init documentation
in qom/object.h to mention the new ordering?

Maybe something like:

- * @instance_post_init: This function is called to finish initialization of
- *   an object, after all @instance_init functions were called.
+ * @instance_post_init: Finish initialization of an object.  This
+ *   function is called after the @instance_init functions for
+ *   all subclasses were called, but before the @instance_post_init
+ *   function for the subclasses are called.


> 
> CC: Andreas Färber <afaerber@suse.de>
> CC: Markus Armbruster <armbru@redhat.com>
> CC: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  qom/object.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index dfdbd50..e2c9c4a 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -347,13 +347,13 @@ static void object_init_with_type(Object *obj, TypeImpl *ti)
>  
>  static void object_post_init_with_type(Object *obj, TypeImpl *ti)
>  {
> -    if (ti->instance_post_init) {
> -        ti->instance_post_init(obj);
> -    }
> -
>      if (type_has_parent(ti)) {
>          object_post_init_with_type(obj, type_get_parent(ti));
>      }
> +
> +    if (ti->instance_post_init) {
> +        ti->instance_post_init(obj);
> +    }
>  }
>  
>  static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
> -- 
> 2.7.4
> 

-- 
Eduardo

  reply	other threads:[~2017-07-17 18:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17  8:26 [Qemu-devel] [PATCH v2 00/11] migration: export cap/params to qdev props Peter Xu
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 01/11] qdev: provide DEFINE_PROP_INT64() Peter Xu
2017-07-17  8:30   ` Marcel Apfelbaum
2017-07-17 16:24   ` Juan Quintela
2017-07-17 16:30   ` Eric Blake
2017-07-18  1:25     ` Peter Xu
2017-07-17 17:49   ` Eduardo Habkost
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 02/11] migration: export parameters to props Peter Xu
2017-07-17 16:30   ` Juan Quintela
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 03/11] migration: export capabilities " Peter Xu
2017-07-17 16:58   ` Juan Quintela
2017-07-18  1:34     ` Peter Xu
2017-07-17 17:52   ` Eduardo Habkost
2017-07-18  1:00     ` Peter Xu
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 04/11] qom: call parent first on post_init() Peter Xu
2017-07-17 18:02   ` Eduardo Habkost [this message]
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 05/11] migration: introduce migrate_params_check() Peter Xu
2017-07-17 17:04   ` Juan Quintela
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 06/11] migration: provide migrate_params_apply() Peter Xu
2017-07-17 19:01   ` Juan Quintela
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 07/11] migration: check global params for validity Peter Xu
2017-07-17 17:50   ` Juan Quintela
2017-07-17 18:25   ` Eduardo Habkost
2017-07-18  1:56     ` Peter Xu
2017-07-18  2:33       ` Eduardo Habkost
2017-07-18  2:41         ` Peter Xu
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 08/11] migration: remove check against colo support Peter Xu
2017-07-17 17:07   ` Juan Quintela
2017-07-18  7:13   ` Zhang Chen
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 09/11] migration: provide migrate_caps_check() Peter Xu
2017-07-17 19:03   ` Juan Quintela
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 10/11] migration: provide migrate_cap_add() Peter Xu
2017-07-17 17:14   ` Juan Quintela
2017-07-18  3:10     ` Peter Xu
2017-07-17  8:26 ` [Qemu-devel] [PATCH v2 11/11] migration: check global caps for validity Peter Xu
2017-07-17 19:48   ` Juan Quintela

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=20170717180213.GY6020@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).