Skip to content

Commit 1657624

Browse files
ribaldahverkuil
authored andcommitted
media: core: export v4l2_translate_cmd
video_translate_cmd() can be useful for drivers to convert between the VIDIOC_*32 and VIDIOC_ defines. Let's export it. Now that the function is exported, use this opportunity to rename the function with the v4l2_ prefix, that is less ambiguous than video_ The VIDIOC_*32 defines are not accessible by the drivers, they live in v4l2-compat-ioctl32.c. Reviewed-by: Hans Verkuil <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent a03e32e commit 1657624

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/media/v4l2-core/v4l2-ioctl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,7 +3249,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
32493249
return ret;
32503250
}
32513251

3252-
static unsigned int video_translate_cmd(unsigned int cmd)
3252+
unsigned int v4l2_translate_cmd(unsigned int cmd)
32533253
{
32543254
#if !defined(CONFIG_64BIT) && defined(CONFIG_COMPAT_32BIT_TIME)
32553255
switch (cmd) {
@@ -3270,6 +3270,7 @@ static unsigned int video_translate_cmd(unsigned int cmd)
32703270

32713271
return cmd;
32723272
}
3273+
EXPORT_SYMBOL_GPL(v4l2_translate_cmd);
32733274

32743275
static int video_get_user(void __user *arg, void *parg,
32753276
unsigned int real_cmd, unsigned int cmd,
@@ -3430,7 +3431,7 @@ video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
34303431
size_t array_size = 0;
34313432
void __user *user_ptr = NULL;
34323433
void **kernel_ptr = NULL;
3433-
unsigned int cmd = video_translate_cmd(orig_cmd);
3434+
unsigned int cmd = v4l2_translate_cmd(orig_cmd);
34343435
const size_t ioc_size = _IOC_SIZE(cmd);
34353436

34363437
/* Copy arguments into temp kernel buffer */

include/media/v4l2-ioctl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
679679
#endif
680680

681681
unsigned int v4l2_compat_translate_cmd(unsigned int cmd);
682+
unsigned int v4l2_translate_cmd(unsigned int cmd);
682683
int v4l2_compat_get_user(void __user *arg, void *parg, unsigned int cmd);
683684
int v4l2_compat_put_user(void __user *arg, void *parg, unsigned int cmd);
684685
int v4l2_compat_get_array_args(struct file *file, void *mbuf,

0 commit comments

Comments
 (0)