From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA642C27C65 for ; Tue, 11 Jun 2024 17:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HiAP3+Ec5hrm6yQRRHqP09xttz6ueK0PRlnBsUBLqPg=; b=oi/3r4xOz0I62KEnxStAx1ppQG +BgoIUR0BJalogWj4QW44ab6zLQGNeZ8qzXWkczB9onz0t641R1fq0tdtFC12LluQgrj6Qvr8HCt0 F43/B/IdjM4ehoapWELhDupWqXywJzpJ4i74dOAiu3sgDpFkDrqQn8Zcnd/jyM5T+1movUR+EiDen zZfgESH433XFP8ou4rHkSpNvekVt5DCb6vlmgzgjsMS5eRe+DRUigE8qMfxcWi0XTHA6F5OK7O56+ mCMZKIeGG+Xipddz2kyE/lUGPdfQdx4Vm4WKk9ZIUq9RBCD+3y96wz+E36Gzk6wttPuuZfZH1ozb/ ToVzc5CQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH5G6-00000009fUX-1SU8; Tue, 11 Jun 2024 17:26:10 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH5G3-00000009fTc-1LzK for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 17:26:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 861E3CE1CFE; Tue, 11 Jun 2024 17:26:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CECECC2BD10; Tue, 11 Jun 2024 17:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718126764; bh=SQVKiWoMEQlGJzZl2xfryE32TSjR7fWPakYa+xG+jOQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c2suFtL5Vem76e++QV+lrZeQ7MGiZxVNYh58xkSQi2PPsLfzgMS+DIViYpPHwQIIF OQsYe+Y8zKrquo+xzNMcQu6lXzyiUATsppSouXRBdVURX2p/4tkeyTY8YA3VjNSpRq F64+77bYB6rnQpQt6afrIzUOf6dOR6B4sXGhn7UVKtUTB8MLQAEFpwkuEtLMEi5GDu HRy6oaJUJJdwjklzdWv+LgNpsX8DPiNzS9u2kLYOXfEPTvmV8CzRmlgvdhLcfUbiza CAmlUqVumeZrj5/6o682Y84/8n7jfxQeLepnQGIcQ1Xm+1hE6nkCG3V6dye3Leykmi 1MBzCTM49UwkA== Date: Tue, 11 Jun 2024 10:26:02 -0700 From: Nathan Chancellor To: Umang Jain Cc: Mauro Carvalho Chehab , Conor Dooley , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sakari Ailus , Kieran Bingham , Rob Herring , Krzysztof Kozlowski , Sascha Hauer , Andy Shevchenko , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v4 2/2] media: i2c: Add imx283 camera sensor driver Message-ID: <20240611172602.GA2226028@thelio-3990X> References: <20240402-kernel-name-extraversion-v4-0-fb776893e4ec@ideasonboard.com> <20240402-kernel-name-extraversion-v4-2-fb776893e4ec@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240402-kernel-name-extraversion-v4-2-fb776893e4ec@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_102607_727552_9A7EA45E X-CRM114-Status: GOOD ( 15.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Umang, On Tue, Apr 02, 2024 at 03:37:51PM +0530, Umang Jain wrote: > From: Kieran Bingham > > Add a v4l2 subdevice driver for the Sony IMX283 image sensor. > > The IMX283 is a 20MP Diagonal 15.86 mm (Type 1) CMOS Image Sensor with > Square Pixel for Color Cameras. > > The following features are supported: > - Manual exposure an gain control support > - vblank/hblank/link freq control support > - Test pattern support control > - Arbitrary horizontal and vertical cropping > - Supported resolution: > - 5472x3648 @ 20fps (SRGGB12) > - 5472x3648 @ 25fps (SRGGB10) > - 2736x1824 @ 50fps (SRGGB12) > > Signed-off-by: Kieran Bingham > Signed-off-by: Umang Jain This change is now in -next as commit ccb4eb4496fa ("media: i2c: Add imx283 camera sensor driver"). > +++ b/drivers/media/i2c/imx283.c ... > +/* IMX283 native and active pixel array size. */ > +static const struct v4l2_rect imx283_native_area = { > + .top = 0, > + .left = 0, > + .width = 5592, > + .height = 3710, > +}; > + > +static const struct v4l2_rect imx283_active_area = { > + .top = 40, > + .left = 108, > + .width = 5472, > + .height = 3648, > +}; ... > +#define CENTERED_RECTANGLE(rect, _width, _height) \ > + { \ > + .left = rect.left + ((rect.width - (_width)) / 2), \ > + .top = rect.top + ((rect.height - (_height)) / 2), \ > + .width = (_width), \ > + .height = (_height), \ > + } ... > + .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), This construct does not work with GCC prior to 7 and Clang prior to 17 (where certain const structures and variables will be considered constant expressions for the sake of initializers and such), resulting in: drivers/media/i2c/imx283.c:443:30: error: initializer element is not constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:412:11: note: in definition of macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: note: (near initialization for 'supported_modes_12bit[0].crop.left') .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:412:11: note: in definition of macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: error: initializer element is not constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:413:10: note: in definition of macro 'CENTERED_RECTANGLE' .top = rect.top + ((rect.height - (_height)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: note: (near initialization for 'supported_modes_12bit[0].crop.top') .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ^ drivers/media/i2c/imx283.c:413:10: note: in definition of macro 'CENTERED_RECTANGLE' .top = rect.top + ((rect.height - (_height)) / 2), \ ^~~~ drivers/media/i2c/imx283.c:443:30: error: initializer element is not a compile-time constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:412:11: note: expanded from macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:492:30: error: initializer element is not a compile-time constant .crop = CENTERED_RECTANGLE(imx283_active_area, 5472, 3648), ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/media/i2c/imx283.c:412:11: note: expanded from macro 'CENTERED_RECTANGLE' .left = rect.left + ((rect.width - (_width)) / 2), \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated. with these compiler versions. Usually, the values are just refactored with #define macros. Cheers, Nathan