summaryrefslogtreecommitdiff
path: root/drivers/vfio/mdev/mdev_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vfio/mdev/mdev_private.h')
-rw-r--r--drivers/vfio/mdev/mdev_private.h39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
index 7d922950caaf..6999c89db7b1 100644
--- a/drivers/vfio/mdev/mdev_private.h
+++ b/drivers/vfio/mdev/mdev_private.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
- * Mediated device interal definitions
+ * Mediated device internal definitions
*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
* Author: Neo Jia <cjia@nvidia.com>
@@ -24,26 +24,12 @@ struct mdev_parent {
struct rw_semaphore unreg_sem;
};
-struct mdev_device {
- struct device dev;
- struct mdev_parent *parent;
- guid_t uuid;
- void *driver_data;
- struct list_head next;
- struct kobject *type_kobj;
- struct device *iommu_device;
- bool active;
-};
-
-#define to_mdev_device(dev) container_of(dev, struct mdev_device, dev)
-#define dev_is_mdev(d) ((d)->bus == &mdev_bus_type)
-
struct mdev_type {
struct kobject kobj;
struct kobject *devices_kobj;
struct mdev_parent *parent;
struct list_head next;
- struct attribute_group *group;
+ unsigned int type_group_id;
};
#define to_mdev_type_attr(_attr) \
@@ -54,11 +40,22 @@ struct mdev_type {
int parent_create_sysfs_files(struct mdev_parent *parent);
void parent_remove_sysfs_files(struct mdev_parent *parent);
-int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type);
-void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type);
+int mdev_create_sysfs_files(struct mdev_device *mdev);
+void mdev_remove_sysfs_files(struct mdev_device *mdev);
+
+int mdev_device_create(struct mdev_type *kobj, const guid_t *uuid);
+int mdev_device_remove(struct mdev_device *dev);
+
+void mdev_release_parent(struct kref *kref);
+
+static inline void mdev_get_parent(struct mdev_parent *parent)
+{
+ kref_get(&parent->ref);
+}
-int mdev_device_create(struct kobject *kobj,
- struct device *dev, const guid_t *uuid);
-int mdev_device_remove(struct device *dev);
+static inline void mdev_put_parent(struct mdev_parent *parent)
+{
+ kref_put(&parent->ref, mdev_release_parent);
+}
#endif /* MDEV_PRIVATE_H */