qemu-s390x
[Top][All Lists]
Advanced

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

Re: [qemu-s390x] [RFC PATCH v2] hw/s390x/virtio-ccw: Consolidate calls t


From: Thomas Huth
Subject: Re: [qemu-s390x] [RFC PATCH v2] hw/s390x/virtio-ccw: Consolidate calls to virtio_ccw_unrealize()
Date: Tue, 24 Jul 2018 15:30:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 24.07.2018 15:17, Cornelia Huck wrote:
> On Tue, 24 Jul 2018 10:43:59 +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 a common unrealize function, just like
>> it is already done for the realize functions.
>>
>> Signed-off-by: Thomas Huth <address@hidden>
>> ---
>>  hw/s390x/virtio-ccw.c | 22 +++++++---------------
>>  1 file changed, 7 insertions(+), 15 deletions(-)
>>
>> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
>> index 7ddb378..f3ad7aa 100644
>> --- a/hw/s390x/virtio-ccw.c
>> +++ b/hw/s390x/virtio-ccw.c
>> @@ -750,8 +750,9 @@ out_err:
>>      g_free(sch);
>>  }
>>  
>> -static void virtio_ccw_unrealize(VirtioCcwDevice *dev, Error **errp)
>> +static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev, Error **errp)
>>  {
>> +    VirtIOCCWDeviceClass *dc = VIRTIO_CCW_DEVICE_GET_CLASS(dev);
>>      CcwDevice *ccw_dev = CCW_DEVICE(dev);
>>      SubchDev *sch = ccw_dev->sch;
>>  
>> @@ -764,6 +765,10 @@ static void virtio_ccw_unrealize(VirtioCcwDevice *dev, 
>> Error **errp)
>>          release_indicator(&dev->routes.adapter, dev->indicators);
>>          dev->indicators = NULL;
>>      }
>> +
>> +    if (dc->unrealize) {
>> +        dc->unrealize(dev, errp);
>> +    }
>>  }
>>  
> 
> Hm... if any device type should have the need to do something in the
> unrealize path, it would probably want to do it before the common
> unrealize handling, I think. For example, it might want a valid sch.

Sure, I can move it!

 Thomas





reply via email to

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