Lines Matching refs:mdev
30 struct device *mdev_parent_dev(struct mdev_device *mdev) in mdev_parent_dev() argument
32 return mdev->type->parent->dev; in mdev_parent_dev()
40 unsigned int mdev_get_type_group_id(struct mdev_device *mdev) in mdev_get_type_group_id() argument
42 return mdev->type->type_group_id; in mdev_get_type_group_id()
89 static void mdev_device_remove_common(struct mdev_device *mdev) in mdev_device_remove_common() argument
91 struct mdev_parent *parent = mdev->type->parent; in mdev_device_remove_common()
94 mdev_remove_sysfs_files(mdev); in mdev_device_remove_common()
95 device_del(&mdev->dev); in mdev_device_remove_common()
98 ret = parent->ops->remove(mdev); in mdev_device_remove_common()
100 dev_err(&mdev->dev, "Remove failed: err=%d\n", ret); in mdev_device_remove_common()
104 put_device(&mdev->dev); in mdev_device_remove_common()
109 struct mdev_device *mdev = mdev_from_dev(dev); in mdev_device_remove_cb() local
111 if (mdev) in mdev_device_remove_cb()
112 mdev_device_remove_common(mdev); in mdev_device_remove_cb()
241 struct mdev_device *mdev = to_mdev_device(dev); in mdev_device_release() local
244 kobject_put(&mdev->type->kobj); in mdev_device_release()
247 list_del(&mdev->next); in mdev_device_release()
250 dev_dbg(&mdev->dev, "MDEV: destroying\n"); in mdev_device_release()
251 kfree(mdev); in mdev_device_release()
257 struct mdev_device *mdev, *tmp; in mdev_device_create() local
271 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); in mdev_device_create()
272 if (!mdev) { in mdev_device_create()
277 device_initialize(&mdev->dev); in mdev_device_create()
278 mdev->dev.parent = parent->dev; in mdev_device_create()
279 mdev->dev.bus = &mdev_bus_type; in mdev_device_create()
280 mdev->dev.release = mdev_device_release; in mdev_device_create()
281 mdev->dev.groups = parent->ops->mdev_attr_groups; in mdev_device_create()
282 mdev->type = type; in mdev_device_create()
286 guid_copy(&mdev->uuid, uuid); in mdev_device_create()
287 list_add(&mdev->next, &mdev_list); in mdev_device_create()
290 ret = dev_set_name(&mdev->dev, "%pUl", uuid); in mdev_device_create()
301 ret = parent->ops->create(mdev); in mdev_device_create()
306 ret = device_add(&mdev->dev); in mdev_device_create()
312 ret = device_driver_attach(&drv->driver, &mdev->dev); in mdev_device_create()
316 ret = mdev_create_sysfs_files(mdev); in mdev_device_create()
320 mdev->active = true; in mdev_device_create()
321 dev_dbg(&mdev->dev, "MDEV: created\n"); in mdev_device_create()
327 device_del(&mdev->dev); in mdev_device_create()
330 parent->ops->remove(mdev); in mdev_device_create()
334 put_device(&mdev->dev); in mdev_device_create()
338 int mdev_device_remove(struct mdev_device *mdev) in mdev_device_remove() argument
341 struct mdev_parent *parent = mdev->type->parent; in mdev_device_remove()
345 if (tmp == mdev) in mdev_device_remove()
349 if (tmp != mdev) { in mdev_device_remove()
354 if (!mdev->active) { in mdev_device_remove()
359 mdev->active = false; in mdev_device_remove()
366 mdev_device_remove_common(mdev); in mdev_device_remove()