v4l2-ctl: move the doioctl_name function up to a more logical place.
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:00:01 +0000 (12:00 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 2 Jul 2011 10:00:01 +0000 (12:00 +0200)
doioctl_name was defined fairly late in the source, limiting where it
could be used. Move it up.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl.cpp

index 44cb153..e6fcd19 100644 (file)
@@ -573,6 +573,24 @@ static inline int test_ioctl(int fd, int cmd, void *arg)
        return options[OptUseWrapper] ? v4l2_ioctl(fd, cmd, arg) : ioctl(fd, cmd, arg);
 }
 
+static int doioctl_name(int fd, unsigned long int request, void *parm, const char *name)
+{
+       int retval = test_ioctl(fd, request, parm);
+
+       if (retval < 0) {
+               app_result = -1;
+       }
+       if (options[OptSilent]) return retval;
+       if (retval < 0)
+               printf("%s: failed: %s\n", name, strerror(errno));
+       else if (verbose)
+               printf("%s: ok\n", name);
+
+       return retval;
+}
+
+#define doioctl(n, r, p) doioctl_name(n, r, p, #r)
+
 static std::string num2s(unsigned num)
 {
        char buf[10];
@@ -1495,24 +1513,6 @@ static v4l2_std_id parse_ntsc(const char *ntsc)
        return 0;
 }
 
-static int doioctl_name(int fd, unsigned long int request, void *parm, const char *name)
-{
-       int retval = test_ioctl(fd, request, parm);
-
-       if (retval < 0) {
-               app_result = -1;
-       }
-       if (options[OptSilent]) return retval;
-       if (retval < 0)
-               printf("%s: failed: %s\n", name, strerror(errno));
-       else if (verbose)
-               printf("%s: ok\n", name);
-
-       return retval;
-}
-
-#define doioctl(n, r, p) doioctl_name(n, r, p, #r)
-
 static bool is_v4l_dev(const char *name)
 {
        return !memcmp(name, "vtx", 3) ||