Commit 66873b5f authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

vfio/mdev: Make to_mdev_device() into a static inline

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: 99e3123e ("vfio-mdev: Make mdev_device private and abstract interfaces")
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Message-Id: <11-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 1ae1b20f
...@@ -35,7 +35,10 @@ struct mdev_device { ...@@ -35,7 +35,10 @@ struct mdev_device {
bool active; 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) #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type)
struct mdev_type { struct mdev_type {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment