From patchwork Mon Dec 13 23:28:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15157 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 733ADBF415 for ; Mon, 13 Dec 2021 23:29:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EDBD56089F; Tue, 14 Dec 2021 00:29:09 +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="fpit3Yup"; dkim-atps=neutral Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C1FEE6087E for ; Tue, 14 Dec 2021 00:29:06 +0100 (CET) Received: by mail-wr1-x42f.google.com with SMTP id u1so29549978wru.13 for ; Mon, 13 Dec 2021 15:29:06 -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=MgCtKC+Gd7kApujFsuR5TW5hz/ErAzIhf2rX5Pgmy5o=; b=fpit3YupVLRQCsiBB98paZPY/vws70ChOL/XADsgVF+afDYelu3wOsyXvfZp07Yf7o ndFBw+WRAtNMGJBYbZFUGgwLGzlp4qHkCjIYn04iy9f72bbyrJd/AUrbcGn2TM7XLNyU +cDf7APM95/8gyD9ibCDD59KxHrOJBokmhdBLlGPOOZy576lD2EEOZLKx2RggT01inI6 OsxdBUsGarGkvz9cqyR8hDzHL/ZGYDj+GFjPyEPdjDACCx9tyH8pVdmlI4OUaH4hD2UG NL5vpAuXU613PQv6iRCmiz81P7QZdJMaVrVJCvhxUVJaHeuCC/mNtOHGDFCMrkGJh/mM NIXA== 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=MgCtKC+Gd7kApujFsuR5TW5hz/ErAzIhf2rX5Pgmy5o=; b=LGkp5Ak+59HX5kcIFIdXHknrl56pr7ztEH2gtEyV1ZAxYe5MCrCtzxwxPgpL0tpfYX uH4DdlsmM/AxgHieWIaN8YKLtmww/lROQ+rIqZVsXe7nFipFL8j+754roTFok6dI+qCy uQGHItiX/l1VeNd8Uwj/LBGdlNB2RkVW38Ohvt+qacK2ZTOm8OzS6ecxkq4mxJ+u/dtZ LgyD+wtxwcu2wTEx0H1kKA19PyWCzxwjAXd3kYukSUHq0FgdCFa8wK9YXIkszWHkxn39 bqOr9tUOthTHz3YKvxUJW6sm5kaIpif78lOKlArXmkW6zRmE6CrE8x2MxIwGkjWpdXfK slwg== X-Gm-Message-State: AOAM533jD7r1oHIa/wjyjVlApGTufuleEMkC1dQUF1ymfxYTe2IV6b32 7vp/BfUrfdM5zF8Frc20Gl4= X-Google-Smtp-Source: ABdhPJx3yb6CKioC+of69sRZt9ZhFjNno0BY3/9Z+rr7mxoEowwx35RVewqpHNlQ6z/8uOlnrGS03g== X-Received: by 2002:adf:900f:: with SMTP id h15mr1736128wrh.562.1639438146517; Mon, 13 Dec 2021 15:29:06 -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 38sm12551643wrc.1.2021.12.13.15.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 15:29:05 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org Date: Mon, 13 Dec 2021 23:28:46 +0000 Message-Id: <20211213232849.40071-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213232849.40071-1-djrscally@gmail.com> References: <20211213232849.40071-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/5] media: entity: Add link_type() 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. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart --- 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 f40f41977142..d79eb88bc167 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(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(link), media_id(link->gobj0), media_id(link->gobj1)); break;