[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>
- [PATCH v2 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000(), (continued)
- [PATCH v2 10/19] hw/net/ne2000-pci: Replace DO_UPCAST(PCINE2000State) by PCI_NE2000(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v2 11/19] hw/net/tulip: Finish QOM conversion, Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v2 12/19] hw/pci/pci: Replace DO_UPCAST(PCIBus) by PCI_BUS(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v2 13/19] hw/scsi/scsi-bus: Replace DO_UPCAST(SCSIBus) by SCSI_BUS(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v2 15/19] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT(), Philippe Mathieu-Daudé, 2023/02/13
- [PATCH v2 16/19] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW(), Philippe Mathieu-Daudé, 2023/02/13
[PATCH v2 14/19] hw/scsi/scsi-bus: Inline two uses of scsi_bus_from_device(), Philippe Mathieu-Daudé, 2023/02/13
[PATCH v2 17/19] hw/usb/dev-hub: Use QOM USB_HUB() macro instead of casting, Philippe Mathieu-Daudé, 2023/02/13
[PATCH v2 18/19] hw/usb: Replace DO_UPCAST(USBBus) by USB_BUS(), Philippe Mathieu-Daudé, 2023/02/13
[RFC PATCH v2 19/19] hw/usb: Inline usb_bus_from_device(), Philippe Mathieu-Daudé, 2023/02/13