aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/media-devnode.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/media-devnode.h')
-rw-r--r--include/media/media-devnode.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
index 17ddae32060d..fe42f08e72bd 100644
--- a/include/media/media-devnode.h
+++ b/include/media/media-devnode.h
@@ -40,6 +40,20 @@
40 */ 40 */
41#define MEDIA_FLAG_REGISTERED 0 41#define MEDIA_FLAG_REGISTERED 0
42 42
43/**
44 * struct media_file_operations - Media device file operations
45 *
46 * @owner: should be filled with %THIS_MODULE
47 * @read: pointer to the function that implements read() syscall
48 * @write: pointer to the function that implements write() syscall
49 * @poll: pointer to the function that implements poll() syscall
50 * @ioctl: pointer to the function that implements ioctl() syscall
51 * @compat_ioctl: pointer to the function that will handle 32 bits userspace
52 * calls to the the ioctl() syscall on a Kernel compiled with 64 bits.
53 * @open: pointer to the function that implements open() syscall
54 * @release: pointer to the function that will release the resources allocated
55 * by the @open function.
56 */
43struct media_file_operations { 57struct media_file_operations {
44 struct module *owner; 58 struct module *owner;
45 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 59 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
@@ -53,7 +67,7 @@ struct media_file_operations {
53 67
54/** 68/**
55 * struct media_devnode - Media device node 69 * struct media_devnode - Media device node
56 * @fops: pointer to struct media_file_operations with media device ops 70 * @fops: pointer to struct &media_file_operations with media device ops
57 * @dev: struct device pointer for the media controller device 71 * @dev: struct device pointer for the media controller device
58 * @cdev: struct cdev pointer character device 72 * @cdev: struct cdev pointer character device
59 * @parent: parent device 73 * @parent: parent device
@@ -86,15 +100,53 @@ struct media_devnode {
86/* dev to media_devnode */ 100/* dev to media_devnode */
87#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev) 101#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
88 102
103/**
104 * media_devnode_register - register a media device node
105 *
106 * @mdev: media device node structure we want to register
107 * @owner: should be filled with %THIS_MODULE
108 *
109 * The registration code assigns minor numbers and registers the new device node
110 * with the kernel. An error is returned if no free minor number can be found,
111 * or if the registration of the device node fails.
112 *
113 * Zero is returned on success.
114 *
115 * Note that if the media_devnode_register call fails, the release() callback of
116 * the media_devnode structure is *not* called, so the caller is responsible for
117 * freeing any data.
118 */
89int __must_check media_devnode_register(struct media_devnode *mdev, 119int __must_check media_devnode_register(struct media_devnode *mdev,
90 struct module *owner); 120 struct module *owner);
121
122/**
123 * media_devnode_unregister - unregister a media device node
124 * @mdev: the device node to unregister
125 *
126 * This unregisters the passed device. Future open calls will be met with
127 * errors.
128 *
129 * This function can safely be called if the device node has never been
130 * registered or has already been unregistered.
131 */
91void media_devnode_unregister(struct media_devnode *mdev); 132void media_devnode_unregister(struct media_devnode *mdev);
92 133
134/**
135 * media_devnode_data - returns a pointer to the &media_devnode
136 *
137 * @filp: pointer to struct &file
138 */
93static inline struct media_devnode *media_devnode_data(struct file *filp) 139static inline struct media_devnode *media_devnode_data(struct file *filp)
94{ 140{
95 return filp->private_data; 141 return filp->private_data;
96} 142}
97 143
144/**
145 * media_devnode_is_registered - returns true if &media_devnode is registered;
146 * false otherwise.
147 *
148 * @mdev: pointer to struct &media_devnode.
149 */
98static inline int media_devnode_is_registered(struct media_devnode *mdev) 150static inline int media_devnode_is_registered(struct media_devnode *mdev)
99{ 151{
100 return test_bit(MEDIA_FLAG_REGISTERED, &mdev->flags); 152 return test_bit(MEDIA_FLAG_REGISTERED, &mdev->flags);