Lines Matching refs:devnode
51 struct media_devnode *devnode = to_media_devnode(cd); in media_devnode_release() local
55 clear_bit(devnode->minor, media_devnode_nums); in media_devnode_release()
59 if (devnode->release) in media_devnode_release()
60 devnode->release(devnode); in media_devnode_release()
62 kfree(devnode); in media_devnode_release()
73 struct media_devnode *devnode = media_devnode_data(filp); in media_read() local
75 if (!devnode->fops->read) in media_read()
77 if (!media_devnode_is_registered(devnode)) in media_read()
79 return devnode->fops->read(filp, buf, sz, off); in media_read()
85 struct media_devnode *devnode = media_devnode_data(filp); in media_write() local
87 if (!devnode->fops->write) in media_write()
89 if (!media_devnode_is_registered(devnode)) in media_write()
91 return devnode->fops->write(filp, buf, sz, off); in media_write()
97 struct media_devnode *devnode = media_devnode_data(filp); in media_poll() local
99 if (!media_devnode_is_registered(devnode)) in media_poll()
101 if (!devnode->fops->poll) in media_poll()
103 return devnode->fops->poll(filp, poll); in media_poll()
111 struct media_devnode *devnode = media_devnode_data(filp); in __media_ioctl() local
116 if (!media_devnode_is_registered(devnode)) in __media_ioctl()
124 struct media_devnode *devnode = media_devnode_data(filp); in media_ioctl() local
126 return __media_ioctl(filp, cmd, arg, devnode->fops->ioctl); in media_ioctl()
134 struct media_devnode *devnode = media_devnode_data(filp); in media_compat_ioctl() local
136 return __media_ioctl(filp, cmd, arg, devnode->fops->compat_ioctl); in media_compat_ioctl()
144 struct media_devnode *devnode; in media_open() local
154 devnode = container_of(inode->i_cdev, struct media_devnode, cdev); in media_open()
157 if (!media_devnode_is_registered(devnode)) { in media_open()
162 get_device(&devnode->dev); in media_open()
165 filp->private_data = devnode; in media_open()
167 if (devnode->fops->open) { in media_open()
168 ret = devnode->fops->open(filp); in media_open()
170 put_device(&devnode->dev); in media_open()
182 struct media_devnode *devnode = media_devnode_data(filp); in media_release() local
184 if (devnode->fops->release) in media_release()
185 devnode->fops->release(filp); in media_release()
191 put_device(&devnode->dev); in media_release()
212 struct media_devnode *devnode, in media_devnode_register() argument
224 kfree(devnode); in media_devnode_register()
231 devnode->minor = minor; in media_devnode_register()
232 devnode->media_dev = mdev; in media_devnode_register()
235 devnode->dev.bus = &media_bus_type; in media_devnode_register()
236 devnode->dev.devt = MKDEV(MAJOR(media_dev_t), devnode->minor); in media_devnode_register()
237 devnode->dev.release = media_devnode_release; in media_devnode_register()
238 if (devnode->parent) in media_devnode_register()
239 devnode->dev.parent = devnode->parent; in media_devnode_register()
240 dev_set_name(&devnode->dev, "media%d", devnode->minor); in media_devnode_register()
241 device_initialize(&devnode->dev); in media_devnode_register()
244 cdev_init(&devnode->cdev, &media_devnode_fops); in media_devnode_register()
245 devnode->cdev.owner = owner; in media_devnode_register()
246 kobject_set_name(&devnode->cdev.kobj, "media%d", devnode->minor); in media_devnode_register()
249 ret = cdev_device_add(&devnode->cdev, &devnode->dev); in media_devnode_register()
256 set_bit(MEDIA_FLAG_REGISTERED, &devnode->flags); in media_devnode_register()
262 clear_bit(devnode->minor, media_devnode_nums); in media_devnode_register()
263 devnode->media_dev = NULL; in media_devnode_register()
266 put_device(&devnode->dev); in media_devnode_register()
270 void media_devnode_unregister_prepare(struct media_devnode *devnode) in media_devnode_unregister_prepare() argument
273 if (!media_devnode_is_registered(devnode)) in media_devnode_unregister_prepare()
277 clear_bit(MEDIA_FLAG_REGISTERED, &devnode->flags); in media_devnode_unregister_prepare()
281 void media_devnode_unregister(struct media_devnode *devnode) in media_devnode_unregister() argument
285 cdev_device_del(&devnode->cdev, &devnode->dev); in media_devnode_unregister()
286 devnode->media_dev = NULL; in media_devnode_unregister()
289 put_device(&devnode->dev); in media_devnode_unregister()