All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: David Hildenbrand <david@redhat.com>,
	qemu-s390x@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	Richard Henderson <rth@twiddle.net>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
Date: Mon, 23 Jul 2018 17:12:06 +0200	[thread overview]
Message-ID: <20180723171206.476d69ef.cohuck@redhat.com> (raw)
In-Reply-To: <1532356951-18210-1-git-send-email-thuth@redhat.com>

On Mon, 23 Jul 2018 16:42:31 +0200
Thomas Huth <thuth@redhat.com> wrote:

> Currently, every virtio-ccw device explicitely sets its unrealize
> function to virtio_ccw_unrealize() in its class_init function.
> We can simplify this by using this unrealize function in the common
> virtio_ccw_busdev_unrealize() function if no other device unrealize
> function has been set.

Sounds sensible to consolidate that.

> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/s390x/virtio-ccw.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 

> @@ -1705,7 +1695,11 @@ static void virtio_ccw_busdev_unrealize(DeviceState *dev, Error **errp)
>      VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
>      VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
>  
> -    _info->unrealize(_dev, errp);
> +    if (_info->unrealize) {
> +        _info->unrealize(_dev, errp);
> +    } else {
> +        virtio_ccw_unrealize(_dev, errp);
> +    }

However, I think it is better to call virtio_ccw_unrealize()
unconditionally here (as we want to make sure it is always invoked) and
call ->unrealize from there if set. That also mirrors what we do for
realize.

>  }
>  
>  static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev,

      reply	other threads:[~2018-07-23 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 14:42 [Qemu-devel] [RFC PATCH] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize() Thomas Huth
2018-07-23 15:12 ` Cornelia Huck [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=20180723171206.476d69ef.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@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 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.