diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 14:46:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-13 14:46:37 -0500 |
commit | 77a76b04d2be1c45b8fd746b7ef754525029340c (patch) | |
tree | ef5db67c07d538a43d160847acefe80f3c049dba /include/media/media-devnode.h | |
parent | 50ae833e471fe1a1a906a0342bdaa690e69fcc19 (diff) | |
parent | be0270ec89e6b9b49de7e533dd1f3a89ad34d205 (diff) |
Merge tag 'media/v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull second batch of media updates from Mauro Carvalho Chehab:
"This is the second part of the media patches. It contains the media
controller next generation patches, with is the result of one year of
discussions and development. It also contains patches to enable media
controller support at the DVB subsystem.
The goal is to improve the media controller to allow proper support
for other types of Video4Linux devices (radio and TV ones) and to
extend the media controller functionality to allow it to be used by
other subsystems like DVB, ALSA and IIO.
In order to use the new functionality, a new ioctl is needed
(MEDIA_IOC_G_TOPOLOGY). As we're still discussing how to pack the
struct fields of this ioctl in order to avoid compat32 issues, I
decided to add a patch at the end of this series commenting out the
new ioctl, in order to postpone the addition of the new ioctl to the
next Kernel version (4.6).
With that, no userspace visible changes should happen at the media
controller API, as the existing ioctls are untouched. Yet, it helps
DVB, ALSA and IIO developers to develop and test the patches adding
media controller support there, as the core will contain all required
internal changes to allow adding support for devices that belong to
those subsystems"
* tag 'media/v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (177 commits)
[media] Postpone the addition of MEDIA_IOC_G_TOPOLOGY
[media] mxl111sf: Add a tuner entity
[media] dvbdev: create links on devices with multiple frontends
[media] media-entitiy: add a function to create multiple links
[media] dvb-usb-v2: postpone removal of media_device
[media] dvbdev: Add RF connector if needed
[media] dvbdev: remove two dead functions if !CONFIG_MEDIA_CONTROLLER_DVB
[media] call media_device_init() before registering the V4L2 device
[media] uapi/media.h: Use u32 for the number of graph objects
[media] media-entity: don't sleep at media_device_register_entity()
[media] media-entity: increase max number of PADs
[media] media-entity.h: document the remaining functions
[media] media-device.h: use just one u32 counter for object ID
[media] media-entity.h fix documentation for several parameters
[media] DocBook: document media_entity_graph_walk_cleanup()
[media] move documentation to the header files
[media] media: Move MEDIA_ENTITY_MAX_PADS from media-entity.h to media-entity.c
[media] media: Remove pre-allocated entity enumeration bitmap
[media] staging: v4l: davinci_vpbe: Use the new media graph walk interface
[media] staging: v4l: omap4iss: Use the new media graph walk interface
...
Diffstat (limited to 'include/media/media-devnode.h')
-rw-r--r-- | include/media/media-devnode.h | 54 |
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 | */ | ||
43 | struct media_file_operations { | 57 | struct 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 | */ | ||
89 | int __must_check media_devnode_register(struct media_devnode *mdev, | 119 | int __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 | */ | ||
91 | void media_devnode_unregister(struct media_devnode *mdev); | 132 | void 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 | */ | ||
93 | static inline struct media_devnode *media_devnode_data(struct file *filp) | 139 | static 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 | */ | ||
98 | static inline int media_devnode_is_registered(struct media_devnode *mdev) | 150 | static 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); |