1 |
commit: b29b5859b935dc369fe2e040993cb6d290d04744 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 10 19:43:09 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 10 19:43:09 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b29b5859 |
7 |
|
8 |
Linux patch 5.0.15 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1014_linux-5.0.15.patch | 6151 +++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 6155 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index b2a5389..0d6cdbe 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -99,6 +99,10 @@ Patch: 1013_linux-5.0.14.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.0.14 |
23 |
|
24 |
+Patch: 1014_linux-5.0.15.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.0.15 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1014_linux-5.0.15.patch b/1014_linux-5.0.15.patch |
33 |
new file mode 100644 |
34 |
index 0000000..9c65e91 |
35 |
--- /dev/null |
36 |
+++ b/1014_linux-5.0.15.patch |
37 |
@@ -0,0 +1,6151 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 5ce29665eeed..11c7f7844507 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 0 |
46 |
+-SUBLEVEL = 14 |
47 |
++SUBLEVEL = 15 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Shy Crocodile |
50 |
+ |
51 |
+diff --git a/arch/arm64/include/asm/futex.h b/arch/arm64/include/asm/futex.h |
52 |
+index c7e1a7837706..6fb2214333a2 100644 |
53 |
+--- a/arch/arm64/include/asm/futex.h |
54 |
++++ b/arch/arm64/include/asm/futex.h |
55 |
+@@ -23,26 +23,34 @@ |
56 |
+ |
57 |
+ #include <asm/errno.h> |
58 |
+ |
59 |
++#define FUTEX_MAX_LOOPS 128 /* What's the largest number you can think of? */ |
60 |
++ |
61 |
+ #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ |
62 |
+ do { \ |
63 |
++ unsigned int loops = FUTEX_MAX_LOOPS; \ |
64 |
++ \ |
65 |
+ uaccess_enable(); \ |
66 |
+ asm volatile( \ |
67 |
+ " prfm pstl1strm, %2\n" \ |
68 |
+ "1: ldxr %w1, %2\n" \ |
69 |
+ insn "\n" \ |
70 |
+ "2: stlxr %w0, %w3, %2\n" \ |
71 |
+-" cbnz %w0, 1b\n" \ |
72 |
+-" dmb ish\n" \ |
73 |
++" cbz %w0, 3f\n" \ |
74 |
++" sub %w4, %w4, %w0\n" \ |
75 |
++" cbnz %w4, 1b\n" \ |
76 |
++" mov %w0, %w7\n" \ |
77 |
+ "3:\n" \ |
78 |
++" dmb ish\n" \ |
79 |
+ " .pushsection .fixup,\"ax\"\n" \ |
80 |
+ " .align 2\n" \ |
81 |
+-"4: mov %w0, %w5\n" \ |
82 |
++"4: mov %w0, %w6\n" \ |
83 |
+ " b 3b\n" \ |
84 |
+ " .popsection\n" \ |
85 |
+ _ASM_EXTABLE(1b, 4b) \ |
86 |
+ _ASM_EXTABLE(2b, 4b) \ |
87 |
+- : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ |
88 |
+- : "r" (oparg), "Ir" (-EFAULT) \ |
89 |
++ : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp), \ |
90 |
++ "+r" (loops) \ |
91 |
++ : "r" (oparg), "Ir" (-EFAULT), "Ir" (-EAGAIN) \ |
92 |
+ : "memory"); \ |
93 |
+ uaccess_disable(); \ |
94 |
+ } while (0) |
95 |
+@@ -57,23 +65,23 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) |
96 |
+ |
97 |
+ switch (op) { |
98 |
+ case FUTEX_OP_SET: |
99 |
+- __futex_atomic_op("mov %w3, %w4", |
100 |
++ __futex_atomic_op("mov %w3, %w5", |
101 |
+ ret, oldval, uaddr, tmp, oparg); |
102 |
+ break; |
103 |
+ case FUTEX_OP_ADD: |
104 |
+- __futex_atomic_op("add %w3, %w1, %w4", |
105 |
++ __futex_atomic_op("add %w3, %w1, %w5", |
106 |
+ ret, oldval, uaddr, tmp, oparg); |
107 |
+ break; |
108 |
+ case FUTEX_OP_OR: |
109 |
+- __futex_atomic_op("orr %w3, %w1, %w4", |
110 |
++ __futex_atomic_op("orr %w3, %w1, %w5", |
111 |
+ ret, oldval, uaddr, tmp, oparg); |
112 |
+ break; |
113 |
+ case FUTEX_OP_ANDN: |
114 |
+- __futex_atomic_op("and %w3, %w1, %w4", |
115 |
++ __futex_atomic_op("and %w3, %w1, %w5", |
116 |
+ ret, oldval, uaddr, tmp, ~oparg); |
117 |
+ break; |
118 |
+ case FUTEX_OP_XOR: |
119 |
+- __futex_atomic_op("eor %w3, %w1, %w4", |
120 |
++ __futex_atomic_op("eor %w3, %w1, %w5", |
121 |
+ ret, oldval, uaddr, tmp, oparg); |
122 |
+ break; |
123 |
+ default: |
124 |
+@@ -93,6 +101,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, |
125 |
+ u32 oldval, u32 newval) |
126 |
+ { |
127 |
+ int ret = 0; |
128 |
++ unsigned int loops = FUTEX_MAX_LOOPS; |
129 |
+ u32 val, tmp; |
130 |
+ u32 __user *uaddr; |
131 |
+ |
132 |
+@@ -104,20 +113,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, |
133 |
+ asm volatile("// futex_atomic_cmpxchg_inatomic\n" |
134 |
+ " prfm pstl1strm, %2\n" |
135 |
+ "1: ldxr %w1, %2\n" |
136 |
+-" sub %w3, %w1, %w4\n" |
137 |
+-" cbnz %w3, 3f\n" |
138 |
+-"2: stlxr %w3, %w5, %2\n" |
139 |
+-" cbnz %w3, 1b\n" |
140 |
+-" dmb ish\n" |
141 |
++" sub %w3, %w1, %w5\n" |
142 |
++" cbnz %w3, 4f\n" |
143 |
++"2: stlxr %w3, %w6, %2\n" |
144 |
++" cbz %w3, 3f\n" |
145 |
++" sub %w4, %w4, %w3\n" |
146 |
++" cbnz %w4, 1b\n" |
147 |
++" mov %w0, %w8\n" |
148 |
+ "3:\n" |
149 |
++" dmb ish\n" |
150 |
++"4:\n" |
151 |
+ " .pushsection .fixup,\"ax\"\n" |
152 |
+-"4: mov %w0, %w6\n" |
153 |
+-" b 3b\n" |
154 |
++"5: mov %w0, %w7\n" |
155 |
++" b 4b\n" |
156 |
+ " .popsection\n" |
157 |
+- _ASM_EXTABLE(1b, 4b) |
158 |
+- _ASM_EXTABLE(2b, 4b) |
159 |
+- : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) |
160 |
+- : "r" (oldval), "r" (newval), "Ir" (-EFAULT) |
161 |
++ _ASM_EXTABLE(1b, 5b) |
162 |
++ _ASM_EXTABLE(2b, 5b) |
163 |
++ : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp), "+r" (loops) |
164 |
++ : "r" (oldval), "r" (newval), "Ir" (-EFAULT), "Ir" (-EAGAIN) |
165 |
+ : "memory"); |
166 |
+ uaccess_disable(); |
167 |
+ |
168 |
+diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c |
169 |
+index 149100e1bc7c..90f37626100f 100644 |
170 |
+--- a/arch/mips/kernel/kgdb.c |
171 |
++++ b/arch/mips/kernel/kgdb.c |
172 |
+@@ -33,6 +33,7 @@ |
173 |
+ #include <asm/processor.h> |
174 |
+ #include <asm/sigcontext.h> |
175 |
+ #include <linux/uaccess.h> |
176 |
++#include <asm/irq_regs.h> |
177 |
+ |
178 |
+ static struct hard_trap_info { |
179 |
+ unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */ |
180 |
+@@ -214,7 +215,7 @@ void kgdb_call_nmi_hook(void *ignored) |
181 |
+ old_fs = get_fs(); |
182 |
+ set_fs(get_ds()); |
183 |
+ |
184 |
+- kgdb_nmicallback(raw_smp_processor_id(), NULL); |
185 |
++ kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); |
186 |
+ |
187 |
+ set_fs(old_fs); |
188 |
+ } |
189 |
+diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c |
190 |
+index 470d7daa915d..71fb8b7b2954 100644 |
191 |
+--- a/arch/x86/events/intel/core.c |
192 |
++++ b/arch/x86/events/intel/core.c |
193 |
+@@ -3184,7 +3184,7 @@ static int intel_pmu_hw_config(struct perf_event *event) |
194 |
+ return ret; |
195 |
+ |
196 |
+ if (event->attr.precise_ip) { |
197 |
+- if (!event->attr.freq) { |
198 |
++ if (!(event->attr.freq || event->attr.wakeup_events)) { |
199 |
+ event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD; |
200 |
+ if (!(event->attr.sample_type & |
201 |
+ ~intel_pmu_large_pebs_flags(event))) |
202 |
+@@ -3563,6 +3563,12 @@ static void intel_pmu_cpu_starting(int cpu) |
203 |
+ |
204 |
+ cpuc->lbr_sel = NULL; |
205 |
+ |
206 |
++ if (x86_pmu.flags & PMU_FL_TFA) { |
207 |
++ WARN_ON_ONCE(cpuc->tfa_shadow); |
208 |
++ cpuc->tfa_shadow = ~0ULL; |
209 |
++ intel_set_tfa(cpuc, false); |
210 |
++ } |
211 |
++ |
212 |
+ if (x86_pmu.version > 1) |
213 |
+ flip_smm_bit(&x86_pmu.attr_freeze_on_smi); |
214 |
+ |
215 |
+diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h |
216 |
+index f7dd895b2353..0c14018d1c26 100644 |
217 |
+--- a/arch/xtensa/include/asm/processor.h |
218 |
++++ b/arch/xtensa/include/asm/processor.h |
219 |
+@@ -187,15 +187,18 @@ struct thread_struct { |
220 |
+ |
221 |
+ /* Clearing a0 terminates the backtrace. */ |
222 |
+ #define start_thread(regs, new_pc, new_sp) \ |
223 |
+- memset(regs, 0, sizeof(*regs)); \ |
224 |
+- regs->pc = new_pc; \ |
225 |
+- regs->ps = USER_PS_VALUE; \ |
226 |
+- regs->areg[1] = new_sp; \ |
227 |
+- regs->areg[0] = 0; \ |
228 |
+- regs->wmask = 1; \ |
229 |
+- regs->depc = 0; \ |
230 |
+- regs->windowbase = 0; \ |
231 |
+- regs->windowstart = 1; |
232 |
++ do { \ |
233 |
++ memset((regs), 0, sizeof(*(regs))); \ |
234 |
++ (regs)->pc = (new_pc); \ |
235 |
++ (regs)->ps = USER_PS_VALUE; \ |
236 |
++ (regs)->areg[1] = (new_sp); \ |
237 |
++ (regs)->areg[0] = 0; \ |
238 |
++ (regs)->wmask = 1; \ |
239 |
++ (regs)->depc = 0; \ |
240 |
++ (regs)->windowbase = 0; \ |
241 |
++ (regs)->windowstart = 1; \ |
242 |
++ (regs)->syscall = NO_SYSCALL; \ |
243 |
++ } while (0) |
244 |
+ |
245 |
+ /* Forward declaration */ |
246 |
+ struct task_struct; |
247 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
248 |
+index 5a2585d69c81..6930c82ab75f 100644 |
249 |
+--- a/block/blk-mq.c |
250 |
++++ b/block/blk-mq.c |
251 |
+@@ -657,6 +657,13 @@ bool blk_mq_complete_request(struct request *rq) |
252 |
+ } |
253 |
+ EXPORT_SYMBOL(blk_mq_complete_request); |
254 |
+ |
255 |
++void blk_mq_complete_request_sync(struct request *rq) |
256 |
++{ |
257 |
++ WRITE_ONCE(rq->state, MQ_RQ_COMPLETE); |
258 |
++ rq->q->mq_ops->complete(rq); |
259 |
++} |
260 |
++EXPORT_SYMBOL_GPL(blk_mq_complete_request_sync); |
261 |
++ |
262 |
+ int blk_mq_request_started(struct request *rq) |
263 |
+ { |
264 |
+ return blk_mq_rq_state(rq) != MQ_RQ_IDLE; |
265 |
+diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c |
266 |
+index 5f94c35d165f..a2d8c03b1e24 100644 |
267 |
+--- a/drivers/acpi/acpi_lpss.c |
268 |
++++ b/drivers/acpi/acpi_lpss.c |
269 |
+@@ -1142,8 +1142,8 @@ static struct dev_pm_domain acpi_lpss_pm_domain = { |
270 |
+ .thaw_noirq = acpi_subsys_thaw_noirq, |
271 |
+ .poweroff = acpi_subsys_suspend, |
272 |
+ .poweroff_late = acpi_lpss_suspend_late, |
273 |
+- .poweroff_noirq = acpi_subsys_suspend_noirq, |
274 |
+- .restore_noirq = acpi_subsys_resume_noirq, |
275 |
++ .poweroff_noirq = acpi_lpss_suspend_noirq, |
276 |
++ .restore_noirq = acpi_lpss_resume_noirq, |
277 |
+ .restore_early = acpi_lpss_resume_early, |
278 |
+ #endif |
279 |
+ .runtime_suspend = acpi_lpss_runtime_suspend, |
280 |
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c |
281 |
+index b16a887bbd02..29bede887237 100644 |
282 |
+--- a/drivers/block/virtio_blk.c |
283 |
++++ b/drivers/block/virtio_blk.c |
284 |
+@@ -513,6 +513,8 @@ static int init_vq(struct virtio_blk *vblk) |
285 |
+ if (err) |
286 |
+ num_vqs = 1; |
287 |
+ |
288 |
++ num_vqs = min_t(unsigned int, nr_cpu_ids, num_vqs); |
289 |
++ |
290 |
+ vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL); |
291 |
+ if (!vblk->vqs) |
292 |
+ return -ENOMEM; |
293 |
+diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c |
294 |
+index ddbe518c3e5b..b5d31d583d60 100644 |
295 |
+--- a/drivers/bluetooth/hci_bcm.c |
296 |
++++ b/drivers/bluetooth/hci_bcm.c |
297 |
+@@ -228,9 +228,15 @@ static int bcm_gpio_set_power(struct bcm_device *dev, bool powered) |
298 |
+ int err; |
299 |
+ |
300 |
+ if (powered && !dev->res_enabled) { |
301 |
+- err = regulator_bulk_enable(BCM_NUM_SUPPLIES, dev->supplies); |
302 |
+- if (err) |
303 |
+- return err; |
304 |
++ /* Intel Macs use bcm_apple_get_resources() and don't |
305 |
++ * have regulator supplies configured. |
306 |
++ */ |
307 |
++ if (dev->supplies[0].supply) { |
308 |
++ err = regulator_bulk_enable(BCM_NUM_SUPPLIES, |
309 |
++ dev->supplies); |
310 |
++ if (err) |
311 |
++ return err; |
312 |
++ } |
313 |
+ |
314 |
+ /* LPO clock needs to be 32.768 kHz */ |
315 |
+ err = clk_set_rate(dev->lpo_clk, 32768); |
316 |
+@@ -259,7 +265,13 @@ static int bcm_gpio_set_power(struct bcm_device *dev, bool powered) |
317 |
+ if (!powered && dev->res_enabled) { |
318 |
+ clk_disable_unprepare(dev->txco_clk); |
319 |
+ clk_disable_unprepare(dev->lpo_clk); |
320 |
+- regulator_bulk_disable(BCM_NUM_SUPPLIES, dev->supplies); |
321 |
++ |
322 |
++ /* Intel Macs use bcm_apple_get_resources() and don't |
323 |
++ * have regulator supplies configured. |
324 |
++ */ |
325 |
++ if (dev->supplies[0].supply) |
326 |
++ regulator_bulk_disable(BCM_NUM_SUPPLIES, |
327 |
++ dev->supplies); |
328 |
+ } |
329 |
+ |
330 |
+ /* wait for device to power on and come out of reset */ |
331 |
+diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c |
332 |
+index 65f2599e5243..08824b2cd142 100644 |
333 |
+--- a/drivers/clk/meson/gxbb.c |
334 |
++++ b/drivers/clk/meson/gxbb.c |
335 |
+@@ -2213,6 +2213,7 @@ static struct clk_regmap gxbb_vdec_1_div = { |
336 |
+ .offset = HHI_VDEC_CLK_CNTL, |
337 |
+ .shift = 0, |
338 |
+ .width = 7, |
339 |
++ .flags = CLK_DIVIDER_ROUND_CLOSEST, |
340 |
+ }, |
341 |
+ .hw.init = &(struct clk_init_data){ |
342 |
+ .name = "vdec_1_div", |
343 |
+@@ -2258,6 +2259,7 @@ static struct clk_regmap gxbb_vdec_hevc_div = { |
344 |
+ .offset = HHI_VDEC2_CLK_CNTL, |
345 |
+ .shift = 16, |
346 |
+ .width = 7, |
347 |
++ .flags = CLK_DIVIDER_ROUND_CLOSEST, |
348 |
+ }, |
349 |
+ .hw.init = &(struct clk_init_data){ |
350 |
+ .name = "vdec_hevc_div", |
351 |
+diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c |
352 |
+index 75491fc841a6..0df16eb1eb3c 100644 |
353 |
+--- a/drivers/cpufreq/armada-37xx-cpufreq.c |
354 |
++++ b/drivers/cpufreq/armada-37xx-cpufreq.c |
355 |
+@@ -359,11 +359,11 @@ static int __init armada37xx_cpufreq_driver_init(void) |
356 |
+ struct armada_37xx_dvfs *dvfs; |
357 |
+ struct platform_device *pdev; |
358 |
+ unsigned long freq; |
359 |
+- unsigned int cur_frequency; |
360 |
++ unsigned int cur_frequency, base_frequency; |
361 |
+ struct regmap *nb_pm_base, *avs_base; |
362 |
+ struct device *cpu_dev; |
363 |
+ int load_lvl, ret; |
364 |
+- struct clk *clk; |
365 |
++ struct clk *clk, *parent; |
366 |
+ |
367 |
+ nb_pm_base = |
368 |
+ syscon_regmap_lookup_by_compatible("marvell,armada-3700-nb-pm"); |
369 |
+@@ -399,6 +399,22 @@ static int __init armada37xx_cpufreq_driver_init(void) |
370 |
+ return PTR_ERR(clk); |
371 |
+ } |
372 |
+ |
373 |
++ parent = clk_get_parent(clk); |
374 |
++ if (IS_ERR(parent)) { |
375 |
++ dev_err(cpu_dev, "Cannot get parent clock for CPU0\n"); |
376 |
++ clk_put(clk); |
377 |
++ return PTR_ERR(parent); |
378 |
++ } |
379 |
++ |
380 |
++ /* Get parent CPU frequency */ |
381 |
++ base_frequency = clk_get_rate(parent); |
382 |
++ |
383 |
++ if (!base_frequency) { |
384 |
++ dev_err(cpu_dev, "Failed to get parent clock rate for CPU\n"); |
385 |
++ clk_put(clk); |
386 |
++ return -EINVAL; |
387 |
++ } |
388 |
++ |
389 |
+ /* Get nominal (current) CPU frequency */ |
390 |
+ cur_frequency = clk_get_rate(clk); |
391 |
+ if (!cur_frequency) { |
392 |
+@@ -431,7 +447,7 @@ static int __init armada37xx_cpufreq_driver_init(void) |
393 |
+ for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR; |
394 |
+ load_lvl++) { |
395 |
+ unsigned long u_volt = avs_map[dvfs->avs[load_lvl]] * 1000; |
396 |
+- freq = cur_frequency / dvfs->divider[load_lvl]; |
397 |
++ freq = base_frequency / dvfs->divider[load_lvl]; |
398 |
+ ret = dev_pm_opp_add(cpu_dev, freq, u_volt); |
399 |
+ if (ret) |
400 |
+ goto remove_opp; |
401 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
402 |
+index 7ff3a28fc903..d55dd570a702 100644 |
403 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
404 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
405 |
+@@ -3158,11 +3158,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) |
406 |
+ break; |
407 |
+ |
408 |
+ if (fence) { |
409 |
+- r = dma_fence_wait_timeout(fence, false, tmo); |
410 |
++ tmo = dma_fence_wait_timeout(fence, false, tmo); |
411 |
+ dma_fence_put(fence); |
412 |
+ fence = next; |
413 |
+- if (r <= 0) |
414 |
++ if (tmo == 0) { |
415 |
++ r = -ETIMEDOUT; |
416 |
+ break; |
417 |
++ } else if (tmo < 0) { |
418 |
++ r = tmo; |
419 |
++ break; |
420 |
++ } |
421 |
+ } else { |
422 |
+ fence = next; |
423 |
+ } |
424 |
+@@ -3173,8 +3178,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) |
425 |
+ tmo = dma_fence_wait_timeout(fence, false, tmo); |
426 |
+ dma_fence_put(fence); |
427 |
+ |
428 |
+- if (r <= 0 || tmo <= 0) { |
429 |
+- DRM_ERROR("recover vram bo from shadow failed\n"); |
430 |
++ if (r < 0 || tmo <= 0) { |
431 |
++ DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo); |
432 |
+ return -EIO; |
433 |
+ } |
434 |
+ |
435 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c |
436 |
+index c48207b377bc..b82c5fca217b 100644 |
437 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c |
438 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c |
439 |
+@@ -35,6 +35,7 @@ |
440 |
+ #include "amdgpu_trace.h" |
441 |
+ |
442 |
+ #define AMDGPU_IB_TEST_TIMEOUT msecs_to_jiffies(1000) |
443 |
++#define AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT msecs_to_jiffies(2000) |
444 |
+ |
445 |
+ /* |
446 |
+ * IB |
447 |
+@@ -344,6 +345,8 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev) |
448 |
+ * cost waiting for it coming back under RUNTIME only |
449 |
+ */ |
450 |
+ tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT; |
451 |
++ } else if (adev->gmc.xgmi.hive_id) { |
452 |
++ tmo_gfx = AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT; |
453 |
+ } |
454 |
+ |
455 |
+ for (i = 0; i < adev->num_rings; ++i) { |
456 |
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
457 |
+index 8be9677c0c07..cf9a49f49d3a 100644 |
458 |
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
459 |
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c |
460 |
+@@ -320,6 +320,7 @@ static const struct kfd_deviceid supported_devices[] = { |
461 |
+ { 0x9876, &carrizo_device_info }, /* Carrizo */ |
462 |
+ { 0x9877, &carrizo_device_info }, /* Carrizo */ |
463 |
+ { 0x15DD, &raven_device_info }, /* Raven */ |
464 |
++ { 0x15D8, &raven_device_info }, /* Raven */ |
465 |
+ #endif |
466 |
+ { 0x67A0, &hawaii_device_info }, /* Hawaii */ |
467 |
+ { 0x67A1, &hawaii_device_info }, /* Hawaii */ |
468 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
469 |
+index 83c8a0407537..84ee77786944 100644 |
470 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
471 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
472 |
+@@ -4455,6 +4455,7 @@ static void handle_cursor_update(struct drm_plane *plane, |
473 |
+ amdgpu_crtc->cursor_width = plane->state->crtc_w; |
474 |
+ amdgpu_crtc->cursor_height = plane->state->crtc_h; |
475 |
+ |
476 |
++ memset(&attributes, 0, sizeof(attributes)); |
477 |
+ attributes.address.high_part = upper_32_bits(address); |
478 |
+ attributes.address.low_part = lower_32_bits(address); |
479 |
+ attributes.width = plane->state->crtc_w; |
480 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c |
481 |
+index 62a9d47df948..9160c55769f8 100644 |
482 |
+--- a/drivers/gpu/drm/mediatek/mtk_dpi.c |
483 |
++++ b/drivers/gpu/drm/mediatek/mtk_dpi.c |
484 |
+@@ -662,13 +662,11 @@ static unsigned int mt8173_calculate_factor(int clock) |
485 |
+ static unsigned int mt2701_calculate_factor(int clock) |
486 |
+ { |
487 |
+ if (clock <= 64000) |
488 |
+- return 16; |
489 |
+- else if (clock <= 128000) |
490 |
+- return 8; |
491 |
+- else if (clock <= 256000) |
492 |
+ return 4; |
493 |
+- else |
494 |
++ else if (clock <= 128000) |
495 |
+ return 2; |
496 |
++ else |
497 |
++ return 1; |
498 |
+ } |
499 |
+ |
500 |
+ static const struct mtk_dpi_conf mt8173_conf = { |
501 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c |
502 |
+index 862f3ec22131..a687fe3e1d6c 100644 |
503 |
+--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c |
504 |
++++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c |
505 |
+@@ -1479,7 +1479,6 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, |
506 |
+ if (IS_ERR(regmap)) |
507 |
+ ret = PTR_ERR(regmap); |
508 |
+ if (ret) { |
509 |
+- ret = PTR_ERR(regmap); |
510 |
+ dev_err(dev, |
511 |
+ "Failed to get system configuration registers: %d\n", |
512 |
+ ret); |
513 |
+@@ -1515,6 +1514,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, |
514 |
+ of_node_put(remote); |
515 |
+ |
516 |
+ hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np); |
517 |
++ of_node_put(i2c_np); |
518 |
+ if (!hdmi->ddc_adpt) { |
519 |
+ dev_err(dev, "Failed to get ddc i2c adapter by node\n"); |
520 |
+ return -EINVAL; |
521 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
522 |
+index 4ef9c57ffd44..5223498502c4 100644 |
523 |
+--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
524 |
++++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c |
525 |
+@@ -15,28 +15,6 @@ static const struct phy_ops mtk_hdmi_phy_dev_ops = { |
526 |
+ .owner = THIS_MODULE, |
527 |
+ }; |
528 |
+ |
529 |
+-long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
530 |
+- unsigned long *parent_rate) |
531 |
+-{ |
532 |
+- struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); |
533 |
+- |
534 |
+- hdmi_phy->pll_rate = rate; |
535 |
+- if (rate <= 74250000) |
536 |
+- *parent_rate = rate; |
537 |
+- else |
538 |
+- *parent_rate = rate / 2; |
539 |
+- |
540 |
+- return rate; |
541 |
+-} |
542 |
+- |
543 |
+-unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, |
544 |
+- unsigned long parent_rate) |
545 |
+-{ |
546 |
+- struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); |
547 |
+- |
548 |
+- return hdmi_phy->pll_rate; |
549 |
+-} |
550 |
+- |
551 |
+ void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, |
552 |
+ u32 bits) |
553 |
+ { |
554 |
+@@ -110,13 +88,11 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) |
555 |
+ return NULL; |
556 |
+ } |
557 |
+ |
558 |
+-static void mtk_hdmi_phy_clk_get_ops(struct mtk_hdmi_phy *hdmi_phy, |
559 |
+- const struct clk_ops **ops) |
560 |
++static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy, |
561 |
++ struct clk_init_data *clk_init) |
562 |
+ { |
563 |
+- if (hdmi_phy && hdmi_phy->conf && hdmi_phy->conf->hdmi_phy_clk_ops) |
564 |
+- *ops = hdmi_phy->conf->hdmi_phy_clk_ops; |
565 |
+- else |
566 |
+- dev_err(hdmi_phy->dev, "Failed to get clk ops of phy\n"); |
567 |
++ clk_init->flags = hdmi_phy->conf->flags; |
568 |
++ clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; |
569 |
+ } |
570 |
+ |
571 |
+ static int mtk_hdmi_phy_probe(struct platform_device *pdev) |
572 |
+@@ -129,7 +105,6 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) |
573 |
+ struct clk_init_data clk_init = { |
574 |
+ .num_parents = 1, |
575 |
+ .parent_names = (const char * const *)&ref_clk_name, |
576 |
+- .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, |
577 |
+ }; |
578 |
+ |
579 |
+ struct phy *phy; |
580 |
+@@ -167,7 +142,7 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) |
581 |
+ hdmi_phy->dev = dev; |
582 |
+ hdmi_phy->conf = |
583 |
+ (struct mtk_hdmi_phy_conf *)of_device_get_match_data(dev); |
584 |
+- mtk_hdmi_phy_clk_get_ops(hdmi_phy, &clk_init.ops); |
585 |
++ mtk_hdmi_phy_clk_get_data(hdmi_phy, &clk_init); |
586 |
+ hdmi_phy->pll_hw.init = &clk_init; |
587 |
+ hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); |
588 |
+ if (IS_ERR(hdmi_phy->pll)) { |
589 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |
590 |
+index f39b1fc66612..2d8b3182470d 100644 |
591 |
+--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |
592 |
++++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h |
593 |
+@@ -21,6 +21,7 @@ struct mtk_hdmi_phy; |
594 |
+ |
595 |
+ struct mtk_hdmi_phy_conf { |
596 |
+ bool tz_disabled; |
597 |
++ unsigned long flags; |
598 |
+ const struct clk_ops *hdmi_phy_clk_ops; |
599 |
+ void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); |
600 |
+ void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); |
601 |
+@@ -48,10 +49,6 @@ void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, |
602 |
+ void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset, |
603 |
+ u32 val, u32 mask); |
604 |
+ struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw); |
605 |
+-long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
606 |
+- unsigned long *parent_rate); |
607 |
+-unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, |
608 |
+- unsigned long parent_rate); |
609 |
+ |
610 |
+ extern struct platform_driver mtk_hdmi_phy_driver; |
611 |
+ extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf; |
612 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c |
613 |
+index fcc42dc6ea7f..d3cc4022e988 100644 |
614 |
+--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c |
615 |
++++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c |
616 |
+@@ -79,7 +79,6 @@ static int mtk_hdmi_pll_prepare(struct clk_hw *hw) |
617 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
618 |
+ usleep_range(80, 100); |
619 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
620 |
+- mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); |
621 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
622 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
623 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
624 |
+@@ -94,7 +93,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) |
625 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
626 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
627 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
628 |
+- mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); |
629 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
630 |
+ usleep_range(80, 100); |
631 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
632 |
+@@ -108,6 +106,12 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) |
633 |
+ usleep_range(80, 100); |
634 |
+ } |
635 |
+ |
636 |
++static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
637 |
++ unsigned long *parent_rate) |
638 |
++{ |
639 |
++ return rate; |
640 |
++} |
641 |
++ |
642 |
+ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
643 |
+ unsigned long parent_rate) |
644 |
+ { |
645 |
+@@ -116,13 +120,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
646 |
+ |
647 |
+ if (rate <= 64000000) |
648 |
+ pos_div = 3; |
649 |
+- else if (rate <= 12800000) |
650 |
+- pos_div = 1; |
651 |
++ else if (rate <= 128000000) |
652 |
++ pos_div = 2; |
653 |
+ else |
654 |
+ pos_div = 1; |
655 |
+ |
656 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_PREDIV_MASK); |
657 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_POSDIV_MASK); |
658 |
++ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); |
659 |
+ mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IC), |
660 |
+ RG_HTPLL_IC_MASK); |
661 |
+ mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IR), |
662 |
+@@ -154,6 +159,39 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
663 |
+ return 0; |
664 |
+ } |
665 |
+ |
666 |
++static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, |
667 |
++ unsigned long parent_rate) |
668 |
++{ |
669 |
++ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); |
670 |
++ unsigned long out_rate, val; |
671 |
++ |
672 |
++ val = (readl(hdmi_phy->regs + HDMI_CON6) |
673 |
++ & RG_HTPLL_PREDIV_MASK) >> RG_HTPLL_PREDIV; |
674 |
++ switch (val) { |
675 |
++ case 0x00: |
676 |
++ out_rate = parent_rate; |
677 |
++ break; |
678 |
++ case 0x01: |
679 |
++ out_rate = parent_rate / 2; |
680 |
++ break; |
681 |
++ default: |
682 |
++ out_rate = parent_rate / 4; |
683 |
++ break; |
684 |
++ } |
685 |
++ |
686 |
++ val = (readl(hdmi_phy->regs + HDMI_CON6) |
687 |
++ & RG_HTPLL_FBKDIV_MASK) >> RG_HTPLL_FBKDIV; |
688 |
++ out_rate *= (val + 1) * 2; |
689 |
++ val = (readl(hdmi_phy->regs + HDMI_CON2) |
690 |
++ & RG_HDMITX_TX_POSDIV_MASK); |
691 |
++ out_rate >>= (val >> RG_HDMITX_TX_POSDIV); |
692 |
++ |
693 |
++ if (readl(hdmi_phy->regs + HDMI_CON2) & RG_HDMITX_EN_TX_POSDIV) |
694 |
++ out_rate /= 5; |
695 |
++ |
696 |
++ return out_rate; |
697 |
++} |
698 |
++ |
699 |
+ static const struct clk_ops mtk_hdmi_phy_pll_ops = { |
700 |
+ .prepare = mtk_hdmi_pll_prepare, |
701 |
+ .unprepare = mtk_hdmi_pll_unprepare, |
702 |
+@@ -174,7 +212,6 @@ static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy) |
703 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
704 |
+ usleep_range(80, 100); |
705 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
706 |
+- mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); |
707 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
708 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
709 |
+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
710 |
+@@ -186,7 +223,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) |
711 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK); |
712 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK); |
713 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK); |
714 |
+- mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV); |
715 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN); |
716 |
+ usleep_range(80, 100); |
717 |
+ mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK); |
718 |
+@@ -202,6 +238,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) |
719 |
+ |
720 |
+ struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = { |
721 |
+ .tz_disabled = true, |
722 |
++ .flags = CLK_SET_RATE_GATE, |
723 |
+ .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, |
724 |
+ .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, |
725 |
+ .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, |
726 |
+diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c |
727 |
+index ed5916b27658..47f8a2951682 100644 |
728 |
+--- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c |
729 |
++++ b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c |
730 |
+@@ -199,6 +199,20 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) |
731 |
+ usleep_range(100, 150); |
732 |
+ } |
733 |
+ |
734 |
++static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
735 |
++ unsigned long *parent_rate) |
736 |
++{ |
737 |
++ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); |
738 |
++ |
739 |
++ hdmi_phy->pll_rate = rate; |
740 |
++ if (rate <= 74250000) |
741 |
++ *parent_rate = rate; |
742 |
++ else |
743 |
++ *parent_rate = rate / 2; |
744 |
++ |
745 |
++ return rate; |
746 |
++} |
747 |
++ |
748 |
+ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
749 |
+ unsigned long parent_rate) |
750 |
+ { |
751 |
+@@ -285,6 +299,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
752 |
+ return 0; |
753 |
+ } |
754 |
+ |
755 |
++static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, |
756 |
++ unsigned long parent_rate) |
757 |
++{ |
758 |
++ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); |
759 |
++ |
760 |
++ return hdmi_phy->pll_rate; |
761 |
++} |
762 |
++ |
763 |
+ static const struct clk_ops mtk_hdmi_phy_pll_ops = { |
764 |
+ .prepare = mtk_hdmi_pll_prepare, |
765 |
+ .unprepare = mtk_hdmi_pll_unprepare, |
766 |
+@@ -309,6 +331,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) |
767 |
+ } |
768 |
+ |
769 |
+ struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf = { |
770 |
++ .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, |
771 |
+ .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, |
772 |
+ .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, |
773 |
+ .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds, |
774 |
+diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c |
775 |
+index 340383150fb9..ebf9c96d43ee 100644 |
776 |
+--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c |
777 |
++++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c |
778 |
+@@ -175,6 +175,7 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) |
779 |
+ REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3); |
780 |
+ hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE); |
781 |
+ hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE); |
782 |
++ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); |
783 |
+ hdmi4_core_disable(core); |
784 |
+ return 0; |
785 |
+ } |
786 |
+@@ -182,16 +183,24 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) |
787 |
+ if (err) |
788 |
+ return err; |
789 |
+ |
790 |
++ /* |
791 |
++ * Initialize CEC clock divider: CEC needs 2MHz clock hence |
792 |
++ * set the divider to 24 to get 48/24=2MHz clock |
793 |
++ */ |
794 |
++ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0); |
795 |
++ |
796 |
+ /* Clear TX FIFO */ |
797 |
+ if (!hdmi_cec_clear_tx_fifo(adap)) { |
798 |
+ pr_err("cec-%s: could not clear TX FIFO\n", adap->name); |
799 |
+- return -EIO; |
800 |
++ err = -EIO; |
801 |
++ goto err_disable_clk; |
802 |
+ } |
803 |
+ |
804 |
+ /* Clear RX FIFO */ |
805 |
+ if (!hdmi_cec_clear_rx_fifo(adap)) { |
806 |
+ pr_err("cec-%s: could not clear RX FIFO\n", adap->name); |
807 |
+- return -EIO; |
808 |
++ err = -EIO; |
809 |
++ goto err_disable_clk; |
810 |
+ } |
811 |
+ |
812 |
+ /* Clear CEC interrupts */ |
813 |
+@@ -236,6 +245,12 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) |
814 |
+ hdmi_write_reg(core->base, HDMI_CEC_INT_STATUS_1, temp); |
815 |
+ } |
816 |
+ return 0; |
817 |
++ |
818 |
++err_disable_clk: |
819 |
++ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); |
820 |
++ hdmi4_core_disable(core); |
821 |
++ |
822 |
++ return err; |
823 |
+ } |
824 |
+ |
825 |
+ static int hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) |
826 |
+@@ -333,11 +348,8 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core, |
827 |
+ return ret; |
828 |
+ core->wp = wp; |
829 |
+ |
830 |
+- /* |
831 |
+- * Initialize CEC clock divider: CEC needs 2MHz clock hence |
832 |
+- * set the devider to 24 to get 48/24=2MHz clock |
833 |
+- */ |
834 |
+- REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0); |
835 |
++ /* Disable clock initially, hdmi_cec_adap_enable() manages it */ |
836 |
++ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0); |
837 |
+ |
838 |
+ ret = cec_register_adapter(core->adap, &pdev->dev); |
839 |
+ if (ret < 0) { |
840 |
+diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
841 |
+index fc36e0c10a37..b1e7c76e9c17 100644 |
842 |
+--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
843 |
++++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c |
844 |
+@@ -227,7 +227,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, |
845 |
+ |
846 |
+ err_unregister_gates: |
847 |
+ for (i = 0; i < CLK_NUM; i++) |
848 |
+- if (clk_data->hws[i]) |
849 |
++ if (!IS_ERR_OR_NULL(clk_data->hws[i])) |
850 |
+ clk_hw_unregister_gate(clk_data->hws[i]); |
851 |
+ clk_disable_unprepare(tcon_top->bus); |
852 |
+ err_assert_reset: |
853 |
+@@ -245,7 +245,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, |
854 |
+ |
855 |
+ of_clk_del_provider(dev->of_node); |
856 |
+ for (i = 0; i < CLK_NUM; i++) |
857 |
+- clk_hw_unregister_gate(clk_data->hws[i]); |
858 |
++ if (clk_data->hws[i]) |
859 |
++ clk_hw_unregister_gate(clk_data->hws[i]); |
860 |
+ |
861 |
+ clk_disable_unprepare(tcon_top->bus); |
862 |
+ reset_control_assert(tcon_top->rst); |
863 |
+diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c |
864 |
+index 632d25674e7f..45653029ee18 100644 |
865 |
+--- a/drivers/hv/hv.c |
866 |
++++ b/drivers/hv/hv.c |
867 |
+@@ -408,7 +408,6 @@ int hv_synic_cleanup(unsigned int cpu) |
868 |
+ |
869 |
+ clockevents_unbind_device(hv_cpu->clk_evt, cpu); |
870 |
+ hv_ce_shutdown(hv_cpu->clk_evt); |
871 |
+- put_cpu_ptr(hv_cpu); |
872 |
+ } |
873 |
+ |
874 |
+ hv_get_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64); |
875 |
+diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c |
876 |
+index 1cf6290d6435..70f2cb90adc5 100644 |
877 |
+--- a/drivers/hwtracing/intel_th/pci.c |
878 |
++++ b/drivers/hwtracing/intel_th/pci.c |
879 |
+@@ -165,6 +165,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { |
880 |
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x34a6), |
881 |
+ .driver_data = (kernel_ulong_t)&intel_th_2x, |
882 |
+ }, |
883 |
++ { |
884 |
++ /* Comet Lake */ |
885 |
++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6), |
886 |
++ .driver_data = (kernel_ulong_t)&intel_th_2x, |
887 |
++ }, |
888 |
+ { 0 }, |
889 |
+ }; |
890 |
+ |
891 |
+diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c |
892 |
+index 1412abcff010..5f4bd52121fe 100644 |
893 |
+--- a/drivers/i3c/master.c |
894 |
++++ b/drivers/i3c/master.c |
895 |
+@@ -385,8 +385,9 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr, |
896 |
+ return; |
897 |
+ |
898 |
+ ptr = bus->addrslots + (bitpos / BITS_PER_LONG); |
899 |
+- *ptr &= ~(I3C_ADDR_SLOT_STATUS_MASK << (bitpos % BITS_PER_LONG)); |
900 |
+- *ptr |= status << (bitpos % BITS_PER_LONG); |
901 |
++ *ptr &= ~((unsigned long)I3C_ADDR_SLOT_STATUS_MASK << |
902 |
++ (bitpos % BITS_PER_LONG)); |
903 |
++ *ptr |= (unsigned long)status << (bitpos % BITS_PER_LONG); |
904 |
+ } |
905 |
+ |
906 |
+ static bool i3c_bus_dev_addr_is_avail(struct i3c_bus *bus, u8 addr) |
907 |
+diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c |
908 |
+index 6a866cc187f7..21fdcde77883 100644 |
909 |
+--- a/drivers/iio/adc/qcom-spmi-adc5.c |
910 |
++++ b/drivers/iio/adc/qcom-spmi-adc5.c |
911 |
+@@ -664,6 +664,7 @@ static const struct of_device_id adc5_match_table[] = { |
912 |
+ }, |
913 |
+ { } |
914 |
+ }; |
915 |
++MODULE_DEVICE_TABLE(of, adc5_match_table); |
916 |
+ |
917 |
+ static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) |
918 |
+ { |
919 |
+diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c |
920 |
+index b443642eac02..0ae05e9249b3 100644 |
921 |
+--- a/drivers/infiniband/hw/hfi1/chip.c |
922 |
++++ b/drivers/infiniband/hw/hfi1/chip.c |
923 |
+@@ -13219,7 +13219,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd) |
924 |
+ int total_contexts; |
925 |
+ int ret; |
926 |
+ unsigned ngroups; |
927 |
+- int qos_rmt_count; |
928 |
++ int rmt_count; |
929 |
+ int user_rmt_reduced; |
930 |
+ u32 n_usr_ctxts; |
931 |
+ u32 send_contexts = chip_send_contexts(dd); |
932 |
+@@ -13281,10 +13281,20 @@ static int set_up_context_variables(struct hfi1_devdata *dd) |
933 |
+ n_usr_ctxts = rcv_contexts - total_contexts; |
934 |
+ } |
935 |
+ |
936 |
+- /* each user context requires an entry in the RMT */ |
937 |
+- qos_rmt_count = qos_rmt_entries(dd, NULL, NULL); |
938 |
+- if (qos_rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) { |
939 |
+- user_rmt_reduced = NUM_MAP_ENTRIES - qos_rmt_count; |
940 |
++ /* |
941 |
++ * The RMT entries are currently allocated as shown below: |
942 |
++ * 1. QOS (0 to 128 entries); |
943 |
++ * 2. FECN for PSM (num_user_contexts + num_vnic_contexts); |
944 |
++ * 3. VNIC (num_vnic_contexts). |
945 |
++ * It should be noted that PSM FECN oversubscribe num_vnic_contexts |
946 |
++ * entries of RMT because both VNIC and PSM could allocate any receive |
947 |
++ * context between dd->first_dyn_alloc_text and dd->num_rcv_contexts, |
948 |
++ * and PSM FECN must reserve an RMT entry for each possible PSM receive |
949 |
++ * context. |
950 |
++ */ |
951 |
++ rmt_count = qos_rmt_entries(dd, NULL, NULL) + (num_vnic_contexts * 2); |
952 |
++ if (rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) { |
953 |
++ user_rmt_reduced = NUM_MAP_ENTRIES - rmt_count; |
954 |
+ dd_dev_err(dd, |
955 |
+ "RMT size is reducing the number of user receive contexts from %u to %d\n", |
956 |
+ n_usr_ctxts, |
957 |
+@@ -14272,9 +14282,11 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, |
958 |
+ u64 reg; |
959 |
+ int i, idx, regoff, regidx; |
960 |
+ u8 offset; |
961 |
++ u32 total_cnt; |
962 |
+ |
963 |
+ /* there needs to be enough room in the map table */ |
964 |
+- if (rmt->used + dd->num_user_contexts >= NUM_MAP_ENTRIES) { |
965 |
++ total_cnt = dd->num_rcv_contexts - dd->first_dyn_alloc_ctxt; |
966 |
++ if (rmt->used + total_cnt >= NUM_MAP_ENTRIES) { |
967 |
+ dd_dev_err(dd, "User FECN handling disabled - too many user contexts allocated\n"); |
968 |
+ return; |
969 |
+ } |
970 |
+@@ -14328,7 +14340,7 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, |
971 |
+ /* add rule 1 */ |
972 |
+ add_rsm_rule(dd, RSM_INS_FECN, &rrd); |
973 |
+ |
974 |
+- rmt->used += dd->num_user_contexts; |
975 |
++ rmt->used += total_cnt; |
976 |
+ } |
977 |
+ |
978 |
+ /* Initialize RSM for VNIC */ |
979 |
+diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c |
980 |
+index 5866f358ea04..df8e812804b3 100644 |
981 |
+--- a/drivers/infiniband/hw/hfi1/qp.c |
982 |
++++ b/drivers/infiniband/hw/hfi1/qp.c |
983 |
+@@ -834,6 +834,8 @@ void notify_error_qp(struct rvt_qp *qp) |
984 |
+ if (!list_empty(&priv->s_iowait.list) && |
985 |
+ !(qp->s_flags & RVT_S_BUSY)) { |
986 |
+ qp->s_flags &= ~HFI1_S_ANY_WAIT_IO; |
987 |
++ iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_IB); |
988 |
++ iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_TID); |
989 |
+ list_del_init(&priv->s_iowait.list); |
990 |
+ priv->s_iowait.lock = NULL; |
991 |
+ rvt_put_qp(qp); |
992 |
+diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c |
993 |
+index be603f35d7e4..cfde43b1df96 100644 |
994 |
+--- a/drivers/infiniband/hw/hfi1/rc.c |
995 |
++++ b/drivers/infiniband/hw/hfi1/rc.c |
996 |
+@@ -2302,7 +2302,7 @@ send_last: |
997 |
+ update_ack_queue(qp, next); |
998 |
+ } |
999 |
+ e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
1000 |
+- if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { |
1001 |
++ if (e->rdma_sge.mr) { |
1002 |
+ rvt_put_mr(e->rdma_sge.mr); |
1003 |
+ e->rdma_sge.mr = NULL; |
1004 |
+ } |
1005 |
+@@ -2376,7 +2376,7 @@ send_last: |
1006 |
+ update_ack_queue(qp, next); |
1007 |
+ } |
1008 |
+ e = &qp->s_ack_queue[qp->r_head_ack_queue]; |
1009 |
+- if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) { |
1010 |
++ if (e->rdma_sge.mr) { |
1011 |
+ rvt_put_mr(e->rdma_sge.mr); |
1012 |
+ e->rdma_sge.mr = NULL; |
1013 |
+ } |
1014 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c |
1015 |
+index 4cdbcafa5915..cae23364cfea 100644 |
1016 |
+--- a/drivers/infiniband/hw/hns/hns_roce_hem.c |
1017 |
++++ b/drivers/infiniband/hw/hns/hns_roce_hem.c |
1018 |
+@@ -763,6 +763,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, |
1019 |
+ idx_offset = (obj & (table->num_obj - 1)) % obj_per_chunk; |
1020 |
+ dma_offset = offset = idx_offset * table->obj_size; |
1021 |
+ } else { |
1022 |
++ u32 seg_size = 64; /* 8 bytes per BA and 8 BA per segment */ |
1023 |
++ |
1024 |
+ hns_roce_calc_hem_mhop(hr_dev, table, &mhop_obj, &mhop); |
1025 |
+ /* mtt mhop */ |
1026 |
+ i = mhop.l0_idx; |
1027 |
+@@ -774,8 +776,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, |
1028 |
+ hem_idx = i; |
1029 |
+ |
1030 |
+ hem = table->hem[hem_idx]; |
1031 |
+- dma_offset = offset = (obj & (table->num_obj - 1)) * |
1032 |
+- table->obj_size % mhop.bt_chunk_size; |
1033 |
++ dma_offset = offset = (obj & (table->num_obj - 1)) * seg_size % |
1034 |
++ mhop.bt_chunk_size; |
1035 |
+ if (mhop.hop_num == 2) |
1036 |
+ dma_offset = offset = 0; |
1037 |
+ } |
1038 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c |
1039 |
+index ee5991bd4171..dd4bb0ec6113 100644 |
1040 |
+--- a/drivers/infiniband/hw/hns/hns_roce_mr.c |
1041 |
++++ b/drivers/infiniband/hw/hns/hns_roce_mr.c |
1042 |
+@@ -746,7 +746,6 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, |
1043 |
+ struct hns_roce_hem_table *table; |
1044 |
+ dma_addr_t dma_handle; |
1045 |
+ __le64 *mtts; |
1046 |
+- u32 s = start_index * sizeof(u64); |
1047 |
+ u32 bt_page_size; |
1048 |
+ u32 i; |
1049 |
+ |
1050 |
+@@ -780,7 +779,8 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, |
1051 |
+ return -EINVAL; |
1052 |
+ |
1053 |
+ mtts = hns_roce_table_find(hr_dev, table, |
1054 |
+- mtt->first_seg + s / hr_dev->caps.mtt_entry_sz, |
1055 |
++ mtt->first_seg + |
1056 |
++ start_index / HNS_ROCE_MTT_ENTRY_PER_SEG, |
1057 |
+ &dma_handle); |
1058 |
+ if (!mtts) |
1059 |
+ return -ENOMEM; |
1060 |
+diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
1061 |
+index 39c37b6fd715..76b8dda40edd 100644 |
1062 |
+--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
1063 |
++++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |
1064 |
+@@ -1125,6 +1125,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev) |
1065 |
+ pvrdma_page_dir_cleanup(dev, &dev->cq_pdir); |
1066 |
+ pvrdma_page_dir_cleanup(dev, &dev->async_pdir); |
1067 |
+ pvrdma_free_slots(dev); |
1068 |
++ dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr, |
1069 |
++ dev->dsrbase); |
1070 |
+ |
1071 |
+ iounmap(dev->regs); |
1072 |
+ kfree(dev->sgid_tbl); |
1073 |
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c |
1074 |
+index 84fa5b22371e..e8a2efe0afce 100644 |
1075 |
+--- a/drivers/iommu/amd_iommu_init.c |
1076 |
++++ b/drivers/iommu/amd_iommu_init.c |
1077 |
+@@ -358,7 +358,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val) |
1078 |
+ static void iommu_set_exclusion_range(struct amd_iommu *iommu) |
1079 |
+ { |
1080 |
+ u64 start = iommu->exclusion_start & PAGE_MASK; |
1081 |
+- u64 limit = (start + iommu->exclusion_length) & PAGE_MASK; |
1082 |
++ u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK; |
1083 |
+ u64 entry; |
1084 |
+ |
1085 |
+ if (!iommu->exclusion_start) |
1086 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1087 |
+index b7dd4e3c760d..6d690678c20e 100644 |
1088 |
+--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1089 |
++++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c |
1090 |
+@@ -140,7 +140,7 @@ static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, |
1091 |
+ p->des0 |= cpu_to_le32(RDES0_OWN); |
1092 |
+ |
1093 |
+ bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); |
1094 |
+- p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK); |
1095 |
++ p->des1 |= cpu_to_le32(bfsize1 & RDES1_BUFFER1_SIZE_MASK); |
1096 |
+ |
1097 |
+ if (mode == STMMAC_CHAIN_MODE) |
1098 |
+ ndesc_rx_set_on_chain(p, end); |
1099 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1100 |
+index 6a9dd68c0f4f..4c4413ad3ceb 100644 |
1101 |
+--- a/drivers/nvme/host/core.c |
1102 |
++++ b/drivers/nvme/host/core.c |
1103 |
+@@ -291,7 +291,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) |
1104 |
+ "Cancelling I/O %d", req->tag); |
1105 |
+ |
1106 |
+ nvme_req(req)->status = NVME_SC_ABORT_REQ; |
1107 |
+- blk_mq_complete_request(req); |
1108 |
++ blk_mq_complete_request_sync(req); |
1109 |
+ return true; |
1110 |
+ } |
1111 |
+ EXPORT_SYMBOL_GPL(nvme_cancel_request); |
1112 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
1113 |
+index c37d5bbd72ab..8625b73d94bf 100644 |
1114 |
+--- a/drivers/nvme/host/fc.c |
1115 |
++++ b/drivers/nvme/host/fc.c |
1116 |
+@@ -1857,7 +1857,7 @@ nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) |
1117 |
+ memset(queue, 0, sizeof(*queue)); |
1118 |
+ queue->ctrl = ctrl; |
1119 |
+ queue->qnum = idx; |
1120 |
+- atomic_set(&queue->csn, 1); |
1121 |
++ atomic_set(&queue->csn, 0); |
1122 |
+ queue->dev = ctrl->dev; |
1123 |
+ |
1124 |
+ if (idx > 0) |
1125 |
+@@ -1899,7 +1899,7 @@ nvme_fc_free_queue(struct nvme_fc_queue *queue) |
1126 |
+ */ |
1127 |
+ |
1128 |
+ queue->connection_id = 0; |
1129 |
+- atomic_set(&queue->csn, 1); |
1130 |
++ atomic_set(&queue->csn, 0); |
1131 |
+ } |
1132 |
+ |
1133 |
+ static void |
1134 |
+@@ -2195,7 +2195,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, |
1135 |
+ { |
1136 |
+ struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu; |
1137 |
+ struct nvme_command *sqe = &cmdiu->sqe; |
1138 |
+- u32 csn; |
1139 |
+ int ret, opstate; |
1140 |
+ |
1141 |
+ /* |
1142 |
+@@ -2210,8 +2209,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, |
1143 |
+ |
1144 |
+ /* format the FC-NVME CMD IU and fcp_req */ |
1145 |
+ cmdiu->connection_id = cpu_to_be64(queue->connection_id); |
1146 |
+- csn = atomic_inc_return(&queue->csn); |
1147 |
+- cmdiu->csn = cpu_to_be32(csn); |
1148 |
+ cmdiu->data_len = cpu_to_be32(data_len); |
1149 |
+ switch (io_dir) { |
1150 |
+ case NVMEFC_FCP_WRITE: |
1151 |
+@@ -2269,11 +2266,24 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, |
1152 |
+ if (!(op->flags & FCOP_FLAGS_AEN)) |
1153 |
+ blk_mq_start_request(op->rq); |
1154 |
+ |
1155 |
++ cmdiu->csn = cpu_to_be32(atomic_inc_return(&queue->csn)); |
1156 |
+ ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport, |
1157 |
+ &ctrl->rport->remoteport, |
1158 |
+ queue->lldd_handle, &op->fcp_req); |
1159 |
+ |
1160 |
+ if (ret) { |
1161 |
++ /* |
1162 |
++ * If the lld fails to send the command is there an issue with |
1163 |
++ * the csn value? If the command that fails is the Connect, |
1164 |
++ * no - as the connection won't be live. If it is a command |
1165 |
++ * post-connect, it's possible a gap in csn may be created. |
1166 |
++ * Does this matter? As Linux initiators don't send fused |
1167 |
++ * commands, no. The gap would exist, but as there's nothing |
1168 |
++ * that depends on csn order to be delivered on the target |
1169 |
++ * side, it shouldn't hurt. It would be difficult for a |
1170 |
++ * target to even detect the csn gap as it has no idea when the |
1171 |
++ * cmd with the csn was supposed to arrive. |
1172 |
++ */ |
1173 |
+ opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE); |
1174 |
+ __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); |
1175 |
+ |
1176 |
+diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c |
1177 |
+index 11baeb14c388..8fdae510c5ac 100644 |
1178 |
+--- a/drivers/nvme/target/admin-cmd.c |
1179 |
++++ b/drivers/nvme/target/admin-cmd.c |
1180 |
+@@ -32,6 +32,11 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd) |
1181 |
+ return len; |
1182 |
+ } |
1183 |
+ |
1184 |
++u64 nvmet_get_log_page_offset(struct nvme_command *cmd) |
1185 |
++{ |
1186 |
++ return le64_to_cpu(cmd->get_log_page.lpo); |
1187 |
++} |
1188 |
++ |
1189 |
+ static void nvmet_execute_get_log_page_noop(struct nvmet_req *req) |
1190 |
+ { |
1191 |
+ nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len)); |
1192 |
+diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c |
1193 |
+index d2cb71a0b419..389c1a90197d 100644 |
1194 |
+--- a/drivers/nvme/target/discovery.c |
1195 |
++++ b/drivers/nvme/target/discovery.c |
1196 |
+@@ -139,54 +139,76 @@ static void nvmet_set_disc_traddr(struct nvmet_req *req, struct nvmet_port *port |
1197 |
+ memcpy(traddr, port->disc_addr.traddr, NVMF_TRADDR_SIZE); |
1198 |
+ } |
1199 |
+ |
1200 |
++static size_t discovery_log_entries(struct nvmet_req *req) |
1201 |
++{ |
1202 |
++ struct nvmet_ctrl *ctrl = req->sq->ctrl; |
1203 |
++ struct nvmet_subsys_link *p; |
1204 |
++ struct nvmet_port *r; |
1205 |
++ size_t entries = 0; |
1206 |
++ |
1207 |
++ list_for_each_entry(p, &req->port->subsystems, entry) { |
1208 |
++ if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn)) |
1209 |
++ continue; |
1210 |
++ entries++; |
1211 |
++ } |
1212 |
++ list_for_each_entry(r, &req->port->referrals, entry) |
1213 |
++ entries++; |
1214 |
++ return entries; |
1215 |
++} |
1216 |
++ |
1217 |
+ static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) |
1218 |
+ { |
1219 |
+ const int entry_size = sizeof(struct nvmf_disc_rsp_page_entry); |
1220 |
+ struct nvmet_ctrl *ctrl = req->sq->ctrl; |
1221 |
+ struct nvmf_disc_rsp_page_hdr *hdr; |
1222 |
++ u64 offset = nvmet_get_log_page_offset(req->cmd); |
1223 |
+ size_t data_len = nvmet_get_log_page_len(req->cmd); |
1224 |
+- size_t alloc_len = max(data_len, sizeof(*hdr)); |
1225 |
+- int residual_len = data_len - sizeof(*hdr); |
1226 |
++ size_t alloc_len; |
1227 |
+ struct nvmet_subsys_link *p; |
1228 |
+ struct nvmet_port *r; |
1229 |
+ u32 numrec = 0; |
1230 |
+ u16 status = 0; |
1231 |
++ void *buffer; |
1232 |
++ |
1233 |
++ /* Spec requires dword aligned offsets */ |
1234 |
++ if (offset & 0x3) { |
1235 |
++ status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; |
1236 |
++ goto out; |
1237 |
++ } |
1238 |
+ |
1239 |
+ /* |
1240 |
+ * Make sure we're passing at least a buffer of response header size. |
1241 |
+ * If host provided data len is less than the header size, only the |
1242 |
+ * number of bytes requested by host will be sent to host. |
1243 |
+ */ |
1244 |
+- hdr = kzalloc(alloc_len, GFP_KERNEL); |
1245 |
+- if (!hdr) { |
1246 |
++ down_read(&nvmet_config_sem); |
1247 |
++ alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req); |
1248 |
++ buffer = kzalloc(alloc_len, GFP_KERNEL); |
1249 |
++ if (!buffer) { |
1250 |
++ up_read(&nvmet_config_sem); |
1251 |
+ status = NVME_SC_INTERNAL; |
1252 |
+ goto out; |
1253 |
+ } |
1254 |
+ |
1255 |
+- down_read(&nvmet_config_sem); |
1256 |
++ hdr = buffer; |
1257 |
+ list_for_each_entry(p, &req->port->subsystems, entry) { |
1258 |
++ char traddr[NVMF_TRADDR_SIZE]; |
1259 |
++ |
1260 |
+ if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn)) |
1261 |
+ continue; |
1262 |
+- if (residual_len >= entry_size) { |
1263 |
+- char traddr[NVMF_TRADDR_SIZE]; |
1264 |
+- |
1265 |
+- nvmet_set_disc_traddr(req, req->port, traddr); |
1266 |
+- nvmet_format_discovery_entry(hdr, req->port, |
1267 |
+- p->subsys->subsysnqn, traddr, |
1268 |
+- NVME_NQN_NVME, numrec); |
1269 |
+- residual_len -= entry_size; |
1270 |
+- } |
1271 |
++ |
1272 |
++ nvmet_set_disc_traddr(req, req->port, traddr); |
1273 |
++ nvmet_format_discovery_entry(hdr, req->port, |
1274 |
++ p->subsys->subsysnqn, traddr, |
1275 |
++ NVME_NQN_NVME, numrec); |
1276 |
+ numrec++; |
1277 |
+ } |
1278 |
+ |
1279 |
+ list_for_each_entry(r, &req->port->referrals, entry) { |
1280 |
+- if (residual_len >= entry_size) { |
1281 |
+- nvmet_format_discovery_entry(hdr, r, |
1282 |
+- NVME_DISC_SUBSYS_NAME, |
1283 |
+- r->disc_addr.traddr, |
1284 |
+- NVME_NQN_DISC, numrec); |
1285 |
+- residual_len -= entry_size; |
1286 |
+- } |
1287 |
++ nvmet_format_discovery_entry(hdr, r, |
1288 |
++ NVME_DISC_SUBSYS_NAME, |
1289 |
++ r->disc_addr.traddr, |
1290 |
++ NVME_NQN_DISC, numrec); |
1291 |
+ numrec++; |
1292 |
+ } |
1293 |
+ |
1294 |
+@@ -198,8 +220,8 @@ static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) |
1295 |
+ |
1296 |
+ up_read(&nvmet_config_sem); |
1297 |
+ |
1298 |
+- status = nvmet_copy_to_sgl(req, 0, hdr, data_len); |
1299 |
+- kfree(hdr); |
1300 |
++ status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len); |
1301 |
++ kfree(buffer); |
1302 |
+ out: |
1303 |
+ nvmet_req_complete(req, status); |
1304 |
+ } |
1305 |
+diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h |
1306 |
+index 3e4719fdba85..d253c45c1aa6 100644 |
1307 |
+--- a/drivers/nvme/target/nvmet.h |
1308 |
++++ b/drivers/nvme/target/nvmet.h |
1309 |
+@@ -436,6 +436,7 @@ u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf, |
1310 |
+ u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len); |
1311 |
+ |
1312 |
+ u32 nvmet_get_log_page_len(struct nvme_command *cmd); |
1313 |
++u64 nvmet_get_log_page_offset(struct nvme_command *cmd); |
1314 |
+ |
1315 |
+ extern struct list_head *nvmet_ports; |
1316 |
+ void nvmet_port_disc_changed(struct nvmet_port *port, |
1317 |
+diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c |
1318 |
+index eaec2d306481..c7039f52ad51 100644 |
1319 |
+--- a/drivers/platform/x86/pmc_atom.c |
1320 |
++++ b/drivers/platform/x86/pmc_atom.c |
1321 |
+@@ -396,7 +396,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc) |
1322 |
+ * Some systems need one or more of their pmc_plt_clks to be |
1323 |
+ * marked as critical. |
1324 |
+ */ |
1325 |
+-static const struct dmi_system_id critclk_systems[] __initconst = { |
1326 |
++static const struct dmi_system_id critclk_systems[] = { |
1327 |
+ { |
1328 |
+ .ident = "MPL CEC1x", |
1329 |
+ .matches = { |
1330 |
+diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c |
1331 |
+index bc5547a62c00..c54c6cd504c4 100644 |
1332 |
+--- a/drivers/scsi/csiostor/csio_scsi.c |
1333 |
++++ b/drivers/scsi/csiostor/csio_scsi.c |
1334 |
+@@ -1713,8 +1713,11 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req) |
1335 |
+ } |
1336 |
+ |
1337 |
+ out: |
1338 |
+- if (req->nsge > 0) |
1339 |
++ if (req->nsge > 0) { |
1340 |
+ scsi_dma_unmap(cmnd); |
1341 |
++ if (req->dcopy && (host_status == DID_OK)) |
1342 |
++ host_status = csio_scsi_copy_to_sgl(hw, req); |
1343 |
++ } |
1344 |
+ |
1345 |
+ cmnd->result = (((host_status) << 16) | scsi_status); |
1346 |
+ cmnd->scsi_done(cmnd); |
1347 |
+diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
1348 |
+index 4bae72cbf3f6..45b26a8eb61e 100644 |
1349 |
+--- a/drivers/scsi/lpfc/lpfc_attr.c |
1350 |
++++ b/drivers/scsi/lpfc/lpfc_attr.c |
1351 |
+@@ -117,7 +117,7 @@ static ssize_t |
1352 |
+ lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr, |
1353 |
+ char *buf) |
1354 |
+ { |
1355 |
+- return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); |
1356 |
++ return scnprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); |
1357 |
+ } |
1358 |
+ |
1359 |
+ /** |
1360 |
+@@ -137,9 +137,9 @@ lpfc_enable_fip_show(struct device *dev, struct device_attribute *attr, |
1361 |
+ struct lpfc_hba *phba = vport->phba; |
1362 |
+ |
1363 |
+ if (phba->hba_flag & HBA_FIP_SUPPORT) |
1364 |
+- return snprintf(buf, PAGE_SIZE, "1\n"); |
1365 |
++ return scnprintf(buf, PAGE_SIZE, "1\n"); |
1366 |
+ else |
1367 |
+- return snprintf(buf, PAGE_SIZE, "0\n"); |
1368 |
++ return scnprintf(buf, PAGE_SIZE, "0\n"); |
1369 |
+ } |
1370 |
+ |
1371 |
+ static ssize_t |
1372 |
+@@ -517,14 +517,15 @@ lpfc_bg_info_show(struct device *dev, struct device_attribute *attr, |
1373 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1374 |
+ struct lpfc_hba *phba = vport->phba; |
1375 |
+ |
1376 |
+- if (phba->cfg_enable_bg) |
1377 |
++ if (phba->cfg_enable_bg) { |
1378 |
+ if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) |
1379 |
+- return snprintf(buf, PAGE_SIZE, "BlockGuard Enabled\n"); |
1380 |
++ return scnprintf(buf, PAGE_SIZE, |
1381 |
++ "BlockGuard Enabled\n"); |
1382 |
+ else |
1383 |
+- return snprintf(buf, PAGE_SIZE, |
1384 |
++ return scnprintf(buf, PAGE_SIZE, |
1385 |
+ "BlockGuard Not Supported\n"); |
1386 |
+- else |
1387 |
+- return snprintf(buf, PAGE_SIZE, |
1388 |
++ } else |
1389 |
++ return scnprintf(buf, PAGE_SIZE, |
1390 |
+ "BlockGuard Disabled\n"); |
1391 |
+ } |
1392 |
+ |
1393 |
+@@ -536,7 +537,7 @@ lpfc_bg_guard_err_show(struct device *dev, struct device_attribute *attr, |
1394 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1395 |
+ struct lpfc_hba *phba = vport->phba; |
1396 |
+ |
1397 |
+- return snprintf(buf, PAGE_SIZE, "%llu\n", |
1398 |
++ return scnprintf(buf, PAGE_SIZE, "%llu\n", |
1399 |
+ (unsigned long long)phba->bg_guard_err_cnt); |
1400 |
+ } |
1401 |
+ |
1402 |
+@@ -548,7 +549,7 @@ lpfc_bg_apptag_err_show(struct device *dev, struct device_attribute *attr, |
1403 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1404 |
+ struct lpfc_hba *phba = vport->phba; |
1405 |
+ |
1406 |
+- return snprintf(buf, PAGE_SIZE, "%llu\n", |
1407 |
++ return scnprintf(buf, PAGE_SIZE, "%llu\n", |
1408 |
+ (unsigned long long)phba->bg_apptag_err_cnt); |
1409 |
+ } |
1410 |
+ |
1411 |
+@@ -560,7 +561,7 @@ lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr, |
1412 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1413 |
+ struct lpfc_hba *phba = vport->phba; |
1414 |
+ |
1415 |
+- return snprintf(buf, PAGE_SIZE, "%llu\n", |
1416 |
++ return scnprintf(buf, PAGE_SIZE, "%llu\n", |
1417 |
+ (unsigned long long)phba->bg_reftag_err_cnt); |
1418 |
+ } |
1419 |
+ |
1420 |
+@@ -578,7 +579,7 @@ lpfc_info_show(struct device *dev, struct device_attribute *attr, |
1421 |
+ { |
1422 |
+ struct Scsi_Host *host = class_to_shost(dev); |
1423 |
+ |
1424 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); |
1425 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", lpfc_info(host)); |
1426 |
+ } |
1427 |
+ |
1428 |
+ /** |
1429 |
+@@ -597,7 +598,7 @@ lpfc_serialnum_show(struct device *dev, struct device_attribute *attr, |
1430 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1431 |
+ struct lpfc_hba *phba = vport->phba; |
1432 |
+ |
1433 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber); |
1434 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); |
1435 |
+ } |
1436 |
+ |
1437 |
+ /** |
1438 |
+@@ -619,7 +620,7 @@ lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr, |
1439 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1440 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1441 |
+ struct lpfc_hba *phba = vport->phba; |
1442 |
+- return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support); |
1443 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); |
1444 |
+ } |
1445 |
+ |
1446 |
+ /** |
1447 |
+@@ -638,7 +639,7 @@ lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr, |
1448 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1449 |
+ struct lpfc_hba *phba = vport->phba; |
1450 |
+ |
1451 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelDesc); |
1452 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); |
1453 |
+ } |
1454 |
+ |
1455 |
+ /** |
1456 |
+@@ -657,7 +658,7 @@ lpfc_modelname_show(struct device *dev, struct device_attribute *attr, |
1457 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1458 |
+ struct lpfc_hba *phba = vport->phba; |
1459 |
+ |
1460 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelName); |
1461 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); |
1462 |
+ } |
1463 |
+ |
1464 |
+ /** |
1465 |
+@@ -676,7 +677,7 @@ lpfc_programtype_show(struct device *dev, struct device_attribute *attr, |
1466 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1467 |
+ struct lpfc_hba *phba = vport->phba; |
1468 |
+ |
1469 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",phba->ProgramType); |
1470 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); |
1471 |
+ } |
1472 |
+ |
1473 |
+ /** |
1474 |
+@@ -694,7 +695,7 @@ lpfc_mlomgmt_show(struct device *dev, struct device_attribute *attr, char *buf) |
1475 |
+ struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; |
1476 |
+ struct lpfc_hba *phba = vport->phba; |
1477 |
+ |
1478 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", |
1479 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", |
1480 |
+ (phba->sli.sli_flag & LPFC_MENLO_MAINT)); |
1481 |
+ } |
1482 |
+ |
1483 |
+@@ -714,7 +715,7 @@ lpfc_vportnum_show(struct device *dev, struct device_attribute *attr, |
1484 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1485 |
+ struct lpfc_hba *phba = vport->phba; |
1486 |
+ |
1487 |
+- return snprintf(buf, PAGE_SIZE, "%s\n",phba->Port); |
1488 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); |
1489 |
+ } |
1490 |
+ |
1491 |
+ /** |
1492 |
+@@ -742,10 +743,10 @@ lpfc_fwrev_show(struct device *dev, struct device_attribute *attr, |
1493 |
+ sli_family = phba->sli4_hba.pc_sli4_params.sli_family; |
1494 |
+ |
1495 |
+ if (phba->sli_rev < LPFC_SLI_REV4) |
1496 |
+- len = snprintf(buf, PAGE_SIZE, "%s, sli-%d\n", |
1497 |
++ len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", |
1498 |
+ fwrev, phba->sli_rev); |
1499 |
+ else |
1500 |
+- len = snprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", |
1501 |
++ len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", |
1502 |
+ fwrev, phba->sli_rev, if_type, sli_family); |
1503 |
+ |
1504 |
+ return len; |
1505 |
+@@ -769,7 +770,7 @@ lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf) |
1506 |
+ lpfc_vpd_t *vp = &phba->vpd; |
1507 |
+ |
1508 |
+ lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); |
1509 |
+- return snprintf(buf, PAGE_SIZE, "%s\n", hdw); |
1510 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", hdw); |
1511 |
+ } |
1512 |
+ |
1513 |
+ /** |
1514 |
+@@ -790,10 +791,11 @@ lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr, |
1515 |
+ char fwrev[FW_REV_STR_SIZE]; |
1516 |
+ |
1517 |
+ if (phba->sli_rev < LPFC_SLI_REV4) |
1518 |
+- return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); |
1519 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", |
1520 |
++ phba->OptionROMVersion); |
1521 |
+ |
1522 |
+ lpfc_decode_firmware_rev(phba, fwrev, 1); |
1523 |
+- return snprintf(buf, PAGE_SIZE, "%s\n", fwrev); |
1524 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", fwrev); |
1525 |
+ } |
1526 |
+ |
1527 |
+ /** |
1528 |
+@@ -824,20 +826,20 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, |
1529 |
+ case LPFC_LINK_DOWN: |
1530 |
+ case LPFC_HBA_ERROR: |
1531 |
+ if (phba->hba_flag & LINK_DISABLED) |
1532 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1533 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1534 |
+ "Link Down - User disabled\n"); |
1535 |
+ else |
1536 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1537 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1538 |
+ "Link Down\n"); |
1539 |
+ break; |
1540 |
+ case LPFC_LINK_UP: |
1541 |
+ case LPFC_CLEAR_LA: |
1542 |
+ case LPFC_HBA_READY: |
1543 |
+- len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - "); |
1544 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); |
1545 |
+ |
1546 |
+ switch (vport->port_state) { |
1547 |
+ case LPFC_LOCAL_CFG_LINK: |
1548 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1549 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1550 |
+ "Configuring Link\n"); |
1551 |
+ break; |
1552 |
+ case LPFC_FDISC: |
1553 |
+@@ -847,38 +849,40 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, |
1554 |
+ case LPFC_NS_QRY: |
1555 |
+ case LPFC_BUILD_DISC_LIST: |
1556 |
+ case LPFC_DISC_AUTH: |
1557 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1558 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1559 |
+ "Discovery\n"); |
1560 |
+ break; |
1561 |
+ case LPFC_VPORT_READY: |
1562 |
+- len += snprintf(buf + len, PAGE_SIZE - len, "Ready\n"); |
1563 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1564 |
++ "Ready\n"); |
1565 |
+ break; |
1566 |
+ |
1567 |
+ case LPFC_VPORT_FAILED: |
1568 |
+- len += snprintf(buf + len, PAGE_SIZE - len, "Failed\n"); |
1569 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1570 |
++ "Failed\n"); |
1571 |
+ break; |
1572 |
+ |
1573 |
+ case LPFC_VPORT_UNKNOWN: |
1574 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1575 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1576 |
+ "Unknown\n"); |
1577 |
+ break; |
1578 |
+ } |
1579 |
+ if (phba->sli.sli_flag & LPFC_MENLO_MAINT) |
1580 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1581 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1582 |
+ " Menlo Maint Mode\n"); |
1583 |
+ else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
1584 |
+ if (vport->fc_flag & FC_PUBLIC_LOOP) |
1585 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1586 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1587 |
+ " Public Loop\n"); |
1588 |
+ else |
1589 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1590 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1591 |
+ " Private Loop\n"); |
1592 |
+ } else { |
1593 |
+ if (vport->fc_flag & FC_FABRIC) |
1594 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1595 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1596 |
+ " Fabric\n"); |
1597 |
+ else |
1598 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1599 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1600 |
+ " Point-2-Point\n"); |
1601 |
+ } |
1602 |
+ } |
1603 |
+@@ -890,28 +894,28 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, |
1604 |
+ struct lpfc_trunk_link link = phba->trunk_link; |
1605 |
+ |
1606 |
+ if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) |
1607 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1608 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1609 |
+ "Trunk port 0: Link %s %s\n", |
1610 |
+ (link.link0.state == LPFC_LINK_UP) ? |
1611 |
+ "Up" : "Down. ", |
1612 |
+ trunk_errmsg[link.link0.fault]); |
1613 |
+ |
1614 |
+ if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) |
1615 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1616 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1617 |
+ "Trunk port 1: Link %s %s\n", |
1618 |
+ (link.link1.state == LPFC_LINK_UP) ? |
1619 |
+ "Up" : "Down. ", |
1620 |
+ trunk_errmsg[link.link1.fault]); |
1621 |
+ |
1622 |
+ if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) |
1623 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1624 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1625 |
+ "Trunk port 2: Link %s %s\n", |
1626 |
+ (link.link2.state == LPFC_LINK_UP) ? |
1627 |
+ "Up" : "Down. ", |
1628 |
+ trunk_errmsg[link.link2.fault]); |
1629 |
+ |
1630 |
+ if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) |
1631 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
1632 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1633 |
+ "Trunk port 3: Link %s %s\n", |
1634 |
+ (link.link3.state == LPFC_LINK_UP) ? |
1635 |
+ "Up" : "Down. ", |
1636 |
+@@ -939,15 +943,15 @@ lpfc_sli4_protocol_show(struct device *dev, struct device_attribute *attr, |
1637 |
+ struct lpfc_hba *phba = vport->phba; |
1638 |
+ |
1639 |
+ if (phba->sli_rev < LPFC_SLI_REV4) |
1640 |
+- return snprintf(buf, PAGE_SIZE, "fc\n"); |
1641 |
++ return scnprintf(buf, PAGE_SIZE, "fc\n"); |
1642 |
+ |
1643 |
+ if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { |
1644 |
+ if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) |
1645 |
+- return snprintf(buf, PAGE_SIZE, "fcoe\n"); |
1646 |
++ return scnprintf(buf, PAGE_SIZE, "fcoe\n"); |
1647 |
+ if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) |
1648 |
+- return snprintf(buf, PAGE_SIZE, "fc\n"); |
1649 |
++ return scnprintf(buf, PAGE_SIZE, "fc\n"); |
1650 |
+ } |
1651 |
+- return snprintf(buf, PAGE_SIZE, "unknown\n"); |
1652 |
++ return scnprintf(buf, PAGE_SIZE, "unknown\n"); |
1653 |
+ } |
1654 |
+ |
1655 |
+ /** |
1656 |
+@@ -967,7 +971,7 @@ lpfc_oas_supported_show(struct device *dev, struct device_attribute *attr, |
1657 |
+ struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; |
1658 |
+ struct lpfc_hba *phba = vport->phba; |
1659 |
+ |
1660 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", |
1661 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", |
1662 |
+ phba->sli4_hba.pc_sli4_params.oas_supported); |
1663 |
+ } |
1664 |
+ |
1665 |
+@@ -1025,7 +1029,7 @@ lpfc_num_discovered_ports_show(struct device *dev, |
1666 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1667 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1668 |
+ |
1669 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", |
1670 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", |
1671 |
+ vport->fc_map_cnt + vport->fc_unmap_cnt); |
1672 |
+ } |
1673 |
+ |
1674 |
+@@ -1539,7 +1543,7 @@ lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr, |
1675 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1676 |
+ struct lpfc_hba *phba = vport->phba; |
1677 |
+ |
1678 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); |
1679 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); |
1680 |
+ } |
1681 |
+ |
1682 |
+ int |
1683 |
+@@ -1628,7 +1632,7 @@ lpfc_board_mode_show(struct device *dev, struct device_attribute *attr, |
1684 |
+ else |
1685 |
+ state = "online"; |
1686 |
+ |
1687 |
+- return snprintf(buf, PAGE_SIZE, "%s\n", state); |
1688 |
++ return scnprintf(buf, PAGE_SIZE, "%s\n", state); |
1689 |
+ } |
1690 |
+ |
1691 |
+ /** |
1692 |
+@@ -1854,8 +1858,8 @@ lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr, |
1693 |
+ uint32_t cnt; |
1694 |
+ |
1695 |
+ if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, NULL, NULL, NULL)) |
1696 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1697 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1698 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1699 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1700 |
+ } |
1701 |
+ |
1702 |
+ /** |
1703 |
+@@ -1882,8 +1886,8 @@ lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr, |
1704 |
+ uint32_t cnt, acnt; |
1705 |
+ |
1706 |
+ if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, &acnt, NULL, NULL)) |
1707 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1708 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1709 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1710 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1711 |
+ } |
1712 |
+ |
1713 |
+ /** |
1714 |
+@@ -1910,8 +1914,8 @@ lpfc_max_xri_show(struct device *dev, struct device_attribute *attr, |
1715 |
+ uint32_t cnt; |
1716 |
+ |
1717 |
+ if (lpfc_get_hba_info(phba, &cnt, NULL, NULL, NULL, NULL, NULL)) |
1718 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1719 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1720 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1721 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1722 |
+ } |
1723 |
+ |
1724 |
+ /** |
1725 |
+@@ -1938,8 +1942,8 @@ lpfc_used_xri_show(struct device *dev, struct device_attribute *attr, |
1726 |
+ uint32_t cnt, acnt; |
1727 |
+ |
1728 |
+ if (lpfc_get_hba_info(phba, &cnt, &acnt, NULL, NULL, NULL, NULL)) |
1729 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1730 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1731 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1732 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1733 |
+ } |
1734 |
+ |
1735 |
+ /** |
1736 |
+@@ -1966,8 +1970,8 @@ lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr, |
1737 |
+ uint32_t cnt; |
1738 |
+ |
1739 |
+ if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, NULL)) |
1740 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1741 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1742 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); |
1743 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1744 |
+ } |
1745 |
+ |
1746 |
+ /** |
1747 |
+@@ -1994,8 +1998,8 @@ lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr, |
1748 |
+ uint32_t cnt, acnt; |
1749 |
+ |
1750 |
+ if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, &acnt)) |
1751 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1752 |
+- return snprintf(buf, PAGE_SIZE, "Unknown\n"); |
1753 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); |
1754 |
++ return scnprintf(buf, PAGE_SIZE, "Unknown\n"); |
1755 |
+ } |
1756 |
+ |
1757 |
+ /** |
1758 |
+@@ -2020,10 +2024,10 @@ lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr, |
1759 |
+ struct lpfc_hba *phba = vport->phba; |
1760 |
+ |
1761 |
+ if (!(phba->max_vpi)) |
1762 |
+- return snprintf(buf, PAGE_SIZE, "NPIV Not Supported\n"); |
1763 |
++ return scnprintf(buf, PAGE_SIZE, "NPIV Not Supported\n"); |
1764 |
+ if (vport->port_type == LPFC_PHYSICAL_PORT) |
1765 |
+- return snprintf(buf, PAGE_SIZE, "NPIV Physical\n"); |
1766 |
+- return snprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); |
1767 |
++ return scnprintf(buf, PAGE_SIZE, "NPIV Physical\n"); |
1768 |
++ return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); |
1769 |
+ } |
1770 |
+ |
1771 |
+ /** |
1772 |
+@@ -2045,7 +2049,7 @@ lpfc_poll_show(struct device *dev, struct device_attribute *attr, |
1773 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1774 |
+ struct lpfc_hba *phba = vport->phba; |
1775 |
+ |
1776 |
+- return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); |
1777 |
++ return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); |
1778 |
+ } |
1779 |
+ |
1780 |
+ /** |
1781 |
+@@ -2149,7 +2153,7 @@ lpfc_fips_level_show(struct device *dev, struct device_attribute *attr, |
1782 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1783 |
+ struct lpfc_hba *phba = vport->phba; |
1784 |
+ |
1785 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level); |
1786 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level); |
1787 |
+ } |
1788 |
+ |
1789 |
+ /** |
1790 |
+@@ -2168,7 +2172,7 @@ lpfc_fips_rev_show(struct device *dev, struct device_attribute *attr, |
1791 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1792 |
+ struct lpfc_hba *phba = vport->phba; |
1793 |
+ |
1794 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev); |
1795 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev); |
1796 |
+ } |
1797 |
+ |
1798 |
+ /** |
1799 |
+@@ -2187,7 +2191,7 @@ lpfc_dss_show(struct device *dev, struct device_attribute *attr, |
1800 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1801 |
+ struct lpfc_hba *phba = vport->phba; |
1802 |
+ |
1803 |
+- return snprintf(buf, PAGE_SIZE, "%s - %sOperational\n", |
1804 |
++ return scnprintf(buf, PAGE_SIZE, "%s - %sOperational\n", |
1805 |
+ (phba->cfg_enable_dss) ? "Enabled" : "Disabled", |
1806 |
+ (phba->sli3_options & LPFC_SLI3_DSS_ENABLED) ? |
1807 |
+ "" : "Not "); |
1808 |
+@@ -2216,7 +2220,7 @@ lpfc_sriov_hw_max_virtfn_show(struct device *dev, |
1809 |
+ uint16_t max_nr_virtfn; |
1810 |
+ |
1811 |
+ max_nr_virtfn = lpfc_sli_sriov_nr_virtfn_get(phba); |
1812 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", max_nr_virtfn); |
1813 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", max_nr_virtfn); |
1814 |
+ } |
1815 |
+ |
1816 |
+ static inline bool lpfc_rangecheck(uint val, uint min, uint max) |
1817 |
+@@ -2276,7 +2280,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
1818 |
+ struct Scsi_Host *shost = class_to_shost(dev);\ |
1819 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
1820 |
+ struct lpfc_hba *phba = vport->phba;\ |
1821 |
+- return snprintf(buf, PAGE_SIZE, "%d\n",\ |
1822 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n",\ |
1823 |
+ phba->cfg_##attr);\ |
1824 |
+ } |
1825 |
+ |
1826 |
+@@ -2304,7 +2308,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
1827 |
+ struct lpfc_hba *phba = vport->phba;\ |
1828 |
+ uint val = 0;\ |
1829 |
+ val = phba->cfg_##attr;\ |
1830 |
+- return snprintf(buf, PAGE_SIZE, "%#x\n",\ |
1831 |
++ return scnprintf(buf, PAGE_SIZE, "%#x\n",\ |
1832 |
+ phba->cfg_##attr);\ |
1833 |
+ } |
1834 |
+ |
1835 |
+@@ -2440,7 +2444,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
1836 |
+ { \ |
1837 |
+ struct Scsi_Host *shost = class_to_shost(dev);\ |
1838 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
1839 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\ |
1840 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\ |
1841 |
+ } |
1842 |
+ |
1843 |
+ /** |
1844 |
+@@ -2465,7 +2469,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
1845 |
+ { \ |
1846 |
+ struct Scsi_Host *shost = class_to_shost(dev);\ |
1847 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
1848 |
+- return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\ |
1849 |
++ return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\ |
1850 |
+ } |
1851 |
+ |
1852 |
+ /** |
1853 |
+@@ -2736,7 +2740,7 @@ lpfc_soft_wwpn_show(struct device *dev, struct device_attribute *attr, |
1854 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1855 |
+ struct lpfc_hba *phba = vport->phba; |
1856 |
+ |
1857 |
+- return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
1858 |
++ return scnprintf(buf, PAGE_SIZE, "0x%llx\n", |
1859 |
+ (unsigned long long)phba->cfg_soft_wwpn); |
1860 |
+ } |
1861 |
+ |
1862 |
+@@ -2833,7 +2837,7 @@ lpfc_soft_wwnn_show(struct device *dev, struct device_attribute *attr, |
1863 |
+ { |
1864 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1865 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1866 |
+- return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
1867 |
++ return scnprintf(buf, PAGE_SIZE, "0x%llx\n", |
1868 |
+ (unsigned long long)phba->cfg_soft_wwnn); |
1869 |
+ } |
1870 |
+ |
1871 |
+@@ -2899,7 +2903,7 @@ lpfc_oas_tgt_show(struct device *dev, struct device_attribute *attr, |
1872 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1873 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1874 |
+ |
1875 |
+- return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
1876 |
++ return scnprintf(buf, PAGE_SIZE, "0x%llx\n", |
1877 |
+ wwn_to_u64(phba->cfg_oas_tgt_wwpn)); |
1878 |
+ } |
1879 |
+ |
1880 |
+@@ -2967,7 +2971,7 @@ lpfc_oas_priority_show(struct device *dev, struct device_attribute *attr, |
1881 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1882 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1883 |
+ |
1884 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); |
1885 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); |
1886 |
+ } |
1887 |
+ |
1888 |
+ /** |
1889 |
+@@ -3030,7 +3034,7 @@ lpfc_oas_vpt_show(struct device *dev, struct device_attribute *attr, |
1890 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1891 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1892 |
+ |
1893 |
+- return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
1894 |
++ return scnprintf(buf, PAGE_SIZE, "0x%llx\n", |
1895 |
+ wwn_to_u64(phba->cfg_oas_vpt_wwpn)); |
1896 |
+ } |
1897 |
+ |
1898 |
+@@ -3101,7 +3105,7 @@ lpfc_oas_lun_state_show(struct device *dev, struct device_attribute *attr, |
1899 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1900 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1901 |
+ |
1902 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); |
1903 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); |
1904 |
+ } |
1905 |
+ |
1906 |
+ /** |
1907 |
+@@ -3165,7 +3169,7 @@ lpfc_oas_lun_status_show(struct device *dev, struct device_attribute *attr, |
1908 |
+ if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) |
1909 |
+ return -EFAULT; |
1910 |
+ |
1911 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); |
1912 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); |
1913 |
+ } |
1914 |
+ static DEVICE_ATTR(lpfc_xlane_lun_status, S_IRUGO, |
1915 |
+ lpfc_oas_lun_status_show, NULL); |
1916 |
+@@ -3317,7 +3321,7 @@ lpfc_oas_lun_show(struct device *dev, struct device_attribute *attr, |
1917 |
+ if (oas_lun != NOT_OAS_ENABLED_LUN) |
1918 |
+ phba->cfg_oas_flags |= OAS_LUN_VALID; |
1919 |
+ |
1920 |
+- len += snprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); |
1921 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); |
1922 |
+ |
1923 |
+ return len; |
1924 |
+ } |
1925 |
+@@ -3451,7 +3455,7 @@ lpfc_iocb_hw_show(struct device *dev, struct device_attribute *attr, char *buf) |
1926 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1927 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; |
1928 |
+ |
1929 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); |
1930 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); |
1931 |
+ } |
1932 |
+ |
1933 |
+ static DEVICE_ATTR(iocb_hw, S_IRUGO, |
1934 |
+@@ -3463,7 +3467,7 @@ lpfc_txq_hw_show(struct device *dev, struct device_attribute *attr, char *buf) |
1935 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; |
1936 |
+ struct lpfc_sli_ring *pring = lpfc_phba_elsring(phba); |
1937 |
+ |
1938 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", |
1939 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", |
1940 |
+ pring ? pring->txq_max : 0); |
1941 |
+ } |
1942 |
+ |
1943 |
+@@ -3477,7 +3481,7 @@ lpfc_txcmplq_hw_show(struct device *dev, struct device_attribute *attr, |
1944 |
+ struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; |
1945 |
+ struct lpfc_sli_ring *pring = lpfc_phba_elsring(phba); |
1946 |
+ |
1947 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", |
1948 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", |
1949 |
+ pring ? pring->txcmplq_max : 0); |
1950 |
+ } |
1951 |
+ |
1952 |
+@@ -3513,7 +3517,7 @@ lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr, |
1953 |
+ struct Scsi_Host *shost = class_to_shost(dev); |
1954 |
+ struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1955 |
+ |
1956 |
+- return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); |
1957 |
++ return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); |
1958 |
+ } |
1959 |
+ |
1960 |
+ /** |
1961 |
+@@ -5016,19 +5020,19 @@ lpfc_fcp_cpu_map_show(struct device *dev, struct device_attribute *attr, |
1962 |
+ |
1963 |
+ switch (phba->cfg_fcp_cpu_map) { |
1964 |
+ case 0: |
1965 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1966 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1967 |
+ "fcp_cpu_map: No mapping (%d)\n", |
1968 |
+ phba->cfg_fcp_cpu_map); |
1969 |
+ return len; |
1970 |
+ case 1: |
1971 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1972 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1973 |
+ "fcp_cpu_map: HBA centric mapping (%d): " |
1974 |
+ "%d online CPUs\n", |
1975 |
+ phba->cfg_fcp_cpu_map, |
1976 |
+ phba->sli4_hba.num_online_cpu); |
1977 |
+ break; |
1978 |
+ case 2: |
1979 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1980 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1981 |
+ "fcp_cpu_map: Driver centric mapping (%d): " |
1982 |
+ "%d online CPUs\n", |
1983 |
+ phba->cfg_fcp_cpu_map, |
1984 |
+@@ -5041,14 +5045,14 @@ lpfc_fcp_cpu_map_show(struct device *dev, struct device_attribute *attr, |
1985 |
+ |
1986 |
+ /* margin should fit in this and the truncated message */ |
1987 |
+ if (cpup->irq == LPFC_VECTOR_MAP_EMPTY) |
1988 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1989 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1990 |
+ "CPU %02d io_chan %02d " |
1991 |
+ "physid %d coreid %d\n", |
1992 |
+ phba->sli4_hba.curr_disp_cpu, |
1993 |
+ cpup->channel_id, cpup->phys_id, |
1994 |
+ cpup->core_id); |
1995 |
+ else |
1996 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
1997 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
1998 |
+ "CPU %02d io_chan %02d " |
1999 |
+ "physid %d coreid %d IRQ %d\n", |
2000 |
+ phba->sli4_hba.curr_disp_cpu, |
2001 |
+@@ -5061,7 +5065,7 @@ lpfc_fcp_cpu_map_show(struct device *dev, struct device_attribute *attr, |
2002 |
+ if (phba->sli4_hba.curr_disp_cpu < |
2003 |
+ phba->sli4_hba.num_present_cpu && |
2004 |
+ (len >= (PAGE_SIZE - 64))) { |
2005 |
+- len += snprintf(buf + len, PAGE_SIZE-len, "more...\n"); |
2006 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, "more...\n"); |
2007 |
+ break; |
2008 |
+ } |
2009 |
+ } |
2010 |
+@@ -5586,10 +5590,10 @@ lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, |
2011 |
+ struct lpfc_hba *phba = vport->phba; |
2012 |
+ int len; |
2013 |
+ |
2014 |
+- len = snprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", |
2015 |
++ len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", |
2016 |
+ phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); |
2017 |
+ |
2018 |
+- len += snprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", |
2019 |
++ len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", |
2020 |
+ phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, |
2021 |
+ phba->cfg_nvme_seg_cnt); |
2022 |
+ return len; |
2023 |
+@@ -6586,7 +6590,7 @@ lpfc_show_rport_##field (struct device *dev, \ |
2024 |
+ { \ |
2025 |
+ struct fc_rport *rport = transport_class_to_rport(dev); \ |
2026 |
+ struct lpfc_rport_data *rdata = rport->hostdata; \ |
2027 |
+- return snprintf(buf, sz, format_string, \ |
2028 |
++ return scnprintf(buf, sz, format_string, \ |
2029 |
+ (rdata->target) ? cast rdata->target->field : 0); \ |
2030 |
+ } |
2031 |
+ |
2032 |
+diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c |
2033 |
+index 552da8bf43e4..221f8fd87d24 100644 |
2034 |
+--- a/drivers/scsi/lpfc/lpfc_ct.c |
2035 |
++++ b/drivers/scsi/lpfc/lpfc_ct.c |
2036 |
+@@ -1430,7 +1430,7 @@ lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol, |
2037 |
+ * Name object. NPIV is not in play so this integer |
2038 |
+ * value is sufficient and unique per FC-ID. |
2039 |
+ */ |
2040 |
+- n = snprintf(symbol, size, "%d", vport->phba->brd_no); |
2041 |
++ n = scnprintf(symbol, size, "%d", vport->phba->brd_no); |
2042 |
+ return n; |
2043 |
+ } |
2044 |
+ |
2045 |
+@@ -1444,26 +1444,26 @@ lpfc_vport_symbolic_node_name(struct lpfc_vport *vport, char *symbol, |
2046 |
+ |
2047 |
+ lpfc_decode_firmware_rev(vport->phba, fwrev, 0); |
2048 |
+ |
2049 |
+- n = snprintf(symbol, size, "Emulex %s", vport->phba->ModelName); |
2050 |
++ n = scnprintf(symbol, size, "Emulex %s", vport->phba->ModelName); |
2051 |
+ if (size < n) |
2052 |
+ return n; |
2053 |
+ |
2054 |
+- n += snprintf(symbol + n, size - n, " FV%s", fwrev); |
2055 |
++ n += scnprintf(symbol + n, size - n, " FV%s", fwrev); |
2056 |
+ if (size < n) |
2057 |
+ return n; |
2058 |
+ |
2059 |
+- n += snprintf(symbol + n, size - n, " DV%s.", |
2060 |
++ n += scnprintf(symbol + n, size - n, " DV%s.", |
2061 |
+ lpfc_release_version); |
2062 |
+ if (size < n) |
2063 |
+ return n; |
2064 |
+ |
2065 |
+- n += snprintf(symbol + n, size - n, " HN:%s.", |
2066 |
++ n += scnprintf(symbol + n, size - n, " HN:%s.", |
2067 |
+ init_utsname()->nodename); |
2068 |
+ if (size < n) |
2069 |
+ return n; |
2070 |
+ |
2071 |
+ /* Note :- OS name is "Linux" */ |
2072 |
+- n += snprintf(symbol + n, size - n, " OS:%s\n", |
2073 |
++ n += scnprintf(symbol + n, size - n, " OS:%s\n", |
2074 |
+ init_utsname()->sysname); |
2075 |
+ return n; |
2076 |
+ } |
2077 |
+diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c |
2078 |
+index a58f0b3f03a9..361521dd5bd8 100644 |
2079 |
+--- a/drivers/scsi/lpfc/lpfc_debugfs.c |
2080 |
++++ b/drivers/scsi/lpfc/lpfc_debugfs.c |
2081 |
+@@ -170,7 +170,7 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) |
2082 |
+ snprintf(buffer, |
2083 |
+ LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", |
2084 |
+ dtp->seq_cnt, ms, dtp->fmt); |
2085 |
+- len += snprintf(buf+len, size-len, buffer, |
2086 |
++ len += scnprintf(buf+len, size-len, buffer, |
2087 |
+ dtp->data1, dtp->data2, dtp->data3); |
2088 |
+ } |
2089 |
+ for (i = 0; i < index; i++) { |
2090 |
+@@ -181,7 +181,7 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) |
2091 |
+ snprintf(buffer, |
2092 |
+ LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", |
2093 |
+ dtp->seq_cnt, ms, dtp->fmt); |
2094 |
+- len += snprintf(buf+len, size-len, buffer, |
2095 |
++ len += scnprintf(buf+len, size-len, buffer, |
2096 |
+ dtp->data1, dtp->data2, dtp->data3); |
2097 |
+ } |
2098 |
+ |
2099 |
+@@ -236,7 +236,7 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2100 |
+ snprintf(buffer, |
2101 |
+ LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", |
2102 |
+ dtp->seq_cnt, ms, dtp->fmt); |
2103 |
+- len += snprintf(buf+len, size-len, buffer, |
2104 |
++ len += scnprintf(buf+len, size-len, buffer, |
2105 |
+ dtp->data1, dtp->data2, dtp->data3); |
2106 |
+ } |
2107 |
+ for (i = 0; i < index; i++) { |
2108 |
+@@ -247,7 +247,7 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2109 |
+ snprintf(buffer, |
2110 |
+ LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n", |
2111 |
+ dtp->seq_cnt, ms, dtp->fmt); |
2112 |
+- len += snprintf(buf+len, size-len, buffer, |
2113 |
++ len += scnprintf(buf+len, size-len, buffer, |
2114 |
+ dtp->data1, dtp->data2, dtp->data3); |
2115 |
+ } |
2116 |
+ |
2117 |
+@@ -307,7 +307,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) |
2118 |
+ |
2119 |
+ i = lpfc_debugfs_last_hbq; |
2120 |
+ |
2121 |
+- len += snprintf(buf+len, size-len, "HBQ %d Info\n", i); |
2122 |
++ len += scnprintf(buf+len, size-len, "HBQ %d Info\n", i); |
2123 |
+ |
2124 |
+ hbqs = &phba->hbqs[i]; |
2125 |
+ posted = 0; |
2126 |
+@@ -315,21 +315,21 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) |
2127 |
+ posted++; |
2128 |
+ |
2129 |
+ hip = lpfc_hbq_defs[i]; |
2130 |
+- len += snprintf(buf+len, size-len, |
2131 |
++ len += scnprintf(buf+len, size-len, |
2132 |
+ "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n", |
2133 |
+ hip->hbq_index, hip->profile, hip->rn, |
2134 |
+ hip->buffer_count, hip->init_count, hip->add_count, posted); |
2135 |
+ |
2136 |
+ raw_index = phba->hbq_get[i]; |
2137 |
+ getidx = le32_to_cpu(raw_index); |
2138 |
+- len += snprintf(buf+len, size-len, |
2139 |
++ len += scnprintf(buf+len, size-len, |
2140 |
+ "entries:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n", |
2141 |
+ hbqs->entry_count, hbqs->buffer_count, hbqs->hbqPutIdx, |
2142 |
+ hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx); |
2143 |
+ |
2144 |
+ hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt; |
2145 |
+ for (j=0; j<hbqs->entry_count; j++) { |
2146 |
+- len += snprintf(buf+len, size-len, |
2147 |
++ len += scnprintf(buf+len, size-len, |
2148 |
+ "%03d: %08x %04x %05x ", j, |
2149 |
+ le32_to_cpu(hbqe->bde.addrLow), |
2150 |
+ le32_to_cpu(hbqe->bde.tus.w), |
2151 |
+@@ -341,14 +341,16 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) |
2152 |
+ low = hbqs->hbqPutIdx - posted; |
2153 |
+ if (low >= 0) { |
2154 |
+ if ((j >= hbqs->hbqPutIdx) || (j < low)) { |
2155 |
+- len += snprintf(buf+len, size-len, "Unused\n"); |
2156 |
++ len += scnprintf(buf + len, size - len, |
2157 |
++ "Unused\n"); |
2158 |
+ goto skipit; |
2159 |
+ } |
2160 |
+ } |
2161 |
+ else { |
2162 |
+ if ((j >= hbqs->hbqPutIdx) && |
2163 |
+ (j < (hbqs->entry_count+low))) { |
2164 |
+- len += snprintf(buf+len, size-len, "Unused\n"); |
2165 |
++ len += scnprintf(buf + len, size - len, |
2166 |
++ "Unused\n"); |
2167 |
+ goto skipit; |
2168 |
+ } |
2169 |
+ } |
2170 |
+@@ -358,7 +360,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) |
2171 |
+ hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
2172 |
+ phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); |
2173 |
+ if (phys == le32_to_cpu(hbqe->bde.addrLow)) { |
2174 |
+- len += snprintf(buf+len, size-len, |
2175 |
++ len += scnprintf(buf+len, size-len, |
2176 |
+ "Buf%d: %p %06x\n", i, |
2177 |
+ hbq_buf->dbuf.virt, hbq_buf->tag); |
2178 |
+ found = 1; |
2179 |
+@@ -367,7 +369,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) |
2180 |
+ i++; |
2181 |
+ } |
2182 |
+ if (!found) { |
2183 |
+- len += snprintf(buf+len, size-len, "No DMAinfo?\n"); |
2184 |
++ len += scnprintf(buf+len, size-len, "No DMAinfo?\n"); |
2185 |
+ } |
2186 |
+ skipit: |
2187 |
+ hbqe++; |
2188 |
+@@ -413,7 +415,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size) |
2189 |
+ off = 0; |
2190 |
+ spin_lock_irq(&phba->hbalock); |
2191 |
+ |
2192 |
+- len += snprintf(buf+len, size-len, "HBA SLIM\n"); |
2193 |
++ len += scnprintf(buf+len, size-len, "HBA SLIM\n"); |
2194 |
+ lpfc_memcpy_from_slim(buffer, |
2195 |
+ phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024); |
2196 |
+ |
2197 |
+@@ -427,7 +429,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size) |
2198 |
+ |
2199 |
+ i = 1024; |
2200 |
+ while (i > 0) { |
2201 |
+- len += snprintf(buf+len, size-len, |
2202 |
++ len += scnprintf(buf+len, size-len, |
2203 |
+ "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
2204 |
+ off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), |
2205 |
+ *(ptr+5), *(ptr+6), *(ptr+7)); |
2206 |
+@@ -471,11 +473,11 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) |
2207 |
+ off = 0; |
2208 |
+ spin_lock_irq(&phba->hbalock); |
2209 |
+ |
2210 |
+- len += snprintf(buf+len, size-len, "SLIM Mailbox\n"); |
2211 |
++ len += scnprintf(buf+len, size-len, "SLIM Mailbox\n"); |
2212 |
+ ptr = (uint32_t *)phba->slim2p.virt; |
2213 |
+ i = sizeof(MAILBOX_t); |
2214 |
+ while (i > 0) { |
2215 |
+- len += snprintf(buf+len, size-len, |
2216 |
++ len += scnprintf(buf+len, size-len, |
2217 |
+ "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
2218 |
+ off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), |
2219 |
+ *(ptr+5), *(ptr+6), *(ptr+7)); |
2220 |
+@@ -484,11 +486,11 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) |
2221 |
+ off += (8 * sizeof(uint32_t)); |
2222 |
+ } |
2223 |
+ |
2224 |
+- len += snprintf(buf+len, size-len, "SLIM PCB\n"); |
2225 |
++ len += scnprintf(buf+len, size-len, "SLIM PCB\n"); |
2226 |
+ ptr = (uint32_t *)phba->pcb; |
2227 |
+ i = sizeof(PCB_t); |
2228 |
+ while (i > 0) { |
2229 |
+- len += snprintf(buf+len, size-len, |
2230 |
++ len += scnprintf(buf+len, size-len, |
2231 |
+ "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
2232 |
+ off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), |
2233 |
+ *(ptr+5), *(ptr+6), *(ptr+7)); |
2234 |
+@@ -501,7 +503,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) |
2235 |
+ for (i = 0; i < 4; i++) { |
2236 |
+ pgpp = &phba->port_gp[i]; |
2237 |
+ pring = &psli->sli3_ring[i]; |
2238 |
+- len += snprintf(buf+len, size-len, |
2239 |
++ len += scnprintf(buf+len, size-len, |
2240 |
+ "Ring %d: CMD GetInx:%d " |
2241 |
+ "(Max:%d Next:%d " |
2242 |
+ "Local:%d flg:x%x) " |
2243 |
+@@ -518,7 +520,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) |
2244 |
+ word1 = readl(phba->CAregaddr); |
2245 |
+ word2 = readl(phba->HSregaddr); |
2246 |
+ word3 = readl(phba->HCregaddr); |
2247 |
+- len += snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x " |
2248 |
++ len += scnprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x " |
2249 |
+ "HC:%08x\n", word0, word1, word2, word3); |
2250 |
+ } |
2251 |
+ spin_unlock_irq(&phba->hbalock); |
2252 |
+@@ -556,12 +558,12 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
2253 |
+ cnt = (LPFC_NODELIST_SIZE / LPFC_NODELIST_ENTRY_SIZE); |
2254 |
+ outio = 0; |
2255 |
+ |
2256 |
+- len += snprintf(buf+len, size-len, "\nFCP Nodelist Entries ...\n"); |
2257 |
++ len += scnprintf(buf+len, size-len, "\nFCP Nodelist Entries ...\n"); |
2258 |
+ spin_lock_irq(shost->host_lock); |
2259 |
+ list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { |
2260 |
+ iocnt = 0; |
2261 |
+ if (!cnt) { |
2262 |
+- len += snprintf(buf+len, size-len, |
2263 |
++ len += scnprintf(buf+len, size-len, |
2264 |
+ "Missing Nodelist Entries\n"); |
2265 |
+ break; |
2266 |
+ } |
2267 |
+@@ -599,63 +601,63 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
2268 |
+ default: |
2269 |
+ statep = "UNKNOWN"; |
2270 |
+ } |
2271 |
+- len += snprintf(buf+len, size-len, "%s DID:x%06x ", |
2272 |
++ len += scnprintf(buf+len, size-len, "%s DID:x%06x ", |
2273 |
+ statep, ndlp->nlp_DID); |
2274 |
+- len += snprintf(buf+len, size-len, |
2275 |
++ len += scnprintf(buf+len, size-len, |
2276 |
+ "WWPN x%llx ", |
2277 |
+ wwn_to_u64(ndlp->nlp_portname.u.wwn)); |
2278 |
+- len += snprintf(buf+len, size-len, |
2279 |
++ len += scnprintf(buf+len, size-len, |
2280 |
+ "WWNN x%llx ", |
2281 |
+ wwn_to_u64(ndlp->nlp_nodename.u.wwn)); |
2282 |
+ if (ndlp->nlp_flag & NLP_RPI_REGISTERED) |
2283 |
+- len += snprintf(buf+len, size-len, "RPI:%03d ", |
2284 |
++ len += scnprintf(buf+len, size-len, "RPI:%03d ", |
2285 |
+ ndlp->nlp_rpi); |
2286 |
+ else |
2287 |
+- len += snprintf(buf+len, size-len, "RPI:none "); |
2288 |
+- len += snprintf(buf+len, size-len, "flag:x%08x ", |
2289 |
++ len += scnprintf(buf+len, size-len, "RPI:none "); |
2290 |
++ len += scnprintf(buf+len, size-len, "flag:x%08x ", |
2291 |
+ ndlp->nlp_flag); |
2292 |
+ if (!ndlp->nlp_type) |
2293 |
+- len += snprintf(buf+len, size-len, "UNKNOWN_TYPE "); |
2294 |
++ len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE "); |
2295 |
+ if (ndlp->nlp_type & NLP_FC_NODE) |
2296 |
+- len += snprintf(buf+len, size-len, "FC_NODE "); |
2297 |
++ len += scnprintf(buf+len, size-len, "FC_NODE "); |
2298 |
+ if (ndlp->nlp_type & NLP_FABRIC) { |
2299 |
+- len += snprintf(buf+len, size-len, "FABRIC "); |
2300 |
++ len += scnprintf(buf+len, size-len, "FABRIC "); |
2301 |
+ iocnt = 0; |
2302 |
+ } |
2303 |
+ if (ndlp->nlp_type & NLP_FCP_TARGET) |
2304 |
+- len += snprintf(buf+len, size-len, "FCP_TGT sid:%d ", |
2305 |
++ len += scnprintf(buf+len, size-len, "FCP_TGT sid:%d ", |
2306 |
+ ndlp->nlp_sid); |
2307 |
+ if (ndlp->nlp_type & NLP_FCP_INITIATOR) |
2308 |
+- len += snprintf(buf+len, size-len, "FCP_INITIATOR "); |
2309 |
++ len += scnprintf(buf+len, size-len, "FCP_INITIATOR "); |
2310 |
+ if (ndlp->nlp_type & NLP_NVME_TARGET) |
2311 |
+- len += snprintf(buf + len, |
2312 |
++ len += scnprintf(buf + len, |
2313 |
+ size - len, "NVME_TGT sid:%d ", |
2314 |
+ NLP_NO_SID); |
2315 |
+ if (ndlp->nlp_type & NLP_NVME_INITIATOR) |
2316 |
+- len += snprintf(buf + len, |
2317 |
++ len += scnprintf(buf + len, |
2318 |
+ size - len, "NVME_INITIATOR "); |
2319 |
+- len += snprintf(buf+len, size-len, "usgmap:%x ", |
2320 |
++ len += scnprintf(buf+len, size-len, "usgmap:%x ", |
2321 |
+ ndlp->nlp_usg_map); |
2322 |
+- len += snprintf(buf+len, size-len, "refcnt:%x", |
2323 |
++ len += scnprintf(buf+len, size-len, "refcnt:%x", |
2324 |
+ kref_read(&ndlp->kref)); |
2325 |
+ if (iocnt) { |
2326 |
+ i = atomic_read(&ndlp->cmd_pending); |
2327 |
+- len += snprintf(buf + len, size - len, |
2328 |
++ len += scnprintf(buf + len, size - len, |
2329 |
+ " OutIO:x%x Qdepth x%x", |
2330 |
+ i, ndlp->cmd_qdepth); |
2331 |
+ outio += i; |
2332 |
+ } |
2333 |
+- len += snprintf(buf + len, size - len, "defer:%x ", |
2334 |
++ len += scnprintf(buf + len, size - len, "defer:%x ", |
2335 |
+ ndlp->nlp_defer_did); |
2336 |
+- len += snprintf(buf+len, size-len, "\n"); |
2337 |
++ len += scnprintf(buf+len, size-len, "\n"); |
2338 |
+ } |
2339 |
+ spin_unlock_irq(shost->host_lock); |
2340 |
+ |
2341 |
+- len += snprintf(buf + len, size - len, |
2342 |
++ len += scnprintf(buf + len, size - len, |
2343 |
+ "\nOutstanding IO x%x\n", outio); |
2344 |
+ |
2345 |
+ if (phba->nvmet_support && phba->targetport && (vport == phba->pport)) { |
2346 |
+- len += snprintf(buf + len, size - len, |
2347 |
++ len += scnprintf(buf + len, size - len, |
2348 |
+ "\nNVME Targetport Entry ...\n"); |
2349 |
+ |
2350 |
+ /* Port state is only one of two values for now. */ |
2351 |
+@@ -663,18 +665,18 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
2352 |
+ statep = "REGISTERED"; |
2353 |
+ else |
2354 |
+ statep = "INIT"; |
2355 |
+- len += snprintf(buf + len, size - len, |
2356 |
++ len += scnprintf(buf + len, size - len, |
2357 |
+ "TGT WWNN x%llx WWPN x%llx State %s\n", |
2358 |
+ wwn_to_u64(vport->fc_nodename.u.wwn), |
2359 |
+ wwn_to_u64(vport->fc_portname.u.wwn), |
2360 |
+ statep); |
2361 |
+- len += snprintf(buf + len, size - len, |
2362 |
++ len += scnprintf(buf + len, size - len, |
2363 |
+ " Targetport DID x%06x\n", |
2364 |
+ phba->targetport->port_id); |
2365 |
+ goto out_exit; |
2366 |
+ } |
2367 |
+ |
2368 |
+- len += snprintf(buf + len, size - len, |
2369 |
++ len += scnprintf(buf + len, size - len, |
2370 |
+ "\nNVME Lport/Rport Entries ...\n"); |
2371 |
+ |
2372 |
+ localport = vport->localport; |
2373 |
+@@ -689,11 +691,11 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
2374 |
+ else |
2375 |
+ statep = "UNKNOWN "; |
2376 |
+ |
2377 |
+- len += snprintf(buf + len, size - len, |
2378 |
++ len += scnprintf(buf + len, size - len, |
2379 |
+ "Lport DID x%06x PortState %s\n", |
2380 |
+ localport->port_id, statep); |
2381 |
+ |
2382 |
+- len += snprintf(buf + len, size - len, "\tRport List:\n"); |
2383 |
++ len += scnprintf(buf + len, size - len, "\tRport List:\n"); |
2384 |
+ list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { |
2385 |
+ /* local short-hand pointer. */ |
2386 |
+ spin_lock(&phba->hbalock); |
2387 |
+@@ -720,32 +722,32 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) |
2388 |
+ } |
2389 |
+ |
2390 |
+ /* Tab in to show lport ownership. */ |
2391 |
+- len += snprintf(buf + len, size - len, |
2392 |
++ len += scnprintf(buf + len, size - len, |
2393 |
+ "\t%s Port ID:x%06x ", |
2394 |
+ statep, nrport->port_id); |
2395 |
+- len += snprintf(buf + len, size - len, "WWPN x%llx ", |
2396 |
++ len += scnprintf(buf + len, size - len, "WWPN x%llx ", |
2397 |
+ nrport->port_name); |
2398 |
+- len += snprintf(buf + len, size - len, "WWNN x%llx ", |
2399 |
++ len += scnprintf(buf + len, size - len, "WWNN x%llx ", |
2400 |
+ nrport->node_name); |
2401 |
+ |
2402 |
+ /* An NVME rport can have multiple roles. */ |
2403 |
+ if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) |
2404 |
+- len += snprintf(buf + len, size - len, |
2405 |
++ len += scnprintf(buf + len, size - len, |
2406 |
+ "INITIATOR "); |
2407 |
+ if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) |
2408 |
+- len += snprintf(buf + len, size - len, |
2409 |
++ len += scnprintf(buf + len, size - len, |
2410 |
+ "TARGET "); |
2411 |
+ if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) |
2412 |
+- len += snprintf(buf + len, size - len, |
2413 |
++ len += scnprintf(buf + len, size - len, |
2414 |
+ "DISCSRVC "); |
2415 |
+ if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | |
2416 |
+ FC_PORT_ROLE_NVME_TARGET | |
2417 |
+ FC_PORT_ROLE_NVME_DISCOVERY)) |
2418 |
+- len += snprintf(buf + len, size - len, |
2419 |
++ len += scnprintf(buf + len, size - len, |
2420 |
+ "UNKNOWN ROLE x%x", |
2421 |
+ nrport->port_role); |
2422 |
+ /* Terminate the string. */ |
2423 |
+- len += snprintf(buf + len, size - len, "\n"); |
2424 |
++ len += scnprintf(buf + len, size - len, "\n"); |
2425 |
+ } |
2426 |
+ |
2427 |
+ spin_unlock_irq(shost->host_lock); |
2428 |
+@@ -784,35 +786,35 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2429 |
+ if (!phba->targetport) |
2430 |
+ return len; |
2431 |
+ tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; |
2432 |
+- len += snprintf(buf + len, size - len, |
2433 |
++ len += scnprintf(buf + len, size - len, |
2434 |
+ "\nNVME Targetport Statistics\n"); |
2435 |
+ |
2436 |
+- len += snprintf(buf + len, size - len, |
2437 |
++ len += scnprintf(buf + len, size - len, |
2438 |
+ "LS: Rcv %08x Drop %08x Abort %08x\n", |
2439 |
+ atomic_read(&tgtp->rcv_ls_req_in), |
2440 |
+ atomic_read(&tgtp->rcv_ls_req_drop), |
2441 |
+ atomic_read(&tgtp->xmt_ls_abort)); |
2442 |
+ if (atomic_read(&tgtp->rcv_ls_req_in) != |
2443 |
+ atomic_read(&tgtp->rcv_ls_req_out)) { |
2444 |
+- len += snprintf(buf + len, size - len, |
2445 |
++ len += scnprintf(buf + len, size - len, |
2446 |
+ "Rcv LS: in %08x != out %08x\n", |
2447 |
+ atomic_read(&tgtp->rcv_ls_req_in), |
2448 |
+ atomic_read(&tgtp->rcv_ls_req_out)); |
2449 |
+ } |
2450 |
+ |
2451 |
+- len += snprintf(buf + len, size - len, |
2452 |
++ len += scnprintf(buf + len, size - len, |
2453 |
+ "LS: Xmt %08x Drop %08x Cmpl %08x\n", |
2454 |
+ atomic_read(&tgtp->xmt_ls_rsp), |
2455 |
+ atomic_read(&tgtp->xmt_ls_drop), |
2456 |
+ atomic_read(&tgtp->xmt_ls_rsp_cmpl)); |
2457 |
+ |
2458 |
+- len += snprintf(buf + len, size - len, |
2459 |
++ len += scnprintf(buf + len, size - len, |
2460 |
+ "LS: RSP Abort %08x xb %08x Err %08x\n", |
2461 |
+ atomic_read(&tgtp->xmt_ls_rsp_aborted), |
2462 |
+ atomic_read(&tgtp->xmt_ls_rsp_xb_set), |
2463 |
+ atomic_read(&tgtp->xmt_ls_rsp_error)); |
2464 |
+ |
2465 |
+- len += snprintf(buf + len, size - len, |
2466 |
++ len += scnprintf(buf + len, size - len, |
2467 |
+ "FCP: Rcv %08x Defer %08x Release %08x " |
2468 |
+ "Drop %08x\n", |
2469 |
+ atomic_read(&tgtp->rcv_fcp_cmd_in), |
2470 |
+@@ -822,13 +824,13 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2471 |
+ |
2472 |
+ if (atomic_read(&tgtp->rcv_fcp_cmd_in) != |
2473 |
+ atomic_read(&tgtp->rcv_fcp_cmd_out)) { |
2474 |
+- len += snprintf(buf + len, size - len, |
2475 |
++ len += scnprintf(buf + len, size - len, |
2476 |
+ "Rcv FCP: in %08x != out %08x\n", |
2477 |
+ atomic_read(&tgtp->rcv_fcp_cmd_in), |
2478 |
+ atomic_read(&tgtp->rcv_fcp_cmd_out)); |
2479 |
+ } |
2480 |
+ |
2481 |
+- len += snprintf(buf + len, size - len, |
2482 |
++ len += scnprintf(buf + len, size - len, |
2483 |
+ "FCP Rsp: read %08x readrsp %08x " |
2484 |
+ "write %08x rsp %08x\n", |
2485 |
+ atomic_read(&tgtp->xmt_fcp_read), |
2486 |
+@@ -836,31 +838,31 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2487 |
+ atomic_read(&tgtp->xmt_fcp_write), |
2488 |
+ atomic_read(&tgtp->xmt_fcp_rsp)); |
2489 |
+ |
2490 |
+- len += snprintf(buf + len, size - len, |
2491 |
++ len += scnprintf(buf + len, size - len, |
2492 |
+ "FCP Rsp Cmpl: %08x err %08x drop %08x\n", |
2493 |
+ atomic_read(&tgtp->xmt_fcp_rsp_cmpl), |
2494 |
+ atomic_read(&tgtp->xmt_fcp_rsp_error), |
2495 |
+ atomic_read(&tgtp->xmt_fcp_rsp_drop)); |
2496 |
+ |
2497 |
+- len += snprintf(buf + len, size - len, |
2498 |
++ len += scnprintf(buf + len, size - len, |
2499 |
+ "FCP Rsp Abort: %08x xb %08x xricqe %08x\n", |
2500 |
+ atomic_read(&tgtp->xmt_fcp_rsp_aborted), |
2501 |
+ atomic_read(&tgtp->xmt_fcp_rsp_xb_set), |
2502 |
+ atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); |
2503 |
+ |
2504 |
+- len += snprintf(buf + len, size - len, |
2505 |
++ len += scnprintf(buf + len, size - len, |
2506 |
+ "ABORT: Xmt %08x Cmpl %08x\n", |
2507 |
+ atomic_read(&tgtp->xmt_fcp_abort), |
2508 |
+ atomic_read(&tgtp->xmt_fcp_abort_cmpl)); |
2509 |
+ |
2510 |
+- len += snprintf(buf + len, size - len, |
2511 |
++ len += scnprintf(buf + len, size - len, |
2512 |
+ "ABORT: Sol %08x Usol %08x Err %08x Cmpl %08x", |
2513 |
+ atomic_read(&tgtp->xmt_abort_sol), |
2514 |
+ atomic_read(&tgtp->xmt_abort_unsol), |
2515 |
+ atomic_read(&tgtp->xmt_abort_rsp), |
2516 |
+ atomic_read(&tgtp->xmt_abort_rsp_error)); |
2517 |
+ |
2518 |
+- len += snprintf(buf + len, size - len, "\n"); |
2519 |
++ len += scnprintf(buf + len, size - len, "\n"); |
2520 |
+ |
2521 |
+ cnt = 0; |
2522 |
+ spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock); |
2523 |
+@@ -871,7 +873,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2524 |
+ } |
2525 |
+ spin_unlock(&phba->sli4_hba.abts_nvme_buf_list_lock); |
2526 |
+ if (cnt) { |
2527 |
+- len += snprintf(buf + len, size - len, |
2528 |
++ len += scnprintf(buf + len, size - len, |
2529 |
+ "ABORT: %d ctx entries\n", cnt); |
2530 |
+ spin_lock(&phba->sli4_hba.abts_nvme_buf_list_lock); |
2531 |
+ list_for_each_entry_safe(ctxp, next_ctxp, |
2532 |
+@@ -879,7 +881,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2533 |
+ list) { |
2534 |
+ if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ)) |
2535 |
+ break; |
2536 |
+- len += snprintf(buf + len, size - len, |
2537 |
++ len += scnprintf(buf + len, size - len, |
2538 |
+ "Entry: oxid %x state %x " |
2539 |
+ "flag %x\n", |
2540 |
+ ctxp->oxid, ctxp->state, |
2541 |
+@@ -893,7 +895,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2542 |
+ tot += atomic_read(&tgtp->xmt_fcp_release); |
2543 |
+ tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; |
2544 |
+ |
2545 |
+- len += snprintf(buf + len, size - len, |
2546 |
++ len += scnprintf(buf + len, size - len, |
2547 |
+ "IO_CTX: %08x WAIT: cur %08x tot %08x\n" |
2548 |
+ "CTX Outstanding %08llx\n", |
2549 |
+ phba->sli4_hba.nvmet_xri_cnt, |
2550 |
+@@ -911,10 +913,10 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2551 |
+ if (!lport) |
2552 |
+ return len; |
2553 |
+ |
2554 |
+- len += snprintf(buf + len, size - len, |
2555 |
++ len += scnprintf(buf + len, size - len, |
2556 |
+ "\nNVME Lport Statistics\n"); |
2557 |
+ |
2558 |
+- len += snprintf(buf + len, size - len, |
2559 |
++ len += scnprintf(buf + len, size - len, |
2560 |
+ "LS: Xmt %016x Cmpl %016x\n", |
2561 |
+ atomic_read(&lport->fc4NvmeLsRequests), |
2562 |
+ atomic_read(&lport->fc4NvmeLsCmpls)); |
2563 |
+@@ -938,20 +940,20 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2564 |
+ if (i >= 32) |
2565 |
+ continue; |
2566 |
+ |
2567 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2568 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2569 |
+ "FCP (%d): Rd %016llx Wr %016llx " |
2570 |
+ "IO %016llx ", |
2571 |
+ i, data1, data2, data3); |
2572 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2573 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2574 |
+ "Cmpl %016llx OutIO %016llx\n", |
2575 |
+ tot, ((data1 + data2 + data3) - tot)); |
2576 |
+ } |
2577 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2578 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2579 |
+ "Total FCP Cmpl %016llx Issue %016llx " |
2580 |
+ "OutIO %016llx\n", |
2581 |
+ totin, totout, totout - totin); |
2582 |
+ |
2583 |
+- len += snprintf(buf + len, size - len, |
2584 |
++ len += scnprintf(buf + len, size - len, |
2585 |
+ "LS Xmt Err: Abrt %08x Err %08x " |
2586 |
+ "Cmpl Err: xb %08x Err %08x\n", |
2587 |
+ atomic_read(&lport->xmt_ls_abort), |
2588 |
+@@ -959,7 +961,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2589 |
+ atomic_read(&lport->cmpl_ls_xb), |
2590 |
+ atomic_read(&lport->cmpl_ls_err)); |
2591 |
+ |
2592 |
+- len += snprintf(buf + len, size - len, |
2593 |
++ len += scnprintf(buf + len, size - len, |
2594 |
+ "FCP Xmt Err: noxri %06x nondlp %06x " |
2595 |
+ "qdepth %06x wqerr %06x err %06x Abrt %06x\n", |
2596 |
+ atomic_read(&lport->xmt_fcp_noxri), |
2597 |
+@@ -969,7 +971,7 @@ lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) |
2598 |
+ atomic_read(&lport->xmt_fcp_err), |
2599 |
+ atomic_read(&lport->xmt_fcp_abort)); |
2600 |
+ |
2601 |
+- len += snprintf(buf + len, size - len, |
2602 |
++ len += scnprintf(buf + len, size - len, |
2603 |
+ "FCP Cmpl Err: xb %08x Err %08x\n", |
2604 |
+ atomic_read(&lport->cmpl_fcp_xb), |
2605 |
+ atomic_read(&lport->cmpl_fcp_err)); |
2606 |
+@@ -1001,58 +1003,58 @@ lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size) |
2607 |
+ |
2608 |
+ if (phba->nvmet_support == 0) { |
2609 |
+ /* NVME Initiator */ |
2610 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2611 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2612 |
+ "ktime %s: Total Samples: %lld\n", |
2613 |
+ (phba->ktime_on ? "Enabled" : "Disabled"), |
2614 |
+ phba->ktime_data_samples); |
2615 |
+ if (phba->ktime_data_samples == 0) |
2616 |
+ return len; |
2617 |
+ |
2618 |
+- len += snprintf( |
2619 |
++ len += scnprintf( |
2620 |
+ buf + len, PAGE_SIZE - len, |
2621 |
+ "Segment 1: Last NVME Cmd cmpl " |
2622 |
+ "done -to- Start of next NVME cnd (in driver)\n"); |
2623 |
+- len += snprintf( |
2624 |
++ len += scnprintf( |
2625 |
+ buf + len, PAGE_SIZE - len, |
2626 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2627 |
+ div_u64(phba->ktime_seg1_total, |
2628 |
+ phba->ktime_data_samples), |
2629 |
+ phba->ktime_seg1_min, |
2630 |
+ phba->ktime_seg1_max); |
2631 |
+- len += snprintf( |
2632 |
++ len += scnprintf( |
2633 |
+ buf + len, PAGE_SIZE - len, |
2634 |
+ "Segment 2: Driver start of NVME cmd " |
2635 |
+ "-to- Firmware WQ doorbell\n"); |
2636 |
+- len += snprintf( |
2637 |
++ len += scnprintf( |
2638 |
+ buf + len, PAGE_SIZE - len, |
2639 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2640 |
+ div_u64(phba->ktime_seg2_total, |
2641 |
+ phba->ktime_data_samples), |
2642 |
+ phba->ktime_seg2_min, |
2643 |
+ phba->ktime_seg2_max); |
2644 |
+- len += snprintf( |
2645 |
++ len += scnprintf( |
2646 |
+ buf + len, PAGE_SIZE - len, |
2647 |
+ "Segment 3: Firmware WQ doorbell -to- " |
2648 |
+ "MSI-X ISR cmpl\n"); |
2649 |
+- len += snprintf( |
2650 |
++ len += scnprintf( |
2651 |
+ buf + len, PAGE_SIZE - len, |
2652 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2653 |
+ div_u64(phba->ktime_seg3_total, |
2654 |
+ phba->ktime_data_samples), |
2655 |
+ phba->ktime_seg3_min, |
2656 |
+ phba->ktime_seg3_max); |
2657 |
+- len += snprintf( |
2658 |
++ len += scnprintf( |
2659 |
+ buf + len, PAGE_SIZE - len, |
2660 |
+ "Segment 4: MSI-X ISR cmpl -to- " |
2661 |
+ "NVME cmpl done\n"); |
2662 |
+- len += snprintf( |
2663 |
++ len += scnprintf( |
2664 |
+ buf + len, PAGE_SIZE - len, |
2665 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2666 |
+ div_u64(phba->ktime_seg4_total, |
2667 |
+ phba->ktime_data_samples), |
2668 |
+ phba->ktime_seg4_min, |
2669 |
+ phba->ktime_seg4_max); |
2670 |
+- len += snprintf( |
2671 |
++ len += scnprintf( |
2672 |
+ buf + len, PAGE_SIZE - len, |
2673 |
+ "Total IO avg time: %08lld\n", |
2674 |
+ div_u64(phba->ktime_seg1_total + |
2675 |
+@@ -1064,7 +1066,7 @@ lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size) |
2676 |
+ } |
2677 |
+ |
2678 |
+ /* NVME Target */ |
2679 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2680 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2681 |
+ "ktime %s: Total Samples: %lld %lld\n", |
2682 |
+ (phba->ktime_on ? "Enabled" : "Disabled"), |
2683 |
+ phba->ktime_data_samples, |
2684 |
+@@ -1072,46 +1074,46 @@ lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size) |
2685 |
+ if (phba->ktime_data_samples == 0) |
2686 |
+ return len; |
2687 |
+ |
2688 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2689 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2690 |
+ "Segment 1: MSI-X ISR Rcv cmd -to- " |
2691 |
+ "cmd pass to NVME Layer\n"); |
2692 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2693 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2694 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2695 |
+ div_u64(phba->ktime_seg1_total, |
2696 |
+ phba->ktime_data_samples), |
2697 |
+ phba->ktime_seg1_min, |
2698 |
+ phba->ktime_seg1_max); |
2699 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2700 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2701 |
+ "Segment 2: cmd pass to NVME Layer- " |
2702 |
+ "-to- Driver rcv cmd OP (action)\n"); |
2703 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2704 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2705 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2706 |
+ div_u64(phba->ktime_seg2_total, |
2707 |
+ phba->ktime_data_samples), |
2708 |
+ phba->ktime_seg2_min, |
2709 |
+ phba->ktime_seg2_max); |
2710 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2711 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2712 |
+ "Segment 3: Driver rcv cmd OP -to- " |
2713 |
+ "Firmware WQ doorbell: cmd\n"); |
2714 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2715 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2716 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2717 |
+ div_u64(phba->ktime_seg3_total, |
2718 |
+ phba->ktime_data_samples), |
2719 |
+ phba->ktime_seg3_min, |
2720 |
+ phba->ktime_seg3_max); |
2721 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2722 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2723 |
+ "Segment 4: Firmware WQ doorbell: cmd " |
2724 |
+ "-to- MSI-X ISR for cmd cmpl\n"); |
2725 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2726 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2727 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2728 |
+ div_u64(phba->ktime_seg4_total, |
2729 |
+ phba->ktime_data_samples), |
2730 |
+ phba->ktime_seg4_min, |
2731 |
+ phba->ktime_seg4_max); |
2732 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2733 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2734 |
+ "Segment 5: MSI-X ISR for cmd cmpl " |
2735 |
+ "-to- NVME layer passed cmd done\n"); |
2736 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2737 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2738 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2739 |
+ div_u64(phba->ktime_seg5_total, |
2740 |
+ phba->ktime_data_samples), |
2741 |
+@@ -1119,10 +1121,10 @@ lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size) |
2742 |
+ phba->ktime_seg5_max); |
2743 |
+ |
2744 |
+ if (phba->ktime_status_samples == 0) { |
2745 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2746 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2747 |
+ "Total: cmd received by MSI-X ISR " |
2748 |
+ "-to- cmd completed on wire\n"); |
2749 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2750 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2751 |
+ "avg:%08lld min:%08lld " |
2752 |
+ "max %08lld\n", |
2753 |
+ div_u64(phba->ktime_seg10_total, |
2754 |
+@@ -1132,46 +1134,46 @@ lpfc_debugfs_nvmektime_data(struct lpfc_vport *vport, char *buf, int size) |
2755 |
+ return len; |
2756 |
+ } |
2757 |
+ |
2758 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2759 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2760 |
+ "Segment 6: NVME layer passed cmd done " |
2761 |
+ "-to- Driver rcv rsp status OP\n"); |
2762 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2763 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2764 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2765 |
+ div_u64(phba->ktime_seg6_total, |
2766 |
+ phba->ktime_status_samples), |
2767 |
+ phba->ktime_seg6_min, |
2768 |
+ phba->ktime_seg6_max); |
2769 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2770 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2771 |
+ "Segment 7: Driver rcv rsp status OP " |
2772 |
+ "-to- Firmware WQ doorbell: status\n"); |
2773 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2774 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2775 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2776 |
+ div_u64(phba->ktime_seg7_total, |
2777 |
+ phba->ktime_status_samples), |
2778 |
+ phba->ktime_seg7_min, |
2779 |
+ phba->ktime_seg7_max); |
2780 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2781 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2782 |
+ "Segment 8: Firmware WQ doorbell: status" |
2783 |
+ " -to- MSI-X ISR for status cmpl\n"); |
2784 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2785 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2786 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2787 |
+ div_u64(phba->ktime_seg8_total, |
2788 |
+ phba->ktime_status_samples), |
2789 |
+ phba->ktime_seg8_min, |
2790 |
+ phba->ktime_seg8_max); |
2791 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2792 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2793 |
+ "Segment 9: MSI-X ISR for status cmpl " |
2794 |
+ "-to- NVME layer passed status done\n"); |
2795 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2796 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2797 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2798 |
+ div_u64(phba->ktime_seg9_total, |
2799 |
+ phba->ktime_status_samples), |
2800 |
+ phba->ktime_seg9_min, |
2801 |
+ phba->ktime_seg9_max); |
2802 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2803 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2804 |
+ "Total: cmd received by MSI-X ISR -to- " |
2805 |
+ "cmd completed on wire\n"); |
2806 |
+- len += snprintf(buf + len, PAGE_SIZE-len, |
2807 |
++ len += scnprintf(buf + len, PAGE_SIZE-len, |
2808 |
+ "avg:%08lld min:%08lld max %08lld\n", |
2809 |
+ div_u64(phba->ktime_seg10_total, |
2810 |
+ phba->ktime_status_samples), |
2811 |
+@@ -1206,7 +1208,7 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2812 |
+ (phba->nvmeio_trc_size - 1); |
2813 |
+ skip = phba->nvmeio_trc_output_idx; |
2814 |
+ |
2815 |
+- len += snprintf(buf + len, size - len, |
2816 |
++ len += scnprintf(buf + len, size - len, |
2817 |
+ "%s IO Trace %s: next_idx %d skip %d size %d\n", |
2818 |
+ (phba->nvmet_support ? "NVME" : "NVMET"), |
2819 |
+ (state ? "Enabled" : "Disabled"), |
2820 |
+@@ -1228,18 +1230,18 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2821 |
+ if (!dtp->fmt) |
2822 |
+ continue; |
2823 |
+ |
2824 |
+- len += snprintf(buf + len, size - len, dtp->fmt, |
2825 |
++ len += scnprintf(buf + len, size - len, dtp->fmt, |
2826 |
+ dtp->data1, dtp->data2, dtp->data3); |
2827 |
+ |
2828 |
+ if (phba->nvmeio_trc_output_idx >= phba->nvmeio_trc_size) { |
2829 |
+ phba->nvmeio_trc_output_idx = 0; |
2830 |
+- len += snprintf(buf + len, size - len, |
2831 |
++ len += scnprintf(buf + len, size - len, |
2832 |
+ "Trace Complete\n"); |
2833 |
+ goto out; |
2834 |
+ } |
2835 |
+ |
2836 |
+ if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ)) { |
2837 |
+- len += snprintf(buf + len, size - len, |
2838 |
++ len += scnprintf(buf + len, size - len, |
2839 |
+ "Trace Continue (%d of %d)\n", |
2840 |
+ phba->nvmeio_trc_output_idx, |
2841 |
+ phba->nvmeio_trc_size); |
2842 |
+@@ -1257,18 +1259,18 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2843 |
+ if (!dtp->fmt) |
2844 |
+ continue; |
2845 |
+ |
2846 |
+- len += snprintf(buf + len, size - len, dtp->fmt, |
2847 |
++ len += scnprintf(buf + len, size - len, dtp->fmt, |
2848 |
+ dtp->data1, dtp->data2, dtp->data3); |
2849 |
+ |
2850 |
+ if (phba->nvmeio_trc_output_idx >= phba->nvmeio_trc_size) { |
2851 |
+ phba->nvmeio_trc_output_idx = 0; |
2852 |
+- len += snprintf(buf + len, size - len, |
2853 |
++ len += scnprintf(buf + len, size - len, |
2854 |
+ "Trace Complete\n"); |
2855 |
+ goto out; |
2856 |
+ } |
2857 |
+ |
2858 |
+ if (len >= (size - LPFC_DEBUG_OUT_LINE_SZ)) { |
2859 |
+- len += snprintf(buf + len, size - len, |
2860 |
++ len += scnprintf(buf + len, size - len, |
2861 |
+ "Trace Continue (%d of %d)\n", |
2862 |
+ phba->nvmeio_trc_output_idx, |
2863 |
+ phba->nvmeio_trc_size); |
2864 |
+@@ -1276,7 +1278,7 @@ lpfc_debugfs_nvmeio_trc_data(struct lpfc_hba *phba, char *buf, int size) |
2865 |
+ } |
2866 |
+ } |
2867 |
+ |
2868 |
+- len += snprintf(buf + len, size - len, |
2869 |
++ len += scnprintf(buf + len, size - len, |
2870 |
+ "Trace Done\n"); |
2871 |
+ out: |
2872 |
+ return len; |
2873 |
+@@ -1308,39 +1310,39 @@ lpfc_debugfs_cpucheck_data(struct lpfc_vport *vport, char *buf, int size) |
2874 |
+ |
2875 |
+ if (phba->nvmet_support == 0) { |
2876 |
+ /* NVME Initiator */ |
2877 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2878 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2879 |
+ "CPUcheck %s\n", |
2880 |
+ (phba->cpucheck_on & LPFC_CHECK_NVME_IO ? |
2881 |
+ "Enabled" : "Disabled")); |
2882 |
+ for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { |
2883 |
+ if (i >= LPFC_CHECK_CPU_CNT) |
2884 |
+ break; |
2885 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2886 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2887 |
+ "%02d: xmit x%08x cmpl x%08x\n", |
2888 |
+ i, phba->cpucheck_xmt_io[i], |
2889 |
+ phba->cpucheck_cmpl_io[i]); |
2890 |
+ tot_xmt += phba->cpucheck_xmt_io[i]; |
2891 |
+ tot_cmpl += phba->cpucheck_cmpl_io[i]; |
2892 |
+ } |
2893 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2894 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2895 |
+ "tot:xmit x%08x cmpl x%08x\n", |
2896 |
+ tot_xmt, tot_cmpl); |
2897 |
+ return len; |
2898 |
+ } |
2899 |
+ |
2900 |
+ /* NVME Target */ |
2901 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2902 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2903 |
+ "CPUcheck %s ", |
2904 |
+ (phba->cpucheck_on & LPFC_CHECK_NVMET_IO ? |
2905 |
+ "IO Enabled - " : "IO Disabled - ")); |
2906 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2907 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2908 |
+ "%s\n", |
2909 |
+ (phba->cpucheck_on & LPFC_CHECK_NVMET_RCV ? |
2910 |
+ "Rcv Enabled\n" : "Rcv Disabled\n")); |
2911 |
+ for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) { |
2912 |
+ if (i >= LPFC_CHECK_CPU_CNT) |
2913 |
+ break; |
2914 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2915 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2916 |
+ "%02d: xmit x%08x ccmpl x%08x " |
2917 |
+ "cmpl x%08x rcv x%08x\n", |
2918 |
+ i, phba->cpucheck_xmt_io[i], |
2919 |
+@@ -1352,7 +1354,7 @@ lpfc_debugfs_cpucheck_data(struct lpfc_vport *vport, char *buf, int size) |
2920 |
+ tot_cmpl += phba->cpucheck_cmpl_io[i]; |
2921 |
+ tot_ccmpl += phba->cpucheck_ccmpl_io[i]; |
2922 |
+ } |
2923 |
+- len += snprintf(buf + len, PAGE_SIZE - len, |
2924 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
2925 |
+ "tot:xmit x%08x ccmpl x%08x cmpl x%08x rcv x%08x\n", |
2926 |
+ tot_xmt, tot_ccmpl, tot_cmpl, tot_rcv); |
2927 |
+ return len; |
2928 |
+@@ -1797,28 +1799,29 @@ lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, |
2929 |
+ int cnt = 0; |
2930 |
+ |
2931 |
+ if (dent == phba->debug_writeGuard) |
2932 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt); |
2933 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt); |
2934 |
+ else if (dent == phba->debug_writeApp) |
2935 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt); |
2936 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt); |
2937 |
+ else if (dent == phba->debug_writeRef) |
2938 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt); |
2939 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt); |
2940 |
+ else if (dent == phba->debug_readGuard) |
2941 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt); |
2942 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt); |
2943 |
+ else if (dent == phba->debug_readApp) |
2944 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt); |
2945 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt); |
2946 |
+ else if (dent == phba->debug_readRef) |
2947 |
+- cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt); |
2948 |
++ cnt = scnprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt); |
2949 |
+ else if (dent == phba->debug_InjErrNPortID) |
2950 |
+- cnt = snprintf(cbuf, 32, "0x%06x\n", phba->lpfc_injerr_nportid); |
2951 |
++ cnt = scnprintf(cbuf, 32, "0x%06x\n", |
2952 |
++ phba->lpfc_injerr_nportid); |
2953 |
+ else if (dent == phba->debug_InjErrWWPN) { |
2954 |
+ memcpy(&tmp, &phba->lpfc_injerr_wwpn, sizeof(struct lpfc_name)); |
2955 |
+ tmp = cpu_to_be64(tmp); |
2956 |
+- cnt = snprintf(cbuf, 32, "0x%016llx\n", tmp); |
2957 |
++ cnt = scnprintf(cbuf, 32, "0x%016llx\n", tmp); |
2958 |
+ } else if (dent == phba->debug_InjErrLBA) { |
2959 |
+ if (phba->lpfc_injerr_lba == (sector_t)(-1)) |
2960 |
+- cnt = snprintf(cbuf, 32, "off\n"); |
2961 |
++ cnt = scnprintf(cbuf, 32, "off\n"); |
2962 |
+ else |
2963 |
+- cnt = snprintf(cbuf, 32, "0x%llx\n", |
2964 |
++ cnt = scnprintf(cbuf, 32, "0x%llx\n", |
2965 |
+ (uint64_t) phba->lpfc_injerr_lba); |
2966 |
+ } else |
2967 |
+ lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2968 |
+@@ -2624,17 +2627,17 @@ lpfc_idiag_pcicfg_read(struct file *file, char __user *buf, size_t nbytes, |
2969 |
+ switch (count) { |
2970 |
+ case SIZE_U8: /* byte (8 bits) */ |
2971 |
+ pci_read_config_byte(pdev, where, &u8val); |
2972 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2973 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2974 |
+ "%03x: %02x\n", where, u8val); |
2975 |
+ break; |
2976 |
+ case SIZE_U16: /* word (16 bits) */ |
2977 |
+ pci_read_config_word(pdev, where, &u16val); |
2978 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2979 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2980 |
+ "%03x: %04x\n", where, u16val); |
2981 |
+ break; |
2982 |
+ case SIZE_U32: /* double word (32 bits) */ |
2983 |
+ pci_read_config_dword(pdev, where, &u32val); |
2984 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2985 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2986 |
+ "%03x: %08x\n", where, u32val); |
2987 |
+ break; |
2988 |
+ case LPFC_PCI_CFG_BROWSE: /* browse all */ |
2989 |
+@@ -2654,25 +2657,25 @@ pcicfg_browse: |
2990 |
+ offset = offset_label; |
2991 |
+ |
2992 |
+ /* Read PCI config space */ |
2993 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2994 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2995 |
+ "%03x: ", offset_label); |
2996 |
+ while (index > 0) { |
2997 |
+ pci_read_config_dword(pdev, offset, &u32val); |
2998 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
2999 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
3000 |
+ "%08x ", u32val); |
3001 |
+ offset += sizeof(uint32_t); |
3002 |
+ if (offset >= LPFC_PCI_CFG_SIZE) { |
3003 |
+- len += snprintf(pbuffer+len, |
3004 |
++ len += scnprintf(pbuffer+len, |
3005 |
+ LPFC_PCI_CFG_SIZE-len, "\n"); |
3006 |
+ break; |
3007 |
+ } |
3008 |
+ index -= sizeof(uint32_t); |
3009 |
+ if (!index) |
3010 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
3011 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
3012 |
+ "\n"); |
3013 |
+ else if (!(index % (8 * sizeof(uint32_t)))) { |
3014 |
+ offset_label += (8 * sizeof(uint32_t)); |
3015 |
+- len += snprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
3016 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_CFG_SIZE-len, |
3017 |
+ "\n%03x: ", offset_label); |
3018 |
+ } |
3019 |
+ } |
3020 |
+@@ -2943,7 +2946,7 @@ lpfc_idiag_baracc_read(struct file *file, char __user *buf, size_t nbytes, |
3021 |
+ if (acc_range == SINGLE_WORD) { |
3022 |
+ offset_run = offset; |
3023 |
+ u32val = readl(mem_mapped_bar + offset_run); |
3024 |
+- len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3025 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3026 |
+ "%05x: %08x\n", offset_run, u32val); |
3027 |
+ } else |
3028 |
+ goto baracc_browse; |
3029 |
+@@ -2957,35 +2960,35 @@ baracc_browse: |
3030 |
+ offset_run = offset_label; |
3031 |
+ |
3032 |
+ /* Read PCI bar memory mapped space */ |
3033 |
+- len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3034 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3035 |
+ "%05x: ", offset_label); |
3036 |
+ index = LPFC_PCI_BAR_RD_SIZE; |
3037 |
+ while (index > 0) { |
3038 |
+ u32val = readl(mem_mapped_bar + offset_run); |
3039 |
+- len += snprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3040 |
++ len += scnprintf(pbuffer+len, LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3041 |
+ "%08x ", u32val); |
3042 |
+ offset_run += sizeof(uint32_t); |
3043 |
+ if (acc_range == LPFC_PCI_BAR_BROWSE) { |
3044 |
+ if (offset_run >= bar_size) { |
3045 |
+- len += snprintf(pbuffer+len, |
3046 |
++ len += scnprintf(pbuffer+len, |
3047 |
+ LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n"); |
3048 |
+ break; |
3049 |
+ } |
3050 |
+ } else { |
3051 |
+ if (offset_run >= offset + |
3052 |
+ (acc_range * sizeof(uint32_t))) { |
3053 |
+- len += snprintf(pbuffer+len, |
3054 |
++ len += scnprintf(pbuffer+len, |
3055 |
+ LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n"); |
3056 |
+ break; |
3057 |
+ } |
3058 |
+ } |
3059 |
+ index -= sizeof(uint32_t); |
3060 |
+ if (!index) |
3061 |
+- len += snprintf(pbuffer+len, |
3062 |
++ len += scnprintf(pbuffer+len, |
3063 |
+ LPFC_PCI_BAR_RD_BUF_SIZE-len, "\n"); |
3064 |
+ else if (!(index % (8 * sizeof(uint32_t)))) { |
3065 |
+ offset_label += (8 * sizeof(uint32_t)); |
3066 |
+- len += snprintf(pbuffer+len, |
3067 |
++ len += scnprintf(pbuffer+len, |
3068 |
+ LPFC_PCI_BAR_RD_BUF_SIZE-len, |
3069 |
+ "\n%05x: ", offset_label); |
3070 |
+ } |
3071 |
+@@ -3158,19 +3161,19 @@ __lpfc_idiag_print_wq(struct lpfc_queue *qp, char *wqtype, |
3072 |
+ if (!qp) |
3073 |
+ return len; |
3074 |
+ |
3075 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3076 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3077 |
+ "\t\t%s WQ info: ", wqtype); |
3078 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3079 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3080 |
+ "AssocCQID[%04d]: WQ-STAT[oflow:x%x posted:x%llx]\n", |
3081 |
+ qp->assoc_qid, qp->q_cnt_1, |
3082 |
+ (unsigned long long)qp->q_cnt_4); |
3083 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3084 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3085 |
+ "\t\tWQID[%02d], QE-CNT[%04d], QE-SZ[%04d], " |
3086 |
+ "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]", |
3087 |
+ qp->queue_id, qp->entry_count, |
3088 |
+ qp->entry_size, qp->host_index, |
3089 |
+ qp->hba_index, qp->entry_repost); |
3090 |
+- len += snprintf(pbuffer + len, |
3091 |
++ len += scnprintf(pbuffer + len, |
3092 |
+ LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n"); |
3093 |
+ return len; |
3094 |
+ } |
3095 |
+@@ -3208,21 +3211,21 @@ __lpfc_idiag_print_cq(struct lpfc_queue *qp, char *cqtype, |
3096 |
+ if (!qp) |
3097 |
+ return len; |
3098 |
+ |
3099 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3100 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3101 |
+ "\t%s CQ info: ", cqtype); |
3102 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3103 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3104 |
+ "AssocEQID[%02d]: CQ STAT[max:x%x relw:x%x " |
3105 |
+ "xabt:x%x wq:x%llx]\n", |
3106 |
+ qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2, |
3107 |
+ qp->q_cnt_3, (unsigned long long)qp->q_cnt_4); |
3108 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3109 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3110 |
+ "\tCQID[%02d], QE-CNT[%04d], QE-SZ[%04d], " |
3111 |
+ "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]", |
3112 |
+ qp->queue_id, qp->entry_count, |
3113 |
+ qp->entry_size, qp->host_index, |
3114 |
+ qp->hba_index, qp->entry_repost); |
3115 |
+ |
3116 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n"); |
3117 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n"); |
3118 |
+ |
3119 |
+ return len; |
3120 |
+ } |
3121 |
+@@ -3234,19 +3237,19 @@ __lpfc_idiag_print_rqpair(struct lpfc_queue *qp, struct lpfc_queue *datqp, |
3122 |
+ if (!qp || !datqp) |
3123 |
+ return len; |
3124 |
+ |
3125 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3126 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3127 |
+ "\t\t%s RQ info: ", rqtype); |
3128 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3129 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3130 |
+ "AssocCQID[%02d]: RQ-STAT[nopost:x%x nobuf:x%x " |
3131 |
+ "posted:x%x rcv:x%llx]\n", |
3132 |
+ qp->assoc_qid, qp->q_cnt_1, qp->q_cnt_2, |
3133 |
+ qp->q_cnt_3, (unsigned long long)qp->q_cnt_4); |
3134 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3135 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3136 |
+ "\t\tHQID[%02d], QE-CNT[%04d], QE-SZ[%04d], " |
3137 |
+ "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n", |
3138 |
+ qp->queue_id, qp->entry_count, qp->entry_size, |
3139 |
+ qp->host_index, qp->hba_index, qp->entry_repost); |
3140 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3141 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3142 |
+ "\t\tDQID[%02d], QE-CNT[%04d], QE-SZ[%04d], " |
3143 |
+ "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]\n", |
3144 |
+ datqp->queue_id, datqp->entry_count, |
3145 |
+@@ -3331,17 +3334,17 @@ __lpfc_idiag_print_eq(struct lpfc_queue *qp, char *eqtype, |
3146 |
+ if (!qp) |
3147 |
+ return len; |
3148 |
+ |
3149 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3150 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3151 |
+ "\n%s EQ info: EQ-STAT[max:x%x noE:x%x " |
3152 |
+ "cqe_proc:x%x eqe_proc:x%llx eqd %d]\n", |
3153 |
+ eqtype, qp->q_cnt_1, qp->q_cnt_2, qp->q_cnt_3, |
3154 |
+ (unsigned long long)qp->q_cnt_4, qp->q_mode); |
3155 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3156 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3157 |
+ "EQID[%02d], QE-CNT[%04d], QE-SZ[%04d], " |
3158 |
+ "HST-IDX[%04d], PRT-IDX[%04d], PST[%03d]", |
3159 |
+ qp->queue_id, qp->entry_count, qp->entry_size, |
3160 |
+ qp->host_index, qp->hba_index, qp->entry_repost); |
3161 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n"); |
3162 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, "\n"); |
3163 |
+ |
3164 |
+ return len; |
3165 |
+ } |
3166 |
+@@ -3399,7 +3402,7 @@ lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes, |
3167 |
+ if (phba->cfg_fof == 0) |
3168 |
+ phba->lpfc_idiag_last_eq = 0; |
3169 |
+ |
3170 |
+- len += snprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3171 |
++ len += scnprintf(pbuffer + len, LPFC_QUE_INFO_GET_BUF_SIZE - len, |
3172 |
+ "EQ %d out of %d HBA EQs\n", |
3173 |
+ x, phba->io_channel_irqs); |
3174 |
+ |
3175 |
+@@ -3512,7 +3515,7 @@ fof: |
3176 |
+ return simple_read_from_buffer(buf, nbytes, ppos, pbuffer, len); |
3177 |
+ |
3178 |
+ too_big: |
3179 |
+- len += snprintf(pbuffer + len, |
3180 |
++ len += scnprintf(pbuffer + len, |
3181 |
+ LPFC_QUE_INFO_GET_BUF_SIZE - len, "Truncated ...\n"); |
3182 |
+ out: |
3183 |
+ spin_unlock_irq(&phba->hbalock); |
3184 |
+@@ -3568,22 +3571,22 @@ lpfc_idiag_queacc_read_qe(char *pbuffer, int len, struct lpfc_queue *pque, |
3185 |
+ return 0; |
3186 |
+ |
3187 |
+ esize = pque->entry_size; |
3188 |
+- len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, |
3189 |
++ len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, |
3190 |
+ "QE-INDEX[%04d]:\n", index); |
3191 |
+ |
3192 |
+ offset = 0; |
3193 |
+ pentry = pque->qe[index].address; |
3194 |
+ while (esize > 0) { |
3195 |
+- len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, |
3196 |
++ len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, |
3197 |
+ "%08x ", *pentry); |
3198 |
+ pentry++; |
3199 |
+ offset += sizeof(uint32_t); |
3200 |
+ esize -= sizeof(uint32_t); |
3201 |
+ if (esize > 0 && !(offset % (4 * sizeof(uint32_t)))) |
3202 |
+- len += snprintf(pbuffer+len, |
3203 |
++ len += scnprintf(pbuffer+len, |
3204 |
+ LPFC_QUE_ACC_BUF_SIZE-len, "\n"); |
3205 |
+ } |
3206 |
+- len += snprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, "\n"); |
3207 |
++ len += scnprintf(pbuffer+len, LPFC_QUE_ACC_BUF_SIZE-len, "\n"); |
3208 |
+ |
3209 |
+ return len; |
3210 |
+ } |
3211 |
+@@ -3989,27 +3992,27 @@ lpfc_idiag_drbacc_read_reg(struct lpfc_hba *phba, char *pbuffer, |
3212 |
+ |
3213 |
+ switch (drbregid) { |
3214 |
+ case LPFC_DRB_EQ: |
3215 |
+- len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len, |
3216 |
++ len += scnprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len, |
3217 |
+ "EQ-DRB-REG: 0x%08x\n", |
3218 |
+ readl(phba->sli4_hba.EQDBregaddr)); |
3219 |
+ break; |
3220 |
+ case LPFC_DRB_CQ: |
3221 |
+- len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len, |
3222 |
++ len += scnprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len, |
3223 |
+ "CQ-DRB-REG: 0x%08x\n", |
3224 |
+ readl(phba->sli4_hba.CQDBregaddr)); |
3225 |
+ break; |
3226 |
+ case LPFC_DRB_MQ: |
3227 |
+- len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3228 |
++ len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3229 |
+ "MQ-DRB-REG: 0x%08x\n", |
3230 |
+ readl(phba->sli4_hba.MQDBregaddr)); |
3231 |
+ break; |
3232 |
+ case LPFC_DRB_WQ: |
3233 |
+- len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3234 |
++ len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3235 |
+ "WQ-DRB-REG: 0x%08x\n", |
3236 |
+ readl(phba->sli4_hba.WQDBregaddr)); |
3237 |
+ break; |
3238 |
+ case LPFC_DRB_RQ: |
3239 |
+- len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3240 |
++ len += scnprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, |
3241 |
+ "RQ-DRB-REG: 0x%08x\n", |
3242 |
+ readl(phba->sli4_hba.RQDBregaddr)); |
3243 |
+ break; |
3244 |
+@@ -4199,37 +4202,37 @@ lpfc_idiag_ctlacc_read_reg(struct lpfc_hba *phba, char *pbuffer, |
3245 |
+ |
3246 |
+ switch (ctlregid) { |
3247 |
+ case LPFC_CTL_PORT_SEM: |
3248 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3249 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3250 |
+ "Port SemReg: 0x%08x\n", |
3251 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3252 |
+ LPFC_CTL_PORT_SEM_OFFSET)); |
3253 |
+ break; |
3254 |
+ case LPFC_CTL_PORT_STA: |
3255 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3256 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3257 |
+ "Port StaReg: 0x%08x\n", |
3258 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3259 |
+ LPFC_CTL_PORT_STA_OFFSET)); |
3260 |
+ break; |
3261 |
+ case LPFC_CTL_PORT_CTL: |
3262 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3263 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3264 |
+ "Port CtlReg: 0x%08x\n", |
3265 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3266 |
+ LPFC_CTL_PORT_CTL_OFFSET)); |
3267 |
+ break; |
3268 |
+ case LPFC_CTL_PORT_ER1: |
3269 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3270 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3271 |
+ "Port Er1Reg: 0x%08x\n", |
3272 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3273 |
+ LPFC_CTL_PORT_ER1_OFFSET)); |
3274 |
+ break; |
3275 |
+ case LPFC_CTL_PORT_ER2: |
3276 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3277 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3278 |
+ "Port Er2Reg: 0x%08x\n", |
3279 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3280 |
+ LPFC_CTL_PORT_ER2_OFFSET)); |
3281 |
+ break; |
3282 |
+ case LPFC_CTL_PDEV_CTL: |
3283 |
+- len += snprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3284 |
++ len += scnprintf(pbuffer+len, LPFC_CTL_ACC_BUF_SIZE-len, |
3285 |
+ "PDev CtlReg: 0x%08x\n", |
3286 |
+ readl(phba->sli4_hba.conf_regs_memmap_p + |
3287 |
+ LPFC_CTL_PDEV_CTL_OFFSET)); |
3288 |
+@@ -4422,13 +4425,13 @@ lpfc_idiag_mbxacc_get_setup(struct lpfc_hba *phba, char *pbuffer) |
3289 |
+ mbx_dump_cnt = idiag.cmd.data[IDIAG_MBXACC_DPCNT_INDX]; |
3290 |
+ mbx_word_cnt = idiag.cmd.data[IDIAG_MBXACC_WDCNT_INDX]; |
3291 |
+ |
3292 |
+- len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3293 |
++ len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3294 |
+ "mbx_dump_map: 0x%08x\n", mbx_dump_map); |
3295 |
+- len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3296 |
++ len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3297 |
+ "mbx_dump_cnt: %04d\n", mbx_dump_cnt); |
3298 |
+- len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3299 |
++ len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3300 |
+ "mbx_word_cnt: %04d\n", mbx_word_cnt); |
3301 |
+- len += snprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3302 |
++ len += scnprintf(pbuffer+len, LPFC_MBX_ACC_BUF_SIZE-len, |
3303 |
+ "mbx_mbox_cmd: 0x%02x\n", mbx_mbox_cmd); |
3304 |
+ |
3305 |
+ return len; |
3306 |
+@@ -4577,35 +4580,35 @@ lpfc_idiag_extacc_avail_get(struct lpfc_hba *phba, char *pbuffer, int len) |
3307 |
+ { |
3308 |
+ uint16_t ext_cnt, ext_size; |
3309 |
+ |
3310 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3311 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3312 |
+ "\nAvailable Extents Information:\n"); |
3313 |
+ |
3314 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3315 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3316 |
+ "\tPort Available VPI extents: "); |
3317 |
+ lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_VPI, |
3318 |
+ &ext_cnt, &ext_size); |
3319 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3320 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3321 |
+ "Count %3d, Size %3d\n", ext_cnt, ext_size); |
3322 |
+ |
3323 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3324 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3325 |
+ "\tPort Available VFI extents: "); |
3326 |
+ lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_VFI, |
3327 |
+ &ext_cnt, &ext_size); |
3328 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3329 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3330 |
+ "Count %3d, Size %3d\n", ext_cnt, ext_size); |
3331 |
+ |
3332 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3333 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3334 |
+ "\tPort Available RPI extents: "); |
3335 |
+ lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_RPI, |
3336 |
+ &ext_cnt, &ext_size); |
3337 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3338 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3339 |
+ "Count %3d, Size %3d\n", ext_cnt, ext_size); |
3340 |
+ |
3341 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3342 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3343 |
+ "\tPort Available XRI extents: "); |
3344 |
+ lpfc_sli4_get_avail_extnt_rsrc(phba, LPFC_RSC_TYPE_FCOE_XRI, |
3345 |
+ &ext_cnt, &ext_size); |
3346 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3347 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3348 |
+ "Count %3d, Size %3d\n", ext_cnt, ext_size); |
3349 |
+ |
3350 |
+ return len; |
3351 |
+@@ -4629,55 +4632,55 @@ lpfc_idiag_extacc_alloc_get(struct lpfc_hba *phba, char *pbuffer, int len) |
3352 |
+ uint16_t ext_cnt, ext_size; |
3353 |
+ int rc; |
3354 |
+ |
3355 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3356 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3357 |
+ "\nAllocated Extents Information:\n"); |
3358 |
+ |
3359 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3360 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3361 |
+ "\tHost Allocated VPI extents: "); |
3362 |
+ rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_VPI, |
3363 |
+ &ext_cnt, &ext_size); |
3364 |
+ if (!rc) |
3365 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3366 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3367 |
+ "Port %d Extent %3d, Size %3d\n", |
3368 |
+ phba->brd_no, ext_cnt, ext_size); |
3369 |
+ else |
3370 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3371 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3372 |
+ "N/A\n"); |
3373 |
+ |
3374 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3375 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3376 |
+ "\tHost Allocated VFI extents: "); |
3377 |
+ rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_VFI, |
3378 |
+ &ext_cnt, &ext_size); |
3379 |
+ if (!rc) |
3380 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3381 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3382 |
+ "Port %d Extent %3d, Size %3d\n", |
3383 |
+ phba->brd_no, ext_cnt, ext_size); |
3384 |
+ else |
3385 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3386 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3387 |
+ "N/A\n"); |
3388 |
+ |
3389 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3390 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3391 |
+ "\tHost Allocated RPI extents: "); |
3392 |
+ rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_RPI, |
3393 |
+ &ext_cnt, &ext_size); |
3394 |
+ if (!rc) |
3395 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3396 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3397 |
+ "Port %d Extent %3d, Size %3d\n", |
3398 |
+ phba->brd_no, ext_cnt, ext_size); |
3399 |
+ else |
3400 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3401 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3402 |
+ "N/A\n"); |
3403 |
+ |
3404 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3405 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3406 |
+ "\tHost Allocated XRI extents: "); |
3407 |
+ rc = lpfc_sli4_get_allocated_extnts(phba, LPFC_RSC_TYPE_FCOE_XRI, |
3408 |
+ &ext_cnt, &ext_size); |
3409 |
+ if (!rc) |
3410 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3411 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3412 |
+ "Port %d Extent %3d, Size %3d\n", |
3413 |
+ phba->brd_no, ext_cnt, ext_size); |
3414 |
+ else |
3415 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3416 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3417 |
+ "N/A\n"); |
3418 |
+ |
3419 |
+ return len; |
3420 |
+@@ -4701,49 +4704,49 @@ lpfc_idiag_extacc_drivr_get(struct lpfc_hba *phba, char *pbuffer, int len) |
3421 |
+ struct lpfc_rsrc_blks *rsrc_blks; |
3422 |
+ int index; |
3423 |
+ |
3424 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3425 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3426 |
+ "\nDriver Extents Information:\n"); |
3427 |
+ |
3428 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3429 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3430 |
+ "\tVPI extents:\n"); |
3431 |
+ index = 0; |
3432 |
+ list_for_each_entry(rsrc_blks, &phba->lpfc_vpi_blk_list, list) { |
3433 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3434 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3435 |
+ "\t\tBlock %3d: Start %4d, Count %4d\n", |
3436 |
+ index, rsrc_blks->rsrc_start, |
3437 |
+ rsrc_blks->rsrc_size); |
3438 |
+ index++; |
3439 |
+ } |
3440 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3441 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3442 |
+ "\tVFI extents:\n"); |
3443 |
+ index = 0; |
3444 |
+ list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_vfi_blk_list, |
3445 |
+ list) { |
3446 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3447 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3448 |
+ "\t\tBlock %3d: Start %4d, Count %4d\n", |
3449 |
+ index, rsrc_blks->rsrc_start, |
3450 |
+ rsrc_blks->rsrc_size); |
3451 |
+ index++; |
3452 |
+ } |
3453 |
+ |
3454 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3455 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3456 |
+ "\tRPI extents:\n"); |
3457 |
+ index = 0; |
3458 |
+ list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_rpi_blk_list, |
3459 |
+ list) { |
3460 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3461 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3462 |
+ "\t\tBlock %3d: Start %4d, Count %4d\n", |
3463 |
+ index, rsrc_blks->rsrc_start, |
3464 |
+ rsrc_blks->rsrc_size); |
3465 |
+ index++; |
3466 |
+ } |
3467 |
+ |
3468 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3469 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3470 |
+ "\tXRI extents:\n"); |
3471 |
+ index = 0; |
3472 |
+ list_for_each_entry(rsrc_blks, &phba->sli4_hba.lpfc_xri_blk_list, |
3473 |
+ list) { |
3474 |
+- len += snprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3475 |
++ len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, |
3476 |
+ "\t\tBlock %3d: Start %4d, Count %4d\n", |
3477 |
+ index, rsrc_blks->rsrc_start, |
3478 |
+ rsrc_blks->rsrc_size); |
3479 |
+@@ -5137,11 +5140,11 @@ lpfc_idiag_mbxacc_dump_bsg_mbox(struct lpfc_hba *phba, enum nemb_type nemb_tp, |
3480 |
+ if (i != 0) |
3481 |
+ pr_err("%s\n", line_buf); |
3482 |
+ len = 0; |
3483 |
+- len += snprintf(line_buf+len, |
3484 |
++ len += scnprintf(line_buf+len, |
3485 |
+ LPFC_MBX_ACC_LBUF_SZ-len, |
3486 |
+ "%03d: ", i); |
3487 |
+ } |
3488 |
+- len += snprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len, |
3489 |
++ len += scnprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len, |
3490 |
+ "%08x ", (uint32_t)*pword); |
3491 |
+ pword++; |
3492 |
+ } |
3493 |
+@@ -5204,11 +5207,11 @@ lpfc_idiag_mbxacc_dump_issue_mbox(struct lpfc_hba *phba, MAILBOX_t *pmbox) |
3494 |
+ pr_err("%s\n", line_buf); |
3495 |
+ len = 0; |
3496 |
+ memset(line_buf, 0, LPFC_MBX_ACC_LBUF_SZ); |
3497 |
+- len += snprintf(line_buf+len, |
3498 |
++ len += scnprintf(line_buf+len, |
3499 |
+ LPFC_MBX_ACC_LBUF_SZ-len, |
3500 |
+ "%03d: ", i); |
3501 |
+ } |
3502 |
+- len += snprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len, |
3503 |
++ len += scnprintf(line_buf+len, LPFC_MBX_ACC_LBUF_SZ-len, |
3504 |
+ "%08x ", |
3505 |
+ ((uint32_t)*pword) & 0xffffffff); |
3506 |
+ pword++; |
3507 |
+@@ -5227,18 +5230,18 @@ lpfc_idiag_mbxacc_dump_issue_mbox(struct lpfc_hba *phba, MAILBOX_t *pmbox) |
3508 |
+ pr_err("%s\n", line_buf); |
3509 |
+ len = 0; |
3510 |
+ memset(line_buf, 0, LPFC_MBX_ACC_LBUF_SZ); |
3511 |
+- len += snprintf(line_buf+len, |
3512 |
++ len += scnprintf(line_buf+len, |
3513 |
+ LPFC_MBX_ACC_LBUF_SZ-len, |
3514 |
+ "%03d: ", i); |
3515 |
+ } |
3516 |
+ for (j = 0; j < 4; j++) { |
3517 |
+- len += snprintf(line_buf+len, |
3518 |
++ len += scnprintf(line_buf+len, |
3519 |
+ LPFC_MBX_ACC_LBUF_SZ-len, |
3520 |
+ "%02x", |
3521 |
+ ((uint8_t)*pbyte) & 0xff); |
3522 |
+ pbyte++; |
3523 |
+ } |
3524 |
+- len += snprintf(line_buf+len, |
3525 |
++ len += scnprintf(line_buf+len, |
3526 |
+ LPFC_MBX_ACC_LBUF_SZ-len, " "); |
3527 |
+ } |
3528 |
+ if ((i - 1) % 8) |
3529 |
+diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h |
3530 |
+index 30efc7bf91bd..824de3e410ca 100644 |
3531 |
+--- a/drivers/scsi/lpfc/lpfc_debugfs.h |
3532 |
++++ b/drivers/scsi/lpfc/lpfc_debugfs.h |
3533 |
+@@ -342,7 +342,7 @@ lpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx) |
3534 |
+ pword = q->qe[idx].address; |
3535 |
+ |
3536 |
+ len = 0; |
3537 |
+- len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx); |
3538 |
++ len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx); |
3539 |
+ if (qe_word_cnt > 8) |
3540 |
+ printk(KERN_ERR "%s\n", line_buf); |
3541 |
+ |
3542 |
+@@ -353,11 +353,11 @@ lpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx) |
3543 |
+ if (qe_word_cnt > 8) { |
3544 |
+ len = 0; |
3545 |
+ memset(line_buf, 0, LPFC_LBUF_SZ); |
3546 |
+- len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, |
3547 |
++ len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, |
3548 |
+ "%03d: ", i); |
3549 |
+ } |
3550 |
+ } |
3551 |
+- len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ", |
3552 |
++ len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ", |
3553 |
+ ((uint32_t)*pword) & 0xffffffff); |
3554 |
+ pword++; |
3555 |
+ } |
3556 |
+diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c |
3557 |
+index ac504a1ff0ff..1a396f843de1 100644 |
3558 |
+--- a/drivers/scsi/qla2xxx/qla_attr.c |
3559 |
++++ b/drivers/scsi/qla2xxx/qla_attr.c |
3560 |
+@@ -364,7 +364,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, |
3561 |
+ } |
3562 |
+ |
3563 |
+ ha->optrom_region_start = start; |
3564 |
+- ha->optrom_region_size = start + size; |
3565 |
++ ha->optrom_region_size = size; |
3566 |
+ |
3567 |
+ ha->optrom_state = QLA_SREADING; |
3568 |
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size); |
3569 |
+@@ -437,7 +437,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, |
3570 |
+ } |
3571 |
+ |
3572 |
+ ha->optrom_region_start = start; |
3573 |
+- ha->optrom_region_size = start + size; |
3574 |
++ ha->optrom_region_size = size; |
3575 |
+ |
3576 |
+ ha->optrom_state = QLA_SWRITING; |
3577 |
+ ha->optrom_buffer = vmalloc(ha->optrom_region_size); |
3578 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
3579 |
+index 510337eac106..d4ac18573d81 100644 |
3580 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
3581 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
3582 |
+@@ -977,6 +977,8 @@ void qlt_free_session_done(struct work_struct *work) |
3583 |
+ sess->send_els_logo); |
3584 |
+ |
3585 |
+ if (!IS_SW_RESV_ADDR(sess->d_id)) { |
3586 |
++ qla2x00_mark_device_lost(vha, sess, 0, 0); |
3587 |
++ |
3588 |
+ if (sess->send_els_logo) { |
3589 |
+ qlt_port_logo_t logo; |
3590 |
+ |
3591 |
+@@ -1157,8 +1159,6 @@ void qlt_unreg_sess(struct fc_port *sess) |
3592 |
+ if (sess->se_sess) |
3593 |
+ vha->hw->tgt.tgt_ops->clear_nacl_from_fcport_map(sess); |
3594 |
+ |
3595 |
+- qla2x00_mark_device_lost(vha, sess, 0, 0); |
3596 |
+- |
3597 |
+ sess->deleted = QLA_SESS_DELETION_IN_PROGRESS; |
3598 |
+ sess->disc_state = DSC_DELETE_PEND; |
3599 |
+ sess->last_rscn_gen = sess->rscn_gen; |
3600 |
+diff --git a/drivers/soc/sunxi/Kconfig b/drivers/soc/sunxi/Kconfig |
3601 |
+index 353b07e40176..e84eb4e59f58 100644 |
3602 |
+--- a/drivers/soc/sunxi/Kconfig |
3603 |
++++ b/drivers/soc/sunxi/Kconfig |
3604 |
+@@ -4,6 +4,7 @@ |
3605 |
+ config SUNXI_SRAM |
3606 |
+ bool |
3607 |
+ default ARCH_SUNXI |
3608 |
++ select REGMAP_MMIO |
3609 |
+ help |
3610 |
+ Say y here to enable the SRAM controller support. This |
3611 |
+ device is responsible on mapping the SRAM in the sunXi SoCs |
3612 |
+diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c |
3613 |
+index 0529e5628c24..ae5c0285a942 100644 |
3614 |
+--- a/drivers/staging/greybus/power_supply.c |
3615 |
++++ b/drivers/staging/greybus/power_supply.c |
3616 |
+@@ -520,7 +520,7 @@ static int gb_power_supply_prop_descriptors_get(struct gb_power_supply *gbpsy) |
3617 |
+ |
3618 |
+ op = gb_operation_create(connection, |
3619 |
+ GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS, |
3620 |
+- sizeof(req), sizeof(*resp) + props_count * |
3621 |
++ sizeof(*req), sizeof(*resp) + props_count * |
3622 |
+ sizeof(struct gb_power_supply_props_desc), |
3623 |
+ GFP_KERNEL); |
3624 |
+ if (!op) |
3625 |
+diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c |
3626 |
+index ea64aabda94e..67ac51c8fc5b 100644 |
3627 |
+--- a/drivers/staging/most/cdev/cdev.c |
3628 |
++++ b/drivers/staging/most/cdev/cdev.c |
3629 |
+@@ -546,7 +546,7 @@ static void __exit mod_exit(void) |
3630 |
+ destroy_cdev(c); |
3631 |
+ destroy_channel(c); |
3632 |
+ } |
3633 |
+- unregister_chrdev_region(comp.devno, 1); |
3634 |
++ unregister_chrdev_region(comp.devno, CHRDEV_REGION_SIZE); |
3635 |
+ ida_destroy(&comp.minor_id); |
3636 |
+ class_destroy(comp.class); |
3637 |
+ } |
3638 |
+diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c |
3639 |
+index 79ab3a78c5ec..1e6f47cfe42c 100644 |
3640 |
+--- a/drivers/staging/most/sound/sound.c |
3641 |
++++ b/drivers/staging/most/sound/sound.c |
3642 |
+@@ -622,7 +622,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, |
3643 |
+ INIT_LIST_HEAD(&adpt->dev_list); |
3644 |
+ iface->priv = adpt; |
3645 |
+ list_add_tail(&adpt->list, &adpt_list); |
3646 |
+- ret = snd_card_new(&iface->dev, -1, "INIC", THIS_MODULE, |
3647 |
++ ret = snd_card_new(iface->driver_dev, -1, "INIC", THIS_MODULE, |
3648 |
+ sizeof(*channel), &adpt->card); |
3649 |
+ if (ret < 0) |
3650 |
+ goto err_free_adpt; |
3651 |
+diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c |
3652 |
+index 5e5149c9a92d..2448805315c5 100644 |
3653 |
+--- a/drivers/staging/wilc1000/linux_wlan.c |
3654 |
++++ b/drivers/staging/wilc1000/linux_wlan.c |
3655 |
+@@ -816,7 +816,7 @@ static void wilc_set_multicast_list(struct net_device *dev) |
3656 |
+ return; |
3657 |
+ } |
3658 |
+ |
3659 |
+- mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_KERNEL); |
3660 |
++ mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_ATOMIC); |
3661 |
+ if (!mc_list) |
3662 |
+ return; |
3663 |
+ |
3664 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
3665 |
+index ec666eb4b7b4..c03aa8550980 100644 |
3666 |
+--- a/drivers/usb/class/cdc-acm.c |
3667 |
++++ b/drivers/usb/class/cdc-acm.c |
3668 |
+@@ -470,12 +470,12 @@ static void acm_read_bulk_callback(struct urb *urb) |
3669 |
+ struct acm *acm = rb->instance; |
3670 |
+ unsigned long flags; |
3671 |
+ int status = urb->status; |
3672 |
++ bool stopped = false; |
3673 |
++ bool stalled = false; |
3674 |
+ |
3675 |
+ dev_vdbg(&acm->data->dev, "got urb %d, len %d, status %d\n", |
3676 |
+ rb->index, urb->actual_length, status); |
3677 |
+ |
3678 |
+- set_bit(rb->index, &acm->read_urbs_free); |
3679 |
+- |
3680 |
+ if (!acm->dev) { |
3681 |
+ dev_dbg(&acm->data->dev, "%s - disconnected\n", __func__); |
3682 |
+ return; |
3683 |
+@@ -488,15 +488,16 @@ static void acm_read_bulk_callback(struct urb *urb) |
3684 |
+ break; |
3685 |
+ case -EPIPE: |
3686 |
+ set_bit(EVENT_RX_STALL, &acm->flags); |
3687 |
+- schedule_work(&acm->work); |
3688 |
+- return; |
3689 |
++ stalled = true; |
3690 |
++ break; |
3691 |
+ case -ENOENT: |
3692 |
+ case -ECONNRESET: |
3693 |
+ case -ESHUTDOWN: |
3694 |
+ dev_dbg(&acm->data->dev, |
3695 |
+ "%s - urb shutting down with status: %d\n", |
3696 |
+ __func__, status); |
3697 |
+- return; |
3698 |
++ stopped = true; |
3699 |
++ break; |
3700 |
+ default: |
3701 |
+ dev_dbg(&acm->data->dev, |
3702 |
+ "%s - nonzero urb status received: %d\n", |
3703 |
+@@ -505,10 +506,24 @@ static void acm_read_bulk_callback(struct urb *urb) |
3704 |
+ } |
3705 |
+ |
3706 |
+ /* |
3707 |
+- * Unthrottle may run on another CPU which needs to see events |
3708 |
+- * in the same order. Submission has an implict barrier |
3709 |
++ * Make sure URB processing is done before marking as free to avoid |
3710 |
++ * racing with unthrottle() on another CPU. Matches the barriers |
3711 |
++ * implied by the test_and_clear_bit() in acm_submit_read_urb(). |
3712 |
+ */ |
3713 |
+ smp_mb__before_atomic(); |
3714 |
++ set_bit(rb->index, &acm->read_urbs_free); |
3715 |
++ /* |
3716 |
++ * Make sure URB is marked as free before checking the throttled flag |
3717 |
++ * to avoid racing with unthrottle() on another CPU. Matches the |
3718 |
++ * smp_mb() in unthrottle(). |
3719 |
++ */ |
3720 |
++ smp_mb__after_atomic(); |
3721 |
++ |
3722 |
++ if (stopped || stalled) { |
3723 |
++ if (stalled) |
3724 |
++ schedule_work(&acm->work); |
3725 |
++ return; |
3726 |
++ } |
3727 |
+ |
3728 |
+ /* throttle device if requested by tty */ |
3729 |
+ spin_lock_irqsave(&acm->read_lock, flags); |
3730 |
+@@ -842,6 +857,9 @@ static void acm_tty_unthrottle(struct tty_struct *tty) |
3731 |
+ acm->throttle_req = 0; |
3732 |
+ spin_unlock_irq(&acm->read_lock); |
3733 |
+ |
3734 |
++ /* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */ |
3735 |
++ smp_mb(); |
3736 |
++ |
3737 |
+ if (was_throttled) |
3738 |
+ acm_submit_read_urbs(acm, GFP_KERNEL); |
3739 |
+ } |
3740 |
+diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig |
3741 |
+index 1a0404fda596..5d22f4bf2a9f 100644 |
3742 |
+--- a/drivers/usb/dwc3/Kconfig |
3743 |
++++ b/drivers/usb/dwc3/Kconfig |
3744 |
+@@ -52,7 +52,8 @@ comment "Platform Glue Driver Support" |
3745 |
+ |
3746 |
+ config USB_DWC3_OMAP |
3747 |
+ tristate "Texas Instruments OMAP5 and similar Platforms" |
3748 |
+- depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
3749 |
++ depends on ARCH_OMAP2PLUS || COMPILE_TEST |
3750 |
++ depends on EXTCON || !EXTCON |
3751 |
+ depends on OF |
3752 |
+ default USB_DWC3 |
3753 |
+ help |
3754 |
+@@ -113,7 +114,8 @@ config USB_DWC3_ST |
3755 |
+ |
3756 |
+ config USB_DWC3_QCOM |
3757 |
+ tristate "Qualcomm Platform" |
3758 |
+- depends on EXTCON && (ARCH_QCOM || COMPILE_TEST) |
3759 |
++ depends on ARCH_QCOM || COMPILE_TEST |
3760 |
++ depends on EXTCON || !EXTCON |
3761 |
+ depends on OF |
3762 |
+ default USB_DWC3 |
3763 |
+ help |
3764 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
3765 |
+index a1b126f90261..f944cea4056b 100644 |
3766 |
+--- a/drivers/usb/dwc3/core.c |
3767 |
++++ b/drivers/usb/dwc3/core.c |
3768 |
+@@ -1218,7 +1218,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) |
3769 |
+ u8 tx_max_burst_prd; |
3770 |
+ |
3771 |
+ /* default to highest possible threshold */ |
3772 |
+- lpm_nyet_threshold = 0xff; |
3773 |
++ lpm_nyet_threshold = 0xf; |
3774 |
+ |
3775 |
+ /* default to -3.5dB de-emphasis */ |
3776 |
+ tx_de_emphasis = 1; |
3777 |
+diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig |
3778 |
+index ad08895e78f9..c3dae7d5cb6e 100644 |
3779 |
+--- a/drivers/usb/musb/Kconfig |
3780 |
++++ b/drivers/usb/musb/Kconfig |
3781 |
+@@ -66,7 +66,7 @@ config USB_MUSB_SUNXI |
3782 |
+ depends on NOP_USB_XCEIV |
3783 |
+ depends on PHY_SUN4I_USB |
3784 |
+ depends on EXTCON |
3785 |
+- depends on GENERIC_PHY |
3786 |
++ select GENERIC_PHY |
3787 |
+ select SUNXI_SRAM |
3788 |
+ |
3789 |
+ config USB_MUSB_DAVINCI |
3790 |
+diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c |
3791 |
+index 0dcdcb4b2cde..dee6f2caf9b5 100644 |
3792 |
+--- a/drivers/usb/serial/f81232.c |
3793 |
++++ b/drivers/usb/serial/f81232.c |
3794 |
+@@ -556,9 +556,12 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) |
3795 |
+ |
3796 |
+ static void f81232_close(struct usb_serial_port *port) |
3797 |
+ { |
3798 |
++ struct f81232_private *port_priv = usb_get_serial_port_data(port); |
3799 |
++ |
3800 |
+ f81232_port_disable(port); |
3801 |
+ usb_serial_generic_close(port); |
3802 |
+ usb_kill_urb(port->interrupt_in_urb); |
3803 |
++ flush_work(&port_priv->interrupt_work); |
3804 |
+ } |
3805 |
+ |
3806 |
+ static void f81232_dtr_rts(struct usb_serial_port *port, int on) |
3807 |
+@@ -632,6 +635,40 @@ static int f81232_port_remove(struct usb_serial_port *port) |
3808 |
+ return 0; |
3809 |
+ } |
3810 |
+ |
3811 |
++static int f81232_suspend(struct usb_serial *serial, pm_message_t message) |
3812 |
++{ |
3813 |
++ struct usb_serial_port *port = serial->port[0]; |
3814 |
++ struct f81232_private *port_priv = usb_get_serial_port_data(port); |
3815 |
++ int i; |
3816 |
++ |
3817 |
++ for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) |
3818 |
++ usb_kill_urb(port->read_urbs[i]); |
3819 |
++ |
3820 |
++ usb_kill_urb(port->interrupt_in_urb); |
3821 |
++ |
3822 |
++ if (port_priv) |
3823 |
++ flush_work(&port_priv->interrupt_work); |
3824 |
++ |
3825 |
++ return 0; |
3826 |
++} |
3827 |
++ |
3828 |
++static int f81232_resume(struct usb_serial *serial) |
3829 |
++{ |
3830 |
++ struct usb_serial_port *port = serial->port[0]; |
3831 |
++ int result; |
3832 |
++ |
3833 |
++ if (tty_port_initialized(&port->port)) { |
3834 |
++ result = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
3835 |
++ if (result) { |
3836 |
++ dev_err(&port->dev, "submit interrupt urb failed: %d\n", |
3837 |
++ result); |
3838 |
++ return result; |
3839 |
++ } |
3840 |
++ } |
3841 |
++ |
3842 |
++ return usb_serial_generic_resume(serial); |
3843 |
++} |
3844 |
++ |
3845 |
+ static struct usb_serial_driver f81232_device = { |
3846 |
+ .driver = { |
3847 |
+ .owner = THIS_MODULE, |
3848 |
+@@ -655,6 +692,8 @@ static struct usb_serial_driver f81232_device = { |
3849 |
+ .read_int_callback = f81232_read_int_callback, |
3850 |
+ .port_probe = f81232_port_probe, |
3851 |
+ .port_remove = f81232_port_remove, |
3852 |
++ .suspend = f81232_suspend, |
3853 |
++ .resume = f81232_resume, |
3854 |
+ }; |
3855 |
+ |
3856 |
+ static struct usb_serial_driver * const serial_drivers[] = { |
3857 |
+diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c |
3858 |
+index a73ea495d5a7..59190d88fa9f 100644 |
3859 |
+--- a/drivers/usb/storage/scsiglue.c |
3860 |
++++ b/drivers/usb/storage/scsiglue.c |
3861 |
+@@ -65,6 +65,7 @@ static const char* host_info(struct Scsi_Host *host) |
3862 |
+ static int slave_alloc (struct scsi_device *sdev) |
3863 |
+ { |
3864 |
+ struct us_data *us = host_to_us(sdev->host); |
3865 |
++ int maxp; |
3866 |
+ |
3867 |
+ /* |
3868 |
+ * Set the INQUIRY transfer length to 36. We don't use any of |
3869 |
+@@ -74,20 +75,17 @@ static int slave_alloc (struct scsi_device *sdev) |
3870 |
+ sdev->inquiry_len = 36; |
3871 |
+ |
3872 |
+ /* |
3873 |
+- * USB has unusual DMA-alignment requirements: Although the |
3874 |
+- * starting address of each scatter-gather element doesn't matter, |
3875 |
+- * the length of each element except the last must be divisible |
3876 |
+- * by the Bulk maxpacket value. There's currently no way to |
3877 |
+- * express this by block-layer constraints, so we'll cop out |
3878 |
+- * and simply require addresses to be aligned at 512-byte |
3879 |
+- * boundaries. This is okay since most block I/O involves |
3880 |
+- * hardware sectors that are multiples of 512 bytes in length, |
3881 |
+- * and since host controllers up through USB 2.0 have maxpacket |
3882 |
+- * values no larger than 512. |
3883 |
+- * |
3884 |
+- * But it doesn't suffice for Wireless USB, where Bulk maxpacket |
3885 |
+- * values can be as large as 2048. To make that work properly |
3886 |
+- * will require changes to the block layer. |
3887 |
++ * USB has unusual scatter-gather requirements: the length of each |
3888 |
++ * scatterlist element except the last must be divisible by the |
3889 |
++ * Bulk maxpacket value. Fortunately this value is always a |
3890 |
++ * power of 2. Inform the block layer about this requirement. |
3891 |
++ */ |
3892 |
++ maxp = usb_maxpacket(us->pusb_dev, us->recv_bulk_pipe, 0); |
3893 |
++ blk_queue_virt_boundary(sdev->request_queue, maxp - 1); |
3894 |
++ |
3895 |
++ /* |
3896 |
++ * Some host controllers may have alignment requirements. |
3897 |
++ * We'll play it safe by requiring 512-byte alignment always. |
3898 |
+ */ |
3899 |
+ blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
3900 |
+ |
3901 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
3902 |
+index 36742e8e7edc..d2ed3049e7de 100644 |
3903 |
+--- a/drivers/usb/storage/uas.c |
3904 |
++++ b/drivers/usb/storage/uas.c |
3905 |
+@@ -796,24 +796,33 @@ static int uas_slave_alloc(struct scsi_device *sdev) |
3906 |
+ { |
3907 |
+ struct uas_dev_info *devinfo = |
3908 |
+ (struct uas_dev_info *)sdev->host->hostdata; |
3909 |
++ int maxp; |
3910 |
+ |
3911 |
+ sdev->hostdata = devinfo; |
3912 |
+ |
3913 |
+ /* |
3914 |
+- * USB has unusual DMA-alignment requirements: Although the |
3915 |
+- * starting address of each scatter-gather element doesn't matter, |
3916 |
+- * the length of each element except the last must be divisible |
3917 |
+- * by the Bulk maxpacket value. There's currently no way to |
3918 |
+- * express this by block-layer constraints, so we'll cop out |
3919 |
+- * and simply require addresses to be aligned at 512-byte |
3920 |
+- * boundaries. This is okay since most block I/O involves |
3921 |
+- * hardware sectors that are multiples of 512 bytes in length, |
3922 |
+- * and since host controllers up through USB 2.0 have maxpacket |
3923 |
+- * values no larger than 512. |
3924 |
++ * We have two requirements here. We must satisfy the requirements |
3925 |
++ * of the physical HC and the demands of the protocol, as we |
3926 |
++ * definitely want no additional memory allocation in this path |
3927 |
++ * ruling out using bounce buffers. |
3928 |
+ * |
3929 |
+- * But it doesn't suffice for Wireless USB, where Bulk maxpacket |
3930 |
+- * values can be as large as 2048. To make that work properly |
3931 |
+- * will require changes to the block layer. |
3932 |
++ * For a transmission on USB to continue we must never send |
3933 |
++ * a package that is smaller than maxpacket. Hence the length of each |
3934 |
++ * scatterlist element except the last must be divisible by the |
3935 |
++ * Bulk maxpacket value. |
3936 |
++ * If the HC does not ensure that through SG, |
3937 |
++ * the upper layer must do that. We must assume nothing |
3938 |
++ * about the capabilities off the HC, so we use the most |
3939 |
++ * pessimistic requirement. |
3940 |
++ */ |
3941 |
++ |
3942 |
++ maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0); |
3943 |
++ blk_queue_virt_boundary(sdev->request_queue, maxp - 1); |
3944 |
++ |
3945 |
++ /* |
3946 |
++ * The protocol has no requirements on alignment in the strict sense. |
3947 |
++ * Controllers may or may not have alignment restrictions. |
3948 |
++ * As this is not exported, we use an extremely conservative guess. |
3949 |
+ */ |
3950 |
+ blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
3951 |
+ |
3952 |
+diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c |
3953 |
+index d0584c040c60..7a0398bb84f7 100644 |
3954 |
+--- a/drivers/virtio/virtio_pci_common.c |
3955 |
++++ b/drivers/virtio/virtio_pci_common.c |
3956 |
+@@ -255,9 +255,11 @@ void vp_del_vqs(struct virtio_device *vdev) |
3957 |
+ for (i = 0; i < vp_dev->msix_used_vectors; ++i) |
3958 |
+ free_irq(pci_irq_vector(vp_dev->pci_dev, i), vp_dev); |
3959 |
+ |
3960 |
+- for (i = 0; i < vp_dev->msix_vectors; i++) |
3961 |
+- if (vp_dev->msix_affinity_masks[i]) |
3962 |
+- free_cpumask_var(vp_dev->msix_affinity_masks[i]); |
3963 |
++ if (vp_dev->msix_affinity_masks) { |
3964 |
++ for (i = 0; i < vp_dev->msix_vectors; i++) |
3965 |
++ if (vp_dev->msix_affinity_masks[i]) |
3966 |
++ free_cpumask_var(vp_dev->msix_affinity_masks[i]); |
3967 |
++ } |
3968 |
+ |
3969 |
+ if (vp_dev->msix_enabled) { |
3970 |
+ /* Disable the vector used for configuration */ |
3971 |
+diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c |
3972 |
+index fed06fd9998d..94f98e190e63 100644 |
3973 |
+--- a/fs/nfs/nfs42proc.c |
3974 |
++++ b/fs/nfs/nfs42proc.c |
3975 |
+@@ -329,9 +329,6 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, |
3976 |
+ }; |
3977 |
+ ssize_t err, err2; |
3978 |
+ |
3979 |
+- if (!nfs_server_capable(file_inode(dst), NFS_CAP_COPY)) |
3980 |
+- return -EOPNOTSUPP; |
3981 |
+- |
3982 |
+ src_lock = nfs_get_lock_context(nfs_file_open_context(src)); |
3983 |
+ if (IS_ERR(src_lock)) |
3984 |
+ return PTR_ERR(src_lock); |
3985 |
+diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
3986 |
+index 45b2322e092d..00d17198ee12 100644 |
3987 |
+--- a/fs/nfs/nfs4file.c |
3988 |
++++ b/fs/nfs/nfs4file.c |
3989 |
+@@ -133,8 +133,10 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, |
3990 |
+ struct file *file_out, loff_t pos_out, |
3991 |
+ size_t count, unsigned int flags) |
3992 |
+ { |
3993 |
++ if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY)) |
3994 |
++ return -EOPNOTSUPP; |
3995 |
+ if (file_inode(file_in) == file_inode(file_out)) |
3996 |
+- return -EINVAL; |
3997 |
++ return -EOPNOTSUPP; |
3998 |
+ return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); |
3999 |
+ } |
4000 |
+ |
4001 |
+diff --git a/include/keys/trusted.h b/include/keys/trusted.h |
4002 |
+index adbcb6817826..0071298b9b28 100644 |
4003 |
+--- a/include/keys/trusted.h |
4004 |
++++ b/include/keys/trusted.h |
4005 |
+@@ -38,7 +38,7 @@ enum { |
4006 |
+ |
4007 |
+ int TSS_authhmac(unsigned char *digest, const unsigned char *key, |
4008 |
+ unsigned int keylen, unsigned char *h1, |
4009 |
+- unsigned char *h2, unsigned char h3, ...); |
4010 |
++ unsigned char *h2, unsigned int h3, ...); |
4011 |
+ int TSS_checkhmac1(unsigned char *buffer, |
4012 |
+ const uint32_t command, |
4013 |
+ const unsigned char *ononce, |
4014 |
+diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h |
4015 |
+index 0e030f5f76b6..7e092bdac27f 100644 |
4016 |
+--- a/include/linux/blk-mq.h |
4017 |
++++ b/include/linux/blk-mq.h |
4018 |
+@@ -306,6 +306,7 @@ void blk_mq_add_to_requeue_list(struct request *rq, bool at_head, |
4019 |
+ void blk_mq_kick_requeue_list(struct request_queue *q); |
4020 |
+ void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs); |
4021 |
+ bool blk_mq_complete_request(struct request *rq); |
4022 |
++void blk_mq_complete_request_sync(struct request *rq); |
4023 |
+ bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list, |
4024 |
+ struct bio *bio); |
4025 |
+ bool blk_mq_queue_stopped(struct request_queue *q); |
4026 |
+diff --git a/include/linux/kernel.h b/include/linux/kernel.h |
4027 |
+index 8f0e68e250a7..fd827b240059 100644 |
4028 |
+--- a/include/linux/kernel.h |
4029 |
++++ b/include/linux/kernel.h |
4030 |
+@@ -73,8 +73,8 @@ |
4031 |
+ |
4032 |
+ #define u64_to_user_ptr(x) ( \ |
4033 |
+ { \ |
4034 |
+- typecheck(u64, x); \ |
4035 |
+- (void __user *)(uintptr_t)x; \ |
4036 |
++ typecheck(u64, (x)); \ |
4037 |
++ (void __user *)(uintptr_t)(x); \ |
4038 |
+ } \ |
4039 |
+ ) |
4040 |
+ |
4041 |
+diff --git a/include/linux/nvme.h b/include/linux/nvme.h |
4042 |
+index bbcc83886899..7ba0368f16e6 100644 |
4043 |
+--- a/include/linux/nvme.h |
4044 |
++++ b/include/linux/nvme.h |
4045 |
+@@ -975,8 +975,13 @@ struct nvme_get_log_page_command { |
4046 |
+ __le16 numdl; |
4047 |
+ __le16 numdu; |
4048 |
+ __u16 rsvd11; |
4049 |
+- __le32 lpol; |
4050 |
+- __le32 lpou; |
4051 |
++ union { |
4052 |
++ struct { |
4053 |
++ __le32 lpol; |
4054 |
++ __le32 lpou; |
4055 |
++ }; |
4056 |
++ __le64 lpo; |
4057 |
++ }; |
4058 |
+ __u32 rsvd14[2]; |
4059 |
+ }; |
4060 |
+ |
4061 |
+diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
4062 |
+index e5ea633ea368..fa61e70788c5 100644 |
4063 |
+--- a/include/net/bluetooth/hci_core.h |
4064 |
++++ b/include/net/bluetooth/hci_core.h |
4065 |
+@@ -190,6 +190,9 @@ struct adv_info { |
4066 |
+ |
4067 |
+ #define HCI_MAX_SHORT_NAME_LENGTH 10 |
4068 |
+ |
4069 |
++/* Min encryption key size to match with SMP */ |
4070 |
++#define HCI_MIN_ENC_KEY_SIZE 7 |
4071 |
++ |
4072 |
+ /* Default LE RPA expiry time, 15 minutes */ |
4073 |
+ #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) |
4074 |
+ |
4075 |
+diff --git a/include/sound/soc.h b/include/sound/soc.h |
4076 |
+index e665f111b0d2..fa82d6215328 100644 |
4077 |
+--- a/include/sound/soc.h |
4078 |
++++ b/include/sound/soc.h |
4079 |
+@@ -1043,6 +1043,8 @@ struct snd_soc_card { |
4080 |
+ struct mutex mutex; |
4081 |
+ struct mutex dapm_mutex; |
4082 |
+ |
4083 |
++ spinlock_t dpcm_lock; |
4084 |
++ |
4085 |
+ bool instantiated; |
4086 |
+ bool topology_shortname_created; |
4087 |
+ |
4088 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
4089 |
+index 2e2305a81047..124e1e3d06b9 100644 |
4090 |
+--- a/kernel/events/core.c |
4091 |
++++ b/kernel/events/core.c |
4092 |
+@@ -2007,8 +2007,8 @@ event_sched_out(struct perf_event *event, |
4093 |
+ event->pmu->del(event, 0); |
4094 |
+ event->oncpu = -1; |
4095 |
+ |
4096 |
+- if (event->pending_disable) { |
4097 |
+- event->pending_disable = 0; |
4098 |
++ if (READ_ONCE(event->pending_disable) >= 0) { |
4099 |
++ WRITE_ONCE(event->pending_disable, -1); |
4100 |
+ state = PERF_EVENT_STATE_OFF; |
4101 |
+ } |
4102 |
+ perf_event_set_state(event, state); |
4103 |
+@@ -2196,7 +2196,8 @@ EXPORT_SYMBOL_GPL(perf_event_disable); |
4104 |
+ |
4105 |
+ void perf_event_disable_inatomic(struct perf_event *event) |
4106 |
+ { |
4107 |
+- event->pending_disable = 1; |
4108 |
++ WRITE_ONCE(event->pending_disable, smp_processor_id()); |
4109 |
++ /* can fail, see perf_pending_event_disable() */ |
4110 |
+ irq_work_queue(&event->pending); |
4111 |
+ } |
4112 |
+ |
4113 |
+@@ -5803,10 +5804,45 @@ void perf_event_wakeup(struct perf_event *event) |
4114 |
+ } |
4115 |
+ } |
4116 |
+ |
4117 |
++static void perf_pending_event_disable(struct perf_event *event) |
4118 |
++{ |
4119 |
++ int cpu = READ_ONCE(event->pending_disable); |
4120 |
++ |
4121 |
++ if (cpu < 0) |
4122 |
++ return; |
4123 |
++ |
4124 |
++ if (cpu == smp_processor_id()) { |
4125 |
++ WRITE_ONCE(event->pending_disable, -1); |
4126 |
++ perf_event_disable_local(event); |
4127 |
++ return; |
4128 |
++ } |
4129 |
++ |
4130 |
++ /* |
4131 |
++ * CPU-A CPU-B |
4132 |
++ * |
4133 |
++ * perf_event_disable_inatomic() |
4134 |
++ * @pending_disable = CPU-A; |
4135 |
++ * irq_work_queue(); |
4136 |
++ * |
4137 |
++ * sched-out |
4138 |
++ * @pending_disable = -1; |
4139 |
++ * |
4140 |
++ * sched-in |
4141 |
++ * perf_event_disable_inatomic() |
4142 |
++ * @pending_disable = CPU-B; |
4143 |
++ * irq_work_queue(); // FAILS |
4144 |
++ * |
4145 |
++ * irq_work_run() |
4146 |
++ * perf_pending_event() |
4147 |
++ * |
4148 |
++ * But the event runs on CPU-B and wants disabling there. |
4149 |
++ */ |
4150 |
++ irq_work_queue_on(&event->pending, cpu); |
4151 |
++} |
4152 |
++ |
4153 |
+ static void perf_pending_event(struct irq_work *entry) |
4154 |
+ { |
4155 |
+- struct perf_event *event = container_of(entry, |
4156 |
+- struct perf_event, pending); |
4157 |
++ struct perf_event *event = container_of(entry, struct perf_event, pending); |
4158 |
+ int rctx; |
4159 |
+ |
4160 |
+ rctx = perf_swevent_get_recursion_context(); |
4161 |
+@@ -5815,10 +5851,7 @@ static void perf_pending_event(struct irq_work *entry) |
4162 |
+ * and we won't recurse 'further'. |
4163 |
+ */ |
4164 |
+ |
4165 |
+- if (event->pending_disable) { |
4166 |
+- event->pending_disable = 0; |
4167 |
+- perf_event_disable_local(event); |
4168 |
+- } |
4169 |
++ perf_pending_event_disable(event); |
4170 |
+ |
4171 |
+ if (event->pending_wakeup) { |
4172 |
+ event->pending_wakeup = 0; |
4173 |
+@@ -9998,6 +10031,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, |
4174 |
+ |
4175 |
+ |
4176 |
+ init_waitqueue_head(&event->waitq); |
4177 |
++ event->pending_disable = -1; |
4178 |
+ init_irq_work(&event->pending, perf_pending_event); |
4179 |
+ |
4180 |
+ mutex_init(&event->mmap_mutex); |
4181 |
+diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c |
4182 |
+index dbd7656b4f73..a5fc56a654fd 100644 |
4183 |
+--- a/kernel/events/ring_buffer.c |
4184 |
++++ b/kernel/events/ring_buffer.c |
4185 |
+@@ -393,7 +393,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle, |
4186 |
+ * store that will be enabled on successful return |
4187 |
+ */ |
4188 |
+ if (!handle->size) { /* A, matches D */ |
4189 |
+- event->pending_disable = 1; |
4190 |
++ event->pending_disable = smp_processor_id(); |
4191 |
+ perf_output_wakeup(handle); |
4192 |
+ local_set(&rb->aux_nest, 0); |
4193 |
+ goto err_put; |
4194 |
+@@ -478,7 +478,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) |
4195 |
+ |
4196 |
+ if (wakeup) { |
4197 |
+ if (handle->aux_flags & PERF_AUX_FLAG_TRUNCATED) |
4198 |
+- handle->event->pending_disable = 1; |
4199 |
++ handle->event->pending_disable = smp_processor_id(); |
4200 |
+ perf_output_wakeup(handle); |
4201 |
+ } |
4202 |
+ |
4203 |
+diff --git a/kernel/futex.c b/kernel/futex.c |
4204 |
+index 52668d44e07b..4eafa8ec76a4 100644 |
4205 |
+--- a/kernel/futex.c |
4206 |
++++ b/kernel/futex.c |
4207 |
+@@ -1314,13 +1314,15 @@ static int lookup_pi_state(u32 __user *uaddr, u32 uval, |
4208 |
+ |
4209 |
+ static int lock_pi_update_atomic(u32 __user *uaddr, u32 uval, u32 newval) |
4210 |
+ { |
4211 |
++ int err; |
4212 |
+ u32 uninitialized_var(curval); |
4213 |
+ |
4214 |
+ if (unlikely(should_fail_futex(true))) |
4215 |
+ return -EFAULT; |
4216 |
+ |
4217 |
+- if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))) |
4218 |
+- return -EFAULT; |
4219 |
++ err = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
4220 |
++ if (unlikely(err)) |
4221 |
++ return err; |
4222 |
+ |
4223 |
+ /* If user space value changed, let the caller retry */ |
4224 |
+ return curval != uval ? -EAGAIN : 0; |
4225 |
+@@ -1506,10 +1508,8 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_ |
4226 |
+ if (unlikely(should_fail_futex(true))) |
4227 |
+ ret = -EFAULT; |
4228 |
+ |
4229 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) { |
4230 |
+- ret = -EFAULT; |
4231 |
+- |
4232 |
+- } else if (curval != uval) { |
4233 |
++ ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
4234 |
++ if (!ret && (curval != uval)) { |
4235 |
+ /* |
4236 |
+ * If a unconditional UNLOCK_PI operation (user space did not |
4237 |
+ * try the TID->0 transition) raced with a waiter setting the |
4238 |
+@@ -1704,32 +1704,32 @@ retry_private: |
4239 |
+ double_lock_hb(hb1, hb2); |
4240 |
+ op_ret = futex_atomic_op_inuser(op, uaddr2); |
4241 |
+ if (unlikely(op_ret < 0)) { |
4242 |
+- |
4243 |
+ double_unlock_hb(hb1, hb2); |
4244 |
+ |
4245 |
+-#ifndef CONFIG_MMU |
4246 |
+- /* |
4247 |
+- * we don't get EFAULT from MMU faults if we don't have an MMU, |
4248 |
+- * but we might get them from range checking |
4249 |
+- */ |
4250 |
+- ret = op_ret; |
4251 |
+- goto out_put_keys; |
4252 |
+-#endif |
4253 |
+- |
4254 |
+- if (unlikely(op_ret != -EFAULT)) { |
4255 |
++ if (!IS_ENABLED(CONFIG_MMU) || |
4256 |
++ unlikely(op_ret != -EFAULT && op_ret != -EAGAIN)) { |
4257 |
++ /* |
4258 |
++ * we don't get EFAULT from MMU faults if we don't have |
4259 |
++ * an MMU, but we might get them from range checking |
4260 |
++ */ |
4261 |
+ ret = op_ret; |
4262 |
+ goto out_put_keys; |
4263 |
+ } |
4264 |
+ |
4265 |
+- ret = fault_in_user_writeable(uaddr2); |
4266 |
+- if (ret) |
4267 |
+- goto out_put_keys; |
4268 |
++ if (op_ret == -EFAULT) { |
4269 |
++ ret = fault_in_user_writeable(uaddr2); |
4270 |
++ if (ret) |
4271 |
++ goto out_put_keys; |
4272 |
++ } |
4273 |
+ |
4274 |
+- if (!(flags & FLAGS_SHARED)) |
4275 |
++ if (!(flags & FLAGS_SHARED)) { |
4276 |
++ cond_resched(); |
4277 |
+ goto retry_private; |
4278 |
++ } |
4279 |
+ |
4280 |
+ put_futex_key(&key2); |
4281 |
+ put_futex_key(&key1); |
4282 |
++ cond_resched(); |
4283 |
+ goto retry; |
4284 |
+ } |
4285 |
+ |
4286 |
+@@ -2354,7 +2354,7 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, |
4287 |
+ u32 uval, uninitialized_var(curval), newval; |
4288 |
+ struct task_struct *oldowner, *newowner; |
4289 |
+ u32 newtid; |
4290 |
+- int ret; |
4291 |
++ int ret, err = 0; |
4292 |
+ |
4293 |
+ lockdep_assert_held(q->lock_ptr); |
4294 |
+ |
4295 |
+@@ -2425,14 +2425,17 @@ retry: |
4296 |
+ if (!pi_state->owner) |
4297 |
+ newtid |= FUTEX_OWNER_DIED; |
4298 |
+ |
4299 |
+- if (get_futex_value_locked(&uval, uaddr)) |
4300 |
+- goto handle_fault; |
4301 |
++ err = get_futex_value_locked(&uval, uaddr); |
4302 |
++ if (err) |
4303 |
++ goto handle_err; |
4304 |
+ |
4305 |
+ for (;;) { |
4306 |
+ newval = (uval & FUTEX_OWNER_DIED) | newtid; |
4307 |
+ |
4308 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) |
4309 |
+- goto handle_fault; |
4310 |
++ err = cmpxchg_futex_value_locked(&curval, uaddr, uval, newval); |
4311 |
++ if (err) |
4312 |
++ goto handle_err; |
4313 |
++ |
4314 |
+ if (curval == uval) |
4315 |
+ break; |
4316 |
+ uval = curval; |
4317 |
+@@ -2460,23 +2463,37 @@ retry: |
4318 |
+ return 0; |
4319 |
+ |
4320 |
+ /* |
4321 |
+- * To handle the page fault we need to drop the locks here. That gives |
4322 |
+- * the other task (either the highest priority waiter itself or the |
4323 |
+- * task which stole the rtmutex) the chance to try the fixup of the |
4324 |
+- * pi_state. So once we are back from handling the fault we need to |
4325 |
+- * check the pi_state after reacquiring the locks and before trying to |
4326 |
+- * do another fixup. When the fixup has been done already we simply |
4327 |
+- * return. |
4328 |
++ * In order to reschedule or handle a page fault, we need to drop the |
4329 |
++ * locks here. In the case of a fault, this gives the other task |
4330 |
++ * (either the highest priority waiter itself or the task which stole |
4331 |
++ * the rtmutex) the chance to try the fixup of the pi_state. So once we |
4332 |
++ * are back from handling the fault we need to check the pi_state after |
4333 |
++ * reacquiring the locks and before trying to do another fixup. When |
4334 |
++ * the fixup has been done already we simply return. |
4335 |
+ * |
4336 |
+ * Note: we hold both hb->lock and pi_mutex->wait_lock. We can safely |
4337 |
+ * drop hb->lock since the caller owns the hb -> futex_q relation. |
4338 |
+ * Dropping the pi_mutex->wait_lock requires the state revalidate. |
4339 |
+ */ |
4340 |
+-handle_fault: |
4341 |
++handle_err: |
4342 |
+ raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); |
4343 |
+ spin_unlock(q->lock_ptr); |
4344 |
+ |
4345 |
+- ret = fault_in_user_writeable(uaddr); |
4346 |
++ switch (err) { |
4347 |
++ case -EFAULT: |
4348 |
++ ret = fault_in_user_writeable(uaddr); |
4349 |
++ break; |
4350 |
++ |
4351 |
++ case -EAGAIN: |
4352 |
++ cond_resched(); |
4353 |
++ ret = 0; |
4354 |
++ break; |
4355 |
++ |
4356 |
++ default: |
4357 |
++ WARN_ON_ONCE(1); |
4358 |
++ ret = err; |
4359 |
++ break; |
4360 |
++ } |
4361 |
+ |
4362 |
+ spin_lock(q->lock_ptr); |
4363 |
+ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); |
4364 |
+@@ -3045,10 +3062,8 @@ retry: |
4365 |
+ * A unconditional UNLOCK_PI op raced against a waiter |
4366 |
+ * setting the FUTEX_WAITERS bit. Try again. |
4367 |
+ */ |
4368 |
+- if (ret == -EAGAIN) { |
4369 |
+- put_futex_key(&key); |
4370 |
+- goto retry; |
4371 |
+- } |
4372 |
++ if (ret == -EAGAIN) |
4373 |
++ goto pi_retry; |
4374 |
+ /* |
4375 |
+ * wake_futex_pi has detected invalid state. Tell user |
4376 |
+ * space. |
4377 |
+@@ -3063,9 +3078,19 @@ retry: |
4378 |
+ * preserve the WAITERS bit not the OWNER_DIED one. We are the |
4379 |
+ * owner. |
4380 |
+ */ |
4381 |
+- if (cmpxchg_futex_value_locked(&curval, uaddr, uval, 0)) { |
4382 |
++ if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { |
4383 |
+ spin_unlock(&hb->lock); |
4384 |
+- goto pi_faulted; |
4385 |
++ switch (ret) { |
4386 |
++ case -EFAULT: |
4387 |
++ goto pi_faulted; |
4388 |
++ |
4389 |
++ case -EAGAIN: |
4390 |
++ goto pi_retry; |
4391 |
++ |
4392 |
++ default: |
4393 |
++ WARN_ON_ONCE(1); |
4394 |
++ goto out_putkey; |
4395 |
++ } |
4396 |
+ } |
4397 |
+ |
4398 |
+ /* |
4399 |
+@@ -3079,6 +3104,11 @@ out_putkey: |
4400 |
+ put_futex_key(&key); |
4401 |
+ return ret; |
4402 |
+ |
4403 |
++pi_retry: |
4404 |
++ put_futex_key(&key); |
4405 |
++ cond_resched(); |
4406 |
++ goto retry; |
4407 |
++ |
4408 |
+ pi_faulted: |
4409 |
+ put_futex_key(&key); |
4410 |
+ |
4411 |
+@@ -3439,6 +3469,7 @@ err_unlock: |
4412 |
+ static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi) |
4413 |
+ { |
4414 |
+ u32 uval, uninitialized_var(nval), mval; |
4415 |
++ int err; |
4416 |
+ |
4417 |
+ /* Futex address must be 32bit aligned */ |
4418 |
+ if ((((unsigned long)uaddr) % sizeof(*uaddr)) != 0) |
4419 |
+@@ -3448,42 +3479,57 @@ retry: |
4420 |
+ if (get_user(uval, uaddr)) |
4421 |
+ return -1; |
4422 |
+ |
4423 |
+- if ((uval & FUTEX_TID_MASK) == task_pid_vnr(curr)) { |
4424 |
+- /* |
4425 |
+- * Ok, this dying thread is truly holding a futex |
4426 |
+- * of interest. Set the OWNER_DIED bit atomically |
4427 |
+- * via cmpxchg, and if the value had FUTEX_WAITERS |
4428 |
+- * set, wake up a waiter (if any). (We have to do a |
4429 |
+- * futex_wake() even if OWNER_DIED is already set - |
4430 |
+- * to handle the rare but possible case of recursive |
4431 |
+- * thread-death.) The rest of the cleanup is done in |
4432 |
+- * userspace. |
4433 |
+- */ |
4434 |
+- mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; |
4435 |
+- /* |
4436 |
+- * We are not holding a lock here, but we want to have |
4437 |
+- * the pagefault_disable/enable() protection because |
4438 |
+- * we want to handle the fault gracefully. If the |
4439 |
+- * access fails we try to fault in the futex with R/W |
4440 |
+- * verification via get_user_pages. get_user() above |
4441 |
+- * does not guarantee R/W access. If that fails we |
4442 |
+- * give up and leave the futex locked. |
4443 |
+- */ |
4444 |
+- if (cmpxchg_futex_value_locked(&nval, uaddr, uval, mval)) { |
4445 |
++ if ((uval & FUTEX_TID_MASK) != task_pid_vnr(curr)) |
4446 |
++ return 0; |
4447 |
++ |
4448 |
++ /* |
4449 |
++ * Ok, this dying thread is truly holding a futex |
4450 |
++ * of interest. Set the OWNER_DIED bit atomically |
4451 |
++ * via cmpxchg, and if the value had FUTEX_WAITERS |
4452 |
++ * set, wake up a waiter (if any). (We have to do a |
4453 |
++ * futex_wake() even if OWNER_DIED is already set - |
4454 |
++ * to handle the rare but possible case of recursive |
4455 |
++ * thread-death.) The rest of the cleanup is done in |
4456 |
++ * userspace. |
4457 |
++ */ |
4458 |
++ mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; |
4459 |
++ |
4460 |
++ /* |
4461 |
++ * We are not holding a lock here, but we want to have |
4462 |
++ * the pagefault_disable/enable() protection because |
4463 |
++ * we want to handle the fault gracefully. If the |
4464 |
++ * access fails we try to fault in the futex with R/W |
4465 |
++ * verification via get_user_pages. get_user() above |
4466 |
++ * does not guarantee R/W access. If that fails we |
4467 |
++ * give up and leave the futex locked. |
4468 |
++ */ |
4469 |
++ if ((err = cmpxchg_futex_value_locked(&nval, uaddr, uval, mval))) { |
4470 |
++ switch (err) { |
4471 |
++ case -EFAULT: |
4472 |
+ if (fault_in_user_writeable(uaddr)) |
4473 |
+ return -1; |
4474 |
+ goto retry; |
4475 |
+- } |
4476 |
+- if (nval != uval) |
4477 |
++ |
4478 |
++ case -EAGAIN: |
4479 |
++ cond_resched(); |
4480 |
+ goto retry; |
4481 |
+ |
4482 |
+- /* |
4483 |
+- * Wake robust non-PI futexes here. The wakeup of |
4484 |
+- * PI futexes happens in exit_pi_state(): |
4485 |
+- */ |
4486 |
+- if (!pi && (uval & FUTEX_WAITERS)) |
4487 |
+- futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY); |
4488 |
++ default: |
4489 |
++ WARN_ON_ONCE(1); |
4490 |
++ return err; |
4491 |
++ } |
4492 |
+ } |
4493 |
++ |
4494 |
++ if (nval != uval) |
4495 |
++ goto retry; |
4496 |
++ |
4497 |
++ /* |
4498 |
++ * Wake robust non-PI futexes here. The wakeup of |
4499 |
++ * PI futexes happens in exit_pi_state(): |
4500 |
++ */ |
4501 |
++ if (!pi && (uval & FUTEX_WAITERS)) |
4502 |
++ futex_wake(uaddr, 1, 1, FUTEX_BITSET_MATCH_ANY); |
4503 |
++ |
4504 |
+ return 0; |
4505 |
+ } |
4506 |
+ |
4507 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
4508 |
+index 84b54a17b95d..df557ec20a6f 100644 |
4509 |
+--- a/kernel/irq/manage.c |
4510 |
++++ b/kernel/irq/manage.c |
4511 |
+@@ -356,8 +356,10 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) |
4512 |
+ desc->affinity_notify = notify; |
4513 |
+ raw_spin_unlock_irqrestore(&desc->lock, flags); |
4514 |
+ |
4515 |
+- if (old_notify) |
4516 |
++ if (old_notify) { |
4517 |
++ cancel_work_sync(&old_notify->work); |
4518 |
+ kref_put(&old_notify->kref, old_notify->release); |
4519 |
++ } |
4520 |
+ |
4521 |
+ return 0; |
4522 |
+ } |
4523 |
+diff --git a/lib/iov_iter.c b/lib/iov_iter.c |
4524 |
+index be4bd627caf0..a0d1cd88f903 100644 |
4525 |
+--- a/lib/iov_iter.c |
4526 |
++++ b/lib/iov_iter.c |
4527 |
+@@ -1515,6 +1515,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter); |
4528 |
+ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp, |
4529 |
+ struct iov_iter *i) |
4530 |
+ { |
4531 |
++#ifdef CONFIG_CRYPTO |
4532 |
+ struct ahash_request *hash = hashp; |
4533 |
+ struct scatterlist sg; |
4534 |
+ size_t copied; |
4535 |
+@@ -1524,6 +1525,9 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp, |
4536 |
+ ahash_request_set_crypt(hash, &sg, NULL, copied); |
4537 |
+ crypto_ahash_update(hash); |
4538 |
+ return copied; |
4539 |
++#else |
4540 |
++ return 0; |
4541 |
++#endif |
4542 |
+ } |
4543 |
+ EXPORT_SYMBOL(hash_and_copy_to_iter); |
4544 |
+ |
4545 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
4546 |
+index e4162f59a81c..1e9e2ab25539 100644 |
4547 |
+--- a/lib/ubsan.c |
4548 |
++++ b/lib/ubsan.c |
4549 |
+@@ -86,11 +86,13 @@ static bool is_inline_int(struct type_descriptor *type) |
4550 |
+ return bits <= inline_bits; |
4551 |
+ } |
4552 |
+ |
4553 |
+-static s_max get_signed_val(struct type_descriptor *type, unsigned long val) |
4554 |
++static s_max get_signed_val(struct type_descriptor *type, void *val) |
4555 |
+ { |
4556 |
+ if (is_inline_int(type)) { |
4557 |
+ unsigned extra_bits = sizeof(s_max)*8 - type_bit_width(type); |
4558 |
+- return ((s_max)val) << extra_bits >> extra_bits; |
4559 |
++ unsigned long ulong_val = (unsigned long)val; |
4560 |
++ |
4561 |
++ return ((s_max)ulong_val) << extra_bits >> extra_bits; |
4562 |
+ } |
4563 |
+ |
4564 |
+ if (type_bit_width(type) == 64) |
4565 |
+@@ -99,15 +101,15 @@ static s_max get_signed_val(struct type_descriptor *type, unsigned long val) |
4566 |
+ return *(s_max *)val; |
4567 |
+ } |
4568 |
+ |
4569 |
+-static bool val_is_negative(struct type_descriptor *type, unsigned long val) |
4570 |
++static bool val_is_negative(struct type_descriptor *type, void *val) |
4571 |
+ { |
4572 |
+ return type_is_signed(type) && get_signed_val(type, val) < 0; |
4573 |
+ } |
4574 |
+ |
4575 |
+-static u_max get_unsigned_val(struct type_descriptor *type, unsigned long val) |
4576 |
++static u_max get_unsigned_val(struct type_descriptor *type, void *val) |
4577 |
+ { |
4578 |
+ if (is_inline_int(type)) |
4579 |
+- return val; |
4580 |
++ return (unsigned long)val; |
4581 |
+ |
4582 |
+ if (type_bit_width(type) == 64) |
4583 |
+ return *(u64 *)val; |
4584 |
+@@ -116,7 +118,7 @@ static u_max get_unsigned_val(struct type_descriptor *type, unsigned long val) |
4585 |
+ } |
4586 |
+ |
4587 |
+ static void val_to_string(char *str, size_t size, struct type_descriptor *type, |
4588 |
+- unsigned long value) |
4589 |
++ void *value) |
4590 |
+ { |
4591 |
+ if (type_is_int(type)) { |
4592 |
+ if (type_bit_width(type) == 128) { |
4593 |
+@@ -163,8 +165,8 @@ static void ubsan_epilogue(unsigned long *flags) |
4594 |
+ current->in_ubsan--; |
4595 |
+ } |
4596 |
+ |
4597 |
+-static void handle_overflow(struct overflow_data *data, unsigned long lhs, |
4598 |
+- unsigned long rhs, char op) |
4599 |
++static void handle_overflow(struct overflow_data *data, void *lhs, |
4600 |
++ void *rhs, char op) |
4601 |
+ { |
4602 |
+ |
4603 |
+ struct type_descriptor *type = data->type; |
4604 |
+@@ -191,8 +193,7 @@ static void handle_overflow(struct overflow_data *data, unsigned long lhs, |
4605 |
+ } |
4606 |
+ |
4607 |
+ void __ubsan_handle_add_overflow(struct overflow_data *data, |
4608 |
+- unsigned long lhs, |
4609 |
+- unsigned long rhs) |
4610 |
++ void *lhs, void *rhs) |
4611 |
+ { |
4612 |
+ |
4613 |
+ handle_overflow(data, lhs, rhs, '+'); |
4614 |
+@@ -200,23 +201,21 @@ void __ubsan_handle_add_overflow(struct overflow_data *data, |
4615 |
+ EXPORT_SYMBOL(__ubsan_handle_add_overflow); |
4616 |
+ |
4617 |
+ void __ubsan_handle_sub_overflow(struct overflow_data *data, |
4618 |
+- unsigned long lhs, |
4619 |
+- unsigned long rhs) |
4620 |
++ void *lhs, void *rhs) |
4621 |
+ { |
4622 |
+ handle_overflow(data, lhs, rhs, '-'); |
4623 |
+ } |
4624 |
+ EXPORT_SYMBOL(__ubsan_handle_sub_overflow); |
4625 |
+ |
4626 |
+ void __ubsan_handle_mul_overflow(struct overflow_data *data, |
4627 |
+- unsigned long lhs, |
4628 |
+- unsigned long rhs) |
4629 |
++ void *lhs, void *rhs) |
4630 |
+ { |
4631 |
+ handle_overflow(data, lhs, rhs, '*'); |
4632 |
+ } |
4633 |
+ EXPORT_SYMBOL(__ubsan_handle_mul_overflow); |
4634 |
+ |
4635 |
+ void __ubsan_handle_negate_overflow(struct overflow_data *data, |
4636 |
+- unsigned long old_val) |
4637 |
++ void *old_val) |
4638 |
+ { |
4639 |
+ unsigned long flags; |
4640 |
+ char old_val_str[VALUE_LENGTH]; |
4641 |
+@@ -237,8 +236,7 @@ EXPORT_SYMBOL(__ubsan_handle_negate_overflow); |
4642 |
+ |
4643 |
+ |
4644 |
+ void __ubsan_handle_divrem_overflow(struct overflow_data *data, |
4645 |
+- unsigned long lhs, |
4646 |
+- unsigned long rhs) |
4647 |
++ void *lhs, void *rhs) |
4648 |
+ { |
4649 |
+ unsigned long flags; |
4650 |
+ char rhs_val_str[VALUE_LENGTH]; |
4651 |
+@@ -323,7 +321,7 @@ static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data, |
4652 |
+ } |
4653 |
+ |
4654 |
+ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, |
4655 |
+- unsigned long ptr) |
4656 |
++ void *ptr) |
4657 |
+ { |
4658 |
+ struct type_mismatch_data_common common_data = { |
4659 |
+ .location = &data->location, |
4660 |
+@@ -332,12 +330,12 @@ void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, |
4661 |
+ .type_check_kind = data->type_check_kind |
4662 |
+ }; |
4663 |
+ |
4664 |
+- ubsan_type_mismatch_common(&common_data, ptr); |
4665 |
++ ubsan_type_mismatch_common(&common_data, (unsigned long)ptr); |
4666 |
+ } |
4667 |
+ EXPORT_SYMBOL(__ubsan_handle_type_mismatch); |
4668 |
+ |
4669 |
+ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, |
4670 |
+- unsigned long ptr) |
4671 |
++ void *ptr) |
4672 |
+ { |
4673 |
+ |
4674 |
+ struct type_mismatch_data_common common_data = { |
4675 |
+@@ -347,12 +345,12 @@ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, |
4676 |
+ .type_check_kind = data->type_check_kind |
4677 |
+ }; |
4678 |
+ |
4679 |
+- ubsan_type_mismatch_common(&common_data, ptr); |
4680 |
++ ubsan_type_mismatch_common(&common_data, (unsigned long)ptr); |
4681 |
+ } |
4682 |
+ EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1); |
4683 |
+ |
4684 |
+ void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, |
4685 |
+- unsigned long bound) |
4686 |
++ void *bound) |
4687 |
+ { |
4688 |
+ unsigned long flags; |
4689 |
+ char bound_str[VALUE_LENGTH]; |
4690 |
+@@ -369,8 +367,7 @@ void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, |
4691 |
+ } |
4692 |
+ EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); |
4693 |
+ |
4694 |
+-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, |
4695 |
+- unsigned long index) |
4696 |
++void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, void *index) |
4697 |
+ { |
4698 |
+ unsigned long flags; |
4699 |
+ char index_str[VALUE_LENGTH]; |
4700 |
+@@ -388,7 +385,7 @@ void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, |
4701 |
+ EXPORT_SYMBOL(__ubsan_handle_out_of_bounds); |
4702 |
+ |
4703 |
+ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
4704 |
+- unsigned long lhs, unsigned long rhs) |
4705 |
++ void *lhs, void *rhs) |
4706 |
+ { |
4707 |
+ unsigned long flags; |
4708 |
+ struct type_descriptor *rhs_type = data->rhs_type; |
4709 |
+@@ -439,7 +436,7 @@ void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
4710 |
+ EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); |
4711 |
+ |
4712 |
+ void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, |
4713 |
+- unsigned long val) |
4714 |
++ void *val) |
4715 |
+ { |
4716 |
+ unsigned long flags; |
4717 |
+ char val_str[VALUE_LENGTH]; |
4718 |
+diff --git a/mm/slab.c b/mm/slab.c |
4719 |
+index 2f2aa8eaf7d9..188c4b65255d 100644 |
4720 |
+--- a/mm/slab.c |
4721 |
++++ b/mm/slab.c |
4722 |
+@@ -4297,7 +4297,8 @@ static void show_symbol(struct seq_file *m, unsigned long address) |
4723 |
+ |
4724 |
+ static int leaks_show(struct seq_file *m, void *p) |
4725 |
+ { |
4726 |
+- struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list); |
4727 |
++ struct kmem_cache *cachep = list_entry(p, struct kmem_cache, |
4728 |
++ root_caches_node); |
4729 |
+ struct page *page; |
4730 |
+ struct kmem_cache_node *n; |
4731 |
+ const char *name; |
4732 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
4733 |
+index bd4978ce8c45..3cf0764d5793 100644 |
4734 |
+--- a/net/bluetooth/hci_conn.c |
4735 |
++++ b/net/bluetooth/hci_conn.c |
4736 |
+@@ -1276,6 +1276,14 @@ int hci_conn_check_link_mode(struct hci_conn *conn) |
4737 |
+ !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
4738 |
+ return 0; |
4739 |
+ |
4740 |
++ /* The minimum encryption key size needs to be enforced by the |
4741 |
++ * host stack before establishing any L2CAP connections. The |
4742 |
++ * specification in theory allows a minimum of 1, but to align |
4743 |
++ * BR/EDR and LE transports, a minimum of 7 is chosen. |
4744 |
++ */ |
4745 |
++ if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) |
4746 |
++ return 0; |
4747 |
++ |
4748 |
+ return 1; |
4749 |
+ } |
4750 |
+ |
4751 |
+diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c |
4752 |
+index 9f85a1943be9..2151913892ce 100644 |
4753 |
+--- a/net/bluetooth/hidp/sock.c |
4754 |
++++ b/net/bluetooth/hidp/sock.c |
4755 |
+@@ -75,6 +75,7 @@ static int do_hidp_sock_ioctl(struct socket *sock, unsigned int cmd, void __user |
4756 |
+ sockfd_put(csock); |
4757 |
+ return err; |
4758 |
+ } |
4759 |
++ ca.name[sizeof(ca.name)-1] = 0; |
4760 |
+ |
4761 |
+ err = hidp_connection_add(&ca, csock, isock); |
4762 |
+ if (!err && copy_to_user(argp, &ca, sizeof(ca))) |
4763 |
+diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
4764 |
+index ccdc5c67d22a..a3b2e3b5f04b 100644 |
4765 |
+--- a/net/bluetooth/l2cap_core.c |
4766 |
++++ b/net/bluetooth/l2cap_core.c |
4767 |
+@@ -510,12 +510,12 @@ void l2cap_chan_set_defaults(struct l2cap_chan *chan) |
4768 |
+ } |
4769 |
+ EXPORT_SYMBOL_GPL(l2cap_chan_set_defaults); |
4770 |
+ |
4771 |
+-static void l2cap_le_flowctl_init(struct l2cap_chan *chan) |
4772 |
++static void l2cap_le_flowctl_init(struct l2cap_chan *chan, u16 tx_credits) |
4773 |
+ { |
4774 |
+ chan->sdu = NULL; |
4775 |
+ chan->sdu_last_frag = NULL; |
4776 |
+ chan->sdu_len = 0; |
4777 |
+- chan->tx_credits = 0; |
4778 |
++ chan->tx_credits = tx_credits; |
4779 |
+ /* Derive MPS from connection MTU to stop HCI fragmentation */ |
4780 |
+ chan->mps = min_t(u16, chan->imtu, chan->conn->mtu - L2CAP_HDR_SIZE); |
4781 |
+ /* Give enough credits for a full packet */ |
4782 |
+@@ -1281,7 +1281,7 @@ static void l2cap_le_connect(struct l2cap_chan *chan) |
4783 |
+ if (test_and_set_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags)) |
4784 |
+ return; |
4785 |
+ |
4786 |
+- l2cap_le_flowctl_init(chan); |
4787 |
++ l2cap_le_flowctl_init(chan, 0); |
4788 |
+ |
4789 |
+ req.psm = chan->psm; |
4790 |
+ req.scid = cpu_to_le16(chan->scid); |
4791 |
+@@ -5531,11 +5531,10 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, |
4792 |
+ chan->dcid = scid; |
4793 |
+ chan->omtu = mtu; |
4794 |
+ chan->remote_mps = mps; |
4795 |
+- chan->tx_credits = __le16_to_cpu(req->credits); |
4796 |
+ |
4797 |
+ __l2cap_chan_add(conn, chan); |
4798 |
+ |
4799 |
+- l2cap_le_flowctl_init(chan); |
4800 |
++ l2cap_le_flowctl_init(chan, __le16_to_cpu(req->credits)); |
4801 |
+ |
4802 |
+ dcid = chan->scid; |
4803 |
+ credits = chan->rx_credits; |
4804 |
+diff --git a/security/keys/trusted.c b/security/keys/trusted.c |
4805 |
+index 4d98f4f87236..94d2b28c7c22 100644 |
4806 |
+--- a/security/keys/trusted.c |
4807 |
++++ b/security/keys/trusted.c |
4808 |
+@@ -123,7 +123,7 @@ out: |
4809 |
+ */ |
4810 |
+ int TSS_authhmac(unsigned char *digest, const unsigned char *key, |
4811 |
+ unsigned int keylen, unsigned char *h1, |
4812 |
+- unsigned char *h2, unsigned char h3, ...) |
4813 |
++ unsigned char *h2, unsigned int h3, ...) |
4814 |
+ { |
4815 |
+ unsigned char paramdigest[SHA1_DIGEST_SIZE]; |
4816 |
+ struct sdesc *sdesc; |
4817 |
+@@ -139,7 +139,7 @@ int TSS_authhmac(unsigned char *digest, const unsigned char *key, |
4818 |
+ return PTR_ERR(sdesc); |
4819 |
+ } |
4820 |
+ |
4821 |
+- c = h3; |
4822 |
++ c = !!h3; |
4823 |
+ ret = crypto_shash_init(&sdesc->shash); |
4824 |
+ if (ret < 0) |
4825 |
+ goto out; |
4826 |
+diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c |
4827 |
+index 9c37d9af3023..ec7715c6b0c0 100644 |
4828 |
+--- a/sound/hda/ext/hdac_ext_bus.c |
4829 |
++++ b/sound/hda/ext/hdac_ext_bus.c |
4830 |
+@@ -107,7 +107,6 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, |
4831 |
+ INIT_LIST_HEAD(&bus->hlink_list); |
4832 |
+ bus->idx = idx++; |
4833 |
+ |
4834 |
+- mutex_init(&bus->lock); |
4835 |
+ bus->cmd_dma_state = true; |
4836 |
+ |
4837 |
+ return 0; |
4838 |
+diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c |
4839 |
+index 012305177f68..ad8eee08013f 100644 |
4840 |
+--- a/sound/hda/hdac_bus.c |
4841 |
++++ b/sound/hda/hdac_bus.c |
4842 |
+@@ -38,6 +38,7 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, |
4843 |
+ INIT_WORK(&bus->unsol_work, snd_hdac_bus_process_unsol_events); |
4844 |
+ spin_lock_init(&bus->reg_lock); |
4845 |
+ mutex_init(&bus->cmd_mutex); |
4846 |
++ mutex_init(&bus->lock); |
4847 |
+ bus->irq = -1; |
4848 |
+ return 0; |
4849 |
+ } |
4850 |
+diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c |
4851 |
+index a6d37b9d6413..6b5caee61c6e 100644 |
4852 |
+--- a/sound/hda/hdac_component.c |
4853 |
++++ b/sound/hda/hdac_component.c |
4854 |
+@@ -69,13 +69,15 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable) |
4855 |
+ |
4856 |
+ dev_dbg(bus->dev, "display power %s\n", |
4857 |
+ enable ? "enable" : "disable"); |
4858 |
++ |
4859 |
++ mutex_lock(&bus->lock); |
4860 |
+ if (enable) |
4861 |
+ set_bit(idx, &bus->display_power_status); |
4862 |
+ else |
4863 |
+ clear_bit(idx, &bus->display_power_status); |
4864 |
+ |
4865 |
+ if (!acomp || !acomp->ops) |
4866 |
+- return; |
4867 |
++ goto unlock; |
4868 |
+ |
4869 |
+ if (bus->display_power_status) { |
4870 |
+ if (!bus->display_power_active) { |
4871 |
+@@ -92,6 +94,8 @@ void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx, bool enable) |
4872 |
+ bus->display_power_active = false; |
4873 |
+ } |
4874 |
+ } |
4875 |
++ unlock: |
4876 |
++ mutex_unlock(&bus->lock); |
4877 |
+ } |
4878 |
+ EXPORT_SYMBOL_GPL(snd_hdac_display_power); |
4879 |
+ |
4880 |
+diff --git a/sound/soc/codecs/cs35l35.c b/sound/soc/codecs/cs35l35.c |
4881 |
+index 9f4a59871cee..c71696146c5e 100644 |
4882 |
+--- a/sound/soc/codecs/cs35l35.c |
4883 |
++++ b/sound/soc/codecs/cs35l35.c |
4884 |
+@@ -1635,6 +1635,16 @@ err: |
4885 |
+ return ret; |
4886 |
+ } |
4887 |
+ |
4888 |
++static int cs35l35_i2c_remove(struct i2c_client *i2c_client) |
4889 |
++{ |
4890 |
++ struct cs35l35_private *cs35l35 = i2c_get_clientdata(i2c_client); |
4891 |
++ |
4892 |
++ regulator_bulk_disable(cs35l35->num_supplies, cs35l35->supplies); |
4893 |
++ gpiod_set_value_cansleep(cs35l35->reset_gpio, 0); |
4894 |
++ |
4895 |
++ return 0; |
4896 |
++} |
4897 |
++ |
4898 |
+ static const struct of_device_id cs35l35_of_match[] = { |
4899 |
+ {.compatible = "cirrus,cs35l35"}, |
4900 |
+ {}, |
4901 |
+@@ -1655,6 +1665,7 @@ static struct i2c_driver cs35l35_i2c_driver = { |
4902 |
+ }, |
4903 |
+ .id_table = cs35l35_id, |
4904 |
+ .probe = cs35l35_i2c_probe, |
4905 |
++ .remove = cs35l35_i2c_remove, |
4906 |
+ }; |
4907 |
+ |
4908 |
+ module_i2c_driver(cs35l35_i2c_driver); |
4909 |
+diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c |
4910 |
+index 33d74f163bd7..793a14d58667 100644 |
4911 |
+--- a/sound/soc/codecs/cs4270.c |
4912 |
++++ b/sound/soc/codecs/cs4270.c |
4913 |
+@@ -642,6 +642,7 @@ static const struct regmap_config cs4270_regmap = { |
4914 |
+ .reg_defaults = cs4270_reg_defaults, |
4915 |
+ .num_reg_defaults = ARRAY_SIZE(cs4270_reg_defaults), |
4916 |
+ .cache_type = REGCACHE_RBTREE, |
4917 |
++ .write_flag_mask = CS4270_I2C_INCR, |
4918 |
+ |
4919 |
+ .readable_reg = cs4270_reg_is_readable, |
4920 |
+ .volatile_reg = cs4270_reg_is_volatile, |
4921 |
+diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c |
4922 |
+index ffecdaaa8cf2..f889d94c8e3c 100644 |
4923 |
+--- a/sound/soc/codecs/hdac_hda.c |
4924 |
++++ b/sound/soc/codecs/hdac_hda.c |
4925 |
+@@ -38,6 +38,9 @@ static void hdac_hda_dai_close(struct snd_pcm_substream *substream, |
4926 |
+ struct snd_soc_dai *dai); |
4927 |
+ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, |
4928 |
+ struct snd_soc_dai *dai); |
4929 |
++static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, |
4930 |
++ struct snd_pcm_hw_params *params, |
4931 |
++ struct snd_soc_dai *dai); |
4932 |
+ static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream, |
4933 |
+ struct snd_soc_dai *dai); |
4934 |
+ static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, |
4935 |
+@@ -50,6 +53,7 @@ static const struct snd_soc_dai_ops hdac_hda_dai_ops = { |
4936 |
+ .startup = hdac_hda_dai_open, |
4937 |
+ .shutdown = hdac_hda_dai_close, |
4938 |
+ .prepare = hdac_hda_dai_prepare, |
4939 |
++ .hw_params = hdac_hda_dai_hw_params, |
4940 |
+ .hw_free = hdac_hda_dai_hw_free, |
4941 |
+ .set_tdm_slot = hdac_hda_dai_set_tdm_slot, |
4942 |
+ }; |
4943 |
+@@ -139,6 +143,39 @@ static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, |
4944 |
+ return 0; |
4945 |
+ } |
4946 |
+ |
4947 |
++static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, |
4948 |
++ struct snd_pcm_hw_params *params, |
4949 |
++ struct snd_soc_dai *dai) |
4950 |
++{ |
4951 |
++ struct snd_soc_component *component = dai->component; |
4952 |
++ struct hdac_hda_priv *hda_pvt; |
4953 |
++ unsigned int format_val; |
4954 |
++ unsigned int maxbps; |
4955 |
++ |
4956 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
4957 |
++ maxbps = dai->driver->playback.sig_bits; |
4958 |
++ else |
4959 |
++ maxbps = dai->driver->capture.sig_bits; |
4960 |
++ |
4961 |
++ hda_pvt = snd_soc_component_get_drvdata(component); |
4962 |
++ format_val = snd_hdac_calc_stream_format(params_rate(params), |
4963 |
++ params_channels(params), |
4964 |
++ params_format(params), |
4965 |
++ maxbps, |
4966 |
++ 0); |
4967 |
++ if (!format_val) { |
4968 |
++ dev_err(dai->dev, |
4969 |
++ "invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n", |
4970 |
++ params_rate(params), params_channels(params), |
4971 |
++ params_format(params), maxbps); |
4972 |
++ |
4973 |
++ return -EINVAL; |
4974 |
++ } |
4975 |
++ |
4976 |
++ hda_pvt->pcm[dai->id].format_val[substream->stream] = format_val; |
4977 |
++ return 0; |
4978 |
++} |
4979 |
++ |
4980 |
+ static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream, |
4981 |
+ struct snd_soc_dai *dai) |
4982 |
+ { |
4983 |
+@@ -162,10 +199,9 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, |
4984 |
+ struct snd_soc_dai *dai) |
4985 |
+ { |
4986 |
+ struct snd_soc_component *component = dai->component; |
4987 |
++ struct hda_pcm_stream *hda_stream; |
4988 |
+ struct hdac_hda_priv *hda_pvt; |
4989 |
+- struct snd_pcm_runtime *runtime = substream->runtime; |
4990 |
+ struct hdac_device *hdev; |
4991 |
+- struct hda_pcm_stream *hda_stream; |
4992 |
+ unsigned int format_val; |
4993 |
+ struct hda_pcm *pcm; |
4994 |
+ unsigned int stream; |
4995 |
+@@ -179,19 +215,8 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, |
4996 |
+ |
4997 |
+ hda_stream = &pcm->stream[substream->stream]; |
4998 |
+ |
4999 |
+- format_val = snd_hdac_calc_stream_format(runtime->rate, |
5000 |
+- runtime->channels, |
5001 |
+- runtime->format, |
5002 |
+- hda_stream->maxbps, |
5003 |
+- 0); |
5004 |
+- if (!format_val) { |
5005 |
+- dev_err(&hdev->dev, |
5006 |
+- "invalid format_val, rate=%d, ch=%d, format=%d\n", |
5007 |
+- runtime->rate, runtime->channels, runtime->format); |
5008 |
+- return -EINVAL; |
5009 |
+- } |
5010 |
+- |
5011 |
+ stream = hda_pvt->pcm[dai->id].stream_tag[substream->stream]; |
5012 |
++ format_val = hda_pvt->pcm[dai->id].format_val[substream->stream]; |
5013 |
+ |
5014 |
+ ret = snd_hda_codec_prepare(&hda_pvt->codec, hda_stream, |
5015 |
+ stream, format_val, substream); |
5016 |
+diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h |
5017 |
+index e444ef593360..6b1bd4f428e7 100644 |
5018 |
+--- a/sound/soc/codecs/hdac_hda.h |
5019 |
++++ b/sound/soc/codecs/hdac_hda.h |
5020 |
+@@ -8,6 +8,7 @@ |
5021 |
+ |
5022 |
+ struct hdac_hda_pcm { |
5023 |
+ int stream_tag[2]; |
5024 |
++ unsigned int format_val[2]; |
5025 |
+ }; |
5026 |
+ |
5027 |
+ struct hdac_hda_priv { |
5028 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
5029 |
+index e5b6769b9797..d5f73c837281 100644 |
5030 |
+--- a/sound/soc/codecs/hdmi-codec.c |
5031 |
++++ b/sound/soc/codecs/hdmi-codec.c |
5032 |
+@@ -529,73 +529,71 @@ static int hdmi_codec_set_fmt(struct snd_soc_dai *dai, |
5033 |
+ { |
5034 |
+ struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); |
5035 |
+ struct hdmi_codec_daifmt cf = { 0 }; |
5036 |
+- int ret = 0; |
5037 |
+ |
5038 |
+ dev_dbg(dai->dev, "%s()\n", __func__); |
5039 |
+ |
5040 |
+- if (dai->id == DAI_ID_SPDIF) { |
5041 |
+- cf.fmt = HDMI_SPDIF; |
5042 |
+- } else { |
5043 |
+- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
5044 |
+- case SND_SOC_DAIFMT_CBM_CFM: |
5045 |
+- cf.bit_clk_master = 1; |
5046 |
+- cf.frame_clk_master = 1; |
5047 |
+- break; |
5048 |
+- case SND_SOC_DAIFMT_CBS_CFM: |
5049 |
+- cf.frame_clk_master = 1; |
5050 |
+- break; |
5051 |
+- case SND_SOC_DAIFMT_CBM_CFS: |
5052 |
+- cf.bit_clk_master = 1; |
5053 |
+- break; |
5054 |
+- case SND_SOC_DAIFMT_CBS_CFS: |
5055 |
+- break; |
5056 |
+- default: |
5057 |
+- return -EINVAL; |
5058 |
+- } |
5059 |
++ if (dai->id == DAI_ID_SPDIF) |
5060 |
++ return 0; |
5061 |
++ |
5062 |
++ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
5063 |
++ case SND_SOC_DAIFMT_CBM_CFM: |
5064 |
++ cf.bit_clk_master = 1; |
5065 |
++ cf.frame_clk_master = 1; |
5066 |
++ break; |
5067 |
++ case SND_SOC_DAIFMT_CBS_CFM: |
5068 |
++ cf.frame_clk_master = 1; |
5069 |
++ break; |
5070 |
++ case SND_SOC_DAIFMT_CBM_CFS: |
5071 |
++ cf.bit_clk_master = 1; |
5072 |
++ break; |
5073 |
++ case SND_SOC_DAIFMT_CBS_CFS: |
5074 |
++ break; |
5075 |
++ default: |
5076 |
++ return -EINVAL; |
5077 |
++ } |
5078 |
+ |
5079 |
+- switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
5080 |
+- case SND_SOC_DAIFMT_NB_NF: |
5081 |
+- break; |
5082 |
+- case SND_SOC_DAIFMT_NB_IF: |
5083 |
+- cf.frame_clk_inv = 1; |
5084 |
+- break; |
5085 |
+- case SND_SOC_DAIFMT_IB_NF: |
5086 |
+- cf.bit_clk_inv = 1; |
5087 |
+- break; |
5088 |
+- case SND_SOC_DAIFMT_IB_IF: |
5089 |
+- cf.frame_clk_inv = 1; |
5090 |
+- cf.bit_clk_inv = 1; |
5091 |
+- break; |
5092 |
+- } |
5093 |
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
5094 |
++ case SND_SOC_DAIFMT_NB_NF: |
5095 |
++ break; |
5096 |
++ case SND_SOC_DAIFMT_NB_IF: |
5097 |
++ cf.frame_clk_inv = 1; |
5098 |
++ break; |
5099 |
++ case SND_SOC_DAIFMT_IB_NF: |
5100 |
++ cf.bit_clk_inv = 1; |
5101 |
++ break; |
5102 |
++ case SND_SOC_DAIFMT_IB_IF: |
5103 |
++ cf.frame_clk_inv = 1; |
5104 |
++ cf.bit_clk_inv = 1; |
5105 |
++ break; |
5106 |
++ } |
5107 |
+ |
5108 |
+- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
5109 |
+- case SND_SOC_DAIFMT_I2S: |
5110 |
+- cf.fmt = HDMI_I2S; |
5111 |
+- break; |
5112 |
+- case SND_SOC_DAIFMT_DSP_A: |
5113 |
+- cf.fmt = HDMI_DSP_A; |
5114 |
+- break; |
5115 |
+- case SND_SOC_DAIFMT_DSP_B: |
5116 |
+- cf.fmt = HDMI_DSP_B; |
5117 |
+- break; |
5118 |
+- case SND_SOC_DAIFMT_RIGHT_J: |
5119 |
+- cf.fmt = HDMI_RIGHT_J; |
5120 |
+- break; |
5121 |
+- case SND_SOC_DAIFMT_LEFT_J: |
5122 |
+- cf.fmt = HDMI_LEFT_J; |
5123 |
+- break; |
5124 |
+- case SND_SOC_DAIFMT_AC97: |
5125 |
+- cf.fmt = HDMI_AC97; |
5126 |
+- break; |
5127 |
+- default: |
5128 |
+- dev_err(dai->dev, "Invalid DAI interface format\n"); |
5129 |
+- return -EINVAL; |
5130 |
+- } |
5131 |
++ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
5132 |
++ case SND_SOC_DAIFMT_I2S: |
5133 |
++ cf.fmt = HDMI_I2S; |
5134 |
++ break; |
5135 |
++ case SND_SOC_DAIFMT_DSP_A: |
5136 |
++ cf.fmt = HDMI_DSP_A; |
5137 |
++ break; |
5138 |
++ case SND_SOC_DAIFMT_DSP_B: |
5139 |
++ cf.fmt = HDMI_DSP_B; |
5140 |
++ break; |
5141 |
++ case SND_SOC_DAIFMT_RIGHT_J: |
5142 |
++ cf.fmt = HDMI_RIGHT_J; |
5143 |
++ break; |
5144 |
++ case SND_SOC_DAIFMT_LEFT_J: |
5145 |
++ cf.fmt = HDMI_LEFT_J; |
5146 |
++ break; |
5147 |
++ case SND_SOC_DAIFMT_AC97: |
5148 |
++ cf.fmt = HDMI_AC97; |
5149 |
++ break; |
5150 |
++ default: |
5151 |
++ dev_err(dai->dev, "Invalid DAI interface format\n"); |
5152 |
++ return -EINVAL; |
5153 |
+ } |
5154 |
+ |
5155 |
+ hcp->daifmt[dai->id] = cf; |
5156 |
+ |
5157 |
+- return ret; |
5158 |
++ return 0; |
5159 |
+ } |
5160 |
+ |
5161 |
+ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) |
5162 |
+@@ -792,8 +790,10 @@ static int hdmi_codec_probe(struct platform_device *pdev) |
5163 |
+ i++; |
5164 |
+ } |
5165 |
+ |
5166 |
+- if (hcd->spdif) |
5167 |
++ if (hcd->spdif) { |
5168 |
+ hcp->daidrv[i] = hdmi_spdif_dai; |
5169 |
++ hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF; |
5170 |
++ } |
5171 |
+ |
5172 |
+ dev_set_drvdata(dev, hcp); |
5173 |
+ |
5174 |
+diff --git a/sound/soc/codecs/nau8810.c b/sound/soc/codecs/nau8810.c |
5175 |
+index bfd74b86c9d2..645aa0794123 100644 |
5176 |
+--- a/sound/soc/codecs/nau8810.c |
5177 |
++++ b/sound/soc/codecs/nau8810.c |
5178 |
+@@ -411,9 +411,9 @@ static const struct snd_soc_dapm_widget nau8810_dapm_widgets[] = { |
5179 |
+ SND_SOC_DAPM_MIXER("Mono Mixer", NAU8810_REG_POWER3, |
5180 |
+ NAU8810_MOUTMX_EN_SFT, 0, &nau8810_mono_mixer_controls[0], |
5181 |
+ ARRAY_SIZE(nau8810_mono_mixer_controls)), |
5182 |
+- SND_SOC_DAPM_DAC("DAC", "HiFi Playback", NAU8810_REG_POWER3, |
5183 |
++ SND_SOC_DAPM_DAC("DAC", "Playback", NAU8810_REG_POWER3, |
5184 |
+ NAU8810_DAC_EN_SFT, 0), |
5185 |
+- SND_SOC_DAPM_ADC("ADC", "HiFi Capture", NAU8810_REG_POWER2, |
5186 |
++ SND_SOC_DAPM_ADC("ADC", "Capture", NAU8810_REG_POWER2, |
5187 |
+ NAU8810_ADC_EN_SFT, 0), |
5188 |
+ SND_SOC_DAPM_PGA("SpkN Out", NAU8810_REG_POWER3, |
5189 |
+ NAU8810_NSPK_EN_SFT, 0, NULL, 0), |
5190 |
+diff --git a/sound/soc/codecs/nau8824.c b/sound/soc/codecs/nau8824.c |
5191 |
+index 468d5143e2c4..663a208c2f78 100644 |
5192 |
+--- a/sound/soc/codecs/nau8824.c |
5193 |
++++ b/sound/soc/codecs/nau8824.c |
5194 |
+@@ -681,8 +681,8 @@ static const struct snd_soc_dapm_widget nau8824_dapm_widgets[] = { |
5195 |
+ SND_SOC_DAPM_ADC("ADCR", NULL, NAU8824_REG_ANALOG_ADC_2, |
5196 |
+ NAU8824_ADCR_EN_SFT, 0), |
5197 |
+ |
5198 |
+- SND_SOC_DAPM_AIF_OUT("AIFTX", "HiFi Capture", 0, SND_SOC_NOPM, 0, 0), |
5199 |
+- SND_SOC_DAPM_AIF_IN("AIFRX", "HiFi Playback", 0, SND_SOC_NOPM, 0, 0), |
5200 |
++ SND_SOC_DAPM_AIF_OUT("AIFTX", "Capture", 0, SND_SOC_NOPM, 0, 0), |
5201 |
++ SND_SOC_DAPM_AIF_IN("AIFRX", "Playback", 0, SND_SOC_NOPM, 0, 0), |
5202 |
+ |
5203 |
+ SND_SOC_DAPM_DAC("DACL", NULL, NAU8824_REG_RDAC, |
5204 |
+ NAU8824_DACL_EN_SFT, 0), |
5205 |
+@@ -831,6 +831,36 @@ static void nau8824_int_status_clear_all(struct regmap *regmap) |
5206 |
+ } |
5207 |
+ } |
5208 |
+ |
5209 |
++static void nau8824_dapm_disable_pin(struct nau8824 *nau8824, const char *pin) |
5210 |
++{ |
5211 |
++ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
5212 |
++ const char *prefix = dapm->component->name_prefix; |
5213 |
++ char prefixed_pin[80]; |
5214 |
++ |
5215 |
++ if (prefix) { |
5216 |
++ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", |
5217 |
++ prefix, pin); |
5218 |
++ snd_soc_dapm_disable_pin(dapm, prefixed_pin); |
5219 |
++ } else { |
5220 |
++ snd_soc_dapm_disable_pin(dapm, pin); |
5221 |
++ } |
5222 |
++} |
5223 |
++ |
5224 |
++static void nau8824_dapm_enable_pin(struct nau8824 *nau8824, const char *pin) |
5225 |
++{ |
5226 |
++ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
5227 |
++ const char *prefix = dapm->component->name_prefix; |
5228 |
++ char prefixed_pin[80]; |
5229 |
++ |
5230 |
++ if (prefix) { |
5231 |
++ snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", |
5232 |
++ prefix, pin); |
5233 |
++ snd_soc_dapm_force_enable_pin(dapm, prefixed_pin); |
5234 |
++ } else { |
5235 |
++ snd_soc_dapm_force_enable_pin(dapm, pin); |
5236 |
++ } |
5237 |
++} |
5238 |
++ |
5239 |
+ static void nau8824_eject_jack(struct nau8824 *nau8824) |
5240 |
+ { |
5241 |
+ struct snd_soc_dapm_context *dapm = nau8824->dapm; |
5242 |
+@@ -839,8 +869,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) |
5243 |
+ /* Clear all interruption status */ |
5244 |
+ nau8824_int_status_clear_all(regmap); |
5245 |
+ |
5246 |
+- snd_soc_dapm_disable_pin(dapm, "SAR"); |
5247 |
+- snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
5248 |
++ nau8824_dapm_disable_pin(nau8824, "SAR"); |
5249 |
++ nau8824_dapm_disable_pin(nau8824, "MICBIAS"); |
5250 |
+ snd_soc_dapm_sync(dapm); |
5251 |
+ |
5252 |
+ /* Enable the insertion interruption, disable the ejection |
5253 |
+@@ -870,8 +900,8 @@ static void nau8824_jdet_work(struct work_struct *work) |
5254 |
+ struct regmap *regmap = nau8824->regmap; |
5255 |
+ int adc_value, event = 0, event_mask = 0; |
5256 |
+ |
5257 |
+- snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); |
5258 |
+- snd_soc_dapm_force_enable_pin(dapm, "SAR"); |
5259 |
++ nau8824_dapm_enable_pin(nau8824, "MICBIAS"); |
5260 |
++ nau8824_dapm_enable_pin(nau8824, "SAR"); |
5261 |
+ snd_soc_dapm_sync(dapm); |
5262 |
+ |
5263 |
+ msleep(100); |
5264 |
+@@ -882,8 +912,8 @@ static void nau8824_jdet_work(struct work_struct *work) |
5265 |
+ if (adc_value < HEADSET_SARADC_THD) { |
5266 |
+ event |= SND_JACK_HEADPHONE; |
5267 |
+ |
5268 |
+- snd_soc_dapm_disable_pin(dapm, "SAR"); |
5269 |
+- snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
5270 |
++ nau8824_dapm_disable_pin(nau8824, "SAR"); |
5271 |
++ nau8824_dapm_disable_pin(nau8824, "MICBIAS"); |
5272 |
+ snd_soc_dapm_sync(dapm); |
5273 |
+ } else { |
5274 |
+ event |= SND_JACK_HEADSET; |
5275 |
+diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
5276 |
+index a9b91bcfcc09..72ef2a0f6387 100644 |
5277 |
+--- a/sound/soc/codecs/rt5682.c |
5278 |
++++ b/sound/soc/codecs/rt5682.c |
5279 |
+@@ -904,13 +904,21 @@ static int rt5682_headset_detect(struct snd_soc_component *component, |
5280 |
+ int jack_insert) |
5281 |
+ { |
5282 |
+ struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); |
5283 |
+- struct snd_soc_dapm_context *dapm = |
5284 |
+- snd_soc_component_get_dapm(component); |
5285 |
+ unsigned int val, count; |
5286 |
+ |
5287 |
+ if (jack_insert) { |
5288 |
+- snd_soc_dapm_force_enable_pin(dapm, "CBJ Power"); |
5289 |
+- snd_soc_dapm_sync(dapm); |
5290 |
++ |
5291 |
++ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, |
5292 |
++ RT5682_PWR_VREF2 | RT5682_PWR_MB, |
5293 |
++ RT5682_PWR_VREF2 | RT5682_PWR_MB); |
5294 |
++ snd_soc_component_update_bits(component, |
5295 |
++ RT5682_PWR_ANLG_1, RT5682_PWR_FV2, 0); |
5296 |
++ usleep_range(15000, 20000); |
5297 |
++ snd_soc_component_update_bits(component, |
5298 |
++ RT5682_PWR_ANLG_1, RT5682_PWR_FV2, RT5682_PWR_FV2); |
5299 |
++ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3, |
5300 |
++ RT5682_PWR_CBJ, RT5682_PWR_CBJ); |
5301 |
++ |
5302 |
+ snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, |
5303 |
+ RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH); |
5304 |
+ |
5305 |
+@@ -938,8 +946,10 @@ static int rt5682_headset_detect(struct snd_soc_component *component, |
5306 |
+ rt5682_enable_push_button_irq(component, false); |
5307 |
+ snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, |
5308 |
+ RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW); |
5309 |
+- snd_soc_dapm_disable_pin(dapm, "CBJ Power"); |
5310 |
+- snd_soc_dapm_sync(dapm); |
5311 |
++ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, |
5312 |
++ RT5682_PWR_VREF2 | RT5682_PWR_MB, 0); |
5313 |
++ snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3, |
5314 |
++ RT5682_PWR_CBJ, 0); |
5315 |
+ |
5316 |
+ rt5682->jack_type = 0; |
5317 |
+ } |
5318 |
+@@ -1192,7 +1202,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, |
5319 |
+ struct snd_soc_component *component = |
5320 |
+ snd_soc_dapm_to_component(w->dapm); |
5321 |
+ struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); |
5322 |
+- int ref, val, reg, sft, mask, idx = -EINVAL; |
5323 |
++ int ref, val, reg, idx = -EINVAL; |
5324 |
+ static const int div_f[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48}; |
5325 |
+ static const int div_o[] = {1, 2, 4, 6, 8, 12, 16, 24, 32, 48}; |
5326 |
+ |
5327 |
+@@ -1206,15 +1216,10 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, |
5328 |
+ |
5329 |
+ idx = rt5682_div_sel(rt5682, ref, div_f, ARRAY_SIZE(div_f)); |
5330 |
+ |
5331 |
+- if (w->shift == RT5682_PWR_ADC_S1F_BIT) { |
5332 |
++ if (w->shift == RT5682_PWR_ADC_S1F_BIT) |
5333 |
+ reg = RT5682_PLL_TRACK_3; |
5334 |
+- sft = RT5682_ADC_OSR_SFT; |
5335 |
+- mask = RT5682_ADC_OSR_MASK; |
5336 |
+- } else { |
5337 |
++ else |
5338 |
+ reg = RT5682_PLL_TRACK_2; |
5339 |
+- sft = RT5682_DAC_OSR_SFT; |
5340 |
+- mask = RT5682_DAC_OSR_MASK; |
5341 |
+- } |
5342 |
+ |
5343 |
+ snd_soc_component_update_bits(component, reg, |
5344 |
+ RT5682_FILTER_CLK_DIV_MASK, idx << RT5682_FILTER_CLK_DIV_SFT); |
5345 |
+@@ -1226,7 +1231,8 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w, |
5346 |
+ } |
5347 |
+ |
5348 |
+ snd_soc_component_update_bits(component, RT5682_ADDA_CLK_1, |
5349 |
+- mask, idx << sft); |
5350 |
++ RT5682_ADC_OSR_MASK | RT5682_DAC_OSR_MASK, |
5351 |
++ (idx << RT5682_ADC_OSR_SFT) | (idx << RT5682_DAC_OSR_SFT)); |
5352 |
+ |
5353 |
+ return 0; |
5354 |
+ } |
5355 |
+@@ -1585,8 +1591,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = { |
5356 |
+ 0, NULL, 0), |
5357 |
+ SND_SOC_DAPM_SUPPLY("Vref1", RT5682_PWR_ANLG_1, RT5682_PWR_VREF1_BIT, 0, |
5358 |
+ rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
5359 |
+- SND_SOC_DAPM_SUPPLY("Vref2", RT5682_PWR_ANLG_1, RT5682_PWR_VREF2_BIT, 0, |
5360 |
+- rt5655_set_verf, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), |
5361 |
+ |
5362 |
+ /* ASRC */ |
5363 |
+ SND_SOC_DAPM_SUPPLY_S("DAC STO1 ASRC", 1, RT5682_PLL_TRACK_1, |
5364 |
+@@ -1621,9 +1625,6 @@ static const struct snd_soc_dapm_widget rt5682_dapm_widgets[] = { |
5365 |
+ SND_SOC_DAPM_PGA("BST1 CBJ", SND_SOC_NOPM, |
5366 |
+ 0, 0, NULL, 0), |
5367 |
+ |
5368 |
+- SND_SOC_DAPM_SUPPLY("CBJ Power", RT5682_PWR_ANLG_3, |
5369 |
+- RT5682_PWR_CBJ_BIT, 0, NULL, 0), |
5370 |
+- |
5371 |
+ /* REC Mixer */ |
5372 |
+ SND_SOC_DAPM_MIXER("RECMIX1L", SND_SOC_NOPM, 0, 0, rt5682_rec1_l_mix, |
5373 |
+ ARRAY_SIZE(rt5682_rec1_l_mix)), |
5374 |
+@@ -1786,17 +1787,13 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = { |
5375 |
+ |
5376 |
+ /*Vref*/ |
5377 |
+ {"MICBIAS1", NULL, "Vref1"}, |
5378 |
+- {"MICBIAS1", NULL, "Vref2"}, |
5379 |
+ {"MICBIAS2", NULL, "Vref1"}, |
5380 |
+- {"MICBIAS2", NULL, "Vref2"}, |
5381 |
+ |
5382 |
+ {"CLKDET SYS", NULL, "CLKDET"}, |
5383 |
+ |
5384 |
+ {"IN1P", NULL, "LDO2"}, |
5385 |
+ |
5386 |
+ {"BST1 CBJ", NULL, "IN1P"}, |
5387 |
+- {"BST1 CBJ", NULL, "CBJ Power"}, |
5388 |
+- {"CBJ Power", NULL, "Vref2"}, |
5389 |
+ |
5390 |
+ {"RECMIX1L", "CBJ Switch", "BST1 CBJ"}, |
5391 |
+ {"RECMIX1L", NULL, "RECMIX1L Power"}, |
5392 |
+@@ -1906,9 +1903,7 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = { |
5393 |
+ {"HP Amp", NULL, "Capless"}, |
5394 |
+ {"HP Amp", NULL, "Charge Pump"}, |
5395 |
+ {"HP Amp", NULL, "CLKDET SYS"}, |
5396 |
+- {"HP Amp", NULL, "CBJ Power"}, |
5397 |
+ {"HP Amp", NULL, "Vref1"}, |
5398 |
+- {"HP Amp", NULL, "Vref2"}, |
5399 |
+ {"HPOL Playback", "Switch", "HP Amp"}, |
5400 |
+ {"HPOR Playback", "Switch", "HP Amp"}, |
5401 |
+ {"HPOL", NULL, "HPOL Playback"}, |
5402 |
+@@ -2297,16 +2292,13 @@ static int rt5682_set_bias_level(struct snd_soc_component *component, |
5403 |
+ switch (level) { |
5404 |
+ case SND_SOC_BIAS_PREPARE: |
5405 |
+ regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, |
5406 |
+- RT5682_PWR_MB | RT5682_PWR_BG, |
5407 |
+- RT5682_PWR_MB | RT5682_PWR_BG); |
5408 |
++ RT5682_PWR_BG, RT5682_PWR_BG); |
5409 |
+ regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, |
5410 |
+ RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO, |
5411 |
+ RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO); |
5412 |
+ break; |
5413 |
+ |
5414 |
+ case SND_SOC_BIAS_STANDBY: |
5415 |
+- regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, |
5416 |
+- RT5682_PWR_MB, RT5682_PWR_MB); |
5417 |
+ regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, |
5418 |
+ RT5682_DIG_GATE_CTRL, RT5682_DIG_GATE_CTRL); |
5419 |
+ break; |
5420 |
+@@ -2314,7 +2306,7 @@ static int rt5682_set_bias_level(struct snd_soc_component *component, |
5421 |
+ regmap_update_bits(rt5682->regmap, RT5682_PWR_DIG_1, |
5422 |
+ RT5682_DIG_GATE_CTRL | RT5682_PWR_LDO, 0); |
5423 |
+ regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, |
5424 |
+- RT5682_PWR_MB | RT5682_PWR_BG, 0); |
5425 |
++ RT5682_PWR_BG, 0); |
5426 |
+ break; |
5427 |
+ |
5428 |
+ default: |
5429 |
+@@ -2357,6 +2349,8 @@ static int rt5682_resume(struct snd_soc_component *component) |
5430 |
+ regcache_cache_only(rt5682->regmap, false); |
5431 |
+ regcache_sync(rt5682->regmap); |
5432 |
+ |
5433 |
++ rt5682_irq(0, rt5682); |
5434 |
++ |
5435 |
+ return 0; |
5436 |
+ } |
5437 |
+ #else |
5438 |
+diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c |
5439 |
+index f03195d2ab2e..45d9f4a09044 100644 |
5440 |
+--- a/sound/soc/codecs/tlv320aic32x4.c |
5441 |
++++ b/sound/soc/codecs/tlv320aic32x4.c |
5442 |
+@@ -462,6 +462,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = { |
5443 |
+ SND_SOC_DAPM_INPUT("IN2_R"), |
5444 |
+ SND_SOC_DAPM_INPUT("IN3_L"), |
5445 |
+ SND_SOC_DAPM_INPUT("IN3_R"), |
5446 |
++ SND_SOC_DAPM_INPUT("CM_L"), |
5447 |
++ SND_SOC_DAPM_INPUT("CM_R"), |
5448 |
+ }; |
5449 |
+ |
5450 |
+ static const struct snd_soc_dapm_route aic32x4_dapm_routes[] = { |
5451 |
+diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c |
5452 |
+index 6aa0edf8c5ef..cea3ebecdb12 100644 |
5453 |
+--- a/sound/soc/codecs/tlv320aic3x.c |
5454 |
++++ b/sound/soc/codecs/tlv320aic3x.c |
5455 |
+@@ -1609,7 +1609,6 @@ static int aic3x_probe(struct snd_soc_component *component) |
5456 |
+ struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); |
5457 |
+ int ret, i; |
5458 |
+ |
5459 |
+- INIT_LIST_HEAD(&aic3x->list); |
5460 |
+ aic3x->component = component; |
5461 |
+ |
5462 |
+ for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) { |
5463 |
+@@ -1692,7 +1691,6 @@ static void aic3x_remove(struct snd_soc_component *component) |
5464 |
+ struct aic3x_priv *aic3x = snd_soc_component_get_drvdata(component); |
5465 |
+ int i; |
5466 |
+ |
5467 |
+- list_del(&aic3x->list); |
5468 |
+ for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) |
5469 |
+ regulator_unregister_notifier(aic3x->supplies[i].consumer, |
5470 |
+ &aic3x->disable_nb[i].nb); |
5471 |
+@@ -1890,6 +1888,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, |
5472 |
+ if (ret != 0) |
5473 |
+ goto err_gpio; |
5474 |
+ |
5475 |
++ INIT_LIST_HEAD(&aic3x->list); |
5476 |
+ list_add(&aic3x->list, &reset_list); |
5477 |
+ |
5478 |
+ return 0; |
5479 |
+@@ -1906,6 +1905,8 @@ static int aic3x_i2c_remove(struct i2c_client *client) |
5480 |
+ { |
5481 |
+ struct aic3x_priv *aic3x = i2c_get_clientdata(client); |
5482 |
+ |
5483 |
++ list_del(&aic3x->list); |
5484 |
++ |
5485 |
+ if (gpio_is_valid(aic3x->gpio_reset) && |
5486 |
+ !aic3x_is_shared_reset(aic3x)) { |
5487 |
+ gpio_set_value(aic3x->gpio_reset, 0); |
5488 |
+diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c |
5489 |
+index 0600e4404f90..eb5b1be77c47 100644 |
5490 |
+--- a/sound/soc/codecs/wm_adsp.c |
5491 |
++++ b/sound/soc/codecs/wm_adsp.c |
5492 |
+@@ -3821,11 +3821,13 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
5493 |
+ struct regmap *regmap = dsp->regmap; |
5494 |
+ int ret = 0; |
5495 |
+ |
5496 |
++ mutex_lock(&dsp->pwr_lock); |
5497 |
++ |
5498 |
+ ret = regmap_read(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, &val); |
5499 |
+ if (ret) { |
5500 |
+ adsp_err(dsp, |
5501 |
+ "Failed to read Region Lock Ctrl register: %d\n", ret); |
5502 |
+- return IRQ_HANDLED; |
5503 |
++ goto error; |
5504 |
+ } |
5505 |
+ |
5506 |
+ if (val & ADSP2_WDT_TIMEOUT_STS_MASK) { |
5507 |
+@@ -3844,7 +3846,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
5508 |
+ adsp_err(dsp, |
5509 |
+ "Failed to read Bus Err Addr register: %d\n", |
5510 |
+ ret); |
5511 |
+- return IRQ_HANDLED; |
5512 |
++ goto error; |
5513 |
+ } |
5514 |
+ |
5515 |
+ adsp_err(dsp, "bus error address = 0x%x\n", |
5516 |
+@@ -3857,7 +3859,7 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
5517 |
+ adsp_err(dsp, |
5518 |
+ "Failed to read Pmem Xmem Err Addr register: %d\n", |
5519 |
+ ret); |
5520 |
+- return IRQ_HANDLED; |
5521 |
++ goto error; |
5522 |
+ } |
5523 |
+ |
5524 |
+ adsp_err(dsp, "xmem error address = 0x%x\n", |
5525 |
+@@ -3870,6 +3872,9 @@ irqreturn_t wm_adsp2_bus_error(struct wm_adsp *dsp) |
5526 |
+ regmap_update_bits(regmap, dsp->base + ADSP2_LOCK_REGION_CTRL, |
5527 |
+ ADSP2_CTRL_ERR_EINT, ADSP2_CTRL_ERR_EINT); |
5528 |
+ |
5529 |
++error: |
5530 |
++ mutex_unlock(&dsp->pwr_lock); |
5531 |
++ |
5532 |
+ return IRQ_HANDLED; |
5533 |
+ } |
5534 |
+ EXPORT_SYMBOL_GPL(wm_adsp2_bus_error); |
5535 |
+diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
5536 |
+index 7044d8c2b187..879f14257a3e 100644 |
5537 |
+--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
5538 |
++++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c |
5539 |
+@@ -405,7 +405,7 @@ static const struct snd_pcm_hw_constraint_list constraints_dmic_channels = { |
5540 |
+ }; |
5541 |
+ |
5542 |
+ static const unsigned int dmic_2ch[] = { |
5543 |
+- 4, |
5544 |
++ 2, |
5545 |
+ }; |
5546 |
+ |
5547 |
+ static const struct snd_pcm_hw_constraint_list constraints_dmic_2ch = { |
5548 |
+diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c |
5549 |
+index 1e067504b604..f830e59f93ea 100644 |
5550 |
+--- a/sound/soc/intel/common/sst-firmware.c |
5551 |
++++ b/sound/soc/intel/common/sst-firmware.c |
5552 |
+@@ -1251,11 +1251,15 @@ struct sst_dsp *sst_dsp_new(struct device *dev, |
5553 |
+ goto irq_err; |
5554 |
+ |
5555 |
+ err = sst_dma_new(sst); |
5556 |
+- if (err) |
5557 |
+- dev_warn(dev, "sst_dma_new failed %d\n", err); |
5558 |
++ if (err) { |
5559 |
++ dev_err(dev, "sst_dma_new failed %d\n", err); |
5560 |
++ goto dma_err; |
5561 |
++ } |
5562 |
+ |
5563 |
+ return sst; |
5564 |
+ |
5565 |
++dma_err: |
5566 |
++ free_irq(sst->irq, sst); |
5567 |
+ irq_err: |
5568 |
+ if (sst->ops->free) |
5569 |
+ sst->ops->free(sst); |
5570 |
+diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c |
5571 |
+index 557f80c0bfe5..5cd308d622f6 100644 |
5572 |
+--- a/sound/soc/intel/skylake/skl-pcm.c |
5573 |
++++ b/sound/soc/intel/skylake/skl-pcm.c |
5574 |
+@@ -181,6 +181,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) |
5575 |
+ struct hdac_stream *hstream; |
5576 |
+ struct hdac_ext_stream *stream; |
5577 |
+ struct hdac_ext_link *link; |
5578 |
++ unsigned char stream_tag; |
5579 |
+ |
5580 |
+ hstream = snd_hdac_get_stream(bus, params->stream, |
5581 |
+ params->link_dma_id + 1); |
5582 |
+@@ -199,10 +200,13 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params) |
5583 |
+ |
5584 |
+ snd_hdac_ext_link_stream_setup(stream, format_val); |
5585 |
+ |
5586 |
+- list_for_each_entry(link, &bus->hlink_list, list) { |
5587 |
+- if (link->index == params->link_index) |
5588 |
+- snd_hdac_ext_link_set_stream_id(link, |
5589 |
+- hstream->stream_tag); |
5590 |
++ stream_tag = hstream->stream_tag; |
5591 |
++ if (stream->hstream.direction == SNDRV_PCM_STREAM_PLAYBACK) { |
5592 |
++ list_for_each_entry(link, &bus->hlink_list, list) { |
5593 |
++ if (link->index == params->link_index) |
5594 |
++ snd_hdac_ext_link_set_stream_id(link, |
5595 |
++ stream_tag); |
5596 |
++ } |
5597 |
+ } |
5598 |
+ |
5599 |
+ stream->link_prepared = 1; |
5600 |
+@@ -645,6 +649,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, |
5601 |
+ struct hdac_ext_stream *link_dev = |
5602 |
+ snd_soc_dai_get_dma_data(dai, substream); |
5603 |
+ struct hdac_ext_link *link; |
5604 |
++ unsigned char stream_tag; |
5605 |
+ |
5606 |
+ dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name); |
5607 |
+ |
5608 |
+@@ -654,7 +659,11 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, |
5609 |
+ if (!link) |
5610 |
+ return -EINVAL; |
5611 |
+ |
5612 |
+- snd_hdac_ext_link_clear_stream_id(link, hdac_stream(link_dev)->stream_tag); |
5613 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
5614 |
++ stream_tag = hdac_stream(link_dev)->stream_tag; |
5615 |
++ snd_hdac_ext_link_clear_stream_id(link, stream_tag); |
5616 |
++ } |
5617 |
++ |
5618 |
+ snd_hdac_ext_stream_release(link_dev, HDAC_EXT_STREAM_TYPE_LINK); |
5619 |
+ return 0; |
5620 |
+ } |
5621 |
+diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c |
5622 |
+index 400e29edb1c9..8a2e3bbce3a1 100644 |
5623 |
+--- a/sound/soc/rockchip/rockchip_pdm.c |
5624 |
++++ b/sound/soc/rockchip/rockchip_pdm.c |
5625 |
+@@ -208,7 +208,9 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, |
5626 |
+ return -EINVAL; |
5627 |
+ } |
5628 |
+ |
5629 |
++ pm_runtime_get_sync(cpu_dai->dev); |
5630 |
+ regmap_update_bits(pdm->regmap, PDM_CLK_CTRL, mask, val); |
5631 |
++ pm_runtime_put(cpu_dai->dev); |
5632 |
+ |
5633 |
+ return 0; |
5634 |
+ } |
5635 |
+diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c |
5636 |
+index e7b371b07230..45c6d7396785 100644 |
5637 |
+--- a/sound/soc/samsung/odroid.c |
5638 |
++++ b/sound/soc/samsung/odroid.c |
5639 |
+@@ -64,11 +64,11 @@ static int odroid_card_hw_params(struct snd_pcm_substream *substream, |
5640 |
+ return ret; |
5641 |
+ |
5642 |
+ /* |
5643 |
+- * We add 1 to the rclk_freq value in order to avoid too low clock |
5644 |
++ * We add 2 to the rclk_freq value in order to avoid too low clock |
5645 |
+ * frequency values due to the EPLL output frequency not being exact |
5646 |
+ * multiple of the audio sampling rate. |
5647 |
+ */ |
5648 |
+- rclk_freq = params_rate(params) * rfs + 1; |
5649 |
++ rclk_freq = params_rate(params) * rfs + 2; |
5650 |
+ |
5651 |
+ ret = clk_set_rate(priv->sclk_i2s, rclk_freq); |
5652 |
+ if (ret < 0) |
5653 |
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c |
5654 |
+index 50617db05c46..416c371fa01a 100644 |
5655 |
+--- a/sound/soc/soc-core.c |
5656 |
++++ b/sound/soc/soc-core.c |
5657 |
+@@ -2790,6 +2790,7 @@ int snd_soc_register_card(struct snd_soc_card *card) |
5658 |
+ card->instantiated = 0; |
5659 |
+ mutex_init(&card->mutex); |
5660 |
+ mutex_init(&card->dapm_mutex); |
5661 |
++ spin_lock_init(&card->dpcm_lock); |
5662 |
+ |
5663 |
+ return snd_soc_bind_card(card); |
5664 |
+ } |
5665 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
5666 |
+index 20bad755888b..08ab5fef75dc 100644 |
5667 |
+--- a/sound/soc/soc-dapm.c |
5668 |
++++ b/sound/soc/soc-dapm.c |
5669 |
+@@ -3840,6 +3840,10 @@ snd_soc_dapm_free_kcontrol(struct snd_soc_card *card, |
5670 |
+ int count; |
5671 |
+ |
5672 |
+ devm_kfree(card->dev, (void *)*private_value); |
5673 |
++ |
5674 |
++ if (!w_param_text) |
5675 |
++ return; |
5676 |
++ |
5677 |
+ for (count = 0 ; count < num_params; count++) |
5678 |
+ devm_kfree(card->dev, (void *)w_param_text[count]); |
5679 |
+ devm_kfree(card->dev, w_param_text); |
5680 |
+diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c |
5681 |
+index 0c1dd6bd67ab..22946493a11f 100644 |
5682 |
+--- a/sound/soc/soc-pcm.c |
5683 |
++++ b/sound/soc/soc-pcm.c |
5684 |
+@@ -954,10 +954,13 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, |
5685 |
+ codec_params = *params; |
5686 |
+ |
5687 |
+ /* fixup params based on TDM slot masks */ |
5688 |
+- if (codec_dai->tx_mask) |
5689 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && |
5690 |
++ codec_dai->tx_mask) |
5691 |
+ soc_pcm_codec_params_fixup(&codec_params, |
5692 |
+ codec_dai->tx_mask); |
5693 |
+- if (codec_dai->rx_mask) |
5694 |
++ |
5695 |
++ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && |
5696 |
++ codec_dai->rx_mask) |
5697 |
+ soc_pcm_codec_params_fixup(&codec_params, |
5698 |
+ codec_dai->rx_mask); |
5699 |
+ |
5700 |
+@@ -1209,6 +1212,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, |
5701 |
+ struct snd_soc_pcm_runtime *be, int stream) |
5702 |
+ { |
5703 |
+ struct snd_soc_dpcm *dpcm; |
5704 |
++ unsigned long flags; |
5705 |
+ |
5706 |
+ /* only add new dpcms */ |
5707 |
+ for_each_dpcm_be(fe, stream, dpcm) { |
5708 |
+@@ -1224,8 +1228,10 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, |
5709 |
+ dpcm->fe = fe; |
5710 |
+ be->dpcm[stream].runtime = fe->dpcm[stream].runtime; |
5711 |
+ dpcm->state = SND_SOC_DPCM_LINK_STATE_NEW; |
5712 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5713 |
+ list_add(&dpcm->list_be, &fe->dpcm[stream].be_clients); |
5714 |
+ list_add(&dpcm->list_fe, &be->dpcm[stream].fe_clients); |
5715 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5716 |
+ |
5717 |
+ dev_dbg(fe->dev, "connected new DPCM %s path %s %s %s\n", |
5718 |
+ stream ? "capture" : "playback", fe->dai_link->name, |
5719 |
+@@ -1271,6 +1277,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, |
5720 |
+ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) |
5721 |
+ { |
5722 |
+ struct snd_soc_dpcm *dpcm, *d; |
5723 |
++ unsigned long flags; |
5724 |
+ |
5725 |
+ for_each_dpcm_be_safe(fe, stream, dpcm, d) { |
5726 |
+ dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n", |
5727 |
+@@ -1290,8 +1297,10 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) |
5728 |
+ #ifdef CONFIG_DEBUG_FS |
5729 |
+ debugfs_remove(dpcm->debugfs_state); |
5730 |
+ #endif |
5731 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5732 |
+ list_del(&dpcm->list_be); |
5733 |
+ list_del(&dpcm->list_fe); |
5734 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5735 |
+ kfree(dpcm); |
5736 |
+ } |
5737 |
+ } |
5738 |
+@@ -1543,10 +1552,13 @@ int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, |
5739 |
+ void dpcm_clear_pending_state(struct snd_soc_pcm_runtime *fe, int stream) |
5740 |
+ { |
5741 |
+ struct snd_soc_dpcm *dpcm; |
5742 |
++ unsigned long flags; |
5743 |
+ |
5744 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5745 |
+ for_each_dpcm_be(fe, stream, dpcm) |
5746 |
+ dpcm->be->dpcm[stream].runtime_update = |
5747 |
+ SND_SOC_DPCM_UPDATE_NO; |
5748 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5749 |
+ } |
5750 |
+ |
5751 |
+ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe, |
5752 |
+@@ -2572,6 +2584,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) |
5753 |
+ struct snd_soc_dpcm *dpcm; |
5754 |
+ enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; |
5755 |
+ int ret; |
5756 |
++ unsigned long flags; |
5757 |
+ |
5758 |
+ dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n", |
5759 |
+ stream ? "capture" : "playback", fe->dai_link->name); |
5760 |
+@@ -2641,11 +2654,13 @@ close: |
5761 |
+ dpcm_be_dai_shutdown(fe, stream); |
5762 |
+ disconnect: |
5763 |
+ /* disconnect any non started BEs */ |
5764 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5765 |
+ for_each_dpcm_be(fe, stream, dpcm) { |
5766 |
+ struct snd_soc_pcm_runtime *be = dpcm->be; |
5767 |
+ if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) |
5768 |
+ dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; |
5769 |
+ } |
5770 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5771 |
+ |
5772 |
+ return ret; |
5773 |
+ } |
5774 |
+@@ -3221,7 +3236,10 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, |
5775 |
+ { |
5776 |
+ struct snd_soc_dpcm *dpcm; |
5777 |
+ int state; |
5778 |
++ int ret = 1; |
5779 |
++ unsigned long flags; |
5780 |
+ |
5781 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5782 |
+ for_each_dpcm_fe(be, stream, dpcm) { |
5783 |
+ |
5784 |
+ if (dpcm->fe == fe) |
5785 |
+@@ -3230,12 +3248,15 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe, |
5786 |
+ state = dpcm->fe->dpcm[stream].state; |
5787 |
+ if (state == SND_SOC_DPCM_STATE_START || |
5788 |
+ state == SND_SOC_DPCM_STATE_PAUSED || |
5789 |
+- state == SND_SOC_DPCM_STATE_SUSPEND) |
5790 |
+- return 0; |
5791 |
++ state == SND_SOC_DPCM_STATE_SUSPEND) { |
5792 |
++ ret = 0; |
5793 |
++ break; |
5794 |
++ } |
5795 |
+ } |
5796 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5797 |
+ |
5798 |
+ /* it's safe to free/stop this BE DAI */ |
5799 |
+- return 1; |
5800 |
++ return ret; |
5801 |
+ } |
5802 |
+ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_free_stop); |
5803 |
+ |
5804 |
+@@ -3248,7 +3269,10 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, |
5805 |
+ { |
5806 |
+ struct snd_soc_dpcm *dpcm; |
5807 |
+ int state; |
5808 |
++ int ret = 1; |
5809 |
++ unsigned long flags; |
5810 |
+ |
5811 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5812 |
+ for_each_dpcm_fe(be, stream, dpcm) { |
5813 |
+ |
5814 |
+ if (dpcm->fe == fe) |
5815 |
+@@ -3258,12 +3282,15 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe, |
5816 |
+ if (state == SND_SOC_DPCM_STATE_START || |
5817 |
+ state == SND_SOC_DPCM_STATE_PAUSED || |
5818 |
+ state == SND_SOC_DPCM_STATE_SUSPEND || |
5819 |
+- state == SND_SOC_DPCM_STATE_PREPARE) |
5820 |
+- return 0; |
5821 |
++ state == SND_SOC_DPCM_STATE_PREPARE) { |
5822 |
++ ret = 0; |
5823 |
++ break; |
5824 |
++ } |
5825 |
+ } |
5826 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5827 |
+ |
5828 |
+ /* it's safe to change hw_params */ |
5829 |
+- return 1; |
5830 |
++ return ret; |
5831 |
+ } |
5832 |
+ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); |
5833 |
+ |
5834 |
+@@ -3302,6 +3329,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
5835 |
+ struct snd_pcm_hw_params *params = &fe->dpcm[stream].hw_params; |
5836 |
+ struct snd_soc_dpcm *dpcm; |
5837 |
+ ssize_t offset = 0; |
5838 |
++ unsigned long flags; |
5839 |
+ |
5840 |
+ /* FE state */ |
5841 |
+ offset += snprintf(buf + offset, size - offset, |
5842 |
+@@ -3329,6 +3357,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
5843 |
+ goto out; |
5844 |
+ } |
5845 |
+ |
5846 |
++ spin_lock_irqsave(&fe->card->dpcm_lock, flags); |
5847 |
+ for_each_dpcm_be(fe, stream, dpcm) { |
5848 |
+ struct snd_soc_pcm_runtime *be = dpcm->be; |
5849 |
+ params = &dpcm->hw_params; |
5850 |
+@@ -3349,7 +3378,7 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe, |
5851 |
+ params_channels(params), |
5852 |
+ params_rate(params)); |
5853 |
+ } |
5854 |
+- |
5855 |
++ spin_unlock_irqrestore(&fe->card->dpcm_lock, flags); |
5856 |
+ out: |
5857 |
+ return offset; |
5858 |
+ } |
5859 |
+diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c |
5860 |
+index 706ff005234f..24948b95eb19 100644 |
5861 |
+--- a/sound/soc/stm/stm32_adfsdm.c |
5862 |
++++ b/sound/soc/stm/stm32_adfsdm.c |
5863 |
+@@ -9,6 +9,7 @@ |
5864 |
+ |
5865 |
+ #include <linux/clk.h> |
5866 |
+ #include <linux/module.h> |
5867 |
++#include <linux/mutex.h> |
5868 |
+ #include <linux/platform_device.h> |
5869 |
+ #include <linux/slab.h> |
5870 |
+ |
5871 |
+@@ -37,6 +38,8 @@ struct stm32_adfsdm_priv { |
5872 |
+ /* PCM buffer */ |
5873 |
+ unsigned char *pcm_buff; |
5874 |
+ unsigned int pos; |
5875 |
++ |
5876 |
++ struct mutex lock; /* protect against race condition on iio state */ |
5877 |
+ }; |
5878 |
+ |
5879 |
+ static const struct snd_pcm_hardware stm32_adfsdm_pcm_hw = { |
5880 |
+@@ -62,10 +65,12 @@ static void stm32_adfsdm_shutdown(struct snd_pcm_substream *substream, |
5881 |
+ { |
5882 |
+ struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai); |
5883 |
+ |
5884 |
++ mutex_lock(&priv->lock); |
5885 |
+ if (priv->iio_active) { |
5886 |
+ iio_channel_stop_all_cb(priv->iio_cb); |
5887 |
+ priv->iio_active = false; |
5888 |
+ } |
5889 |
++ mutex_unlock(&priv->lock); |
5890 |
+ } |
5891 |
+ |
5892 |
+ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, |
5893 |
+@@ -74,13 +79,19 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, |
5894 |
+ struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(dai); |
5895 |
+ int ret; |
5896 |
+ |
5897 |
++ mutex_lock(&priv->lock); |
5898 |
++ if (priv->iio_active) { |
5899 |
++ iio_channel_stop_all_cb(priv->iio_cb); |
5900 |
++ priv->iio_active = false; |
5901 |
++ } |
5902 |
++ |
5903 |
+ ret = iio_write_channel_attribute(priv->iio_ch, |
5904 |
+ substream->runtime->rate, 0, |
5905 |
+ IIO_CHAN_INFO_SAMP_FREQ); |
5906 |
+ if (ret < 0) { |
5907 |
+ dev_err(dai->dev, "%s: Failed to set %d sampling rate\n", |
5908 |
+ __func__, substream->runtime->rate); |
5909 |
+- return ret; |
5910 |
++ goto out; |
5911 |
+ } |
5912 |
+ |
5913 |
+ if (!priv->iio_active) { |
5914 |
+@@ -92,6 +103,9 @@ static int stm32_adfsdm_dai_prepare(struct snd_pcm_substream *substream, |
5915 |
+ __func__, ret); |
5916 |
+ } |
5917 |
+ |
5918 |
++out: |
5919 |
++ mutex_unlock(&priv->lock); |
5920 |
++ |
5921 |
+ return ret; |
5922 |
+ } |
5923 |
+ |
5924 |
+@@ -290,6 +304,7 @@ MODULE_DEVICE_TABLE(of, stm32_adfsdm_of_match); |
5925 |
+ static int stm32_adfsdm_probe(struct platform_device *pdev) |
5926 |
+ { |
5927 |
+ struct stm32_adfsdm_priv *priv; |
5928 |
++ struct snd_soc_component *component; |
5929 |
+ int ret; |
5930 |
+ |
5931 |
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
5932 |
+@@ -298,6 +313,7 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) |
5933 |
+ |
5934 |
+ priv->dev = &pdev->dev; |
5935 |
+ priv->dai_drv = stm32_adfsdm_dai; |
5936 |
++ mutex_init(&priv->lock); |
5937 |
+ |
5938 |
+ dev_set_drvdata(&pdev->dev, priv); |
5939 |
+ |
5940 |
+@@ -316,9 +332,15 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) |
5941 |
+ if (IS_ERR(priv->iio_cb)) |
5942 |
+ return PTR_ERR(priv->iio_cb); |
5943 |
+ |
5944 |
+- ret = devm_snd_soc_register_component(&pdev->dev, |
5945 |
+- &stm32_adfsdm_soc_platform, |
5946 |
+- NULL, 0); |
5947 |
++ component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL); |
5948 |
++ if (!component) |
5949 |
++ return -ENOMEM; |
5950 |
++#ifdef CONFIG_DEBUG_FS |
5951 |
++ component->debugfs_prefix = "pcm"; |
5952 |
++#endif |
5953 |
++ |
5954 |
++ ret = snd_soc_add_component(&pdev->dev, component, |
5955 |
++ &stm32_adfsdm_soc_platform, NULL, 0); |
5956 |
+ if (ret < 0) |
5957 |
+ dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", |
5958 |
+ __func__); |
5959 |
+@@ -326,12 +348,20 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) |
5960 |
+ return ret; |
5961 |
+ } |
5962 |
+ |
5963 |
++static int stm32_adfsdm_remove(struct platform_device *pdev) |
5964 |
++{ |
5965 |
++ snd_soc_unregister_component(&pdev->dev); |
5966 |
++ |
5967 |
++ return 0; |
5968 |
++} |
5969 |
++ |
5970 |
+ static struct platform_driver stm32_adfsdm_driver = { |
5971 |
+ .driver = { |
5972 |
+ .name = STM32_ADFSDM_DRV_NAME, |
5973 |
+ .of_match_table = stm32_adfsdm_of_match, |
5974 |
+ }, |
5975 |
+ .probe = stm32_adfsdm_probe, |
5976 |
++ .remove = stm32_adfsdm_remove, |
5977 |
+ }; |
5978 |
+ |
5979 |
+ module_platform_driver(stm32_adfsdm_driver); |
5980 |
+diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c |
5981 |
+index 29a131e0569e..1cf9df4b6f11 100644 |
5982 |
+--- a/sound/soc/stm/stm32_sai_sub.c |
5983 |
++++ b/sound/soc/stm/stm32_sai_sub.c |
5984 |
+@@ -70,6 +70,7 @@ |
5985 |
+ #define SAI_IEC60958_STATUS_BYTES 24 |
5986 |
+ |
5987 |
+ #define SAI_MCLK_NAME_LEN 32 |
5988 |
++#define SAI_RATE_11K 11025 |
5989 |
+ |
5990 |
+ /** |
5991 |
+ * struct stm32_sai_sub_data - private data of SAI sub block (block A or B) |
5992 |
+@@ -100,8 +101,9 @@ |
5993 |
+ * @slot_mask: rx or tx active slots mask. set at init or at runtime |
5994 |
+ * @data_size: PCM data width. corresponds to PCM substream width. |
5995 |
+ * @spdif_frm_cnt: S/PDIF playback frame counter |
5996 |
+- * @snd_aes_iec958: iec958 data |
5997 |
++ * @iec958: iec958 data |
5998 |
+ * @ctrl_lock: control lock |
5999 |
++ * @irq_lock: prevent race condition with IRQ |
6000 |
+ */ |
6001 |
+ struct stm32_sai_sub_data { |
6002 |
+ struct platform_device *pdev; |
6003 |
+@@ -133,6 +135,7 @@ struct stm32_sai_sub_data { |
6004 |
+ unsigned int spdif_frm_cnt; |
6005 |
+ struct snd_aes_iec958 iec958; |
6006 |
+ struct mutex ctrl_lock; /* protect resources accessed by controls */ |
6007 |
++ spinlock_t irq_lock; /* used to prevent race condition with IRQ */ |
6008 |
+ }; |
6009 |
+ |
6010 |
+ enum stm32_sai_fifo_th { |
6011 |
+@@ -307,6 +310,25 @@ static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai, |
6012 |
+ return ret; |
6013 |
+ } |
6014 |
+ |
6015 |
++static int stm32_sai_set_parent_clock(struct stm32_sai_sub_data *sai, |
6016 |
++ unsigned int rate) |
6017 |
++{ |
6018 |
++ struct platform_device *pdev = sai->pdev; |
6019 |
++ struct clk *parent_clk = sai->pdata->clk_x8k; |
6020 |
++ int ret; |
6021 |
++ |
6022 |
++ if (!(rate % SAI_RATE_11K)) |
6023 |
++ parent_clk = sai->pdata->clk_x11k; |
6024 |
++ |
6025 |
++ ret = clk_set_parent(sai->sai_ck, parent_clk); |
6026 |
++ if (ret) |
6027 |
++ dev_err(&pdev->dev, " Error %d setting sai_ck parent clock. %s", |
6028 |
++ ret, ret == -EBUSY ? |
6029 |
++ "Active stream rates conflict\n" : "\n"); |
6030 |
++ |
6031 |
++ return ret; |
6032 |
++} |
6033 |
++ |
6034 |
+ static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate, |
6035 |
+ unsigned long *prate) |
6036 |
+ { |
6037 |
+@@ -474,8 +496,10 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid) |
6038 |
+ status = SNDRV_PCM_STATE_XRUN; |
6039 |
+ } |
6040 |
+ |
6041 |
+- if (status != SNDRV_PCM_STATE_RUNNING) |
6042 |
++ spin_lock(&sai->irq_lock); |
6043 |
++ if (status != SNDRV_PCM_STATE_RUNNING && sai->substream) |
6044 |
+ snd_pcm_stop_xrun(sai->substream); |
6045 |
++ spin_unlock(&sai->irq_lock); |
6046 |
+ |
6047 |
+ return IRQ_HANDLED; |
6048 |
+ } |
6049 |
+@@ -486,25 +510,29 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai, |
6050 |
+ struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); |
6051 |
+ int ret; |
6052 |
+ |
6053 |
+- if (dir == SND_SOC_CLOCK_OUT) { |
6054 |
++ if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) { |
6055 |
+ ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, |
6056 |
+ SAI_XCR1_NODIV, |
6057 |
+ (unsigned int)~SAI_XCR1_NODIV); |
6058 |
+ if (ret < 0) |
6059 |
+ return ret; |
6060 |
+ |
6061 |
+- dev_dbg(cpu_dai->dev, "SAI MCLK frequency is %uHz\n", freq); |
6062 |
+- sai->mclk_rate = freq; |
6063 |
++ /* If master clock is used, set parent clock now */ |
6064 |
++ ret = stm32_sai_set_parent_clock(sai, freq); |
6065 |
++ if (ret) |
6066 |
++ return ret; |
6067 |
+ |
6068 |
+- if (sai->sai_mclk) { |
6069 |
+- ret = clk_set_rate_exclusive(sai->sai_mclk, |
6070 |
+- sai->mclk_rate); |
6071 |
+- if (ret) { |
6072 |
+- dev_err(cpu_dai->dev, |
6073 |
+- "Could not set mclk rate\n"); |
6074 |
+- return ret; |
6075 |
+- } |
6076 |
++ ret = clk_set_rate_exclusive(sai->sai_mclk, freq); |
6077 |
++ if (ret) { |
6078 |
++ dev_err(cpu_dai->dev, |
6079 |
++ ret == -EBUSY ? |
6080 |
++ "Active streams have incompatible rates" : |
6081 |
++ "Could not set mclk rate\n"); |
6082 |
++ return ret; |
6083 |
+ } |
6084 |
++ |
6085 |
++ dev_dbg(cpu_dai->dev, "SAI MCLK frequency is %uHz\n", freq); |
6086 |
++ sai->mclk_rate = freq; |
6087 |
+ } |
6088 |
+ |
6089 |
+ return 0; |
6090 |
+@@ -679,8 +707,19 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream, |
6091 |
+ { |
6092 |
+ struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); |
6093 |
+ int imr, cr2, ret; |
6094 |
++ unsigned long flags; |
6095 |
+ |
6096 |
++ spin_lock_irqsave(&sai->irq_lock, flags); |
6097 |
+ sai->substream = substream; |
6098 |
++ spin_unlock_irqrestore(&sai->irq_lock, flags); |
6099 |
++ |
6100 |
++ if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) { |
6101 |
++ snd_pcm_hw_constraint_mask64(substream->runtime, |
6102 |
++ SNDRV_PCM_HW_PARAM_FORMAT, |
6103 |
++ SNDRV_PCM_FMTBIT_S32_LE); |
6104 |
++ snd_pcm_hw_constraint_single(substream->runtime, |
6105 |
++ SNDRV_PCM_HW_PARAM_CHANNELS, 2); |
6106 |
++ } |
6107 |
+ |
6108 |
+ ret = clk_prepare_enable(sai->sai_ck); |
6109 |
+ if (ret < 0) { |
6110 |
+@@ -901,11 +940,13 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai, |
6111 |
+ int cr1, mask, div = 0; |
6112 |
+ int sai_clk_rate, mclk_ratio, den; |
6113 |
+ unsigned int rate = params_rate(params); |
6114 |
++ int ret; |
6115 |
+ |
6116 |
+- if (!(rate % 11025)) |
6117 |
+- clk_set_parent(sai->sai_ck, sai->pdata->clk_x11k); |
6118 |
+- else |
6119 |
+- clk_set_parent(sai->sai_ck, sai->pdata->clk_x8k); |
6120 |
++ if (!sai->sai_mclk) { |
6121 |
++ ret = stm32_sai_set_parent_clock(sai, rate); |
6122 |
++ if (ret) |
6123 |
++ return ret; |
6124 |
++ } |
6125 |
+ sai_clk_rate = clk_get_rate(sai->sai_ck); |
6126 |
+ |
6127 |
+ if (STM_SAI_IS_F4(sai->pdata)) { |
6128 |
+@@ -1053,28 +1094,36 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, |
6129 |
+ struct snd_soc_dai *cpu_dai) |
6130 |
+ { |
6131 |
+ struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); |
6132 |
++ unsigned long flags; |
6133 |
+ |
6134 |
+ regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); |
6135 |
+ |
6136 |
+ regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV, |
6137 |
+ SAI_XCR1_NODIV); |
6138 |
+ |
6139 |
+- clk_disable_unprepare(sai->sai_ck); |
6140 |
++ /* Release mclk rate only if rate was actually set */ |
6141 |
++ if (sai->mclk_rate) { |
6142 |
++ clk_rate_exclusive_put(sai->sai_mclk); |
6143 |
++ sai->mclk_rate = 0; |
6144 |
++ } |
6145 |
+ |
6146 |
+- clk_rate_exclusive_put(sai->sai_mclk); |
6147 |
++ clk_disable_unprepare(sai->sai_ck); |
6148 |
+ |
6149 |
++ spin_lock_irqsave(&sai->irq_lock, flags); |
6150 |
+ sai->substream = NULL; |
6151 |
++ spin_unlock_irqrestore(&sai->irq_lock, flags); |
6152 |
+ } |
6153 |
+ |
6154 |
+ static int stm32_sai_pcm_new(struct snd_soc_pcm_runtime *rtd, |
6155 |
+ struct snd_soc_dai *cpu_dai) |
6156 |
+ { |
6157 |
+ struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); |
6158 |
++ struct snd_kcontrol_new knew = iec958_ctls; |
6159 |
+ |
6160 |
+ if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) { |
6161 |
+ dev_dbg(&sai->pdev->dev, "%s: register iec controls", __func__); |
6162 |
+- return snd_ctl_add(rtd->pcm->card, |
6163 |
+- snd_ctl_new1(&iec958_ctls, sai)); |
6164 |
++ knew.device = rtd->pcm->device; |
6165 |
++ return snd_ctl_add(rtd->pcm->card, snd_ctl_new1(&knew, sai)); |
6166 |
+ } |
6167 |
+ |
6168 |
+ return 0; |
6169 |
+@@ -1426,6 +1475,7 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) |
6170 |
+ |
6171 |
+ sai->pdev = pdev; |
6172 |
+ mutex_init(&sai->ctrl_lock); |
6173 |
++ spin_lock_init(&sai->irq_lock); |
6174 |
+ platform_set_drvdata(pdev, sai); |
6175 |
+ |
6176 |
+ sai->pdata = dev_get_drvdata(pdev->dev.parent); |
6177 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
6178 |
+index 5dde107083c6..479196aeb409 100644 |
6179 |
+--- a/tools/objtool/check.c |
6180 |
++++ b/tools/objtool/check.c |
6181 |
+@@ -165,6 +165,7 @@ static int __dead_end_function(struct objtool_file *file, struct symbol *func, |
6182 |
+ "fortify_panic", |
6183 |
+ "usercopy_abort", |
6184 |
+ "machine_real_restart", |
6185 |
++ "rewind_stack_do_exit", |
6186 |
+ }; |
6187 |
+ |
6188 |
+ if (func->bind == STB_WEAK) |