Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3488859pxf; Mon, 15 Mar 2021 10:38:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrpxBOlTWey9phPhjGkOV4zG37CywVa12cjnTCLYUVlUKkZPB9ngjU6l/fFkfTEEwpHK6l X-Received: by 2002:a17:907:2d24:: with SMTP id gs36mr25013666ejc.344.1615829909808; Mon, 15 Mar 2021 10:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615829909; cv=none; d=google.com; s=arc-20160816; b=uYq0cHqUAbllaYZSJvnS4JGGAG8XFA6CSx+snHz5cuObJCzw8n02RaAjUSkQrf9Fk8 dzL1pABlpfCmZehQcSljykVwFmdECNpxY9lJ+pVvxGB39wUIAkCocpAO6949qBBiH2Yq /KimGzQIPUdF/lY3WZqVvgHqZtUdtS1LAE+GasuAR+AWyND3PPo1Wuz3V17+fVAGMYVi 33885wFulj8Qisjnd4aX60CUrPc4VCJxmQoFziaNB5pYEGuG5yYArPuXiGPPwshnTYiZ zO6qifYoQSRREf1vnS3HTv1/NCiTe+g55Jc4cyLDNSzW1v83ZnQX/182S86ug6Ozl+sa HuSQ== 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=M1MckosJzUu2CQ3qgCveRtXT5Fl+1KQo++LPrJvuljw=; b=0F/+7dui9YhJJgFAEbMgb8fYemTWoNLdFeRNe2aoefp8y1TgsFiQ+y0L8ZHJuWLS1P cRZpFD0d7RYHOraAvutQNMPBQce8dOExVJj4KUFIh+T/S/NOfu4wVKC+cZHUfSqgmM22 QLEQkTb1b6kEgDAaEovloeLl9HMrwrQp+Bf2Z5eE1CqO94M9aJ+Ou/oExdRovaaJ109u 14cLPpDby3YY2hr6UZDNSns0y3V4swOuuSvqQlDgJpENoP0b1Kb5pwSKBPYZqVIoZGIK YFSWT8qaJF+hhI+1VYFIxCmAVdefPbiNu3RjeCXP/fvneU5FEydf7j6RYo2NgYu/X2YW F06g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="axm/2YCs"; 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 kq25si11662797ejb.366.2021.03.15.10.38.07; Mon, 15 Mar 2021 10:38:29 -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="axm/2YCs"; 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 S236569AbhCORgt (ORCPT + 99 others); Mon, 15 Mar 2021 13:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbhCORgR (ORCPT ); Mon, 15 Mar 2021 13:36:17 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61EFDC06175F for ; Mon, 15 Mar 2021 10:36:17 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id h10so18299160edt.13 for ; Mon, 15 Mar 2021 10:36:17 -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=M1MckosJzUu2CQ3qgCveRtXT5Fl+1KQo++LPrJvuljw=; b=axm/2YCstp+BXtdXpUb2XbtOyIVKPk9CpRa4p6uJWBdOkQMMiUDAbRh63DpKyhaVMS kf2uw4Pj5MPykfKyoCpWmCpJXhAp+rUaBa96C7twwxPpKxIUc54nTx9OrgIzSx9eb2Rf Ih2Fcyk7QP1JDaCHeu0/FEUQfhAi903kfhrXs= 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=M1MckosJzUu2CQ3qgCveRtXT5Fl+1KQo++LPrJvuljw=; b=NRQJWYId+699sPPW5T2O26Aqv17Z69KG7miNlkILeim7EmIfvuExOkfId31ppuhavk cqcDzD3iR/3Qrqkp54XkP2Leh1xNzG9j6cm7a4X84727bxC4BGQU6sNigE8sM2l68rgr V/iV+bi89aVJjLNje59LclUXybeJJSanWsUUFQWL9R0xwZpNZgVUnuzwSh01aHxTxnZX jdqANqUcnRxlsMbnRte8zut8uG8ENM1Nvz8isUBguNMjo6jpzzfzN0QE6XB1ROVmqq3t +I49dyUXM4mje7W1ZJUaZza0HZv64L0/wLS0Lziy4ubWXlhLTO4b5kWXYfPCxybChutA 0l8g== X-Gm-Message-State: AOAM530ppOPvynuyNpfcxhaXO0x5+xVfVs3XwgKF3LknL9rXZqDqEamD wmn/nO2QPh4BWcCIKoFNioeyXA== X-Received: by 2002:aa7:cd64:: with SMTP id ca4mr5164326edb.334.1615829776180; Mon, 15 Mar 2021 10:36:16 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id a3sm8109239ejv.40.2021.03.15.10.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 10:36: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 Cc: Ricardo Ribalda Subject: [PATCH v4 08/11] media: uvcvideo: Set unique vdev name based in type Date: Mon, 15 Mar 2021 18:36:06 +0100 Message-Id: <20210315173609.1547857-9-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315173609.1547857-1-ribalda@chromium.org> References: <20210315173609.1547857-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 --- 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..73ab30891845 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