aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 940b5db3463e..06b9f9f82013 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -80,69 +80,6 @@ MODULE_LICENSE("GPL");
80 * Video Standard Operations (contributed by Michael Schimek) 80 * Video Standard Operations (contributed by Michael Schimek)
81 */ 81 */
82 82
83
84/* ----------------------------------------------------------------- */
85/* priority handling */
86
87#define V4L2_PRIO_VALID(val) (val == V4L2_PRIORITY_BACKGROUND || \
88 val == V4L2_PRIORITY_INTERACTIVE || \
89 val == V4L2_PRIORITY_RECORD)
90
91void v4l2_prio_init(struct v4l2_prio_state *global)
92{
93 memset(global, 0, sizeof(*global));
94}
95EXPORT_SYMBOL(v4l2_prio_init);
96
97int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
98 enum v4l2_priority new)
99{
100 if (!V4L2_PRIO_VALID(new))
101 return -EINVAL;
102 if (*local == new)
103 return 0;
104
105 atomic_inc(&global->prios[new]);
106 if (V4L2_PRIO_VALID(*local))
107 atomic_dec(&global->prios[*local]);
108 *local = new;
109 return 0;
110}
111EXPORT_SYMBOL(v4l2_prio_change);
112
113void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
114{
115 v4l2_prio_change(global, local, V4L2_PRIORITY_DEFAULT);
116}
117EXPORT_SYMBOL(v4l2_prio_open);
118
119void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local)
120{
121 if (V4L2_PRIO_VALID(local))
122 atomic_dec(&global->prios[local]);
123}
124EXPORT_SYMBOL(v4l2_prio_close);
125
126enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
127{
128 if (atomic_read(&global->prios[V4L2_PRIORITY_RECORD]) > 0)
129 return V4L2_PRIORITY_RECORD;
130 if (atomic_read(&global->prios[V4L2_PRIORITY_INTERACTIVE]) > 0)
131 return V4L2_PRIORITY_INTERACTIVE;
132 if (atomic_read(&global->prios[V4L2_PRIORITY_BACKGROUND]) > 0)
133 return V4L2_PRIORITY_BACKGROUND;
134 return V4L2_PRIORITY_UNSET;
135}
136EXPORT_SYMBOL(v4l2_prio_max);
137
138int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local)
139{
140 return (local < v4l2_prio_max(global)) ? -EBUSY : 0;
141}
142EXPORT_SYMBOL(v4l2_prio_check);
143
144/* ----------------------------------------------------------------- */
145
146/* Helper functions for control handling */ 83/* Helper functions for control handling */
147 84
148/* Check for correctness of the ctrl's value based on the data from 85/* Check for correctness of the ctrl's value based on the data from