linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] v4l2-ctl: Fix test_ioctl cmd type
@ 2020-06-11  2:34 Paul Elder
  2020-06-19  8:27 ` Paul Elder
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Elder @ 2020-06-11  2:34 UTC (permalink / raw)
  To: linux-media; +Cc: Paul Elder, hverkuil, laurent.pinchart

test_ioctl uses int for the ioctl cmd, while it should be unsigned long.
Fix this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
---
 utils/v4l2-ctl/v4l2-ctl.cpp | 2 +-
 utils/v4l2-ctl/v4l2-ctl.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index e7b270cd..4972591e 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -306,7 +306,7 @@ static void usage_all()
        edid_usage();
 }
 
-int test_ioctl(int fd, int cmd, void *arg)
+int test_ioctl(int fd, unsigned long cmd, void *arg)
 {
 	return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
 }
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index b31be7f5..28e50471 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -300,7 +300,7 @@ typedef struct {
 
 // v4l2-ctl.cpp
 int doioctl_name(int fd, unsigned long int request, void *parm, const char *name);
-int test_ioctl(int fd, int cmd, void *arg);
+int test_ioctl(int fd, unsigned long cmd, void *arg);
 int parse_subopt(char **subs, const char * const *subopts, char **value);
 __u32 parse_field(const char *s);
 __u32 parse_colorspace(const char *s);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] v4l2-ctl: Fix test_ioctl cmd type
  2020-06-11  2:34 [PATCH] v4l2-ctl: Fix test_ioctl cmd type Paul Elder
@ 2020-06-19  8:27 ` Paul Elder
  2020-06-19 10:13   ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Elder @ 2020-06-19  8:27 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, laurent.pinchart

ping

On Thu, Jun 11, 2020 at 11:34:14AM +0900, Paul Elder wrote:
> test_ioctl uses int for the ioctl cmd, while it should be unsigned long.
> Fix this.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  utils/v4l2-ctl/v4l2-ctl.cpp | 2 +-
>  utils/v4l2-ctl/v4l2-ctl.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
> index e7b270cd..4972591e 100644
> --- a/utils/v4l2-ctl/v4l2-ctl.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl.cpp
> @@ -306,7 +306,7 @@ static void usage_all()
>         edid_usage();
>  }
>  
> -int test_ioctl(int fd, int cmd, void *arg)
> +int test_ioctl(int fd, unsigned long cmd, void *arg)
>  {
>  	return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
>  }
> diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
> index b31be7f5..28e50471 100644
> --- a/utils/v4l2-ctl/v4l2-ctl.h
> +++ b/utils/v4l2-ctl/v4l2-ctl.h
> @@ -300,7 +300,7 @@ typedef struct {
>  
>  // v4l2-ctl.cpp
>  int doioctl_name(int fd, unsigned long int request, void *parm, const char *name);
> -int test_ioctl(int fd, int cmd, void *arg);
> +int test_ioctl(int fd, unsigned long cmd, void *arg);
>  int parse_subopt(char **subs, const char * const *subopts, char **value);
>  __u32 parse_field(const char *s);
>  __u32 parse_colorspace(const char *s);
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] v4l2-ctl: Fix test_ioctl cmd type
  2020-06-19  8:27 ` Paul Elder
@ 2020-06-19 10:13   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2020-06-19 10:13 UTC (permalink / raw)
  To: Paul Elder; +Cc: linux-media, hverkuil

Hi Paul,

Thank you for the patch.

On Fri, Jun 19, 2020 at 05:27:58PM +0900, Paul Elder wrote:
> ping
> 
> On Thu, Jun 11, 2020 at 11:34:14AM +0900, Paul Elder wrote:
> > test_ioctl uses int for the ioctl cmd, while it should be unsigned long.
> > Fix this.

This matches the libc ioctl() prototype and the ioctl values (the _IOC
macro produces, if I'm not mistaken, an unsigned type) and should help
avoiding sign extension issues.

> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> > ---
> >  utils/v4l2-ctl/v4l2-ctl.cpp | 2 +-
> >  utils/v4l2-ctl/v4l2-ctl.h   | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
> > index e7b270cd..4972591e 100644
> > --- a/utils/v4l2-ctl/v4l2-ctl.cpp
> > +++ b/utils/v4l2-ctl/v4l2-ctl.cpp
> > @@ -306,7 +306,7 @@ static void usage_all()
> >         edid_usage();
> >  }
> >  
> > -int test_ioctl(int fd, int cmd, void *arg)
> > +int test_ioctl(int fd, unsigned long cmd, void *arg)
> >  {
> >  	return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
> >  }
> > diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
> > index b31be7f5..28e50471 100644
> > --- a/utils/v4l2-ctl/v4l2-ctl.h
> > +++ b/utils/v4l2-ctl/v4l2-ctl.h
> > @@ -300,7 +300,7 @@ typedef struct {
> >  
> >  // v4l2-ctl.cpp
> >  int doioctl_name(int fd, unsigned long int request, void *parm, const char *name);
> > -int test_ioctl(int fd, int cmd, void *arg);
> > +int test_ioctl(int fd, unsigned long cmd, void *arg);
> >  int parse_subopt(char **subs, const char * const *subopts, char **value);
> >  __u32 parse_field(const char *s);
> >  __u32 parse_colorspace(const char *s);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-19 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  2:34 [PATCH] v4l2-ctl: Fix test_ioctl cmd type Paul Elder
2020-06-19  8:27 ` Paul Elder
2020-06-19 10:13   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).