summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/mdev/mdev_sysfs.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2021-04-06 16:40:28 -0300
committerAlex Williamson <alex.williamson@redhat.com>2021-04-07 15:39:17 -0600
commit417fd5bf242d7691c15fe0bd705ab76c69276572 (patch)
tree3e1fb6626122c6beaf352d89a74770a37bdd19b9 /drivers/vfio/mdev/mdev_sysfs.c
parent91b9969d9c6bb7c02253bbfc536bfd892f636fdc (diff)
downloadlinux-417fd5bf242d7691c15fe0bd705ab76c69276572.tar.bz2
vfio/mdev: Use struct mdev_type in struct mdev_device
The kobj pointer in mdev_device is actually pointing at a struct mdev_type. Use the proper type so things are understandable. There are a number of places that are confused and passing both the mdev and the mtype as function arguments, fix these to derive the mtype directly from the mdev to remove the redundancy. 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> Message-Id: <5-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/mdev/mdev_sysfs.c')
-rw-r--r--drivers/vfio/mdev/mdev_sysfs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
index 18114f3e090a..bcfe48d56e8a 100644
--- a/drivers/vfio/mdev/mdev_sysfs.c
+++ b/drivers/vfio/mdev/mdev_sysfs.c
@@ -67,7 +67,7 @@ static ssize_t create_store(struct kobject *kobj, struct device *dev,
if (ret)
return ret;
- ret = mdev_device_create(kobj, dev, &uuid);
+ ret = mdev_device_create(to_mdev_type(kobj), &uuid);
if (ret)
return ret;
@@ -249,8 +249,9 @@ static const struct attribute *mdev_device_attrs[] = {
NULL,
};
-int mdev_create_sysfs_files(struct mdev_device *mdev, struct mdev_type *type)
+int mdev_create_sysfs_files(struct mdev_device *mdev)
{
+ struct mdev_type *type = mdev->type;
struct kobject *kobj = &mdev->dev.kobj;
int ret;
@@ -271,15 +272,15 @@ int mdev_create_sysfs_files(struct mdev_device *mdev, struct mdev_type *type)
create_files_failed:
sysfs_remove_link(kobj, "mdev_type");
type_link_failed:
- sysfs_remove_link(type->devices_kobj, dev_name(&mdev->dev));
+ sysfs_remove_link(mdev->type->devices_kobj, dev_name(&mdev->dev));
return ret;
}
-void mdev_remove_sysfs_files(struct mdev_device *mdev, struct mdev_type *type)
+void mdev_remove_sysfs_files(struct mdev_device *mdev)
{
struct kobject *kobj = &mdev->dev.kobj;
sysfs_remove_files(kobj, mdev_device_attrs);
sysfs_remove_link(kobj, "mdev_type");
- sysfs_remove_link(type->devices_kobj, dev_name(&mdev->dev));
+ sysfs_remove_link(mdev->type->devices_kobj, dev_name(&mdev->dev));
}