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: 13716313 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3FFB1DDE9 for ; Fri, 28 Jun 2024 15:11:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719587480; cv=none; b=ZUvxFRgmxpbRKf0VY5zEbTMdbj+feXUjj5maxKj0vKjAB+ex7XFW0bbXZgIr8/C86UlCu/PWq1tq0K10CrGrMqJH06EckK7KGFRPbUxH3EDjADLH0qjTqxrwcsaCMldDy4Lx244G+x6hbhVKDRU8XqC3C5pX5NzeAx70uecFFFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719587480; c=relaxed/simple; bh=IoUQMkRlutwZpLhi+B8muMB2qxCoEdTw4U8Kbs1pSW0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=q73LLhIyuqyeTZheBb71nytsOpnjKgTG9tOlIAn8poB3CEaGukawoGYWD8IH2pNDZ92RWu6FbKYn5dZsmjGSU9YuEaee9ZKgFUcnLHykqIMf8M2nOCUgp0zgXMlNxolsKSDya2CY2/0O5e4xhu0bnb/Qyykg516YduaG+10ePpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=WIGC+QvX; arc=none smtp.client-ip=209.85.219.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WIGC+QvX" Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-6b5932383e0so15321766d6.0 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.linux.dev; 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=WIGC+QvXnIkH90j60lBGtnCoo21slRcJinFycRhslatXQOfShOxFYND2vw1C5/Wgoq hdm3FJVO44GOV+qAALmN5535MVo9Ta0JiVeTl8rN/eTxjy1Q/Vvlpf4GEUptwt7uuAW1 J+EwCAtRyMJPJy/PXF/WrPXJKYGY5k5uIR0ck= 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=tckdbLBuDNlQK7CHmKLptQ5yHzteyOKdc4YyYdOZwP+Cafkyna7HKJln5Ywf/Df7+k 7aGJRIVrR+gGaUK762ZpAG279r+DHtBu1w0LdBADoGzphkgThQlbJ6hVNiHyHjvcbQb+ 09ZsFkftP8d2dxGYnRIP8yIxQUWiPkSvSc8sGHZQ+XRYtzNulAUX85Q7NJVgKGSU27UD rAqt9y+QTX48jefZqK+WjQdis5Fqq59P+BXfeCGWJfLeS7lJHthFhR52e4cFvxZoYxwV X1zaBtMEVVj6AaJHsyrKTlz1I7aE0PRu390Il1W3lkVQ7NzbifZUlIgxh4ASrF5orDAp w2Jg== X-Forwarded-Encrypted: i=1; AJvYcCVgK6sVBWk6vbB5vY0iiB486Uj7NDfJcN2X/8ilobojR2ko8coAr5i7Lw8zn8SVdMvLQT6edr6kGKAjMcI9rGlOFRo3 X-Gm-Message-State: AOJu0YzOyWLAovoCx9Y9ont7sv32JB5x2jHaPQvkxhLprWrQmkOLLD5V epABLfWjV+rwNBiNsvG1+0+Uq+xtof2iQv8A86Sl2bncFc6JyqmzSrk+UWQBEA== 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 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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 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)