Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1577605pxf; Fri, 19 Mar 2021 10:12:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyhI+BZ3o8wBonS0FIaXqXXQBSy43+++7ywnMjWdIs1ZjmzX1q4B17meiR3GBuDl2YHj4i X-Received: by 2002:a17:906:3385:: with SMTP id v5mr5499234eja.539.1616173925169; Fri, 19 Mar 2021 10:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616173925; cv=none; d=google.com; s=arc-20160816; b=yKT1N+LRN+XE36v1HEGiHDfDTReVDbLrMUX1+XvgYvgVb36lNvxoAPJRiGIk2j000u 56yXP3jHHQ3SXOKhY/6k6Zdt+DOkEqRagSHO897XAHD3SY5KiCcEjBL6XUpM0dS+AGLn UUuJVeUF8qxaFUpaes4H4x8fGg3jEfWDLf/SbtiiR60x4MlPPZZPMo5dKynUUhq6eHGG ngxhZASY/PYIWtwkcmXdzrIPjS8uJcMwzl58lJpH2U3fvA48fQgNVALT522vrhVo4xyT 8//HgpKLrswz1zvu/9IodNc3vNjWxmQqIvLGyM1up7vkAOzLnRbv91nUUeEmqLz/J5Zc fGjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VEHA0wDh2t06lBti+/CKy5TQQJ8gS0FLl9pl6QcZYKI=; b=HjcSPpiYaj7MnXUDlhKjKQOW6607Mudn5aGXrt5xLgXJW4AGh0nBseJbDdaQ5ubWuV uWaK29VNFjUm+ZkiOrm5iftIYo15bbaa6vqGDuPSo3xWrrmwwj6nKIs/ZfB6rJnRLtDZ geojuuktrNUMjXtwIAZ9WUvd8pHhSnpFi8rEucl5eAWKneU6h7XKJV6tYxCNiKwY31/A Xly/63VaxjbxWxh4hQkRMkQTHHtGQPpPbzNMXKKOneQty1ZjmxUQ++G/MIuHjF+aqQaY og1Wt0LRyaMvJEWenX7weJktGB0FoIR5lErJoGedWZkCI2/9HPqa7GVEG5Yc7f/FMbpv smWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=klWXVuR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu1si4571809edb.213.2021.03.19.10.11.42; Fri, 19 Mar 2021 10:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=klWXVuR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230489AbhCSRJ4 (ORCPT + 99 others); Fri, 19 Mar 2021 13:09:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbhCSRJT (ORCPT ); Fri, 19 Mar 2021 13:09:19 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA50DC06175F for ; Fri, 19 Mar 2021 10:09:18 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id w3so10879227ejc.4 for ; Fri, 19 Mar 2021 10:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VEHA0wDh2t06lBti+/CKy5TQQJ8gS0FLl9pl6QcZYKI=; b=klWXVuR8O1Vy0VInrrZJzfEK7Dyb/ZVFAXvREjrGP2AzreuOcJH6CP8Nkx+kzTOpwF dyoBUbm7rsFHianFatx1CBzC/PQEaYQ/X1z27rjWiEalg7uito9Ll/W8j4DiqnC94z84 +vCjWfO9GTpNFBJ3KGxf2St4zT7hsyuU3NE3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VEHA0wDh2t06lBti+/CKy5TQQJ8gS0FLl9pl6QcZYKI=; b=EQT9KyRuCd31BTvlRQ6eJlNCEU04f6Djj0LrllifgExT8ZJ0sVP+kTXxpufx4juK8F IPLU1gu48eXIYvfvpl/Ght5MO17ImhwPWbhhIgf/KHbwyJdnHyB8E9F4bHiWfCc5iDFz dAMdL5UWwzp9VnlOnxm44Az1hcgrSP9gW5LwTM3m+x7bxr6O+h24qrwV0MFdCHTlSwJn xZqQwYKMgNCVYB9vnuBAZI0WxV3UsJAjJs9Eyk8YuKdpmbSF1LF2RoNn83K6yW6BqyMd eGKmm0WXIKy2AsQ+v8zaKRb57hvEsQUc3nPa2uW374aJalZYbXj5GyYw8lMazbCbY9Ck hBpA== X-Gm-Message-State: AOAM533DdV0uacVe5YTVoGLsx6HO14JJFfZYMe8O2CbilF8bRNcL2X/7 iLIxq1IG1b+thgWKm7vPBOWZ5w== X-Received: by 2002:a17:906:f953:: with SMTP id ld19mr5400744ejb.164.1616173757580; Fri, 19 Mar 2021 10:09:17 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id be27sm4506050edb.47.2021.03.19.10.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 10:09:16 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sergey Senozhatsky , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org Cc: Ricardo Ribalda Subject: [PATCH v8 11/19] media: uvcvideo: Set unique vdev name based in type Date: Fri, 19 Mar 2021 18:08:58 +0100 Message-Id: <20210319170906.278238-12-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210319170906.278238-1-ribalda@chromium.org> References: <20210319170906.278238-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the entities must have a unique name. We can have a descriptive and unique name by appending the function and the entity->id. This is even resilent to multi chain devices. Fixes v4l2-compliance: Media Controller ioctls: fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end() test MEDIA_IOC_G_TOPOLOGY: FAIL fail: v4l2-test-media.cpp(394): num_data_links != num_links test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL Signed-off-by: Ricardo Ribalda Reviewed-by: Hans Verkuil --- drivers/media/usb/uvc/uvc_driver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 35873cf2773d..76ab6acecbc9 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2163,6 +2163,7 @@ int uvc_register_video_device(struct uvc_device *dev, const struct v4l2_ioctl_ops *ioctl_ops) { int ret; + const char *name; /* Initialize the video buffers queue. */ ret = uvc_queue_init(queue, type, !uvc_no_drop_param); @@ -2190,16 +2191,20 @@ int uvc_register_video_device(struct uvc_device *dev, case V4L2_BUF_TYPE_VIDEO_CAPTURE: default: vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; + name = "Video Capture"; break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; + name = "Video Output"; break; case V4L2_BUF_TYPE_META_CAPTURE: vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; + name = "Metadata"; break; } - strscpy(vdev->name, dev->name, sizeof(vdev->name)); + snprintf(vdev->name, sizeof(vdev->name), "%s %u", name, + stream->header.bTerminalLink); /* * Set the driver data before calling video_register_device, otherwise -- 2.31.0.rc2.261.g7f71774620-goog