Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5788962pxu; Wed, 23 Dec 2020 05:39:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxugSja9x25kDRkbh3OX+APtweQJwHth18yBR0qJ8OGpx7BUGDKjs0x+/m20XImW5ODDZv2 X-Received: by 2002:a17:906:a00a:: with SMTP id p10mr24514879ejy.312.1608730796647; Wed, 23 Dec 2020 05:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608730796; cv=none; d=google.com; s=arc-20160816; b=jDL+wrMPgnccUDmTdJu/nZY/BsaeMEM/t36ROR8QCLTPfT7zuULAKx0HZtvl5wWwLV bSy9ZhGOXZSUpKskYgo1Eqk4tYZNQF8rVsESyk/8gysdyu9KeQmVNEQ30iBTKJQHxkKi hL5VoQGiwtzvVlvqTZxsbt63sutpetO0OSFrk4ri0VYxLu+VVKUYmdjLfSsBd1eWovrT 4ijo2bdyRE4yp+Ip1yuSsnScuZ08IINziTiUAxuOhz2Q9EqC8oBQd6DoqNpU8bENL2IA nGHEBppUZ03TSeVxPtvQkQBRSn0ieWbxOrmr8tetzIkHSGRsD+YUR0qL7hBOfeEqL0oo i+bw== 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=u758tc6qPeylpt3SsVLMdt+s9OHLjZNVgsX5L88s2r0=; b=OtwOCoiYpbt+UlYYoTSmvHQf7wVMYk0Clplq5ijLT/r+q6hgTlHrBAFruHAthJMldn RcP8LEMezaA96BEmsWTeCZQX8Kev+kAn85JheLZLopJfnvd7Ltcul0vdWqt4zNxxViNc wqGjoghbnCNtwyrcFEqe1BA7Mcp0hEiHfic0fDfuX20lqNqOucn1gQvnNSl9nhyr6sNJ I5wRIOh011zMHSgFYxhLD9gsIJU7AIn2GAY9rjGGXAI+2c6i8fZhXr8WWsrJJWAShXv8 f/pZDVX5ftZrCQ1OoK94MUXOlX6DP2wKzY2lUpWPXHWOSgrirqxpJ432sVtgT5InpavN Y7Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Q0erJBz9; 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 e7si14547514ejm.291.2020.12.23.05.39.34; Wed, 23 Dec 2020 05:39:56 -0800 (PST) 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=Q0erJBz9; 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 S1728698AbgLWNgx (ORCPT + 99 others); Wed, 23 Dec 2020 08:36:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728535AbgLWNgw (ORCPT ); Wed, 23 Dec 2020 08:36:52 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC6EAC0617A6 for ; Wed, 23 Dec 2020 05:35:33 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id v14so5396766wml.1 for ; Wed, 23 Dec 2020 05:35:33 -0800 (PST) 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=u758tc6qPeylpt3SsVLMdt+s9OHLjZNVgsX5L88s2r0=; b=Q0erJBz9hqoU0oD9aLjCvmVU/bI2+F5SMwPkvpY74SU1tcoH70Y42Yd/eDOGArUPkJ Z65XOrGr/mdJja7UDE9DWusMG+ymQy7jOFXAU/8eQpS1VPf6t85xBuVOZ8aEQPEdmGf3 JlcPpqsqvZ/BLRWiQlzvgHyyKC+X3PUQhDfRc= 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=u758tc6qPeylpt3SsVLMdt+s9OHLjZNVgsX5L88s2r0=; b=nuv6cqAfIdN+h85MJocnxRgZTyl1pGsjkW2hLaERyY1EWLiRiga9iI7KNGG3wr7LUa /HJb9SdelljdK3oJvhQEGaT0MR8q0VjeECPHIyt+4rWYsjcQhyENYRdiuNCbL10T49P4 MzCT8oej5aVwV5VxNXyTg3u5QwYNqThOvr8bCXd7Fkw2HfnXoO7qIqGRQAKmp0S5lu0q VJ3k7XpdSCZKjfnoOdNYGNnOc66iZCSypn8GhAWapsSVvtOvkU1JCMfzBKNaIbfdyVEY ePATnUPxA53bMp4vMlYA1z6TgjDczPu+86zbstJhhmoRX+ejCKRtd2CDjkMV9qd051Zp z26g== X-Gm-Message-State: AOAM531Bm2tVui2aOzxylE3FERsOAdImDFisXgXGCtVnNcHtKrB+m1+o sBKovmALCclvc1YcwDTzmk/J99Xd8mc69ETAcHY= X-Received: by 2002:a1c:67c5:: with SMTP id b188mr27091865wmc.147.1608730532583; Wed, 23 Dec 2020 05:35:32 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id q143sm31572247wme.28.2020.12.23.05.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 05:35:32 -0800 (PST) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Subject: [PATCH v7 02/12] media: uvcvideo: Allow extra entities Date: Wed, 23 Dec 2020 14:35:18 +0100 Message-Id: <20201223133528.55014-3-ribalda@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223133528.55014-1-ribalda@chromium.org> References: <20201223133528.55014-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Increase the size of the id, to avoid collisions with entities implemented by the driver that are not part of the UVC device. Entities exposed by the UVC device use IDs 0-255, extra entities implemented by the driver (such as the GPIO entity) use IDs 256 and up. Reviewed-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/media/usb/uvc/uvcvideo.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index bfbc5a4d4ca6..82cdd1bb28dc 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1024,7 +1024,7 @@ static const u8 uvc_media_transport_input_guid[16] = UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT; static const u8 uvc_processing_guid[16] = UVC_GUID_UVC_PROCESSING; -static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id, +static struct uvc_entity *uvc_alloc_entity(u16 type, u16 id, unsigned int num_pads, unsigned int extra_size) { struct uvc_entity *entity; diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index df7bf2d104a3..c50b0546901f 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -301,7 +301,12 @@ struct uvc_entity { * chain. */ unsigned int flags; - u8 id; + /* + * Entities exposed by the UVC device use IDs 0-255, extra entities + * implemented by the driver (such as the GPIO entity) use IDs 256 and + * up. + */ + u16 id; u16 type; char name[64]; u8 guid[16]; -- 2.29.2.729.g45daf8777d-goog