This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: media-ctl: Move flags printing code to a new print_flags function
Author:  Laurent Pinchart <[email protected]>
Date:    Tue Feb 4 11:22:15 2014 +0100

This will allow reusing the flag printing code for the DV timings flags.

Signed-off-by: Laurent Pinchart <[email protected]>

 utils/media-ctl/media-ctl.c |   43 +++++++++++++++++++++++++++++--------------
 1 files changed, 29 insertions(+), 14 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=a96b77a8b273d6fb444d0aea1eede5998359b78d

diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
index 2686c47..28e602c 100644
--- a/utils/media-ctl/media-ctl.c
+++ b/utils/media-ctl/media-ctl.c
@@ -48,6 +48,33 @@
  * Printing
  */
 
+struct flag_name {
+       __u32 flag;
+       char *name;
+};
+
+static void print_flags(const struct flag_name *flag_names, unsigned int 
num_entries, __u32 flags)
+{
+       bool first = true;
+       unsigned int i;
+
+       for (i = 0; i < num_entries; i++) {
+               if (!(flags & flag_names[i].flag))
+                       continue;
+               if (!first)
+                       printf(",");
+               printf("%s", flag_names[i].name);
+               flags &= ~flag_names[i].flag;
+               first = false;
+       }
+
+       if (flags) {
+               if (!first)
+                       printf(",");
+               printf("0x%x", flags);
+       }
+}
+
 static void v4l2_subdev_print_format(struct media_entity *entity,
        unsigned int pad, enum v4l2_subdev_format_whence which)
 {
@@ -255,10 +282,7 @@ static void media_print_topology_dot(struct media_device 
*media)
 
 static void media_print_topology_text(struct media_device *media)
 {
-       static const struct {
-               __u32 flag;
-               char *name;
-       } link_flags[] = {
+       static const struct flag_name link_flags[] = {
                { MEDIA_LNK_FL_ENABLED, "ENABLED" },
                { MEDIA_LNK_FL_IMMUTABLE, "IMMUTABLE" },
                { MEDIA_LNK_FL_DYNAMIC, "DYNAMIC" },
@@ -299,8 +323,6 @@ static void media_print_topology_text(struct media_device 
*media)
                                const struct media_link *link = 
media_entity_get_link(entity, k);
                                const struct media_pad *source = link->source;
                                const struct media_pad *sink = link->sink;
-                               bool first = true;
-                               unsigned int i;
 
                                if (source->entity == entity && source->index 
== j)
                                        printf("\t\t-> \"%s\":%u [",
@@ -313,14 +335,7 @@ static void media_print_topology_text(struct media_device 
*media)
                                else
                                        continue;
 
-                               for (i = 0; i < ARRAY_SIZE(link_flags); i++) {
-                                       if (!(link->flags & link_flags[i].flag))
-                                               continue;
-                                       if (!first)
-                                               printf(",");
-                                       printf("%s", link_flags[i].name);
-                                       first = false;
-                               }
+                               print_flags(link_flags, ARRAY_SIZE(link_flags), 
link->flags);
 
                                printf("]\n");
                        }

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to