kernel: bump 6.1 to 6.1.58
[openwrt/staging/nbd.git] / target / linux / layerscape / patches-6.1 / 703-layerscape-6.1-fix-compilation-warning-for-fsl-ppfe-.patch
1 From 1dc3a2e216d99adc2df022ab37eab32f61d80e0e Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Mon, 8 May 2023 19:26:48 +0200
4 Subject: [PATCH] layerscape: 6.1: fix compilation warning for fsl ppfe driver
5
6 Rework some desc dump and dummy pkt function to fix compilation warning.
7 Fix compilation warning:
8 drivers/staging/fsl_ppfe/pfe_hif.c: In function 'send_dummy_pkt_to_hif':
9 drivers/staging/fsl_ppfe/pfe_hif.c:118:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
10 118 | ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
11 | ^
12 drivers/staging/fsl_ppfe/pfe_hif.c:122:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
13 122 | lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
14 | ^
15 drivers/staging/fsl_ppfe/pfe_hif.c: In function 'pfe_hif_desc_dump':
16 drivers/staging/fsl_ppfe/pfe_hif.c:195:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
17 195 | desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
18 | ^
19 drivers/staging/fsl_ppfe/pfe_hif.c:195:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
20 195 | desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
21 | ^
22 drivers/staging/fsl_ppfe/pfe_hif.c:207:19: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
23 207 | desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
24 | ^
25 drivers/staging/fsl_ppfe/pfe_hif.c:207:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
26 207 | desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
27 | ^
28 cc1: all warnings being treated as errors
29
30 In file included from ./include/linux/kernel.h:19,
31 from ./include/linux/list.h:9,
32 from ./include/linux/wait.h:7,
33 from ./include/linux/eventfd.h:13,
34 from drivers/staging/fsl_ppfe/pfe_cdev.c:11:
35 drivers/staging/fsl_ppfe/pfe_cdev.c: In function 'pfe_cdev_read':
36 ./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Werror=format=]
37 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
38 | ^~~~~~
39 ./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
40 422 | _p_func(_fmt, ##__VA_ARGS__); \
41 | ^~~~
42 ./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
43 132 | printk(fmt, ##__VA_ARGS__); \
44 | ^~~~~~
45 ./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
46 580 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
47 | ^~~~~~~~~
48 ./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
49 15 | #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
50 | ^~~~~~~~
51 ./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
52 580 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
53 | ^~~~~~~~~~
54 drivers/staging/fsl_ppfe/pfe_cdev.c:42:17: note: in expansion of macro 'pr_debug'
55 42 | pr_debug("%u %lu", link_states[ret].phy_id,
56 | ^~~~~~~~
57 ./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
58 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
59 | ^~~~~~
60 ./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
61 422 | _p_func(_fmt, ##__VA_ARGS__); \
62 | ^~~~
63 ./include/linux/printk.h:493:9: note: in expansion of macro 'printk'
64 493 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
65 | ^~~~~~
66 ./include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
67 11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
68 | ^~~~~~~~
69 ./include/linux/printk.h:493:16: note: in expansion of macro 'KERN_ERR'
70 493 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
71 | ^~~~~~~~
72 drivers/staging/fsl_ppfe/pfe_cdev.c:50:17: note: in expansion of macro 'pr_err'
73 50 | pr_err("Failed to send (%d)bytes of (%lu) requested.\n",
74 | ^~~~~~
75 ./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'unsigned int' [-Werror=format=]
76 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
77 | ^~~~~~
78 ./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
79 422 | _p_func(_fmt, ##__VA_ARGS__); \
80 | ^~~~
81 ./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
82 132 | printk(fmt, ##__VA_ARGS__); \
83 | ^~~~~~
84 ./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
85 580 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
86 | ^~~~~~~~~
87 ./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
88 15 | #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
89 | ^~~~~~~~
90 ./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
91 580 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
92 | ^~~~~~~~~~
93 drivers/staging/fsl_ppfe/pfe_cdev.c:57:9: note: in expansion of macro 'pr_debug'
94 57 | pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states));
95 | ^~~~~~~~
96 cc1: all warnings being treated as errors
97
98 In file included from ./include/uapi/linux/posix_types.h:5,
99 from ./include/uapi/linux/types.h:14,
100 from ./include/linux/types.h:6,
101 from ./include/linux/list.h:5,
102 from ./include/linux/module.h:12,
103 from drivers/staging/fsl_ppfe/pfe_sysfs.c:7:
104 drivers/staging/fsl_ppfe/pfe_sysfs.c: In function 'pfe_set_util':
105 ./include/linux/stddef.h:8:14: error: passing argument 2 of 'kstrtoul' makes integer from pointer without a cast [-Werror=int-conversion]
106 8 | #define NULL ((void *)0)
107 | ^~~~~~~~~~~
108 | |
109 | void *
110 drivers/staging/fsl_ppfe/pfe_sysfs.c:538:39: note: in expansion of macro 'NULL'
111 538 | util_do_clear = kstrtoul(buf, NULL, 0);
112 | ^~~~
113 In file included from ./include/linux/kernel.h:13,
114 from ./include/linux/list.h:9:
115 ./include/linux/kstrtox.h:30:69: note: expected 'unsigned int' but argument is of type 'void *'
116 30 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
117 | ~~~~~~~~~~~~~^~~~
118 cc1: all warnings being treated as errors
119
120 With UTIL compiled on, fix compilation warning:
121 drivers/staging/fsl_ppfe/pfe_hal.c: In function 'pe_load_ddr_section':
122 drivers/staging/fsl_ppfe/pfe_hal.c:617:19: error: 'else' without a previous 'if'
123 617 | } else {
124 | ^~~~
125 drivers/staging/fsl_ppfe/pfe_hal.c:622:17: error: break statement not within loop or switch
126 622 | break;
127 | ^~~~~
128 drivers/staging/fsl_ppfe/pfe_hal.c:624:9: error: case label not within a switch statement
129 624 | case SHT_NOBITS:
130 | ^~~~
131 drivers/staging/fsl_ppfe/pfe_hal.c:627:17: error: break statement not within loop or switch
132 627 | break;
133 | ^~~~~
134 drivers/staging/fsl_ppfe/pfe_hal.c:629:9: error: 'default' label not within a switch statement
135 629 | default:
136 | ^~~~~~~
137 drivers/staging/fsl_ppfe/pfe_hal.c: At top level:
138 drivers/staging/fsl_ppfe/pfe_hal.c:635:9: error: expected identifier or '(' before 'return'
139 635 | return 0;
140 | ^~~~~~
141 drivers/staging/fsl_ppfe/pfe_hal.c:636:1: error: expected identifier or '(' before '}' token
142 636 | }
143
144 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
145 Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
146 ---
147 drivers/staging/fsl_ppfe/pfe_cdev.c | 6 +++---
148 drivers/staging/fsl_ppfe/pfe_hif.c | 14 +++++++-------
149 drivers/staging/fsl_ppfe/pfe_sysfs.c | 2 +-
150 3 files changed, 11 insertions(+), 11 deletions(-)
151
152 --- a/drivers/staging/fsl_ppfe/pfe_cdev.c
153 +++ b/drivers/staging/fsl_ppfe/pfe_cdev.c
154 @@ -34,7 +34,7 @@ static ssize_t pfe_cdev_read(struct file
155 {
156 int ret = 0;
157
158 - pr_info("PFE CDEV attempt copying (%lu) size of user.\n",
159 + pr_info("PFE CDEV attempt copying (%zu) size of user.\n",
160 sizeof(link_states));
161
162 pr_debug("Dump link_state on screen before copy_to_user\n");
163 @@ -47,14 +47,14 @@ static ssize_t pfe_cdev_read(struct file
164 /* Copy to user the value in buffer sized len */
165 ret = copy_to_user(buf, &link_states, sizeof(link_states));
166 if (ret != 0) {
167 - pr_err("Failed to send (%d)bytes of (%lu) requested.\n",
168 + pr_err("Failed to send (%d)bytes of (%zu) requested.\n",
169 ret, len);
170 return -EFAULT;
171 }
172
173 /* offset set back to 0 as there is contextual reading offset */
174 *off = 0;
175 - pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states));
176 + pr_debug("Read of (%zu) bytes performed.\n", sizeof(link_states));
177
178 return sizeof(link_states);
179 }
180 --- a/drivers/staging/fsl_ppfe/pfe_hif.c
181 +++ b/drivers/staging/fsl_ppfe/pfe_hif.c
182 @@ -115,11 +115,11 @@ static void send_dummy_pkt_to_hif(void)
183 0x33221100, 0xa8c05544, 0x00000301, 0x00000000,
184 0x00000000, 0x00000000, 0x00000000, 0xbe86c51f };
185
186 - ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
187 + ddr_ptr = (void *)((uintptr_t)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
188 if (!ddr_ptr)
189 return;
190
191 - lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
192 + lmem_ptr = (void *)((uintptr_t)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
193 if (!lmem_ptr)
194 return;
195
196 @@ -186,16 +186,16 @@ static void pfe_hif_free_descr(struct pf
197 void pfe_hif_desc_dump(struct pfe_hif *hif)
198 {
199 struct hif_desc *desc;
200 - unsigned long desc_p;
201 + u64 desc_p;
202 int ii = 0;
203
204 pr_info("%s\n", __func__);
205
206 desc = hif->rx_base;
207 - desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
208 + desc_p = ((void *)desc - hif->descr_baseaddr_v +
209 hif->descr_baseaddr_p);
210
211 - pr_info("HIF Rx desc base %p physical %x\n", desc, (u32)desc_p);
212 + pr_info("HIF Rx desc base %p physical %llx\n", desc, desc_p);
213 for (ii = 0; ii < hif->rx_ring_size; ii++) {
214 pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n",
215 readl(&desc->status), readl(&desc->ctrl),
216 @@ -204,10 +204,10 @@ void pfe_hif_desc_dump(struct pfe_hif *h
217 }
218
219 desc = hif->tx_base;
220 - desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
221 + desc_p = ((void *)desc - hif->descr_baseaddr_v +
222 hif->descr_baseaddr_p);
223
224 - pr_info("HIF Tx desc base %p physical %x\n", desc, (u32)desc_p);
225 + pr_info("HIF Tx desc base %p physical %llx\n", desc, desc_p);
226 for (ii = 0; ii < hif->tx_ring_size; ii++) {
227 pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n",
228 readl(&desc->status), readl(&desc->ctrl),
229 --- a/drivers/staging/fsl_ppfe/pfe_sysfs.c
230 +++ b/drivers/staging/fsl_ppfe/pfe_sysfs.c
231 @@ -535,7 +535,7 @@ static ssize_t pfe_show_tmu3_queues(stru
232 static ssize_t pfe_set_util(struct device *dev, struct device_attribute *attr,
233 const char *buf, size_t count)
234 {
235 - util_do_clear = kstrtoul(buf, NULL, 0);
236 + util_do_clear = kstrtoul(buf, 0, 0);
237 return count;
238 }
239