From patchwork Mon Dec 6 18:50:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15054 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 3D8B9BDB13 for ; Mon, 6 Dec 2021 18:51:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8274360876; Mon, 6 Dec 2021 19:51:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="luRYv0xB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2545060725 for ; Mon, 6 Dec 2021 19:51:19 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AF4DFEE for ; Mon, 6 Dec 2021 19:51:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1638816678; bh=ZxB/c+DMwpxlaN030e7h6LjymAGiNsO/ipdc51kqLSA=; h=From:To:Subject:Date:From; b=luRYv0xBmmwFcPHHh98rqBfL1jO1w+/RalM1q+BM0Wi4sBQ7dr6Q5C53sR2Mr07k6 LYbZ5XHbNDY/ENmqx/UFpYHtl8HuAkzifNQ1iivx9zo1tf1531HIWvZubsTHUydSr2 nRrq7iKGL4QiCPg8asE7W/xJhZewMb3q/M8dcZm8= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 6 Dec 2021 20:50:47 +0200 Message-Id: <20211206185047.18285-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: media_device: Skip all non-data links during enumeration 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The MediaDevice::populateLinks() function iterates over data links by skipping interface links. This isn't very future-proof, it will break if the kernel adds new types of links. Fix it by only considering data links instead of blacklisting interface links. Signed-off-by: Laurent Pinchart Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- Let's merge this ASAP to avoid bug reports when using an older libcamera version with a kernel that supports the soon-to-be-added ancillary links. --- src/libcamera/media_device.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) base-commit: 294663eece8c067d268442724b969c9dfa081b0a diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 4df0a27fe193..0b7940182d0c 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -695,12 +695,9 @@ bool MediaDevice::populateLinks(const struct media_v2_topology &topology) (topology.ptr_links); for (unsigned int i = 0; i < topology.num_links; ++i) { - /* - * Skip links between entities and interfaces: we only care - * about pad-2-pad links here. - */ - if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) == - MEDIA_LNK_FL_INTERFACE_LINK) + /* We only care about pad-2-pad links here. */ + if ((mediaLinks[i].flags & MEDIA_LNK_FL_LINK_TYPE) != + MEDIA_LNK_FL_DATA_LINK) continue; /* Store references to source and sink pads in the link. */