Lines Matching refs:mdev

33 struct device *mdev_parent_dev(struct mdev_device *mdev)  in mdev_parent_dev()  argument
35 return mdev->parent->dev; in mdev_parent_dev()
39 void *mdev_get_drvdata(struct mdev_device *mdev) in mdev_get_drvdata() argument
41 return mdev->driver_data; in mdev_get_drvdata()
45 void mdev_set_drvdata(struct mdev_device *mdev, void *data) in mdev_set_drvdata() argument
47 mdev->driver_data = data; in mdev_set_drvdata()
51 struct device *mdev_dev(struct mdev_device *mdev) in mdev_dev() argument
53 return &mdev->dev; in mdev_dev()
63 uuid_le mdev_uuid(struct mdev_device *mdev) in mdev_uuid() argument
65 return mdev->uuid; in mdev_uuid()
107 struct mdev_device *mdev) in mdev_device_create_ops() argument
109 struct mdev_parent *parent = mdev->parent; in mdev_device_create_ops()
112 ret = parent->ops->create(kobj, mdev); in mdev_device_create_ops()
116 ret = sysfs_create_groups(&mdev->dev.kobj, in mdev_device_create_ops()
119 parent->ops->remove(mdev); in mdev_device_create_ops()
134 static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove) in mdev_device_remove_ops() argument
136 struct mdev_parent *parent = mdev->parent; in mdev_device_remove_ops()
143 ret = parent->ops->remove(mdev); in mdev_device_remove_ops()
147 sysfs_remove_groups(&mdev->dev.kobj, parent->ops->mdev_attr_groups); in mdev_device_remove_ops()
269 struct mdev_device *mdev = to_mdev_device(dev); in mdev_device_release() local
272 list_del(&mdev->next); in mdev_device_release()
275 dev_dbg(&mdev->dev, "MDEV: destroying\n"); in mdev_device_release()
276 kfree(mdev); in mdev_device_release()
282 struct mdev_device *mdev, *tmp; in mdev_device_create() local
301 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); in mdev_device_create()
302 if (!mdev) { in mdev_device_create()
308 memcpy(&mdev->uuid, &uuid, sizeof(uuid_le)); in mdev_device_create()
309 list_add(&mdev->next, &mdev_list); in mdev_device_create()
312 mdev->parent = parent; in mdev_device_create()
313 kref_init(&mdev->ref); in mdev_device_create()
315 mdev->dev.parent = dev; in mdev_device_create()
316 mdev->dev.bus = &mdev_bus_type; in mdev_device_create()
317 mdev->dev.release = mdev_device_release; in mdev_device_create()
318 dev_set_name(&mdev->dev, "%pUl", uuid.b); in mdev_device_create()
320 ret = device_register(&mdev->dev); in mdev_device_create()
322 put_device(&mdev->dev); in mdev_device_create()
326 ret = mdev_device_create_ops(kobj, mdev); in mdev_device_create()
330 ret = mdev_create_sysfs_files(&mdev->dev, type); in mdev_device_create()
332 mdev_device_remove_ops(mdev, true); in mdev_device_create()
336 mdev->type_kobj = kobj; in mdev_device_create()
337 mdev->active = true; in mdev_device_create()
338 dev_dbg(&mdev->dev, "MDEV: created\n"); in mdev_device_create()
343 device_unregister(&mdev->dev); in mdev_device_create()
351 struct mdev_device *mdev, *tmp; in mdev_device_remove() local
356 mdev = to_mdev_device(dev); in mdev_device_remove()
360 if (tmp == mdev) in mdev_device_remove()
364 if (tmp != mdev) { in mdev_device_remove()
369 if (!mdev->active) { in mdev_device_remove()
374 mdev->active = false; in mdev_device_remove()
377 type = to_mdev_type(mdev->type_kobj); in mdev_device_remove()
378 parent = mdev->parent; in mdev_device_remove()
380 ret = mdev_device_remove_ops(mdev, force_remove); in mdev_device_remove()
382 mdev->active = true; in mdev_device_remove()