summaryrefslogtreecommitdiff
path: root/drivers/vfio/mdev
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2022-04-11 17:14:00 +0300
committerZhi Wang <zhi.a.wang@intel.com>2022-04-21 14:36:56 +0300
commite6486939d8ea22569af942a1888aa3824f59cc5e (patch)
treef1c273b67fdd9104f17f58467e78622f41752810 /drivers/vfio/mdev
parent6c7f98b334a32df5cac8abac8983ac4ce17cab57 (diff)
downloadlinux-e6486939d8ea22569af942a1888aa3824f59cc5e.tar.xz
vfio/mdev: Remove mdev_parent_ops dev_attr_groups
This is only used by one sample to print a fixed string that is pointless. In general, having a device driver attach sysfs attributes to the parent is horrific. This should never happen, and always leads to some kind of liftime bug as it become very difficult for the sysfs attribute to go back to any data owned by the device driver. Remove the general mechanism to create this abuse. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zhi Wang <zhi.a.wang@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-32-hch@lst.de Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> Reviewed-by: Zhi Wang <zhi.a.wang@intel.com>
Diffstat (limited to 'drivers/vfio/mdev')
-rw-r--r--drivers/vfio/mdev/mdev_sysfs.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
index f5cf1931c54e..66eef08833a4 100644
--- a/drivers/vfio/mdev/mdev_sysfs.c
+++ b/drivers/vfio/mdev/mdev_sysfs.c
@@ -197,7 +197,6 @@ void parent_remove_sysfs_files(struct mdev_parent *parent)
remove_mdev_supported_type(type);
}
- sysfs_remove_groups(&parent->dev->kobj, parent->ops->dev_attr_groups);
kset_unregister(parent->mdev_types_kset);
}
@@ -213,17 +212,10 @@ int parent_create_sysfs_files(struct mdev_parent *parent)
INIT_LIST_HEAD(&parent->type_list);
- ret = sysfs_create_groups(&parent->dev->kobj,
- parent->ops->dev_attr_groups);
- if (ret)
- goto create_err;
-
ret = add_mdev_supported_type_groups(parent);
if (ret)
- sysfs_remove_groups(&parent->dev->kobj,
- parent->ops->dev_attr_groups);
- else
- return ret;
+ goto create_err;
+ return 0;
create_err:
kset_unregister(parent->mdev_types_kset);