mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
vfio/mdev: consolidate all the device_api sysfs into the core code
Every driver just emits a static string, simply feed it through the ops and provide a standard sysfs show function. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> Reviewed-by: Eric Farman <farman@linux.ibm.com> Link: https://lore.kernel.org/r/20220923092652.100656-11-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
committed by
Alex Williamson
parent
c7c1f38f6c
commit
290aac5df8
@@ -1384,17 +1384,9 @@ static ssize_t available_instances_show(struct mdev_type *mtype,
|
||||
}
|
||||
static MDEV_TYPE_ATTR_RO(available_instances);
|
||||
|
||||
static ssize_t device_api_show(struct mdev_type *mtype,
|
||||
struct mdev_type_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
|
||||
}
|
||||
static MDEV_TYPE_ATTR_RO(device_api);
|
||||
|
||||
static const struct attribute *mdev_types_attrs[] = {
|
||||
&mdev_type_attr_name.attr,
|
||||
&mdev_type_attr_description.attr,
|
||||
&mdev_type_attr_device_api.attr,
|
||||
&mdev_type_attr_available_instances.attr,
|
||||
NULL,
|
||||
};
|
||||
@@ -1410,6 +1402,7 @@ static const struct vfio_device_ops mbochs_dev_ops = {
|
||||
};
|
||||
|
||||
static struct mdev_driver mbochs_driver = {
|
||||
.device_api = VFIO_DEVICE_API_PCI_STRING,
|
||||
.driver = {
|
||||
.name = "mbochs",
|
||||
.owner = THIS_MODULE,
|
||||
|
@@ -689,17 +689,9 @@ static ssize_t available_instances_show(struct mdev_type *mtype,
|
||||
}
|
||||
static MDEV_TYPE_ATTR_RO(available_instances);
|
||||
|
||||
static ssize_t device_api_show(struct mdev_type *mtype,
|
||||
struct mdev_type_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
|
||||
}
|
||||
static MDEV_TYPE_ATTR_RO(device_api);
|
||||
|
||||
static const struct attribute *mdev_types_attrs[] = {
|
||||
&mdev_type_attr_name.attr,
|
||||
&mdev_type_attr_description.attr,
|
||||
&mdev_type_attr_device_api.attr,
|
||||
&mdev_type_attr_available_instances.attr,
|
||||
NULL,
|
||||
};
|
||||
@@ -714,6 +706,7 @@ static const struct vfio_device_ops mdpy_dev_ops = {
|
||||
};
|
||||
|
||||
static struct mdev_driver mdpy_driver = {
|
||||
.device_api = VFIO_DEVICE_API_PCI_STRING,
|
||||
.driver = {
|
||||
.name = "mdpy",
|
||||
.owner = THIS_MODULE,
|
||||
|
@@ -1277,17 +1277,8 @@ static ssize_t available_instances_show(struct mdev_type *mtype,
|
||||
|
||||
static MDEV_TYPE_ATTR_RO(available_instances);
|
||||
|
||||
static ssize_t device_api_show(struct mdev_type *mtype,
|
||||
struct mdev_type_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
|
||||
}
|
||||
|
||||
static MDEV_TYPE_ATTR_RO(device_api);
|
||||
|
||||
static const struct attribute *mdev_types_attrs[] = {
|
||||
&mdev_type_attr_name.attr,
|
||||
&mdev_type_attr_device_api.attr,
|
||||
&mdev_type_attr_available_instances.attr,
|
||||
NULL,
|
||||
};
|
||||
@@ -1302,6 +1293,7 @@ static const struct vfio_device_ops mtty_dev_ops = {
|
||||
};
|
||||
|
||||
static struct mdev_driver mtty_driver = {
|
||||
.device_api = VFIO_DEVICE_API_PCI_STRING,
|
||||
.driver = {
|
||||
.name = "mtty",
|
||||
.owner = THIS_MODULE,
|
||||
|
Reference in New Issue
Block a user