* how can I get compat_ioctl support for v4l2_subdev_fops
@ 2014-01-15 6:28 Jianle Wang
2014-01-15 7:39 ` Hans Verkuil
0 siblings, 1 reply; 6+ messages in thread
From: Jianle Wang @ 2014-01-15 6:28 UTC (permalink / raw)
To: linux-media
Hi all, :
I use the media-ctl from http://git.ideasonboard.org/media-ctl.git
It is compiled into a 32 bit application. Run on a 64 bit CPU. The
version of kernel is 3.10.
When call ioctl(, VIDIOC_SUBDEV_S_SELECTION,), meet the below warning:
[ 97.186338] c0 707 (drv_test) compat_ioctl32: unknown ioctl 'V',
dir=3, #62 (0xc040563e)
[ 97.203252] c0 707 (drv_test) WARNING: no compat_ioctl for v4l-subdev1
VIDIOC_SUBDEV_S_SELECTION is not supported for compat_iocl. And I list
others subdev’s ioctl, which are also not included
in v4l2_compat_iocl32().
How can I get these compat_ioctl?
Have they been added in v4l2_compat_iocl32() or We have added a
compat_ioctl32 in v4l2_subdev_fops?
VIDIOC_SUBDEV_G_FMT
VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_CROP
VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_G_FRAME_INTERVAL
VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION
VIDIOC_SUBDEV_S_SELECTION
default
v4l2_subdev_call(sd, core, ioctl, cmd, arg);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how can I get compat_ioctl support for v4l2_subdev_fops
2014-01-15 6:28 how can I get compat_ioctl support for v4l2_subdev_fops Jianle Wang
@ 2014-01-15 7:39 ` Hans Verkuil
2014-01-15 8:02 ` Jianle Wang
0 siblings, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2014-01-15 7:39 UTC (permalink / raw)
To: Jianle Wang; +Cc: linux-media, Laurent Pinchart
Hi Jianle,
On 01/15/2014 07:28 AM, Jianle Wang wrote:
> Hi all, :
> I use the media-ctl from http://git.ideasonboard.org/media-ctl.git
> It is compiled into a 32 bit application. Run on a 64 bit CPU. The
> version of kernel is 3.10.
>
> When call ioctl(, VIDIOC_SUBDEV_S_SELECTION,), meet the below warning:
> [ 97.186338] c0 707 (drv_test) compat_ioctl32: unknown ioctl 'V',
> dir=3, #62 (0xc040563e)
> [ 97.203252] c0 707 (drv_test) WARNING: no compat_ioctl for v4l-subdev1
>
> VIDIOC_SUBDEV_S_SELECTION is not supported for compat_iocl. And I list
> others subdev’s ioctl, which are also not included
>
> in v4l2_compat_iocl32().
> How can I get these compat_ioctl?
> Have they been added in v4l2_compat_iocl32() or We have added a
> compat_ioctl32 in v4l2_subdev_fops?
It's a bug, I'm afraid. A lot of the SUBDEV ioctls are missing in v4l2_compat_ioctl32.
Try the patch below, that should fix it.
Regards,
Hans
>
> VIDIOC_SUBDEV_G_FMT
> VIDIOC_SUBDEV_S_FMT
> VIDIOC_SUBDEV_G_CROP
> VIDIOC_SUBDEV_S_CROP
> VIDIOC_SUBDEV_ENUM_MBUS_CODE
> VIDIOC_SUBDEV_ENUM_FRAME_SIZE
> VIDIOC_SUBDEV_G_FRAME_INTERVAL
> VIDIOC_SUBDEV_S_FRAME_INTERVAL
> VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
> VIDIOC_SUBDEV_G_SELECTION
> VIDIOC_SUBDEV_S_SELECTION
> default
> v4l2_subdev_call(sd, core, ioctl, cmd, arg);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..15d3586 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -1007,6 +1007,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
return ret;
switch (cmd) {
+ /* V4L2 ioctls */
case VIDIOC_QUERYCAP:
case VIDIOC_RESERVED:
case VIDIOC_ENUM_FMT:
@@ -1087,8 +1088,21 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOC_QUERY_DV_TIMINGS:
case VIDIOC_DV_TIMINGS_CAP:
case VIDIOC_ENUM_FREQ_BANDS:
+
+ /* V4L2 subdev ioctls */
case VIDIOC_SUBDEV_G_EDID32:
case VIDIOC_SUBDEV_S_EDID32:
+ case VIDIOC_SUBDEV_G_FMT:
+ case VIDIOC_SUBDEV_S_FMT:
+ case VIDIOC_SUBDEV_G_FRAME_INTERVAL:
+ case VIDIOC_SUBDEV_S_FRAME_INTERVAL:
+ case VIDIOC_SUBDEV_ENUM_MBUS_CODE:
+ case VIDIOC_SUBDEV_ENUM_FRAME_SIZE:
+ case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
+ case VIDIOC_SUBDEV_G_CROP:
+ case VIDIOC_SUBDEV_S_CROP:
+ case VIDIOC_SUBDEV_G_SELECTION:
+ case VIDIOC_SUBDEV_S_SELECTION:
ret = do_video_ioctl(file, cmd, arg);
break;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: how can I get compat_ioctl support for v4l2_subdev_fops
2014-01-15 7:39 ` Hans Verkuil
@ 2014-01-15 8:02 ` Jianle Wang
2014-01-15 9:40 ` Hans Verkuil
0 siblings, 1 reply; 6+ messages in thread
From: Jianle Wang @ 2014-01-15 8:02 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Laurent Pinchart
Hi Hans:
Thanks for your patch.
How do we handle the private ioctl defined in struct v4l2_subdev_core.ioctl?
These ioctls are also not supported for compat_ioctl.
2014/1/15 Hans Verkuil <hverkuil@xs4all.nl>:
> Hi Jianle,
>
> On 01/15/2014 07:28 AM, Jianle Wang wrote:
>> Hi all, :
>> I use the media-ctl from http://git.ideasonboard.org/media-ctl.git
>> It is compiled into a 32 bit application. Run on a 64 bit CPU. The
>> version of kernel is 3.10.
>>
>> When call ioctl(, VIDIOC_SUBDEV_S_SELECTION,), meet the below warning:
>> [ 97.186338] c0 707 (drv_test) compat_ioctl32: unknown ioctl 'V',
>> dir=3, #62 (0xc040563e)
>> [ 97.203252] c0 707 (drv_test) WARNING: no compat_ioctl for v4l-subdev1
>>
>> VIDIOC_SUBDEV_S_SELECTION is not supported for compat_iocl. And I list
>> others subdev’s ioctl, which are also not included
>>
>> in v4l2_compat_iocl32().
>> How can I get these compat_ioctl?
>> Have they been added in v4l2_compat_iocl32() or We have added a
>> compat_ioctl32 in v4l2_subdev_fops?
>
> It's a bug, I'm afraid. A lot of the SUBDEV ioctls are missing in v4l2_compat_ioctl32.
> Try the patch below, that should fix it.
>
> Regards,
>
> Hans
>
>>
>> VIDIOC_SUBDEV_G_FMT
>> VIDIOC_SUBDEV_S_FMT
>> VIDIOC_SUBDEV_G_CROP
>> VIDIOC_SUBDEV_S_CROP
>> VIDIOC_SUBDEV_ENUM_MBUS_CODE
>> VIDIOC_SUBDEV_ENUM_FRAME_SIZE
>> VIDIOC_SUBDEV_G_FRAME_INTERVAL
>> VIDIOC_SUBDEV_S_FRAME_INTERVAL
>> VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
>> VIDIOC_SUBDEV_G_SELECTION
>> VIDIOC_SUBDEV_S_SELECTION
>> default
>> v4l2_subdev_call(sd, core, ioctl, cmd, arg);
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>
> diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> index 8f7a6a4..15d3586 100644
> --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> @@ -1007,6 +1007,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
> return ret;
>
> switch (cmd) {
> + /* V4L2 ioctls */
> case VIDIOC_QUERYCAP:
> case VIDIOC_RESERVED:
> case VIDIOC_ENUM_FMT:
> @@ -1087,8 +1088,21 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
> case VIDIOC_QUERY_DV_TIMINGS:
> case VIDIOC_DV_TIMINGS_CAP:
> case VIDIOC_ENUM_FREQ_BANDS:
> +
> + /* V4L2 subdev ioctls */
> case VIDIOC_SUBDEV_G_EDID32:
> case VIDIOC_SUBDEV_S_EDID32:
> + case VIDIOC_SUBDEV_G_FMT:
> + case VIDIOC_SUBDEV_S_FMT:
> + case VIDIOC_SUBDEV_G_FRAME_INTERVAL:
> + case VIDIOC_SUBDEV_S_FRAME_INTERVAL:
> + case VIDIOC_SUBDEV_ENUM_MBUS_CODE:
> + case VIDIOC_SUBDEV_ENUM_FRAME_SIZE:
> + case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
> + case VIDIOC_SUBDEV_G_CROP:
> + case VIDIOC_SUBDEV_S_CROP:
> + case VIDIOC_SUBDEV_G_SELECTION:
> + case VIDIOC_SUBDEV_S_SELECTION:
> ret = do_video_ioctl(file, cmd, arg);
> break;
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how can I get compat_ioctl support for v4l2_subdev_fops
2014-01-15 8:02 ` Jianle Wang
@ 2014-01-15 9:40 ` Hans Verkuil
2014-01-15 11:36 ` Jianle Wang
0 siblings, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2014-01-15 9:40 UTC (permalink / raw)
To: Jianle Wang; +Cc: linux-media, Laurent Pinchart
On 01/15/14 09:02, Jianle Wang wrote:
> Hi Hans:
> Thanks for your patch.
> How do we handle the private ioctl defined in struct v4l2_subdev_core.ioctl?
> These ioctls are also not supported for compat_ioctl.
There is currently no support for that, but try the patch below. That should
allow you to add compat_ioctl32 support for your custom ioctls.
Regards,
Hans
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 996c248..60d2550 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -368,6 +368,17 @@ static long subdev_ioctl(struct file *file, unsigned int cmd,
return video_usercopy(file, cmd, arg, subdev_do_ioctl);
}
+#ifdef CONFIG_COMPAT
+static long subdev_compat_ioctl32(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ struct video_device *vdev = video_devdata(file);
+ struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+
+ return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg);
+}
+#endif
+
static unsigned int subdev_poll(struct file *file, poll_table *wait)
{
struct video_device *vdev = video_devdata(file);
@@ -389,6 +400,9 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
.owner = THIS_MODULE,
.open = subdev_open,
.unlocked_ioctl = subdev_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl32 = subdev_compat_ioctl32,
+#endif
.release = subdev_close,
.poll = subdev_poll,
};
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d67210a..3fd91a5 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -162,6 +162,9 @@ struct v4l2_subdev_core_ops {
int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
+#ifdef CONFIG_COMPAT
+ long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
+#endif
#ifdef CONFIG_VIDEO_ADV_DEBUG
int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: how can I get compat_ioctl support for v4l2_subdev_fops
2014-01-15 9:40 ` Hans Verkuil
@ 2014-01-15 11:36 ` Jianle Wang
2014-01-15 11:43 ` Hans Verkuil
0 siblings, 1 reply; 6+ messages in thread
From: Jianle Wang @ 2014-01-15 11:36 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Laurent Pinchart
Hi Hans:
Thanks for your help. It can work at my side.
BTW: There is a warning during compiling
drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_compat_ioctl32':
drivers/media/v4l2-core/v4l2-subdev.c:379:2: warning: passing argument
3 of 'sd->ops->core->compat_ioctl32' makes pointer from integer
without a cast [enabled by default]
drivers/media/v4l2-core/v4l2-subdev.c:379:2: note: expected 'void *'
but argument is of type 'long unsigned int'
2014/1/15 Hans Verkuil <hverkuil@xs4all.nl>:
> On 01/15/14 09:02, Jianle Wang wrote:
>> Hi Hans:
>> Thanks for your patch.
>> How do we handle the private ioctl defined in struct v4l2_subdev_core.ioctl?
>> These ioctls are also not supported for compat_ioctl.
>
> There is currently no support for that, but try the patch below. That should
> allow you to add compat_ioctl32 support for your custom ioctls.
>
> Regards,
>
> Hans
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 996c248..60d2550 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -368,6 +368,17 @@ static long subdev_ioctl(struct file *file, unsigned int cmd,
> return video_usercopy(file, cmd, arg, subdev_do_ioctl);
> }
>
> +#ifdef CONFIG_COMPAT
> +static long subdev_compat_ioctl32(struct file *file, unsigned int cmd,
> + unsigned long arg)
> +{
> + struct video_device *vdev = video_devdata(file);
> + struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
> +
> + return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg);
> +}
> +#endif
> +
> static unsigned int subdev_poll(struct file *file, poll_table *wait)
> {
> struct video_device *vdev = video_devdata(file);
> @@ -389,6 +400,9 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
> .owner = THIS_MODULE,
> .open = subdev_open,
> .unlocked_ioctl = subdev_ioctl,
> +#ifdef CONFIG_COMPAT
> + .compat_ioctl32 = subdev_compat_ioctl32,
> +#endif
> .release = subdev_close,
> .poll = subdev_poll,
> };
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index d67210a..3fd91a5 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -162,6 +162,9 @@ struct v4l2_subdev_core_ops {
> int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
> int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
> long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
> +#ifdef CONFIG_COMPAT
> + long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
> +#endif
> #ifdef CONFIG_VIDEO_ADV_DEBUG
> int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
> int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how can I get compat_ioctl support for v4l2_subdev_fops
2014-01-15 11:36 ` Jianle Wang
@ 2014-01-15 11:43 ` Hans Verkuil
0 siblings, 0 replies; 6+ messages in thread
From: Hans Verkuil @ 2014-01-15 11:43 UTC (permalink / raw)
To: Jianle Wang; +Cc: linux-media, Laurent Pinchart
On 01/15/14 12:36, Jianle Wang wrote:
> Hi Hans:
> Thanks for your help. It can work at my side.
>
> BTW: There is a warning during compiling
> drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_compat_ioctl32':
> drivers/media/v4l2-core/v4l2-subdev.c:379:2: warning: passing argument
> 3 of 'sd->ops->core->compat_ioctl32' makes pointer from integer
> without a cast [enabled by default]
> drivers/media/v4l2-core/v4l2-subdev.c:379:2: note: expected 'void *'
> but argument is of type 'long unsigned int'
Just replace this:
return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg);
by:
return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, (void *)arg);
Alternatively, change the type of arg to unsigned long in v4l2-subdev.h.
I'm not sure what is easier.
Regards,
Hans
>
> 2014/1/15 Hans Verkuil <hverkuil@xs4all.nl>:
>> On 01/15/14 09:02, Jianle Wang wrote:
>>> Hi Hans:
>>> Thanks for your patch.
>>> How do we handle the private ioctl defined in struct v4l2_subdev_core.ioctl?
>>> These ioctls are also not supported for compat_ioctl.
>>
>> There is currently no support for that, but try the patch below. That should
>> allow you to add compat_ioctl32 support for your custom ioctls.
>>
>> Regards,
>>
>> Hans
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
>> index 996c248..60d2550 100644
>> --- a/drivers/media/v4l2-core/v4l2-subdev.c
>> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
>> @@ -368,6 +368,17 @@ static long subdev_ioctl(struct file *file, unsigned int cmd,
>> return video_usercopy(file, cmd, arg, subdev_do_ioctl);
>> }
>>
>> +#ifdef CONFIG_COMPAT
>> +static long subdev_compat_ioctl32(struct file *file, unsigned int cmd,
>> + unsigned long arg)
>> +{
>> + struct video_device *vdev = video_devdata(file);
>> + struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
>> +
>> + return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg);
>> +}
>> +#endif
>> +
>> static unsigned int subdev_poll(struct file *file, poll_table *wait)
>> {
>> struct video_device *vdev = video_devdata(file);
>> @@ -389,6 +400,9 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
>> .owner = THIS_MODULE,
>> .open = subdev_open,
>> .unlocked_ioctl = subdev_ioctl,
>> +#ifdef CONFIG_COMPAT
>> + .compat_ioctl32 = subdev_compat_ioctl32,
>> +#endif
>> .release = subdev_close,
>> .poll = subdev_poll,
>> };
>> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
>> index d67210a..3fd91a5 100644
>> --- a/include/media/v4l2-subdev.h
>> +++ b/include/media/v4l2-subdev.h
>> @@ -162,6 +162,9 @@ struct v4l2_subdev_core_ops {
>> int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
>> int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
>> long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
>> +#ifdef CONFIG_COMPAT
>> + long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
>> +#endif
>> #ifdef CONFIG_VIDEO_ADV_DEBUG
>> int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
>> int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-01-15 11:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15 6:28 how can I get compat_ioctl support for v4l2_subdev_fops Jianle Wang
2014-01-15 7:39 ` Hans Verkuil
2014-01-15 8:02 ` Jianle Wang
2014-01-15 9:40 ` Hans Verkuil
2014-01-15 11:36 ` Jianle Wang
2014-01-15 11:43 ` Hans Verkuil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.