diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2016-12-30 10:13:38 -0500 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-12-30 10:13:38 -0500 |
commit | 42930553a7c11f06351bc08b889808d0f6020f08 (patch) | |
tree | 673ea947ecaa5529f007fc0fc4bc9a302eeddb18 /drivers/vfio/mdev/mdev_core.c | |
parent | 49550787a90b5bfa44d8dc424d11824dbe21473d (diff) |
vfio-mdev: de-polute the namespace, rename parent_device & parent_ops
Add an mdev_ prefix so we're not poluting the namespace so much.
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Jike Song <jike.song@intel.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
Diffstat (limited to 'drivers/vfio/mdev/mdev_core.c')
-rw-r--r-- | drivers/vfio/mdev/mdev_core.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index 6bb4d4c469ab..bf3b3b0b3d2b 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c | |||
@@ -45,7 +45,7 @@ static int _find_mdev_device(struct device *dev, void *data) | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid) | 48 | static bool mdev_device_exist(struct mdev_parent *parent, uuid_le uuid) |
49 | { | 49 | { |
50 | struct device *dev; | 50 | struct device *dev; |
51 | 51 | ||
@@ -59,9 +59,9 @@ static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /* Should be called holding parent_list_lock */ | 61 | /* Should be called holding parent_list_lock */ |
62 | static struct parent_device *__find_parent_device(struct device *dev) | 62 | static struct mdev_parent *__find_parent_device(struct device *dev) |
63 | { | 63 | { |
64 | struct parent_device *parent; | 64 | struct mdev_parent *parent; |
65 | 65 | ||
66 | list_for_each_entry(parent, &parent_list, next) { | 66 | list_for_each_entry(parent, &parent_list, next) { |
67 | if (parent->dev == dev) | 67 | if (parent->dev == dev) |
@@ -72,8 +72,8 @@ static struct parent_device *__find_parent_device(struct device *dev) | |||
72 | 72 | ||
73 | static void mdev_release_parent(struct kref *kref) | 73 | static void mdev_release_parent(struct kref *kref) |
74 | { | 74 | { |
75 | struct parent_device *parent = container_of(kref, struct parent_device, | 75 | struct mdev_parent *parent = container_of(kref, struct mdev_parent, |
76 | ref); | 76 | ref); |
77 | struct device *dev = parent->dev; | 77 | struct device *dev = parent->dev; |
78 | 78 | ||
79 | kfree(parent); | 79 | kfree(parent); |
@@ -81,7 +81,7 @@ static void mdev_release_parent(struct kref *kref) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | static | 83 | static |
84 | inline struct parent_device *mdev_get_parent(struct parent_device *parent) | 84 | inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent) |
85 | { | 85 | { |
86 | if (parent) | 86 | if (parent) |
87 | kref_get(&parent->ref); | 87 | kref_get(&parent->ref); |
@@ -89,7 +89,7 @@ inline struct parent_device *mdev_get_parent(struct parent_device *parent) | |||
89 | return parent; | 89 | return parent; |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void mdev_put_parent(struct parent_device *parent) | 92 | static inline void mdev_put_parent(struct mdev_parent *parent) |
93 | { | 93 | { |
94 | if (parent) | 94 | if (parent) |
95 | kref_put(&parent->ref, mdev_release_parent); | 95 | kref_put(&parent->ref, mdev_release_parent); |
@@ -98,7 +98,7 @@ static inline void mdev_put_parent(struct parent_device *parent) | |||
98 | static int mdev_device_create_ops(struct kobject *kobj, | 98 | static int mdev_device_create_ops(struct kobject *kobj, |
99 | struct mdev_device *mdev) | 99 | struct mdev_device *mdev) |
100 | { | 100 | { |
101 | struct parent_device *parent = mdev->parent; | 101 | struct mdev_parent *parent = mdev->parent; |
102 | int ret; | 102 | int ret; |
103 | 103 | ||
104 | ret = parent->ops->create(kobj, mdev); | 104 | ret = parent->ops->create(kobj, mdev); |
@@ -125,7 +125,7 @@ static int mdev_device_create_ops(struct kobject *kobj, | |||
125 | */ | 125 | */ |
126 | static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) | 126 | static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) |
127 | { | 127 | { |
128 | struct parent_device *parent = mdev->parent; | 128 | struct mdev_parent *parent = mdev->parent; |
129 | int ret; | 129 | int ret; |
130 | 130 | ||
131 | /* | 131 | /* |
@@ -156,10 +156,10 @@ static int mdev_device_remove_cb(struct device *dev, void *data) | |||
156 | * Add device to list of registered parent devices. | 156 | * Add device to list of registered parent devices. |
157 | * Returns a negative value on error, otherwise 0. | 157 | * Returns a negative value on error, otherwise 0. |
158 | */ | 158 | */ |
159 | int mdev_register_device(struct device *dev, const struct parent_ops *ops) | 159 | int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) |
160 | { | 160 | { |
161 | int ret; | 161 | int ret; |
162 | struct parent_device *parent; | 162 | struct mdev_parent *parent; |
163 | 163 | ||
164 | /* check for mandatory ops */ | 164 | /* check for mandatory ops */ |
165 | if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups) | 165 | if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups) |
@@ -232,7 +232,7 @@ EXPORT_SYMBOL(mdev_register_device); | |||
232 | 232 | ||
233 | void mdev_unregister_device(struct device *dev) | 233 | void mdev_unregister_device(struct device *dev) |
234 | { | 234 | { |
235 | struct parent_device *parent; | 235 | struct mdev_parent *parent; |
236 | bool force_remove = true; | 236 | bool force_remove = true; |
237 | 237 | ||
238 | mutex_lock(&parent_list_lock); | 238 | mutex_lock(&parent_list_lock); |
@@ -269,7 +269,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid) | |||
269 | { | 269 | { |
270 | int ret; | 270 | int ret; |
271 | struct mdev_device *mdev; | 271 | struct mdev_device *mdev; |
272 | struct parent_device *parent; | 272 | struct mdev_parent *parent; |
273 | struct mdev_type *type = to_mdev_type(kobj); | 273 | struct mdev_type *type = to_mdev_type(kobj); |
274 | 274 | ||
275 | parent = mdev_get_parent(type->parent); | 275 | parent = mdev_get_parent(type->parent); |
@@ -338,7 +338,7 @@ create_err: | |||
338 | int mdev_device_remove(struct device *dev, bool force_remove) | 338 | int mdev_device_remove(struct device *dev, bool force_remove) |
339 | { | 339 | { |
340 | struct mdev_device *mdev, *tmp; | 340 | struct mdev_device *mdev, *tmp; |
341 | struct parent_device *parent; | 341 | struct mdev_parent *parent; |
342 | struct mdev_type *type; | 342 | struct mdev_type *type; |
343 | int ret; | 343 | int ret; |
344 | bool found = false; | 344 | bool found = false; |