All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Lin Ma <lma@suse.com>,
	imammedo@redhat.com, afaerber@suse.de,
	peter.crosthwaite@xilinx.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qom: Change prototype of user_creatable_complete.
Date: Wed, 01 Apr 2015 11:07:49 +0200	[thread overview]
Message-ID: <551BB565.4060706@redhat.com> (raw)
In-Reply-To: <1427878342-19872-1-git-send-email-lma@suse.com>



On 01/04/2015 10:52, Lin Ma wrote:
> From void user_creatable_complete(Object *obj, Error **errp)
> to   void user_creatable_complete(UserCreatable *uc, Error **errp)
> 
> Signed-off-by: Lin Ma <lma@suse.com>
> ---
>  hw/block/dataplane/virtio-blk.c |  3 ++-
>  hw/virtio/virtio-rng.c          |  2 +-
>  include/qom/object_interfaces.h |  7 +++----
>  qmp.c                           |  2 +-
>  qom/object_interfaces.c         | 11 ++---------
>  5 files changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index cd41478..2941574 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -188,7 +188,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
>          object_initialize(&s->internal_iothread_obj,
>                            sizeof(s->internal_iothread_obj),
>                            TYPE_IOTHREAD);
> -        user_creatable_complete(OBJECT(&s->internal_iothread_obj), &error_abort);
> +        user_creatable_complete(USER_CREATABLE(&s->internal_iothread_obj),
> +                                &error_abort);
>          s->iothread = &s->internal_iothread_obj;
>      }
>      s->ctx = iothread_get_aio_context(s->iothread);
> diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
> index 06e7178..65afc9e 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -165,7 +165,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
>      if (vrng->conf.rng == NULL) {
>          vrng->conf.default_backend = RNG_RANDOM(object_new(TYPE_RNG_RANDOM));
>  
> -        user_creatable_complete(OBJECT(vrng->conf.default_backend),
> +        user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend),
>                                  &local_err);
>          if (local_err) {
>              error_propagate(errp, local_err);
> diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
> index b792283..5e7fcb3 100644
> --- a/include/qom/object_interfaces.h
> +++ b/include/qom/object_interfaces.h
> @@ -51,12 +51,11 @@ typedef struct UserCreatableClass {
>  
>  /**
>   * user_creatable_complete:
> - * @obj: the object whose complete() method is called if defined
> + * @uc: the object whose complete() method is called if defined
>   * @errp: if an error occurs, a pointer to an area to store the error
>   *
>   * Wrapper to call complete() method if one of types it's inherited
> - * from implements USER_CREATABLE interface, otherwise the call does
> - * nothing.
> + * from implements USER_CREATABLE interface.
>   */
> -void user_creatable_complete(Object *obj, Error **errp);
> +void user_creatable_complete(UserCreatable *uc, Error **errp);
>  #endif
> diff --git a/qmp.c b/qmp.c
> index c479e77..b944507 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -656,7 +656,7 @@ void object_add(const char *type, const char *id, const QDict *qdict,
>          goto out;
>      }
>  
> -    user_creatable_complete(obj, &local_err);
> +    user_creatable_complete(USER_CREATABLE(obj), &local_err);
>      if (local_err) {
>          object_property_del(container_get(object_get_root(), "/objects"),
>                              id, &error_abort);
> diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
> index 6360818..3aa26c7 100644
> --- a/qom/object_interfaces.c
> +++ b/qom/object_interfaces.c
> @@ -1,18 +1,11 @@
>  #include "qom/object_interfaces.h"
>  #include "qemu/module.h"
>  
> -void user_creatable_complete(Object *obj, Error **errp)
> +void user_creatable_complete(UserCreatable *uc, Error **errp)
>  {
>  
> -    UserCreatableClass *ucc;
> -    UserCreatable *uc =
> -        (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
> +    UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
>  
> -    if (!uc) {
> -        return;
> -    }
> -
> -    ucc = USER_CREATABLE_GET_CLASS(uc);
>      if (ucc->complete) {
>          ucc->complete(uc, errp);
>      }
> 

Thanks,

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

  reply	other threads:[~2015-04-01  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  8:52 [Qemu-devel] [PATCH v2] qom: Change prototype of user_creatable_complete Lin Ma
2015-04-01  9:07 ` Paolo Bonzini [this message]
2015-04-01  9:28 ` Igor Mammedov

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=551BB565.4060706@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=lma@suse.com \
    --cc=peter.crosthwaite@xilinx.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.