Lines Matching refs:devnode
54 int cec_get_device(struct cec_devnode *devnode) in cec_get_device() argument
63 mutex_lock(&devnode->lock); in cec_get_device()
68 if (!devnode->registered) { in cec_get_device()
69 mutex_unlock(&devnode->lock); in cec_get_device()
73 get_device(&devnode->dev); in cec_get_device()
74 mutex_unlock(&devnode->lock); in cec_get_device()
78 void cec_put_device(struct cec_devnode *devnode) in cec_put_device() argument
80 put_device(&devnode->dev); in cec_put_device()
86 struct cec_devnode *devnode = to_cec_devnode(cd); in cec_devnode_release() local
90 clear_bit(devnode->minor, cec_devnode_nums); in cec_devnode_release()
93 cec_delete_adapter(to_cec_adapter(devnode)); in cec_devnode_release()
113 static int __must_check cec_devnode_register(struct cec_devnode *devnode, in cec_devnode_register() argument
131 devnode->minor = minor; in cec_devnode_register()
132 devnode->dev.bus = &cec_bus_type; in cec_devnode_register()
133 devnode->dev.devt = MKDEV(MAJOR(cec_dev_t), minor); in cec_devnode_register()
134 devnode->dev.release = cec_devnode_release; in cec_devnode_register()
135 dev_set_name(&devnode->dev, "cec%d", devnode->minor); in cec_devnode_register()
136 device_initialize(&devnode->dev); in cec_devnode_register()
139 cdev_init(&devnode->cdev, &cec_devnode_fops); in cec_devnode_register()
140 devnode->cdev.owner = owner; in cec_devnode_register()
141 kobject_set_name(&devnode->cdev.kobj, "cec%d", devnode->minor); in cec_devnode_register()
143 devnode->registered = true; in cec_devnode_register()
144 ret = cdev_device_add(&devnode->cdev, &devnode->dev); in cec_devnode_register()
146 devnode->registered = false; in cec_devnode_register()
155 clear_bit(devnode->minor, cec_devnode_nums); in cec_devnode_register()
171 struct cec_devnode *devnode = &adap->devnode; in cec_devnode_unregister() local
174 mutex_lock(&devnode->lock); in cec_devnode_unregister()
177 if (!devnode->registered || devnode->unregistered) { in cec_devnode_unregister()
178 mutex_unlock(&devnode->lock); in cec_devnode_unregister()
181 devnode->registered = false; in cec_devnode_unregister()
182 devnode->unregistered = true; in cec_devnode_unregister()
184 mutex_lock(&devnode->lock_fhs); in cec_devnode_unregister()
185 list_for_each_entry(fh, &devnode->fhs, list) in cec_devnode_unregister()
187 mutex_unlock(&devnode->lock_fhs); in cec_devnode_unregister()
189 mutex_unlock(&devnode->lock); in cec_devnode_unregister()
198 cdev_device_del(&devnode->cdev, &devnode->dev); in cec_devnode_unregister()
199 put_device(&devnode->dev); in cec_devnode_unregister()
290 INIT_LIST_HEAD(&adap->devnode.fhs); in cec_allocate_adapter()
291 mutex_init(&adap->devnode.lock_fhs); in cec_allocate_adapter()
292 mutex_init(&adap->devnode.lock); in cec_allocate_adapter()
347 adap->devnode.dev.parent = parent; in cec_register_adapter()
366 res = cec_devnode_register(&adap->devnode, adap->owner); in cec_register_adapter()
376 dev_set_drvdata(&adap->devnode.dev, adap); in cec_register_adapter()
381 adap->cec_dir = debugfs_create_dir(dev_name(&adap->devnode.dev), in cec_register_adapter()
384 debugfs_create_devm_seqfile(&adap->devnode.dev, "status", adap->cec_dir, in cec_register_adapter()