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] qom: Change prototype of user_creatable_complete.
Date: Wed, 01 Apr 2015 10:05:01 +0200	[thread overview]
Message-ID: <551BA6AD.5040704@redhat.com> (raw)
In-Reply-To: <1427857024-7942-1-git-send-email-lma@suse.com>



On 01/04/2015 04:57, 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 |  4 +++-
>  hw/virtio/virtio-rng.c          |  3 ++-
>  include/qom/object_interfaces.h |  4 ++--
>  qmp.c                           |  2 +-
>  qom/object_interfaces.c         | 11 ++---------
>  5 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
> index cd41478..21b5e49 100644
> --- a/hw/block/dataplane/virtio-blk.c
> +++ b/hw/block/dataplane/virtio-blk.c
> @@ -188,7 +188,9 @@ 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(
> +                                OBJECT(&s->internal_iothread_obj)),

In addition to what Igor suggested, it is not necessary to do
USER_CREATABLE(OBJECT(x)).  It is enough to use USER_CREATABLE(x).

Paolo

> +                                &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..182b586 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -165,7 +165,8 @@ 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(
> +                                OBJECT(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..7324521 100644
> --- a/include/qom/object_interfaces.h
> +++ b/include/qom/object_interfaces.h
> @@ -51,12 +51,12 @@ 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.
>   */
> -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);
>      }
> 

      parent reply	other threads:[~2015-04-01  8:55 UTC|newest]

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

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=551BA6AD.5040704@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.