From: Ricardo Ribalda Delgado Date: Mon, 7 Oct 2019 15:06:35 +0000 (-0300) Subject: media: v4l2-ctrl: Add new helper v4l2_ctrl_ptr_create X-Git-Tag: v5.10.7~3807^2^2~221 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e8db63e1f64b6085cc84a03484213af565c81fb;p=platform%2Fkernel%2Flinux-rpi.git media: v4l2-ctrl: Add new helper v4l2_ctrl_ptr_create This helper function simplifies the code by not needing a union v4l2_ctrl_ptr and an assignment every time we need to use a ctrl_ptr. Suggested-by: Hans Verkuil Signed-off-by: Ricardo Ribalda Delgado Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index c9ca867..26205ba 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -74,6 +74,18 @@ union v4l2_ctrl_ptr { }; /** + * v4l2_ctrl_ptr_create() - Helper function to return a v4l2_ctrl_ptr from a + * void pointer + * @ptr: The void pointer + */ +static inline union v4l2_ctrl_ptr v4l2_ctrl_ptr_create(void *ptr) +{ + union v4l2_ctrl_ptr p = { .p = ptr }; + + return p; +} + +/** * struct v4l2_ctrl_ops - The control operations that the driver has to provide. * * @g_volatile_ctrl: Get a new value for this control. Generally only relevant