From patchwork Sun Jan 30 23:58:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15301 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 247D0BDCBF for ; Sun, 30 Jan 2022 23:59:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D2AB4609F2; Mon, 31 Jan 2022 00:59:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mi2/QUg5"; dkim-atps=neutral Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DF81D609DD for ; Mon, 31 Jan 2022 00:59:09 +0100 (CET) Received: by mail-wr1-x42a.google.com with SMTP id s9so22036845wrb.6 for ; Sun, 30 Jan 2022 15:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OPpoJnU/qyg2/VoeGoW1Rn4aPz6S0A9ibACKGoGZN18=; b=mi2/QUg5gWiGvQqVrMJ9tD3a+99R4h/pf625IaJ5ekxUwfe734jVrYfEvS85V7l82X Ki2ZNyC4CmrYAdOhONydYzPPH/nkEbr7yvZfJrBqWfi9EgYKJ2GcPq9S95q4z2TpH8lD +qvFsW2c5zoy52JHyL3IWnmxVzoKFUWDcsL668OxOy5CtbiRNRhgpuHJs4mF0T1BY9y5 xHnb9JAmFP8TSUD9I5LHLfjlsHDhczP1rVnFdq7iqoLZsFcvRnNVAn4+LK82R12OIKjD 7snvR3fzYVdRcjPD2t4m+eNDVf99bHr/EIL0nv77fY903gPOumGeARe1NQp1ZaT0cZ++ n36g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OPpoJnU/qyg2/VoeGoW1Rn4aPz6S0A9ibACKGoGZN18=; b=4sd895W/g4MThcByKKWkQrJXyP3Fc30XitGWnaBE2XnDffmBj1n6XPrePZefKVzRJ1 D+/7MNVM2MtAeRYgYae1kLEzxK7TG+jjy+Sbl0aaCs6zjv0iAg1hYP05xUvMCTfEVgOC D0cSR3lIDA5/41baUXTUJuRILK7txelydSazUF42RRf35excrz9Ygsc8N2EjbY8fM9Nc X0RqTjPGVvOY8mNcr6wH4/iUs1XmYxflskapjT/VZKX+l7NfCcsdJBlemXT8rWBCjD/Z ZiaH4lvlnzqTqDY68C9P2wrzYzaCwkjfYBmcXVjcmQRA45WnwpoLwxzZgUz/+KWTA4Io cRRg== X-Gm-Message-State: AOAM532qp2b8FrIipnpUHlPkdUEsXVkY/bU/5wzukC/XbfO0vmQmcirZ lEHEkJR5qA6uRTgl2qMfvFo= X-Google-Smtp-Source: ABdhPJw/ZKDFFuQpy2pfkYk48xdzvk7TXgvZRkEm9DSG5fVyY1ZAxYR7N9RhYmUdcddXvCxA23DvNg== X-Received: by 2002:a5d:47cf:: with SMTP id o15mr15151828wrc.577.1643587149642; Sun, 30 Jan 2022 15:59:09 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id 11sm11993663wrb.30.2022.01.30.15.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 15:59:09 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org Date: Sun, 30 Jan 2022 23:58:19 +0000 Message-Id: <20220130235821.48076-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130235821.48076-1-djrscally@gmail.com> References: <20220130235821.48076-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/6] media: entity: Add link_type_name() helper X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sakari.ailus@linux.intel.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now we have three types of media link, printing the right name during debug output is slightly more complicated. Add a helper function to make it easier. Reviewed-by: Laurent Pinchart Signed-off-by: Daniel Scally --- Changes since v1: - renamed function to link_type_name() (Laurent) Changes since the rfc: - new patch drivers/media/mc/mc-entity.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 2a6e16fb0048..29d1285c805a 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf) } }; +static inline const char *link_type_name(struct media_link *link) +{ + switch (link->flags & MEDIA_LNK_FL_LINK_TYPE) { + case MEDIA_LNK_FL_DATA_LINK: + return "data"; + case MEDIA_LNK_FL_INTERFACE_LINK: + return "interface"; + case MEDIA_LNK_FL_ANCILLARY_LINK: + return "ancillary"; + default: + return "unknown"; + } +} + __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum, int idx_max) { @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj) dev_dbg(gobj->mdev->dev, "%s id %u: %s link id %u ==> id %u\n", - event_name, media_id(gobj), - media_type(link->gobj0) == MEDIA_GRAPH_PAD ? - "data" : "interface", + event_name, media_id(gobj), link_type_name(link), media_id(link->gobj0), media_id(link->gobj1)); break;