From patchwork Fri Jun 28 15:11:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13716321 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 84C68C2BD09 for ; Fri, 28 Jun 2024 15:11:40 +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:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ewUlL1qV/fAyQa0r+zSGNQy6ZDoRG0k1rfyTSSVFaRw=; b=VOd4bx9/gCmwFhszJUeCDIc7Zf AWm8LqAcTudR/1qSFj3HwWO4xBX5yz2knfXLun6O9BQIUEjDrlnz421OwbJjUR9FN3evS59pymlCP p4KSDq/Fuj2282OjP1L1KMG8+A0eDQWVTc9V6iuFyQtHRKrCHl669lBqp+6RMIhXVbuB9+Vt1uQ0P tFZKGyS+GhdPi7zl4Tpac1We0/7gTljsTnxC3HzLqRQlTCx/G5uTDVAv4T3D2TIqnVK26eP7w2e/X JsK5cx3Op5rmh8lwa7Tc/T/fCKUBxkHmFN8cvuQP3rF6hO4bbQx4wkPJyl/A/J84iC3dLJiACMWW8 JIT009eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNDG5-0000000E9n6-2O6u; Fri, 28 Jun 2024 15:11:29 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNDFw-0000000E9lI-3NBR for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 15:11:22 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-6b593387daaso14363506d6.1 for ; Fri, 28 Jun 2024 08:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1719587478; x=1720192278; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=ewUlL1qV/fAyQa0r+zSGNQy6ZDoRG0k1rfyTSSVFaRw=; b=dKQx6d41RMYfos+zqcSK80JnXgaag1/tLQCisVW9Q/L20jzVM9HTJ8x9bjkzN/F0CB oEuT3leAt9i7jMkiQK/wDlqOZQgoin9B4m1ocxo/0W00DumJVpONbWnIPfKb67Ofp0q4 Yehcm3gYgBsLplS2vOC/86oM5w3U54yBMtN0g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719587478; x=1720192278; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ewUlL1qV/fAyQa0r+zSGNQy6ZDoRG0k1rfyTSSVFaRw=; b=XFvykQlAVb9cyw0fQWU69h3bJWk2FZvacyhwY5wT1UheGimpHH2M56tdLNArnTjxwO 7+L18XSu7nLCgenUUklG+JYc8g0KphXWr6Wy8KhV7QoDl9s74wirTJRe3wWiNhQ2lX2J 7x9oUuzT3NX+aepgJ7dNws+nvU4+eQnOXF653zKiG6g2Cwits2Kzx+mtrgo/QkVMSRgE RPbc8+XaVa0VywSDIHnAQ2lOQ63A1uMzhafR90ak7KzshY494v9qFGFHd6Puh5ndWQSP GRCf038dN5MEeoM5ZENXc8vB+HfNtxi8rS7pe6auqCbXQozbXRzEzZ0ZZAp8BbmwPJGK q9wg== X-Forwarded-Encrypted: i=1; AJvYcCXh4xHPUo5Zy3WoN4aEEWF2bSUgSEJ+INsIhDt7Ld7s0AbP4ZRhfVOsOrG62rIGzng8BSQsrUjwPy0dP4t39a8BOMxwstBlolOWlWsQKXyBKgbDPsw= X-Gm-Message-State: AOJu0YyUHmmyjUlhsomqmC5qnS4/okfkxlWlmV0ylH8cvbhSeukwDmC+ jhjxRebyG3smZeBN3NaXA0+l2pcQhJMn0Lq4JI5q/VOoVleaPepYOIIjJj0dqA== X-Google-Smtp-Source: AGHT+IGWfSOemKkZb5msOxo57P5Pa0H8aUEVN9sUgcscdSX3cMREFWR8el+dHT96RwEANwnK0nKXcA== X-Received: by 2002:a05:6214:224c:b0:6b5:101c:6473 with SMTP id 6a1803df08f44-6b5a5405c0cmr32591476d6.2.1719587477714; Fri, 28 Jun 2024 08:11:17 -0700 (PDT) Received: from denia.c.googlers.com (123.178.145.34.bc.googleusercontent.com. [34.145.178.123]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e564455sm8532496d6.42.2024.06.28.08.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 08:11:17 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 28 Jun 2024 15:11:15 +0000 Subject: [PATCH] media: imx-pxp: Rewrite coeff expression MIME-Version: 1.0 Message-Id: <20240628-gcc5-v1-1-7cd56f04a6a8@chromium.org> X-B4-Tracking: v=1; b=H4sIAJPSfmYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDMyML3fTkZFNdc8NESzOLZHOLVEsLJaDSgqLUtMwKsDHRsbW1AEhi88h WAAAA To: Philipp Zabel , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-media@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hans Verkuil , Ricardo Ribalda X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_081120_960963_AD6A43AF X-CRM114-Status: GOOD ( 12.62 ) 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 GCC5 cannot figure out that the expressions are constant, and that triggers a build failure. Rewrite the expressions. The following gcc5 error is workaround: #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000 ^ BM_PXP_CSC1_COEF0_YCBCR_MODE | ^ #define BM_PXP_CSC1_COEF0_YCBCR_MODE 0x80000000 ^ drivers/media/platform/nxp/imx-pxp.c: In function 'pxp_setup_csc': drivers/media/platform/nxp/imx-pxp.h:582:38: error: initializer element is not constant drivers/media/platform/nxp/imx-pxp.c:374:4: note: in expansion of macro 'BM_PXP_CSC1_COEF0_YCBCR_MODE' drivers/media/platform/nxp/imx-pxp.h:582:38: note: (near initialization for 'csc1_coef_bt601_lim[0]') Signed-off-by: Ricardo Ribalda --- While implementing media-ci, we have found this build error with gcc5. --- drivers/media/platform/nxp/imx-pxp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- base-commit: 6aa082910445aec6b1dc652a69c5178a555d8ca5 change-id: 20240628-gcc5-71a968c78e98 Best regards, diff --git a/drivers/media/platform/nxp/imx-pxp.h b/drivers/media/platform/nxp/imx-pxp.h index 44f95c749d2e..ae4c6021c156 100644 --- a/drivers/media/platform/nxp/imx-pxp.h +++ b/drivers/media/platform/nxp/imx-pxp.h @@ -594,12 +594,17 @@ (((v) << 18) & BM_PXP_CSC1_COEF0_C0) #define BP_PXP_CSC1_COEF0_UV_OFFSET 9 #define BM_PXP_CSC1_COEF0_UV_OFFSET 0x0003FE00 + +/* + * We use v * (1 << 9) instead of v << 9, to workaround a gcc5 bug. + * The compiler cannot understand that the expression is constant. +*/ #define BF_PXP_CSC1_COEF0_UV_OFFSET(v) \ - (((v) << 9) & BM_PXP_CSC1_COEF0_UV_OFFSET) + (((v) * (1 << 9)) & BM_PXP_CSC1_COEF0_UV_OFFSET) #define BP_PXP_CSC1_COEF0_Y_OFFSET 0 #define BM_PXP_CSC1_COEF0_Y_OFFSET 0x000001FF #define BF_PXP_CSC1_COEF0_Y_OFFSET(v) \ - (((v) << 0) & BM_PXP_CSC1_COEF0_Y_OFFSET) + ((v) & BM_PXP_CSC1_COEF0_Y_OFFSET) #define HW_PXP_CSC1_COEF1 (0x000001b0)