qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex.williamson@redhat.com>,
	"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 30/31] s390x/s390-pci-vfio.c: use QOM casts where appropriate
Date: Mon,  8 Sep 2025 18:53:53 +0200	[thread overview]
Message-ID: <20250908165354.1731444-31-clg@redhat.com> (raw)
In-Reply-To: <20250908165354.1731444-1-clg@redhat.com>

From: Mark Cave-Ayland <mark.caveayland@nutanix.com>

Use QOM casts to cast to VFIOPCIDevice instead of using container_of().

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-22-mark.caveayland@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/s390x/s390-pci-vfio.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
index aaf91319b4e3cfacf3ca3a91e71d9d6d2fbda13f..938a5511713dade46740dca79a8c4c738799a1ce 100644
--- a/hw/s390x/s390-pci-vfio.c
+++ b/hw/s390x/s390-pci-vfio.c
@@ -62,7 +62,7 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
 {
     S390PCIDMACount *cnt;
     uint32_t avail;
-    VFIOPCIDevice *vpdev = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpdev = VFIO_PCI_BASE(pbdev->pdev);
     int id;
 
     assert(vpdev);
@@ -108,7 +108,7 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev,
 {
     struct vfio_info_cap_header *hdr;
     struct vfio_device_info_cap_zpci_base *cap;
-    VFIOPCIDevice *vpci =  container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
     uint64_t vfio_size;
 
     hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
@@ -162,7 +162,7 @@ static bool get_host_fh(S390PCIBusDevice *pbdev, struct vfio_device_info *info,
 {
     struct vfio_info_cap_header *hdr;
     struct vfio_device_info_cap_zpci_base *cap;
-    VFIOPCIDevice *vpci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
 
     hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE);
 
@@ -185,7 +185,7 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev,
     struct vfio_device_info_cap_zpci_group *cap;
     S390pciState *s = s390_get_phb();
     ClpRspQueryPciGrp *resgrp;
-    VFIOPCIDevice *vpci =  container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
     uint8_t start_gid = pbdev->zpci_fn.pfgid;
 
     hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_GROUP);
@@ -264,7 +264,7 @@ static void s390_pci_read_util(S390PCIBusDevice *pbdev,
 {
     struct vfio_info_cap_header *hdr;
     struct vfio_device_info_cap_zpci_util *cap;
-    VFIOPCIDevice *vpci =  container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
 
     hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_UTIL);
 
@@ -291,7 +291,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
 {
     struct vfio_info_cap_header *hdr;
     struct vfio_device_info_cap_zpci_pfip *cap;
-    VFIOPCIDevice *vpci =  container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vpci = VFIO_PCI_BASE(pbdev->pdev);
 
     hdr = vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_PFIP);
 
@@ -314,7 +314,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev,
 
 static struct vfio_device_info *get_device_info(S390PCIBusDevice *pbdev)
 {
-    VFIOPCIDevice *vfio_pci = container_of(pbdev->pdev, VFIOPCIDevice, pdev);
+    VFIOPCIDevice *vfio_pci = VFIO_PCI_BASE(pbdev->pdev);
 
     return vfio_get_device_info(vfio_pci->vbasedev.fd);
 }
-- 
2.51.0



  parent reply	other threads:[~2025-09-08 17:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 16:53 [PULL 00/31] vfio queue Cédric Le Goater
2025-09-08 16:53 ` [PULL 01/31] MAINTAINERS: Add myself as reviewer for PowerNV and XIVE Cédric Le Goater
2025-09-08 16:53 ` [PULL 02/31] vfio/igd: Enable quirks when IGD is not the primary display Cédric Le Goater
2025-09-08 16:53 ` [PULL 03/31] vfio: Remove 'vfio-amd-xgbe' device Cédric Le Goater
2025-09-08 16:53 ` [PULL 04/31] vfio: Remove 'vfio-calxeda-xgmac' device Cédric Le Goater
2025-09-08 16:53 ` [PULL 05/31] vfio: Remove 'vfio-platform' Cédric Le Goater
2025-09-08 16:53 ` [PULL 06/31] vfio: Move vfio-region.h under hw/vfio/ Cédric Le Goater
2025-09-08 16:53 ` [PULL 07/31] vfio/container: set error on cpr failure Cédric Le Goater
2025-09-08 16:53 ` [PULL 08/31] vfio: Report an error when the 'dma_max_mappings' limit is reached Cédric Le Goater
2025-09-08 16:53 ` [PULL 09/31] hw/vfio-user: add x-pci-class-code Cédric Le Goater
2025-09-08 16:53 ` [PULL 10/31] vfio: Introduce helper vfio_pci_from_vfio_device() Cédric Le Goater
2025-09-08 16:53 ` [PULL 11/31] vfio/vfio-container-base.h: update VFIOContainerBase declaration Cédric Le Goater
2025-09-08 16:53 ` [PULL 12/31] vfio/vfio-container.h: update VFIOContainer declaration Cédric Le Goater
2025-09-08 16:53 ` [PULL 13/31] hw/vfio/cpr-legacy.c: use QOM casts where appropriate Cédric Le Goater
2025-09-08 16:53 ` [PULL 14/31] hw/vfio/container.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 15/31] ppc/spapr_pci_vfio.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 16/31] vfio/spapr.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 17/31] vfio/vfio-container.h: rename VFIOContainer bcontainer field to parent_obj Cédric Le Goater
2025-09-08 16:53 ` [PULL 18/31] vfio-user/container.h: update VFIOUserContainer declaration Cédric Le Goater
2025-09-08 16:53 ` [PULL 19/31] vfio/container.c: use QOM casts where appropriate Cédric Le Goater
2025-09-08 16:53 ` [PULL 20/31] vfio-user/container.h: rename VFIOUserContainer bcontainer field to parent_obj Cédric Le Goater
2025-09-08 16:53 ` [PULL 21/31] vfio-user/pci.c: update VFIOUserPCIDevice declaration Cédric Le Goater
2025-09-08 16:53 ` [PULL 22/31] vfio-user/pci.c: use QOM casts where appropriate Cédric Le Goater
2025-09-08 16:53 ` [PULL 23/31] vfio-user/pci.c: rename VFIOUserPCIDevice device field to parent_obj Cédric Le Goater
2025-09-08 16:53 ` [PULL 24/31] vfio/pci.h: update VFIOPCIDevice declaration Cédric Le Goater
2025-09-08 16:53 ` [PULL 25/31] vfio/pci.c: use QOM casts where appropriate Cédric Le Goater
2025-09-08 16:53 ` [PULL 26/31] vfio/pci-quirks.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 27/31] vfio/cpr.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 28/31] vfio/igd.c: " Cédric Le Goater
2025-09-08 16:53 ` [PULL 29/31] vfio-user/pci.c: " Cédric Le Goater
2025-09-08 16:53 ` Cédric Le Goater [this message]
2025-09-08 16:53 ` [PULL 31/31] vfio/pci.h: rename VFIOPCIDevice pdev field to parent_obj Cédric Le Goater
2025-09-11 13:11 ` [PULL 00/31] vfio queue Peter Maydell

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=20250908165354.1731444-31-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=mark.caveayland@nutanix.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).