Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp506460pxx; Wed, 28 Oct 2020 09:53:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznRuqk0Qz+K7agui0w+8ajPKe4uX2JJ3V3FInF5venPNG8CrbdeFQDVxOj8ItmBu7thYkW X-Received: by 2002:a17:906:ca54:: with SMTP id jx20mr8868090ejb.541.1603903980759; Wed, 28 Oct 2020 09:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903980; cv=none; d=google.com; s=arc-20160816; b=wLcU6BpGsPFRz5aocmNKMh4zFhutNYkaz0TItEEEa/eBCdNmphXw0uViCEuyed7hoh h0mhN01/jNdgaRMqg3hq2FUwpmRGZ8F4SvuX6nE0EetmBZG3jrbuCfDgwEv6X0EZbMGQ T4i/IVNJnJ6KP8nnFIb5q2tF9RmRL4Jdrw//B9ltgPUxBiP8Bc7lqYgcR38Ij0aQ0Rc7 PUIPPYKd12zNM6AU5SGIKx7BvvnH6QSsQ4DUPilU3HtiTSX0FH2/7kNHw9dqKf4TYe7V abWu22kySHVmETiaXtO6vLqpfC29dp4U8NuQaENOkkBZvHegohHwE3xSuLQxeyA73lk7 C8pg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kxuPubV87+XwlDNlm+AMnij3szJUyaTBkvq+hV0jwzo=; b=yQEX9BfJylOVocyMV5bPG8el71GXFeOHSZn/Jyj1kSnOgGQDmwcek1Tws/sH3oAeTq UaH72H+ajuit/df80RqVSG2feyR1NyEXrBIizO3hUXQEj+OIgyK1gghOHmmhIjm8GeTq EqRaiMuVFaQkzLYdAIo8KoH0cA/FxWNrfvqKVXji/8s48VQO0jQtIQ2B0MTig5725RmX NOXywK0csaDr6mOSZ8V8swVAbL+8gx/GH/AriF9CxskK3VJWevgNSgZkoVYZyA6kh88L iO81HSEc2IipdVWR3/goOS6QbOzQ9qBH78jSqz/NtvO5fdWMrUcePzW27N3T8CM3mJMh sQEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mqsjIxMu; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay1si32292edb.3.2020.10.28.09.52.38; Wed, 28 Oct 2020 09:53:00 -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=@kernel.org header.s=default header.b=mqsjIxMu; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811874AbgJ0RYO (ORCPT + 99 others); Tue, 27 Oct 2020 13:24:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:54688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2900805AbgJ0OyR (ORCPT ); Tue, 27 Oct 2020 10:54:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45BF222202; Tue, 27 Oct 2020 14:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810457; bh=A6OMpTdyCylzyerA5CB0Ge8MMoV/V8hVB4ep8A82JIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqsjIxMugiM5HaAHxuxMUQDDB0TzNg1xSIt2WsmaKye55Is0WU4psr050u6iS+Ei7 wH32/WCKxuJ72ctrcZjtDA/2FsZ+OmR52sxrbhFRSLdIbm7wMgPh0YF18yXTpH+1gY 7OuDlH6NdHb7D81G5Bfwl+EPCI9w7h28Mwsy619w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.8 115/633] media: uvcvideo: Set media controller entity functions Date: Tue, 27 Oct 2020 14:47:38 +0100 Message-Id: <20201027135528.085062020@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurent Pinchart [ Upstream commit d6834b4b58d110814aaf3469e7fd87d34ae5ae81 ] The media controller core prints a warning when an entity is registered without a function being set. This affects the uvcvideo driver, as the warning was added without first addressing the issue in existing drivers. The problem is harmless, but unnecessarily worries users. Fix it by mapping UVC entity types to MC entity functions as accurately as possible using the existing functions. Fixes: b50bde4e476d ("[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs") Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_entity.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c index b4499cddeffe5..ca3a9c2eec271 100644 --- a/drivers/media/usb/uvc/uvc_entity.c +++ b/drivers/media/usb/uvc/uvc_entity.c @@ -73,10 +73,45 @@ static int uvc_mc_init_entity(struct uvc_video_chain *chain, int ret; if (UVC_ENTITY_TYPE(entity) != UVC_TT_STREAMING) { + u32 function; + v4l2_subdev_init(&entity->subdev, &uvc_subdev_ops); strscpy(entity->subdev.name, entity->name, sizeof(entity->subdev.name)); + switch (UVC_ENTITY_TYPE(entity)) { + case UVC_VC_SELECTOR_UNIT: + function = MEDIA_ENT_F_VID_MUX; + break; + case UVC_VC_PROCESSING_UNIT: + case UVC_VC_EXTENSION_UNIT: + /* For lack of a better option. */ + function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; + break; + case UVC_COMPOSITE_CONNECTOR: + case UVC_COMPONENT_CONNECTOR: + function = MEDIA_ENT_F_CONN_COMPOSITE; + break; + case UVC_SVIDEO_CONNECTOR: + function = MEDIA_ENT_F_CONN_SVIDEO; + break; + case UVC_ITT_CAMERA: + function = MEDIA_ENT_F_CAM_SENSOR; + break; + case UVC_TT_VENDOR_SPECIFIC: + case UVC_ITT_VENDOR_SPECIFIC: + case UVC_ITT_MEDIA_TRANSPORT_INPUT: + case UVC_OTT_VENDOR_SPECIFIC: + case UVC_OTT_DISPLAY: + case UVC_OTT_MEDIA_TRANSPORT_OUTPUT: + case UVC_EXTERNAL_VENDOR_SPECIFIC: + default: + function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; + break; + } + + entity->subdev.entity.function = function; + ret = media_entity_pads_init(&entity->subdev.entity, entity->num_pads, entity->pads); -- 2.25.1