Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4362295pxu; Mon, 21 Dec 2020 10:27:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcT+qrf35fugvEohyDHj/kcAXTJrUX9sT49AK9APSjJD8ZTKHGa/f/f/zzy+F4XBdoH6m2 X-Received: by 2002:a50:ed04:: with SMTP id j4mr17419406eds.84.1608575265396; Mon, 21 Dec 2020 10:27:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608575265; cv=none; d=google.com; s=arc-20160816; b=JDwXTOpYTtAtW+fbuCbWzZ42lO0rcPFxh41xYXiW54gQppk/Wjfnm6uQGK08ZXg+qE yNucut5GLkU8i7f/Z+ADeBB8qXM762Mbk5PXkxOiiIN4xb0gLnVvcLGAit/JgrxEo/FK mxxouDcBLcGEh4CtfgQAe4kBtns0NbL3IY5Lw67dPSua3MvLvrRTkL0Re3HnJue82C/5 +Uw/KWi2X+tIcf/G2Ah8HSJjuIzR7dHTHD3RQj7A0Jtb/ytLxPVDbJhOp9spIh4tLEYN 4gV8E1NZQB3RgDj8IZIkuI0uJsqW1fQLXTpLknQuD6AO42XQZr3DzlAcbafOEALGgBTO 4amg== 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=C/fCz+ZBoSHS5SlHs6JCakf/TmcPwilk8kMtlWo97qo=; b=yyQ4QrIdA+S/n8B2IeqmdvgwrIHXKdbVEFJYXu0x32tJbzYaj6u76TaZE9hLwlSIlW qoLQICr9xqBqr9/CAr3grtkyOtPyg0j/8q/vDQO6cyMkRpEJElaz3pnAQAWkMFpSXf6c Zp4VsPv2SyP+8yfkI3wqPRjWQCAYYhqDtySDbZSz5ANjkB/oh6ISwaampFQT9OUVrHEt NClzEu9qQ/wLGqK39bLJoo1uF70Tq3VPVYMSuyCdRbPcrQyg9Lk61esgty2489qGB8b6 MupoNyuO3sEIrKGGkq4ebO6DWJsXeN0xRmVJoz3rbbx3Kt87NQ1yUJIBoDAbbOI5WQL+ MjSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Yx/8lnR3"; 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 a21si11139491eda.110.2020.12.21.10.27.22; Mon, 21 Dec 2020 10:27:45 -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="Yx/8lnR3"; 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 S1726515AbgLUS0Y (ORCPT + 99 others); Mon, 21 Dec 2020 13:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgLUS0Y (ORCPT ); Mon, 21 Dec 2020 13:26:24 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CCF0C0613D3 for ; Mon, 21 Dec 2020 10:25:43 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id 190so10766699wmz.0 for ; Mon, 21 Dec 2020 10:25:43 -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=C/fCz+ZBoSHS5SlHs6JCakf/TmcPwilk8kMtlWo97qo=; b=Yx/8lnR3YJEPedRdD4WXM1N4zDjp7wCJXAncjrg5mCb+/lgXSpzGIK6Vs001/yYtyS Z9VPPh9Lrof/xY+p5Yq92by9DtsDnj3mITJSnP54geGELxtA8mSVjreFMLvZbgRqOT7Q YdaHGXGbQxlXlP2ZV22NDmM4d9zRYH+olA55E= 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=C/fCz+ZBoSHS5SlHs6JCakf/TmcPwilk8kMtlWo97qo=; b=O8Mrfgdd0lUEcTQCxQLX4wy6F8srOFgpPhTsAt53bbF6Z+IShJZqYF28krc4ZlRUOI V99MO5DWMqWLWpL38xiVB0KuhL+vp1aUZZvrayXkPyf56yyA7Ikp1DzmoMG8ui1uxCX7 mlL84x6nCW5wd2LPo+k0pNO1HLRRXWciQ+APEzxL0Zv/TOiNWhyq48oKkpg6DY+4omDV EY8nJ2GAbwijruJeUsREUldzrFHVid6d2fc3eZsq/XYuRm3+8XIhQgNLXn1QKy/WYbGS 55qa16GodrSJ5SowKu6BhIRfdVf5txOQ3v8QJJDJhhAK9rd23OdSibZ0odOs+w03DzKn DtYw== X-Gm-Message-State: AOAM530fMoiW/Fb4R9mqWhLoyDR8NMw82/2Z41xdMBOhJTpxXhPqymUZ qTGPltRRKIIvSkNRzlnPLPbXI97CtiOBRiobHyg= X-Received: by 2002:a1c:186:: with SMTP id 128mr17543418wmb.176.1608569305103; Mon, 21 Dec 2020 08:48:25 -0800 (PST) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id o125sm24581109wmo.30.2020.12.21.08.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Dec 2020 08:48:24 -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 v5 04/12] media: uvcvideo: Allow extra entities Date: Mon, 21 Dec 2020 17:48:11 +0100 Message-Id: <20201221164819.792019-5-ribalda@chromium.org> X-Mailer: git-send-email 2.29.2.684.gfbc64c5ab5-goog In-Reply-To: <20201221164819.792019-1-ribalda@chromium.org> References: <20201221164819.792019-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 0a3404091665..5d4da54dfd13 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.684.gfbc64c5ab5-goog