From patchwork Sat Oct 20 21:04:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1622091 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 379E840135 for ; Sat, 20 Oct 2012 21:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751630Ab2JTVDq (ORCPT ); Sat, 20 Oct 2012 17:03:46 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:56499 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003Ab2JTVDp (ORCPT ); Sat, 20 Oct 2012 17:03:45 -0400 Received: from avalon.ideasonboard.com (unknown [91.178.69.170]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 914F035A8B; Sat, 20 Oct 2012 23:03:44 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: sakari.ailus@iki.fi Subject: [PATCH] v4l: Don't warn during link validation when encountering a V4L2 devnode Date: Sat, 20 Oct 2012 23:04:33 +0200 Message-Id: <1350767073-9478-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org v4l2_subdev_link_validate_get_format() retrieves the remote pad format depending on the entity type and prints a warning if the entity type is not supported. The type check doesn't take the subtype into account, and thus always prints a warning for device node types, even when supported. Fix it. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus --- drivers/media/video/v4l2-subdev.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 9182f81..5f74d96 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c @@ -406,20 +406,20 @@ static int v4l2_subdev_link_validate_get_format(struct media_pad *pad, struct v4l2_subdev_format *fmt) { - switch (media_entity_type(pad->entity)) { - case MEDIA_ENT_T_V4L2_SUBDEV: + if (media_entity_type(pad->entity) == MEDIA_ENT_T_V4L2_SUBDEV) { + struct v4l2_subdev *sd = + media_entity_to_v4l2_subdev(pad->entity); + fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; fmt->pad = pad->index; - return v4l2_subdev_call(media_entity_to_v4l2_subdev( - pad->entity), - pad, get_fmt, NULL, fmt); - default: - WARN(1, "Driver bug! Wrong media entity type %d, entity %s\n", - media_entity_type(pad->entity), pad->entity->name); - /* Fall through */ - case MEDIA_ENT_T_DEVNODE_V4L: - return -EINVAL; + return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); } + + WARN(pad->entity->type != MEDIA_ENT_T_DEVNODE_V4L, + "Driver bug! Wrong media entity type 0x%08x, entity %s\n", + pad->entity->type, pad->entity->name); + + return -EINVAL; } int v4l2_subdev_link_validate(struct media_link *link)