Lines Matching refs:parent
35 return mdev->parent->dev; in mdev_parent_dev()
72 struct mdev_parent *parent; in __find_parent_device() local
74 list_for_each_entry(parent, &parent_list, next) { in __find_parent_device()
75 if (parent->dev == dev) in __find_parent_device()
76 return parent; in __find_parent_device()
83 struct mdev_parent *parent = container_of(kref, struct mdev_parent, in mdev_release_parent() local
85 struct device *dev = parent->dev; in mdev_release_parent()
87 kfree(parent); in mdev_release_parent()
92 inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent) in mdev_get_parent() argument
94 if (parent) in mdev_get_parent()
95 kref_get(&parent->ref); in mdev_get_parent()
97 return parent; in mdev_get_parent()
100 static inline void mdev_put_parent(struct mdev_parent *parent) in mdev_put_parent() argument
102 if (parent) in mdev_put_parent()
103 kref_put(&parent->ref, mdev_release_parent); in mdev_put_parent()
109 struct mdev_parent *parent = mdev->parent; in mdev_device_create_ops() local
112 ret = parent->ops->create(kobj, mdev); in mdev_device_create_ops()
117 parent->ops->mdev_attr_groups); in mdev_device_create_ops()
119 parent->ops->remove(mdev); in mdev_device_create_ops()
136 struct mdev_parent *parent = mdev->parent; in mdev_device_remove_ops() local
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()
170 struct mdev_parent *parent; in mdev_register_device() local
183 parent = __find_parent_device(dev); in mdev_register_device()
184 if (parent) { in mdev_register_device()
189 parent = kzalloc(sizeof(*parent), GFP_KERNEL); in mdev_register_device()
190 if (!parent) { in mdev_register_device()
195 kref_init(&parent->ref); in mdev_register_device()
197 parent->dev = dev; in mdev_register_device()
198 parent->ops = ops; in mdev_register_device()
208 ret = parent_create_sysfs_files(parent); in mdev_register_device()
216 list_add(&parent->next, &parent_list); in mdev_register_device()
224 if (parent) in mdev_register_device()
225 mdev_put_parent(parent); in mdev_register_device()
242 struct mdev_parent *parent; in mdev_unregister_device() local
246 parent = __find_parent_device(dev); in mdev_unregister_device()
248 if (!parent) { in mdev_unregister_device()
254 list_del(&parent->next); in mdev_unregister_device()
260 parent_remove_sysfs_files(parent); in mdev_unregister_device()
263 mdev_put_parent(parent); in mdev_unregister_device()
283 struct mdev_parent *parent; in mdev_device_create() local
286 parent = mdev_get_parent(type->parent); in mdev_device_create()
287 if (!parent) in mdev_device_create()
312 mdev->parent = parent; in mdev_device_create()
315 mdev->dev.parent = dev; in mdev_device_create()
345 mdev_put_parent(parent); in mdev_device_create()
352 struct mdev_parent *parent; in mdev_device_remove() local
378 parent = mdev->parent; in mdev_device_remove()
388 mdev_put_parent(parent); in mdev_device_remove()