kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: kvm@vger.kernel.org, Kirti Wankhede <kwankhede@nvidia.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Daniel Vetter <daniel@ffwll.ch>, Christoph Hellwig <hch@lst.de>,
	Jike Song <jike.song@intel.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Tarun Gupta <targupta@nvidia.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>
Subject: [PATCH v3 11/14] vfio/mdev: Make to_mdev_device() into a static inline
Date: Tue, 23 Mar 2021 13:15:03 -0300	[thread overview]
Message-ID: <11-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com> (raw)
In-Reply-To: <0-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>

The macro wrongly uses 'dev' as both the macro argument and the member
name, which means it fails compilation if any caller uses a word other
than 'dev' as the single argument. Fix this defect by making it into
proper static inline, which is more clear and typesafe anyhow.

Fixes: 99e3123e3d72 ("vfio-mdev: Make mdev_device private and abstract interfaces")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/mdev/mdev_private.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
index 7d922950caaf3c..74c2e541146999 100644
--- a/drivers/vfio/mdev/mdev_private.h
+++ b/drivers/vfio/mdev/mdev_private.h
@@ -35,7 +35,10 @@ struct mdev_device {
 	bool active;
 };
 
-#define to_mdev_device(dev)	container_of(dev, struct mdev_device, dev)
+static inline struct mdev_device *to_mdev_device(struct device *dev)
+{
+	return container_of(dev, struct mdev_device, dev);
+}
 #define dev_is_mdev(d)		((d)->bus == &mdev_bus_type)
 
 struct mdev_type {
-- 
2.31.0


  parent reply	other threads:[~2021-03-23 16:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 16:14 [PATCH v3 00/14] Embed struct vfio_device in all sub-structures Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 01/14] vfio: Remove extra put/gets around vfio_device->group Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 02/14] vfio: Simplify the lifetime logic for vfio_device Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 03/14] vfio: Split creation of a vfio_device into init and register ops Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 04/14] vfio/platform: Use vfio_init/register/unregister_group_dev Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 05/14] vfio/fsl-mc: Re-order vfio_fsl_mc_probe() Jason Gunthorpe
2021-03-26 16:54   ` Diana Craciun OSS
2021-03-23 16:14 ` [PATCH v3 06/14] vfio/fsl-mc: Use vfio_init/register/unregister_group_dev Jason Gunthorpe
2021-03-23 16:14 ` [PATCH v3 07/14] vfio/pci: Move VGA and VF initialization to functions Jason Gunthorpe
2021-03-23 16:15 ` [PATCH v3 08/14] vfio/pci: Re-order vfio_pci_probe() Jason Gunthorpe
2021-03-23 16:15 ` [PATCH v3 09/14] vfio/pci: Use vfio_init/register/unregister_group_dev Jason Gunthorpe
2021-03-23 16:15 ` [PATCH v3 10/14] vfio/mdev: " Jason Gunthorpe
2021-03-23 16:15 ` Jason Gunthorpe [this message]
2021-03-23 16:15 ` [PATCH v3 12/14] vfio: Make vfio_device_ops pass a 'struct vfio_device *' instead of 'void *' Jason Gunthorpe
2021-03-23 16:15 ` [PATCH v3 13/14] vfio/pci: Replace uses of vfio_device_data() with container_of Jason Gunthorpe
2021-03-23 16:15 ` [PATCH v3 14/14] vfio: Remove device_data from the vfio bus driver API Jason Gunthorpe
2021-04-06 15:57 ` [PATCH v3 00/14] Embed struct vfio_device in all sub-structures Jason Gunthorpe
2021-04-06 19:38 ` Alex Williamson
2021-04-06 19:45   ` Jason Gunthorpe

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=11-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=ashok.raj@intel.com \
    --cc=cohuck@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=hch@lst.de \
    --cc=jike.song@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=targupta@nvidia.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.com \
    /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).