qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VF


From: Eric Farman
Subject: Re: [PATCH v2 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW()
Date: Mon, 13 Feb 2023 11:24:46 -0500
User-agent: Evolution 3.46.3 (3.46.3-1.fc37)

On Mon, 2023-02-13 at 17:10 +0100, Philippe Mathieu-Daudé wrote:
> On 13/2/23 16:51, Philippe Mathieu-Daudé wrote:
> > On 13/2/23 16:29, Eric Farman wrote:
> > > On Mon, 2023-02-13 at 08:08 +0100, Philippe Mathieu-Daudé wrote:
> > > > Use the VFIO_CCW() QOM type-checking macro to avoid
> > > > DO_UPCAST().
> > > > 
> > > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > > > ---
> > > >   hw/vfio/ccw.c | 35 ++++++++++++++++-------------------
> > > >   1 file changed, 16 insertions(+), 19 deletions(-)
> > > > 
> > > > diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> > > > index 0354737666..a8aa5b48c4 100644
> > > > --- a/hw/vfio/ccw.c
> > > > +++ b/hw/vfio/ccw.c
> > > 
> > > ...snip...
> > > 
> > > > @@ -252,8 +248,8 @@ again:
> > > >   static void vfio_ccw_reset(DeviceState *dev)
> > > >   {
> > > >       CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj,
> > > > dev);
> > > 
> > > If I'm not mistaken, I believe that this (and (un)realize below)
> > > could
> > > be changed to:
> > > 
> > >     CcwDevice *ccw_dev = CCW_DEVICE(dev);
> > 
> > Even ...
> > 
> > > > -    S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj,
> > > > ccw_dev);
> > > > -    VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev,
> > > > cdev);
> > > > +    S390CCWDevice *cdev = S390_CCW_DEVICE(ccw_dev);
> > > > +    VFIOCCWDevice *vcdev = VFIO_CCW(cdev);
> > 
> >          VFIOCCWDevice *vcdev = VFIO_CCW(dev);

Ha, I didn't look to see if we cared about the intermediary ones, but
this is true here. (Realize cares a bit, but that's easy enough.)

> > 
> > But I somehow got scared to of removing too many casts...
> > 
> > Are these paths covered by a "make check-qtest" on a s390x host?
> 
> They are covered by the Avocado tests :)
> 
> $ avocado --show=app,console run -t arch:s390x tests/avocado
> 

Woo! Then I'm happy with the big squash then.

Reviewed-by: Eric Farman <farman@linux.ibm.com>



reply via email to

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