Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4464811pxf; Tue, 16 Mar 2021 14:20:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6ZMSVfb55XK7VPL1aa1GHKkliWLKazsdBlaT4ZZsIblq0uhGTutHsIfplSXZGq/JEsFTr X-Received: by 2002:a17:906:25c4:: with SMTP id n4mr32245636ejb.359.1615929641258; Tue, 16 Mar 2021 14:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929641; cv=none; d=google.com; s=arc-20160816; b=e2OLe4idQiQRFvkyelIT9leqSOmdETaz0I9/eHl4EVDw946U/Wgv7f8PEqiXTrgd4O F0DObNTBfVgQvex7KCW9PDgSfim5kHyOSzBEfXA+e7fXOnMmVD2Ej8jcyPsoTMvY+kPw BknYHg+b0pw7Cb28MUA2uGDJkhkCFxXQS+6VRWGdvR6XKYHneSsolALhhTy5p5o1E+za 8yp71S+hGo3jnpVQkwP3AiPEi5YIKoZ2R92PaE38rOC4JH4inj3yTEz0dQxI4AGk65EQ 1sEtOC1pHWAkdLCYOiYKDFgeBw6U+81FvbIXxeE8aTQzLQxbO3w0W/vdSHpVuMULKU7g oTqw== 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=CMtIaK2o/sCkDiI74hLlYP8qtnxqeuh2FZmFgGR3X7XJDh3puhr8JuNURJDy5zQdcB OwtUFRjHKHVxE0jZ9BhPiXHhlM3ZUZtU7MOUUJrRtD1hdXDOza73p/jyiSJaBdzU+9q8 tR3UMI+fQ3rVGbni2ZyDWp8qu1qf7dF13kiJP5aIQx7ZgsxtNVxrhZ4d1/TICXKVh/2o TB8i8qbCqX0u0JDtgo7WtcOVFIkBKlM2srPPuwZxN+DwP5XDBsU8uqL1suxKzoz+d+Lh /nGjj7lzoHye/RaQO87C3D0VPQEid2/o3kx+6tbcKGdPrLV31wg2j/712aJbamrpBv7g BM+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GSCUdaKK; 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 ks7si14623416ejb.682.2021.03.16.14.20.18; Tue, 16 Mar 2021 14:20:41 -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=GSCUdaKK; 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 S231752AbhCPSD1 (ORCPT + 99 others); Tue, 16 Mar 2021 14:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239592AbhCPSAb (ORCPT ); Tue, 16 Mar 2021 14:00:31 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3DAC0613E7 for ; Tue, 16 Mar 2021 11:00:18 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id mm21so73615480ejb.12 for ; Tue, 16 Mar 2021 11:00: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=GSCUdaKKddn0P+JUnfqgXAmGvZnbOBtsQGdNms0pyNeLiuPWUKslqIlvheKIMmoDjv GFtfr1R7h9339Q9RKI03TiFHnVAL6GxzQ+YBOewBSC5KCzHMywU92h5dX3LDUJDfcW4J uH5IcXjDaXgLZUgL8VpPIn5Q2v+9zWYGpckGw= 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=WwCRwqdvrG8WNvExgCIDph3QBqDpGFRJnw3oJnIj7wMbK8GA08whA4AIc9njSZM2LQ kqtzRf+5af7+SnVdB46iUfagyOUilXk5hSmFAWI026BNm2s60fPnJn59eZe2H4wrDvum CbLDxId+HXhGTk4Y3nvDqkA3XW8ZWq2ym+UT/O3DNmtkMTk5XIWUjqrpAXxfFwOuyEYE Xx/t1W18EIRUkIbRmB3ZksJgs7BPETongofe5nqmlL3cCqTH9haKRvYfliXPaqnHcSxi L4ha42UY1ycZrWKTIpoG6xSoxRgeSxFUJoVwyNgtEcXUambesjrnmtrlfUdj6bdnvfBS OyhA== X-Gm-Message-State: AOAM530ewzKNpPURwfpR0qJLkbfdtuMvBG493kiYDkk/L4G71YcDwlMs UvTFOXSDHQEu3G+3g3Ze27C7Dg== X-Received: by 2002:a17:906:abcd:: with SMTP id kq13mr31862932ejb.477.1615917612312; Tue, 16 Mar 2021 11:00:12 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id c19sm10953182edu.20.2021.03.16.11.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 11:00:12 -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 v5 08/13] media: uvcvideo: Set unique vdev name based in type Date: Tue, 16 Mar 2021 18:59:58 +0100 Message-Id: <20210316180004.1605727-9-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210316180004.1605727-1-ribalda@chromium.org> References: <20210316180004.1605727-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