diff options
Diffstat (limited to 'include/media/v4l2-ctrls.h')
-rw-r--r-- | include/media/v4l2-ctrls.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index f00d42bc01a6..7343a27fe819 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -259,7 +259,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | |||
259 | s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); | 259 | s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); |
260 | 260 | ||
261 | 261 | ||
262 | /** v4l2_ctrl_handler_init() - Initialize the control handler. | 262 | /** v4l2_ctrl_handler_init_class() - Initialize the control handler. |
263 | * @hdl: The control handler. | 263 | * @hdl: The control handler. |
264 | * @nr_of_controls_hint: A hint of how many controls this handler is | 264 | * @nr_of_controls_hint: A hint of how many controls this handler is |
265 | * expected to refer to. This is the total number, so including | 265 | * expected to refer to. This is the total number, so including |
@@ -268,12 +268,35 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | |||
268 | * are allocated) or the control lookup becomes slower (not enough | 268 | * are allocated) or the control lookup becomes slower (not enough |
269 | * buckets are allocated, so there are more slow list lookups). | 269 | * buckets are allocated, so there are more slow list lookups). |
270 | * It will always work, though. | 270 | * It will always work, though. |
271 | * @key: Used by the lock validator if CONFIG_LOCKDEP is set. | ||
272 | * @name: Used by the lock validator if CONFIG_LOCKDEP is set. | ||
271 | * | 273 | * |
272 | * Returns an error if the buckets could not be allocated. This error will | 274 | * Returns an error if the buckets could not be allocated. This error will |
273 | * also be stored in @hdl->error. | 275 | * also be stored in @hdl->error. |
276 | * | ||
277 | * Never use this call directly, always use the v4l2_ctrl_handler_init | ||
278 | * macro that hides the @key and @name arguments. | ||
274 | */ | 279 | */ |
275 | int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, | 280 | int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, |
276 | unsigned nr_of_controls_hint); | 281 | unsigned nr_of_controls_hint, |
282 | struct lock_class_key *key, const char *name); | ||
283 | |||
284 | #ifdef CONFIG_LOCKDEP | ||
285 | #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \ | ||
286 | ( \ | ||
287 | ({ \ | ||
288 | static struct lock_class_key _key; \ | ||
289 | v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, \ | ||
290 | &_key, \ | ||
291 | KBUILD_BASENAME ":" \ | ||
292 | __stringify(__LINE__) ":" \ | ||
293 | "(" #hdl ")->_lock"); \ | ||
294 | }) \ | ||
295 | ) | ||
296 | #else | ||
297 | #define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint) \ | ||
298 | v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL) | ||
299 | #endif | ||
277 | 300 | ||
278 | /** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free | 301 | /** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free |
279 | * the control list. | 302 | * the control list. |