openwrt-cghmn-mt300n/target/linux/bcm27xx/patches-6.6/950-1547-fix-clang-compilation-error.patch
Álvaro Fernández Rojas 251f76c1c6 bcm27xx: pull 6.6 patches from RPi repo
Adds latest 6.6 patches from the Raspberry Pi repository.

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.6.y/
With the following command:
git format-patch -N v6.6.83..HEAD
(HEAD -> 08d4e8f52256bd422d8a1f876411603f627d0a82)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-03-16 08:04:48 +01:00

31 lines
1.2 KiB
Diff

From 1337c39626c14ca5e61b4cddbc097d87212a0b13 Mon Sep 17 00:00:00 2001
From: KubaTaba1uga <luna7337anul@proton.me>
Date: Mon, 3 Mar 2025 17:25:29 +0100
Subject: [PATCH] fix clang compilation error
---
drivers/dma-buf/heaps/system_heap.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -50,11 +50,16 @@ static gfp_t order_flags[] = {HIGH_ORDER
* to match with the sizes often found in IOMMUs. Using order 4 pages instead
* of order 0 pages can significantly improve the performance of many IOMMUs
* by reducing TLB pressure and time spent updating page tables.
+ *
+ * Note: `module_max_order` must be set explicitly instead of using
+ * `orders[0]` to avoid Clang's "initializer element is not a
+ * compile-time constant" error.
*/
-static const unsigned int orders[] = {8, 4, 0};
+#define MAX_ORDERS_VALUE 8
+static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0};
#define NUM_ORDERS ARRAY_SIZE(orders)
-static unsigned int module_max_order = orders[0];
+static unsigned int module_max_order = MAX_ORDERS_VALUE;
module_param_named(max_order, module_max_order, uint, 0400);
MODULE_PARM_DESC(max_order, "Maximum allocation order override.");