[media] media: Print information on failed link validation
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 28 Oct 2014 23:35:04 +0000 (20:35 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 3 Nov 2014 14:45:58 +0000 (12:45 -0200)
The Media controller doesn't tell much to the user in cases such as pipeline
startup failure. The link validation is the most common media graph (or in
V4L2's case, format) related reason for the failure. In more complex
pipelines the reason may not always be obvious to the user, so point them to
look at the right direction.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/media-entity.c

index 37c334edc7e8c10d3a6430f64a29b1f16088d929..4122d7f42e1058819902253251ae47740de0c040 100644 (file)
@@ -279,8 +279,14 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
                                continue;
 
                        ret = entity->ops->link_validate(link);
-                       if (ret < 0 && ret != -ENOIOCTLCMD)
+                       if (ret < 0 && ret != -ENOIOCTLCMD) {
+                               dev_dbg(entity->parent->dev,
+                                       "link validation failed for \"%s\":%u -> \"%s\":%u, error %d\n",
+                                       entity->name, link->source->index,
+                                       link->sink->entity->name,
+                                       link->sink->index, ret);
                                goto error;
+                       }
                }
 
                /* Either no links or validated links are fine. */
@@ -288,6 +294,10 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
 
                if (!bitmap_full(active, entity->num_pads)) {
                        ret = -EPIPE;
+                       dev_dbg(entity->parent->dev,
+                               "\"%s\":%u must be connected by an enabled link\n",
+                               entity->name,
+                               find_first_zero_bit(active, entity->num_pads));
                        goto error;
                }
        }