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.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 810eef43c21..06b9f9f8201 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -59,7 +59,6 @@
59#include <asm/pgtable.h> 59#include <asm/pgtable.h>
60#include <asm/io.h> 60#include <asm/io.h>
61#include <asm/div64.h> 61#include <asm/div64.h>
62#define __OLD_VIDIOC_ /* To allow fixing old calls*/
63#include <media/v4l2-common.h> 62#include <media/v4l2-common.h>
64#include <media/v4l2-device.h> 63#include <media/v4l2-device.h>
65#include <media/v4l2-ctrls.h> 64#include <media/v4l2-ctrls.h>
@@ -81,69 +80,6 @@ MODULE_LICENSE("GPL");
81 * Video Standard Operations (contributed by Michael Schimek) 80 * Video Standard Operations (contributed by Michael Schimek)
82 */ 81 */
83 82
84
85/* ----------------------------------------------------------------- */
86/* priority handling */
87
88#define V4L2_PRIO_VALID(val) (val == V4L2_PRIORITY_BACKGROUND || \
89 val == V4L2_PRIORITY_INTERACTIVE || \
90 val == V4L2_PRIORITY_RECORD)
91
92void v4l2_prio_init(struct v4l2_prio_state *global)
93{
94 memset(global, 0, sizeof(*global));
95}
96EXPORT_SYMBOL(v4l2_prio_init);
97
98int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
99 enum v4l2_priority new)
100{
101 if (!V4L2_PRIO_VALID(new))
102 return -EINVAL;
103 if (*local == new)
104 return 0;
105
106 atomic_inc(&global->prios[new]);
107 if (V4L2_PRIO_VALID(*local))
108 atomic_dec(&global->prios[*local]);
109 *local = new;
110 return 0;
111}
112EXPORT_SYMBOL(v4l2_prio_change);
113
114void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
115{
116 v4l2_prio_change(global, local, V4L2_PRIORITY_DEFAULT);
117}
118EXPORT_SYMBOL(v4l2_prio_open);
119
120void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local)
121{
122 if (V4L2_PRIO_VALID(local))
123 atomic_dec(&global->prios[local]);
124}
125EXPORT_SYMBOL(v4l2_prio_close);
126
127enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
128{
129 if (atomic_read(&global->prios[V4L2_PRIORITY_RECORD]) > 0)
130 return V4L2_PRIORITY_RECORD;
131 if (atomic_read(&global->prios[V4L2_PRIORITY_INTERACTIVE]) > 0)
132 return V4L2_PRIORITY_INTERACTIVE;
133 if (atomic_read(&global->prios[V4L2_PRIORITY_BACKGROUND]) > 0)
134 return V4L2_PRIORITY_BACKGROUND;
135 return V4L2_PRIORITY_UNSET;
136}
137EXPORT_SYMBOL(v4l2_prio_max);
138
139int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local)
140{
141 return (local < v4l2_prio_max(global)) ? -EBUSY : 0;
142}
143EXPORT_SYMBOL(v4l2_prio_check);
144
145/* ----------------------------------------------------------------- */
146
147/* Helper functions for control handling */ 83/* Helper functions for control handling */
148 84
149/* 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