From patchwork Wed Mar 2 22:03:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 15400 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 7FD35BE08A for ; Wed, 2 Mar 2022 22:03:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9148F61187; Wed, 2 Mar 2022 23:03:19 +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="WR0utUqO"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 170C76047A for ; Wed, 2 Mar 2022 23:03:17 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id ay10so4903260wrb.6 for ; Wed, 02 Mar 2022 14:03:17 -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=ZZuRb6vJ4xL/T85VnKjF8jjubHhc9DkEkfgVG9uggJ4=; b=WR0utUqOYB7ZuyINcK/dNLS0PEbpJCuBuL4jurQW5+C1ApyrN3YJklICb+1aASRiIL khiDGY62G/cE+1kZBySmNmwLxCey30zqxuLrX2LpqkQaSYQTE544eFatwTJcBlH1gWWF wG8DbfB34kXC+N/y0gYF/4IHjonxbOUTC0uXR+1cgnWM9jhK+uzUb6gHBvTMgWXMGVK1 393a8bkurpawowYeDTMbRUk9sffEty3wF7WamsIMEg6PGNBDTB5DqrQuUfkyfFm5loZf evTQ/uJ+w7mu3MIqAIleu87IURx9z1WpCUy1VHUS3uyy035XNnclUUnoOewulryWoC5w SEgw== 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=ZZuRb6vJ4xL/T85VnKjF8jjubHhc9DkEkfgVG9uggJ4=; b=ObFOYVR81WPyO1Pu3/dLcA+ZXxz+WOZnmgviIKyV8V0mW5b3b3MR9+VZjLo9og52kD KJJvrldipXtI+gea/hskGTVBhZv411vNk3V4Vp2Be2yoOB3TrKkufcztWUr9aVpC0Jb4 RZp6gYzO1dBKgboBBT758R0oJ8m+OVwVQvxzcbnIMKEtRws+xQz0ZV6ZuQP2CLgMJBeM ptAWzhe7h55W9d0a4a7Nby0wOgnDgQVQNrZzsNHWs5hOgxCHIgEI7eOsUabe+YeFQM4h 3Vf+YLacjNStz3/FLrd4Rdpg4yZQ/b4ZWl2oMRdpU/Q+XwGdhZdIyLUhQY+if5uTrSHr NG6w== X-Gm-Message-State: AOAM5306sEnJSNUVvzehlp4UV+PY/9/FNScxJLVYC9k9Wj+7IFhHSxRI pxIzIq9rEFBYAS1IDusqH+LuqcKV52bYXQ== X-Google-Smtp-Source: ABdhPJwyIst7piDstEx9M7MU7dqS8Jcpe10l0k3knw9tQODBYPx5ugkivtEZE6GyRL7cJlO1TgQYRQ== X-Received: by 2002:a05:6000:15c7:b0:1f0:45e0:e40d with SMTP id y7-20020a05600015c700b001f045e0e40dmr2921118wry.343.1646258596840; Wed, 02 Mar 2022 14:03:16 -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 l16-20020a05600c4f1000b0033383cdeea1sm229258wmq.10.2022.03.02.14.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:03:16 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org Date: Wed, 2 Mar 2022 22:03:02 +0000 Message-Id: <20220302220304.1327896-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302220304.1327896-1-djrscally@gmail.com> References: <20220302220304.1327896-1-djrscally@gmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/5] 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 Reviewed-by: Jean-Michel Hautbois --- Changes since v2: - None 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 d0563ee4b28b..1a7d0a4fb9e8 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -44,6 +44,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) { @@ -89,9 +103,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;