kernel: bump 5.15 to 5.15.115
[openwrt/openwrt.git] / target / linux / generic / pending-5.15 / 160-workqueue-fix-enum-type-for-gcc-13.patch
1 From 525ff9c2965770762b81d679820552a208070d59 Mon Sep 17 00:00:00 2001
2 From: Arnd Bergmann <arnd@arndb.de>
3 Date: Tue, 17 Jan 2023 17:40:35 +0100
4 Subject: workqueue: fix enum type for gcc-13
5
6 In gcc-13, the WORK_STRUCT_WQ_DATA_MASK constant is a signed 64-bit
7 type on 32-bit architectures because the enum definition has both
8 negative numbers and numbers above LONG_MAX in it:
9
10 kernel/workqueue.c: In function 'get_work_pwq':
11 kernel/workqueue.c:709:24: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
12 709 | return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
13 | ^
14 kernel/workqueue.c: In function 'get_work_pool':
15 kernel/workqueue.c:737:25: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
16 737 | return ((struct pool_workqueue *)
17 | ^
18 kernel/workqueue.c: In function 'get_work_pool_id':
19 kernel/workqueue.c:759:25: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
20 759 | return ((struct pool_workqueue *)
21 | ^
22
23 Change the enum definition to ensure all values can fit into
24 the range of 'unsigned long' on all architectures.
25
26 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
27 Tested-by: Thierry Reding <treding@nvidia.com>
28 Tested-by: Lai Jiangshan<jiangshanlai@gmail.com>
29 Signed-off-by: Tejun Heo <tj@kernel.org>
30 ---
31 include/linux/workqueue.h | 2 +-
32 1 file changed, 1 insertion(+), 1 deletion(-)
33
34 --- a/include/linux/workqueue.h
35 +++ b/include/linux/workqueue.h
36 @@ -83,7 +83,7 @@ enum {
37
38 /* convenience constants */
39 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
40 - WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
41 + WORK_STRUCT_WQ_DATA_MASK = (unsigned long)~WORK_STRUCT_FLAG_MASK,
42 WORK_STRUCT_NO_POOL = (unsigned long)WORK_OFFQ_POOL_NONE << WORK_OFFQ_POOL_SHIFT,
43
44 /* bit mask for work_busy() return values */