Lines Matching refs:mdev
13 #include <linux/mdev.h>
27 static void mdev_device_remove_common(struct mdev_device *mdev)
29 struct mdev_parent *parent = mdev->type->parent;
31 mdev_remove_sysfs_files(mdev);
32 device_del(&mdev->dev);
35 put_device(&mdev->dev);
49 * @mdev_driver: Device driver to bind to the newly created mdev
50 * @types: Array of supported mdev types
53 * Registers the @parent stucture as a parent for mdev types and thus mdev
112 struct mdev_device *mdev = to_mdev_device(dev);
113 struct mdev_parent *parent = mdev->type->parent;
116 list_del(&mdev->next);
122 kobject_put(&mdev->type->kobj);
124 dev_dbg(&mdev->dev, "MDEV: destroying\n");
125 kfree(mdev);
131 struct mdev_device *mdev, *tmp;
157 mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
158 if (!mdev) {
163 device_initialize(&mdev->dev);
164 mdev->dev.parent = parent->dev;
165 mdev->dev.bus = &mdev_bus_type;
166 mdev->dev.release = mdev_device_release;
167 mdev->dev.groups = mdev_device_groups;
168 mdev->type = type;
172 guid_copy(&mdev->uuid, uuid);
173 list_add(&mdev->next, &mdev_list);
176 ret = dev_set_name(&mdev->dev, "%pUl", uuid);
186 ret = device_add(&mdev->dev);
190 ret = device_driver_attach(&drv->driver, &mdev->dev);
194 ret = mdev_create_sysfs_files(mdev);
198 mdev->active = true;
199 dev_dbg(&mdev->dev, "MDEV: created\n");
205 device_del(&mdev->dev);
209 put_device(&mdev->dev);
213 int mdev_device_remove(struct mdev_device *mdev)
216 struct mdev_parent *parent = mdev->type->parent;
220 if (tmp == mdev)
224 if (tmp != mdev) {
229 if (!mdev->active) {
234 mdev->active = false;
241 mdev_device_remove_common(mdev);