summaryrefslogtreecommitdiffstats
path: root/include/linux/mdev.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-09-23 11:26:50 +0200
committerAlex Williamson <alex.williamson@redhat.com>2022-10-04 12:06:58 -0600
commitf2fbc72e6da4f8e01fe5fe3d6871a791e76271c3 (patch)
treeee1b8729387da228a9f23f5a2d7be303cad86155 /include/linux/mdev.h
parent0bc79069ccbdbe26492493dd0c4e38b7cadf8ad5 (diff)
downloadlinux-f2fbc72e6da4f8e01fe5fe3d6871a791e76271c3.tar.bz2
vfio/mdev: consolidate all the available_instance sysfs into the core code
Every driver just print a number, simply add a method to the mdev_driver to return it and provide a standard sysfs show function. 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> Reviewed-by: Eric Farman <farman@linux.ibm.com> Link: https://lore.kernel.org/r/20220923092652.100656-13-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux/mdev.h')
-rw-r--r--include/linux/mdev.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mdev.h b/include/linux/mdev.h
index 4bb8a58b577b..d39e08a1824c 100644
--- a/include/linux/mdev.h
+++ b/include/linux/mdev.h
@@ -72,6 +72,7 @@ struct mdev_type_attribute {
* @device_api: string to return for the device_api sysfs
* @probe: called when new device created
* @remove: called when device removed
+ * @get_available: Return the max number of instances that can be created
* @types_attrs: attributes to the type kobjects.
* @driver: device driver structure
**/
@@ -79,6 +80,7 @@ struct mdev_driver {
const char *device_api;
int (*probe)(struct mdev_device *dev);
void (*remove)(struct mdev_device *dev);
+ unsigned int (*get_available)(struct mdev_type *mtype);
const struct attribute * const *types_attrs;
struct device_driver driver;
};