aboutsummaryrefslogtreecommitdiff
path: root/samples/vfio-mdev/mbochs.c
diff options
context:
space:
mode:
authorGravatar Christoph Hellwig <hch@lst.de> 2022-09-23 11:26:51 +0200
committerGravatar Alex Williamson <alex.williamson@redhat.com> 2022-10-04 12:06:58 -0600
commit685a1537f4c603cfcaf4b9be56ff6a571f7ddd08 (patch)
tree7319267ff8a1b392c167e693b34eed5f41ff5d94 /samples/vfio-mdev/mbochs.c
parentvfio/mdev: consolidate all the available_instance sysfs into the core code (diff)
downloadlinux-685a1537f4c603cfcaf4b9be56ff6a571f7ddd08.tar.gz
linux-685a1537f4c603cfcaf4b9be56ff6a571f7ddd08.tar.bz2
linux-685a1537f4c603cfcaf4b9be56ff6a571f7ddd08.zip
vfio/mdev: consolidate all the description sysfs into the core code
Every driver just emits a string, simply add a method to the mdev_driver to return it and provide a standard sysfs show function. Remove the now unused types_attrs field in struct mdev_driver and the support code for it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> Link: https://lore.kernel.org/r/20220923092652.100656-14-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'samples/vfio-mdev/mbochs.c')
-rw-r--r--samples/vfio-mdev/mbochs.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 6c2cbc4e25ca..117a8d799f71 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -1350,8 +1350,7 @@ static const struct attribute_group *mdev_dev_groups[] = {
NULL,
};
-static ssize_t description_show(struct mdev_type *mtype,
- struct mdev_type_attribute *attr, char *buf)
+static ssize_t mbochs_show_description(struct mdev_type *mtype, char *buf)
{
struct mbochs_type *type =
container_of(mtype, struct mbochs_type, type);
@@ -1359,7 +1358,6 @@ static ssize_t description_show(struct mdev_type *mtype,
return sprintf(buf, "virtual display, %d MB video memory\n",
type ? type->mbytes : 0);
}
-static MDEV_TYPE_ATTR_RO(description);
static unsigned int mbochs_get_available(struct mdev_type *mtype)
{
@@ -1369,11 +1367,6 @@ static unsigned int mbochs_get_available(struct mdev_type *mtype)
return atomic_read(&mbochs_avail_mbytes) / type->mbytes;
}
-static const struct attribute *mdev_types_attrs[] = {
- &mdev_type_attr_description.attr,
- NULL,
-};
-
static const struct vfio_device_ops mbochs_dev_ops = {
.close_device = mbochs_close_device,
.init = mbochs_init_dev,
@@ -1395,7 +1388,7 @@ static struct mdev_driver mbochs_driver = {
.probe = mbochs_probe,
.remove = mbochs_remove,
.get_available = mbochs_get_available,
- .types_attrs = mdev_types_attrs,
+ .show_description = mbochs_show_description,
};
static const struct file_operations vd_fops = {