qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [RFC PATCH] hw/s390x/virtio-ccw: Consolidate calls to v


From: Cornelia Huck
Subject: Re: [qemu-s390x] [RFC PATCH] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
Date: Mon, 23 Jul 2018 17:12:06 +0200

On Mon, 23 Jul 2018 16:42:31 +0200
Thomas Huth <address@hidden> 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 <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]