aboutsummaryrefslogtreecommitdiff
path: root/target/linux/layerscape/patches-6.1/703-layerscape-6.1-fix-compilation-warning-for-fsl-ppfe-.patch
blob: d49488ab4c3e4c16ec9bdd58f762b13f6b5a741d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
From 1dc3a2e216d99adc2df022ab37eab32f61d80e0e Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Mon, 8 May 2023 19:26:48 +0200
Subject: [PATCH]  layerscape: 6.1: fix compilation warning for fsl ppfe driver

Rework some desc dump and dummy pkt function to fix compilation warning.
Fix compilation warning:
drivers/staging/fsl_ppfe/pfe_hif.c: In function 'send_dummy_pkt_to_hif':
drivers/staging/fsl_ppfe/pfe_hif.c:118:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  118 |         ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
      |                   ^
drivers/staging/fsl_ppfe/pfe_hif.c:122:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  122 |         lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
      |                    ^
drivers/staging/fsl_ppfe/pfe_hif.c: In function 'pfe_hif_desc_dump':
drivers/staging/fsl_ppfe/pfe_hif.c:195:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  195 |         desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
      |                        ^
drivers/staging/fsl_ppfe/pfe_hif.c:195:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  195 |         desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
      |                                    ^
drivers/staging/fsl_ppfe/pfe_hif.c:207:19: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  207 |         desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
      |                   ^
drivers/staging/fsl_ppfe/pfe_hif.c:207:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  207 |         desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
      |                               ^
cc1: all warnings being treated as errors

In file included from ./include/linux/kernel.h:19,
                 from ./include/linux/list.h:9,
                 from ./include/linux/wait.h:7,
                 from ./include/linux/eventfd.h:13,
                 from drivers/staging/fsl_ppfe/pfe_cdev.c:11:
drivers/staging/fsl_ppfe/pfe_cdev.c: In function 'pfe_cdev_read':
./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=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
  132 |                 printk(fmt, ##__VA_ARGS__);             \
      |                 ^~~~~~
./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~~~~
./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
   15 | #define KERN_DEBUG      KERN_SOH "7"    /* debug-level messages */
      |                         ^~~~~~~~
./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |                   ^~~~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:42:17: note: in expansion of macro 'pr_debug'
   42 |                 pr_debug("%u  %lu", link_states[ret].phy_id,
      |                 ^~~~~~~~
./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=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:493:9: note: in expansion of macro 'printk'
  493 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~
./include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
   11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
      |                         ^~~~~~~~
./include/linux/printk.h:493:16: note: in expansion of macro 'KERN_ERR'
  493 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |                ^~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:50:17: note: in expansion of macro 'pr_err'
   50 |                 pr_err("Failed to send (%d)bytes of (%lu) requested.\n",
      |                 ^~~~~~
./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=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
  132 |                 printk(fmt, ##__VA_ARGS__);             \
      |                 ^~~~~~
./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~~~~
./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
   15 | #define KERN_DEBUG      KERN_SOH "7"    /* debug-level messages */
      |                         ^~~~~~~~
./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |                   ^~~~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:57:9: note: in expansion of macro 'pr_debug'
   57 |         pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states));
      |         ^~~~~~~~
cc1: all warnings being treated as errors

In file included from ./include/uapi/linux/posix_types.h:5,
                 from ./include/uapi/linux/types.h:14,
                 from ./include/linux/types.h:6,
                 from ./include/linux/list.h:5,
                 from ./include/linux/module.h:12,
                 from drivers/staging/fsl_ppfe/pfe_sysfs.c:7:
drivers/staging/fsl_ppfe/pfe_sysfs.c: In function 'pfe_set_util':
./include/linux/stddef.h:8:14: error: passing argument 2 of 'kstrtoul' makes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |
      |              void *
drivers/staging/fsl_ppfe/pfe_sysfs.c:538:39: note: in expansion of macro 'NULL'
  538 |         util_do_clear = kstrtoul(buf, NULL, 0);
      |                                       ^~~~
In file included from ./include/linux/kernel.h:13,
                 from ./include/linux/list.h:9:
./include/linux/kstrtox.h:30:69: note: expected 'unsigned int' but argument is of type 'void *'
   30 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
      |                                                        ~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors

With UTIL compiled on, fix compilation warning:
drivers/staging/fsl_ppfe/pfe_hal.c: In function 'pe_load_ddr_section':
drivers/staging/fsl_ppfe/pfe_hal.c:617:19: error: 'else' without a previous 'if'
  617 |                 } else {
      |                   ^~~~
drivers/staging/fsl_ppfe/pfe_hal.c:622:17: error: break statement not within loop or switch
  622 |                 break;
      |                 ^~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:624:9: error: case label not within a switch statement
  624 |         case SHT_NOBITS:
      |         ^~~~
drivers/staging/fsl_ppfe/pfe_hal.c:627:17: error: break statement not within loop or switch
  627 |                 break;
      |                 ^~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:629:9: error: 'default' label not within a switch statement
  629 |         default:
      |         ^~~~~~~
drivers/staging/fsl_ppfe/pfe_hal.c: At top level:
drivers/staging/fsl_ppfe/pfe_hal.c:635:9: error: expected identifier or '(' before 'return'
  635 |         return 0;
      |         ^~~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:636:1: error: expected identifier or '(' before '}' token
  636 | }

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
---
 drivers/staging/fsl_ppfe/pfe_cdev.c  |  6 +++---
 drivers/staging/fsl_ppfe/pfe_hif.c   | 14 +++++++-------
 drivers/staging/fsl_ppfe/pfe_sysfs.c |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

--- a/drivers/staging/fsl_ppfe/pfe_cdev.c
+++ b/drivers/staging/fsl_ppfe/pfe_cdev.c
@@ -34,7 +34,7 @@ static ssize_t pfe_cdev_read(struct file
 {
 	int ret = 0;
 
-	pr_info("PFE CDEV attempt copying (%lu) size of user.\n",
+	pr_info("PFE CDEV attempt copying (%zu) size of user.\n",
 		sizeof(link_states));
 
 	pr_debug("Dump link_state on screen before copy_to_user\n");
@@ -47,14 +47,14 @@ static ssize_t pfe_cdev_read(struct file
 	/* Copy to user the value in buffer sized len */
 	ret = copy_to_user(buf, &link_states, sizeof(link_states));
 	if (ret != 0) {
-		pr_err("Failed to send (%d)bytes of (%lu) requested.\n",
+		pr_err("Failed to send (%d)bytes of (%zu) requested.\n",
 		       ret, len);
 		return -EFAULT;
 	}
 
 	/* offset set back to 0 as there is contextual reading offset */
 	*off = 0;
-	pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states));
+	pr_debug("Read of (%zu) bytes performed.\n", sizeof(link_states));
 
 	return sizeof(link_states);
 }
--- a/drivers/staging/fsl_ppfe/pfe_hif.c
+++ b/drivers/staging/fsl_ppfe/pfe_hif.c
@@ -115,11 +115,11 @@ static void send_dummy_pkt_to_hif(void)
 		0x33221100, 0xa8c05544, 0x00000301, 0x00000000,
 		0x00000000, 0x00000000, 0x00000000, 0xbe86c51f };
 
-	ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
+	ddr_ptr = (void *)((uintptr_t)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
 	if (!ddr_ptr)
 		return;
 
-	lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
+	lmem_ptr = (void *)((uintptr_t)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
 	if (!lmem_ptr)
 		return;
 
@@ -186,16 +186,16 @@ static void pfe_hif_free_descr(struct pf
 void pfe_hif_desc_dump(struct pfe_hif *hif)
 {
 	struct hif_desc	*desc;
-	unsigned long desc_p;
+	u64 desc_p;
 	int ii = 0;
 
 	pr_info("%s\n", __func__);
 
 	desc = hif->rx_base;
-	desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
+	desc_p = ((void *)desc - hif->descr_baseaddr_v +
 			hif->descr_baseaddr_p);
 
-	pr_info("HIF Rx desc base %p physical %x\n", desc, (u32)desc_p);
+	pr_info("HIF Rx desc base %p physical %llx\n", desc, desc_p);
 	for (ii = 0; ii < hif->rx_ring_size; ii++) {
 		pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n",
 			readl(&desc->status), readl(&desc->ctrl),
@@ -204,10 +204,10 @@ void pfe_hif_desc_dump(struct pfe_hif *h
 	}
 
 	desc = hif->tx_base;
-	desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
+	desc_p = ((void *)desc - hif->descr_baseaddr_v +
 			hif->descr_baseaddr_p);
 
-	pr_info("HIF Tx desc base %p physical %x\n", desc, (u32)desc_p);
+	pr_info("HIF Tx desc base %p physical %llx\n", desc, desc_p);
 	for (ii = 0; ii < hif->tx_ring_size; ii++) {
 		pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n",
 			readl(&desc->status), readl(&desc->ctrl),
--- a/drivers/staging/fsl_ppfe/pfe_sysfs.c
+++ b/drivers/staging/fsl_ppfe/pfe_sysfs.c
@@ -535,7 +535,7 @@ static ssize_t pfe_show_tmu3_queues(stru
 static ssize_t pfe_set_util(struct device *dev, struct device_attribute *attr,
 			    const char *buf, size_t count)
 {
-	util_do_clear = kstrtoul(buf, NULL, 0);
+	util_do_clear = kstrtoul(buf, 0, 0);
 	return count;
 }