Lines Matching refs:mdev

30 struct device *mdev_parent_dev(struct mdev_device *mdev)  in mdev_parent_dev()  argument
32 return mdev->parent->dev; in mdev_parent_dev()
36 void *mdev_get_drvdata(struct mdev_device *mdev) in mdev_get_drvdata() argument
38 return mdev->driver_data; in mdev_get_drvdata()
42 void mdev_set_drvdata(struct mdev_device *mdev, void *data) in mdev_set_drvdata() argument
44 mdev->driver_data = data; in mdev_set_drvdata()
48 struct device *mdev_dev(struct mdev_device *mdev) in mdev_dev() argument
50 return &mdev->dev; in mdev_dev()
60 const guid_t *mdev_uuid(struct mdev_device *mdev) in mdev_uuid() argument
62 return &mdev->uuid; in mdev_uuid()
103 static void mdev_device_remove_common(struct mdev_device *mdev) in mdev_device_remove_common() argument
109 type = to_mdev_type(mdev->type_kobj); in mdev_device_remove_common()
110 mdev_remove_sysfs_files(&mdev->dev, type); in mdev_device_remove_common()
111 device_del(&mdev->dev); in mdev_device_remove_common()
112 parent = mdev->parent; in mdev_device_remove_common()
114 ret = parent->ops->remove(mdev); in mdev_device_remove_common()
116 dev_err(&mdev->dev, "Remove failed: err=%d\n", ret); in mdev_device_remove_common()
119 put_device(&mdev->dev); in mdev_device_remove_common()
126 struct mdev_device *mdev; in mdev_device_remove_cb() local
128 mdev = to_mdev_device(dev); in mdev_device_remove_cb()
129 mdev_device_remove_common(mdev); in mdev_device_remove_cb()
255 static void mdev_device_free(struct mdev_device *mdev) in mdev_device_free() argument
258 list_del(&mdev->next); in mdev_device_free()
261 dev_dbg(&mdev->dev, "MDEV: destroying\n"); in mdev_device_free()
262 kfree(mdev); in mdev_device_free()
267 struct mdev_device *mdev = to_mdev_device(dev); in mdev_device_release() local
269 mdev_device_free(mdev); in mdev_device_release()
276 struct mdev_device *mdev, *tmp; in mdev_device_create() local
295 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); in mdev_device_create()
296 if (!mdev) { in mdev_device_create()
302 guid_copy(&mdev->uuid, uuid); in mdev_device_create()
303 list_add(&mdev->next, &mdev_list); in mdev_device_create()
306 mdev->parent = parent; in mdev_device_create()
310 mdev_device_free(mdev); in mdev_device_create()
315 device_initialize(&mdev->dev); in mdev_device_create()
316 mdev->dev.parent = dev; in mdev_device_create()
317 mdev->dev.bus = &mdev_bus_type; in mdev_device_create()
318 mdev->dev.release = mdev_device_release; in mdev_device_create()
319 dev_set_name(&mdev->dev, "%pUl", uuid); in mdev_device_create()
320 mdev->dev.groups = parent->ops->mdev_attr_groups; in mdev_device_create()
321 mdev->type_kobj = kobj; in mdev_device_create()
323 ret = parent->ops->create(kobj, mdev); in mdev_device_create()
327 ret = device_add(&mdev->dev); in mdev_device_create()
331 ret = mdev_create_sysfs_files(&mdev->dev, type); in mdev_device_create()
335 mdev->active = true; in mdev_device_create()
336 dev_dbg(&mdev->dev, "MDEV: created\n"); in mdev_device_create()
342 device_del(&mdev->dev); in mdev_device_create()
344 parent->ops->remove(mdev); in mdev_device_create()
347 put_device(&mdev->dev); in mdev_device_create()
355 struct mdev_device *mdev, *tmp; in mdev_device_remove() local
358 mdev = to_mdev_device(dev); in mdev_device_remove()
362 if (tmp == mdev) in mdev_device_remove()
366 if (tmp != mdev) { in mdev_device_remove()
371 if (!mdev->active) { in mdev_device_remove()
376 mdev->active = false; in mdev_device_remove()
379 parent = mdev->parent; in mdev_device_remove()
384 mdev_device_remove_common(mdev); in mdev_device_remove()
391 struct mdev_device *mdev = to_mdev_device(dev); in mdev_set_iommu_device() local
393 mdev->iommu_device = iommu_device; in mdev_set_iommu_device()
401 struct mdev_device *mdev = to_mdev_device(dev); in mdev_get_iommu_device() local
403 return mdev->iommu_device; in mdev_get_iommu_device()