Lines Matching refs:parent
32 return mdev->type->parent->dev; in mdev_parent_dev()
62 return mtype->parent->dev; in mtype_get_parent_dev()
69 struct mdev_parent *parent; in __find_parent_device() local
71 list_for_each_entry(parent, &parent_list, next) { in __find_parent_device()
72 if (parent->dev == dev) in __find_parent_device()
73 return parent; in __find_parent_device()
80 struct mdev_parent *parent = container_of(kref, struct mdev_parent, in mdev_release_parent() local
82 struct device *dev = parent->dev; in mdev_release_parent()
84 kfree(parent); in mdev_release_parent()
91 struct mdev_parent *parent = mdev->type->parent; in mdev_device_remove_common() local
96 lockdep_assert_held(&parent->unreg_sem); in mdev_device_remove_common()
97 if (parent->ops->remove) { in mdev_device_remove_common()
98 ret = parent->ops->remove(mdev); in mdev_device_remove_common()
127 struct mdev_parent *parent; in mdev_register_device() local
144 parent = __find_parent_device(dev); in mdev_register_device()
145 if (parent) { in mdev_register_device()
146 parent = NULL; in mdev_register_device()
151 parent = kzalloc(sizeof(*parent), GFP_KERNEL); in mdev_register_device()
152 if (!parent) { in mdev_register_device()
157 kref_init(&parent->ref); in mdev_register_device()
158 init_rwsem(&parent->unreg_sem); in mdev_register_device()
160 parent->dev = dev; in mdev_register_device()
161 parent->ops = ops; in mdev_register_device()
171 ret = parent_create_sysfs_files(parent); in mdev_register_device()
179 list_add(&parent->next, &parent_list); in mdev_register_device()
189 if (parent) in mdev_register_device()
190 mdev_put_parent(parent); in mdev_register_device()
207 struct mdev_parent *parent; in mdev_unregister_device() local
212 parent = __find_parent_device(dev); in mdev_unregister_device()
214 if (!parent) { in mdev_unregister_device()
220 list_del(&parent->next); in mdev_unregister_device()
223 down_write(&parent->unreg_sem); in mdev_unregister_device()
229 parent_remove_sysfs_files(parent); in mdev_unregister_device()
230 up_write(&parent->unreg_sem); in mdev_unregister_device()
232 mdev_put_parent(parent); in mdev_unregister_device()
258 struct mdev_parent *parent = type->parent; in mdev_device_create() local
259 struct mdev_driver *drv = parent->ops->device_driver; in mdev_device_create()
278 mdev->dev.parent = parent->dev; in mdev_device_create()
281 mdev->dev.groups = parent->ops->mdev_attr_groups; in mdev_device_create()
295 if (!down_read_trylock(&parent->unreg_sem)) { in mdev_device_create()
300 if (parent->ops->create) { in mdev_device_create()
301 ret = parent->ops->create(mdev); in mdev_device_create()
322 up_read(&parent->unreg_sem); in mdev_device_create()
329 if (parent->ops->remove) in mdev_device_create()
330 parent->ops->remove(mdev); in mdev_device_create()
332 up_read(&parent->unreg_sem); in mdev_device_create()
341 struct mdev_parent *parent = mdev->type->parent; in mdev_device_remove() local
363 if (!down_read_trylock(&parent->unreg_sem)) in mdev_device_remove()
367 up_read(&parent->unreg_sem); in mdev_device_remove()