diff options
490 files changed, 4880 insertions, 2579 deletions
diff --git a/Documentation/CodeOfConflict b/Documentation/CodeOfConflict new file mode 100644 index 000000000000..1684d0b4efa6 --- /dev/null +++ b/Documentation/CodeOfConflict | |||
@@ -0,0 +1,27 @@ | |||
1 | Code of Conflict | ||
2 | ---------------- | ||
3 | |||
4 | The Linux kernel development effort is a very personal process compared | ||
5 | to "traditional" ways of developing software. Your code and ideas | ||
6 | behind it will be carefully reviewed, often resulting in critique and | ||
7 | criticism. The review will almost always require improvements to the | ||
8 | code before it can be included in the kernel. Know that this happens | ||
9 | because everyone involved wants to see the best possible solution for | ||
10 | the overall success of Linux. This development process has been proven | ||
11 | to create the most robust operating system kernel ever, and we do not | ||
12 | want to do anything to cause the quality of submission and eventual | ||
13 | result to ever decrease. | ||
14 | |||
15 | If however, anyone feels personally abused, threatened, or otherwise | ||
16 | uncomfortable due to this process, that is not acceptable. If so, | ||
17 | please contact the Linux Foundation's Technical Advisory Board at | ||
18 | <tab@lists.linux-foundation.org>, or the individual members, and they | ||
19 | will work to resolve the issue to the best of their ability. For more | ||
20 | information on who is on the Technical Advisory Board and what their | ||
21 | role is, please see: | ||
22 | http://www.linuxfoundation.org/programs/advisory-councils/tab | ||
23 | |||
24 | As a reviewer of code, please strive to keep things civil and focused on | ||
25 | the technical issues involved. We are all humans, and frustrations can | ||
26 | be high on both sides of the process. Try to keep in mind the immortal | ||
27 | words of Bill and Ted, "Be excellent to each other." | ||
diff --git a/Documentation/cgroups/unified-hierarchy.txt b/Documentation/cgroups/unified-hierarchy.txt index 71daa35ec2d9..eb102fb72213 100644 --- a/Documentation/cgroups/unified-hierarchy.txt +++ b/Documentation/cgroups/unified-hierarchy.txt | |||
@@ -404,8 +404,8 @@ supported and the interface files "release_agent" and | |||
404 | be understood as an underflow into the highest possible value, -2 or | 404 | be understood as an underflow into the highest possible value, -2 or |
405 | -10M etc. do not work, so it's not consistent. | 405 | -10M etc. do not work, so it's not consistent. |
406 | 406 | ||
407 | memory.low, memory.high, and memory.max will use the string | 407 | memory.low, memory.high, and memory.max will use the string "max" to |
408 | "infinity" to indicate and set the highest possible value. | 408 | indicate and set the highest possible value. |
409 | 409 | ||
410 | 5. Planned Changes | 410 | 5. Planned Changes |
411 | 411 | ||
diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.txt b/Documentation/devicetree/bindings/i2c/i2c-imx.txt index 52d37fd8d3e5..ce4311d726ae 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-imx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-imx.txt | |||
@@ -7,6 +7,7 @@ Required properties: | |||
7 | - "fsl,vf610-i2c" for I2C compatible with the one integrated on Vybrid vf610 SoC | 7 | - "fsl,vf610-i2c" for I2C compatible with the one integrated on Vybrid vf610 SoC |
8 | - reg : Should contain I2C/HS-I2C registers location and length | 8 | - reg : Should contain I2C/HS-I2C registers location and length |
9 | - interrupts : Should contain I2C/HS-I2C interrupt | 9 | - interrupts : Should contain I2C/HS-I2C interrupt |
10 | - clocks : Should contain the I2C/HS-I2C clock specifier | ||
10 | 11 | ||
11 | Optional properties: | 12 | Optional properties: |
12 | - clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. | 13 | - clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. |
diff --git a/Documentation/devicetree/bindings/net/amd-xgbe-phy.txt b/Documentation/devicetree/bindings/net/amd-xgbe-phy.txt index 33df3932168e..8db32384a486 100644 --- a/Documentation/devicetree/bindings/net/amd-xgbe-phy.txt +++ b/Documentation/devicetree/bindings/net/amd-xgbe-phy.txt | |||
@@ -27,6 +27,8 @@ property is used. | |||
27 | - amd,serdes-cdr-rate: CDR rate speed selection | 27 | - amd,serdes-cdr-rate: CDR rate speed selection |
28 | - amd,serdes-pq-skew: PQ (data sampling) skew | 28 | - amd,serdes-pq-skew: PQ (data sampling) skew |
29 | - amd,serdes-tx-amp: TX amplitude boost | 29 | - amd,serdes-tx-amp: TX amplitude boost |
30 | - amd,serdes-dfe-tap-config: DFE taps available to run | ||
31 | - amd,serdes-dfe-tap-enable: DFE taps to enable | ||
30 | 32 | ||
31 | Example: | 33 | Example: |
32 | xgbe_phy@e1240800 { | 34 | xgbe_phy@e1240800 { |
@@ -41,4 +43,6 @@ Example: | |||
41 | amd,serdes-cdr-rate = <2>, <2>, <7>; | 43 | amd,serdes-cdr-rate = <2>, <2>, <7>; |
42 | amd,serdes-pq-skew = <10>, <10>, <30>; | 44 | amd,serdes-pq-skew = <10>, <10>, <30>; |
43 | amd,serdes-tx-amp = <15>, <15>, <10>; | 45 | amd,serdes-tx-amp = <15>, <15>, <10>; |
46 | amd,serdes-dfe-tap-config = <3>, <3>, <1>; | ||
47 | amd,serdes-dfe-tap-enable = <0>, <0>, <127>; | ||
44 | }; | 48 | }; |
diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt index 7f76214f728a..289c40ed7470 100644 --- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt +++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.txt | |||
@@ -21,6 +21,18 @@ Optional properties: | |||
21 | - reg-io-width : the size (in bytes) of the IO accesses that should be | 21 | - reg-io-width : the size (in bytes) of the IO accesses that should be |
22 | performed on the device. If this property is not present then single byte | 22 | performed on the device. If this property is not present then single byte |
23 | accesses are used. | 23 | accesses are used. |
24 | - dcd-override : Override the DCD modem status signal. This signal will always | ||
25 | be reported as active instead of being obtained from the modem status | ||
26 | register. Define this if your serial port does not use this pin. | ||
27 | - dsr-override : Override the DTS modem status signal. This signal will always | ||
28 | be reported as active instead of being obtained from the modem status | ||
29 | register. Define this if your serial port does not use this pin. | ||
30 | - cts-override : Override the CTS modem status signal. This signal will always | ||
31 | be reported as active instead of being obtained from the modem status | ||
32 | register. Define this if your serial port does not use this pin. | ||
33 | - ri-override : Override the RI modem status signal. This signal will always be | ||
34 | reported as inactive instead of being obtained from the modem status register. | ||
35 | Define this if your serial port does not use this pin. | ||
24 | 36 | ||
25 | Example: | 37 | Example: |
26 | 38 | ||
@@ -31,6 +43,10 @@ Example: | |||
31 | interrupts = <10>; | 43 | interrupts = <10>; |
32 | reg-shift = <2>; | 44 | reg-shift = <2>; |
33 | reg-io-width = <4>; | 45 | reg-io-width = <4>; |
46 | dcd-override; | ||
47 | dsr-override; | ||
48 | cts-override; | ||
49 | ri-override; | ||
34 | }; | 50 | }; |
35 | 51 | ||
36 | Example with one clock: | 52 | Example with one clock: |
diff --git a/Documentation/filesystems/dlmfs.txt b/Documentation/filesystems/dlmfs.txt index 1b528b2ad809..fcf4d509d118 100644 --- a/Documentation/filesystems/dlmfs.txt +++ b/Documentation/filesystems/dlmfs.txt | |||
@@ -5,8 +5,8 @@ system. | |||
5 | 5 | ||
6 | dlmfs is built with OCFS2 as it requires most of its infrastructure. | 6 | dlmfs is built with OCFS2 as it requires most of its infrastructure. |
7 | 7 | ||
8 | Project web page: http://oss.oracle.com/projects/ocfs2 | 8 | Project web page: http://ocfs2.wiki.kernel.org |
9 | Tools web page: http://oss.oracle.com/projects/ocfs2-tools | 9 | Tools web page: https://github.com/markfasheh/ocfs2-tools |
10 | OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/ | 10 | OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/ |
11 | 11 | ||
12 | All code copyright 2005 Oracle except when otherwise noted. | 12 | All code copyright 2005 Oracle except when otherwise noted. |
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index 28f8c08201e2..4c49e5410595 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -8,8 +8,8 @@ also make it attractive for non-clustered use. | |||
8 | You'll want to install the ocfs2-tools package in order to at least | 8 | You'll want to install the ocfs2-tools package in order to at least |
9 | get "mount.ocfs2" and "ocfs2_hb_ctl". | 9 | get "mount.ocfs2" and "ocfs2_hb_ctl". |
10 | 10 | ||
11 | Project web page: http://oss.oracle.com/projects/ocfs2 | 11 | Project web page: http://ocfs2.wiki.kernel.org |
12 | Tools web page: http://oss.oracle.com/projects/ocfs2-tools | 12 | Tools git tree: https://github.com/markfasheh/ocfs2-tools |
13 | OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/ | 13 | OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/ |
14 | 14 | ||
15 | All code copyright 2005 Oracle except when otherwise noted. | 15 | All code copyright 2005 Oracle except when otherwise noted. |
diff --git a/Documentation/power/suspend-and-interrupts.txt b/Documentation/power/suspend-and-interrupts.txt index 2f9c5a5fcb25..8afb29a8604a 100644 --- a/Documentation/power/suspend-and-interrupts.txt +++ b/Documentation/power/suspend-and-interrupts.txt | |||
@@ -40,8 +40,10 @@ but also to IPIs and to some other special-purpose interrupts. | |||
40 | 40 | ||
41 | The IRQF_NO_SUSPEND flag is used to indicate that to the IRQ subsystem when | 41 | The IRQF_NO_SUSPEND flag is used to indicate that to the IRQ subsystem when |
42 | requesting a special-purpose interrupt. It causes suspend_device_irqs() to | 42 | requesting a special-purpose interrupt. It causes suspend_device_irqs() to |
43 | leave the corresponding IRQ enabled so as to allow the interrupt to work all | 43 | leave the corresponding IRQ enabled so as to allow the interrupt to work as |
44 | the time as expected. | 44 | expected during the suspend-resume cycle, but does not guarantee that the |
45 | interrupt will wake the system from a suspended state -- for such cases it is | ||
46 | necessary to use enable_irq_wake(). | ||
45 | 47 | ||
46 | Note that the IRQF_NO_SUSPEND flag affects the entire IRQ and not just one | 48 | Note that the IRQF_NO_SUSPEND flag affects the entire IRQ and not just one |
47 | user of it. Thus, if the IRQ is shared, all of the interrupt handlers installed | 49 | user of it. Thus, if the IRQ is shared, all of the interrupt handlers installed |
@@ -110,8 +112,9 @@ any special interrupt handling logic for it to work. | |||
110 | IRQF_NO_SUSPEND and enable_irq_wake() | 112 | IRQF_NO_SUSPEND and enable_irq_wake() |
111 | ------------------------------------- | 113 | ------------------------------------- |
112 | 114 | ||
113 | There are no valid reasons to use both enable_irq_wake() and the IRQF_NO_SUSPEND | 115 | There are very few valid reasons to use both enable_irq_wake() and the |
114 | flag on the same IRQ. | 116 | IRQF_NO_SUSPEND flag on the same IRQ, and it is never valid to use both for the |
117 | same device. | ||
115 | 118 | ||
116 | First of all, if the IRQ is not shared, the rules for handling IRQF_NO_SUSPEND | 119 | First of all, if the IRQ is not shared, the rules for handling IRQF_NO_SUSPEND |
117 | interrupts (interrupt handlers are invoked after suspend_device_irqs()) are | 120 | interrupts (interrupt handlers are invoked after suspend_device_irqs()) are |
@@ -120,4 +123,13 @@ handlers are not invoked after suspend_device_irqs()). | |||
120 | 123 | ||
121 | Second, both enable_irq_wake() and IRQF_NO_SUSPEND apply to entire IRQs and not | 124 | Second, both enable_irq_wake() and IRQF_NO_SUSPEND apply to entire IRQs and not |
122 | to individual interrupt handlers, so sharing an IRQ between a system wakeup | 125 | to individual interrupt handlers, so sharing an IRQ between a system wakeup |
123 | interrupt source and an IRQF_NO_SUSPEND interrupt source does not make sense. | 126 | interrupt source and an IRQF_NO_SUSPEND interrupt source does not generally |
127 | make sense. | ||
128 | |||
129 | In rare cases an IRQ can be shared between a wakeup device driver and an | ||
130 | IRQF_NO_SUSPEND user. In order for this to be safe, the wakeup device driver | ||
131 | must be able to discern spurious IRQs from genuine wakeup events (signalling | ||
132 | the latter to the core with pm_system_wakeup()), must use enable_irq_wake() to | ||
133 | ensure that the IRQ will function as a wakeup source, and must request the IRQ | ||
134 | with IRQF_COND_SUSPEND to tell the core that it meets these requirements. If | ||
135 | these requirements are not met, it is not valid to use IRQF_COND_SUSPEND. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index ddc5a8cf9a8a..6239a305dff0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2065,7 +2065,7 @@ F: include/net/bluetooth/ | |||
2065 | BONDING DRIVER | 2065 | BONDING DRIVER |
2066 | M: Jay Vosburgh <j.vosburgh@gmail.com> | 2066 | M: Jay Vosburgh <j.vosburgh@gmail.com> |
2067 | M: Veaceslav Falico <vfalico@gmail.com> | 2067 | M: Veaceslav Falico <vfalico@gmail.com> |
2068 | M: Andy Gospodarek <andy@greyhouse.net> | 2068 | M: Andy Gospodarek <gospo@cumulusnetworks.com> |
2069 | L: netdev@vger.kernel.org | 2069 | L: netdev@vger.kernel.org |
2070 | W: http://sourceforge.net/projects/bonding/ | 2070 | W: http://sourceforge.net/projects/bonding/ |
2071 | S: Supported | 2071 | S: Supported |
@@ -7213,8 +7213,7 @@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2) | |||
7213 | M: Mark Fasheh <mfasheh@suse.com> | 7213 | M: Mark Fasheh <mfasheh@suse.com> |
7214 | M: Joel Becker <jlbec@evilplan.org> | 7214 | M: Joel Becker <jlbec@evilplan.org> |
7215 | L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers) | 7215 | L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers) |
7216 | W: http://oss.oracle.com/projects/ocfs2/ | 7216 | W: http://ocfs2.wiki.kernel.org |
7217 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2.git | ||
7218 | S: Supported | 7217 | S: Supported |
7219 | F: Documentation/filesystems/ocfs2.txt | 7218 | F: Documentation/filesystems/ocfs2.txt |
7220 | F: Documentation/filesystems/dlmfs.txt | 7219 | F: Documentation/filesystems/dlmfs.txt |
@@ -8481,6 +8480,14 @@ S: Supported | |||
8481 | L: netdev@vger.kernel.org | 8480 | L: netdev@vger.kernel.org |
8482 | F: drivers/net/ethernet/samsung/sxgbe/ | 8481 | F: drivers/net/ethernet/samsung/sxgbe/ |
8483 | 8482 | ||
8483 | SAMSUNG THERMAL DRIVER | ||
8484 | M: Lukasz Majewski <l.majewski@samsung.com> | ||
8485 | L: linux-pm@vger.kernel.org | ||
8486 | L: linux-samsung-soc@vger.kernel.org | ||
8487 | S: Supported | ||
8488 | T: https://github.com/lmajewski/linux-samsung-thermal.git | ||
8489 | F: drivers/thermal/samsung/ | ||
8490 | |||
8484 | SAMSUNG USB2 PHY DRIVER | 8491 | SAMSUNG USB2 PHY DRIVER |
8485 | M: Kamil Debski <k.debski@samsung.com> | 8492 | M: Kamil Debski <k.debski@samsung.com> |
8486 | L: linux-kernel@vger.kernel.org | 8493 | L: linux-kernel@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 0 | 2 | PATCHLEVEL = 0 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc1 | 4 | EXTRAVERSION = -rc3 |
5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h index 4e547296831d..52312cb5dbe2 100644 --- a/arch/arc/include/asm/processor.h +++ b/arch/arc/include/asm/processor.h | |||
@@ -47,9 +47,6 @@ struct thread_struct { | |||
47 | /* Forward declaration, a strange C thing */ | 47 | /* Forward declaration, a strange C thing */ |
48 | struct task_struct; | 48 | struct task_struct; |
49 | 49 | ||
50 | /* Return saved PC of a blocked thread */ | ||
51 | unsigned long thread_saved_pc(struct task_struct *t); | ||
52 | |||
53 | #define task_pt_regs(p) \ | 50 | #define task_pt_regs(p) \ |
54 | ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) | 51 | ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) |
55 | 52 | ||
@@ -72,18 +69,21 @@ unsigned long thread_saved_pc(struct task_struct *t); | |||
72 | #define release_segments(mm) do { } while (0) | 69 | #define release_segments(mm) do { } while (0) |
73 | 70 | ||
74 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret) | 71 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ret) |
72 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp) | ||
75 | 73 | ||
76 | /* | 74 | /* |
77 | * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. | 75 | * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. |
78 | * Look in process.c for details of kernel stack layout | 76 | * Look in process.c for details of kernel stack layout |
79 | */ | 77 | */ |
80 | #define KSTK_ESP(tsk) (tsk->thread.ksp) | 78 | #define TSK_K_ESP(tsk) (tsk->thread.ksp) |
81 | 79 | ||
82 | #define KSTK_REG(tsk, off) (*((unsigned int *)(KSTK_ESP(tsk) + \ | 80 | #define TSK_K_REG(tsk, off) (*((unsigned int *)(TSK_K_ESP(tsk) + \ |
83 | sizeof(struct callee_regs) + off))) | 81 | sizeof(struct callee_regs) + off))) |
84 | 82 | ||
85 | #define KSTK_BLINK(tsk) KSTK_REG(tsk, 4) | 83 | #define TSK_K_BLINK(tsk) TSK_K_REG(tsk, 4) |
86 | #define KSTK_FP(tsk) KSTK_REG(tsk, 0) | 84 | #define TSK_K_FP(tsk) TSK_K_REG(tsk, 0) |
85 | |||
86 | #define thread_saved_pc(tsk) TSK_K_BLINK(tsk) | ||
87 | 87 | ||
88 | extern void start_thread(struct pt_regs * regs, unsigned long pc, | 88 | extern void start_thread(struct pt_regs * regs, unsigned long pc, |
89 | unsigned long usp); | 89 | unsigned long usp); |
diff --git a/arch/arc/include/asm/stacktrace.h b/arch/arc/include/asm/stacktrace.h new file mode 100644 index 000000000000..b29b6064ea14 --- /dev/null +++ b/arch/arc/include/asm/stacktrace.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) | ||
3 | * Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef __ASM_STACKTRACE_H | ||
11 | #define __ASM_STACKTRACE_H | ||
12 | |||
13 | #include <linux/sched.h> | ||
14 | |||
15 | /** | ||
16 | * arc_unwind_core - Unwind the kernel mode stack for an execution context | ||
17 | * @tsk: NULL for current task, specific task otherwise | ||
18 | * @regs: pt_regs used to seed the unwinder {SP, FP, BLINK, PC} | ||
19 | * If NULL, use pt_regs of @tsk (if !NULL) otherwise | ||
20 | * use the current values of {SP, FP, BLINK, PC} | ||
21 | * @consumer_fn: Callback invoked for each frame unwound | ||
22 | * Returns 0 to continue unwinding, -1 to stop | ||
23 | * @arg: Arg to callback | ||
24 | * | ||
25 | * Returns the address of first function in stack | ||
26 | * | ||
27 | * Semantics: | ||
28 | * - synchronous unwinding (e.g. dump_stack): @tsk NULL, @regs NULL | ||
29 | * - Asynchronous unwinding of sleeping task: @tsk !NULL, @regs NULL | ||
30 | * - Asynchronous unwinding of intr/excp etc: @tsk !NULL, @regs !NULL | ||
31 | */ | ||
32 | notrace noinline unsigned int arc_unwind_core( | ||
33 | struct task_struct *tsk, struct pt_regs *regs, | ||
34 | int (*consumer_fn) (unsigned int, void *), | ||
35 | void *arg); | ||
36 | |||
37 | #endif /* __ASM_STACKTRACE_H */ | ||
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index fdd89715d2d3..98c00a2d4dd9 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c | |||
@@ -192,29 +192,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) | |||
192 | return 0; | 192 | return 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | /* | ||
196 | * API: expected by schedular Code: If thread is sleeping where is that. | ||
197 | * What is this good for? it will be always the scheduler or ret_from_fork. | ||
198 | * So we hard code that anyways. | ||
199 | */ | ||
200 | unsigned long thread_saved_pc(struct task_struct *t) | ||
201 | { | ||
202 | struct pt_regs *regs = task_pt_regs(t); | ||
203 | unsigned long blink = 0; | ||
204 | |||
205 | /* | ||
206 | * If the thread being queried for in not itself calling this, then it | ||
207 | * implies it is not executing, which in turn implies it is sleeping, | ||
208 | * which in turn implies it got switched OUT by the schedular. | ||
209 | * In that case, it's kernel mode blink can reliably retrieved as per | ||
210 | * the picture above (right above pt_regs). | ||
211 | */ | ||
212 | if (t != current && t->state != TASK_RUNNING) | ||
213 | blink = *((unsigned int *)regs - 1); | ||
214 | |||
215 | return blink; | ||
216 | } | ||
217 | |||
218 | int elf_check_arch(const struct elf32_hdr *x) | 195 | int elf_check_arch(const struct elf32_hdr *x) |
219 | { | 196 | { |
220 | unsigned int eflags; | 197 | unsigned int eflags; |
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c index 9ce47cfe2303..92320d6f737c 100644 --- a/arch/arc/kernel/stacktrace.c +++ b/arch/arc/kernel/stacktrace.c | |||
@@ -43,6 +43,10 @@ static void seed_unwind_frame_info(struct task_struct *tsk, | |||
43 | struct pt_regs *regs, | 43 | struct pt_regs *regs, |
44 | struct unwind_frame_info *frame_info) | 44 | struct unwind_frame_info *frame_info) |
45 | { | 45 | { |
46 | /* | ||
47 | * synchronous unwinding (e.g. dump_stack) | ||
48 | * - uses current values of SP and friends | ||
49 | */ | ||
46 | if (tsk == NULL && regs == NULL) { | 50 | if (tsk == NULL && regs == NULL) { |
47 | unsigned long fp, sp, blink, ret; | 51 | unsigned long fp, sp, blink, ret; |
48 | frame_info->task = current; | 52 | frame_info->task = current; |
@@ -61,12 +65,17 @@ static void seed_unwind_frame_info(struct task_struct *tsk, | |||
61 | frame_info->regs.r63 = ret; | 65 | frame_info->regs.r63 = ret; |
62 | frame_info->call_frame = 0; | 66 | frame_info->call_frame = 0; |
63 | } else if (regs == NULL) { | 67 | } else if (regs == NULL) { |
68 | /* | ||
69 | * Asynchronous unwinding of sleeping task | ||
70 | * - Gets SP etc from task's pt_regs (saved bottom of kernel | ||
71 | * mode stack of task) | ||
72 | */ | ||
64 | 73 | ||
65 | frame_info->task = tsk; | 74 | frame_info->task = tsk; |
66 | 75 | ||
67 | frame_info->regs.r27 = KSTK_FP(tsk); | 76 | frame_info->regs.r27 = TSK_K_FP(tsk); |
68 | frame_info->regs.r28 = KSTK_ESP(tsk); | 77 | frame_info->regs.r28 = TSK_K_ESP(tsk); |
69 | frame_info->regs.r31 = KSTK_BLINK(tsk); | 78 | frame_info->regs.r31 = TSK_K_BLINK(tsk); |
70 | frame_info->regs.r63 = (unsigned int)__switch_to; | 79 | frame_info->regs.r63 = (unsigned int)__switch_to; |
71 | 80 | ||
72 | /* In the prologue of __switch_to, first FP is saved on stack | 81 | /* In the prologue of __switch_to, first FP is saved on stack |
@@ -83,6 +92,10 @@ static void seed_unwind_frame_info(struct task_struct *tsk, | |||
83 | frame_info->call_frame = 0; | 92 | frame_info->call_frame = 0; |
84 | 93 | ||
85 | } else { | 94 | } else { |
95 | /* | ||
96 | * Asynchronous unwinding of intr/exception | ||
97 | * - Just uses the pt_regs passed | ||
98 | */ | ||
86 | frame_info->task = tsk; | 99 | frame_info->task = tsk; |
87 | 100 | ||
88 | frame_info->regs.r27 = regs->fp; | 101 | frame_info->regs.r27 = regs->fp; |
@@ -95,7 +108,7 @@ static void seed_unwind_frame_info(struct task_struct *tsk, | |||
95 | 108 | ||
96 | #endif | 109 | #endif |
97 | 110 | ||
98 | static noinline unsigned int | 111 | notrace noinline unsigned int |
99 | arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, | 112 | arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, |
100 | int (*consumer_fn) (unsigned int, void *), void *arg) | 113 | int (*consumer_fn) (unsigned int, void *), void *arg) |
101 | { | 114 | { |
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c index 7ff5b5c183bb..74db59b6f392 100644 --- a/arch/arc/kernel/unaligned.c +++ b/arch/arc/kernel/unaligned.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/perf_event.h> | ||
15 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
16 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
17 | #include <asm/disasm.h> | 18 | #include <asm/disasm.h> |
@@ -253,6 +254,7 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs, | |||
253 | } | 254 | } |
254 | } | 255 | } |
255 | 256 | ||
257 | perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, address); | ||
256 | return 0; | 258 | return 0; |
257 | 259 | ||
258 | fault: | 260 | fault: |
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 563cb27e37f5..6a2e006cbcce 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/ptrace.h> | 14 | #include <linux/ptrace.h> |
15 | #include <linux/uaccess.h> | 15 | #include <linux/uaccess.h> |
16 | #include <linux/kdebug.h> | 16 | #include <linux/kdebug.h> |
17 | #include <linux/perf_event.h> | ||
17 | #include <asm/pgalloc.h> | 18 | #include <asm/pgalloc.h> |
18 | #include <asm/mmu.h> | 19 | #include <asm/mmu.h> |
19 | 20 | ||
@@ -139,13 +140,20 @@ good_area: | |||
139 | return; | 140 | return; |
140 | } | 141 | } |
141 | 142 | ||
143 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); | ||
144 | |||
142 | if (likely(!(fault & VM_FAULT_ERROR))) { | 145 | if (likely(!(fault & VM_FAULT_ERROR))) { |
143 | if (flags & FAULT_FLAG_ALLOW_RETRY) { | 146 | if (flags & FAULT_FLAG_ALLOW_RETRY) { |
144 | /* To avoid updating stats twice for retry case */ | 147 | /* To avoid updating stats twice for retry case */ |
145 | if (fault & VM_FAULT_MAJOR) | 148 | if (fault & VM_FAULT_MAJOR) { |
146 | tsk->maj_flt++; | 149 | tsk->maj_flt++; |
147 | else | 150 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, |
151 | regs, address); | ||
152 | } else { | ||
148 | tsk->min_flt++; | 153 | tsk->min_flt++; |
154 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, | ||
155 | regs, address); | ||
156 | } | ||
149 | 157 | ||
150 | if (fault & VM_FAULT_RETRY) { | 158 | if (fault & VM_FAULT_RETRY) { |
151 | flags &= ~FAULT_FLAG_ALLOW_RETRY; | 159 | flags &= ~FAULT_FLAG_ALLOW_RETRY; |
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi index 6cc25ed912ee..2c6248d9a9ef 100644 --- a/arch/arm/boot/dts/am335x-bone-common.dtsi +++ b/arch/arm/boot/dts/am335x-bone-common.dtsi | |||
@@ -195,6 +195,7 @@ | |||
195 | 195 | ||
196 | &usb0 { | 196 | &usb0 { |
197 | status = "okay"; | 197 | status = "okay"; |
198 | dr_mode = "peripheral"; | ||
198 | }; | 199 | }; |
199 | 200 | ||
200 | &usb1 { | 201 | &usb1 { |
diff --git a/arch/arm/boot/dts/am437x-idk-evm.dts b/arch/arm/boot/dts/am437x-idk-evm.dts index f9a17e2ca8cb..0198f5a62b96 100644 --- a/arch/arm/boot/dts/am437x-idk-evm.dts +++ b/arch/arm/boot/dts/am437x-idk-evm.dts | |||
@@ -133,20 +133,6 @@ | |||
133 | >; | 133 | >; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | i2c1_pins_default: i2c1_pins_default { | ||
137 | pinctrl-single,pins = < | ||
138 | 0x15c (PIN_INPUT | SLEWCTRL_FAST | MUX_MODE2) /* spi0_cs0.i2c1_scl */ | ||
139 | 0x158 (PIN_INPUT | SLEWCTRL_FAST | MUX_MODE2) /* spi0_d1.i2c1_sda */ | ||
140 | >; | ||
141 | }; | ||
142 | |||
143 | i2c1_pins_sleep: i2c1_pins_sleep { | ||
144 | pinctrl-single,pins = < | ||
145 | 0x15c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_cs0.i2c1_scl */ | ||
146 | 0x158 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_d1.i2c1_sda */ | ||
147 | >; | ||
148 | }; | ||
149 | |||
150 | mmc1_pins_default: pinmux_mmc1_pins_default { | 136 | mmc1_pins_default: pinmux_mmc1_pins_default { |
151 | pinctrl-single,pins = < | 137 | pinctrl-single,pins = < |
152 | 0x100 (PIN_INPUT | MUX_MODE0) /* mmc0_clk.mmc0_clk */ | 138 | 0x100 (PIN_INPUT | MUX_MODE0) /* mmc0_clk.mmc0_clk */ |
@@ -254,7 +240,7 @@ | |||
254 | status = "okay"; | 240 | status = "okay"; |
255 | pinctrl-names = "default", "sleep"; | 241 | pinctrl-names = "default", "sleep"; |
256 | pinctrl-0 = <&i2c0_pins_default>; | 242 | pinctrl-0 = <&i2c0_pins_default>; |
257 | pinctrl-1 = <&i2c0_pins_default>; | 243 | pinctrl-1 = <&i2c0_pins_sleep>; |
258 | clock-frequency = <400000>; | 244 | clock-frequency = <400000>; |
259 | 245 | ||
260 | at24@50 { | 246 | at24@50 { |
@@ -262,17 +248,10 @@ | |||
262 | pagesize = <64>; | 248 | pagesize = <64>; |
263 | reg = <0x50>; | 249 | reg = <0x50>; |
264 | }; | 250 | }; |
265 | }; | ||
266 | |||
267 | &i2c1 { | ||
268 | status = "okay"; | ||
269 | pinctrl-names = "default", "sleep"; | ||
270 | pinctrl-0 = <&i2c1_pins_default>; | ||
271 | pinctrl-1 = <&i2c1_pins_default>; | ||
272 | clock-frequency = <400000>; | ||
273 | 251 | ||
274 | tps: tps62362@60 { | 252 | tps: tps62362@60 { |
275 | compatible = "ti,tps62362"; | 253 | compatible = "ti,tps62362"; |
254 | reg = <0x60>; | ||
276 | regulator-name = "VDD_MPU"; | 255 | regulator-name = "VDD_MPU"; |
277 | regulator-min-microvolt = <950000>; | 256 | regulator-min-microvolt = <950000>; |
278 | regulator-max-microvolt = <1330000>; | 257 | regulator-max-microvolt = <1330000>; |
diff --git a/arch/arm/boot/dts/am57xx-beagle-x15.dts b/arch/arm/boot/dts/am57xx-beagle-x15.dts index 03750af3b49a..6463f9ef2b54 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15.dts +++ b/arch/arm/boot/dts/am57xx-beagle-x15.dts | |||
@@ -549,14 +549,6 @@ | |||
549 | pinctrl-0 = <&usb1_pins>; | 549 | pinctrl-0 = <&usb1_pins>; |
550 | }; | 550 | }; |
551 | 551 | ||
552 | &omap_dwc3_1 { | ||
553 | extcon = <&extcon_usb1>; | ||
554 | }; | ||
555 | |||
556 | &omap_dwc3_2 { | ||
557 | extcon = <&extcon_usb2>; | ||
558 | }; | ||
559 | |||
560 | &usb2 { | 552 | &usb2 { |
561 | dr_mode = "peripheral"; | 553 | dr_mode = "peripheral"; |
562 | }; | 554 | }; |
diff --git a/arch/arm/boot/dts/dm8168-evm.dts b/arch/arm/boot/dts/dm8168-evm.dts index 857d0289ad4d..d3a29c1b8417 100644 --- a/arch/arm/boot/dts/dm8168-evm.dts +++ b/arch/arm/boot/dts/dm8168-evm.dts | |||
@@ -35,6 +35,18 @@ | |||
35 | DM816X_IOPAD(0x0aac, PIN_INPUT | MUX_MODE0) /* SPI_D1 */ | 35 | DM816X_IOPAD(0x0aac, PIN_INPUT | MUX_MODE0) /* SPI_D1 */ |
36 | >; | 36 | >; |
37 | }; | 37 | }; |
38 | |||
39 | usb0_pins: pinmux_usb0_pins { | ||
40 | pinctrl-single,pins = < | ||
41 | DM816X_IOPAD(0x0d00, MUX_MODE0) /* USB0_DRVVBUS */ | ||
42 | >; | ||
43 | }; | ||
44 | |||
45 | usb1_pins: pinmux_usb0_pins { | ||
46 | pinctrl-single,pins = < | ||
47 | DM816X_IOPAD(0x0d04, MUX_MODE0) /* USB1_DRVVBUS */ | ||
48 | >; | ||
49 | }; | ||
38 | }; | 50 | }; |
39 | 51 | ||
40 | &i2c1 { | 52 | &i2c1 { |
@@ -127,3 +139,16 @@ | |||
127 | &mmc1 { | 139 | &mmc1 { |
128 | vmmc-supply = <&vmmcsd_fixed>; | 140 | vmmc-supply = <&vmmcsd_fixed>; |
129 | }; | 141 | }; |
142 | |||
143 | /* At least dm8168-evm rev c won't support multipoint, later may */ | ||
144 | &usb0 { | ||
145 | pinctrl-names = "default"; | ||
146 | pinctrl-0 = <&usb0_pins>; | ||
147 | mentor,multipoint = <0>; | ||
148 | }; | ||
149 | |||
150 | &usb1 { | ||
151 | pinctrl-names = "default"; | ||
152 | pinctrl-0 = <&usb1_pins>; | ||
153 | mentor,multipoint = <0>; | ||
154 | }; | ||
diff --git a/arch/arm/boot/dts/dm816x.dtsi b/arch/arm/boot/dts/dm816x.dtsi index d98d0f7de380..3c97b5f2addc 100644 --- a/arch/arm/boot/dts/dm816x.dtsi +++ b/arch/arm/boot/dts/dm816x.dtsi | |||
@@ -97,10 +97,31 @@ | |||
97 | 97 | ||
98 | /* Device Configuration Registers */ | 98 | /* Device Configuration Registers */ |
99 | scm_conf: syscon@600 { | 99 | scm_conf: syscon@600 { |
100 | compatible = "syscon"; | 100 | compatible = "syscon", "simple-bus"; |
101 | reg = <0x600 0x110>; | 101 | reg = <0x600 0x110>; |
102 | #address-cells = <1>; | 102 | #address-cells = <1>; |
103 | #size-cells = <1>; | 103 | #size-cells = <1>; |
104 | ranges = <0 0x600 0x110>; | ||
105 | |||
106 | usb_phy0: usb-phy@20 { | ||
107 | compatible = "ti,dm8168-usb-phy"; | ||
108 | reg = <0x20 0x8>; | ||
109 | reg-names = "phy"; | ||
110 | clocks = <&main_fapll 6>; | ||
111 | clock-names = "refclk"; | ||
112 | #phy-cells = <0>; | ||
113 | syscon = <&scm_conf>; | ||
114 | }; | ||
115 | |||
116 | usb_phy1: usb-phy@28 { | ||
117 | compatible = "ti,dm8168-usb-phy"; | ||
118 | reg = <0x28 0x8>; | ||
119 | reg-names = "phy"; | ||
120 | clocks = <&main_fapll 6>; | ||
121 | clock-names = "refclk"; | ||
122 | #phy-cells = <0>; | ||
123 | syscon = <&scm_conf>; | ||
124 | }; | ||
104 | }; | 125 | }; |
105 | 126 | ||
106 | scrm_clocks: clocks { | 127 | scrm_clocks: clocks { |
@@ -357,7 +378,10 @@ | |||
357 | reg-names = "mc", "control"; | 378 | reg-names = "mc", "control"; |
358 | interrupts = <18>; | 379 | interrupts = <18>; |
359 | interrupt-names = "mc"; | 380 | interrupt-names = "mc"; |
360 | dr_mode = "otg"; | 381 | dr_mode = "host"; |
382 | interface-type = <0>; | ||
383 | phys = <&usb_phy0>; | ||
384 | phy-names = "usb2-phy"; | ||
361 | mentor,multipoint = <1>; | 385 | mentor,multipoint = <1>; |
362 | mentor,num-eps = <16>; | 386 | mentor,num-eps = <16>; |
363 | mentor,ram-bits = <12>; | 387 | mentor,ram-bits = <12>; |
@@ -366,13 +390,15 @@ | |||
366 | 390 | ||
367 | usb1: usb@47401800 { | 391 | usb1: usb@47401800 { |
368 | compatible = "ti,musb-am33xx"; | 392 | compatible = "ti,musb-am33xx"; |
369 | status = "disabled"; | ||
370 | reg = <0x47401c00 0x400 | 393 | reg = <0x47401c00 0x400 |
371 | 0x47401800 0x200>; | 394 | 0x47401800 0x200>; |
372 | reg-names = "mc", "control"; | 395 | reg-names = "mc", "control"; |
373 | interrupts = <19>; | 396 | interrupts = <19>; |
374 | interrupt-names = "mc"; | 397 | interrupt-names = "mc"; |
375 | dr_mode = "otg"; | 398 | dr_mode = "host"; |
399 | interface-type = <0>; | ||
400 | phys = <&usb_phy1>; | ||
401 | phy-names = "usb2-phy"; | ||
376 | mentor,multipoint = <1>; | 402 | mentor,multipoint = <1>; |
377 | mentor,num-eps = <16>; | 403 | mentor,num-eps = <16>; |
378 | mentor,ram-bits = <12>; | 404 | mentor,ram-bits = <12>; |
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index 746cddb1b8f5..3290a96ba586 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts | |||
@@ -543,14 +543,6 @@ | |||
543 | }; | 543 | }; |
544 | }; | 544 | }; |
545 | 545 | ||
546 | &omap_dwc3_1 { | ||
547 | extcon = <&extcon_usb1>; | ||
548 | }; | ||
549 | |||
550 | &omap_dwc3_2 { | ||
551 | extcon = <&extcon_usb2>; | ||
552 | }; | ||
553 | |||
554 | &usb1 { | 546 | &usb1 { |
555 | dr_mode = "peripheral"; | 547 | dr_mode = "peripheral"; |
556 | pinctrl-names = "default"; | 548 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 5827fedafd43..127608d79033 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
@@ -249,8 +249,8 @@ | |||
249 | <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, | 249 | <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, |
250 | <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; | 250 | <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; |
251 | #dma-cells = <1>; | 251 | #dma-cells = <1>; |
252 | #dma-channels = <32>; | 252 | dma-channels = <32>; |
253 | #dma-requests = <127>; | 253 | dma-requests = <127>; |
254 | }; | 254 | }; |
255 | 255 | ||
256 | gpio1: gpio@4ae10000 { | 256 | gpio1: gpio@4ae10000 { |
@@ -1090,8 +1090,8 @@ | |||
1090 | <0x4A096800 0x40>; /* pll_ctrl */ | 1090 | <0x4A096800 0x40>; /* pll_ctrl */ |
1091 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; | 1091 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; |
1092 | ctrl-module = <&omap_control_sata>; | 1092 | ctrl-module = <&omap_control_sata>; |
1093 | clocks = <&sys_clkin1>; | 1093 | clocks = <&sys_clkin1>, <&sata_ref_clk>; |
1094 | clock-names = "sysclk"; | 1094 | clock-names = "sysclk", "refclk"; |
1095 | #phy-cells = <0>; | 1095 | #phy-cells = <0>; |
1096 | }; | 1096 | }; |
1097 | 1097 | ||
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts index 4d8711713610..e0264d0bf7b9 100644 --- a/arch/arm/boot/dts/dra72-evm.dts +++ b/arch/arm/boot/dts/dra72-evm.dts | |||
@@ -380,14 +380,6 @@ | |||
380 | phy-supply = <&ldo4_reg>; | 380 | phy-supply = <&ldo4_reg>; |
381 | }; | 381 | }; |
382 | 382 | ||
383 | &omap_dwc3_1 { | ||
384 | extcon = <&extcon_usb1>; | ||
385 | }; | ||
386 | |||
387 | &omap_dwc3_2 { | ||
388 | extcon = <&extcon_usb2>; | ||
389 | }; | ||
390 | |||
391 | &usb1 { | 383 | &usb1 { |
392 | dr_mode = "peripheral"; | 384 | dr_mode = "peripheral"; |
393 | pinctrl-names = "default"; | 385 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi index 59d1c297bb30..578fa2a54dce 100644 --- a/arch/arm/boot/dts/omap2.dtsi +++ b/arch/arm/boot/dts/omap2.dtsi | |||
@@ -87,8 +87,8 @@ | |||
87 | <14>, | 87 | <14>, |
88 | <15>; | 88 | <15>; |
89 | #dma-cells = <1>; | 89 | #dma-cells = <1>; |
90 | #dma-channels = <32>; | 90 | dma-channels = <32>; |
91 | #dma-requests = <64>; | 91 | dma-requests = <64>; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | i2c1: i2c@48070000 { | 94 | i2c1: i2c@48070000 { |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 60403273f83e..db80f9d376fa 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -16,6 +16,13 @@ | |||
16 | model = "Nokia N900"; | 16 | model = "Nokia N900"; |
17 | compatible = "nokia,omap3-n900", "ti,omap3430", "ti,omap3"; | 17 | compatible = "nokia,omap3-n900", "ti,omap3430", "ti,omap3"; |
18 | 18 | ||
19 | aliases { | ||
20 | i2c0; | ||
21 | i2c1 = &i2c1; | ||
22 | i2c2 = &i2c2; | ||
23 | i2c3 = &i2c3; | ||
24 | }; | ||
25 | |||
19 | cpus { | 26 | cpus { |
20 | cpu@0 { | 27 | cpu@0 { |
21 | cpu0-supply = <&vcc>; | 28 | cpu0-supply = <&vcc>; |
@@ -704,7 +711,7 @@ | |||
704 | compatible = "smsc,lan91c94"; | 711 | compatible = "smsc,lan91c94"; |
705 | interrupt-parent = <&gpio2>; | 712 | interrupt-parent = <&gpio2>; |
706 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; /* gpio54 */ | 713 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; /* gpio54 */ |
707 | reg = <1 0x300 0xf>; /* 16 byte IO range at offset 0x300 */ | 714 | reg = <1 0 0xf>; /* 16 byte IO range */ |
708 | bank-width = <2>; | 715 | bank-width = <2>; |
709 | pinctrl-names = "default"; | 716 | pinctrl-names = "default"; |
710 | pinctrl-0 = <ðernet_pins>; | 717 | pinctrl-0 = <ðernet_pins>; |
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 01b71111bd55..f4f78c40b564 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -155,8 +155,8 @@ | |||
155 | <14>, | 155 | <14>, |
156 | <15>; | 156 | <15>; |
157 | #dma-cells = <1>; | 157 | #dma-cells = <1>; |
158 | #dma-channels = <32>; | 158 | dma-channels = <32>; |
159 | #dma-requests = <96>; | 159 | dma-requests = <96>; |
160 | }; | 160 | }; |
161 | 161 | ||
162 | omap3_pmx_core: pinmux@48002030 { | 162 | omap3_pmx_core: pinmux@48002030 { |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 074147cebae4..87401d9f4d8b 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -223,8 +223,8 @@ | |||
223 | <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, | 223 | <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
224 | <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 224 | <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
225 | #dma-cells = <1>; | 225 | #dma-cells = <1>; |
226 | #dma-channels = <32>; | 226 | dma-channels = <32>; |
227 | #dma-requests = <127>; | 227 | dma-requests = <127>; |
228 | }; | 228 | }; |
229 | 229 | ||
230 | gpio1: gpio@4a310000 { | 230 | gpio1: gpio@4a310000 { |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index b321fdf42c9f..ddff674bd05e 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
@@ -238,8 +238,8 @@ | |||
238 | <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, | 238 | <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>, |
239 | <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 239 | <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
240 | #dma-cells = <1>; | 240 | #dma-cells = <1>; |
241 | #dma-channels = <32>; | 241 | dma-channels = <32>; |
242 | #dma-requests = <127>; | 242 | dma-requests = <127>; |
243 | }; | 243 | }; |
244 | 244 | ||
245 | gpio1: gpio@4ae10000 { | 245 | gpio1: gpio@4ae10000 { |
@@ -929,8 +929,8 @@ | |||
929 | <0x4A096800 0x40>; /* pll_ctrl */ | 929 | <0x4A096800 0x40>; /* pll_ctrl */ |
930 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; | 930 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; |
931 | ctrl-module = <&omap_control_sata>; | 931 | ctrl-module = <&omap_control_sata>; |
932 | clocks = <&sys_clkin>; | 932 | clocks = <&sys_clkin>, <&sata_ref_clk>; |
933 | clock-names = "sysclk"; | 933 | clock-names = "sysclk", "refclk"; |
934 | #phy-cells = <0>; | 934 | #phy-cells = <0>; |
935 | }; | 935 | }; |
936 | }; | 936 | }; |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index e8a4c955241b..b7e6b6fba5e0 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -62,6 +62,17 @@ CONFIG_MACH_SPEAR1340=y | |||
62 | CONFIG_ARCH_STI=y | 62 | CONFIG_ARCH_STI=y |
63 | CONFIG_ARCH_EXYNOS=y | 63 | CONFIG_ARCH_EXYNOS=y |
64 | CONFIG_EXYNOS5420_MCPM=y | 64 | CONFIG_EXYNOS5420_MCPM=y |
65 | CONFIG_ARCH_SHMOBILE_MULTI=y | ||
66 | CONFIG_ARCH_EMEV2=y | ||
67 | CONFIG_ARCH_R7S72100=y | ||
68 | CONFIG_ARCH_R8A73A4=y | ||
69 | CONFIG_ARCH_R8A7740=y | ||
70 | CONFIG_ARCH_R8A7779=y | ||
71 | CONFIG_ARCH_R8A7790=y | ||
72 | CONFIG_ARCH_R8A7791=y | ||
73 | CONFIG_ARCH_R8A7794=y | ||
74 | CONFIG_ARCH_SH73A0=y | ||
75 | CONFIG_MACH_MARZEN=y | ||
65 | CONFIG_ARCH_SUNXI=y | 76 | CONFIG_ARCH_SUNXI=y |
66 | CONFIG_ARCH_SIRF=y | 77 | CONFIG_ARCH_SIRF=y |
67 | CONFIG_ARCH_TEGRA=y | 78 | CONFIG_ARCH_TEGRA=y |
@@ -84,6 +95,8 @@ CONFIG_PCI_KEYSTONE=y | |||
84 | CONFIG_PCI_MSI=y | 95 | CONFIG_PCI_MSI=y |
85 | CONFIG_PCI_MVEBU=y | 96 | CONFIG_PCI_MVEBU=y |
86 | CONFIG_PCI_TEGRA=y | 97 | CONFIG_PCI_TEGRA=y |
98 | CONFIG_PCI_RCAR_GEN2=y | ||
99 | CONFIG_PCI_RCAR_GEN2_PCIE=y | ||
87 | CONFIG_PCIEPORTBUS=y | 100 | CONFIG_PCIEPORTBUS=y |
88 | CONFIG_SMP=y | 101 | CONFIG_SMP=y |
89 | CONFIG_NR_CPUS=8 | 102 | CONFIG_NR_CPUS=8 |
@@ -130,6 +143,7 @@ CONFIG_DEVTMPFS_MOUNT=y | |||
130 | CONFIG_DMA_CMA=y | 143 | CONFIG_DMA_CMA=y |
131 | CONFIG_CMA_SIZE_MBYTES=64 | 144 | CONFIG_CMA_SIZE_MBYTES=64 |
132 | CONFIG_OMAP_OCP2SCP=y | 145 | CONFIG_OMAP_OCP2SCP=y |
146 | CONFIG_SIMPLE_PM_BUS=y | ||
133 | CONFIG_MTD=y | 147 | CONFIG_MTD=y |
134 | CONFIG_MTD_CMDLINE_PARTS=y | 148 | CONFIG_MTD_CMDLINE_PARTS=y |
135 | CONFIG_MTD_BLOCK=y | 149 | CONFIG_MTD_BLOCK=y |
@@ -157,6 +171,7 @@ CONFIG_AHCI_SUNXI=y | |||
157 | CONFIG_AHCI_TEGRA=y | 171 | CONFIG_AHCI_TEGRA=y |
158 | CONFIG_SATA_HIGHBANK=y | 172 | CONFIG_SATA_HIGHBANK=y |
159 | CONFIG_SATA_MV=y | 173 | CONFIG_SATA_MV=y |
174 | CONFIG_SATA_RCAR=y | ||
160 | CONFIG_NETDEVICES=y | 175 | CONFIG_NETDEVICES=y |
161 | CONFIG_HIX5HD2_GMAC=y | 176 | CONFIG_HIX5HD2_GMAC=y |
162 | CONFIG_SUN4I_EMAC=y | 177 | CONFIG_SUN4I_EMAC=y |
@@ -167,14 +182,17 @@ CONFIG_MV643XX_ETH=y | |||
167 | CONFIG_MVNETA=y | 182 | CONFIG_MVNETA=y |
168 | CONFIG_KS8851=y | 183 | CONFIG_KS8851=y |
169 | CONFIG_R8169=y | 184 | CONFIG_R8169=y |
185 | CONFIG_SH_ETH=y | ||
170 | CONFIG_SMSC911X=y | 186 | CONFIG_SMSC911X=y |
171 | CONFIG_STMMAC_ETH=y | 187 | CONFIG_STMMAC_ETH=y |
172 | CONFIG_TI_CPSW=y | 188 | CONFIG_TI_CPSW=y |
173 | CONFIG_XILINX_EMACLITE=y | 189 | CONFIG_XILINX_EMACLITE=y |
174 | CONFIG_AT803X_PHY=y | 190 | CONFIG_AT803X_PHY=y |
175 | CONFIG_MARVELL_PHY=y | 191 | CONFIG_MARVELL_PHY=y |
192 | CONFIG_SMSC_PHY=y | ||
176 | CONFIG_BROADCOM_PHY=y | 193 | CONFIG_BROADCOM_PHY=y |
177 | CONFIG_ICPLUS_PHY=y | 194 | CONFIG_ICPLUS_PHY=y |
195 | CONFIG_MICREL_PHY=y | ||
178 | CONFIG_USB_PEGASUS=y | 196 | CONFIG_USB_PEGASUS=y |
179 | CONFIG_USB_USBNET=y | 197 | CONFIG_USB_USBNET=y |
180 | CONFIG_USB_NET_SMSC75XX=y | 198 | CONFIG_USB_NET_SMSC75XX=y |
@@ -192,15 +210,18 @@ CONFIG_KEYBOARD_CROS_EC=y | |||
192 | CONFIG_MOUSE_PS2_ELANTECH=y | 210 | CONFIG_MOUSE_PS2_ELANTECH=y |
193 | CONFIG_INPUT_TOUCHSCREEN=y | 211 | CONFIG_INPUT_TOUCHSCREEN=y |
194 | CONFIG_TOUCHSCREEN_ATMEL_MXT=y | 212 | CONFIG_TOUCHSCREEN_ATMEL_MXT=y |
213 | CONFIG_TOUCHSCREEN_ST1232=m | ||
195 | CONFIG_TOUCHSCREEN_STMPE=y | 214 | CONFIG_TOUCHSCREEN_STMPE=y |
196 | CONFIG_TOUCHSCREEN_SUN4I=y | 215 | CONFIG_TOUCHSCREEN_SUN4I=y |
197 | CONFIG_INPUT_MISC=y | 216 | CONFIG_INPUT_MISC=y |
198 | CONFIG_INPUT_MPU3050=y | 217 | CONFIG_INPUT_MPU3050=y |
199 | CONFIG_INPUT_AXP20X_PEK=y | 218 | CONFIG_INPUT_AXP20X_PEK=y |
219 | CONFIG_INPUT_ADXL34X=m | ||
200 | CONFIG_SERIO_AMBAKMI=y | 220 | CONFIG_SERIO_AMBAKMI=y |
201 | CONFIG_SERIAL_8250=y | 221 | CONFIG_SERIAL_8250=y |
202 | CONFIG_SERIAL_8250_CONSOLE=y | 222 | CONFIG_SERIAL_8250_CONSOLE=y |
203 | CONFIG_SERIAL_8250_DW=y | 223 | CONFIG_SERIAL_8250_DW=y |
224 | CONFIG_SERIAL_8250_EM=y | ||
204 | CONFIG_SERIAL_8250_MT6577=y | 225 | CONFIG_SERIAL_8250_MT6577=y |
205 | CONFIG_SERIAL_AMBA_PL011=y | 226 | CONFIG_SERIAL_AMBA_PL011=y |
206 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 227 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
@@ -213,6 +234,9 @@ CONFIG_SERIAL_SIRFSOC_CONSOLE=y | |||
213 | CONFIG_SERIAL_TEGRA=y | 234 | CONFIG_SERIAL_TEGRA=y |
214 | CONFIG_SERIAL_IMX=y | 235 | CONFIG_SERIAL_IMX=y |
215 | CONFIG_SERIAL_IMX_CONSOLE=y | 236 | CONFIG_SERIAL_IMX_CONSOLE=y |
237 | CONFIG_SERIAL_SH_SCI=y | ||
238 | CONFIG_SERIAL_SH_SCI_NR_UARTS=20 | ||
239 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | ||
216 | CONFIG_SERIAL_MSM=y | 240 | CONFIG_SERIAL_MSM=y |
217 | CONFIG_SERIAL_MSM_CONSOLE=y | 241 | CONFIG_SERIAL_MSM_CONSOLE=y |
218 | CONFIG_SERIAL_VT8500=y | 242 | CONFIG_SERIAL_VT8500=y |
@@ -233,19 +257,26 @@ CONFIG_I2C_MUX_PCA954x=y | |||
233 | CONFIG_I2C_MUX_PINCTRL=y | 257 | CONFIG_I2C_MUX_PINCTRL=y |
234 | CONFIG_I2C_CADENCE=y | 258 | CONFIG_I2C_CADENCE=y |
235 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | 259 | CONFIG_I2C_DESIGNWARE_PLATFORM=y |
260 | CONFIG_I2C_GPIO=m | ||
236 | CONFIG_I2C_EXYNOS5=y | 261 | CONFIG_I2C_EXYNOS5=y |
237 | CONFIG_I2C_MV64XXX=y | 262 | CONFIG_I2C_MV64XXX=y |
263 | CONFIG_I2C_RIIC=y | ||
238 | CONFIG_I2C_S3C2410=y | 264 | CONFIG_I2C_S3C2410=y |
265 | CONFIG_I2C_SH_MOBILE=y | ||
239 | CONFIG_I2C_SIRF=y | 266 | CONFIG_I2C_SIRF=y |
240 | CONFIG_I2C_TEGRA=y | ||
241 | CONFIG_I2C_ST=y | 267 | CONFIG_I2C_ST=y |
242 | CONFIG_SPI=y | 268 | CONFIG_I2C_TEGRA=y |
243 | CONFIG_I2C_XILINX=y | 269 | CONFIG_I2C_XILINX=y |
244 | CONFIG_SPI_DAVINCI=y | 270 | CONFIG_I2C_RCAR=y |
271 | CONFIG_SPI=y | ||
245 | CONFIG_SPI_CADENCE=y | 272 | CONFIG_SPI_CADENCE=y |
273 | CONFIG_SPI_DAVINCI=y | ||
246 | CONFIG_SPI_OMAP24XX=y | 274 | CONFIG_SPI_OMAP24XX=y |
247 | CONFIG_SPI_ORION=y | 275 | CONFIG_SPI_ORION=y |
248 | CONFIG_SPI_PL022=y | 276 | CONFIG_SPI_PL022=y |
277 | CONFIG_SPI_RSPI=y | ||
278 | CONFIG_SPI_SH_MSIOF=m | ||
279 | CONFIG_SPI_SH_HSPI=y | ||
249 | CONFIG_SPI_SIRF=y | 280 | CONFIG_SPI_SIRF=y |
250 | CONFIG_SPI_SUN4I=y | 281 | CONFIG_SPI_SUN4I=y |
251 | CONFIG_SPI_SUN6I=y | 282 | CONFIG_SPI_SUN6I=y |
@@ -259,12 +290,15 @@ CONFIG_PINCTRL_PALMAS=y | |||
259 | CONFIG_PINCTRL_APQ8084=y | 290 | CONFIG_PINCTRL_APQ8084=y |
260 | CONFIG_GPIO_SYSFS=y | 291 | CONFIG_GPIO_SYSFS=y |
261 | CONFIG_GPIO_GENERIC_PLATFORM=y | 292 | CONFIG_GPIO_GENERIC_PLATFORM=y |
262 | CONFIG_GPIO_DWAPB=y | ||
263 | CONFIG_GPIO_DAVINCI=y | 293 | CONFIG_GPIO_DAVINCI=y |
294 | CONFIG_GPIO_DWAPB=y | ||
295 | CONFIG_GPIO_EM=y | ||
296 | CONFIG_GPIO_RCAR=y | ||
264 | CONFIG_GPIO_XILINX=y | 297 | CONFIG_GPIO_XILINX=y |
265 | CONFIG_GPIO_ZYNQ=y | 298 | CONFIG_GPIO_ZYNQ=y |
266 | CONFIG_GPIO_PCA953X=y | 299 | CONFIG_GPIO_PCA953X=y |
267 | CONFIG_GPIO_PCA953X_IRQ=y | 300 | CONFIG_GPIO_PCA953X_IRQ=y |
301 | CONFIG_GPIO_PCF857X=y | ||
268 | CONFIG_GPIO_TWL4030=y | 302 | CONFIG_GPIO_TWL4030=y |
269 | CONFIG_GPIO_PALMAS=y | 303 | CONFIG_GPIO_PALMAS=y |
270 | CONFIG_GPIO_SYSCON=y | 304 | CONFIG_GPIO_SYSCON=y |
@@ -276,10 +310,12 @@ CONFIG_POWER_RESET_AS3722=y | |||
276 | CONFIG_POWER_RESET_GPIO=y | 310 | CONFIG_POWER_RESET_GPIO=y |
277 | CONFIG_POWER_RESET_KEYSTONE=y | 311 | CONFIG_POWER_RESET_KEYSTONE=y |
278 | CONFIG_POWER_RESET_SUN6I=y | 312 | CONFIG_POWER_RESET_SUN6I=y |
313 | CONFIG_POWER_RESET_RMOBILE=y | ||
279 | CONFIG_SENSORS_LM90=y | 314 | CONFIG_SENSORS_LM90=y |
280 | CONFIG_SENSORS_LM95245=y | 315 | CONFIG_SENSORS_LM95245=y |
281 | CONFIG_THERMAL=y | 316 | CONFIG_THERMAL=y |
282 | CONFIG_CPU_THERMAL=y | 317 | CONFIG_CPU_THERMAL=y |
318 | CONFIG_RCAR_THERMAL=y | ||
283 | CONFIG_ARMADA_THERMAL=y | 319 | CONFIG_ARMADA_THERMAL=y |
284 | CONFIG_DAVINCI_WATCHDOG | 320 | CONFIG_DAVINCI_WATCHDOG |
285 | CONFIG_ST_THERMAL_SYSCFG=y | 321 | CONFIG_ST_THERMAL_SYSCFG=y |
@@ -290,6 +326,7 @@ CONFIG_ARM_SP805_WATCHDOG=y | |||
290 | CONFIG_ORION_WATCHDOG=y | 326 | CONFIG_ORION_WATCHDOG=y |
291 | CONFIG_SUNXI_WATCHDOG=y | 327 | CONFIG_SUNXI_WATCHDOG=y |
292 | CONFIG_MESON_WATCHDOG=y | 328 | CONFIG_MESON_WATCHDOG=y |
329 | CONFIG_MFD_AS3711=y | ||
293 | CONFIG_MFD_AS3722=y | 330 | CONFIG_MFD_AS3722=y |
294 | CONFIG_MFD_BCM590XX=y | 331 | CONFIG_MFD_BCM590XX=y |
295 | CONFIG_MFD_AXP20X=y | 332 | CONFIG_MFD_AXP20X=y |
@@ -304,13 +341,16 @@ CONFIG_MFD_TPS65090=y | |||
304 | CONFIG_MFD_TPS6586X=y | 341 | CONFIG_MFD_TPS6586X=y |
305 | CONFIG_MFD_TPS65910=y | 342 | CONFIG_MFD_TPS65910=y |
306 | CONFIG_REGULATOR_AB8500=y | 343 | CONFIG_REGULATOR_AB8500=y |
344 | CONFIG_REGULATOR_AS3711=y | ||
307 | CONFIG_REGULATOR_AS3722=y | 345 | CONFIG_REGULATOR_AS3722=y |
308 | CONFIG_REGULATOR_AXP20X=y | 346 | CONFIG_REGULATOR_AXP20X=y |
309 | CONFIG_REGULATOR_BCM590XX=y | 347 | CONFIG_REGULATOR_BCM590XX=y |
348 | CONFIG_REGULATOR_DA9210=y | ||
310 | CONFIG_REGULATOR_GPIO=y | 349 | CONFIG_REGULATOR_GPIO=y |
311 | CONFIG_MFD_SYSCON=y | 350 | CONFIG_MFD_SYSCON=y |
312 | CONFIG_POWER_RESET_SYSCON=y | 351 | CONFIG_POWER_RESET_SYSCON=y |
313 | CONFIG_REGULATOR_MAX8907=y | 352 | CONFIG_REGULATOR_MAX8907=y |
353 | CONFIG_REGULATOR_MAX8973=y | ||
314 | CONFIG_REGULATOR_MAX77686=y | 354 | CONFIG_REGULATOR_MAX77686=y |
315 | CONFIG_REGULATOR_PALMAS=y | 355 | CONFIG_REGULATOR_PALMAS=y |
316 | CONFIG_REGULATOR_S2MPS11=y | 356 | CONFIG_REGULATOR_S2MPS11=y |
@@ -324,18 +364,32 @@ CONFIG_REGULATOR_TWL4030=y | |||
324 | CONFIG_REGULATOR_VEXPRESS=y | 364 | CONFIG_REGULATOR_VEXPRESS=y |
325 | CONFIG_MEDIA_SUPPORT=y | 365 | CONFIG_MEDIA_SUPPORT=y |
326 | CONFIG_MEDIA_CAMERA_SUPPORT=y | 366 | CONFIG_MEDIA_CAMERA_SUPPORT=y |
367 | CONFIG_MEDIA_CONTROLLER=y | ||
368 | CONFIG_VIDEO_V4L2_SUBDEV_API=y | ||
327 | CONFIG_MEDIA_USB_SUPPORT=y | 369 | CONFIG_MEDIA_USB_SUPPORT=y |
328 | CONFIG_USB_VIDEO_CLASS=y | 370 | CONFIG_USB_VIDEO_CLASS=y |
329 | CONFIG_USB_GSPCA=y | 371 | CONFIG_USB_GSPCA=y |
372 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
373 | CONFIG_SOC_CAMERA=m | ||
374 | CONFIG_SOC_CAMERA_PLATFORM=m | ||
375 | CONFIG_VIDEO_RCAR_VIN=m | ||
376 | CONFIG_V4L_MEM2MEM_DRIVERS=y | ||
377 | CONFIG_VIDEO_RENESAS_VSP1=m | ||
378 | # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set | ||
379 | CONFIG_VIDEO_ADV7180=m | ||
330 | CONFIG_DRM=y | 380 | CONFIG_DRM=y |
381 | CONFIG_DRM_RCAR_DU=m | ||
331 | CONFIG_DRM_TEGRA=y | 382 | CONFIG_DRM_TEGRA=y |
332 | CONFIG_DRM_PANEL_SIMPLE=y | 383 | CONFIG_DRM_PANEL_SIMPLE=y |
333 | CONFIG_FB_ARMCLCD=y | 384 | CONFIG_FB_ARMCLCD=y |
334 | CONFIG_FB_WM8505=y | 385 | CONFIG_FB_WM8505=y |
386 | CONFIG_FB_SH_MOBILE_LCDC=y | ||
335 | CONFIG_FB_SIMPLE=y | 387 | CONFIG_FB_SIMPLE=y |
388 | CONFIG_FB_SH_MOBILE_MERAM=y | ||
336 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 389 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
337 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 390 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
338 | CONFIG_BACKLIGHT_PWM=y | 391 | CONFIG_BACKLIGHT_PWM=y |
392 | CONFIG_BACKLIGHT_AS3711=y | ||
339 | CONFIG_FRAMEBUFFER_CONSOLE=y | 393 | CONFIG_FRAMEBUFFER_CONSOLE=y |
340 | CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y | 394 | CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y |
341 | CONFIG_SOUND=y | 395 | CONFIG_SOUND=y |
@@ -343,6 +397,8 @@ CONFIG_SND=y | |||
343 | CONFIG_SND_DYNAMIC_MINORS=y | 397 | CONFIG_SND_DYNAMIC_MINORS=y |
344 | CONFIG_SND_USB_AUDIO=y | 398 | CONFIG_SND_USB_AUDIO=y |
345 | CONFIG_SND_SOC=y | 399 | CONFIG_SND_SOC=y |
400 | CONFIG_SND_SOC_SH4_FSI=m | ||
401 | CONFIG_SND_SOC_RCAR=m | ||
346 | CONFIG_SND_SOC_TEGRA=y | 402 | CONFIG_SND_SOC_TEGRA=y |
347 | CONFIG_SND_SOC_TEGRA_RT5640=y | 403 | CONFIG_SND_SOC_TEGRA_RT5640=y |
348 | CONFIG_SND_SOC_TEGRA_WM8753=y | 404 | CONFIG_SND_SOC_TEGRA_WM8753=y |
@@ -350,6 +406,8 @@ CONFIG_SND_SOC_TEGRA_WM8903=y | |||
350 | CONFIG_SND_SOC_TEGRA_TRIMSLICE=y | 406 | CONFIG_SND_SOC_TEGRA_TRIMSLICE=y |
351 | CONFIG_SND_SOC_TEGRA_ALC5632=y | 407 | CONFIG_SND_SOC_TEGRA_ALC5632=y |
352 | CONFIG_SND_SOC_TEGRA_MAX98090=y | 408 | CONFIG_SND_SOC_TEGRA_MAX98090=y |
409 | CONFIG_SND_SOC_AK4642=m | ||
410 | CONFIG_SND_SOC_WM8978=m | ||
353 | CONFIG_USB=y | 411 | CONFIG_USB=y |
354 | CONFIG_USB_XHCI_HCD=y | 412 | CONFIG_USB_XHCI_HCD=y |
355 | CONFIG_USB_XHCI_MVEBU=y | 413 | CONFIG_USB_XHCI_MVEBU=y |
@@ -362,6 +420,8 @@ CONFIG_USB_ISP1760_HCD=y | |||
362 | CONFIG_USB_OHCI_HCD=y | 420 | CONFIG_USB_OHCI_HCD=y |
363 | CONFIG_USB_OHCI_HCD_STI=y | 421 | CONFIG_USB_OHCI_HCD_STI=y |
364 | CONFIG_USB_OHCI_HCD_PLATFORM=y | 422 | CONFIG_USB_OHCI_HCD_PLATFORM=y |
423 | CONFIG_USB_R8A66597_HCD=m | ||
424 | CONFIG_USB_RENESAS_USBHS=m | ||
365 | CONFIG_USB_STORAGE=y | 425 | CONFIG_USB_STORAGE=y |
366 | CONFIG_USB_DWC3=y | 426 | CONFIG_USB_DWC3=y |
367 | CONFIG_USB_CHIPIDEA=y | 427 | CONFIG_USB_CHIPIDEA=y |
@@ -374,6 +434,10 @@ CONFIG_SAMSUNG_USB3PHY=y | |||
374 | CONFIG_USB_GPIO_VBUS=y | 434 | CONFIG_USB_GPIO_VBUS=y |
375 | CONFIG_USB_ISP1301=y | 435 | CONFIG_USB_ISP1301=y |
376 | CONFIG_USB_MXS_PHY=y | 436 | CONFIG_USB_MXS_PHY=y |
437 | CONFIG_USB_RCAR_PHY=m | ||
438 | CONFIG_USB_RCAR_GEN2_PHY=m | ||
439 | CONFIG_USB_GADGET=y | ||
440 | CONFIG_USB_RENESAS_USBHS_UDC=m | ||
377 | CONFIG_MMC=y | 441 | CONFIG_MMC=y |
378 | CONFIG_MMC_BLOCK_MINORS=16 | 442 | CONFIG_MMC_BLOCK_MINORS=16 |
379 | CONFIG_MMC_ARMMMCI=y | 443 | CONFIG_MMC_ARMMMCI=y |
@@ -392,12 +456,14 @@ CONFIG_MMC_SDHCI_ST=y | |||
392 | CONFIG_MMC_OMAP=y | 456 | CONFIG_MMC_OMAP=y |
393 | CONFIG_MMC_OMAP_HS=y | 457 | CONFIG_MMC_OMAP_HS=y |
394 | CONFIG_MMC_MVSDIO=y | 458 | CONFIG_MMC_MVSDIO=y |
395 | CONFIG_MMC_SUNXI=y | 459 | CONFIG_MMC_SDHI=y |
396 | CONFIG_MMC_DW=y | 460 | CONFIG_MMC_DW=y |
397 | CONFIG_MMC_DW_IDMAC=y | 461 | CONFIG_MMC_DW_IDMAC=y |
398 | CONFIG_MMC_DW_PLTFM=y | 462 | CONFIG_MMC_DW_PLTFM=y |
399 | CONFIG_MMC_DW_EXYNOS=y | 463 | CONFIG_MMC_DW_EXYNOS=y |
400 | CONFIG_MMC_DW_ROCKCHIP=y | 464 | CONFIG_MMC_DW_ROCKCHIP=y |
465 | CONFIG_MMC_SH_MMCIF=y | ||
466 | CONFIG_MMC_SUNXI=y | ||
401 | CONFIG_NEW_LEDS=y | 467 | CONFIG_NEW_LEDS=y |
402 | CONFIG_LEDS_CLASS=y | 468 | CONFIG_LEDS_CLASS=y |
403 | CONFIG_LEDS_GPIO=y | 469 | CONFIG_LEDS_GPIO=y |
@@ -421,10 +487,12 @@ CONFIG_RTC_DRV_AS3722=y | |||
421 | CONFIG_RTC_DRV_DS1307=y | 487 | CONFIG_RTC_DRV_DS1307=y |
422 | CONFIG_RTC_DRV_MAX8907=y | 488 | CONFIG_RTC_DRV_MAX8907=y |
423 | CONFIG_RTC_DRV_MAX77686=y | 489 | CONFIG_RTC_DRV_MAX77686=y |
490 | CONFIG_RTC_DRV_RS5C372=m | ||
424 | CONFIG_RTC_DRV_PALMAS=y | 491 | CONFIG_RTC_DRV_PALMAS=y |
425 | CONFIG_RTC_DRV_TWL4030=y | 492 | CONFIG_RTC_DRV_TWL4030=y |
426 | CONFIG_RTC_DRV_TPS6586X=y | 493 | CONFIG_RTC_DRV_TPS6586X=y |
427 | CONFIG_RTC_DRV_TPS65910=y | 494 | CONFIG_RTC_DRV_TPS65910=y |
495 | CONFIG_RTC_DRV_S35390A=m | ||
428 | CONFIG_RTC_DRV_EM3027=y | 496 | CONFIG_RTC_DRV_EM3027=y |
429 | CONFIG_RTC_DRV_PL031=y | 497 | CONFIG_RTC_DRV_PL031=y |
430 | CONFIG_RTC_DRV_VT8500=y | 498 | CONFIG_RTC_DRV_VT8500=y |
@@ -436,6 +504,9 @@ CONFIG_DMADEVICES=y | |||
436 | CONFIG_DW_DMAC=y | 504 | CONFIG_DW_DMAC=y |
437 | CONFIG_MV_XOR=y | 505 | CONFIG_MV_XOR=y |
438 | CONFIG_TEGRA20_APB_DMA=y | 506 | CONFIG_TEGRA20_APB_DMA=y |
507 | CONFIG_SH_DMAE=y | ||
508 | CONFIG_RCAR_AUDMAC_PP=m | ||
509 | CONFIG_RCAR_DMAC=y | ||
439 | CONFIG_STE_DMA40=y | 510 | CONFIG_STE_DMA40=y |
440 | CONFIG_SIRF_DMA=y | 511 | CONFIG_SIRF_DMA=y |
441 | CONFIG_TI_EDMA=y | 512 | CONFIG_TI_EDMA=y |
@@ -468,6 +539,7 @@ CONFIG_IIO=y | |||
468 | CONFIG_XILINX_XADC=y | 539 | CONFIG_XILINX_XADC=y |
469 | CONFIG_AK8975=y | 540 | CONFIG_AK8975=y |
470 | CONFIG_PWM=y | 541 | CONFIG_PWM=y |
542 | CONFIG_PWM_RENESAS_TPU=y | ||
471 | CONFIG_PWM_TEGRA=y | 543 | CONFIG_PWM_TEGRA=y |
472 | CONFIG_PWM_VT8500=y | 544 | CONFIG_PWM_VT8500=y |
473 | CONFIG_PHY_HIX5HD2_SATA=y | 545 | CONFIG_PHY_HIX5HD2_SATA=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index b7386524c356..a097cffa1231 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -114,6 +114,7 @@ CONFIG_MTD_PHYSMAP_OF=y | |||
114 | CONFIG_MTD_NAND=y | 114 | CONFIG_MTD_NAND=y |
115 | CONFIG_MTD_NAND_ECC_BCH=y | 115 | CONFIG_MTD_NAND_ECC_BCH=y |
116 | CONFIG_MTD_NAND_OMAP2=y | 116 | CONFIG_MTD_NAND_OMAP2=y |
117 | CONFIG_MTD_NAND_OMAP_BCH=y | ||
117 | CONFIG_MTD_ONENAND=y | 118 | CONFIG_MTD_ONENAND=y |
118 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y | 119 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y |
119 | CONFIG_MTD_ONENAND_OMAP2=y | 120 | CONFIG_MTD_ONENAND_OMAP2=y |
@@ -248,6 +249,7 @@ CONFIG_TWL6040_CORE=y | |||
248 | CONFIG_REGULATOR_PALMAS=y | 249 | CONFIG_REGULATOR_PALMAS=y |
249 | CONFIG_REGULATOR_PBIAS=y | 250 | CONFIG_REGULATOR_PBIAS=y |
250 | CONFIG_REGULATOR_TI_ABB=y | 251 | CONFIG_REGULATOR_TI_ABB=y |
252 | CONFIG_REGULATOR_TPS62360=m | ||
251 | CONFIG_REGULATOR_TPS65023=y | 253 | CONFIG_REGULATOR_TPS65023=y |
252 | CONFIG_REGULATOR_TPS6507X=y | 254 | CONFIG_REGULATOR_TPS6507X=y |
253 | CONFIG_REGULATOR_TPS65217=y | 255 | CONFIG_REGULATOR_TPS65217=y |
@@ -374,7 +376,7 @@ CONFIG_PWM_TIEHRPWM=m | |||
374 | CONFIG_PWM_TWL=m | 376 | CONFIG_PWM_TWL=m |
375 | CONFIG_PWM_TWL_LED=m | 377 | CONFIG_PWM_TWL_LED=m |
376 | CONFIG_OMAP_USB2=m | 378 | CONFIG_OMAP_USB2=m |
377 | CONFIG_TI_PIPE3=m | 379 | CONFIG_TI_PIPE3=y |
378 | CONFIG_EXT2_FS=y | 380 | CONFIG_EXT2_FS=y |
379 | CONFIG_EXT3_FS=y | 381 | CONFIG_EXT3_FS=y |
380 | # CONFIG_EXT3_FS_XATTR is not set | 382 | # CONFIG_EXT3_FS_XATTR is not set |
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index 37ca2a4c6f09..bf0fe99e8ca9 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h | |||
@@ -207,7 +207,7 @@ static inline void __coherent_cache_guest_page(struct kvm_vcpu *vcpu, pfn_t pfn, | |||
207 | 207 | ||
208 | bool need_flush = !vcpu_has_cache_enabled(vcpu) || ipa_uncached; | 208 | bool need_flush = !vcpu_has_cache_enabled(vcpu) || ipa_uncached; |
209 | 209 | ||
210 | VM_BUG_ON(size & PAGE_MASK); | 210 | VM_BUG_ON(size & ~PAGE_MASK); |
211 | 211 | ||
212 | if (!need_flush && !icache_is_pipt()) | 212 | if (!need_flush && !icache_is_pipt()) |
213 | goto vipt_cache; | 213 | goto vipt_cache; |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 07e7eb1d7ab6..5560f74f9eee 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -540,7 +540,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
540 | 540 | ||
541 | vcpu->mode = OUTSIDE_GUEST_MODE; | 541 | vcpu->mode = OUTSIDE_GUEST_MODE; |
542 | kvm_guest_exit(); | 542 | kvm_guest_exit(); |
543 | trace_kvm_exit(*vcpu_pc(vcpu)); | 543 | trace_kvm_exit(kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); |
544 | /* | 544 | /* |
545 | * We may have taken a host interrupt in HYP mode (ie | 545 | * We may have taken a host interrupt in HYP mode (ie |
546 | * while executing the guest). This interrupt is still | 546 | * while executing the guest). This interrupt is still |
diff --git a/arch/arm/kvm/trace.h b/arch/arm/kvm/trace.h index 881874b1a036..6817664b46b8 100644 --- a/arch/arm/kvm/trace.h +++ b/arch/arm/kvm/trace.h | |||
@@ -25,18 +25,22 @@ TRACE_EVENT(kvm_entry, | |||
25 | ); | 25 | ); |
26 | 26 | ||
27 | TRACE_EVENT(kvm_exit, | 27 | TRACE_EVENT(kvm_exit, |
28 | TP_PROTO(unsigned long vcpu_pc), | 28 | TP_PROTO(unsigned int exit_reason, unsigned long vcpu_pc), |
29 | TP_ARGS(vcpu_pc), | 29 | TP_ARGS(exit_reason, vcpu_pc), |
30 | 30 | ||
31 | TP_STRUCT__entry( | 31 | TP_STRUCT__entry( |
32 | __field( unsigned int, exit_reason ) | ||
32 | __field( unsigned long, vcpu_pc ) | 33 | __field( unsigned long, vcpu_pc ) |
33 | ), | 34 | ), |
34 | 35 | ||
35 | TP_fast_assign( | 36 | TP_fast_assign( |
37 | __entry->exit_reason = exit_reason; | ||
36 | __entry->vcpu_pc = vcpu_pc; | 38 | __entry->vcpu_pc = vcpu_pc; |
37 | ), | 39 | ), |
38 | 40 | ||
39 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) | 41 | TP_printk("HSR_EC: 0x%04x, PC: 0x%08lx", |
42 | __entry->exit_reason, | ||
43 | __entry->vcpu_pc) | ||
40 | ); | 44 | ); |
41 | 45 | ||
42 | TRACE_EVENT(kvm_guest_fault, | 46 | TRACE_EVENT(kvm_guest_fault, |
diff --git a/arch/arm/mach-asm9260/Kconfig b/arch/arm/mach-asm9260/Kconfig index 8423be76080e..52241207a82a 100644 --- a/arch/arm/mach-asm9260/Kconfig +++ b/arch/arm/mach-asm9260/Kconfig | |||
@@ -2,5 +2,7 @@ config MACH_ASM9260 | |||
2 | bool "Alphascale ASM9260" | 2 | bool "Alphascale ASM9260" |
3 | depends on ARCH_MULTI_V5 | 3 | depends on ARCH_MULTI_V5 |
4 | select CPU_ARM926T | 4 | select CPU_ARM926T |
5 | select ASM9260_TIMER | ||
6 | select GENERIC_CLOCKEVENTS | ||
5 | help | 7 | help |
6 | Support for Alphascale ASM9260 based platform. | 8 | Support for Alphascale ASM9260 based platform. |
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index 61bfe584a9d7..fc832040c6e9 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/input.h> | 20 | #include <linux/input.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/smc91x.h> | ||
23 | 24 | ||
24 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
25 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
@@ -46,15 +47,20 @@ static struct resource smc91x_resources[] = { | |||
46 | [1] = { | 47 | [1] = { |
47 | .start = MSM_GPIO_TO_INT(49), | 48 | .start = MSM_GPIO_TO_INT(49), |
48 | .end = MSM_GPIO_TO_INT(49), | 49 | .end = MSM_GPIO_TO_INT(49), |
49 | .flags = IORESOURCE_IRQ, | 50 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
50 | }, | 51 | }, |
51 | }; | 52 | }; |
52 | 53 | ||
54 | static struct smc91x_platdata smc91x_platdata = { | ||
55 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | ||
56 | }; | ||
57 | |||
53 | static struct platform_device smc91x_device = { | 58 | static struct platform_device smc91x_device = { |
54 | .name = "smc91x", | 59 | .name = "smc91x", |
55 | .id = 0, | 60 | .id = 0, |
56 | .num_resources = ARRAY_SIZE(smc91x_resources), | 61 | .num_resources = ARRAY_SIZE(smc91x_resources), |
57 | .resource = smc91x_resources, | 62 | .resource = smc91x_resources, |
63 | .dev.platform_data = &smc91x_platdata, | ||
58 | }; | 64 | }; |
59 | 65 | ||
60 | static struct platform_device *devices[] __initdata = { | 66 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c index 4c748616ef47..10016a3bc698 100644 --- a/arch/arm/mach-msm/board-qsd8x50.c +++ b/arch/arm/mach-msm/board-qsd8x50.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/usb/msm_hsusb.h> | 22 | #include <linux/usb/msm_hsusb.h> |
23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
24 | #include <linux/clkdev.h> | 24 | #include <linux/clkdev.h> |
25 | #include <linux/smc91x.h> | ||
25 | 26 | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
@@ -49,15 +50,20 @@ static struct resource smc91x_resources[] = { | |||
49 | .flags = IORESOURCE_MEM, | 50 | .flags = IORESOURCE_MEM, |
50 | }, | 51 | }, |
51 | [1] = { | 52 | [1] = { |
52 | .flags = IORESOURCE_IRQ, | 53 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
53 | }, | 54 | }, |
54 | }; | 55 | }; |
55 | 56 | ||
57 | static struct smc91x_platdata smc91x_platdata = { | ||
58 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | ||
59 | }; | ||
60 | |||
56 | static struct platform_device smc91x_device = { | 61 | static struct platform_device smc91x_device = { |
57 | .name = "smc91x", | 62 | .name = "smc91x", |
58 | .id = 0, | 63 | .id = 0, |
59 | .num_resources = ARRAY_SIZE(smc91x_resources), | 64 | .num_resources = ARRAY_SIZE(smc91x_resources), |
60 | .resource = smc91x_resources, | 65 | .resource = smc91x_resources, |
66 | .dev.platform_data = &smc91x_platdata, | ||
61 | }; | 67 | }; |
62 | 68 | ||
63 | static int __init msm_init_smc91x(void) | 69 | static int __init msm_init_smc91x(void) |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 343c4e3a7c5d..7d8eab857a93 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -81,11 +81,16 @@ static struct resource smc91x_resources[] = { | |||
81 | } | 81 | } |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static struct smc91x_platdata smc91x_platdata = { | ||
85 | .flags = SMC91X_USE_32BIT | SMC91X_USE_DMA | SMC91X_NOWAIT, | ||
86 | }; | ||
87 | |||
84 | static struct platform_device smc91x_device = { | 88 | static struct platform_device smc91x_device = { |
85 | .name = "smc91x", | 89 | .name = "smc91x", |
86 | .id = 0, | 90 | .id = 0, |
87 | .num_resources = ARRAY_SIZE(smc91x_resources), | 91 | .num_resources = ARRAY_SIZE(smc91x_resources), |
88 | .resource = smc91x_resources, | 92 | .resource = smc91x_resources, |
93 | .dev.platform_data = &smc91x_platdata, | ||
89 | }; | 94 | }; |
90 | 95 | ||
91 | static void idp_backlight_power(int on) | 96 | static void idp_backlight_power(int on) |
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c index ad777b353bd5..28da319d389f 100644 --- a/arch/arm/mach-pxa/lpd270.c +++ b/arch/arm/mach-pxa/lpd270.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/pwm_backlight.h> | 26 | #include <linux/pwm_backlight.h> |
27 | #include <linux/smc91x.h> | ||
27 | 28 | ||
28 | #include <asm/types.h> | 29 | #include <asm/types.h> |
29 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
@@ -189,15 +190,20 @@ static struct resource smc91x_resources[] = { | |||
189 | [1] = { | 190 | [1] = { |
190 | .start = LPD270_ETHERNET_IRQ, | 191 | .start = LPD270_ETHERNET_IRQ, |
191 | .end = LPD270_ETHERNET_IRQ, | 192 | .end = LPD270_ETHERNET_IRQ, |
192 | .flags = IORESOURCE_IRQ, | 193 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
193 | }, | 194 | }, |
194 | }; | 195 | }; |
195 | 196 | ||
197 | struct smc91x_platdata smc91x_platdata = { | ||
198 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT; | ||
199 | }; | ||
200 | |||
196 | static struct platform_device smc91x_device = { | 201 | static struct platform_device smc91x_device = { |
197 | .name = "smc91x", | 202 | .name = "smc91x", |
198 | .id = 0, | 203 | .id = 0, |
199 | .num_resources = ARRAY_SIZE(smc91x_resources), | 204 | .num_resources = ARRAY_SIZE(smc91x_resources), |
200 | .resource = smc91x_resources, | 205 | .resource = smc91x_resources, |
206 | .dev.platform_data = &smc91x_platdata, | ||
201 | }; | 207 | }; |
202 | 208 | ||
203 | static struct resource lpd270_flash_resources[] = { | 209 | static struct resource lpd270_flash_resources[] = { |
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 850e506926df..c309593abdb2 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/platform_data/video-clcd-versatile.h> | 28 | #include <linux/platform_data/video-clcd-versatile.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/smsc911x.h> | 30 | #include <linux/smsc911x.h> |
31 | #include <linux/smc91x.h> | ||
31 | #include <linux/ata_platform.h> | 32 | #include <linux/ata_platform.h> |
32 | #include <linux/amba/mmci.h> | 33 | #include <linux/amba/mmci.h> |
33 | #include <linux/gfp.h> | 34 | #include <linux/gfp.h> |
@@ -94,6 +95,10 @@ static struct smsc911x_platform_config smsc911x_config = { | |||
94 | .phy_interface = PHY_INTERFACE_MODE_MII, | 95 | .phy_interface = PHY_INTERFACE_MODE_MII, |
95 | }; | 96 | }; |
96 | 97 | ||
98 | static struct smc91x_platdata smc91x_platdata = { | ||
99 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, | ||
100 | }; | ||
101 | |||
97 | static struct platform_device realview_eth_device = { | 102 | static struct platform_device realview_eth_device = { |
98 | .name = "smsc911x", | 103 | .name = "smsc911x", |
99 | .id = 0, | 104 | .id = 0, |
@@ -107,6 +112,8 @@ int realview_eth_register(const char *name, struct resource *res) | |||
107 | realview_eth_device.resource = res; | 112 | realview_eth_device.resource = res; |
108 | if (strcmp(realview_eth_device.name, "smsc911x") == 0) | 113 | if (strcmp(realview_eth_device.name, "smsc911x") == 0) |
109 | realview_eth_device.dev.platform_data = &smsc911x_config; | 114 | realview_eth_device.dev.platform_data = &smsc911x_config; |
115 | else | ||
116 | realview_eth_device.dev.platform_data = &smc91x_platdata; | ||
110 | 117 | ||
111 | return platform_device_register(&realview_eth_device); | 118 | return platform_device_register(&realview_eth_device); |
112 | } | 119 | } |
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 64c88d657f9e..b3869cbbcc68 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -234,7 +234,7 @@ static struct resource realview_eb_eth_resources[] = { | |||
234 | [1] = { | 234 | [1] = { |
235 | .start = IRQ_EB_ETH, | 235 | .start = IRQ_EB_ETH, |
236 | .end = IRQ_EB_ETH, | 236 | .end = IRQ_EB_ETH, |
237 | .flags = IORESOURCE_IRQ, | 237 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
238 | }, | 238 | }, |
239 | }; | 239 | }; |
240 | 240 | ||
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c index 169262e3040d..7b0cd3172354 100644 --- a/arch/arm/mach-sa1100/neponset.c +++ b/arch/arm/mach-sa1100/neponset.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
13 | #include <linux/serial_core.h> | 13 | #include <linux/serial_core.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/smc91x.h> | ||
15 | 16 | ||
16 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
17 | #include <asm/mach/map.h> | 18 | #include <asm/mach/map.h> |
@@ -258,12 +259,17 @@ static int neponset_probe(struct platform_device *dev) | |||
258 | 0x02000000, "smc91x-attrib"), | 259 | 0x02000000, "smc91x-attrib"), |
259 | { .flags = IORESOURCE_IRQ }, | 260 | { .flags = IORESOURCE_IRQ }, |
260 | }; | 261 | }; |
262 | struct smc91x_platdata smc91x_platdata = { | ||
263 | .flags = SMC91X_USE_8BIT | SMC91X_IO_SHIFT_2 | SMC91X_NOWAIT, | ||
264 | }; | ||
261 | struct platform_device_info smc91x_devinfo = { | 265 | struct platform_device_info smc91x_devinfo = { |
262 | .parent = &dev->dev, | 266 | .parent = &dev->dev, |
263 | .name = "smc91x", | 267 | .name = "smc91x", |
264 | .id = 0, | 268 | .id = 0, |
265 | .res = smc91x_resources, | 269 | .res = smc91x_resources, |
266 | .num_res = ARRAY_SIZE(smc91x_resources), | 270 | .num_res = ARRAY_SIZE(smc91x_resources), |
271 | .data = &smc91c_platdata, | ||
272 | .size_data = sizeof(smc91c_platdata), | ||
267 | }; | 273 | }; |
268 | int ret, irq; | 274 | int ret, irq; |
269 | 275 | ||
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c index 091261878eff..696fd0fe4806 100644 --- a/arch/arm/mach-sa1100/pleb.c +++ b/arch/arm/mach-sa1100/pleb.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/mtd/partitions.h> | 13 | #include <linux/mtd/partitions.h> |
14 | #include <linux/smc91x.h> | ||
14 | 15 | ||
15 | #include <mach/hardware.h> | 16 | #include <mach/hardware.h> |
16 | #include <asm/setup.h> | 17 | #include <asm/setup.h> |
@@ -43,12 +44,18 @@ static struct resource smc91x_resources[] = { | |||
43 | #endif | 44 | #endif |
44 | }; | 45 | }; |
45 | 46 | ||
47 | static struct smc91x_platdata smc91x_platdata = { | ||
48 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | ||
49 | }; | ||
46 | 50 | ||
47 | static struct platform_device smc91x_device = { | 51 | static struct platform_device smc91x_device = { |
48 | .name = "smc91x", | 52 | .name = "smc91x", |
49 | .id = 0, | 53 | .id = 0, |
50 | .num_resources = ARRAY_SIZE(smc91x_resources), | 54 | .num_resources = ARRAY_SIZE(smc91x_resources), |
51 | .resource = smc91x_resources, | 55 | .resource = smc91x_resources, |
56 | .dev = { | ||
57 | .platform_data = &smc91c_platdata, | ||
58 | }, | ||
52 | }; | 59 | }; |
53 | 60 | ||
54 | static struct platform_device *devices[] __initdata = { | 61 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm64/boot/dts/arm/foundation-v8.dts b/arch/arm64/boot/dts/arm/foundation-v8.dts index 27f32962e55c..4eac8dcea423 100644 --- a/arch/arm64/boot/dts/arm/foundation-v8.dts +++ b/arch/arm64/boot/dts/arm/foundation-v8.dts | |||
@@ -34,6 +34,7 @@ | |||
34 | reg = <0x0 0x0>; | 34 | reg = <0x0 0x0>; |
35 | enable-method = "spin-table"; | 35 | enable-method = "spin-table"; |
36 | cpu-release-addr = <0x0 0x8000fff8>; | 36 | cpu-release-addr = <0x0 0x8000fff8>; |
37 | next-level-cache = <&L2_0>; | ||
37 | }; | 38 | }; |
38 | cpu@1 { | 39 | cpu@1 { |
39 | device_type = "cpu"; | 40 | device_type = "cpu"; |
@@ -41,6 +42,7 @@ | |||
41 | reg = <0x0 0x1>; | 42 | reg = <0x0 0x1>; |
42 | enable-method = "spin-table"; | 43 | enable-method = "spin-table"; |
43 | cpu-release-addr = <0x0 0x8000fff8>; | 44 | cpu-release-addr = <0x0 0x8000fff8>; |
45 | next-level-cache = <&L2_0>; | ||
44 | }; | 46 | }; |
45 | cpu@2 { | 47 | cpu@2 { |
46 | device_type = "cpu"; | 48 | device_type = "cpu"; |
@@ -48,6 +50,7 @@ | |||
48 | reg = <0x0 0x2>; | 50 | reg = <0x0 0x2>; |
49 | enable-method = "spin-table"; | 51 | enable-method = "spin-table"; |
50 | cpu-release-addr = <0x0 0x8000fff8>; | 52 | cpu-release-addr = <0x0 0x8000fff8>; |
53 | next-level-cache = <&L2_0>; | ||
51 | }; | 54 | }; |
52 | cpu@3 { | 55 | cpu@3 { |
53 | device_type = "cpu"; | 56 | device_type = "cpu"; |
@@ -55,6 +58,11 @@ | |||
55 | reg = <0x0 0x3>; | 58 | reg = <0x0 0x3>; |
56 | enable-method = "spin-table"; | 59 | enable-method = "spin-table"; |
57 | cpu-release-addr = <0x0 0x8000fff8>; | 60 | cpu-release-addr = <0x0 0x8000fff8>; |
61 | next-level-cache = <&L2_0>; | ||
62 | }; | ||
63 | |||
64 | L2_0: l2-cache0 { | ||
65 | compatible = "cache"; | ||
58 | }; | 66 | }; |
59 | }; | 67 | }; |
60 | 68 | ||
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts index d429129ecb3d..133ee59de2d7 100644 --- a/arch/arm64/boot/dts/arm/juno.dts +++ b/arch/arm64/boot/dts/arm/juno.dts | |||
@@ -39,6 +39,7 @@ | |||
39 | reg = <0x0 0x0>; | 39 | reg = <0x0 0x0>; |
40 | device_type = "cpu"; | 40 | device_type = "cpu"; |
41 | enable-method = "psci"; | 41 | enable-method = "psci"; |
42 | next-level-cache = <&A57_L2>; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | A57_1: cpu@1 { | 45 | A57_1: cpu@1 { |
@@ -46,6 +47,7 @@ | |||
46 | reg = <0x0 0x1>; | 47 | reg = <0x0 0x1>; |
47 | device_type = "cpu"; | 48 | device_type = "cpu"; |
48 | enable-method = "psci"; | 49 | enable-method = "psci"; |
50 | next-level-cache = <&A57_L2>; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | A53_0: cpu@100 { | 53 | A53_0: cpu@100 { |
@@ -53,6 +55,7 @@ | |||
53 | reg = <0x0 0x100>; | 55 | reg = <0x0 0x100>; |
54 | device_type = "cpu"; | 56 | device_type = "cpu"; |
55 | enable-method = "psci"; | 57 | enable-method = "psci"; |
58 | next-level-cache = <&A53_L2>; | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | A53_1: cpu@101 { | 61 | A53_1: cpu@101 { |
@@ -60,6 +63,7 @@ | |||
60 | reg = <0x0 0x101>; | 63 | reg = <0x0 0x101>; |
61 | device_type = "cpu"; | 64 | device_type = "cpu"; |
62 | enable-method = "psci"; | 65 | enable-method = "psci"; |
66 | next-level-cache = <&A53_L2>; | ||
63 | }; | 67 | }; |
64 | 68 | ||
65 | A53_2: cpu@102 { | 69 | A53_2: cpu@102 { |
@@ -67,6 +71,7 @@ | |||
67 | reg = <0x0 0x102>; | 71 | reg = <0x0 0x102>; |
68 | device_type = "cpu"; | 72 | device_type = "cpu"; |
69 | enable-method = "psci"; | 73 | enable-method = "psci"; |
74 | next-level-cache = <&A53_L2>; | ||
70 | }; | 75 | }; |
71 | 76 | ||
72 | A53_3: cpu@103 { | 77 | A53_3: cpu@103 { |
@@ -74,6 +79,15 @@ | |||
74 | reg = <0x0 0x103>; | 79 | reg = <0x0 0x103>; |
75 | device_type = "cpu"; | 80 | device_type = "cpu"; |
76 | enable-method = "psci"; | 81 | enable-method = "psci"; |
82 | next-level-cache = <&A53_L2>; | ||
83 | }; | ||
84 | |||
85 | A57_L2: l2-cache0 { | ||
86 | compatible = "cache"; | ||
87 | }; | ||
88 | |||
89 | A53_L2: l2-cache1 { | ||
90 | compatible = "cache"; | ||
77 | }; | 91 | }; |
78 | }; | 92 | }; |
79 | 93 | ||
diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts index efc59b3baf63..20addabbd127 100644 --- a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts +++ b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts | |||
@@ -37,6 +37,7 @@ | |||
37 | reg = <0x0 0x0>; | 37 | reg = <0x0 0x0>; |
38 | enable-method = "spin-table"; | 38 | enable-method = "spin-table"; |
39 | cpu-release-addr = <0x0 0x8000fff8>; | 39 | cpu-release-addr = <0x0 0x8000fff8>; |
40 | next-level-cache = <&L2_0>; | ||
40 | }; | 41 | }; |
41 | cpu@1 { | 42 | cpu@1 { |
42 | device_type = "cpu"; | 43 | device_type = "cpu"; |
@@ -44,6 +45,7 @@ | |||
44 | reg = <0x0 0x1>; | 45 | reg = <0x0 0x1>; |
45 | enable-method = "spin-table"; | 46 | enable-method = "spin-table"; |
46 | cpu-release-addr = <0x0 0x8000fff8>; | 47 | cpu-release-addr = <0x0 0x8000fff8>; |
48 | next-level-cache = <&L2_0>; | ||
47 | }; | 49 | }; |
48 | cpu@2 { | 50 | cpu@2 { |
49 | device_type = "cpu"; | 51 | device_type = "cpu"; |
@@ -51,6 +53,7 @@ | |||
51 | reg = <0x0 0x2>; | 53 | reg = <0x0 0x2>; |
52 | enable-method = "spin-table"; | 54 | enable-method = "spin-table"; |
53 | cpu-release-addr = <0x0 0x8000fff8>; | 55 | cpu-release-addr = <0x0 0x8000fff8>; |
56 | next-level-cache = <&L2_0>; | ||
54 | }; | 57 | }; |
55 | cpu@3 { | 58 | cpu@3 { |
56 | device_type = "cpu"; | 59 | device_type = "cpu"; |
@@ -58,6 +61,11 @@ | |||
58 | reg = <0x0 0x3>; | 61 | reg = <0x0 0x3>; |
59 | enable-method = "spin-table"; | 62 | enable-method = "spin-table"; |
60 | cpu-release-addr = <0x0 0x8000fff8>; | 63 | cpu-release-addr = <0x0 0x8000fff8>; |
64 | next-level-cache = <&L2_0>; | ||
65 | }; | ||
66 | |||
67 | L2_0: l2-cache0 { | ||
68 | compatible = "cache"; | ||
61 | }; | 69 | }; |
62 | }; | 70 | }; |
63 | 71 | ||
diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile index 5720608c50b1..abb79b3cfcfe 100644 --- a/arch/arm64/crypto/Makefile +++ b/arch/arm64/crypto/Makefile | |||
@@ -29,7 +29,7 @@ aes-ce-blk-y := aes-glue-ce.o aes-ce.o | |||
29 | obj-$(CONFIG_CRYPTO_AES_ARM64_NEON_BLK) += aes-neon-blk.o | 29 | obj-$(CONFIG_CRYPTO_AES_ARM64_NEON_BLK) += aes-neon-blk.o |
30 | aes-neon-blk-y := aes-glue-neon.o aes-neon.o | 30 | aes-neon-blk-y := aes-glue-neon.o aes-neon.o |
31 | 31 | ||
32 | AFLAGS_aes-ce.o := -DINTERLEAVE=2 -DINTERLEAVE_INLINE | 32 | AFLAGS_aes-ce.o := -DINTERLEAVE=4 |
33 | AFLAGS_aes-neon.o := -DINTERLEAVE=4 | 33 | AFLAGS_aes-neon.o := -DINTERLEAVE=4 |
34 | 34 | ||
35 | CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS | 35 | CFLAGS_aes-glue-ce.o := -DUSE_V8_CRYPTO_EXTENSIONS |
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 5901480bfdca..750bac4e637e 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h | |||
@@ -20,6 +20,9 @@ | |||
20 | #error "Only include this from assembly code" | 20 | #error "Only include this from assembly code" |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifndef __ASM_ASSEMBLER_H | ||
24 | #define __ASM_ASSEMBLER_H | ||
25 | |||
23 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
24 | #include <asm/thread_info.h> | 27 | #include <asm/thread_info.h> |
25 | 28 | ||
@@ -155,3 +158,5 @@ lr .req x30 // link register | |||
155 | #endif | 158 | #endif |
156 | orr \rd, \lbits, \hbits, lsl #32 | 159 | orr \rd, \lbits, \hbits, lsl #32 |
157 | .endm | 160 | .endm |
161 | |||
162 | #endif /* __ASM_ASSEMBLER_H */ | ||
diff --git a/arch/arm64/include/asm/cpuidle.h b/arch/arm64/include/asm/cpuidle.h index 0710654631e7..c60643f14cda 100644 --- a/arch/arm64/include/asm/cpuidle.h +++ b/arch/arm64/include/asm/cpuidle.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __ASM_CPUIDLE_H | 1 | #ifndef __ASM_CPUIDLE_H |
2 | #define __ASM_CPUIDLE_H | 2 | #define __ASM_CPUIDLE_H |
3 | 3 | ||
4 | #include <asm/proc-fns.h> | ||
5 | |||
4 | #ifdef CONFIG_CPU_IDLE | 6 | #ifdef CONFIG_CPU_IDLE |
5 | extern int cpu_init_idle(unsigned int cpu); | 7 | extern int cpu_init_idle(unsigned int cpu); |
6 | extern int cpu_suspend(unsigned long arg); | 8 | extern int cpu_suspend(unsigned long arg); |
diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h index e2ff32a93b5c..d2f49423c5dc 100644 --- a/arch/arm64/include/asm/insn.h +++ b/arch/arm64/include/asm/insn.h | |||
@@ -264,8 +264,10 @@ __AARCH64_INSN_FUNCS(ands, 0x7F200000, 0x6A000000) | |||
264 | __AARCH64_INSN_FUNCS(bics, 0x7F200000, 0x6A200000) | 264 | __AARCH64_INSN_FUNCS(bics, 0x7F200000, 0x6A200000) |
265 | __AARCH64_INSN_FUNCS(b, 0xFC000000, 0x14000000) | 265 | __AARCH64_INSN_FUNCS(b, 0xFC000000, 0x14000000) |
266 | __AARCH64_INSN_FUNCS(bl, 0xFC000000, 0x94000000) | 266 | __AARCH64_INSN_FUNCS(bl, 0xFC000000, 0x94000000) |
267 | __AARCH64_INSN_FUNCS(cbz, 0xFE000000, 0x34000000) | 267 | __AARCH64_INSN_FUNCS(cbz, 0x7F000000, 0x34000000) |
268 | __AARCH64_INSN_FUNCS(cbnz, 0xFE000000, 0x35000000) | 268 | __AARCH64_INSN_FUNCS(cbnz, 0x7F000000, 0x35000000) |
269 | __AARCH64_INSN_FUNCS(tbz, 0x7F000000, 0x36000000) | ||
270 | __AARCH64_INSN_FUNCS(tbnz, 0x7F000000, 0x37000000) | ||
269 | __AARCH64_INSN_FUNCS(bcond, 0xFF000010, 0x54000000) | 271 | __AARCH64_INSN_FUNCS(bcond, 0xFF000010, 0x54000000) |
270 | __AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001) | 272 | __AARCH64_INSN_FUNCS(svc, 0xFFE0001F, 0xD4000001) |
271 | __AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002) | 273 | __AARCH64_INSN_FUNCS(hvc, 0xFFE0001F, 0xD4000002) |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 16449c535e50..800ec0e87ed9 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -460,7 +460,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long addr) | |||
460 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 460 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
461 | { | 461 | { |
462 | const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | | 462 | const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | |
463 | PTE_PROT_NONE | PTE_VALID | PTE_WRITE; | 463 | PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK; |
464 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); | 464 | pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); |
465 | return pte; | 465 | return pte; |
466 | } | 466 | } |
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index f9be30ea1cbd..20e9591a60cf 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h | |||
@@ -45,7 +45,8 @@ | |||
45 | #define STACK_TOP STACK_TOP_MAX | 45 | #define STACK_TOP STACK_TOP_MAX |
46 | #endif /* CONFIG_COMPAT */ | 46 | #endif /* CONFIG_COMPAT */ |
47 | 47 | ||
48 | #define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK | 48 | extern phys_addr_t arm64_dma_phys_limit; |
49 | #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) | ||
49 | #endif /* __KERNEL__ */ | 50 | #endif /* __KERNEL__ */ |
50 | 51 | ||
51 | struct debug_info { | 52 | struct debug_info { |
diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 73f0ce570fb3..4abe9b945f77 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h | |||
@@ -24,11 +24,6 @@ | |||
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <asm/cputype.h> | 25 | #include <asm/cputype.h> |
26 | 26 | ||
27 | extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long, struct vm_area_struct *); | ||
28 | extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long); | ||
29 | |||
30 | extern struct cpu_tlb_fns cpu_tlb; | ||
31 | |||
32 | /* | 27 | /* |
33 | * TLB Management | 28 | * TLB Management |
34 | * ============== | 29 | * ============== |
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index bef04afd6031..5ee07eee80c2 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile | |||
@@ -15,8 +15,9 @@ CFLAGS_REMOVE_return_address.o = -pg | |||
15 | arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \ | 15 | arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \ |
16 | entry-fpsimd.o process.o ptrace.o setup.o signal.o \ | 16 | entry-fpsimd.o process.o ptrace.o setup.o signal.o \ |
17 | sys.o stacktrace.o time.o traps.o io.o vdso.o \ | 17 | sys.o stacktrace.o time.o traps.o io.o vdso.o \ |
18 | hyp-stub.o psci.o cpu_ops.o insn.o return_address.o \ | 18 | hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \ |
19 | cpuinfo.o cpu_errata.o alternative.o cacheinfo.o | 19 | return_address.o cpuinfo.o cpu_errata.o \ |
20 | alternative.o cacheinfo.o | ||
20 | 21 | ||
21 | arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ | 22 | arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ |
22 | sys_compat.o entry32.o \ | 23 | sys_compat.o entry32.o \ |
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index cf8556ae09d0..c851be795080 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c | |||
@@ -156,7 +156,7 @@ static int ftrace_modify_graph_caller(bool enable) | |||
156 | 156 | ||
157 | branch = aarch64_insn_gen_branch_imm(pc, | 157 | branch = aarch64_insn_gen_branch_imm(pc, |
158 | (unsigned long)ftrace_graph_caller, | 158 | (unsigned long)ftrace_graph_caller, |
159 | AARCH64_INSN_BRANCH_LINK); | 159 | AARCH64_INSN_BRANCH_NOLINK); |
160 | nop = aarch64_insn_gen_nop(); | 160 | nop = aarch64_insn_gen_nop(); |
161 | 161 | ||
162 | if (enable) | 162 | if (enable) |
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index 27d4864577e5..c8eca88f12e6 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c | |||
@@ -87,8 +87,10 @@ static void __kprobes *patch_map(void *addr, int fixmap) | |||
87 | 87 | ||
88 | if (module && IS_ENABLED(CONFIG_DEBUG_SET_MODULE_RONX)) | 88 | if (module && IS_ENABLED(CONFIG_DEBUG_SET_MODULE_RONX)) |
89 | page = vmalloc_to_page(addr); | 89 | page = vmalloc_to_page(addr); |
90 | else | 90 | else if (!module && IS_ENABLED(CONFIG_DEBUG_RODATA)) |
91 | page = virt_to_page(addr); | 91 | page = virt_to_page(addr); |
92 | else | ||
93 | return addr; | ||
92 | 94 | ||
93 | BUG_ON(!page); | 95 | BUG_ON(!page); |
94 | set_fixmap(fixmap, page_to_phys(page)); | 96 | set_fixmap(fixmap, page_to_phys(page)); |
diff --git a/arch/arm64/kernel/psci-call.S b/arch/arm64/kernel/psci-call.S new file mode 100644 index 000000000000..cf83e61cd3b5 --- /dev/null +++ b/arch/arm64/kernel/psci-call.S | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * Copyright (C) 2015 ARM Limited | ||
12 | * | ||
13 | * Author: Will Deacon <will.deacon@arm.com> | ||
14 | */ | ||
15 | |||
16 | #include <linux/linkage.h> | ||
17 | |||
18 | /* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ | ||
19 | ENTRY(__invoke_psci_fn_hvc) | ||
20 | hvc #0 | ||
21 | ret | ||
22 | ENDPROC(__invoke_psci_fn_hvc) | ||
23 | |||
24 | /* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ | ||
25 | ENTRY(__invoke_psci_fn_smc) | ||
26 | smc #0 | ||
27 | ret | ||
28 | ENDPROC(__invoke_psci_fn_smc) | ||
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 3425f311c49e..9b8a70ae64a1 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c | |||
@@ -57,6 +57,9 @@ static struct psci_operations psci_ops; | |||
57 | static int (*invoke_psci_fn)(u64, u64, u64, u64); | 57 | static int (*invoke_psci_fn)(u64, u64, u64, u64); |
58 | typedef int (*psci_initcall_t)(const struct device_node *); | 58 | typedef int (*psci_initcall_t)(const struct device_node *); |
59 | 59 | ||
60 | asmlinkage int __invoke_psci_fn_hvc(u64, u64, u64, u64); | ||
61 | asmlinkage int __invoke_psci_fn_smc(u64, u64, u64, u64); | ||
62 | |||
60 | enum psci_function { | 63 | enum psci_function { |
61 | PSCI_FN_CPU_SUSPEND, | 64 | PSCI_FN_CPU_SUSPEND, |
62 | PSCI_FN_CPU_ON, | 65 | PSCI_FN_CPU_ON, |
@@ -109,40 +112,6 @@ static void psci_power_state_unpack(u32 power_state, | |||
109 | PSCI_0_2_POWER_STATE_AFFL_SHIFT; | 112 | PSCI_0_2_POWER_STATE_AFFL_SHIFT; |
110 | } | 113 | } |
111 | 114 | ||
112 | /* | ||
113 | * The following two functions are invoked via the invoke_psci_fn pointer | ||
114 | * and will not be inlined, allowing us to piggyback on the AAPCS. | ||
115 | */ | ||
116 | static noinline int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, | ||
117 | u64 arg2) | ||
118 | { | ||
119 | asm volatile( | ||
120 | __asmeq("%0", "x0") | ||
121 | __asmeq("%1", "x1") | ||
122 | __asmeq("%2", "x2") | ||
123 | __asmeq("%3", "x3") | ||
124 | "hvc #0\n" | ||
125 | : "+r" (function_id) | ||
126 | : "r" (arg0), "r" (arg1), "r" (arg2)); | ||
127 | |||
128 | return function_id; | ||
129 | } | ||
130 | |||
131 | static noinline int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, | ||
132 | u64 arg2) | ||
133 | { | ||
134 | asm volatile( | ||
135 | __asmeq("%0", "x0") | ||
136 | __asmeq("%1", "x1") | ||
137 | __asmeq("%2", "x2") | ||
138 | __asmeq("%3", "x3") | ||
139 | "smc #0\n" | ||
140 | : "+r" (function_id) | ||
141 | : "r" (arg0), "r" (arg1), "r" (arg2)); | ||
142 | |||
143 | return function_id; | ||
144 | } | ||
145 | |||
146 | static int psci_get_version(void) | 115 | static int psci_get_version(void) |
147 | { | 116 | { |
148 | int err; | 117 | int err; |
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index c20a300e2213..d26fcd4cd6e6 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c | |||
@@ -154,8 +154,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
154 | case __SI_TIMER: | 154 | case __SI_TIMER: |
155 | err |= __put_user(from->si_tid, &to->si_tid); | 155 | err |= __put_user(from->si_tid, &to->si_tid); |
156 | err |= __put_user(from->si_overrun, &to->si_overrun); | 156 | err |= __put_user(from->si_overrun, &to->si_overrun); |
157 | err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, | 157 | err |= __put_user(from->si_int, &to->si_int); |
158 | &to->si_ptr); | ||
159 | break; | 158 | break; |
160 | case __SI_POLL: | 159 | case __SI_POLL: |
161 | err |= __put_user(from->si_band, &to->si_band); | 160 | err |= __put_user(from->si_band, &to->si_band); |
@@ -184,7 +183,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
184 | case __SI_MESGQ: /* But this is */ | 183 | case __SI_MESGQ: /* But this is */ |
185 | err |= __put_user(from->si_pid, &to->si_pid); | 184 | err |= __put_user(from->si_pid, &to->si_pid); |
186 | err |= __put_user(from->si_uid, &to->si_uid); | 185 | err |= __put_user(from->si_uid, &to->si_uid); |
187 | err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); | 186 | err |= __put_user(from->si_int, &to->si_int); |
188 | break; | 187 | break; |
189 | case __SI_SYS: | 188 | case __SI_SYS: |
190 | err |= __put_user((compat_uptr_t)(unsigned long) | 189 | err |= __put_user((compat_uptr_t)(unsigned long) |
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index fe652ffd34c2..efa79e8d4196 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S | |||
@@ -174,8 +174,6 @@ ENDPROC(__kernel_clock_gettime) | |||
174 | /* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */ | 174 | /* int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); */ |
175 | ENTRY(__kernel_clock_getres) | 175 | ENTRY(__kernel_clock_getres) |
176 | .cfi_startproc | 176 | .cfi_startproc |
177 | cbz w1, 3f | ||
178 | |||
179 | cmp w0, #CLOCK_REALTIME | 177 | cmp w0, #CLOCK_REALTIME |
180 | ccmp w0, #CLOCK_MONOTONIC, #0x4, ne | 178 | ccmp w0, #CLOCK_MONOTONIC, #0x4, ne |
181 | b.ne 1f | 179 | b.ne 1f |
@@ -188,6 +186,7 @@ ENTRY(__kernel_clock_getres) | |||
188 | b.ne 4f | 186 | b.ne 4f |
189 | ldr x2, 6f | 187 | ldr x2, 6f |
190 | 2: | 188 | 2: |
189 | cbz w1, 3f | ||
191 | stp xzr, x2, [x1] | 190 | stp xzr, x2, [x1] |
192 | 191 | ||
193 | 3: /* res == NULL. */ | 192 | 3: /* res == NULL. */ |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 0a24b9b8c698..58e0c2bdde04 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
@@ -348,8 +348,6 @@ static struct dma_map_ops swiotlb_dma_ops = { | |||
348 | .mapping_error = swiotlb_dma_mapping_error, | 348 | .mapping_error = swiotlb_dma_mapping_error, |
349 | }; | 349 | }; |
350 | 350 | ||
351 | extern int swiotlb_late_init_with_default_size(size_t default_size); | ||
352 | |||
353 | static int __init atomic_pool_init(void) | 351 | static int __init atomic_pool_init(void) |
354 | { | 352 | { |
355 | pgprot_t prot = __pgprot(PROT_NORMAL_NC); | 353 | pgprot_t prot = __pgprot(PROT_NORMAL_NC); |
@@ -411,21 +409,13 @@ out: | |||
411 | return -ENOMEM; | 409 | return -ENOMEM; |
412 | } | 410 | } |
413 | 411 | ||
414 | static int __init swiotlb_late_init(void) | 412 | static int __init arm64_dma_init(void) |
415 | { | 413 | { |
416 | size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT); | 414 | int ret; |
417 | 415 | ||
418 | dma_ops = &swiotlb_dma_ops; | 416 | dma_ops = &swiotlb_dma_ops; |
419 | 417 | ||
420 | return swiotlb_late_init_with_default_size(swiotlb_size); | 418 | ret = atomic_pool_init(); |
421 | } | ||
422 | |||
423 | static int __init arm64_dma_init(void) | ||
424 | { | ||
425 | int ret = 0; | ||
426 | |||
427 | ret |= swiotlb_late_init(); | ||
428 | ret |= atomic_pool_init(); | ||
429 | 419 | ||
430 | return ret; | 420 | return ret; |
431 | } | 421 | } |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 71145f952070..ae85da6307bb 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
35 | #include <linux/efi.h> | 35 | #include <linux/efi.h> |
36 | #include <linux/swiotlb.h> | ||
36 | 37 | ||
37 | #include <asm/fixmap.h> | 38 | #include <asm/fixmap.h> |
38 | #include <asm/memory.h> | 39 | #include <asm/memory.h> |
@@ -45,6 +46,7 @@ | |||
45 | #include "mm.h" | 46 | #include "mm.h" |
46 | 47 | ||
47 | phys_addr_t memstart_addr __read_mostly = 0; | 48 | phys_addr_t memstart_addr __read_mostly = 0; |
49 | phys_addr_t arm64_dma_phys_limit __read_mostly; | ||
48 | 50 | ||
49 | #ifdef CONFIG_BLK_DEV_INITRD | 51 | #ifdef CONFIG_BLK_DEV_INITRD |
50 | static int __init early_initrd(char *p) | 52 | static int __init early_initrd(char *p) |
@@ -85,7 +87,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
85 | 87 | ||
86 | /* 4GB maximum for 32-bit only capable devices */ | 88 | /* 4GB maximum for 32-bit only capable devices */ |
87 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 89 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
88 | max_dma = PFN_DOWN(max_zone_dma_phys()); | 90 | max_dma = PFN_DOWN(arm64_dma_phys_limit); |
89 | zone_size[ZONE_DMA] = max_dma - min; | 91 | zone_size[ZONE_DMA] = max_dma - min; |
90 | } | 92 | } |
91 | zone_size[ZONE_NORMAL] = max - max_dma; | 93 | zone_size[ZONE_NORMAL] = max - max_dma; |
@@ -156,8 +158,6 @@ early_param("mem", early_mem); | |||
156 | 158 | ||
157 | void __init arm64_memblock_init(void) | 159 | void __init arm64_memblock_init(void) |
158 | { | 160 | { |
159 | phys_addr_t dma_phys_limit = 0; | ||
160 | |||
161 | memblock_enforce_memory_limit(memory_limit); | 161 | memblock_enforce_memory_limit(memory_limit); |
162 | 162 | ||
163 | /* | 163 | /* |
@@ -174,8 +174,10 @@ void __init arm64_memblock_init(void) | |||
174 | 174 | ||
175 | /* 4GB maximum for 32-bit only capable devices */ | 175 | /* 4GB maximum for 32-bit only capable devices */ |
176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
177 | dma_phys_limit = max_zone_dma_phys(); | 177 | arm64_dma_phys_limit = max_zone_dma_phys(); |
178 | dma_contiguous_reserve(dma_phys_limit); | 178 | else |
179 | arm64_dma_phys_limit = PHYS_MASK + 1; | ||
180 | dma_contiguous_reserve(arm64_dma_phys_limit); | ||
179 | 181 | ||
180 | memblock_allow_resize(); | 182 | memblock_allow_resize(); |
181 | memblock_dump_all(); | 183 | memblock_dump_all(); |
@@ -276,6 +278,8 @@ static void __init free_unused_memmap(void) | |||
276 | */ | 278 | */ |
277 | void __init mem_init(void) | 279 | void __init mem_init(void) |
278 | { | 280 | { |
281 | swiotlb_init(1); | ||
282 | |||
279 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | 283 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
280 | 284 | ||
281 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 285 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |
diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c index bb0ea94c4ba1..1d3ec3ddd84b 100644 --- a/arch/arm64/mm/pageattr.c +++ b/arch/arm64/mm/pageattr.c | |||
@@ -51,7 +51,10 @@ static int change_memory_common(unsigned long addr, int numpages, | |||
51 | WARN_ON_ONCE(1); | 51 | WARN_ON_ONCE(1); |
52 | } | 52 | } |
53 | 53 | ||
54 | if (!is_module_address(start) || !is_module_address(end - 1)) | 54 | if (start < MODULES_VADDR || start >= MODULES_END) |
55 | return -EINVAL; | ||
56 | |||
57 | if (end < MODULES_VADDR || end >= MODULES_END) | ||
55 | return -EINVAL; | 58 | return -EINVAL; |
56 | 59 | ||
57 | data.set_mask = set_mask; | 60 | data.set_mask = set_mask; |
diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h index 93bcf2abd1a1..07d7a7ef8bd5 100644 --- a/arch/frv/include/asm/pgtable.h +++ b/arch/frv/include/asm/pgtable.h | |||
@@ -123,12 +123,14 @@ extern unsigned long empty_zero_page; | |||
123 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) | 123 | #define PGDIR_MASK (~(PGDIR_SIZE - 1)) |
124 | #define PTRS_PER_PGD 64 | 124 | #define PTRS_PER_PGD 64 |
125 | 125 | ||
126 | #define __PAGETABLE_PUD_FOLDED | ||
126 | #define PUD_SHIFT 26 | 127 | #define PUD_SHIFT 26 |
127 | #define PTRS_PER_PUD 1 | 128 | #define PTRS_PER_PUD 1 |
128 | #define PUD_SIZE (1UL << PUD_SHIFT) | 129 | #define PUD_SIZE (1UL << PUD_SHIFT) |
129 | #define PUD_MASK (~(PUD_SIZE - 1)) | 130 | #define PUD_MASK (~(PUD_SIZE - 1)) |
130 | #define PUE_SIZE 256 | 131 | #define PUE_SIZE 256 |
131 | 132 | ||
133 | #define __PAGETABLE_PMD_FOLDED | ||
132 | #define PMD_SHIFT 26 | 134 | #define PMD_SHIFT 26 |
133 | #define PMD_SIZE (1UL << PMD_SHIFT) | 135 | #define PMD_SIZE (1UL << PMD_SHIFT) |
134 | #define PMD_MASK (~(PMD_SIZE - 1)) | 136 | #define PMD_MASK (~(PMD_SIZE - 1)) |
diff --git a/arch/m32r/include/asm/pgtable-2level.h b/arch/m32r/include/asm/pgtable-2level.h index 8fd8ee70266a..421e6ba3a173 100644 --- a/arch/m32r/include/asm/pgtable-2level.h +++ b/arch/m32r/include/asm/pgtable-2level.h | |||
@@ -13,6 +13,7 @@ | |||
13 | * the M32R is two-level, so we don't really have any | 13 | * the M32R is two-level, so we don't really have any |
14 | * PMD directory physically. | 14 | * PMD directory physically. |
15 | */ | 15 | */ |
16 | #define __PAGETABLE_PMD_FOLDED | ||
16 | #define PMD_SHIFT 22 | 17 | #define PMD_SHIFT 22 |
17 | #define PTRS_PER_PMD 1 | 18 | #define PTRS_PER_PMD 1 |
18 | 19 | ||
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index 28a145bfbb71..35ed4a9981ae 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h | |||
@@ -54,10 +54,12 @@ | |||
54 | */ | 54 | */ |
55 | #ifdef CONFIG_SUN3 | 55 | #ifdef CONFIG_SUN3 |
56 | #define PTRS_PER_PTE 16 | 56 | #define PTRS_PER_PTE 16 |
57 | #define __PAGETABLE_PMD_FOLDED | ||
57 | #define PTRS_PER_PMD 1 | 58 | #define PTRS_PER_PMD 1 |
58 | #define PTRS_PER_PGD 2048 | 59 | #define PTRS_PER_PGD 2048 |
59 | #elif defined(CONFIG_COLDFIRE) | 60 | #elif defined(CONFIG_COLDFIRE) |
60 | #define PTRS_PER_PTE 512 | 61 | #define PTRS_PER_PTE 512 |
62 | #define __PAGETABLE_PMD_FOLDED | ||
61 | #define PTRS_PER_PMD 1 | 63 | #define PTRS_PER_PMD 1 |
62 | #define PTRS_PER_PGD 1024 | 64 | #define PTRS_PER_PGD 1024 |
63 | #else | 65 | #else |
diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h index 881071c07942..13272fd5a5ba 100644 --- a/arch/metag/include/asm/processor.h +++ b/arch/metag/include/asm/processor.h | |||
@@ -149,8 +149,8 @@ extern void exit_thread(void); | |||
149 | 149 | ||
150 | unsigned long get_wchan(struct task_struct *p); | 150 | unsigned long get_wchan(struct task_struct *p); |
151 | 151 | ||
152 | #define KSTK_EIP(tsk) ((tsk)->thread.kernel_context->CurrPC) | 152 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->ctx.CurrPC) |
153 | #define KSTK_ESP(tsk) ((tsk)->thread.kernel_context->AX[0].U0) | 153 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->ctx.AX[0].U0) |
154 | 154 | ||
155 | #define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) | 155 | #define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) |
156 | 156 | ||
diff --git a/arch/mips/kvm/tlb.c b/arch/mips/kvm/tlb.c index bbcd82242059..b6beb0e07b1b 100644 --- a/arch/mips/kvm/tlb.c +++ b/arch/mips/kvm/tlb.c | |||
@@ -216,6 +216,7 @@ int kvm_mips_host_tlb_write(struct kvm_vcpu *vcpu, unsigned long entryhi, | |||
216 | if (idx > current_cpu_data.tlbsize) { | 216 | if (idx > current_cpu_data.tlbsize) { |
217 | kvm_err("%s: Invalid Index: %d\n", __func__, idx); | 217 | kvm_err("%s: Invalid Index: %d\n", __func__, idx); |
218 | kvm_mips_dump_host_tlbs(); | 218 | kvm_mips_dump_host_tlbs(); |
219 | local_irq_restore(flags); | ||
219 | return -1; | 220 | return -1; |
220 | } | 221 | } |
221 | 222 | ||
diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h index c1388d40663b..bd6437f67dc0 100644 --- a/arch/mips/kvm/trace.h +++ b/arch/mips/kvm/trace.h | |||
@@ -24,18 +24,18 @@ TRACE_EVENT(kvm_exit, | |||
24 | TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), | 24 | TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), |
25 | TP_ARGS(vcpu, reason), | 25 | TP_ARGS(vcpu, reason), |
26 | TP_STRUCT__entry( | 26 | TP_STRUCT__entry( |
27 | __field(struct kvm_vcpu *, vcpu) | 27 | __field(unsigned long, pc) |
28 | __field(unsigned int, reason) | 28 | __field(unsigned int, reason) |
29 | ), | 29 | ), |
30 | 30 | ||
31 | TP_fast_assign( | 31 | TP_fast_assign( |
32 | __entry->vcpu = vcpu; | 32 | __entry->pc = vcpu->arch.pc; |
33 | __entry->reason = reason; | 33 | __entry->reason = reason; |
34 | ), | 34 | ), |
35 | 35 | ||
36 | TP_printk("[%s]PC: 0x%08lx", | 36 | TP_printk("[%s]PC: 0x%08lx", |
37 | kvm_mips_exit_types_str[__entry->reason], | 37 | kvm_mips_exit_types_str[__entry->reason], |
38 | __entry->vcpu->arch.pc) | 38 | __entry->pc) |
39 | ); | 39 | ); |
40 | 40 | ||
41 | #endif /* _TRACE_KVM_H */ | 41 | #endif /* _TRACE_KVM_H */ |
diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h index afab728ab65e..96d3f9deb59c 100644 --- a/arch/mn10300/include/asm/pgtable.h +++ b/arch/mn10300/include/asm/pgtable.h | |||
@@ -56,7 +56,9 @@ extern void paging_init(void); | |||
56 | #define PGDIR_SHIFT 22 | 56 | #define PGDIR_SHIFT 22 |
57 | #define PTRS_PER_PGD 1024 | 57 | #define PTRS_PER_PGD 1024 |
58 | #define PTRS_PER_PUD 1 /* we don't really have any PUD physically */ | 58 | #define PTRS_PER_PUD 1 /* we don't really have any PUD physically */ |
59 | #define __PAGETABLE_PUD_FOLDED | ||
59 | #define PTRS_PER_PMD 1 /* we don't really have any PMD physically */ | 60 | #define PTRS_PER_PMD 1 /* we don't really have any PMD physically */ |
61 | #define __PAGETABLE_PMD_FOLDED | ||
60 | #define PTRS_PER_PTE 1024 | 62 | #define PTRS_PER_PTE 1024 |
61 | 63 | ||
62 | #define PGD_SIZE PAGE_SIZE | 64 | #define PGD_SIZE PAGE_SIZE |
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 8c966b2270aa..15207b9362bf 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h | |||
@@ -96,6 +96,7 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long); | |||
96 | #if PT_NLEVELS == 3 | 96 | #if PT_NLEVELS == 3 |
97 | #define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY) | 97 | #define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY) |
98 | #else | 98 | #else |
99 | #define __PAGETABLE_PMD_FOLDED | ||
99 | #define BITS_PER_PMD 0 | 100 | #define BITS_PER_PMD 0 |
100 | #endif | 101 | #endif |
101 | #define PTRS_PER_PMD (1UL << BITS_PER_PMD) | 102 | #define PTRS_PER_PMD (1UL << BITS_PER_PMD) |
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h index 9cfa3706a1b8..f1ea5972f6ec 100644 --- a/arch/powerpc/include/asm/iommu.h +++ b/arch/powerpc/include/asm/iommu.h | |||
@@ -113,6 +113,7 @@ extern void iommu_register_group(struct iommu_table *tbl, | |||
113 | int pci_domain_number, unsigned long pe_num); | 113 | int pci_domain_number, unsigned long pe_num); |
114 | extern int iommu_add_device(struct device *dev); | 114 | extern int iommu_add_device(struct device *dev); |
115 | extern void iommu_del_device(struct device *dev); | 115 | extern void iommu_del_device(struct device *dev); |
116 | extern int __init tce_iommu_bus_notifier_init(void); | ||
116 | #else | 117 | #else |
117 | static inline void iommu_register_group(struct iommu_table *tbl, | 118 | static inline void iommu_register_group(struct iommu_table *tbl, |
118 | int pci_domain_number, | 119 | int pci_domain_number, |
@@ -128,6 +129,11 @@ static inline int iommu_add_device(struct device *dev) | |||
128 | static inline void iommu_del_device(struct device *dev) | 129 | static inline void iommu_del_device(struct device *dev) |
129 | { | 130 | { |
130 | } | 131 | } |
132 | |||
133 | static inline int __init tce_iommu_bus_notifier_init(void) | ||
134 | { | ||
135 | return 0; | ||
136 | } | ||
131 | #endif /* !CONFIG_IOMMU_API */ | 137 | #endif /* !CONFIG_IOMMU_API */ |
132 | 138 | ||
133 | static inline void set_iommu_table_base_and_group(struct device *dev, | 139 | static inline void set_iommu_table_base_and_group(struct device *dev, |
diff --git a/arch/powerpc/include/asm/irq_work.h b/arch/powerpc/include/asm/irq_work.h new file mode 100644 index 000000000000..744fd54de374 --- /dev/null +++ b/arch/powerpc/include/asm/irq_work.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef _ASM_POWERPC_IRQ_WORK_H | ||
2 | #define _ASM_POWERPC_IRQ_WORK_H | ||
3 | |||
4 | static inline bool arch_irq_work_has_interrupt(void) | ||
5 | { | ||
6 | return true; | ||
7 | } | ||
8 | |||
9 | #endif /* _ASM_POWERPC_IRQ_WORK_H */ | ||
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 5d3968c4d799..b054f33ab1fb 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -1175,4 +1175,30 @@ void iommu_del_device(struct device *dev) | |||
1175 | } | 1175 | } |
1176 | EXPORT_SYMBOL_GPL(iommu_del_device); | 1176 | EXPORT_SYMBOL_GPL(iommu_del_device); |
1177 | 1177 | ||
1178 | static int tce_iommu_bus_notifier(struct notifier_block *nb, | ||
1179 | unsigned long action, void *data) | ||
1180 | { | ||
1181 | struct device *dev = data; | ||
1182 | |||
1183 | switch (action) { | ||
1184 | case BUS_NOTIFY_ADD_DEVICE: | ||
1185 | return iommu_add_device(dev); | ||
1186 | case BUS_NOTIFY_DEL_DEVICE: | ||
1187 | if (dev->iommu_group) | ||
1188 | iommu_del_device(dev); | ||
1189 | return 0; | ||
1190 | default: | ||
1191 | return 0; | ||
1192 | } | ||
1193 | } | ||
1194 | |||
1195 | static struct notifier_block tce_iommu_bus_nb = { | ||
1196 | .notifier_call = tce_iommu_bus_notifier, | ||
1197 | }; | ||
1198 | |||
1199 | int __init tce_iommu_bus_notifier_init(void) | ||
1200 | { | ||
1201 | bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb); | ||
1202 | return 0; | ||
1203 | } | ||
1178 | #endif /* CONFIG_IOMMU_API */ | 1204 | #endif /* CONFIG_IOMMU_API */ |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 6e19afa35a15..ec9ec2058d2d 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -541,8 +541,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
541 | if (smp_ops->give_timebase) | 541 | if (smp_ops->give_timebase) |
542 | smp_ops->give_timebase(); | 542 | smp_ops->give_timebase(); |
543 | 543 | ||
544 | /* Wait until cpu puts itself in the online map */ | 544 | /* Wait until cpu puts itself in the online & active maps */ |
545 | while (!cpu_online(cpu)) | 545 | while (!cpu_online(cpu) || !cpu_active(cpu)) |
546 | cpu_relax(); | 546 | cpu_relax(); |
547 | 547 | ||
548 | return 0; | 548 | return 0; |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index e69142f4af08..54323d6b5166 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -836,30 +836,4 @@ void __init pnv_pci_init(void) | |||
836 | #endif | 836 | #endif |
837 | } | 837 | } |
838 | 838 | ||
839 | static int tce_iommu_bus_notifier(struct notifier_block *nb, | ||
840 | unsigned long action, void *data) | ||
841 | { | ||
842 | struct device *dev = data; | ||
843 | |||
844 | switch (action) { | ||
845 | case BUS_NOTIFY_ADD_DEVICE: | ||
846 | return iommu_add_device(dev); | ||
847 | case BUS_NOTIFY_DEL_DEVICE: | ||
848 | if (dev->iommu_group) | ||
849 | iommu_del_device(dev); | ||
850 | return 0; | ||
851 | default: | ||
852 | return 0; | ||
853 | } | ||
854 | } | ||
855 | |||
856 | static struct notifier_block tce_iommu_bus_nb = { | ||
857 | .notifier_call = tce_iommu_bus_notifier, | ||
858 | }; | ||
859 | |||
860 | static int __init tce_iommu_bus_notifier_init(void) | ||
861 | { | ||
862 | bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb); | ||
863 | return 0; | ||
864 | } | ||
865 | machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init); | 839 | machine_subsys_initcall_sync(powernv, tce_iommu_bus_notifier_init); |
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 1d3d52dc3ff3..7803a19adb31 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -1340,3 +1340,5 @@ static int __init disable_multitce(char *str) | |||
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | __setup("multitce=", disable_multitce); | 1342 | __setup("multitce=", disable_multitce); |
1343 | |||
1344 | machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init); | ||
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index fbb5ee3ae57c..e08ec38f8c6e 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -91,7 +91,9 @@ extern unsigned long zero_page_mask; | |||
91 | */ | 91 | */ |
92 | #define PTRS_PER_PTE 256 | 92 | #define PTRS_PER_PTE 256 |
93 | #ifndef CONFIG_64BIT | 93 | #ifndef CONFIG_64BIT |
94 | #define __PAGETABLE_PUD_FOLDED | ||
94 | #define PTRS_PER_PMD 1 | 95 | #define PTRS_PER_PMD 1 |
96 | #define __PAGETABLE_PMD_FOLDED | ||
95 | #define PTRS_PER_PUD 1 | 97 | #define PTRS_PER_PUD 1 |
96 | #else /* CONFIG_64BIT */ | 98 | #else /* CONFIG_64BIT */ |
97 | #define PTRS_PER_PMD 2048 | 99 | #define PTRS_PER_PMD 2048 |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c2fb8a87dccb..b7d31ca55187 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -499,6 +499,7 @@ config X86_INTEL_QUARK | |||
499 | depends on X86_IO_APIC | 499 | depends on X86_IO_APIC |
500 | select IOSF_MBI | 500 | select IOSF_MBI |
501 | select INTEL_IMR | 501 | select INTEL_IMR |
502 | select COMMON_CLK | ||
502 | ---help--- | 503 | ---help--- |
503 | Select to include support for Quark X1000 SoC. | 504 | Select to include support for Quark X1000 SoC. |
504 | Say Y here if you have a Quark based system such as the Arduino | 505 | Say Y here if you have a Quark based system such as the Arduino |
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 5fa9770035dc..c9a6d68b8d62 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -82,18 +82,15 @@ static inline int xsave_state_booting(struct xsave_struct *fx, u64 mask) | |||
82 | if (boot_cpu_has(X86_FEATURE_XSAVES)) | 82 | if (boot_cpu_has(X86_FEATURE_XSAVES)) |
83 | asm volatile("1:"XSAVES"\n\t" | 83 | asm volatile("1:"XSAVES"\n\t" |
84 | "2:\n\t" | 84 | "2:\n\t" |
85 | : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | 85 | xstate_fault |
86 | : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | ||
86 | : "memory"); | 87 | : "memory"); |
87 | else | 88 | else |
88 | asm volatile("1:"XSAVE"\n\t" | 89 | asm volatile("1:"XSAVE"\n\t" |
89 | "2:\n\t" | 90 | "2:\n\t" |
90 | : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | 91 | xstate_fault |
92 | : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | ||
91 | : "memory"); | 93 | : "memory"); |
92 | |||
93 | asm volatile(xstate_fault | ||
94 | : "0" (0) | ||
95 | : "memory"); | ||
96 | |||
97 | return err; | 94 | return err; |
98 | } | 95 | } |
99 | 96 | ||
@@ -112,18 +109,15 @@ static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask) | |||
112 | if (boot_cpu_has(X86_FEATURE_XSAVES)) | 109 | if (boot_cpu_has(X86_FEATURE_XSAVES)) |
113 | asm volatile("1:"XRSTORS"\n\t" | 110 | asm volatile("1:"XRSTORS"\n\t" |
114 | "2:\n\t" | 111 | "2:\n\t" |
115 | : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | 112 | xstate_fault |
113 | : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | ||
116 | : "memory"); | 114 | : "memory"); |
117 | else | 115 | else |
118 | asm volatile("1:"XRSTOR"\n\t" | 116 | asm volatile("1:"XRSTOR"\n\t" |
119 | "2:\n\t" | 117 | "2:\n\t" |
120 | : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | 118 | xstate_fault |
119 | : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | ||
121 | : "memory"); | 120 | : "memory"); |
122 | |||
123 | asm volatile(xstate_fault | ||
124 | : "0" (0) | ||
125 | : "memory"); | ||
126 | |||
127 | return err; | 121 | return err; |
128 | } | 122 | } |
129 | 123 | ||
@@ -149,9 +143,9 @@ static inline int xsave_state(struct xsave_struct *fx, u64 mask) | |||
149 | */ | 143 | */ |
150 | alternative_input_2( | 144 | alternative_input_2( |
151 | "1:"XSAVE, | 145 | "1:"XSAVE, |
152 | "1:"XSAVEOPT, | 146 | XSAVEOPT, |
153 | X86_FEATURE_XSAVEOPT, | 147 | X86_FEATURE_XSAVEOPT, |
154 | "1:"XSAVES, | 148 | XSAVES, |
155 | X86_FEATURE_XSAVES, | 149 | X86_FEATURE_XSAVES, |
156 | [fx] "D" (fx), "a" (lmask), "d" (hmask) : | 150 | [fx] "D" (fx), "a" (lmask), "d" (hmask) : |
157 | "memory"); | 151 | "memory"); |
@@ -178,7 +172,7 @@ static inline int xrstor_state(struct xsave_struct *fx, u64 mask) | |||
178 | */ | 172 | */ |
179 | alternative_input( | 173 | alternative_input( |
180 | "1: " XRSTOR, | 174 | "1: " XRSTOR, |
181 | "1: " XRSTORS, | 175 | XRSTORS, |
182 | X86_FEATURE_XSAVES, | 176 | X86_FEATURE_XSAVES, |
183 | "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) | 177 | "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask) |
184 | : "memory"); | 178 | : "memory"); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b5c8ff5e9dfc..2346c95c6ab1 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1396,6 +1396,12 @@ void cpu_init(void) | |||
1396 | 1396 | ||
1397 | wait_for_master_cpu(cpu); | 1397 | wait_for_master_cpu(cpu); |
1398 | 1398 | ||
1399 | /* | ||
1400 | * Initialize the CR4 shadow before doing anything that could | ||
1401 | * try to read it. | ||
1402 | */ | ||
1403 | cr4_init_shadow(); | ||
1404 | |||
1399 | show_ucode_info_early(); | 1405 | show_ucode_info_early(); |
1400 | 1406 | ||
1401 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); | 1407 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 94d7dcb12145..50163fa9034f 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -565,8 +565,8 @@ static const struct _tlb_table intel_tlb_table[] = { | |||
565 | { 0xb2, TLB_INST_4K, 64, " TLB_INST 4KByte pages, 4-way set associative" }, | 565 | { 0xb2, TLB_INST_4K, 64, " TLB_INST 4KByte pages, 4-way set associative" }, |
566 | { 0xb3, TLB_DATA_4K, 128, " TLB_DATA 4 KByte pages, 4-way set associative" }, | 566 | { 0xb3, TLB_DATA_4K, 128, " TLB_DATA 4 KByte pages, 4-way set associative" }, |
567 | { 0xb4, TLB_DATA_4K, 256, " TLB_DATA 4 KByte pages, 4-way associative" }, | 567 | { 0xb4, TLB_DATA_4K, 256, " TLB_DATA 4 KByte pages, 4-way associative" }, |
568 | { 0xb5, TLB_INST_4K, 64, " TLB_INST 4 KByte pages, 8-way set ssociative" }, | 568 | { 0xb5, TLB_INST_4K, 64, " TLB_INST 4 KByte pages, 8-way set associative" }, |
569 | { 0xb6, TLB_INST_4K, 128, " TLB_INST 4 KByte pages, 8-way set ssociative" }, | 569 | { 0xb6, TLB_INST_4K, 128, " TLB_INST 4 KByte pages, 8-way set associative" }, |
570 | { 0xba, TLB_DATA_4K, 64, " TLB_DATA 4 KByte pages, 4-way associative" }, | 570 | { 0xba, TLB_DATA_4K, 64, " TLB_DATA 4 KByte pages, 4-way associative" }, |
571 | { 0xc0, TLB_DATA_4K_4M, 8, " TLB_DATA 4 KByte and 4 MByte pages, 4-way associative" }, | 571 | { 0xc0, TLB_DATA_4K_4M, 8, " TLB_DATA 4 KByte and 4 MByte pages, 4-way associative" }, |
572 | { 0xc1, STLB_4K_2M, 1024, " STLB 4 KByte and 2 MByte pages, 8-way associative" }, | 572 | { 0xc1, STLB_4K_2M, 1024, " STLB 4 KByte and 2 MByte pages, 8-way associative" }, |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index 000d4199b03e..31e2d5bf3e38 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -982,6 +982,9 @@ ENTRY(xen_hypervisor_callback) | |||
982 | ENTRY(xen_do_upcall) | 982 | ENTRY(xen_do_upcall) |
983 | 1: mov %esp, %eax | 983 | 1: mov %esp, %eax |
984 | call xen_evtchn_do_upcall | 984 | call xen_evtchn_do_upcall |
985 | #ifndef CONFIG_PREEMPT | ||
986 | call xen_maybe_preempt_hcall | ||
987 | #endif | ||
985 | jmp ret_from_intr | 988 | jmp ret_from_intr |
986 | CFI_ENDPROC | 989 | CFI_ENDPROC |
987 | ENDPROC(xen_hypervisor_callback) | 990 | ENDPROC(xen_hypervisor_callback) |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index db13655c3a2a..1d74d161687c 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -269,11 +269,14 @@ ENTRY(ret_from_fork) | |||
269 | testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? | 269 | testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? |
270 | jz 1f | 270 | jz 1f |
271 | 271 | ||
272 | testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET | 272 | /* |
273 | jnz int_ret_from_sys_call | 273 | * By the time we get here, we have no idea whether our pt_regs, |
274 | 274 | * ti flags, and ti status came from the 64-bit SYSCALL fast path, | |
275 | RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET | 275 | * the slow path, or one of the ia32entry paths. |
276 | jmp ret_from_sys_call # go to the SYSRET fastpath | 276 | * Use int_ret_from_sys_call to return, since it can safely handle |
277 | * all of the above. | ||
278 | */ | ||
279 | jmp int_ret_from_sys_call | ||
277 | 280 | ||
278 | 1: | 281 | 1: |
279 | subq $REST_SKIP, %rsp # leave space for volatiles | 282 | subq $REST_SKIP, %rsp # leave space for volatiles |
@@ -1208,6 +1211,9 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) | |||
1208 | popq %rsp | 1211 | popq %rsp |
1209 | CFI_DEF_CFA_REGISTER rsp | 1212 | CFI_DEF_CFA_REGISTER rsp |
1210 | decl PER_CPU_VAR(irq_count) | 1213 | decl PER_CPU_VAR(irq_count) |
1214 | #ifndef CONFIG_PREEMPT | ||
1215 | call xen_maybe_preempt_hcall | ||
1216 | #endif | ||
1211 | jmp error_exit | 1217 | jmp error_exit |
1212 | CFI_ENDPROC | 1218 | CFI_ENDPROC |
1213 | END(xen_do_hypervisor_callback) | 1219 | END(xen_do_hypervisor_callback) |
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 6a1146ea4d4d..4e3d5a9621fe 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -223,27 +223,48 @@ static unsigned long | |||
223 | __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr) | 223 | __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr) |
224 | { | 224 | { |
225 | struct kprobe *kp; | 225 | struct kprobe *kp; |
226 | unsigned long faddr; | ||
226 | 227 | ||
227 | kp = get_kprobe((void *)addr); | 228 | kp = get_kprobe((void *)addr); |
228 | /* There is no probe, return original address */ | 229 | faddr = ftrace_location(addr); |
229 | if (!kp) | 230 | /* |
231 | * Addresses inside the ftrace location are refused by | ||
232 | * arch_check_ftrace_location(). Something went terribly wrong | ||
233 | * if such an address is checked here. | ||
234 | */ | ||
235 | if (WARN_ON(faddr && faddr != addr)) | ||
236 | return 0UL; | ||
237 | /* | ||
238 | * Use the current code if it is not modified by Kprobe | ||
239 | * and it cannot be modified by ftrace. | ||
240 | */ | ||
241 | if (!kp && !faddr) | ||
230 | return addr; | 242 | return addr; |
231 | 243 | ||
232 | /* | 244 | /* |
233 | * Basically, kp->ainsn.insn has an original instruction. | 245 | * Basically, kp->ainsn.insn has an original instruction. |
234 | * However, RIP-relative instruction can not do single-stepping | 246 | * However, RIP-relative instruction can not do single-stepping |
235 | * at different place, __copy_instruction() tweaks the displacement of | 247 | * at different place, __copy_instruction() tweaks the displacement of |
236 | * that instruction. In that case, we can't recover the instruction | 248 | * that instruction. In that case, we can't recover the instruction |
237 | * from the kp->ainsn.insn. | 249 | * from the kp->ainsn.insn. |
238 | * | 250 | * |
239 | * On the other hand, kp->opcode has a copy of the first byte of | 251 | * On the other hand, in case on normal Kprobe, kp->opcode has a copy |
240 | * the probed instruction, which is overwritten by int3. And | 252 | * of the first byte of the probed instruction, which is overwritten |
241 | * the instruction at kp->addr is not modified by kprobes except | 253 | * by int3. And the instruction at kp->addr is not modified by kprobes |
242 | * for the first byte, we can recover the original instruction | 254 | * except for the first byte, we can recover the original instruction |
243 | * from it and kp->opcode. | 255 | * from it and kp->opcode. |
256 | * | ||
257 | * In case of Kprobes using ftrace, we do not have a copy of | ||
258 | * the original instruction. In fact, the ftrace location might | ||
259 | * be modified at anytime and even could be in an inconsistent state. | ||
260 | * Fortunately, we know that the original code is the ideal 5-byte | ||
261 | * long NOP. | ||
244 | */ | 262 | */ |
245 | memcpy(buf, kp->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 263 | memcpy(buf, (void *)addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
246 | buf[0] = kp->opcode; | 264 | if (faddr) |
265 | memcpy(buf, ideal_nops[NOP_ATOMIC5], 5); | ||
266 | else | ||
267 | buf[0] = kp->opcode; | ||
247 | return (unsigned long)buf; | 268 | return (unsigned long)buf; |
248 | } | 269 | } |
249 | 270 | ||
@@ -251,6 +272,7 @@ __recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr) | |||
251 | * Recover the probed instruction at addr for further analysis. | 272 | * Recover the probed instruction at addr for further analysis. |
252 | * Caller must lock kprobes by kprobe_mutex, or disable preemption | 273 | * Caller must lock kprobes by kprobe_mutex, or disable preemption |
253 | * for preventing to release referencing kprobes. | 274 | * for preventing to release referencing kprobes. |
275 | * Returns zero if the instruction can not get recovered. | ||
254 | */ | 276 | */ |
255 | unsigned long recover_probed_instruction(kprobe_opcode_t *buf, unsigned long addr) | 277 | unsigned long recover_probed_instruction(kprobe_opcode_t *buf, unsigned long addr) |
256 | { | 278 | { |
@@ -285,6 +307,8 @@ static int can_probe(unsigned long paddr) | |||
285 | * normally used, we just go through if there is no kprobe. | 307 | * normally used, we just go through if there is no kprobe. |
286 | */ | 308 | */ |
287 | __addr = recover_probed_instruction(buf, addr); | 309 | __addr = recover_probed_instruction(buf, addr); |
310 | if (!__addr) | ||
311 | return 0; | ||
288 | kernel_insn_init(&insn, (void *)__addr, MAX_INSN_SIZE); | 312 | kernel_insn_init(&insn, (void *)__addr, MAX_INSN_SIZE); |
289 | insn_get_length(&insn); | 313 | insn_get_length(&insn); |
290 | 314 | ||
@@ -333,6 +357,8 @@ int __copy_instruction(u8 *dest, u8 *src) | |||
333 | unsigned long recovered_insn = | 357 | unsigned long recovered_insn = |
334 | recover_probed_instruction(buf, (unsigned long)src); | 358 | recover_probed_instruction(buf, (unsigned long)src); |
335 | 359 | ||
360 | if (!recovered_insn) | ||
361 | return 0; | ||
336 | kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE); | 362 | kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE); |
337 | insn_get_length(&insn); | 363 | insn_get_length(&insn); |
338 | /* Another subsystem puts a breakpoint, failed to recover */ | 364 | /* Another subsystem puts a breakpoint, failed to recover */ |
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 0dd8d089c315..7b3b9d15c47a 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c | |||
@@ -259,6 +259,8 @@ static int can_optimize(unsigned long paddr) | |||
259 | */ | 259 | */ |
260 | return 0; | 260 | return 0; |
261 | recovered_insn = recover_probed_instruction(buf, addr); | 261 | recovered_insn = recover_probed_instruction(buf, addr); |
262 | if (!recovered_insn) | ||
263 | return 0; | ||
262 | kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE); | 264 | kernel_insn_init(&insn, (void *)recovered_insn, MAX_INSN_SIZE); |
263 | insn_get_length(&insn); | 265 | insn_get_length(&insn); |
264 | /* Another subsystem puts a breakpoint */ | 266 | /* Another subsystem puts a breakpoint */ |
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index e0b794a84c35..106c01557f2b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -4950,7 +4950,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) | |||
4950 | goto done; | 4950 | goto done; |
4951 | } | 4951 | } |
4952 | } | 4952 | } |
4953 | ctxt->dst.orig_val = ctxt->dst.val; | 4953 | /* Copy full 64-bit value for CMPXCHG8B. */ |
4954 | ctxt->dst.orig_val64 = ctxt->dst.val64; | ||
4954 | 4955 | ||
4955 | special_insn: | 4956 | special_insn: |
4956 | 4957 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index e55b5fc344eb..bd4e34de24c7 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1572,7 +1572,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu) | |||
1572 | apic_set_reg(apic, APIC_TMR + 0x10 * i, 0); | 1572 | apic_set_reg(apic, APIC_TMR + 0x10 * i, 0); |
1573 | } | 1573 | } |
1574 | apic->irr_pending = kvm_apic_vid_enabled(vcpu->kvm); | 1574 | apic->irr_pending = kvm_apic_vid_enabled(vcpu->kvm); |
1575 | apic->isr_count = kvm_apic_vid_enabled(vcpu->kvm); | 1575 | apic->isr_count = kvm_x86_ops->hwapic_isr_update ? 1 : 0; |
1576 | apic->highest_isr_cache = -1; | 1576 | apic->highest_isr_cache = -1; |
1577 | update_divide_count(apic); | 1577 | update_divide_count(apic); |
1578 | atomic_set(&apic->lapic_timer.pending, 0); | 1578 | atomic_set(&apic->lapic_timer.pending, 0); |
@@ -1782,7 +1782,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu, | |||
1782 | update_divide_count(apic); | 1782 | update_divide_count(apic); |
1783 | start_apic_timer(apic); | 1783 | start_apic_timer(apic); |
1784 | apic->irr_pending = true; | 1784 | apic->irr_pending = true; |
1785 | apic->isr_count = kvm_apic_vid_enabled(vcpu->kvm) ? | 1785 | apic->isr_count = kvm_x86_ops->hwapic_isr_update ? |
1786 | 1 : count_vectors(apic->regs + APIC_ISR); | 1786 | 1 : count_vectors(apic->regs + APIC_ISR); |
1787 | apic->highest_isr_cache = -1; | 1787 | apic->highest_isr_cache = -1; |
1788 | if (kvm_x86_ops->hwapic_irr_update) | 1788 | if (kvm_x86_ops->hwapic_irr_update) |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index d319e0c24758..cc618c882f90 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -3649,11 +3649,6 @@ static void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) | |||
3649 | return; | 3649 | return; |
3650 | } | 3650 | } |
3651 | 3651 | ||
3652 | static void svm_hwapic_isr_update(struct kvm *kvm, int isr) | ||
3653 | { | ||
3654 | return; | ||
3655 | } | ||
3656 | |||
3657 | static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu) | 3652 | static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu) |
3658 | { | 3653 | { |
3659 | return; | 3654 | return; |
@@ -4403,7 +4398,6 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
4403 | .set_virtual_x2apic_mode = svm_set_virtual_x2apic_mode, | 4398 | .set_virtual_x2apic_mode = svm_set_virtual_x2apic_mode, |
4404 | .vm_has_apicv = svm_vm_has_apicv, | 4399 | .vm_has_apicv = svm_vm_has_apicv, |
4405 | .load_eoi_exitmap = svm_load_eoi_exitmap, | 4400 | .load_eoi_exitmap = svm_load_eoi_exitmap, |
4406 | .hwapic_isr_update = svm_hwapic_isr_update, | ||
4407 | .sync_pir_to_irr = svm_sync_pir_to_irr, | 4401 | .sync_pir_to_irr = svm_sync_pir_to_irr, |
4408 | 4402 | ||
4409 | .set_tss_addr = svm_set_tss_addr, | 4403 | .set_tss_addr = svm_set_tss_addr, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 14c1a18d206a..f7b20b417a3a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4367,6 +4367,18 @@ static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu) | |||
4367 | return 0; | 4367 | return 0; |
4368 | } | 4368 | } |
4369 | 4369 | ||
4370 | static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu) | ||
4371 | { | ||
4372 | #ifdef CONFIG_SMP | ||
4373 | if (vcpu->mode == IN_GUEST_MODE) { | ||
4374 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4375 | POSTED_INTR_VECTOR); | ||
4376 | return true; | ||
4377 | } | ||
4378 | #endif | ||
4379 | return false; | ||
4380 | } | ||
4381 | |||
4370 | static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, | 4382 | static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, |
4371 | int vector) | 4383 | int vector) |
4372 | { | 4384 | { |
@@ -4375,9 +4387,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu, | |||
4375 | if (is_guest_mode(vcpu) && | 4387 | if (is_guest_mode(vcpu) && |
4376 | vector == vmx->nested.posted_intr_nv) { | 4388 | vector == vmx->nested.posted_intr_nv) { |
4377 | /* the PIR and ON have been set by L1. */ | 4389 | /* the PIR and ON have been set by L1. */ |
4378 | if (vcpu->mode == IN_GUEST_MODE) | 4390 | kvm_vcpu_trigger_posted_interrupt(vcpu); |
4379 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4380 | POSTED_INTR_VECTOR); | ||
4381 | /* | 4391 | /* |
4382 | * If a posted intr is not recognized by hardware, | 4392 | * If a posted intr is not recognized by hardware, |
4383 | * we will accomplish it in the next vmentry. | 4393 | * we will accomplish it in the next vmentry. |
@@ -4409,12 +4419,7 @@ static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) | |||
4409 | 4419 | ||
4410 | r = pi_test_and_set_on(&vmx->pi_desc); | 4420 | r = pi_test_and_set_on(&vmx->pi_desc); |
4411 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 4421 | kvm_make_request(KVM_REQ_EVENT, vcpu); |
4412 | #ifdef CONFIG_SMP | 4422 | if (r || !kvm_vcpu_trigger_posted_interrupt(vcpu)) |
4413 | if (!r && (vcpu->mode == IN_GUEST_MODE)) | ||
4414 | apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), | ||
4415 | POSTED_INTR_VECTOR); | ||
4416 | else | ||
4417 | #endif | ||
4418 | kvm_vcpu_kick(vcpu); | 4423 | kvm_vcpu_kick(vcpu); |
4419 | } | 4424 | } |
4420 | 4425 | ||
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig index 4a0890f815c4..08f41caada45 100644 --- a/arch/x86/lguest/Kconfig +++ b/arch/x86/lguest/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config LGUEST_GUEST | 1 | config LGUEST_GUEST |
2 | bool "Lguest guest support" | 2 | bool "Lguest guest support" |
3 | depends on X86_32 && PARAVIRT | 3 | depends on X86_32 && PARAVIRT && PCI |
4 | select TTY | 4 | select TTY |
5 | select VIRTUALIZATION | 5 | select VIRTUALIZATION |
6 | select VIRTIO | 6 | select VIRTIO |
@@ -8,7 +8,7 @@ config LGUEST_GUEST | |||
8 | help | 8 | help |
9 | Lguest is a tiny in-kernel hypervisor. Selecting this will | 9 | Lguest is a tiny in-kernel hypervisor. Selecting this will |
10 | allow your kernel to boot under lguest. This option will increase | 10 | allow your kernel to boot under lguest. This option will increase |
11 | your kernel size by about 6k. If in doubt, say N. | 11 | your kernel size by about 10k. If in doubt, say N. |
12 | 12 | ||
13 | If you say Y here, make sure you say Y (or M) to the virtio block | 13 | If you say Y here, make sure you say Y (or M) to the virtio block |
14 | and net drivers which lguest needs. | 14 | and net drivers which lguest needs. |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 6ac273832f28..e4695985f9de 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -331,7 +331,7 @@ static void probe_pci_root_info(struct pci_root_info *info, | |||
331 | struct list_head *list) | 331 | struct list_head *list) |
332 | { | 332 | { |
333 | int ret; | 333 | int ret; |
334 | struct resource_entry *entry; | 334 | struct resource_entry *entry, *tmp; |
335 | 335 | ||
336 | sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum); | 336 | sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum); |
337 | info->bridge = device; | 337 | info->bridge = device; |
@@ -345,8 +345,13 @@ static void probe_pci_root_info(struct pci_root_info *info, | |||
345 | dev_dbg(&device->dev, | 345 | dev_dbg(&device->dev, |
346 | "no IO and memory resources present in _CRS\n"); | 346 | "no IO and memory resources present in _CRS\n"); |
347 | else | 347 | else |
348 | resource_list_for_each_entry(entry, list) | 348 | resource_list_for_each_entry_safe(entry, tmp, list) { |
349 | entry->res->name = info->name; | 349 | if ((entry->res->flags & IORESOURCE_WINDOW) == 0 || |
350 | (entry->res->flags & IORESOURCE_DISABLED)) | ||
351 | resource_list_destroy_entry(entry); | ||
352 | else | ||
353 | entry->res->name = info->name; | ||
354 | } | ||
350 | } | 355 | } |
351 | 356 | ||
352 | struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | 357 | struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) |
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index 1bbedc4b0f88..3005f0c89f2e 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c | |||
@@ -130,7 +130,7 @@ static void intel_mid_arch_setup(void) | |||
130 | intel_mid_ops = get_intel_mid_ops[__intel_mid_cpu_chip](); | 130 | intel_mid_ops = get_intel_mid_ops[__intel_mid_cpu_chip](); |
131 | else { | 131 | else { |
132 | intel_mid_ops = get_intel_mid_ops[INTEL_MID_CPU_CHIP_PENWELL](); | 132 | intel_mid_ops = get_intel_mid_ops[INTEL_MID_CPU_CHIP_PENWELL](); |
133 | pr_info("ARCH: Uknown SoC, assuming PENWELL!\n"); | 133 | pr_info("ARCH: Unknown SoC, assuming PENWELL!\n"); |
134 | } | 134 | } |
135 | 135 | ||
136 | out: | 136 | out: |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index bd8b8459c3d0..5240f563076d 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1070,6 +1070,23 @@ static inline void xen_write_cr8(unsigned long val) | |||
1070 | BUG_ON(val); | 1070 | BUG_ON(val); |
1071 | } | 1071 | } |
1072 | #endif | 1072 | #endif |
1073 | |||
1074 | static u64 xen_read_msr_safe(unsigned int msr, int *err) | ||
1075 | { | ||
1076 | u64 val; | ||
1077 | |||
1078 | val = native_read_msr_safe(msr, err); | ||
1079 | switch (msr) { | ||
1080 | case MSR_IA32_APICBASE: | ||
1081 | #ifdef CONFIG_X86_X2APIC | ||
1082 | if (!(cpuid_ecx(1) & (1 << (X86_FEATURE_X2APIC & 31)))) | ||
1083 | #endif | ||
1084 | val &= ~X2APIC_ENABLE; | ||
1085 | break; | ||
1086 | } | ||
1087 | return val; | ||
1088 | } | ||
1089 | |||
1073 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) | 1090 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) |
1074 | { | 1091 | { |
1075 | int ret; | 1092 | int ret; |
@@ -1240,7 +1257,7 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { | |||
1240 | 1257 | ||
1241 | .wbinvd = native_wbinvd, | 1258 | .wbinvd = native_wbinvd, |
1242 | 1259 | ||
1243 | .read_msr = native_read_msr_safe, | 1260 | .read_msr = xen_read_msr_safe, |
1244 | .write_msr = xen_write_msr_safe, | 1261 | .write_msr = xen_write_msr_safe, |
1245 | 1262 | ||
1246 | .read_tsc = native_read_tsc, | 1263 | .read_tsc = native_read_tsc, |
@@ -1741,6 +1758,7 @@ asmlinkage __visible void __init xen_start_kernel(void) | |||
1741 | #ifdef CONFIG_X86_32 | 1758 | #ifdef CONFIG_X86_32 |
1742 | i386_start_kernel(); | 1759 | i386_start_kernel(); |
1743 | #else | 1760 | #else |
1761 | cr4_init_shadow(); /* 32b kernel does this in i386_start_kernel() */ | ||
1744 | x86_64_start_reservations((char *)__pa_symbol(&boot_params)); | 1762 | x86_64_start_reservations((char *)__pa_symbol(&boot_params)); |
1745 | #endif | 1763 | #endif |
1746 | } | 1764 | } |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index c723668e3e27..5589a6e2a023 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -42,8 +42,10 @@ static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io) | |||
42 | * CHECKME: len might be required to check versus a minimum | 42 | * CHECKME: len might be required to check versus a minimum |
43 | * length as well. 1 for io is fine, but for memory it does | 43 | * length as well. 1 for io is fine, but for memory it does |
44 | * not make any sense at all. | 44 | * not make any sense at all. |
45 | * Note: some BIOSes report incorrect length for ACPI address space | ||
46 | * descriptor, so remove check of 'reslen == len' to avoid regression. | ||
45 | */ | 47 | */ |
46 | if (len && reslen && reslen == len && start <= end) | 48 | if (len && reslen && start <= end) |
47 | return true; | 49 | return true; |
48 | 50 | ||
49 | pr_debug("ACPI: invalid or unassigned resource %s [%016llx - %016llx] length [%016llx]\n", | 51 | pr_debug("ACPI: invalid or unassigned resource %s [%016llx - %016llx] length [%016llx]\n", |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index debd30917010..26eb70c8f518 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -2110,7 +2110,8 @@ static int __init intel_opregion_present(void) | |||
2110 | 2110 | ||
2111 | int acpi_video_register(void) | 2111 | int acpi_video_register(void) |
2112 | { | 2112 | { |
2113 | int result = 0; | 2113 | int ret; |
2114 | |||
2114 | if (register_count) { | 2115 | if (register_count) { |
2115 | /* | 2116 | /* |
2116 | * if the function of acpi_video_register is already called, | 2117 | * if the function of acpi_video_register is already called, |
@@ -2122,9 +2123,9 @@ int acpi_video_register(void) | |||
2122 | mutex_init(&video_list_lock); | 2123 | mutex_init(&video_list_lock); |
2123 | INIT_LIST_HEAD(&video_bus_head); | 2124 | INIT_LIST_HEAD(&video_bus_head); |
2124 | 2125 | ||
2125 | result = acpi_bus_register_driver(&acpi_video_bus); | 2126 | ret = acpi_bus_register_driver(&acpi_video_bus); |
2126 | if (result < 0) | 2127 | if (ret) |
2127 | return -ENODEV; | 2128 | return ret; |
2128 | 2129 | ||
2129 | /* | 2130 | /* |
2130 | * When the acpi_video_bus is loaded successfully, increase | 2131 | * When the acpi_video_bus is loaded successfully, increase |
@@ -2176,6 +2177,17 @@ EXPORT_SYMBOL(acpi_video_unregister_backlight); | |||
2176 | 2177 | ||
2177 | static int __init acpi_video_init(void) | 2178 | static int __init acpi_video_init(void) |
2178 | { | 2179 | { |
2180 | /* | ||
2181 | * Let the module load even if ACPI is disabled (e.g. due to | ||
2182 | * a broken BIOS) so that i915.ko can still be loaded on such | ||
2183 | * old systems without an AcpiOpRegion. | ||
2184 | * | ||
2185 | * acpi_video_register() will report -ENODEV later as well due | ||
2186 | * to acpi_disabled when i915.ko tries to register itself afterwards. | ||
2187 | */ | ||
2188 | if (acpi_disabled) | ||
2189 | return 0; | ||
2190 | |||
2179 | dmi_check_system(video_dmi_table); | 2191 | dmi_check_system(video_dmi_table); |
2180 | 2192 | ||
2181 | if (intel_opregion_present()) | 2193 | if (intel_opregion_present()) |
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 33b09b6568a4..6607f3c6ace1 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
@@ -551,7 +551,6 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, | |||
551 | { | 551 | { |
552 | void *page_addr; | 552 | void *page_addr; |
553 | unsigned long user_page_addr; | 553 | unsigned long user_page_addr; |
554 | struct vm_struct tmp_area; | ||
555 | struct page **page; | 554 | struct page **page; |
556 | struct mm_struct *mm; | 555 | struct mm_struct *mm; |
557 | 556 | ||
@@ -600,10 +599,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, | |||
600 | proc->pid, page_addr); | 599 | proc->pid, page_addr); |
601 | goto err_alloc_page_failed; | 600 | goto err_alloc_page_failed; |
602 | } | 601 | } |
603 | tmp_area.addr = page_addr; | 602 | ret = map_kernel_range_noflush((unsigned long)page_addr, |
604 | tmp_area.size = PAGE_SIZE + PAGE_SIZE /* guard page? */; | 603 | PAGE_SIZE, PAGE_KERNEL, page); |
605 | ret = map_vm_area(&tmp_area, PAGE_KERNEL, page); | 604 | flush_cache_vmap((unsigned long)page_addr, |
606 | if (ret) { | 605 | (unsigned long)page_addr + PAGE_SIZE); |
606 | if (ret != 1) { | ||
607 | pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n", | 607 | pr_err("%d: binder_alloc_buf failed to map page at %p in kernel\n", |
608 | proc->pid, page_addr); | 608 | proc->pid, page_addr); |
609 | goto err_map_kernel_failed; | 609 | goto err_map_kernel_failed; |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index ba4abbe4693c..45937f88e77c 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -2242,7 +2242,7 @@ static void rtpm_status_str(struct seq_file *s, struct device *dev) | |||
2242 | } | 2242 | } |
2243 | 2243 | ||
2244 | static int pm_genpd_summary_one(struct seq_file *s, | 2244 | static int pm_genpd_summary_one(struct seq_file *s, |
2245 | struct generic_pm_domain *gpd) | 2245 | struct generic_pm_domain *genpd) |
2246 | { | 2246 | { |
2247 | static const char * const status_lookup[] = { | 2247 | static const char * const status_lookup[] = { |
2248 | [GPD_STATE_ACTIVE] = "on", | 2248 | [GPD_STATE_ACTIVE] = "on", |
@@ -2256,26 +2256,26 @@ static int pm_genpd_summary_one(struct seq_file *s, | |||
2256 | struct gpd_link *link; | 2256 | struct gpd_link *link; |
2257 | int ret; | 2257 | int ret; |
2258 | 2258 | ||
2259 | ret = mutex_lock_interruptible(&gpd->lock); | 2259 | ret = mutex_lock_interruptible(&genpd->lock); |
2260 | if (ret) | 2260 | if (ret) |
2261 | return -ERESTARTSYS; | 2261 | return -ERESTARTSYS; |
2262 | 2262 | ||
2263 | if (WARN_ON(gpd->status >= ARRAY_SIZE(status_lookup))) | 2263 | if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup))) |
2264 | goto exit; | 2264 | goto exit; |
2265 | seq_printf(s, "%-30s %-15s ", gpd->name, status_lookup[gpd->status]); | 2265 | seq_printf(s, "%-30s %-15s ", genpd->name, status_lookup[genpd->status]); |
2266 | 2266 | ||
2267 | /* | 2267 | /* |
2268 | * Modifications on the list require holding locks on both | 2268 | * Modifications on the list require holding locks on both |
2269 | * master and slave, so we are safe. | 2269 | * master and slave, so we are safe. |
2270 | * Also gpd->name is immutable. | 2270 | * Also genpd->name is immutable. |
2271 | */ | 2271 | */ |
2272 | list_for_each_entry(link, &gpd->master_links, master_node) { | 2272 | list_for_each_entry(link, &genpd->master_links, master_node) { |
2273 | seq_printf(s, "%s", link->slave->name); | 2273 | seq_printf(s, "%s", link->slave->name); |
2274 | if (!list_is_last(&link->master_node, &gpd->master_links)) | 2274 | if (!list_is_last(&link->master_node, &genpd->master_links)) |
2275 | seq_puts(s, ", "); | 2275 | seq_puts(s, ", "); |
2276 | } | 2276 | } |
2277 | 2277 | ||
2278 | list_for_each_entry(pm_data, &gpd->dev_list, list_node) { | 2278 | list_for_each_entry(pm_data, &genpd->dev_list, list_node) { |
2279 | kobj_path = kobject_get_path(&pm_data->dev->kobj, GFP_KERNEL); | 2279 | kobj_path = kobject_get_path(&pm_data->dev->kobj, GFP_KERNEL); |
2280 | if (kobj_path == NULL) | 2280 | if (kobj_path == NULL) |
2281 | continue; | 2281 | continue; |
@@ -2287,14 +2287,14 @@ static int pm_genpd_summary_one(struct seq_file *s, | |||
2287 | 2287 | ||
2288 | seq_puts(s, "\n"); | 2288 | seq_puts(s, "\n"); |
2289 | exit: | 2289 | exit: |
2290 | mutex_unlock(&gpd->lock); | 2290 | mutex_unlock(&genpd->lock); |
2291 | 2291 | ||
2292 | return 0; | 2292 | return 0; |
2293 | } | 2293 | } |
2294 | 2294 | ||
2295 | static int pm_genpd_summary_show(struct seq_file *s, void *data) | 2295 | static int pm_genpd_summary_show(struct seq_file *s, void *data) |
2296 | { | 2296 | { |
2297 | struct generic_pm_domain *gpd; | 2297 | struct generic_pm_domain *genpd; |
2298 | int ret = 0; | 2298 | int ret = 0; |
2299 | 2299 | ||
2300 | seq_puts(s, " domain status slaves\n"); | 2300 | seq_puts(s, " domain status slaves\n"); |
@@ -2305,8 +2305,8 @@ static int pm_genpd_summary_show(struct seq_file *s, void *data) | |||
2305 | if (ret) | 2305 | if (ret) |
2306 | return -ERESTARTSYS; | 2306 | return -ERESTARTSYS; |
2307 | 2307 | ||
2308 | list_for_each_entry(gpd, &gpd_list, gpd_list_node) { | 2308 | list_for_each_entry(genpd, &gpd_list, gpd_list_node) { |
2309 | ret = pm_genpd_summary_one(s, gpd); | 2309 | ret = pm_genpd_summary_one(s, genpd); |
2310 | if (ret) | 2310 | if (ret) |
2311 | break; | 2311 | break; |
2312 | } | 2312 | } |
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index c2744b30d5d9..aab7158d2afe 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
@@ -730,6 +730,7 @@ void pm_system_wakeup(void) | |||
730 | pm_abort_suspend = true; | 730 | pm_abort_suspend = true; |
731 | freeze_wake(); | 731 | freeze_wake(); |
732 | } | 732 | } |
733 | EXPORT_SYMBOL_GPL(pm_system_wakeup); | ||
733 | 734 | ||
734 | void pm_wakeup_clear(void) | 735 | void pm_wakeup_clear(void) |
735 | { | 736 | { |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index b64bccbb78c9..ceb32dd52a6c 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -482,6 +482,7 @@ static int nvme_error_status(u16 status) | |||
482 | } | 482 | } |
483 | } | 483 | } |
484 | 484 | ||
485 | #ifdef CONFIG_BLK_DEV_INTEGRITY | ||
485 | static void nvme_dif_prep(u32 p, u32 v, struct t10_pi_tuple *pi) | 486 | static void nvme_dif_prep(u32 p, u32 v, struct t10_pi_tuple *pi) |
486 | { | 487 | { |
487 | if (be32_to_cpu(pi->ref_tag) == v) | 488 | if (be32_to_cpu(pi->ref_tag) == v) |
@@ -538,6 +539,58 @@ static void nvme_dif_remap(struct request *req, | |||
538 | kunmap_atomic(pmap); | 539 | kunmap_atomic(pmap); |
539 | } | 540 | } |
540 | 541 | ||
542 | static int nvme_noop_verify(struct blk_integrity_iter *iter) | ||
543 | { | ||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | static int nvme_noop_generate(struct blk_integrity_iter *iter) | ||
548 | { | ||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | struct blk_integrity nvme_meta_noop = { | ||
553 | .name = "NVME_META_NOOP", | ||
554 | .generate_fn = nvme_noop_generate, | ||
555 | .verify_fn = nvme_noop_verify, | ||
556 | }; | ||
557 | |||
558 | static void nvme_init_integrity(struct nvme_ns *ns) | ||
559 | { | ||
560 | struct blk_integrity integrity; | ||
561 | |||
562 | switch (ns->pi_type) { | ||
563 | case NVME_NS_DPS_PI_TYPE3: | ||
564 | integrity = t10_pi_type3_crc; | ||
565 | break; | ||
566 | case NVME_NS_DPS_PI_TYPE1: | ||
567 | case NVME_NS_DPS_PI_TYPE2: | ||
568 | integrity = t10_pi_type1_crc; | ||
569 | break; | ||
570 | default: | ||
571 | integrity = nvme_meta_noop; | ||
572 | break; | ||
573 | } | ||
574 | integrity.tuple_size = ns->ms; | ||
575 | blk_integrity_register(ns->disk, &integrity); | ||
576 | blk_queue_max_integrity_segments(ns->queue, 1); | ||
577 | } | ||
578 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | ||
579 | static void nvme_dif_remap(struct request *req, | ||
580 | void (*dif_swap)(u32 p, u32 v, struct t10_pi_tuple *pi)) | ||
581 | { | ||
582 | } | ||
583 | static void nvme_dif_prep(u32 p, u32 v, struct t10_pi_tuple *pi) | ||
584 | { | ||
585 | } | ||
586 | static void nvme_dif_complete(u32 p, u32 v, struct t10_pi_tuple *pi) | ||
587 | { | ||
588 | } | ||
589 | static void nvme_init_integrity(struct nvme_ns *ns) | ||
590 | { | ||
591 | } | ||
592 | #endif | ||
593 | |||
541 | static void req_completion(struct nvme_queue *nvmeq, void *ctx, | 594 | static void req_completion(struct nvme_queue *nvmeq, void *ctx, |
542 | struct nvme_completion *cqe) | 595 | struct nvme_completion *cqe) |
543 | { | 596 | { |
@@ -1959,43 +2012,6 @@ static void nvme_config_discard(struct nvme_ns *ns) | |||
1959 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, ns->queue); | 2012 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, ns->queue); |
1960 | } | 2013 | } |
1961 | 2014 | ||
1962 | static int nvme_noop_verify(struct blk_integrity_iter *iter) | ||
1963 | { | ||
1964 | return 0; | ||
1965 | } | ||
1966 | |||
1967 | static int nvme_noop_generate(struct blk_integrity_iter *iter) | ||
1968 | { | ||
1969 | return 0; | ||
1970 | } | ||
1971 | |||
1972 | struct blk_integrity nvme_meta_noop = { | ||
1973 | .name = "NVME_META_NOOP", | ||
1974 | .generate_fn = nvme_noop_generate, | ||
1975 | .verify_fn = nvme_noop_verify, | ||
1976 | }; | ||
1977 | |||
1978 | static void nvme_init_integrity(struct nvme_ns *ns) | ||
1979 | { | ||
1980 | struct blk_integrity integrity; | ||
1981 | |||
1982 | switch (ns->pi_type) { | ||
1983 | case NVME_NS_DPS_PI_TYPE3: | ||
1984 | integrity = t10_pi_type3_crc; | ||
1985 | break; | ||
1986 | case NVME_NS_DPS_PI_TYPE1: | ||
1987 | case NVME_NS_DPS_PI_TYPE2: | ||
1988 | integrity = t10_pi_type1_crc; | ||
1989 | break; | ||
1990 | default: | ||
1991 | integrity = nvme_meta_noop; | ||
1992 | break; | ||
1993 | } | ||
1994 | integrity.tuple_size = ns->ms; | ||
1995 | blk_integrity_register(ns->disk, &integrity); | ||
1996 | blk_queue_max_integrity_segments(ns->queue, 1); | ||
1997 | } | ||
1998 | |||
1999 | static int nvme_revalidate_disk(struct gendisk *disk) | 2015 | static int nvme_revalidate_disk(struct gendisk *disk) |
2000 | { | 2016 | { |
2001 | struct nvme_ns *ns = disk->private_data; | 2017 | struct nvme_ns *ns = disk->private_data; |
@@ -2036,7 +2052,8 @@ static int nvme_revalidate_disk(struct gendisk *disk) | |||
2036 | pi_type = ns->ms == sizeof(struct t10_pi_tuple) ? | 2052 | pi_type = ns->ms == sizeof(struct t10_pi_tuple) ? |
2037 | id->dps & NVME_NS_DPS_PI_MASK : 0; | 2053 | id->dps & NVME_NS_DPS_PI_MASK : 0; |
2038 | 2054 | ||
2039 | if (disk->integrity && (ns->pi_type != pi_type || ns->ms != old_ms || | 2055 | if (blk_get_integrity(disk) && (ns->pi_type != pi_type || |
2056 | ns->ms != old_ms || | ||
2040 | bs != queue_logical_block_size(disk->queue) || | 2057 | bs != queue_logical_block_size(disk->queue) || |
2041 | (ns->ms && id->flbas & NVME_NS_FLBAS_META_EXT))) | 2058 | (ns->ms && id->flbas & NVME_NS_FLBAS_META_EXT))) |
2042 | blk_integrity_unregister(disk); | 2059 | blk_integrity_unregister(disk); |
@@ -2044,11 +2061,11 @@ static int nvme_revalidate_disk(struct gendisk *disk) | |||
2044 | ns->pi_type = pi_type; | 2061 | ns->pi_type = pi_type; |
2045 | blk_queue_logical_block_size(ns->queue, bs); | 2062 | blk_queue_logical_block_size(ns->queue, bs); |
2046 | 2063 | ||
2047 | if (ns->ms && !disk->integrity && (disk->flags & GENHD_FL_UP) && | 2064 | if (ns->ms && !blk_get_integrity(disk) && (disk->flags & GENHD_FL_UP) && |
2048 | !(id->flbas & NVME_NS_FLBAS_META_EXT)) | 2065 | !(id->flbas & NVME_NS_FLBAS_META_EXT)) |
2049 | nvme_init_integrity(ns); | 2066 | nvme_init_integrity(ns); |
2050 | 2067 | ||
2051 | if (id->ncap == 0 || (ns->ms && !disk->integrity)) | 2068 | if (id->ncap == 0 || (ns->ms && !blk_get_integrity(disk))) |
2052 | set_capacity(disk, 0); | 2069 | set_capacity(disk, 0); |
2053 | else | 2070 | else |
2054 | set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9)); | 2071 | set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9)); |
@@ -2652,7 +2669,7 @@ static void nvme_dev_remove(struct nvme_dev *dev) | |||
2652 | 2669 | ||
2653 | list_for_each_entry(ns, &dev->namespaces, list) { | 2670 | list_for_each_entry(ns, &dev->namespaces, list) { |
2654 | if (ns->disk->flags & GENHD_FL_UP) { | 2671 | if (ns->disk->flags & GENHD_FL_UP) { |
2655 | if (ns->disk->integrity) | 2672 | if (blk_get_integrity(ns->disk)) |
2656 | blk_integrity_unregister(ns->disk); | 2673 | blk_integrity_unregister(ns->disk); |
2657 | del_gendisk(ns->disk); | 2674 | del_gendisk(ns->disk); |
2658 | } | 2675 | } |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 8e233edd7a09..871bd3550cb0 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -528,7 +528,7 @@ out_cleanup: | |||
528 | static inline void update_used_max(struct zram *zram, | 528 | static inline void update_used_max(struct zram *zram, |
529 | const unsigned long pages) | 529 | const unsigned long pages) |
530 | { | 530 | { |
531 | int old_max, cur_max; | 531 | unsigned long old_max, cur_max; |
532 | 532 | ||
533 | old_max = atomic_long_read(&zram->stats.max_used_pages); | 533 | old_max = atomic_long_read(&zram->stats.max_used_pages); |
534 | 534 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index b87688881143..8bfc4c2bba87 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -272,6 +272,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
272 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | 272 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, |
273 | 273 | ||
274 | /* Intel Bluetooth devices */ | 274 | /* Intel Bluetooth devices */ |
275 | { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, | ||
275 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, | 276 | { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL }, |
276 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, | 277 | { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL }, |
277 | { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_NEW }, | 278 | { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_NEW }, |
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index f07c8152e5cc..3f27d21fb729 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c | |||
@@ -89,12 +89,29 @@ static int pmc_irq_set_type(struct irq_data *d, unsigned type) | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | static void pmc_irq_suspend(struct irq_data *d) | ||
93 | { | ||
94 | struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); | ||
95 | |||
96 | pmc->imr = pmc_read(pmc, AT91_PMC_IMR); | ||
97 | pmc_write(pmc, AT91_PMC_IDR, pmc->imr); | ||
98 | } | ||
99 | |||
100 | static void pmc_irq_resume(struct irq_data *d) | ||
101 | { | ||
102 | struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); | ||
103 | |||
104 | pmc_write(pmc, AT91_PMC_IER, pmc->imr); | ||
105 | } | ||
106 | |||
92 | static struct irq_chip pmc_irq = { | 107 | static struct irq_chip pmc_irq = { |
93 | .name = "PMC", | 108 | .name = "PMC", |
94 | .irq_disable = pmc_irq_mask, | 109 | .irq_disable = pmc_irq_mask, |
95 | .irq_mask = pmc_irq_mask, | 110 | .irq_mask = pmc_irq_mask, |
96 | .irq_unmask = pmc_irq_unmask, | 111 | .irq_unmask = pmc_irq_unmask, |
97 | .irq_set_type = pmc_irq_set_type, | 112 | .irq_set_type = pmc_irq_set_type, |
113 | .irq_suspend = pmc_irq_suspend, | ||
114 | .irq_resume = pmc_irq_resume, | ||
98 | }; | 115 | }; |
99 | 116 | ||
100 | static struct lock_class_key pmc_lock_class; | 117 | static struct lock_class_key pmc_lock_class; |
@@ -224,7 +241,8 @@ static struct at91_pmc *__init at91_pmc_init(struct device_node *np, | |||
224 | goto out_free_pmc; | 241 | goto out_free_pmc; |
225 | 242 | ||
226 | pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); | 243 | pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); |
227 | if (request_irq(pmc->virq, pmc_irq_handler, IRQF_SHARED, "pmc", pmc)) | 244 | if (request_irq(pmc->virq, pmc_irq_handler, |
245 | IRQF_SHARED | IRQF_COND_SUSPEND, "pmc", pmc)) | ||
228 | goto out_remove_irqdomain; | 246 | goto out_remove_irqdomain; |
229 | 247 | ||
230 | return pmc; | 248 | return pmc; |
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h index 52d2041fa3f6..69abb08cf146 100644 --- a/drivers/clk/at91/pmc.h +++ b/drivers/clk/at91/pmc.h | |||
@@ -33,6 +33,7 @@ struct at91_pmc { | |||
33 | spinlock_t lock; | 33 | spinlock_t lock; |
34 | const struct at91_pmc_caps *caps; | 34 | const struct at91_pmc_caps *caps; |
35 | struct irq_domain *irqdomain; | 35 | struct irq_domain *irqdomain; |
36 | u32 imr; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static inline void pmc_lock(struct at91_pmc *pmc) | 39 | static inline void pmc_lock(struct at91_pmc *pmc) |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 1c2506f68122..68161f7a07d6 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -63,6 +63,11 @@ config VT8500_TIMER | |||
63 | config CADENCE_TTC_TIMER | 63 | config CADENCE_TTC_TIMER |
64 | bool | 64 | bool |
65 | 65 | ||
66 | config ASM9260_TIMER | ||
67 | bool | ||
68 | select CLKSRC_MMIO | ||
69 | select CLKSRC_OF | ||
70 | |||
66 | config CLKSRC_NOMADIK_MTU | 71 | config CLKSRC_NOMADIK_MTU |
67 | bool | 72 | bool |
68 | depends on (ARCH_NOMADIK || ARCH_U8500) | 73 | depends on (ARCH_NOMADIK || ARCH_U8500) |
@@ -245,15 +250,4 @@ config CLKSRC_PXA | |||
245 | help | 250 | help |
246 | This enables OST0 support available on PXA and SA-11x0 | 251 | This enables OST0 support available on PXA and SA-11x0 |
247 | platforms. | 252 | platforms. |
248 | |||
249 | config ASM9260_TIMER | ||
250 | bool "Alphascale ASM9260 timer driver" | ||
251 | depends on GENERIC_CLOCKEVENTS | ||
252 | select CLKSRC_MMIO | ||
253 | select CLKSRC_OF | ||
254 | default y if MACH_ASM9260 | ||
255 | help | ||
256 | This enables build of a clocksource and clockevent driver for | ||
257 | the 32-bit System Timer hardware available on a Alphascale ASM9260. | ||
258 | |||
259 | endmenu | 253 | endmenu |
diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c index 32a3d25795d3..68ab42356d0e 100644 --- a/drivers/clocksource/mtk_timer.c +++ b/drivers/clocksource/mtk_timer.c | |||
@@ -224,6 +224,8 @@ static void __init mtk_timer_init(struct device_node *node) | |||
224 | } | 224 | } |
225 | rate = clk_get_rate(clk); | 225 | rate = clk_get_rate(clk); |
226 | 226 | ||
227 | mtk_timer_global_reset(evt); | ||
228 | |||
227 | if (request_irq(evt->dev.irq, mtk_timer_interrupt, | 229 | if (request_irq(evt->dev.irq, mtk_timer_interrupt, |
228 | IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) { | 230 | IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) { |
229 | pr_warn("failed to setup irq %d\n", evt->dev.irq); | 231 | pr_warn("failed to setup irq %d\n", evt->dev.irq); |
@@ -232,8 +234,6 @@ static void __init mtk_timer_init(struct device_node *node) | |||
232 | 234 | ||
233 | evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); | 235 | evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); |
234 | 236 | ||
235 | mtk_timer_global_reset(evt); | ||
236 | |||
237 | /* Configure clock source */ | 237 | /* Configure clock source */ |
238 | mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN); | 238 | mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN); |
239 | clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC), | 239 | clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC), |
@@ -241,10 +241,11 @@ static void __init mtk_timer_init(struct device_node *node) | |||
241 | 241 | ||
242 | /* Configure clock event */ | 242 | /* Configure clock event */ |
243 | mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT); | 243 | mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT); |
244 | mtk_timer_enable_irq(evt, GPT_CLK_EVT); | ||
245 | |||
246 | clockevents_config_and_register(&evt->dev, rate, 0x3, | 244 | clockevents_config_and_register(&evt->dev, rate, 0x3, |
247 | 0xffffffff); | 245 | 0xffffffff); |
246 | |||
247 | mtk_timer_enable_irq(evt, GPT_CLK_EVT); | ||
248 | |||
248 | return; | 249 | return; |
249 | 250 | ||
250 | err_clk_disable: | 251 | err_clk_disable: |
diff --git a/drivers/clocksource/pxa_timer.c b/drivers/clocksource/pxa_timer.c index 941f3f344e08..d9438af2bbd6 100644 --- a/drivers/clocksource/pxa_timer.c +++ b/drivers/clocksource/pxa_timer.c | |||
@@ -163,7 +163,7 @@ static struct irqaction pxa_ost0_irq = { | |||
163 | .dev_id = &ckevt_pxa_osmr0, | 163 | .dev_id = &ckevt_pxa_osmr0, |
164 | }; | 164 | }; |
165 | 165 | ||
166 | static void pxa_timer_common_init(int irq, unsigned long clock_tick_rate) | 166 | static void __init pxa_timer_common_init(int irq, unsigned long clock_tick_rate) |
167 | { | 167 | { |
168 | timer_writel(0, OIER); | 168 | timer_writel(0, OIER); |
169 | timer_writel(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); | 169 | timer_writel(OSSR_M0 | OSSR_M1 | OSSR_M2 | OSSR_M3, OSSR); |
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 5e98c6b1f284..82d2fbb20f7e 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
@@ -159,7 +159,7 @@ static struct cpufreq_driver exynos_driver = { | |||
159 | 159 | ||
160 | static int exynos_cpufreq_probe(struct platform_device *pdev) | 160 | static int exynos_cpufreq_probe(struct platform_device *pdev) |
161 | { | 161 | { |
162 | struct device_node *cpus, *np; | 162 | struct device_node *cpu0; |
163 | int ret = -EINVAL; | 163 | int ret = -EINVAL; |
164 | 164 | ||
165 | exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); | 165 | exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL); |
@@ -206,28 +206,19 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
206 | if (ret) | 206 | if (ret) |
207 | goto err_cpufreq_reg; | 207 | goto err_cpufreq_reg; |
208 | 208 | ||
209 | cpus = of_find_node_by_path("/cpus"); | 209 | cpu0 = of_get_cpu_node(0, NULL); |
210 | if (!cpus) { | 210 | if (!cpu0) { |
211 | pr_err("failed to find cpus node\n"); | 211 | pr_err("failed to find cpu0 node\n"); |
212 | return 0; | 212 | return 0; |
213 | } | 213 | } |
214 | 214 | ||
215 | np = of_get_next_child(cpus, NULL); | 215 | if (of_find_property(cpu0, "#cooling-cells", NULL)) { |
216 | if (!np) { | 216 | cdev = of_cpufreq_cooling_register(cpu0, |
217 | pr_err("failed to find cpus child node\n"); | ||
218 | of_node_put(cpus); | ||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | if (of_find_property(np, "#cooling-cells", NULL)) { | ||
223 | cdev = of_cpufreq_cooling_register(np, | ||
224 | cpu_present_mask); | 217 | cpu_present_mask); |
225 | if (IS_ERR(cdev)) | 218 | if (IS_ERR(cdev)) |
226 | pr_err("running cpufreq without cooling device: %ld\n", | 219 | pr_err("running cpufreq without cooling device: %ld\n", |
227 | PTR_ERR(cdev)); | 220 | PTR_ERR(cdev)); |
228 | } | 221 | } |
229 | of_node_put(np); | ||
230 | of_node_put(cpus); | ||
231 | 222 | ||
232 | return 0; | 223 | return 0; |
233 | 224 | ||
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index bee5df7794d3..7cb4b766cf94 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
23 | #include <sysdev/fsl_soc.h> | 23 | #include <sysdev/fsl_soc.h> |
24 | 24 | ||
25 | #include <asm/smp.h> /* for get_hard_smp_processor_id() in UP configs */ | ||
26 | |||
25 | /** | 27 | /** |
26 | * struct cpu_data - per CPU data struct | 28 | * struct cpu_data - per CPU data struct |
27 | * @parent: the parent node of cpu clock | 29 | * @parent: the parent node of cpu clock |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 4d534582514e..080bd2dbde4b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -44,6 +44,12 @@ void disable_cpuidle(void) | |||
44 | off = 1; | 44 | off = 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool cpuidle_not_available(struct cpuidle_driver *drv, | ||
48 | struct cpuidle_device *dev) | ||
49 | { | ||
50 | return off || !initialized || !drv || !dev || !dev->enabled; | ||
51 | } | ||
52 | |||
47 | /** | 53 | /** |
48 | * cpuidle_play_dead - cpu off-lining | 54 | * cpuidle_play_dead - cpu off-lining |
49 | * | 55 | * |
@@ -66,14 +72,8 @@ int cpuidle_play_dead(void) | |||
66 | return -ENODEV; | 72 | return -ENODEV; |
67 | } | 73 | } |
68 | 74 | ||
69 | /** | 75 | static int find_deepest_state(struct cpuidle_driver *drv, |
70 | * cpuidle_find_deepest_state - Find deepest state meeting specific conditions. | 76 | struct cpuidle_device *dev, bool freeze) |
71 | * @drv: cpuidle driver for the given CPU. | ||
72 | * @dev: cpuidle device for the given CPU. | ||
73 | * @freeze: Whether or not the state should be suitable for suspend-to-idle. | ||
74 | */ | ||
75 | static int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | ||
76 | struct cpuidle_device *dev, bool freeze) | ||
77 | { | 77 | { |
78 | unsigned int latency_req = 0; | 78 | unsigned int latency_req = 0; |
79 | int i, ret = freeze ? -1 : CPUIDLE_DRIVER_STATE_START - 1; | 79 | int i, ret = freeze ? -1 : CPUIDLE_DRIVER_STATE_START - 1; |
@@ -92,6 +92,17 @@ static int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | |||
92 | return ret; | 92 | return ret; |
93 | } | 93 | } |
94 | 94 | ||
95 | /** | ||
96 | * cpuidle_find_deepest_state - Find the deepest available idle state. | ||
97 | * @drv: cpuidle driver for the given CPU. | ||
98 | * @dev: cpuidle device for the given CPU. | ||
99 | */ | ||
100 | int cpuidle_find_deepest_state(struct cpuidle_driver *drv, | ||
101 | struct cpuidle_device *dev) | ||
102 | { | ||
103 | return find_deepest_state(drv, dev, false); | ||
104 | } | ||
105 | |||
95 | static void enter_freeze_proper(struct cpuidle_driver *drv, | 106 | static void enter_freeze_proper(struct cpuidle_driver *drv, |
96 | struct cpuidle_device *dev, int index) | 107 | struct cpuidle_device *dev, int index) |
97 | { | 108 | { |
@@ -113,15 +124,14 @@ static void enter_freeze_proper(struct cpuidle_driver *drv, | |||
113 | 124 | ||
114 | /** | 125 | /** |
115 | * cpuidle_enter_freeze - Enter an idle state suitable for suspend-to-idle. | 126 | * cpuidle_enter_freeze - Enter an idle state suitable for suspend-to-idle. |
127 | * @drv: cpuidle driver for the given CPU. | ||
128 | * @dev: cpuidle device for the given CPU. | ||
116 | * | 129 | * |
117 | * If there are states with the ->enter_freeze callback, find the deepest of | 130 | * If there are states with the ->enter_freeze callback, find the deepest of |
118 | * them and enter it with frozen tick. Otherwise, find the deepest state | 131 | * them and enter it with frozen tick. |
119 | * available and enter it normally. | ||
120 | */ | 132 | */ |
121 | void cpuidle_enter_freeze(void) | 133 | int cpuidle_enter_freeze(struct cpuidle_driver *drv, struct cpuidle_device *dev) |
122 | { | 134 | { |
123 | struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); | ||
124 | struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); | ||
125 | int index; | 135 | int index; |
126 | 136 | ||
127 | /* | 137 | /* |
@@ -129,24 +139,11 @@ void cpuidle_enter_freeze(void) | |||
129 | * that interrupts won't be enabled when it exits and allows the tick to | 139 | * that interrupts won't be enabled when it exits and allows the tick to |
130 | * be frozen safely. | 140 | * be frozen safely. |
131 | */ | 141 | */ |
132 | index = cpuidle_find_deepest_state(drv, dev, true); | 142 | index = find_deepest_state(drv, dev, true); |
133 | if (index >= 0) { | ||
134 | enter_freeze_proper(drv, dev, index); | ||
135 | return; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * It is not safe to freeze the tick, find the deepest state available | ||
140 | * at all and try to enter it normally. | ||
141 | */ | ||
142 | index = cpuidle_find_deepest_state(drv, dev, false); | ||
143 | if (index >= 0) | 143 | if (index >= 0) |
144 | cpuidle_enter(drv, dev, index); | 144 | enter_freeze_proper(drv, dev, index); |
145 | else | ||
146 | arch_cpu_idle(); | ||
147 | 145 | ||
148 | /* Interrupts are enabled again here. */ | 146 | return index; |
149 | local_irq_disable(); | ||
150 | } | 147 | } |
151 | 148 | ||
152 | /** | 149 | /** |
@@ -205,12 +202,6 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, | |||
205 | */ | 202 | */ |
206 | int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | 203 | int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) |
207 | { | 204 | { |
208 | if (off || !initialized) | ||
209 | return -ENODEV; | ||
210 | |||
211 | if (!drv || !dev || !dev->enabled) | ||
212 | return -EBUSY; | ||
213 | |||
214 | return cpuidle_curr_governor->select(drv, dev); | 205 | return cpuidle_curr_governor->select(drv, dev); |
215 | } | 206 | } |
216 | 207 | ||
diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c index e5541117b3e9..50ef8bd8708b 100644 --- a/drivers/dma-buf/fence.c +++ b/drivers/dma-buf/fence.c | |||
@@ -159,6 +159,9 @@ fence_wait_timeout(struct fence *fence, bool intr, signed long timeout) | |||
159 | if (WARN_ON(timeout < 0)) | 159 | if (WARN_ON(timeout < 0)) |
160 | return -EINVAL; | 160 | return -EINVAL; |
161 | 161 | ||
162 | if (timeout == 0) | ||
163 | return fence_is_signaled(fence); | ||
164 | |||
162 | trace_fence_wait_start(fence); | 165 | trace_fence_wait_start(fence); |
163 | ret = fence->ops->wait(fence, intr, timeout); | 166 | ret = fence->ops->wait(fence, intr, timeout); |
164 | trace_fence_wait_end(fence); | 167 | trace_fence_wait_end(fence); |
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index 3c97c8fa8d02..39920d77f288 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c | |||
@@ -327,6 +327,9 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, | |||
327 | unsigned seq, shared_count, i = 0; | 327 | unsigned seq, shared_count, i = 0; |
328 | long ret = timeout; | 328 | long ret = timeout; |
329 | 329 | ||
330 | if (!timeout) | ||
331 | return reservation_object_test_signaled_rcu(obj, wait_all); | ||
332 | |||
330 | retry: | 333 | retry: |
331 | fence = NULL; | 334 | fence = NULL; |
332 | shared_count = 0; | 335 | shared_count = 0; |
@@ -402,8 +405,6 @@ reservation_object_test_signaled_single(struct fence *passed_fence) | |||
402 | int ret = 1; | 405 | int ret = 1; |
403 | 406 | ||
404 | if (!test_bit(FENCE_FLAG_SIGNALED_BIT, &lfence->flags)) { | 407 | if (!test_bit(FENCE_FLAG_SIGNALED_BIT, &lfence->flags)) { |
405 | int ret; | ||
406 | |||
407 | fence = fence_get_rcu(lfence); | 408 | fence = fence_get_rcu(lfence); |
408 | if (!fence) | 409 | if (!fence) |
409 | return -1; | 410 | return -1; |
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 09e2825a547a..d9891d3461f6 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c | |||
@@ -664,7 +664,6 @@ at_xdmac_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, | |||
664 | struct at_xdmac_desc *first = NULL, *prev = NULL; | 664 | struct at_xdmac_desc *first = NULL, *prev = NULL; |
665 | unsigned int periods = buf_len / period_len; | 665 | unsigned int periods = buf_len / period_len; |
666 | int i; | 666 | int i; |
667 | u32 cfg; | ||
668 | 667 | ||
669 | dev_dbg(chan2dev(chan), "%s: buf_addr=%pad, buf_len=%zd, period_len=%zd, dir=%s, flags=0x%lx\n", | 668 | dev_dbg(chan2dev(chan), "%s: buf_addr=%pad, buf_len=%zd, period_len=%zd, dir=%s, flags=0x%lx\n", |
670 | __func__, &buf_addr, buf_len, period_len, | 669 | __func__, &buf_addr, buf_len, period_len, |
@@ -700,17 +699,17 @@ at_xdmac_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, | |||
700 | if (direction == DMA_DEV_TO_MEM) { | 699 | if (direction == DMA_DEV_TO_MEM) { |
701 | desc->lld.mbr_sa = atchan->per_src_addr; | 700 | desc->lld.mbr_sa = atchan->per_src_addr; |
702 | desc->lld.mbr_da = buf_addr + i * period_len; | 701 | desc->lld.mbr_da = buf_addr + i * period_len; |
703 | cfg = atchan->cfg[AT_XDMAC_DEV_TO_MEM_CFG]; | 702 | desc->lld.mbr_cfg = atchan->cfg[AT_XDMAC_DEV_TO_MEM_CFG]; |
704 | } else { | 703 | } else { |
705 | desc->lld.mbr_sa = buf_addr + i * period_len; | 704 | desc->lld.mbr_sa = buf_addr + i * period_len; |
706 | desc->lld.mbr_da = atchan->per_dst_addr; | 705 | desc->lld.mbr_da = atchan->per_dst_addr; |
707 | cfg = atchan->cfg[AT_XDMAC_MEM_TO_DEV_CFG]; | 706 | desc->lld.mbr_cfg = atchan->cfg[AT_XDMAC_MEM_TO_DEV_CFG]; |
708 | } | 707 | } |
709 | desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV1 | 708 | desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV1 |
710 | | AT_XDMAC_MBR_UBC_NDEN | 709 | | AT_XDMAC_MBR_UBC_NDEN |
711 | | AT_XDMAC_MBR_UBC_NSEN | 710 | | AT_XDMAC_MBR_UBC_NSEN |
712 | | AT_XDMAC_MBR_UBC_NDE | 711 | | AT_XDMAC_MBR_UBC_NDE |
713 | | period_len >> at_xdmac_get_dwidth(cfg); | 712 | | period_len >> at_xdmac_get_dwidth(desc->lld.mbr_cfg); |
714 | 713 | ||
715 | dev_dbg(chan2dev(chan), | 714 | dev_dbg(chan2dev(chan), |
716 | "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n", | 715 | "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n", |
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 455b7a4f1e87..a8ad05291b27 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
@@ -626,7 +626,7 @@ static irqreturn_t dw_dma_interrupt(int irq, void *dev_id) | |||
626 | dev_vdbg(dw->dma.dev, "%s: status=0x%x\n", __func__, status); | 626 | dev_vdbg(dw->dma.dev, "%s: status=0x%x\n", __func__, status); |
627 | 627 | ||
628 | /* Check if we have any interrupt from the DMAC */ | 628 | /* Check if we have any interrupt from the DMAC */ |
629 | if (!status) | 629 | if (!status || !dw->in_use) |
630 | return IRQ_NONE; | 630 | return IRQ_NONE; |
631 | 631 | ||
632 | /* | 632 | /* |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 77a6dcf25b98..194ec20c9408 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -230,6 +230,10 @@ static bool is_bwd_noraid(struct pci_dev *pdev) | |||
230 | switch (pdev->device) { | 230 | switch (pdev->device) { |
231 | case PCI_DEVICE_ID_INTEL_IOAT_BWD2: | 231 | case PCI_DEVICE_ID_INTEL_IOAT_BWD2: |
232 | case PCI_DEVICE_ID_INTEL_IOAT_BWD3: | 232 | case PCI_DEVICE_ID_INTEL_IOAT_BWD3: |
233 | case PCI_DEVICE_ID_INTEL_IOAT_BDXDE0: | ||
234 | case PCI_DEVICE_ID_INTEL_IOAT_BDXDE1: | ||
235 | case PCI_DEVICE_ID_INTEL_IOAT_BDXDE2: | ||
236 | case PCI_DEVICE_ID_INTEL_IOAT_BDXDE3: | ||
233 | return true; | 237 | return true; |
234 | default: | 238 | default: |
235 | return false; | 239 | return false; |
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 8926f271904e..eb410044e1af 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -219,6 +219,9 @@ static irqreturn_t mmp_pdma_int_handler(int irq, void *dev_id) | |||
219 | 219 | ||
220 | while (dint) { | 220 | while (dint) { |
221 | i = __ffs(dint); | 221 | i = __ffs(dint); |
222 | /* only handle interrupts belonging to pdma driver*/ | ||
223 | if (i >= pdev->dma_channels) | ||
224 | break; | ||
222 | dint &= (dint - 1); | 225 | dint &= (dint - 1); |
223 | phy = &pdev->phy[i]; | 226 | phy = &pdev->phy[i]; |
224 | ret = mmp_pdma_chan_handler(irq, phy); | 227 | ret = mmp_pdma_chan_handler(irq, phy); |
@@ -999,6 +1002,9 @@ static int mmp_pdma_probe(struct platform_device *op) | |||
999 | struct resource *iores; | 1002 | struct resource *iores; |
1000 | int i, ret, irq = 0; | 1003 | int i, ret, irq = 0; |
1001 | int dma_channels = 0, irq_num = 0; | 1004 | int dma_channels = 0, irq_num = 0; |
1005 | const enum dma_slave_buswidth widths = | ||
1006 | DMA_SLAVE_BUSWIDTH_1_BYTE | DMA_SLAVE_BUSWIDTH_2_BYTES | | ||
1007 | DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1002 | 1008 | ||
1003 | pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL); | 1009 | pdev = devm_kzalloc(&op->dev, sizeof(*pdev), GFP_KERNEL); |
1004 | if (!pdev) | 1010 | if (!pdev) |
@@ -1066,6 +1072,10 @@ static int mmp_pdma_probe(struct platform_device *op) | |||
1066 | pdev->device.device_config = mmp_pdma_config; | 1072 | pdev->device.device_config = mmp_pdma_config; |
1067 | pdev->device.device_terminate_all = mmp_pdma_terminate_all; | 1073 | pdev->device.device_terminate_all = mmp_pdma_terminate_all; |
1068 | pdev->device.copy_align = PDMA_ALIGNMENT; | 1074 | pdev->device.copy_align = PDMA_ALIGNMENT; |
1075 | pdev->device.src_addr_widths = widths; | ||
1076 | pdev->device.dst_addr_widths = widths; | ||
1077 | pdev->device.directions = BIT(DMA_MEM_TO_DEV) | BIT(DMA_DEV_TO_MEM); | ||
1078 | pdev->device.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR; | ||
1069 | 1079 | ||
1070 | if (pdev->dev->coherent_dma_mask) | 1080 | if (pdev->dev->coherent_dma_mask) |
1071 | dma_set_mask(pdev->dev, pdev->dev->coherent_dma_mask); | 1081 | dma_set_mask(pdev->dev, pdev->dev->coherent_dma_mask); |
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index 70c2fa9963cd..b6f4e1fc9c78 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c | |||
@@ -110,7 +110,7 @@ struct mmp_tdma_chan { | |||
110 | struct tasklet_struct tasklet; | 110 | struct tasklet_struct tasklet; |
111 | 111 | ||
112 | struct mmp_tdma_desc *desc_arr; | 112 | struct mmp_tdma_desc *desc_arr; |
113 | phys_addr_t desc_arr_phys; | 113 | dma_addr_t desc_arr_phys; |
114 | int desc_num; | 114 | int desc_num; |
115 | enum dma_transfer_direction dir; | 115 | enum dma_transfer_direction dir; |
116 | dma_addr_t dev_addr; | 116 | dma_addr_t dev_addr; |
@@ -166,9 +166,12 @@ static void mmp_tdma_enable_chan(struct mmp_tdma_chan *tdmac) | |||
166 | static int mmp_tdma_disable_chan(struct dma_chan *chan) | 166 | static int mmp_tdma_disable_chan(struct dma_chan *chan) |
167 | { | 167 | { |
168 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); | 168 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); |
169 | u32 tdcr; | ||
169 | 170 | ||
170 | writel(readl(tdmac->reg_base + TDCR) & ~TDCR_CHANEN, | 171 | tdcr = readl(tdmac->reg_base + TDCR); |
171 | tdmac->reg_base + TDCR); | 172 | tdcr |= TDCR_ABR; |
173 | tdcr &= ~TDCR_CHANEN; | ||
174 | writel(tdcr, tdmac->reg_base + TDCR); | ||
172 | 175 | ||
173 | tdmac->status = DMA_COMPLETE; | 176 | tdmac->status = DMA_COMPLETE; |
174 | 177 | ||
@@ -296,12 +299,27 @@ static int mmp_tdma_clear_chan_irq(struct mmp_tdma_chan *tdmac) | |||
296 | return -EAGAIN; | 299 | return -EAGAIN; |
297 | } | 300 | } |
298 | 301 | ||
302 | static size_t mmp_tdma_get_pos(struct mmp_tdma_chan *tdmac) | ||
303 | { | ||
304 | size_t reg; | ||
305 | |||
306 | if (tdmac->idx == 0) { | ||
307 | reg = __raw_readl(tdmac->reg_base + TDSAR); | ||
308 | reg -= tdmac->desc_arr[0].src_addr; | ||
309 | } else if (tdmac->idx == 1) { | ||
310 | reg = __raw_readl(tdmac->reg_base + TDDAR); | ||
311 | reg -= tdmac->desc_arr[0].dst_addr; | ||
312 | } else | ||
313 | return -EINVAL; | ||
314 | |||
315 | return reg; | ||
316 | } | ||
317 | |||
299 | static irqreturn_t mmp_tdma_chan_handler(int irq, void *dev_id) | 318 | static irqreturn_t mmp_tdma_chan_handler(int irq, void *dev_id) |
300 | { | 319 | { |
301 | struct mmp_tdma_chan *tdmac = dev_id; | 320 | struct mmp_tdma_chan *tdmac = dev_id; |
302 | 321 | ||
303 | if (mmp_tdma_clear_chan_irq(tdmac) == 0) { | 322 | if (mmp_tdma_clear_chan_irq(tdmac) == 0) { |
304 | tdmac->pos = (tdmac->pos + tdmac->period_len) % tdmac->buf_len; | ||
305 | tasklet_schedule(&tdmac->tasklet); | 323 | tasklet_schedule(&tdmac->tasklet); |
306 | return IRQ_HANDLED; | 324 | return IRQ_HANDLED; |
307 | } else | 325 | } else |
@@ -343,7 +361,7 @@ static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac) | |||
343 | int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); | 361 | int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); |
344 | 362 | ||
345 | gpool = tdmac->pool; | 363 | gpool = tdmac->pool; |
346 | if (tdmac->desc_arr) | 364 | if (gpool && tdmac->desc_arr) |
347 | gen_pool_free(gpool, (unsigned long)tdmac->desc_arr, | 365 | gen_pool_free(gpool, (unsigned long)tdmac->desc_arr, |
348 | size); | 366 | size); |
349 | tdmac->desc_arr = NULL; | 367 | tdmac->desc_arr = NULL; |
@@ -499,6 +517,7 @@ static enum dma_status mmp_tdma_tx_status(struct dma_chan *chan, | |||
499 | { | 517 | { |
500 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); | 518 | struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan); |
501 | 519 | ||
520 | tdmac->pos = mmp_tdma_get_pos(tdmac); | ||
502 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, | 521 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, |
503 | tdmac->buf_len - tdmac->pos); | 522 | tdmac->buf_len - tdmac->pos); |
504 | 523 | ||
@@ -610,7 +629,7 @@ static int mmp_tdma_probe(struct platform_device *pdev) | |||
610 | int i, ret; | 629 | int i, ret; |
611 | int irq = 0, irq_num = 0; | 630 | int irq = 0, irq_num = 0; |
612 | int chan_num = TDMA_CHANNEL_NUM; | 631 | int chan_num = TDMA_CHANNEL_NUM; |
613 | struct gen_pool *pool; | 632 | struct gen_pool *pool = NULL; |
614 | 633 | ||
615 | of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); | 634 | of_id = of_match_device(mmp_tdma_dt_ids, &pdev->dev); |
616 | if (of_id) | 635 | if (of_id) |
diff --git a/drivers/dma/qcom_bam_dma.c b/drivers/dma/qcom_bam_dma.c index d7a33b3ac466..9c914d625906 100644 --- a/drivers/dma/qcom_bam_dma.c +++ b/drivers/dma/qcom_bam_dma.c | |||
@@ -162,9 +162,9 @@ static const struct reg_offset_data bam_v1_4_reg_info[] = { | |||
162 | [BAM_P_IRQ_STTS] = { 0x1010, 0x1000, 0x00, 0x00 }, | 162 | [BAM_P_IRQ_STTS] = { 0x1010, 0x1000, 0x00, 0x00 }, |
163 | [BAM_P_IRQ_CLR] = { 0x1014, 0x1000, 0x00, 0x00 }, | 163 | [BAM_P_IRQ_CLR] = { 0x1014, 0x1000, 0x00, 0x00 }, |
164 | [BAM_P_IRQ_EN] = { 0x1018, 0x1000, 0x00, 0x00 }, | 164 | [BAM_P_IRQ_EN] = { 0x1018, 0x1000, 0x00, 0x00 }, |
165 | [BAM_P_EVNT_DEST_ADDR] = { 0x102C, 0x00, 0x1000, 0x00 }, | 165 | [BAM_P_EVNT_DEST_ADDR] = { 0x182C, 0x00, 0x1000, 0x00 }, |
166 | [BAM_P_EVNT_REG] = { 0x1018, 0x00, 0x1000, 0x00 }, | 166 | [BAM_P_EVNT_REG] = { 0x1818, 0x00, 0x1000, 0x00 }, |
167 | [BAM_P_SW_OFSTS] = { 0x1000, 0x00, 0x1000, 0x00 }, | 167 | [BAM_P_SW_OFSTS] = { 0x1800, 0x00, 0x1000, 0x00 }, |
168 | [BAM_P_DATA_FIFO_ADDR] = { 0x1824, 0x00, 0x1000, 0x00 }, | 168 | [BAM_P_DATA_FIFO_ADDR] = { 0x1824, 0x00, 0x1000, 0x00 }, |
169 | [BAM_P_DESC_FIFO_ADDR] = { 0x181C, 0x00, 0x1000, 0x00 }, | 169 | [BAM_P_DESC_FIFO_ADDR] = { 0x181C, 0x00, 0x1000, 0x00 }, |
170 | [BAM_P_EVNT_GEN_TRSHLD] = { 0x1828, 0x00, 0x1000, 0x00 }, | 170 | [BAM_P_EVNT_GEN_TRSHLD] = { 0x1828, 0x00, 0x1000, 0x00 }, |
@@ -1143,6 +1143,10 @@ static int bam_dma_probe(struct platform_device *pdev) | |||
1143 | dma_cap_set(DMA_SLAVE, bdev->common.cap_mask); | 1143 | dma_cap_set(DMA_SLAVE, bdev->common.cap_mask); |
1144 | 1144 | ||
1145 | /* initialize dmaengine apis */ | 1145 | /* initialize dmaengine apis */ |
1146 | bdev->common.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); | ||
1147 | bdev->common.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT; | ||
1148 | bdev->common.src_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1149 | bdev->common.dst_addr_widths = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1146 | bdev->common.device_alloc_chan_resources = bam_alloc_chan; | 1150 | bdev->common.device_alloc_chan_resources = bam_alloc_chan; |
1147 | bdev->common.device_free_chan_resources = bam_free_chan; | 1151 | bdev->common.device_free_chan_resources = bam_free_chan; |
1148 | bdev->common.device_prep_slave_sg = bam_prep_slave_sg; | 1152 | bdev->common.device_prep_slave_sg = bam_prep_slave_sg; |
diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index b2431aa30033..9f1d4c7dbab8 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c | |||
@@ -582,15 +582,12 @@ static void sh_dmae_chan_remove(struct sh_dmae_device *shdev) | |||
582 | } | 582 | } |
583 | } | 583 | } |
584 | 584 | ||
585 | static void sh_dmae_shutdown(struct platform_device *pdev) | ||
586 | { | ||
587 | struct sh_dmae_device *shdev = platform_get_drvdata(pdev); | ||
588 | sh_dmae_ctl_stop(shdev); | ||
589 | } | ||
590 | |||
591 | #ifdef CONFIG_PM | 585 | #ifdef CONFIG_PM |
592 | static int sh_dmae_runtime_suspend(struct device *dev) | 586 | static int sh_dmae_runtime_suspend(struct device *dev) |
593 | { | 587 | { |
588 | struct sh_dmae_device *shdev = dev_get_drvdata(dev); | ||
589 | |||
590 | sh_dmae_ctl_stop(shdev); | ||
594 | return 0; | 591 | return 0; |
595 | } | 592 | } |
596 | 593 | ||
@@ -605,6 +602,9 @@ static int sh_dmae_runtime_resume(struct device *dev) | |||
605 | #ifdef CONFIG_PM_SLEEP | 602 | #ifdef CONFIG_PM_SLEEP |
606 | static int sh_dmae_suspend(struct device *dev) | 603 | static int sh_dmae_suspend(struct device *dev) |
607 | { | 604 | { |
605 | struct sh_dmae_device *shdev = dev_get_drvdata(dev); | ||
606 | |||
607 | sh_dmae_ctl_stop(shdev); | ||
608 | return 0; | 608 | return 0; |
609 | } | 609 | } |
610 | 610 | ||
@@ -929,13 +929,12 @@ static int sh_dmae_remove(struct platform_device *pdev) | |||
929 | } | 929 | } |
930 | 930 | ||
931 | static struct platform_driver sh_dmae_driver = { | 931 | static struct platform_driver sh_dmae_driver = { |
932 | .driver = { | 932 | .driver = { |
933 | .pm = &sh_dmae_pm, | 933 | .pm = &sh_dmae_pm, |
934 | .name = SH_DMAE_DRV_NAME, | 934 | .name = SH_DMAE_DRV_NAME, |
935 | .of_match_table = sh_dmae_of_match, | 935 | .of_match_table = sh_dmae_of_match, |
936 | }, | 936 | }, |
937 | .remove = sh_dmae_remove, | 937 | .remove = sh_dmae_remove, |
938 | .shutdown = sh_dmae_shutdown, | ||
939 | }; | 938 | }; |
940 | 939 | ||
941 | static int __init sh_dmae_init(void) | 940 | static int __init sh_dmae_init(void) |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index c5f7b4e9eb6c..69fac068669f 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -78,7 +78,7 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s) | |||
78 | * We have to be cautious here. We have seen BIOSes with DMI pointers | 78 | * We have to be cautious here. We have seen BIOSes with DMI pointers |
79 | * pointing to completely the wrong place for example | 79 | * pointing to completely the wrong place for example |
80 | */ | 80 | */ |
81 | static void dmi_table(u8 *buf, int len, int num, | 81 | static void dmi_table(u8 *buf, u32 len, int num, |
82 | void (*decode)(const struct dmi_header *, void *), | 82 | void (*decode)(const struct dmi_header *, void *), |
83 | void *private_data) | 83 | void *private_data) |
84 | { | 84 | { |
@@ -93,12 +93,6 @@ static void dmi_table(u8 *buf, int len, int num, | |||
93 | const struct dmi_header *dm = (const struct dmi_header *)data; | 93 | const struct dmi_header *dm = (const struct dmi_header *)data; |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] | ||
97 | */ | ||
98 | if (dm->type == DMI_ENTRY_END_OF_TABLE) | ||
99 | break; | ||
100 | |||
101 | /* | ||
102 | * We want to know the total length (formatted area and | 96 | * We want to know the total length (formatted area and |
103 | * strings) before decoding to make sure we won't run off the | 97 | * strings) before decoding to make sure we won't run off the |
104 | * table in dmi_decode or dmi_string | 98 | * table in dmi_decode or dmi_string |
@@ -108,13 +102,20 @@ static void dmi_table(u8 *buf, int len, int num, | |||
108 | data++; | 102 | data++; |
109 | if (data - buf < len - 1) | 103 | if (data - buf < len - 1) |
110 | decode(dm, private_data); | 104 | decode(dm, private_data); |
105 | |||
106 | /* | ||
107 | * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] | ||
108 | */ | ||
109 | if (dm->type == DMI_ENTRY_END_OF_TABLE) | ||
110 | break; | ||
111 | |||
111 | data += 2; | 112 | data += 2; |
112 | i++; | 113 | i++; |
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
116 | static phys_addr_t dmi_base; | 117 | static phys_addr_t dmi_base; |
117 | static u16 dmi_len; | 118 | static u32 dmi_len; |
118 | static u16 dmi_num; | 119 | static u16 dmi_num; |
119 | 120 | ||
120 | static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, | 121 | static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, |
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 2fe195002021..f07d4a67fa76 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c | |||
@@ -179,12 +179,12 @@ again: | |||
179 | start = desc->phys_addr; | 179 | start = desc->phys_addr; |
180 | end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT); | 180 | end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT); |
181 | 181 | ||
182 | if ((start + size) > end || (start + size) > max) | 182 | if (end > max) |
183 | continue; | ||
184 | |||
185 | if (end - size > max) | ||
186 | end = max; | 183 | end = max; |
187 | 184 | ||
185 | if ((start + size) > end) | ||
186 | continue; | ||
187 | |||
188 | if (round_down(end - size, align) < start) | 188 | if (round_down(end - size, align) < start) |
189 | continue; | 189 | continue; |
190 | 190 | ||
diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c index 472fb5b8779f..9cdbc0c9cb2d 100644 --- a/drivers/gpio/gpio-tps65912.c +++ b/drivers/gpio/gpio-tps65912.c | |||
@@ -26,9 +26,12 @@ struct tps65912_gpio_data { | |||
26 | struct gpio_chip gpio_chip; | 26 | struct gpio_chip gpio_chip; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) | ||
30 | |||
29 | static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) | 31 | static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) |
30 | { | 32 | { |
31 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 33 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
34 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
32 | int val; | 35 | int val; |
33 | 36 | ||
34 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); | 37 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); |
@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) | |||
42 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, | 45 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, |
43 | int value) | 46 | int value) |
44 | { | 47 | { |
45 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 48 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
49 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
46 | 50 | ||
47 | if (value) | 51 | if (value) |
48 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, | 52 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, |
@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, | |||
55 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, | 59 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, |
56 | int value) | 60 | int value) |
57 | { | 61 | { |
58 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 62 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
63 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
59 | 64 | ||
60 | /* Set the initial value */ | 65 | /* Set the initial value */ |
61 | tps65912_gpio_set(gc, offset, value); | 66 | tps65912_gpio_set(gc, offset, value); |
@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, | |||
66 | 71 | ||
67 | static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) | 72 | static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) |
68 | { | 73 | { |
69 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 74 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
75 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
70 | 76 | ||
71 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, | 77 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, |
72 | GPIO_CFG_MASK); | 78 | GPIO_CFG_MASK); |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 8cad8e400b44..4650bf830d6b 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -46,12 +46,13 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data) | |||
46 | 46 | ||
47 | ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); | 47 | ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); |
48 | if (ret < 0) { | 48 | if (ret < 0) { |
49 | /* We've found the gpio chip, but the translation failed. | 49 | /* We've found a gpio chip, but the translation failed. |
50 | * Return true to stop looking and return the translation | 50 | * Store translation error in out_gpio. |
51 | * error via out_gpio | 51 | * Return false to keep looking, as more than one gpio chip |
52 | * could be registered per of-node. | ||
52 | */ | 53 | */ |
53 | gg_data->out_gpio = ERR_PTR(ret); | 54 | gg_data->out_gpio = ERR_PTR(ret); |
54 | return true; | 55 | return false; |
55 | } | 56 | } |
56 | 57 | ||
57 | gg_data->out_gpio = gpiochip_get_desc(gc, ret); | 58 | gg_data->out_gpio = gpiochip_get_desc(gc, ret); |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index b3589d0e39b9..910ff8ab9c9c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | |||
@@ -62,12 +62,18 @@ enum KFD_MQD_TYPE get_mqd_type_from_queue_type(enum kfd_queue_type type) | |||
62 | return KFD_MQD_TYPE_CP; | 62 | return KFD_MQD_TYPE_CP; |
63 | } | 63 | } |
64 | 64 | ||
65 | static inline unsigned int get_first_pipe(struct device_queue_manager *dqm) | 65 | unsigned int get_first_pipe(struct device_queue_manager *dqm) |
66 | { | 66 | { |
67 | BUG_ON(!dqm); | 67 | BUG_ON(!dqm || !dqm->dev); |
68 | return dqm->dev->shared_resources.first_compute_pipe; | 68 | return dqm->dev->shared_resources.first_compute_pipe; |
69 | } | 69 | } |
70 | 70 | ||
71 | unsigned int get_pipes_num(struct device_queue_manager *dqm) | ||
72 | { | ||
73 | BUG_ON(!dqm || !dqm->dev); | ||
74 | return dqm->dev->shared_resources.compute_pipe_count; | ||
75 | } | ||
76 | |||
71 | static inline unsigned int get_pipes_num_cpsch(void) | 77 | static inline unsigned int get_pipes_num_cpsch(void) |
72 | { | 78 | { |
73 | return PIPE_PER_ME_CP_SCHEDULING; | 79 | return PIPE_PER_ME_CP_SCHEDULING; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h index d64f86cda34f..488f51d19427 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | |||
@@ -163,6 +163,8 @@ void program_sh_mem_settings(struct device_queue_manager *dqm, | |||
163 | struct qcm_process_device *qpd); | 163 | struct qcm_process_device *qpd); |
164 | int init_pipelines(struct device_queue_manager *dqm, | 164 | int init_pipelines(struct device_queue_manager *dqm, |
165 | unsigned int pipes_num, unsigned int first_pipe); | 165 | unsigned int pipes_num, unsigned int first_pipe); |
166 | unsigned int get_first_pipe(struct device_queue_manager *dqm); | ||
167 | unsigned int get_pipes_num(struct device_queue_manager *dqm); | ||
166 | 168 | ||
167 | extern inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd) | 169 | extern inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd) |
168 | { | 170 | { |
@@ -175,10 +177,4 @@ get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd) | |||
175 | return (pdd->lds_base >> 60) & 0x0E; | 177 | return (pdd->lds_base >> 60) & 0x0E; |
176 | } | 178 | } |
177 | 179 | ||
178 | extern inline unsigned int get_pipes_num(struct device_queue_manager *dqm) | ||
179 | { | ||
180 | BUG_ON(!dqm || !dqm->dev); | ||
181 | return dqm->dev->shared_resources.compute_pipe_count; | ||
182 | } | ||
183 | |||
184 | #endif /* KFD_DEVICE_QUEUE_MANAGER_H_ */ | 180 | #endif /* KFD_DEVICE_QUEUE_MANAGER_H_ */ |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c index 6b072466e2a6..5469efe0523e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c | |||
@@ -131,5 +131,5 @@ static int register_process_cik(struct device_queue_manager *dqm, | |||
131 | 131 | ||
132 | static int initialize_cpsch_cik(struct device_queue_manager *dqm) | 132 | static int initialize_cpsch_cik(struct device_queue_manager *dqm) |
133 | { | 133 | { |
134 | return init_pipelines(dqm, get_pipes_num(dqm), 0); | 134 | return init_pipelines(dqm, get_pipes_num(dqm), get_first_pipe(dqm)); |
135 | } | 135 | } |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index b81cea6baeea..d55c0c232e1d 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -85,7 +85,7 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) | |||
85 | (adj->crtc_hdisplay - 1) | | 85 | (adj->crtc_hdisplay - 1) | |
86 | ((adj->crtc_vdisplay - 1) << 16)); | 86 | ((adj->crtc_vdisplay - 1) << 16)); |
87 | 87 | ||
88 | cfg = ATMEL_HLCDC_CLKPOL; | 88 | cfg = 0; |
89 | 89 | ||
90 | prate = clk_get_rate(crtc->dc->hlcdc->sys_clk); | 90 | prate = clk_get_rate(crtc->dc->hlcdc->sys_clk); |
91 | mode_rate = adj->crtc_clock * 1000; | 91 | mode_rate = adj->crtc_clock * 1000; |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 01afeafe17b1..c4bb1f9f95c6 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | |||
@@ -313,8 +313,6 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) | |||
313 | 313 | ||
314 | pm_runtime_enable(dev->dev); | 314 | pm_runtime_enable(dev->dev); |
315 | 315 | ||
316 | pm_runtime_put_sync(dev->dev); | ||
317 | |||
318 | ret = atmel_hlcdc_dc_modeset_init(dev); | 316 | ret = atmel_hlcdc_dc_modeset_init(dev); |
319 | if (ret < 0) { | 317 | if (ret < 0) { |
320 | dev_err(dev->dev, "failed to initialize mode setting\n"); | 318 | dev_err(dev->dev, "failed to initialize mode setting\n"); |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_layer.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_layer.c index d1dca39b76dd..377e43cea9dd 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_layer.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_layer.c | |||
@@ -311,7 +311,8 @@ void atmel_hlcdc_layer_disable(struct atmel_hlcdc_layer *layer) | |||
311 | 311 | ||
312 | /* Disable the layer */ | 312 | /* Disable the layer */ |
313 | regmap_write(regmap, desc->regs_offset + ATMEL_HLCDC_LAYER_CHDR, | 313 | regmap_write(regmap, desc->regs_offset + ATMEL_HLCDC_LAYER_CHDR, |
314 | ATMEL_HLCDC_LAYER_RST); | 314 | ATMEL_HLCDC_LAYER_RST | ATMEL_HLCDC_LAYER_A2Q | |
315 | ATMEL_HLCDC_LAYER_UPDATE); | ||
315 | 316 | ||
316 | /* Clear all pending interrupts */ | 317 | /* Clear all pending interrupts */ |
317 | regmap_read(regmap, desc->regs_offset + ATMEL_HLCDC_LAYER_ISR, &isr); | 318 | regmap_read(regmap, desc->regs_offset + ATMEL_HLCDC_LAYER_ISR, &isr); |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 29dbde5ecef7..927f3445ff38 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2138,7 +2138,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, | |||
2138 | DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id); | 2138 | DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id); |
2139 | 2139 | ||
2140 | mutex_lock(&dev->mode_config.mutex); | 2140 | mutex_lock(&dev->mode_config.mutex); |
2141 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | ||
2142 | 2141 | ||
2143 | connector = drm_connector_find(dev, out_resp->connector_id); | 2142 | connector = drm_connector_find(dev, out_resp->connector_id); |
2144 | if (!connector) { | 2143 | if (!connector) { |
@@ -2168,6 +2167,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, | |||
2168 | out_resp->mm_height = connector->display_info.height_mm; | 2167 | out_resp->mm_height = connector->display_info.height_mm; |
2169 | out_resp->subpixel = connector->display_info.subpixel_order; | 2168 | out_resp->subpixel = connector->display_info.subpixel_order; |
2170 | out_resp->connection = connector->status; | 2169 | out_resp->connection = connector->status; |
2170 | |||
2171 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | ||
2171 | encoder = drm_connector_get_encoder(connector); | 2172 | encoder = drm_connector_get_encoder(connector); |
2172 | if (encoder) | 2173 | if (encoder) |
2173 | out_resp->encoder_id = encoder->base.id; | 2174 | out_resp->encoder_id = encoder->base.id; |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 04a209e2b66d..7fc6f8bd4821 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -91,29 +91,29 @@ | |||
91 | */ | 91 | */ |
92 | 92 | ||
93 | static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, | 93 | static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, |
94 | unsigned long size, | 94 | u64 size, |
95 | unsigned alignment, | 95 | unsigned alignment, |
96 | unsigned long color, | 96 | unsigned long color, |
97 | enum drm_mm_search_flags flags); | 97 | enum drm_mm_search_flags flags); |
98 | static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm, | 98 | static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm, |
99 | unsigned long size, | 99 | u64 size, |
100 | unsigned alignment, | 100 | unsigned alignment, |
101 | unsigned long color, | 101 | unsigned long color, |
102 | unsigned long start, | 102 | u64 start, |
103 | unsigned long end, | 103 | u64 end, |
104 | enum drm_mm_search_flags flags); | 104 | enum drm_mm_search_flags flags); |
105 | 105 | ||
106 | static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | 106 | static void drm_mm_insert_helper(struct drm_mm_node *hole_node, |
107 | struct drm_mm_node *node, | 107 | struct drm_mm_node *node, |
108 | unsigned long size, unsigned alignment, | 108 | u64 size, unsigned alignment, |
109 | unsigned long color, | 109 | unsigned long color, |
110 | enum drm_mm_allocator_flags flags) | 110 | enum drm_mm_allocator_flags flags) |
111 | { | 111 | { |
112 | struct drm_mm *mm = hole_node->mm; | 112 | struct drm_mm *mm = hole_node->mm; |
113 | unsigned long hole_start = drm_mm_hole_node_start(hole_node); | 113 | u64 hole_start = drm_mm_hole_node_start(hole_node); |
114 | unsigned long hole_end = drm_mm_hole_node_end(hole_node); | 114 | u64 hole_end = drm_mm_hole_node_end(hole_node); |
115 | unsigned long adj_start = hole_start; | 115 | u64 adj_start = hole_start; |
116 | unsigned long adj_end = hole_end; | 116 | u64 adj_end = hole_end; |
117 | 117 | ||
118 | BUG_ON(node->allocated); | 118 | BUG_ON(node->allocated); |
119 | 119 | ||
@@ -124,12 +124,15 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | |||
124 | adj_start = adj_end - size; | 124 | adj_start = adj_end - size; |
125 | 125 | ||
126 | if (alignment) { | 126 | if (alignment) { |
127 | unsigned tmp = adj_start % alignment; | 127 | u64 tmp = adj_start; |
128 | if (tmp) { | 128 | unsigned rem; |
129 | |||
130 | rem = do_div(tmp, alignment); | ||
131 | if (rem) { | ||
129 | if (flags & DRM_MM_CREATE_TOP) | 132 | if (flags & DRM_MM_CREATE_TOP) |
130 | adj_start -= tmp; | 133 | adj_start -= rem; |
131 | else | 134 | else |
132 | adj_start += alignment - tmp; | 135 | adj_start += alignment - rem; |
133 | } | 136 | } |
134 | } | 137 | } |
135 | 138 | ||
@@ -176,9 +179,9 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node, | |||
176 | int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) | 179 | int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) |
177 | { | 180 | { |
178 | struct drm_mm_node *hole; | 181 | struct drm_mm_node *hole; |
179 | unsigned long end = node->start + node->size; | 182 | u64 end = node->start + node->size; |
180 | unsigned long hole_start; | 183 | u64 hole_start; |
181 | unsigned long hole_end; | 184 | u64 hole_end; |
182 | 185 | ||
183 | BUG_ON(node == NULL); | 186 | BUG_ON(node == NULL); |
184 | 187 | ||
@@ -227,7 +230,7 @@ EXPORT_SYMBOL(drm_mm_reserve_node); | |||
227 | * 0 on success, -ENOSPC if there's no suitable hole. | 230 | * 0 on success, -ENOSPC if there's no suitable hole. |
228 | */ | 231 | */ |
229 | int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node, | 232 | int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node, |
230 | unsigned long size, unsigned alignment, | 233 | u64 size, unsigned alignment, |
231 | unsigned long color, | 234 | unsigned long color, |
232 | enum drm_mm_search_flags sflags, | 235 | enum drm_mm_search_flags sflags, |
233 | enum drm_mm_allocator_flags aflags) | 236 | enum drm_mm_allocator_flags aflags) |
@@ -246,16 +249,16 @@ EXPORT_SYMBOL(drm_mm_insert_node_generic); | |||
246 | 249 | ||
247 | static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, | 250 | static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, |
248 | struct drm_mm_node *node, | 251 | struct drm_mm_node *node, |
249 | unsigned long size, unsigned alignment, | 252 | u64 size, unsigned alignment, |
250 | unsigned long color, | 253 | unsigned long color, |
251 | unsigned long start, unsigned long end, | 254 | u64 start, u64 end, |
252 | enum drm_mm_allocator_flags flags) | 255 | enum drm_mm_allocator_flags flags) |
253 | { | 256 | { |
254 | struct drm_mm *mm = hole_node->mm; | 257 | struct drm_mm *mm = hole_node->mm; |
255 | unsigned long hole_start = drm_mm_hole_node_start(hole_node); | 258 | u64 hole_start = drm_mm_hole_node_start(hole_node); |
256 | unsigned long hole_end = drm_mm_hole_node_end(hole_node); | 259 | u64 hole_end = drm_mm_hole_node_end(hole_node); |
257 | unsigned long adj_start = hole_start; | 260 | u64 adj_start = hole_start; |
258 | unsigned long adj_end = hole_end; | 261 | u64 adj_end = hole_end; |
259 | 262 | ||
260 | BUG_ON(!hole_node->hole_follows || node->allocated); | 263 | BUG_ON(!hole_node->hole_follows || node->allocated); |
261 | 264 | ||
@@ -271,12 +274,15 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, | |||
271 | mm->color_adjust(hole_node, color, &adj_start, &adj_end); | 274 | mm->color_adjust(hole_node, color, &adj_start, &adj_end); |
272 | 275 | ||
273 | if (alignment) { | 276 | if (alignment) { |
274 | unsigned tmp = adj_start % alignment; | 277 | u64 tmp = adj_start; |
275 | if (tmp) { | 278 | unsigned rem; |
279 | |||
280 | rem = do_div(tmp, alignment); | ||
281 | if (rem) { | ||
276 | if (flags & DRM_MM_CREATE_TOP) | 282 | if (flags & DRM_MM_CREATE_TOP) |
277 | adj_start -= tmp; | 283 | adj_start -= rem; |
278 | else | 284 | else |
279 | adj_start += alignment - tmp; | 285 | adj_start += alignment - rem; |
280 | } | 286 | } |
281 | } | 287 | } |
282 | 288 | ||
@@ -324,9 +330,9 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, | |||
324 | * 0 on success, -ENOSPC if there's no suitable hole. | 330 | * 0 on success, -ENOSPC if there's no suitable hole. |
325 | */ | 331 | */ |
326 | int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node, | 332 | int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node, |
327 | unsigned long size, unsigned alignment, | 333 | u64 size, unsigned alignment, |
328 | unsigned long color, | 334 | unsigned long color, |
329 | unsigned long start, unsigned long end, | 335 | u64 start, u64 end, |
330 | enum drm_mm_search_flags sflags, | 336 | enum drm_mm_search_flags sflags, |
331 | enum drm_mm_allocator_flags aflags) | 337 | enum drm_mm_allocator_flags aflags) |
332 | { | 338 | { |
@@ -387,32 +393,34 @@ void drm_mm_remove_node(struct drm_mm_node *node) | |||
387 | } | 393 | } |
388 | EXPORT_SYMBOL(drm_mm_remove_node); | 394 | EXPORT_SYMBOL(drm_mm_remove_node); |
389 | 395 | ||
390 | static int check_free_hole(unsigned long start, unsigned long end, | 396 | static int check_free_hole(u64 start, u64 end, u64 size, unsigned alignment) |
391 | unsigned long size, unsigned alignment) | ||
392 | { | 397 | { |
393 | if (end - start < size) | 398 | if (end - start < size) |
394 | return 0; | 399 | return 0; |
395 | 400 | ||
396 | if (alignment) { | 401 | if (alignment) { |
397 | unsigned tmp = start % alignment; | 402 | u64 tmp = start; |
403 | unsigned rem; | ||
404 | |||
405 | rem = do_div(tmp, alignment); | ||
398 | if (tmp) | 406 | if (tmp) |
399 | start += alignment - tmp; | 407 | start += alignment - rem; |
400 | } | 408 | } |
401 | 409 | ||
402 | return end >= start + size; | 410 | return end >= start + size; |
403 | } | 411 | } |
404 | 412 | ||
405 | static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, | 413 | static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, |
406 | unsigned long size, | 414 | u64 size, |
407 | unsigned alignment, | 415 | unsigned alignment, |
408 | unsigned long color, | 416 | unsigned long color, |
409 | enum drm_mm_search_flags flags) | 417 | enum drm_mm_search_flags flags) |
410 | { | 418 | { |
411 | struct drm_mm_node *entry; | 419 | struct drm_mm_node *entry; |
412 | struct drm_mm_node *best; | 420 | struct drm_mm_node *best; |
413 | unsigned long adj_start; | 421 | u64 adj_start; |
414 | unsigned long adj_end; | 422 | u64 adj_end; |
415 | unsigned long best_size; | 423 | u64 best_size; |
416 | 424 | ||
417 | BUG_ON(mm->scanned_blocks); | 425 | BUG_ON(mm->scanned_blocks); |
418 | 426 | ||
@@ -421,7 +429,7 @@ static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, | |||
421 | 429 | ||
422 | __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, | 430 | __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, |
423 | flags & DRM_MM_SEARCH_BELOW) { | 431 | flags & DRM_MM_SEARCH_BELOW) { |
424 | unsigned long hole_size = adj_end - adj_start; | 432 | u64 hole_size = adj_end - adj_start; |
425 | 433 | ||
426 | if (mm->color_adjust) { | 434 | if (mm->color_adjust) { |
427 | mm->color_adjust(entry, color, &adj_start, &adj_end); | 435 | mm->color_adjust(entry, color, &adj_start, &adj_end); |
@@ -445,18 +453,18 @@ static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm, | |||
445 | } | 453 | } |
446 | 454 | ||
447 | static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm, | 455 | static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_mm *mm, |
448 | unsigned long size, | 456 | u64 size, |
449 | unsigned alignment, | 457 | unsigned alignment, |
450 | unsigned long color, | 458 | unsigned long color, |
451 | unsigned long start, | 459 | u64 start, |
452 | unsigned long end, | 460 | u64 end, |
453 | enum drm_mm_search_flags flags) | 461 | enum drm_mm_search_flags flags) |
454 | { | 462 | { |
455 | struct drm_mm_node *entry; | 463 | struct drm_mm_node *entry; |
456 | struct drm_mm_node *best; | 464 | struct drm_mm_node *best; |
457 | unsigned long adj_start; | 465 | u64 adj_start; |
458 | unsigned long adj_end; | 466 | u64 adj_end; |
459 | unsigned long best_size; | 467 | u64 best_size; |
460 | 468 | ||
461 | BUG_ON(mm->scanned_blocks); | 469 | BUG_ON(mm->scanned_blocks); |
462 | 470 | ||
@@ -465,7 +473,7 @@ static struct drm_mm_node *drm_mm_search_free_in_range_generic(const struct drm_ | |||
465 | 473 | ||
466 | __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, | 474 | __drm_mm_for_each_hole(entry, mm, adj_start, adj_end, |
467 | flags & DRM_MM_SEARCH_BELOW) { | 475 | flags & DRM_MM_SEARCH_BELOW) { |
468 | unsigned long hole_size = adj_end - adj_start; | 476 | u64 hole_size = adj_end - adj_start; |
469 | 477 | ||
470 | if (adj_start < start) | 478 | if (adj_start < start) |
471 | adj_start = start; | 479 | adj_start = start; |
@@ -561,7 +569,7 @@ EXPORT_SYMBOL(drm_mm_replace_node); | |||
561 | * adding/removing nodes to/from the scan list are allowed. | 569 | * adding/removing nodes to/from the scan list are allowed. |
562 | */ | 570 | */ |
563 | void drm_mm_init_scan(struct drm_mm *mm, | 571 | void drm_mm_init_scan(struct drm_mm *mm, |
564 | unsigned long size, | 572 | u64 size, |
565 | unsigned alignment, | 573 | unsigned alignment, |
566 | unsigned long color) | 574 | unsigned long color) |
567 | { | 575 | { |
@@ -594,11 +602,11 @@ EXPORT_SYMBOL(drm_mm_init_scan); | |||
594 | * adding/removing nodes to/from the scan list are allowed. | 602 | * adding/removing nodes to/from the scan list are allowed. |
595 | */ | 603 | */ |
596 | void drm_mm_init_scan_with_range(struct drm_mm *mm, | 604 | void drm_mm_init_scan_with_range(struct drm_mm *mm, |
597 | unsigned long size, | 605 | u64 size, |
598 | unsigned alignment, | 606 | unsigned alignment, |
599 | unsigned long color, | 607 | unsigned long color, |
600 | unsigned long start, | 608 | u64 start, |
601 | unsigned long end) | 609 | u64 end) |
602 | { | 610 | { |
603 | mm->scan_color = color; | 611 | mm->scan_color = color; |
604 | mm->scan_alignment = alignment; | 612 | mm->scan_alignment = alignment; |
@@ -627,8 +635,8 @@ bool drm_mm_scan_add_block(struct drm_mm_node *node) | |||
627 | { | 635 | { |
628 | struct drm_mm *mm = node->mm; | 636 | struct drm_mm *mm = node->mm; |
629 | struct drm_mm_node *prev_node; | 637 | struct drm_mm_node *prev_node; |
630 | unsigned long hole_start, hole_end; | 638 | u64 hole_start, hole_end; |
631 | unsigned long adj_start, adj_end; | 639 | u64 adj_start, adj_end; |
632 | 640 | ||
633 | mm->scanned_blocks++; | 641 | mm->scanned_blocks++; |
634 | 642 | ||
@@ -731,7 +739,7 @@ EXPORT_SYMBOL(drm_mm_clean); | |||
731 | * | 739 | * |
732 | * Note that @mm must be cleared to 0 before calling this function. | 740 | * Note that @mm must be cleared to 0 before calling this function. |
733 | */ | 741 | */ |
734 | void drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size) | 742 | void drm_mm_init(struct drm_mm * mm, u64 start, u64 size) |
735 | { | 743 | { |
736 | INIT_LIST_HEAD(&mm->hole_stack); | 744 | INIT_LIST_HEAD(&mm->hole_stack); |
737 | mm->scanned_blocks = 0; | 745 | mm->scanned_blocks = 0; |
@@ -766,18 +774,17 @@ void drm_mm_takedown(struct drm_mm * mm) | |||
766 | } | 774 | } |
767 | EXPORT_SYMBOL(drm_mm_takedown); | 775 | EXPORT_SYMBOL(drm_mm_takedown); |
768 | 776 | ||
769 | static unsigned long drm_mm_debug_hole(struct drm_mm_node *entry, | 777 | static u64 drm_mm_debug_hole(struct drm_mm_node *entry, |
770 | const char *prefix) | 778 | const char *prefix) |
771 | { | 779 | { |
772 | unsigned long hole_start, hole_end, hole_size; | 780 | u64 hole_start, hole_end, hole_size; |
773 | 781 | ||
774 | if (entry->hole_follows) { | 782 | if (entry->hole_follows) { |
775 | hole_start = drm_mm_hole_node_start(entry); | 783 | hole_start = drm_mm_hole_node_start(entry); |
776 | hole_end = drm_mm_hole_node_end(entry); | 784 | hole_end = drm_mm_hole_node_end(entry); |
777 | hole_size = hole_end - hole_start; | 785 | hole_size = hole_end - hole_start; |
778 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: free\n", | 786 | pr_debug("%s %#llx-%#llx: %llu: free\n", prefix, hole_start, |
779 | prefix, hole_start, hole_end, | 787 | hole_end, hole_size); |
780 | hole_size); | ||
781 | return hole_size; | 788 | return hole_size; |
782 | } | 789 | } |
783 | 790 | ||
@@ -792,35 +799,34 @@ static unsigned long drm_mm_debug_hole(struct drm_mm_node *entry, | |||
792 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) | 799 | void drm_mm_debug_table(struct drm_mm *mm, const char *prefix) |
793 | { | 800 | { |
794 | struct drm_mm_node *entry; | 801 | struct drm_mm_node *entry; |
795 | unsigned long total_used = 0, total_free = 0, total = 0; | 802 | u64 total_used = 0, total_free = 0, total = 0; |
796 | 803 | ||
797 | total_free += drm_mm_debug_hole(&mm->head_node, prefix); | 804 | total_free += drm_mm_debug_hole(&mm->head_node, prefix); |
798 | 805 | ||
799 | drm_mm_for_each_node(entry, mm) { | 806 | drm_mm_for_each_node(entry, mm) { |
800 | printk(KERN_DEBUG "%s 0x%08lx-0x%08lx: %8lu: used\n", | 807 | pr_debug("%s %#llx-%#llx: %llu: used\n", prefix, entry->start, |
801 | prefix, entry->start, entry->start + entry->size, | 808 | entry->start + entry->size, entry->size); |
802 | entry->size); | ||
803 | total_used += entry->size; | 809 | total_used += entry->size; |
804 | total_free += drm_mm_debug_hole(entry, prefix); | 810 | total_free += drm_mm_debug_hole(entry, prefix); |
805 | } | 811 | } |
806 | total = total_free + total_used; | 812 | total = total_free + total_used; |
807 | 813 | ||
808 | printk(KERN_DEBUG "%s total: %lu, used %lu free %lu\n", prefix, total, | 814 | pr_debug("%s total: %llu, used %llu free %llu\n", prefix, total, |
809 | total_used, total_free); | 815 | total_used, total_free); |
810 | } | 816 | } |
811 | EXPORT_SYMBOL(drm_mm_debug_table); | 817 | EXPORT_SYMBOL(drm_mm_debug_table); |
812 | 818 | ||
813 | #if defined(CONFIG_DEBUG_FS) | 819 | #if defined(CONFIG_DEBUG_FS) |
814 | static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry) | 820 | static u64 drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *entry) |
815 | { | 821 | { |
816 | unsigned long hole_start, hole_end, hole_size; | 822 | u64 hole_start, hole_end, hole_size; |
817 | 823 | ||
818 | if (entry->hole_follows) { | 824 | if (entry->hole_follows) { |
819 | hole_start = drm_mm_hole_node_start(entry); | 825 | hole_start = drm_mm_hole_node_start(entry); |
820 | hole_end = drm_mm_hole_node_end(entry); | 826 | hole_end = drm_mm_hole_node_end(entry); |
821 | hole_size = hole_end - hole_start; | 827 | hole_size = hole_end - hole_start; |
822 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: free\n", | 828 | seq_printf(m, "%#llx-%#llx: %llu: free\n", hole_start, |
823 | hole_start, hole_end, hole_size); | 829 | hole_end, hole_size); |
824 | return hole_size; | 830 | return hole_size; |
825 | } | 831 | } |
826 | 832 | ||
@@ -835,20 +841,20 @@ static unsigned long drm_mm_dump_hole(struct seq_file *m, struct drm_mm_node *en | |||
835 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) | 841 | int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm) |
836 | { | 842 | { |
837 | struct drm_mm_node *entry; | 843 | struct drm_mm_node *entry; |
838 | unsigned long total_used = 0, total_free = 0, total = 0; | 844 | u64 total_used = 0, total_free = 0, total = 0; |
839 | 845 | ||
840 | total_free += drm_mm_dump_hole(m, &mm->head_node); | 846 | total_free += drm_mm_dump_hole(m, &mm->head_node); |
841 | 847 | ||
842 | drm_mm_for_each_node(entry, mm) { | 848 | drm_mm_for_each_node(entry, mm) { |
843 | seq_printf(m, "0x%08lx-0x%08lx: 0x%08lx: used\n", | 849 | seq_printf(m, "%#016llx-%#016llx: %llu: used\n", entry->start, |
844 | entry->start, entry->start + entry->size, | 850 | entry->start + entry->size, entry->size); |
845 | entry->size); | ||
846 | total_used += entry->size; | 851 | total_used += entry->size; |
847 | total_free += drm_mm_dump_hole(m, entry); | 852 | total_free += drm_mm_dump_hole(m, entry); |
848 | } | 853 | } |
849 | total = total_free + total_used; | 854 | total = total_free + total_used; |
850 | 855 | ||
851 | seq_printf(m, "total: %lu, used %lu free %lu\n", total, total_used, total_free); | 856 | seq_printf(m, "total: %llu, used %llu free %llu\n", total, |
857 | total_used, total_free); | ||
852 | return 0; | 858 | return 0; |
853 | } | 859 | } |
854 | EXPORT_SYMBOL(drm_mm_dump_table); | 860 | EXPORT_SYMBOL(drm_mm_dump_table); |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 94b3984dbea0..e38f45374d55 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -153,12 +153,12 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) | |||
153 | seq_puts(m, " (pp"); | 153 | seq_puts(m, " (pp"); |
154 | else | 154 | else |
155 | seq_puts(m, " (g"); | 155 | seq_puts(m, " (g"); |
156 | seq_printf(m, "gtt offset: %08lx, size: %08lx, type: %u)", | 156 | seq_printf(m, "gtt offset: %08llx, size: %08llx, type: %u)", |
157 | vma->node.start, vma->node.size, | 157 | vma->node.start, vma->node.size, |
158 | vma->ggtt_view.type); | 158 | vma->ggtt_view.type); |
159 | } | 159 | } |
160 | if (obj->stolen) | 160 | if (obj->stolen) |
161 | seq_printf(m, " (stolen: %08lx)", obj->stolen->start); | 161 | seq_printf(m, " (stolen: %08llx)", obj->stolen->start); |
162 | if (obj->pin_mappable || obj->fault_mappable) { | 162 | if (obj->pin_mappable || obj->fault_mappable) { |
163 | char s[3], *t = s; | 163 | char s[3], *t = s; |
164 | if (obj->pin_mappable) | 164 | if (obj->pin_mappable) |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 875b1b7964c3..0001642c38b4 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -633,7 +633,7 @@ static int i915_drm_suspend(struct drm_device *dev) | |||
633 | return 0; | 633 | return 0; |
634 | } | 634 | } |
635 | 635 | ||
636 | static int i915_drm_suspend_late(struct drm_device *drm_dev) | 636 | static int i915_drm_suspend_late(struct drm_device *drm_dev, bool hibernation) |
637 | { | 637 | { |
638 | struct drm_i915_private *dev_priv = drm_dev->dev_private; | 638 | struct drm_i915_private *dev_priv = drm_dev->dev_private; |
639 | int ret; | 639 | int ret; |
@@ -647,7 +647,17 @@ static int i915_drm_suspend_late(struct drm_device *drm_dev) | |||
647 | } | 647 | } |
648 | 648 | ||
649 | pci_disable_device(drm_dev->pdev); | 649 | pci_disable_device(drm_dev->pdev); |
650 | pci_set_power_state(drm_dev->pdev, PCI_D3hot); | 650 | /* |
651 | * During hibernation on some GEN4 platforms the BIOS may try to access | ||
652 | * the device even though it's already in D3 and hang the machine. So | ||
653 | * leave the device in D0 on those platforms and hope the BIOS will | ||
654 | * power down the device properly. Platforms where this was seen: | ||
655 | * Lenovo Thinkpad X301, X61s | ||
656 | */ | ||
657 | if (!(hibernation && | ||
658 | drm_dev->pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO && | ||
659 | INTEL_INFO(dev_priv)->gen == 4)) | ||
660 | pci_set_power_state(drm_dev->pdev, PCI_D3hot); | ||
651 | 661 | ||
652 | return 0; | 662 | return 0; |
653 | } | 663 | } |
@@ -673,7 +683,7 @@ int i915_suspend_legacy(struct drm_device *dev, pm_message_t state) | |||
673 | if (error) | 683 | if (error) |
674 | return error; | 684 | return error; |
675 | 685 | ||
676 | return i915_drm_suspend_late(dev); | 686 | return i915_drm_suspend_late(dev, false); |
677 | } | 687 | } |
678 | 688 | ||
679 | static int i915_drm_resume(struct drm_device *dev) | 689 | static int i915_drm_resume(struct drm_device *dev) |
@@ -953,7 +963,17 @@ static int i915_pm_suspend_late(struct device *dev) | |||
953 | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 963 | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
954 | return 0; | 964 | return 0; |
955 | 965 | ||
956 | return i915_drm_suspend_late(drm_dev); | 966 | return i915_drm_suspend_late(drm_dev, false); |
967 | } | ||
968 | |||
969 | static int i915_pm_poweroff_late(struct device *dev) | ||
970 | { | ||
971 | struct drm_device *drm_dev = dev_to_i915(dev)->dev; | ||
972 | |||
973 | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) | ||
974 | return 0; | ||
975 | |||
976 | return i915_drm_suspend_late(drm_dev, true); | ||
957 | } | 977 | } |
958 | 978 | ||
959 | static int i915_pm_resume_early(struct device *dev) | 979 | static int i915_pm_resume_early(struct device *dev) |
@@ -1523,7 +1543,7 @@ static const struct dev_pm_ops i915_pm_ops = { | |||
1523 | .thaw_early = i915_pm_resume_early, | 1543 | .thaw_early = i915_pm_resume_early, |
1524 | .thaw = i915_pm_resume, | 1544 | .thaw = i915_pm_resume, |
1525 | .poweroff = i915_pm_suspend, | 1545 | .poweroff = i915_pm_suspend, |
1526 | .poweroff_late = i915_pm_suspend_late, | 1546 | .poweroff_late = i915_pm_poweroff_late, |
1527 | .restore_early = i915_pm_resume_early, | 1547 | .restore_early = i915_pm_resume_early, |
1528 | .restore = i915_pm_resume, | 1548 | .restore = i915_pm_resume, |
1529 | 1549 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 2903090f25e5..ee5bc43dfc0b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -2004,6 +2004,9 @@ void i915_gem_track_fb(struct drm_i915_gem_object *old, | |||
2004 | * number comparisons on buffer last_read|write_seqno. It also allows an | 2004 | * number comparisons on buffer last_read|write_seqno. It also allows an |
2005 | * emission time to be associated with the request for tracking how far ahead | 2005 | * emission time to be associated with the request for tracking how far ahead |
2006 | * of the GPU the submission is. | 2006 | * of the GPU the submission is. |
2007 | * | ||
2008 | * The requests are reference counted, so upon creation they should have an | ||
2009 | * initial reference taken using kref_init | ||
2007 | */ | 2010 | */ |
2008 | struct drm_i915_gem_request { | 2011 | struct drm_i915_gem_request { |
2009 | struct kref ref; | 2012 | struct kref ref; |
@@ -2027,7 +2030,16 @@ struct drm_i915_gem_request { | |||
2027 | /** Position in the ringbuffer of the end of the whole request */ | 2030 | /** Position in the ringbuffer of the end of the whole request */ |
2028 | u32 tail; | 2031 | u32 tail; |
2029 | 2032 | ||
2030 | /** Context and ring buffer related to this request */ | 2033 | /** |
2034 | * Context and ring buffer related to this request | ||
2035 | * Contexts are refcounted, so when this request is associated with a | ||
2036 | * context, we must increment the context's refcount, to guarantee that | ||
2037 | * it persists while any request is linked to it. Requests themselves | ||
2038 | * are also refcounted, so the request will only be freed when the last | ||
2039 | * reference to it is dismissed, and the code in | ||
2040 | * i915_gem_request_free() will then decrement the refcount on the | ||
2041 | * context. | ||
2042 | */ | ||
2031 | struct intel_context *ctx; | 2043 | struct intel_context *ctx; |
2032 | struct intel_ringbuffer *ringbuf; | 2044 | struct intel_ringbuffer *ringbuf; |
2033 | 2045 | ||
@@ -2266,6 +2278,7 @@ struct drm_i915_cmd_table { | |||
2266 | (INTEL_DEVID(dev) & 0xFF00) == 0x0C00) | 2278 | (INTEL_DEVID(dev) & 0xFF00) == 0x0C00) |
2267 | #define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \ | 2279 | #define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \ |
2268 | ((INTEL_DEVID(dev) & 0xf) == 0x6 || \ | 2280 | ((INTEL_DEVID(dev) & 0xf) == 0x6 || \ |
2281 | (INTEL_DEVID(dev) & 0xf) == 0xb || \ | ||
2269 | (INTEL_DEVID(dev) & 0xf) == 0xe)) | 2282 | (INTEL_DEVID(dev) & 0xf) == 0xe)) |
2270 | #define IS_BDW_GT3(dev) (IS_BROADWELL(dev) && \ | 2283 | #define IS_BDW_GT3(dev) (IS_BROADWELL(dev) && \ |
2271 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) | 2284 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 1b2a1eb3aafc..0107c2ae77d0 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2664,8 +2664,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, | |||
2664 | if (submit_req->ctx != ring->default_context) | 2664 | if (submit_req->ctx != ring->default_context) |
2665 | intel_lr_context_unpin(ring, submit_req->ctx); | 2665 | intel_lr_context_unpin(ring, submit_req->ctx); |
2666 | 2666 | ||
2667 | i915_gem_context_unreference(submit_req->ctx); | 2667 | i915_gem_request_unreference(submit_req); |
2668 | kfree(submit_req); | ||
2669 | } | 2668 | } |
2670 | 2669 | ||
2671 | /* | 2670 | /* |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index bd95776c3144..74df3d1581dd 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1229,7 +1229,7 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt) | |||
1229 | 1229 | ||
1230 | ppgtt->base.clear_range(&ppgtt->base, 0, ppgtt->base.total, true); | 1230 | ppgtt->base.clear_range(&ppgtt->base, 0, ppgtt->base.total, true); |
1231 | 1231 | ||
1232 | DRM_DEBUG_DRIVER("Allocated pde space (%ldM) at GTT entry: %lx\n", | 1232 | DRM_DEBUG_DRIVER("Allocated pde space (%lldM) at GTT entry: %llx\n", |
1233 | ppgtt->node.size >> 20, | 1233 | ppgtt->node.size >> 20, |
1234 | ppgtt->node.start / PAGE_SIZE); | 1234 | ppgtt->node.start / PAGE_SIZE); |
1235 | 1235 | ||
@@ -1797,8 +1797,8 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj) | |||
1797 | 1797 | ||
1798 | static void i915_gtt_color_adjust(struct drm_mm_node *node, | 1798 | static void i915_gtt_color_adjust(struct drm_mm_node *node, |
1799 | unsigned long color, | 1799 | unsigned long color, |
1800 | unsigned long *start, | 1800 | u64 *start, |
1801 | unsigned long *end) | 1801 | u64 *end) |
1802 | { | 1802 | { |
1803 | if (node->color != color) | 1803 | if (node->color != color) |
1804 | *start += 4096; | 1804 | *start += 4096; |
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index f1de95f7432c..f8da71682c96 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -485,10 +485,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
485 | stolen_offset, gtt_offset, size); | 485 | stolen_offset, gtt_offset, size); |
486 | 486 | ||
487 | /* KISS and expect everything to be page-aligned */ | 487 | /* KISS and expect everything to be page-aligned */ |
488 | BUG_ON(stolen_offset & 4095); | 488 | if (WARN_ON(size == 0) || WARN_ON(size & 4095) || |
489 | BUG_ON(size & 4095); | 489 | WARN_ON(stolen_offset & 4095)) |
490 | |||
491 | if (WARN_ON(size == 0)) | ||
492 | return NULL; | 490 | return NULL; |
493 | 491 | ||
494 | stolen = kzalloc(sizeof(*stolen), GFP_KERNEL); | 492 | stolen = kzalloc(sizeof(*stolen), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 7a24bd1a51f6..6377b22269ad 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -335,9 +335,10 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
335 | return -EINVAL; | 335 | return -EINVAL; |
336 | } | 336 | } |
337 | 337 | ||
338 | mutex_lock(&dev->struct_mutex); | ||
338 | if (i915_gem_obj_is_pinned(obj) || obj->framebuffer_references) { | 339 | if (i915_gem_obj_is_pinned(obj) || obj->framebuffer_references) { |
339 | drm_gem_object_unreference_unlocked(&obj->base); | 340 | ret = -EBUSY; |
340 | return -EBUSY; | 341 | goto err; |
341 | } | 342 | } |
342 | 343 | ||
343 | if (args->tiling_mode == I915_TILING_NONE) { | 344 | if (args->tiling_mode == I915_TILING_NONE) { |
@@ -369,7 +370,6 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
369 | } | 370 | } |
370 | } | 371 | } |
371 | 372 | ||
372 | mutex_lock(&dev->struct_mutex); | ||
373 | if (args->tiling_mode != obj->tiling_mode || | 373 | if (args->tiling_mode != obj->tiling_mode || |
374 | args->stride != obj->stride) { | 374 | args->stride != obj->stride) { |
375 | /* We need to rebind the object if its current allocation | 375 | /* We need to rebind the object if its current allocation |
@@ -424,6 +424,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
424 | obj->bit_17 = NULL; | 424 | obj->bit_17 = NULL; |
425 | } | 425 | } |
426 | 426 | ||
427 | err: | ||
427 | drm_gem_object_unreference(&obj->base); | 428 | drm_gem_object_unreference(&obj->base); |
428 | mutex_unlock(&dev->struct_mutex); | 429 | mutex_unlock(&dev->struct_mutex); |
429 | 430 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 6ebea4614204..9baecb79de8c 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1840,6 +1840,9 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg) | |||
1840 | u32 iir, gt_iir, pm_iir; | 1840 | u32 iir, gt_iir, pm_iir; |
1841 | irqreturn_t ret = IRQ_NONE; | 1841 | irqreturn_t ret = IRQ_NONE; |
1842 | 1842 | ||
1843 | if (!intel_irqs_enabled(dev_priv)) | ||
1844 | return IRQ_NONE; | ||
1845 | |||
1843 | while (true) { | 1846 | while (true) { |
1844 | /* Find, clear, then process each source of interrupt */ | 1847 | /* Find, clear, then process each source of interrupt */ |
1845 | 1848 | ||
@@ -1884,6 +1887,9 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg) | |||
1884 | u32 master_ctl, iir; | 1887 | u32 master_ctl, iir; |
1885 | irqreturn_t ret = IRQ_NONE; | 1888 | irqreturn_t ret = IRQ_NONE; |
1886 | 1889 | ||
1890 | if (!intel_irqs_enabled(dev_priv)) | ||
1891 | return IRQ_NONE; | ||
1892 | |||
1887 | for (;;) { | 1893 | for (;;) { |
1888 | master_ctl = I915_READ(GEN8_MASTER_IRQ) & ~GEN8_MASTER_IRQ_CONTROL; | 1894 | master_ctl = I915_READ(GEN8_MASTER_IRQ) & ~GEN8_MASTER_IRQ_CONTROL; |
1889 | iir = I915_READ(VLV_IIR); | 1895 | iir = I915_READ(VLV_IIR); |
@@ -2156,6 +2162,9 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg) | |||
2156 | u32 de_iir, gt_iir, de_ier, sde_ier = 0; | 2162 | u32 de_iir, gt_iir, de_ier, sde_ier = 0; |
2157 | irqreturn_t ret = IRQ_NONE; | 2163 | irqreturn_t ret = IRQ_NONE; |
2158 | 2164 | ||
2165 | if (!intel_irqs_enabled(dev_priv)) | ||
2166 | return IRQ_NONE; | ||
2167 | |||
2159 | /* We get interrupts on unclaimed registers, so check for this before we | 2168 | /* We get interrupts on unclaimed registers, so check for this before we |
2160 | * do any I915_{READ,WRITE}. */ | 2169 | * do any I915_{READ,WRITE}. */ |
2161 | intel_uncore_check_errors(dev); | 2170 | intel_uncore_check_errors(dev); |
@@ -2227,6 +2236,9 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg) | |||
2227 | enum pipe pipe; | 2236 | enum pipe pipe; |
2228 | u32 aux_mask = GEN8_AUX_CHANNEL_A; | 2237 | u32 aux_mask = GEN8_AUX_CHANNEL_A; |
2229 | 2238 | ||
2239 | if (!intel_irqs_enabled(dev_priv)) | ||
2240 | return IRQ_NONE; | ||
2241 | |||
2230 | if (IS_GEN9(dev)) | 2242 | if (IS_GEN9(dev)) |
2231 | aux_mask |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C | | 2243 | aux_mask |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C | |
2232 | GEN9_AUX_CHANNEL_D; | 2244 | GEN9_AUX_CHANNEL_D; |
@@ -3704,6 +3716,9 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) | |||
3704 | I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT | | 3716 | I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT | |
3705 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; | 3717 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; |
3706 | 3718 | ||
3719 | if (!intel_irqs_enabled(dev_priv)) | ||
3720 | return IRQ_NONE; | ||
3721 | |||
3707 | iir = I915_READ16(IIR); | 3722 | iir = I915_READ16(IIR); |
3708 | if (iir == 0) | 3723 | if (iir == 0) |
3709 | return IRQ_NONE; | 3724 | return IRQ_NONE; |
@@ -3884,6 +3899,9 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) | |||
3884 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; | 3899 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; |
3885 | int pipe, ret = IRQ_NONE; | 3900 | int pipe, ret = IRQ_NONE; |
3886 | 3901 | ||
3902 | if (!intel_irqs_enabled(dev_priv)) | ||
3903 | return IRQ_NONE; | ||
3904 | |||
3887 | iir = I915_READ(IIR); | 3905 | iir = I915_READ(IIR); |
3888 | do { | 3906 | do { |
3889 | bool irq_received = (iir & ~flip_mask) != 0; | 3907 | bool irq_received = (iir & ~flip_mask) != 0; |
@@ -4104,6 +4122,9 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) | |||
4104 | I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT | | 4122 | I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT | |
4105 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; | 4123 | I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT; |
4106 | 4124 | ||
4125 | if (!intel_irqs_enabled(dev_priv)) | ||
4126 | return IRQ_NONE; | ||
4127 | |||
4107 | iir = I915_READ(IIR); | 4128 | iir = I915_READ(IIR); |
4108 | 4129 | ||
4109 | for (;;) { | 4130 | for (;;) { |
@@ -4451,6 +4472,7 @@ void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv) | |||
4451 | { | 4472 | { |
4452 | dev_priv->dev->driver->irq_uninstall(dev_priv->dev); | 4473 | dev_priv->dev->driver->irq_uninstall(dev_priv->dev); |
4453 | dev_priv->pm.irqs_enabled = false; | 4474 | dev_priv->pm.irqs_enabled = false; |
4475 | synchronize_irq(dev_priv->dev->irq); | ||
4454 | } | 4476 | } |
4455 | 4477 | ||
4456 | /** | 4478 | /** |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dbd817928d0d..31f3b11589b9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2416,13 +2416,19 @@ intel_alloc_plane_obj(struct intel_crtc *crtc, | |||
2416 | struct drm_i915_gem_object *obj = NULL; | 2416 | struct drm_i915_gem_object *obj = NULL; |
2417 | struct drm_mode_fb_cmd2 mode_cmd = { 0 }; | 2417 | struct drm_mode_fb_cmd2 mode_cmd = { 0 }; |
2418 | struct drm_framebuffer *fb = &plane_config->fb->base; | 2418 | struct drm_framebuffer *fb = &plane_config->fb->base; |
2419 | u32 base = plane_config->base; | 2419 | u32 base_aligned = round_down(plane_config->base, PAGE_SIZE); |
2420 | u32 size_aligned = round_up(plane_config->base + plane_config->size, | ||
2421 | PAGE_SIZE); | ||
2422 | |||
2423 | size_aligned -= base_aligned; | ||
2420 | 2424 | ||
2421 | if (plane_config->size == 0) | 2425 | if (plane_config->size == 0) |
2422 | return false; | 2426 | return false; |
2423 | 2427 | ||
2424 | obj = i915_gem_object_create_stolen_for_preallocated(dev, base, base, | 2428 | obj = i915_gem_object_create_stolen_for_preallocated(dev, |
2425 | plane_config->size); | 2429 | base_aligned, |
2430 | base_aligned, | ||
2431 | size_aligned); | ||
2426 | if (!obj) | 2432 | if (!obj) |
2427 | return false; | 2433 | return false; |
2428 | 2434 | ||
@@ -2830,10 +2836,19 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc, | |||
2830 | case DRM_FORMAT_XRGB8888: | 2836 | case DRM_FORMAT_XRGB8888: |
2831 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | 2837 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; |
2832 | break; | 2838 | break; |
2839 | case DRM_FORMAT_ARGB8888: | ||
2840 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | ||
2841 | plane_ctl |= PLANE_CTL_ALPHA_SW_PREMULTIPLY; | ||
2842 | break; | ||
2833 | case DRM_FORMAT_XBGR8888: | 2843 | case DRM_FORMAT_XBGR8888: |
2834 | plane_ctl |= PLANE_CTL_ORDER_RGBX; | 2844 | plane_ctl |= PLANE_CTL_ORDER_RGBX; |
2835 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | 2845 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; |
2836 | break; | 2846 | break; |
2847 | case DRM_FORMAT_ABGR8888: | ||
2848 | plane_ctl |= PLANE_CTL_ORDER_RGBX; | ||
2849 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_8888; | ||
2850 | plane_ctl |= PLANE_CTL_ALPHA_SW_PREMULTIPLY; | ||
2851 | break; | ||
2837 | case DRM_FORMAT_XRGB2101010: | 2852 | case DRM_FORMAT_XRGB2101010: |
2838 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_2101010; | 2853 | plane_ctl |= PLANE_CTL_FORMAT_XRGB_2101010; |
2839 | break; | 2854 | break; |
@@ -6755,7 +6770,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
6755 | fb->pixel_format, | 6770 | fb->pixel_format, |
6756 | fb->modifier[0]); | 6771 | fb->modifier[0]); |
6757 | 6772 | ||
6758 | plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); | 6773 | plane_config->size = fb->pitches[0] * aligned_height; |
6759 | 6774 | ||
6760 | DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 6775 | DRM_DEBUG_KMS("pipe/plane %c/%d with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
6761 | pipe_name(pipe), plane, fb->width, fb->height, | 6776 | pipe_name(pipe), plane, fb->width, fb->height, |
@@ -7804,7 +7819,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7804 | fb->pixel_format, | 7819 | fb->pixel_format, |
7805 | fb->modifier[0]); | 7820 | fb->modifier[0]); |
7806 | 7821 | ||
7807 | plane_config->size = ALIGN(fb->pitches[0] * aligned_height, PAGE_SIZE); | 7822 | plane_config->size = fb->pitches[0] * aligned_height; |
7808 | 7823 | ||
7809 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 7824 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
7810 | pipe_name(pipe), fb->width, fb->height, | 7825 | pipe_name(pipe), fb->width, fb->height, |
@@ -7901,7 +7916,7 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
7901 | fb->pixel_format, | 7916 | fb->pixel_format, |
7902 | fb->modifier[0]); | 7917 | fb->modifier[0]); |
7903 | 7918 | ||
7904 | plane_config->size = PAGE_ALIGN(fb->pitches[0] * aligned_height); | 7919 | plane_config->size = fb->pitches[0] * aligned_height; |
7905 | 7920 | ||
7906 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", | 7921 | DRM_DEBUG_KMS("pipe %c with fb: size=%dx%d@%d, offset=%x, pitch %d, size 0x%x\n", |
7907 | pipe_name(pipe), fb->width, fb->height, | 7922 | pipe_name(pipe), fb->width, fb->height, |
@@ -8844,6 +8859,7 @@ retry: | |||
8844 | old->release_fb->funcs->destroy(old->release_fb); | 8859 | old->release_fb->funcs->destroy(old->release_fb); |
8845 | goto fail; | 8860 | goto fail; |
8846 | } | 8861 | } |
8862 | crtc->primary->crtc = crtc; | ||
8847 | 8863 | ||
8848 | /* let the connector get through one full cycle before testing */ | 8864 | /* let the connector get through one full cycle before testing */ |
8849 | intel_wait_for_vblank(dev, intel_crtc->pipe); | 8865 | intel_wait_for_vblank(dev, intel_crtc->pipe); |
@@ -12279,10 +12295,9 @@ intel_check_cursor_plane(struct drm_plane *plane, | |||
12279 | return -ENOMEM; | 12295 | return -ENOMEM; |
12280 | } | 12296 | } |
12281 | 12297 | ||
12282 | if (fb == crtc->cursor->fb) | 12298 | /* we only need to pin inside GTT if cursor is non-phy */ |
12283 | return 0; | 12299 | mutex_lock(&dev->struct_mutex); |
12284 | 12300 | if (!INTEL_INFO(dev)->cursor_needs_physical && obj->tiling_mode) { | |
12285 | if (fb->modifier[0] != DRM_FORMAT_MOD_NONE) { | ||
12286 | DRM_DEBUG_KMS("cursor cannot be tiled\n"); | 12301 | DRM_DEBUG_KMS("cursor cannot be tiled\n"); |
12287 | ret = -EINVAL; | 12302 | ret = -EINVAL; |
12288 | } | 12303 | } |
@@ -13236,6 +13251,9 @@ static struct intel_quirk intel_quirks[] = { | |||
13236 | 13251 | ||
13237 | /* HP Chromebook 14 (Celeron 2955U) */ | 13252 | /* HP Chromebook 14 (Celeron 2955U) */ |
13238 | { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present }, | 13253 | { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present }, |
13254 | |||
13255 | /* Dell Chromebook 11 */ | ||
13256 | { 0x0a06, 0x1028, 0x0a35, quirk_backlight_present }, | ||
13239 | }; | 13257 | }; |
13240 | 13258 | ||
13241 | static void intel_init_quirks(struct drm_device *dev) | 13259 | static void intel_init_quirks(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_fifo_underrun.c b/drivers/gpu/drm/i915/intel_fifo_underrun.c index 04e248dd2259..54daa66c6970 100644 --- a/drivers/gpu/drm/i915/intel_fifo_underrun.c +++ b/drivers/gpu/drm/i915/intel_fifo_underrun.c | |||
@@ -282,16 +282,6 @@ bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv, | |||
282 | return ret; | 282 | return ret; |
283 | } | 283 | } |
284 | 284 | ||
285 | static bool | ||
286 | __cpu_fifo_underrun_reporting_enabled(struct drm_i915_private *dev_priv, | ||
287 | enum pipe pipe) | ||
288 | { | ||
289 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | ||
290 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
291 | |||
292 | return !intel_crtc->cpu_fifo_underrun_disabled; | ||
293 | } | ||
294 | |||
295 | /** | 285 | /** |
296 | * intel_set_pch_fifo_underrun_reporting - set PCH fifo underrun reporting state | 286 | * intel_set_pch_fifo_underrun_reporting - set PCH fifo underrun reporting state |
297 | * @dev_priv: i915 device instance | 287 | * @dev_priv: i915 device instance |
@@ -352,9 +342,15 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, | |||
352 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | 342 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, |
353 | enum pipe pipe) | 343 | enum pipe pipe) |
354 | { | 344 | { |
345 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | ||
346 | |||
347 | /* We may be called too early in init, thanks BIOS! */ | ||
348 | if (crtc == NULL) | ||
349 | return; | ||
350 | |||
355 | /* GMCH can't disable fifo underruns, filter them. */ | 351 | /* GMCH can't disable fifo underruns, filter them. */ |
356 | if (HAS_GMCH_DISPLAY(dev_priv->dev) && | 352 | if (HAS_GMCH_DISPLAY(dev_priv->dev) && |
357 | !__cpu_fifo_underrun_reporting_enabled(dev_priv, pipe)) | 353 | to_intel_crtc(crtc)->cpu_fifo_underrun_disabled) |
358 | return; | 354 | return; |
359 | 355 | ||
360 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false)) | 356 | if (intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false)) |
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index a2dc9a11a248..fcb074bd55dc 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
@@ -512,18 +512,19 @@ static int execlists_context_queue(struct intel_engine_cs *ring, | |||
512 | * If there isn't a request associated with this submission, | 512 | * If there isn't a request associated with this submission, |
513 | * create one as a temporary holder. | 513 | * create one as a temporary holder. |
514 | */ | 514 | */ |
515 | WARN(1, "execlist context submission without request"); | ||
516 | request = kzalloc(sizeof(*request), GFP_KERNEL); | 515 | request = kzalloc(sizeof(*request), GFP_KERNEL); |
517 | if (request == NULL) | 516 | if (request == NULL) |
518 | return -ENOMEM; | 517 | return -ENOMEM; |
519 | request->ring = ring; | 518 | request->ring = ring; |
520 | request->ctx = to; | 519 | request->ctx = to; |
520 | kref_init(&request->ref); | ||
521 | request->uniq = dev_priv->request_uniq++; | ||
522 | i915_gem_context_reference(request->ctx); | ||
521 | } else { | 523 | } else { |
524 | i915_gem_request_reference(request); | ||
522 | WARN_ON(to != request->ctx); | 525 | WARN_ON(to != request->ctx); |
523 | } | 526 | } |
524 | request->tail = tail; | 527 | request->tail = tail; |
525 | i915_gem_request_reference(request); | ||
526 | i915_gem_context_reference(request->ctx); | ||
527 | 528 | ||
528 | intel_runtime_pm_get(dev_priv); | 529 | intel_runtime_pm_get(dev_priv); |
529 | 530 | ||
@@ -742,7 +743,6 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring) | |||
742 | if (ctx_obj && (ctx != ring->default_context)) | 743 | if (ctx_obj && (ctx != ring->default_context)) |
743 | intel_lr_context_unpin(ring, ctx); | 744 | intel_lr_context_unpin(ring, ctx); |
744 | intel_runtime_pm_put(dev_priv); | 745 | intel_runtime_pm_put(dev_priv); |
745 | i915_gem_context_unreference(ctx); | ||
746 | list_del(&req->execlist_link); | 746 | list_del(&req->execlist_link); |
747 | i915_gem_request_unreference(req); | 747 | i915_gem_request_unreference(req); |
748 | } | 748 | } |
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index 121d30ca2d44..87fe8ed92ebe 100644 --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c | |||
@@ -70,7 +70,9 @@ static const struct dw_hdmi_curr_ctrl imx_cur_ctr[] = { | |||
70 | 118800000, { 0x091c, 0x091c, 0x06dc }, | 70 | 118800000, { 0x091c, 0x091c, 0x06dc }, |
71 | }, { | 71 | }, { |
72 | 216000000, { 0x06dc, 0x0b5c, 0x091c }, | 72 | 216000000, { 0x06dc, 0x0b5c, 0x091c }, |
73 | } | 73 | }, { |
74 | ~0UL, { 0x0000, 0x0000, 0x0000 }, | ||
75 | }, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | static const struct dw_hdmi_sym_term imx_sym_term[] = { | 78 | static const struct dw_hdmi_sym_term imx_sym_term[] = { |
@@ -136,11 +138,34 @@ static struct drm_encoder_funcs dw_hdmi_imx_encoder_funcs = { | |||
136 | .destroy = drm_encoder_cleanup, | 138 | .destroy = drm_encoder_cleanup, |
137 | }; | 139 | }; |
138 | 140 | ||
141 | static enum drm_mode_status imx6q_hdmi_mode_valid(struct drm_connector *con, | ||
142 | struct drm_display_mode *mode) | ||
143 | { | ||
144 | if (mode->clock < 13500) | ||
145 | return MODE_CLOCK_LOW; | ||
146 | if (mode->clock > 266000) | ||
147 | return MODE_CLOCK_HIGH; | ||
148 | |||
149 | return MODE_OK; | ||
150 | } | ||
151 | |||
152 | static enum drm_mode_status imx6dl_hdmi_mode_valid(struct drm_connector *con, | ||
153 | struct drm_display_mode *mode) | ||
154 | { | ||
155 | if (mode->clock < 13500) | ||
156 | return MODE_CLOCK_LOW; | ||
157 | if (mode->clock > 270000) | ||
158 | return MODE_CLOCK_HIGH; | ||
159 | |||
160 | return MODE_OK; | ||
161 | } | ||
162 | |||
139 | static struct dw_hdmi_plat_data imx6q_hdmi_drv_data = { | 163 | static struct dw_hdmi_plat_data imx6q_hdmi_drv_data = { |
140 | .mpll_cfg = imx_mpll_cfg, | 164 | .mpll_cfg = imx_mpll_cfg, |
141 | .cur_ctr = imx_cur_ctr, | 165 | .cur_ctr = imx_cur_ctr, |
142 | .sym_term = imx_sym_term, | 166 | .sym_term = imx_sym_term, |
143 | .dev_type = IMX6Q_HDMI, | 167 | .dev_type = IMX6Q_HDMI, |
168 | .mode_valid = imx6q_hdmi_mode_valid, | ||
144 | }; | 169 | }; |
145 | 170 | ||
146 | static struct dw_hdmi_plat_data imx6dl_hdmi_drv_data = { | 171 | static struct dw_hdmi_plat_data imx6dl_hdmi_drv_data = { |
@@ -148,6 +173,7 @@ static struct dw_hdmi_plat_data imx6dl_hdmi_drv_data = { | |||
148 | .cur_ctr = imx_cur_ctr, | 173 | .cur_ctr = imx_cur_ctr, |
149 | .sym_term = imx_sym_term, | 174 | .sym_term = imx_sym_term, |
150 | .dev_type = IMX6DL_HDMI, | 175 | .dev_type = IMX6DL_HDMI, |
176 | .mode_valid = imx6dl_hdmi_mode_valid, | ||
151 | }; | 177 | }; |
152 | 178 | ||
153 | static const struct of_device_id dw_hdmi_imx_dt_ids[] = { | 179 | static const struct of_device_id dw_hdmi_imx_dt_ids[] = { |
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 1b86aac0b341..2d6dc94e1e64 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c | |||
@@ -163,22 +163,7 @@ static void imx_ldb_encoder_prepare(struct drm_encoder *encoder) | |||
163 | { | 163 | { |
164 | struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); | 164 | struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); |
165 | struct imx_ldb *ldb = imx_ldb_ch->ldb; | 165 | struct imx_ldb *ldb = imx_ldb_ch->ldb; |
166 | struct drm_display_mode *mode = &encoder->crtc->hwmode; | ||
167 | u32 pixel_fmt; | 166 | u32 pixel_fmt; |
168 | unsigned long serial_clk; | ||
169 | unsigned long di_clk = mode->clock * 1000; | ||
170 | int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); | ||
171 | |||
172 | if (ldb->ldb_ctrl & LDB_SPLIT_MODE_EN) { | ||
173 | /* dual channel LVDS mode */ | ||
174 | serial_clk = 3500UL * mode->clock; | ||
175 | imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); | ||
176 | imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); | ||
177 | } else { | ||
178 | serial_clk = 7000UL * mode->clock; | ||
179 | imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, | ||
180 | di_clk); | ||
181 | } | ||
182 | 167 | ||
183 | switch (imx_ldb_ch->chno) { | 168 | switch (imx_ldb_ch->chno) { |
184 | case 0: | 169 | case 0: |
@@ -247,6 +232,9 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder, | |||
247 | struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); | 232 | struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); |
248 | struct imx_ldb *ldb = imx_ldb_ch->ldb; | 233 | struct imx_ldb *ldb = imx_ldb_ch->ldb; |
249 | int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; | 234 | int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; |
235 | unsigned long serial_clk; | ||
236 | unsigned long di_clk = mode->clock * 1000; | ||
237 | int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); | ||
250 | 238 | ||
251 | if (mode->clock > 170000) { | 239 | if (mode->clock > 170000) { |
252 | dev_warn(ldb->dev, | 240 | dev_warn(ldb->dev, |
@@ -257,6 +245,16 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder, | |||
257 | "%s: mode exceeds 85 MHz pixel clock\n", __func__); | 245 | "%s: mode exceeds 85 MHz pixel clock\n", __func__); |
258 | } | 246 | } |
259 | 247 | ||
248 | if (dual) { | ||
249 | serial_clk = 3500UL * mode->clock; | ||
250 | imx_ldb_set_clock(ldb, mux, 0, serial_clk, di_clk); | ||
251 | imx_ldb_set_clock(ldb, mux, 1, serial_clk, di_clk); | ||
252 | } else { | ||
253 | serial_clk = 7000UL * mode->clock; | ||
254 | imx_ldb_set_clock(ldb, mux, imx_ldb_ch->chno, serial_clk, | ||
255 | di_clk); | ||
256 | } | ||
257 | |||
260 | /* FIXME - assumes straight connections DI0 --> CH0, DI1 --> CH1 */ | 258 | /* FIXME - assumes straight connections DI0 --> CH0, DI1 --> CH1 */ |
261 | if (imx_ldb_ch == &ldb->channel[0]) { | 259 | if (imx_ldb_ch == &ldb->channel[0]) { |
262 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) | 260 | if (mode->flags & DRM_MODE_FLAG_NVSYNC) |
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index 5e83e007080f..900dda6a8e71 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c | |||
@@ -236,8 +236,11 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | panel_node = of_parse_phandle(np, "fsl,panel", 0); | 238 | panel_node = of_parse_phandle(np, "fsl,panel", 0); |
239 | if (panel_node) | 239 | if (panel_node) { |
240 | imxpd->panel = of_drm_find_panel(panel_node); | 240 | imxpd->panel = of_drm_find_panel(panel_node); |
241 | if (!imxpd->panel) | ||
242 | return -EPROBE_DEFER; | ||
243 | } | ||
241 | 244 | ||
242 | imxpd->dev = dev; | 245 | imxpd->dev = dev; |
243 | 246 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c index 8edd531cb621..7369ee7f0c55 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c | |||
@@ -32,7 +32,10 @@ static void mdp4_irq_error_handler(struct mdp_irq *irq, uint32_t irqstatus) | |||
32 | void mdp4_irq_preinstall(struct msm_kms *kms) | 32 | void mdp4_irq_preinstall(struct msm_kms *kms) |
33 | { | 33 | { |
34 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); | 34 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); |
35 | mdp4_enable(mdp4_kms); | ||
35 | mdp4_write(mdp4_kms, REG_MDP4_INTR_CLEAR, 0xffffffff); | 36 | mdp4_write(mdp4_kms, REG_MDP4_INTR_CLEAR, 0xffffffff); |
37 | mdp4_write(mdp4_kms, REG_MDP4_INTR_ENABLE, 0x00000000); | ||
38 | mdp4_disable(mdp4_kms); | ||
36 | } | 39 | } |
37 | 40 | ||
38 | int mdp4_irq_postinstall(struct msm_kms *kms) | 41 | int mdp4_irq_postinstall(struct msm_kms *kms) |
@@ -53,7 +56,9 @@ int mdp4_irq_postinstall(struct msm_kms *kms) | |||
53 | void mdp4_irq_uninstall(struct msm_kms *kms) | 56 | void mdp4_irq_uninstall(struct msm_kms *kms) |
54 | { | 57 | { |
55 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); | 58 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); |
59 | mdp4_enable(mdp4_kms); | ||
56 | mdp4_write(mdp4_kms, REG_MDP4_INTR_ENABLE, 0x00000000); | 60 | mdp4_write(mdp4_kms, REG_MDP4_INTR_ENABLE, 0x00000000); |
61 | mdp4_disable(mdp4_kms); | ||
57 | } | 62 | } |
58 | 63 | ||
59 | irqreturn_t mdp4_irq(struct msm_kms *kms) | 64 | irqreturn_t mdp4_irq(struct msm_kms *kms) |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h index 09b4a25eb553..c276624290af 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h | |||
@@ -8,17 +8,9 @@ http://github.com/freedreno/envytools/ | |||
8 | git clone https://github.com/freedreno/envytools.git | 8 | git clone https://github.com/freedreno/envytools.git |
9 | 9 | ||
10 | The rules-ng-ng source files this header was generated from are: | 10 | The rules-ng-ng source files this header was generated from are: |
11 | - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2014-12-05 15:34:49) | 11 | - /local/mnt2/workspace2/sviau/envytools/rnndb/mdp/mdp5.xml ( 27229 bytes, from 2015-02-10 17:00:41) |
12 | - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2013-03-31 16:51:27) | 12 | - /local/mnt2/workspace2/sviau/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2014-06-02 18:31:15) |
13 | - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20908 bytes, from 2014-12-08 16:13:00) | 13 | - /local/mnt2/workspace2/sviau/envytools/rnndb/mdp/mdp_common.xml ( 2357 bytes, from 2015-01-23 16:20:19) |
14 | - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2357 bytes, from 2014-12-08 16:13:00) | ||
15 | - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 27208 bytes, from 2015-01-13 23:56:11) | ||
16 | - /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml ( 11712 bytes, from 2013-08-17 17:13:43) | ||
17 | - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 344 bytes, from 2013-08-11 19:26:32) | ||
18 | - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2014-10-31 16:48:57) | ||
19 | - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2013-07-05 19:21:12) | ||
20 | - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 26848 bytes, from 2015-01-13 23:55:57) | ||
21 | - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 8253 bytes, from 2014-12-08 16:13:00) | ||
22 | 14 | ||
23 | Copyright (C) 2013-2015 by the following authors: | 15 | Copyright (C) 2013-2015 by the following authors: |
24 | - Rob Clark <robdclark@gmail.com> (robclark) | 16 | - Rob Clark <robdclark@gmail.com> (robclark) |
@@ -910,6 +902,7 @@ static inline uint32_t __offset_LM(uint32_t idx) | |||
910 | case 2: return (mdp5_cfg->lm.base[2]); | 902 | case 2: return (mdp5_cfg->lm.base[2]); |
911 | case 3: return (mdp5_cfg->lm.base[3]); | 903 | case 3: return (mdp5_cfg->lm.base[3]); |
912 | case 4: return (mdp5_cfg->lm.base[4]); | 904 | case 4: return (mdp5_cfg->lm.base[4]); |
905 | case 5: return (mdp5_cfg->lm.base[5]); | ||
913 | default: return INVALID_IDX(idx); | 906 | default: return INVALID_IDX(idx); |
914 | } | 907 | } |
915 | } | 908 | } |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c index 46fac545dc2b..2f2863cf8b45 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c | |||
@@ -62,8 +62,8 @@ struct mdp5_crtc { | |||
62 | 62 | ||
63 | /* current cursor being scanned out: */ | 63 | /* current cursor being scanned out: */ |
64 | struct drm_gem_object *scanout_bo; | 64 | struct drm_gem_object *scanout_bo; |
65 | uint32_t width; | 65 | uint32_t width, height; |
66 | uint32_t height; | 66 | uint32_t x, y; |
67 | } cursor; | 67 | } cursor; |
68 | }; | 68 | }; |
69 | #define to_mdp5_crtc(x) container_of(x, struct mdp5_crtc, base) | 69 | #define to_mdp5_crtc(x) container_of(x, struct mdp5_crtc, base) |
@@ -103,8 +103,8 @@ static void crtc_flush_all(struct drm_crtc *crtc) | |||
103 | struct drm_plane *plane; | 103 | struct drm_plane *plane; |
104 | uint32_t flush_mask = 0; | 104 | uint32_t flush_mask = 0; |
105 | 105 | ||
106 | /* we could have already released CTL in the disable path: */ | 106 | /* this should not happen: */ |
107 | if (!mdp5_crtc->ctl) | 107 | if (WARN_ON(!mdp5_crtc->ctl)) |
108 | return; | 108 | return; |
109 | 109 | ||
110 | drm_atomic_crtc_for_each_plane(plane, crtc) { | 110 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
@@ -143,6 +143,11 @@ static void complete_flip(struct drm_crtc *crtc, struct drm_file *file) | |||
143 | drm_atomic_crtc_for_each_plane(plane, crtc) { | 143 | drm_atomic_crtc_for_each_plane(plane, crtc) { |
144 | mdp5_plane_complete_flip(plane); | 144 | mdp5_plane_complete_flip(plane); |
145 | } | 145 | } |
146 | |||
147 | if (mdp5_crtc->ctl && !crtc->state->enable) { | ||
148 | mdp5_ctl_release(mdp5_crtc->ctl); | ||
149 | mdp5_crtc->ctl = NULL; | ||
150 | } | ||
146 | } | 151 | } |
147 | 152 | ||
148 | static void unref_cursor_worker(struct drm_flip_work *work, void *val) | 153 | static void unref_cursor_worker(struct drm_flip_work *work, void *val) |
@@ -386,14 +391,17 @@ static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc) | |||
386 | mdp5_crtc->event = crtc->state->event; | 391 | mdp5_crtc->event = crtc->state->event; |
387 | spin_unlock_irqrestore(&dev->event_lock, flags); | 392 | spin_unlock_irqrestore(&dev->event_lock, flags); |
388 | 393 | ||
394 | /* | ||
395 | * If no CTL has been allocated in mdp5_crtc_atomic_check(), | ||
396 | * it means we are trying to flush a CRTC whose state is disabled: | ||
397 | * nothing else needs to be done. | ||
398 | */ | ||
399 | if (unlikely(!mdp5_crtc->ctl)) | ||
400 | return; | ||
401 | |||
389 | blend_setup(crtc); | 402 | blend_setup(crtc); |
390 | crtc_flush_all(crtc); | 403 | crtc_flush_all(crtc); |
391 | request_pending(crtc, PENDING_FLIP); | 404 | request_pending(crtc, PENDING_FLIP); |
392 | |||
393 | if (mdp5_crtc->ctl && !crtc->state->enable) { | ||
394 | mdp5_ctl_release(mdp5_crtc->ctl); | ||
395 | mdp5_crtc->ctl = NULL; | ||
396 | } | ||
397 | } | 405 | } |
398 | 406 | ||
399 | static int mdp5_crtc_set_property(struct drm_crtc *crtc, | 407 | static int mdp5_crtc_set_property(struct drm_crtc *crtc, |
@@ -403,6 +411,32 @@ static int mdp5_crtc_set_property(struct drm_crtc *crtc, | |||
403 | return -EINVAL; | 411 | return -EINVAL; |
404 | } | 412 | } |
405 | 413 | ||
414 | static void get_roi(struct drm_crtc *crtc, uint32_t *roi_w, uint32_t *roi_h) | ||
415 | { | ||
416 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); | ||
417 | uint32_t xres = crtc->mode.hdisplay; | ||
418 | uint32_t yres = crtc->mode.vdisplay; | ||
419 | |||
420 | /* | ||
421 | * Cursor Region Of Interest (ROI) is a plane read from cursor | ||
422 | * buffer to render. The ROI region is determined by the visibility of | ||
423 | * the cursor point. In the default Cursor image the cursor point will | ||
424 | * be at the top left of the cursor image, unless it is specified | ||
425 | * otherwise using hotspot feature. | ||
426 | * | ||
427 | * If the cursor point reaches the right (xres - x < cursor.width) or | ||
428 | * bottom (yres - y < cursor.height) boundary of the screen, then ROI | ||
429 | * width and ROI height need to be evaluated to crop the cursor image | ||
430 | * accordingly. | ||
431 | * (xres-x) will be new cursor width when x > (xres - cursor.width) | ||
432 | * (yres-y) will be new cursor height when y > (yres - cursor.height) | ||
433 | */ | ||
434 | *roi_w = min(mdp5_crtc->cursor.width, xres - | ||
435 | mdp5_crtc->cursor.x); | ||
436 | *roi_h = min(mdp5_crtc->cursor.height, yres - | ||
437 | mdp5_crtc->cursor.y); | ||
438 | } | ||
439 | |||
406 | static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, | 440 | static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, |
407 | struct drm_file *file, uint32_t handle, | 441 | struct drm_file *file, uint32_t handle, |
408 | uint32_t width, uint32_t height) | 442 | uint32_t width, uint32_t height) |
@@ -416,6 +450,7 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, | |||
416 | unsigned int depth; | 450 | unsigned int depth; |
417 | enum mdp5_cursor_alpha cur_alpha = CURSOR_ALPHA_PER_PIXEL; | 451 | enum mdp5_cursor_alpha cur_alpha = CURSOR_ALPHA_PER_PIXEL; |
418 | uint32_t flush_mask = mdp_ctl_flush_mask_cursor(0); | 452 | uint32_t flush_mask = mdp_ctl_flush_mask_cursor(0); |
453 | uint32_t roi_w, roi_h; | ||
419 | unsigned long flags; | 454 | unsigned long flags; |
420 | 455 | ||
421 | if ((width > CURSOR_WIDTH) || (height > CURSOR_HEIGHT)) { | 456 | if ((width > CURSOR_WIDTH) || (height > CURSOR_HEIGHT)) { |
@@ -446,6 +481,12 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, | |||
446 | spin_lock_irqsave(&mdp5_crtc->cursor.lock, flags); | 481 | spin_lock_irqsave(&mdp5_crtc->cursor.lock, flags); |
447 | old_bo = mdp5_crtc->cursor.scanout_bo; | 482 | old_bo = mdp5_crtc->cursor.scanout_bo; |
448 | 483 | ||
484 | mdp5_crtc->cursor.scanout_bo = cursor_bo; | ||
485 | mdp5_crtc->cursor.width = width; | ||
486 | mdp5_crtc->cursor.height = height; | ||
487 | |||
488 | get_roi(crtc, &roi_w, &roi_h); | ||
489 | |||
449 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride); | 490 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_STRIDE(lm), stride); |
450 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm), | 491 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_FORMAT(lm), |
451 | MDP5_LM_CURSOR_FORMAT_FORMAT(CURSOR_FMT_ARGB8888)); | 492 | MDP5_LM_CURSOR_FORMAT_FORMAT(CURSOR_FMT_ARGB8888)); |
@@ -453,19 +494,14 @@ static int mdp5_crtc_cursor_set(struct drm_crtc *crtc, | |||
453 | MDP5_LM_CURSOR_IMG_SIZE_SRC_H(height) | | 494 | MDP5_LM_CURSOR_IMG_SIZE_SRC_H(height) | |
454 | MDP5_LM_CURSOR_IMG_SIZE_SRC_W(width)); | 495 | MDP5_LM_CURSOR_IMG_SIZE_SRC_W(width)); |
455 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_SIZE(lm), | 496 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_SIZE(lm), |
456 | MDP5_LM_CURSOR_SIZE_ROI_H(height) | | 497 | MDP5_LM_CURSOR_SIZE_ROI_H(roi_h) | |
457 | MDP5_LM_CURSOR_SIZE_ROI_W(width)); | 498 | MDP5_LM_CURSOR_SIZE_ROI_W(roi_w)); |
458 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BASE_ADDR(lm), cursor_addr); | 499 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BASE_ADDR(lm), cursor_addr); |
459 | 500 | ||
460 | |||
461 | blendcfg = MDP5_LM_CURSOR_BLEND_CONFIG_BLEND_EN; | 501 | blendcfg = MDP5_LM_CURSOR_BLEND_CONFIG_BLEND_EN; |
462 | blendcfg |= MDP5_LM_CURSOR_BLEND_CONFIG_BLEND_TRANSP_EN; | ||
463 | blendcfg |= MDP5_LM_CURSOR_BLEND_CONFIG_BLEND_ALPHA_SEL(cur_alpha); | 502 | blendcfg |= MDP5_LM_CURSOR_BLEND_CONFIG_BLEND_ALPHA_SEL(cur_alpha); |
464 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BLEND_CONFIG(lm), blendcfg); | 503 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_BLEND_CONFIG(lm), blendcfg); |
465 | 504 | ||
466 | mdp5_crtc->cursor.scanout_bo = cursor_bo; | ||
467 | mdp5_crtc->cursor.width = width; | ||
468 | mdp5_crtc->cursor.height = height; | ||
469 | spin_unlock_irqrestore(&mdp5_crtc->cursor.lock, flags); | 505 | spin_unlock_irqrestore(&mdp5_crtc->cursor.lock, flags); |
470 | 506 | ||
471 | ret = mdp5_ctl_set_cursor(mdp5_crtc->ctl, true); | 507 | ret = mdp5_ctl_set_cursor(mdp5_crtc->ctl, true); |
@@ -489,31 +525,18 @@ static int mdp5_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
489 | struct mdp5_kms *mdp5_kms = get_kms(crtc); | 525 | struct mdp5_kms *mdp5_kms = get_kms(crtc); |
490 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); | 526 | struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); |
491 | uint32_t flush_mask = mdp_ctl_flush_mask_cursor(0); | 527 | uint32_t flush_mask = mdp_ctl_flush_mask_cursor(0); |
492 | uint32_t xres = crtc->mode.hdisplay; | ||
493 | uint32_t yres = crtc->mode.vdisplay; | ||
494 | uint32_t roi_w; | 528 | uint32_t roi_w; |
495 | uint32_t roi_h; | 529 | uint32_t roi_h; |
496 | unsigned long flags; | 530 | unsigned long flags; |
497 | 531 | ||
498 | x = (x > 0) ? x : 0; | 532 | /* In case the CRTC is disabled, just drop the cursor update */ |
499 | y = (y > 0) ? y : 0; | 533 | if (unlikely(!crtc->state->enable)) |
534 | return 0; | ||
500 | 535 | ||
501 | /* | 536 | mdp5_crtc->cursor.x = x = max(x, 0); |
502 | * Cursor Region Of Interest (ROI) is a plane read from cursor | 537 | mdp5_crtc->cursor.y = y = max(y, 0); |
503 | * buffer to render. The ROI region is determined by the visiblity of | 538 | |
504 | * the cursor point. In the default Cursor image the cursor point will | 539 | get_roi(crtc, &roi_w, &roi_h); |
505 | * be at the top left of the cursor image, unless it is specified | ||
506 | * otherwise using hotspot feature. | ||
507 | * | ||
508 | * If the cursor point reaches the right (xres - x < cursor.width) or | ||
509 | * bottom (yres - y < cursor.height) boundary of the screen, then ROI | ||
510 | * width and ROI height need to be evaluated to crop the cursor image | ||
511 | * accordingly. | ||
512 | * (xres-x) will be new cursor width when x > (xres - cursor.width) | ||
513 | * (yres-y) will be new cursor height when y > (yres - cursor.height) | ||
514 | */ | ||
515 | roi_w = min(mdp5_crtc->cursor.width, xres - x); | ||
516 | roi_h = min(mdp5_crtc->cursor.height, yres - y); | ||
517 | 540 | ||
518 | spin_lock_irqsave(&mdp5_crtc->cursor.lock, flags); | 541 | spin_lock_irqsave(&mdp5_crtc->cursor.lock, flags); |
519 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_SIZE(mdp5_crtc->lm), | 542 | mdp5_write(mdp5_kms, REG_MDP5_LM_CURSOR_SIZE(mdp5_crtc->lm), |
@@ -544,8 +567,8 @@ static const struct drm_crtc_funcs mdp5_crtc_funcs = { | |||
544 | static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = { | 567 | static const struct drm_crtc_helper_funcs mdp5_crtc_helper_funcs = { |
545 | .mode_fixup = mdp5_crtc_mode_fixup, | 568 | .mode_fixup = mdp5_crtc_mode_fixup, |
546 | .mode_set_nofb = mdp5_crtc_mode_set_nofb, | 569 | .mode_set_nofb = mdp5_crtc_mode_set_nofb, |
547 | .prepare = mdp5_crtc_disable, | 570 | .disable = mdp5_crtc_disable, |
548 | .commit = mdp5_crtc_enable, | 571 | .enable = mdp5_crtc_enable, |
549 | .atomic_check = mdp5_crtc_atomic_check, | 572 | .atomic_check = mdp5_crtc_atomic_check, |
550 | .atomic_begin = mdp5_crtc_atomic_begin, | 573 | .atomic_begin = mdp5_crtc_atomic_begin, |
551 | .atomic_flush = mdp5_crtc_atomic_flush, | 574 | .atomic_flush = mdp5_crtc_atomic_flush, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c index d6a14bb99988..af0e02fa4f48 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c | |||
@@ -267,14 +267,14 @@ static void mdp5_encoder_enable(struct drm_encoder *encoder) | |||
267 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 1); | 267 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 1); |
268 | spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); | 268 | spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); |
269 | 269 | ||
270 | mdp5_encoder->enabled = false; | 270 | mdp5_encoder->enabled = true; |
271 | } | 271 | } |
272 | 272 | ||
273 | static const struct drm_encoder_helper_funcs mdp5_encoder_helper_funcs = { | 273 | static const struct drm_encoder_helper_funcs mdp5_encoder_helper_funcs = { |
274 | .mode_fixup = mdp5_encoder_mode_fixup, | 274 | .mode_fixup = mdp5_encoder_mode_fixup, |
275 | .mode_set = mdp5_encoder_mode_set, | 275 | .mode_set = mdp5_encoder_mode_set, |
276 | .prepare = mdp5_encoder_disable, | 276 | .disable = mdp5_encoder_disable, |
277 | .commit = mdp5_encoder_enable, | 277 | .enable = mdp5_encoder_enable, |
278 | }; | 278 | }; |
279 | 279 | ||
280 | /* initialize encoder */ | 280 | /* initialize encoder */ |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c index 70ac81edd40f..a9407105b9b7 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c | |||
@@ -34,7 +34,10 @@ static void mdp5_irq_error_handler(struct mdp_irq *irq, uint32_t irqstatus) | |||
34 | void mdp5_irq_preinstall(struct msm_kms *kms) | 34 | void mdp5_irq_preinstall(struct msm_kms *kms) |
35 | { | 35 | { |
36 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); | 36 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); |
37 | mdp5_enable(mdp5_kms); | ||
37 | mdp5_write(mdp5_kms, REG_MDP5_INTR_CLEAR, 0xffffffff); | 38 | mdp5_write(mdp5_kms, REG_MDP5_INTR_CLEAR, 0xffffffff); |
39 | mdp5_write(mdp5_kms, REG_MDP5_INTR_EN, 0x00000000); | ||
40 | mdp5_disable(mdp5_kms); | ||
38 | } | 41 | } |
39 | 42 | ||
40 | int mdp5_irq_postinstall(struct msm_kms *kms) | 43 | int mdp5_irq_postinstall(struct msm_kms *kms) |
@@ -57,7 +60,9 @@ int mdp5_irq_postinstall(struct msm_kms *kms) | |||
57 | void mdp5_irq_uninstall(struct msm_kms *kms) | 60 | void mdp5_irq_uninstall(struct msm_kms *kms) |
58 | { | 61 | { |
59 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); | 62 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); |
63 | mdp5_enable(mdp5_kms); | ||
60 | mdp5_write(mdp5_kms, REG_MDP5_INTR_EN, 0x00000000); | 64 | mdp5_write(mdp5_kms, REG_MDP5_INTR_EN, 0x00000000); |
65 | mdp5_disable(mdp5_kms); | ||
61 | } | 66 | } |
62 | 67 | ||
63 | static void mdp5_irq_mdp(struct mdp_kms *mdp_kms) | 68 | static void mdp5_irq_mdp(struct mdp_kms *mdp_kms) |
diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 7c412292a0ff..5b192128cda2 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c | |||
@@ -219,8 +219,10 @@ int msm_atomic_commit(struct drm_device *dev, | |||
219 | * mark our set of crtc's as busy: | 219 | * mark our set of crtc's as busy: |
220 | */ | 220 | */ |
221 | ret = start_atomic(dev->dev_private, c->crtc_mask); | 221 | ret = start_atomic(dev->dev_private, c->crtc_mask); |
222 | if (ret) | 222 | if (ret) { |
223 | kfree(c); | ||
223 | return ret; | 224 | return ret; |
225 | } | ||
224 | 226 | ||
225 | /* | 227 | /* |
226 | * This is the point of no return - everything below never fails except | 228 | * This is the point of no return - everything below never fails except |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 79924e4b1b49..6751553abe4a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -418,7 +418,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, | |||
418 | nouveau_fbcon_zfill(dev, fbcon); | 418 | nouveau_fbcon_zfill(dev, fbcon); |
419 | 419 | ||
420 | /* To allow resizeing without swapping buffers */ | 420 | /* To allow resizeing without swapping buffers */ |
421 | NV_INFO(drm, "allocated %dx%d fb: 0x%lx, bo %p\n", | 421 | NV_INFO(drm, "allocated %dx%d fb: 0x%llx, bo %p\n", |
422 | nouveau_fb->base.width, nouveau_fb->base.height, | 422 | nouveau_fb->base.width, nouveau_fb->base.height, |
423 | nvbo->bo.offset, nvbo); | 423 | nvbo->bo.offset, nvbo); |
424 | 424 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index ed644a4f6f57..86807ee91bd1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1405,6 +1405,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1405 | (x << 16) | y); | 1405 | (x << 16) | y); |
1406 | viewport_w = crtc->mode.hdisplay; | 1406 | viewport_w = crtc->mode.hdisplay; |
1407 | viewport_h = (crtc->mode.vdisplay + 1) & ~1; | 1407 | viewport_h = (crtc->mode.vdisplay + 1) & ~1; |
1408 | if ((rdev->family >= CHIP_BONAIRE) && | ||
1409 | (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)) | ||
1410 | viewport_h *= 2; | ||
1408 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1411 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1409 | (viewport_w << 16) | viewport_h); | 1412 | (viewport_w << 16) | viewport_h); |
1410 | 1413 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 5bf825dfaa09..8d74de82456e 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -178,6 +178,13 @@ radeon_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) | |||
178 | switch (msg->request & ~DP_AUX_I2C_MOT) { | 178 | switch (msg->request & ~DP_AUX_I2C_MOT) { |
179 | case DP_AUX_NATIVE_WRITE: | 179 | case DP_AUX_NATIVE_WRITE: |
180 | case DP_AUX_I2C_WRITE: | 180 | case DP_AUX_I2C_WRITE: |
181 | /* The atom implementation only supports writes with a max payload of | ||
182 | * 12 bytes since it uses 4 bits for the total count (header + payload) | ||
183 | * in the parameter space. The atom interface supports 16 byte | ||
184 | * payloads for reads. The hw itself supports up to 16 bytes of payload. | ||
185 | */ | ||
186 | if (WARN_ON_ONCE(msg->size > 12)) | ||
187 | return -E2BIG; | ||
181 | /* tx_size needs to be 4 even for bare address packets since the atom | 188 | /* tx_size needs to be 4 even for bare address packets since the atom |
182 | * table needs the info in tx_buf[3]. | 189 | * table needs the info in tx_buf[3]. |
183 | */ | 190 | */ |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 7c9df1eac065..c39c1d0d9d4e 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -731,7 +731,9 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
731 | dig_connector = radeon_connector->con_priv; | 731 | dig_connector = radeon_connector->con_priv; |
732 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 732 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
733 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { | 733 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { |
734 | if (radeon_audio != 0 && ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) | 734 | if (radeon_audio != 0 && |
735 | drm_detect_monitor_audio(radeon_connector_edid(connector)) && | ||
736 | ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) | ||
735 | return ATOM_ENCODER_MODE_DP_AUDIO; | 737 | return ATOM_ENCODER_MODE_DP_AUDIO; |
736 | return ATOM_ENCODER_MODE_DP; | 738 | return ATOM_ENCODER_MODE_DP; |
737 | } else if (radeon_audio != 0) { | 739 | } else if (radeon_audio != 0) { |
@@ -747,7 +749,9 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
747 | } | 749 | } |
748 | break; | 750 | break; |
749 | case DRM_MODE_CONNECTOR_eDP: | 751 | case DRM_MODE_CONNECTOR_eDP: |
750 | if (radeon_audio != 0 && ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) | 752 | if (radeon_audio != 0 && |
753 | drm_detect_monitor_audio(radeon_connector_edid(connector)) && | ||
754 | ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) | ||
751 | return ATOM_ENCODER_MODE_DP_AUDIO; | 755 | return ATOM_ENCODER_MODE_DP_AUDIO; |
752 | return ATOM_ENCODER_MODE_DP; | 756 | return ATOM_ENCODER_MODE_DP; |
753 | case DRM_MODE_CONNECTOR_DVIA: | 757 | case DRM_MODE_CONNECTOR_DVIA: |
@@ -1622,7 +1626,6 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
1622 | struct radeon_connector *radeon_connector = NULL; | 1626 | struct radeon_connector *radeon_connector = NULL; |
1623 | struct radeon_connector_atom_dig *radeon_dig_connector = NULL; | 1627 | struct radeon_connector_atom_dig *radeon_dig_connector = NULL; |
1624 | bool travis_quirk = false; | 1628 | bool travis_quirk = false; |
1625 | int encoder_mode; | ||
1626 | 1629 | ||
1627 | if (connector) { | 1630 | if (connector) { |
1628 | radeon_connector = to_radeon_connector(connector); | 1631 | radeon_connector = to_radeon_connector(connector); |
@@ -1718,11 +1721,6 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) | |||
1718 | } | 1721 | } |
1719 | break; | 1722 | break; |
1720 | } | 1723 | } |
1721 | |||
1722 | encoder_mode = atombios_get_encoder_mode(encoder); | ||
1723 | if (radeon_audio != 0 && | ||
1724 | (encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode))) | ||
1725 | radeon_audio_dpms(encoder, mode); | ||
1726 | } | 1724 | } |
1727 | 1725 | ||
1728 | static void | 1726 | static void |
@@ -1731,10 +1729,19 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1731 | struct drm_device *dev = encoder->dev; | 1729 | struct drm_device *dev = encoder->dev; |
1732 | struct radeon_device *rdev = dev->dev_private; | 1730 | struct radeon_device *rdev = dev->dev_private; |
1733 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1731 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1732 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
1733 | int encoder_mode = atombios_get_encoder_mode(encoder); | ||
1734 | 1734 | ||
1735 | DRM_DEBUG_KMS("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", | 1735 | DRM_DEBUG_KMS("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", |
1736 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, | 1736 | radeon_encoder->encoder_id, mode, radeon_encoder->devices, |
1737 | radeon_encoder->active_device); | 1737 | radeon_encoder->active_device); |
1738 | |||
1739 | if (connector && (radeon_audio != 0) && | ||
1740 | ((encoder_mode == ATOM_ENCODER_MODE_HDMI) || | ||
1741 | (ENCODER_MODE_IS_DP(encoder_mode) && | ||
1742 | drm_detect_monitor_audio(radeon_connector_edid(connector))))) | ||
1743 | radeon_audio_dpms(encoder, mode); | ||
1744 | |||
1738 | switch (radeon_encoder->encoder_id) { | 1745 | switch (radeon_encoder->encoder_id) { |
1739 | case ENCODER_OBJECT_ID_INTERNAL_TMDS1: | 1746 | case ENCODER_OBJECT_ID_INTERNAL_TMDS1: |
1740 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: | 1747 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: |
@@ -2136,6 +2143,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
2136 | struct drm_device *dev = encoder->dev; | 2143 | struct drm_device *dev = encoder->dev; |
2137 | struct radeon_device *rdev = dev->dev_private; | 2144 | struct radeon_device *rdev = dev->dev_private; |
2138 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 2145 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
2146 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
2139 | int encoder_mode; | 2147 | int encoder_mode; |
2140 | 2148 | ||
2141 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 2149 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
@@ -2163,10 +2171,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
2163 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3: | 2171 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3: |
2164 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | 2172 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: |
2165 | /* handled in dpms */ | 2173 | /* handled in dpms */ |
2166 | encoder_mode = atombios_get_encoder_mode(encoder); | ||
2167 | if (radeon_audio != 0 && | ||
2168 | (encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode))) | ||
2169 | radeon_audio_mode_set(encoder, adjusted_mode); | ||
2170 | break; | 2174 | break; |
2171 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 2175 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
2172 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 2176 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
@@ -2188,6 +2192,13 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
2188 | } | 2192 | } |
2189 | 2193 | ||
2190 | atombios_apply_encoder_quirks(encoder, adjusted_mode); | 2194 | atombios_apply_encoder_quirks(encoder, adjusted_mode); |
2195 | |||
2196 | encoder_mode = atombios_get_encoder_mode(encoder); | ||
2197 | if (connector && (radeon_audio != 0) && | ||
2198 | ((encoder_mode == ATOM_ENCODER_MODE_HDMI) || | ||
2199 | (ENCODER_MODE_IS_DP(encoder_mode) && | ||
2200 | drm_detect_monitor_audio(radeon_connector_edid(connector))))) | ||
2201 | radeon_audio_mode_set(encoder, adjusted_mode); | ||
2191 | } | 2202 | } |
2192 | 2203 | ||
2193 | static bool | 2204 | static bool |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index e6a4ba236c70..3e670d344a20 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -3613,6 +3613,8 @@ static void cik_gpu_init(struct radeon_device *rdev) | |||
3613 | } | 3613 | } |
3614 | 3614 | ||
3615 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 3615 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
3616 | WREG32(SRBM_INT_CNTL, 0x1); | ||
3617 | WREG32(SRBM_INT_ACK, 0x1); | ||
3616 | 3618 | ||
3617 | WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN); | 3619 | WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN); |
3618 | 3620 | ||
@@ -7230,6 +7232,8 @@ static void cik_disable_interrupt_state(struct radeon_device *rdev) | |||
7230 | WREG32(CP_ME2_PIPE3_INT_CNTL, 0); | 7232 | WREG32(CP_ME2_PIPE3_INT_CNTL, 0); |
7231 | /* grbm */ | 7233 | /* grbm */ |
7232 | WREG32(GRBM_INT_CNTL, 0); | 7234 | WREG32(GRBM_INT_CNTL, 0); |
7235 | /* SRBM */ | ||
7236 | WREG32(SRBM_INT_CNTL, 0); | ||
7233 | /* vline/vblank, etc. */ | 7237 | /* vline/vblank, etc. */ |
7234 | WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 7238 | WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
7235 | WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 7239 | WREG32(LB_INTERRUPT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
@@ -7551,6 +7555,9 @@ int cik_irq_set(struct radeon_device *rdev) | |||
7551 | WREG32(DC_HPD5_INT_CONTROL, hpd5); | 7555 | WREG32(DC_HPD5_INT_CONTROL, hpd5); |
7552 | WREG32(DC_HPD6_INT_CONTROL, hpd6); | 7556 | WREG32(DC_HPD6_INT_CONTROL, hpd6); |
7553 | 7557 | ||
7558 | /* posting read */ | ||
7559 | RREG32(SRBM_STATUS); | ||
7560 | |||
7554 | return 0; | 7561 | return 0; |
7555 | } | 7562 | } |
7556 | 7563 | ||
@@ -8046,6 +8053,10 @@ restart_ih: | |||
8046 | break; | 8053 | break; |
8047 | } | 8054 | } |
8048 | break; | 8055 | break; |
8056 | case 96: | ||
8057 | DRM_ERROR("SRBM_READ_ERROR: 0x%x\n", RREG32(SRBM_READ_ERROR)); | ||
8058 | WREG32(SRBM_INT_ACK, 0x1); | ||
8059 | break; | ||
8049 | case 124: /* UVD */ | 8060 | case 124: /* UVD */ |
8050 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); | 8061 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); |
8051 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); | 8062 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); |
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index 03003f8a6de6..c648e1996dab 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
@@ -482,6 +482,10 @@ | |||
482 | #define SOFT_RESET_ORB (1 << 23) | 482 | #define SOFT_RESET_ORB (1 << 23) |
483 | #define SOFT_RESET_VCE (1 << 24) | 483 | #define SOFT_RESET_VCE (1 << 24) |
484 | 484 | ||
485 | #define SRBM_READ_ERROR 0xE98 | ||
486 | #define SRBM_INT_CNTL 0xEA0 | ||
487 | #define SRBM_INT_ACK 0xEA8 | ||
488 | |||
485 | #define VM_L2_CNTL 0x1400 | 489 | #define VM_L2_CNTL 0x1400 |
486 | #define ENABLE_L2_CACHE (1 << 0) | 490 | #define ENABLE_L2_CACHE (1 << 0) |
487 | #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1) | 491 | #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1) |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 192c80389151..3adc2afe32aa 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include "radeon_audio.h" | 26 | #include "radeon_audio.h" |
27 | #include "sid.h" | 27 | #include "sid.h" |
28 | 28 | ||
29 | #define DCE8_DCCG_AUDIO_DTO1_PHASE 0x05b8 | ||
30 | #define DCE8_DCCG_AUDIO_DTO1_MODULE 0x05bc | ||
31 | |||
29 | u32 dce6_endpoint_rreg(struct radeon_device *rdev, | 32 | u32 dce6_endpoint_rreg(struct radeon_device *rdev, |
30 | u32 block_offset, u32 reg) | 33 | u32 block_offset, u32 reg) |
31 | { | 34 | { |
@@ -252,72 +255,67 @@ void dce6_audio_enable(struct radeon_device *rdev, | |||
252 | void dce6_hdmi_audio_set_dto(struct radeon_device *rdev, | 255 | void dce6_hdmi_audio_set_dto(struct radeon_device *rdev, |
253 | struct radeon_crtc *crtc, unsigned int clock) | 256 | struct radeon_crtc *crtc, unsigned int clock) |
254 | { | 257 | { |
255 | /* Two dtos; generally use dto0 for HDMI */ | 258 | /* Two dtos; generally use dto0 for HDMI */ |
256 | u32 value = 0; | 259 | u32 value = 0; |
257 | 260 | ||
258 | if (crtc) | 261 | if (crtc) |
259 | value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id); | 262 | value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id); |
260 | 263 | ||
261 | WREG32(DCCG_AUDIO_DTO_SOURCE, value); | 264 | WREG32(DCCG_AUDIO_DTO_SOURCE, value); |
262 | 265 | ||
263 | /* Express [24MHz / target pixel clock] as an exact rational | 266 | /* Express [24MHz / target pixel clock] as an exact rational |
264 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 267 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
265 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 268 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
266 | */ | 269 | */ |
267 | WREG32(DCCG_AUDIO_DTO0_PHASE, 24000); | 270 | WREG32(DCCG_AUDIO_DTO0_PHASE, 24000); |
268 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock); | 271 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock); |
269 | } | 272 | } |
270 | 273 | ||
271 | void dce6_dp_audio_set_dto(struct radeon_device *rdev, | 274 | void dce6_dp_audio_set_dto(struct radeon_device *rdev, |
272 | struct radeon_crtc *crtc, unsigned int clock) | 275 | struct radeon_crtc *crtc, unsigned int clock) |
273 | { | 276 | { |
274 | /* Two dtos; generally use dto1 for DP */ | 277 | /* Two dtos; generally use dto1 for DP */ |
275 | u32 value = 0; | 278 | u32 value = 0; |
276 | value |= DCCG_AUDIO_DTO_SEL; | 279 | value |= DCCG_AUDIO_DTO_SEL; |
277 | 280 | ||
278 | if (crtc) | 281 | if (crtc) |
279 | value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id); | 282 | value |= DCCG_AUDIO_DTO0_SOURCE_SEL(crtc->crtc_id); |
280 | 283 | ||
281 | WREG32(DCCG_AUDIO_DTO_SOURCE, value); | 284 | WREG32(DCCG_AUDIO_DTO_SOURCE, value); |
282 | 285 | ||
283 | /* Express [24MHz / target pixel clock] as an exact rational | 286 | /* Express [24MHz / target pixel clock] as an exact rational |
284 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 287 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
285 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 288 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
286 | */ | 289 | */ |
287 | WREG32(DCCG_AUDIO_DTO1_PHASE, 24000); | 290 | if (ASIC_IS_DCE8(rdev)) { |
288 | WREG32(DCCG_AUDIO_DTO1_MODULE, clock); | 291 | WREG32(DCE8_DCCG_AUDIO_DTO1_PHASE, 24000); |
292 | WREG32(DCE8_DCCG_AUDIO_DTO1_MODULE, clock); | ||
293 | } else { | ||
294 | WREG32(DCCG_AUDIO_DTO1_PHASE, 24000); | ||
295 | WREG32(DCCG_AUDIO_DTO1_MODULE, clock); | ||
296 | } | ||
289 | } | 297 | } |
290 | 298 | ||
291 | void dce6_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) | 299 | void dce6_dp_enable(struct drm_encoder *encoder, bool enable) |
292 | { | 300 | { |
293 | struct drm_device *dev = encoder->dev; | 301 | struct drm_device *dev = encoder->dev; |
294 | struct radeon_device *rdev = dev->dev_private; | 302 | struct radeon_device *rdev = dev->dev_private; |
295 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 303 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
296 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 304 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
297 | uint32_t offset; | ||
298 | 305 | ||
299 | if (!dig || !dig->afmt) | 306 | if (!dig || !dig->afmt) |
300 | return; | 307 | return; |
301 | 308 | ||
302 | offset = dig->afmt->offset; | ||
303 | |||
304 | if (enable) { | 309 | if (enable) { |
305 | if (dig->afmt->enabled) | 310 | WREG32(EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset, |
306 | return; | 311 | EVERGREEN_DP_SEC_TIMESTAMP_MODE(1)); |
307 | 312 | WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, | |
308 | WREG32(EVERGREEN_DP_SEC_TIMESTAMP + offset, EVERGREEN_DP_SEC_TIMESTAMP_MODE(1)); | 313 | EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ |
309 | WREG32(EVERGREEN_DP_SEC_CNTL + offset, | 314 | EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ |
310 | EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ | 315 | EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ |
311 | EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ | 316 | EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ |
312 | EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ | ||
313 | EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ | ||
314 | radeon_audio_enable(rdev, dig->afmt->pin, true); | ||
315 | } else { | 317 | } else { |
316 | if (!dig->afmt->enabled) | 318 | WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, 0); |
317 | return; | ||
318 | |||
319 | WREG32(EVERGREEN_DP_SEC_CNTL + offset, 0); | ||
320 | radeon_audio_enable(rdev, dig->afmt->pin, false); | ||
321 | } | 319 | } |
322 | 320 | ||
323 | dig->afmt->enabled = enable; | 321 | dig->afmt->enabled = enable; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 78600f534c80..973df064c14f 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3253,6 +3253,8 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
3253 | } | 3253 | } |
3254 | 3254 | ||
3255 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 3255 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
3256 | WREG32(SRBM_INT_CNTL, 0x1); | ||
3257 | WREG32(SRBM_INT_ACK, 0x1); | ||
3256 | 3258 | ||
3257 | evergreen_fix_pci_max_read_req_size(rdev); | 3259 | evergreen_fix_pci_max_read_req_size(rdev); |
3258 | 3260 | ||
@@ -4324,6 +4326,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev) | |||
4324 | tmp = RREG32(DMA_CNTL) & ~TRAP_ENABLE; | 4326 | tmp = RREG32(DMA_CNTL) & ~TRAP_ENABLE; |
4325 | WREG32(DMA_CNTL, tmp); | 4327 | WREG32(DMA_CNTL, tmp); |
4326 | WREG32(GRBM_INT_CNTL, 0); | 4328 | WREG32(GRBM_INT_CNTL, 0); |
4329 | WREG32(SRBM_INT_CNTL, 0); | ||
4327 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 4330 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
4328 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 4331 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
4329 | if (rdev->num_crtc >= 4) { | 4332 | if (rdev->num_crtc >= 4) { |
@@ -4590,6 +4593,9 @@ int evergreen_irq_set(struct radeon_device *rdev) | |||
4590 | WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, afmt5); | 4593 | WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, afmt5); |
4591 | WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, afmt6); | 4594 | WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, afmt6); |
4592 | 4595 | ||
4596 | /* posting read */ | ||
4597 | RREG32(SRBM_STATUS); | ||
4598 | |||
4593 | return 0; | 4599 | return 0; |
4594 | } | 4600 | } |
4595 | 4601 | ||
@@ -5066,6 +5072,10 @@ restart_ih: | |||
5066 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); | 5072 | DRM_ERROR("Unhandled interrupt: %d %d\n", src_id, src_data); |
5067 | break; | 5073 | break; |
5068 | } | 5074 | } |
5075 | case 96: | ||
5076 | DRM_ERROR("SRBM_READ_ERROR: 0x%x\n", RREG32(SRBM_READ_ERROR)); | ||
5077 | WREG32(SRBM_INT_ACK, 0x1); | ||
5078 | break; | ||
5069 | case 124: /* UVD */ | 5079 | case 124: /* UVD */ |
5070 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); | 5080 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); |
5071 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); | 5081 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 1d9aebc79595..c18d4ecbd95d 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -272,7 +272,7 @@ void dce4_hdmi_audio_set_dto(struct radeon_device *rdev, | |||
272 | } | 272 | } |
273 | 273 | ||
274 | void dce4_dp_audio_set_dto(struct radeon_device *rdev, | 274 | void dce4_dp_audio_set_dto(struct radeon_device *rdev, |
275 | struct radeon_crtc *crtc, unsigned int clock) | 275 | struct radeon_crtc *crtc, unsigned int clock) |
276 | { | 276 | { |
277 | u32 value; | 277 | u32 value; |
278 | 278 | ||
@@ -294,7 +294,7 @@ void dce4_dp_audio_set_dto(struct radeon_device *rdev, | |||
294 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 294 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
295 | */ | 295 | */ |
296 | WREG32(DCCG_AUDIO_DTO1_PHASE, 24000); | 296 | WREG32(DCCG_AUDIO_DTO1_PHASE, 24000); |
297 | WREG32(DCCG_AUDIO_DTO1_MODULE, rdev->clock.max_pixel_clock * 10); | 297 | WREG32(DCCG_AUDIO_DTO1_MODULE, clock); |
298 | } | 298 | } |
299 | 299 | ||
300 | void dce4_set_vbi_packet(struct drm_encoder *encoder, u32 offset) | 300 | void dce4_set_vbi_packet(struct drm_encoder *encoder, u32 offset) |
@@ -350,20 +350,9 @@ void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset) | |||
350 | struct drm_device *dev = encoder->dev; | 350 | struct drm_device *dev = encoder->dev; |
351 | struct radeon_device *rdev = dev->dev_private; | 351 | struct radeon_device *rdev = dev->dev_private; |
352 | 352 | ||
353 | WREG32(HDMI_INFOFRAME_CONTROL0 + offset, | ||
354 | HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */ | ||
355 | HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */ | ||
356 | |||
357 | WREG32(AFMT_INFOFRAME_CONTROL0 + offset, | 353 | WREG32(AFMT_INFOFRAME_CONTROL0 + offset, |
358 | AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */ | 354 | AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */ |
359 | 355 | ||
360 | WREG32(HDMI_INFOFRAME_CONTROL1 + offset, | ||
361 | HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */ | ||
362 | |||
363 | WREG32(HDMI_AUDIO_PACKET_CONTROL + offset, | ||
364 | HDMI_AUDIO_DELAY_EN(1) | /* set the default audio delay */ | ||
365 | HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */ | ||
366 | |||
367 | WREG32(AFMT_60958_0 + offset, | 356 | WREG32(AFMT_60958_0 + offset, |
368 | AFMT_60958_CS_CHANNEL_NUMBER_L(1)); | 357 | AFMT_60958_CS_CHANNEL_NUMBER_L(1)); |
369 | 358 | ||
@@ -408,15 +397,19 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
408 | if (!dig || !dig->afmt) | 397 | if (!dig || !dig->afmt) |
409 | return; | 398 | return; |
410 | 399 | ||
411 | /* Silent, r600_hdmi_enable will raise WARN for us */ | 400 | if (enable) { |
412 | if (enable && dig->afmt->enabled) | 401 | WREG32(HDMI_INFOFRAME_CONTROL1 + dig->afmt->offset, |
413 | return; | 402 | HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */ |
414 | if (!enable && !dig->afmt->enabled) | 403 | |
415 | return; | 404 | WREG32(HDMI_AUDIO_PACKET_CONTROL + dig->afmt->offset, |
405 | HDMI_AUDIO_DELAY_EN(1) | /* set the default audio delay */ | ||
406 | HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */ | ||
416 | 407 | ||
417 | if (!enable && dig->afmt->pin) { | 408 | WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, |
418 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | 409 | HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */ |
419 | dig->afmt->pin = NULL; | 410 | HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */ |
411 | } else { | ||
412 | WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, 0); | ||
420 | } | 413 | } |
421 | 414 | ||
422 | dig->afmt->enabled = enable; | 415 | dig->afmt->enabled = enable; |
@@ -425,33 +418,28 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
425 | enable ? "En" : "Dis", dig->afmt->offset, radeon_encoder->encoder_id); | 418 | enable ? "En" : "Dis", dig->afmt->offset, radeon_encoder->encoder_id); |
426 | } | 419 | } |
427 | 420 | ||
428 | void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) | 421 | void evergreen_dp_enable(struct drm_encoder *encoder, bool enable) |
429 | { | 422 | { |
430 | struct drm_device *dev = encoder->dev; | 423 | struct drm_device *dev = encoder->dev; |
431 | struct radeon_device *rdev = dev->dev_private; | 424 | struct radeon_device *rdev = dev->dev_private; |
432 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 425 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
433 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 426 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
434 | uint32_t offset; | ||
435 | 427 | ||
436 | if (!dig || !dig->afmt) | 428 | if (!dig || !dig->afmt) |
437 | return; | 429 | return; |
438 | 430 | ||
439 | offset = dig->afmt->offset; | ||
440 | |||
441 | if (enable) { | 431 | if (enable) { |
442 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 432 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
443 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 433 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
444 | struct radeon_connector_atom_dig *dig_connector; | 434 | struct radeon_connector_atom_dig *dig_connector; |
445 | uint32_t val; | 435 | uint32_t val; |
446 | 436 | ||
447 | if (dig->afmt->enabled) | 437 | WREG32(EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset, |
448 | return; | 438 | EVERGREEN_DP_SEC_TIMESTAMP_MODE(1)); |
449 | |||
450 | WREG32(EVERGREEN_DP_SEC_TIMESTAMP + offset, EVERGREEN_DP_SEC_TIMESTAMP_MODE(1)); | ||
451 | 439 | ||
452 | if (radeon_connector->con_priv) { | 440 | if (radeon_connector->con_priv) { |
453 | dig_connector = radeon_connector->con_priv; | 441 | dig_connector = radeon_connector->con_priv; |
454 | val = RREG32(EVERGREEN_DP_SEC_AUD_N + offset); | 442 | val = RREG32(EVERGREEN_DP_SEC_AUD_N + dig->afmt->offset); |
455 | val &= ~EVERGREEN_DP_SEC_N_BASE_MULTIPLE(0xf); | 443 | val &= ~EVERGREEN_DP_SEC_N_BASE_MULTIPLE(0xf); |
456 | 444 | ||
457 | if (dig_connector->dp_clock == 162000) | 445 | if (dig_connector->dp_clock == 162000) |
@@ -459,21 +447,16 @@ void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) | |||
459 | else | 447 | else |
460 | val |= EVERGREEN_DP_SEC_N_BASE_MULTIPLE(5); | 448 | val |= EVERGREEN_DP_SEC_N_BASE_MULTIPLE(5); |
461 | 449 | ||
462 | WREG32(EVERGREEN_DP_SEC_AUD_N + offset, val); | 450 | WREG32(EVERGREEN_DP_SEC_AUD_N + dig->afmt->offset, val); |
463 | } | 451 | } |
464 | 452 | ||
465 | WREG32(EVERGREEN_DP_SEC_CNTL + offset, | 453 | WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, |
466 | EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ | 454 | EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ |
467 | EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ | 455 | EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ |
468 | EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ | 456 | EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ |
469 | EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ | 457 | EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ |
470 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); | ||
471 | } else { | 458 | } else { |
472 | if (!dig->afmt->enabled) | 459 | WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, 0); |
473 | return; | ||
474 | |||
475 | WREG32(EVERGREEN_DP_SEC_CNTL + offset, 0); | ||
476 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | ||
477 | } | 460 | } |
478 | 461 | ||
479 | dig->afmt->enabled = enable; | 462 | dig->afmt->enabled = enable; |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index ee83d2a88750..a8d1d5240fcb 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -1191,6 +1191,10 @@ | |||
1191 | #define SOFT_RESET_REGBB (1 << 22) | 1191 | #define SOFT_RESET_REGBB (1 << 22) |
1192 | #define SOFT_RESET_ORB (1 << 23) | 1192 | #define SOFT_RESET_ORB (1 << 23) |
1193 | 1193 | ||
1194 | #define SRBM_READ_ERROR 0xE98 | ||
1195 | #define SRBM_INT_CNTL 0xEA0 | ||
1196 | #define SRBM_INT_ACK 0xEA8 | ||
1197 | |||
1194 | /* display watermarks */ | 1198 | /* display watermarks */ |
1195 | #define DC_LB_MEMORY_SPLIT 0x6b0c | 1199 | #define DC_LB_MEMORY_SPLIT 0x6b0c |
1196 | #define PRIORITY_A_CNT 0x6b18 | 1200 | #define PRIORITY_A_CNT 0x6b18 |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 24242a7f0ac3..dab00812abaa 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -962,6 +962,8 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
962 | } | 962 | } |
963 | 963 | ||
964 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 964 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
965 | WREG32(SRBM_INT_CNTL, 0x1); | ||
966 | WREG32(SRBM_INT_ACK, 0x1); | ||
965 | 967 | ||
966 | evergreen_fix_pci_max_read_req_size(rdev); | 968 | evergreen_fix_pci_max_read_req_size(rdev); |
967 | 969 | ||
@@ -1086,12 +1088,12 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
1086 | 1088 | ||
1087 | if ((rdev->config.cayman.max_backends_per_se == 1) && | 1089 | if ((rdev->config.cayman.max_backends_per_se == 1) && |
1088 | (rdev->flags & RADEON_IS_IGP)) { | 1090 | (rdev->flags & RADEON_IS_IGP)) { |
1089 | if ((disabled_rb_mask & 3) == 1) { | 1091 | if ((disabled_rb_mask & 3) == 2) { |
1090 | /* RB0 disabled, RB1 enabled */ | ||
1091 | tmp = 0x11111111; | ||
1092 | } else { | ||
1093 | /* RB1 disabled, RB0 enabled */ | 1092 | /* RB1 disabled, RB0 enabled */ |
1094 | tmp = 0x00000000; | 1093 | tmp = 0x00000000; |
1094 | } else { | ||
1095 | /* RB0 disabled, RB1 enabled */ | ||
1096 | tmp = 0x11111111; | ||
1095 | } | 1097 | } |
1096 | } else { | 1098 | } else { |
1097 | tmp = gb_addr_config & NUM_PIPES_MASK; | 1099 | tmp = gb_addr_config & NUM_PIPES_MASK; |
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h index ad7125486894..6b44580440d0 100644 --- a/drivers/gpu/drm/radeon/nid.h +++ b/drivers/gpu/drm/radeon/nid.h | |||
@@ -82,6 +82,10 @@ | |||
82 | #define SOFT_RESET_REGBB (1 << 22) | 82 | #define SOFT_RESET_REGBB (1 << 22) |
83 | #define SOFT_RESET_ORB (1 << 23) | 83 | #define SOFT_RESET_ORB (1 << 23) |
84 | 84 | ||
85 | #define SRBM_READ_ERROR 0xE98 | ||
86 | #define SRBM_INT_CNTL 0xEA0 | ||
87 | #define SRBM_INT_ACK 0xEA8 | ||
88 | |||
85 | #define SRBM_STATUS2 0x0EC4 | 89 | #define SRBM_STATUS2 0x0EC4 |
86 | #define DMA_BUSY (1 << 5) | 90 | #define DMA_BUSY (1 << 5) |
87 | #define DMA1_BUSY (1 << 6) | 91 | #define DMA1_BUSY (1 << 6) |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 279801ca5110..04f2514f7564 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -728,6 +728,10 @@ int r100_irq_set(struct radeon_device *rdev) | |||
728 | tmp |= RADEON_FP2_DETECT_MASK; | 728 | tmp |= RADEON_FP2_DETECT_MASK; |
729 | } | 729 | } |
730 | WREG32(RADEON_GEN_INT_CNTL, tmp); | 730 | WREG32(RADEON_GEN_INT_CNTL, tmp); |
731 | |||
732 | /* read back to post the write */ | ||
733 | RREG32(RADEON_GEN_INT_CNTL); | ||
734 | |||
731 | return 0; | 735 | return 0; |
732 | } | 736 | } |
733 | 737 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 07a71a2488c9..2fcad344492f 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -3784,6 +3784,9 @@ int r600_irq_set(struct radeon_device *rdev) | |||
3784 | WREG32(RV770_CG_THERMAL_INT, thermal_int); | 3784 | WREG32(RV770_CG_THERMAL_INT, thermal_int); |
3785 | } | 3785 | } |
3786 | 3786 | ||
3787 | /* posting read */ | ||
3788 | RREG32(R_000E50_SRBM_STATUS); | ||
3789 | |||
3787 | return 0; | 3790 | return 0; |
3788 | } | 3791 | } |
3789 | 3792 | ||
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index 843b65f46ece..fa2154493cf1 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -188,7 +188,7 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev) | |||
188 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 188 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
189 | radeon_crtc = to_radeon_crtc(crtc); | 189 | radeon_crtc = to_radeon_crtc(crtc); |
190 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { | 190 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
191 | vrefresh = radeon_crtc->hw_mode.vrefresh; | 191 | vrefresh = drm_mode_vrefresh(&radeon_crtc->hw_mode); |
192 | break; | 192 | break; |
193 | } | 193 | } |
194 | } | 194 | } |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 62c91ed669ce..dd6606b8e23c 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -476,17 +476,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
476 | if (!dig || !dig->afmt) | 476 | if (!dig || !dig->afmt) |
477 | return; | 477 | return; |
478 | 478 | ||
479 | /* Silent, r600_hdmi_enable will raise WARN for us */ | ||
480 | if (enable && dig->afmt->enabled) | ||
481 | return; | ||
482 | if (!enable && !dig->afmt->enabled) | ||
483 | return; | ||
484 | |||
485 | if (!enable && dig->afmt->pin) { | ||
486 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | ||
487 | dig->afmt->pin = NULL; | ||
488 | } | ||
489 | |||
490 | /* Older chipsets require setting HDMI and routing manually */ | 479 | /* Older chipsets require setting HDMI and routing manually */ |
491 | if (!ASIC_IS_DCE3(rdev)) { | 480 | if (!ASIC_IS_DCE3(rdev)) { |
492 | if (enable) | 481 | if (enable) |
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index a3ceef6d9632..b21ef69a34ac 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c | |||
@@ -101,8 +101,8 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder, | |||
101 | struct drm_display_mode *mode); | 101 | struct drm_display_mode *mode); |
102 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable); | 102 | void r600_hdmi_enable(struct drm_encoder *encoder, bool enable); |
103 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable); | 103 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable); |
104 | void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable); | 104 | void evergreen_dp_enable(struct drm_encoder *encoder, bool enable); |
105 | void dce6_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable); | 105 | void dce6_dp_enable(struct drm_encoder *encoder, bool enable); |
106 | 106 | ||
107 | static const u32 pin_offsets[7] = | 107 | static const u32 pin_offsets[7] = |
108 | { | 108 | { |
@@ -210,7 +210,7 @@ static struct radeon_audio_funcs dce4_dp_funcs = { | |||
210 | .set_avi_packet = evergreen_set_avi_packet, | 210 | .set_avi_packet = evergreen_set_avi_packet, |
211 | .set_audio_packet = dce4_set_audio_packet, | 211 | .set_audio_packet = dce4_set_audio_packet, |
212 | .mode_set = radeon_audio_dp_mode_set, | 212 | .mode_set = radeon_audio_dp_mode_set, |
213 | .dpms = evergreen_enable_dp_audio_packets, | 213 | .dpms = evergreen_dp_enable, |
214 | }; | 214 | }; |
215 | 215 | ||
216 | static struct radeon_audio_funcs dce6_hdmi_funcs = { | 216 | static struct radeon_audio_funcs dce6_hdmi_funcs = { |
@@ -240,7 +240,7 @@ static struct radeon_audio_funcs dce6_dp_funcs = { | |||
240 | .set_avi_packet = evergreen_set_avi_packet, | 240 | .set_avi_packet = evergreen_set_avi_packet, |
241 | .set_audio_packet = dce4_set_audio_packet, | 241 | .set_audio_packet = dce4_set_audio_packet, |
242 | .mode_set = radeon_audio_dp_mode_set, | 242 | .mode_set = radeon_audio_dp_mode_set, |
243 | .dpms = dce6_enable_dp_audio_packets, | 243 | .dpms = dce6_dp_enable, |
244 | }; | 244 | }; |
245 | 245 | ||
246 | static void radeon_audio_interface_init(struct radeon_device *rdev) | 246 | static void radeon_audio_interface_init(struct radeon_device *rdev) |
@@ -452,7 +452,7 @@ void radeon_audio_enable(struct radeon_device *rdev, | |||
452 | } | 452 | } |
453 | 453 | ||
454 | void radeon_audio_detect(struct drm_connector *connector, | 454 | void radeon_audio_detect(struct drm_connector *connector, |
455 | enum drm_connector_status status) | 455 | enum drm_connector_status status) |
456 | { | 456 | { |
457 | struct radeon_device *rdev; | 457 | struct radeon_device *rdev; |
458 | struct radeon_encoder *radeon_encoder; | 458 | struct radeon_encoder *radeon_encoder; |
@@ -483,14 +483,11 @@ void radeon_audio_detect(struct drm_connector *connector, | |||
483 | else | 483 | else |
484 | radeon_encoder->audio = rdev->audio.hdmi_funcs; | 484 | radeon_encoder->audio = rdev->audio.hdmi_funcs; |
485 | 485 | ||
486 | radeon_audio_write_speaker_allocation(connector->encoder); | 486 | dig->afmt->pin = radeon_audio_get_pin(connector->encoder); |
487 | radeon_audio_write_sad_regs(connector->encoder); | ||
488 | if (connector->encoder->crtc) | ||
489 | radeon_audio_write_latency_fields(connector->encoder, | ||
490 | &connector->encoder->crtc->mode); | ||
491 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); | 487 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); |
492 | } else { | 488 | } else { |
493 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | 489 | radeon_audio_enable(rdev, dig->afmt->pin, 0); |
490 | dig->afmt->pin = NULL; | ||
494 | } | 491 | } |
495 | } | 492 | } |
496 | 493 | ||
@@ -694,23 +691,22 @@ static void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute) | |||
694 | * update the info frames with the data from the current display mode | 691 | * update the info frames with the data from the current display mode |
695 | */ | 692 | */ |
696 | static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder, | 693 | static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder, |
697 | struct drm_display_mode *mode) | 694 | struct drm_display_mode *mode) |
698 | { | 695 | { |
699 | struct radeon_device *rdev = encoder->dev->dev_private; | ||
700 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 696 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
701 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 697 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
702 | 698 | ||
703 | if (!dig || !dig->afmt) | 699 | if (!dig || !dig->afmt) |
704 | return; | 700 | return; |
705 | 701 | ||
706 | /* disable audio prior to setting up hw */ | 702 | radeon_audio_set_mute(encoder, true); |
707 | dig->afmt->pin = radeon_audio_get_pin(encoder); | ||
708 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | ||
709 | 703 | ||
704 | radeon_audio_write_speaker_allocation(encoder); | ||
705 | radeon_audio_write_sad_regs(encoder); | ||
706 | radeon_audio_write_latency_fields(encoder, mode); | ||
710 | radeon_audio_set_dto(encoder, mode->clock); | 707 | radeon_audio_set_dto(encoder, mode->clock); |
711 | radeon_audio_set_vbi_packet(encoder); | 708 | radeon_audio_set_vbi_packet(encoder); |
712 | radeon_hdmi_set_color_depth(encoder); | 709 | radeon_hdmi_set_color_depth(encoder); |
713 | radeon_audio_set_mute(encoder, false); | ||
714 | radeon_audio_update_acr(encoder, mode->clock); | 710 | radeon_audio_update_acr(encoder, mode->clock); |
715 | radeon_audio_set_audio_packet(encoder); | 711 | radeon_audio_set_audio_packet(encoder); |
716 | radeon_audio_select_pin(encoder); | 712 | radeon_audio_select_pin(encoder); |
@@ -718,8 +714,7 @@ static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder, | |||
718 | if (radeon_audio_set_avi_packet(encoder, mode) < 0) | 714 | if (radeon_audio_set_avi_packet(encoder, mode) < 0) |
719 | return; | 715 | return; |
720 | 716 | ||
721 | /* enable audio after to setting up hw */ | 717 | radeon_audio_set_mute(encoder, false); |
722 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); | ||
723 | } | 718 | } |
724 | 719 | ||
725 | static void radeon_audio_dp_mode_set(struct drm_encoder *encoder, | 720 | static void radeon_audio_dp_mode_set(struct drm_encoder *encoder, |
@@ -729,23 +724,26 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder, | |||
729 | struct radeon_device *rdev = dev->dev_private; | 724 | struct radeon_device *rdev = dev->dev_private; |
730 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 725 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
731 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 726 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
727 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
728 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
729 | struct radeon_connector_atom_dig *dig_connector = | ||
730 | radeon_connector->con_priv; | ||
732 | 731 | ||
733 | if (!dig || !dig->afmt) | 732 | if (!dig || !dig->afmt) |
734 | return; | 733 | return; |
735 | 734 | ||
736 | /* disable audio prior to setting up hw */ | 735 | radeon_audio_write_speaker_allocation(encoder); |
737 | dig->afmt->pin = radeon_audio_get_pin(encoder); | 736 | radeon_audio_write_sad_regs(encoder); |
738 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | 737 | radeon_audio_write_latency_fields(encoder, mode); |
739 | 738 | if (rdev->clock.dp_extclk || ASIC_IS_DCE5(rdev)) | |
740 | radeon_audio_set_dto(encoder, rdev->clock.default_dispclk * 10); | 739 | radeon_audio_set_dto(encoder, rdev->clock.default_dispclk * 10); |
740 | else | ||
741 | radeon_audio_set_dto(encoder, dig_connector->dp_clock); | ||
741 | radeon_audio_set_audio_packet(encoder); | 742 | radeon_audio_set_audio_packet(encoder); |
742 | radeon_audio_select_pin(encoder); | 743 | radeon_audio_select_pin(encoder); |
743 | 744 | ||
744 | if (radeon_audio_set_avi_packet(encoder, mode) < 0) | 745 | if (radeon_audio_set_avi_packet(encoder, mode) < 0) |
745 | return; | 746 | return; |
746 | |||
747 | /* enable audio after to setting up hw */ | ||
748 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); | ||
749 | } | 747 | } |
750 | 748 | ||
751 | void radeon_audio_mode_set(struct drm_encoder *encoder, | 749 | void radeon_audio_mode_set(struct drm_encoder *encoder, |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index c830863bc98a..4d0f96cc3da4 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -256,11 +256,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
256 | u32 ring = RADEON_CS_RING_GFX; | 256 | u32 ring = RADEON_CS_RING_GFX; |
257 | s32 priority = 0; | 257 | s32 priority = 0; |
258 | 258 | ||
259 | INIT_LIST_HEAD(&p->validated); | ||
260 | |||
259 | if (!cs->num_chunks) { | 261 | if (!cs->num_chunks) { |
260 | return 0; | 262 | return 0; |
261 | } | 263 | } |
264 | |||
262 | /* get chunks */ | 265 | /* get chunks */ |
263 | INIT_LIST_HEAD(&p->validated); | ||
264 | p->idx = 0; | 266 | p->idx = 0; |
265 | p->ib.sa_bo = NULL; | 267 | p->ib.sa_bo = NULL; |
266 | p->const_ib.sa_bo = NULL; | 268 | p->const_ib.sa_bo = NULL; |
@@ -715,6 +717,7 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, | |||
715 | struct radeon_cs_chunk *ib_chunk = p->chunk_ib; | 717 | struct radeon_cs_chunk *ib_chunk = p->chunk_ib; |
716 | struct radeon_device *rdev = p->rdev; | 718 | struct radeon_device *rdev = p->rdev; |
717 | uint32_t header; | 719 | uint32_t header; |
720 | int ret = 0, i; | ||
718 | 721 | ||
719 | if (idx >= ib_chunk->length_dw) { | 722 | if (idx >= ib_chunk->length_dw) { |
720 | DRM_ERROR("Can not parse packet at %d after CS end %d !\n", | 723 | DRM_ERROR("Can not parse packet at %d after CS end %d !\n", |
@@ -743,14 +746,25 @@ int radeon_cs_packet_parse(struct radeon_cs_parser *p, | |||
743 | break; | 746 | break; |
744 | default: | 747 | default: |
745 | DRM_ERROR("Unknown packet type %d at %d !\n", pkt->type, idx); | 748 | DRM_ERROR("Unknown packet type %d at %d !\n", pkt->type, idx); |
746 | return -EINVAL; | 749 | ret = -EINVAL; |
750 | goto dump_ib; | ||
747 | } | 751 | } |
748 | if ((pkt->count + 1 + pkt->idx) >= ib_chunk->length_dw) { | 752 | if ((pkt->count + 1 + pkt->idx) >= ib_chunk->length_dw) { |
749 | DRM_ERROR("Packet (%d:%d:%d) end after CS buffer (%d) !\n", | 753 | DRM_ERROR("Packet (%d:%d:%d) end after CS buffer (%d) !\n", |
750 | pkt->idx, pkt->type, pkt->count, ib_chunk->length_dw); | 754 | pkt->idx, pkt->type, pkt->count, ib_chunk->length_dw); |
751 | return -EINVAL; | 755 | ret = -EINVAL; |
756 | goto dump_ib; | ||
752 | } | 757 | } |
753 | return 0; | 758 | return 0; |
759 | |||
760 | dump_ib: | ||
761 | for (i = 0; i < ib_chunk->length_dw; i++) { | ||
762 | if (i == idx) | ||
763 | printk("\t0x%08x <---\n", radeon_get_ib_value(p, i)); | ||
764 | else | ||
765 | printk("\t0x%08x\n", radeon_get_ib_value(p, i)); | ||
766 | } | ||
767 | return ret; | ||
754 | } | 768 | } |
755 | 769 | ||
756 | /** | 770 | /** |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 6b670b0bc47b..3a297037cc17 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -179,9 +179,12 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | |||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | 179 | (rdev->pdev->subsystem_vendor == 0x1734) && |
180 | (rdev->pdev->subsystem_device == 0x1107)) | 180 | (rdev->pdev->subsystem_device == 0x1107)) |
181 | use_bl = false; | 181 | use_bl = false; |
182 | /* Older PPC macs use on-GPU backlight controller */ | ||
183 | #ifndef CONFIG_PPC_PMAC | ||
182 | /* disable native backlight control on older asics */ | 184 | /* disable native backlight control on older asics */ |
183 | else if (rdev->family < CHIP_R600) | 185 | else if (rdev->family < CHIP_R600) |
184 | use_bl = false; | 186 | use_bl = false; |
187 | #endif | ||
185 | else | 188 | else |
186 | use_bl = true; | 189 | use_bl = true; |
187 | } | 190 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 9f758d39420d..33cf4108386d 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -852,6 +852,12 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | |||
852 | single_display = false; | 852 | single_display = false; |
853 | } | 853 | } |
854 | 854 | ||
855 | /* 120hz tends to be problematic even if they are under the | ||
856 | * vblank limit. | ||
857 | */ | ||
858 | if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) | ||
859 | single_display = false; | ||
860 | |||
855 | /* certain older asics have a separare 3D performance state, | 861 | /* certain older asics have a separare 3D performance state, |
856 | * so try that first if the user selected performance | 862 | * so try that first if the user selected performance |
857 | */ | 863 | */ |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index d81182ad53ec..97a904835759 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -694,6 +694,10 @@ int rs600_irq_set(struct radeon_device *rdev) | |||
694 | WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2); | 694 | WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2); |
695 | if (ASIC_IS_DCE2(rdev)) | 695 | if (ASIC_IS_DCE2(rdev)) |
696 | WREG32(R_007408_HDMI0_AUDIO_PACKET_CONTROL, hdmi0); | 696 | WREG32(R_007408_HDMI0_AUDIO_PACKET_CONTROL, hdmi0); |
697 | |||
698 | /* posting read */ | ||
699 | RREG32(R_000040_GEN_INT_CNTL); | ||
700 | |||
697 | return 0; | 701 | return 0; |
698 | } | 702 | } |
699 | 703 | ||
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 73107fe9e46f..e088e5558da0 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -3162,6 +3162,8 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
3162 | } | 3162 | } |
3163 | 3163 | ||
3164 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); | 3164 | WREG32(GRBM_CNTL, GRBM_READ_TIMEOUT(0xff)); |
3165 | WREG32(SRBM_INT_CNTL, 1); | ||
3166 | WREG32(SRBM_INT_ACK, 1); | ||
3165 | 3167 | ||
3166 | evergreen_fix_pci_max_read_req_size(rdev); | 3168 | evergreen_fix_pci_max_read_req_size(rdev); |
3167 | 3169 | ||
@@ -4699,12 +4701,6 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) | |||
4699 | switch (pkt.type) { | 4701 | switch (pkt.type) { |
4700 | case RADEON_PACKET_TYPE0: | 4702 | case RADEON_PACKET_TYPE0: |
4701 | dev_err(rdev->dev, "Packet0 not allowed!\n"); | 4703 | dev_err(rdev->dev, "Packet0 not allowed!\n"); |
4702 | for (i = 0; i < ib->length_dw; i++) { | ||
4703 | if (i == idx) | ||
4704 | printk("\t0x%08x <---\n", ib->ptr[i]); | ||
4705 | else | ||
4706 | printk("\t0x%08x\n", ib->ptr[i]); | ||
4707 | } | ||
4708 | ret = -EINVAL; | 4704 | ret = -EINVAL; |
4709 | break; | 4705 | break; |
4710 | case RADEON_PACKET_TYPE2: | 4706 | case RADEON_PACKET_TYPE2: |
@@ -4736,8 +4732,15 @@ int si_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib) | |||
4736 | ret = -EINVAL; | 4732 | ret = -EINVAL; |
4737 | break; | 4733 | break; |
4738 | } | 4734 | } |
4739 | if (ret) | 4735 | if (ret) { |
4736 | for (i = 0; i < ib->length_dw; i++) { | ||
4737 | if (i == idx) | ||
4738 | printk("\t0x%08x <---\n", ib->ptr[i]); | ||
4739 | else | ||
4740 | printk("\t0x%08x\n", ib->ptr[i]); | ||
4741 | } | ||
4740 | break; | 4742 | break; |
4743 | } | ||
4741 | } while (idx < ib->length_dw); | 4744 | } while (idx < ib->length_dw); |
4742 | 4745 | ||
4743 | return ret; | 4746 | return ret; |
@@ -5910,6 +5913,7 @@ static void si_disable_interrupt_state(struct radeon_device *rdev) | |||
5910 | tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; | 5913 | tmp = RREG32(DMA_CNTL + DMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; |
5911 | WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp); | 5914 | WREG32(DMA_CNTL + DMA1_REGISTER_OFFSET, tmp); |
5912 | WREG32(GRBM_INT_CNTL, 0); | 5915 | WREG32(GRBM_INT_CNTL, 0); |
5916 | WREG32(SRBM_INT_CNTL, 0); | ||
5913 | if (rdev->num_crtc >= 2) { | 5917 | if (rdev->num_crtc >= 2) { |
5914 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 5918 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
5915 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 5919 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
@@ -6199,6 +6203,9 @@ int si_irq_set(struct radeon_device *rdev) | |||
6199 | 6203 | ||
6200 | WREG32(CG_THERMAL_INT, thermal_int); | 6204 | WREG32(CG_THERMAL_INT, thermal_int); |
6201 | 6205 | ||
6206 | /* posting read */ | ||
6207 | RREG32(SRBM_STATUS); | ||
6208 | |||
6202 | return 0; | 6209 | return 0; |
6203 | } | 6210 | } |
6204 | 6211 | ||
@@ -6609,6 +6616,10 @@ restart_ih: | |||
6609 | break; | 6616 | break; |
6610 | } | 6617 | } |
6611 | break; | 6618 | break; |
6619 | case 96: | ||
6620 | DRM_ERROR("SRBM_READ_ERROR: 0x%x\n", RREG32(SRBM_READ_ERROR)); | ||
6621 | WREG32(SRBM_INT_ACK, 0x1); | ||
6622 | break; | ||
6612 | case 124: /* UVD */ | 6623 | case 124: /* UVD */ |
6613 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); | 6624 | DRM_DEBUG("IH: UVD int: 0x%08x\n", src_data); |
6614 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); | 6625 | radeon_fence_process(rdev, R600_RING_TYPE_UVD_INDEX); |
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index cbd91d226f3c..99a9835c9f61 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
@@ -358,6 +358,10 @@ | |||
358 | #define CC_SYS_RB_BACKEND_DISABLE 0xe80 | 358 | #define CC_SYS_RB_BACKEND_DISABLE 0xe80 |
359 | #define GC_USER_SYS_RB_BACKEND_DISABLE 0xe84 | 359 | #define GC_USER_SYS_RB_BACKEND_DISABLE 0xe84 |
360 | 360 | ||
361 | #define SRBM_READ_ERROR 0xE98 | ||
362 | #define SRBM_INT_CNTL 0xEA0 | ||
363 | #define SRBM_INT_ACK 0xEA8 | ||
364 | |||
361 | #define SRBM_STATUS2 0x0EC4 | 365 | #define SRBM_STATUS2 0x0EC4 |
362 | #define DMA_BUSY (1 << 5) | 366 | #define DMA_BUSY (1 << 5) |
363 | #define DMA1_BUSY (1 << 6) | 367 | #define DMA1_BUSY (1 << 6) |
@@ -908,8 +912,8 @@ | |||
908 | 912 | ||
909 | #define DCCG_AUDIO_DTO0_PHASE 0x05b0 | 913 | #define DCCG_AUDIO_DTO0_PHASE 0x05b0 |
910 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 | 914 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 |
911 | #define DCCG_AUDIO_DTO1_PHASE 0x05b8 | 915 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 |
912 | #define DCCG_AUDIO_DTO1_MODULE 0x05bc | 916 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 |
913 | 917 | ||
914 | #define AFMT_AUDIO_SRC_CONTROL 0x713c | 918 | #define AFMT_AUDIO_SRC_CONTROL 0x713c |
915 | #define AFMT_AUDIO_SRC_SELECT(x) (((x) & 7) << 0) | 919 | #define AFMT_AUDIO_SRC_SELECT(x) (((x) & 7) << 0) |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index bc3e85186b88..b7f781573b15 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -999,8 +999,10 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) | |||
999 | crtc->state = NULL; | 999 | crtc->state = NULL; |
1000 | 1000 | ||
1001 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 1001 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
1002 | if (state) | 1002 | if (state) { |
1003 | crtc->state = &state->base; | 1003 | crtc->state = &state->base; |
1004 | crtc->state->crtc = crtc; | ||
1005 | } | ||
1004 | } | 1006 | } |
1005 | 1007 | ||
1006 | static struct drm_crtc_state * | 1008 | static struct drm_crtc_state * |
@@ -1014,6 +1016,7 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) | |||
1014 | return NULL; | 1016 | return NULL; |
1015 | 1017 | ||
1016 | copy->base.mode_changed = false; | 1018 | copy->base.mode_changed = false; |
1019 | copy->base.active_changed = false; | ||
1017 | copy->base.planes_changed = false; | 1020 | copy->base.planes_changed = false; |
1018 | copy->base.event = NULL; | 1021 | copy->base.event = NULL; |
1019 | 1022 | ||
@@ -1229,9 +1232,6 @@ static void tegra_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
1229 | /* program display mode */ | 1232 | /* program display mode */ |
1230 | tegra_dc_set_timings(dc, mode); | 1233 | tegra_dc_set_timings(dc, mode); |
1231 | 1234 | ||
1232 | if (dc->soc->supports_border_color) | ||
1233 | tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR); | ||
1234 | |||
1235 | /* interlacing isn't supported yet, so disable it */ | 1235 | /* interlacing isn't supported yet, so disable it */ |
1236 | if (dc->soc->supports_interlacing) { | 1236 | if (dc->soc->supports_interlacing) { |
1237 | value = tegra_dc_readl(dc, DC_DISP_INTERLACE_CONTROL); | 1237 | value = tegra_dc_readl(dc, DC_DISP_INTERLACE_CONTROL); |
@@ -1254,42 +1254,7 @@ static void tegra_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
1254 | 1254 | ||
1255 | static void tegra_crtc_prepare(struct drm_crtc *crtc) | 1255 | static void tegra_crtc_prepare(struct drm_crtc *crtc) |
1256 | { | 1256 | { |
1257 | struct tegra_dc *dc = to_tegra_dc(crtc); | ||
1258 | unsigned int syncpt; | ||
1259 | unsigned long value; | ||
1260 | |||
1261 | drm_crtc_vblank_off(crtc); | 1257 | drm_crtc_vblank_off(crtc); |
1262 | |||
1263 | if (dc->pipe) | ||
1264 | syncpt = SYNCPT_VBLANK1; | ||
1265 | else | ||
1266 | syncpt = SYNCPT_VBLANK0; | ||
1267 | |||
1268 | /* initialize display controller */ | ||
1269 | tegra_dc_writel(dc, 0x00000100, DC_CMD_GENERAL_INCR_SYNCPT_CNTRL); | ||
1270 | tegra_dc_writel(dc, 0x100 | syncpt, DC_CMD_CONT_SYNCPT_VSYNC); | ||
1271 | |||
1272 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | WIN_A_OF_INT; | ||
1273 | tegra_dc_writel(dc, value, DC_CMD_INT_TYPE); | ||
1274 | |||
1275 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | | ||
1276 | WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT; | ||
1277 | tegra_dc_writel(dc, value, DC_CMD_INT_POLARITY); | ||
1278 | |||
1279 | /* initialize timer */ | ||
1280 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(0x20) | | ||
1281 | WINDOW_B_THRESHOLD(0x20) | WINDOW_C_THRESHOLD(0x20); | ||
1282 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY); | ||
1283 | |||
1284 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(1) | | ||
1285 | WINDOW_B_THRESHOLD(1) | WINDOW_C_THRESHOLD(1); | ||
1286 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); | ||
1287 | |||
1288 | value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
1289 | tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); | ||
1290 | |||
1291 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
1292 | tegra_dc_writel(dc, value, DC_CMD_INT_MASK); | ||
1293 | } | 1258 | } |
1294 | 1259 | ||
1295 | static void tegra_crtc_commit(struct drm_crtc *crtc) | 1260 | static void tegra_crtc_commit(struct drm_crtc *crtc) |
@@ -1666,6 +1631,8 @@ static int tegra_dc_init(struct host1x_client *client) | |||
1666 | struct tegra_drm *tegra = drm->dev_private; | 1631 | struct tegra_drm *tegra = drm->dev_private; |
1667 | struct drm_plane *primary = NULL; | 1632 | struct drm_plane *primary = NULL; |
1668 | struct drm_plane *cursor = NULL; | 1633 | struct drm_plane *cursor = NULL; |
1634 | unsigned int syncpt; | ||
1635 | u32 value; | ||
1669 | int err; | 1636 | int err; |
1670 | 1637 | ||
1671 | if (tegra->domain) { | 1638 | if (tegra->domain) { |
@@ -1732,6 +1699,40 @@ static int tegra_dc_init(struct host1x_client *client) | |||
1732 | goto cleanup; | 1699 | goto cleanup; |
1733 | } | 1700 | } |
1734 | 1701 | ||
1702 | /* initialize display controller */ | ||
1703 | if (dc->pipe) | ||
1704 | syncpt = SYNCPT_VBLANK1; | ||
1705 | else | ||
1706 | syncpt = SYNCPT_VBLANK0; | ||
1707 | |||
1708 | tegra_dc_writel(dc, 0x00000100, DC_CMD_GENERAL_INCR_SYNCPT_CNTRL); | ||
1709 | tegra_dc_writel(dc, 0x100 | syncpt, DC_CMD_CONT_SYNCPT_VSYNC); | ||
1710 | |||
1711 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | WIN_A_OF_INT; | ||
1712 | tegra_dc_writel(dc, value, DC_CMD_INT_TYPE); | ||
1713 | |||
1714 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | | ||
1715 | WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT; | ||
1716 | tegra_dc_writel(dc, value, DC_CMD_INT_POLARITY); | ||
1717 | |||
1718 | /* initialize timer */ | ||
1719 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(0x20) | | ||
1720 | WINDOW_B_THRESHOLD(0x20) | WINDOW_C_THRESHOLD(0x20); | ||
1721 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY); | ||
1722 | |||
1723 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(1) | | ||
1724 | WINDOW_B_THRESHOLD(1) | WINDOW_C_THRESHOLD(1); | ||
1725 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); | ||
1726 | |||
1727 | value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
1728 | tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); | ||
1729 | |||
1730 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
1731 | tegra_dc_writel(dc, value, DC_CMD_INT_MASK); | ||
1732 | |||
1733 | if (dc->soc->supports_border_color) | ||
1734 | tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR); | ||
1735 | |||
1735 | return 0; | 1736 | return 0; |
1736 | 1737 | ||
1737 | cleanup: | 1738 | cleanup: |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 7e06657ae58b..7eaaee74a039 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
@@ -851,6 +851,14 @@ static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder, | |||
851 | h_back_porch = mode->htotal - mode->hsync_end; | 851 | h_back_porch = mode->htotal - mode->hsync_end; |
852 | h_front_porch = mode->hsync_start - mode->hdisplay; | 852 | h_front_porch = mode->hsync_start - mode->hdisplay; |
853 | 853 | ||
854 | err = clk_set_rate(hdmi->clk, pclk); | ||
855 | if (err < 0) { | ||
856 | dev_err(hdmi->dev, "failed to set HDMI clock frequency: %d\n", | ||
857 | err); | ||
858 | } | ||
859 | |||
860 | DRM_DEBUG_KMS("HDMI clock rate: %lu Hz\n", clk_get_rate(hdmi->clk)); | ||
861 | |||
854 | /* power up sequence */ | 862 | /* power up sequence */ |
855 | value = tegra_hdmi_readl(hdmi, HDMI_NV_PDISP_SOR_PLL0); | 863 | value = tegra_hdmi_readl(hdmi, HDMI_NV_PDISP_SOR_PLL0); |
856 | value &= ~SOR_PLL_PDBG; | 864 | value &= ~SOR_PLL_PDBG; |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index d395b0bef73b..8d9b7de25613 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -74,7 +74,7 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) | |||
74 | pr_err(" has_type: %d\n", man->has_type); | 74 | pr_err(" has_type: %d\n", man->has_type); |
75 | pr_err(" use_type: %d\n", man->use_type); | 75 | pr_err(" use_type: %d\n", man->use_type); |
76 | pr_err(" flags: 0x%08X\n", man->flags); | 76 | pr_err(" flags: 0x%08X\n", man->flags); |
77 | pr_err(" gpu_offset: 0x%08lX\n", man->gpu_offset); | 77 | pr_err(" gpu_offset: 0x%08llX\n", man->gpu_offset); |
78 | pr_err(" size: %llu\n", man->size); | 78 | pr_err(" size: %llu\n", man->size); |
79 | pr_err(" available_caching: 0x%08X\n", man->available_caching); | 79 | pr_err(" available_caching: 0x%08X\n", man->available_caching); |
80 | pr_err(" default_caching: 0x%08X\n", man->default_caching); | 80 | pr_err(" default_caching: 0x%08X\n", man->default_caching); |
diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index b61d6be97602..3ddfb3d0b64d 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c | |||
@@ -459,6 +459,8 @@ static void ipu_di_config_clock(struct ipu_di *di, | |||
459 | 459 | ||
460 | clkrate = clk_get_rate(di->clk_ipu); | 460 | clkrate = clk_get_rate(di->clk_ipu); |
461 | div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock); | 461 | div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock); |
462 | if (div == 0) | ||
463 | div = 1; | ||
462 | rate = clkrate / div; | 464 | rate = clkrate / div; |
463 | 465 | ||
464 | error = rate / (sig->mode.pixelclock / 1000); | 466 | error = rate / (sig->mode.pixelclock / 1000); |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index db4fb6e1cc5b..7c669c328c4c 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1872,6 +1872,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1872 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, | 1872 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
1873 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, | 1873 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, |
1874 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, | 1874 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, |
1875 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) }, | ||
1875 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | 1876 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, |
1876 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1877 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1877 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | 1878 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
@@ -1926,6 +1927,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1926 | #endif | 1927 | #endif |
1927 | #if IS_ENABLED(CONFIG_HID_SAITEK) | 1928 | #if IS_ENABLED(CONFIG_HID_SAITEK) |
1928 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | 1929 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, |
1930 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) }, | ||
1929 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, | 1931 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, |
1930 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, | 1932 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, |
1931 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, | 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 46edb4d3ed28..204312bfab2c 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -654,6 +654,7 @@ | |||
654 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 | 654 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 |
655 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 | 655 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 |
656 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | 656 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 |
657 | #define USB_DEVICE_ID_MS_NE7K 0x071d | ||
657 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 | 658 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 |
658 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c | 659 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c |
659 | #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 | 660 | #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 |
@@ -802,6 +803,7 @@ | |||
802 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 803 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
803 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 804 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
804 | #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 | 805 | #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 |
806 | #define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb | ||
805 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 | 807 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 |
806 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 | 808 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 |
807 | 809 | ||
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index fbaea6eb882e..af935eb198c9 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = { | |||
264 | .driver_data = MS_ERGONOMY }, | 264 | .driver_data = MS_ERGONOMY }, |
265 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), | 265 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), |
266 | .driver_data = MS_ERGONOMY }, | 266 | .driver_data = MS_ERGONOMY }, |
267 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K), | ||
268 | .driver_data = MS_ERGONOMY }, | ||
267 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), | 269 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), |
268 | .driver_data = MS_ERGONOMY | MS_RDESC }, | 270 | .driver_data = MS_ERGONOMY | MS_RDESC }, |
269 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | 271 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), |
diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c index 5632c54eadf0..a014f21275d8 100644 --- a/drivers/hid/hid-saitek.c +++ b/drivers/hid/hid-saitek.c | |||
@@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field, | |||
177 | static const struct hid_device_id saitek_devices[] = { | 177 | static const struct hid_device_id saitek_devices[] = { |
178 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), | 178 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), |
179 | .driver_data = SAITEK_FIX_PS1000 }, | 179 | .driver_data = SAITEK_FIX_PS1000 }, |
180 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD), | ||
181 | .driver_data = SAITEK_RELEASE_MODE_RAT7 }, | ||
180 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), | 182 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), |
181 | .driver_data = SAITEK_RELEASE_MODE_RAT7 }, | 183 | .driver_data = SAITEK_RELEASE_MODE_RAT7 }, |
182 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9), | 184 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9), |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 6a58b6c723aa..e54ce1097e2c 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -135,8 +135,9 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( | |||
135 | { | 135 | { |
136 | struct hid_sensor_hub_callbacks_list *callback; | 136 | struct hid_sensor_hub_callbacks_list *callback; |
137 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); | 137 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); |
138 | unsigned long flags; | ||
138 | 139 | ||
139 | spin_lock(&pdata->dyn_callback_lock); | 140 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
140 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) | 141 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) |
141 | if (callback->usage_id == usage_id && | 142 | if (callback->usage_id == usage_id && |
142 | (collection_index >= | 143 | (collection_index >= |
@@ -145,10 +146,11 @@ static struct hid_sensor_hub_callbacks *sensor_hub_get_callback( | |||
145 | callback->hsdev->end_collection_index)) { | 146 | callback->hsdev->end_collection_index)) { |
146 | *priv = callback->priv; | 147 | *priv = callback->priv; |
147 | *hsdev = callback->hsdev; | 148 | *hsdev = callback->hsdev; |
148 | spin_unlock(&pdata->dyn_callback_lock); | 149 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, |
150 | flags); | ||
149 | return callback->usage_callback; | 151 | return callback->usage_callback; |
150 | } | 152 | } |
151 | spin_unlock(&pdata->dyn_callback_lock); | 153 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
152 | 154 | ||
153 | return NULL; | 155 | return NULL; |
154 | } | 156 | } |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 31e9d2561106..1896c019e302 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -804,7 +804,7 @@ union sixaxis_output_report_01 { | |||
804 | #define DS4_REPORT_0x81_SIZE 7 | 804 | #define DS4_REPORT_0x81_SIZE 7 |
805 | #define SIXAXIS_REPORT_0xF2_SIZE 18 | 805 | #define SIXAXIS_REPORT_0xF2_SIZE 18 |
806 | 806 | ||
807 | static spinlock_t sony_dev_list_lock; | 807 | static DEFINE_SPINLOCK(sony_dev_list_lock); |
808 | static LIST_HEAD(sony_device_list); | 808 | static LIST_HEAD(sony_device_list); |
809 | static DEFINE_IDA(sony_device_id_allocator); | 809 | static DEFINE_IDA(sony_device_id_allocator); |
810 | 810 | ||
@@ -1944,6 +1944,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1944 | return -ENOMEM; | 1944 | return -ENOMEM; |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | spin_lock_init(&sc->lock); | ||
1948 | |||
1947 | sc->quirks = quirks; | 1949 | sc->quirks = quirks; |
1948 | hid_set_drvdata(hdev, sc); | 1950 | hid_set_drvdata(hdev, sc); |
1949 | sc->hdev = hdev; | 1951 | sc->hdev = hdev; |
@@ -2147,8 +2149,8 @@ static void __exit sony_exit(void) | |||
2147 | { | 2149 | { |
2148 | dbg_hid("Sony:%s\n", __func__); | 2150 | dbg_hid("Sony:%s\n", __func__); |
2149 | 2151 | ||
2150 | ida_destroy(&sony_device_id_allocator); | ||
2151 | hid_unregister_driver(&sony_driver); | 2152 | hid_unregister_driver(&sony_driver); |
2153 | ida_destroy(&sony_device_id_allocator); | ||
2152 | } | 2154 | } |
2153 | module_init(sony_init); | 2155 | module_init(sony_init); |
2154 | module_exit(sony_exit); | 2156 | module_exit(sony_exit); |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index d43e967e7533..36053f33d6d9 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -370,7 +370,10 @@ static int i2c_hid_hwreset(struct i2c_client *client) | |||
370 | static void i2c_hid_get_input(struct i2c_hid *ihid) | 370 | static void i2c_hid_get_input(struct i2c_hid *ihid) |
371 | { | 371 | { |
372 | int ret, ret_size; | 372 | int ret, ret_size; |
373 | int size = ihid->bufsize; | 373 | int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); |
374 | |||
375 | if (size > ihid->bufsize) | ||
376 | size = ihid->bufsize; | ||
374 | 377 | ||
375 | ret = i2c_master_recv(ihid->client, ihid->inbuf, size); | 378 | ret = i2c_master_recv(ihid->client, ihid->inbuf, size); |
376 | if (ret != size) { | 379 | if (ret != size) { |
@@ -785,7 +788,7 @@ static int i2c_hid_init_irq(struct i2c_client *client) | |||
785 | dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); | 788 | dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq); |
786 | 789 | ||
787 | ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, | 790 | ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq, |
788 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 791 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, |
789 | client->name, ihid); | 792 | client->name, ihid); |
790 | if (ret < 0) { | 793 | if (ret < 0) { |
791 | dev_warn(&client->dev, | 794 | dev_warn(&client->dev, |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 1a6507999a65..046351cf17f3 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -778,6 +778,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
778 | input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); | 778 | input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4])); |
779 | input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); | 779 | input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6])); |
780 | input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); | 780 | input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8])); |
781 | if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) { | ||
782 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | ||
783 | } else { | ||
784 | input_report_abs(input, ABS_MISC, 0); | ||
785 | } | ||
781 | } else if (features->type == CINTIQ_HYBRID) { | 786 | } else if (features->type == CINTIQ_HYBRID) { |
782 | /* | 787 | /* |
783 | * Do not send hardware buttons under Android. They | 788 | * Do not send hardware buttons under Android. They |
@@ -2725,9 +2730,9 @@ static const struct wacom_features wacom_features_0xF6 = | |||
2725 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, | 2730 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, |
2726 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | 2731 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
2727 | static const struct wacom_features wacom_features_0x32A = | 2732 | static const struct wacom_features wacom_features_0x32A = |
2728 | { "Wacom Cintiq 27QHD", 119740, 67520, 2047, | 2733 | { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63, |
2729 | 63, WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2734 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
2730 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2735 | WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; |
2731 | static const struct wacom_features wacom_features_0x32B = | 2736 | static const struct wacom_features wacom_features_0x32B = |
2732 | { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, | 2737 | { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, |
2733 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2738 | WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, |
diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index bce4e9ff21bf..6c99ee7bafa3 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c | |||
@@ -147,6 +147,9 @@ static int ads7828_probe(struct i2c_client *client, | |||
147 | &ads2830_regmap_config); | 147 | &ads2830_regmap_config); |
148 | } | 148 | } |
149 | 149 | ||
150 | if (IS_ERR(data->regmap)) | ||
151 | return PTR_ERR(data->regmap); | ||
152 | |||
150 | data->cmd_byte = ext_vref ? ADS7828_CMD_PD1 : ADS7828_CMD_PD3; | 153 | data->cmd_byte = ext_vref ? ADS7828_CMD_PD1 : ADS7828_CMD_PD3; |
151 | if (!diff_input) | 154 | if (!diff_input) |
152 | data->cmd_byte |= ADS7828_CMD_SD_SE; | 155 | data->cmd_byte |= ADS7828_CMD_SD_SE; |
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c index 5f1ff4cc5c34..7d7ae97476e2 100644 --- a/drivers/i2c/busses/i2c-designware-baytrail.c +++ b/drivers/i2c/busses/i2c-designware-baytrail.c | |||
@@ -17,27 +17,31 @@ | |||
17 | #include <linux/acpi.h> | 17 | #include <linux/acpi.h> |
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | |||
20 | #include <asm/iosf_mbi.h> | 21 | #include <asm/iosf_mbi.h> |
22 | |||
21 | #include "i2c-designware-core.h" | 23 | #include "i2c-designware-core.h" |
22 | 24 | ||
23 | #define SEMAPHORE_TIMEOUT 100 | 25 | #define SEMAPHORE_TIMEOUT 100 |
24 | #define PUNIT_SEMAPHORE 0x7 | 26 | #define PUNIT_SEMAPHORE 0x7 |
27 | #define PUNIT_SEMAPHORE_BIT BIT(0) | ||
28 | #define PUNIT_SEMAPHORE_ACQUIRE BIT(1) | ||
25 | 29 | ||
26 | static unsigned long acquired; | 30 | static unsigned long acquired; |
27 | 31 | ||
28 | static int get_sem(struct device *dev, u32 *sem) | 32 | static int get_sem(struct device *dev, u32 *sem) |
29 | { | 33 | { |
30 | u32 reg_val; | 34 | u32 data; |
31 | int ret; | 35 | int ret; |
32 | 36 | ||
33 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, PUNIT_SEMAPHORE, | 37 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, PUNIT_SEMAPHORE, |
34 | ®_val); | 38 | &data); |
35 | if (ret) { | 39 | if (ret) { |
36 | dev_err(dev, "iosf failed to read punit semaphore\n"); | 40 | dev_err(dev, "iosf failed to read punit semaphore\n"); |
37 | return ret; | 41 | return ret; |
38 | } | 42 | } |
39 | 43 | ||
40 | *sem = reg_val & 0x1; | 44 | *sem = data & PUNIT_SEMAPHORE_BIT; |
41 | 45 | ||
42 | return 0; | 46 | return 0; |
43 | } | 47 | } |
@@ -52,27 +56,29 @@ static void reset_semaphore(struct device *dev) | |||
52 | return; | 56 | return; |
53 | } | 57 | } |
54 | 58 | ||
55 | data = data & 0xfffffffe; | 59 | data &= ~PUNIT_SEMAPHORE_BIT; |
56 | if (iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 60 | if (iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, |
57 | PUNIT_SEMAPHORE, data)) | 61 | PUNIT_SEMAPHORE, data)) |
58 | dev_err(dev, "iosf failed to reset punit semaphore during write\n"); | 62 | dev_err(dev, "iosf failed to reset punit semaphore during write\n"); |
59 | } | 63 | } |
60 | 64 | ||
61 | int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | 65 | static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) |
62 | { | 66 | { |
63 | u32 sem = 0; | 67 | u32 sem; |
64 | int ret; | 68 | int ret; |
65 | unsigned long start, end; | 69 | unsigned long start, end; |
66 | 70 | ||
71 | might_sleep(); | ||
72 | |||
67 | if (!dev || !dev->dev) | 73 | if (!dev || !dev->dev) |
68 | return -ENODEV; | 74 | return -ENODEV; |
69 | 75 | ||
70 | if (!dev->acquire_lock) | 76 | if (!dev->release_lock) |
71 | return 0; | 77 | return 0; |
72 | 78 | ||
73 | /* host driver writes 0x2 to side band semaphore register */ | 79 | /* host driver writes to side band semaphore register */ |
74 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, | 80 | ret = iosf_mbi_write(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_WRITE, |
75 | PUNIT_SEMAPHORE, 0x2); | 81 | PUNIT_SEMAPHORE, PUNIT_SEMAPHORE_ACQUIRE); |
76 | if (ret) { | 82 | if (ret) { |
77 | dev_err(dev->dev, "iosf punit semaphore request failed\n"); | 83 | dev_err(dev->dev, "iosf punit semaphore request failed\n"); |
78 | return ret; | 84 | return ret; |
@@ -81,7 +87,7 @@ int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | |||
81 | /* host driver waits for bit 0 to be set in semaphore register */ | 87 | /* host driver waits for bit 0 to be set in semaphore register */ |
82 | start = jiffies; | 88 | start = jiffies; |
83 | end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT); | 89 | end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT); |
84 | while (!time_after(jiffies, end)) { | 90 | do { |
85 | ret = get_sem(dev->dev, &sem); | 91 | ret = get_sem(dev->dev, &sem); |
86 | if (!ret && sem) { | 92 | if (!ret && sem) { |
87 | acquired = jiffies; | 93 | acquired = jiffies; |
@@ -91,14 +97,14 @@ int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | |||
91 | } | 97 | } |
92 | 98 | ||
93 | usleep_range(1000, 2000); | 99 | usleep_range(1000, 2000); |
94 | } | 100 | } while (time_before(jiffies, end)); |
95 | 101 | ||
96 | dev_err(dev->dev, "punit semaphore timed out, resetting\n"); | 102 | dev_err(dev->dev, "punit semaphore timed out, resetting\n"); |
97 | reset_semaphore(dev->dev); | 103 | reset_semaphore(dev->dev); |
98 | 104 | ||
99 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, | 105 | ret = iosf_mbi_read(BT_MBI_UNIT_PMC, BT_MBI_BUNIT_READ, |
100 | PUNIT_SEMAPHORE, &sem); | 106 | PUNIT_SEMAPHORE, &sem); |
101 | if (!ret) | 107 | if (ret) |
102 | dev_err(dev->dev, "iosf failed to read punit semaphore\n"); | 108 | dev_err(dev->dev, "iosf failed to read punit semaphore\n"); |
103 | else | 109 | else |
104 | dev_err(dev->dev, "PUNIT SEM: %d\n", sem); | 110 | dev_err(dev->dev, "PUNIT SEM: %d\n", sem); |
@@ -107,9 +113,8 @@ int baytrail_i2c_acquire(struct dw_i2c_dev *dev) | |||
107 | 113 | ||
108 | return -ETIMEDOUT; | 114 | return -ETIMEDOUT; |
109 | } | 115 | } |
110 | EXPORT_SYMBOL(baytrail_i2c_acquire); | ||
111 | 116 | ||
112 | void baytrail_i2c_release(struct dw_i2c_dev *dev) | 117 | static void baytrail_i2c_release(struct dw_i2c_dev *dev) |
113 | { | 118 | { |
114 | if (!dev || !dev->dev) | 119 | if (!dev || !dev->dev) |
115 | return; | 120 | return; |
@@ -121,7 +126,6 @@ void baytrail_i2c_release(struct dw_i2c_dev *dev) | |||
121 | dev_dbg(dev->dev, "punit semaphore held for %ums\n", | 126 | dev_dbg(dev->dev, "punit semaphore held for %ums\n", |
122 | jiffies_to_msecs(jiffies - acquired)); | 127 | jiffies_to_msecs(jiffies - acquired)); |
123 | } | 128 | } |
124 | EXPORT_SYMBOL(baytrail_i2c_release); | ||
125 | 129 | ||
126 | int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev) | 130 | int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev) |
127 | { | 131 | { |
@@ -137,7 +141,6 @@ int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev) | |||
137 | return 0; | 141 | return 0; |
138 | 142 | ||
139 | status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host); | 143 | status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host); |
140 | |||
141 | if (ACPI_FAILURE(status)) | 144 | if (ACPI_FAILURE(status)) |
142 | return 0; | 145 | return 0; |
143 | 146 | ||
@@ -153,7 +156,6 @@ int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev) | |||
153 | 156 | ||
154 | return 0; | 157 | return 0; |
155 | } | 158 | } |
156 | EXPORT_SYMBOL(i2c_dw_eval_lock_support); | ||
157 | 159 | ||
158 | MODULE_AUTHOR("David E. Box <david.e.box@linux.intel.com>"); | 160 | MODULE_AUTHOR("David E. Box <david.e.box@linux.intel.com>"); |
159 | MODULE_DESCRIPTION("Baytrail I2C Semaphore driver"); | 161 | MODULE_DESCRIPTION("Baytrail I2C Semaphore driver"); |
diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c index 51672256072b..b96c636470ef 100644 --- a/drivers/iio/adc/mcp3422.c +++ b/drivers/iio/adc/mcp3422.c | |||
@@ -58,20 +58,11 @@ | |||
58 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ | 58 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ |
59 | } | 59 | } |
60 | 60 | ||
61 | /* LSB is in nV to eliminate floating point */ | ||
62 | static const u32 rates_to_lsb[] = {1000000, 250000, 62500, 15625}; | ||
63 | |||
64 | /* | ||
65 | * scales calculated as: | ||
66 | * rates_to_lsb[sample_rate] / (1 << pga); | ||
67 | * pga is 1 for 0, 2 | ||
68 | */ | ||
69 | |||
70 | static const int mcp3422_scales[4][4] = { | 61 | static const int mcp3422_scales[4][4] = { |
71 | { 1000000, 250000, 62500, 15625 }, | 62 | { 1000000, 500000, 250000, 125000 }, |
72 | { 500000 , 125000, 31250, 7812 }, | 63 | { 250000 , 125000, 62500 , 31250 }, |
73 | { 250000 , 62500 , 15625, 3906 }, | 64 | { 62500 , 31250 , 15625 , 7812 }, |
74 | { 125000 , 31250 , 7812 , 1953 } }; | 65 | { 15625 , 7812 , 3906 , 1953 } }; |
75 | 66 | ||
76 | /* Constant msleep times for data acquisitions */ | 67 | /* Constant msleep times for data acquisitions */ |
77 | static const int mcp3422_read_times[4] = { | 68 | static const int mcp3422_read_times[4] = { |
diff --git a/drivers/iio/adc/qcom-spmi-iadc.c b/drivers/iio/adc/qcom-spmi-iadc.c index b9666f2f5e51..fabd24edc2a1 100644 --- a/drivers/iio/adc/qcom-spmi-iadc.c +++ b/drivers/iio/adc/qcom-spmi-iadc.c | |||
@@ -296,7 +296,8 @@ static int iadc_do_conversion(struct iadc_chip *iadc, int chan, u16 *data) | |||
296 | if (iadc->poll_eoc) { | 296 | if (iadc->poll_eoc) { |
297 | ret = iadc_poll_wait_eoc(iadc, wait); | 297 | ret = iadc_poll_wait_eoc(iadc, wait); |
298 | } else { | 298 | } else { |
299 | ret = wait_for_completion_timeout(&iadc->complete, wait); | 299 | ret = wait_for_completion_timeout(&iadc->complete, |
300 | usecs_to_jiffies(wait)); | ||
300 | if (!ret) | 301 | if (!ret) |
301 | ret = -ETIMEDOUT; | 302 | ret = -ETIMEDOUT; |
302 | else | 303 | else |
diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 52d70435f5a1..55a90082a29b 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c | |||
@@ -640,6 +640,7 @@ static int ssp_remove(struct spi_device *spi) | |||
640 | return 0; | 640 | return 0; |
641 | } | 641 | } |
642 | 642 | ||
643 | #ifdef CONFIG_PM_SLEEP | ||
643 | static int ssp_suspend(struct device *dev) | 644 | static int ssp_suspend(struct device *dev) |
644 | { | 645 | { |
645 | int ret; | 646 | int ret; |
@@ -688,6 +689,7 @@ static int ssp_resume(struct device *dev) | |||
688 | 689 | ||
689 | return 0; | 690 | return 0; |
690 | } | 691 | } |
692 | #endif /* CONFIG_PM_SLEEP */ | ||
691 | 693 | ||
692 | static const struct dev_pm_ops ssp_pm_ops = { | 694 | static const struct dev_pm_ops ssp_pm_ops = { |
693 | SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) | 695 | SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) |
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c index f57562aa396f..15c73e20272d 100644 --- a/drivers/iio/dac/ad5686.c +++ b/drivers/iio/dac/ad5686.c | |||
@@ -322,7 +322,7 @@ static int ad5686_probe(struct spi_device *spi) | |||
322 | st = iio_priv(indio_dev); | 322 | st = iio_priv(indio_dev); |
323 | spi_set_drvdata(spi, indio_dev); | 323 | spi_set_drvdata(spi, indio_dev); |
324 | 324 | ||
325 | st->reg = devm_regulator_get(&spi->dev, "vcc"); | 325 | st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); |
326 | if (!IS_ERR(st->reg)) { | 326 | if (!IS_ERR(st->reg)) { |
327 | ret = regulator_enable(st->reg); | 327 | ret = regulator_enable(st->reg); |
328 | if (ret) | 328 | if (ret) |
diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c index 623c145d8a97..7d79a1ac5f5f 100644 --- a/drivers/iio/humidity/dht11.c +++ b/drivers/iio/humidity/dht11.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/wait.h> | 29 | #include <linux/wait.h> |
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/completion.h> | 31 | #include <linux/completion.h> |
32 | #include <linux/mutex.h> | ||
32 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
33 | #include <linux/gpio.h> | 34 | #include <linux/gpio.h> |
34 | #include <linux/of_gpio.h> | 35 | #include <linux/of_gpio.h> |
@@ -39,8 +40,12 @@ | |||
39 | 40 | ||
40 | #define DHT11_DATA_VALID_TIME 2000000000 /* 2s in ns */ | 41 | #define DHT11_DATA_VALID_TIME 2000000000 /* 2s in ns */ |
41 | 42 | ||
42 | #define DHT11_EDGES_PREAMBLE 4 | 43 | #define DHT11_EDGES_PREAMBLE 2 |
43 | #define DHT11_BITS_PER_READ 40 | 44 | #define DHT11_BITS_PER_READ 40 |
45 | /* | ||
46 | * Note that when reading the sensor actually 84 edges are detected, but | ||
47 | * since the last edge is not significant, we only store 83: | ||
48 | */ | ||
44 | #define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1) | 49 | #define DHT11_EDGES_PER_READ (2*DHT11_BITS_PER_READ + DHT11_EDGES_PREAMBLE + 1) |
45 | 50 | ||
46 | /* Data transmission timing (nano seconds) */ | 51 | /* Data transmission timing (nano seconds) */ |
@@ -57,6 +62,7 @@ struct dht11 { | |||
57 | int irq; | 62 | int irq; |
58 | 63 | ||
59 | struct completion completion; | 64 | struct completion completion; |
65 | struct mutex lock; | ||
60 | 66 | ||
61 | s64 timestamp; | 67 | s64 timestamp; |
62 | int temperature; | 68 | int temperature; |
@@ -88,7 +94,7 @@ static int dht11_decode(struct dht11 *dht11, int offset) | |||
88 | unsigned char temp_int, temp_dec, hum_int, hum_dec, checksum; | 94 | unsigned char temp_int, temp_dec, hum_int, hum_dec, checksum; |
89 | 95 | ||
90 | /* Calculate timestamp resolution */ | 96 | /* Calculate timestamp resolution */ |
91 | for (i = 0; i < dht11->num_edges; ++i) { | 97 | for (i = 1; i < dht11->num_edges; ++i) { |
92 | t = dht11->edges[i].ts - dht11->edges[i-1].ts; | 98 | t = dht11->edges[i].ts - dht11->edges[i-1].ts; |
93 | if (t > 0 && t < timeres) | 99 | if (t > 0 && t < timeres) |
94 | timeres = t; | 100 | timeres = t; |
@@ -138,6 +144,27 @@ static int dht11_decode(struct dht11 *dht11, int offset) | |||
138 | return 0; | 144 | return 0; |
139 | } | 145 | } |
140 | 146 | ||
147 | /* | ||
148 | * IRQ handler called on GPIO edges | ||
149 | */ | ||
150 | static irqreturn_t dht11_handle_irq(int irq, void *data) | ||
151 | { | ||
152 | struct iio_dev *iio = data; | ||
153 | struct dht11 *dht11 = iio_priv(iio); | ||
154 | |||
155 | /* TODO: Consider making the handler safe for IRQ sharing */ | ||
156 | if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) { | ||
157 | dht11->edges[dht11->num_edges].ts = iio_get_time_ns(); | ||
158 | dht11->edges[dht11->num_edges++].value = | ||
159 | gpio_get_value(dht11->gpio); | ||
160 | |||
161 | if (dht11->num_edges >= DHT11_EDGES_PER_READ) | ||
162 | complete(&dht11->completion); | ||
163 | } | ||
164 | |||
165 | return IRQ_HANDLED; | ||
166 | } | ||
167 | |||
141 | static int dht11_read_raw(struct iio_dev *iio_dev, | 168 | static int dht11_read_raw(struct iio_dev *iio_dev, |
142 | const struct iio_chan_spec *chan, | 169 | const struct iio_chan_spec *chan, |
143 | int *val, int *val2, long m) | 170 | int *val, int *val2, long m) |
@@ -145,6 +172,7 @@ static int dht11_read_raw(struct iio_dev *iio_dev, | |||
145 | struct dht11 *dht11 = iio_priv(iio_dev); | 172 | struct dht11 *dht11 = iio_priv(iio_dev); |
146 | int ret; | 173 | int ret; |
147 | 174 | ||
175 | mutex_lock(&dht11->lock); | ||
148 | if (dht11->timestamp + DHT11_DATA_VALID_TIME < iio_get_time_ns()) { | 176 | if (dht11->timestamp + DHT11_DATA_VALID_TIME < iio_get_time_ns()) { |
149 | reinit_completion(&dht11->completion); | 177 | reinit_completion(&dht11->completion); |
150 | 178 | ||
@@ -157,8 +185,17 @@ static int dht11_read_raw(struct iio_dev *iio_dev, | |||
157 | if (ret) | 185 | if (ret) |
158 | goto err; | 186 | goto err; |
159 | 187 | ||
188 | ret = request_irq(dht11->irq, dht11_handle_irq, | ||
189 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
190 | iio_dev->name, iio_dev); | ||
191 | if (ret) | ||
192 | goto err; | ||
193 | |||
160 | ret = wait_for_completion_killable_timeout(&dht11->completion, | 194 | ret = wait_for_completion_killable_timeout(&dht11->completion, |
161 | HZ); | 195 | HZ); |
196 | |||
197 | free_irq(dht11->irq, iio_dev); | ||
198 | |||
162 | if (ret == 0 && dht11->num_edges < DHT11_EDGES_PER_READ - 1) { | 199 | if (ret == 0 && dht11->num_edges < DHT11_EDGES_PER_READ - 1) { |
163 | dev_err(&iio_dev->dev, | 200 | dev_err(&iio_dev->dev, |
164 | "Only %d signal edges detected\n", | 201 | "Only %d signal edges detected\n", |
@@ -185,6 +222,7 @@ static int dht11_read_raw(struct iio_dev *iio_dev, | |||
185 | ret = -EINVAL; | 222 | ret = -EINVAL; |
186 | err: | 223 | err: |
187 | dht11->num_edges = -1; | 224 | dht11->num_edges = -1; |
225 | mutex_unlock(&dht11->lock); | ||
188 | return ret; | 226 | return ret; |
189 | } | 227 | } |
190 | 228 | ||
@@ -193,27 +231,6 @@ static const struct iio_info dht11_iio_info = { | |||
193 | .read_raw = dht11_read_raw, | 231 | .read_raw = dht11_read_raw, |
194 | }; | 232 | }; |
195 | 233 | ||
196 | /* | ||
197 | * IRQ handler called on GPIO edges | ||
198 | */ | ||
199 | static irqreturn_t dht11_handle_irq(int irq, void *data) | ||
200 | { | ||
201 | struct iio_dev *iio = data; | ||
202 | struct dht11 *dht11 = iio_priv(iio); | ||
203 | |||
204 | /* TODO: Consider making the handler safe for IRQ sharing */ | ||
205 | if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) { | ||
206 | dht11->edges[dht11->num_edges].ts = iio_get_time_ns(); | ||
207 | dht11->edges[dht11->num_edges++].value = | ||
208 | gpio_get_value(dht11->gpio); | ||
209 | |||
210 | if (dht11->num_edges >= DHT11_EDGES_PER_READ) | ||
211 | complete(&dht11->completion); | ||
212 | } | ||
213 | |||
214 | return IRQ_HANDLED; | ||
215 | } | ||
216 | |||
217 | static const struct iio_chan_spec dht11_chan_spec[] = { | 234 | static const struct iio_chan_spec dht11_chan_spec[] = { |
218 | { .type = IIO_TEMP, | 235 | { .type = IIO_TEMP, |
219 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), }, | 236 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), }, |
@@ -256,11 +273,6 @@ static int dht11_probe(struct platform_device *pdev) | |||
256 | dev_err(dev, "GPIO %d has no interrupt\n", dht11->gpio); | 273 | dev_err(dev, "GPIO %d has no interrupt\n", dht11->gpio); |
257 | return -EINVAL; | 274 | return -EINVAL; |
258 | } | 275 | } |
259 | ret = devm_request_irq(dev, dht11->irq, dht11_handle_irq, | ||
260 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
261 | pdev->name, iio); | ||
262 | if (ret) | ||
263 | return ret; | ||
264 | 276 | ||
265 | dht11->timestamp = iio_get_time_ns() - DHT11_DATA_VALID_TIME - 1; | 277 | dht11->timestamp = iio_get_time_ns() - DHT11_DATA_VALID_TIME - 1; |
266 | dht11->num_edges = -1; | 278 | dht11->num_edges = -1; |
@@ -268,6 +280,7 @@ static int dht11_probe(struct platform_device *pdev) | |||
268 | platform_set_drvdata(pdev, iio); | 280 | platform_set_drvdata(pdev, iio); |
269 | 281 | ||
270 | init_completion(&dht11->completion); | 282 | init_completion(&dht11->completion); |
283 | mutex_init(&dht11->lock); | ||
271 | iio->name = pdev->name; | 284 | iio->name = pdev->name; |
272 | iio->dev.parent = &pdev->dev; | 285 | iio->dev.parent = &pdev->dev; |
273 | iio->info = &dht11_iio_info; | 286 | iio->info = &dht11_iio_info; |
diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c index b54164677b89..fa3b809aff5e 100644 --- a/drivers/iio/humidity/si7020.c +++ b/drivers/iio/humidity/si7020.c | |||
@@ -45,12 +45,12 @@ static int si7020_read_raw(struct iio_dev *indio_dev, | |||
45 | struct iio_chan_spec const *chan, int *val, | 45 | struct iio_chan_spec const *chan, int *val, |
46 | int *val2, long mask) | 46 | int *val2, long mask) |
47 | { | 47 | { |
48 | struct i2c_client *client = iio_priv(indio_dev); | 48 | struct i2c_client **client = iio_priv(indio_dev); |
49 | int ret; | 49 | int ret; |
50 | 50 | ||
51 | switch (mask) { | 51 | switch (mask) { |
52 | case IIO_CHAN_INFO_RAW: | 52 | case IIO_CHAN_INFO_RAW: |
53 | ret = i2c_smbus_read_word_data(client, | 53 | ret = i2c_smbus_read_word_data(*client, |
54 | chan->type == IIO_TEMP ? | 54 | chan->type == IIO_TEMP ? |
55 | SI7020CMD_TEMP_HOLD : | 55 | SI7020CMD_TEMP_HOLD : |
56 | SI7020CMD_RH_HOLD); | 56 | SI7020CMD_RH_HOLD); |
@@ -126,7 +126,7 @@ static int si7020_probe(struct i2c_client *client, | |||
126 | /* Wait the maximum power-up time after software reset. */ | 126 | /* Wait the maximum power-up time after software reset. */ |
127 | msleep(15); | 127 | msleep(15); |
128 | 128 | ||
129 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client)); | 129 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); |
130 | if (!indio_dev) | 130 | if (!indio_dev) |
131 | return -ENOMEM; | 131 | return -ENOMEM; |
132 | 132 | ||
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index b70873de04ea..fa795dcd5f75 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/debugfs.h> | 28 | #include <linux/debugfs.h> |
29 | #include <linux/bitops.h> | ||
29 | 30 | ||
30 | #include <linux/iio/iio.h> | 31 | #include <linux/iio/iio.h> |
31 | #include <linux/iio/sysfs.h> | 32 | #include <linux/iio/sysfs.h> |
@@ -414,7 +415,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
414 | mutex_unlock(&indio_dev->mlock); | 415 | mutex_unlock(&indio_dev->mlock); |
415 | if (ret) | 416 | if (ret) |
416 | return ret; | 417 | return ret; |
417 | val16 = ((val16 & 0xFFF) << 4) >> 4; | 418 | val16 = sign_extend32(val16, 11); |
418 | *val = val16; | 419 | *val = val16; |
419 | return IIO_VAL_INT; | 420 | return IIO_VAL_INT; |
420 | case IIO_CHAN_INFO_OFFSET: | 421 | case IIO_CHAN_INFO_OFFSET: |
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index f73e60b7a796..d8d5bed65e07 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | |||
@@ -780,7 +780,11 @@ static int inv_mpu_probe(struct i2c_client *client, | |||
780 | 780 | ||
781 | i2c_set_clientdata(client, indio_dev); | 781 | i2c_set_clientdata(client, indio_dev); |
782 | indio_dev->dev.parent = &client->dev; | 782 | indio_dev->dev.parent = &client->dev; |
783 | indio_dev->name = id->name; | 783 | /* id will be NULL when enumerated via ACPI */ |
784 | if (id) | ||
785 | indio_dev->name = (char *)id->name; | ||
786 | else | ||
787 | indio_dev->name = (char *)dev_name(&client->dev); | ||
784 | indio_dev->channels = inv_mpu_channels; | 788 | indio_dev->channels = inv_mpu_channels; |
785 | indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); | 789 | indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); |
786 | 790 | ||
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig index ae68c64bdad3..a224afd6380c 100644 --- a/drivers/iio/light/Kconfig +++ b/drivers/iio/light/Kconfig | |||
@@ -73,6 +73,7 @@ config CM36651 | |||
73 | config GP2AP020A00F | 73 | config GP2AP020A00F |
74 | tristate "Sharp GP2AP020A00F Proximity/ALS sensor" | 74 | tristate "Sharp GP2AP020A00F Proximity/ALS sensor" |
75 | depends on I2C | 75 | depends on I2C |
76 | select REGMAP_I2C | ||
76 | select IIO_BUFFER | 77 | select IIO_BUFFER |
77 | select IIO_TRIGGERED_BUFFER | 78 | select IIO_TRIGGERED_BUFFER |
78 | select IRQ_WORK | 79 | select IRQ_WORK |
@@ -126,6 +127,7 @@ config HID_SENSOR_PROX | |||
126 | config JSA1212 | 127 | config JSA1212 |
127 | tristate "JSA1212 ALS and proximity sensor driver" | 128 | tristate "JSA1212 ALS and proximity sensor driver" |
128 | depends on I2C | 129 | depends on I2C |
130 | select REGMAP_I2C | ||
129 | help | 131 | help |
130 | Say Y here if you want to build a IIO driver for JSA1212 | 132 | Say Y here if you want to build a IIO driver for JSA1212 |
131 | proximity & ALS sensor device. | 133 | proximity & ALS sensor device. |
diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig index 4c7a4c52dd06..a5d6de72c523 100644 --- a/drivers/iio/magnetometer/Kconfig +++ b/drivers/iio/magnetometer/Kconfig | |||
@@ -18,6 +18,8 @@ config AK8975 | |||
18 | 18 | ||
19 | config AK09911 | 19 | config AK09911 |
20 | tristate "Asahi Kasei AK09911 3-axis Compass" | 20 | tristate "Asahi Kasei AK09911 3-axis Compass" |
21 | depends on I2C | ||
22 | depends on GPIOLIB | ||
21 | select AK8975 | 23 | select AK8975 |
22 | help | 24 | help |
23 | Deprecated: AK09911 is now supported by AK8975 driver. | 25 | Deprecated: AK09911 is now supported by AK8975 driver. |
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index 3c92780bda09..ff48da61c94c 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c | |||
@@ -1755,7 +1755,7 @@ init_card(struct hfc_pci *hc) | |||
1755 | enable_hwirq(hc); | 1755 | enable_hwirq(hc); |
1756 | spin_unlock_irqrestore(&hc->lock, flags); | 1756 | spin_unlock_irqrestore(&hc->lock, flags); |
1757 | /* Timeout 80ms */ | 1757 | /* Timeout 80ms */ |
1758 | current->state = TASK_UNINTERRUPTIBLE; | 1758 | set_current_state(TASK_UNINTERRUPTIBLE); |
1759 | schedule_timeout((80 * HZ) / 1000); | 1759 | schedule_timeout((80 * HZ) / 1000); |
1760 | printk(KERN_INFO "HFC PCI: IRQ %d count %d\n", | 1760 | printk(KERN_INFO "HFC PCI: IRQ %d count %d\n", |
1761 | hc->irq, hc->irqcnt); | 1761 | hc->irq, hc->irqcnt); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index c8d2bac4e28b..cadf9cc02b25 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2555,7 +2555,7 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) | |||
2555 | return err ? err : len; | 2555 | return err ? err : len; |
2556 | } | 2556 | } |
2557 | static struct rdev_sysfs_entry rdev_state = | 2557 | static struct rdev_sysfs_entry rdev_state = |
2558 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); | 2558 | __ATTR_PREALLOC(state, S_IRUGO|S_IWUSR, state_show, state_store); |
2559 | 2559 | ||
2560 | static ssize_t | 2560 | static ssize_t |
2561 | errors_show(struct md_rdev *rdev, char *page) | 2561 | errors_show(struct md_rdev *rdev, char *page) |
@@ -3638,7 +3638,8 @@ resync_start_store(struct mddev *mddev, const char *buf, size_t len) | |||
3638 | return err ?: len; | 3638 | return err ?: len; |
3639 | } | 3639 | } |
3640 | static struct md_sysfs_entry md_resync_start = | 3640 | static struct md_sysfs_entry md_resync_start = |
3641 | __ATTR(resync_start, S_IRUGO|S_IWUSR, resync_start_show, resync_start_store); | 3641 | __ATTR_PREALLOC(resync_start, S_IRUGO|S_IWUSR, |
3642 | resync_start_show, resync_start_store); | ||
3642 | 3643 | ||
3643 | /* | 3644 | /* |
3644 | * The array state can be: | 3645 | * The array state can be: |
@@ -3851,7 +3852,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
3851 | return err ?: len; | 3852 | return err ?: len; |
3852 | } | 3853 | } |
3853 | static struct md_sysfs_entry md_array_state = | 3854 | static struct md_sysfs_entry md_array_state = |
3854 | __ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); | 3855 | __ATTR_PREALLOC(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); |
3855 | 3856 | ||
3856 | static ssize_t | 3857 | static ssize_t |
3857 | max_corrected_read_errors_show(struct mddev *mddev, char *page) { | 3858 | max_corrected_read_errors_show(struct mddev *mddev, char *page) { |
@@ -4101,7 +4102,7 @@ out_unlock: | |||
4101 | } | 4102 | } |
4102 | 4103 | ||
4103 | static struct md_sysfs_entry md_metadata = | 4104 | static struct md_sysfs_entry md_metadata = |
4104 | __ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); | 4105 | __ATTR_PREALLOC(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); |
4105 | 4106 | ||
4106 | static ssize_t | 4107 | static ssize_t |
4107 | action_show(struct mddev *mddev, char *page) | 4108 | action_show(struct mddev *mddev, char *page) |
@@ -4189,7 +4190,7 @@ action_store(struct mddev *mddev, const char *page, size_t len) | |||
4189 | } | 4190 | } |
4190 | 4191 | ||
4191 | static struct md_sysfs_entry md_scan_mode = | 4192 | static struct md_sysfs_entry md_scan_mode = |
4192 | __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); | 4193 | __ATTR_PREALLOC(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); |
4193 | 4194 | ||
4194 | static ssize_t | 4195 | static ssize_t |
4195 | last_sync_action_show(struct mddev *mddev, char *page) | 4196 | last_sync_action_show(struct mddev *mddev, char *page) |
@@ -4335,7 +4336,8 @@ sync_completed_show(struct mddev *mddev, char *page) | |||
4335 | return sprintf(page, "%llu / %llu\n", resync, max_sectors); | 4336 | return sprintf(page, "%llu / %llu\n", resync, max_sectors); |
4336 | } | 4337 | } |
4337 | 4338 | ||
4338 | static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed); | 4339 | static struct md_sysfs_entry md_sync_completed = |
4340 | __ATTR_PREALLOC(sync_completed, S_IRUGO, sync_completed_show, NULL); | ||
4339 | 4341 | ||
4340 | static ssize_t | 4342 | static ssize_t |
4341 | min_sync_show(struct mddev *mddev, char *page) | 4343 | min_sync_show(struct mddev *mddev, char *page) |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4153da5d4011..d34e238afa54 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -560,7 +560,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
560 | if (test_bit(WriteMostly, &rdev->flags)) { | 560 | if (test_bit(WriteMostly, &rdev->flags)) { |
561 | /* Don't balance among write-mostly, just | 561 | /* Don't balance among write-mostly, just |
562 | * use the first as a last resort */ | 562 | * use the first as a last resort */ |
563 | if (best_disk < 0) { | 563 | if (best_dist_disk < 0) { |
564 | if (is_badblock(rdev, this_sector, sectors, | 564 | if (is_badblock(rdev, this_sector, sectors, |
565 | &first_bad, &bad_sectors)) { | 565 | &first_bad, &bad_sectors)) { |
566 | if (first_bad < this_sector) | 566 | if (first_bad < this_sector) |
@@ -569,7 +569,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
569 | best_good_sectors = first_bad - this_sector; | 569 | best_good_sectors = first_bad - this_sector; |
570 | } else | 570 | } else |
571 | best_good_sectors = sectors; | 571 | best_good_sectors = sectors; |
572 | best_disk = disk; | 572 | best_dist_disk = disk; |
573 | best_pending_disk = disk; | ||
573 | } | 574 | } |
574 | continue; | 575 | continue; |
575 | } | 576 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e75d48c0421a..cd2f96b2c572 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5121,12 +5121,17 @@ static inline sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int | |||
5121 | schedule_timeout_uninterruptible(1); | 5121 | schedule_timeout_uninterruptible(1); |
5122 | } | 5122 | } |
5123 | /* Need to check if array will still be degraded after recovery/resync | 5123 | /* Need to check if array will still be degraded after recovery/resync |
5124 | * We don't need to check the 'failed' flag as when that gets set, | 5124 | * Note in case of > 1 drive failures it's possible we're rebuilding |
5125 | * recovery aborts. | 5125 | * one drive while leaving another faulty drive in array. |
5126 | */ | 5126 | */ |
5127 | for (i = 0; i < conf->raid_disks; i++) | 5127 | rcu_read_lock(); |
5128 | if (conf->disks[i].rdev == NULL) | 5128 | for (i = 0; i < conf->raid_disks; i++) { |
5129 | struct md_rdev *rdev = ACCESS_ONCE(conf->disks[i].rdev); | ||
5130 | |||
5131 | if (rdev == NULL || test_bit(Faulty, &rdev->flags)) | ||
5129 | still_degraded = 1; | 5132 | still_degraded = 1; |
5133 | } | ||
5134 | rcu_read_unlock(); | ||
5130 | 5135 | ||
5131 | bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded); | 5136 | bitmap_start_sync(mddev->bitmap, sector_nr, &sync_blocks, still_degraded); |
5132 | 5137 | ||
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index 9306219d5675..6ad049a08e4d 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
@@ -341,6 +341,8 @@ void mei_stop(struct mei_device *dev) | |||
341 | 341 | ||
342 | dev->dev_state = MEI_DEV_POWER_DOWN; | 342 | dev->dev_state = MEI_DEV_POWER_DOWN; |
343 | mei_reset(dev); | 343 | mei_reset(dev); |
344 | /* move device to disabled state unconditionally */ | ||
345 | dev->dev_state = MEI_DEV_DISABLED; | ||
344 | 346 | ||
345 | mutex_unlock(&dev->device_lock); | 347 | mutex_unlock(&dev->device_lock); |
346 | 348 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 84673ebcf428..df51d6025a90 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -157,7 +157,7 @@ config IPVLAN | |||
157 | making it transparent to the connected L2 switch. | 157 | making it transparent to the connected L2 switch. |
158 | 158 | ||
159 | Ipvlan devices can be added using the "ip" command from the | 159 | Ipvlan devices can be added using the "ip" command from the |
160 | iproute2 package starting with the iproute2-X.Y.ZZ release: | 160 | iproute2 package starting with the iproute2-3.19 release: |
161 | 161 | ||
162 | "ip link add link <main-dev> [ NAME ] type ipvlan" | 162 | "ip link add link <main-dev> [ NAME ] type ipvlan" |
163 | 163 | ||
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig index 4ce6ca5f3d36..dc6b78e5342f 100644 --- a/drivers/net/appletalk/Kconfig +++ b/drivers/net/appletalk/Kconfig | |||
@@ -40,7 +40,7 @@ config DEV_APPLETALK | |||
40 | 40 | ||
41 | config LTPC | 41 | config LTPC |
42 | tristate "Apple/Farallon LocalTalk PC support" | 42 | tristate "Apple/Farallon LocalTalk PC support" |
43 | depends on DEV_APPLETALK && (ISA || EISA) && ISA_DMA_API | 43 | depends on DEV_APPLETALK && (ISA || EISA) && ISA_DMA_API && VIRT_TO_BUS |
44 | help | 44 | help |
45 | This allows you to use the AppleTalk PC card to connect to LocalTalk | 45 | This allows you to use the AppleTalk PC card to connect to LocalTalk |
46 | networks. The card is also known as the Farallon PhoneNet PC card. | 46 | networks. The card is also known as the Farallon PhoneNet PC card. |
diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h index ee9f650d5026..7b7053d3c5fa 100644 --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h | |||
@@ -105,8 +105,8 @@ static inline u64 name##_readq(struct bcm_sf2_priv *priv, u32 off) \ | |||
105 | { \ | 105 | { \ |
106 | u32 indir, dir; \ | 106 | u32 indir, dir; \ |
107 | spin_lock(&priv->indir_lock); \ | 107 | spin_lock(&priv->indir_lock); \ |
108 | indir = reg_readl(priv, REG_DIR_DATA_READ); \ | ||
109 | dir = __raw_readl(priv->name + off); \ | 108 | dir = __raw_readl(priv->name + off); \ |
109 | indir = reg_readl(priv, REG_DIR_DATA_READ); \ | ||
110 | spin_unlock(&priv->indir_lock); \ | 110 | spin_unlock(&priv->indir_lock); \ |
111 | return (u64)indir << 32 | dir; \ | 111 | return (u64)indir << 32 | dir; \ |
112 | } \ | 112 | } \ |
diff --git a/drivers/net/ethernet/8390/axnet_cs.c b/drivers/net/ethernet/8390/axnet_cs.c index 7769c05543f1..ec6eac1f8c95 100644 --- a/drivers/net/ethernet/8390/axnet_cs.c +++ b/drivers/net/ethernet/8390/axnet_cs.c | |||
@@ -484,11 +484,8 @@ static int axnet_open(struct net_device *dev) | |||
484 | link->open++; | 484 | link->open++; |
485 | 485 | ||
486 | info->link_status = 0x00; | 486 | info->link_status = 0x00; |
487 | init_timer(&info->watchdog); | 487 | setup_timer(&info->watchdog, ei_watchdog, (u_long)dev); |
488 | info->watchdog.function = ei_watchdog; | 488 | mod_timer(&info->watchdog, jiffies + HZ); |
489 | info->watchdog.data = (u_long)dev; | ||
490 | info->watchdog.expires = jiffies + HZ; | ||
491 | add_timer(&info->watchdog); | ||
492 | 489 | ||
493 | return ax_open(dev); | 490 | return ax_open(dev); |
494 | } /* axnet_open */ | 491 | } /* axnet_open */ |
diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index 9fb7b9d4fd6c..2777289a26c0 100644 --- a/drivers/net/ethernet/8390/pcnet_cs.c +++ b/drivers/net/ethernet/8390/pcnet_cs.c | |||
@@ -918,11 +918,8 @@ static int pcnet_open(struct net_device *dev) | |||
918 | 918 | ||
919 | info->phy_id = info->eth_phy; | 919 | info->phy_id = info->eth_phy; |
920 | info->link_status = 0x00; | 920 | info->link_status = 0x00; |
921 | init_timer(&info->watchdog); | 921 | setup_timer(&info->watchdog, ei_watchdog, (u_long)dev); |
922 | info->watchdog.function = ei_watchdog; | 922 | mod_timer(&info->watchdog, jiffies + HZ); |
923 | info->watchdog.data = (u_long)dev; | ||
924 | info->watchdog.expires = jiffies + HZ; | ||
925 | add_timer(&info->watchdog); | ||
926 | 923 | ||
927 | return ei_open(dev); | 924 | return ei_open(dev); |
928 | } /* pcnet_open */ | 925 | } /* pcnet_open */ |
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 760c72c6e2ac..6725dc00750b 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c | |||
@@ -376,7 +376,8 @@ static int tse_rx(struct altera_tse_private *priv, int limit) | |||
376 | u16 pktlength; | 376 | u16 pktlength; |
377 | u16 pktstatus; | 377 | u16 pktstatus; |
378 | 378 | ||
379 | while ((rxstatus = priv->dmaops->get_rx_status(priv)) != 0) { | 379 | while (((rxstatus = priv->dmaops->get_rx_status(priv)) != 0) && |
380 | (count < limit)) { | ||
380 | pktstatus = rxstatus >> 16; | 381 | pktstatus = rxstatus >> 16; |
381 | pktlength = rxstatus & 0xffff; | 382 | pktlength = rxstatus & 0xffff; |
382 | 383 | ||
@@ -491,28 +492,27 @@ static int tse_poll(struct napi_struct *napi, int budget) | |||
491 | struct altera_tse_private *priv = | 492 | struct altera_tse_private *priv = |
492 | container_of(napi, struct altera_tse_private, napi); | 493 | container_of(napi, struct altera_tse_private, napi); |
493 | int rxcomplete = 0; | 494 | int rxcomplete = 0; |
494 | int txcomplete = 0; | ||
495 | unsigned long int flags; | 495 | unsigned long int flags; |
496 | 496 | ||
497 | txcomplete = tse_tx_complete(priv); | 497 | tse_tx_complete(priv); |
498 | 498 | ||
499 | rxcomplete = tse_rx(priv, budget); | 499 | rxcomplete = tse_rx(priv, budget); |
500 | 500 | ||
501 | if (rxcomplete >= budget || txcomplete > 0) | 501 | if (rxcomplete < budget) { |
502 | return rxcomplete; | ||
503 | 502 | ||
504 | napi_gro_flush(napi, false); | 503 | napi_gro_flush(napi, false); |
505 | __napi_complete(napi); | 504 | __napi_complete(napi); |
506 | 505 | ||
507 | netdev_dbg(priv->dev, | 506 | netdev_dbg(priv->dev, |
508 | "NAPI Complete, did %d packets with budget %d\n", | 507 | "NAPI Complete, did %d packets with budget %d\n", |
509 | txcomplete+rxcomplete, budget); | 508 | rxcomplete, budget); |
510 | 509 | ||
511 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); | 510 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); |
512 | priv->dmaops->enable_rxirq(priv); | 511 | priv->dmaops->enable_rxirq(priv); |
513 | priv->dmaops->enable_txirq(priv); | 512 | priv->dmaops->enable_txirq(priv); |
514 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); | 513 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); |
515 | return rxcomplete + txcomplete; | 514 | } |
515 | return rxcomplete; | ||
516 | } | 516 | } |
517 | 517 | ||
518 | /* DMA TX & RX FIFO interrupt routing | 518 | /* DMA TX & RX FIFO interrupt routing |
@@ -521,7 +521,6 @@ static irqreturn_t altera_isr(int irq, void *dev_id) | |||
521 | { | 521 | { |
522 | struct net_device *dev = dev_id; | 522 | struct net_device *dev = dev_id; |
523 | struct altera_tse_private *priv; | 523 | struct altera_tse_private *priv; |
524 | unsigned long int flags; | ||
525 | 524 | ||
526 | if (unlikely(!dev)) { | 525 | if (unlikely(!dev)) { |
527 | pr_err("%s: invalid dev pointer\n", __func__); | 526 | pr_err("%s: invalid dev pointer\n", __func__); |
@@ -529,20 +528,20 @@ static irqreturn_t altera_isr(int irq, void *dev_id) | |||
529 | } | 528 | } |
530 | priv = netdev_priv(dev); | 529 | priv = netdev_priv(dev); |
531 | 530 | ||
532 | /* turn off desc irqs and enable napi rx */ | 531 | spin_lock(&priv->rxdma_irq_lock); |
533 | spin_lock_irqsave(&priv->rxdma_irq_lock, flags); | 532 | /* reset IRQs */ |
533 | priv->dmaops->clear_rxirq(priv); | ||
534 | priv->dmaops->clear_txirq(priv); | ||
535 | spin_unlock(&priv->rxdma_irq_lock); | ||
534 | 536 | ||
535 | if (likely(napi_schedule_prep(&priv->napi))) { | 537 | if (likely(napi_schedule_prep(&priv->napi))) { |
538 | spin_lock(&priv->rxdma_irq_lock); | ||
536 | priv->dmaops->disable_rxirq(priv); | 539 | priv->dmaops->disable_rxirq(priv); |
537 | priv->dmaops->disable_txirq(priv); | 540 | priv->dmaops->disable_txirq(priv); |
541 | spin_unlock(&priv->rxdma_irq_lock); | ||
538 | __napi_schedule(&priv->napi); | 542 | __napi_schedule(&priv->napi); |
539 | } | 543 | } |
540 | 544 | ||
541 | /* reset IRQs */ | ||
542 | priv->dmaops->clear_rxirq(priv); | ||
543 | priv->dmaops->clear_txirq(priv); | ||
544 | |||
545 | spin_unlock_irqrestore(&priv->rxdma_irq_lock, flags); | ||
546 | 545 | ||
547 | return IRQ_HANDLED; | 546 | return IRQ_HANDLED; |
548 | } | 547 | } |
@@ -1399,7 +1398,7 @@ static int altera_tse_probe(struct platform_device *pdev) | |||
1399 | } | 1398 | } |
1400 | 1399 | ||
1401 | if (of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth", | 1400 | if (of_property_read_u32(pdev->dev.of_node, "tx-fifo-depth", |
1402 | &priv->rx_fifo_depth)) { | 1401 | &priv->tx_fifo_depth)) { |
1403 | dev_err(&pdev->dev, "cannot obtain tx-fifo-depth\n"); | 1402 | dev_err(&pdev->dev, "cannot obtain tx-fifo-depth\n"); |
1404 | ret = -ENXIO; | 1403 | ret = -ENXIO; |
1405 | goto err_free_netdev; | 1404 | goto err_free_netdev; |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index b93d4404d975..885b02b5be07 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -609,6 +609,68 @@ static void xgbe_napi_disable(struct xgbe_prv_data *pdata, unsigned int del) | |||
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
612 | static int xgbe_request_irqs(struct xgbe_prv_data *pdata) | ||
613 | { | ||
614 | struct xgbe_channel *channel; | ||
615 | struct net_device *netdev = pdata->netdev; | ||
616 | unsigned int i; | ||
617 | int ret; | ||
618 | |||
619 | ret = devm_request_irq(pdata->dev, pdata->dev_irq, xgbe_isr, 0, | ||
620 | netdev->name, pdata); | ||
621 | if (ret) { | ||
622 | netdev_alert(netdev, "error requesting irq %d\n", | ||
623 | pdata->dev_irq); | ||
624 | return ret; | ||
625 | } | ||
626 | |||
627 | if (!pdata->per_channel_irq) | ||
628 | return 0; | ||
629 | |||
630 | channel = pdata->channel; | ||
631 | for (i = 0; i < pdata->channel_count; i++, channel++) { | ||
632 | snprintf(channel->dma_irq_name, | ||
633 | sizeof(channel->dma_irq_name) - 1, | ||
634 | "%s-TxRx-%u", netdev_name(netdev), | ||
635 | channel->queue_index); | ||
636 | |||
637 | ret = devm_request_irq(pdata->dev, channel->dma_irq, | ||
638 | xgbe_dma_isr, 0, | ||
639 | channel->dma_irq_name, channel); | ||
640 | if (ret) { | ||
641 | netdev_alert(netdev, "error requesting irq %d\n", | ||
642 | channel->dma_irq); | ||
643 | goto err_irq; | ||
644 | } | ||
645 | } | ||
646 | |||
647 | return 0; | ||
648 | |||
649 | err_irq: | ||
650 | /* Using an unsigned int, 'i' will go to UINT_MAX and exit */ | ||
651 | for (i--, channel--; i < pdata->channel_count; i--, channel--) | ||
652 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
653 | |||
654 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
655 | |||
656 | return ret; | ||
657 | } | ||
658 | |||
659 | static void xgbe_free_irqs(struct xgbe_prv_data *pdata) | ||
660 | { | ||
661 | struct xgbe_channel *channel; | ||
662 | unsigned int i; | ||
663 | |||
664 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
665 | |||
666 | if (!pdata->per_channel_irq) | ||
667 | return; | ||
668 | |||
669 | channel = pdata->channel; | ||
670 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
671 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
672 | } | ||
673 | |||
612 | void xgbe_init_tx_coalesce(struct xgbe_prv_data *pdata) | 674 | void xgbe_init_tx_coalesce(struct xgbe_prv_data *pdata) |
613 | { | 675 | { |
614 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 676 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
@@ -810,20 +872,20 @@ int xgbe_powerdown(struct net_device *netdev, unsigned int caller) | |||
810 | return -EINVAL; | 872 | return -EINVAL; |
811 | } | 873 | } |
812 | 874 | ||
813 | phy_stop(pdata->phydev); | ||
814 | |||
815 | spin_lock_irqsave(&pdata->lock, flags); | 875 | spin_lock_irqsave(&pdata->lock, flags); |
816 | 876 | ||
817 | if (caller == XGMAC_DRIVER_CONTEXT) | 877 | if (caller == XGMAC_DRIVER_CONTEXT) |
818 | netif_device_detach(netdev); | 878 | netif_device_detach(netdev); |
819 | 879 | ||
820 | netif_tx_stop_all_queues(netdev); | 880 | netif_tx_stop_all_queues(netdev); |
821 | xgbe_napi_disable(pdata, 0); | ||
822 | 881 | ||
823 | /* Powerdown Tx/Rx */ | ||
824 | hw_if->powerdown_tx(pdata); | 882 | hw_if->powerdown_tx(pdata); |
825 | hw_if->powerdown_rx(pdata); | 883 | hw_if->powerdown_rx(pdata); |
826 | 884 | ||
885 | xgbe_napi_disable(pdata, 0); | ||
886 | |||
887 | phy_stop(pdata->phydev); | ||
888 | |||
827 | pdata->power_down = 1; | 889 | pdata->power_down = 1; |
828 | 890 | ||
829 | spin_unlock_irqrestore(&pdata->lock, flags); | 891 | spin_unlock_irqrestore(&pdata->lock, flags); |
@@ -854,14 +916,14 @@ int xgbe_powerup(struct net_device *netdev, unsigned int caller) | |||
854 | 916 | ||
855 | phy_start(pdata->phydev); | 917 | phy_start(pdata->phydev); |
856 | 918 | ||
857 | /* Enable Tx/Rx */ | 919 | xgbe_napi_enable(pdata, 0); |
920 | |||
858 | hw_if->powerup_tx(pdata); | 921 | hw_if->powerup_tx(pdata); |
859 | hw_if->powerup_rx(pdata); | 922 | hw_if->powerup_rx(pdata); |
860 | 923 | ||
861 | if (caller == XGMAC_DRIVER_CONTEXT) | 924 | if (caller == XGMAC_DRIVER_CONTEXT) |
862 | netif_device_attach(netdev); | 925 | netif_device_attach(netdev); |
863 | 926 | ||
864 | xgbe_napi_enable(pdata, 0); | ||
865 | netif_tx_start_all_queues(netdev); | 927 | netif_tx_start_all_queues(netdev); |
866 | 928 | ||
867 | spin_unlock_irqrestore(&pdata->lock, flags); | 929 | spin_unlock_irqrestore(&pdata->lock, flags); |
@@ -875,6 +937,7 @@ static int xgbe_start(struct xgbe_prv_data *pdata) | |||
875 | { | 937 | { |
876 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 938 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
877 | struct net_device *netdev = pdata->netdev; | 939 | struct net_device *netdev = pdata->netdev; |
940 | int ret; | ||
878 | 941 | ||
879 | DBGPR("-->xgbe_start\n"); | 942 | DBGPR("-->xgbe_start\n"); |
880 | 943 | ||
@@ -884,17 +947,31 @@ static int xgbe_start(struct xgbe_prv_data *pdata) | |||
884 | 947 | ||
885 | phy_start(pdata->phydev); | 948 | phy_start(pdata->phydev); |
886 | 949 | ||
950 | xgbe_napi_enable(pdata, 1); | ||
951 | |||
952 | ret = xgbe_request_irqs(pdata); | ||
953 | if (ret) | ||
954 | goto err_napi; | ||
955 | |||
887 | hw_if->enable_tx(pdata); | 956 | hw_if->enable_tx(pdata); |
888 | hw_if->enable_rx(pdata); | 957 | hw_if->enable_rx(pdata); |
889 | 958 | ||
890 | xgbe_init_tx_timers(pdata); | 959 | xgbe_init_tx_timers(pdata); |
891 | 960 | ||
892 | xgbe_napi_enable(pdata, 1); | ||
893 | netif_tx_start_all_queues(netdev); | 961 | netif_tx_start_all_queues(netdev); |
894 | 962 | ||
895 | DBGPR("<--xgbe_start\n"); | 963 | DBGPR("<--xgbe_start\n"); |
896 | 964 | ||
897 | return 0; | 965 | return 0; |
966 | |||
967 | err_napi: | ||
968 | xgbe_napi_disable(pdata, 1); | ||
969 | |||
970 | phy_stop(pdata->phydev); | ||
971 | |||
972 | hw_if->exit(pdata); | ||
973 | |||
974 | return ret; | ||
898 | } | 975 | } |
899 | 976 | ||
900 | static void xgbe_stop(struct xgbe_prv_data *pdata) | 977 | static void xgbe_stop(struct xgbe_prv_data *pdata) |
@@ -907,16 +984,21 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) | |||
907 | 984 | ||
908 | DBGPR("-->xgbe_stop\n"); | 985 | DBGPR("-->xgbe_stop\n"); |
909 | 986 | ||
910 | phy_stop(pdata->phydev); | ||
911 | |||
912 | netif_tx_stop_all_queues(netdev); | 987 | netif_tx_stop_all_queues(netdev); |
913 | xgbe_napi_disable(pdata, 1); | ||
914 | 988 | ||
915 | xgbe_stop_tx_timers(pdata); | 989 | xgbe_stop_tx_timers(pdata); |
916 | 990 | ||
917 | hw_if->disable_tx(pdata); | 991 | hw_if->disable_tx(pdata); |
918 | hw_if->disable_rx(pdata); | 992 | hw_if->disable_rx(pdata); |
919 | 993 | ||
994 | xgbe_free_irqs(pdata); | ||
995 | |||
996 | xgbe_napi_disable(pdata, 1); | ||
997 | |||
998 | phy_stop(pdata->phydev); | ||
999 | |||
1000 | hw_if->exit(pdata); | ||
1001 | |||
920 | channel = pdata->channel; | 1002 | channel = pdata->channel; |
921 | for (i = 0; i < pdata->channel_count; i++, channel++) { | 1003 | for (i = 0; i < pdata->channel_count; i++, channel++) { |
922 | if (!channel->tx_ring) | 1004 | if (!channel->tx_ring) |
@@ -931,10 +1013,6 @@ static void xgbe_stop(struct xgbe_prv_data *pdata) | |||
931 | 1013 | ||
932 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata) | 1014 | static void xgbe_restart_dev(struct xgbe_prv_data *pdata) |
933 | { | 1015 | { |
934 | struct xgbe_channel *channel; | ||
935 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
936 | unsigned int i; | ||
937 | |||
938 | DBGPR("-->xgbe_restart_dev\n"); | 1016 | DBGPR("-->xgbe_restart_dev\n"); |
939 | 1017 | ||
940 | /* If not running, "restart" will happen on open */ | 1018 | /* If not running, "restart" will happen on open */ |
@@ -942,19 +1020,10 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata) | |||
942 | return; | 1020 | return; |
943 | 1021 | ||
944 | xgbe_stop(pdata); | 1022 | xgbe_stop(pdata); |
945 | synchronize_irq(pdata->dev_irq); | ||
946 | if (pdata->per_channel_irq) { | ||
947 | channel = pdata->channel; | ||
948 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
949 | synchronize_irq(channel->dma_irq); | ||
950 | } | ||
951 | 1023 | ||
952 | xgbe_free_tx_data(pdata); | 1024 | xgbe_free_tx_data(pdata); |
953 | xgbe_free_rx_data(pdata); | 1025 | xgbe_free_rx_data(pdata); |
954 | 1026 | ||
955 | /* Issue software reset to device */ | ||
956 | hw_if->exit(pdata); | ||
957 | |||
958 | xgbe_start(pdata); | 1027 | xgbe_start(pdata); |
959 | 1028 | ||
960 | DBGPR("<--xgbe_restart_dev\n"); | 1029 | DBGPR("<--xgbe_restart_dev\n"); |
@@ -1283,10 +1352,7 @@ static void xgbe_packet_info(struct xgbe_prv_data *pdata, | |||
1283 | static int xgbe_open(struct net_device *netdev) | 1352 | static int xgbe_open(struct net_device *netdev) |
1284 | { | 1353 | { |
1285 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1354 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
1286 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
1287 | struct xgbe_desc_if *desc_if = &pdata->desc_if; | 1355 | struct xgbe_desc_if *desc_if = &pdata->desc_if; |
1288 | struct xgbe_channel *channel = NULL; | ||
1289 | unsigned int i = 0; | ||
1290 | int ret; | 1356 | int ret; |
1291 | 1357 | ||
1292 | DBGPR("-->xgbe_open\n"); | 1358 | DBGPR("-->xgbe_open\n"); |
@@ -1329,55 +1395,14 @@ static int xgbe_open(struct net_device *netdev) | |||
1329 | INIT_WORK(&pdata->restart_work, xgbe_restart); | 1395 | INIT_WORK(&pdata->restart_work, xgbe_restart); |
1330 | INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp); | 1396 | INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp); |
1331 | 1397 | ||
1332 | /* Request interrupts */ | ||
1333 | ret = devm_request_irq(pdata->dev, pdata->dev_irq, xgbe_isr, 0, | ||
1334 | netdev->name, pdata); | ||
1335 | if (ret) { | ||
1336 | netdev_alert(netdev, "error requesting irq %d\n", | ||
1337 | pdata->dev_irq); | ||
1338 | goto err_rings; | ||
1339 | } | ||
1340 | |||
1341 | if (pdata->per_channel_irq) { | ||
1342 | channel = pdata->channel; | ||
1343 | for (i = 0; i < pdata->channel_count; i++, channel++) { | ||
1344 | snprintf(channel->dma_irq_name, | ||
1345 | sizeof(channel->dma_irq_name) - 1, | ||
1346 | "%s-TxRx-%u", netdev_name(netdev), | ||
1347 | channel->queue_index); | ||
1348 | |||
1349 | ret = devm_request_irq(pdata->dev, channel->dma_irq, | ||
1350 | xgbe_dma_isr, 0, | ||
1351 | channel->dma_irq_name, channel); | ||
1352 | if (ret) { | ||
1353 | netdev_alert(netdev, | ||
1354 | "error requesting irq %d\n", | ||
1355 | channel->dma_irq); | ||
1356 | goto err_irq; | ||
1357 | } | ||
1358 | } | ||
1359 | } | ||
1360 | |||
1361 | ret = xgbe_start(pdata); | 1398 | ret = xgbe_start(pdata); |
1362 | if (ret) | 1399 | if (ret) |
1363 | goto err_start; | 1400 | goto err_rings; |
1364 | 1401 | ||
1365 | DBGPR("<--xgbe_open\n"); | 1402 | DBGPR("<--xgbe_open\n"); |
1366 | 1403 | ||
1367 | return 0; | 1404 | return 0; |
1368 | 1405 | ||
1369 | err_start: | ||
1370 | hw_if->exit(pdata); | ||
1371 | |||
1372 | err_irq: | ||
1373 | if (pdata->per_channel_irq) { | ||
1374 | /* Using an unsigned int, 'i' will go to UINT_MAX and exit */ | ||
1375 | for (i--, channel--; i < pdata->channel_count; i--, channel--) | ||
1376 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
1377 | } | ||
1378 | |||
1379 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
1380 | |||
1381 | err_rings: | 1406 | err_rings: |
1382 | desc_if->free_ring_resources(pdata); | 1407 | desc_if->free_ring_resources(pdata); |
1383 | 1408 | ||
@@ -1399,30 +1424,16 @@ err_phy_init: | |||
1399 | static int xgbe_close(struct net_device *netdev) | 1424 | static int xgbe_close(struct net_device *netdev) |
1400 | { | 1425 | { |
1401 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1426 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
1402 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | ||
1403 | struct xgbe_desc_if *desc_if = &pdata->desc_if; | 1427 | struct xgbe_desc_if *desc_if = &pdata->desc_if; |
1404 | struct xgbe_channel *channel; | ||
1405 | unsigned int i; | ||
1406 | 1428 | ||
1407 | DBGPR("-->xgbe_close\n"); | 1429 | DBGPR("-->xgbe_close\n"); |
1408 | 1430 | ||
1409 | /* Stop the device */ | 1431 | /* Stop the device */ |
1410 | xgbe_stop(pdata); | 1432 | xgbe_stop(pdata); |
1411 | 1433 | ||
1412 | /* Issue software reset to device */ | ||
1413 | hw_if->exit(pdata); | ||
1414 | |||
1415 | /* Free the ring descriptors and buffers */ | 1434 | /* Free the ring descriptors and buffers */ |
1416 | desc_if->free_ring_resources(pdata); | 1435 | desc_if->free_ring_resources(pdata); |
1417 | 1436 | ||
1418 | /* Release the interrupts */ | ||
1419 | devm_free_irq(pdata->dev, pdata->dev_irq, pdata); | ||
1420 | if (pdata->per_channel_irq) { | ||
1421 | channel = pdata->channel; | ||
1422 | for (i = 0; i < pdata->channel_count; i++, channel++) | ||
1423 | devm_free_irq(pdata->dev, channel->dma_irq, channel); | ||
1424 | } | ||
1425 | |||
1426 | /* Free the channel and ring structures */ | 1437 | /* Free the channel and ring structures */ |
1427 | xgbe_free_channels(pdata); | 1438 | xgbe_free_channels(pdata); |
1428 | 1439 | ||
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 5b308a4a4d0e..783543ad1fcf 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -274,9 +274,9 @@ static const struct bcm_sysport_stats bcm_sysport_gstrings_stats[] = { | |||
274 | /* RBUF misc statistics */ | 274 | /* RBUF misc statistics */ |
275 | STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR), | 275 | STAT_RBUF("rbuf_ovflow_cnt", mib.rbuf_ovflow_cnt, RBUF_OVFL_DISC_CNTR), |
276 | STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR), | 276 | STAT_RBUF("rbuf_err_cnt", mib.rbuf_err_cnt, RBUF_ERR_PKT_CNTR), |
277 | STAT_MIB_RX("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), | 277 | STAT_MIB_SOFT("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), |
278 | STAT_MIB_RX("rx_dma_failed", mib.rx_dma_failed), | 278 | STAT_MIB_SOFT("rx_dma_failed", mib.rx_dma_failed), |
279 | STAT_MIB_TX("tx_dma_failed", mib.tx_dma_failed), | 279 | STAT_MIB_SOFT("tx_dma_failed", mib.tx_dma_failed), |
280 | }; | 280 | }; |
281 | 281 | ||
282 | #define BCM_SYSPORT_STATS_LEN ARRAY_SIZE(bcm_sysport_gstrings_stats) | 282 | #define BCM_SYSPORT_STATS_LEN ARRAY_SIZE(bcm_sysport_gstrings_stats) |
@@ -345,6 +345,7 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv) | |||
345 | s = &bcm_sysport_gstrings_stats[i]; | 345 | s = &bcm_sysport_gstrings_stats[i]; |
346 | switch (s->type) { | 346 | switch (s->type) { |
347 | case BCM_SYSPORT_STAT_NETDEV: | 347 | case BCM_SYSPORT_STAT_NETDEV: |
348 | case BCM_SYSPORT_STAT_SOFT: | ||
348 | continue; | 349 | continue; |
349 | case BCM_SYSPORT_STAT_MIB_RX: | 350 | case BCM_SYSPORT_STAT_MIB_RX: |
350 | case BCM_SYSPORT_STAT_MIB_TX: | 351 | case BCM_SYSPORT_STAT_MIB_TX: |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h index fc19417d82a5..7e3d87a88c76 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h | |||
@@ -570,6 +570,7 @@ enum bcm_sysport_stat_type { | |||
570 | BCM_SYSPORT_STAT_RUNT, | 570 | BCM_SYSPORT_STAT_RUNT, |
571 | BCM_SYSPORT_STAT_RXCHK, | 571 | BCM_SYSPORT_STAT_RXCHK, |
572 | BCM_SYSPORT_STAT_RBUF, | 572 | BCM_SYSPORT_STAT_RBUF, |
573 | BCM_SYSPORT_STAT_SOFT, | ||
573 | }; | 574 | }; |
574 | 575 | ||
575 | /* Macros to help define ethtool statistics */ | 576 | /* Macros to help define ethtool statistics */ |
@@ -590,6 +591,7 @@ enum bcm_sysport_stat_type { | |||
590 | #define STAT_MIB_RX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_RX) | 591 | #define STAT_MIB_RX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_RX) |
591 | #define STAT_MIB_TX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_TX) | 592 | #define STAT_MIB_TX(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_MIB_TX) |
592 | #define STAT_RUNT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_RUNT) | 593 | #define STAT_RUNT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_RUNT) |
594 | #define STAT_MIB_SOFT(str, m) STAT_MIB(str, m, BCM_SYSPORT_STAT_SOFT) | ||
593 | 595 | ||
594 | #define STAT_RXCHK(str, m, ofs) { \ | 596 | #define STAT_RXCHK(str, m, ofs) { \ |
595 | .stat_string = str, \ | 597 | .stat_string = str, \ |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index ff83c46bc389..6befde61c203 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -487,6 +487,7 @@ enum bcmgenet_stat_type { | |||
487 | BCMGENET_STAT_MIB_TX, | 487 | BCMGENET_STAT_MIB_TX, |
488 | BCMGENET_STAT_RUNT, | 488 | BCMGENET_STAT_RUNT, |
489 | BCMGENET_STAT_MISC, | 489 | BCMGENET_STAT_MISC, |
490 | BCMGENET_STAT_SOFT, | ||
490 | }; | 491 | }; |
491 | 492 | ||
492 | struct bcmgenet_stats { | 493 | struct bcmgenet_stats { |
@@ -515,6 +516,7 @@ struct bcmgenet_stats { | |||
515 | #define STAT_GENET_MIB_RX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_RX) | 516 | #define STAT_GENET_MIB_RX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_RX) |
516 | #define STAT_GENET_MIB_TX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_TX) | 517 | #define STAT_GENET_MIB_TX(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_MIB_TX) |
517 | #define STAT_GENET_RUNT(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_RUNT) | 518 | #define STAT_GENET_RUNT(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_RUNT) |
519 | #define STAT_GENET_SOFT_MIB(str, m) STAT_GENET_MIB(str, m, BCMGENET_STAT_SOFT) | ||
518 | 520 | ||
519 | #define STAT_GENET_MISC(str, m, offset) { \ | 521 | #define STAT_GENET_MISC(str, m, offset) { \ |
520 | .stat_string = str, \ | 522 | .stat_string = str, \ |
@@ -614,9 +616,9 @@ static const struct bcmgenet_stats bcmgenet_gstrings_stats[] = { | |||
614 | UMAC_RBUF_OVFL_CNT), | 616 | UMAC_RBUF_OVFL_CNT), |
615 | STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT), | 617 | STAT_GENET_MISC("rbuf_err_cnt", mib.rbuf_err_cnt, UMAC_RBUF_ERR_CNT), |
616 | STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT), | 618 | STAT_GENET_MISC("mdf_err_cnt", mib.mdf_err_cnt, UMAC_MDF_ERR_CNT), |
617 | STAT_GENET_MIB_RX("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), | 619 | STAT_GENET_SOFT_MIB("alloc_rx_buff_failed", mib.alloc_rx_buff_failed), |
618 | STAT_GENET_MIB_RX("rx_dma_failed", mib.rx_dma_failed), | 620 | STAT_GENET_SOFT_MIB("rx_dma_failed", mib.rx_dma_failed), |
619 | STAT_GENET_MIB_TX("tx_dma_failed", mib.tx_dma_failed), | 621 | STAT_GENET_SOFT_MIB("tx_dma_failed", mib.tx_dma_failed), |
620 | }; | 622 | }; |
621 | 623 | ||
622 | #define BCMGENET_STATS_LEN ARRAY_SIZE(bcmgenet_gstrings_stats) | 624 | #define BCMGENET_STATS_LEN ARRAY_SIZE(bcmgenet_gstrings_stats) |
@@ -668,6 +670,7 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv) | |||
668 | s = &bcmgenet_gstrings_stats[i]; | 670 | s = &bcmgenet_gstrings_stats[i]; |
669 | switch (s->type) { | 671 | switch (s->type) { |
670 | case BCMGENET_STAT_NETDEV: | 672 | case BCMGENET_STAT_NETDEV: |
673 | case BCMGENET_STAT_SOFT: | ||
671 | continue; | 674 | continue; |
672 | case BCMGENET_STAT_MIB_RX: | 675 | case BCMGENET_STAT_MIB_RX: |
673 | case BCMGENET_STAT_MIB_TX: | 676 | case BCMGENET_STAT_MIB_TX: |
@@ -971,13 +974,14 @@ static inline void bcmgenet_tx_ring_int_disable(struct bcmgenet_priv *priv, | |||
971 | } | 974 | } |
972 | 975 | ||
973 | /* Unlocked version of the reclaim routine */ | 976 | /* Unlocked version of the reclaim routine */ |
974 | static void __bcmgenet_tx_reclaim(struct net_device *dev, | 977 | static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, |
975 | struct bcmgenet_tx_ring *ring) | 978 | struct bcmgenet_tx_ring *ring) |
976 | { | 979 | { |
977 | struct bcmgenet_priv *priv = netdev_priv(dev); | 980 | struct bcmgenet_priv *priv = netdev_priv(dev); |
978 | int last_tx_cn, last_c_index, num_tx_bds; | 981 | int last_tx_cn, last_c_index, num_tx_bds; |
979 | struct enet_cb *tx_cb_ptr; | 982 | struct enet_cb *tx_cb_ptr; |
980 | struct netdev_queue *txq; | 983 | struct netdev_queue *txq; |
984 | unsigned int pkts_compl = 0; | ||
981 | unsigned int bds_compl; | 985 | unsigned int bds_compl; |
982 | unsigned int c_index; | 986 | unsigned int c_index; |
983 | 987 | ||
@@ -1005,6 +1009,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
1005 | tx_cb_ptr = ring->cbs + last_c_index; | 1009 | tx_cb_ptr = ring->cbs + last_c_index; |
1006 | bds_compl = 0; | 1010 | bds_compl = 0; |
1007 | if (tx_cb_ptr->skb) { | 1011 | if (tx_cb_ptr->skb) { |
1012 | pkts_compl++; | ||
1008 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; | 1013 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; |
1009 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; | 1014 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
1010 | dma_unmap_single(&dev->dev, | 1015 | dma_unmap_single(&dev->dev, |
@@ -1028,23 +1033,45 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
1028 | last_c_index &= (num_tx_bds - 1); | 1033 | last_c_index &= (num_tx_bds - 1); |
1029 | } | 1034 | } |
1030 | 1035 | ||
1031 | if (ring->free_bds > (MAX_SKB_FRAGS + 1)) | 1036 | if (ring->free_bds > (MAX_SKB_FRAGS + 1)) { |
1032 | ring->int_disable(priv, ring); | 1037 | if (netif_tx_queue_stopped(txq)) |
1033 | 1038 | netif_tx_wake_queue(txq); | |
1034 | if (netif_tx_queue_stopped(txq)) | 1039 | } |
1035 | netif_tx_wake_queue(txq); | ||
1036 | 1040 | ||
1037 | ring->c_index = c_index; | 1041 | ring->c_index = c_index; |
1042 | |||
1043 | return pkts_compl; | ||
1038 | } | 1044 | } |
1039 | 1045 | ||
1040 | static void bcmgenet_tx_reclaim(struct net_device *dev, | 1046 | static unsigned int bcmgenet_tx_reclaim(struct net_device *dev, |
1041 | struct bcmgenet_tx_ring *ring) | 1047 | struct bcmgenet_tx_ring *ring) |
1042 | { | 1048 | { |
1049 | unsigned int released; | ||
1043 | unsigned long flags; | 1050 | unsigned long flags; |
1044 | 1051 | ||
1045 | spin_lock_irqsave(&ring->lock, flags); | 1052 | spin_lock_irqsave(&ring->lock, flags); |
1046 | __bcmgenet_tx_reclaim(dev, ring); | 1053 | released = __bcmgenet_tx_reclaim(dev, ring); |
1047 | spin_unlock_irqrestore(&ring->lock, flags); | 1054 | spin_unlock_irqrestore(&ring->lock, flags); |
1055 | |||
1056 | return released; | ||
1057 | } | ||
1058 | |||
1059 | static int bcmgenet_tx_poll(struct napi_struct *napi, int budget) | ||
1060 | { | ||
1061 | struct bcmgenet_tx_ring *ring = | ||
1062 | container_of(napi, struct bcmgenet_tx_ring, napi); | ||
1063 | unsigned int work_done = 0; | ||
1064 | |||
1065 | work_done = bcmgenet_tx_reclaim(ring->priv->dev, ring); | ||
1066 | |||
1067 | if (work_done == 0) { | ||
1068 | napi_complete(napi); | ||
1069 | ring->int_enable(ring->priv, ring); | ||
1070 | |||
1071 | return 0; | ||
1072 | } | ||
1073 | |||
1074 | return budget; | ||
1048 | } | 1075 | } |
1049 | 1076 | ||
1050 | static void bcmgenet_tx_reclaim_all(struct net_device *dev) | 1077 | static void bcmgenet_tx_reclaim_all(struct net_device *dev) |
@@ -1302,10 +1329,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1302 | bcmgenet_tdma_ring_writel(priv, ring->index, | 1329 | bcmgenet_tdma_ring_writel(priv, ring->index, |
1303 | ring->prod_index, TDMA_PROD_INDEX); | 1330 | ring->prod_index, TDMA_PROD_INDEX); |
1304 | 1331 | ||
1305 | if (ring->free_bds <= (MAX_SKB_FRAGS + 1)) { | 1332 | if (ring->free_bds <= (MAX_SKB_FRAGS + 1)) |
1306 | netif_tx_stop_queue(txq); | 1333 | netif_tx_stop_queue(txq); |
1307 | ring->int_enable(priv, ring); | ||
1308 | } | ||
1309 | 1334 | ||
1310 | out: | 1335 | out: |
1311 | spin_unlock_irqrestore(&ring->lock, flags); | 1336 | spin_unlock_irqrestore(&ring->lock, flags); |
@@ -1621,6 +1646,7 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
1621 | struct device *kdev = &priv->pdev->dev; | 1646 | struct device *kdev = &priv->pdev->dev; |
1622 | int ret; | 1647 | int ret; |
1623 | u32 reg, cpu_mask_clear; | 1648 | u32 reg, cpu_mask_clear; |
1649 | int index; | ||
1624 | 1650 | ||
1625 | dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n"); | 1651 | dev_dbg(&priv->pdev->dev, "bcmgenet: init_umac\n"); |
1626 | 1652 | ||
@@ -1647,7 +1673,7 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
1647 | 1673 | ||
1648 | bcmgenet_intr_disable(priv); | 1674 | bcmgenet_intr_disable(priv); |
1649 | 1675 | ||
1650 | cpu_mask_clear = UMAC_IRQ_RXDMA_BDONE; | 1676 | cpu_mask_clear = UMAC_IRQ_RXDMA_BDONE | UMAC_IRQ_TXDMA_BDONE; |
1651 | 1677 | ||
1652 | dev_dbg(kdev, "%s:Enabling RXDMA_BDONE interrupt\n", __func__); | 1678 | dev_dbg(kdev, "%s:Enabling RXDMA_BDONE interrupt\n", __func__); |
1653 | 1679 | ||
@@ -1674,6 +1700,10 @@ static int init_umac(struct bcmgenet_priv *priv) | |||
1674 | 1700 | ||
1675 | bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, INTRL2_CPU_MASK_CLEAR); | 1701 | bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, INTRL2_CPU_MASK_CLEAR); |
1676 | 1702 | ||
1703 | for (index = 0; index < priv->hw_params->tx_queues; index++) | ||
1704 | bcmgenet_intrl2_1_writel(priv, (1 << index), | ||
1705 | INTRL2_CPU_MASK_CLEAR); | ||
1706 | |||
1677 | /* Enable rx/tx engine.*/ | 1707 | /* Enable rx/tx engine.*/ |
1678 | dev_dbg(kdev, "done init umac\n"); | 1708 | dev_dbg(kdev, "done init umac\n"); |
1679 | 1709 | ||
@@ -1693,6 +1723,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, | |||
1693 | unsigned int first_bd; | 1723 | unsigned int first_bd; |
1694 | 1724 | ||
1695 | spin_lock_init(&ring->lock); | 1725 | spin_lock_init(&ring->lock); |
1726 | ring->priv = priv; | ||
1727 | netif_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, 64); | ||
1696 | ring->index = index; | 1728 | ring->index = index; |
1697 | if (index == DESC_INDEX) { | 1729 | if (index == DESC_INDEX) { |
1698 | ring->queue = 0; | 1730 | ring->queue = 0; |
@@ -1738,6 +1770,17 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, | |||
1738 | TDMA_WRITE_PTR); | 1770 | TDMA_WRITE_PTR); |
1739 | bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1, | 1771 | bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1, |
1740 | DMA_END_ADDR); | 1772 | DMA_END_ADDR); |
1773 | |||
1774 | napi_enable(&ring->napi); | ||
1775 | } | ||
1776 | |||
1777 | static void bcmgenet_fini_tx_ring(struct bcmgenet_priv *priv, | ||
1778 | unsigned int index) | ||
1779 | { | ||
1780 | struct bcmgenet_tx_ring *ring = &priv->tx_rings[index]; | ||
1781 | |||
1782 | napi_disable(&ring->napi); | ||
1783 | netif_napi_del(&ring->napi); | ||
1741 | } | 1784 | } |
1742 | 1785 | ||
1743 | /* Initialize a RDMA ring */ | 1786 | /* Initialize a RDMA ring */ |
@@ -1907,7 +1950,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | |||
1907 | return ret; | 1950 | return ret; |
1908 | } | 1951 | } |
1909 | 1952 | ||
1910 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | 1953 | static void __bcmgenet_fini_dma(struct bcmgenet_priv *priv) |
1911 | { | 1954 | { |
1912 | int i; | 1955 | int i; |
1913 | 1956 | ||
@@ -1926,6 +1969,18 @@ static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | |||
1926 | kfree(priv->tx_cbs); | 1969 | kfree(priv->tx_cbs); |
1927 | } | 1970 | } |
1928 | 1971 | ||
1972 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | ||
1973 | { | ||
1974 | int i; | ||
1975 | |||
1976 | bcmgenet_fini_tx_ring(priv, DESC_INDEX); | ||
1977 | |||
1978 | for (i = 0; i < priv->hw_params->tx_queues; i++) | ||
1979 | bcmgenet_fini_tx_ring(priv, i); | ||
1980 | |||
1981 | __bcmgenet_fini_dma(priv); | ||
1982 | } | ||
1983 | |||
1929 | /* init_edma: Initialize DMA control register */ | 1984 | /* init_edma: Initialize DMA control register */ |
1930 | static int bcmgenet_init_dma(struct bcmgenet_priv *priv) | 1985 | static int bcmgenet_init_dma(struct bcmgenet_priv *priv) |
1931 | { | 1986 | { |
@@ -1952,7 +2007,7 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) | |||
1952 | priv->tx_cbs = kcalloc(priv->num_tx_bds, sizeof(struct enet_cb), | 2007 | priv->tx_cbs = kcalloc(priv->num_tx_bds, sizeof(struct enet_cb), |
1953 | GFP_KERNEL); | 2008 | GFP_KERNEL); |
1954 | if (!priv->tx_cbs) { | 2009 | if (!priv->tx_cbs) { |
1955 | bcmgenet_fini_dma(priv); | 2010 | __bcmgenet_fini_dma(priv); |
1956 | return -ENOMEM; | 2011 | return -ENOMEM; |
1957 | } | 2012 | } |
1958 | 2013 | ||
@@ -1975,9 +2030,6 @@ static int bcmgenet_poll(struct napi_struct *napi, int budget) | |||
1975 | struct bcmgenet_priv, napi); | 2030 | struct bcmgenet_priv, napi); |
1976 | unsigned int work_done; | 2031 | unsigned int work_done; |
1977 | 2032 | ||
1978 | /* tx reclaim */ | ||
1979 | bcmgenet_tx_reclaim(priv->dev, &priv->tx_rings[DESC_INDEX]); | ||
1980 | |||
1981 | work_done = bcmgenet_desc_rx(priv, budget); | 2033 | work_done = bcmgenet_desc_rx(priv, budget); |
1982 | 2034 | ||
1983 | /* Advancing our consumer index*/ | 2035 | /* Advancing our consumer index*/ |
@@ -2022,28 +2074,34 @@ static void bcmgenet_irq_task(struct work_struct *work) | |||
2022 | static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) | 2074 | static irqreturn_t bcmgenet_isr1(int irq, void *dev_id) |
2023 | { | 2075 | { |
2024 | struct bcmgenet_priv *priv = dev_id; | 2076 | struct bcmgenet_priv *priv = dev_id; |
2077 | struct bcmgenet_tx_ring *ring; | ||
2025 | unsigned int index; | 2078 | unsigned int index; |
2026 | 2079 | ||
2027 | /* Save irq status for bottom-half processing. */ | 2080 | /* Save irq status for bottom-half processing. */ |
2028 | priv->irq1_stat = | 2081 | priv->irq1_stat = |
2029 | bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) & | 2082 | bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_STAT) & |
2030 | ~priv->int1_mask; | 2083 | ~bcmgenet_intrl2_1_readl(priv, INTRL2_CPU_MASK_STATUS); |
2031 | /* clear interrupts */ | 2084 | /* clear interrupts */ |
2032 | bcmgenet_intrl2_1_writel(priv, priv->irq1_stat, INTRL2_CPU_CLEAR); | 2085 | bcmgenet_intrl2_1_writel(priv, priv->irq1_stat, INTRL2_CPU_CLEAR); |
2033 | 2086 | ||
2034 | netif_dbg(priv, intr, priv->dev, | 2087 | netif_dbg(priv, intr, priv->dev, |
2035 | "%s: IRQ=0x%x\n", __func__, priv->irq1_stat); | 2088 | "%s: IRQ=0x%x\n", __func__, priv->irq1_stat); |
2089 | |||
2036 | /* Check the MBDONE interrupts. | 2090 | /* Check the MBDONE interrupts. |
2037 | * packet is done, reclaim descriptors | 2091 | * packet is done, reclaim descriptors |
2038 | */ | 2092 | */ |
2039 | if (priv->irq1_stat & 0x0000ffff) { | 2093 | for (index = 0; index < priv->hw_params->tx_queues; index++) { |
2040 | index = 0; | 2094 | if (!(priv->irq1_stat & BIT(index))) |
2041 | for (index = 0; index < 16; index++) { | 2095 | continue; |
2042 | if (priv->irq1_stat & (1 << index)) | 2096 | |
2043 | bcmgenet_tx_reclaim(priv->dev, | 2097 | ring = &priv->tx_rings[index]; |
2044 | &priv->tx_rings[index]); | 2098 | |
2099 | if (likely(napi_schedule_prep(&ring->napi))) { | ||
2100 | ring->int_disable(priv, ring); | ||
2101 | __napi_schedule(&ring->napi); | ||
2045 | } | 2102 | } |
2046 | } | 2103 | } |
2104 | |||
2047 | return IRQ_HANDLED; | 2105 | return IRQ_HANDLED; |
2048 | } | 2106 | } |
2049 | 2107 | ||
@@ -2075,8 +2133,12 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) | |||
2075 | } | 2133 | } |
2076 | if (priv->irq0_stat & | 2134 | if (priv->irq0_stat & |
2077 | (UMAC_IRQ_TXDMA_BDONE | UMAC_IRQ_TXDMA_PDONE)) { | 2135 | (UMAC_IRQ_TXDMA_BDONE | UMAC_IRQ_TXDMA_PDONE)) { |
2078 | /* Tx reclaim */ | 2136 | struct bcmgenet_tx_ring *ring = &priv->tx_rings[DESC_INDEX]; |
2079 | bcmgenet_tx_reclaim(priv->dev, &priv->tx_rings[DESC_INDEX]); | 2137 | |
2138 | if (likely(napi_schedule_prep(&ring->napi))) { | ||
2139 | ring->int_disable(priv, ring); | ||
2140 | __napi_schedule(&ring->napi); | ||
2141 | } | ||
2080 | } | 2142 | } |
2081 | if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R | | 2143 | if (priv->irq0_stat & (UMAC_IRQ_PHY_DET_R | |
2082 | UMAC_IRQ_PHY_DET_F | | 2144 | UMAC_IRQ_PHY_DET_F | |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index b36ddec0cc0a..0d370d168aee 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
@@ -520,6 +520,7 @@ struct bcmgenet_hw_params { | |||
520 | 520 | ||
521 | struct bcmgenet_tx_ring { | 521 | struct bcmgenet_tx_ring { |
522 | spinlock_t lock; /* ring lock */ | 522 | spinlock_t lock; /* ring lock */ |
523 | struct napi_struct napi; /* NAPI per tx queue */ | ||
523 | unsigned int index; /* ring index */ | 524 | unsigned int index; /* ring index */ |
524 | unsigned int queue; /* queue index */ | 525 | unsigned int queue; /* queue index */ |
525 | struct enet_cb *cbs; /* tx ring buffer control block*/ | 526 | struct enet_cb *cbs; /* tx ring buffer control block*/ |
@@ -534,6 +535,7 @@ struct bcmgenet_tx_ring { | |||
534 | struct bcmgenet_tx_ring *); | 535 | struct bcmgenet_tx_ring *); |
535 | void (*int_disable)(struct bcmgenet_priv *priv, | 536 | void (*int_disable)(struct bcmgenet_priv *priv, |
536 | struct bcmgenet_tx_ring *); | 537 | struct bcmgenet_tx_ring *); |
538 | struct bcmgenet_priv *priv; | ||
537 | }; | 539 | }; |
538 | 540 | ||
539 | /* device context */ | 541 | /* device context */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c index 9062a8434246..c308429dd9c7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c +++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.c | |||
@@ -35,10 +35,10 @@ static inline unsigned int ipv6_clip_hash(struct clip_tbl *d, const u32 *key) | |||
35 | } | 35 | } |
36 | 36 | ||
37 | static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr, | 37 | static unsigned int clip_addr_hash(struct clip_tbl *ctbl, const u32 *addr, |
38 | int addr_len) | 38 | u8 v6) |
39 | { | 39 | { |
40 | return addr_len == 4 ? ipv4_clip_hash(ctbl, addr) : | 40 | return v6 ? ipv6_clip_hash(ctbl, addr) : |
41 | ipv6_clip_hash(ctbl, addr); | 41 | ipv4_clip_hash(ctbl, addr); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int clip6_get_mbox(const struct net_device *dev, | 44 | static int clip6_get_mbox(const struct net_device *dev, |
@@ -78,23 +78,22 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) | |||
78 | struct clip_entry *ce, *cte; | 78 | struct clip_entry *ce, *cte; |
79 | u32 *addr = (u32 *)lip; | 79 | u32 *addr = (u32 *)lip; |
80 | int hash; | 80 | int hash; |
81 | int addr_len; | 81 | int ret = -1; |
82 | int ret = 0; | ||
83 | 82 | ||
84 | if (!ctbl) | 83 | if (!ctbl) |
85 | return 0; | 84 | return 0; |
86 | 85 | ||
87 | if (v6) | 86 | hash = clip_addr_hash(ctbl, addr, v6); |
88 | addr_len = 16; | ||
89 | else | ||
90 | addr_len = 4; | ||
91 | |||
92 | hash = clip_addr_hash(ctbl, addr, addr_len); | ||
93 | 87 | ||
94 | read_lock_bh(&ctbl->lock); | 88 | read_lock_bh(&ctbl->lock); |
95 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | 89 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { |
96 | if (addr_len == cte->addr_len && | 90 | if (cte->addr6.sin6_family == AF_INET6 && v6) |
97 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | 91 | ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, |
92 | sizeof(struct in6_addr)); | ||
93 | else if (cte->addr.sin_family == AF_INET && !v6) | ||
94 | ret = memcmp(lip, (char *)(&cte->addr.sin_addr), | ||
95 | sizeof(struct in_addr)); | ||
96 | if (!ret) { | ||
98 | ce = cte; | 97 | ce = cte; |
99 | read_unlock_bh(&ctbl->lock); | 98 | read_unlock_bh(&ctbl->lock); |
100 | goto found; | 99 | goto found; |
@@ -111,15 +110,20 @@ int cxgb4_clip_get(const struct net_device *dev, const u32 *lip, u8 v6) | |||
111 | spin_lock_init(&ce->lock); | 110 | spin_lock_init(&ce->lock); |
112 | atomic_set(&ce->refcnt, 0); | 111 | atomic_set(&ce->refcnt, 0); |
113 | atomic_dec(&ctbl->nfree); | 112 | atomic_dec(&ctbl->nfree); |
114 | ce->addr_len = addr_len; | ||
115 | memcpy(ce->addr, lip, addr_len); | ||
116 | list_add_tail(&ce->list, &ctbl->hash_list[hash]); | 113 | list_add_tail(&ce->list, &ctbl->hash_list[hash]); |
117 | if (v6) { | 114 | if (v6) { |
115 | ce->addr6.sin6_family = AF_INET6; | ||
116 | memcpy(ce->addr6.sin6_addr.s6_addr, | ||
117 | lip, sizeof(struct in6_addr)); | ||
118 | ret = clip6_get_mbox(dev, (const struct in6_addr *)lip); | 118 | ret = clip6_get_mbox(dev, (const struct in6_addr *)lip); |
119 | if (ret) { | 119 | if (ret) { |
120 | write_unlock_bh(&ctbl->lock); | 120 | write_unlock_bh(&ctbl->lock); |
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | } else { | ||
124 | ce->addr.sin_family = AF_INET; | ||
125 | memcpy((char *)(&ce->addr.sin_addr), lip, | ||
126 | sizeof(struct in_addr)); | ||
123 | } | 127 | } |
124 | } else { | 128 | } else { |
125 | write_unlock_bh(&ctbl->lock); | 129 | write_unlock_bh(&ctbl->lock); |
@@ -140,19 +144,19 @@ void cxgb4_clip_release(const struct net_device *dev, const u32 *lip, u8 v6) | |||
140 | struct clip_entry *ce, *cte; | 144 | struct clip_entry *ce, *cte; |
141 | u32 *addr = (u32 *)lip; | 145 | u32 *addr = (u32 *)lip; |
142 | int hash; | 146 | int hash; |
143 | int addr_len; | 147 | int ret = -1; |
144 | |||
145 | if (v6) | ||
146 | addr_len = 16; | ||
147 | else | ||
148 | addr_len = 4; | ||
149 | 148 | ||
150 | hash = clip_addr_hash(ctbl, addr, addr_len); | 149 | hash = clip_addr_hash(ctbl, addr, v6); |
151 | 150 | ||
152 | read_lock_bh(&ctbl->lock); | 151 | read_lock_bh(&ctbl->lock); |
153 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { | 152 | list_for_each_entry(cte, &ctbl->hash_list[hash], list) { |
154 | if (addr_len == cte->addr_len && | 153 | if (cte->addr6.sin6_family == AF_INET6 && v6) |
155 | memcmp(lip, cte->addr, cte->addr_len) == 0) { | 154 | ret = memcmp(lip, cte->addr6.sin6_addr.s6_addr, |
155 | sizeof(struct in6_addr)); | ||
156 | else if (cte->addr.sin_family == AF_INET && !v6) | ||
157 | ret = memcmp(lip, (char *)(&cte->addr.sin_addr), | ||
158 | sizeof(struct in_addr)); | ||
159 | if (!ret) { | ||
156 | ce = cte; | 160 | ce = cte; |
157 | read_unlock_bh(&ctbl->lock); | 161 | read_unlock_bh(&ctbl->lock); |
158 | goto found; | 162 | goto found; |
@@ -249,10 +253,7 @@ int clip_tbl_show(struct seq_file *seq, void *v) | |||
249 | for (i = 0 ; i < ctbl->clipt_size; ++i) { | 253 | for (i = 0 ; i < ctbl->clipt_size; ++i) { |
250 | list_for_each_entry(ce, &ctbl->hash_list[i], list) { | 254 | list_for_each_entry(ce, &ctbl->hash_list[i], list) { |
251 | ip[0] = '\0'; | 255 | ip[0] = '\0'; |
252 | if (ce->addr_len == 16) | 256 | sprintf(ip, "%pISc", &ce->addr); |
253 | sprintf(ip, "%pI6c", ce->addr); | ||
254 | else | ||
255 | sprintf(ip, "%pI4c", ce->addr); | ||
256 | seq_printf(seq, "%-25s %u\n", ip, | 257 | seq_printf(seq, "%-25s %u\n", ip, |
257 | atomic_read(&ce->refcnt)); | 258 | atomic_read(&ce->refcnt)); |
258 | } | 259 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h index 2eaba0161cf8..35eb43c6bcbb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h +++ b/drivers/net/ethernet/chelsio/cxgb4/clip_tbl.h | |||
@@ -14,8 +14,10 @@ struct clip_entry { | |||
14 | spinlock_t lock; /* Hold while modifying clip reference */ | 14 | spinlock_t lock; /* Hold while modifying clip reference */ |
15 | atomic_t refcnt; | 15 | atomic_t refcnt; |
16 | struct list_head list; | 16 | struct list_head list; |
17 | u32 addr[4]; | 17 | union { |
18 | int addr_len; | 18 | struct sockaddr_in addr; |
19 | struct sockaddr_in6 addr6; | ||
20 | }; | ||
19 | }; | 21 | }; |
20 | 22 | ||
21 | struct clip_tbl { | 23 | struct clip_tbl { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index d6cda17efe6e..97842d03675b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -1103,7 +1103,7 @@ int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); | |||
1103 | #define T4_MEMORY_WRITE 0 | 1103 | #define T4_MEMORY_WRITE 0 |
1104 | #define T4_MEMORY_READ 1 | 1104 | #define T4_MEMORY_READ 1 |
1105 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, u32 len, | 1105 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, u32 len, |
1106 | __be32 *buf, int dir); | 1106 | void *buf, int dir); |
1107 | static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, | 1107 | static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, |
1108 | u32 len, __be32 *buf) | 1108 | u32 len, __be32 *buf) |
1109 | { | 1109 | { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4d643b65265e..853c38997c82 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -449,7 +449,7 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
449 | * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC | 449 | * @mtype: memory type: MEM_EDC0, MEM_EDC1 or MEM_MC |
450 | * @addr: address within indicated memory type | 450 | * @addr: address within indicated memory type |
451 | * @len: amount of memory to transfer | 451 | * @len: amount of memory to transfer |
452 | * @buf: host memory buffer | 452 | * @hbuf: host memory buffer |
453 | * @dir: direction of transfer T4_MEMORY_READ (1) or T4_MEMORY_WRITE (0) | 453 | * @dir: direction of transfer T4_MEMORY_READ (1) or T4_MEMORY_WRITE (0) |
454 | * | 454 | * |
455 | * Reads/writes an [almost] arbitrary memory region in the firmware: the | 455 | * Reads/writes an [almost] arbitrary memory region in the firmware: the |
@@ -460,15 +460,17 @@ int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *ecc) | |||
460 | * caller's responsibility to perform appropriate byte order conversions. | 460 | * caller's responsibility to perform appropriate byte order conversions. |
461 | */ | 461 | */ |
462 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | 462 | int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, |
463 | u32 len, __be32 *buf, int dir) | 463 | u32 len, void *hbuf, int dir) |
464 | { | 464 | { |
465 | u32 pos, offset, resid, memoffset; | 465 | u32 pos, offset, resid, memoffset; |
466 | u32 edc_size, mc_size, win_pf, mem_reg, mem_aperture, mem_base; | 466 | u32 edc_size, mc_size, win_pf, mem_reg, mem_aperture, mem_base; |
467 | u32 *buf; | ||
467 | 468 | ||
468 | /* Argument sanity checks ... | 469 | /* Argument sanity checks ... |
469 | */ | 470 | */ |
470 | if (addr & 0x3) | 471 | if (addr & 0x3 || (uintptr_t)hbuf & 0x3) |
471 | return -EINVAL; | 472 | return -EINVAL; |
473 | buf = (u32 *)hbuf; | ||
472 | 474 | ||
473 | /* It's convenient to be able to handle lengths which aren't a | 475 | /* It's convenient to be able to handle lengths which aren't a |
474 | * multiple of 32-bits because we often end up transferring files to | 476 | * multiple of 32-bits because we often end up transferring files to |
@@ -532,14 +534,45 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
532 | 534 | ||
533 | /* Transfer data to/from the adapter as long as there's an integral | 535 | /* Transfer data to/from the adapter as long as there's an integral |
534 | * number of 32-bit transfers to complete. | 536 | * number of 32-bit transfers to complete. |
537 | * | ||
538 | * A note on Endianness issues: | ||
539 | * | ||
540 | * The "register" reads and writes below from/to the PCI-E Memory | ||
541 | * Window invoke the standard adapter Big-Endian to PCI-E Link | ||
542 | * Little-Endian "swizzel." As a result, if we have the following | ||
543 | * data in adapter memory: | ||
544 | * | ||
545 | * Memory: ... | b0 | b1 | b2 | b3 | ... | ||
546 | * Address: i+0 i+1 i+2 i+3 | ||
547 | * | ||
548 | * Then a read of the adapter memory via the PCI-E Memory Window | ||
549 | * will yield: | ||
550 | * | ||
551 | * x = readl(i) | ||
552 | * 31 0 | ||
553 | * [ b3 | b2 | b1 | b0 ] | ||
554 | * | ||
555 | * If this value is stored into local memory on a Little-Endian system | ||
556 | * it will show up correctly in local memory as: | ||
557 | * | ||
558 | * ( ..., b0, b1, b2, b3, ... ) | ||
559 | * | ||
560 | * But on a Big-Endian system, the store will show up in memory | ||
561 | * incorrectly swizzled as: | ||
562 | * | ||
563 | * ( ..., b3, b2, b1, b0, ... ) | ||
564 | * | ||
565 | * So we need to account for this in the reads and writes to the | ||
566 | * PCI-E Memory Window below by undoing the register read/write | ||
567 | * swizzels. | ||
535 | */ | 568 | */ |
536 | while (len > 0) { | 569 | while (len > 0) { |
537 | if (dir == T4_MEMORY_READ) | 570 | if (dir == T4_MEMORY_READ) |
538 | *buf++ = (__force __be32) t4_read_reg(adap, | 571 | *buf++ = le32_to_cpu((__force __le32)t4_read_reg(adap, |
539 | mem_base + offset); | 572 | mem_base + offset)); |
540 | else | 573 | else |
541 | t4_write_reg(adap, mem_base + offset, | 574 | t4_write_reg(adap, mem_base + offset, |
542 | (__force u32) *buf++); | 575 | (__force u32)cpu_to_le32(*buf++)); |
543 | offset += sizeof(__be32); | 576 | offset += sizeof(__be32); |
544 | len -= sizeof(__be32); | 577 | len -= sizeof(__be32); |
545 | 578 | ||
@@ -568,15 +601,16 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
568 | */ | 601 | */ |
569 | if (resid) { | 602 | if (resid) { |
570 | union { | 603 | union { |
571 | __be32 word; | 604 | u32 word; |
572 | char byte[4]; | 605 | char byte[4]; |
573 | } last; | 606 | } last; |
574 | unsigned char *bp; | 607 | unsigned char *bp; |
575 | int i; | 608 | int i; |
576 | 609 | ||
577 | if (dir == T4_MEMORY_READ) { | 610 | if (dir == T4_MEMORY_READ) { |
578 | last.word = (__force __be32) t4_read_reg(adap, | 611 | last.word = le32_to_cpu( |
579 | mem_base + offset); | 612 | (__force __le32)t4_read_reg(adap, |
613 | mem_base + offset)); | ||
580 | for (bp = (unsigned char *)buf, i = resid; i < 4; i++) | 614 | for (bp = (unsigned char *)buf, i = resid; i < 4; i++) |
581 | bp[i] = last.byte[i]; | 615 | bp[i] = last.byte[i]; |
582 | } else { | 616 | } else { |
@@ -584,7 +618,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
584 | for (i = resid; i < 4; i++) | 618 | for (i = resid; i < 4; i++) |
585 | last.byte[i] = 0; | 619 | last.byte[i] = 0; |
586 | t4_write_reg(adap, mem_base + offset, | 620 | t4_write_reg(adap, mem_base + offset, |
587 | (__force u32) last.word); | 621 | (__force u32)cpu_to_le32(last.word)); |
588 | } | 622 | } |
589 | } | 623 | } |
590 | 624 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 9cbe038a388e..a5179bfcdc2c 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -272,8 +272,8 @@ static irqreturn_t enic_isr_legacy(int irq, void *data) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | if (ENIC_TEST_INTR(pba, notify_intr)) { | 274 | if (ENIC_TEST_INTR(pba, notify_intr)) { |
275 | vnic_intr_return_all_credits(&enic->intr[notify_intr]); | ||
276 | enic_notify_check(enic); | 275 | enic_notify_check(enic); |
276 | vnic_intr_return_all_credits(&enic->intr[notify_intr]); | ||
277 | } | 277 | } |
278 | 278 | ||
279 | if (ENIC_TEST_INTR(pba, err_intr)) { | 279 | if (ENIC_TEST_INTR(pba, err_intr)) { |
@@ -346,8 +346,8 @@ static irqreturn_t enic_isr_msix_notify(int irq, void *data) | |||
346 | struct enic *enic = data; | 346 | struct enic *enic = data; |
347 | unsigned int intr = enic_msix_notify_intr(enic); | 347 | unsigned int intr = enic_msix_notify_intr(enic); |
348 | 348 | ||
349 | vnic_intr_return_all_credits(&enic->intr[intr]); | ||
350 | enic_notify_check(enic); | 349 | enic_notify_check(enic); |
350 | vnic_intr_return_all_credits(&enic->intr[intr]); | ||
351 | 351 | ||
352 | return IRQ_HANDLED; | 352 | return IRQ_HANDLED; |
353 | } | 353 | } |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 43df78882e48..178e54028d10 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
@@ -3162,8 +3162,8 @@ static void adjust_link(struct net_device *dev) | |||
3162 | struct phy_device *phydev = priv->phydev; | 3162 | struct phy_device *phydev = priv->phydev; |
3163 | 3163 | ||
3164 | if (unlikely(phydev->link != priv->oldlink || | 3164 | if (unlikely(phydev->link != priv->oldlink || |
3165 | phydev->duplex != priv->oldduplex || | 3165 | (phydev->link && (phydev->duplex != priv->oldduplex || |
3166 | phydev->speed != priv->oldspeed)) | 3166 | phydev->speed != priv->oldspeed)))) |
3167 | gfar_update_link_state(priv); | 3167 | gfar_update_link_state(priv); |
3168 | } | 3168 | } |
3169 | 3169 | ||
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index e8a1adb7a962..c05e50759621 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -3262,6 +3262,139 @@ static void ehea_remove_device_sysfs(struct platform_device *dev) | |||
3262 | device_remove_file(&dev->dev, &dev_attr_remove_port); | 3262 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
3263 | } | 3263 | } |
3264 | 3264 | ||
3265 | static int ehea_reboot_notifier(struct notifier_block *nb, | ||
3266 | unsigned long action, void *unused) | ||
3267 | { | ||
3268 | if (action == SYS_RESTART) { | ||
3269 | pr_info("Reboot: freeing all eHEA resources\n"); | ||
3270 | ibmebus_unregister_driver(&ehea_driver); | ||
3271 | } | ||
3272 | return NOTIFY_DONE; | ||
3273 | } | ||
3274 | |||
3275 | static struct notifier_block ehea_reboot_nb = { | ||
3276 | .notifier_call = ehea_reboot_notifier, | ||
3277 | }; | ||
3278 | |||
3279 | static int ehea_mem_notifier(struct notifier_block *nb, | ||
3280 | unsigned long action, void *data) | ||
3281 | { | ||
3282 | int ret = NOTIFY_BAD; | ||
3283 | struct memory_notify *arg = data; | ||
3284 | |||
3285 | mutex_lock(&dlpar_mem_lock); | ||
3286 | |||
3287 | switch (action) { | ||
3288 | case MEM_CANCEL_OFFLINE: | ||
3289 | pr_info("memory offlining canceled"); | ||
3290 | /* Fall through: re-add canceled memory block */ | ||
3291 | |||
3292 | case MEM_ONLINE: | ||
3293 | pr_info("memory is going online"); | ||
3294 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
3295 | if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
3296 | goto out_unlock; | ||
3297 | ehea_rereg_mrs(); | ||
3298 | break; | ||
3299 | |||
3300 | case MEM_GOING_OFFLINE: | ||
3301 | pr_info("memory is going offline"); | ||
3302 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
3303 | if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
3304 | goto out_unlock; | ||
3305 | ehea_rereg_mrs(); | ||
3306 | break; | ||
3307 | |||
3308 | default: | ||
3309 | break; | ||
3310 | } | ||
3311 | |||
3312 | ehea_update_firmware_handles(); | ||
3313 | ret = NOTIFY_OK; | ||
3314 | |||
3315 | out_unlock: | ||
3316 | mutex_unlock(&dlpar_mem_lock); | ||
3317 | return ret; | ||
3318 | } | ||
3319 | |||
3320 | static struct notifier_block ehea_mem_nb = { | ||
3321 | .notifier_call = ehea_mem_notifier, | ||
3322 | }; | ||
3323 | |||
3324 | static void ehea_crash_handler(void) | ||
3325 | { | ||
3326 | int i; | ||
3327 | |||
3328 | if (ehea_fw_handles.arr) | ||
3329 | for (i = 0; i < ehea_fw_handles.num_entries; i++) | ||
3330 | ehea_h_free_resource(ehea_fw_handles.arr[i].adh, | ||
3331 | ehea_fw_handles.arr[i].fwh, | ||
3332 | FORCE_FREE); | ||
3333 | |||
3334 | if (ehea_bcmc_regs.arr) | ||
3335 | for (i = 0; i < ehea_bcmc_regs.num_entries; i++) | ||
3336 | ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh, | ||
3337 | ehea_bcmc_regs.arr[i].port_id, | ||
3338 | ehea_bcmc_regs.arr[i].reg_type, | ||
3339 | ehea_bcmc_regs.arr[i].macaddr, | ||
3340 | 0, H_DEREG_BCMC); | ||
3341 | } | ||
3342 | |||
3343 | static atomic_t ehea_memory_hooks_registered; | ||
3344 | |||
3345 | /* Register memory hooks on probe of first adapter */ | ||
3346 | static int ehea_register_memory_hooks(void) | ||
3347 | { | ||
3348 | int ret = 0; | ||
3349 | |||
3350 | if (atomic_inc_and_test(&ehea_memory_hooks_registered)) | ||
3351 | return 0; | ||
3352 | |||
3353 | ret = ehea_create_busmap(); | ||
3354 | if (ret) { | ||
3355 | pr_info("ehea_create_busmap failed\n"); | ||
3356 | goto out; | ||
3357 | } | ||
3358 | |||
3359 | ret = register_reboot_notifier(&ehea_reboot_nb); | ||
3360 | if (ret) { | ||
3361 | pr_info("register_reboot_notifier failed\n"); | ||
3362 | goto out; | ||
3363 | } | ||
3364 | |||
3365 | ret = register_memory_notifier(&ehea_mem_nb); | ||
3366 | if (ret) { | ||
3367 | pr_info("register_memory_notifier failed\n"); | ||
3368 | goto out2; | ||
3369 | } | ||
3370 | |||
3371 | ret = crash_shutdown_register(ehea_crash_handler); | ||
3372 | if (ret) { | ||
3373 | pr_info("crash_shutdown_register failed\n"); | ||
3374 | goto out3; | ||
3375 | } | ||
3376 | |||
3377 | return 0; | ||
3378 | |||
3379 | out3: | ||
3380 | unregister_memory_notifier(&ehea_mem_nb); | ||
3381 | out2: | ||
3382 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
3383 | out: | ||
3384 | return ret; | ||
3385 | } | ||
3386 | |||
3387 | static void ehea_unregister_memory_hooks(void) | ||
3388 | { | ||
3389 | if (atomic_read(&ehea_memory_hooks_registered)) | ||
3390 | return; | ||
3391 | |||
3392 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
3393 | if (crash_shutdown_unregister(ehea_crash_handler)) | ||
3394 | pr_info("failed unregistering crash handler\n"); | ||
3395 | unregister_memory_notifier(&ehea_mem_nb); | ||
3396 | } | ||
3397 | |||
3265 | static int ehea_probe_adapter(struct platform_device *dev) | 3398 | static int ehea_probe_adapter(struct platform_device *dev) |
3266 | { | 3399 | { |
3267 | struct ehea_adapter *adapter; | 3400 | struct ehea_adapter *adapter; |
@@ -3269,6 +3402,10 @@ static int ehea_probe_adapter(struct platform_device *dev) | |||
3269 | int ret; | 3402 | int ret; |
3270 | int i; | 3403 | int i; |
3271 | 3404 | ||
3405 | ret = ehea_register_memory_hooks(); | ||
3406 | if (ret) | ||
3407 | return ret; | ||
3408 | |||
3272 | if (!dev || !dev->dev.of_node) { | 3409 | if (!dev || !dev->dev.of_node) { |
3273 | pr_err("Invalid ibmebus device probed\n"); | 3410 | pr_err("Invalid ibmebus device probed\n"); |
3274 | return -EINVAL; | 3411 | return -EINVAL; |
@@ -3392,81 +3529,6 @@ static int ehea_remove(struct platform_device *dev) | |||
3392 | return 0; | 3529 | return 0; |
3393 | } | 3530 | } |
3394 | 3531 | ||
3395 | static void ehea_crash_handler(void) | ||
3396 | { | ||
3397 | int i; | ||
3398 | |||
3399 | if (ehea_fw_handles.arr) | ||
3400 | for (i = 0; i < ehea_fw_handles.num_entries; i++) | ||
3401 | ehea_h_free_resource(ehea_fw_handles.arr[i].adh, | ||
3402 | ehea_fw_handles.arr[i].fwh, | ||
3403 | FORCE_FREE); | ||
3404 | |||
3405 | if (ehea_bcmc_regs.arr) | ||
3406 | for (i = 0; i < ehea_bcmc_regs.num_entries; i++) | ||
3407 | ehea_h_reg_dereg_bcmc(ehea_bcmc_regs.arr[i].adh, | ||
3408 | ehea_bcmc_regs.arr[i].port_id, | ||
3409 | ehea_bcmc_regs.arr[i].reg_type, | ||
3410 | ehea_bcmc_regs.arr[i].macaddr, | ||
3411 | 0, H_DEREG_BCMC); | ||
3412 | } | ||
3413 | |||
3414 | static int ehea_mem_notifier(struct notifier_block *nb, | ||
3415 | unsigned long action, void *data) | ||
3416 | { | ||
3417 | int ret = NOTIFY_BAD; | ||
3418 | struct memory_notify *arg = data; | ||
3419 | |||
3420 | mutex_lock(&dlpar_mem_lock); | ||
3421 | |||
3422 | switch (action) { | ||
3423 | case MEM_CANCEL_OFFLINE: | ||
3424 | pr_info("memory offlining canceled"); | ||
3425 | /* Readd canceled memory block */ | ||
3426 | case MEM_ONLINE: | ||
3427 | pr_info("memory is going online"); | ||
3428 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
3429 | if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
3430 | goto out_unlock; | ||
3431 | ehea_rereg_mrs(); | ||
3432 | break; | ||
3433 | case MEM_GOING_OFFLINE: | ||
3434 | pr_info("memory is going offline"); | ||
3435 | set_bit(__EHEA_STOP_XFER, &ehea_driver_flags); | ||
3436 | if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages)) | ||
3437 | goto out_unlock; | ||
3438 | ehea_rereg_mrs(); | ||
3439 | break; | ||
3440 | default: | ||
3441 | break; | ||
3442 | } | ||
3443 | |||
3444 | ehea_update_firmware_handles(); | ||
3445 | ret = NOTIFY_OK; | ||
3446 | |||
3447 | out_unlock: | ||
3448 | mutex_unlock(&dlpar_mem_lock); | ||
3449 | return ret; | ||
3450 | } | ||
3451 | |||
3452 | static struct notifier_block ehea_mem_nb = { | ||
3453 | .notifier_call = ehea_mem_notifier, | ||
3454 | }; | ||
3455 | |||
3456 | static int ehea_reboot_notifier(struct notifier_block *nb, | ||
3457 | unsigned long action, void *unused) | ||
3458 | { | ||
3459 | if (action == SYS_RESTART) { | ||
3460 | pr_info("Reboot: freeing all eHEA resources\n"); | ||
3461 | ibmebus_unregister_driver(&ehea_driver); | ||
3462 | } | ||
3463 | return NOTIFY_DONE; | ||
3464 | } | ||
3465 | |||
3466 | static struct notifier_block ehea_reboot_nb = { | ||
3467 | .notifier_call = ehea_reboot_notifier, | ||
3468 | }; | ||
3469 | |||
3470 | static int check_module_parm(void) | 3532 | static int check_module_parm(void) |
3471 | { | 3533 | { |
3472 | int ret = 0; | 3534 | int ret = 0; |
@@ -3520,26 +3582,10 @@ static int __init ehea_module_init(void) | |||
3520 | if (ret) | 3582 | if (ret) |
3521 | goto out; | 3583 | goto out; |
3522 | 3584 | ||
3523 | ret = ehea_create_busmap(); | ||
3524 | if (ret) | ||
3525 | goto out; | ||
3526 | |||
3527 | ret = register_reboot_notifier(&ehea_reboot_nb); | ||
3528 | if (ret) | ||
3529 | pr_info("failed registering reboot notifier\n"); | ||
3530 | |||
3531 | ret = register_memory_notifier(&ehea_mem_nb); | ||
3532 | if (ret) | ||
3533 | pr_info("failed registering memory remove notifier\n"); | ||
3534 | |||
3535 | ret = crash_shutdown_register(ehea_crash_handler); | ||
3536 | if (ret) | ||
3537 | pr_info("failed registering crash handler\n"); | ||
3538 | |||
3539 | ret = ibmebus_register_driver(&ehea_driver); | 3585 | ret = ibmebus_register_driver(&ehea_driver); |
3540 | if (ret) { | 3586 | if (ret) { |
3541 | pr_err("failed registering eHEA device driver on ebus\n"); | 3587 | pr_err("failed registering eHEA device driver on ebus\n"); |
3542 | goto out2; | 3588 | goto out; |
3543 | } | 3589 | } |
3544 | 3590 | ||
3545 | ret = driver_create_file(&ehea_driver.driver, | 3591 | ret = driver_create_file(&ehea_driver.driver, |
@@ -3547,32 +3593,22 @@ static int __init ehea_module_init(void) | |||
3547 | if (ret) { | 3593 | if (ret) { |
3548 | pr_err("failed to register capabilities attribute, ret=%d\n", | 3594 | pr_err("failed to register capabilities attribute, ret=%d\n", |
3549 | ret); | 3595 | ret); |
3550 | goto out3; | 3596 | goto out2; |
3551 | } | 3597 | } |
3552 | 3598 | ||
3553 | return ret; | 3599 | return ret; |
3554 | 3600 | ||
3555 | out3: | ||
3556 | ibmebus_unregister_driver(&ehea_driver); | ||
3557 | out2: | 3601 | out2: |
3558 | unregister_memory_notifier(&ehea_mem_nb); | 3602 | ibmebus_unregister_driver(&ehea_driver); |
3559 | unregister_reboot_notifier(&ehea_reboot_nb); | ||
3560 | crash_shutdown_unregister(ehea_crash_handler); | ||
3561 | out: | 3603 | out: |
3562 | return ret; | 3604 | return ret; |
3563 | } | 3605 | } |
3564 | 3606 | ||
3565 | static void __exit ehea_module_exit(void) | 3607 | static void __exit ehea_module_exit(void) |
3566 | { | 3608 | { |
3567 | int ret; | ||
3568 | |||
3569 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); | 3609 | driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); |
3570 | ibmebus_unregister_driver(&ehea_driver); | 3610 | ibmebus_unregister_driver(&ehea_driver); |
3571 | unregister_reboot_notifier(&ehea_reboot_nb); | 3611 | ehea_unregister_memory_hooks(); |
3572 | ret = crash_shutdown_unregister(ehea_crash_handler); | ||
3573 | if (ret) | ||
3574 | pr_info("failed unregistering crash handler\n"); | ||
3575 | unregister_memory_notifier(&ehea_mem_nb); | ||
3576 | kfree(ehea_fw_handles.arr); | 3612 | kfree(ehea_fw_handles.arr); |
3577 | kfree(ehea_bcmc_regs.arr); | 3613 | kfree(ehea_bcmc_regs.arr); |
3578 | ehea_destroy_busmap(); | 3614 | ehea_destroy_busmap(); |
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 21978cc019e7..072426a72745 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
@@ -1327,6 +1327,28 @@ static unsigned long ibmveth_get_desired_dma(struct vio_dev *vdev) | |||
1327 | return ret; | 1327 | return ret; |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | static int ibmveth_set_mac_addr(struct net_device *dev, void *p) | ||
1331 | { | ||
1332 | struct ibmveth_adapter *adapter = netdev_priv(dev); | ||
1333 | struct sockaddr *addr = p; | ||
1334 | u64 mac_address; | ||
1335 | int rc; | ||
1336 | |||
1337 | if (!is_valid_ether_addr(addr->sa_data)) | ||
1338 | return -EADDRNOTAVAIL; | ||
1339 | |||
1340 | mac_address = ibmveth_encode_mac_addr(addr->sa_data); | ||
1341 | rc = h_change_logical_lan_mac(adapter->vdev->unit_address, mac_address); | ||
1342 | if (rc) { | ||
1343 | netdev_err(adapter->netdev, "h_change_logical_lan_mac failed with rc=%d\n", rc); | ||
1344 | return rc; | ||
1345 | } | ||
1346 | |||
1347 | ether_addr_copy(dev->dev_addr, addr->sa_data); | ||
1348 | |||
1349 | return 0; | ||
1350 | } | ||
1351 | |||
1330 | static const struct net_device_ops ibmveth_netdev_ops = { | 1352 | static const struct net_device_ops ibmveth_netdev_ops = { |
1331 | .ndo_open = ibmveth_open, | 1353 | .ndo_open = ibmveth_open, |
1332 | .ndo_stop = ibmveth_close, | 1354 | .ndo_stop = ibmveth_close, |
@@ -1337,7 +1359,7 @@ static const struct net_device_ops ibmveth_netdev_ops = { | |||
1337 | .ndo_fix_features = ibmveth_fix_features, | 1359 | .ndo_fix_features = ibmveth_fix_features, |
1338 | .ndo_set_features = ibmveth_set_features, | 1360 | .ndo_set_features = ibmveth_set_features, |
1339 | .ndo_validate_addr = eth_validate_addr, | 1361 | .ndo_validate_addr = eth_validate_addr, |
1340 | .ndo_set_mac_address = eth_mac_addr, | 1362 | .ndo_set_mac_address = ibmveth_set_mac_addr, |
1341 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1363 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1342 | .ndo_poll_controller = ibmveth_poll_controller, | 1364 | .ndo_poll_controller = ibmveth_poll_controller, |
1343 | #endif | 1365 | #endif |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 11a9ffebf8d8..6aea65dae5ed 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
@@ -868,8 +868,9 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw) | |||
868 | * The grst delay value is in 100ms units, and we'll wait a | 868 | * The grst delay value is in 100ms units, and we'll wait a |
869 | * couple counts longer to be sure we don't just miss the end. | 869 | * couple counts longer to be sure we don't just miss the end. |
870 | */ | 870 | */ |
871 | grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK | 871 | grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) & |
872 | >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; | 872 | I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> |
873 | I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; | ||
873 | for (cnt = 0; cnt < grst_del + 2; cnt++) { | 874 | for (cnt = 0; cnt < grst_del + 2; cnt++) { |
874 | reg = rd32(hw, I40E_GLGEN_RSTAT); | 875 | reg = rd32(hw, I40E_GLGEN_RSTAT); |
875 | if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) | 876 | if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) |
@@ -2846,7 +2847,7 @@ i40e_status i40e_aq_add_udp_tunnel(struct i40e_hw *hw, | |||
2846 | 2847 | ||
2847 | status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); | 2848 | status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); |
2848 | 2849 | ||
2849 | if (!status) | 2850 | if (!status && filter_index) |
2850 | *filter_index = resp->index; | 2851 | *filter_index = resp->index; |
2851 | 2852 | ||
2852 | return status; | 2853 | return status; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c index 183dcb63ce98..a11c70ca5a28 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c +++ b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c | |||
@@ -40,7 +40,7 @@ static void i40e_get_pfc_delay(struct i40e_hw *hw, u16 *delay) | |||
40 | u32 val; | 40 | u32 val; |
41 | 41 | ||
42 | val = rd32(hw, I40E_PRTDCB_GENC); | 42 | val = rd32(hw, I40E_PRTDCB_GENC); |
43 | *delay = (u16)(val & I40E_PRTDCB_GENC_PFCLDA_MASK >> | 43 | *delay = (u16)((val & I40E_PRTDCB_GENC_PFCLDA_MASK) >> |
44 | I40E_PRTDCB_GENC_PFCLDA_SHIFT); | 44 | I40E_PRTDCB_GENC_PFCLDA_SHIFT); |
45 | } | 45 | } |
46 | 46 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c index 61236f983971..c17ee77100d3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c | |||
@@ -989,8 +989,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp, | |||
989 | if (!cmd_buf) | 989 | if (!cmd_buf) |
990 | return count; | 990 | return count; |
991 | bytes_not_copied = copy_from_user(cmd_buf, buffer, count); | 991 | bytes_not_copied = copy_from_user(cmd_buf, buffer, count); |
992 | if (bytes_not_copied < 0) | 992 | if (bytes_not_copied < 0) { |
993 | kfree(cmd_buf); | ||
993 | return bytes_not_copied; | 994 | return bytes_not_copied; |
995 | } | ||
994 | if (bytes_not_copied > 0) | 996 | if (bytes_not_copied > 0) |
995 | count -= bytes_not_copied; | 997 | count -= bytes_not_copied; |
996 | cmd_buf[count] = '\0'; | 998 | cmd_buf[count] = '\0'; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index cbe281be1c9f..dadda3c5d658 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -1512,7 +1512,12 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, | |||
1512 | vsi->tc_config.numtc = numtc; | 1512 | vsi->tc_config.numtc = numtc; |
1513 | vsi->tc_config.enabled_tc = enabled_tc ? enabled_tc : 1; | 1513 | vsi->tc_config.enabled_tc = enabled_tc ? enabled_tc : 1; |
1514 | /* Number of queues per enabled TC */ | 1514 | /* Number of queues per enabled TC */ |
1515 | num_tc_qps = vsi->alloc_queue_pairs/numtc; | 1515 | /* In MFP case we can have a much lower count of MSIx |
1516 | * vectors available and so we need to lower the used | ||
1517 | * q count. | ||
1518 | */ | ||
1519 | qcount = min_t(int, vsi->alloc_queue_pairs, pf->num_lan_msix); | ||
1520 | num_tc_qps = qcount / numtc; | ||
1516 | num_tc_qps = min_t(int, num_tc_qps, I40E_MAX_QUEUES_PER_TC); | 1521 | num_tc_qps = min_t(int, num_tc_qps, I40E_MAX_QUEUES_PER_TC); |
1517 | 1522 | ||
1518 | /* Setup queue offset/count for all TCs for given VSI */ | 1523 | /* Setup queue offset/count for all TCs for given VSI */ |
@@ -2684,8 +2689,15 @@ static void i40e_vsi_config_dcb_rings(struct i40e_vsi *vsi) | |||
2684 | u16 qoffset, qcount; | 2689 | u16 qoffset, qcount; |
2685 | int i, n; | 2690 | int i, n; |
2686 | 2691 | ||
2687 | if (!(vsi->back->flags & I40E_FLAG_DCB_ENABLED)) | 2692 | if (!(vsi->back->flags & I40E_FLAG_DCB_ENABLED)) { |
2688 | return; | 2693 | /* Reset the TC information */ |
2694 | for (i = 0; i < vsi->num_queue_pairs; i++) { | ||
2695 | rx_ring = vsi->rx_rings[i]; | ||
2696 | tx_ring = vsi->tx_rings[i]; | ||
2697 | rx_ring->dcb_tc = 0; | ||
2698 | tx_ring->dcb_tc = 0; | ||
2699 | } | ||
2700 | } | ||
2689 | 2701 | ||
2690 | for (n = 0; n < I40E_MAX_TRAFFIC_CLASS; n++) { | 2702 | for (n = 0; n < I40E_MAX_TRAFFIC_CLASS; n++) { |
2691 | if (!(vsi->tc_config.enabled_tc & (1 << n))) | 2703 | if (!(vsi->tc_config.enabled_tc & (1 << n))) |
@@ -3830,6 +3842,12 @@ static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) | |||
3830 | { | 3842 | { |
3831 | int i; | 3843 | int i; |
3832 | 3844 | ||
3845 | i40e_stop_misc_vector(pf); | ||
3846 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) { | ||
3847 | synchronize_irq(pf->msix_entries[0].vector); | ||
3848 | free_irq(pf->msix_entries[0].vector, pf); | ||
3849 | } | ||
3850 | |||
3833 | i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); | 3851 | i40e_put_lump(pf->irq_pile, 0, I40E_PILE_VALID_BIT-1); |
3834 | for (i = 0; i < pf->num_alloc_vsi; i++) | 3852 | for (i = 0; i < pf->num_alloc_vsi; i++) |
3835 | if (pf->vsi[i]) | 3853 | if (pf->vsi[i]) |
@@ -5254,8 +5272,14 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, | |||
5254 | 5272 | ||
5255 | /* Wait for the PF's Tx queues to be disabled */ | 5273 | /* Wait for the PF's Tx queues to be disabled */ |
5256 | ret = i40e_pf_wait_txq_disabled(pf); | 5274 | ret = i40e_pf_wait_txq_disabled(pf); |
5257 | if (!ret) | 5275 | if (ret) { |
5276 | /* Schedule PF reset to recover */ | ||
5277 | set_bit(__I40E_PF_RESET_REQUESTED, &pf->state); | ||
5278 | i40e_service_event_schedule(pf); | ||
5279 | } else { | ||
5258 | i40e_pf_unquiesce_all_vsi(pf); | 5280 | i40e_pf_unquiesce_all_vsi(pf); |
5281 | } | ||
5282 | |||
5259 | exit: | 5283 | exit: |
5260 | return ret; | 5284 | return ret; |
5261 | } | 5285 | } |
@@ -5587,7 +5611,8 @@ static void i40e_check_hang_subtask(struct i40e_pf *pf) | |||
5587 | int i, v; | 5611 | int i, v; |
5588 | 5612 | ||
5589 | /* If we're down or resetting, just bail */ | 5613 | /* If we're down or resetting, just bail */ |
5590 | if (test_bit(__I40E_CONFIG_BUSY, &pf->state)) | 5614 | if (test_bit(__I40E_DOWN, &pf->state) || |
5615 | test_bit(__I40E_CONFIG_BUSY, &pf->state)) | ||
5591 | return; | 5616 | return; |
5592 | 5617 | ||
5593 | /* for each VSI/netdev | 5618 | /* for each VSI/netdev |
@@ -9533,6 +9558,7 @@ static void i40e_remove(struct pci_dev *pdev) | |||
9533 | set_bit(__I40E_DOWN, &pf->state); | 9558 | set_bit(__I40E_DOWN, &pf->state); |
9534 | del_timer_sync(&pf->service_timer); | 9559 | del_timer_sync(&pf->service_timer); |
9535 | cancel_work_sync(&pf->service_task); | 9560 | cancel_work_sync(&pf->service_task); |
9561 | i40e_fdir_teardown(pf); | ||
9536 | 9562 | ||
9537 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { | 9563 | if (pf->flags & I40E_FLAG_SRIOV_ENABLED) { |
9538 | i40e_free_vfs(pf); | 9564 | i40e_free_vfs(pf); |
@@ -9559,12 +9585,6 @@ static void i40e_remove(struct pci_dev *pdev) | |||
9559 | if (pf->vsi[pf->lan_vsi]) | 9585 | if (pf->vsi[pf->lan_vsi]) |
9560 | i40e_vsi_release(pf->vsi[pf->lan_vsi]); | 9586 | i40e_vsi_release(pf->vsi[pf->lan_vsi]); |
9561 | 9587 | ||
9562 | i40e_stop_misc_vector(pf); | ||
9563 | if (pf->flags & I40E_FLAG_MSIX_ENABLED) { | ||
9564 | synchronize_irq(pf->msix_entries[0].vector); | ||
9565 | free_irq(pf->msix_entries[0].vector, pf); | ||
9566 | } | ||
9567 | |||
9568 | /* shutdown and destroy the HMC */ | 9588 | /* shutdown and destroy the HMC */ |
9569 | if (pf->hw.hmc.hmc_obj) { | 9589 | if (pf->hw.hmc.hmc_obj) { |
9570 | ret_code = i40e_shutdown_lan_hmc(&pf->hw); | 9590 | ret_code = i40e_shutdown_lan_hmc(&pf->hw); |
@@ -9718,6 +9738,8 @@ static void i40e_shutdown(struct pci_dev *pdev) | |||
9718 | wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); | 9738 | wr32(hw, I40E_PFPM_APM, (pf->wol_en ? I40E_PFPM_APM_APME_MASK : 0)); |
9719 | wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); | 9739 | wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0)); |
9720 | 9740 | ||
9741 | i40e_clear_interrupt_scheme(pf); | ||
9742 | |||
9721 | if (system_state == SYSTEM_POWER_OFF) { | 9743 | if (system_state == SYSTEM_POWER_OFF) { |
9722 | pci_wake_from_d3(pdev, pf->wol_en); | 9744 | pci_wake_from_d3(pdev, pf->wol_en); |
9723 | pci_set_power_state(pdev, PCI_D3hot); | 9745 | pci_set_power_state(pdev, PCI_D3hot); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c index 3e70f2e45a47..5defe0d63514 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c +++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c | |||
@@ -679,9 +679,11 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw, | |||
679 | { | 679 | { |
680 | i40e_status status; | 680 | i40e_status status; |
681 | enum i40e_nvmupd_cmd upd_cmd; | 681 | enum i40e_nvmupd_cmd upd_cmd; |
682 | bool retry_attempt = false; | ||
682 | 683 | ||
683 | upd_cmd = i40e_nvmupd_validate_command(hw, cmd, errno); | 684 | upd_cmd = i40e_nvmupd_validate_command(hw, cmd, errno); |
684 | 685 | ||
686 | retry: | ||
685 | switch (upd_cmd) { | 687 | switch (upd_cmd) { |
686 | case I40E_NVMUPD_WRITE_CON: | 688 | case I40E_NVMUPD_WRITE_CON: |
687 | status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); | 689 | status = i40e_nvmupd_nvm_write(hw, cmd, bytes, errno); |
@@ -725,6 +727,39 @@ static i40e_status i40e_nvmupd_state_writing(struct i40e_hw *hw, | |||
725 | *errno = -ESRCH; | 727 | *errno = -ESRCH; |
726 | break; | 728 | break; |
727 | } | 729 | } |
730 | |||
731 | /* In some circumstances, a multi-write transaction takes longer | ||
732 | * than the default 3 minute timeout on the write semaphore. If | ||
733 | * the write failed with an EBUSY status, this is likely the problem, | ||
734 | * so here we try to reacquire the semaphore then retry the write. | ||
735 | * We only do one retry, then give up. | ||
736 | */ | ||
737 | if (status && (hw->aq.asq_last_status == I40E_AQ_RC_EBUSY) && | ||
738 | !retry_attempt) { | ||
739 | i40e_status old_status = status; | ||
740 | u32 old_asq_status = hw->aq.asq_last_status; | ||
741 | u32 gtime; | ||
742 | |||
743 | gtime = rd32(hw, I40E_GLVFGEN_TIMER); | ||
744 | if (gtime >= hw->nvm.hw_semaphore_timeout) { | ||
745 | i40e_debug(hw, I40E_DEBUG_ALL, | ||
746 | "NVMUPD: write semaphore expired (%d >= %lld), retrying\n", | ||
747 | gtime, hw->nvm.hw_semaphore_timeout); | ||
748 | i40e_release_nvm(hw); | ||
749 | status = i40e_acquire_nvm(hw, I40E_RESOURCE_WRITE); | ||
750 | if (status) { | ||
751 | i40e_debug(hw, I40E_DEBUG_ALL, | ||
752 | "NVMUPD: write semaphore reacquire failed aq_err = %d\n", | ||
753 | hw->aq.asq_last_status); | ||
754 | status = old_status; | ||
755 | hw->aq.asq_last_status = old_asq_status; | ||
756 | } else { | ||
757 | retry_attempt = true; | ||
758 | goto retry; | ||
759 | } | ||
760 | } | ||
761 | } | ||
762 | |||
728 | return status; | 763 | return status; |
729 | } | 764 | } |
730 | 765 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 2206d2d36f0f..bbf1b1247ac4 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -586,6 +586,20 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring) | |||
586 | } | 586 | } |
587 | 587 | ||
588 | /** | 588 | /** |
589 | * i40e_get_head - Retrieve head from head writeback | ||
590 | * @tx_ring: tx ring to fetch head of | ||
591 | * | ||
592 | * Returns value of Tx ring head based on value stored | ||
593 | * in head write-back location | ||
594 | **/ | ||
595 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
596 | { | ||
597 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
598 | |||
599 | return le32_to_cpu(*(volatile __le32 *)head); | ||
600 | } | ||
601 | |||
602 | /** | ||
589 | * i40e_get_tx_pending - how many tx descriptors not processed | 603 | * i40e_get_tx_pending - how many tx descriptors not processed |
590 | * @tx_ring: the ring of descriptors | 604 | * @tx_ring: the ring of descriptors |
591 | * | 605 | * |
@@ -594,10 +608,16 @@ void i40e_free_tx_resources(struct i40e_ring *tx_ring) | |||
594 | **/ | 608 | **/ |
595 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) | 609 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) |
596 | { | 610 | { |
597 | u32 ntu = ((ring->next_to_clean <= ring->next_to_use) | 611 | u32 head, tail; |
598 | ? ring->next_to_use | 612 | |
599 | : ring->next_to_use + ring->count); | 613 | head = i40e_get_head(ring); |
600 | return ntu - ring->next_to_clean; | 614 | tail = readl(ring->tail); |
615 | |||
616 | if (head != tail) | ||
617 | return (head < tail) ? | ||
618 | tail - head : (tail + ring->count - head); | ||
619 | |||
620 | return 0; | ||
601 | } | 621 | } |
602 | 622 | ||
603 | /** | 623 | /** |
@@ -606,6 +626,8 @@ static u32 i40e_get_tx_pending(struct i40e_ring *ring) | |||
606 | **/ | 626 | **/ |
607 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | 627 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) |
608 | { | 628 | { |
629 | u32 tx_done = tx_ring->stats.packets; | ||
630 | u32 tx_done_old = tx_ring->tx_stats.tx_done_old; | ||
609 | u32 tx_pending = i40e_get_tx_pending(tx_ring); | 631 | u32 tx_pending = i40e_get_tx_pending(tx_ring); |
610 | struct i40e_pf *pf = tx_ring->vsi->back; | 632 | struct i40e_pf *pf = tx_ring->vsi->back; |
611 | bool ret = false; | 633 | bool ret = false; |
@@ -623,41 +645,25 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | |||
623 | * run the check_tx_hang logic with a transmit completion | 645 | * run the check_tx_hang logic with a transmit completion |
624 | * pending but without time to complete it yet. | 646 | * pending but without time to complete it yet. |
625 | */ | 647 | */ |
626 | if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 648 | if ((tx_done_old == tx_done) && tx_pending) { |
627 | (tx_pending >= I40E_MIN_DESC_PENDING)) { | ||
628 | /* make sure it is true for two checks in a row */ | 649 | /* make sure it is true for two checks in a row */ |
629 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, | 650 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, |
630 | &tx_ring->state); | 651 | &tx_ring->state); |
631 | } else if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 652 | } else if (tx_done_old == tx_done && |
632 | (tx_pending < I40E_MIN_DESC_PENDING) && | 653 | (tx_pending < I40E_MIN_DESC_PENDING) && (tx_pending > 0)) { |
633 | (tx_pending > 0)) { | ||
634 | if (I40E_DEBUG_FLOW & pf->hw.debug_mask) | 654 | if (I40E_DEBUG_FLOW & pf->hw.debug_mask) |
635 | dev_info(tx_ring->dev, "HW needs some more descs to do a cacheline flush. tx_pending %d, queue %d", | 655 | dev_info(tx_ring->dev, "HW needs some more descs to do a cacheline flush. tx_pending %d, queue %d", |
636 | tx_pending, tx_ring->queue_index); | 656 | tx_pending, tx_ring->queue_index); |
637 | pf->tx_sluggish_count++; | 657 | pf->tx_sluggish_count++; |
638 | } else { | 658 | } else { |
639 | /* update completed stats and disarm the hang check */ | 659 | /* update completed stats and disarm the hang check */ |
640 | tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets; | 660 | tx_ring->tx_stats.tx_done_old = tx_done; |
641 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); | 661 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); |
642 | } | 662 | } |
643 | 663 | ||
644 | return ret; | 664 | return ret; |
645 | } | 665 | } |
646 | 666 | ||
647 | /** | ||
648 | * i40e_get_head - Retrieve head from head writeback | ||
649 | * @tx_ring: tx ring to fetch head of | ||
650 | * | ||
651 | * Returns value of Tx ring head based on value stored | ||
652 | * in head write-back location | ||
653 | **/ | ||
654 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
655 | { | ||
656 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
657 | |||
658 | return le32_to_cpu(*(volatile __le32 *)head); | ||
659 | } | ||
660 | |||
661 | #define WB_STRIDE 0x3 | 667 | #define WB_STRIDE 0x3 |
662 | 668 | ||
663 | /** | 669 | /** |
@@ -2140,6 +2146,67 @@ static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size) | |||
2140 | } | 2146 | } |
2141 | 2147 | ||
2142 | /** | 2148 | /** |
2149 | * i40e_chk_linearize - Check if there are more than 8 fragments per packet | ||
2150 | * @skb: send buffer | ||
2151 | * @tx_flags: collected send information | ||
2152 | * @hdr_len: size of the packet header | ||
2153 | * | ||
2154 | * Note: Our HW can't scatter-gather more than 8 fragments to build | ||
2155 | * a packet on the wire and so we need to figure out the cases where we | ||
2156 | * need to linearize the skb. | ||
2157 | **/ | ||
2158 | static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, | ||
2159 | const u8 hdr_len) | ||
2160 | { | ||
2161 | struct skb_frag_struct *frag; | ||
2162 | bool linearize = false; | ||
2163 | unsigned int size = 0; | ||
2164 | u16 num_frags; | ||
2165 | u16 gso_segs; | ||
2166 | |||
2167 | num_frags = skb_shinfo(skb)->nr_frags; | ||
2168 | gso_segs = skb_shinfo(skb)->gso_segs; | ||
2169 | |||
2170 | if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { | ||
2171 | u16 j = 1; | ||
2172 | |||
2173 | if (num_frags < (I40E_MAX_BUFFER_TXD)) | ||
2174 | goto linearize_chk_done; | ||
2175 | /* try the simple math, if we have too many frags per segment */ | ||
2176 | if (DIV_ROUND_UP((num_frags + gso_segs), gso_segs) > | ||
2177 | I40E_MAX_BUFFER_TXD) { | ||
2178 | linearize = true; | ||
2179 | goto linearize_chk_done; | ||
2180 | } | ||
2181 | frag = &skb_shinfo(skb)->frags[0]; | ||
2182 | size = hdr_len; | ||
2183 | /* we might still have more fragments per segment */ | ||
2184 | do { | ||
2185 | size += skb_frag_size(frag); | ||
2186 | frag++; j++; | ||
2187 | if (j == I40E_MAX_BUFFER_TXD) { | ||
2188 | if (size < skb_shinfo(skb)->gso_size) { | ||
2189 | linearize = true; | ||
2190 | break; | ||
2191 | } | ||
2192 | j = 1; | ||
2193 | size -= skb_shinfo(skb)->gso_size; | ||
2194 | if (size) | ||
2195 | j++; | ||
2196 | size += hdr_len; | ||
2197 | } | ||
2198 | num_frags--; | ||
2199 | } while (num_frags); | ||
2200 | } else { | ||
2201 | if (num_frags >= I40E_MAX_BUFFER_TXD) | ||
2202 | linearize = true; | ||
2203 | } | ||
2204 | |||
2205 | linearize_chk_done: | ||
2206 | return linearize; | ||
2207 | } | ||
2208 | |||
2209 | /** | ||
2143 | * i40e_tx_map - Build the Tx descriptor | 2210 | * i40e_tx_map - Build the Tx descriptor |
2144 | * @tx_ring: ring to send buffer on | 2211 | * @tx_ring: ring to send buffer on |
2145 | * @skb: send buffer | 2212 | * @skb: send buffer |
@@ -2396,6 +2463,10 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
2396 | if (tsyn) | 2463 | if (tsyn) |
2397 | tx_flags |= I40E_TX_FLAGS_TSYN; | 2464 | tx_flags |= I40E_TX_FLAGS_TSYN; |
2398 | 2465 | ||
2466 | if (i40e_chk_linearize(skb, tx_flags, hdr_len)) | ||
2467 | if (skb_linearize(skb)) | ||
2468 | goto out_drop; | ||
2469 | |||
2399 | skb_tx_timestamp(skb); | 2470 | skb_tx_timestamp(skb); |
2400 | 2471 | ||
2401 | /* always enable CRC insertion offload */ | 2472 | /* always enable CRC insertion offload */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index 18b00231d2f1..dff0baeb1ecc 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h | |||
@@ -112,6 +112,7 @@ enum i40e_dyn_idx_t { | |||
112 | 112 | ||
113 | #define i40e_rx_desc i40e_32byte_rx_desc | 113 | #define i40e_rx_desc i40e_32byte_rx_desc |
114 | 114 | ||
115 | #define I40E_MAX_BUFFER_TXD 8 | ||
115 | #define I40E_MIN_TX_LEN 17 | 116 | #define I40E_MIN_TX_LEN 17 |
116 | #define I40E_MAX_DATA_PER_TXD 8192 | 117 | #define I40E_MAX_DATA_PER_TXD 8192 |
117 | 118 | ||
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 29004382f462..708891571dae 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
@@ -126,6 +126,20 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * i40e_get_head - Retrieve head from head writeback | ||
130 | * @tx_ring: tx ring to fetch head of | ||
131 | * | ||
132 | * Returns value of Tx ring head based on value stored | ||
133 | * in head write-back location | ||
134 | **/ | ||
135 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
136 | { | ||
137 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
138 | |||
139 | return le32_to_cpu(*(volatile __le32 *)head); | ||
140 | } | ||
141 | |||
142 | /** | ||
129 | * i40e_get_tx_pending - how many tx descriptors not processed | 143 | * i40e_get_tx_pending - how many tx descriptors not processed |
130 | * @tx_ring: the ring of descriptors | 144 | * @tx_ring: the ring of descriptors |
131 | * | 145 | * |
@@ -134,10 +148,16 @@ void i40evf_free_tx_resources(struct i40e_ring *tx_ring) | |||
134 | **/ | 148 | **/ |
135 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) | 149 | static u32 i40e_get_tx_pending(struct i40e_ring *ring) |
136 | { | 150 | { |
137 | u32 ntu = ((ring->next_to_clean <= ring->next_to_use) | 151 | u32 head, tail; |
138 | ? ring->next_to_use | 152 | |
139 | : ring->next_to_use + ring->count); | 153 | head = i40e_get_head(ring); |
140 | return ntu - ring->next_to_clean; | 154 | tail = readl(ring->tail); |
155 | |||
156 | if (head != tail) | ||
157 | return (head < tail) ? | ||
158 | tail - head : (tail + ring->count - head); | ||
159 | |||
160 | return 0; | ||
141 | } | 161 | } |
142 | 162 | ||
143 | /** | 163 | /** |
@@ -146,6 +166,8 @@ static u32 i40e_get_tx_pending(struct i40e_ring *ring) | |||
146 | **/ | 166 | **/ |
147 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | 167 | static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) |
148 | { | 168 | { |
169 | u32 tx_done = tx_ring->stats.packets; | ||
170 | u32 tx_done_old = tx_ring->tx_stats.tx_done_old; | ||
149 | u32 tx_pending = i40e_get_tx_pending(tx_ring); | 171 | u32 tx_pending = i40e_get_tx_pending(tx_ring); |
150 | bool ret = false; | 172 | bool ret = false; |
151 | 173 | ||
@@ -162,36 +184,20 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring) | |||
162 | * run the check_tx_hang logic with a transmit completion | 184 | * run the check_tx_hang logic with a transmit completion |
163 | * pending but without time to complete it yet. | 185 | * pending but without time to complete it yet. |
164 | */ | 186 | */ |
165 | if ((tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) && | 187 | if ((tx_done_old == tx_done) && tx_pending) { |
166 | (tx_pending >= I40E_MIN_DESC_PENDING)) { | ||
167 | /* make sure it is true for two checks in a row */ | 188 | /* make sure it is true for two checks in a row */ |
168 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, | 189 | ret = test_and_set_bit(__I40E_HANG_CHECK_ARMED, |
169 | &tx_ring->state); | 190 | &tx_ring->state); |
170 | } else if (!(tx_ring->tx_stats.tx_done_old == tx_ring->stats.packets) || | 191 | } else if (tx_done_old == tx_done && |
171 | !(tx_pending < I40E_MIN_DESC_PENDING) || | 192 | (tx_pending < I40E_MIN_DESC_PENDING) && (tx_pending > 0)) { |
172 | !(tx_pending > 0)) { | ||
173 | /* update completed stats and disarm the hang check */ | 193 | /* update completed stats and disarm the hang check */ |
174 | tx_ring->tx_stats.tx_done_old = tx_ring->stats.packets; | 194 | tx_ring->tx_stats.tx_done_old = tx_done; |
175 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); | 195 | clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state); |
176 | } | 196 | } |
177 | 197 | ||
178 | return ret; | 198 | return ret; |
179 | } | 199 | } |
180 | 200 | ||
181 | /** | ||
182 | * i40e_get_head - Retrieve head from head writeback | ||
183 | * @tx_ring: tx ring to fetch head of | ||
184 | * | ||
185 | * Returns value of Tx ring head based on value stored | ||
186 | * in head write-back location | ||
187 | **/ | ||
188 | static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | ||
189 | { | ||
190 | void *head = (struct i40e_tx_desc *)tx_ring->desc + tx_ring->count; | ||
191 | |||
192 | return le32_to_cpu(*(volatile __le32 *)head); | ||
193 | } | ||
194 | |||
195 | #define WB_STRIDE 0x3 | 201 | #define WB_STRIDE 0x3 |
196 | 202 | ||
197 | /** | 203 | /** |
@@ -1206,17 +1212,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb, | |||
1206 | if (err < 0) | 1212 | if (err < 0) |
1207 | return err; | 1213 | return err; |
1208 | 1214 | ||
1209 | if (protocol == htons(ETH_P_IP)) { | 1215 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); |
1210 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); | 1216 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb); |
1217 | |||
1218 | if (iph->version == 4) { | ||
1211 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1219 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
1212 | iph->tot_len = 0; | 1220 | iph->tot_len = 0; |
1213 | iph->check = 0; | 1221 | iph->check = 0; |
1214 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | 1222 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, |
1215 | 0, IPPROTO_TCP, 0); | 1223 | 0, IPPROTO_TCP, 0); |
1216 | } else if (skb_is_gso_v6(skb)) { | 1224 | } else if (ipv6h->version == 6) { |
1217 | |||
1218 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) | ||
1219 | : ipv6_hdr(skb); | ||
1220 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1225 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
1221 | ipv6h->payload_len = 0; | 1226 | ipv6h->payload_len = 0; |
1222 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, | 1227 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, |
@@ -1274,13 +1279,9 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
1274 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | 1279 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; |
1275 | } | 1280 | } |
1276 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { | 1281 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { |
1277 | if (tx_flags & I40E_TX_FLAGS_TSO) { | 1282 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; |
1278 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; | 1283 | if (tx_flags & I40E_TX_FLAGS_TSO) |
1279 | ip_hdr(skb)->check = 0; | 1284 | ip_hdr(skb)->check = 0; |
1280 | } else { | ||
1281 | *cd_tunneling |= | ||
1282 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | ||
1283 | } | ||
1284 | } | 1285 | } |
1285 | 1286 | ||
1286 | /* Now set the ctx descriptor fields */ | 1287 | /* Now set the ctx descriptor fields */ |
@@ -1290,6 +1291,11 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
1290 | ((skb_inner_network_offset(skb) - | 1291 | ((skb_inner_network_offset(skb) - |
1291 | skb_transport_offset(skb)) >> 1) << | 1292 | skb_transport_offset(skb)) >> 1) << |
1292 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; | 1293 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; |
1294 | if (this_ip_hdr->version == 6) { | ||
1295 | tx_flags &= ~I40E_TX_FLAGS_IPV4; | ||
1296 | tx_flags |= I40E_TX_FLAGS_IPV6; | ||
1297 | } | ||
1298 | |||
1293 | 1299 | ||
1294 | } else { | 1300 | } else { |
1295 | network_hdr_len = skb_network_header_len(skb); | 1301 | network_hdr_len = skb_network_header_len(skb); |
@@ -1380,6 +1386,67 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring, | |||
1380 | context_desc->type_cmd_tso_mss = cpu_to_le64(cd_type_cmd_tso_mss); | 1386 | context_desc->type_cmd_tso_mss = cpu_to_le64(cd_type_cmd_tso_mss); |
1381 | } | 1387 | } |
1382 | 1388 | ||
1389 | /** | ||
1390 | * i40e_chk_linearize - Check if there are more than 8 fragments per packet | ||
1391 | * @skb: send buffer | ||
1392 | * @tx_flags: collected send information | ||
1393 | * @hdr_len: size of the packet header | ||
1394 | * | ||
1395 | * Note: Our HW can't scatter-gather more than 8 fragments to build | ||
1396 | * a packet on the wire and so we need to figure out the cases where we | ||
1397 | * need to linearize the skb. | ||
1398 | **/ | ||
1399 | static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, | ||
1400 | const u8 hdr_len) | ||
1401 | { | ||
1402 | struct skb_frag_struct *frag; | ||
1403 | bool linearize = false; | ||
1404 | unsigned int size = 0; | ||
1405 | u16 num_frags; | ||
1406 | u16 gso_segs; | ||
1407 | |||
1408 | num_frags = skb_shinfo(skb)->nr_frags; | ||
1409 | gso_segs = skb_shinfo(skb)->gso_segs; | ||
1410 | |||
1411 | if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { | ||
1412 | u16 j = 1; | ||
1413 | |||
1414 | if (num_frags < (I40E_MAX_BUFFER_TXD)) | ||
1415 | goto linearize_chk_done; | ||
1416 | /* try the simple math, if we have too many frags per segment */ | ||
1417 | if (DIV_ROUND_UP((num_frags + gso_segs), gso_segs) > | ||
1418 | I40E_MAX_BUFFER_TXD) { | ||
1419 | linearize = true; | ||
1420 | goto linearize_chk_done; | ||
1421 | } | ||
1422 | frag = &skb_shinfo(skb)->frags[0]; | ||
1423 | size = hdr_len; | ||
1424 | /* we might still have more fragments per segment */ | ||
1425 | do { | ||
1426 | size += skb_frag_size(frag); | ||
1427 | frag++; j++; | ||
1428 | if (j == I40E_MAX_BUFFER_TXD) { | ||
1429 | if (size < skb_shinfo(skb)->gso_size) { | ||
1430 | linearize = true; | ||
1431 | break; | ||
1432 | } | ||
1433 | j = 1; | ||
1434 | size -= skb_shinfo(skb)->gso_size; | ||
1435 | if (size) | ||
1436 | j++; | ||
1437 | size += hdr_len; | ||
1438 | } | ||
1439 | num_frags--; | ||
1440 | } while (num_frags); | ||
1441 | } else { | ||
1442 | if (num_frags >= I40E_MAX_BUFFER_TXD) | ||
1443 | linearize = true; | ||
1444 | } | ||
1445 | |||
1446 | linearize_chk_done: | ||
1447 | return linearize; | ||
1448 | } | ||
1449 | |||
1383 | /** | 1450 | /** |
1384 | * i40e_tx_map - Build the Tx descriptor | 1451 | * i40e_tx_map - Build the Tx descriptor |
1385 | * @tx_ring: ring to send buffer on | 1452 | * @tx_ring: ring to send buffer on |
@@ -1654,6 +1721,10 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
1654 | else if (tso) | 1721 | else if (tso) |
1655 | tx_flags |= I40E_TX_FLAGS_TSO; | 1722 | tx_flags |= I40E_TX_FLAGS_TSO; |
1656 | 1723 | ||
1724 | if (i40e_chk_linearize(skb, tx_flags, hdr_len)) | ||
1725 | if (skb_linearize(skb)) | ||
1726 | goto out_drop; | ||
1727 | |||
1657 | skb_tx_timestamp(skb); | 1728 | skb_tx_timestamp(skb); |
1658 | 1729 | ||
1659 | /* always enable CRC insertion offload */ | 1730 | /* always enable CRC insertion offload */ |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h index 4e15903b2b6d..c950a038237c 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h | |||
@@ -112,6 +112,7 @@ enum i40e_dyn_idx_t { | |||
112 | 112 | ||
113 | #define i40e_rx_desc i40e_32byte_rx_desc | 113 | #define i40e_rx_desc i40e_32byte_rx_desc |
114 | 114 | ||
115 | #define I40E_MAX_BUFFER_TXD 8 | ||
115 | #define I40E_MIN_TX_LEN 17 | 116 | #define I40E_MIN_TX_LEN 17 |
116 | #define I40E_MAX_DATA_PER_TXD 8192 | 117 | #define I40E_MAX_DATA_PER_TXD 8192 |
117 | 118 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c index 2d8ee66138e8..a61009f4b2df 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_selftest.c | |||
@@ -81,12 +81,14 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) | |||
81 | { | 81 | { |
82 | u32 loopback_ok = 0; | 82 | u32 loopback_ok = 0; |
83 | int i; | 83 | int i; |
84 | 84 | bool gro_enabled; | |
85 | 85 | ||
86 | priv->loopback_ok = 0; | 86 | priv->loopback_ok = 0; |
87 | priv->validate_loopback = 1; | 87 | priv->validate_loopback = 1; |
88 | gro_enabled = priv->dev->features & NETIF_F_GRO; | ||
88 | 89 | ||
89 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); | 90 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); |
91 | priv->dev->features &= ~NETIF_F_GRO; | ||
90 | 92 | ||
91 | /* xmit */ | 93 | /* xmit */ |
92 | if (mlx4_en_test_loopback_xmit(priv)) { | 94 | if (mlx4_en_test_loopback_xmit(priv)) { |
@@ -108,6 +110,10 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv) | |||
108 | mlx4_en_test_loopback_exit: | 110 | mlx4_en_test_loopback_exit: |
109 | 111 | ||
110 | priv->validate_loopback = 0; | 112 | priv->validate_loopback = 0; |
113 | |||
114 | if (gro_enabled) | ||
115 | priv->dev->features |= NETIF_F_GRO; | ||
116 | |||
111 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); | 117 | mlx4_en_update_loopback_state(priv->dev, priv->dev->features); |
112 | return !loopback_ok; | 118 | return !loopback_ok; |
113 | } | 119 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 2bb8553bd905..eda29dbbfcd2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -412,7 +412,6 @@ err_icm: | |||
412 | 412 | ||
413 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); | 413 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); |
414 | 414 | ||
415 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC | ||
416 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, | 415 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
417 | enum mlx4_update_qp_attr attr, | 416 | enum mlx4_update_qp_attr attr, |
418 | struct mlx4_update_qp_params *params) | 417 | struct mlx4_update_qp_params *params) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 486e3d26cd4a..d97ca88c55b5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -713,7 +713,7 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
713 | struct mlx4_vport_oper_state *vp_oper; | 713 | struct mlx4_vport_oper_state *vp_oper; |
714 | struct mlx4_priv *priv; | 714 | struct mlx4_priv *priv; |
715 | u32 qp_type; | 715 | u32 qp_type; |
716 | int port; | 716 | int port, err = 0; |
717 | 717 | ||
718 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; | 718 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; |
719 | priv = mlx4_priv(dev); | 719 | priv = mlx4_priv(dev); |
@@ -738,7 +738,9 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
738 | } else { | 738 | } else { |
739 | struct mlx4_update_qp_params params = {.flags = 0}; | 739 | struct mlx4_update_qp_params params = {.flags = 0}; |
740 | 740 | ||
741 | mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); | 741 | err = mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); |
742 | if (err) | ||
743 | goto out; | ||
742 | } | 744 | } |
743 | } | 745 | } |
744 | 746 | ||
@@ -773,7 +775,8 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
773 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; | 775 | qpc->pri_path.feup |= MLX4_FSM_FORCE_ETH_SRC_MAC; |
774 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; | 776 | qpc->pri_path.grh_mylmc = (0x80 & qpc->pri_path.grh_mylmc) + vp_oper->mac_idx; |
775 | } | 777 | } |
776 | return 0; | 778 | out: |
779 | return err; | ||
777 | } | 780 | } |
778 | 781 | ||
779 | static int mpt_mask(struct mlx4_dev *dev) | 782 | static int mpt_mask(struct mlx4_dev *dev) |
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c index 44e8d7d25547..57a6e6cd74fc 100644 --- a/drivers/net/ethernet/pasemi/pasemi_mac.c +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c | |||
@@ -1239,11 +1239,9 @@ static int pasemi_mac_open(struct net_device *dev) | |||
1239 | if (mac->phydev) | 1239 | if (mac->phydev) |
1240 | phy_start(mac->phydev); | 1240 | phy_start(mac->phydev); |
1241 | 1241 | ||
1242 | init_timer(&mac->tx->clean_timer); | 1242 | setup_timer(&mac->tx->clean_timer, pasemi_mac_tx_timer, |
1243 | mac->tx->clean_timer.function = pasemi_mac_tx_timer; | 1243 | (unsigned long)mac->tx); |
1244 | mac->tx->clean_timer.data = (unsigned long)mac->tx; | 1244 | mod_timer(&mac->tx->clean_timer, jiffies + HZ); |
1245 | mac->tx->clean_timer.expires = jiffies+HZ; | ||
1246 | add_timer(&mac->tx->clean_timer); | ||
1247 | 1245 | ||
1248 | return 0; | 1246 | return 0; |
1249 | 1247 | ||
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h index 6e426ae94692..0a5e204a0179 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h | |||
@@ -354,7 +354,7 @@ struct cmd_desc_type0 { | |||
354 | 354 | ||
355 | } __attribute__ ((aligned(64))); | 355 | } __attribute__ ((aligned(64))); |
356 | 356 | ||
357 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ | 357 | /* Note: sizeof(rcv_desc) should always be a multiple of 2 */ |
358 | struct rcv_desc { | 358 | struct rcv_desc { |
359 | __le16 reference_handle; | 359 | __le16 reference_handle; |
360 | __le16 reserved; | 360 | __le16 reserved; |
@@ -499,7 +499,7 @@ struct uni_data_desc{ | |||
499 | #define NETXEN_IMAGE_START 0x43000 /* compressed image */ | 499 | #define NETXEN_IMAGE_START 0x43000 /* compressed image */ |
500 | #define NETXEN_SECONDARY_START 0x200000 /* backup images */ | 500 | #define NETXEN_SECONDARY_START 0x200000 /* backup images */ |
501 | #define NETXEN_PXE_START 0x3E0000 /* PXE boot rom */ | 501 | #define NETXEN_PXE_START 0x3E0000 /* PXE boot rom */ |
502 | #define NETXEN_USER_START 0x3E8000 /* Firmare info */ | 502 | #define NETXEN_USER_START 0x3E8000 /* Firmware info */ |
503 | #define NETXEN_FIXED_START 0x3F0000 /* backup of crbinit */ | 503 | #define NETXEN_FIXED_START 0x3F0000 /* backup of crbinit */ |
504 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* very old flash */ | 504 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* very old flash */ |
505 | 505 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index fa4317611fd6..f221126a5c4e 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -314,7 +314,7 @@ struct qlcnic_fdt { | |||
314 | #define QLCNIC_BRDCFG_START 0x4000 /* board config */ | 314 | #define QLCNIC_BRDCFG_START 0x4000 /* board config */ |
315 | #define QLCNIC_BOOTLD_START 0x10000 /* bootld */ | 315 | #define QLCNIC_BOOTLD_START 0x10000 /* bootld */ |
316 | #define QLCNIC_IMAGE_START 0x43000 /* compressed image */ | 316 | #define QLCNIC_IMAGE_START 0x43000 /* compressed image */ |
317 | #define QLCNIC_USER_START 0x3E8000 /* Firmare info */ | 317 | #define QLCNIC_USER_START 0x3E8000 /* Firmware info */ |
318 | 318 | ||
319 | #define QLCNIC_FW_VERSION_OFFSET (QLCNIC_USER_START+0x408) | 319 | #define QLCNIC_FW_VERSION_OFFSET (QLCNIC_USER_START+0x408) |
320 | #define QLCNIC_FW_SIZE_OFFSET (QLCNIC_USER_START+0x40c) | 320 | #define QLCNIC_FW_SIZE_OFFSET (QLCNIC_USER_START+0x40c) |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index ad0020af2193..c70ab40d8698 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -2561,7 +2561,7 @@ static int rtl_check_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw) | |||
2561 | int rc = -EINVAL; | 2561 | int rc = -EINVAL; |
2562 | 2562 | ||
2563 | if (!rtl_fw_format_ok(tp, rtl_fw)) { | 2563 | if (!rtl_fw_format_ok(tp, rtl_fw)) { |
2564 | netif_err(tp, ifup, dev, "invalid firwmare\n"); | 2564 | netif_err(tp, ifup, dev, "invalid firmware\n"); |
2565 | goto out; | 2565 | goto out; |
2566 | } | 2566 | } |
2567 | 2567 | ||
@@ -5067,8 +5067,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp) | |||
5067 | RTL_W8(ChipCmd, CmdReset); | 5067 | RTL_W8(ChipCmd, CmdReset); |
5068 | 5068 | ||
5069 | rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100); | 5069 | rtl_udelay_loop_wait_low(tp, &rtl_chipcmd_cond, 100, 100); |
5070 | |||
5071 | netdev_reset_queue(tp->dev); | ||
5072 | } | 5070 | } |
5073 | 5071 | ||
5074 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) | 5072 | static void rtl_request_uncached_firmware(struct rtl8169_private *tp) |
@@ -7049,7 +7047,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
7049 | u32 status, len; | 7047 | u32 status, len; |
7050 | u32 opts[2]; | 7048 | u32 opts[2]; |
7051 | int frags; | 7049 | int frags; |
7052 | bool stop_queue; | ||
7053 | 7050 | ||
7054 | if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) { | 7051 | if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) { |
7055 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); | 7052 | netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); |
@@ -7090,8 +7087,6 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
7090 | 7087 | ||
7091 | txd->opts2 = cpu_to_le32(opts[1]); | 7088 | txd->opts2 = cpu_to_le32(opts[1]); |
7092 | 7089 | ||
7093 | netdev_sent_queue(dev, skb->len); | ||
7094 | |||
7095 | skb_tx_timestamp(skb); | 7090 | skb_tx_timestamp(skb); |
7096 | 7091 | ||
7097 | /* Force memory writes to complete before releasing descriptor */ | 7092 | /* Force memory writes to complete before releasing descriptor */ |
@@ -7106,16 +7101,11 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
7106 | 7101 | ||
7107 | tp->cur_tx += frags + 1; | 7102 | tp->cur_tx += frags + 1; |
7108 | 7103 | ||
7109 | stop_queue = !TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS); | 7104 | RTL_W8(TxPoll, NPQ); |
7110 | 7105 | ||
7111 | if (!skb->xmit_more || stop_queue || | 7106 | mmiowb(); |
7112 | netif_xmit_stopped(netdev_get_tx_queue(dev, 0))) { | ||
7113 | RTL_W8(TxPoll, NPQ); | ||
7114 | |||
7115 | mmiowb(); | ||
7116 | } | ||
7117 | 7107 | ||
7118 | if (stop_queue) { | 7108 | if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) { |
7119 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must | 7109 | /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must |
7120 | * not miss a ring update when it notices a stopped queue. | 7110 | * not miss a ring update when it notices a stopped queue. |
7121 | */ | 7111 | */ |
@@ -7198,7 +7188,6 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev) | |||
7198 | static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | 7188 | static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) |
7199 | { | 7189 | { |
7200 | unsigned int dirty_tx, tx_left; | 7190 | unsigned int dirty_tx, tx_left; |
7201 | unsigned int bytes_compl = 0, pkts_compl = 0; | ||
7202 | 7191 | ||
7203 | dirty_tx = tp->dirty_tx; | 7192 | dirty_tx = tp->dirty_tx; |
7204 | smp_rmb(); | 7193 | smp_rmb(); |
@@ -7222,8 +7211,10 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
7222 | rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb, | 7211 | rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb, |
7223 | tp->TxDescArray + entry); | 7212 | tp->TxDescArray + entry); |
7224 | if (status & LastFrag) { | 7213 | if (status & LastFrag) { |
7225 | pkts_compl++; | 7214 | u64_stats_update_begin(&tp->tx_stats.syncp); |
7226 | bytes_compl += tx_skb->skb->len; | 7215 | tp->tx_stats.packets++; |
7216 | tp->tx_stats.bytes += tx_skb->skb->len; | ||
7217 | u64_stats_update_end(&tp->tx_stats.syncp); | ||
7227 | dev_kfree_skb_any(tx_skb->skb); | 7218 | dev_kfree_skb_any(tx_skb->skb); |
7228 | tx_skb->skb = NULL; | 7219 | tx_skb->skb = NULL; |
7229 | } | 7220 | } |
@@ -7232,13 +7223,6 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) | |||
7232 | } | 7223 | } |
7233 | 7224 | ||
7234 | if (tp->dirty_tx != dirty_tx) { | 7225 | if (tp->dirty_tx != dirty_tx) { |
7235 | netdev_completed_queue(tp->dev, pkts_compl, bytes_compl); | ||
7236 | |||
7237 | u64_stats_update_begin(&tp->tx_stats.syncp); | ||
7238 | tp->tx_stats.packets += pkts_compl; | ||
7239 | tp->tx_stats.bytes += bytes_compl; | ||
7240 | u64_stats_update_end(&tp->tx_stats.syncp); | ||
7241 | |||
7242 | tp->dirty_tx = dirty_tx; | 7226 | tp->dirty_tx = dirty_tx; |
7243 | /* Sync with rtl8169_start_xmit: | 7227 | /* Sync with rtl8169_start_xmit: |
7244 | * - publish dirty_tx ring index (write barrier) | 7228 | * - publish dirty_tx ring index (write barrier) |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 4da8bd263997..736d5d1624a1 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -508,7 +508,6 @@ static struct sh_eth_cpu_data r8a779x_data = { | |||
508 | .tpauser = 1, | 508 | .tpauser = 1, |
509 | .hw_swap = 1, | 509 | .hw_swap = 1, |
510 | .rmiimode = 1, | 510 | .rmiimode = 1, |
511 | .shift_rd0 = 1, | ||
512 | }; | 511 | }; |
513 | 512 | ||
514 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) | 513 | static void sh_eth_set_rate_sh7724(struct net_device *ndev) |
@@ -1392,6 +1391,9 @@ static void sh_eth_dev_exit(struct net_device *ndev) | |||
1392 | msleep(2); /* max frame time at 10 Mbps < 1250 us */ | 1391 | msleep(2); /* max frame time at 10 Mbps < 1250 us */ |
1393 | sh_eth_get_stats(ndev); | 1392 | sh_eth_get_stats(ndev); |
1394 | sh_eth_reset(ndev); | 1393 | sh_eth_reset(ndev); |
1394 | |||
1395 | /* Set MAC address again */ | ||
1396 | update_mac_address(ndev); | ||
1395 | } | 1397 | } |
1396 | 1398 | ||
1397 | /* free Tx skb function */ | 1399 | /* free Tx skb function */ |
@@ -1407,6 +1409,8 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
1407 | txdesc = &mdp->tx_ring[entry]; | 1409 | txdesc = &mdp->tx_ring[entry]; |
1408 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) | 1410 | if (txdesc->status & cpu_to_edmac(mdp, TD_TACT)) |
1409 | break; | 1411 | break; |
1412 | /* TACT bit must be checked before all the following reads */ | ||
1413 | rmb(); | ||
1410 | /* Free the original skb. */ | 1414 | /* Free the original skb. */ |
1411 | if (mdp->tx_skbuff[entry]) { | 1415 | if (mdp->tx_skbuff[entry]) { |
1412 | dma_unmap_single(&ndev->dev, txdesc->addr, | 1416 | dma_unmap_single(&ndev->dev, txdesc->addr, |
@@ -1444,6 +1448,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1444 | limit = boguscnt; | 1448 | limit = boguscnt; |
1445 | rxdesc = &mdp->rx_ring[entry]; | 1449 | rxdesc = &mdp->rx_ring[entry]; |
1446 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { | 1450 | while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { |
1451 | /* RACT bit must be checked before all the following reads */ | ||
1452 | rmb(); | ||
1447 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1453 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
1448 | pkt_len = rxdesc->frame_length; | 1454 | pkt_len = rxdesc->frame_length; |
1449 | 1455 | ||
@@ -1455,8 +1461,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1455 | 1461 | ||
1456 | /* In case of almost all GETHER/ETHERs, the Receive Frame State | 1462 | /* In case of almost all GETHER/ETHERs, the Receive Frame State |
1457 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to | 1463 | * (RFS) bits in the Receive Descriptor 0 are from bit 9 to |
1458 | * bit 0. However, in case of the R8A7740, R8A779x, and | 1464 | * bit 0. However, in case of the R8A7740 and R7S72100 |
1459 | * R7S72100 the RFS bits are from bit 25 to bit 16. So, the | 1465 | * the RFS bits are from bit 25 to bit 16. So, the |
1460 | * driver needs right shifting by 16. | 1466 | * driver needs right shifting by 16. |
1461 | */ | 1467 | */ |
1462 | if (mdp->cd->shift_rd0) | 1468 | if (mdp->cd->shift_rd0) |
@@ -1523,6 +1529,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1523 | skb_checksum_none_assert(skb); | 1529 | skb_checksum_none_assert(skb); |
1524 | rxdesc->addr = dma_addr; | 1530 | rxdesc->addr = dma_addr; |
1525 | } | 1531 | } |
1532 | wmb(); /* RACT bit must be set after all the above writes */ | ||
1526 | if (entry >= mdp->num_rx_ring - 1) | 1533 | if (entry >= mdp->num_rx_ring - 1) |
1527 | rxdesc->status |= | 1534 | rxdesc->status |= |
1528 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); | 1535 | cpu_to_edmac(mdp, RD_RACT | RD_RFP | RD_RDEL); |
@@ -1535,7 +1542,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1535 | /* If we don't need to check status, don't. -KDU */ | 1542 | /* If we don't need to check status, don't. -KDU */ |
1536 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { | 1543 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { |
1537 | /* fix the values for the next receiving if RDE is set */ | 1544 | /* fix the values for the next receiving if RDE is set */ |
1538 | if (intr_status & EESR_RDE) { | 1545 | if (intr_status & EESR_RDE && mdp->reg_offset[RDFAR] != 0) { |
1539 | u32 count = (sh_eth_read(ndev, RDFAR) - | 1546 | u32 count = (sh_eth_read(ndev, RDFAR) - |
1540 | sh_eth_read(ndev, RDLAR)) >> 4; | 1547 | sh_eth_read(ndev, RDLAR)) >> 4; |
1541 | 1548 | ||
@@ -2174,7 +2181,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2174 | } | 2181 | } |
2175 | spin_unlock_irqrestore(&mdp->lock, flags); | 2182 | spin_unlock_irqrestore(&mdp->lock, flags); |
2176 | 2183 | ||
2177 | if (skb_padto(skb, ETH_ZLEN)) | 2184 | if (skb_put_padto(skb, ETH_ZLEN)) |
2178 | return NETDEV_TX_OK; | 2185 | return NETDEV_TX_OK; |
2179 | 2186 | ||
2180 | entry = mdp->cur_tx % mdp->num_tx_ring; | 2187 | entry = mdp->cur_tx % mdp->num_tx_ring; |
@@ -2192,6 +2199,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2192 | } | 2199 | } |
2193 | txdesc->buffer_length = skb->len; | 2200 | txdesc->buffer_length = skb->len; |
2194 | 2201 | ||
2202 | wmb(); /* TACT bit must be set after all the above writes */ | ||
2195 | if (entry >= mdp->num_tx_ring - 1) | 2203 | if (entry >= mdp->num_tx_ring - 1) |
2196 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); | 2204 | txdesc->status |= cpu_to_edmac(mdp, TD_TACT | TD_TDLE); |
2197 | else | 2205 | else |
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index 34389b6aa67c..9fb6948e14c6 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c | |||
@@ -1257,9 +1257,9 @@ static void rocker_port_set_enable(struct rocker_port *rocker_port, bool enable) | |||
1257 | u64 val = rocker_read64(rocker_port->rocker, PORT_PHYS_ENABLE); | 1257 | u64 val = rocker_read64(rocker_port->rocker, PORT_PHYS_ENABLE); |
1258 | 1258 | ||
1259 | if (enable) | 1259 | if (enable) |
1260 | val |= 1 << rocker_port->lport; | 1260 | val |= 1ULL << rocker_port->lport; |
1261 | else | 1261 | else |
1262 | val &= ~(1 << rocker_port->lport); | 1262 | val &= ~(1ULL << rocker_port->lport); |
1263 | rocker_write64(rocker_port->rocker, PORT_PHYS_ENABLE, val); | 1263 | rocker_write64(rocker_port->rocker, PORT_PHYS_ENABLE, val); |
1264 | } | 1264 | } |
1265 | 1265 | ||
@@ -4201,6 +4201,8 @@ static int rocker_probe_ports(struct rocker *rocker) | |||
4201 | 4201 | ||
4202 | alloc_size = sizeof(struct rocker_port *) * rocker->port_count; | 4202 | alloc_size = sizeof(struct rocker_port *) * rocker->port_count; |
4203 | rocker->ports = kmalloc(alloc_size, GFP_KERNEL); | 4203 | rocker->ports = kmalloc(alloc_size, GFP_KERNEL); |
4204 | if (!rocker->ports) | ||
4205 | return -ENOMEM; | ||
4204 | for (i = 0; i < rocker->port_count; i++) { | 4206 | for (i = 0; i < rocker->port_count; i++) { |
4205 | err = rocker_probe_port(rocker, i); | 4207 | err = rocker_probe_port(rocker, i); |
4206 | if (err) | 4208 | if (err) |
diff --git a/drivers/net/ethernet/smsc/smc91c92_cs.c b/drivers/net/ethernet/smsc/smc91c92_cs.c index 6b33127ab352..3449893aea8d 100644 --- a/drivers/net/ethernet/smsc/smc91c92_cs.c +++ b/drivers/net/ethernet/smsc/smc91c92_cs.c | |||
@@ -1070,11 +1070,8 @@ static int smc_open(struct net_device *dev) | |||
1070 | smc->packets_waiting = 0; | 1070 | smc->packets_waiting = 0; |
1071 | 1071 | ||
1072 | smc_reset(dev); | 1072 | smc_reset(dev); |
1073 | init_timer(&smc->media); | 1073 | setup_timer(&smc->media, media_check, (u_long)dev); |
1074 | smc->media.function = media_check; | 1074 | mod_timer(&smc->media, jiffies + HZ); |
1075 | smc->media.data = (u_long) dev; | ||
1076 | smc->media.expires = jiffies + HZ; | ||
1077 | add_timer(&smc->media); | ||
1078 | 1075 | ||
1079 | return 0; | 1076 | return 0; |
1080 | } /* smc_open */ | 1077 | } /* smc_open */ |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 88a55f95fe09..209ee1b27f8d 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -91,6 +91,10 @@ static const char version[] = | |||
91 | 91 | ||
92 | #include "smc91x.h" | 92 | #include "smc91x.h" |
93 | 93 | ||
94 | #if defined(CONFIG_ASSABET_NEPONSET) | ||
95 | #include <mach/neponset.h> | ||
96 | #endif | ||
97 | |||
94 | #ifndef SMC_NOWAIT | 98 | #ifndef SMC_NOWAIT |
95 | # define SMC_NOWAIT 0 | 99 | # define SMC_NOWAIT 0 |
96 | #endif | 100 | #endif |
@@ -2355,8 +2359,9 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2355 | ret = smc_request_attrib(pdev, ndev); | 2359 | ret = smc_request_attrib(pdev, ndev); |
2356 | if (ret) | 2360 | if (ret) |
2357 | goto out_release_io; | 2361 | goto out_release_io; |
2358 | #if defined(CONFIG_SA1100_ASSABET) | 2362 | #if defined(CONFIG_ASSABET_NEPONSET) |
2359 | neponset_ncr_set(NCR_ENET_OSC_EN); | 2363 | if (machine_is_assabet() && machine_has_neponset()) |
2364 | neponset_ncr_set(NCR_ENET_OSC_EN); | ||
2360 | #endif | 2365 | #endif |
2361 | platform_set_drvdata(pdev, ndev); | 2366 | platform_set_drvdata(pdev, ndev); |
2362 | ret = smc_enable_device(pdev); | 2367 | ret = smc_enable_device(pdev); |
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index be67baf5f677..3a18501d1068 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
@@ -39,14 +39,7 @@ | |||
39 | * Define your architecture specific bus configuration parameters here. | 39 | * Define your architecture specific bus configuration parameters here. |
40 | */ | 40 | */ |
41 | 41 | ||
42 | #if defined(CONFIG_ARCH_LUBBOCK) ||\ | 42 | #if defined(CONFIG_ARM) |
43 | defined(CONFIG_MACH_MAINSTONE) ||\ | ||
44 | defined(CONFIG_MACH_ZYLONITE) ||\ | ||
45 | defined(CONFIG_MACH_LITTLETON) ||\ | ||
46 | defined(CONFIG_MACH_ZYLONITE2) ||\ | ||
47 | defined(CONFIG_ARCH_VIPER) ||\ | ||
48 | defined(CONFIG_MACH_STARGATE2) ||\ | ||
49 | defined(CONFIG_ARCH_VERSATILE) | ||
50 | 43 | ||
51 | #include <asm/mach-types.h> | 44 | #include <asm/mach-types.h> |
52 | 45 | ||
@@ -74,95 +67,8 @@ | |||
74 | /* We actually can't write halfwords properly if not word aligned */ | 67 | /* We actually can't write halfwords properly if not word aligned */ |
75 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | 68 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) |
76 | { | 69 | { |
77 | if ((machine_is_mainstone() || machine_is_stargate2()) && reg & 2) { | 70 | if ((machine_is_mainstone() || machine_is_stargate2() || |
78 | unsigned int v = val << 16; | 71 | machine_is_pxa_idp()) && reg & 2) { |
79 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | ||
80 | writel(v, ioaddr + (reg & ~2)); | ||
81 | } else { | ||
82 | writew(val, ioaddr + reg); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | #elif defined(CONFIG_SA1100_PLEB) | ||
87 | /* We can only do 16-bit reads and writes in the static memory space. */ | ||
88 | #define SMC_CAN_USE_8BIT 1 | ||
89 | #define SMC_CAN_USE_16BIT 1 | ||
90 | #define SMC_CAN_USE_32BIT 0 | ||
91 | #define SMC_IO_SHIFT 0 | ||
92 | #define SMC_NOWAIT 1 | ||
93 | |||
94 | #define SMC_inb(a, r) readb((a) + (r)) | ||
95 | #define SMC_insb(a, r, p, l) readsb((a) + (r), p, (l)) | ||
96 | #define SMC_inw(a, r) readw((a) + (r)) | ||
97 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
98 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
99 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) | ||
100 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
101 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
102 | |||
103 | #define SMC_IRQ_FLAGS (-1) | ||
104 | |||
105 | #elif defined(CONFIG_SA1100_ASSABET) | ||
106 | |||
107 | #include <mach/neponset.h> | ||
108 | |||
109 | /* We can only do 8-bit reads and writes in the static memory space. */ | ||
110 | #define SMC_CAN_USE_8BIT 1 | ||
111 | #define SMC_CAN_USE_16BIT 0 | ||
112 | #define SMC_CAN_USE_32BIT 0 | ||
113 | #define SMC_NOWAIT 1 | ||
114 | |||
115 | /* The first two address lines aren't connected... */ | ||
116 | #define SMC_IO_SHIFT 2 | ||
117 | |||
118 | #define SMC_inb(a, r) readb((a) + (r)) | ||
119 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
120 | #define SMC_insb(a, r, p, l) readsb((a) + (r), p, (l)) | ||
121 | #define SMC_outsb(a, r, p, l) writesb((a) + (r), p, (l)) | ||
122 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
123 | |||
124 | #elif defined(CONFIG_MACH_LOGICPD_PXA270) || \ | ||
125 | defined(CONFIG_MACH_NOMADIK_8815NHK) | ||
126 | |||
127 | #define SMC_CAN_USE_8BIT 0 | ||
128 | #define SMC_CAN_USE_16BIT 1 | ||
129 | #define SMC_CAN_USE_32BIT 0 | ||
130 | #define SMC_IO_SHIFT 0 | ||
131 | #define SMC_NOWAIT 1 | ||
132 | |||
133 | #define SMC_inw(a, r) readw((a) + (r)) | ||
134 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
135 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
136 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
137 | |||
138 | #elif defined(CONFIG_ARCH_INNOKOM) || \ | ||
139 | defined(CONFIG_ARCH_PXA_IDP) || \ | ||
140 | defined(CONFIG_ARCH_RAMSES) || \ | ||
141 | defined(CONFIG_ARCH_PCM027) | ||
142 | |||
143 | #define SMC_CAN_USE_8BIT 1 | ||
144 | #define SMC_CAN_USE_16BIT 1 | ||
145 | #define SMC_CAN_USE_32BIT 1 | ||
146 | #define SMC_IO_SHIFT 0 | ||
147 | #define SMC_NOWAIT 1 | ||
148 | #define SMC_USE_PXA_DMA 1 | ||
149 | |||
150 | #define SMC_inb(a, r) readb((a) + (r)) | ||
151 | #define SMC_inw(a, r) readw((a) + (r)) | ||
152 | #define SMC_inl(a, r) readl((a) + (r)) | ||
153 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
154 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
155 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
156 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
157 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
158 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
159 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
160 | |||
161 | /* We actually can't write halfwords properly if not word aligned */ | ||
162 | static inline void | ||
163 | SMC_outw(u16 val, void __iomem *ioaddr, int reg) | ||
164 | { | ||
165 | if (reg & 2) { | ||
166 | unsigned int v = val << 16; | 72 | unsigned int v = val << 16; |
167 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | 73 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; |
168 | writel(v, ioaddr + (reg & ~2)); | 74 | writel(v, ioaddr + (reg & ~2)); |
@@ -237,20 +143,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
237 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 143 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
238 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX | 144 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX |
239 | 145 | ||
240 | #elif defined(CONFIG_ARCH_MSM) | ||
241 | |||
242 | #define SMC_CAN_USE_8BIT 0 | ||
243 | #define SMC_CAN_USE_16BIT 1 | ||
244 | #define SMC_CAN_USE_32BIT 0 | ||
245 | #define SMC_NOWAIT 1 | ||
246 | |||
247 | #define SMC_inw(a, r) readw((a) + (r)) | ||
248 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
249 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | ||
250 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | ||
251 | |||
252 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | ||
253 | |||
254 | #elif defined(CONFIG_COLDFIRE) | 146 | #elif defined(CONFIG_COLDFIRE) |
255 | 147 | ||
256 | #define SMC_CAN_USE_8BIT 0 | 148 | #define SMC_CAN_USE_8BIT 0 |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 55e89b3838f1..a0ea84fe6519 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -310,11 +310,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
310 | spin_lock_irqsave(&priv->lock, flags); | 310 | spin_lock_irqsave(&priv->lock, flags); |
311 | if (!priv->eee_active) { | 311 | if (!priv->eee_active) { |
312 | priv->eee_active = 1; | 312 | priv->eee_active = 1; |
313 | init_timer(&priv->eee_ctrl_timer); | 313 | setup_timer(&priv->eee_ctrl_timer, |
314 | priv->eee_ctrl_timer.function = stmmac_eee_ctrl_timer; | 314 | stmmac_eee_ctrl_timer, |
315 | priv->eee_ctrl_timer.data = (unsigned long)priv; | 315 | (unsigned long)priv); |
316 | priv->eee_ctrl_timer.expires = STMMAC_LPI_T(eee_timer); | 316 | mod_timer(&priv->eee_ctrl_timer, |
317 | add_timer(&priv->eee_ctrl_timer); | 317 | STMMAC_LPI_T(eee_timer)); |
318 | 318 | ||
319 | priv->hw->mac->set_eee_timer(priv->hw, | 319 | priv->hw->mac->set_eee_timer(priv->hw, |
320 | STMMAC_DEFAULT_LIT_LS, | 320 | STMMAC_DEFAULT_LIT_LS, |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 4b51f903fb73..0c5842aeb807 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -6989,10 +6989,10 @@ static int niu_class_to_ethflow(u64 class, int *flow_type) | |||
6989 | *flow_type = IP_USER_FLOW; | 6989 | *flow_type = IP_USER_FLOW; |
6990 | break; | 6990 | break; |
6991 | default: | 6991 | default: |
6992 | return 0; | 6992 | return -EINVAL; |
6993 | } | 6993 | } |
6994 | 6994 | ||
6995 | return 1; | 6995 | return 0; |
6996 | } | 6996 | } |
6997 | 6997 | ||
6998 | static int niu_ethflow_to_class(int flow_type, u64 *class) | 6998 | static int niu_ethflow_to_class(int flow_type, u64 *class) |
@@ -7198,11 +7198,9 @@ static int niu_get_ethtool_tcam_entry(struct niu *np, | |||
7198 | class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >> | 7198 | class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >> |
7199 | TCAM_V4KEY0_CLASS_CODE_SHIFT; | 7199 | TCAM_V4KEY0_CLASS_CODE_SHIFT; |
7200 | ret = niu_class_to_ethflow(class, &fsp->flow_type); | 7200 | ret = niu_class_to_ethflow(class, &fsp->flow_type); |
7201 | |||
7202 | if (ret < 0) { | 7201 | if (ret < 0) { |
7203 | netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", | 7202 | netdev_info(np->dev, "niu%d: niu_class_to_ethflow failed\n", |
7204 | parent->index); | 7203 | parent->index); |
7205 | ret = -EINVAL; | ||
7206 | goto out; | 7204 | goto out; |
7207 | } | 7205 | } |
7208 | 7206 | ||
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7d8dd0d2182e..a1bbaf6352ba 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1103,7 +1103,7 @@ static inline void cpsw_add_dual_emac_def_ale_entries( | |||
1103 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, | 1103 | cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast, |
1104 | port_mask, ALE_VLAN, slave->port_vlan, 0); | 1104 | port_mask, ALE_VLAN, slave->port_vlan, 0); |
1105 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, | 1105 | cpsw_ale_add_ucast(priv->ale, priv->mac_addr, |
1106 | priv->host_port, ALE_VLAN, slave->port_vlan); | 1106 | priv->host_port, ALE_VLAN | ALE_SECURE, slave->port_vlan); |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | static void soft_reset_slave(struct cpsw_slave *slave) | 1109 | static void soft_reset_slave(struct cpsw_slave *slave) |
@@ -2466,6 +2466,7 @@ static int cpsw_remove(struct platform_device *pdev) | |||
2466 | return 0; | 2466 | return 0; |
2467 | } | 2467 | } |
2468 | 2468 | ||
2469 | #ifdef CONFIG_PM_SLEEP | ||
2469 | static int cpsw_suspend(struct device *dev) | 2470 | static int cpsw_suspend(struct device *dev) |
2470 | { | 2471 | { |
2471 | struct platform_device *pdev = to_platform_device(dev); | 2472 | struct platform_device *pdev = to_platform_device(dev); |
@@ -2518,11 +2519,9 @@ static int cpsw_resume(struct device *dev) | |||
2518 | } | 2519 | } |
2519 | return 0; | 2520 | return 0; |
2520 | } | 2521 | } |
2522 | #endif | ||
2521 | 2523 | ||
2522 | static const struct dev_pm_ops cpsw_pm_ops = { | 2524 | static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume); |
2523 | .suspend = cpsw_suspend, | ||
2524 | .resume = cpsw_resume, | ||
2525 | }; | ||
2526 | 2525 | ||
2527 | static const struct of_device_id cpsw_of_mtable[] = { | 2526 | static const struct of_device_id cpsw_of_mtable[] = { |
2528 | { .compatible = "ti,cpsw", }, | 2527 | { .compatible = "ti,cpsw", }, |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 98655b44b97e..c00084d689f3 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
@@ -423,6 +423,7 @@ static int davinci_mdio_remove(struct platform_device *pdev) | |||
423 | return 0; | 423 | return 0; |
424 | } | 424 | } |
425 | 425 | ||
426 | #ifdef CONFIG_PM_SLEEP | ||
426 | static int davinci_mdio_suspend(struct device *dev) | 427 | static int davinci_mdio_suspend(struct device *dev) |
427 | { | 428 | { |
428 | struct davinci_mdio_data *data = dev_get_drvdata(dev); | 429 | struct davinci_mdio_data *data = dev_get_drvdata(dev); |
@@ -464,10 +465,10 @@ static int davinci_mdio_resume(struct device *dev) | |||
464 | 465 | ||
465 | return 0; | 466 | return 0; |
466 | } | 467 | } |
468 | #endif | ||
467 | 469 | ||
468 | static const struct dev_pm_ops davinci_mdio_pm_ops = { | 470 | static const struct dev_pm_ops davinci_mdio_pm_ops = { |
469 | .suspend_late = davinci_mdio_suspend, | 471 | SET_LATE_SYSTEM_SLEEP_PM_OPS(davinci_mdio_suspend, davinci_mdio_resume) |
470 | .resume_early = davinci_mdio_resume, | ||
471 | }; | 472 | }; |
472 | 473 | ||
473 | #if IS_ENABLED(CONFIG_OF) | 474 | #if IS_ENABLED(CONFIG_OF) |
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c index f7e0f0f7c2e2..9e16a2819d48 100644 --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c | |||
@@ -938,7 +938,7 @@ static void eth_set_mcast_list(struct net_device *dev) | |||
938 | int i; | 938 | int i; |
939 | static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 939 | static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
940 | 940 | ||
941 | if (dev->flags & IFF_ALLMULTI) { | 941 | if ((dev->flags & IFF_ALLMULTI) && !(dev->flags & IFF_PROMISC)) { |
942 | for (i = 0; i < ETH_ALEN; i++) { | 942 | for (i = 0; i < ETH_ALEN; i++) { |
943 | __raw_writel(allmulti[i], &port->regs->mcast_addr[i]); | 943 | __raw_writel(allmulti[i], &port->regs->mcast_addr[i]); |
944 | __raw_writel(allmulti[i], &port->regs->mcast_mask[i]); | 944 | __raw_writel(allmulti[i], &port->regs->mcast_mask[i]); |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index e40fdfccc9c1..27ecc5c4fa26 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -654,11 +654,14 @@ static void macvtap_skb_to_vnet_hdr(struct macvtap_queue *q, | |||
654 | } /* else everything is zero */ | 654 | } /* else everything is zero */ |
655 | } | 655 | } |
656 | 656 | ||
657 | /* Neighbour code has some assumptions on HH_DATA_MOD alignment */ | ||
658 | #define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) | ||
659 | |||
657 | /* Get packet from user space buffer */ | 660 | /* Get packet from user space buffer */ |
658 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | 661 | static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, |
659 | struct iov_iter *from, int noblock) | 662 | struct iov_iter *from, int noblock) |
660 | { | 663 | { |
661 | int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); | 664 | int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); |
662 | struct sk_buff *skb; | 665 | struct sk_buff *skb; |
663 | struct macvlan_dev *vlan; | 666 | struct macvlan_dev *vlan; |
664 | unsigned long total_len = iov_iter_count(from); | 667 | unsigned long total_len = iov_iter_count(from); |
@@ -722,7 +725,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
722 | linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); | 725 | linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len); |
723 | } | 726 | } |
724 | 727 | ||
725 | skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, | 728 | skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, |
726 | linear, noblock, &err); | 729 | linear, noblock, &err); |
727 | if (!skb) | 730 | if (!skb) |
728 | goto err; | 731 | goto err; |
diff --git a/drivers/net/phy/amd-xgbe-phy.c b/drivers/net/phy/amd-xgbe-phy.c index 9e3af54c9010..32efbd48f326 100644 --- a/drivers/net/phy/amd-xgbe-phy.c +++ b/drivers/net/phy/amd-xgbe-phy.c | |||
@@ -92,6 +92,8 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
92 | #define XGBE_PHY_CDR_RATE_PROPERTY "amd,serdes-cdr-rate" | 92 | #define XGBE_PHY_CDR_RATE_PROPERTY "amd,serdes-cdr-rate" |
93 | #define XGBE_PHY_PQ_SKEW_PROPERTY "amd,serdes-pq-skew" | 93 | #define XGBE_PHY_PQ_SKEW_PROPERTY "amd,serdes-pq-skew" |
94 | #define XGBE_PHY_TX_AMP_PROPERTY "amd,serdes-tx-amp" | 94 | #define XGBE_PHY_TX_AMP_PROPERTY "amd,serdes-tx-amp" |
95 | #define XGBE_PHY_DFE_CFG_PROPERTY "amd,serdes-dfe-tap-config" | ||
96 | #define XGBE_PHY_DFE_ENA_PROPERTY "amd,serdes-dfe-tap-enable" | ||
95 | 97 | ||
96 | #define XGBE_PHY_SPEEDS 3 | 98 | #define XGBE_PHY_SPEEDS 3 |
97 | #define XGBE_PHY_SPEED_1000 0 | 99 | #define XGBE_PHY_SPEED_1000 0 |
@@ -177,10 +179,12 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
177 | #define SPEED_10000_BLWC 0 | 179 | #define SPEED_10000_BLWC 0 |
178 | #define SPEED_10000_CDR 0x7 | 180 | #define SPEED_10000_CDR 0x7 |
179 | #define SPEED_10000_PLL 0x1 | 181 | #define SPEED_10000_PLL 0x1 |
180 | #define SPEED_10000_PQ 0x1e | 182 | #define SPEED_10000_PQ 0x12 |
181 | #define SPEED_10000_RATE 0x0 | 183 | #define SPEED_10000_RATE 0x0 |
182 | #define SPEED_10000_TXAMP 0xa | 184 | #define SPEED_10000_TXAMP 0xa |
183 | #define SPEED_10000_WORD 0x7 | 185 | #define SPEED_10000_WORD 0x7 |
186 | #define SPEED_10000_DFE_TAP_CONFIG 0x1 | ||
187 | #define SPEED_10000_DFE_TAP_ENABLE 0x7f | ||
184 | 188 | ||
185 | #define SPEED_2500_BLWC 1 | 189 | #define SPEED_2500_BLWC 1 |
186 | #define SPEED_2500_CDR 0x2 | 190 | #define SPEED_2500_CDR 0x2 |
@@ -189,6 +193,8 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
189 | #define SPEED_2500_RATE 0x1 | 193 | #define SPEED_2500_RATE 0x1 |
190 | #define SPEED_2500_TXAMP 0xf | 194 | #define SPEED_2500_TXAMP 0xf |
191 | #define SPEED_2500_WORD 0x1 | 195 | #define SPEED_2500_WORD 0x1 |
196 | #define SPEED_2500_DFE_TAP_CONFIG 0x3 | ||
197 | #define SPEED_2500_DFE_TAP_ENABLE 0x0 | ||
192 | 198 | ||
193 | #define SPEED_1000_BLWC 1 | 199 | #define SPEED_1000_BLWC 1 |
194 | #define SPEED_1000_CDR 0x2 | 200 | #define SPEED_1000_CDR 0x2 |
@@ -197,16 +203,25 @@ MODULE_DESCRIPTION("AMD 10GbE (amd-xgbe) PHY driver"); | |||
197 | #define SPEED_1000_RATE 0x3 | 203 | #define SPEED_1000_RATE 0x3 |
198 | #define SPEED_1000_TXAMP 0xf | 204 | #define SPEED_1000_TXAMP 0xf |
199 | #define SPEED_1000_WORD 0x1 | 205 | #define SPEED_1000_WORD 0x1 |
206 | #define SPEED_1000_DFE_TAP_CONFIG 0x3 | ||
207 | #define SPEED_1000_DFE_TAP_ENABLE 0x0 | ||
200 | 208 | ||
201 | /* SerDes RxTx register offsets */ | 209 | /* SerDes RxTx register offsets */ |
210 | #define RXTX_REG6 0x0018 | ||
202 | #define RXTX_REG20 0x0050 | 211 | #define RXTX_REG20 0x0050 |
212 | #define RXTX_REG22 0x0058 | ||
203 | #define RXTX_REG114 0x01c8 | 213 | #define RXTX_REG114 0x01c8 |
214 | #define RXTX_REG129 0x0204 | ||
204 | 215 | ||
205 | /* SerDes RxTx register entry bit positions and sizes */ | 216 | /* SerDes RxTx register entry bit positions and sizes */ |
217 | #define RXTX_REG6_RESETB_RXD_INDEX 8 | ||
218 | #define RXTX_REG6_RESETB_RXD_WIDTH 1 | ||
206 | #define RXTX_REG20_BLWC_ENA_INDEX 2 | 219 | #define RXTX_REG20_BLWC_ENA_INDEX 2 |
207 | #define RXTX_REG20_BLWC_ENA_WIDTH 1 | 220 | #define RXTX_REG20_BLWC_ENA_WIDTH 1 |
208 | #define RXTX_REG114_PQ_REG_INDEX 9 | 221 | #define RXTX_REG114_PQ_REG_INDEX 9 |
209 | #define RXTX_REG114_PQ_REG_WIDTH 7 | 222 | #define RXTX_REG114_PQ_REG_WIDTH 7 |
223 | #define RXTX_REG129_RXDFE_CONFIG_INDEX 14 | ||
224 | #define RXTX_REG129_RXDFE_CONFIG_WIDTH 2 | ||
210 | 225 | ||
211 | /* Bit setting and getting macros | 226 | /* Bit setting and getting macros |
212 | * The get macro will extract the current bit field value from within | 227 | * The get macro will extract the current bit field value from within |
@@ -333,6 +348,18 @@ static const u32 amd_xgbe_phy_serdes_tx_amp[] = { | |||
333 | SPEED_10000_TXAMP, | 348 | SPEED_10000_TXAMP, |
334 | }; | 349 | }; |
335 | 350 | ||
351 | static const u32 amd_xgbe_phy_serdes_dfe_tap_cfg[] = { | ||
352 | SPEED_1000_DFE_TAP_CONFIG, | ||
353 | SPEED_2500_DFE_TAP_CONFIG, | ||
354 | SPEED_10000_DFE_TAP_CONFIG, | ||
355 | }; | ||
356 | |||
357 | static const u32 amd_xgbe_phy_serdes_dfe_tap_ena[] = { | ||
358 | SPEED_1000_DFE_TAP_ENABLE, | ||
359 | SPEED_2500_DFE_TAP_ENABLE, | ||
360 | SPEED_10000_DFE_TAP_ENABLE, | ||
361 | }; | ||
362 | |||
336 | enum amd_xgbe_phy_an { | 363 | enum amd_xgbe_phy_an { |
337 | AMD_XGBE_AN_READY = 0, | 364 | AMD_XGBE_AN_READY = 0, |
338 | AMD_XGBE_AN_PAGE_RECEIVED, | 365 | AMD_XGBE_AN_PAGE_RECEIVED, |
@@ -393,6 +420,8 @@ struct amd_xgbe_phy_priv { | |||
393 | u32 serdes_cdr_rate[XGBE_PHY_SPEEDS]; | 420 | u32 serdes_cdr_rate[XGBE_PHY_SPEEDS]; |
394 | u32 serdes_pq_skew[XGBE_PHY_SPEEDS]; | 421 | u32 serdes_pq_skew[XGBE_PHY_SPEEDS]; |
395 | u32 serdes_tx_amp[XGBE_PHY_SPEEDS]; | 422 | u32 serdes_tx_amp[XGBE_PHY_SPEEDS]; |
423 | u32 serdes_dfe_tap_cfg[XGBE_PHY_SPEEDS]; | ||
424 | u32 serdes_dfe_tap_ena[XGBE_PHY_SPEEDS]; | ||
396 | 425 | ||
397 | /* Auto-negotiation state machine support */ | 426 | /* Auto-negotiation state machine support */ |
398 | struct mutex an_mutex; | 427 | struct mutex an_mutex; |
@@ -481,11 +510,16 @@ static void amd_xgbe_phy_serdes_complete_ratechange(struct phy_device *phydev) | |||
481 | status = XSIR0_IOREAD(priv, SIR0_STATUS); | 510 | status = XSIR0_IOREAD(priv, SIR0_STATUS); |
482 | if (XSIR_GET_BITS(status, SIR0_STATUS, RX_READY) && | 511 | if (XSIR_GET_BITS(status, SIR0_STATUS, RX_READY) && |
483 | XSIR_GET_BITS(status, SIR0_STATUS, TX_READY)) | 512 | XSIR_GET_BITS(status, SIR0_STATUS, TX_READY)) |
484 | return; | 513 | goto rx_reset; |
485 | } | 514 | } |
486 | 515 | ||
487 | netdev_dbg(phydev->attached_dev, "SerDes rx/tx not ready (%#hx)\n", | 516 | netdev_dbg(phydev->attached_dev, "SerDes rx/tx not ready (%#hx)\n", |
488 | status); | 517 | status); |
518 | |||
519 | rx_reset: | ||
520 | /* Perform Rx reset for the DFE changes */ | ||
521 | XRXTX_IOWRITE_BITS(priv, RXTX_REG6, RESETB_RXD, 0); | ||
522 | XRXTX_IOWRITE_BITS(priv, RXTX_REG6, RESETB_RXD, 1); | ||
489 | } | 523 | } |
490 | 524 | ||
491 | static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) | 525 | static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) |
@@ -534,6 +568,10 @@ static int amd_xgbe_phy_xgmii_mode(struct phy_device *phydev) | |||
534 | priv->serdes_blwc[XGBE_PHY_SPEED_10000]); | 568 | priv->serdes_blwc[XGBE_PHY_SPEED_10000]); |
535 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 569 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
536 | priv->serdes_pq_skew[XGBE_PHY_SPEED_10000]); | 570 | priv->serdes_pq_skew[XGBE_PHY_SPEED_10000]); |
571 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
572 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_10000]); | ||
573 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
574 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_10000]); | ||
537 | 575 | ||
538 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 576 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
539 | 577 | ||
@@ -586,6 +624,10 @@ static int amd_xgbe_phy_gmii_2500_mode(struct phy_device *phydev) | |||
586 | priv->serdes_blwc[XGBE_PHY_SPEED_2500]); | 624 | priv->serdes_blwc[XGBE_PHY_SPEED_2500]); |
587 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 625 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
588 | priv->serdes_pq_skew[XGBE_PHY_SPEED_2500]); | 626 | priv->serdes_pq_skew[XGBE_PHY_SPEED_2500]); |
627 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
628 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_2500]); | ||
629 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
630 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_2500]); | ||
589 | 631 | ||
590 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 632 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
591 | 633 | ||
@@ -638,6 +680,10 @@ static int amd_xgbe_phy_gmii_mode(struct phy_device *phydev) | |||
638 | priv->serdes_blwc[XGBE_PHY_SPEED_1000]); | 680 | priv->serdes_blwc[XGBE_PHY_SPEED_1000]); |
639 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, | 681 | XRXTX_IOWRITE_BITS(priv, RXTX_REG114, PQ_REG, |
640 | priv->serdes_pq_skew[XGBE_PHY_SPEED_1000]); | 682 | priv->serdes_pq_skew[XGBE_PHY_SPEED_1000]); |
683 | XRXTX_IOWRITE_BITS(priv, RXTX_REG129, RXDFE_CONFIG, | ||
684 | priv->serdes_dfe_tap_cfg[XGBE_PHY_SPEED_1000]); | ||
685 | XRXTX_IOWRITE(priv, RXTX_REG22, | ||
686 | priv->serdes_dfe_tap_ena[XGBE_PHY_SPEED_1000]); | ||
641 | 687 | ||
642 | amd_xgbe_phy_serdes_complete_ratechange(phydev); | 688 | amd_xgbe_phy_serdes_complete_ratechange(phydev); |
643 | 689 | ||
@@ -1668,6 +1714,38 @@ static int amd_xgbe_phy_probe(struct phy_device *phydev) | |||
1668 | sizeof(priv->serdes_tx_amp)); | 1714 | sizeof(priv->serdes_tx_amp)); |
1669 | } | 1715 | } |
1670 | 1716 | ||
1717 | if (device_property_present(phy_dev, XGBE_PHY_DFE_CFG_PROPERTY)) { | ||
1718 | ret = device_property_read_u32_array(phy_dev, | ||
1719 | XGBE_PHY_DFE_CFG_PROPERTY, | ||
1720 | priv->serdes_dfe_tap_cfg, | ||
1721 | XGBE_PHY_SPEEDS); | ||
1722 | if (ret) { | ||
1723 | dev_err(dev, "invalid %s property\n", | ||
1724 | XGBE_PHY_DFE_CFG_PROPERTY); | ||
1725 | goto err_sir1; | ||
1726 | } | ||
1727 | } else { | ||
1728 | memcpy(priv->serdes_dfe_tap_cfg, | ||
1729 | amd_xgbe_phy_serdes_dfe_tap_cfg, | ||
1730 | sizeof(priv->serdes_dfe_tap_cfg)); | ||
1731 | } | ||
1732 | |||
1733 | if (device_property_present(phy_dev, XGBE_PHY_DFE_ENA_PROPERTY)) { | ||
1734 | ret = device_property_read_u32_array(phy_dev, | ||
1735 | XGBE_PHY_DFE_ENA_PROPERTY, | ||
1736 | priv->serdes_dfe_tap_ena, | ||
1737 | XGBE_PHY_SPEEDS); | ||
1738 | if (ret) { | ||
1739 | dev_err(dev, "invalid %s property\n", | ||
1740 | XGBE_PHY_DFE_ENA_PROPERTY); | ||
1741 | goto err_sir1; | ||
1742 | } | ||
1743 | } else { | ||
1744 | memcpy(priv->serdes_dfe_tap_ena, | ||
1745 | amd_xgbe_phy_serdes_dfe_tap_ena, | ||
1746 | sizeof(priv->serdes_dfe_tap_ena)); | ||
1747 | } | ||
1748 | |||
1671 | phydev->priv = priv; | 1749 | phydev->priv = priv; |
1672 | 1750 | ||
1673 | if (!priv->adev || acpi_disabled) | 1751 | if (!priv->adev || acpi_disabled) |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index cdcac6aa4260..52cd8db2c57d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -236,6 +236,25 @@ static inline unsigned int phy_find_valid(unsigned int idx, u32 features) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * phy_check_valid - check if there is a valid PHY setting which matches | ||
240 | * speed, duplex, and feature mask | ||
241 | * @speed: speed to match | ||
242 | * @duplex: duplex to match | ||
243 | * @features: A mask of the valid settings | ||
244 | * | ||
245 | * Description: Returns true if there is a valid setting, false otherwise. | ||
246 | */ | ||
247 | static inline bool phy_check_valid(int speed, int duplex, u32 features) | ||
248 | { | ||
249 | unsigned int idx; | ||
250 | |||
251 | idx = phy_find_valid(phy_find_setting(speed, duplex), features); | ||
252 | |||
253 | return settings[idx].speed == speed && settings[idx].duplex == duplex && | ||
254 | (settings[idx].setting & features); | ||
255 | } | ||
256 | |||
257 | /** | ||
239 | * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex | 258 | * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex |
240 | * @phydev: the target phy_device struct | 259 | * @phydev: the target phy_device struct |
241 | * | 260 | * |
@@ -1045,7 +1064,6 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1045 | int eee_lp, eee_cap, eee_adv; | 1064 | int eee_lp, eee_cap, eee_adv; |
1046 | u32 lp, cap, adv; | 1065 | u32 lp, cap, adv; |
1047 | int status; | 1066 | int status; |
1048 | unsigned int idx; | ||
1049 | 1067 | ||
1050 | /* Read phy status to properly get the right settings */ | 1068 | /* Read phy status to properly get the right settings */ |
1051 | status = phy_read_status(phydev); | 1069 | status = phy_read_status(phydev); |
@@ -1077,8 +1095,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1077 | 1095 | ||
1078 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1096 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
1079 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1097 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
1080 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1098 | if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) |
1081 | if (!(lp & adv & settings[idx].setting)) | ||
1082 | goto eee_exit_err; | 1099 | goto eee_exit_err; |
1083 | 1100 | ||
1084 | if (clk_stop_enable) { | 1101 | if (clk_stop_enable) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 0e62274e884a..f1ee71e22241 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -43,9 +43,7 @@ | |||
43 | 43 | ||
44 | static struct team_port *team_port_get_rcu(const struct net_device *dev) | 44 | static struct team_port *team_port_get_rcu(const struct net_device *dev) |
45 | { | 45 | { |
46 | struct team_port *port = rcu_dereference(dev->rx_handler_data); | 46 | return rcu_dereference(dev->rx_handler_data); |
47 | |||
48 | return team_port_exists(dev) ? port : NULL; | ||
49 | } | 47 | } |
50 | 48 | ||
51 | static struct team_port *team_port_get_rtnl(const struct net_device *dev) | 49 | static struct team_port *team_port_get_rtnl(const struct net_device *dev) |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3bd9678315ad..7ba8d0885f12 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -161,6 +161,7 @@ config USB_NET_AX8817X | |||
161 | * Linksys USB200M | 161 | * Linksys USB200M |
162 | * Netgear FA120 | 162 | * Netgear FA120 |
163 | * Sitecom LN-029 | 163 | * Sitecom LN-029 |
164 | * Sitecom LN-028 | ||
164 | * Intellinet USB 2.0 Ethernet | 165 | * Intellinet USB 2.0 Ethernet |
165 | * ST Lab USB 2.0 Ethernet | 166 | * ST Lab USB 2.0 Ethernet |
166 | * TrendNet TU2-ET100 | 167 | * TrendNet TU2-ET100 |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index bf49792062a2..1173a24feda3 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -979,6 +979,10 @@ static const struct usb_device_id products [] = { | |||
979 | USB_DEVICE (0x0df6, 0x0056), | 979 | USB_DEVICE (0x0df6, 0x0056), |
980 | .driver_info = (unsigned long) &ax88178_info, | 980 | .driver_info = (unsigned long) &ax88178_info, |
981 | }, { | 981 | }, { |
982 | // Sitecom LN-028 "USB 2.0 10/100/1000 Ethernet adapter" | ||
983 | USB_DEVICE (0x0df6, 0x061c), | ||
984 | .driver_info = (unsigned long) &ax88178_info, | ||
985 | }, { | ||
982 | // corega FEther USB2-TX | 986 | // corega FEther USB2-TX |
983 | USB_DEVICE (0x07aa, 0x0017), | 987 | USB_DEVICE (0x07aa, 0x0017), |
984 | .driver_info = (unsigned long) &ax8817x_info, | 988 | .driver_info = (unsigned long) &ax8817x_info, |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 9cdfb3fe9c15..778e91531fac 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1594,7 +1594,7 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg) | |||
1594 | } | 1594 | } |
1595 | cprev = cnow; | 1595 | cprev = cnow; |
1596 | } | 1596 | } |
1597 | current->state = TASK_RUNNING; | 1597 | __set_current_state(TASK_RUNNING); |
1598 | remove_wait_queue(&tiocmget->waitq, &wait); | 1598 | remove_wait_queue(&tiocmget->waitq, &wait); |
1599 | 1599 | ||
1600 | return ret; | 1600 | return ret; |
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 3d18bb0eee85..1bfe0fcaccf5 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c | |||
@@ -134,6 +134,11 @@ static const struct usb_device_id products [] = { | |||
134 | }, { | 134 | }, { |
135 | USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ | 135 | USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ |
136 | .driver_info = (unsigned long) &prolific_info, | 136 | .driver_info = (unsigned long) &prolific_info, |
137 | }, { | ||
138 | USB_DEVICE(0x3923, 0x7825), /* National Instruments USB | ||
139 | * Host-to-Host Cable | ||
140 | */ | ||
141 | .driver_info = (unsigned long) &prolific_info, | ||
137 | }, | 142 | }, |
138 | 143 | ||
139 | { }, // END | 144 | { }, // END |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 83c39e2858bf..88d121d43c08 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -806,21 +806,21 @@ static ssize_t cosa_read(struct file *file, | |||
806 | spin_lock_irqsave(&cosa->lock, flags); | 806 | spin_lock_irqsave(&cosa->lock, flags); |
807 | add_wait_queue(&chan->rxwaitq, &wait); | 807 | add_wait_queue(&chan->rxwaitq, &wait); |
808 | while (!chan->rx_status) { | 808 | while (!chan->rx_status) { |
809 | current->state = TASK_INTERRUPTIBLE; | 809 | set_current_state(TASK_INTERRUPTIBLE); |
810 | spin_unlock_irqrestore(&cosa->lock, flags); | 810 | spin_unlock_irqrestore(&cosa->lock, flags); |
811 | schedule(); | 811 | schedule(); |
812 | spin_lock_irqsave(&cosa->lock, flags); | 812 | spin_lock_irqsave(&cosa->lock, flags); |
813 | if (signal_pending(current) && chan->rx_status == 0) { | 813 | if (signal_pending(current) && chan->rx_status == 0) { |
814 | chan->rx_status = 1; | 814 | chan->rx_status = 1; |
815 | remove_wait_queue(&chan->rxwaitq, &wait); | 815 | remove_wait_queue(&chan->rxwaitq, &wait); |
816 | current->state = TASK_RUNNING; | 816 | __set_current_state(TASK_RUNNING); |
817 | spin_unlock_irqrestore(&cosa->lock, flags); | 817 | spin_unlock_irqrestore(&cosa->lock, flags); |
818 | mutex_unlock(&chan->rlock); | 818 | mutex_unlock(&chan->rlock); |
819 | return -ERESTARTSYS; | 819 | return -ERESTARTSYS; |
820 | } | 820 | } |
821 | } | 821 | } |
822 | remove_wait_queue(&chan->rxwaitq, &wait); | 822 | remove_wait_queue(&chan->rxwaitq, &wait); |
823 | current->state = TASK_RUNNING; | 823 | __set_current_state(TASK_RUNNING); |
824 | kbuf = chan->rxdata; | 824 | kbuf = chan->rxdata; |
825 | count = chan->rxsize; | 825 | count = chan->rxsize; |
826 | spin_unlock_irqrestore(&cosa->lock, flags); | 826 | spin_unlock_irqrestore(&cosa->lock, flags); |
@@ -890,14 +890,14 @@ static ssize_t cosa_write(struct file *file, | |||
890 | spin_lock_irqsave(&cosa->lock, flags); | 890 | spin_lock_irqsave(&cosa->lock, flags); |
891 | add_wait_queue(&chan->txwaitq, &wait); | 891 | add_wait_queue(&chan->txwaitq, &wait); |
892 | while (!chan->tx_status) { | 892 | while (!chan->tx_status) { |
893 | current->state = TASK_INTERRUPTIBLE; | 893 | set_current_state(TASK_INTERRUPTIBLE); |
894 | spin_unlock_irqrestore(&cosa->lock, flags); | 894 | spin_unlock_irqrestore(&cosa->lock, flags); |
895 | schedule(); | 895 | schedule(); |
896 | spin_lock_irqsave(&cosa->lock, flags); | 896 | spin_lock_irqsave(&cosa->lock, flags); |
897 | if (signal_pending(current) && chan->tx_status == 0) { | 897 | if (signal_pending(current) && chan->tx_status == 0) { |
898 | chan->tx_status = 1; | 898 | chan->tx_status = 1; |
899 | remove_wait_queue(&chan->txwaitq, &wait); | 899 | remove_wait_queue(&chan->txwaitq, &wait); |
900 | current->state = TASK_RUNNING; | 900 | __set_current_state(TASK_RUNNING); |
901 | chan->tx_status = 1; | 901 | chan->tx_status = 1; |
902 | spin_unlock_irqrestore(&cosa->lock, flags); | 902 | spin_unlock_irqrestore(&cosa->lock, flags); |
903 | up(&chan->wsem); | 903 | up(&chan->wsem); |
@@ -905,7 +905,7 @@ static ssize_t cosa_write(struct file *file, | |||
905 | } | 905 | } |
906 | } | 906 | } |
907 | remove_wait_queue(&chan->txwaitq, &wait); | 907 | remove_wait_queue(&chan->txwaitq, &wait); |
908 | current->state = TASK_RUNNING; | 908 | __set_current_state(TASK_RUNNING); |
909 | up(&chan->wsem); | 909 | up(&chan->wsem); |
910 | spin_unlock_irqrestore(&cosa->lock, flags); | 910 | spin_unlock_irqrestore(&cosa->lock, flags); |
911 | kfree(kbuf); | 911 | kfree(kbuf); |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4a4c6586a8d2..8908be6dbc48 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -946,7 +946,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
946 | goto nla_put_failure; | 946 | goto nla_put_failure; |
947 | 947 | ||
948 | genlmsg_end(skb, msg_head); | 948 | genlmsg_end(skb, msg_head); |
949 | genlmsg_unicast(&init_net, skb, dst_portid); | 949 | if (genlmsg_unicast(&init_net, skb, dst_portid)) |
950 | goto err_free_txskb; | ||
950 | 951 | ||
951 | /* Enqueue the packet */ | 952 | /* Enqueue the packet */ |
952 | skb_queue_tail(&data->pending, my_skb); | 953 | skb_queue_tail(&data->pending, my_skb); |
@@ -955,6 +956,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
955 | return; | 956 | return; |
956 | 957 | ||
957 | nla_put_failure: | 958 | nla_put_failure: |
959 | nlmsg_free(skb); | ||
960 | err_free_txskb: | ||
958 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); | 961 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); |
959 | ieee80211_free_txskb(hw, my_skb); | 962 | ieee80211_free_txskb(hw, my_skb); |
960 | data->tx_failed++; | 963 | data->tx_failed++; |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index f7a31d2cb3f1..c4d68d768408 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -655,9 +655,15 @@ static void xenvif_tx_err(struct xenvif_queue *queue, | |||
655 | unsigned long flags; | 655 | unsigned long flags; |
656 | 656 | ||
657 | do { | 657 | do { |
658 | int notify; | ||
659 | |||
658 | spin_lock_irqsave(&queue->response_lock, flags); | 660 | spin_lock_irqsave(&queue->response_lock, flags); |
659 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); | 661 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); |
662 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | ||
660 | spin_unlock_irqrestore(&queue->response_lock, flags); | 663 | spin_unlock_irqrestore(&queue->response_lock, flags); |
664 | if (notify) | ||
665 | notify_remote_via_irq(queue->tx_irq); | ||
666 | |||
661 | if (cons == end) | 667 | if (cons == end) |
662 | break; | 668 | break; |
663 | txp = RING_GET_REQUEST(&queue->tx, cons++); | 669 | txp = RING_GET_REQUEST(&queue->tx, cons++); |
@@ -1649,17 +1655,28 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
1649 | { | 1655 | { |
1650 | struct pending_tx_info *pending_tx_info; | 1656 | struct pending_tx_info *pending_tx_info; |
1651 | pending_ring_idx_t index; | 1657 | pending_ring_idx_t index; |
1658 | int notify; | ||
1652 | unsigned long flags; | 1659 | unsigned long flags; |
1653 | 1660 | ||
1654 | pending_tx_info = &queue->pending_tx_info[pending_idx]; | 1661 | pending_tx_info = &queue->pending_tx_info[pending_idx]; |
1662 | |||
1655 | spin_lock_irqsave(&queue->response_lock, flags); | 1663 | spin_lock_irqsave(&queue->response_lock, flags); |
1664 | |||
1656 | make_tx_response(queue, &pending_tx_info->req, status); | 1665 | make_tx_response(queue, &pending_tx_info->req, status); |
1657 | index = pending_index(queue->pending_prod); | 1666 | |
1667 | /* Release the pending index before pusing the Tx response so | ||
1668 | * its available before a new Tx request is pushed by the | ||
1669 | * frontend. | ||
1670 | */ | ||
1671 | index = pending_index(queue->pending_prod++); | ||
1658 | queue->pending_ring[index] = pending_idx; | 1672 | queue->pending_ring[index] = pending_idx; |
1659 | /* TX shouldn't use the index before we give it back here */ | 1673 | |
1660 | mb(); | 1674 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); |
1661 | queue->pending_prod++; | 1675 | |
1662 | spin_unlock_irqrestore(&queue->response_lock, flags); | 1676 | spin_unlock_irqrestore(&queue->response_lock, flags); |
1677 | |||
1678 | if (notify) | ||
1679 | notify_remote_via_irq(queue->tx_irq); | ||
1663 | } | 1680 | } |
1664 | 1681 | ||
1665 | 1682 | ||
@@ -1669,7 +1686,6 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
1669 | { | 1686 | { |
1670 | RING_IDX i = queue->tx.rsp_prod_pvt; | 1687 | RING_IDX i = queue->tx.rsp_prod_pvt; |
1671 | struct xen_netif_tx_response *resp; | 1688 | struct xen_netif_tx_response *resp; |
1672 | int notify; | ||
1673 | 1689 | ||
1674 | resp = RING_GET_RESPONSE(&queue->tx, i); | 1690 | resp = RING_GET_RESPONSE(&queue->tx, i); |
1675 | resp->id = txp->id; | 1691 | resp->id = txp->id; |
@@ -1679,9 +1695,6 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
1679 | RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL; | 1695 | RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL; |
1680 | 1696 | ||
1681 | queue->tx.rsp_prod_pvt = ++i; | 1697 | queue->tx.rsp_prod_pvt = ++i; |
1682 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | ||
1683 | if (notify) | ||
1684 | notify_remote_via_irq(queue->tx_irq); | ||
1685 | } | 1698 | } |
1686 | 1699 | ||
1687 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, | 1700 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, |
diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c index 1ec694a52379..464bf492ee2a 100644 --- a/drivers/pci/host/pci-versatile.c +++ b/drivers/pci/host/pci-versatile.c | |||
@@ -80,7 +80,7 @@ static int versatile_pci_parse_request_of_pci_ranges(struct device *dev, | |||
80 | if (err) | 80 | if (err) |
81 | return err; | 81 | return err; |
82 | 82 | ||
83 | resource_list_for_each_entry(win, res, list) { | 83 | resource_list_for_each_entry(win, res) { |
84 | struct resource *parent, *res = win->res; | 84 | struct resource *parent, *res = win->res; |
85 | 85 | ||
86 | switch (resource_type(res)) { | 86 | switch (resource_type(res)) { |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 70a5d94cc766..b4f7744f6751 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/of.h> | 32 | #include <linux/of.h> |
33 | #include <linux/of_device.h> | 33 | #include <linux/of_device.h> |
34 | #include <linux/suspend.h> | ||
34 | #include <linux/uaccess.h> | 35 | #include <linux/uaccess.h> |
35 | 36 | ||
36 | #include "rtc-at91rm9200.h" | 37 | #include "rtc-at91rm9200.h" |
@@ -54,6 +55,10 @@ static void __iomem *at91_rtc_regs; | |||
54 | static int irq; | 55 | static int irq; |
55 | static DEFINE_SPINLOCK(at91_rtc_lock); | 56 | static DEFINE_SPINLOCK(at91_rtc_lock); |
56 | static u32 at91_rtc_shadow_imr; | 57 | static u32 at91_rtc_shadow_imr; |
58 | static bool suspended; | ||
59 | static DEFINE_SPINLOCK(suspended_lock); | ||
60 | static unsigned long cached_events; | ||
61 | static u32 at91_rtc_imr; | ||
57 | 62 | ||
58 | static void at91_rtc_write_ier(u32 mask) | 63 | static void at91_rtc_write_ier(u32 mask) |
59 | { | 64 | { |
@@ -290,7 +295,9 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
290 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 295 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
291 | unsigned int rtsr; | 296 | unsigned int rtsr; |
292 | unsigned long events = 0; | 297 | unsigned long events = 0; |
298 | int ret = IRQ_NONE; | ||
293 | 299 | ||
300 | spin_lock(&suspended_lock); | ||
294 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read_imr(); | 301 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read_imr(); |
295 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 302 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
296 | if (rtsr & AT91_RTC_ALARM) | 303 | if (rtsr & AT91_RTC_ALARM) |
@@ -304,14 +311,22 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
304 | 311 | ||
305 | at91_rtc_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ | 312 | at91_rtc_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ |
306 | 313 | ||
307 | rtc_update_irq(rtc, 1, events); | 314 | if (!suspended) { |
315 | rtc_update_irq(rtc, 1, events); | ||
308 | 316 | ||
309 | dev_dbg(&pdev->dev, "%s(): num=%ld, events=0x%02lx\n", __func__, | 317 | dev_dbg(&pdev->dev, "%s(): num=%ld, events=0x%02lx\n", |
310 | events >> 8, events & 0x000000FF); | 318 | __func__, events >> 8, events & 0x000000FF); |
319 | } else { | ||
320 | cached_events |= events; | ||
321 | at91_rtc_write_idr(at91_rtc_imr); | ||
322 | pm_system_wakeup(); | ||
323 | } | ||
311 | 324 | ||
312 | return IRQ_HANDLED; | 325 | ret = IRQ_HANDLED; |
313 | } | 326 | } |
314 | return IRQ_NONE; /* not handled */ | 327 | spin_lock(&suspended_lock); |
328 | |||
329 | return ret; | ||
315 | } | 330 | } |
316 | 331 | ||
317 | static const struct at91_rtc_config at91rm9200_config = { | 332 | static const struct at91_rtc_config at91rm9200_config = { |
@@ -401,8 +416,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
401 | AT91_RTC_CALEV); | 416 | AT91_RTC_CALEV); |
402 | 417 | ||
403 | ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt, | 418 | ret = devm_request_irq(&pdev->dev, irq, at91_rtc_interrupt, |
404 | IRQF_SHARED, | 419 | IRQF_SHARED | IRQF_COND_SUSPEND, |
405 | "at91_rtc", pdev); | 420 | "at91_rtc", pdev); |
406 | if (ret) { | 421 | if (ret) { |
407 | dev_err(&pdev->dev, "IRQ %d already in use.\n", irq); | 422 | dev_err(&pdev->dev, "IRQ %d already in use.\n", irq); |
408 | return ret; | 423 | return ret; |
@@ -454,8 +469,6 @@ static void at91_rtc_shutdown(struct platform_device *pdev) | |||
454 | 469 | ||
455 | /* AT91RM9200 RTC Power management control */ | 470 | /* AT91RM9200 RTC Power management control */ |
456 | 471 | ||
457 | static u32 at91_rtc_imr; | ||
458 | |||
459 | static int at91_rtc_suspend(struct device *dev) | 472 | static int at91_rtc_suspend(struct device *dev) |
460 | { | 473 | { |
461 | /* this IRQ is shared with DBGU and other hardware which isn't | 474 | /* this IRQ is shared with DBGU and other hardware which isn't |
@@ -464,21 +477,42 @@ static int at91_rtc_suspend(struct device *dev) | |||
464 | at91_rtc_imr = at91_rtc_read_imr() | 477 | at91_rtc_imr = at91_rtc_read_imr() |
465 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 478 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
466 | if (at91_rtc_imr) { | 479 | if (at91_rtc_imr) { |
467 | if (device_may_wakeup(dev)) | 480 | if (device_may_wakeup(dev)) { |
481 | unsigned long flags; | ||
482 | |||
468 | enable_irq_wake(irq); | 483 | enable_irq_wake(irq); |
469 | else | 484 | |
485 | spin_lock_irqsave(&suspended_lock, flags); | ||
486 | suspended = true; | ||
487 | spin_unlock_irqrestore(&suspended_lock, flags); | ||
488 | } else { | ||
470 | at91_rtc_write_idr(at91_rtc_imr); | 489 | at91_rtc_write_idr(at91_rtc_imr); |
490 | } | ||
471 | } | 491 | } |
472 | return 0; | 492 | return 0; |
473 | } | 493 | } |
474 | 494 | ||
475 | static int at91_rtc_resume(struct device *dev) | 495 | static int at91_rtc_resume(struct device *dev) |
476 | { | 496 | { |
497 | struct rtc_device *rtc = dev_get_drvdata(dev); | ||
498 | |||
477 | if (at91_rtc_imr) { | 499 | if (at91_rtc_imr) { |
478 | if (device_may_wakeup(dev)) | 500 | if (device_may_wakeup(dev)) { |
501 | unsigned long flags; | ||
502 | |||
503 | spin_lock_irqsave(&suspended_lock, flags); | ||
504 | |||
505 | if (cached_events) { | ||
506 | rtc_update_irq(rtc, 1, cached_events); | ||
507 | cached_events = 0; | ||
508 | } | ||
509 | |||
510 | suspended = false; | ||
511 | spin_unlock_irqrestore(&suspended_lock, flags); | ||
512 | |||
479 | disable_irq_wake(irq); | 513 | disable_irq_wake(irq); |
480 | else | 514 | } |
481 | at91_rtc_write_ier(at91_rtc_imr); | 515 | at91_rtc_write_ier(at91_rtc_imr); |
482 | } | 516 | } |
483 | return 0; | 517 | return 0; |
484 | } | 518 | } |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 2183fd2750ab..5ccaee32df72 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/mfd/syscon.h> | 24 | #include <linux/mfd/syscon.h> |
25 | #include <linux/regmap.h> | 25 | #include <linux/regmap.h> |
26 | #include <linux/suspend.h> | ||
26 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
27 | 28 | ||
28 | /* | 29 | /* |
@@ -77,6 +78,9 @@ struct sam9_rtc { | |||
77 | unsigned int gpbr_offset; | 78 | unsigned int gpbr_offset; |
78 | int irq; | 79 | int irq; |
79 | struct clk *sclk; | 80 | struct clk *sclk; |
81 | bool suspended; | ||
82 | unsigned long events; | ||
83 | spinlock_t lock; | ||
80 | }; | 84 | }; |
81 | 85 | ||
82 | #define rtt_readl(rtc, field) \ | 86 | #define rtt_readl(rtc, field) \ |
@@ -271,14 +275,9 @@ static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | |||
271 | return 0; | 275 | return 0; |
272 | } | 276 | } |
273 | 277 | ||
274 | /* | 278 | static irqreturn_t at91_rtc_cache_events(struct sam9_rtc *rtc) |
275 | * IRQ handler for the RTC | ||
276 | */ | ||
277 | static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | ||
278 | { | 279 | { |
279 | struct sam9_rtc *rtc = _rtc; | ||
280 | u32 sr, mr; | 280 | u32 sr, mr; |
281 | unsigned long events = 0; | ||
282 | 281 | ||
283 | /* Shared interrupt may be for another device. Note: reading | 282 | /* Shared interrupt may be for another device. Note: reading |
284 | * SR clears it, so we must only read it in this irq handler! | 283 | * SR clears it, so we must only read it in this irq handler! |
@@ -290,18 +289,54 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | |||
290 | 289 | ||
291 | /* alarm status */ | 290 | /* alarm status */ |
292 | if (sr & AT91_RTT_ALMS) | 291 | if (sr & AT91_RTT_ALMS) |
293 | events |= (RTC_AF | RTC_IRQF); | 292 | rtc->events |= (RTC_AF | RTC_IRQF); |
294 | 293 | ||
295 | /* timer update/increment */ | 294 | /* timer update/increment */ |
296 | if (sr & AT91_RTT_RTTINC) | 295 | if (sr & AT91_RTT_RTTINC) |
297 | events |= (RTC_UF | RTC_IRQF); | 296 | rtc->events |= (RTC_UF | RTC_IRQF); |
297 | |||
298 | return IRQ_HANDLED; | ||
299 | } | ||
300 | |||
301 | static void at91_rtc_flush_events(struct sam9_rtc *rtc) | ||
302 | { | ||
303 | if (!rtc->events) | ||
304 | return; | ||
298 | 305 | ||
299 | rtc_update_irq(rtc->rtcdev, 1, events); | 306 | rtc_update_irq(rtc->rtcdev, 1, rtc->events); |
307 | rtc->events = 0; | ||
300 | 308 | ||
301 | pr_debug("%s: num=%ld, events=0x%02lx\n", __func__, | 309 | pr_debug("%s: num=%ld, events=0x%02lx\n", __func__, |
302 | events >> 8, events & 0x000000FF); | 310 | rtc->events >> 8, rtc->events & 0x000000FF); |
311 | } | ||
303 | 312 | ||
304 | return IRQ_HANDLED; | 313 | /* |
314 | * IRQ handler for the RTC | ||
315 | */ | ||
316 | static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | ||
317 | { | ||
318 | struct sam9_rtc *rtc = _rtc; | ||
319 | int ret; | ||
320 | |||
321 | spin_lock(&rtc->lock); | ||
322 | |||
323 | ret = at91_rtc_cache_events(rtc); | ||
324 | |||
325 | /* We're called in suspended state */ | ||
326 | if (rtc->suspended) { | ||
327 | /* Mask irqs coming from this peripheral */ | ||
328 | rtt_writel(rtc, MR, | ||
329 | rtt_readl(rtc, MR) & | ||
330 | ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)); | ||
331 | /* Trigger a system wakeup */ | ||
332 | pm_system_wakeup(); | ||
333 | } else { | ||
334 | at91_rtc_flush_events(rtc); | ||
335 | } | ||
336 | |||
337 | spin_unlock(&rtc->lock); | ||
338 | |||
339 | return ret; | ||
305 | } | 340 | } |
306 | 341 | ||
307 | static const struct rtc_class_ops at91_rtc_ops = { | 342 | static const struct rtc_class_ops at91_rtc_ops = { |
@@ -421,7 +456,8 @@ static int at91_rtc_probe(struct platform_device *pdev) | |||
421 | 456 | ||
422 | /* register irq handler after we know what name we'll use */ | 457 | /* register irq handler after we know what name we'll use */ |
423 | ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt, | 458 | ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt, |
424 | IRQF_SHARED, dev_name(&rtc->rtcdev->dev), rtc); | 459 | IRQF_SHARED | IRQF_COND_SUSPEND, |
460 | dev_name(&rtc->rtcdev->dev), rtc); | ||
425 | if (ret) { | 461 | if (ret) { |
426 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq); | 462 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq); |
427 | return ret; | 463 | return ret; |
@@ -482,7 +518,12 @@ static int at91_rtc_suspend(struct device *dev) | |||
482 | rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); | 518 | rtc->imr = mr & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); |
483 | if (rtc->imr) { | 519 | if (rtc->imr) { |
484 | if (device_may_wakeup(dev) && (mr & AT91_RTT_ALMIEN)) { | 520 | if (device_may_wakeup(dev) && (mr & AT91_RTT_ALMIEN)) { |
521 | unsigned long flags; | ||
522 | |||
485 | enable_irq_wake(rtc->irq); | 523 | enable_irq_wake(rtc->irq); |
524 | spin_lock_irqsave(&rtc->lock, flags); | ||
525 | rtc->suspended = true; | ||
526 | spin_unlock_irqrestore(&rtc->lock, flags); | ||
486 | /* don't let RTTINC cause wakeups */ | 527 | /* don't let RTTINC cause wakeups */ |
487 | if (mr & AT91_RTT_RTTINCIEN) | 528 | if (mr & AT91_RTT_RTTINCIEN) |
488 | rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN); | 529 | rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN); |
@@ -499,10 +540,18 @@ static int at91_rtc_resume(struct device *dev) | |||
499 | u32 mr; | 540 | u32 mr; |
500 | 541 | ||
501 | if (rtc->imr) { | 542 | if (rtc->imr) { |
543 | unsigned long flags; | ||
544 | |||
502 | if (device_may_wakeup(dev)) | 545 | if (device_may_wakeup(dev)) |
503 | disable_irq_wake(rtc->irq); | 546 | disable_irq_wake(rtc->irq); |
504 | mr = rtt_readl(rtc, MR); | 547 | mr = rtt_readl(rtc, MR); |
505 | rtt_writel(rtc, MR, mr | rtc->imr); | 548 | rtt_writel(rtc, MR, mr | rtc->imr); |
549 | |||
550 | spin_lock_irqsave(&rtc->lock, flags); | ||
551 | rtc->suspended = false; | ||
552 | at91_rtc_cache_events(rtc); | ||
553 | at91_rtc_flush_events(rtc); | ||
554 | spin_unlock_irqrestore(&rtc->lock, flags); | ||
506 | } | 555 | } |
507 | 556 | ||
508 | return 0; | 557 | return 0; |
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 8c3bfcb115b7..803869c7d7c2 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c | |||
@@ -399,21 +399,21 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
399 | * of this RTC chip. We check for it anyways in case support is | 399 | * of this RTC chip. We check for it anyways in case support is |
400 | * added in the future. | 400 | * added in the future. |
401 | */ | 401 | */ |
402 | if (unlikely((seconds >= 0xc0) && (seconds <= 0xff))) | 402 | if (unlikely(seconds >= 0xc0)) |
403 | alrm->time.tm_sec = -1; | 403 | alrm->time.tm_sec = -1; |
404 | else | 404 | else |
405 | alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, | 405 | alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, |
406 | RTC_SECS_BCD_MASK, | 406 | RTC_SECS_BCD_MASK, |
407 | RTC_SECS_BIN_MASK); | 407 | RTC_SECS_BIN_MASK); |
408 | 408 | ||
409 | if (unlikely((minutes >= 0xc0) && (minutes <= 0xff))) | 409 | if (unlikely(minutes >= 0xc0)) |
410 | alrm->time.tm_min = -1; | 410 | alrm->time.tm_min = -1; |
411 | else | 411 | else |
412 | alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, | 412 | alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, |
413 | RTC_MINS_BCD_MASK, | 413 | RTC_MINS_BCD_MASK, |
414 | RTC_MINS_BIN_MASK); | 414 | RTC_MINS_BIN_MASK); |
415 | 415 | ||
416 | if (unlikely((hours >= 0xc0) && (hours <= 0xff))) | 416 | if (unlikely(hours >= 0xc0)) |
417 | alrm->time.tm_hour = -1; | 417 | alrm->time.tm_hour = -1; |
418 | else | 418 | else |
419 | alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, | 419 | alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, |
@@ -472,13 +472,13 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
472 | * field, and we only support four fields. We put the support | 472 | * field, and we only support four fields. We put the support |
473 | * here anyways for the future. | 473 | * here anyways for the future. |
474 | */ | 474 | */ |
475 | if (unlikely((seconds >= 0xc0) && (seconds <= 0xff))) | 475 | if (unlikely(seconds >= 0xc0)) |
476 | seconds = 0xff; | 476 | seconds = 0xff; |
477 | 477 | ||
478 | if (unlikely((minutes >= 0xc0) && (minutes <= 0xff))) | 478 | if (unlikely(minutes >= 0xc0)) |
479 | minutes = 0xff; | 479 | minutes = 0xff; |
480 | 480 | ||
481 | if (unlikely((hours >= 0xc0) && (hours <= 0xff))) | 481 | if (unlikely(hours >= 0xc0)) |
482 | hours = 0xff; | 482 | hours = 0xff; |
483 | 483 | ||
484 | alrm->time.tm_mon = -1; | 484 | alrm->time.tm_mon = -1; |
@@ -528,7 +528,6 @@ ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
528 | /* ----------------------------------------------------------------------- */ | 528 | /* ----------------------------------------------------------------------- */ |
529 | /* /dev/rtcX Interface functions */ | 529 | /* /dev/rtcX Interface functions */ |
530 | 530 | ||
531 | #ifdef CONFIG_RTC_INTF_DEV | ||
532 | /** | 531 | /** |
533 | * ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off. | 532 | * ds1685_rtc_alarm_irq_enable - replaces ioctl() RTC_AIE on/off. |
534 | * @dev: pointer to device structure. | 533 | * @dev: pointer to device structure. |
@@ -557,7 +556,6 @@ ds1685_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
557 | 556 | ||
558 | return 0; | 557 | return 0; |
559 | } | 558 | } |
560 | #endif | ||
561 | /* ----------------------------------------------------------------------- */ | 559 | /* ----------------------------------------------------------------------- */ |
562 | 560 | ||
563 | 561 | ||
@@ -1612,7 +1610,7 @@ ds1685_rtc_sysfs_time_regs_show(struct device *dev, | |||
1612 | ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); | 1610 | ds1685_rtc_sysfs_time_regs_lookup(attr->attr.name, false); |
1613 | 1611 | ||
1614 | /* Make sure we actually matched something. */ | 1612 | /* Make sure we actually matched something. */ |
1615 | if (!bcd_reg_info && !bin_reg_info) | 1613 | if (!bcd_reg_info || !bin_reg_info) |
1616 | return -EINVAL; | 1614 | return -EINVAL; |
1617 | 1615 | ||
1618 | /* bcd_reg_info->reg == bin_reg_info->reg. */ | 1616 | /* bcd_reg_info->reg == bin_reg_info->reg. */ |
@@ -1650,7 +1648,7 @@ ds1685_rtc_sysfs_time_regs_store(struct device *dev, | |||
1650 | return -EINVAL; | 1648 | return -EINVAL; |
1651 | 1649 | ||
1652 | /* Make sure we actually matched something. */ | 1650 | /* Make sure we actually matched something. */ |
1653 | if (!bcd_reg_info && !bin_reg_info) | 1651 | if (!bcd_reg_info || !bin_reg_info) |
1654 | return -EINVAL; | 1652 | return -EINVAL; |
1655 | 1653 | ||
1656 | /* Check for a valid range. */ | 1654 | /* Check for a valid range. */ |
diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c index f3ee439d6f0e..cd4c293f0dd0 100644 --- a/drivers/sh/pm_runtime.c +++ b/drivers/sh/pm_runtime.c | |||
@@ -81,7 +81,9 @@ static int __init sh_pm_runtime_init(void) | |||
81 | if (!of_machine_is_compatible("renesas,emev2") && | 81 | if (!of_machine_is_compatible("renesas,emev2") && |
82 | !of_machine_is_compatible("renesas,r7s72100") && | 82 | !of_machine_is_compatible("renesas,r7s72100") && |
83 | !of_machine_is_compatible("renesas,r8a73a4") && | 83 | !of_machine_is_compatible("renesas,r8a73a4") && |
84 | #ifndef CONFIG_PM_GENERIC_DOMAINS_OF | ||
84 | !of_machine_is_compatible("renesas,r8a7740") && | 85 | !of_machine_is_compatible("renesas,r8a7740") && |
86 | #endif | ||
85 | !of_machine_is_compatible("renesas,r8a7778") && | 87 | !of_machine_is_compatible("renesas,r8a7778") && |
86 | !of_machine_is_compatible("renesas,r8a7779") && | 88 | !of_machine_is_compatible("renesas,r8a7779") && |
87 | !of_machine_is_compatible("renesas,r8a7790") && | 89 | !of_machine_is_compatible("renesas,r8a7790") && |
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 9800c01e6fb9..3f72451d2de0 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c | |||
@@ -426,7 +426,6 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, | |||
426 | unsigned int *data) | 426 | unsigned int *data) |
427 | { | 427 | { |
428 | struct pci1710_private *devpriv = dev->private; | 428 | struct pci1710_private *devpriv = dev->private; |
429 | unsigned int chan = CR_CHAN(insn->chanspec); | ||
430 | int ret = 0; | 429 | int ret = 0; |
431 | int i; | 430 | int i; |
432 | 431 | ||
@@ -447,7 +446,7 @@ static int pci171x_ai_insn_read(struct comedi_device *dev, | |||
447 | if (ret) | 446 | if (ret) |
448 | break; | 447 | break; |
449 | 448 | ||
450 | ret = pci171x_ai_read_sample(dev, s, chan, &val); | 449 | ret = pci171x_ai_read_sample(dev, s, 0, &val); |
451 | if (ret) | 450 | if (ret) |
452 | break; | 451 | break; |
453 | 452 | ||
diff --git a/drivers/staging/comedi/drivers/comedi_isadma.c b/drivers/staging/comedi/drivers/comedi_isadma.c index dbdea71d6b95..e856f01ca077 100644 --- a/drivers/staging/comedi/drivers/comedi_isadma.c +++ b/drivers/staging/comedi/drivers/comedi_isadma.c | |||
@@ -91,9 +91,10 @@ unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan, | |||
91 | stalled++; | 91 | stalled++; |
92 | if (stalled > 10) | 92 | if (stalled > 10) |
93 | break; | 93 | break; |
94 | } else { | ||
95 | residue = new_residue; | ||
96 | stalled = 0; | ||
94 | } | 97 | } |
95 | residue = new_residue; | ||
96 | stalled = 0; | ||
97 | } | 98 | } |
98 | return residue; | 99 | return residue; |
99 | } | 100 | } |
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index e37118321a27..a0906685e27f 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c | |||
@@ -103,11 +103,6 @@ enum vmk80xx_model { | |||
103 | VMK8061_MODEL | 103 | VMK8061_MODEL |
104 | }; | 104 | }; |
105 | 105 | ||
106 | struct firmware_version { | ||
107 | unsigned char ic3_vers[32]; /* USB-Controller */ | ||
108 | unsigned char ic6_vers[32]; /* CPU */ | ||
109 | }; | ||
110 | |||
111 | static const struct comedi_lrange vmk8061_range = { | 106 | static const struct comedi_lrange vmk8061_range = { |
112 | 2, { | 107 | 2, { |
113 | UNI_RANGE(5), | 108 | UNI_RANGE(5), |
@@ -156,68 +151,12 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = { | |||
156 | struct vmk80xx_private { | 151 | struct vmk80xx_private { |
157 | struct usb_endpoint_descriptor *ep_rx; | 152 | struct usb_endpoint_descriptor *ep_rx; |
158 | struct usb_endpoint_descriptor *ep_tx; | 153 | struct usb_endpoint_descriptor *ep_tx; |
159 | struct firmware_version fw; | ||
160 | struct semaphore limit_sem; | 154 | struct semaphore limit_sem; |
161 | unsigned char *usb_rx_buf; | 155 | unsigned char *usb_rx_buf; |
162 | unsigned char *usb_tx_buf; | 156 | unsigned char *usb_tx_buf; |
163 | enum vmk80xx_model model; | 157 | enum vmk80xx_model model; |
164 | }; | 158 | }; |
165 | 159 | ||
166 | static int vmk80xx_check_data_link(struct comedi_device *dev) | ||
167 | { | ||
168 | struct vmk80xx_private *devpriv = dev->private; | ||
169 | struct usb_device *usb = comedi_to_usb_dev(dev); | ||
170 | unsigned int tx_pipe; | ||
171 | unsigned int rx_pipe; | ||
172 | unsigned char tx[1]; | ||
173 | unsigned char rx[2]; | ||
174 | |||
175 | tx_pipe = usb_sndbulkpipe(usb, 0x01); | ||
176 | rx_pipe = usb_rcvbulkpipe(usb, 0x81); | ||
177 | |||
178 | tx[0] = VMK8061_CMD_RD_PWR_STAT; | ||
179 | |||
180 | /* | ||
181 | * Check that IC6 (PIC16F871) is powered and | ||
182 | * running and the data link between IC3 and | ||
183 | * IC6 is working properly | ||
184 | */ | ||
185 | usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); | ||
186 | usb_bulk_msg(usb, rx_pipe, rx, 2, NULL, HZ * 10); | ||
187 | |||
188 | return (int)rx[1]; | ||
189 | } | ||
190 | |||
191 | static void vmk80xx_read_eeprom(struct comedi_device *dev, int flag) | ||
192 | { | ||
193 | struct vmk80xx_private *devpriv = dev->private; | ||
194 | struct usb_device *usb = comedi_to_usb_dev(dev); | ||
195 | unsigned int tx_pipe; | ||
196 | unsigned int rx_pipe; | ||
197 | unsigned char tx[1]; | ||
198 | unsigned char rx[64]; | ||
199 | int cnt; | ||
200 | |||
201 | tx_pipe = usb_sndbulkpipe(usb, 0x01); | ||
202 | rx_pipe = usb_rcvbulkpipe(usb, 0x81); | ||
203 | |||
204 | tx[0] = VMK8061_CMD_RD_VERSION; | ||
205 | |||
206 | /* | ||
207 | * Read the firmware version info of IC3 and | ||
208 | * IC6 from the internal EEPROM of the IC | ||
209 | */ | ||
210 | usb_bulk_msg(usb, tx_pipe, tx, 1, NULL, devpriv->ep_tx->bInterval); | ||
211 | usb_bulk_msg(usb, rx_pipe, rx, 64, &cnt, HZ * 10); | ||
212 | |||
213 | rx[cnt] = '\0'; | ||
214 | |||
215 | if (flag & IC3_VERSION) | ||
216 | strncpy(devpriv->fw.ic3_vers, rx + 1, 24); | ||
217 | else /* IC6_VERSION */ | ||
218 | strncpy(devpriv->fw.ic6_vers, rx + 25, 24); | ||
219 | } | ||
220 | |||
221 | static void vmk80xx_do_bulk_msg(struct comedi_device *dev) | 160 | static void vmk80xx_do_bulk_msg(struct comedi_device *dev) |
222 | { | 161 | { |
223 | struct vmk80xx_private *devpriv = dev->private; | 162 | struct vmk80xx_private *devpriv = dev->private; |
@@ -878,16 +817,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, | |||
878 | 817 | ||
879 | usb_set_intfdata(intf, devpriv); | 818 | usb_set_intfdata(intf, devpriv); |
880 | 819 | ||
881 | if (devpriv->model == VMK8061_MODEL) { | ||
882 | vmk80xx_read_eeprom(dev, IC3_VERSION); | ||
883 | dev_info(&intf->dev, "%s\n", devpriv->fw.ic3_vers); | ||
884 | |||
885 | if (vmk80xx_check_data_link(dev)) { | ||
886 | vmk80xx_read_eeprom(dev, IC6_VERSION); | ||
887 | dev_info(&intf->dev, "%s\n", devpriv->fw.ic6_vers); | ||
888 | } | ||
889 | } | ||
890 | |||
891 | if (devpriv->model == VMK8055_MODEL) | 820 | if (devpriv->model == VMK8055_MODEL) |
892 | vmk80xx_reset_device(dev); | 821 | vmk80xx_reset_device(dev); |
893 | 822 | ||
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index d9d6fad7cb00..816174388f13 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -214,11 +214,17 @@ struct mxs_lradc { | |||
214 | unsigned long is_divided; | 214 | unsigned long is_divided; |
215 | 215 | ||
216 | /* | 216 | /* |
217 | * Touchscreen LRADC channels receives a private slot in the CTRL4 | 217 | * When the touchscreen is enabled, we give it two private virtual |
218 | * register, the slot #7. Therefore only 7 slots instead of 8 in the | 218 | * channels: #6 and #7. This means that only 6 virtual channels (instead |
219 | * CTRL4 register can be mapped to LRADC channels when using the | 219 | * of 8) will be available for buffered capture. |
220 | * touchscreen. | 220 | */ |
221 | * | 221 | #define TOUCHSCREEN_VCHANNEL1 7 |
222 | #define TOUCHSCREEN_VCHANNEL2 6 | ||
223 | #define BUFFER_VCHANS_LIMITED 0x3f | ||
224 | #define BUFFER_VCHANS_ALL 0xff | ||
225 | u8 buffer_vchans; | ||
226 | |||
227 | /* | ||
222 | * Furthermore, certain LRADC channels are shared between touchscreen | 228 | * Furthermore, certain LRADC channels are shared between touchscreen |
223 | * and/or touch-buttons and generic LRADC block. Therefore when using | 229 | * and/or touch-buttons and generic LRADC block. Therefore when using |
224 | * either of these, these channels are not available for the regular | 230 | * either of these, these channels are not available for the regular |
@@ -342,6 +348,9 @@ struct mxs_lradc { | |||
342 | #define LRADC_CTRL4 0x140 | 348 | #define LRADC_CTRL4 0x140 |
343 | #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) | 349 | #define LRADC_CTRL4_LRADCSELECT_MASK(n) (0xf << ((n) * 4)) |
344 | #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) | 350 | #define LRADC_CTRL4_LRADCSELECT_OFFSET(n) ((n) * 4) |
351 | #define LRADC_CTRL4_LRADCSELECT(n, x) \ | ||
352 | (((x) << LRADC_CTRL4_LRADCSELECT_OFFSET(n)) & \ | ||
353 | LRADC_CTRL4_LRADCSELECT_MASK(n)) | ||
345 | 354 | ||
346 | #define LRADC_RESOLUTION 12 | 355 | #define LRADC_RESOLUTION 12 |
347 | #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) | 356 | #define LRADC_SINGLE_SAMPLE_MASK ((1 << LRADC_RESOLUTION) - 1) |
@@ -416,6 +425,14 @@ static bool mxs_lradc_check_touch_event(struct mxs_lradc *lradc) | |||
416 | LRADC_STATUS_TOUCH_DETECT_RAW); | 425 | LRADC_STATUS_TOUCH_DETECT_RAW); |
417 | } | 426 | } |
418 | 427 | ||
428 | static void mxs_lradc_map_channel(struct mxs_lradc *lradc, unsigned vch, | ||
429 | unsigned ch) | ||
430 | { | ||
431 | mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(vch), | ||
432 | LRADC_CTRL4); | ||
433 | mxs_lradc_reg_set(lradc, LRADC_CTRL4_LRADCSELECT(vch, ch), LRADC_CTRL4); | ||
434 | } | ||
435 | |||
419 | static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) | 436 | static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) |
420 | { | 437 | { |
421 | /* | 438 | /* |
@@ -450,12 +467,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) | |||
450 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), | 467 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), |
451 | LRADC_DELAY(3)); | 468 | LRADC_DELAY(3)); |
452 | 469 | ||
453 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | | 470 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch), LRADC_CTRL1); |
454 | LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | | ||
455 | LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | ||
456 | 471 | ||
457 | /* wake us again, when the complete conversion is done */ | ||
458 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch), LRADC_CTRL1); | ||
459 | /* | 472 | /* |
460 | * after changing the touchscreen plates setting | 473 | * after changing the touchscreen plates setting |
461 | * the signals need some initial time to settle. Start the | 474 | * the signals need some initial time to settle. Start the |
@@ -509,12 +522,8 @@ static void mxs_lradc_setup_ts_pressure(struct mxs_lradc *lradc, unsigned ch1, | |||
509 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), | 522 | LRADC_DELAY_DELAY(lradc->over_sample_delay - 1), |
510 | LRADC_DELAY(3)); | 523 | LRADC_DELAY(3)); |
511 | 524 | ||
512 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(2) | | 525 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(ch2), LRADC_CTRL1); |
513 | LRADC_CTRL1_LRADC_IRQ(3) | LRADC_CTRL1_LRADC_IRQ(4) | | ||
514 | LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | ||
515 | 526 | ||
516 | /* wake us again, when the conversions are done */ | ||
517 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(ch2), LRADC_CTRL1); | ||
518 | /* | 527 | /* |
519 | * after changing the touchscreen plates setting | 528 | * after changing the touchscreen plates setting |
520 | * the signals need some initial time to settle. Start the | 529 | * the signals need some initial time to settle. Start the |
@@ -580,36 +589,6 @@ static unsigned mxs_lradc_read_ts_pressure(struct mxs_lradc *lradc, | |||
580 | #define TS_CH_XM 4 | 589 | #define TS_CH_XM 4 |
581 | #define TS_CH_YM 5 | 590 | #define TS_CH_YM 5 |
582 | 591 | ||
583 | static int mxs_lradc_read_ts_channel(struct mxs_lradc *lradc) | ||
584 | { | ||
585 | u32 reg; | ||
586 | int val; | ||
587 | |||
588 | reg = readl(lradc->base + LRADC_CTRL1); | ||
589 | |||
590 | /* only channels 3 to 5 are of interest here */ | ||
591 | if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YP)) { | ||
592 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YP) | | ||
593 | LRADC_CTRL1_LRADC_IRQ(TS_CH_YP), LRADC_CTRL1); | ||
594 | val = mxs_lradc_read_raw_channel(lradc, TS_CH_YP); | ||
595 | } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_XM)) { | ||
596 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_XM) | | ||
597 | LRADC_CTRL1_LRADC_IRQ(TS_CH_XM), LRADC_CTRL1); | ||
598 | val = mxs_lradc_read_raw_channel(lradc, TS_CH_XM); | ||
599 | } else if (reg & LRADC_CTRL1_LRADC_IRQ(TS_CH_YM)) { | ||
600 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(TS_CH_YM) | | ||
601 | LRADC_CTRL1_LRADC_IRQ(TS_CH_YM), LRADC_CTRL1); | ||
602 | val = mxs_lradc_read_raw_channel(lradc, TS_CH_YM); | ||
603 | } else { | ||
604 | return -EIO; | ||
605 | } | ||
606 | |||
607 | mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); | ||
608 | mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); | ||
609 | |||
610 | return val; | ||
611 | } | ||
612 | |||
613 | /* | 592 | /* |
614 | * YP(open)--+-------------+ | 593 | * YP(open)--+-------------+ |
615 | * | |--+ | 594 | * | |--+ |
@@ -653,7 +632,8 @@ static void mxs_lradc_prepare_x_pos(struct mxs_lradc *lradc) | |||
653 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); | 632 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_x_plate(lradc), LRADC_CTRL0); |
654 | 633 | ||
655 | lradc->cur_plate = LRADC_SAMPLE_X; | 634 | lradc->cur_plate = LRADC_SAMPLE_X; |
656 | mxs_lradc_setup_ts_channel(lradc, TS_CH_YP); | 635 | mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YP); |
636 | mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); | ||
657 | } | 637 | } |
658 | 638 | ||
659 | /* | 639 | /* |
@@ -674,7 +654,8 @@ static void mxs_lradc_prepare_y_pos(struct mxs_lradc *lradc) | |||
674 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); | 654 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_y_plate(lradc), LRADC_CTRL0); |
675 | 655 | ||
676 | lradc->cur_plate = LRADC_SAMPLE_Y; | 656 | lradc->cur_plate = LRADC_SAMPLE_Y; |
677 | mxs_lradc_setup_ts_channel(lradc, TS_CH_XM); | 657 | mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_XM); |
658 | mxs_lradc_setup_ts_channel(lradc, TOUCHSCREEN_VCHANNEL1); | ||
678 | } | 659 | } |
679 | 660 | ||
680 | /* | 661 | /* |
@@ -695,7 +676,10 @@ static void mxs_lradc_prepare_pressure(struct mxs_lradc *lradc) | |||
695 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); | 676 | mxs_lradc_reg_set(lradc, mxs_lradc_drive_pressure(lradc), LRADC_CTRL0); |
696 | 677 | ||
697 | lradc->cur_plate = LRADC_SAMPLE_PRESSURE; | 678 | lradc->cur_plate = LRADC_SAMPLE_PRESSURE; |
698 | mxs_lradc_setup_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); | 679 | mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL1, TS_CH_YM); |
680 | mxs_lradc_map_channel(lradc, TOUCHSCREEN_VCHANNEL2, TS_CH_XP); | ||
681 | mxs_lradc_setup_ts_pressure(lradc, TOUCHSCREEN_VCHANNEL2, | ||
682 | TOUCHSCREEN_VCHANNEL1); | ||
699 | } | 683 | } |
700 | 684 | ||
701 | static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) | 685 | static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) |
@@ -708,6 +692,19 @@ static void mxs_lradc_enable_touch_detection(struct mxs_lradc *lradc) | |||
708 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); | 692 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
709 | } | 693 | } |
710 | 694 | ||
695 | static void mxs_lradc_start_touch_event(struct mxs_lradc *lradc) | ||
696 | { | ||
697 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, | ||
698 | LRADC_CTRL1); | ||
699 | mxs_lradc_reg_set(lradc, | ||
700 | LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); | ||
701 | /* | ||
702 | * start with the Y-pos, because it uses nearly the same plate | ||
703 | * settings like the touch detection | ||
704 | */ | ||
705 | mxs_lradc_prepare_y_pos(lradc); | ||
706 | } | ||
707 | |||
711 | static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) | 708 | static void mxs_lradc_report_ts_event(struct mxs_lradc *lradc) |
712 | { | 709 | { |
713 | input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); | 710 | input_report_abs(lradc->ts_input, ABS_X, lradc->ts_x_pos); |
@@ -725,10 +722,12 @@ static void mxs_lradc_complete_touch_event(struct mxs_lradc *lradc) | |||
725 | * start a dummy conversion to burn time to settle the signals | 722 | * start a dummy conversion to burn time to settle the signals |
726 | * note: we are not interested in the conversion's value | 723 | * note: we are not interested in the conversion's value |
727 | */ | 724 | */ |
728 | mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(5)); | 725 | mxs_lradc_reg_wrt(lradc, 0, LRADC_CH(TOUCHSCREEN_VCHANNEL1)); |
729 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ(5), LRADC_CTRL1); | 726 | mxs_lradc_reg_clear(lradc, |
730 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_LRADC_IRQ_EN(5), LRADC_CTRL1); | 727 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | |
731 | mxs_lradc_reg_wrt(lradc, LRADC_DELAY_TRIGGER(1 << 5) | | 728 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); |
729 | mxs_lradc_reg_wrt(lradc, | ||
730 | LRADC_DELAY_TRIGGER(1 << TOUCHSCREEN_VCHANNEL1) | | ||
732 | LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ | 731 | LRADC_DELAY_KICK | LRADC_DELAY_DELAY(10), /* waste 5 ms */ |
733 | LRADC_DELAY(2)); | 732 | LRADC_DELAY(2)); |
734 | } | 733 | } |
@@ -760,59 +759,45 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) | |||
760 | 759 | ||
761 | /* if it is released, wait for the next touch via IRQ */ | 760 | /* if it is released, wait for the next touch via IRQ */ |
762 | lradc->cur_plate = LRADC_TOUCH; | 761 | lradc->cur_plate = LRADC_TOUCH; |
763 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); | 762 | mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(2)); |
763 | mxs_lradc_reg_wrt(lradc, 0, LRADC_DELAY(3)); | ||
764 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ | | ||
765 | LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | | ||
766 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1), LRADC_CTRL1); | ||
764 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); | 767 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
765 | } | 768 | } |
766 | 769 | ||
767 | /* touchscreen's state machine */ | 770 | /* touchscreen's state machine */ |
768 | static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) | 771 | static void mxs_lradc_handle_touch(struct mxs_lradc *lradc) |
769 | { | 772 | { |
770 | int val; | ||
771 | |||
772 | switch (lradc->cur_plate) { | 773 | switch (lradc->cur_plate) { |
773 | case LRADC_TOUCH: | 774 | case LRADC_TOUCH: |
774 | /* | 775 | if (mxs_lradc_check_touch_event(lradc)) |
775 | * start with the Y-pos, because it uses nearly the same plate | 776 | mxs_lradc_start_touch_event(lradc); |
776 | * settings like the touch detection | ||
777 | */ | ||
778 | if (mxs_lradc_check_touch_event(lradc)) { | ||
779 | mxs_lradc_reg_clear(lradc, | ||
780 | LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, | ||
781 | LRADC_CTRL1); | ||
782 | mxs_lradc_prepare_y_pos(lradc); | ||
783 | } | ||
784 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, | 777 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, |
785 | LRADC_CTRL1); | 778 | LRADC_CTRL1); |
786 | return; | 779 | return; |
787 | 780 | ||
788 | case LRADC_SAMPLE_Y: | 781 | case LRADC_SAMPLE_Y: |
789 | val = mxs_lradc_read_ts_channel(lradc); | 782 | lradc->ts_y_pos = mxs_lradc_read_raw_channel(lradc, |
790 | if (val < 0) { | 783 | TOUCHSCREEN_VCHANNEL1); |
791 | mxs_lradc_enable_touch_detection(lradc); /* re-start */ | ||
792 | return; | ||
793 | } | ||
794 | lradc->ts_y_pos = val; | ||
795 | mxs_lradc_prepare_x_pos(lradc); | 784 | mxs_lradc_prepare_x_pos(lradc); |
796 | return; | 785 | return; |
797 | 786 | ||
798 | case LRADC_SAMPLE_X: | 787 | case LRADC_SAMPLE_X: |
799 | val = mxs_lradc_read_ts_channel(lradc); | 788 | lradc->ts_x_pos = mxs_lradc_read_raw_channel(lradc, |
800 | if (val < 0) { | 789 | TOUCHSCREEN_VCHANNEL1); |
801 | mxs_lradc_enable_touch_detection(lradc); /* re-start */ | ||
802 | return; | ||
803 | } | ||
804 | lradc->ts_x_pos = val; | ||
805 | mxs_lradc_prepare_pressure(lradc); | 790 | mxs_lradc_prepare_pressure(lradc); |
806 | return; | 791 | return; |
807 | 792 | ||
808 | case LRADC_SAMPLE_PRESSURE: | 793 | case LRADC_SAMPLE_PRESSURE: |
809 | lradc->ts_pressure = | 794 | lradc->ts_pressure = mxs_lradc_read_ts_pressure(lradc, |
810 | mxs_lradc_read_ts_pressure(lradc, TS_CH_XP, TS_CH_YM); | 795 | TOUCHSCREEN_VCHANNEL2, |
796 | TOUCHSCREEN_VCHANNEL1); | ||
811 | mxs_lradc_complete_touch_event(lradc); | 797 | mxs_lradc_complete_touch_event(lradc); |
812 | return; | 798 | return; |
813 | 799 | ||
814 | case LRADC_SAMPLE_VALID: | 800 | case LRADC_SAMPLE_VALID: |
815 | val = mxs_lradc_read_ts_channel(lradc); /* ignore the value */ | ||
816 | mxs_lradc_finish_touch_event(lradc, 1); | 801 | mxs_lradc_finish_touch_event(lradc, 1); |
817 | break; | 802 | break; |
818 | } | 803 | } |
@@ -844,9 +829,9 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) | |||
844 | * used if doing raw sampling. | 829 | * used if doing raw sampling. |
845 | */ | 830 | */ |
846 | if (lradc->soc == IMX28_LRADC) | 831 | if (lradc->soc == IMX28_LRADC) |
847 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | 832 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_LRADC_IRQ_EN(0), |
848 | LRADC_CTRL1); | 833 | LRADC_CTRL1); |
849 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | 834 | mxs_lradc_reg_clear(lradc, 0x1, LRADC_CTRL0); |
850 | 835 | ||
851 | /* Enable / disable the divider per requirement */ | 836 | /* Enable / disable the divider per requirement */ |
852 | if (test_bit(chan, &lradc->is_divided)) | 837 | if (test_bit(chan, &lradc->is_divided)) |
@@ -1090,9 +1075,8 @@ static void mxs_lradc_disable_ts(struct mxs_lradc *lradc) | |||
1090 | { | 1075 | { |
1091 | /* stop all interrupts from firing */ | 1076 | /* stop all interrupts from firing */ |
1092 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | | 1077 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN | |
1093 | LRADC_CTRL1_LRADC_IRQ_EN(2) | LRADC_CTRL1_LRADC_IRQ_EN(3) | | 1078 | LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL1) | |
1094 | LRADC_CTRL1_LRADC_IRQ_EN(4) | LRADC_CTRL1_LRADC_IRQ_EN(5), | 1079 | LRADC_CTRL1_LRADC_IRQ_EN(TOUCHSCREEN_VCHANNEL2), LRADC_CTRL1); |
1095 | LRADC_CTRL1); | ||
1096 | 1080 | ||
1097 | /* Power-down touchscreen touch-detect circuitry. */ | 1081 | /* Power-down touchscreen touch-detect circuitry. */ |
1098 | mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); | 1082 | mxs_lradc_reg_clear(lradc, mxs_lradc_plate_mask(lradc), LRADC_CTRL0); |
@@ -1158,26 +1142,31 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data) | |||
1158 | struct iio_dev *iio = data; | 1142 | struct iio_dev *iio = data; |
1159 | struct mxs_lradc *lradc = iio_priv(iio); | 1143 | struct mxs_lradc *lradc = iio_priv(iio); |
1160 | unsigned long reg = readl(lradc->base + LRADC_CTRL1); | 1144 | unsigned long reg = readl(lradc->base + LRADC_CTRL1); |
1145 | uint32_t clr_irq = mxs_lradc_irq_mask(lradc); | ||
1161 | const uint32_t ts_irq_mask = | 1146 | const uint32_t ts_irq_mask = |
1162 | LRADC_CTRL1_TOUCH_DETECT_IRQ | | 1147 | LRADC_CTRL1_TOUCH_DETECT_IRQ | |
1163 | LRADC_CTRL1_LRADC_IRQ(2) | | 1148 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | |
1164 | LRADC_CTRL1_LRADC_IRQ(3) | | 1149 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2); |
1165 | LRADC_CTRL1_LRADC_IRQ(4) | | ||
1166 | LRADC_CTRL1_LRADC_IRQ(5); | ||
1167 | 1150 | ||
1168 | if (!(reg & mxs_lradc_irq_mask(lradc))) | 1151 | if (!(reg & mxs_lradc_irq_mask(lradc))) |
1169 | return IRQ_NONE; | 1152 | return IRQ_NONE; |
1170 | 1153 | ||
1171 | if (lradc->use_touchscreen && (reg & ts_irq_mask)) | 1154 | if (lradc->use_touchscreen && (reg & ts_irq_mask)) { |
1172 | mxs_lradc_handle_touch(lradc); | 1155 | mxs_lradc_handle_touch(lradc); |
1173 | 1156 | ||
1174 | if (iio_buffer_enabled(iio)) | 1157 | /* Make sure we don't clear the next conversion's interrupt. */ |
1175 | iio_trigger_poll(iio->trig); | 1158 | clr_irq &= ~(LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL1) | |
1176 | else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) | 1159 | LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2)); |
1160 | } | ||
1161 | |||
1162 | if (iio_buffer_enabled(iio)) { | ||
1163 | if (reg & lradc->buffer_vchans) | ||
1164 | iio_trigger_poll(iio->trig); | ||
1165 | } else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) { | ||
1177 | complete(&lradc->completion); | 1166 | complete(&lradc->completion); |
1167 | } | ||
1178 | 1168 | ||
1179 | mxs_lradc_reg_clear(lradc, reg & mxs_lradc_irq_mask(lradc), | 1169 | mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1); |
1180 | LRADC_CTRL1); | ||
1181 | 1170 | ||
1182 | return IRQ_HANDLED; | 1171 | return IRQ_HANDLED; |
1183 | } | 1172 | } |
@@ -1289,9 +1278,10 @@ static int mxs_lradc_buffer_preenable(struct iio_dev *iio) | |||
1289 | } | 1278 | } |
1290 | 1279 | ||
1291 | if (lradc->soc == IMX28_LRADC) | 1280 | if (lradc->soc == IMX28_LRADC) |
1292 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | 1281 | mxs_lradc_reg_clear(lradc, |
1293 | LRADC_CTRL1); | 1282 | lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, |
1294 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | 1283 | LRADC_CTRL1); |
1284 | mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); | ||
1295 | 1285 | ||
1296 | for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { | 1286 | for_each_set_bit(chan, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) { |
1297 | ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); | 1287 | ctrl4_set |= chan << LRADC_CTRL4_LRADCSELECT_OFFSET(ofs); |
@@ -1324,10 +1314,11 @@ static int mxs_lradc_buffer_postdisable(struct iio_dev *iio) | |||
1324 | mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | | 1314 | mxs_lradc_reg_clear(lradc, LRADC_DELAY_TRIGGER_LRADCS_MASK | |
1325 | LRADC_DELAY_KICK, LRADC_DELAY(0)); | 1315 | LRADC_DELAY_KICK, LRADC_DELAY(0)); |
1326 | 1316 | ||
1327 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | 1317 | mxs_lradc_reg_clear(lradc, lradc->buffer_vchans, LRADC_CTRL0); |
1328 | if (lradc->soc == IMX28_LRADC) | 1318 | if (lradc->soc == IMX28_LRADC) |
1329 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_MX28_LRADC_IRQ_EN_MASK, | 1319 | mxs_lradc_reg_clear(lradc, |
1330 | LRADC_CTRL1); | 1320 | lradc->buffer_vchans << LRADC_CTRL1_LRADC_IRQ_EN_OFFSET, |
1321 | LRADC_CTRL1); | ||
1331 | 1322 | ||
1332 | kfree(lradc->buffer); | 1323 | kfree(lradc->buffer); |
1333 | mutex_unlock(&lradc->lock); | 1324 | mutex_unlock(&lradc->lock); |
@@ -1353,7 +1344,7 @@ static bool mxs_lradc_validate_scan_mask(struct iio_dev *iio, | |||
1353 | if (lradc->use_touchbutton) | 1344 | if (lradc->use_touchbutton) |
1354 | rsvd_chans++; | 1345 | rsvd_chans++; |
1355 | if (lradc->use_touchscreen) | 1346 | if (lradc->use_touchscreen) |
1356 | rsvd_chans++; | 1347 | rsvd_chans += 2; |
1357 | 1348 | ||
1358 | /* Test for attempts to map channels with special mode of operation. */ | 1349 | /* Test for attempts to map channels with special mode of operation. */ |
1359 | if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) | 1350 | if (bitmap_intersects(mask, &rsvd_mask, LRADC_MAX_TOTAL_CHANS)) |
@@ -1413,6 +1404,13 @@ static const struct iio_chan_spec mxs_lradc_chan_spec[] = { | |||
1413 | .channel = 8, | 1404 | .channel = 8, |
1414 | .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, | 1405 | .scan_type = {.sign = 'u', .realbits = 18, .storagebits = 32,}, |
1415 | }, | 1406 | }, |
1407 | /* Hidden channel to keep indexes */ | ||
1408 | { | ||
1409 | .type = IIO_TEMP, | ||
1410 | .indexed = 1, | ||
1411 | .scan_index = -1, | ||
1412 | .channel = 9, | ||
1413 | }, | ||
1416 | MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ | 1414 | MXS_ADC_CHAN(10, IIO_VOLTAGE), /* VDDIO */ |
1417 | MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ | 1415 | MXS_ADC_CHAN(11, IIO_VOLTAGE), /* VTH */ |
1418 | MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ | 1416 | MXS_ADC_CHAN(12, IIO_VOLTAGE), /* VDDA */ |
@@ -1583,6 +1581,11 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
1583 | 1581 | ||
1584 | touch_ret = mxs_lradc_probe_touchscreen(lradc, node); | 1582 | touch_ret = mxs_lradc_probe_touchscreen(lradc, node); |
1585 | 1583 | ||
1584 | if (touch_ret == 0) | ||
1585 | lradc->buffer_vchans = BUFFER_VCHANS_LIMITED; | ||
1586 | else | ||
1587 | lradc->buffer_vchans = BUFFER_VCHANS_ALL; | ||
1588 | |||
1586 | /* Grab all IRQ sources */ | 1589 | /* Grab all IRQ sources */ |
1587 | for (i = 0; i < of_cfg->irq_count; i++) { | 1590 | for (i = 0; i < of_cfg->irq_count; i++) { |
1588 | lradc->irq[i] = platform_get_irq(pdev, i); | 1591 | lradc->irq[i] = platform_get_irq(pdev, i); |
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index 017d2f8379b7..c17893b4918c 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/bitops.h> | ||
21 | 22 | ||
22 | #include <linux/iio/iio.h> | 23 | #include <linux/iio/iio.h> |
23 | #include <linux/iio/sysfs.h> | 24 | #include <linux/iio/sysfs.h> |
@@ -68,7 +69,7 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev, | |||
68 | break; | 69 | break; |
69 | case IIO_ANGL_VEL: | 70 | case IIO_ANGL_VEL: |
70 | vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); | 71 | vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); |
71 | vel = (vel << 4) >> 4; | 72 | vel = sign_extend32(vel, 11); |
72 | *val = vel; | 73 | *val = vel; |
73 | break; | 74 | break; |
74 | default: | 75 | default: |
diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c index 25d244cbbe8f..031018e7a65b 100644 --- a/drivers/thermal/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c | |||
@@ -262,13 +262,12 @@ static int int3400_thermal_probe(struct platform_device *pdev) | |||
262 | result = acpi_parse_art(priv->adev->handle, &priv->art_count, | 262 | result = acpi_parse_art(priv->adev->handle, &priv->art_count, |
263 | &priv->arts, true); | 263 | &priv->arts, true); |
264 | if (result) | 264 | if (result) |
265 | goto free_priv; | 265 | dev_dbg(&pdev->dev, "_ART table parsing error\n"); |
266 | |||
267 | 266 | ||
268 | result = acpi_parse_trt(priv->adev->handle, &priv->trt_count, | 267 | result = acpi_parse_trt(priv->adev->handle, &priv->trt_count, |
269 | &priv->trts, true); | 268 | &priv->trts, true); |
270 | if (result) | 269 | if (result) |
271 | goto free_art; | 270 | dev_dbg(&pdev->dev, "_TRT table parsing error\n"); |
272 | 271 | ||
273 | platform_set_drvdata(pdev, priv); | 272 | platform_set_drvdata(pdev, priv); |
274 | 273 | ||
@@ -281,7 +280,7 @@ static int int3400_thermal_probe(struct platform_device *pdev) | |||
281 | &int3400_thermal_params, 0, 0); | 280 | &int3400_thermal_params, 0, 0); |
282 | if (IS_ERR(priv->thermal)) { | 281 | if (IS_ERR(priv->thermal)) { |
283 | result = PTR_ERR(priv->thermal); | 282 | result = PTR_ERR(priv->thermal); |
284 | goto free_trt; | 283 | goto free_art_trt; |
285 | } | 284 | } |
286 | 285 | ||
287 | priv->rel_misc_dev_res = acpi_thermal_rel_misc_device_add( | 286 | priv->rel_misc_dev_res = acpi_thermal_rel_misc_device_add( |
@@ -295,9 +294,8 @@ static int int3400_thermal_probe(struct platform_device *pdev) | |||
295 | 294 | ||
296 | free_zone: | 295 | free_zone: |
297 | thermal_zone_device_unregister(priv->thermal); | 296 | thermal_zone_device_unregister(priv->thermal); |
298 | free_trt: | 297 | free_art_trt: |
299 | kfree(priv->trts); | 298 | kfree(priv->trts); |
300 | free_art: | ||
301 | kfree(priv->arts); | 299 | kfree(priv->arts); |
302 | free_priv: | 300 | free_priv: |
303 | kfree(priv); | 301 | kfree(priv); |
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c index f88b08877025..1e25133d35e2 100644 --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c | |||
@@ -208,7 +208,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, | |||
208 | trip_cnt, GFP_KERNEL); | 208 | trip_cnt, GFP_KERNEL); |
209 | if (!int34x_thermal_zone->aux_trips) { | 209 | if (!int34x_thermal_zone->aux_trips) { |
210 | ret = -ENOMEM; | 210 | ret = -ENOMEM; |
211 | goto free_mem; | 211 | goto err_trip_alloc; |
212 | } | 212 | } |
213 | trip_mask = BIT(trip_cnt) - 1; | 213 | trip_mask = BIT(trip_cnt) - 1; |
214 | int34x_thermal_zone->aux_trip_nr = trip_cnt; | 214 | int34x_thermal_zone->aux_trip_nr = trip_cnt; |
@@ -248,14 +248,15 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, | |||
248 | 0, 0); | 248 | 0, 0); |
249 | if (IS_ERR(int34x_thermal_zone->zone)) { | 249 | if (IS_ERR(int34x_thermal_zone->zone)) { |
250 | ret = PTR_ERR(int34x_thermal_zone->zone); | 250 | ret = PTR_ERR(int34x_thermal_zone->zone); |
251 | goto free_lpat; | 251 | goto err_thermal_zone; |
252 | } | 252 | } |
253 | 253 | ||
254 | return int34x_thermal_zone; | 254 | return int34x_thermal_zone; |
255 | 255 | ||
256 | free_lpat: | 256 | err_thermal_zone: |
257 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); | 257 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); |
258 | free_mem: | 258 | kfree(int34x_thermal_zone->aux_trips); |
259 | err_trip_alloc: | ||
259 | kfree(int34x_thermal_zone); | 260 | kfree(int34x_thermal_zone); |
260 | return ERR_PTR(ret); | 261 | return ERR_PTR(ret); |
261 | } | 262 | } |
@@ -266,6 +267,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone | |||
266 | { | 267 | { |
267 | thermal_zone_device_unregister(int34x_thermal_zone->zone); | 268 | thermal_zone_device_unregister(int34x_thermal_zone->zone); |
268 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); | 269 | acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table); |
270 | kfree(int34x_thermal_zone->aux_trips); | ||
269 | kfree(int34x_thermal_zone); | 271 | kfree(int34x_thermal_zone); |
270 | } | 272 | } |
271 | EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); | 273 | EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove); |
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 6ceebd659dd4..12623bc02f46 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c | |||
@@ -688,6 +688,7 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = { | |||
688 | { X86_VENDOR_INTEL, 6, 0x45}, | 688 | { X86_VENDOR_INTEL, 6, 0x45}, |
689 | { X86_VENDOR_INTEL, 6, 0x46}, | 689 | { X86_VENDOR_INTEL, 6, 0x46}, |
690 | { X86_VENDOR_INTEL, 6, 0x4c}, | 690 | { X86_VENDOR_INTEL, 6, 0x4c}, |
691 | { X86_VENDOR_INTEL, 6, 0x4d}, | ||
691 | { X86_VENDOR_INTEL, 6, 0x56}, | 692 | { X86_VENDOR_INTEL, 6, 0x56}, |
692 | {} | 693 | {} |
693 | }; | 694 | }; |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 2580a4872f90..fe4e767018c4 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -387,21 +387,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
387 | 387 | ||
388 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 388 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
389 | if (irq) { | 389 | if (irq) { |
390 | int ret; | ||
391 | |||
392 | /* | 390 | /* |
393 | * platform has IRQ support. | 391 | * platform has IRQ support. |
394 | * Then, driver uses common registers | 392 | * Then, driver uses common registers |
395 | */ | ||
396 | |||
397 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, | ||
398 | dev_name(dev), common); | ||
399 | if (ret) { | ||
400 | dev_err(dev, "irq request failed\n "); | ||
401 | return ret; | ||
402 | } | ||
403 | |||
404 | /* | ||
405 | * rcar_has_irq_support() will be enabled | 393 | * rcar_has_irq_support() will be enabled |
406 | */ | 394 | */ |
407 | res = platform_get_resource(pdev, IORESOURCE_MEM, mres++); | 395 | res = platform_get_resource(pdev, IORESOURCE_MEM, mres++); |
@@ -456,8 +444,16 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
456 | } | 444 | } |
457 | 445 | ||
458 | /* enable temperature comparation */ | 446 | /* enable temperature comparation */ |
459 | if (irq) | 447 | if (irq) { |
448 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, | ||
449 | dev_name(dev), common); | ||
450 | if (ret) { | ||
451 | dev_err(dev, "irq request failed\n "); | ||
452 | goto error_unregister; | ||
453 | } | ||
454 | |||
460 | rcar_thermal_common_write(common, ENR, enr_bits); | 455 | rcar_thermal_common_write(common, ENR, enr_bits); |
456 | } | ||
461 | 457 | ||
462 | platform_set_drvdata(pdev, common); | 458 | platform_set_drvdata(pdev, common); |
463 | 459 | ||
@@ -467,9 +463,9 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
467 | 463 | ||
468 | error_unregister: | 464 | error_unregister: |
469 | rcar_thermal_for_each_priv(priv, common) { | 465 | rcar_thermal_for_each_priv(priv, common) { |
470 | thermal_zone_device_unregister(priv->zone); | ||
471 | if (rcar_has_irq_support(priv)) | 466 | if (rcar_has_irq_support(priv)) |
472 | rcar_thermal_irq_disable(priv); | 467 | rcar_thermal_irq_disable(priv); |
468 | thermal_zone_device_unregister(priv->zone); | ||
473 | } | 469 | } |
474 | 470 | ||
475 | pm_runtime_put(dev); | 471 | pm_runtime_put(dev); |
@@ -485,9 +481,9 @@ static int rcar_thermal_remove(struct platform_device *pdev) | |||
485 | struct rcar_thermal_priv *priv; | 481 | struct rcar_thermal_priv *priv; |
486 | 482 | ||
487 | rcar_thermal_for_each_priv(priv, common) { | 483 | rcar_thermal_for_each_priv(priv, common) { |
488 | thermal_zone_device_unregister(priv->zone); | ||
489 | if (rcar_has_irq_support(priv)) | 484 | if (rcar_has_irq_support(priv)) |
490 | rcar_thermal_irq_disable(priv); | 485 | rcar_thermal_irq_disable(priv); |
486 | thermal_zone_device_unregister(priv->zone); | ||
491 | } | 487 | } |
492 | 488 | ||
493 | pm_runtime_put(dev); | 489 | pm_runtime_put(dev); |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 933cd80a6bc5..1d30b0975651 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -682,6 +682,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) | |||
682 | 682 | ||
683 | if (on) { | 683 | if (on) { |
684 | con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); | 684 | con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); |
685 | con |= (1 << EXYNOS7_PD_DET_EN_SHIFT); | ||
685 | interrupt_en = | 686 | interrupt_en = |
686 | (of_thermal_is_trip_valid(tz, 7) | 687 | (of_thermal_is_trip_valid(tz, 7) |
687 | << EXYNOS7_TMU_INTEN_RISE7_SHIFT) | | 688 | << EXYNOS7_TMU_INTEN_RISE7_SHIFT) | |
@@ -704,9 +705,9 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) | |||
704 | interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT; | 705 | interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT; |
705 | } else { | 706 | } else { |
706 | con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT); | 707 | con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT); |
708 | con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT); | ||
707 | interrupt_en = 0; /* Disable all interrupts */ | 709 | interrupt_en = 0; /* Disable all interrupts */ |
708 | } | 710 | } |
709 | con |= 1 << EXYNOS7_PD_DET_EN_SHIFT; | ||
710 | 711 | ||
711 | writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN); | 712 | writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN); |
712 | writel(con, data->base + EXYNOS_TMU_REG_CONTROL); | 713 | writel(con, data->base + EXYNOS_TMU_REG_CONTROL); |
@@ -918,34 +919,16 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id) | |||
918 | } | 919 | } |
919 | 920 | ||
920 | static const struct of_device_id exynos_tmu_match[] = { | 921 | static const struct of_device_id exynos_tmu_match[] = { |
921 | { | 922 | { .compatible = "samsung,exynos3250-tmu", }, |
922 | .compatible = "samsung,exynos3250-tmu", | 923 | { .compatible = "samsung,exynos4210-tmu", }, |
923 | }, | 924 | { .compatible = "samsung,exynos4412-tmu", }, |
924 | { | 925 | { .compatible = "samsung,exynos5250-tmu", }, |
925 | .compatible = "samsung,exynos4210-tmu", | 926 | { .compatible = "samsung,exynos5260-tmu", }, |
926 | }, | 927 | { .compatible = "samsung,exynos5420-tmu", }, |
927 | { | 928 | { .compatible = "samsung,exynos5420-tmu-ext-triminfo", }, |
928 | .compatible = "samsung,exynos4412-tmu", | 929 | { .compatible = "samsung,exynos5440-tmu", }, |
929 | }, | 930 | { .compatible = "samsung,exynos7-tmu", }, |
930 | { | 931 | { /* sentinel */ }, |
931 | .compatible = "samsung,exynos5250-tmu", | ||
932 | }, | ||
933 | { | ||
934 | .compatible = "samsung,exynos5260-tmu", | ||
935 | }, | ||
936 | { | ||
937 | .compatible = "samsung,exynos5420-tmu", | ||
938 | }, | ||
939 | { | ||
940 | .compatible = "samsung,exynos5420-tmu-ext-triminfo", | ||
941 | }, | ||
942 | { | ||
943 | .compatible = "samsung,exynos5440-tmu", | ||
944 | }, | ||
945 | { | ||
946 | .compatible = "samsung,exynos7-tmu", | ||
947 | }, | ||
948 | {}, | ||
949 | }; | 932 | }; |
950 | MODULE_DEVICE_TABLE(of, exynos_tmu_match); | 933 | MODULE_DEVICE_TABLE(of, exynos_tmu_match); |
951 | 934 | ||
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 48491d1a81d6..174d3bcf8bd7 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -899,6 +899,22 @@ thermal_cooling_device_trip_point_show(struct device *dev, | |||
899 | return sprintf(buf, "%d\n", instance->trip); | 899 | return sprintf(buf, "%d\n", instance->trip); |
900 | } | 900 | } |
901 | 901 | ||
902 | static struct attribute *cooling_device_attrs[] = { | ||
903 | &dev_attr_cdev_type.attr, | ||
904 | &dev_attr_max_state.attr, | ||
905 | &dev_attr_cur_state.attr, | ||
906 | NULL, | ||
907 | }; | ||
908 | |||
909 | static const struct attribute_group cooling_device_attr_group = { | ||
910 | .attrs = cooling_device_attrs, | ||
911 | }; | ||
912 | |||
913 | static const struct attribute_group *cooling_device_attr_groups[] = { | ||
914 | &cooling_device_attr_group, | ||
915 | NULL, | ||
916 | }; | ||
917 | |||
902 | /* Device management */ | 918 | /* Device management */ |
903 | 919 | ||
904 | /** | 920 | /** |
@@ -1130,6 +1146,7 @@ __thermal_cooling_device_register(struct device_node *np, | |||
1130 | cdev->ops = ops; | 1146 | cdev->ops = ops; |
1131 | cdev->updated = false; | 1147 | cdev->updated = false; |
1132 | cdev->device.class = &thermal_class; | 1148 | cdev->device.class = &thermal_class; |
1149 | cdev->device.groups = cooling_device_attr_groups; | ||
1133 | cdev->devdata = devdata; | 1150 | cdev->devdata = devdata; |
1134 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); | 1151 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); |
1135 | result = device_register(&cdev->device); | 1152 | result = device_register(&cdev->device); |
@@ -1139,21 +1156,6 @@ __thermal_cooling_device_register(struct device_node *np, | |||
1139 | return ERR_PTR(result); | 1156 | return ERR_PTR(result); |
1140 | } | 1157 | } |
1141 | 1158 | ||
1142 | /* sys I/F */ | ||
1143 | if (type) { | ||
1144 | result = device_create_file(&cdev->device, &dev_attr_cdev_type); | ||
1145 | if (result) | ||
1146 | goto unregister; | ||
1147 | } | ||
1148 | |||
1149 | result = device_create_file(&cdev->device, &dev_attr_max_state); | ||
1150 | if (result) | ||
1151 | goto unregister; | ||
1152 | |||
1153 | result = device_create_file(&cdev->device, &dev_attr_cur_state); | ||
1154 | if (result) | ||
1155 | goto unregister; | ||
1156 | |||
1157 | /* Add 'this' new cdev to the global cdev list */ | 1159 | /* Add 'this' new cdev to the global cdev list */ |
1158 | mutex_lock(&thermal_list_lock); | 1160 | mutex_lock(&thermal_list_lock); |
1159 | list_add(&cdev->node, &thermal_cdev_list); | 1161 | list_add(&cdev->node, &thermal_cdev_list); |
@@ -1163,11 +1165,6 @@ __thermal_cooling_device_register(struct device_node *np, | |||
1163 | bind_cdev(cdev); | 1165 | bind_cdev(cdev); |
1164 | 1166 | ||
1165 | return cdev; | 1167 | return cdev; |
1166 | |||
1167 | unregister: | ||
1168 | release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); | ||
1169 | device_unregister(&cdev->device); | ||
1170 | return ERR_PTR(result); | ||
1171 | } | 1168 | } |
1172 | 1169 | ||
1173 | /** | 1170 | /** |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 634b6ce0e63a..62a5d449c388 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -1402,7 +1402,7 @@ int ti_bandgap_remove(struct platform_device *pdev) | |||
1402 | return 0; | 1402 | return 0; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | #ifdef CONFIG_PM | 1405 | #ifdef CONFIG_PM_SLEEP |
1406 | static int ti_bandgap_save_ctxt(struct ti_bandgap *bgp) | 1406 | static int ti_bandgap_save_ctxt(struct ti_bandgap *bgp) |
1407 | { | 1407 | { |
1408 | int i; | 1408 | int i; |
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index 3fb054a10f6a..a38c1756442a 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c | |||
@@ -429,7 +429,7 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) | |||
429 | 429 | ||
430 | data = ti_bandgap_get_sensor_data(bgp, id); | 430 | data = ti_bandgap_get_sensor_data(bgp, id); |
431 | 431 | ||
432 | if (data && data->cool_dev) | 432 | if (data) |
433 | cpufreq_cooling_unregister(data->cool_dev); | 433 | cpufreq_cooling_unregister(data->cool_dev); |
434 | 434 | ||
435 | return 0; | 435 | return 0; |
diff --git a/drivers/tty/bfin_jtag_comm.c b/drivers/tty/bfin_jtag_comm.c index d7b198c400c7..ce24182f8514 100644 --- a/drivers/tty/bfin_jtag_comm.c +++ b/drivers/tty/bfin_jtag_comm.c | |||
@@ -210,18 +210,6 @@ bfin_jc_chars_in_buffer(struct tty_struct *tty) | |||
210 | return circ_cnt(&bfin_jc_write_buf); | 210 | return circ_cnt(&bfin_jc_write_buf); |
211 | } | 211 | } |
212 | 212 | ||
213 | static void | ||
214 | bfin_jc_wait_until_sent(struct tty_struct *tty, int timeout) | ||
215 | { | ||
216 | unsigned long expire = jiffies + timeout; | ||
217 | while (!circ_empty(&bfin_jc_write_buf)) { | ||
218 | if (signal_pending(current)) | ||
219 | break; | ||
220 | if (time_after(jiffies, expire)) | ||
221 | break; | ||
222 | } | ||
223 | } | ||
224 | |||
225 | static const struct tty_operations bfin_jc_ops = { | 213 | static const struct tty_operations bfin_jc_ops = { |
226 | .open = bfin_jc_open, | 214 | .open = bfin_jc_open, |
227 | .close = bfin_jc_close, | 215 | .close = bfin_jc_close, |
@@ -230,7 +218,6 @@ static const struct tty_operations bfin_jc_ops = { | |||
230 | .flush_chars = bfin_jc_flush_chars, | 218 | .flush_chars = bfin_jc_flush_chars, |
231 | .write_room = bfin_jc_write_room, | 219 | .write_room = bfin_jc_write_room, |
232 | .chars_in_buffer = bfin_jc_chars_in_buffer, | 220 | .chars_in_buffer = bfin_jc_chars_in_buffer, |
233 | .wait_until_sent = bfin_jc_wait_until_sent, | ||
234 | }; | 221 | }; |
235 | 222 | ||
236 | static int __init bfin_jc_init(void) | 223 | static int __init bfin_jc_init(void) |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index e3b9570a1eff..deae122c9c4b 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2138,8 +2138,8 @@ int serial8250_do_startup(struct uart_port *port) | |||
2138 | /* | 2138 | /* |
2139 | * Clear the interrupt registers. | 2139 | * Clear the interrupt registers. |
2140 | */ | 2140 | */ |
2141 | if (serial_port_in(port, UART_LSR) & UART_LSR_DR) | 2141 | serial_port_in(port, UART_LSR); |
2142 | serial_port_in(port, UART_RX); | 2142 | serial_port_in(port, UART_RX); |
2143 | serial_port_in(port, UART_IIR); | 2143 | serial_port_in(port, UART_IIR); |
2144 | serial_port_in(port, UART_MSR); | 2144 | serial_port_in(port, UART_MSR); |
2145 | 2145 | ||
@@ -2300,8 +2300,8 @@ dont_test_tx_en: | |||
2300 | * saved flags to avoid getting false values from polling | 2300 | * saved flags to avoid getting false values from polling |
2301 | * routines or the previous session. | 2301 | * routines or the previous session. |
2302 | */ | 2302 | */ |
2303 | if (serial_port_in(port, UART_LSR) & UART_LSR_DR) | 2303 | serial_port_in(port, UART_LSR); |
2304 | serial_port_in(port, UART_RX); | 2304 | serial_port_in(port, UART_RX); |
2305 | serial_port_in(port, UART_IIR); | 2305 | serial_port_in(port, UART_IIR); |
2306 | serial_port_in(port, UART_MSR); | 2306 | serial_port_in(port, UART_MSR); |
2307 | up->lsr_saved_flags = 0; | 2307 | up->lsr_saved_flags = 0; |
@@ -2394,8 +2394,7 @@ void serial8250_do_shutdown(struct uart_port *port) | |||
2394 | * Read data port to reset things, and then unlink from | 2394 | * Read data port to reset things, and then unlink from |
2395 | * the IRQ chain. | 2395 | * the IRQ chain. |
2396 | */ | 2396 | */ |
2397 | if (serial_port_in(port, UART_LSR) & UART_LSR_DR) | 2397 | serial_port_in(port, UART_RX); |
2398 | serial_port_in(port, UART_RX); | ||
2399 | serial8250_rpm_put(up); | 2398 | serial8250_rpm_put(up); |
2400 | 2399 | ||
2401 | del_timer_sync(&up->timer); | 2400 | del_timer_sync(&up->timer); |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index e60116235836..2ab229ddee38 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -59,6 +59,8 @@ struct dw8250_data { | |||
59 | u8 usr_reg; | 59 | u8 usr_reg; |
60 | int last_mcr; | 60 | int last_mcr; |
61 | int line; | 61 | int line; |
62 | int msr_mask_on; | ||
63 | int msr_mask_off; | ||
62 | struct clk *clk; | 64 | struct clk *clk; |
63 | struct clk *pclk; | 65 | struct clk *pclk; |
64 | struct reset_control *rst; | 66 | struct reset_control *rst; |
@@ -81,6 +83,12 @@ static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) | |||
81 | value &= ~UART_MSR_DCTS; | 83 | value &= ~UART_MSR_DCTS; |
82 | } | 84 | } |
83 | 85 | ||
86 | /* Override any modem control signals if needed */ | ||
87 | if (offset == UART_MSR) { | ||
88 | value |= d->msr_mask_on; | ||
89 | value &= ~d->msr_mask_off; | ||
90 | } | ||
91 | |||
84 | return value; | 92 | return value; |
85 | } | 93 | } |
86 | 94 | ||
@@ -334,6 +342,30 @@ static int dw8250_probe_of(struct uart_port *p, | |||
334 | if (id >= 0) | 342 | if (id >= 0) |
335 | p->line = id; | 343 | p->line = id; |
336 | 344 | ||
345 | if (of_property_read_bool(np, "dcd-override")) { | ||
346 | /* Always report DCD as active */ | ||
347 | data->msr_mask_on |= UART_MSR_DCD; | ||
348 | data->msr_mask_off |= UART_MSR_DDCD; | ||
349 | } | ||
350 | |||
351 | if (of_property_read_bool(np, "dsr-override")) { | ||
352 | /* Always report DSR as active */ | ||
353 | data->msr_mask_on |= UART_MSR_DSR; | ||
354 | data->msr_mask_off |= UART_MSR_DDSR; | ||
355 | } | ||
356 | |||
357 | if (of_property_read_bool(np, "cts-override")) { | ||
358 | /* Always report DSR as active */ | ||
359 | data->msr_mask_on |= UART_MSR_DSR; | ||
360 | data->msr_mask_off |= UART_MSR_DDSR; | ||
361 | } | ||
362 | |||
363 | if (of_property_read_bool(np, "ri-override")) { | ||
364 | /* Always report Ring indicator as inactive */ | ||
365 | data->msr_mask_off |= UART_MSR_RI; | ||
366 | data->msr_mask_off |= UART_MSR_TERI; | ||
367 | } | ||
368 | |||
337 | /* clock got configured through clk api, all done */ | 369 | /* clock got configured through clk api, all done */ |
338 | if (p->uartclk) | 370 | if (p->uartclk) |
339 | return 0; | 371 | return 0; |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index daf2c82984e9..892eb32cdef4 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -69,7 +69,7 @@ static void moan_device(const char *str, struct pci_dev *dev) | |||
69 | "Please send the output of lspci -vv, this\n" | 69 | "Please send the output of lspci -vv, this\n" |
70 | "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" | 70 | "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" |
71 | "manufacturer and name of serial board or\n" | 71 | "manufacturer and name of serial board or\n" |
72 | "modem board to rmk+serial@arm.linux.org.uk.\n", | 72 | "modem board to <linux-serial@vger.kernel.org>.\n", |
73 | pci_name(dev), str, dev->vendor, dev->device, | 73 | pci_name(dev), str, dev->vendor, dev->device, |
74 | dev->subsystem_vendor, dev->subsystem_device); | 74 | dev->subsystem_vendor, dev->subsystem_device); |
75 | } | 75 | } |
@@ -1989,13 +1989,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1989 | }, | 1989 | }, |
1990 | { | 1990 | { |
1991 | .vendor = PCI_VENDOR_ID_INTEL, | 1991 | .vendor = PCI_VENDOR_ID_INTEL, |
1992 | .device = PCI_DEVICE_ID_INTEL_QRK_UART, | ||
1993 | .subvendor = PCI_ANY_ID, | ||
1994 | .subdevice = PCI_ANY_ID, | ||
1995 | .setup = pci_default_setup, | ||
1996 | }, | ||
1997 | { | ||
1998 | .vendor = PCI_VENDOR_ID_INTEL, | ||
1999 | .device = PCI_DEVICE_ID_INTEL_BSW_UART1, | 1992 | .device = PCI_DEVICE_ID_INTEL_BSW_UART1, |
2000 | .subvendor = PCI_ANY_ID, | 1993 | .subvendor = PCI_ANY_ID, |
2001 | .subdevice = PCI_ANY_ID, | 1994 | .subdevice = PCI_ANY_ID, |
@@ -2201,13 +2194,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
2201 | */ | 2194 | */ |
2202 | { | 2195 | { |
2203 | .vendor = PCI_VENDOR_ID_PLX, | 2196 | .vendor = PCI_VENDOR_ID_PLX, |
2204 | .device = PCI_DEVICE_ID_PLX_9030, | ||
2205 | .subvendor = PCI_SUBVENDOR_ID_PERLE, | ||
2206 | .subdevice = PCI_ANY_ID, | ||
2207 | .setup = pci_default_setup, | ||
2208 | }, | ||
2209 | { | ||
2210 | .vendor = PCI_VENDOR_ID_PLX, | ||
2211 | .device = PCI_DEVICE_ID_PLX_9050, | 2197 | .device = PCI_DEVICE_ID_PLX_9050, |
2212 | .subvendor = PCI_SUBVENDOR_ID_EXSYS, | 2198 | .subvendor = PCI_SUBVENDOR_ID_EXSYS, |
2213 | .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055, | 2199 | .subdevice = PCI_SUBDEVICE_ID_EXSYS_4055, |
@@ -5415,10 +5401,6 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
5415 | PCI_ANY_ID, PCI_ANY_ID, | 5401 | PCI_ANY_ID, PCI_ANY_ID, |
5416 | 0, 0, pbn_b0_bt_2_115200 }, | 5402 | 0, 0, pbn_b0_bt_2_115200 }, |
5417 | 5403 | ||
5418 | { PCI_VENDOR_ID_WCH, PCI_DEVICE_ID_WCH_CH352_2S, | ||
5419 | PCI_ANY_ID, PCI_ANY_ID, | ||
5420 | 0, 0, pbn_b0_bt_2_115200 }, | ||
5421 | |||
5422 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, | 5404 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, |
5423 | PCI_ANY_ID, PCI_ANY_ID, | 5405 | PCI_ANY_ID, PCI_ANY_ID, |
5424 | 0, 0, pbn_wch384_4 }, | 5406 | 0, 0, pbn_wch384_4 }, |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 846552bff67d..4e959c43f680 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/gpio/consumer.h> | 47 | #include <linux/gpio/consumer.h> |
48 | #include <linux/err.h> | 48 | #include <linux/err.h> |
49 | #include <linux/irq.h> | 49 | #include <linux/irq.h> |
50 | #include <linux/suspend.h> | ||
50 | 51 | ||
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
52 | #include <asm/ioctls.h> | 53 | #include <asm/ioctls.h> |
@@ -173,6 +174,12 @@ struct atmel_uart_port { | |||
173 | bool ms_irq_enabled; | 174 | bool ms_irq_enabled; |
174 | bool is_usart; /* usart or uart */ | 175 | bool is_usart; /* usart or uart */ |
175 | struct timer_list uart_timer; /* uart timer */ | 176 | struct timer_list uart_timer; /* uart timer */ |
177 | |||
178 | bool suspended; | ||
179 | unsigned int pending; | ||
180 | unsigned int pending_status; | ||
181 | spinlock_t lock_suspended; | ||
182 | |||
176 | int (*prepare_rx)(struct uart_port *port); | 183 | int (*prepare_rx)(struct uart_port *port); |
177 | int (*prepare_tx)(struct uart_port *port); | 184 | int (*prepare_tx)(struct uart_port *port); |
178 | void (*schedule_rx)(struct uart_port *port); | 185 | void (*schedule_rx)(struct uart_port *port); |
@@ -1179,12 +1186,15 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) | |||
1179 | { | 1186 | { |
1180 | struct uart_port *port = dev_id; | 1187 | struct uart_port *port = dev_id; |
1181 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1188 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
1182 | unsigned int status, pending, pass_counter = 0; | 1189 | unsigned int status, pending, mask, pass_counter = 0; |
1183 | bool gpio_handled = false; | 1190 | bool gpio_handled = false; |
1184 | 1191 | ||
1192 | spin_lock(&atmel_port->lock_suspended); | ||
1193 | |||
1185 | do { | 1194 | do { |
1186 | status = atmel_get_lines_status(port); | 1195 | status = atmel_get_lines_status(port); |
1187 | pending = status & UART_GET_IMR(port); | 1196 | mask = UART_GET_IMR(port); |
1197 | pending = status & mask; | ||
1188 | if (!gpio_handled) { | 1198 | if (!gpio_handled) { |
1189 | /* | 1199 | /* |
1190 | * Dealing with GPIO interrupt | 1200 | * Dealing with GPIO interrupt |
@@ -1206,11 +1216,21 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id) | |||
1206 | if (!pending) | 1216 | if (!pending) |
1207 | break; | 1217 | break; |
1208 | 1218 | ||
1219 | if (atmel_port->suspended) { | ||
1220 | atmel_port->pending |= pending; | ||
1221 | atmel_port->pending_status = status; | ||
1222 | UART_PUT_IDR(port, mask); | ||
1223 | pm_system_wakeup(); | ||
1224 | break; | ||
1225 | } | ||
1226 | |||
1209 | atmel_handle_receive(port, pending); | 1227 | atmel_handle_receive(port, pending); |
1210 | atmel_handle_status(port, pending, status); | 1228 | atmel_handle_status(port, pending, status); |
1211 | atmel_handle_transmit(port, pending); | 1229 | atmel_handle_transmit(port, pending); |
1212 | } while (pass_counter++ < ATMEL_ISR_PASS_LIMIT); | 1230 | } while (pass_counter++ < ATMEL_ISR_PASS_LIMIT); |
1213 | 1231 | ||
1232 | spin_unlock(&atmel_port->lock_suspended); | ||
1233 | |||
1214 | return pass_counter ? IRQ_HANDLED : IRQ_NONE; | 1234 | return pass_counter ? IRQ_HANDLED : IRQ_NONE; |
1215 | } | 1235 | } |
1216 | 1236 | ||
@@ -1742,7 +1762,8 @@ static int atmel_startup(struct uart_port *port) | |||
1742 | /* | 1762 | /* |
1743 | * Allocate the IRQ | 1763 | * Allocate the IRQ |
1744 | */ | 1764 | */ |
1745 | retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED, | 1765 | retval = request_irq(port->irq, atmel_interrupt, |
1766 | IRQF_SHARED | IRQF_COND_SUSPEND, | ||
1746 | tty ? tty->name : "atmel_serial", port); | 1767 | tty ? tty->name : "atmel_serial", port); |
1747 | if (retval) { | 1768 | if (retval) { |
1748 | dev_err(port->dev, "atmel_startup - Can't get irq\n"); | 1769 | dev_err(port->dev, "atmel_startup - Can't get irq\n"); |
@@ -2513,8 +2534,14 @@ static int atmel_serial_suspend(struct platform_device *pdev, | |||
2513 | 2534 | ||
2514 | /* we can not wake up if we're running on slow clock */ | 2535 | /* we can not wake up if we're running on slow clock */ |
2515 | atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); | 2536 | atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); |
2516 | if (atmel_serial_clk_will_stop()) | 2537 | if (atmel_serial_clk_will_stop()) { |
2538 | unsigned long flags; | ||
2539 | |||
2540 | spin_lock_irqsave(&atmel_port->lock_suspended, flags); | ||
2541 | atmel_port->suspended = true; | ||
2542 | spin_unlock_irqrestore(&atmel_port->lock_suspended, flags); | ||
2517 | device_set_wakeup_enable(&pdev->dev, 0); | 2543 | device_set_wakeup_enable(&pdev->dev, 0); |
2544 | } | ||
2518 | 2545 | ||
2519 | uart_suspend_port(&atmel_uart, port); | 2546 | uart_suspend_port(&atmel_uart, port); |
2520 | 2547 | ||
@@ -2525,6 +2552,18 @@ static int atmel_serial_resume(struct platform_device *pdev) | |||
2525 | { | 2552 | { |
2526 | struct uart_port *port = platform_get_drvdata(pdev); | 2553 | struct uart_port *port = platform_get_drvdata(pdev); |
2527 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 2554 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
2555 | unsigned long flags; | ||
2556 | |||
2557 | spin_lock_irqsave(&atmel_port->lock_suspended, flags); | ||
2558 | if (atmel_port->pending) { | ||
2559 | atmel_handle_receive(port, atmel_port->pending); | ||
2560 | atmel_handle_status(port, atmel_port->pending, | ||
2561 | atmel_port->pending_status); | ||
2562 | atmel_handle_transmit(port, atmel_port->pending); | ||
2563 | atmel_port->pending = 0; | ||
2564 | } | ||
2565 | atmel_port->suspended = false; | ||
2566 | spin_unlock_irqrestore(&atmel_port->lock_suspended, flags); | ||
2528 | 2567 | ||
2529 | uart_resume_port(&atmel_uart, port); | 2568 | uart_resume_port(&atmel_uart, port); |
2530 | device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); | 2569 | device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); |
@@ -2593,6 +2632,8 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
2593 | port->backup_imr = 0; | 2632 | port->backup_imr = 0; |
2594 | port->uart.line = ret; | 2633 | port->uart.line = ret; |
2595 | 2634 | ||
2635 | spin_lock_init(&port->lock_suspended); | ||
2636 | |||
2596 | ret = atmel_init_gpios(port, &pdev->dev); | 2637 | ret = atmel_init_gpios(port, &pdev->dev); |
2597 | if (ret < 0) | 2638 | if (ret < 0) |
2598 | dev_err(&pdev->dev, "%s", | 2639 | dev_err(&pdev->dev, "%s", |
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 7ff61e24a195..33fb94f78967 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -133,10 +133,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, | |||
133 | if (of_find_property(np, "no-loopback-test", NULL)) | 133 | if (of_find_property(np, "no-loopback-test", NULL)) |
134 | port->flags |= UPF_SKIP_TEST; | 134 | port->flags |= UPF_SKIP_TEST; |
135 | 135 | ||
136 | ret = of_alias_get_id(np, "serial"); | ||
137 | if (ret >= 0) | ||
138 | port->line = ret; | ||
139 | |||
140 | port->dev = &ofdev->dev; | 136 | port->dev = &ofdev->dev; |
141 | 137 | ||
142 | switch (type) { | 138 | switch (type) { |
diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 594b63331ef4..bca975f5093b 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c | |||
@@ -293,8 +293,10 @@ static irqreturn_t sprd_handle_irq(int irq, void *dev_id) | |||
293 | 293 | ||
294 | ims = serial_in(port, SPRD_IMSR); | 294 | ims = serial_in(port, SPRD_IMSR); |
295 | 295 | ||
296 | if (!ims) | 296 | if (!ims) { |
297 | spin_unlock(&port->lock); | ||
297 | return IRQ_NONE; | 298 | return IRQ_NONE; |
299 | } | ||
298 | 300 | ||
299 | serial_out(port, SPRD_ICLR, ~0); | 301 | serial_out(port, SPRD_ICLR, ~0); |
300 | 302 | ||
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 51f066aa375e..2bb4dfc02873 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1028,8 +1028,8 @@ EXPORT_SYMBOL(start_tty); | |||
1028 | /* We limit tty time update visibility to every 8 seconds or so. */ | 1028 | /* We limit tty time update visibility to every 8 seconds or so. */ |
1029 | static void tty_update_time(struct timespec *time) | 1029 | static void tty_update_time(struct timespec *time) |
1030 | { | 1030 | { |
1031 | unsigned long sec = get_seconds() & ~7; | 1031 | unsigned long sec = get_seconds(); |
1032 | if ((long)(sec - time->tv_sec) > 0) | 1032 | if (abs(sec - time->tv_sec) & ~7) |
1033 | time->tv_sec = sec; | 1033 | time->tv_sec = sec; |
1034 | } | 1034 | } |
1035 | 1035 | ||
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index a5cf253b2544..632fc8152061 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c | |||
@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) | |||
217 | #endif | 217 | #endif |
218 | if (!timeout) | 218 | if (!timeout) |
219 | timeout = MAX_SCHEDULE_TIMEOUT; | 219 | timeout = MAX_SCHEDULE_TIMEOUT; |
220 | if (wait_event_interruptible_timeout(tty->write_wait, | 220 | |
221 | !tty_chars_in_buffer(tty), timeout) >= 0) { | 221 | timeout = wait_event_interruptible_timeout(tty->write_wait, |
222 | if (tty->ops->wait_until_sent) | 222 | !tty_chars_in_buffer(tty), timeout); |
223 | tty->ops->wait_until_sent(tty, timeout); | 223 | if (timeout <= 0) |
224 | } | 224 | return; |
225 | |||
226 | if (timeout == MAX_SCHEDULE_TIMEOUT) | ||
227 | timeout = 0; | ||
228 | |||
229 | if (tty->ops->wait_until_sent) | ||
230 | tty->ops->wait_until_sent(tty, timeout); | ||
225 | } | 231 | } |
226 | EXPORT_SYMBOL(tty_wait_until_sent); | 232 | EXPORT_SYMBOL(tty_wait_until_sent); |
227 | 233 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e78720b59d67..683617714e7c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1650,6 +1650,8 @@ static int acm_reset_resume(struct usb_interface *intf) | |||
1650 | 1650 | ||
1651 | static const struct usb_device_id acm_ids[] = { | 1651 | static const struct usb_device_id acm_ids[] = { |
1652 | /* quirky and broken devices */ | 1652 | /* quirky and broken devices */ |
1653 | { USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */ | ||
1654 | .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ | ||
1653 | { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */ | 1655 | { USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */ |
1654 | .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ | 1656 | .driver_info = NO_UNION_NORMAL, },/* has no union descriptor */ |
1655 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ | 1657 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 66abdbcfbfa5..11635537c052 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) | |||
501 | as->status = urb->status; | 501 | as->status = urb->status; |
502 | signr = as->signr; | 502 | signr = as->signr; |
503 | if (signr) { | 503 | if (signr) { |
504 | memset(&sinfo, 0, sizeof(sinfo)); | ||
504 | sinfo.si_signo = as->signr; | 505 | sinfo.si_signo = as->signr; |
505 | sinfo.si_errno = as->status; | 506 | sinfo.si_errno = as->status; |
506 | sinfo.si_code = SI_ASYNCIO; | 507 | sinfo.si_code = SI_ASYNCIO; |
@@ -2382,6 +2383,7 @@ static void usbdev_remove(struct usb_device *udev) | |||
2382 | wake_up_all(&ps->wait); | 2383 | wake_up_all(&ps->wait); |
2383 | list_del_init(&ps->list); | 2384 | list_del_init(&ps->list); |
2384 | if (ps->discsignr) { | 2385 | if (ps->discsignr) { |
2386 | memset(&sinfo, 0, sizeof(sinfo)); | ||
2385 | sinfo.si_signo = ps->discsignr; | 2387 | sinfo.si_signo = ps->discsignr; |
2386 | sinfo.si_errno = EPIPE; | 2388 | sinfo.si_errno = EPIPE; |
2387 | sinfo.si_code = SI_ASYNCIO; | 2389 | sinfo.si_code = SI_ASYNCIO; |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 172d64e585b6..52e0c4e5e48e 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -205,6 +205,18 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap *omap, u32 value) | |||
205 | omap->irq0_offset, value); | 205 | omap->irq0_offset, value); |
206 | } | 206 | } |
207 | 207 | ||
208 | static void dwc3_omap_write_irqmisc_clr(struct dwc3_omap *omap, u32 value) | ||
209 | { | ||
210 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_MISC + | ||
211 | omap->irqmisc_offset, value); | ||
212 | } | ||
213 | |||
214 | static void dwc3_omap_write_irq0_clr(struct dwc3_omap *omap, u32 value) | ||
215 | { | ||
216 | dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_CLR_0 - | ||
217 | omap->irq0_offset, value); | ||
218 | } | ||
219 | |||
208 | static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, | 220 | static void dwc3_omap_set_mailbox(struct dwc3_omap *omap, |
209 | enum omap_dwc3_vbus_id_status status) | 221 | enum omap_dwc3_vbus_id_status status) |
210 | { | 222 | { |
@@ -345,9 +357,23 @@ static void dwc3_omap_enable_irqs(struct dwc3_omap *omap) | |||
345 | 357 | ||
346 | static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) | 358 | static void dwc3_omap_disable_irqs(struct dwc3_omap *omap) |
347 | { | 359 | { |
360 | u32 reg; | ||
361 | |||
348 | /* disable all IRQs */ | 362 | /* disable all IRQs */ |
349 | dwc3_omap_write_irqmisc_set(omap, 0x00); | 363 | reg = USBOTGSS_IRQO_COREIRQ_ST; |
350 | dwc3_omap_write_irq0_set(omap, 0x00); | 364 | dwc3_omap_write_irq0_clr(omap, reg); |
365 | |||
366 | reg = (USBOTGSS_IRQMISC_OEVT | | ||
367 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
368 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
369 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
370 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
371 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
372 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
373 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
374 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
375 | |||
376 | dwc3_omap_write_irqmisc_clr(omap, reg); | ||
351 | } | 377 | } |
352 | 378 | ||
353 | static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); | 379 | static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 75648145dc1b..c42765b3a060 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -1161,7 +1161,6 @@ static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc, | |||
1161 | if (desc->opts_mutex) | 1161 | if (desc->opts_mutex) |
1162 | mutex_lock(desc->opts_mutex); | 1162 | mutex_lock(desc->opts_mutex); |
1163 | memcpy(desc->ext_compat_id, page, l); | 1163 | memcpy(desc->ext_compat_id, page, l); |
1164 | desc->ext_compat_id[l] = '\0'; | ||
1165 | 1164 | ||
1166 | if (desc->opts_mutex) | 1165 | if (desc->opts_mutex) |
1167 | mutex_unlock(desc->opts_mutex); | 1166 | mutex_unlock(desc->opts_mutex); |
@@ -1192,7 +1191,6 @@ static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc, | |||
1192 | if (desc->opts_mutex) | 1191 | if (desc->opts_mutex) |
1193 | mutex_lock(desc->opts_mutex); | 1192 | mutex_lock(desc->opts_mutex); |
1194 | memcpy(desc->ext_compat_id + 8, page, l); | 1193 | memcpy(desc->ext_compat_id + 8, page, l); |
1195 | desc->ext_compat_id[l + 8] = '\0'; | ||
1196 | 1194 | ||
1197 | if (desc->opts_mutex) | 1195 | if (desc->opts_mutex) |
1198 | mutex_unlock(desc->opts_mutex); | 1196 | mutex_unlock(desc->opts_mutex); |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 426d69a9c018..a2612fb79eff 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -569,7 +569,7 @@ fail: | |||
569 | return status; | 569 | return status; |
570 | } | 570 | } |
571 | 571 | ||
572 | const struct file_operations f_hidg_fops = { | 572 | static const struct file_operations f_hidg_fops = { |
573 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
574 | .open = f_hidg_open, | 574 | .open = f_hidg_open, |
575 | .release = f_hidg_release, | 575 | .release = f_hidg_release, |
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index c89e96cfa3e4..c0c3ef272714 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c | |||
@@ -417,7 +417,10 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
417 | return -EINVAL; | 417 | return -EINVAL; |
418 | 418 | ||
419 | spin_lock(&port->lock); | 419 | spin_lock(&port->lock); |
420 | __pn_reset(f); | 420 | |
421 | if (fp->in_ep->driver_data) | ||
422 | __pn_reset(f); | ||
423 | |||
421 | if (alt == 1) { | 424 | if (alt == 1) { |
422 | int i; | 425 | int i; |
423 | 426 | ||
diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c index e07c50ced64d..e3dae47baef3 100644 --- a/drivers/usb/gadget/function/f_sourcesink.c +++ b/drivers/usb/gadget/function/f_sourcesink.c | |||
@@ -344,7 +344,7 @@ static struct usb_endpoint_descriptor ss_int_source_desc = { | |||
344 | .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), | 344 | .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), |
345 | }; | 345 | }; |
346 | 346 | ||
347 | struct usb_ss_ep_comp_descriptor ss_int_source_comp_desc = { | 347 | static struct usb_ss_ep_comp_descriptor ss_int_source_comp_desc = { |
348 | .bLength = USB_DT_SS_EP_COMP_SIZE, | 348 | .bLength = USB_DT_SS_EP_COMP_SIZE, |
349 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | 349 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, |
350 | 350 | ||
@@ -362,7 +362,7 @@ static struct usb_endpoint_descriptor ss_int_sink_desc = { | |||
362 | .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), | 362 | .bInterval = USB_MS_TO_SS_INTERVAL(GZERO_INT_INTERVAL), |
363 | }; | 363 | }; |
364 | 364 | ||
365 | struct usb_ss_ep_comp_descriptor ss_int_sink_comp_desc = { | 365 | static struct usb_ss_ep_comp_descriptor ss_int_sink_comp_desc = { |
366 | .bLength = USB_DT_SS_EP_COMP_SIZE, | 366 | .bLength = USB_DT_SS_EP_COMP_SIZE, |
367 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | 367 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, |
368 | 368 | ||
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 33e16658e5cf..6d3eb8b00a48 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #define UNFLW_CTRL 8 | 54 | #define UNFLW_CTRL 8 |
55 | #define OVFLW_CTRL 10 | 55 | #define OVFLW_CTRL 10 |
56 | 56 | ||
57 | const char *uac2_name = "snd_uac2"; | 57 | static const char *uac2_name = "snd_uac2"; |
58 | 58 | ||
59 | struct uac2_req { | 59 | struct uac2_req { |
60 | struct uac2_rtd_params *pp; /* parent param */ | 60 | struct uac2_rtd_params *pp; /* parent param */ |
@@ -634,7 +634,7 @@ static struct usb_interface_descriptor std_ac_if_desc = { | |||
634 | }; | 634 | }; |
635 | 635 | ||
636 | /* Clock source for IN traffic */ | 636 | /* Clock source for IN traffic */ |
637 | struct uac_clock_source_descriptor in_clk_src_desc = { | 637 | static struct uac_clock_source_descriptor in_clk_src_desc = { |
638 | .bLength = sizeof in_clk_src_desc, | 638 | .bLength = sizeof in_clk_src_desc, |
639 | .bDescriptorType = USB_DT_CS_INTERFACE, | 639 | .bDescriptorType = USB_DT_CS_INTERFACE, |
640 | 640 | ||
@@ -646,7 +646,7 @@ struct uac_clock_source_descriptor in_clk_src_desc = { | |||
646 | }; | 646 | }; |
647 | 647 | ||
648 | /* Clock source for OUT traffic */ | 648 | /* Clock source for OUT traffic */ |
649 | struct uac_clock_source_descriptor out_clk_src_desc = { | 649 | static struct uac_clock_source_descriptor out_clk_src_desc = { |
650 | .bLength = sizeof out_clk_src_desc, | 650 | .bLength = sizeof out_clk_src_desc, |
651 | .bDescriptorType = USB_DT_CS_INTERFACE, | 651 | .bDescriptorType = USB_DT_CS_INTERFACE, |
652 | 652 | ||
@@ -658,7 +658,7 @@ struct uac_clock_source_descriptor out_clk_src_desc = { | |||
658 | }; | 658 | }; |
659 | 659 | ||
660 | /* Input Terminal for USB_OUT */ | 660 | /* Input Terminal for USB_OUT */ |
661 | struct uac2_input_terminal_descriptor usb_out_it_desc = { | 661 | static struct uac2_input_terminal_descriptor usb_out_it_desc = { |
662 | .bLength = sizeof usb_out_it_desc, | 662 | .bLength = sizeof usb_out_it_desc, |
663 | .bDescriptorType = USB_DT_CS_INTERFACE, | 663 | .bDescriptorType = USB_DT_CS_INTERFACE, |
664 | 664 | ||
@@ -672,7 +672,7 @@ struct uac2_input_terminal_descriptor usb_out_it_desc = { | |||
672 | }; | 672 | }; |
673 | 673 | ||
674 | /* Input Terminal for I/O-In */ | 674 | /* Input Terminal for I/O-In */ |
675 | struct uac2_input_terminal_descriptor io_in_it_desc = { | 675 | static struct uac2_input_terminal_descriptor io_in_it_desc = { |
676 | .bLength = sizeof io_in_it_desc, | 676 | .bLength = sizeof io_in_it_desc, |
677 | .bDescriptorType = USB_DT_CS_INTERFACE, | 677 | .bDescriptorType = USB_DT_CS_INTERFACE, |
678 | 678 | ||
@@ -686,7 +686,7 @@ struct uac2_input_terminal_descriptor io_in_it_desc = { | |||
686 | }; | 686 | }; |
687 | 687 | ||
688 | /* Ouput Terminal for USB_IN */ | 688 | /* Ouput Terminal for USB_IN */ |
689 | struct uac2_output_terminal_descriptor usb_in_ot_desc = { | 689 | static struct uac2_output_terminal_descriptor usb_in_ot_desc = { |
690 | .bLength = sizeof usb_in_ot_desc, | 690 | .bLength = sizeof usb_in_ot_desc, |
691 | .bDescriptorType = USB_DT_CS_INTERFACE, | 691 | .bDescriptorType = USB_DT_CS_INTERFACE, |
692 | 692 | ||
@@ -700,7 +700,7 @@ struct uac2_output_terminal_descriptor usb_in_ot_desc = { | |||
700 | }; | 700 | }; |
701 | 701 | ||
702 | /* Ouput Terminal for I/O-Out */ | 702 | /* Ouput Terminal for I/O-Out */ |
703 | struct uac2_output_terminal_descriptor io_out_ot_desc = { | 703 | static struct uac2_output_terminal_descriptor io_out_ot_desc = { |
704 | .bLength = sizeof io_out_ot_desc, | 704 | .bLength = sizeof io_out_ot_desc, |
705 | .bDescriptorType = USB_DT_CS_INTERFACE, | 705 | .bDescriptorType = USB_DT_CS_INTERFACE, |
706 | 706 | ||
@@ -713,7 +713,7 @@ struct uac2_output_terminal_descriptor io_out_ot_desc = { | |||
713 | .bmControls = (CONTROL_RDWR << COPY_CTRL), | 713 | .bmControls = (CONTROL_RDWR << COPY_CTRL), |
714 | }; | 714 | }; |
715 | 715 | ||
716 | struct uac2_ac_header_descriptor ac_hdr_desc = { | 716 | static struct uac2_ac_header_descriptor ac_hdr_desc = { |
717 | .bLength = sizeof ac_hdr_desc, | 717 | .bLength = sizeof ac_hdr_desc, |
718 | .bDescriptorType = USB_DT_CS_INTERFACE, | 718 | .bDescriptorType = USB_DT_CS_INTERFACE, |
719 | 719 | ||
@@ -751,7 +751,7 @@ static struct usb_interface_descriptor std_as_out_if1_desc = { | |||
751 | }; | 751 | }; |
752 | 752 | ||
753 | /* Audio Stream OUT Intface Desc */ | 753 | /* Audio Stream OUT Intface Desc */ |
754 | struct uac2_as_header_descriptor as_out_hdr_desc = { | 754 | static struct uac2_as_header_descriptor as_out_hdr_desc = { |
755 | .bLength = sizeof as_out_hdr_desc, | 755 | .bLength = sizeof as_out_hdr_desc, |
756 | .bDescriptorType = USB_DT_CS_INTERFACE, | 756 | .bDescriptorType = USB_DT_CS_INTERFACE, |
757 | 757 | ||
@@ -764,7 +764,7 @@ struct uac2_as_header_descriptor as_out_hdr_desc = { | |||
764 | }; | 764 | }; |
765 | 765 | ||
766 | /* Audio USB_OUT Format */ | 766 | /* Audio USB_OUT Format */ |
767 | struct uac2_format_type_i_descriptor as_out_fmt1_desc = { | 767 | static struct uac2_format_type_i_descriptor as_out_fmt1_desc = { |
768 | .bLength = sizeof as_out_fmt1_desc, | 768 | .bLength = sizeof as_out_fmt1_desc, |
769 | .bDescriptorType = USB_DT_CS_INTERFACE, | 769 | .bDescriptorType = USB_DT_CS_INTERFACE, |
770 | .bDescriptorSubtype = UAC_FORMAT_TYPE, | 770 | .bDescriptorSubtype = UAC_FORMAT_TYPE, |
@@ -772,7 +772,7 @@ struct uac2_format_type_i_descriptor as_out_fmt1_desc = { | |||
772 | }; | 772 | }; |
773 | 773 | ||
774 | /* STD AS ISO OUT Endpoint */ | 774 | /* STD AS ISO OUT Endpoint */ |
775 | struct usb_endpoint_descriptor fs_epout_desc = { | 775 | static struct usb_endpoint_descriptor fs_epout_desc = { |
776 | .bLength = USB_DT_ENDPOINT_SIZE, | 776 | .bLength = USB_DT_ENDPOINT_SIZE, |
777 | .bDescriptorType = USB_DT_ENDPOINT, | 777 | .bDescriptorType = USB_DT_ENDPOINT, |
778 | 778 | ||
@@ -782,7 +782,7 @@ struct usb_endpoint_descriptor fs_epout_desc = { | |||
782 | .bInterval = 1, | 782 | .bInterval = 1, |
783 | }; | 783 | }; |
784 | 784 | ||
785 | struct usb_endpoint_descriptor hs_epout_desc = { | 785 | static struct usb_endpoint_descriptor hs_epout_desc = { |
786 | .bLength = USB_DT_ENDPOINT_SIZE, | 786 | .bLength = USB_DT_ENDPOINT_SIZE, |
787 | .bDescriptorType = USB_DT_ENDPOINT, | 787 | .bDescriptorType = USB_DT_ENDPOINT, |
788 | 788 | ||
@@ -828,7 +828,7 @@ static struct usb_interface_descriptor std_as_in_if1_desc = { | |||
828 | }; | 828 | }; |
829 | 829 | ||
830 | /* Audio Stream IN Intface Desc */ | 830 | /* Audio Stream IN Intface Desc */ |
831 | struct uac2_as_header_descriptor as_in_hdr_desc = { | 831 | static struct uac2_as_header_descriptor as_in_hdr_desc = { |
832 | .bLength = sizeof as_in_hdr_desc, | 832 | .bLength = sizeof as_in_hdr_desc, |
833 | .bDescriptorType = USB_DT_CS_INTERFACE, | 833 | .bDescriptorType = USB_DT_CS_INTERFACE, |
834 | 834 | ||
@@ -841,7 +841,7 @@ struct uac2_as_header_descriptor as_in_hdr_desc = { | |||
841 | }; | 841 | }; |
842 | 842 | ||
843 | /* Audio USB_IN Format */ | 843 | /* Audio USB_IN Format */ |
844 | struct uac2_format_type_i_descriptor as_in_fmt1_desc = { | 844 | static struct uac2_format_type_i_descriptor as_in_fmt1_desc = { |
845 | .bLength = sizeof as_in_fmt1_desc, | 845 | .bLength = sizeof as_in_fmt1_desc, |
846 | .bDescriptorType = USB_DT_CS_INTERFACE, | 846 | .bDescriptorType = USB_DT_CS_INTERFACE, |
847 | .bDescriptorSubtype = UAC_FORMAT_TYPE, | 847 | .bDescriptorSubtype = UAC_FORMAT_TYPE, |
@@ -849,7 +849,7 @@ struct uac2_format_type_i_descriptor as_in_fmt1_desc = { | |||
849 | }; | 849 | }; |
850 | 850 | ||
851 | /* STD AS ISO IN Endpoint */ | 851 | /* STD AS ISO IN Endpoint */ |
852 | struct usb_endpoint_descriptor fs_epin_desc = { | 852 | static struct usb_endpoint_descriptor fs_epin_desc = { |
853 | .bLength = USB_DT_ENDPOINT_SIZE, | 853 | .bLength = USB_DT_ENDPOINT_SIZE, |
854 | .bDescriptorType = USB_DT_ENDPOINT, | 854 | .bDescriptorType = USB_DT_ENDPOINT, |
855 | 855 | ||
@@ -859,7 +859,7 @@ struct usb_endpoint_descriptor fs_epin_desc = { | |||
859 | .bInterval = 1, | 859 | .bInterval = 1, |
860 | }; | 860 | }; |
861 | 861 | ||
862 | struct usb_endpoint_descriptor hs_epin_desc = { | 862 | static struct usb_endpoint_descriptor hs_epin_desc = { |
863 | .bLength = USB_DT_ENDPOINT_SIZE, | 863 | .bLength = USB_DT_ENDPOINT_SIZE, |
864 | .bDescriptorType = USB_DT_ENDPOINT, | 864 | .bDescriptorType = USB_DT_ENDPOINT, |
865 | 865 | ||
@@ -1563,7 +1563,7 @@ static void afunc_unbind(struct usb_configuration *c, struct usb_function *f) | |||
1563 | agdev->out_ep->driver_data = NULL; | 1563 | agdev->out_ep->driver_data = NULL; |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | struct usb_function *afunc_alloc(struct usb_function_instance *fi) | 1566 | static struct usb_function *afunc_alloc(struct usb_function_instance *fi) |
1567 | { | 1567 | { |
1568 | struct audio_dev *agdev; | 1568 | struct audio_dev *agdev; |
1569 | struct f_uac2_opts *opts; | 1569 | struct f_uac2_opts *opts; |
diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index 5aad7fededa5..8b818fd027b3 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "uvc.h" | 27 | #include "uvc.h" |
28 | #include "uvc_queue.h" | 28 | #include "uvc_queue.h" |
29 | #include "uvc_video.h" | 29 | #include "uvc_video.h" |
30 | #include "uvc_v4l2.h" | ||
30 | 31 | ||
31 | /* -------------------------------------------------------------------------- | 32 | /* -------------------------------------------------------------------------- |
32 | * Requests handling | 33 | * Requests handling |
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index 9cb86bc1a9a5..50a5e637ca35 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "uvc.h" | 22 | #include "uvc.h" |
23 | #include "uvc_queue.h" | 23 | #include "uvc_queue.h" |
24 | #include "uvc_video.h" | ||
24 | 25 | ||
25 | /* -------------------------------------------------------------------------- | 26 | /* -------------------------------------------------------------------------- |
26 | * Video codecs | 27 | * Video codecs |
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c index 06acfa55864a..b01b88e1b716 100644 --- a/drivers/usb/gadget/legacy/g_ffs.c +++ b/drivers/usb/gadget/legacy/g_ffs.c | |||
@@ -133,7 +133,9 @@ struct gfs_configuration { | |||
133 | struct usb_configuration c; | 133 | struct usb_configuration c; |
134 | int (*eth)(struct usb_configuration *c); | 134 | int (*eth)(struct usb_configuration *c); |
135 | int num; | 135 | int num; |
136 | } gfs_configurations[] = { | 136 | }; |
137 | |||
138 | static struct gfs_configuration gfs_configurations[] = { | ||
137 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS | 139 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
138 | { | 140 | { |
139 | .eth = bind_rndis_config, | 141 | .eth = bind_rndis_config, |
@@ -278,7 +280,7 @@ static void *functionfs_acquire_dev(struct ffs_dev *dev) | |||
278 | if (!try_module_get(THIS_MODULE)) | 280 | if (!try_module_get(THIS_MODULE)) |
279 | return ERR_PTR(-ENOENT); | 281 | return ERR_PTR(-ENOENT); |
280 | 282 | ||
281 | return 0; | 283 | return NULL; |
282 | } | 284 | } |
283 | 285 | ||
284 | static void functionfs_release_dev(struct ffs_dev *dev) | 286 | static void functionfs_release_dev(struct ffs_dev *dev) |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 7f76c8a12f89..fd53c9ebd662 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -37,6 +37,9 @@ | |||
37 | 37 | ||
38 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 | 38 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 |
39 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 | 39 | #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 |
40 | #define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 | ||
41 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f | ||
42 | #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f | ||
40 | 43 | ||
41 | static const char hcd_name[] = "xhci_hcd"; | 44 | static const char hcd_name[] = "xhci_hcd"; |
42 | 45 | ||
@@ -133,6 +136,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
133 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { | 136 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { |
134 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 137 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
135 | } | 138 | } |
139 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
140 | (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || | ||
141 | pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || | ||
142 | pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI)) { | ||
143 | xhci->quirks |= XHCI_PME_STUCK_QUIRK; | ||
144 | } | ||
136 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | 145 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
137 | pdev->device == PCI_DEVICE_ID_EJ168) { | 146 | pdev->device == PCI_DEVICE_ID_EJ168) { |
138 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 147 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
@@ -159,6 +168,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
159 | "QUIRK: Resetting on resume"); | 168 | "QUIRK: Resetting on resume"); |
160 | } | 169 | } |
161 | 170 | ||
171 | /* | ||
172 | * Make sure PME works on some Intel xHCI controllers by writing 1 to clear | ||
173 | * the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 | ||
174 | */ | ||
175 | static void xhci_pme_quirk(struct xhci_hcd *xhci) | ||
176 | { | ||
177 | u32 val; | ||
178 | void __iomem *reg; | ||
179 | |||
180 | reg = (void __iomem *) xhci->cap_regs + 0x80a4; | ||
181 | val = readl(reg); | ||
182 | writel(val | BIT(28), reg); | ||
183 | readl(reg); | ||
184 | } | ||
185 | |||
162 | /* called during probe() after chip reset completes */ | 186 | /* called during probe() after chip reset completes */ |
163 | static int xhci_pci_setup(struct usb_hcd *hcd) | 187 | static int xhci_pci_setup(struct usb_hcd *hcd) |
164 | { | 188 | { |
@@ -283,6 +307,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
283 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | 307 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
284 | pdev->no_d3cold = true; | 308 | pdev->no_d3cold = true; |
285 | 309 | ||
310 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | ||
311 | xhci_pme_quirk(xhci); | ||
312 | |||
286 | return xhci_suspend(xhci, do_wakeup); | 313 | return xhci_suspend(xhci, do_wakeup); |
287 | } | 314 | } |
288 | 315 | ||
@@ -313,6 +340,9 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | |||
313 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) | 340 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) |
314 | usb_enable_intel_xhci_ports(pdev); | 341 | usb_enable_intel_xhci_ports(pdev); |
315 | 342 | ||
343 | if (xhci->quirks & XHCI_PME_STUCK_QUIRK) | ||
344 | xhci_pme_quirk(xhci); | ||
345 | |||
316 | retval = xhci_resume(xhci, hibernated); | 346 | retval = xhci_resume(xhci, hibernated); |
317 | return retval; | 347 | return retval; |
318 | } | 348 | } |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 08d402b15482..0e11d61408ff 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -83,16 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
83 | if (irq < 0) | 83 | if (irq < 0) |
84 | return -ENODEV; | 84 | return -ENODEV; |
85 | 85 | ||
86 | |||
87 | if (of_device_is_compatible(pdev->dev.of_node, | ||
88 | "marvell,armada-375-xhci") || | ||
89 | of_device_is_compatible(pdev->dev.of_node, | ||
90 | "marvell,armada-380-xhci")) { | ||
91 | ret = xhci_mvebu_mbus_init_quirk(pdev); | ||
92 | if (ret) | ||
93 | return ret; | ||
94 | } | ||
95 | |||
96 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ | 86 | /* Initialize dma_mask and coherent_dma_mask to 32-bits */ |
97 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | 87 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
98 | if (ret) | 88 | if (ret) |
@@ -127,6 +117,15 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
127 | goto put_hcd; | 117 | goto put_hcd; |
128 | } | 118 | } |
129 | 119 | ||
120 | if (of_device_is_compatible(pdev->dev.of_node, | ||
121 | "marvell,armada-375-xhci") || | ||
122 | of_device_is_compatible(pdev->dev.of_node, | ||
123 | "marvell,armada-380-xhci")) { | ||
124 | ret = xhci_mvebu_mbus_init_quirk(pdev); | ||
125 | if (ret) | ||
126 | goto disable_clk; | ||
127 | } | ||
128 | |||
130 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 129 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); |
131 | if (ret) | 130 | if (ret) |
132 | goto disable_clk; | 131 | goto disable_clk; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 88da8d629820..5fb66db89e05 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1729,7 +1729,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, | |||
1729 | if (!command) | 1729 | if (!command) |
1730 | return; | 1730 | return; |
1731 | 1731 | ||
1732 | ep->ep_state |= EP_HALTED; | 1732 | ep->ep_state |= EP_HALTED | EP_RECENTLY_HALTED; |
1733 | ep->stopped_stream = stream_id; | 1733 | ep->stopped_stream = stream_id; |
1734 | 1734 | ||
1735 | xhci_queue_reset_ep(xhci, command, slot_id, ep_index); | 1735 | xhci_queue_reset_ep(xhci, command, slot_id, ep_index); |
@@ -1946,7 +1946,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1946 | if (event_trb != ep_ring->dequeue) { | 1946 | if (event_trb != ep_ring->dequeue) { |
1947 | /* The event was for the status stage */ | 1947 | /* The event was for the status stage */ |
1948 | if (event_trb == td->last_trb) { | 1948 | if (event_trb == td->last_trb) { |
1949 | if (td->urb->actual_length != 0) { | 1949 | if (td->urb_length_set) { |
1950 | /* Don't overwrite a previously set error code | 1950 | /* Don't overwrite a previously set error code |
1951 | */ | 1951 | */ |
1952 | if ((*status == -EINPROGRESS || *status == 0) && | 1952 | if ((*status == -EINPROGRESS || *status == 0) && |
@@ -1960,7 +1960,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1960 | td->urb->transfer_buffer_length; | 1960 | td->urb->transfer_buffer_length; |
1961 | } | 1961 | } |
1962 | } else { | 1962 | } else { |
1963 | /* Maybe the event was for the data stage? */ | 1963 | /* |
1964 | * Maybe the event was for the data stage? If so, update | ||
1965 | * already the actual_length of the URB and flag it as | ||
1966 | * set, so that it is not overwritten in the event for | ||
1967 | * the last TRB. | ||
1968 | */ | ||
1969 | td->urb_length_set = true; | ||
1964 | td->urb->actual_length = | 1970 | td->urb->actual_length = |
1965 | td->urb->transfer_buffer_length - | 1971 | td->urb->transfer_buffer_length - |
1966 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); | 1972 | EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ec8ac1674854..b06d1a53652d 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1338,6 +1338,12 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | |||
1338 | goto exit; | 1338 | goto exit; |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | /* Reject urb if endpoint is in soft reset, queue must stay empty */ | ||
1342 | if (xhci->devs[slot_id]->eps[ep_index].ep_state & EP_CONFIG_PENDING) { | ||
1343 | xhci_warn(xhci, "Can't enqueue URB while ep is in soft reset\n"); | ||
1344 | ret = -EINVAL; | ||
1345 | } | ||
1346 | |||
1341 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) | 1347 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) |
1342 | size = urb->number_of_packets; | 1348 | size = urb->number_of_packets; |
1343 | else | 1349 | else |
@@ -2948,23 +2954,36 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2948 | } | 2954 | } |
2949 | } | 2955 | } |
2950 | 2956 | ||
2951 | /* Called when clearing halted device. The core should have sent the control | 2957 | /* Called after clearing a halted device. USB core should have sent the control |
2952 | * message to clear the device halt condition. The host side of the halt should | 2958 | * message to clear the device halt condition. The host side of the halt should |
2953 | * already be cleared with a reset endpoint command issued when the STALL tx | 2959 | * already be cleared with a reset endpoint command issued immediately when the |
2954 | * event was received. | 2960 | * STALL tx event was received. |
2955 | * | ||
2956 | * Context: in_interrupt | ||
2957 | */ | 2961 | */ |
2958 | 2962 | ||
2959 | void xhci_endpoint_reset(struct usb_hcd *hcd, | 2963 | void xhci_endpoint_reset(struct usb_hcd *hcd, |
2960 | struct usb_host_endpoint *ep) | 2964 | struct usb_host_endpoint *ep) |
2961 | { | 2965 | { |
2962 | struct xhci_hcd *xhci; | 2966 | struct xhci_hcd *xhci; |
2967 | struct usb_device *udev; | ||
2968 | struct xhci_virt_device *virt_dev; | ||
2969 | struct xhci_virt_ep *virt_ep; | ||
2970 | struct xhci_input_control_ctx *ctrl_ctx; | ||
2971 | struct xhci_command *command; | ||
2972 | unsigned int ep_index, ep_state; | ||
2973 | unsigned long flags; | ||
2974 | u32 ep_flag; | ||
2963 | 2975 | ||
2964 | xhci = hcd_to_xhci(hcd); | 2976 | xhci = hcd_to_xhci(hcd); |
2977 | udev = (struct usb_device *) ep->hcpriv; | ||
2978 | if (!ep->hcpriv) | ||
2979 | return; | ||
2980 | virt_dev = xhci->devs[udev->slot_id]; | ||
2981 | ep_index = xhci_get_endpoint_index(&ep->desc); | ||
2982 | virt_ep = &virt_dev->eps[ep_index]; | ||
2983 | ep_state = virt_ep->ep_state; | ||
2965 | 2984 | ||
2966 | /* | 2985 | /* |
2967 | * We might need to implement the config ep cmd in xhci 4.8.1 note: | 2986 | * Implement the config ep command in xhci 4.6.8 additional note: |
2968 | * The Reset Endpoint Command may only be issued to endpoints in the | 2987 | * The Reset Endpoint Command may only be issued to endpoints in the |
2969 | * Halted state. If software wishes reset the Data Toggle or Sequence | 2988 | * Halted state. If software wishes reset the Data Toggle or Sequence |
2970 | * Number of an endpoint that isn't in the Halted state, then software | 2989 | * Number of an endpoint that isn't in the Halted state, then software |
@@ -2972,9 +2991,72 @@ void xhci_endpoint_reset(struct usb_hcd *hcd, | |||
2972 | * for the target endpoint. that is in the Stopped state. | 2991 | * for the target endpoint. that is in the Stopped state. |
2973 | */ | 2992 | */ |
2974 | 2993 | ||
2975 | /* For now just print debug to follow the situation */ | 2994 | if (ep_state & SET_DEQ_PENDING || ep_state & EP_RECENTLY_HALTED) { |
2976 | xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", | 2995 | virt_ep->ep_state &= ~EP_RECENTLY_HALTED; |
2977 | ep->desc.bEndpointAddress); | 2996 | xhci_dbg(xhci, "ep recently halted, no toggle reset needed\n"); |
2997 | return; | ||
2998 | } | ||
2999 | |||
3000 | /* Only interrupt and bulk ep's use Data toggle, USB2 spec 5.5.4-> */ | ||
3001 | if (usb_endpoint_xfer_control(&ep->desc) || | ||
3002 | usb_endpoint_xfer_isoc(&ep->desc)) | ||
3003 | return; | ||
3004 | |||
3005 | ep_flag = xhci_get_endpoint_flag(&ep->desc); | ||
3006 | |||
3007 | if (ep_flag == SLOT_FLAG || ep_flag == EP0_FLAG) | ||
3008 | return; | ||
3009 | |||
3010 | command = xhci_alloc_command(xhci, true, true, GFP_NOWAIT); | ||
3011 | if (!command) { | ||
3012 | xhci_err(xhci, "Could not allocate xHCI command structure.\n"); | ||
3013 | return; | ||
3014 | } | ||
3015 | |||
3016 | spin_lock_irqsave(&xhci->lock, flags); | ||
3017 | |||
3018 | /* block ringing ep doorbell */ | ||
3019 | virt_ep->ep_state |= EP_CONFIG_PENDING; | ||
3020 | |||
3021 | /* | ||
3022 | * Make sure endpoint ring is empty before resetting the toggle/seq. | ||
3023 | * Driver is required to synchronously cancel all transfer request. | ||
3024 | * | ||
3025 | * xhci 4.6.6 says we can issue a configure endpoint command on a | ||
3026 | * running endpoint ring as long as it's idle (queue empty) | ||
3027 | */ | ||
3028 | |||
3029 | if (!list_empty(&virt_ep->ring->td_list)) { | ||
3030 | dev_err(&udev->dev, "EP not empty, refuse reset\n"); | ||
3031 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
3032 | goto cleanup; | ||
3033 | } | ||
3034 | |||
3035 | xhci_dbg(xhci, "Reset toggle/seq for slot %d, ep_index: %d\n", | ||
3036 | udev->slot_id, ep_index); | ||
3037 | |||
3038 | ctrl_ctx = xhci_get_input_control_ctx(command->in_ctx); | ||
3039 | if (!ctrl_ctx) { | ||
3040 | xhci_err(xhci, "Could not get input context, bad type. virt_dev: %p, in_ctx %p\n", | ||
3041 | virt_dev, virt_dev->in_ctx); | ||
3042 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
3043 | goto cleanup; | ||
3044 | } | ||
3045 | xhci_setup_input_ctx_for_config_ep(xhci, command->in_ctx, | ||
3046 | virt_dev->out_ctx, ctrl_ctx, | ||
3047 | ep_flag, ep_flag); | ||
3048 | xhci_endpoint_copy(xhci, command->in_ctx, virt_dev->out_ctx, ep_index); | ||
3049 | |||
3050 | xhci_queue_configure_endpoint(xhci, command, command->in_ctx->dma, | ||
3051 | udev->slot_id, false); | ||
3052 | xhci_ring_cmd_db(xhci); | ||
3053 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
3054 | |||
3055 | wait_for_completion(command->completion); | ||
3056 | |||
3057 | cleanup: | ||
3058 | virt_ep->ep_state &= ~EP_CONFIG_PENDING; | ||
3059 | xhci_free_command(xhci, command); | ||
2978 | } | 3060 | } |
2979 | 3061 | ||
2980 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, | 3062 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 974514762a14..265ab1771d24 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * xHCI host controller driver | 3 | * xHCI host controller driver |
3 | * | 4 | * |
@@ -88,9 +89,10 @@ struct xhci_cap_regs { | |||
88 | #define HCS_IST(p) (((p) >> 0) & 0xf) | 89 | #define HCS_IST(p) (((p) >> 0) & 0xf) |
89 | /* bits 4:7, max number of Event Ring segments */ | 90 | /* bits 4:7, max number of Event Ring segments */ |
90 | #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) | 91 | #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) |
92 | /* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ | ||
91 | /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ | 93 | /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ |
92 | /* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ | 94 | /* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ |
93 | #define HCS_MAX_SCRATCHPAD(p) (((p) >> 27) & 0x1f) | 95 | #define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f)) |
94 | 96 | ||
95 | /* HCSPARAMS3 - hcs_params3 - bitmasks */ | 97 | /* HCSPARAMS3 - hcs_params3 - bitmasks */ |
96 | /* bits 0:7, Max U1 to U0 latency for the roothub ports */ | 98 | /* bits 0:7, Max U1 to U0 latency for the roothub ports */ |
@@ -863,6 +865,8 @@ struct xhci_virt_ep { | |||
863 | #define EP_HAS_STREAMS (1 << 4) | 865 | #define EP_HAS_STREAMS (1 << 4) |
864 | /* Transitioning the endpoint to not using streams, don't enqueue URBs */ | 866 | /* Transitioning the endpoint to not using streams, don't enqueue URBs */ |
865 | #define EP_GETTING_NO_STREAMS (1 << 5) | 867 | #define EP_GETTING_NO_STREAMS (1 << 5) |
868 | #define EP_RECENTLY_HALTED (1 << 6) | ||
869 | #define EP_CONFIG_PENDING (1 << 7) | ||
866 | /* ---- Related to URB cancellation ---- */ | 870 | /* ---- Related to URB cancellation ---- */ |
867 | struct list_head cancelled_td_list; | 871 | struct list_head cancelled_td_list; |
868 | struct xhci_td *stopped_td; | 872 | struct xhci_td *stopped_td; |
@@ -1288,6 +1292,8 @@ struct xhci_td { | |||
1288 | struct xhci_segment *start_seg; | 1292 | struct xhci_segment *start_seg; |
1289 | union xhci_trb *first_trb; | 1293 | union xhci_trb *first_trb; |
1290 | union xhci_trb *last_trb; | 1294 | union xhci_trb *last_trb; |
1295 | /* actual_length of the URB has already been set */ | ||
1296 | bool urb_length_set; | ||
1291 | }; | 1297 | }; |
1292 | 1298 | ||
1293 | /* xHCI command default timeout value */ | 1299 | /* xHCI command default timeout value */ |
@@ -1560,6 +1566,7 @@ struct xhci_hcd { | |||
1560 | #define XHCI_SPURIOUS_WAKEUP (1 << 18) | 1566 | #define XHCI_SPURIOUS_WAKEUP (1 << 18) |
1561 | /* For controllers with a broken beyond repair streams implementation */ | 1567 | /* For controllers with a broken beyond repair streams implementation */ |
1562 | #define XHCI_BROKEN_STREAMS (1 << 19) | 1568 | #define XHCI_BROKEN_STREAMS (1 << 19) |
1569 | #define XHCI_PME_STUCK_QUIRK (1 << 20) | ||
1563 | unsigned int num_active_eps; | 1570 | unsigned int num_active_eps; |
1564 | unsigned int limit_active_eps; | 1571 | unsigned int limit_active_eps; |
1565 | /* There are two roothubs to keep track of bus suspend info for */ | 1572 | /* There are two roothubs to keep track of bus suspend info for */ |
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index eba9b82e2d70..3cb98b1d5d29 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c | |||
@@ -1274,7 +1274,7 @@ static void errata2_function(unsigned long data) | |||
1274 | for (slot = 0; slot < 32; slot++) | 1274 | for (slot = 0; slot < 32; slot++) |
1275 | if (priv->atl_slots[slot].qh && time_after(jiffies, | 1275 | if (priv->atl_slots[slot].qh && time_after(jiffies, |
1276 | priv->atl_slots[slot].timestamp + | 1276 | priv->atl_slots[slot].timestamp + |
1277 | SLOT_TIMEOUT * HZ / 1000)) { | 1277 | msecs_to_jiffies(SLOT_TIMEOUT))) { |
1278 | ptd_read(hcd->regs, ATL_PTD_OFFSET, slot, &ptd); | 1278 | ptd_read(hcd->regs, ATL_PTD_OFFSET, slot, &ptd); |
1279 | if (!FROM_DW0_VALID(ptd.dw0) && | 1279 | if (!FROM_DW0_VALID(ptd.dw0) && |
1280 | !FROM_DW3_ACTIVE(ptd.dw3)) | 1280 | !FROM_DW3_ACTIVE(ptd.dw3)) |
@@ -1286,7 +1286,7 @@ static void errata2_function(unsigned long data) | |||
1286 | 1286 | ||
1287 | spin_unlock_irqrestore(&priv->lock, spinflags); | 1287 | spin_unlock_irqrestore(&priv->lock, spinflags); |
1288 | 1288 | ||
1289 | errata2_timer.expires = jiffies + SLOT_CHECK_PERIOD * HZ / 1000; | 1289 | errata2_timer.expires = jiffies + msecs_to_jiffies(SLOT_CHECK_PERIOD); |
1290 | add_timer(&errata2_timer); | 1290 | add_timer(&errata2_timer); |
1291 | } | 1291 | } |
1292 | 1292 | ||
@@ -1336,7 +1336,7 @@ static int isp1760_run(struct usb_hcd *hcd) | |||
1336 | return retval; | 1336 | return retval; |
1337 | 1337 | ||
1338 | setup_timer(&errata2_timer, errata2_function, (unsigned long)hcd); | 1338 | setup_timer(&errata2_timer, errata2_function, (unsigned long)hcd); |
1339 | errata2_timer.expires = jiffies + SLOT_CHECK_PERIOD * HZ / 1000; | 1339 | errata2_timer.expires = jiffies + msecs_to_jiffies(SLOT_CHECK_PERIOD); |
1340 | add_timer(&errata2_timer); | 1340 | add_timer(&errata2_timer); |
1341 | 1341 | ||
1342 | chipid = reg_read32(hcd->regs, HC_CHIP_ID_REG); | 1342 | chipid = reg_read32(hcd->regs, HC_CHIP_ID_REG); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e6f4cbfeed97..067920f2d570 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1969,10 +1969,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1969 | goto fail0; | 1969 | goto fail0; |
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | pm_runtime_use_autosuspend(musb->controller); | ||
1973 | pm_runtime_set_autosuspend_delay(musb->controller, 200); | ||
1974 | pm_runtime_enable(musb->controller); | ||
1975 | |||
1976 | spin_lock_init(&musb->lock); | 1972 | spin_lock_init(&musb->lock); |
1977 | musb->board_set_power = plat->set_power; | 1973 | musb->board_set_power = plat->set_power; |
1978 | musb->min_power = plat->min_power; | 1974 | musb->min_power = plat->min_power; |
@@ -1991,6 +1987,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1991 | musb_readl = musb_default_readl; | 1987 | musb_readl = musb_default_readl; |
1992 | musb_writel = musb_default_writel; | 1988 | musb_writel = musb_default_writel; |
1993 | 1989 | ||
1990 | /* We need musb_read/write functions initialized for PM */ | ||
1991 | pm_runtime_use_autosuspend(musb->controller); | ||
1992 | pm_runtime_set_autosuspend_delay(musb->controller, 200); | ||
1993 | pm_runtime_irq_safe(musb->controller); | ||
1994 | pm_runtime_enable(musb->controller); | ||
1995 | |||
1994 | /* The musb_platform_init() call: | 1996 | /* The musb_platform_init() call: |
1995 | * - adjusts musb->mregs | 1997 | * - adjusts musb->mregs |
1996 | * - sets the musb->isr | 1998 | * - sets the musb->isr |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 53bd0e71d19f..a900c9877195 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -457,12 +457,27 @@ static int dsps_musb_init(struct musb *musb) | |||
457 | if (IS_ERR(musb->xceiv)) | 457 | if (IS_ERR(musb->xceiv)) |
458 | return PTR_ERR(musb->xceiv); | 458 | return PTR_ERR(musb->xceiv); |
459 | 459 | ||
460 | musb->phy = devm_phy_get(dev->parent, "usb2-phy"); | ||
461 | |||
460 | /* Returns zero if e.g. not clocked */ | 462 | /* Returns zero if e.g. not clocked */ |
461 | rev = dsps_readl(reg_base, wrp->revision); | 463 | rev = dsps_readl(reg_base, wrp->revision); |
462 | if (!rev) | 464 | if (!rev) |
463 | return -ENODEV; | 465 | return -ENODEV; |
464 | 466 | ||
465 | usb_phy_init(musb->xceiv); | 467 | usb_phy_init(musb->xceiv); |
468 | if (IS_ERR(musb->phy)) { | ||
469 | musb->phy = NULL; | ||
470 | } else { | ||
471 | ret = phy_init(musb->phy); | ||
472 | if (ret < 0) | ||
473 | return ret; | ||
474 | ret = phy_power_on(musb->phy); | ||
475 | if (ret) { | ||
476 | phy_exit(musb->phy); | ||
477 | return ret; | ||
478 | } | ||
479 | } | ||
480 | |||
466 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); | 481 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); |
467 | 482 | ||
468 | /* Reset the musb */ | 483 | /* Reset the musb */ |
@@ -502,6 +517,8 @@ static int dsps_musb_exit(struct musb *musb) | |||
502 | 517 | ||
503 | del_timer_sync(&glue->timer); | 518 | del_timer_sync(&glue->timer); |
504 | usb_phy_shutdown(musb->xceiv); | 519 | usb_phy_shutdown(musb->xceiv); |
520 | phy_power_off(musb->phy); | ||
521 | phy_exit(musb->phy); | ||
505 | debugfs_remove_recursive(glue->dbgfs_root); | 522 | debugfs_remove_recursive(glue->dbgfs_root); |
506 | 523 | ||
507 | return 0; | 524 | return 0; |
@@ -610,7 +627,7 @@ static int dsps_musb_reset(struct musb *musb) | |||
610 | struct device *dev = musb->controller; | 627 | struct device *dev = musb->controller; |
611 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 628 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
612 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 629 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
613 | int session_restart = 0; | 630 | int session_restart = 0, error; |
614 | 631 | ||
615 | if (glue->sw_babble_enabled) | 632 | if (glue->sw_babble_enabled) |
616 | session_restart = sw_babble_control(musb); | 633 | session_restart = sw_babble_control(musb); |
@@ -624,8 +641,14 @@ static int dsps_musb_reset(struct musb *musb) | |||
624 | dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset)); | 641 | dsps_writel(musb->ctrl_base, wrp->control, (1 << wrp->reset)); |
625 | usleep_range(100, 200); | 642 | usleep_range(100, 200); |
626 | usb_phy_shutdown(musb->xceiv); | 643 | usb_phy_shutdown(musb->xceiv); |
644 | error = phy_power_off(musb->phy); | ||
645 | if (error) | ||
646 | dev_err(dev, "phy shutdown failed: %i\n", error); | ||
627 | usleep_range(100, 200); | 647 | usleep_range(100, 200); |
628 | usb_phy_init(musb->xceiv); | 648 | usb_phy_init(musb->xceiv); |
649 | error = phy_power_on(musb->phy); | ||
650 | if (error) | ||
651 | dev_err(dev, "phy powerup failed: %i\n", error); | ||
629 | session_restart = 1; | 652 | session_restart = 1; |
630 | } | 653 | } |
631 | 654 | ||
@@ -687,7 +710,7 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, | |||
687 | struct musb_hdrc_config *config; | 710 | struct musb_hdrc_config *config; |
688 | struct platform_device *musb; | 711 | struct platform_device *musb; |
689 | struct device_node *dn = parent->dev.of_node; | 712 | struct device_node *dn = parent->dev.of_node; |
690 | int ret; | 713 | int ret, val; |
691 | 714 | ||
692 | memset(resources, 0, sizeof(resources)); | 715 | memset(resources, 0, sizeof(resources)); |
693 | res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc"); | 716 | res = platform_get_resource_byname(parent, IORESOURCE_MEM, "mc"); |
@@ -739,7 +762,10 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, | |||
739 | pdata.mode = get_musb_port_mode(dev); | 762 | pdata.mode = get_musb_port_mode(dev); |
740 | /* DT keeps this entry in mA, musb expects it as per USB spec */ | 763 | /* DT keeps this entry in mA, musb expects it as per USB spec */ |
741 | pdata.power = get_int_prop(dn, "mentor,power") / 2; | 764 | pdata.power = get_int_prop(dn, "mentor,power") / 2; |
742 | config->multipoint = of_property_read_bool(dn, "mentor,multipoint"); | 765 | |
766 | ret = of_property_read_u32(dn, "mentor,multipoint", &val); | ||
767 | if (!ret && val) | ||
768 | config->multipoint = true; | ||
743 | 769 | ||
744 | ret = platform_device_add_data(musb, &pdata, sizeof(pdata)); | 770 | ret = platform_device_add_data(musb, &pdata, sizeof(pdata)); |
745 | if (ret) { | 771 | if (ret) { |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 883a9adfdfff..c3d5fc9dfb5b 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2613,7 +2613,7 @@ static const struct hc_driver musb_hc_driver = { | |||
2613 | .description = "musb-hcd", | 2613 | .description = "musb-hcd", |
2614 | .product_desc = "MUSB HDRC host driver", | 2614 | .product_desc = "MUSB HDRC host driver", |
2615 | .hcd_priv_size = sizeof(struct musb *), | 2615 | .hcd_priv_size = sizeof(struct musb *), |
2616 | .flags = HCD_USB2 | HCD_MEMORY, | 2616 | .flags = HCD_USB2 | HCD_MEMORY | HCD_BH, |
2617 | 2617 | ||
2618 | /* not using irq handler or reset hooks from usbcore, since | 2618 | /* not using irq handler or reset hooks from usbcore, since |
2619 | * those must be shared with peripheral code for OTG configs | 2619 | * those must be shared with peripheral code for OTG configs |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 763649eb4987..cc752d8c7773 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -516,7 +516,7 @@ static int omap2430_probe(struct platform_device *pdev) | |||
516 | struct omap2430_glue *glue; | 516 | struct omap2430_glue *glue; |
517 | struct device_node *np = pdev->dev.of_node; | 517 | struct device_node *np = pdev->dev.of_node; |
518 | struct musb_hdrc_config *config; | 518 | struct musb_hdrc_config *config; |
519 | int ret = -ENOMEM; | 519 | int ret = -ENOMEM, val; |
520 | 520 | ||
521 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); | 521 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); |
522 | if (!glue) | 522 | if (!glue) |
@@ -559,7 +559,10 @@ static int omap2430_probe(struct platform_device *pdev) | |||
559 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); | 559 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); |
560 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); | 560 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); |
561 | of_property_read_u32(np, "power", (u32 *)&pdata->power); | 561 | of_property_read_u32(np, "power", (u32 *)&pdata->power); |
562 | config->multipoint = of_property_read_bool(np, "multipoint"); | 562 | |
563 | ret = of_property_read_u32(np, "multipoint", &val); | ||
564 | if (!ret && val) | ||
565 | config->multipoint = true; | ||
563 | 566 | ||
564 | pdata->board_data = data; | 567 | pdata->board_data = data; |
565 | pdata->config = config; | 568 | pdata->config = config; |
diff --git a/drivers/usb/renesas_usbhs/Kconfig b/drivers/usb/renesas_usbhs/Kconfig index de83b9d0cd5c..ebc99ee076ce 100644 --- a/drivers/usb/renesas_usbhs/Kconfig +++ b/drivers/usb/renesas_usbhs/Kconfig | |||
@@ -6,6 +6,7 @@ config USB_RENESAS_USBHS | |||
6 | tristate 'Renesas USBHS controller' | 6 | tristate 'Renesas USBHS controller' |
7 | depends on USB_GADGET | 7 | depends on USB_GADGET |
8 | depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST | 8 | depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST |
9 | depends on EXTCON || !EXTCON # if EXTCON=m, USBHS cannot be built-in | ||
9 | default n | 10 | default n |
10 | help | 11 | help |
11 | Renesas USBHS is a discrete USB host and peripheral controller chip | 12 | Renesas USBHS is a discrete USB host and peripheral controller chip |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 9374bd2aba20..8936a83c96cd 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -38,56 +38,51 @@ static int usb_serial_device_match(struct device *dev, | |||
38 | return 0; | 38 | return 0; |
39 | } | 39 | } |
40 | 40 | ||
41 | static ssize_t port_number_show(struct device *dev, | ||
42 | struct device_attribute *attr, char *buf) | ||
43 | { | ||
44 | struct usb_serial_port *port = to_usb_serial_port(dev); | ||
45 | |||
46 | return sprintf(buf, "%d\n", port->port_number); | ||
47 | } | ||
48 | static DEVICE_ATTR_RO(port_number); | ||
49 | |||
50 | static int usb_serial_device_probe(struct device *dev) | 41 | static int usb_serial_device_probe(struct device *dev) |
51 | { | 42 | { |
52 | struct usb_serial_driver *driver; | 43 | struct usb_serial_driver *driver; |
53 | struct usb_serial_port *port; | 44 | struct usb_serial_port *port; |
45 | struct device *tty_dev; | ||
54 | int retval = 0; | 46 | int retval = 0; |
55 | int minor; | 47 | int minor; |
56 | 48 | ||
57 | port = to_usb_serial_port(dev); | 49 | port = to_usb_serial_port(dev); |
58 | if (!port) { | 50 | if (!port) |
59 | retval = -ENODEV; | 51 | return -ENODEV; |
60 | goto exit; | ||
61 | } | ||
62 | 52 | ||
63 | /* make sure suspend/resume doesn't race against port_probe */ | 53 | /* make sure suspend/resume doesn't race against port_probe */ |
64 | retval = usb_autopm_get_interface(port->serial->interface); | 54 | retval = usb_autopm_get_interface(port->serial->interface); |
65 | if (retval) | 55 | if (retval) |
66 | goto exit; | 56 | return retval; |
67 | 57 | ||
68 | driver = port->serial->type; | 58 | driver = port->serial->type; |
69 | if (driver->port_probe) { | 59 | if (driver->port_probe) { |
70 | retval = driver->port_probe(port); | 60 | retval = driver->port_probe(port); |
71 | if (retval) | 61 | if (retval) |
72 | goto exit_with_autopm; | 62 | goto err_autopm_put; |
73 | } | 63 | } |
74 | 64 | ||
75 | retval = device_create_file(dev, &dev_attr_port_number); | 65 | minor = port->minor; |
76 | if (retval) { | 66 | tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev); |
77 | if (driver->port_remove) | 67 | if (IS_ERR(tty_dev)) { |
78 | retval = driver->port_remove(port); | 68 | retval = PTR_ERR(tty_dev); |
79 | goto exit_with_autopm; | 69 | goto err_port_remove; |
80 | } | 70 | } |
81 | 71 | ||
82 | minor = port->minor; | 72 | usb_autopm_put_interface(port->serial->interface); |
83 | tty_register_device(usb_serial_tty_driver, minor, dev); | 73 | |
84 | dev_info(&port->serial->dev->dev, | 74 | dev_info(&port->serial->dev->dev, |
85 | "%s converter now attached to ttyUSB%d\n", | 75 | "%s converter now attached to ttyUSB%d\n", |
86 | driver->description, minor); | 76 | driver->description, minor); |
87 | 77 | ||
88 | exit_with_autopm: | 78 | return 0; |
79 | |||
80 | err_port_remove: | ||
81 | if (driver->port_remove) | ||
82 | driver->port_remove(port); | ||
83 | err_autopm_put: | ||
89 | usb_autopm_put_interface(port->serial->interface); | 84 | usb_autopm_put_interface(port->serial->interface); |
90 | exit: | 85 | |
91 | return retval; | 86 | return retval; |
92 | } | 87 | } |
93 | 88 | ||
@@ -114,8 +109,6 @@ static int usb_serial_device_remove(struct device *dev) | |||
114 | minor = port->minor; | 109 | minor = port->minor; |
115 | tty_unregister_device(usb_serial_tty_driver, minor); | 110 | tty_unregister_device(usb_serial_tty_driver, minor); |
116 | 111 | ||
117 | device_remove_file(&port->dev, &dev_attr_port_number); | ||
118 | |||
119 | driver = port->serial->type; | 112 | driver = port->serial->type; |
120 | if (driver->port_remove) | 113 | if (driver->port_remove) |
121 | retval = driver->port_remove(port); | 114 | retval = driver->port_remove(port); |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 2d72aa3564a3..ede4f5fcfadd 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -84,6 +84,10 @@ struct ch341_private { | |||
84 | u8 line_status; /* active status of modem control inputs */ | 84 | u8 line_status; /* active status of modem control inputs */ |
85 | }; | 85 | }; |
86 | 86 | ||
87 | static void ch341_set_termios(struct tty_struct *tty, | ||
88 | struct usb_serial_port *port, | ||
89 | struct ktermios *old_termios); | ||
90 | |||
87 | static int ch341_control_out(struct usb_device *dev, u8 request, | 91 | static int ch341_control_out(struct usb_device *dev, u8 request, |
88 | u16 value, u16 index) | 92 | u16 value, u16 index) |
89 | { | 93 | { |
@@ -309,19 +313,12 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
309 | struct ch341_private *priv = usb_get_serial_port_data(port); | 313 | struct ch341_private *priv = usb_get_serial_port_data(port); |
310 | int r; | 314 | int r; |
311 | 315 | ||
312 | priv->baud_rate = DEFAULT_BAUD_RATE; | ||
313 | |||
314 | r = ch341_configure(serial->dev, priv); | 316 | r = ch341_configure(serial->dev, priv); |
315 | if (r) | 317 | if (r) |
316 | goto out; | 318 | goto out; |
317 | 319 | ||
318 | r = ch341_set_handshake(serial->dev, priv->line_control); | 320 | if (tty) |
319 | if (r) | 321 | ch341_set_termios(tty, port, NULL); |
320 | goto out; | ||
321 | |||
322 | r = ch341_set_baudrate(serial->dev, priv); | ||
323 | if (r) | ||
324 | goto out; | ||
325 | 322 | ||
326 | dev_dbg(&port->dev, "%s - submitting interrupt urb\n", __func__); | 323 | dev_dbg(&port->dev, "%s - submitting interrupt urb\n", __func__); |
327 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 324 | r = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 29fa1c3d0089..3806e7014199 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | ||
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
18 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
19 | #include <linux/console.h> | 20 | #include <linux/console.h> |
@@ -144,6 +145,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
144 | init_ldsem(&tty->ldisc_sem); | 145 | init_ldsem(&tty->ldisc_sem); |
145 | INIT_LIST_HEAD(&tty->tty_files); | 146 | INIT_LIST_HEAD(&tty->tty_files); |
146 | kref_get(&tty->driver->kref); | 147 | kref_get(&tty->driver->kref); |
148 | __module_get(tty->driver->owner); | ||
147 | tty->ops = &usb_console_fake_tty_ops; | 149 | tty->ops = &usb_console_fake_tty_ops; |
148 | if (tty_init_termios(tty)) { | 150 | if (tty_init_termios(tty)) { |
149 | retval = -ENOMEM; | 151 | retval = -ENOMEM; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index f40c856ff758..84ce2d74894c 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = { | |||
147 | { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ | 147 | { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ |
148 | { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ | 148 | { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ |
149 | { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ | 149 | { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ |
150 | { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ | ||
151 | { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ | ||
150 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | 152 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
151 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ | 153 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ |
152 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ | 154 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 1ebb351b9e9a..3086dec0ef53 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -799,6 +799,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
799 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, | 799 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, |
800 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, | 800 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, |
801 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, | 801 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, |
802 | { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), | ||
803 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
802 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), | 804 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), |
803 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 805 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
804 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), | 806 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), |
@@ -978,6 +980,23 @@ static const struct usb_device_id id_table_combined[] = { | |||
978 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 980 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
979 | /* GE Healthcare devices */ | 981 | /* GE Healthcare devices */ |
980 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, | 982 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, |
983 | /* Active Research (Actisense) devices */ | ||
984 | { USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) }, | ||
985 | { USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) }, | ||
986 | { USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) }, | ||
987 | { USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) }, | ||
988 | { USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) }, | ||
989 | { USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) }, | ||
990 | { USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) }, | ||
991 | { USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) }, | ||
992 | { USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) }, | ||
993 | { USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) }, | ||
994 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) }, | ||
995 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) }, | ||
996 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) }, | ||
997 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, | ||
998 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, | ||
999 | { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, | ||
981 | { } /* Terminating entry */ | 1000 | { } /* Terminating entry */ |
982 | }; | 1001 | }; |
983 | 1002 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index e52409c9be99..56b1b55c4751 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -38,6 +38,9 @@ | |||
38 | 38 | ||
39 | #define FTDI_LUMEL_PD12_PID 0x6002 | 39 | #define FTDI_LUMEL_PD12_PID 0x6002 |
40 | 40 | ||
41 | /* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ | ||
42 | #define CYBER_CORTEX_AV_PID 0x8698 | ||
43 | |||
41 | /* | 44 | /* |
42 | * Marvell OpenRD Base, Client | 45 | * Marvell OpenRD Base, Client |
43 | * http://www.open-rd.org | 46 | * http://www.open-rd.org |
@@ -1438,3 +1441,23 @@ | |||
1438 | */ | 1441 | */ |
1439 | #define GE_HEALTHCARE_VID 0x1901 | 1442 | #define GE_HEALTHCARE_VID 0x1901 |
1440 | #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 | 1443 | #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 |
1444 | |||
1445 | /* | ||
1446 | * Active Research (Actisense) devices | ||
1447 | */ | ||
1448 | #define ACTISENSE_NDC_PID 0xD9A8 /* NDC USB Serial Adapter */ | ||
1449 | #define ACTISENSE_USG_PID 0xD9A9 /* USG USB Serial Adapter */ | ||
1450 | #define ACTISENSE_NGT_PID 0xD9AA /* NGT NMEA2000 Interface */ | ||
1451 | #define ACTISENSE_NGW_PID 0xD9AB /* NGW NMEA2000 Gateway */ | ||
1452 | #define ACTISENSE_D9AC_PID 0xD9AC /* Actisense Reserved */ | ||
1453 | #define ACTISENSE_D9AD_PID 0xD9AD /* Actisense Reserved */ | ||
1454 | #define ACTISENSE_D9AE_PID 0xD9AE /* Actisense Reserved */ | ||
1455 | #define ACTISENSE_D9AF_PID 0xD9AF /* Actisense Reserved */ | ||
1456 | #define CHETCO_SEAGAUGE_PID 0xA548 /* SeaGauge USB Adapter */ | ||
1457 | #define CHETCO_SEASWITCH_PID 0xA549 /* SeaSwitch USB Adapter */ | ||
1458 | #define CHETCO_SEASMART_NMEA2000_PID 0xA54A /* SeaSmart NMEA2000 Gateway */ | ||
1459 | #define CHETCO_SEASMART_ETHERNET_PID 0xA54B /* SeaSmart Ethernet Gateway */ | ||
1460 | #define CHETCO_SEASMART_WIFI_PID 0xA5AC /* SeaSmart Wifi Gateway */ | ||
1461 | #define CHETCO_SEASMART_DISPLAY_PID 0xA5AD /* SeaSmart NMEA2000 Display */ | ||
1462 | #define CHETCO_SEASMART_LITE_PID 0xA5AE /* SeaSmart Lite USB Adapter */ | ||
1463 | #define CHETCO_SEASMART_ANALOG_PID 0xA5AF /* SeaSmart Analog Adapter */ | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index ccf1df7c4b80..54e170dd3dad 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -258,7 +258,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | |||
258 | * character or at least one jiffy. | 258 | * character or at least one jiffy. |
259 | */ | 259 | */ |
260 | period = max_t(unsigned long, (10 * HZ / bps), 1); | 260 | period = max_t(unsigned long, (10 * HZ / bps), 1); |
261 | period = min_t(unsigned long, period, timeout); | 261 | if (timeout) |
262 | period = min_t(unsigned long, period, timeout); | ||
262 | 263 | ||
263 | dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", | 264 | dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", |
264 | __func__, jiffies_to_msecs(timeout), | 265 | __func__, jiffies_to_msecs(timeout), |
@@ -268,7 +269,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | |||
268 | schedule_timeout_interruptible(period); | 269 | schedule_timeout_interruptible(period); |
269 | if (signal_pending(current)) | 270 | if (signal_pending(current)) |
270 | break; | 271 | break; |
271 | if (time_after(jiffies, expire)) | 272 | if (timeout && time_after(jiffies, expire)) |
272 | break; | 273 | break; |
273 | } | 274 | } |
274 | } | 275 | } |
diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c index ab1d690274ae..460a40669967 100644 --- a/drivers/usb/serial/mxuport.c +++ b/drivers/usb/serial/mxuport.c | |||
@@ -1284,7 +1284,8 @@ static int mxuport_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | /* Initial port termios */ | 1286 | /* Initial port termios */ |
1287 | mxuport_set_termios(tty, port, NULL); | 1287 | if (tty) |
1288 | mxuport_set_termios(tty, port, NULL); | ||
1288 | 1289 | ||
1289 | /* | 1290 | /* |
1290 | * TODO: use RQ_VENDOR_GET_MSR, once we know what it | 1291 | * TODO: use RQ_VENDOR_GET_MSR, once we know what it |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 0f872e6b2c87..829604d11f3f 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
132 | #define UART_OVERRUN_ERROR 0x40 | 132 | #define UART_OVERRUN_ERROR 0x40 |
133 | #define UART_CTS 0x80 | 133 | #define UART_CTS 0x80 |
134 | 134 | ||
135 | static void pl2303_set_break(struct usb_serial_port *port, bool enable); | ||
135 | 136 | ||
136 | enum pl2303_type { | 137 | enum pl2303_type { |
137 | TYPE_01, /* Type 0 and 1 (difference unknown) */ | 138 | TYPE_01, /* Type 0 and 1 (difference unknown) */ |
@@ -615,6 +616,7 @@ static void pl2303_close(struct usb_serial_port *port) | |||
615 | { | 616 | { |
616 | usb_serial_generic_close(port); | 617 | usb_serial_generic_close(port); |
617 | usb_kill_urb(port->interrupt_in_urb); | 618 | usb_kill_urb(port->interrupt_in_urb); |
619 | pl2303_set_break(port, false); | ||
618 | } | 620 | } |
619 | 621 | ||
620 | static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | 622 | static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) |
@@ -741,17 +743,16 @@ static int pl2303_ioctl(struct tty_struct *tty, | |||
741 | return -ENOIOCTLCMD; | 743 | return -ENOIOCTLCMD; |
742 | } | 744 | } |
743 | 745 | ||
744 | static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | 746 | static void pl2303_set_break(struct usb_serial_port *port, bool enable) |
745 | { | 747 | { |
746 | struct usb_serial_port *port = tty->driver_data; | ||
747 | struct usb_serial *serial = port->serial; | 748 | struct usb_serial *serial = port->serial; |
748 | u16 state; | 749 | u16 state; |
749 | int result; | 750 | int result; |
750 | 751 | ||
751 | if (break_state == 0) | 752 | if (enable) |
752 | state = BREAK_OFF; | ||
753 | else | ||
754 | state = BREAK_ON; | 753 | state = BREAK_ON; |
754 | else | ||
755 | state = BREAK_OFF; | ||
755 | 756 | ||
756 | dev_dbg(&port->dev, "%s - turning break %s\n", __func__, | 757 | dev_dbg(&port->dev, "%s - turning break %s\n", __func__, |
757 | state == BREAK_OFF ? "off" : "on"); | 758 | state == BREAK_OFF ? "off" : "on"); |
@@ -763,6 +764,13 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | |||
763 | dev_err(&port->dev, "error sending break = %d\n", result); | 764 | dev_err(&port->dev, "error sending break = %d\n", result); |
764 | } | 765 | } |
765 | 766 | ||
767 | static void pl2303_break_ctl(struct tty_struct *tty, int state) | ||
768 | { | ||
769 | struct usb_serial_port *port = tty->driver_data; | ||
770 | |||
771 | pl2303_set_break(port, state); | ||
772 | } | ||
773 | |||
766 | static void pl2303_update_line_status(struct usb_serial_port *port, | 774 | static void pl2303_update_line_status(struct usb_serial_port *port, |
767 | unsigned char *data, | 775 | unsigned char *data, |
768 | unsigned int actual_length) | 776 | unsigned int actual_length) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 475723c006f9..529066bbc7e8 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -687,6 +687,21 @@ static void serial_port_dtr_rts(struct tty_port *port, int on) | |||
687 | drv->dtr_rts(p, on); | 687 | drv->dtr_rts(p, on); |
688 | } | 688 | } |
689 | 689 | ||
690 | static ssize_t port_number_show(struct device *dev, | ||
691 | struct device_attribute *attr, char *buf) | ||
692 | { | ||
693 | struct usb_serial_port *port = to_usb_serial_port(dev); | ||
694 | |||
695 | return sprintf(buf, "%u\n", port->port_number); | ||
696 | } | ||
697 | static DEVICE_ATTR_RO(port_number); | ||
698 | |||
699 | static struct attribute *usb_serial_port_attrs[] = { | ||
700 | &dev_attr_port_number.attr, | ||
701 | NULL | ||
702 | }; | ||
703 | ATTRIBUTE_GROUPS(usb_serial_port); | ||
704 | |||
690 | static const struct tty_port_operations serial_port_ops = { | 705 | static const struct tty_port_operations serial_port_ops = { |
691 | .carrier_raised = serial_port_carrier_raised, | 706 | .carrier_raised = serial_port_carrier_raised, |
692 | .dtr_rts = serial_port_dtr_rts, | 707 | .dtr_rts = serial_port_dtr_rts, |
@@ -902,6 +917,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
902 | port->dev.driver = NULL; | 917 | port->dev.driver = NULL; |
903 | port->dev.bus = &usb_serial_bus_type; | 918 | port->dev.bus = &usb_serial_bus_type; |
904 | port->dev.release = &usb_serial_port_release; | 919 | port->dev.release = &usb_serial_port_release; |
920 | port->dev.groups = usb_serial_port_groups; | ||
905 | device_initialize(&port->dev); | 921 | device_initialize(&port->dev); |
906 | } | 922 | } |
907 | 923 | ||
@@ -940,8 +956,9 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
940 | port = serial->port[i]; | 956 | port = serial->port[i]; |
941 | if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) | 957 | if (kfifo_alloc(&port->write_fifo, PAGE_SIZE, GFP_KERNEL)) |
942 | goto probe_error; | 958 | goto probe_error; |
943 | buffer_size = max_t(int, serial->type->bulk_out_size, | 959 | buffer_size = serial->type->bulk_out_size; |
944 | usb_endpoint_maxp(endpoint)); | 960 | if (!buffer_size) |
961 | buffer_size = usb_endpoint_maxp(endpoint); | ||
945 | port->bulk_out_size = buffer_size; | 962 | port->bulk_out_size = buffer_size; |
946 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; | 963 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; |
947 | 964 | ||
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index dbc00e56c7f5..82570425fdfe 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -113,6 +113,13 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999, | |||
113 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 113 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
114 | US_FL_NO_ATA_1X), | 114 | US_FL_NO_ATA_1X), |
115 | 115 | ||
116 | /* Reported-by: Tom Arild Naess <tanaess@gmail.com> */ | ||
117 | UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999, | ||
118 | "JMicron", | ||
119 | "JMS539", | ||
120 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
121 | US_FL_NO_REPORT_OPCODES), | ||
122 | |||
116 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 123 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
117 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 124 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
118 | "JMicron", | 125 | "JMicron", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index d468d02179f4..5600c33fcadb 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -889,6 +889,12 @@ static void usb_stor_scan_dwork(struct work_struct *work) | |||
889 | !(us->fflags & US_FL_SCM_MULT_TARG)) { | 889 | !(us->fflags & US_FL_SCM_MULT_TARG)) { |
890 | mutex_lock(&us->dev_mutex); | 890 | mutex_lock(&us->dev_mutex); |
891 | us->max_lun = usb_stor_Bulk_max_lun(us); | 891 | us->max_lun = usb_stor_Bulk_max_lun(us); |
892 | /* | ||
893 | * Allow proper scanning of devices that present more than 8 LUNs | ||
894 | * While not affecting other devices that may need the previous behavior | ||
895 | */ | ||
896 | if (us->max_lun >= 8) | ||
897 | us_to_host(us)->max_lun = us->max_lun+1; | ||
892 | mutex_unlock(&us->dev_mutex); | 898 | mutex_unlock(&us->dev_mutex); |
893 | } | 899 | } |
894 | scsi_scan_host(us_to_host(us)); | 900 | scsi_scan_host(us_to_host(us)); |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index afa06d28725d..2bbfc25e582c 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -591,11 +591,6 @@ static void handle_rx(struct vhost_net *net) | |||
591 | * TODO: support TSO. | 591 | * TODO: support TSO. |
592 | */ | 592 | */ |
593 | iov_iter_advance(&msg.msg_iter, vhost_hlen); | 593 | iov_iter_advance(&msg.msg_iter, vhost_hlen); |
594 | } else { | ||
595 | /* It'll come from socket; we'll need to patch | ||
596 | * ->num_buffers over if VIRTIO_NET_F_MRG_RXBUF | ||
597 | */ | ||
598 | iov_iter_advance(&fixup, sizeof(hdr)); | ||
599 | } | 594 | } |
600 | err = sock->ops->recvmsg(NULL, sock, &msg, | 595 | err = sock->ops->recvmsg(NULL, sock, &msg, |
601 | sock_len, MSG_DONTWAIT | MSG_TRUNC); | 596 | sock_len, MSG_DONTWAIT | MSG_TRUNC); |
@@ -609,17 +604,25 @@ static void handle_rx(struct vhost_net *net) | |||
609 | continue; | 604 | continue; |
610 | } | 605 | } |
611 | /* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */ | 606 | /* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */ |
612 | if (unlikely(vhost_hlen) && | 607 | if (unlikely(vhost_hlen)) { |
613 | copy_to_iter(&hdr, sizeof(hdr), &fixup) != sizeof(hdr)) { | 608 | if (copy_to_iter(&hdr, sizeof(hdr), |
614 | vq_err(vq, "Unable to write vnet_hdr at addr %p\n", | 609 | &fixup) != sizeof(hdr)) { |
615 | vq->iov->iov_base); | 610 | vq_err(vq, "Unable to write vnet_hdr " |
616 | break; | 611 | "at addr %p\n", vq->iov->iov_base); |
612 | break; | ||
613 | } | ||
614 | } else { | ||
615 | /* Header came from socket; we'll need to patch | ||
616 | * ->num_buffers over if VIRTIO_NET_F_MRG_RXBUF | ||
617 | */ | ||
618 | iov_iter_advance(&fixup, sizeof(hdr)); | ||
617 | } | 619 | } |
618 | /* TODO: Should check and handle checksum. */ | 620 | /* TODO: Should check and handle checksum. */ |
619 | 621 | ||
620 | num_buffers = cpu_to_vhost16(vq, headcount); | 622 | num_buffers = cpu_to_vhost16(vq, headcount); |
621 | if (likely(mergeable) && | 623 | if (likely(mergeable) && |
622 | copy_to_iter(&num_buffers, 2, &fixup) != 2) { | 624 | copy_to_iter(&num_buffers, sizeof num_buffers, |
625 | &fixup) != sizeof num_buffers) { | ||
623 | vq_err(vq, "Failed num_buffers write"); | 626 | vq_err(vq, "Failed num_buffers write"); |
624 | vhost_discard_vq_desc(vq, headcount); | 627 | vhost_discard_vq_desc(vq, headcount); |
625 | break; | 628 | break; |
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 6df940528fd2..1443b3c391de 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -208,7 +208,8 @@ static int at91_wdt_init(struct platform_device *pdev, struct at91wdt *wdt) | |||
208 | 208 | ||
209 | if ((tmp & AT91_WDT_WDFIEN) && wdt->irq) { | 209 | if ((tmp & AT91_WDT_WDFIEN) && wdt->irq) { |
210 | err = request_irq(wdt->irq, wdt_interrupt, | 210 | err = request_irq(wdt->irq, wdt_interrupt, |
211 | IRQF_SHARED | IRQF_IRQPOLL, | 211 | IRQF_SHARED | IRQF_IRQPOLL | |
212 | IRQF_NO_SUSPEND, | ||
212 | pdev->name, wdt); | 213 | pdev->name, wdt); |
213 | if (err) | 214 | if (err) |
214 | return err; | 215 | return err; |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 2140398a2a8c..2ccd3592d41f 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -2,7 +2,7 @@ ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),) | |||
2 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 2 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
3 | endif | 3 | endif |
4 | obj-$(CONFIG_X86) += fallback.o | 4 | obj-$(CONFIG_X86) += fallback.o |
5 | obj-y += grant-table.o features.o balloon.o manage.o | 5 | obj-y += grant-table.o features.o balloon.o manage.o preempt.o |
6 | obj-y += events/ | 6 | obj-y += events/ |
7 | obj-y += xenbus/ | 7 | obj-y += xenbus/ |
8 | 8 | ||
diff --git a/drivers/xen/preempt.c b/drivers/xen/preempt.c new file mode 100644 index 000000000000..a1800c150839 --- /dev/null +++ b/drivers/xen/preempt.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Preemptible hypercalls | ||
3 | * | ||
4 | * Copyright (C) 2014 Citrix Systems R&D ltd. | ||
5 | * | ||
6 | * This source code is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation; either version 2 of the | ||
9 | * License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/sched.h> | ||
13 | #include <xen/xen-ops.h> | ||
14 | |||
15 | #ifndef CONFIG_PREEMPT | ||
16 | |||
17 | /* | ||
18 | * Some hypercalls issued by the toolstack can take many 10s of | ||
19 | * seconds. Allow tasks running hypercalls via the privcmd driver to | ||
20 | * be voluntarily preempted even if full kernel preemption is | ||
21 | * disabled. | ||
22 | * | ||
23 | * Such preemptible hypercalls are bracketed by | ||
24 | * xen_preemptible_hcall_begin() and xen_preemptible_hcall_end() | ||
25 | * calls. | ||
26 | */ | ||
27 | |||
28 | DEFINE_PER_CPU(bool, xen_in_preemptible_hcall); | ||
29 | EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall); | ||
30 | |||
31 | asmlinkage __visible void xen_maybe_preempt_hcall(void) | ||
32 | { | ||
33 | if (unlikely(__this_cpu_read(xen_in_preemptible_hcall) | ||
34 | && should_resched())) { | ||
35 | /* | ||
36 | * Clear flag as we may be rescheduled on a different | ||
37 | * cpu. | ||
38 | */ | ||
39 | __this_cpu_write(xen_in_preemptible_hcall, false); | ||
40 | _cond_resched(); | ||
41 | __this_cpu_write(xen_in_preemptible_hcall, true); | ||
42 | } | ||
43 | } | ||
44 | #endif /* CONFIG_PREEMPT */ | ||
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 569a13b9e856..59ac71c4a043 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c | |||
@@ -56,10 +56,12 @@ static long privcmd_ioctl_hypercall(void __user *udata) | |||
56 | if (copy_from_user(&hypercall, udata, sizeof(hypercall))) | 56 | if (copy_from_user(&hypercall, udata, sizeof(hypercall))) |
57 | return -EFAULT; | 57 | return -EFAULT; |
58 | 58 | ||
59 | xen_preemptible_hcall_begin(); | ||
59 | ret = privcmd_call(hypercall.op, | 60 | ret = privcmd_call(hypercall.op, |
60 | hypercall.arg[0], hypercall.arg[1], | 61 | hypercall.arg[0], hypercall.arg[1], |
61 | hypercall.arg[2], hypercall.arg[3], | 62 | hypercall.arg[2], hypercall.arg[3], |
62 | hypercall.arg[4]); | 63 | hypercall.arg[4]); |
64 | xen_preemptible_hcall_end(); | ||
63 | 65 | ||
64 | return ret; | 66 | return ret; |
65 | } | 67 | } |
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 61653a03a8f5..9faca6a60bb0 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
@@ -709,12 +709,11 @@ static int prepare_pending_reqs(struct vscsibk_info *info, | |||
709 | static int scsiback_do_cmd_fn(struct vscsibk_info *info) | 709 | static int scsiback_do_cmd_fn(struct vscsibk_info *info) |
710 | { | 710 | { |
711 | struct vscsiif_back_ring *ring = &info->ring; | 711 | struct vscsiif_back_ring *ring = &info->ring; |
712 | struct vscsiif_request *ring_req; | 712 | struct vscsiif_request ring_req; |
713 | struct vscsibk_pend *pending_req; | 713 | struct vscsibk_pend *pending_req; |
714 | RING_IDX rc, rp; | 714 | RING_IDX rc, rp; |
715 | int err, more_to_do; | 715 | int err, more_to_do; |
716 | uint32_t result; | 716 | uint32_t result; |
717 | uint8_t act; | ||
718 | 717 | ||
719 | rc = ring->req_cons; | 718 | rc = ring->req_cons; |
720 | rp = ring->sring->req_prod; | 719 | rp = ring->sring->req_prod; |
@@ -735,11 +734,10 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info) | |||
735 | if (!pending_req) | 734 | if (!pending_req) |
736 | return 1; | 735 | return 1; |
737 | 736 | ||
738 | ring_req = RING_GET_REQUEST(ring, rc); | 737 | ring_req = *RING_GET_REQUEST(ring, rc); |
739 | ring->req_cons = ++rc; | 738 | ring->req_cons = ++rc; |
740 | 739 | ||
741 | act = ring_req->act; | 740 | err = prepare_pending_reqs(info, &ring_req, pending_req); |
742 | err = prepare_pending_reqs(info, ring_req, pending_req); | ||
743 | if (err) { | 741 | if (err) { |
744 | switch (err) { | 742 | switch (err) { |
745 | case -ENODEV: | 743 | case -ENODEV: |
@@ -755,9 +753,9 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info) | |||
755 | return 1; | 753 | return 1; |
756 | } | 754 | } |
757 | 755 | ||
758 | switch (act) { | 756 | switch (ring_req.act) { |
759 | case VSCSIIF_ACT_SCSI_CDB: | 757 | case VSCSIIF_ACT_SCSI_CDB: |
760 | if (scsiback_gnttab_data_map(ring_req, pending_req)) { | 758 | if (scsiback_gnttab_data_map(&ring_req, pending_req)) { |
761 | scsiback_fast_flush_area(pending_req); | 759 | scsiback_fast_flush_area(pending_req); |
762 | scsiback_do_resp_with_sense(NULL, | 760 | scsiback_do_resp_with_sense(NULL, |
763 | DRIVER_ERROR << 24, 0, pending_req); | 761 | DRIVER_ERROR << 24, 0, pending_req); |
@@ -768,7 +766,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info) | |||
768 | break; | 766 | break; |
769 | case VSCSIIF_ACT_SCSI_ABORT: | 767 | case VSCSIIF_ACT_SCSI_ABORT: |
770 | scsiback_device_action(pending_req, TMR_ABORT_TASK, | 768 | scsiback_device_action(pending_req, TMR_ABORT_TASK, |
771 | ring_req->ref_rqid); | 769 | ring_req.ref_rqid); |
772 | break; | 770 | break; |
773 | case VSCSIIF_ACT_SCSI_RESET: | 771 | case VSCSIIF_ACT_SCSI_RESET: |
774 | scsiback_device_action(pending_req, TMR_LUN_RESET, 0); | 772 | scsiback_device_action(pending_req, TMR_LUN_RESET, 0); |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 993642199326..6d67f32e648d 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1645,14 +1645,14 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
1645 | 1645 | ||
1646 | parent_nritems = btrfs_header_nritems(parent); | 1646 | parent_nritems = btrfs_header_nritems(parent); |
1647 | blocksize = root->nodesize; | 1647 | blocksize = root->nodesize; |
1648 | end_slot = parent_nritems; | 1648 | end_slot = parent_nritems - 1; |
1649 | 1649 | ||
1650 | if (parent_nritems == 1) | 1650 | if (parent_nritems <= 1) |
1651 | return 0; | 1651 | return 0; |
1652 | 1652 | ||
1653 | btrfs_set_lock_blocking(parent); | 1653 | btrfs_set_lock_blocking(parent); |
1654 | 1654 | ||
1655 | for (i = start_slot; i < end_slot; i++) { | 1655 | for (i = start_slot; i <= end_slot; i++) { |
1656 | int close = 1; | 1656 | int close = 1; |
1657 | 1657 | ||
1658 | btrfs_node_key(parent, &disk_key, i); | 1658 | btrfs_node_key(parent, &disk_key, i); |
@@ -1669,7 +1669,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
1669 | other = btrfs_node_blockptr(parent, i - 1); | 1669 | other = btrfs_node_blockptr(parent, i - 1); |
1670 | close = close_blocks(blocknr, other, blocksize); | 1670 | close = close_blocks(blocknr, other, blocksize); |
1671 | } | 1671 | } |
1672 | if (!close && i < end_slot - 2) { | 1672 | if (!close && i < end_slot) { |
1673 | other = btrfs_node_blockptr(parent, i + 1); | 1673 | other = btrfs_node_blockptr(parent, i + 1); |
1674 | close = close_blocks(blocknr, other, blocksize); | 1674 | close = close_blocks(blocknr, other, blocksize); |
1675 | } | 1675 | } |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 571f402d3fc4..6f080451fcb1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3208,6 +3208,8 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group, | |||
3208 | return 0; | 3208 | return 0; |
3209 | } | 3209 | } |
3210 | 3210 | ||
3211 | if (trans->aborted) | ||
3212 | return 0; | ||
3211 | again: | 3213 | again: |
3212 | inode = lookup_free_space_inode(root, block_group, path); | 3214 | inode = lookup_free_space_inode(root, block_group, path); |
3213 | if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { | 3215 | if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { |
@@ -3243,6 +3245,20 @@ again: | |||
3243 | */ | 3245 | */ |
3244 | BTRFS_I(inode)->generation = 0; | 3246 | BTRFS_I(inode)->generation = 0; |
3245 | ret = btrfs_update_inode(trans, root, inode); | 3247 | ret = btrfs_update_inode(trans, root, inode); |
3248 | if (ret) { | ||
3249 | /* | ||
3250 | * So theoretically we could recover from this, simply set the | ||
3251 | * super cache generation to 0 so we know to invalidate the | ||
3252 | * cache, but then we'd have to keep track of the block groups | ||
3253 | * that fail this way so we know we _have_ to reset this cache | ||
3254 | * before the next commit or risk reading stale cache. So to | ||
3255 | * limit our exposure to horrible edge cases lets just abort the | ||
3256 | * transaction, this only happens in really bad situations | ||
3257 | * anyway. | ||
3258 | */ | ||
3259 | btrfs_abort_transaction(trans, root, ret); | ||
3260 | goto out_put; | ||
3261 | } | ||
3246 | WARN_ON(ret); | 3262 | WARN_ON(ret); |
3247 | 3263 | ||
3248 | if (i_size_read(inode) > 0) { | 3264 | if (i_size_read(inode) > 0) { |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b78bbbac900d..30982bbd31c3 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1811,22 +1811,10 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, | |||
1811 | mutex_unlock(&inode->i_mutex); | 1811 | mutex_unlock(&inode->i_mutex); |
1812 | 1812 | ||
1813 | /* | 1813 | /* |
1814 | * we want to make sure fsync finds this change | ||
1815 | * but we haven't joined a transaction running right now. | ||
1816 | * | ||
1817 | * Later on, someone is sure to update the inode and get the | ||
1818 | * real transid recorded. | ||
1819 | * | ||
1820 | * We set last_trans now to the fs_info generation + 1, | ||
1821 | * this will either be one more than the running transaction | ||
1822 | * or the generation used for the next transaction if there isn't | ||
1823 | * one running right now. | ||
1824 | * | ||
1825 | * We also have to set last_sub_trans to the current log transid, | 1814 | * We also have to set last_sub_trans to the current log transid, |
1826 | * otherwise subsequent syncs to a file that's been synced in this | 1815 | * otherwise subsequent syncs to a file that's been synced in this |
1827 | * transaction will appear to have already occured. | 1816 | * transaction will appear to have already occured. |
1828 | */ | 1817 | */ |
1829 | BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; | ||
1830 | BTRFS_I(inode)->last_sub_trans = root->log_transid; | 1818 | BTRFS_I(inode)->last_sub_trans = root->log_transid; |
1831 | if (num_written > 0) { | 1819 | if (num_written > 0) { |
1832 | err = generic_write_sync(file, pos, num_written); | 1820 | err = generic_write_sync(file, pos, num_written); |
@@ -1959,25 +1947,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
1959 | atomic_inc(&root->log_batch); | 1947 | atomic_inc(&root->log_batch); |
1960 | 1948 | ||
1961 | /* | 1949 | /* |
1962 | * check the transaction that last modified this inode | 1950 | * If the last transaction that changed this file was before the current |
1963 | * and see if its already been committed | 1951 | * transaction and we have the full sync flag set in our inode, we can |
1964 | */ | 1952 | * bail out now without any syncing. |
1965 | if (!BTRFS_I(inode)->last_trans) { | 1953 | * |
1966 | mutex_unlock(&inode->i_mutex); | 1954 | * Note that we can't bail out if the full sync flag isn't set. This is |
1967 | goto out; | 1955 | * because when the full sync flag is set we start all ordered extents |
1968 | } | 1956 | * and wait for them to fully complete - when they complete they update |
1969 | 1957 | * the inode's last_trans field through: | |
1970 | /* | 1958 | * |
1971 | * if the last transaction that changed this file was before | 1959 | * btrfs_finish_ordered_io() -> |
1972 | * the current transaction, we can bail out now without any | 1960 | * btrfs_update_inode_fallback() -> |
1973 | * syncing | 1961 | * btrfs_update_inode() -> |
1962 | * btrfs_set_inode_last_trans() | ||
1963 | * | ||
1964 | * So we are sure that last_trans is up to date and can do this check to | ||
1965 | * bail out safely. For the fast path, when the full sync flag is not | ||
1966 | * set in our inode, we can not do it because we start only our ordered | ||
1967 | * extents and don't wait for them to complete (that is when | ||
1968 | * btrfs_finish_ordered_io runs), so here at this point their last_trans | ||
1969 | * value might be less than or equals to fs_info->last_trans_committed, | ||
1970 | * and setting a speculative last_trans for an inode when a buffered | ||
1971 | * write is made (such as fs_info->generation + 1 for example) would not | ||
1972 | * be reliable since after setting the value and before fsync is called | ||
1973 | * any number of transactions can start and commit (transaction kthread | ||
1974 | * commits the current transaction periodically), and a transaction | ||
1975 | * commit does not start nor waits for ordered extents to complete. | ||
1974 | */ | 1976 | */ |
1975 | smp_mb(); | 1977 | smp_mb(); |
1976 | if (btrfs_inode_in_log(inode, root->fs_info->generation) || | 1978 | if (btrfs_inode_in_log(inode, root->fs_info->generation) || |
1977 | BTRFS_I(inode)->last_trans <= | 1979 | (full_sync && BTRFS_I(inode)->last_trans <= |
1978 | root->fs_info->last_trans_committed) { | 1980 | root->fs_info->last_trans_committed)) { |
1979 | BTRFS_I(inode)->last_trans = 0; | ||
1980 | |||
1981 | /* | 1981 | /* |
1982 | * We'v had everything committed since the last time we were | 1982 | * We'v had everything committed since the last time we were |
1983 | * modified so clear this flag in case it was set for whatever | 1983 | * modified so clear this flag in case it was set for whatever |
@@ -2275,6 +2275,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2275 | bool same_page; | 2275 | bool same_page; |
2276 | bool no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES); | 2276 | bool no_holes = btrfs_fs_incompat(root->fs_info, NO_HOLES); |
2277 | u64 ino_size; | 2277 | u64 ino_size; |
2278 | bool truncated_page = false; | ||
2279 | bool updated_inode = false; | ||
2278 | 2280 | ||
2279 | ret = btrfs_wait_ordered_range(inode, offset, len); | 2281 | ret = btrfs_wait_ordered_range(inode, offset, len); |
2280 | if (ret) | 2282 | if (ret) |
@@ -2306,13 +2308,18 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2306 | * entire page. | 2308 | * entire page. |
2307 | */ | 2309 | */ |
2308 | if (same_page && len < PAGE_CACHE_SIZE) { | 2310 | if (same_page && len < PAGE_CACHE_SIZE) { |
2309 | if (offset < ino_size) | 2311 | if (offset < ino_size) { |
2312 | truncated_page = true; | ||
2310 | ret = btrfs_truncate_page(inode, offset, len, 0); | 2313 | ret = btrfs_truncate_page(inode, offset, len, 0); |
2314 | } else { | ||
2315 | ret = 0; | ||
2316 | } | ||
2311 | goto out_only_mutex; | 2317 | goto out_only_mutex; |
2312 | } | 2318 | } |
2313 | 2319 | ||
2314 | /* zero back part of the first page */ | 2320 | /* zero back part of the first page */ |
2315 | if (offset < ino_size) { | 2321 | if (offset < ino_size) { |
2322 | truncated_page = true; | ||
2316 | ret = btrfs_truncate_page(inode, offset, 0, 0); | 2323 | ret = btrfs_truncate_page(inode, offset, 0, 0); |
2317 | if (ret) { | 2324 | if (ret) { |
2318 | mutex_unlock(&inode->i_mutex); | 2325 | mutex_unlock(&inode->i_mutex); |
@@ -2348,6 +2355,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2348 | if (!ret) { | 2355 | if (!ret) { |
2349 | /* zero the front end of the last page */ | 2356 | /* zero the front end of the last page */ |
2350 | if (tail_start + tail_len < ino_size) { | 2357 | if (tail_start + tail_len < ino_size) { |
2358 | truncated_page = true; | ||
2351 | ret = btrfs_truncate_page(inode, | 2359 | ret = btrfs_truncate_page(inode, |
2352 | tail_start + tail_len, 0, 1); | 2360 | tail_start + tail_len, 0, 1); |
2353 | if (ret) | 2361 | if (ret) |
@@ -2357,8 +2365,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2357 | } | 2365 | } |
2358 | 2366 | ||
2359 | if (lockend < lockstart) { | 2367 | if (lockend < lockstart) { |
2360 | mutex_unlock(&inode->i_mutex); | 2368 | ret = 0; |
2361 | return 0; | 2369 | goto out_only_mutex; |
2362 | } | 2370 | } |
2363 | 2371 | ||
2364 | while (1) { | 2372 | while (1) { |
@@ -2506,6 +2514,7 @@ out_trans: | |||
2506 | 2514 | ||
2507 | trans->block_rsv = &root->fs_info->trans_block_rsv; | 2515 | trans->block_rsv = &root->fs_info->trans_block_rsv; |
2508 | ret = btrfs_update_inode(trans, root, inode); | 2516 | ret = btrfs_update_inode(trans, root, inode); |
2517 | updated_inode = true; | ||
2509 | btrfs_end_transaction(trans, root); | 2518 | btrfs_end_transaction(trans, root); |
2510 | btrfs_btree_balance_dirty(root); | 2519 | btrfs_btree_balance_dirty(root); |
2511 | out_free: | 2520 | out_free: |
@@ -2515,6 +2524,22 @@ out: | |||
2515 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, | 2524 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart, lockend, |
2516 | &cached_state, GFP_NOFS); | 2525 | &cached_state, GFP_NOFS); |
2517 | out_only_mutex: | 2526 | out_only_mutex: |
2527 | if (!updated_inode && truncated_page && !ret && !err) { | ||
2528 | /* | ||
2529 | * If we only end up zeroing part of a page, we still need to | ||
2530 | * update the inode item, so that all the time fields are | ||
2531 | * updated as well as the necessary btrfs inode in memory fields | ||
2532 | * for detecting, at fsync time, if the inode isn't yet in the | ||
2533 | * log tree or it's there but not up to date. | ||
2534 | */ | ||
2535 | trans = btrfs_start_transaction(root, 1); | ||
2536 | if (IS_ERR(trans)) { | ||
2537 | err = PTR_ERR(trans); | ||
2538 | } else { | ||
2539 | err = btrfs_update_inode(trans, root, inode); | ||
2540 | ret = btrfs_end_transaction(trans, root); | ||
2541 | } | ||
2542 | } | ||
2518 | mutex_unlock(&inode->i_mutex); | 2543 | mutex_unlock(&inode->i_mutex); |
2519 | if (ret && !err) | 2544 | if (ret && !err) |
2520 | err = ret; | 2545 | err = ret; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a85c23dfcddb..da828cf5e8f8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7285,7 +7285,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | |||
7285 | ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && | 7285 | ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && |
7286 | em->block_start != EXTENT_MAP_HOLE)) { | 7286 | em->block_start != EXTENT_MAP_HOLE)) { |
7287 | int type; | 7287 | int type; |
7288 | int ret; | ||
7289 | u64 block_start, orig_start, orig_block_len, ram_bytes; | 7288 | u64 block_start, orig_start, orig_block_len, ram_bytes; |
7290 | 7289 | ||
7291 | if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) | 7290 | if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 534544e08f76..157cc54fc634 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -452,9 +452,7 @@ void btrfs_get_logged_extents(struct inode *inode, | |||
452 | continue; | 452 | continue; |
453 | if (entry_end(ordered) <= start) | 453 | if (entry_end(ordered) <= start) |
454 | break; | 454 | break; |
455 | if (!list_empty(&ordered->log_list)) | 455 | if (test_and_set_bit(BTRFS_ORDERED_LOGGED, &ordered->flags)) |
456 | continue; | ||
457 | if (test_bit(BTRFS_ORDERED_LOGGED, &ordered->flags)) | ||
458 | continue; | 456 | continue; |
459 | list_add(&ordered->log_list, logged_list); | 457 | list_add(&ordered->log_list, logged_list); |
460 | atomic_inc(&ordered->refs); | 458 | atomic_inc(&ordered->refs); |
@@ -511,8 +509,7 @@ void btrfs_wait_logged_extents(struct btrfs_trans_handle *trans, | |||
511 | wait_event(ordered->wait, test_bit(BTRFS_ORDERED_IO_DONE, | 509 | wait_event(ordered->wait, test_bit(BTRFS_ORDERED_IO_DONE, |
512 | &ordered->flags)); | 510 | &ordered->flags)); |
513 | 511 | ||
514 | if (!test_and_set_bit(BTRFS_ORDERED_LOGGED, &ordered->flags)) | 512 | list_add_tail(&ordered->trans_list, &trans->ordered); |
515 | list_add_tail(&ordered->trans_list, &trans->ordered); | ||
516 | spin_lock_irq(&log->log_extents_lock[index]); | 513 | spin_lock_irq(&log->log_extents_lock[index]); |
517 | } | 514 | } |
518 | spin_unlock_irq(&log->log_extents_lock[index]); | 515 | spin_unlock_irq(&log->log_extents_lock[index]); |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index fe5857223515..d6033f540cc7 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -230,6 +230,7 @@ struct pending_dir_move { | |||
230 | u64 parent_ino; | 230 | u64 parent_ino; |
231 | u64 ino; | 231 | u64 ino; |
232 | u64 gen; | 232 | u64 gen; |
233 | bool is_orphan; | ||
233 | struct list_head update_refs; | 234 | struct list_head update_refs; |
234 | }; | 235 | }; |
235 | 236 | ||
@@ -2984,7 +2985,8 @@ static int add_pending_dir_move(struct send_ctx *sctx, | |||
2984 | u64 ino_gen, | 2985 | u64 ino_gen, |
2985 | u64 parent_ino, | 2986 | u64 parent_ino, |
2986 | struct list_head *new_refs, | 2987 | struct list_head *new_refs, |
2987 | struct list_head *deleted_refs) | 2988 | struct list_head *deleted_refs, |
2989 | const bool is_orphan) | ||
2988 | { | 2990 | { |
2989 | struct rb_node **p = &sctx->pending_dir_moves.rb_node; | 2991 | struct rb_node **p = &sctx->pending_dir_moves.rb_node; |
2990 | struct rb_node *parent = NULL; | 2992 | struct rb_node *parent = NULL; |
@@ -2999,6 +3001,7 @@ static int add_pending_dir_move(struct send_ctx *sctx, | |||
2999 | pm->parent_ino = parent_ino; | 3001 | pm->parent_ino = parent_ino; |
3000 | pm->ino = ino; | 3002 | pm->ino = ino; |
3001 | pm->gen = ino_gen; | 3003 | pm->gen = ino_gen; |
3004 | pm->is_orphan = is_orphan; | ||
3002 | INIT_LIST_HEAD(&pm->list); | 3005 | INIT_LIST_HEAD(&pm->list); |
3003 | INIT_LIST_HEAD(&pm->update_refs); | 3006 | INIT_LIST_HEAD(&pm->update_refs); |
3004 | RB_CLEAR_NODE(&pm->node); | 3007 | RB_CLEAR_NODE(&pm->node); |
@@ -3131,16 +3134,20 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm) | |||
3131 | rmdir_ino = dm->rmdir_ino; | 3134 | rmdir_ino = dm->rmdir_ino; |
3132 | free_waiting_dir_move(sctx, dm); | 3135 | free_waiting_dir_move(sctx, dm); |
3133 | 3136 | ||
3134 | ret = get_first_ref(sctx->parent_root, pm->ino, | 3137 | if (pm->is_orphan) { |
3135 | &parent_ino, &parent_gen, name); | 3138 | ret = gen_unique_name(sctx, pm->ino, |
3136 | if (ret < 0) | 3139 | pm->gen, from_path); |
3137 | goto out; | 3140 | } else { |
3138 | 3141 | ret = get_first_ref(sctx->parent_root, pm->ino, | |
3139 | ret = get_cur_path(sctx, parent_ino, parent_gen, | 3142 | &parent_ino, &parent_gen, name); |
3140 | from_path); | 3143 | if (ret < 0) |
3141 | if (ret < 0) | 3144 | goto out; |
3142 | goto out; | 3145 | ret = get_cur_path(sctx, parent_ino, parent_gen, |
3143 | ret = fs_path_add_path(from_path, name); | 3146 | from_path); |
3147 | if (ret < 0) | ||
3148 | goto out; | ||
3149 | ret = fs_path_add_path(from_path, name); | ||
3150 | } | ||
3144 | if (ret < 0) | 3151 | if (ret < 0) |
3145 | goto out; | 3152 | goto out; |
3146 | 3153 | ||
@@ -3150,7 +3157,8 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm) | |||
3150 | LIST_HEAD(deleted_refs); | 3157 | LIST_HEAD(deleted_refs); |
3151 | ASSERT(ancestor > BTRFS_FIRST_FREE_OBJECTID); | 3158 | ASSERT(ancestor > BTRFS_FIRST_FREE_OBJECTID); |
3152 | ret = add_pending_dir_move(sctx, pm->ino, pm->gen, ancestor, | 3159 | ret = add_pending_dir_move(sctx, pm->ino, pm->gen, ancestor, |
3153 | &pm->update_refs, &deleted_refs); | 3160 | &pm->update_refs, &deleted_refs, |
3161 | pm->is_orphan); | ||
3154 | if (ret < 0) | 3162 | if (ret < 0) |
3155 | goto out; | 3163 | goto out; |
3156 | if (rmdir_ino) { | 3164 | if (rmdir_ino) { |
@@ -3283,6 +3291,127 @@ out: | |||
3283 | return ret; | 3291 | return ret; |
3284 | } | 3292 | } |
3285 | 3293 | ||
3294 | /* | ||
3295 | * We might need to delay a directory rename even when no ancestor directory | ||
3296 | * (in the send root) with a higher inode number than ours (sctx->cur_ino) was | ||
3297 | * renamed. This happens when we rename a directory to the old name (the name | ||
3298 | * in the parent root) of some other unrelated directory that got its rename | ||
3299 | * delayed due to some ancestor with higher number that got renamed. | ||
3300 | * | ||
3301 | * Example: | ||
3302 | * | ||
3303 | * Parent snapshot: | ||
3304 | * . (ino 256) | ||
3305 | * |---- a/ (ino 257) | ||
3306 | * | |---- file (ino 260) | ||
3307 | * | | ||
3308 | * |---- b/ (ino 258) | ||
3309 | * |---- c/ (ino 259) | ||
3310 | * | ||
3311 | * Send snapshot: | ||
3312 | * . (ino 256) | ||
3313 | * |---- a/ (ino 258) | ||
3314 | * |---- x/ (ino 259) | ||
3315 | * |---- y/ (ino 257) | ||
3316 | * |----- file (ino 260) | ||
3317 | * | ||
3318 | * Here we can not rename 258 from 'b' to 'a' without the rename of inode 257 | ||
3319 | * from 'a' to 'x/y' happening first, which in turn depends on the rename of | ||
3320 | * inode 259 from 'c' to 'x'. So the order of rename commands the send stream | ||
3321 | * must issue is: | ||
3322 | * | ||
3323 | * 1 - rename 259 from 'c' to 'x' | ||
3324 | * 2 - rename 257 from 'a' to 'x/y' | ||
3325 | * 3 - rename 258 from 'b' to 'a' | ||
3326 | * | ||
3327 | * Returns 1 if the rename of sctx->cur_ino needs to be delayed, 0 if it can | ||
3328 | * be done right away and < 0 on error. | ||
3329 | */ | ||
3330 | static int wait_for_dest_dir_move(struct send_ctx *sctx, | ||
3331 | struct recorded_ref *parent_ref, | ||
3332 | const bool is_orphan) | ||
3333 | { | ||
3334 | struct btrfs_path *path; | ||
3335 | struct btrfs_key key; | ||
3336 | struct btrfs_key di_key; | ||
3337 | struct btrfs_dir_item *di; | ||
3338 | u64 left_gen; | ||
3339 | u64 right_gen; | ||
3340 | int ret = 0; | ||
3341 | |||
3342 | if (RB_EMPTY_ROOT(&sctx->waiting_dir_moves)) | ||
3343 | return 0; | ||
3344 | |||
3345 | path = alloc_path_for_send(); | ||
3346 | if (!path) | ||
3347 | return -ENOMEM; | ||
3348 | |||
3349 | key.objectid = parent_ref->dir; | ||
3350 | key.type = BTRFS_DIR_ITEM_KEY; | ||
3351 | key.offset = btrfs_name_hash(parent_ref->name, parent_ref->name_len); | ||
3352 | |||
3353 | ret = btrfs_search_slot(NULL, sctx->parent_root, &key, path, 0, 0); | ||
3354 | if (ret < 0) { | ||
3355 | goto out; | ||
3356 | } else if (ret > 0) { | ||
3357 | ret = 0; | ||
3358 | goto out; | ||
3359 | } | ||
3360 | |||
3361 | di = btrfs_match_dir_item_name(sctx->parent_root, path, | ||
3362 | parent_ref->name, parent_ref->name_len); | ||
3363 | if (!di) { | ||
3364 | ret = 0; | ||
3365 | goto out; | ||
3366 | } | ||
3367 | /* | ||
3368 | * di_key.objectid has the number of the inode that has a dentry in the | ||
3369 | * parent directory with the same name that sctx->cur_ino is being | ||
3370 | * renamed to. We need to check if that inode is in the send root as | ||
3371 | * well and if it is currently marked as an inode with a pending rename, | ||
3372 | * if it is, we need to delay the rename of sctx->cur_ino as well, so | ||
3373 | * that it happens after that other inode is renamed. | ||
3374 | */ | ||
3375 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, &di_key); | ||
3376 | if (di_key.type != BTRFS_INODE_ITEM_KEY) { | ||
3377 | ret = 0; | ||
3378 | goto out; | ||
3379 | } | ||
3380 | |||
3381 | ret = get_inode_info(sctx->parent_root, di_key.objectid, NULL, | ||
3382 | &left_gen, NULL, NULL, NULL, NULL); | ||
3383 | if (ret < 0) | ||
3384 | goto out; | ||
3385 | ret = get_inode_info(sctx->send_root, di_key.objectid, NULL, | ||
3386 | &right_gen, NULL, NULL, NULL, NULL); | ||
3387 | if (ret < 0) { | ||
3388 | if (ret == -ENOENT) | ||
3389 | ret = 0; | ||
3390 | goto out; | ||
3391 | } | ||
3392 | |||
3393 | /* Different inode, no need to delay the rename of sctx->cur_ino */ | ||
3394 | if (right_gen != left_gen) { | ||
3395 | ret = 0; | ||
3396 | goto out; | ||
3397 | } | ||
3398 | |||
3399 | if (is_waiting_for_move(sctx, di_key.objectid)) { | ||
3400 | ret = add_pending_dir_move(sctx, | ||
3401 | sctx->cur_ino, | ||
3402 | sctx->cur_inode_gen, | ||
3403 | di_key.objectid, | ||
3404 | &sctx->new_refs, | ||
3405 | &sctx->deleted_refs, | ||
3406 | is_orphan); | ||
3407 | if (!ret) | ||
3408 | ret = 1; | ||
3409 | } | ||
3410 | out: | ||
3411 | btrfs_free_path(path); | ||
3412 | return ret; | ||
3413 | } | ||
3414 | |||
3286 | static int wait_for_parent_move(struct send_ctx *sctx, | 3415 | static int wait_for_parent_move(struct send_ctx *sctx, |
3287 | struct recorded_ref *parent_ref) | 3416 | struct recorded_ref *parent_ref) |
3288 | { | 3417 | { |
@@ -3349,7 +3478,8 @@ out: | |||
3349 | sctx->cur_inode_gen, | 3478 | sctx->cur_inode_gen, |
3350 | ino, | 3479 | ino, |
3351 | &sctx->new_refs, | 3480 | &sctx->new_refs, |
3352 | &sctx->deleted_refs); | 3481 | &sctx->deleted_refs, |
3482 | false); | ||
3353 | if (!ret) | 3483 | if (!ret) |
3354 | ret = 1; | 3484 | ret = 1; |
3355 | } | 3485 | } |
@@ -3372,6 +3502,7 @@ static int process_recorded_refs(struct send_ctx *sctx, int *pending_move) | |||
3372 | int did_overwrite = 0; | 3502 | int did_overwrite = 0; |
3373 | int is_orphan = 0; | 3503 | int is_orphan = 0; |
3374 | u64 last_dir_ino_rm = 0; | 3504 | u64 last_dir_ino_rm = 0; |
3505 | bool can_rename = true; | ||
3375 | 3506 | ||
3376 | verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); | 3507 | verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); |
3377 | 3508 | ||
@@ -3490,12 +3621,22 @@ verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); | |||
3490 | } | 3621 | } |
3491 | } | 3622 | } |
3492 | 3623 | ||
3624 | if (S_ISDIR(sctx->cur_inode_mode) && sctx->parent_root) { | ||
3625 | ret = wait_for_dest_dir_move(sctx, cur, is_orphan); | ||
3626 | if (ret < 0) | ||
3627 | goto out; | ||
3628 | if (ret == 1) { | ||
3629 | can_rename = false; | ||
3630 | *pending_move = 1; | ||
3631 | } | ||
3632 | } | ||
3633 | |||
3493 | /* | 3634 | /* |
3494 | * link/move the ref to the new place. If we have an orphan | 3635 | * link/move the ref to the new place. If we have an orphan |
3495 | * inode, move it and update valid_path. If not, link or move | 3636 | * inode, move it and update valid_path. If not, link or move |
3496 | * it depending on the inode mode. | 3637 | * it depending on the inode mode. |
3497 | */ | 3638 | */ |
3498 | if (is_orphan) { | 3639 | if (is_orphan && can_rename) { |
3499 | ret = send_rename(sctx, valid_path, cur->full_path); | 3640 | ret = send_rename(sctx, valid_path, cur->full_path); |
3500 | if (ret < 0) | 3641 | if (ret < 0) |
3501 | goto out; | 3642 | goto out; |
@@ -3503,7 +3644,7 @@ verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); | |||
3503 | ret = fs_path_copy(valid_path, cur->full_path); | 3644 | ret = fs_path_copy(valid_path, cur->full_path); |
3504 | if (ret < 0) | 3645 | if (ret < 0) |
3505 | goto out; | 3646 | goto out; |
3506 | } else { | 3647 | } else if (can_rename) { |
3507 | if (S_ISDIR(sctx->cur_inode_mode)) { | 3648 | if (S_ISDIR(sctx->cur_inode_mode)) { |
3508 | /* | 3649 | /* |
3509 | * Dirs can't be linked, so move it. For moved | 3650 | * Dirs can't be linked, so move it. For moved |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 7e80f32550a6..88e51aded6bd 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1052,9 +1052,6 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans, | |||
1052 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | 1052 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); |
1053 | if (ret) | 1053 | if (ret) |
1054 | return ret; | 1054 | return ret; |
1055 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | ||
1056 | if (ret) | ||
1057 | return ret; | ||
1058 | } | 1055 | } |
1059 | 1056 | ||
1060 | return 0; | 1057 | return 0; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 9a37f8b39bae..c5b8ba37f88e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -1012,7 +1012,7 @@ again: | |||
1012 | base = btrfs_item_ptr_offset(leaf, path->slots[0]); | 1012 | base = btrfs_item_ptr_offset(leaf, path->slots[0]); |
1013 | 1013 | ||
1014 | while (cur_offset < item_size) { | 1014 | while (cur_offset < item_size) { |
1015 | extref = (struct btrfs_inode_extref *)base + cur_offset; | 1015 | extref = (struct btrfs_inode_extref *)(base + cur_offset); |
1016 | 1016 | ||
1017 | victim_name_len = btrfs_inode_extref_name_len(leaf, extref); | 1017 | victim_name_len = btrfs_inode_extref_name_len(leaf, extref); |
1018 | 1018 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index cd4d1315aaa9..8222f6f74147 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -4903,10 +4903,17 @@ static void sort_parity_stripes(struct btrfs_bio *bbio, int num_stripes) | |||
4903 | static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes) | 4903 | static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes) |
4904 | { | 4904 | { |
4905 | struct btrfs_bio *bbio = kzalloc( | 4905 | struct btrfs_bio *bbio = kzalloc( |
4906 | /* the size of the btrfs_bio */ | ||
4906 | sizeof(struct btrfs_bio) + | 4907 | sizeof(struct btrfs_bio) + |
4908 | /* plus the variable array for the stripes */ | ||
4907 | sizeof(struct btrfs_bio_stripe) * (total_stripes) + | 4909 | sizeof(struct btrfs_bio_stripe) * (total_stripes) + |
4910 | /* plus the variable array for the tgt dev */ | ||
4908 | sizeof(int) * (real_stripes) + | 4911 | sizeof(int) * (real_stripes) + |
4909 | sizeof(u64) * (real_stripes), | 4912 | /* |
4913 | * plus the raid_map, which includes both the tgt dev | ||
4914 | * and the stripes | ||
4915 | */ | ||
4916 | sizeof(u64) * (total_stripes), | ||
4910 | GFP_NOFS); | 4917 | GFP_NOFS); |
4911 | if (!bbio) | 4918 | if (!bbio) |
4912 | return NULL; | 4919 | return NULL; |
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index 47b19465f0dc..883b93623bc5 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -111,6 +111,8 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
111 | name, name_len, -1); | 111 | name, name_len, -1); |
112 | if (!di && (flags & XATTR_REPLACE)) | 112 | if (!di && (flags & XATTR_REPLACE)) |
113 | ret = -ENODATA; | 113 | ret = -ENODATA; |
114 | else if (IS_ERR(di)) | ||
115 | ret = PTR_ERR(di); | ||
114 | else if (di) | 116 | else if (di) |
115 | ret = btrfs_delete_one_dir_name(trans, root, path, di); | 117 | ret = btrfs_delete_one_dir_name(trans, root, path, di); |
116 | goto out; | 118 | goto out; |
@@ -127,10 +129,12 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
127 | ASSERT(mutex_is_locked(&inode->i_mutex)); | 129 | ASSERT(mutex_is_locked(&inode->i_mutex)); |
128 | di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), | 130 | di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), |
129 | name, name_len, 0); | 131 | name, name_len, 0); |
130 | if (!di) { | 132 | if (!di) |
131 | ret = -ENODATA; | 133 | ret = -ENODATA; |
134 | else if (IS_ERR(di)) | ||
135 | ret = PTR_ERR(di); | ||
136 | if (ret) | ||
132 | goto out; | 137 | goto out; |
133 | } | ||
134 | btrfs_release_path(path); | 138 | btrfs_release_path(path); |
135 | di = NULL; | 139 | di = NULL; |
136 | } | 140 | } |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 90d1882b306f..5ba029e627cc 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -124,7 +124,7 @@ ecryptfs_get_key_payload_data(struct key *key) | |||
124 | } | 124 | } |
125 | 125 | ||
126 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 | 126 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 |
127 | #define ECRYPTFS_MAX_CIPHER_NAME_SIZE 32 | 127 | #define ECRYPTFS_MAX_CIPHER_NAME_SIZE 31 |
128 | #define ECRYPTFS_MAX_NUM_ENC_KEYS 64 | 128 | #define ECRYPTFS_MAX_NUM_ENC_KEYS 64 |
129 | #define ECRYPTFS_MAX_IV_BYTES 16 /* 128 bits */ | 129 | #define ECRYPTFS_MAX_IV_BYTES 16 /* 128 bits */ |
130 | #define ECRYPTFS_SALT_BYTES 2 | 130 | #define ECRYPTFS_SALT_BYTES 2 |
@@ -237,7 +237,7 @@ struct ecryptfs_crypt_stat { | |||
237 | struct crypto_ablkcipher *tfm; | 237 | struct crypto_ablkcipher *tfm; |
238 | struct crypto_hash *hash_tfm; /* Crypto context for generating | 238 | struct crypto_hash *hash_tfm; /* Crypto context for generating |
239 | * the initialization vectors */ | 239 | * the initialization vectors */ |
240 | unsigned char cipher[ECRYPTFS_MAX_CIPHER_NAME_SIZE]; | 240 | unsigned char cipher[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; |
241 | unsigned char key[ECRYPTFS_MAX_KEY_BYTES]; | 241 | unsigned char key[ECRYPTFS_MAX_KEY_BYTES]; |
242 | unsigned char root_iv[ECRYPTFS_MAX_IV_BYTES]; | 242 | unsigned char root_iv[ECRYPTFS_MAX_IV_BYTES]; |
243 | struct list_head keysig_list; | 243 | struct list_head keysig_list; |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index b07731e68c0b..fd39bad6f1bd 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -303,9 +303,22 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
303 | struct file *lower_file = ecryptfs_file_to_lower(file); | 303 | struct file *lower_file = ecryptfs_file_to_lower(file); |
304 | long rc = -ENOTTY; | 304 | long rc = -ENOTTY; |
305 | 305 | ||
306 | if (lower_file->f_op->unlocked_ioctl) | 306 | if (!lower_file->f_op->unlocked_ioctl) |
307 | return rc; | ||
308 | |||
309 | switch (cmd) { | ||
310 | case FITRIM: | ||
311 | case FS_IOC_GETFLAGS: | ||
312 | case FS_IOC_SETFLAGS: | ||
313 | case FS_IOC_GETVERSION: | ||
314 | case FS_IOC_SETVERSION: | ||
307 | rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); | 315 | rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); |
308 | return rc; | 316 | fsstack_copy_attr_all(file_inode(file), file_inode(lower_file)); |
317 | |||
318 | return rc; | ||
319 | default: | ||
320 | return rc; | ||
321 | } | ||
309 | } | 322 | } |
310 | 323 | ||
311 | #ifdef CONFIG_COMPAT | 324 | #ifdef CONFIG_COMPAT |
@@ -315,9 +328,22 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
315 | struct file *lower_file = ecryptfs_file_to_lower(file); | 328 | struct file *lower_file = ecryptfs_file_to_lower(file); |
316 | long rc = -ENOIOCTLCMD; | 329 | long rc = -ENOIOCTLCMD; |
317 | 330 | ||
318 | if (lower_file->f_op->compat_ioctl) | 331 | if (!lower_file->f_op->compat_ioctl) |
332 | return rc; | ||
333 | |||
334 | switch (cmd) { | ||
335 | case FITRIM: | ||
336 | case FS_IOC32_GETFLAGS: | ||
337 | case FS_IOC32_SETFLAGS: | ||
338 | case FS_IOC32_GETVERSION: | ||
339 | case FS_IOC32_SETVERSION: | ||
319 | rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); | 340 | rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); |
320 | return rc; | 341 | fsstack_copy_attr_all(file_inode(file), file_inode(lower_file)); |
342 | |||
343 | return rc; | ||
344 | default: | ||
345 | return rc; | ||
346 | } | ||
321 | } | 347 | } |
322 | #endif | 348 | #endif |
323 | 349 | ||
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 917bd5c9776a..6bd67e2011f0 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
@@ -891,7 +891,7 @@ struct ecryptfs_parse_tag_70_packet_silly_stack { | |||
891 | struct blkcipher_desc desc; | 891 | struct blkcipher_desc desc; |
892 | char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; | 892 | char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; |
893 | char iv[ECRYPTFS_MAX_IV_BYTES]; | 893 | char iv[ECRYPTFS_MAX_IV_BYTES]; |
894 | char cipher_string[ECRYPTFS_MAX_CIPHER_NAME_SIZE]; | 894 | char cipher_string[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; |
895 | }; | 895 | }; |
896 | 896 | ||
897 | /** | 897 | /** |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 1895d60f4122..c095d3264259 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -407,7 +407,7 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options, | |||
407 | if (!cipher_name_set) { | 407 | if (!cipher_name_set) { |
408 | int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); | 408 | int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); |
409 | 409 | ||
410 | BUG_ON(cipher_name_len >= ECRYPTFS_MAX_CIPHER_NAME_SIZE); | 410 | BUG_ON(cipher_name_len > ECRYPTFS_MAX_CIPHER_NAME_SIZE); |
411 | strcpy(mount_crypt_stat->global_default_cipher_name, | 411 | strcpy(mount_crypt_stat->global_default_cipher_name, |
412 | ECRYPTFS_DEFAULT_CIPHER); | 412 | ECRYPTFS_DEFAULT_CIPHER); |
413 | } | 413 | } |
diff --git a/fs/locks.c b/fs/locks.c index 365c82e1b3a9..f1bad681fc1c 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1665,7 +1665,8 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr | |||
1665 | } | 1665 | } |
1666 | 1666 | ||
1667 | if (my_fl != NULL) { | 1667 | if (my_fl != NULL) { |
1668 | error = lease->fl_lmops->lm_change(my_fl, arg, &dispose); | 1668 | lease = my_fl; |
1669 | error = lease->fl_lmops->lm_change(lease, arg, &dispose); | ||
1669 | if (error) | 1670 | if (error) |
1670 | goto out; | 1671 | goto out; |
1671 | goto out_setup; | 1672 | goto out_setup; |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index f9f4845db989..19874151e95c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -433,7 +433,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat | |||
433 | 433 | ||
434 | static bool nfs_client_init_is_complete(const struct nfs_client *clp) | 434 | static bool nfs_client_init_is_complete(const struct nfs_client *clp) |
435 | { | 435 | { |
436 | return clp->cl_cons_state != NFS_CS_INITING; | 436 | return clp->cl_cons_state <= NFS_CS_READY; |
437 | } | 437 | } |
438 | 438 | ||
439 | int nfs_wait_client_init_complete(const struct nfs_client *clp) | 439 | int nfs_wait_client_init_complete(const struct nfs_client *clp) |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index a1f0685b42ff..a6ad68865880 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -181,8 +181,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, | |||
181 | clear_bit(NFS_DELEGATION_NEED_RECLAIM, | 181 | clear_bit(NFS_DELEGATION_NEED_RECLAIM, |
182 | &delegation->flags); | 182 | &delegation->flags); |
183 | spin_unlock(&delegation->lock); | 183 | spin_unlock(&delegation->lock); |
184 | put_rpccred(oldcred); | ||
185 | rcu_read_unlock(); | 184 | rcu_read_unlock(); |
185 | put_rpccred(oldcred); | ||
186 | trace_nfs4_reclaim_delegation(inode, res->delegation_type); | 186 | trace_nfs4_reclaim_delegation(inode, res->delegation_type); |
187 | } else { | 187 | } else { |
188 | /* We appear to have raced with a delegation return. */ | 188 | /* We appear to have raced with a delegation return. */ |
@@ -370,7 +370,10 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
370 | delegation = NULL; | 370 | delegation = NULL; |
371 | goto out; | 371 | goto out; |
372 | } | 372 | } |
373 | freeme = nfs_detach_delegation_locked(nfsi, | 373 | if (test_and_set_bit(NFS_DELEGATION_RETURNING, |
374 | &old_delegation->flags)) | ||
375 | goto out; | ||
376 | freeme = nfs_detach_delegation_locked(nfsi, | ||
374 | old_delegation, clp); | 377 | old_delegation, clp); |
375 | if (freeme == NULL) | 378 | if (freeme == NULL) |
376 | goto out; | 379 | goto out; |
@@ -433,6 +436,8 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation) | |||
433 | { | 436 | { |
434 | bool ret = false; | 437 | bool ret = false; |
435 | 438 | ||
439 | if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) | ||
440 | goto out; | ||
436 | if (test_and_clear_bit(NFS_DELEGATION_RETURN, &delegation->flags)) | 441 | if (test_and_clear_bit(NFS_DELEGATION_RETURN, &delegation->flags)) |
437 | ret = true; | 442 | ret = true; |
438 | if (test_and_clear_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags) && !ret) { | 443 | if (test_and_clear_bit(NFS_DELEGATION_RETURN_IF_CLOSED, &delegation->flags) && !ret) { |
@@ -444,6 +449,7 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation) | |||
444 | ret = true; | 449 | ret = true; |
445 | spin_unlock(&delegation->lock); | 450 | spin_unlock(&delegation->lock); |
446 | } | 451 | } |
452 | out: | ||
447 | return ret; | 453 | return ret; |
448 | } | 454 | } |
449 | 455 | ||
@@ -471,14 +477,20 @@ restart: | |||
471 | super_list) { | 477 | super_list) { |
472 | if (!nfs_delegation_need_return(delegation)) | 478 | if (!nfs_delegation_need_return(delegation)) |
473 | continue; | 479 | continue; |
474 | inode = nfs_delegation_grab_inode(delegation); | 480 | if (!nfs_sb_active(server->super)) |
475 | if (inode == NULL) | ||
476 | continue; | 481 | continue; |
482 | inode = nfs_delegation_grab_inode(delegation); | ||
483 | if (inode == NULL) { | ||
484 | rcu_read_unlock(); | ||
485 | nfs_sb_deactive(server->super); | ||
486 | goto restart; | ||
487 | } | ||
477 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); | 488 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); |
478 | rcu_read_unlock(); | 489 | rcu_read_unlock(); |
479 | 490 | ||
480 | err = nfs_end_delegation_return(inode, delegation, 0); | 491 | err = nfs_end_delegation_return(inode, delegation, 0); |
481 | iput(inode); | 492 | iput(inode); |
493 | nfs_sb_deactive(server->super); | ||
482 | if (!err) | 494 | if (!err) |
483 | goto restart; | 495 | goto restart; |
484 | set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); | 496 | set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); |
@@ -809,19 +821,30 @@ restart: | |||
809 | list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { | 821 | list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) { |
810 | list_for_each_entry_rcu(delegation, &server->delegations, | 822 | list_for_each_entry_rcu(delegation, &server->delegations, |
811 | super_list) { | 823 | super_list) { |
824 | if (test_bit(NFS_DELEGATION_RETURNING, | ||
825 | &delegation->flags)) | ||
826 | continue; | ||
812 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, | 827 | if (test_bit(NFS_DELEGATION_NEED_RECLAIM, |
813 | &delegation->flags) == 0) | 828 | &delegation->flags) == 0) |
814 | continue; | 829 | continue; |
815 | inode = nfs_delegation_grab_inode(delegation); | 830 | if (!nfs_sb_active(server->super)) |
816 | if (inode == NULL) | ||
817 | continue; | 831 | continue; |
818 | delegation = nfs_detach_delegation(NFS_I(inode), | 832 | inode = nfs_delegation_grab_inode(delegation); |
819 | delegation, server); | 833 | if (inode == NULL) { |
834 | rcu_read_unlock(); | ||
835 | nfs_sb_deactive(server->super); | ||
836 | goto restart; | ||
837 | } | ||
838 | delegation = nfs_start_delegation_return_locked(NFS_I(inode)); | ||
820 | rcu_read_unlock(); | 839 | rcu_read_unlock(); |
821 | 840 | if (delegation != NULL) { | |
822 | if (delegation != NULL) | 841 | delegation = nfs_detach_delegation(NFS_I(inode), |
823 | nfs_free_delegation(delegation); | 842 | delegation, server); |
843 | if (delegation != NULL) | ||
844 | nfs_free_delegation(delegation); | ||
845 | } | ||
824 | iput(inode); | 846 | iput(inode); |
847 | nfs_sb_deactive(server->super); | ||
825 | goto restart; | 848 | goto restart; |
826 | } | 849 | } |
827 | } | 850 | } |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 9b0c55cb2a2e..c19e16f0b2d0 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -408,14 +408,22 @@ static int xdr_decode(nfs_readdir_descriptor_t *desc, | |||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
410 | 410 | ||
411 | /* Match file and dirent using either filehandle or fileid | ||
412 | * Note: caller is responsible for checking the fsid | ||
413 | */ | ||
411 | static | 414 | static |
412 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) | 415 | int nfs_same_file(struct dentry *dentry, struct nfs_entry *entry) |
413 | { | 416 | { |
417 | struct nfs_inode *nfsi; | ||
418 | |||
414 | if (dentry->d_inode == NULL) | 419 | if (dentry->d_inode == NULL) |
415 | goto different; | 420 | goto different; |
416 | if (nfs_compare_fh(entry->fh, NFS_FH(dentry->d_inode)) != 0) | 421 | |
417 | goto different; | 422 | nfsi = NFS_I(dentry->d_inode); |
418 | return 1; | 423 | if (entry->fattr->fileid == nfsi->fileid) |
424 | return 1; | ||
425 | if (nfs_compare_fh(entry->fh, &nfsi->fh) == 0) | ||
426 | return 1; | ||
419 | different: | 427 | different: |
420 | return 0; | 428 | return 0; |
421 | } | 429 | } |
@@ -469,6 +477,10 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
469 | struct inode *inode; | 477 | struct inode *inode; |
470 | int status; | 478 | int status; |
471 | 479 | ||
480 | if (!(entry->fattr->valid & NFS_ATTR_FATTR_FILEID)) | ||
481 | return; | ||
482 | if (!(entry->fattr->valid & NFS_ATTR_FATTR_FSID)) | ||
483 | return; | ||
472 | if (filename.name[0] == '.') { | 484 | if (filename.name[0] == '.') { |
473 | if (filename.len == 1) | 485 | if (filename.len == 1) |
474 | return; | 486 | return; |
@@ -479,6 +491,10 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry) | |||
479 | 491 | ||
480 | dentry = d_lookup(parent, &filename); | 492 | dentry = d_lookup(parent, &filename); |
481 | if (dentry != NULL) { | 493 | if (dentry != NULL) { |
494 | /* Is there a mountpoint here? If so, just exit */ | ||
495 | if (!nfs_fsid_equal(&NFS_SB(dentry->d_sb)->fsid, | ||
496 | &entry->fattr->fsid)) | ||
497 | goto out; | ||
482 | if (nfs_same_file(dentry, entry)) { | 498 | if (nfs_same_file(dentry, entry)) { |
483 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 499 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
484 | status = nfs_refresh_inode(dentry->d_inode, entry->fattr); | 500 | status = nfs_refresh_inode(dentry->d_inode, entry->fattr); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 94712fc781fa..e679d24c39d3 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -178,7 +178,7 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to) | |||
178 | iocb->ki_filp, | 178 | iocb->ki_filp, |
179 | iov_iter_count(to), (unsigned long) iocb->ki_pos); | 179 | iov_iter_count(to), (unsigned long) iocb->ki_pos); |
180 | 180 | ||
181 | result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); | 181 | result = nfs_revalidate_mapping_protected(inode, iocb->ki_filp->f_mapping); |
182 | if (!result) { | 182 | if (!result) { |
183 | result = generic_file_read_iter(iocb, to); | 183 | result = generic_file_read_iter(iocb, to); |
184 | if (result > 0) | 184 | if (result > 0) |
@@ -199,7 +199,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos, | |||
199 | dprintk("NFS: splice_read(%pD2, %lu@%Lu)\n", | 199 | dprintk("NFS: splice_read(%pD2, %lu@%Lu)\n", |
200 | filp, (unsigned long) count, (unsigned long long) *ppos); | 200 | filp, (unsigned long) count, (unsigned long long) *ppos); |
201 | 201 | ||
202 | res = nfs_revalidate_mapping(inode, filp->f_mapping); | 202 | res = nfs_revalidate_mapping_protected(inode, filp->f_mapping); |
203 | if (!res) { | 203 | if (!res) { |
204 | res = generic_file_splice_read(filp, ppos, pipe, count, flags); | 204 | res = generic_file_splice_read(filp, ppos, pipe, count, flags); |
205 | if (res > 0) | 205 | if (res > 0) |
@@ -372,6 +372,10 @@ start: | |||
372 | nfs_wait_bit_killable, TASK_KILLABLE); | 372 | nfs_wait_bit_killable, TASK_KILLABLE); |
373 | if (ret) | 373 | if (ret) |
374 | return ret; | 374 | return ret; |
375 | /* | ||
376 | * Wait for O_DIRECT to complete | ||
377 | */ | ||
378 | nfs_inode_dio_wait(mapping->host); | ||
375 | 379 | ||
376 | page = grab_cache_page_write_begin(mapping, index, flags); | 380 | page = grab_cache_page_write_begin(mapping, index, flags); |
377 | if (!page) | 381 | if (!page) |
@@ -619,6 +623,9 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
619 | /* make sure the cache has finished storing the page */ | 623 | /* make sure the cache has finished storing the page */ |
620 | nfs_fscache_wait_on_page_write(NFS_I(inode), page); | 624 | nfs_fscache_wait_on_page_write(NFS_I(inode), page); |
621 | 625 | ||
626 | wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING, | ||
627 | nfs_wait_bit_killable, TASK_KILLABLE); | ||
628 | |||
622 | lock_page(page); | 629 | lock_page(page); |
623 | mapping = page_file_mapping(page); | 630 | mapping = page_file_mapping(page); |
624 | if (mapping != inode->i_mapping) | 631 | if (mapping != inode->i_mapping) |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 83107be3dd01..d42dff6d5e98 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -556,6 +556,7 @@ EXPORT_SYMBOL_GPL(nfs_setattr); | |||
556 | * This is a copy of the common vmtruncate, but with the locking | 556 | * This is a copy of the common vmtruncate, but with the locking |
557 | * corrected to take into account the fact that NFS requires | 557 | * corrected to take into account the fact that NFS requires |
558 | * inode->i_size to be updated under the inode->i_lock. | 558 | * inode->i_size to be updated under the inode->i_lock. |
559 | * Note: must be called with inode->i_lock held! | ||
559 | */ | 560 | */ |
560 | static int nfs_vmtruncate(struct inode * inode, loff_t offset) | 561 | static int nfs_vmtruncate(struct inode * inode, loff_t offset) |
561 | { | 562 | { |
@@ -565,14 +566,14 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset) | |||
565 | if (err) | 566 | if (err) |
566 | goto out; | 567 | goto out; |
567 | 568 | ||
568 | spin_lock(&inode->i_lock); | ||
569 | i_size_write(inode, offset); | 569 | i_size_write(inode, offset); |
570 | /* Optimisation */ | 570 | /* Optimisation */ |
571 | if (offset == 0) | 571 | if (offset == 0) |
572 | NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_DATA; | 572 | NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_DATA; |
573 | spin_unlock(&inode->i_lock); | ||
574 | 573 | ||
574 | spin_unlock(&inode->i_lock); | ||
575 | truncate_pagecache(inode, offset); | 575 | truncate_pagecache(inode, offset); |
576 | spin_lock(&inode->i_lock); | ||
576 | out: | 577 | out: |
577 | return err; | 578 | return err; |
578 | } | 579 | } |
@@ -585,10 +586,15 @@ out: | |||
585 | * Note: we do this in the *proc.c in order to ensure that | 586 | * Note: we do this in the *proc.c in order to ensure that |
586 | * it works for things like exclusive creates too. | 587 | * it works for things like exclusive creates too. |
587 | */ | 588 | */ |
588 | void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) | 589 | void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, |
590 | struct nfs_fattr *fattr) | ||
589 | { | 591 | { |
592 | /* Barrier: bump the attribute generation count. */ | ||
593 | nfs_fattr_set_barrier(fattr); | ||
594 | |||
595 | spin_lock(&inode->i_lock); | ||
596 | NFS_I(inode)->attr_gencount = fattr->gencount; | ||
590 | if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) { | 597 | if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) { |
591 | spin_lock(&inode->i_lock); | ||
592 | if ((attr->ia_valid & ATTR_MODE) != 0) { | 598 | if ((attr->ia_valid & ATTR_MODE) != 0) { |
593 | int mode = attr->ia_mode & S_IALLUGO; | 599 | int mode = attr->ia_mode & S_IALLUGO; |
594 | mode |= inode->i_mode & ~S_IALLUGO; | 600 | mode |= inode->i_mode & ~S_IALLUGO; |
@@ -600,12 +606,13 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr) | |||
600 | inode->i_gid = attr->ia_gid; | 606 | inode->i_gid = attr->ia_gid; |
601 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ACCESS | 607 | nfs_set_cache_invalid(inode, NFS_INO_INVALID_ACCESS |
602 | | NFS_INO_INVALID_ACL); | 608 | | NFS_INO_INVALID_ACL); |
603 | spin_unlock(&inode->i_lock); | ||
604 | } | 609 | } |
605 | if ((attr->ia_valid & ATTR_SIZE) != 0) { | 610 | if ((attr->ia_valid & ATTR_SIZE) != 0) { |
606 | nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC); | 611 | nfs_inc_stats(inode, NFSIOS_SETATTRTRUNC); |
607 | nfs_vmtruncate(inode, attr->ia_size); | 612 | nfs_vmtruncate(inode, attr->ia_size); |
608 | } | 613 | } |
614 | nfs_update_inode(inode, fattr); | ||
615 | spin_unlock(&inode->i_lock); | ||
609 | } | 616 | } |
610 | EXPORT_SYMBOL_GPL(nfs_setattr_update_inode); | 617 | EXPORT_SYMBOL_GPL(nfs_setattr_update_inode); |
611 | 618 | ||
@@ -1028,6 +1035,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map | |||
1028 | 1035 | ||
1029 | if (mapping->nrpages != 0) { | 1036 | if (mapping->nrpages != 0) { |
1030 | if (S_ISREG(inode->i_mode)) { | 1037 | if (S_ISREG(inode->i_mode)) { |
1038 | unmap_mapping_range(mapping, 0, 0, 0); | ||
1031 | ret = nfs_sync_mapping(mapping); | 1039 | ret = nfs_sync_mapping(mapping); |
1032 | if (ret < 0) | 1040 | if (ret < 0) |
1033 | return ret; | 1041 | return ret; |
@@ -1060,11 +1068,14 @@ static bool nfs_mapping_need_revalidate_inode(struct inode *inode) | |||
1060 | } | 1068 | } |
1061 | 1069 | ||
1062 | /** | 1070 | /** |
1063 | * nfs_revalidate_mapping - Revalidate the pagecache | 1071 | * __nfs_revalidate_mapping - Revalidate the pagecache |
1064 | * @inode - pointer to host inode | 1072 | * @inode - pointer to host inode |
1065 | * @mapping - pointer to mapping | 1073 | * @mapping - pointer to mapping |
1074 | * @may_lock - take inode->i_mutex? | ||
1066 | */ | 1075 | */ |
1067 | int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | 1076 | static int __nfs_revalidate_mapping(struct inode *inode, |
1077 | struct address_space *mapping, | ||
1078 | bool may_lock) | ||
1068 | { | 1079 | { |
1069 | struct nfs_inode *nfsi = NFS_I(inode); | 1080 | struct nfs_inode *nfsi = NFS_I(inode); |
1070 | unsigned long *bitlock = &nfsi->flags; | 1081 | unsigned long *bitlock = &nfsi->flags; |
@@ -1113,7 +1124,12 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
1113 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; | 1124 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; |
1114 | spin_unlock(&inode->i_lock); | 1125 | spin_unlock(&inode->i_lock); |
1115 | trace_nfs_invalidate_mapping_enter(inode); | 1126 | trace_nfs_invalidate_mapping_enter(inode); |
1116 | ret = nfs_invalidate_mapping(inode, mapping); | 1127 | if (may_lock) { |
1128 | mutex_lock(&inode->i_mutex); | ||
1129 | ret = nfs_invalidate_mapping(inode, mapping); | ||
1130 | mutex_unlock(&inode->i_mutex); | ||
1131 | } else | ||
1132 | ret = nfs_invalidate_mapping(inode, mapping); | ||
1117 | trace_nfs_invalidate_mapping_exit(inode, ret); | 1133 | trace_nfs_invalidate_mapping_exit(inode, ret); |
1118 | 1134 | ||
1119 | clear_bit_unlock(NFS_INO_INVALIDATING, bitlock); | 1135 | clear_bit_unlock(NFS_INO_INVALIDATING, bitlock); |
@@ -1123,6 +1139,29 @@ out: | |||
1123 | return ret; | 1139 | return ret; |
1124 | } | 1140 | } |
1125 | 1141 | ||
1142 | /** | ||
1143 | * nfs_revalidate_mapping - Revalidate the pagecache | ||
1144 | * @inode - pointer to host inode | ||
1145 | * @mapping - pointer to mapping | ||
1146 | */ | ||
1147 | int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | ||
1148 | { | ||
1149 | return __nfs_revalidate_mapping(inode, mapping, false); | ||
1150 | } | ||
1151 | |||
1152 | /** | ||
1153 | * nfs_revalidate_mapping_protected - Revalidate the pagecache | ||
1154 | * @inode - pointer to host inode | ||
1155 | * @mapping - pointer to mapping | ||
1156 | * | ||
1157 | * Differs from nfs_revalidate_mapping() in that it grabs the inode->i_mutex | ||
1158 | * while invalidating the mapping. | ||
1159 | */ | ||
1160 | int nfs_revalidate_mapping_protected(struct inode *inode, struct address_space *mapping) | ||
1161 | { | ||
1162 | return __nfs_revalidate_mapping(inode, mapping, true); | ||
1163 | } | ||
1164 | |||
1126 | static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) | 1165 | static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
1127 | { | 1166 | { |
1128 | struct nfs_inode *nfsi = NFS_I(inode); | 1167 | struct nfs_inode *nfsi = NFS_I(inode); |
@@ -1231,13 +1270,6 @@ static int nfs_ctime_need_update(const struct inode *inode, const struct nfs_fat | |||
1231 | return timespec_compare(&fattr->ctime, &inode->i_ctime) > 0; | 1270 | return timespec_compare(&fattr->ctime, &inode->i_ctime) > 0; |
1232 | } | 1271 | } |
1233 | 1272 | ||
1234 | static int nfs_size_need_update(const struct inode *inode, const struct nfs_fattr *fattr) | ||
1235 | { | ||
1236 | if (!(fattr->valid & NFS_ATTR_FATTR_SIZE)) | ||
1237 | return 0; | ||
1238 | return nfs_size_to_loff_t(fattr->size) > i_size_read(inode); | ||
1239 | } | ||
1240 | |||
1241 | static atomic_long_t nfs_attr_generation_counter; | 1273 | static atomic_long_t nfs_attr_generation_counter; |
1242 | 1274 | ||
1243 | static unsigned long nfs_read_attr_generation_counter(void) | 1275 | static unsigned long nfs_read_attr_generation_counter(void) |
@@ -1249,6 +1281,7 @@ unsigned long nfs_inc_attr_generation_counter(void) | |||
1249 | { | 1281 | { |
1250 | return atomic_long_inc_return(&nfs_attr_generation_counter); | 1282 | return atomic_long_inc_return(&nfs_attr_generation_counter); |
1251 | } | 1283 | } |
1284 | EXPORT_SYMBOL_GPL(nfs_inc_attr_generation_counter); | ||
1252 | 1285 | ||
1253 | void nfs_fattr_init(struct nfs_fattr *fattr) | 1286 | void nfs_fattr_init(struct nfs_fattr *fattr) |
1254 | { | 1287 | { |
@@ -1260,6 +1293,22 @@ void nfs_fattr_init(struct nfs_fattr *fattr) | |||
1260 | } | 1293 | } |
1261 | EXPORT_SYMBOL_GPL(nfs_fattr_init); | 1294 | EXPORT_SYMBOL_GPL(nfs_fattr_init); |
1262 | 1295 | ||
1296 | /** | ||
1297 | * nfs_fattr_set_barrier | ||
1298 | * @fattr: attributes | ||
1299 | * | ||
1300 | * Used to set a barrier after an attribute was updated. This | ||
1301 | * barrier ensures that older attributes from RPC calls that may | ||
1302 | * have raced with our update cannot clobber these new values. | ||
1303 | * Note that you are still responsible for ensuring that other | ||
1304 | * operations which change the attribute on the server do not | ||
1305 | * collide. | ||
1306 | */ | ||
1307 | void nfs_fattr_set_barrier(struct nfs_fattr *fattr) | ||
1308 | { | ||
1309 | fattr->gencount = nfs_inc_attr_generation_counter(); | ||
1310 | } | ||
1311 | |||
1263 | struct nfs_fattr *nfs_alloc_fattr(void) | 1312 | struct nfs_fattr *nfs_alloc_fattr(void) |
1264 | { | 1313 | { |
1265 | struct nfs_fattr *fattr; | 1314 | struct nfs_fattr *fattr; |
@@ -1370,7 +1419,6 @@ static int nfs_inode_attrs_need_update(const struct inode *inode, const struct n | |||
1370 | 1419 | ||
1371 | return ((long)fattr->gencount - (long)nfsi->attr_gencount) > 0 || | 1420 | return ((long)fattr->gencount - (long)nfsi->attr_gencount) > 0 || |
1372 | nfs_ctime_need_update(inode, fattr) || | 1421 | nfs_ctime_need_update(inode, fattr) || |
1373 | nfs_size_need_update(inode, fattr) || | ||
1374 | ((long)nfsi->attr_gencount - (long)nfs_read_attr_generation_counter() > 0); | 1422 | ((long)nfsi->attr_gencount - (long)nfs_read_attr_generation_counter() > 0); |
1375 | } | 1423 | } |
1376 | 1424 | ||
@@ -1460,6 +1508,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1460 | int status; | 1508 | int status; |
1461 | 1509 | ||
1462 | spin_lock(&inode->i_lock); | 1510 | spin_lock(&inode->i_lock); |
1511 | nfs_fattr_set_barrier(fattr); | ||
1463 | status = nfs_post_op_update_inode_locked(inode, fattr); | 1512 | status = nfs_post_op_update_inode_locked(inode, fattr); |
1464 | spin_unlock(&inode->i_lock); | 1513 | spin_unlock(&inode->i_lock); |
1465 | 1514 | ||
@@ -1468,7 +1517,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1468 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); | 1517 | EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); |
1469 | 1518 | ||
1470 | /** | 1519 | /** |
1471 | * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache | 1520 | * nfs_post_op_update_inode_force_wcc_locked - update the inode attribute cache |
1472 | * @inode - pointer to inode | 1521 | * @inode - pointer to inode |
1473 | * @fattr - updated attributes | 1522 | * @fattr - updated attributes |
1474 | * | 1523 | * |
@@ -1478,11 +1527,10 @@ EXPORT_SYMBOL_GPL(nfs_post_op_update_inode); | |||
1478 | * | 1527 | * |
1479 | * This function is mainly designed to be used by the ->write_done() functions. | 1528 | * This function is mainly designed to be used by the ->write_done() functions. |
1480 | */ | 1529 | */ |
1481 | int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr) | 1530 | int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fattr *fattr) |
1482 | { | 1531 | { |
1483 | int status; | 1532 | int status; |
1484 | 1533 | ||
1485 | spin_lock(&inode->i_lock); | ||
1486 | /* Don't do a WCC update if these attributes are already stale */ | 1534 | /* Don't do a WCC update if these attributes are already stale */ |
1487 | if ((fattr->valid & NFS_ATTR_FATTR) == 0 || | 1535 | if ((fattr->valid & NFS_ATTR_FATTR) == 0 || |
1488 | !nfs_inode_attrs_need_update(inode, fattr)) { | 1536 | !nfs_inode_attrs_need_update(inode, fattr)) { |
@@ -1514,6 +1562,27 @@ int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fa | |||
1514 | } | 1562 | } |
1515 | out_noforce: | 1563 | out_noforce: |
1516 | status = nfs_post_op_update_inode_locked(inode, fattr); | 1564 | status = nfs_post_op_update_inode_locked(inode, fattr); |
1565 | return status; | ||
1566 | } | ||
1567 | |||
1568 | /** | ||
1569 | * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache | ||
1570 | * @inode - pointer to inode | ||
1571 | * @fattr - updated attributes | ||
1572 | * | ||
1573 | * After an operation that has changed the inode metadata, mark the | ||
1574 | * attribute cache as being invalid, then try to update it. Fake up | ||
1575 | * weak cache consistency data, if none exist. | ||
1576 | * | ||
1577 | * This function is mainly designed to be used by the ->write_done() functions. | ||
1578 | */ | ||
1579 | int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr) | ||
1580 | { | ||
1581 | int status; | ||
1582 | |||
1583 | spin_lock(&inode->i_lock); | ||
1584 | nfs_fattr_set_barrier(fattr); | ||
1585 | status = nfs_post_op_update_inode_force_wcc_locked(inode, fattr); | ||
1517 | spin_unlock(&inode->i_lock); | 1586 | spin_unlock(&inode->i_lock); |
1518 | return status; | 1587 | return status; |
1519 | } | 1588 | } |
@@ -1715,6 +1784,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1715 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); | 1784 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); |
1716 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); | 1785 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); |
1717 | nfsi->attrtimeo_timestamp = now; | 1786 | nfsi->attrtimeo_timestamp = now; |
1787 | /* Set barrier to be more recent than all outstanding updates */ | ||
1718 | nfsi->attr_gencount = nfs_inc_attr_generation_counter(); | 1788 | nfsi->attr_gencount = nfs_inc_attr_generation_counter(); |
1719 | } else { | 1789 | } else { |
1720 | if (!time_in_range_open(now, nfsi->attrtimeo_timestamp, nfsi->attrtimeo_timestamp + nfsi->attrtimeo)) { | 1790 | if (!time_in_range_open(now, nfsi->attrtimeo_timestamp, nfsi->attrtimeo_timestamp + nfsi->attrtimeo)) { |
@@ -1722,6 +1792,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1722 | nfsi->attrtimeo = NFS_MAXATTRTIMEO(inode); | 1792 | nfsi->attrtimeo = NFS_MAXATTRTIMEO(inode); |
1723 | nfsi->attrtimeo_timestamp = now; | 1793 | nfsi->attrtimeo_timestamp = now; |
1724 | } | 1794 | } |
1795 | /* Set the barrier to be more recent than this fattr */ | ||
1796 | if ((long)fattr->gencount - (long)nfsi->attr_gencount > 0) | ||
1797 | nfsi->attr_gencount = fattr->gencount; | ||
1725 | } | 1798 | } |
1726 | invalid &= ~NFS_INO_INVALID_ATTR; | 1799 | invalid &= ~NFS_INO_INVALID_ATTR; |
1727 | /* Don't invalidate the data if we were to blame */ | 1800 | /* Don't invalidate the data if we were to blame */ |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index b802fb3a2d99..9e6475bc5ba2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -459,6 +459,7 @@ void nfs_mark_request_commit(struct nfs_page *req, | |||
459 | struct nfs_commit_info *cinfo, | 459 | struct nfs_commit_info *cinfo, |
460 | u32 ds_commit_idx); | 460 | u32 ds_commit_idx); |
461 | int nfs_write_need_commit(struct nfs_pgio_header *); | 461 | int nfs_write_need_commit(struct nfs_pgio_header *); |
462 | void nfs_writeback_update_inode(struct nfs_pgio_header *hdr); | ||
462 | int nfs_generic_commit_list(struct inode *inode, struct list_head *head, | 463 | int nfs_generic_commit_list(struct inode *inode, struct list_head *head, |
463 | int how, struct nfs_commit_info *cinfo); | 464 | int how, struct nfs_commit_info *cinfo); |
464 | void nfs_retry_commit(struct list_head *page_list, | 465 | void nfs_retry_commit(struct list_head *page_list, |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 78e557c3ab87..1f11d2533ee4 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -138,7 +138,7 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
138 | nfs_fattr_init(fattr); | 138 | nfs_fattr_init(fattr); |
139 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 139 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
140 | if (status == 0) | 140 | if (status == 0) |
141 | nfs_setattr_update_inode(inode, sattr); | 141 | nfs_setattr_update_inode(inode, sattr, fattr); |
142 | dprintk("NFS reply setattr: %d\n", status); | 142 | dprintk("NFS reply setattr: %d\n", status); |
143 | return status; | 143 | return status; |
144 | } | 144 | } |
@@ -834,7 +834,7 @@ static int nfs3_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr) | |||
834 | if (nfs3_async_handle_jukebox(task, inode)) | 834 | if (nfs3_async_handle_jukebox(task, inode)) |
835 | return -EAGAIN; | 835 | return -EAGAIN; |
836 | if (task->tk_status >= 0) | 836 | if (task->tk_status >= 0) |
837 | nfs_post_op_update_inode_force_wcc(inode, hdr->res.fattr); | 837 | nfs_writeback_update_inode(hdr); |
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | 840 | ||
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 2a932fdc57cb..53852a4bd88b 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -1987,6 +1987,11 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, | |||
1987 | if (entry->fattr->valid & NFS_ATTR_FATTR_V3) | 1987 | if (entry->fattr->valid & NFS_ATTR_FATTR_V3) |
1988 | entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); | 1988 | entry->d_type = nfs_umode_to_dtype(entry->fattr->mode); |
1989 | 1989 | ||
1990 | if (entry->fattr->fileid != entry->ino) { | ||
1991 | entry->fattr->mounted_on_fileid = entry->ino; | ||
1992 | entry->fattr->valid |= NFS_ATTR_FATTR_MOUNTED_ON_FILEID; | ||
1993 | } | ||
1994 | |||
1990 | /* In fact, a post_op_fh3: */ | 1995 | /* In fact, a post_op_fh3: */ |
1991 | p = xdr_inline_decode(xdr, 4); | 1996 | p = xdr_inline_decode(xdr, 4); |
1992 | if (unlikely(p == NULL)) | 1997 | if (unlikely(p == NULL)) |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 8646af9b11d2..86d6214ea022 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -621,6 +621,9 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
621 | spin_lock(&nn->nfs_client_lock); | 621 | spin_lock(&nn->nfs_client_lock); |
622 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | 622 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { |
623 | 623 | ||
624 | if (pos == new) | ||
625 | goto found; | ||
626 | |||
624 | if (pos->rpc_ops != new->rpc_ops) | 627 | if (pos->rpc_ops != new->rpc_ops) |
625 | continue; | 628 | continue; |
626 | 629 | ||
@@ -639,10 +642,6 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
639 | prev = pos; | 642 | prev = pos; |
640 | 643 | ||
641 | status = nfs_wait_client_init_complete(pos); | 644 | status = nfs_wait_client_init_complete(pos); |
642 | if (pos->cl_cons_state == NFS_CS_SESSION_INITING) { | ||
643 | nfs4_schedule_lease_recovery(pos); | ||
644 | status = nfs4_wait_clnt_recover(pos); | ||
645 | } | ||
646 | spin_lock(&nn->nfs_client_lock); | 645 | spin_lock(&nn->nfs_client_lock); |
647 | if (status < 0) | 646 | if (status < 0) |
648 | break; | 647 | break; |
@@ -668,7 +667,7 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
668 | */ | 667 | */ |
669 | if (!nfs4_match_client_owner_id(pos, new)) | 668 | if (!nfs4_match_client_owner_id(pos, new)) |
670 | continue; | 669 | continue; |
671 | 670 | found: | |
672 | atomic_inc(&pos->cl_count); | 671 | atomic_inc(&pos->cl_count); |
673 | *result = pos; | 672 | *result = pos; |
674 | status = 0; | 673 | status = 0; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 88180ac5ea0e..627f37c44456 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -901,6 +901,7 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) | |||
901 | if (!cinfo->atomic || cinfo->before != dir->i_version) | 901 | if (!cinfo->atomic || cinfo->before != dir->i_version) |
902 | nfs_force_lookup_revalidate(dir); | 902 | nfs_force_lookup_revalidate(dir); |
903 | dir->i_version = cinfo->after; | 903 | dir->i_version = cinfo->after; |
904 | nfsi->attr_gencount = nfs_inc_attr_generation_counter(); | ||
904 | nfs_fscache_invalidate(dir); | 905 | nfs_fscache_invalidate(dir); |
905 | spin_unlock(&dir->i_lock); | 906 | spin_unlock(&dir->i_lock); |
906 | } | 907 | } |
@@ -1552,6 +1553,9 @@ static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, fmode_t fmod | |||
1552 | 1553 | ||
1553 | opendata->o_arg.open_flags = 0; | 1554 | opendata->o_arg.open_flags = 0; |
1554 | opendata->o_arg.fmode = fmode; | 1555 | opendata->o_arg.fmode = fmode; |
1556 | opendata->o_arg.share_access = nfs4_map_atomic_open_share( | ||
1557 | NFS_SB(opendata->dentry->d_sb), | ||
1558 | fmode, 0); | ||
1555 | memset(&opendata->o_res, 0, sizeof(opendata->o_res)); | 1559 | memset(&opendata->o_res, 0, sizeof(opendata->o_res)); |
1556 | memset(&opendata->c_res, 0, sizeof(opendata->c_res)); | 1560 | memset(&opendata->c_res, 0, sizeof(opendata->c_res)); |
1557 | nfs4_init_opendata_res(opendata); | 1561 | nfs4_init_opendata_res(opendata); |
@@ -2413,8 +2417,8 @@ static int _nfs4_do_open(struct inode *dir, | |||
2413 | opendata->o_res.f_attr, sattr, | 2417 | opendata->o_res.f_attr, sattr, |
2414 | state, label, olabel); | 2418 | state, label, olabel); |
2415 | if (status == 0) { | 2419 | if (status == 0) { |
2416 | nfs_setattr_update_inode(state->inode, sattr); | 2420 | nfs_setattr_update_inode(state->inode, sattr, |
2417 | nfs_post_op_update_inode(state->inode, opendata->o_res.f_attr); | 2421 | opendata->o_res.f_attr); |
2418 | nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); | 2422 | nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); |
2419 | } | 2423 | } |
2420 | } | 2424 | } |
@@ -2651,7 +2655,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
2651 | case -NFS4ERR_BAD_STATEID: | 2655 | case -NFS4ERR_BAD_STATEID: |
2652 | case -NFS4ERR_EXPIRED: | 2656 | case -NFS4ERR_EXPIRED: |
2653 | if (!nfs4_stateid_match(&calldata->arg.stateid, | 2657 | if (!nfs4_stateid_match(&calldata->arg.stateid, |
2654 | &state->stateid)) { | 2658 | &state->open_stateid)) { |
2655 | rpc_restart_call_prepare(task); | 2659 | rpc_restart_call_prepare(task); |
2656 | goto out_release; | 2660 | goto out_release; |
2657 | } | 2661 | } |
@@ -2687,7 +2691,7 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2687 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | 2691 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); |
2688 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | 2692 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); |
2689 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | 2693 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); |
2690 | nfs4_stateid_copy(&calldata->arg.stateid, &state->stateid); | 2694 | nfs4_stateid_copy(&calldata->arg.stateid, &state->open_stateid); |
2691 | /* Calculate the change in open mode */ | 2695 | /* Calculate the change in open mode */ |
2692 | calldata->arg.fmode = 0; | 2696 | calldata->arg.fmode = 0; |
2693 | if (state->n_rdwr == 0) { | 2697 | if (state->n_rdwr == 0) { |
@@ -3288,7 +3292,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
3288 | 3292 | ||
3289 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state, NULL, label); | 3293 | status = nfs4_do_setattr(inode, cred, fattr, sattr, state, NULL, label); |
3290 | if (status == 0) { | 3294 | if (status == 0) { |
3291 | nfs_setattr_update_inode(inode, sattr); | 3295 | nfs_setattr_update_inode(inode, sattr, fattr); |
3292 | nfs_setsecurity(inode, fattr, label); | 3296 | nfs_setsecurity(inode, fattr, label); |
3293 | } | 3297 | } |
3294 | nfs4_label_free(label); | 3298 | nfs4_label_free(label); |
@@ -4234,7 +4238,7 @@ static int nfs4_write_done_cb(struct rpc_task *task, | |||
4234 | } | 4238 | } |
4235 | if (task->tk_status >= 0) { | 4239 | if (task->tk_status >= 0) { |
4236 | renew_lease(NFS_SERVER(inode), hdr->timestamp); | 4240 | renew_lease(NFS_SERVER(inode), hdr->timestamp); |
4237 | nfs_post_op_update_inode_force_wcc(inode, &hdr->fattr); | 4241 | nfs_writeback_update_inode(hdr); |
4238 | } | 4242 | } |
4239 | return 0; | 4243 | return 0; |
4240 | } | 4244 | } |
@@ -6893,9 +6897,13 @@ static int _nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred, | |||
6893 | 6897 | ||
6894 | if (status == 0) { | 6898 | if (status == 0) { |
6895 | clp->cl_clientid = res.clientid; | 6899 | clp->cl_clientid = res.clientid; |
6896 | clp->cl_exchange_flags = (res.flags & ~EXCHGID4_FLAG_CONFIRMED_R); | 6900 | clp->cl_exchange_flags = res.flags; |
6897 | if (!(res.flags & EXCHGID4_FLAG_CONFIRMED_R)) | 6901 | /* Client ID is not confirmed */ |
6902 | if (!(res.flags & EXCHGID4_FLAG_CONFIRMED_R)) { | ||
6903 | clear_bit(NFS4_SESSION_ESTABLISHED, | ||
6904 | &clp->cl_session->session_state); | ||
6898 | clp->cl_seqid = res.seqid; | 6905 | clp->cl_seqid = res.seqid; |
6906 | } | ||
6899 | 6907 | ||
6900 | kfree(clp->cl_serverowner); | 6908 | kfree(clp->cl_serverowner); |
6901 | clp->cl_serverowner = res.server_owner; | 6909 | clp->cl_serverowner = res.server_owner; |
@@ -7227,6 +7235,9 @@ static void nfs4_update_session(struct nfs4_session *session, | |||
7227 | struct nfs41_create_session_res *res) | 7235 | struct nfs41_create_session_res *res) |
7228 | { | 7236 | { |
7229 | nfs4_copy_sessionid(&session->sess_id, &res->sessionid); | 7237 | nfs4_copy_sessionid(&session->sess_id, &res->sessionid); |
7238 | /* Mark client id and session as being confirmed */ | ||
7239 | session->clp->cl_exchange_flags |= EXCHGID4_FLAG_CONFIRMED_R; | ||
7240 | set_bit(NFS4_SESSION_ESTABLISHED, &session->session_state); | ||
7230 | session->flags = res->flags; | 7241 | session->flags = res->flags; |
7231 | memcpy(&session->fc_attrs, &res->fc_attrs, sizeof(session->fc_attrs)); | 7242 | memcpy(&session->fc_attrs, &res->fc_attrs, sizeof(session->fc_attrs)); |
7232 | if (res->flags & SESSION4_BACK_CHAN) | 7243 | if (res->flags & SESSION4_BACK_CHAN) |
@@ -7322,8 +7333,8 @@ int nfs4_proc_destroy_session(struct nfs4_session *session, | |||
7322 | dprintk("--> nfs4_proc_destroy_session\n"); | 7333 | dprintk("--> nfs4_proc_destroy_session\n"); |
7323 | 7334 | ||
7324 | /* session is still being setup */ | 7335 | /* session is still being setup */ |
7325 | if (session->clp->cl_cons_state != NFS_CS_READY) | 7336 | if (!test_and_clear_bit(NFS4_SESSION_ESTABLISHED, &session->session_state)) |
7326 | return status; | 7337 | return 0; |
7327 | 7338 | ||
7328 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 7339 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
7329 | trace_nfs4_destroy_session(session->clp, status); | 7340 | trace_nfs4_destroy_session(session->clp, status); |
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h index fc46c7455898..e3ea2c5324d6 100644 --- a/fs/nfs/nfs4session.h +++ b/fs/nfs/nfs4session.h | |||
@@ -70,6 +70,7 @@ struct nfs4_session { | |||
70 | 70 | ||
71 | enum nfs4_session_state { | 71 | enum nfs4_session_state { |
72 | NFS4_SESSION_INITING, | 72 | NFS4_SESSION_INITING, |
73 | NFS4_SESSION_ESTABLISHED, | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, | 76 | extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5ad908e9ce9c..f95e3b58bbc3 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -346,9 +346,23 @@ int nfs41_discover_server_trunking(struct nfs_client *clp, | |||
346 | status = nfs4_proc_exchange_id(clp, cred); | 346 | status = nfs4_proc_exchange_id(clp, cred); |
347 | if (status != NFS4_OK) | 347 | if (status != NFS4_OK) |
348 | return status; | 348 | return status; |
349 | set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | ||
350 | 349 | ||
351 | return nfs41_walk_client_list(clp, result, cred); | 350 | status = nfs41_walk_client_list(clp, result, cred); |
351 | if (status < 0) | ||
352 | return status; | ||
353 | if (clp != *result) | ||
354 | return 0; | ||
355 | |||
356 | /* Purge state if the client id was established in a prior instance */ | ||
357 | if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R) | ||
358 | set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); | ||
359 | else | ||
360 | set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); | ||
361 | nfs4_schedule_state_manager(clp); | ||
362 | status = nfs_wait_client_init_complete(clp); | ||
363 | if (status < 0) | ||
364 | nfs_put_client(clp); | ||
365 | return status; | ||
352 | } | 366 | } |
353 | 367 | ||
354 | #endif /* CONFIG_NFS_V4_1 */ | 368 | #endif /* CONFIG_NFS_V4_1 */ |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index b09cc23d6f43..c63189acd052 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -139,7 +139,7 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
139 | nfs_fattr_init(fattr); | 139 | nfs_fattr_init(fattr); |
140 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 140 | status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
141 | if (status == 0) | 141 | if (status == 0) |
142 | nfs_setattr_update_inode(inode, sattr); | 142 | nfs_setattr_update_inode(inode, sattr, fattr); |
143 | dprintk("NFS reply setattr: %d\n", status); | 143 | dprintk("NFS reply setattr: %d\n", status); |
144 | return status; | 144 | return status; |
145 | } | 145 | } |
@@ -609,10 +609,8 @@ static int nfs_proc_pgio_rpc_prepare(struct rpc_task *task, | |||
609 | 609 | ||
610 | static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr) | 610 | static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr) |
611 | { | 611 | { |
612 | struct inode *inode = hdr->inode; | ||
613 | |||
614 | if (task->tk_status >= 0) | 612 | if (task->tk_status >= 0) |
615 | nfs_post_op_update_inode_force_wcc(inode, hdr->res.fattr); | 613 | nfs_writeback_update_inode(hdr); |
616 | return 0; | 614 | return 0; |
617 | } | 615 | } |
618 | 616 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 595d81e354d1..849ed784d6ac 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1377,6 +1377,36 @@ static int nfs_should_remove_suid(const struct inode *inode) | |||
1377 | return 0; | 1377 | return 0; |
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | static void nfs_writeback_check_extend(struct nfs_pgio_header *hdr, | ||
1381 | struct nfs_fattr *fattr) | ||
1382 | { | ||
1383 | struct nfs_pgio_args *argp = &hdr->args; | ||
1384 | struct nfs_pgio_res *resp = &hdr->res; | ||
1385 | |||
1386 | if (!(fattr->valid & NFS_ATTR_FATTR_SIZE)) | ||
1387 | return; | ||
1388 | if (argp->offset + resp->count != fattr->size) | ||
1389 | return; | ||
1390 | if (nfs_size_to_loff_t(fattr->size) < i_size_read(hdr->inode)) | ||
1391 | return; | ||
1392 | /* Set attribute barrier */ | ||
1393 | nfs_fattr_set_barrier(fattr); | ||
1394 | } | ||
1395 | |||
1396 | void nfs_writeback_update_inode(struct nfs_pgio_header *hdr) | ||
1397 | { | ||
1398 | struct nfs_fattr *fattr = hdr->res.fattr; | ||
1399 | struct inode *inode = hdr->inode; | ||
1400 | |||
1401 | if (fattr == NULL) | ||
1402 | return; | ||
1403 | spin_lock(&inode->i_lock); | ||
1404 | nfs_writeback_check_extend(hdr, fattr); | ||
1405 | nfs_post_op_update_inode_force_wcc_locked(inode, fattr); | ||
1406 | spin_unlock(&inode->i_lock); | ||
1407 | } | ||
1408 | EXPORT_SYMBOL_GPL(nfs_writeback_update_inode); | ||
1409 | |||
1380 | /* | 1410 | /* |
1381 | * This function is called when the WRITE call is complete. | 1411 | * This function is called when the WRITE call is complete. |
1382 | */ | 1412 | */ |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f6b2a09f793f..d2f2c37dc2db 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1638,7 +1638,7 @@ __destroy_client(struct nfs4_client *clp) | |||
1638 | nfs4_put_stid(&dp->dl_stid); | 1638 | nfs4_put_stid(&dp->dl_stid); |
1639 | } | 1639 | } |
1640 | while (!list_empty(&clp->cl_revoked)) { | 1640 | while (!list_empty(&clp->cl_revoked)) { |
1641 | dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru); | 1641 | dp = list_entry(clp->cl_revoked.next, struct nfs4_delegation, dl_recall_lru); |
1642 | list_del_init(&dp->dl_recall_lru); | 1642 | list_del_init(&dp->dl_recall_lru); |
1643 | nfs4_put_stid(&dp->dl_stid); | 1643 | nfs4_put_stid(&dp->dl_stid); |
1644 | } | 1644 | } |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index b2e3ff347620..ecdbae19a766 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "alloc.h" | 31 | #include "alloc.h" |
32 | #include "dat.h" | 32 | #include "dat.h" |
33 | 33 | ||
34 | static void __nilfs_btree_init(struct nilfs_bmap *bmap); | ||
35 | |||
34 | static struct nilfs_btree_path *nilfs_btree_alloc_path(void) | 36 | static struct nilfs_btree_path *nilfs_btree_alloc_path(void) |
35 | { | 37 | { |
36 | struct nilfs_btree_path *path; | 38 | struct nilfs_btree_path *path; |
@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, | |||
368 | return ret; | 370 | return ret; |
369 | } | 371 | } |
370 | 372 | ||
373 | /** | ||
374 | * nilfs_btree_root_broken - verify consistency of btree root node | ||
375 | * @node: btree root node to be examined | ||
376 | * @ino: inode number | ||
377 | * | ||
378 | * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. | ||
379 | */ | ||
380 | static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, | ||
381 | unsigned long ino) | ||
382 | { | ||
383 | int level, flags, nchildren; | ||
384 | int ret = 0; | ||
385 | |||
386 | level = nilfs_btree_node_get_level(node); | ||
387 | flags = nilfs_btree_node_get_flags(node); | ||
388 | nchildren = nilfs_btree_node_get_nchildren(node); | ||
389 | |||
390 | if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || | ||
391 | level > NILFS_BTREE_LEVEL_MAX || | ||
392 | nchildren < 0 || | ||
393 | nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { | ||
394 | pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", | ||
395 | ino, level, flags, nchildren); | ||
396 | ret = 1; | ||
397 | } | ||
398 | return ret; | ||
399 | } | ||
400 | |||
371 | int nilfs_btree_broken_node_block(struct buffer_head *bh) | 401 | int nilfs_btree_broken_node_block(struct buffer_head *bh) |
372 | { | 402 | { |
373 | int ret; | 403 | int ret; |
@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, | |||
1713 | 1743 | ||
1714 | /* convert and insert */ | 1744 | /* convert and insert */ |
1715 | dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; | 1745 | dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; |
1716 | nilfs_btree_init(btree); | 1746 | __nilfs_btree_init(btree); |
1717 | if (nreq != NULL) { | 1747 | if (nreq != NULL) { |
1718 | nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); | 1748 | nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); |
1719 | nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); | 1749 | nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); |
@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { | |||
2294 | .bop_gather_data = NULL, | 2324 | .bop_gather_data = NULL, |
2295 | }; | 2325 | }; |
2296 | 2326 | ||
2297 | int nilfs_btree_init(struct nilfs_bmap *bmap) | 2327 | static void __nilfs_btree_init(struct nilfs_bmap *bmap) |
2298 | { | 2328 | { |
2299 | bmap->b_ops = &nilfs_btree_ops; | 2329 | bmap->b_ops = &nilfs_btree_ops; |
2300 | bmap->b_nchildren_per_block = | 2330 | bmap->b_nchildren_per_block = |
2301 | NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); | 2331 | NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); |
2302 | return 0; | 2332 | } |
2333 | |||
2334 | int nilfs_btree_init(struct nilfs_bmap *bmap) | ||
2335 | { | ||
2336 | int ret = 0; | ||
2337 | |||
2338 | __nilfs_btree_init(bmap); | ||
2339 | |||
2340 | if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), | ||
2341 | bmap->b_inode->i_ino)) | ||
2342 | ret = -EIO; | ||
2343 | return ret; | ||
2303 | } | 2344 | } |
2304 | 2345 | ||
2305 | void nilfs_btree_init_gc(struct nilfs_bmap *bmap) | 2346 | void nilfs_btree_init_gc(struct nilfs_bmap *bmap) |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index ce615d12fb44..a2e1cb8a568b 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -397,7 +397,8 @@ STATIC int /* error (positive) */ | |||
397 | xfs_zero_last_block( | 397 | xfs_zero_last_block( |
398 | struct xfs_inode *ip, | 398 | struct xfs_inode *ip, |
399 | xfs_fsize_t offset, | 399 | xfs_fsize_t offset, |
400 | xfs_fsize_t isize) | 400 | xfs_fsize_t isize, |
401 | bool *did_zeroing) | ||
401 | { | 402 | { |
402 | struct xfs_mount *mp = ip->i_mount; | 403 | struct xfs_mount *mp = ip->i_mount; |
403 | xfs_fileoff_t last_fsb = XFS_B_TO_FSBT(mp, isize); | 404 | xfs_fileoff_t last_fsb = XFS_B_TO_FSBT(mp, isize); |
@@ -425,6 +426,7 @@ xfs_zero_last_block( | |||
425 | zero_len = mp->m_sb.sb_blocksize - zero_offset; | 426 | zero_len = mp->m_sb.sb_blocksize - zero_offset; |
426 | if (isize + zero_len > offset) | 427 | if (isize + zero_len > offset) |
427 | zero_len = offset - isize; | 428 | zero_len = offset - isize; |
429 | *did_zeroing = true; | ||
428 | return xfs_iozero(ip, isize, zero_len); | 430 | return xfs_iozero(ip, isize, zero_len); |
429 | } | 431 | } |
430 | 432 | ||
@@ -443,7 +445,8 @@ int /* error (positive) */ | |||
443 | xfs_zero_eof( | 445 | xfs_zero_eof( |
444 | struct xfs_inode *ip, | 446 | struct xfs_inode *ip, |
445 | xfs_off_t offset, /* starting I/O offset */ | 447 | xfs_off_t offset, /* starting I/O offset */ |
446 | xfs_fsize_t isize) /* current inode size */ | 448 | xfs_fsize_t isize, /* current inode size */ |
449 | bool *did_zeroing) | ||
447 | { | 450 | { |
448 | struct xfs_mount *mp = ip->i_mount; | 451 | struct xfs_mount *mp = ip->i_mount; |
449 | xfs_fileoff_t start_zero_fsb; | 452 | xfs_fileoff_t start_zero_fsb; |
@@ -465,7 +468,7 @@ xfs_zero_eof( | |||
465 | * We only zero a part of that block so it is handled specially. | 468 | * We only zero a part of that block so it is handled specially. |
466 | */ | 469 | */ |
467 | if (XFS_B_FSB_OFFSET(mp, isize) != 0) { | 470 | if (XFS_B_FSB_OFFSET(mp, isize) != 0) { |
468 | error = xfs_zero_last_block(ip, offset, isize); | 471 | error = xfs_zero_last_block(ip, offset, isize, did_zeroing); |
469 | if (error) | 472 | if (error) |
470 | return error; | 473 | return error; |
471 | } | 474 | } |
@@ -525,6 +528,7 @@ xfs_zero_eof( | |||
525 | if (error) | 528 | if (error) |
526 | return error; | 529 | return error; |
527 | 530 | ||
531 | *did_zeroing = true; | ||
528 | start_zero_fsb = imap.br_startoff + imap.br_blockcount; | 532 | start_zero_fsb = imap.br_startoff + imap.br_blockcount; |
529 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); | 533 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); |
530 | } | 534 | } |
@@ -567,13 +571,15 @@ restart: | |||
567 | * having to redo all checks before. | 571 | * having to redo all checks before. |
568 | */ | 572 | */ |
569 | if (*pos > i_size_read(inode)) { | 573 | if (*pos > i_size_read(inode)) { |
574 | bool zero = false; | ||
575 | |||
570 | if (*iolock == XFS_IOLOCK_SHARED) { | 576 | if (*iolock == XFS_IOLOCK_SHARED) { |
571 | xfs_rw_iunlock(ip, *iolock); | 577 | xfs_rw_iunlock(ip, *iolock); |
572 | *iolock = XFS_IOLOCK_EXCL; | 578 | *iolock = XFS_IOLOCK_EXCL; |
573 | xfs_rw_ilock(ip, *iolock); | 579 | xfs_rw_ilock(ip, *iolock); |
574 | goto restart; | 580 | goto restart; |
575 | } | 581 | } |
576 | error = xfs_zero_eof(ip, *pos, i_size_read(inode)); | 582 | error = xfs_zero_eof(ip, *pos, i_size_read(inode), &zero); |
577 | if (error) | 583 | if (error) |
578 | return error; | 584 | return error; |
579 | } | 585 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index daafa1f6d260..6163767aa856 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2867,6 +2867,10 @@ xfs_rename( | |||
2867 | * Handle RENAME_EXCHANGE flags | 2867 | * Handle RENAME_EXCHANGE flags |
2868 | */ | 2868 | */ |
2869 | if (flags & RENAME_EXCHANGE) { | 2869 | if (flags & RENAME_EXCHANGE) { |
2870 | if (target_ip == NULL) { | ||
2871 | error = -EINVAL; | ||
2872 | goto error_return; | ||
2873 | } | ||
2870 | error = xfs_cross_rename(tp, src_dp, src_name, src_ip, | 2874 | error = xfs_cross_rename(tp, src_dp, src_name, src_ip, |
2871 | target_dp, target_name, target_ip, | 2875 | target_dp, target_name, target_ip, |
2872 | &free_list, &first_block, spaceres); | 2876 | &free_list, &first_block, spaceres); |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 86cd6b39bed7..a1cd55f3f351 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -384,10 +384,11 @@ enum xfs_prealloc_flags { | |||
384 | XFS_PREALLOC_INVISIBLE = (1 << 4), | 384 | XFS_PREALLOC_INVISIBLE = (1 << 4), |
385 | }; | 385 | }; |
386 | 386 | ||
387 | int xfs_update_prealloc_flags(struct xfs_inode *, | 387 | int xfs_update_prealloc_flags(struct xfs_inode *ip, |
388 | enum xfs_prealloc_flags); | 388 | enum xfs_prealloc_flags flags); |
389 | int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t); | 389 | int xfs_zero_eof(struct xfs_inode *ip, xfs_off_t offset, |
390 | int xfs_iozero(struct xfs_inode *, loff_t, size_t); | 390 | xfs_fsize_t isize, bool *did_zeroing); |
391 | int xfs_iozero(struct xfs_inode *ip, loff_t pos, size_t count); | ||
391 | 392 | ||
392 | 393 | ||
393 | #define IHOLD(ip) \ | 394 | #define IHOLD(ip) \ |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index d919ad7b16bf..e53a90331422 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -751,6 +751,7 @@ xfs_setattr_size( | |||
751 | int error; | 751 | int error; |
752 | uint lock_flags = 0; | 752 | uint lock_flags = 0; |
753 | uint commit_flags = 0; | 753 | uint commit_flags = 0; |
754 | bool did_zeroing = false; | ||
754 | 755 | ||
755 | trace_xfs_setattr(ip); | 756 | trace_xfs_setattr(ip); |
756 | 757 | ||
@@ -794,20 +795,16 @@ xfs_setattr_size( | |||
794 | return error; | 795 | return error; |
795 | 796 | ||
796 | /* | 797 | /* |
797 | * Now we can make the changes. Before we join the inode to the | 798 | * File data changes must be complete before we start the transaction to |
798 | * transaction, take care of the part of the truncation that must be | 799 | * modify the inode. This needs to be done before joining the inode to |
799 | * done without the inode lock. This needs to be done before joining | 800 | * the transaction because the inode cannot be unlocked once it is a |
800 | * the inode to the transaction, because the inode cannot be unlocked | 801 | * part of the transaction. |
801 | * once it is a part of the transaction. | 802 | * |
803 | * Start with zeroing any data block beyond EOF that we may expose on | ||
804 | * file extension. | ||
802 | */ | 805 | */ |
803 | if (newsize > oldsize) { | 806 | if (newsize > oldsize) { |
804 | /* | 807 | error = xfs_zero_eof(ip, newsize, oldsize, &did_zeroing); |
805 | * Do the first part of growing a file: zero any data in the | ||
806 | * last block that is beyond the old EOF. We need to do this | ||
807 | * before the inode is joined to the transaction to modify | ||
808 | * i_size. | ||
809 | */ | ||
810 | error = xfs_zero_eof(ip, newsize, oldsize); | ||
811 | if (error) | 808 | if (error) |
812 | return error; | 809 | return error; |
813 | } | 810 | } |
@@ -817,23 +814,18 @@ xfs_setattr_size( | |||
817 | * any previous writes that are beyond the on disk EOF and the new | 814 | * any previous writes that are beyond the on disk EOF and the new |
818 | * EOF that have not been written out need to be written here. If we | 815 | * EOF that have not been written out need to be written here. If we |
819 | * do not write the data out, we expose ourselves to the null files | 816 | * do not write the data out, we expose ourselves to the null files |
820 | * problem. | 817 | * problem. Note that this includes any block zeroing we did above; |
821 | * | 818 | * otherwise those blocks may not be zeroed after a crash. |
822 | * Only flush from the on disk size to the smaller of the in memory | ||
823 | * file size or the new size as that's the range we really care about | ||
824 | * here and prevents waiting for other data not within the range we | ||
825 | * care about here. | ||
826 | */ | 819 | */ |
827 | if (oldsize != ip->i_d.di_size && newsize > ip->i_d.di_size) { | 820 | if (newsize > ip->i_d.di_size && |
821 | (oldsize != ip->i_d.di_size || did_zeroing)) { | ||
828 | error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | 822 | error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, |
829 | ip->i_d.di_size, newsize); | 823 | ip->i_d.di_size, newsize); |
830 | if (error) | 824 | if (error) |
831 | return error; | 825 | return error; |
832 | } | 826 | } |
833 | 827 | ||
834 | /* | 828 | /* Now wait for all direct I/O to complete. */ |
835 | * Wait for all direct I/O to complete. | ||
836 | */ | ||
837 | inode_dio_wait(inode); | 829 | inode_dio_wait(inode); |
838 | 830 | ||
839 | /* | 831 | /* |
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c index 4b33ef112400..365dd57ea760 100644 --- a/fs/xfs/xfs_pnfs.c +++ b/fs/xfs/xfs_pnfs.c | |||
@@ -300,8 +300,10 @@ xfs_fs_commit_blocks( | |||
300 | 300 | ||
301 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); | 301 | tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); |
302 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0); | 302 | error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0); |
303 | if (error) | 303 | if (error) { |
304 | xfs_trans_cancel(tp, 0); | ||
304 | goto out_drop_iolock; | 305 | goto out_drop_iolock; |
306 | } | ||
305 | 307 | ||
306 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 308 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
307 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | 309 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); |
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 53cc2aaf8d2b..fbbb9e62e274 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c | |||
@@ -836,6 +836,11 @@ xfs_qm_reset_dqcounts( | |||
836 | */ | 836 | */ |
837 | xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR, | 837 | xfs_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR, |
838 | "xfs_quotacheck"); | 838 | "xfs_quotacheck"); |
839 | /* | ||
840 | * Reset type in case we are reusing group quota file for | ||
841 | * project quotas or vice versa | ||
842 | */ | ||
843 | ddq->d_flags = type; | ||
839 | ddq->d_bcount = 0; | 844 | ddq->d_bcount = 0; |
840 | ddq->d_icount = 0; | 845 | ddq->d_icount = 0; |
841 | ddq->d_rtbcount = 0; | 846 | ddq->d_rtbcount = 0; |
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index a24addfdfcec..0de6290df4da 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h | |||
@@ -68,8 +68,8 @@ struct drm_mm_node { | |||
68 | unsigned scanned_preceeds_hole : 1; | 68 | unsigned scanned_preceeds_hole : 1; |
69 | unsigned allocated : 1; | 69 | unsigned allocated : 1; |
70 | unsigned long color; | 70 | unsigned long color; |
71 | unsigned long start; | 71 | u64 start; |
72 | unsigned long size; | 72 | u64 size; |
73 | struct drm_mm *mm; | 73 | struct drm_mm *mm; |
74 | }; | 74 | }; |
75 | 75 | ||
@@ -82,16 +82,16 @@ struct drm_mm { | |||
82 | unsigned int scan_check_range : 1; | 82 | unsigned int scan_check_range : 1; |
83 | unsigned scan_alignment; | 83 | unsigned scan_alignment; |
84 | unsigned long scan_color; | 84 | unsigned long scan_color; |
85 | unsigned long scan_size; | 85 | u64 scan_size; |
86 | unsigned long scan_hit_start; | 86 | u64 scan_hit_start; |
87 | unsigned long scan_hit_end; | 87 | u64 scan_hit_end; |
88 | unsigned scanned_blocks; | 88 | unsigned scanned_blocks; |
89 | unsigned long scan_start; | 89 | u64 scan_start; |
90 | unsigned long scan_end; | 90 | u64 scan_end; |
91 | struct drm_mm_node *prev_scanned_node; | 91 | struct drm_mm_node *prev_scanned_node; |
92 | 92 | ||
93 | void (*color_adjust)(struct drm_mm_node *node, unsigned long color, | 93 | void (*color_adjust)(struct drm_mm_node *node, unsigned long color, |
94 | unsigned long *start, unsigned long *end); | 94 | u64 *start, u64 *end); |
95 | }; | 95 | }; |
96 | 96 | ||
97 | /** | 97 | /** |
@@ -124,7 +124,7 @@ static inline bool drm_mm_initialized(struct drm_mm *mm) | |||
124 | return mm->hole_stack.next; | 124 | return mm->hole_stack.next; |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_node) | 127 | static inline u64 __drm_mm_hole_node_start(struct drm_mm_node *hole_node) |
128 | { | 128 | { |
129 | return hole_node->start + hole_node->size; | 129 | return hole_node->start + hole_node->size; |
130 | } | 130 | } |
@@ -140,13 +140,13 @@ static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_no | |||
140 | * Returns: | 140 | * Returns: |
141 | * Start of the subsequent hole. | 141 | * Start of the subsequent hole. |
142 | */ | 142 | */ |
143 | static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node) | 143 | static inline u64 drm_mm_hole_node_start(struct drm_mm_node *hole_node) |
144 | { | 144 | { |
145 | BUG_ON(!hole_node->hole_follows); | 145 | BUG_ON(!hole_node->hole_follows); |
146 | return __drm_mm_hole_node_start(hole_node); | 146 | return __drm_mm_hole_node_start(hole_node); |
147 | } | 147 | } |
148 | 148 | ||
149 | static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node) | 149 | static inline u64 __drm_mm_hole_node_end(struct drm_mm_node *hole_node) |
150 | { | 150 | { |
151 | return list_entry(hole_node->node_list.next, | 151 | return list_entry(hole_node->node_list.next, |
152 | struct drm_mm_node, node_list)->start; | 152 | struct drm_mm_node, node_list)->start; |
@@ -163,7 +163,7 @@ static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node | |||
163 | * Returns: | 163 | * Returns: |
164 | * End of the subsequent hole. | 164 | * End of the subsequent hole. |
165 | */ | 165 | */ |
166 | static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) | 166 | static inline u64 drm_mm_hole_node_end(struct drm_mm_node *hole_node) |
167 | { | 167 | { |
168 | return __drm_mm_hole_node_end(hole_node); | 168 | return __drm_mm_hole_node_end(hole_node); |
169 | } | 169 | } |
@@ -222,7 +222,7 @@ int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node); | |||
222 | 222 | ||
223 | int drm_mm_insert_node_generic(struct drm_mm *mm, | 223 | int drm_mm_insert_node_generic(struct drm_mm *mm, |
224 | struct drm_mm_node *node, | 224 | struct drm_mm_node *node, |
225 | unsigned long size, | 225 | u64 size, |
226 | unsigned alignment, | 226 | unsigned alignment, |
227 | unsigned long color, | 227 | unsigned long color, |
228 | enum drm_mm_search_flags sflags, | 228 | enum drm_mm_search_flags sflags, |
@@ -245,7 +245,7 @@ int drm_mm_insert_node_generic(struct drm_mm *mm, | |||
245 | */ | 245 | */ |
246 | static inline int drm_mm_insert_node(struct drm_mm *mm, | 246 | static inline int drm_mm_insert_node(struct drm_mm *mm, |
247 | struct drm_mm_node *node, | 247 | struct drm_mm_node *node, |
248 | unsigned long size, | 248 | u64 size, |
249 | unsigned alignment, | 249 | unsigned alignment, |
250 | enum drm_mm_search_flags flags) | 250 | enum drm_mm_search_flags flags) |
251 | { | 251 | { |
@@ -255,11 +255,11 @@ static inline int drm_mm_insert_node(struct drm_mm *mm, | |||
255 | 255 | ||
256 | int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, | 256 | int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, |
257 | struct drm_mm_node *node, | 257 | struct drm_mm_node *node, |
258 | unsigned long size, | 258 | u64 size, |
259 | unsigned alignment, | 259 | unsigned alignment, |
260 | unsigned long color, | 260 | unsigned long color, |
261 | unsigned long start, | 261 | u64 start, |
262 | unsigned long end, | 262 | u64 end, |
263 | enum drm_mm_search_flags sflags, | 263 | enum drm_mm_search_flags sflags, |
264 | enum drm_mm_allocator_flags aflags); | 264 | enum drm_mm_allocator_flags aflags); |
265 | /** | 265 | /** |
@@ -282,10 +282,10 @@ int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, | |||
282 | */ | 282 | */ |
283 | static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, | 283 | static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, |
284 | struct drm_mm_node *node, | 284 | struct drm_mm_node *node, |
285 | unsigned long size, | 285 | u64 size, |
286 | unsigned alignment, | 286 | unsigned alignment, |
287 | unsigned long start, | 287 | u64 start, |
288 | unsigned long end, | 288 | u64 end, |
289 | enum drm_mm_search_flags flags) | 289 | enum drm_mm_search_flags flags) |
290 | { | 290 | { |
291 | return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, | 291 | return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, |
@@ -296,21 +296,21 @@ static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, | |||
296 | void drm_mm_remove_node(struct drm_mm_node *node); | 296 | void drm_mm_remove_node(struct drm_mm_node *node); |
297 | void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); | 297 | void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); |
298 | void drm_mm_init(struct drm_mm *mm, | 298 | void drm_mm_init(struct drm_mm *mm, |
299 | unsigned long start, | 299 | u64 start, |
300 | unsigned long size); | 300 | u64 size); |
301 | void drm_mm_takedown(struct drm_mm *mm); | 301 | void drm_mm_takedown(struct drm_mm *mm); |
302 | bool drm_mm_clean(struct drm_mm *mm); | 302 | bool drm_mm_clean(struct drm_mm *mm); |
303 | 303 | ||
304 | void drm_mm_init_scan(struct drm_mm *mm, | 304 | void drm_mm_init_scan(struct drm_mm *mm, |
305 | unsigned long size, | 305 | u64 size, |
306 | unsigned alignment, | 306 | unsigned alignment, |
307 | unsigned long color); | 307 | unsigned long color); |
308 | void drm_mm_init_scan_with_range(struct drm_mm *mm, | 308 | void drm_mm_init_scan_with_range(struct drm_mm *mm, |
309 | unsigned long size, | 309 | u64 size, |
310 | unsigned alignment, | 310 | unsigned alignment, |
311 | unsigned long color, | 311 | unsigned long color, |
312 | unsigned long start, | 312 | u64 start, |
313 | unsigned long end); | 313 | u64 end); |
314 | bool drm_mm_scan_add_block(struct drm_mm_node *node); | 314 | bool drm_mm_scan_add_block(struct drm_mm_node *node); |
315 | bool drm_mm_scan_remove_block(struct drm_mm_node *node); | 315 | bool drm_mm_scan_remove_block(struct drm_mm_node *node); |
316 | 316 | ||
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h index 38a7c8049e47..f2e47fd56751 100644 --- a/include/drm/i915_pciids.h +++ b/include/drm/i915_pciids.h | |||
@@ -214,9 +214,9 @@ | |||
214 | INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info) | 214 | INTEL_VGA_DEVICE((((gt) - 1) << 4) | (id), info) |
215 | 215 | ||
216 | #define _INTEL_BDW_M_IDS(gt, info) \ | 216 | #define _INTEL_BDW_M_IDS(gt, info) \ |
217 | _INTEL_BDW_M(gt, 0x1602, info), /* ULT */ \ | 217 | _INTEL_BDW_M(gt, 0x1602, info), /* Halo */ \ |
218 | _INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \ | 218 | _INTEL_BDW_M(gt, 0x1606, info), /* ULT */ \ |
219 | _INTEL_BDW_M(gt, 0x160B, info), /* Iris */ \ | 219 | _INTEL_BDW_M(gt, 0x160B, info), /* ULT */ \ |
220 | _INTEL_BDW_M(gt, 0x160E, info) /* ULX */ | 220 | _INTEL_BDW_M(gt, 0x160E, info) /* ULX */ |
221 | 221 | ||
222 | #define _INTEL_BDW_D_IDS(gt, info) \ | 222 | #define _INTEL_BDW_D_IDS(gt, info) \ |
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 0ccf7f267ff9..c768ddfbe53c 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
@@ -249,7 +249,7 @@ struct ttm_buffer_object { | |||
249 | * either of these locks held. | 249 | * either of these locks held. |
250 | */ | 250 | */ |
251 | 251 | ||
252 | unsigned long offset; | 252 | uint64_t offset; /* GPU address space is independent of CPU word size */ |
253 | uint32_t cur_placement; | 253 | uint32_t cur_placement; |
254 | 254 | ||
255 | struct sg_table *sg; | 255 | struct sg_table *sg; |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 142d752fc450..813042cede57 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -277,7 +277,7 @@ struct ttm_mem_type_manager { | |||
277 | bool has_type; | 277 | bool has_type; |
278 | bool use_type; | 278 | bool use_type; |
279 | uint32_t flags; | 279 | uint32_t flags; |
280 | unsigned long gpu_offset; | 280 | uint64_t gpu_offset; /* GPU address space is independent of CPU word size */ |
281 | uint64_t size; | 281 | uint64_t size; |
282 | uint32_t available_caching; | 282 | uint32_t available_caching; |
283 | uint32_t default_caching; | 283 | uint32_t default_caching; |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index f551a9299ac9..306178d7309f 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -126,6 +126,8 @@ struct cpuidle_driver { | |||
126 | 126 | ||
127 | #ifdef CONFIG_CPU_IDLE | 127 | #ifdef CONFIG_CPU_IDLE |
128 | extern void disable_cpuidle(void); | 128 | extern void disable_cpuidle(void); |
129 | extern bool cpuidle_not_available(struct cpuidle_driver *drv, | ||
130 | struct cpuidle_device *dev); | ||
129 | 131 | ||
130 | extern int cpuidle_select(struct cpuidle_driver *drv, | 132 | extern int cpuidle_select(struct cpuidle_driver *drv, |
131 | struct cpuidle_device *dev); | 133 | struct cpuidle_device *dev); |
@@ -150,11 +152,17 @@ extern void cpuidle_resume(void); | |||
150 | extern int cpuidle_enable_device(struct cpuidle_device *dev); | 152 | extern int cpuidle_enable_device(struct cpuidle_device *dev); |
151 | extern void cpuidle_disable_device(struct cpuidle_device *dev); | 153 | extern void cpuidle_disable_device(struct cpuidle_device *dev); |
152 | extern int cpuidle_play_dead(void); | 154 | extern int cpuidle_play_dead(void); |
153 | extern void cpuidle_enter_freeze(void); | 155 | extern int cpuidle_find_deepest_state(struct cpuidle_driver *drv, |
156 | struct cpuidle_device *dev); | ||
157 | extern int cpuidle_enter_freeze(struct cpuidle_driver *drv, | ||
158 | struct cpuidle_device *dev); | ||
154 | 159 | ||
155 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); | 160 | extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); |
156 | #else | 161 | #else |
157 | static inline void disable_cpuidle(void) { } | 162 | static inline void disable_cpuidle(void) { } |
163 | static inline bool cpuidle_not_available(struct cpuidle_driver *drv, | ||
164 | struct cpuidle_device *dev) | ||
165 | {return true; } | ||
158 | static inline int cpuidle_select(struct cpuidle_driver *drv, | 166 | static inline int cpuidle_select(struct cpuidle_driver *drv, |
159 | struct cpuidle_device *dev) | 167 | struct cpuidle_device *dev) |
160 | {return -ENODEV; } | 168 | {return -ENODEV; } |
@@ -183,7 +191,12 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev) | |||
183 | {return -ENODEV; } | 191 | {return -ENODEV; } |
184 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } | 192 | static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } |
185 | static inline int cpuidle_play_dead(void) {return -ENODEV; } | 193 | static inline int cpuidle_play_dead(void) {return -ENODEV; } |
186 | static inline void cpuidle_enter_freeze(void) { } | 194 | static inline int cpuidle_find_deepest_state(struct cpuidle_driver *drv, |
195 | struct cpuidle_device *dev) | ||
196 | {return -ENODEV; } | ||
197 | static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv, | ||
198 | struct cpuidle_device *dev) | ||
199 | {return -ENODEV; } | ||
187 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( | 200 | static inline struct cpuidle_driver *cpuidle_get_cpu_driver( |
188 | struct cpuidle_device *dev) {return NULL; } | 201 | struct cpuidle_device *dev) {return NULL; } |
189 | #endif | 202 | #endif |
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 51f7ccadf923..4173a8fdad9e 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -33,6 +33,8 @@ | |||
33 | * @units: Measurment unit for this attribute. | 33 | * @units: Measurment unit for this attribute. |
34 | * @unit_expo: Exponent used in the data. | 34 | * @unit_expo: Exponent used in the data. |
35 | * @size: Size in bytes for data size. | 35 | * @size: Size in bytes for data size. |
36 | * @logical_minimum: Logical minimum value for this attribute. | ||
37 | * @logical_maximum: Logical maximum value for this attribute. | ||
36 | */ | 38 | */ |
37 | struct hid_sensor_hub_attribute_info { | 39 | struct hid_sensor_hub_attribute_info { |
38 | u32 usage_id; | 40 | u32 usage_id; |
@@ -146,6 +148,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, | |||
146 | 148 | ||
147 | /** | 149 | /** |
148 | * sensor_hub_input_attr_get_raw_value() - Synchronous read request | 150 | * sensor_hub_input_attr_get_raw_value() - Synchronous read request |
151 | * @hsdev: Hub device instance. | ||
149 | * @usage_id: Attribute usage id of parent physical device as per spec | 152 | * @usage_id: Attribute usage id of parent physical device as per spec |
150 | * @attr_usage_id: Attribute usage id as per spec | 153 | * @attr_usage_id: Attribute usage id as per spec |
151 | * @report_id: Report id to look for | 154 | * @report_id: Report id to look for |
@@ -160,6 +163,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, | |||
160 | u32 attr_usage_id, u32 report_id); | 163 | u32 attr_usage_id, u32 report_id); |
161 | /** | 164 | /** |
162 | * sensor_hub_set_feature() - Feature set request | 165 | * sensor_hub_set_feature() - Feature set request |
166 | * @hsdev: Hub device instance. | ||
163 | * @report_id: Report id to look for | 167 | * @report_id: Report id to look for |
164 | * @field_index: Field index inside a report | 168 | * @field_index: Field index inside a report |
165 | * @value: Value to set | 169 | * @value: Value to set |
@@ -172,6 +176,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, | |||
172 | 176 | ||
173 | /** | 177 | /** |
174 | * sensor_hub_get_feature() - Feature get request | 178 | * sensor_hub_get_feature() - Feature get request |
179 | * @hsdev: Hub device instance. | ||
175 | * @report_id: Report id to look for | 180 | * @report_id: Report id to look for |
176 | * @field_index: Field index inside a report | 181 | * @field_index: Field index inside a report |
177 | * @value: Place holder for return value | 182 | * @value: Place holder for return value |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index d9b05b5bf8c7..2e88580194f0 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -52,11 +52,17 @@ | |||
52 | * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. | 52 | * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. |
53 | * Used by threaded interrupts which need to keep the | 53 | * Used by threaded interrupts which need to keep the |
54 | * irq line disabled until the threaded handler has been run. | 54 | * irq line disabled until the threaded handler has been run. |
55 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend | 55 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee |
56 | * that this interrupt will wake the system from a suspended | ||
57 | * state. See Documentation/power/suspend-and-interrupts.txt | ||
56 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set | 58 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
57 | * IRQF_NO_THREAD - Interrupt cannot be threaded | 59 | * IRQF_NO_THREAD - Interrupt cannot be threaded |
58 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device | 60 | * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device |
59 | * resume time. | 61 | * resume time. |
62 | * IRQF_COND_SUSPEND - If the IRQ is shared with a NO_SUSPEND user, execute this | ||
63 | * interrupt handler after suspending interrupts. For system | ||
64 | * wakeup devices users need to implement wakeup detection in | ||
65 | * their interrupt handlers. | ||
60 | */ | 66 | */ |
61 | #define IRQF_DISABLED 0x00000020 | 67 | #define IRQF_DISABLED 0x00000020 |
62 | #define IRQF_SHARED 0x00000080 | 68 | #define IRQF_SHARED 0x00000080 |
@@ -70,6 +76,7 @@ | |||
70 | #define IRQF_FORCE_RESUME 0x00008000 | 76 | #define IRQF_FORCE_RESUME 0x00008000 |
71 | #define IRQF_NO_THREAD 0x00010000 | 77 | #define IRQF_NO_THREAD 0x00010000 |
72 | #define IRQF_EARLY_RESUME 0x00020000 | 78 | #define IRQF_EARLY_RESUME 0x00020000 |
79 | #define IRQF_COND_SUSPEND 0x00040000 | ||
73 | 80 | ||
74 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) | 81 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) |
75 | 82 | ||
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index faf433af425e..dd1109fb241e 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
@@ -78,6 +78,7 @@ struct irq_desc { | |||
78 | #ifdef CONFIG_PM_SLEEP | 78 | #ifdef CONFIG_PM_SLEEP |
79 | unsigned int nr_actions; | 79 | unsigned int nr_actions; |
80 | unsigned int no_suspend_depth; | 80 | unsigned int no_suspend_depth; |
81 | unsigned int cond_suspend_depth; | ||
81 | unsigned int force_resume_depth; | 82 | unsigned int force_resume_depth; |
82 | #endif | 83 | #endif |
83 | #ifdef CONFIG_PROC_FS | 84 | #ifdef CONFIG_PROC_FS |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 2bbc62aa818a..551f85456c11 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -427,7 +427,7 @@ struct mlx4_wqe_inline_seg { | |||
427 | 427 | ||
428 | enum mlx4_update_qp_attr { | 428 | enum mlx4_update_qp_attr { |
429 | MLX4_UPDATE_QP_SMAC = 1 << 0, | 429 | MLX4_UPDATE_QP_SMAC = 1 << 0, |
430 | MLX4_UPDATE_QP_VSD = 1 << 2, | 430 | MLX4_UPDATE_QP_VSD = 1 << 1, |
431 | MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 | 431 | MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 |
432 | }; | 432 | }; |
433 | 433 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 5897b4ea5a3f..429d1790a27e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2342,6 +2342,7 @@ struct gro_remcsum { | |||
2342 | 2342 | ||
2343 | static inline void skb_gro_remcsum_init(struct gro_remcsum *grc) | 2343 | static inline void skb_gro_remcsum_init(struct gro_remcsum *grc) |
2344 | { | 2344 | { |
2345 | grc->offset = 0; | ||
2345 | grc->delta = 0; | 2346 | grc->delta = 0; |
2346 | } | 2347 | } |
2347 | 2348 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 2f77e0c651c8..b01ccf371fdc 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -343,6 +343,7 @@ extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, | |||
343 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); | 343 | extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); |
344 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); | 344 | extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); |
345 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); | 345 | extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); |
346 | extern int nfs_post_op_update_inode_force_wcc_locked(struct inode *inode, struct nfs_fattr *fattr); | ||
346 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 347 | extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
347 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); | 348 | extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); |
348 | extern void nfs_access_set_mask(struct nfs_access_entry *, u32); | 349 | extern void nfs_access_set_mask(struct nfs_access_entry *, u32); |
@@ -355,8 +356,9 @@ extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | |||
355 | extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode); | 356 | extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode *inode); |
356 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 357 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
357 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 358 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
359 | extern int nfs_revalidate_mapping_protected(struct inode *inode, struct address_space *mapping); | ||
358 | extern int nfs_setattr(struct dentry *, struct iattr *); | 360 | extern int nfs_setattr(struct dentry *, struct iattr *); |
359 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 361 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, struct nfs_fattr *); |
360 | extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, | 362 | extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, |
361 | struct nfs4_label *label); | 363 | struct nfs4_label *label); |
362 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 364 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
@@ -369,6 +371,7 @@ extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ct | |||
369 | extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); | 371 | extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); |
370 | extern u64 nfs_compat_user_ino64(u64 fileid); | 372 | extern u64 nfs_compat_user_ino64(u64 fileid); |
371 | extern void nfs_fattr_init(struct nfs_fattr *fattr); | 373 | extern void nfs_fattr_init(struct nfs_fattr *fattr); |
374 | extern void nfs_fattr_set_barrier(struct nfs_fattr *fattr); | ||
372 | extern unsigned long nfs_inc_attr_generation_counter(void); | 375 | extern unsigned long nfs_inc_attr_generation_counter(void); |
373 | 376 | ||
374 | extern struct nfs_fattr *nfs_alloc_fattr(void); | 377 | extern struct nfs_fattr *nfs_alloc_fattr(void); |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 58851275fed9..d438eeb08bff 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
@@ -54,10 +54,11 @@ struct rhash_head { | |||
54 | * @buckets: size * hash buckets | 54 | * @buckets: size * hash buckets |
55 | */ | 55 | */ |
56 | struct bucket_table { | 56 | struct bucket_table { |
57 | size_t size; | 57 | size_t size; |
58 | unsigned int locks_mask; | 58 | unsigned int locks_mask; |
59 | spinlock_t *locks; | 59 | spinlock_t *locks; |
60 | struct rhash_head __rcu *buckets[]; | 60 | |
61 | struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); | 64 | typedef u32 (*rht_hashfn_t)(const void *data, u32 len, u32 seed); |
@@ -78,12 +79,6 @@ struct rhashtable; | |||
78 | * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) | 79 | * @locks_mul: Number of bucket locks to allocate per cpu (default: 128) |
79 | * @hashfn: Function to hash key | 80 | * @hashfn: Function to hash key |
80 | * @obj_hashfn: Function to hash object | 81 | * @obj_hashfn: Function to hash object |
81 | * @grow_decision: If defined, may return true if table should expand | ||
82 | * @shrink_decision: If defined, may return true if table should shrink | ||
83 | * | ||
84 | * Note: when implementing the grow and shrink decision function, min/max | ||
85 | * shift must be enforced, otherwise, resizing watermarks they set may be | ||
86 | * useless. | ||
87 | */ | 82 | */ |
88 | struct rhashtable_params { | 83 | struct rhashtable_params { |
89 | size_t nelem_hint; | 84 | size_t nelem_hint; |
@@ -97,10 +92,6 @@ struct rhashtable_params { | |||
97 | size_t locks_mul; | 92 | size_t locks_mul; |
98 | rht_hashfn_t hashfn; | 93 | rht_hashfn_t hashfn; |
99 | rht_obj_hashfn_t obj_hashfn; | 94 | rht_obj_hashfn_t obj_hashfn; |
100 | bool (*grow_decision)(const struct rhashtable *ht, | ||
101 | size_t new_size); | ||
102 | bool (*shrink_decision)(const struct rhashtable *ht, | ||
103 | size_t new_size); | ||
104 | }; | 95 | }; |
105 | 96 | ||
106 | /** | 97 | /** |
@@ -192,9 +183,6 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params); | |||
192 | void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node); | 183 | void rhashtable_insert(struct rhashtable *ht, struct rhash_head *node); |
193 | bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node); | 184 | bool rhashtable_remove(struct rhashtable *ht, struct rhash_head *node); |
194 | 185 | ||
195 | bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size); | ||
196 | bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size); | ||
197 | |||
198 | int rhashtable_expand(struct rhashtable *ht); | 186 | int rhashtable_expand(struct rhashtable *ht); |
199 | int rhashtable_shrink(struct rhashtable *ht); | 187 | int rhashtable_shrink(struct rhashtable *ht); |
200 | 188 | ||
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index baf3e1d08416..d10965f0d8a4 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -143,13 +143,13 @@ struct uart_port { | |||
143 | unsigned char iotype; /* io access style */ | 143 | unsigned char iotype; /* io access style */ |
144 | unsigned char unused1; | 144 | unsigned char unused1; |
145 | 145 | ||
146 | #define UPIO_PORT (0) /* 8b I/O port access */ | 146 | #define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */ |
147 | #define UPIO_HUB6 (1) /* Hub6 ISA card */ | 147 | #define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */ |
148 | #define UPIO_MEM (2) /* 8b MMIO access */ | 148 | #define UPIO_MEM (SERIAL_IO_MEM) /* 8b MMIO access */ |
149 | #define UPIO_MEM32 (3) /* 32b little endian */ | 149 | #define UPIO_MEM32 (SERIAL_IO_MEM32) /* 32b little endian */ |
150 | #define UPIO_MEM32BE (4) /* 32b big endian */ | 150 | #define UPIO_AU (SERIAL_IO_AU) /* Au1x00 and RT288x type IO */ |
151 | #define UPIO_AU (5) /* Au1x00 and RT288x type IO */ | 151 | #define UPIO_TSI (SERIAL_IO_TSI) /* Tsi108/109 type IO */ |
152 | #define UPIO_TSI (6) /* Tsi108/109 type IO */ | 152 | #define UPIO_MEM32BE (SERIAL_IO_MEM32BE) /* 32b big endian */ |
153 | 153 | ||
154 | unsigned int read_status_mask; /* driver specific */ | 154 | unsigned int read_status_mask; /* driver specific */ |
155 | unsigned int ignore_status_mask; /* driver specific */ | 155 | unsigned int ignore_status_mask; /* driver specific */ |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index fc52e307efab..5eac316490ea 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -314,6 +314,8 @@ void thermal_zone_of_sensor_unregister(struct device *dev, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | #endif | 316 | #endif |
317 | |||
318 | #if IS_ENABLED(CONFIG_THERMAL) | ||
317 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, | 319 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, |
318 | void *, struct thermal_zone_device_ops *, | 320 | void *, struct thermal_zone_device_ops *, |
319 | const struct thermal_zone_params *, int, int); | 321 | const struct thermal_zone_params *, int, int); |
@@ -340,8 +342,58 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, | |||
340 | struct thermal_cooling_device *, int); | 342 | struct thermal_cooling_device *, int); |
341 | void thermal_cdev_update(struct thermal_cooling_device *); | 343 | void thermal_cdev_update(struct thermal_cooling_device *); |
342 | void thermal_notify_framework(struct thermal_zone_device *, int); | 344 | void thermal_notify_framework(struct thermal_zone_device *, int); |
343 | 345 | #else | |
344 | #ifdef CONFIG_NET | 346 | static inline struct thermal_zone_device *thermal_zone_device_register( |
347 | const char *type, int trips, int mask, void *devdata, | ||
348 | struct thermal_zone_device_ops *ops, | ||
349 | const struct thermal_zone_params *tzp, | ||
350 | int passive_delay, int polling_delay) | ||
351 | { return ERR_PTR(-ENODEV); } | ||
352 | static inline void thermal_zone_device_unregister( | ||
353 | struct thermal_zone_device *tz) | ||
354 | { } | ||
355 | static inline int thermal_zone_bind_cooling_device( | ||
356 | struct thermal_zone_device *tz, int trip, | ||
357 | struct thermal_cooling_device *cdev, | ||
358 | unsigned long upper, unsigned long lower) | ||
359 | { return -ENODEV; } | ||
360 | static inline int thermal_zone_unbind_cooling_device( | ||
361 | struct thermal_zone_device *tz, int trip, | ||
362 | struct thermal_cooling_device *cdev) | ||
363 | { return -ENODEV; } | ||
364 | static inline void thermal_zone_device_update(struct thermal_zone_device *tz) | ||
365 | { } | ||
366 | static inline struct thermal_cooling_device * | ||
367 | thermal_cooling_device_register(char *type, void *devdata, | ||
368 | const struct thermal_cooling_device_ops *ops) | ||
369 | { return ERR_PTR(-ENODEV); } | ||
370 | static inline struct thermal_cooling_device * | ||
371 | thermal_of_cooling_device_register(struct device_node *np, | ||
372 | char *type, void *devdata, const struct thermal_cooling_device_ops *ops) | ||
373 | { return ERR_PTR(-ENODEV); } | ||
374 | static inline void thermal_cooling_device_unregister( | ||
375 | struct thermal_cooling_device *cdev) | ||
376 | { } | ||
377 | static inline struct thermal_zone_device *thermal_zone_get_zone_by_name( | ||
378 | const char *name) | ||
379 | { return ERR_PTR(-ENODEV); } | ||
380 | static inline int thermal_zone_get_temp( | ||
381 | struct thermal_zone_device *tz, unsigned long *temp) | ||
382 | { return -ENODEV; } | ||
383 | static inline int get_tz_trend(struct thermal_zone_device *tz, int trip) | ||
384 | { return -ENODEV; } | ||
385 | static inline struct thermal_instance * | ||
386 | get_thermal_instance(struct thermal_zone_device *tz, | ||
387 | struct thermal_cooling_device *cdev, int trip) | ||
388 | { return ERR_PTR(-ENODEV); } | ||
389 | static inline void thermal_cdev_update(struct thermal_cooling_device *cdev) | ||
390 | { } | ||
391 | static inline void thermal_notify_framework(struct thermal_zone_device *tz, | ||
392 | int trip) | ||
393 | { } | ||
394 | #endif /* CONFIG_THERMAL */ | ||
395 | |||
396 | #if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL) | ||
345 | extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, | 397 | extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, |
346 | enum events event); | 398 | enum events event); |
347 | #else | 399 | #else |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 9bb547c7bce7..704a1ab8240c 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -190,8 +190,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
190 | * @num_ports: the number of different ports this device will have. | 190 | * @num_ports: the number of different ports this device will have. |
191 | * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer | 191 | * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer |
192 | * (0 = end-point size) | 192 | * (0 = end-point size) |
193 | * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer | 193 | * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) |
194 | * (0 = end-point size) | ||
195 | * @calc_num_ports: pointer to a function to determine how many ports this | 194 | * @calc_num_ports: pointer to a function to determine how many ports this |
196 | * device has dynamically. It will be called after the probe() | 195 | * device has dynamically. It will be called after the probe() |
197 | * callback is called, but before attach() | 196 | * callback is called, but before attach() |
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h index 1c1ad46250d5..fe328c52c46b 100644 --- a/include/net/caif/cfpkt.h +++ b/include/net/caif/cfpkt.h | |||
@@ -171,7 +171,7 @@ struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos); | |||
171 | * @return Checksum of buffer. | 171 | * @return Checksum of buffer. |
172 | */ | 172 | */ |
173 | 173 | ||
174 | u16 cfpkt_iterate(struct cfpkt *pkt, | 174 | int cfpkt_iterate(struct cfpkt *pkt, |
175 | u16 (*iter_func)(u16 chks, void *buf, u16 len), | 175 | u16 (*iter_func)(u16 chks, void *buf, u16 len), |
176 | u16 data); | 176 | u16 data); |
177 | 177 | ||
diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index 5e0d0ed61cf3..25331f9faa76 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h | |||
@@ -65,6 +65,10 @@ struct serial_struct { | |||
65 | #define SERIAL_IO_PORT 0 | 65 | #define SERIAL_IO_PORT 0 |
66 | #define SERIAL_IO_HUB6 1 | 66 | #define SERIAL_IO_HUB6 1 |
67 | #define SERIAL_IO_MEM 2 | 67 | #define SERIAL_IO_MEM 2 |
68 | #define SERIAL_IO_MEM32 3 | ||
69 | #define SERIAL_IO_AU 4 | ||
70 | #define SERIAL_IO_TSI 5 | ||
71 | #define SERIAL_IO_MEM32BE 6 | ||
68 | 72 | ||
69 | #define UART_CLEAR_FIFO 0x01 | 73 | #define UART_CLEAR_FIFO 0x01 |
70 | #define UART_USE_FIFO 0x02 | 74 | #define UART_USE_FIFO 0x02 |
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild index 19d5219b0b99..242cf0c6e33d 100644 --- a/include/uapi/linux/tc_act/Kbuild +++ b/include/uapi/linux/tc_act/Kbuild | |||
@@ -9,3 +9,4 @@ header-y += tc_pedit.h | |||
9 | header-y += tc_skbedit.h | 9 | header-y += tc_skbedit.h |
10 | header-y += tc_vlan.h | 10 | header-y += tc_vlan.h |
11 | header-y += tc_bpf.h | 11 | header-y += tc_bpf.h |
12 | header-y += tc_connmark.h | ||
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 7491ee5d8164..83338210ee04 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
@@ -46,4 +46,30 @@ static inline efi_system_table_t __init *xen_efi_probe(void) | |||
46 | } | 46 | } |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #ifdef CONFIG_PREEMPT | ||
50 | |||
51 | static inline void xen_preemptible_hcall_begin(void) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | static inline void xen_preemptible_hcall_end(void) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | #else | ||
60 | |||
61 | DECLARE_PER_CPU(bool, xen_in_preemptible_hcall); | ||
62 | |||
63 | static inline void xen_preemptible_hcall_begin(void) | ||
64 | { | ||
65 | __this_cpu_write(xen_in_preemptible_hcall, true); | ||
66 | } | ||
67 | |||
68 | static inline void xen_preemptible_hcall_end(void) | ||
69 | { | ||
70 | __this_cpu_write(xen_in_preemptible_hcall, false); | ||
71 | } | ||
72 | |||
73 | #endif /* CONFIG_PREEMPT */ | ||
74 | |||
49 | #endif /* INCLUDE_XEN_OPS_H */ | 75 | #endif /* INCLUDE_XEN_OPS_H */ |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 196a06fbc122..886d09e691d5 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -1474,8 +1474,13 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, | |||
1474 | * otherwise we'll have trouble later trying to figure out | 1474 | * otherwise we'll have trouble later trying to figure out |
1475 | * which interrupt is which (messes up the interrupt freeing | 1475 | * which interrupt is which (messes up the interrupt freeing |
1476 | * logic etc). | 1476 | * logic etc). |
1477 | * | ||
1478 | * Also IRQF_COND_SUSPEND only makes sense for shared interrupts and | ||
1479 | * it cannot be set along with IRQF_NO_SUSPEND. | ||
1477 | */ | 1480 | */ |
1478 | if ((irqflags & IRQF_SHARED) && !dev_id) | 1481 | if (((irqflags & IRQF_SHARED) && !dev_id) || |
1482 | (!(irqflags & IRQF_SHARED) && (irqflags & IRQF_COND_SUSPEND)) || | ||
1483 | ((irqflags & IRQF_NO_SUSPEND) && (irqflags & IRQF_COND_SUSPEND))) | ||
1479 | return -EINVAL; | 1484 | return -EINVAL; |
1480 | 1485 | ||
1481 | desc = irq_to_desc(irq); | 1486 | desc = irq_to_desc(irq); |
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c index 3ca532592704..5204a6d1b985 100644 --- a/kernel/irq/pm.c +++ b/kernel/irq/pm.c | |||
@@ -43,9 +43,12 @@ void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action) | |||
43 | 43 | ||
44 | if (action->flags & IRQF_NO_SUSPEND) | 44 | if (action->flags & IRQF_NO_SUSPEND) |
45 | desc->no_suspend_depth++; | 45 | desc->no_suspend_depth++; |
46 | else if (action->flags & IRQF_COND_SUSPEND) | ||
47 | desc->cond_suspend_depth++; | ||
46 | 48 | ||
47 | WARN_ON_ONCE(desc->no_suspend_depth && | 49 | WARN_ON_ONCE(desc->no_suspend_depth && |
48 | desc->no_suspend_depth != desc->nr_actions); | 50 | (desc->no_suspend_depth + |
51 | desc->cond_suspend_depth) != desc->nr_actions); | ||
49 | } | 52 | } |
50 | 53 | ||
51 | /* | 54 | /* |
@@ -61,6 +64,8 @@ void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action) | |||
61 | 64 | ||
62 | if (action->flags & IRQF_NO_SUSPEND) | 65 | if (action->flags & IRQF_NO_SUSPEND) |
63 | desc->no_suspend_depth--; | 66 | desc->no_suspend_depth--; |
67 | else if (action->flags & IRQF_COND_SUSPEND) | ||
68 | desc->cond_suspend_depth--; | ||
64 | } | 69 | } |
65 | 70 | ||
66 | static bool suspend_device_irq(struct irq_desc *desc, int irq) | 71 | static bool suspend_device_irq(struct irq_desc *desc, int irq) |
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index ff7f47d026ac..01ca08804f51 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c | |||
@@ -248,11 +248,12 @@ static int klp_find_external_symbol(struct module *pmod, const char *name, | |||
248 | /* first, check if it's an exported symbol */ | 248 | /* first, check if it's an exported symbol */ |
249 | preempt_disable(); | 249 | preempt_disable(); |
250 | sym = find_symbol(name, NULL, NULL, true, true); | 250 | sym = find_symbol(name, NULL, NULL, true, true); |
251 | preempt_enable(); | ||
252 | if (sym) { | 251 | if (sym) { |
253 | *addr = sym->value; | 252 | *addr = sym->value; |
253 | preempt_enable(); | ||
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | preempt_enable(); | ||
256 | 257 | ||
257 | /* otherwise check if it's in another .o within the patch module */ | 258 | /* otherwise check if it's in another .o within the patch module */ |
258 | return klp_find_object_symbol(pmod->name, name, addr); | 259 | return klp_find_object_symbol(pmod->name, name, addr); |
@@ -314,12 +315,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, | |||
314 | rcu_read_lock(); | 315 | rcu_read_lock(); |
315 | func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, | 316 | func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, |
316 | stack_node); | 317 | stack_node); |
317 | rcu_read_unlock(); | ||
318 | |||
319 | if (WARN_ON_ONCE(!func)) | 318 | if (WARN_ON_ONCE(!func)) |
320 | return; | 319 | goto unlock; |
321 | 320 | ||
322 | klp_arch_set_pc(regs, (unsigned long)func->new_func); | 321 | klp_arch_set_pc(regs, (unsigned long)func->new_func); |
322 | unlock: | ||
323 | rcu_read_unlock(); | ||
323 | } | 324 | } |
324 | 325 | ||
325 | static int klp_disable_func(struct klp_func *func) | 326 | static int klp_disable_func(struct klp_func *func) |
@@ -731,7 +732,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) | |||
731 | func->state = KLP_DISABLED; | 732 | func->state = KLP_DISABLED; |
732 | 733 | ||
733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, | 734 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, |
734 | obj->kobj, func->old_name); | 735 | obj->kobj, "%s", func->old_name); |
735 | } | 736 | } |
736 | 737 | ||
737 | /* parts of the initialization that is done only when the object is loaded */ | 738 | /* parts of the initialization that is done only when the object is loaded */ |
@@ -807,7 +808,7 @@ static int klp_init_patch(struct klp_patch *patch) | |||
807 | patch->state = KLP_DISABLED; | 808 | patch->state = KLP_DISABLED; |
808 | 809 | ||
809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, | 810 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, |
810 | klp_root_kobj, patch->mod->name); | 811 | klp_root_kobj, "%s", patch->mod->name); |
811 | if (ret) | 812 | if (ret) |
812 | goto unlock; | 813 | goto unlock; |
813 | 814 | ||
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index e16e5542bf13..6357265a31ad 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
@@ -1193,6 +1193,7 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, | |||
1193 | ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); | 1193 | ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); |
1194 | 1194 | ||
1195 | if (unlikely(ret)) { | 1195 | if (unlikely(ret)) { |
1196 | __set_current_state(TASK_RUNNING); | ||
1196 | if (rt_mutex_has_waiters(lock)) | 1197 | if (rt_mutex_has_waiters(lock)) |
1197 | remove_waiter(lock, &waiter); | 1198 | remove_waiter(lock, &waiter); |
1198 | rt_mutex_handle_deadlock(ret, chwalk, &waiter); | 1199 | rt_mutex_handle_deadlock(ret, chwalk, &waiter); |
diff --git a/kernel/module.c b/kernel/module.c index b34813f725e9..cc93cf68653c 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2313,11 +2313,13 @@ static void layout_symtab(struct module *mod, struct load_info *info) | |||
2313 | info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1); | 2313 | info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1); |
2314 | info->stroffs = mod->core_size = info->symoffs + ndst * sizeof(Elf_Sym); | 2314 | info->stroffs = mod->core_size = info->symoffs + ndst * sizeof(Elf_Sym); |
2315 | mod->core_size += strtab_size; | 2315 | mod->core_size += strtab_size; |
2316 | mod->core_size = debug_align(mod->core_size); | ||
2316 | 2317 | ||
2317 | /* Put string table section at end of init part of module. */ | 2318 | /* Put string table section at end of init part of module. */ |
2318 | strsect->sh_flags |= SHF_ALLOC; | 2319 | strsect->sh_flags |= SHF_ALLOC; |
2319 | strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect, | 2320 | strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect, |
2320 | info->index.str) | INIT_OFFSET_MASK; | 2321 | info->index.str) | INIT_OFFSET_MASK; |
2322 | mod->init_size = debug_align(mod->init_size); | ||
2321 | pr_debug("\t%s\n", info->secstrings + strsect->sh_name); | 2323 | pr_debug("\t%s\n", info->secstrings + strsect->sh_name); |
2322 | } | 2324 | } |
2323 | 2325 | ||
diff --git a/kernel/printk/console_cmdline.h b/kernel/printk/console_cmdline.h index cbd69d842341..2ca4a8b5fe57 100644 --- a/kernel/printk/console_cmdline.h +++ b/kernel/printk/console_cmdline.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | struct console_cmdline | 4 | struct console_cmdline |
5 | { | 5 | { |
6 | char name[8]; /* Name of the driver */ | 6 | char name[16]; /* Name of the driver */ |
7 | int index; /* Minor dev. to use */ | 7 | int index; /* Minor dev. to use */ |
8 | char *options; /* Options for the driver */ | 8 | char *options; /* Options for the driver */ |
9 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 9 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 01cfd69c54c6..bb0635bd74f2 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -2464,6 +2464,7 @@ void register_console(struct console *newcon) | |||
2464 | for (i = 0, c = console_cmdline; | 2464 | for (i = 0, c = console_cmdline; |
2465 | i < MAX_CMDLINECONSOLES && c->name[0]; | 2465 | i < MAX_CMDLINECONSOLES && c->name[0]; |
2466 | i++, c++) { | 2466 | i++, c++) { |
2467 | BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); | ||
2467 | if (strcmp(c->name, newcon->name) != 0) | 2468 | if (strcmp(c->name, newcon->name) != 0) |
2468 | continue; | 2469 | continue; |
2469 | if (newcon->index >= 0 && | 2470 | if (newcon->index >= 0 && |
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 94b2d7b88a27..80014a178342 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c | |||
@@ -82,6 +82,7 @@ static void cpuidle_idle_call(void) | |||
82 | struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); | 82 | struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); |
83 | int next_state, entered_state; | 83 | int next_state, entered_state; |
84 | unsigned int broadcast; | 84 | unsigned int broadcast; |
85 | bool reflect; | ||
85 | 86 | ||
86 | /* | 87 | /* |
87 | * Check if the idle task must be rescheduled. If it is the | 88 | * Check if the idle task must be rescheduled. If it is the |
@@ -105,6 +106,9 @@ static void cpuidle_idle_call(void) | |||
105 | */ | 106 | */ |
106 | rcu_idle_enter(); | 107 | rcu_idle_enter(); |
107 | 108 | ||
109 | if (cpuidle_not_available(drv, dev)) | ||
110 | goto use_default; | ||
111 | |||
108 | /* | 112 | /* |
109 | * Suspend-to-idle ("freeze") is a system state in which all user space | 113 | * Suspend-to-idle ("freeze") is a system state in which all user space |
110 | * has been frozen, all I/O devices have been suspended and the only | 114 | * has been frozen, all I/O devices have been suspended and the only |
@@ -115,30 +119,24 @@ static void cpuidle_idle_call(void) | |||
115 | * until a proper wakeup interrupt happens. | 119 | * until a proper wakeup interrupt happens. |
116 | */ | 120 | */ |
117 | if (idle_should_freeze()) { | 121 | if (idle_should_freeze()) { |
118 | cpuidle_enter_freeze(); | 122 | entered_state = cpuidle_enter_freeze(drv, dev); |
119 | local_irq_enable(); | 123 | if (entered_state >= 0) { |
120 | goto exit_idle; | 124 | local_irq_enable(); |
121 | } | 125 | goto exit_idle; |
126 | } | ||
122 | 127 | ||
123 | /* | 128 | reflect = false; |
124 | * Ask the cpuidle framework to choose a convenient idle state. | 129 | next_state = cpuidle_find_deepest_state(drv, dev); |
125 | * Fall back to the default arch idle method on errors. | 130 | } else { |
126 | */ | 131 | reflect = true; |
127 | next_state = cpuidle_select(drv, dev); | ||
128 | if (next_state < 0) { | ||
129 | use_default: | ||
130 | /* | 132 | /* |
131 | * We can't use the cpuidle framework, let's use the default | 133 | * Ask the cpuidle framework to choose a convenient idle state. |
132 | * idle routine. | ||
133 | */ | 134 | */ |
134 | if (current_clr_polling_and_test()) | 135 | next_state = cpuidle_select(drv, dev); |
135 | local_irq_enable(); | ||
136 | else | ||
137 | arch_cpu_idle(); | ||
138 | |||
139 | goto exit_idle; | ||
140 | } | 136 | } |
141 | 137 | /* Fall back to the default arch idle method on errors. */ | |
138 | if (next_state < 0) | ||
139 | goto use_default; | ||
142 | 140 | ||
143 | /* | 141 | /* |
144 | * The idle task must be scheduled, it is pointless to | 142 | * The idle task must be scheduled, it is pointless to |
@@ -183,7 +181,8 @@ use_default: | |||
183 | /* | 181 | /* |
184 | * Give the governor an opportunity to reflect on the outcome | 182 | * Give the governor an opportunity to reflect on the outcome |
185 | */ | 183 | */ |
186 | cpuidle_reflect(dev, entered_state); | 184 | if (reflect) |
185 | cpuidle_reflect(dev, entered_state); | ||
187 | 186 | ||
188 | exit_idle: | 187 | exit_idle: |
189 | __current_set_polling(); | 188 | __current_set_polling(); |
@@ -196,6 +195,19 @@ exit_idle: | |||
196 | 195 | ||
197 | rcu_idle_exit(); | 196 | rcu_idle_exit(); |
198 | start_critical_timings(); | 197 | start_critical_timings(); |
198 | return; | ||
199 | |||
200 | use_default: | ||
201 | /* | ||
202 | * We can't use the cpuidle framework, let's use the default | ||
203 | * idle routine. | ||
204 | */ | ||
205 | if (current_clr_polling_and_test()) | ||
206 | local_irq_enable(); | ||
207 | else | ||
208 | arch_cpu_idle(); | ||
209 | |||
210 | goto exit_idle; | ||
199 | } | 211 | } |
200 | 212 | ||
201 | /* | 213 | /* |
diff --git a/kernel/sys.c b/kernel/sys.c index 667b2e62fad2..a03d9cd23ed7 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1108,6 +1108,7 @@ DECLARE_RWSEM(uts_sem); | |||
1108 | /* | 1108 | /* |
1109 | * Work around broken programs that cannot handle "Linux 3.0". | 1109 | * Work around broken programs that cannot handle "Linux 3.0". |
1110 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 | 1110 | * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40 |
1111 | * And we map 4.x to 2.6.60+x, so 4.0 would be 2.6.60. | ||
1111 | */ | 1112 | */ |
1112 | static int override_release(char __user *release, size_t len) | 1113 | static int override_release(char __user *release, size_t len) |
1113 | { | 1114 | { |
@@ -1127,7 +1128,7 @@ static int override_release(char __user *release, size_t len) | |||
1127 | break; | 1128 | break; |
1128 | rest++; | 1129 | rest++; |
1129 | } | 1130 | } |
1130 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40; | 1131 | v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 60; |
1131 | copy = clamp_t(size_t, len, 1, sizeof(buf)); | 1132 | copy = clamp_t(size_t, len, 1, sizeof(buf)); |
1132 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); | 1133 | copy = scnprintf(buf, copy, "2.6.%u%s", v, rest); |
1133 | ret = copy_to_user(release, buf, copy + 1); | 1134 | ret = copy_to_user(release, buf, copy + 1); |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 9cc4c4a90d00..b5344ef4c684 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/log2.h> | 19 | #include <linux/log2.h> |
20 | #include <linux/sched.h> | ||
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
21 | #include <linux/vmalloc.h> | 22 | #include <linux/vmalloc.h> |
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -217,15 +218,15 @@ static void bucket_table_free(const struct bucket_table *tbl) | |||
217 | static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, | 218 | static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, |
218 | size_t nbuckets) | 219 | size_t nbuckets) |
219 | { | 220 | { |
220 | struct bucket_table *tbl; | 221 | struct bucket_table *tbl = NULL; |
221 | size_t size; | 222 | size_t size; |
222 | int i; | 223 | int i; |
223 | 224 | ||
224 | size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]); | 225 | size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]); |
225 | tbl = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); | 226 | if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) |
227 | tbl = kzalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); | ||
226 | if (tbl == NULL) | 228 | if (tbl == NULL) |
227 | tbl = vzalloc(size); | 229 | tbl = vzalloc(size); |
228 | |||
229 | if (tbl == NULL) | 230 | if (tbl == NULL) |
230 | return NULL; | 231 | return NULL; |
231 | 232 | ||
@@ -247,26 +248,24 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, | |||
247 | * @ht: hash table | 248 | * @ht: hash table |
248 | * @new_size: new table size | 249 | * @new_size: new table size |
249 | */ | 250 | */ |
250 | bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size) | 251 | static bool rht_grow_above_75(const struct rhashtable *ht, size_t new_size) |
251 | { | 252 | { |
252 | /* Expand table when exceeding 75% load */ | 253 | /* Expand table when exceeding 75% load */ |
253 | return atomic_read(&ht->nelems) > (new_size / 4 * 3) && | 254 | return atomic_read(&ht->nelems) > (new_size / 4 * 3) && |
254 | (ht->p.max_shift && atomic_read(&ht->shift) < ht->p.max_shift); | 255 | (!ht->p.max_shift || atomic_read(&ht->shift) < ht->p.max_shift); |
255 | } | 256 | } |
256 | EXPORT_SYMBOL_GPL(rht_grow_above_75); | ||
257 | 257 | ||
258 | /** | 258 | /** |
259 | * rht_shrink_below_30 - returns true if nelems < 0.3 * table-size | 259 | * rht_shrink_below_30 - returns true if nelems < 0.3 * table-size |
260 | * @ht: hash table | 260 | * @ht: hash table |
261 | * @new_size: new table size | 261 | * @new_size: new table size |
262 | */ | 262 | */ |
263 | bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size) | 263 | static bool rht_shrink_below_30(const struct rhashtable *ht, size_t new_size) |
264 | { | 264 | { |
265 | /* Shrink table beneath 30% load */ | 265 | /* Shrink table beneath 30% load */ |
266 | return atomic_read(&ht->nelems) < (new_size * 3 / 10) && | 266 | return atomic_read(&ht->nelems) < (new_size * 3 / 10) && |
267 | (atomic_read(&ht->shift) > ht->p.min_shift); | 267 | (atomic_read(&ht->shift) > ht->p.min_shift); |
268 | } | 268 | } |
269 | EXPORT_SYMBOL_GPL(rht_shrink_below_30); | ||
270 | 269 | ||
271 | static void lock_buckets(struct bucket_table *new_tbl, | 270 | static void lock_buckets(struct bucket_table *new_tbl, |
272 | struct bucket_table *old_tbl, unsigned int hash) | 271 | struct bucket_table *old_tbl, unsigned int hash) |
@@ -414,6 +413,7 @@ int rhashtable_expand(struct rhashtable *ht) | |||
414 | } | 413 | } |
415 | } | 414 | } |
416 | unlock_buckets(new_tbl, old_tbl, new_hash); | 415 | unlock_buckets(new_tbl, old_tbl, new_hash); |
416 | cond_resched(); | ||
417 | } | 417 | } |
418 | 418 | ||
419 | /* Unzip interleaved hash chains */ | 419 | /* Unzip interleaved hash chains */ |
@@ -437,6 +437,7 @@ int rhashtable_expand(struct rhashtable *ht) | |||
437 | complete = false; | 437 | complete = false; |
438 | 438 | ||
439 | unlock_buckets(new_tbl, old_tbl, old_hash); | 439 | unlock_buckets(new_tbl, old_tbl, old_hash); |
440 | cond_resched(); | ||
440 | } | 441 | } |
441 | } | 442 | } |
442 | 443 | ||
@@ -495,6 +496,7 @@ int rhashtable_shrink(struct rhashtable *ht) | |||
495 | tbl->buckets[new_hash + new_tbl->size]); | 496 | tbl->buckets[new_hash + new_tbl->size]); |
496 | 497 | ||
497 | unlock_buckets(new_tbl, tbl, new_hash); | 498 | unlock_buckets(new_tbl, tbl, new_hash); |
499 | cond_resched(); | ||
498 | } | 500 | } |
499 | 501 | ||
500 | /* Publish the new, valid hash table */ | 502 | /* Publish the new, valid hash table */ |
@@ -528,31 +530,19 @@ static void rht_deferred_worker(struct work_struct *work) | |||
528 | list_for_each_entry(walker, &ht->walkers, list) | 530 | list_for_each_entry(walker, &ht->walkers, list) |
529 | walker->resize = true; | 531 | walker->resize = true; |
530 | 532 | ||
531 | if (ht->p.grow_decision && ht->p.grow_decision(ht, tbl->size)) | 533 | if (rht_grow_above_75(ht, tbl->size)) |
532 | rhashtable_expand(ht); | 534 | rhashtable_expand(ht); |
533 | else if (ht->p.shrink_decision && ht->p.shrink_decision(ht, tbl->size)) | 535 | else if (rht_shrink_below_30(ht, tbl->size)) |
534 | rhashtable_shrink(ht); | 536 | rhashtable_shrink(ht); |
535 | |||
536 | unlock: | 537 | unlock: |
537 | mutex_unlock(&ht->mutex); | 538 | mutex_unlock(&ht->mutex); |
538 | } | 539 | } |
539 | 540 | ||
540 | static void rhashtable_wakeup_worker(struct rhashtable *ht) | ||
541 | { | ||
542 | struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht); | ||
543 | struct bucket_table *new_tbl = rht_dereference_rcu(ht->future_tbl, ht); | ||
544 | size_t size = tbl->size; | ||
545 | |||
546 | /* Only adjust the table if no resizing is currently in progress. */ | ||
547 | if (tbl == new_tbl && | ||
548 | ((ht->p.grow_decision && ht->p.grow_decision(ht, size)) || | ||
549 | (ht->p.shrink_decision && ht->p.shrink_decision(ht, size)))) | ||
550 | schedule_work(&ht->run_work); | ||
551 | } | ||
552 | |||
553 | static void __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj, | 541 | static void __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj, |
554 | struct bucket_table *tbl, u32 hash) | 542 | struct bucket_table *tbl, |
543 | const struct bucket_table *old_tbl, u32 hash) | ||
555 | { | 544 | { |
545 | bool no_resize_running = tbl == old_tbl; | ||
556 | struct rhash_head *head; | 546 | struct rhash_head *head; |
557 | 547 | ||
558 | hash = rht_bucket_index(tbl, hash); | 548 | hash = rht_bucket_index(tbl, hash); |
@@ -568,8 +558,8 @@ static void __rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj, | |||
568 | rcu_assign_pointer(tbl->buckets[hash], obj); | 558 | rcu_assign_pointer(tbl->buckets[hash], obj); |
569 | 559 | ||
570 | atomic_inc(&ht->nelems); | 560 | atomic_inc(&ht->nelems); |
571 | 561 | if (no_resize_running && rht_grow_above_75(ht, tbl->size)) | |
572 | rhashtable_wakeup_worker(ht); | 562 | schedule_work(&ht->run_work); |
573 | } | 563 | } |
574 | 564 | ||
575 | /** | 565 | /** |
@@ -599,7 +589,7 @@ void rhashtable_insert(struct rhashtable *ht, struct rhash_head *obj) | |||
599 | hash = obj_raw_hashfn(ht, rht_obj(ht, obj)); | 589 | hash = obj_raw_hashfn(ht, rht_obj(ht, obj)); |
600 | 590 | ||
601 | lock_buckets(tbl, old_tbl, hash); | 591 | lock_buckets(tbl, old_tbl, hash); |
602 | __rhashtable_insert(ht, obj, tbl, hash); | 592 | __rhashtable_insert(ht, obj, tbl, old_tbl, hash); |
603 | unlock_buckets(tbl, old_tbl, hash); | 593 | unlock_buckets(tbl, old_tbl, hash); |
604 | 594 | ||
605 | rcu_read_unlock(); | 595 | rcu_read_unlock(); |
@@ -681,8 +671,11 @@ found: | |||
681 | unlock_buckets(new_tbl, old_tbl, new_hash); | 671 | unlock_buckets(new_tbl, old_tbl, new_hash); |
682 | 672 | ||
683 | if (ret) { | 673 | if (ret) { |
674 | bool no_resize_running = new_tbl == old_tbl; | ||
675 | |||
684 | atomic_dec(&ht->nelems); | 676 | atomic_dec(&ht->nelems); |
685 | rhashtable_wakeup_worker(ht); | 677 | if (no_resize_running && rht_shrink_below_30(ht, new_tbl->size)) |
678 | schedule_work(&ht->run_work); | ||
686 | } | 679 | } |
687 | 680 | ||
688 | rcu_read_unlock(); | 681 | rcu_read_unlock(); |
@@ -852,7 +845,7 @@ bool rhashtable_lookup_compare_insert(struct rhashtable *ht, | |||
852 | goto exit; | 845 | goto exit; |
853 | } | 846 | } |
854 | 847 | ||
855 | __rhashtable_insert(ht, obj, new_tbl, new_hash); | 848 | __rhashtable_insert(ht, obj, new_tbl, old_tbl, new_hash); |
856 | 849 | ||
857 | exit: | 850 | exit: |
858 | unlock_buckets(new_tbl, old_tbl, new_hash); | 851 | unlock_buckets(new_tbl, old_tbl, new_hash); |
@@ -894,6 +887,9 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter) | |||
894 | if (!iter->walker) | 887 | if (!iter->walker) |
895 | return -ENOMEM; | 888 | return -ENOMEM; |
896 | 889 | ||
890 | INIT_LIST_HEAD(&iter->walker->list); | ||
891 | iter->walker->resize = false; | ||
892 | |||
897 | mutex_lock(&ht->mutex); | 893 | mutex_lock(&ht->mutex); |
898 | list_add(&iter->walker->list, &ht->walkers); | 894 | list_add(&iter->walker->list, &ht->walkers); |
899 | mutex_unlock(&ht->mutex); | 895 | mutex_unlock(&ht->mutex); |
@@ -1111,8 +1107,7 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params) | |||
1111 | if (!ht->p.hash_rnd) | 1107 | if (!ht->p.hash_rnd) |
1112 | get_random_bytes(&ht->p.hash_rnd, sizeof(ht->p.hash_rnd)); | 1108 | get_random_bytes(&ht->p.hash_rnd, sizeof(ht->p.hash_rnd)); |
1113 | 1109 | ||
1114 | if (ht->p.grow_decision || ht->p.shrink_decision) | 1110 | INIT_WORK(&ht->run_work, rht_deferred_worker); |
1115 | INIT_WORK(&ht->run_work, rht_deferred_worker); | ||
1116 | 1111 | ||
1117 | return 0; | 1112 | return 0; |
1118 | } | 1113 | } |
@@ -1130,8 +1125,7 @@ void rhashtable_destroy(struct rhashtable *ht) | |||
1130 | { | 1125 | { |
1131 | ht->being_destroyed = true; | 1126 | ht->being_destroyed = true; |
1132 | 1127 | ||
1133 | if (ht->p.grow_decision || ht->p.shrink_decision) | 1128 | cancel_work_sync(&ht->run_work); |
1134 | cancel_work_sync(&ht->run_work); | ||
1135 | 1129 | ||
1136 | mutex_lock(&ht->mutex); | 1130 | mutex_lock(&ht->mutex); |
1137 | bucket_table_free(rht_dereference(ht->tbl, ht)); | 1131 | bucket_table_free(rht_dereference(ht->tbl, ht)); |
diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index 1dfeba73fc74..67c7593d1dd6 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c | |||
@@ -191,18 +191,18 @@ error: | |||
191 | return err; | 191 | return err; |
192 | } | 192 | } |
193 | 193 | ||
194 | static struct rhashtable ht; | ||
195 | |||
194 | static int __init test_rht_init(void) | 196 | static int __init test_rht_init(void) |
195 | { | 197 | { |
196 | struct rhashtable ht; | ||
197 | struct rhashtable_params params = { | 198 | struct rhashtable_params params = { |
198 | .nelem_hint = TEST_HT_SIZE, | 199 | .nelem_hint = TEST_HT_SIZE, |
199 | .head_offset = offsetof(struct test_obj, node), | 200 | .head_offset = offsetof(struct test_obj, node), |
200 | .key_offset = offsetof(struct test_obj, value), | 201 | .key_offset = offsetof(struct test_obj, value), |
201 | .key_len = sizeof(int), | 202 | .key_len = sizeof(int), |
202 | .hashfn = jhash, | 203 | .hashfn = jhash, |
204 | .max_shift = 1, /* we expand/shrink manually here */ | ||
203 | .nulls_base = (3U << RHT_BASE_SHIFT), | 205 | .nulls_base = (3U << RHT_BASE_SHIFT), |
204 | .grow_decision = rht_grow_above_75, | ||
205 | .shrink_decision = rht_shrink_below_30, | ||
206 | }; | 206 | }; |
207 | int err; | 207 | int err; |
208 | 208 | ||
@@ -222,6 +222,11 @@ static int __init test_rht_init(void) | |||
222 | return err; | 222 | return err; |
223 | } | 223 | } |
224 | 224 | ||
225 | static void __exit test_rht_exit(void) | ||
226 | { | ||
227 | } | ||
228 | |||
225 | module_init(test_rht_init); | 229 | module_init(test_rht_init); |
230 | module_exit(test_rht_exit); | ||
226 | 231 | ||
227 | MODULE_LICENSE("GPL v2"); | 232 | MODULE_LICENSE("GPL v2"); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index d18d3a6e7337..9fe07692eaad 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -5247,7 +5247,7 @@ static int memory_low_show(struct seq_file *m, void *v) | |||
5247 | unsigned long low = ACCESS_ONCE(memcg->low); | 5247 | unsigned long low = ACCESS_ONCE(memcg->low); |
5248 | 5248 | ||
5249 | if (low == PAGE_COUNTER_MAX) | 5249 | if (low == PAGE_COUNTER_MAX) |
5250 | seq_puts(m, "infinity\n"); | 5250 | seq_puts(m, "max\n"); |
5251 | else | 5251 | else |
5252 | seq_printf(m, "%llu\n", (u64)low * PAGE_SIZE); | 5252 | seq_printf(m, "%llu\n", (u64)low * PAGE_SIZE); |
5253 | 5253 | ||
@@ -5262,7 +5262,7 @@ static ssize_t memory_low_write(struct kernfs_open_file *of, | |||
5262 | int err; | 5262 | int err; |
5263 | 5263 | ||
5264 | buf = strstrip(buf); | 5264 | buf = strstrip(buf); |
5265 | err = page_counter_memparse(buf, "infinity", &low); | 5265 | err = page_counter_memparse(buf, "max", &low); |
5266 | if (err) | 5266 | if (err) |
5267 | return err; | 5267 | return err; |
5268 | 5268 | ||
@@ -5277,7 +5277,7 @@ static int memory_high_show(struct seq_file *m, void *v) | |||
5277 | unsigned long high = ACCESS_ONCE(memcg->high); | 5277 | unsigned long high = ACCESS_ONCE(memcg->high); |
5278 | 5278 | ||
5279 | if (high == PAGE_COUNTER_MAX) | 5279 | if (high == PAGE_COUNTER_MAX) |
5280 | seq_puts(m, "infinity\n"); | 5280 | seq_puts(m, "max\n"); |
5281 | else | 5281 | else |
5282 | seq_printf(m, "%llu\n", (u64)high * PAGE_SIZE); | 5282 | seq_printf(m, "%llu\n", (u64)high * PAGE_SIZE); |
5283 | 5283 | ||
@@ -5292,7 +5292,7 @@ static ssize_t memory_high_write(struct kernfs_open_file *of, | |||
5292 | int err; | 5292 | int err; |
5293 | 5293 | ||
5294 | buf = strstrip(buf); | 5294 | buf = strstrip(buf); |
5295 | err = page_counter_memparse(buf, "infinity", &high); | 5295 | err = page_counter_memparse(buf, "max", &high); |
5296 | if (err) | 5296 | if (err) |
5297 | return err; | 5297 | return err; |
5298 | 5298 | ||
@@ -5307,7 +5307,7 @@ static int memory_max_show(struct seq_file *m, void *v) | |||
5307 | unsigned long max = ACCESS_ONCE(memcg->memory.limit); | 5307 | unsigned long max = ACCESS_ONCE(memcg->memory.limit); |
5308 | 5308 | ||
5309 | if (max == PAGE_COUNTER_MAX) | 5309 | if (max == PAGE_COUNTER_MAX) |
5310 | seq_puts(m, "infinity\n"); | 5310 | seq_puts(m, "max\n"); |
5311 | else | 5311 | else |
5312 | seq_printf(m, "%llu\n", (u64)max * PAGE_SIZE); | 5312 | seq_printf(m, "%llu\n", (u64)max * PAGE_SIZE); |
5313 | 5313 | ||
@@ -5322,7 +5322,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, | |||
5322 | int err; | 5322 | int err; |
5323 | 5323 | ||
5324 | buf = strstrip(buf); | 5324 | buf = strstrip(buf); |
5325 | err = page_counter_memparse(buf, "infinity", &max); | 5325 | err = page_counter_memparse(buf, "max", &max); |
5326 | if (err) | 5326 | if (err) |
5327 | return err; | 5327 | return err; |
5328 | 5328 | ||
@@ -5426,7 +5426,7 @@ bool mem_cgroup_low(struct mem_cgroup *root, struct mem_cgroup *memcg) | |||
5426 | if (memcg == root_mem_cgroup) | 5426 | if (memcg == root_mem_cgroup) |
5427 | return false; | 5427 | return false; |
5428 | 5428 | ||
5429 | if (page_counter_read(&memcg->memory) > memcg->low) | 5429 | if (page_counter_read(&memcg->memory) >= memcg->low) |
5430 | return false; | 5430 | return false; |
5431 | 5431 | ||
5432 | while (memcg != root) { | 5432 | while (memcg != root) { |
@@ -5435,7 +5435,7 @@ bool mem_cgroup_low(struct mem_cgroup *root, struct mem_cgroup *memcg) | |||
5435 | if (memcg == root_mem_cgroup) | 5435 | if (memcg == root_mem_cgroup) |
5436 | break; | 5436 | break; |
5437 | 5437 | ||
5438 | if (page_counter_read(&memcg->memory) > memcg->low) | 5438 | if (page_counter_read(&memcg->memory) >= memcg->low) |
5439 | return false; | 5439 | return false; |
5440 | } | 5440 | } |
5441 | return true; | 5441 | return true; |
diff --git a/mm/nommu.c b/mm/nommu.c index 7296360fc057..3e67e7538ecf 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1213,11 +1213,9 @@ static int do_mmap_private(struct vm_area_struct *vma, | |||
1213 | if (sysctl_nr_trim_pages && total - point >= sysctl_nr_trim_pages) { | 1213 | if (sysctl_nr_trim_pages && total - point >= sysctl_nr_trim_pages) { |
1214 | total = point; | 1214 | total = point; |
1215 | kdebug("try to alloc exact %lu pages", total); | 1215 | kdebug("try to alloc exact %lu pages", total); |
1216 | base = alloc_pages_exact(len, GFP_KERNEL); | ||
1217 | } else { | ||
1218 | base = (void *)__get_free_pages(GFP_KERNEL, order); | ||
1219 | } | 1216 | } |
1220 | 1217 | ||
1218 | base = alloc_pages_exact(total << PAGE_SHIFT, GFP_KERNEL); | ||
1221 | if (!base) | 1219 | if (!base) |
1222 | goto enomem; | 1220 | goto enomem; |
1223 | 1221 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a47f0b229a1a..7abfa70cdc1a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2353,8 +2353,15 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, | |||
2353 | if (ac->high_zoneidx < ZONE_NORMAL) | 2353 | if (ac->high_zoneidx < ZONE_NORMAL) |
2354 | goto out; | 2354 | goto out; |
2355 | /* The OOM killer does not compensate for light reclaim */ | 2355 | /* The OOM killer does not compensate for light reclaim */ |
2356 | if (!(gfp_mask & __GFP_FS)) | 2356 | if (!(gfp_mask & __GFP_FS)) { |
2357 | /* | ||
2358 | * XXX: Page reclaim didn't yield anything, | ||
2359 | * and the OOM killer can't be invoked, but | ||
2360 | * keep looping as per should_alloc_retry(). | ||
2361 | */ | ||
2362 | *did_some_progress = 1; | ||
2357 | goto out; | 2363 | goto out; |
2364 | } | ||
2358 | /* | 2365 | /* |
2359 | * GFP_THISNODE contains __GFP_NORETRY and we never hit this. | 2366 | * GFP_THISNODE contains __GFP_NORETRY and we never hit this. |
2360 | * Sanity check for bare calls of __GFP_THISNODE, not real OOM. | 2367 | * Sanity check for bare calls of __GFP_THISNODE, not real OOM. |
diff --git a/mm/shmem.c b/mm/shmem.c index 2f17cb5f00a4..cf2d0ca010bc 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1455,6 +1455,9 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode | |||
1455 | 1455 | ||
1456 | bool shmem_mapping(struct address_space *mapping) | 1456 | bool shmem_mapping(struct address_space *mapping) |
1457 | { | 1457 | { |
1458 | if (!mapping->host) | ||
1459 | return false; | ||
1460 | |||
1458 | return mapping->host->i_sb->s_op == &shmem_ops; | 1461 | return mapping->host->i_sb->s_op == &shmem_ops; |
1459 | } | 1462 | } |
1460 | 1463 | ||
diff --git a/net/bridge/br.c b/net/bridge/br.c index fb57ab6b24f9..02c24cf63c34 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c | |||
@@ -190,6 +190,8 @@ static int __init br_init(void) | |||
190 | { | 190 | { |
191 | int err; | 191 | int err; |
192 | 192 | ||
193 | BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb)); | ||
194 | |||
193 | err = stp_proto_register(&br_stp_proto); | 195 | err = stp_proto_register(&br_stp_proto); |
194 | if (err < 0) { | 196 | if (err < 0) { |
195 | pr_err("bridge: can't register sap for STP\n"); | 197 | pr_err("bridge: can't register sap for STP\n"); |
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index 8bc7caa28e64..434ba8557826 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
@@ -84,7 +84,7 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
84 | u16 tmp; | 84 | u16 tmp; |
85 | u16 len; | 85 | u16 len; |
86 | u16 hdrchks; | 86 | u16 hdrchks; |
87 | u16 pktchks; | 87 | int pktchks; |
88 | struct cffrml *this; | 88 | struct cffrml *this; |
89 | this = container_obj(layr); | 89 | this = container_obj(layr); |
90 | 90 | ||
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c index 1be0b521ac49..f6c3b2137eea 100644 --- a/net/caif/cfpkt_skbuff.c +++ b/net/caif/cfpkt_skbuff.c | |||
@@ -255,9 +255,9 @@ inline u16 cfpkt_getlen(struct cfpkt *pkt) | |||
255 | return skb->len; | 255 | return skb->len; |
256 | } | 256 | } |
257 | 257 | ||
258 | inline u16 cfpkt_iterate(struct cfpkt *pkt, | 258 | int cfpkt_iterate(struct cfpkt *pkt, |
259 | u16 (*iter_func)(u16, void *, u16), | 259 | u16 (*iter_func)(u16, void *, u16), |
260 | u16 data) | 260 | u16 data) |
261 | { | 261 | { |
262 | /* | 262 | /* |
263 | * Don't care about the performance hit of linearizing, | 263 | * Don't care about the performance hit of linearizing, |
diff --git a/net/compat.c b/net/compat.c index 3236b4167a32..94d3d5e97883 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -711,24 +711,18 @@ static unsigned char nas[21] = { | |||
711 | 711 | ||
712 | COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) | 712 | COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) |
713 | { | 713 | { |
714 | if (flags & MSG_CMSG_COMPAT) | ||
715 | return -EINVAL; | ||
716 | return __sys_sendmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | 714 | return __sys_sendmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); |
717 | } | 715 | } |
718 | 716 | ||
719 | COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, | 717 | COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, |
720 | unsigned int, vlen, unsigned int, flags) | 718 | unsigned int, vlen, unsigned int, flags) |
721 | { | 719 | { |
722 | if (flags & MSG_CMSG_COMPAT) | ||
723 | return -EINVAL; | ||
724 | return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | 720 | return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
725 | flags | MSG_CMSG_COMPAT); | 721 | flags | MSG_CMSG_COMPAT); |
726 | } | 722 | } |
727 | 723 | ||
728 | COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) | 724 | COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags) |
729 | { | 725 | { |
730 | if (flags & MSG_CMSG_COMPAT) | ||
731 | return -EINVAL; | ||
732 | return __sys_recvmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | 726 | return __sys_recvmsg(fd, (struct user_msghdr __user *)msg, flags | MSG_CMSG_COMPAT); |
733 | } | 727 | } |
734 | 728 | ||
@@ -751,9 +745,6 @@ COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg, | |||
751 | int datagrams; | 745 | int datagrams; |
752 | struct timespec ktspec; | 746 | struct timespec ktspec; |
753 | 747 | ||
754 | if (flags & MSG_CMSG_COMPAT) | ||
755 | return -EINVAL; | ||
756 | |||
757 | if (timeout == NULL) | 748 | if (timeout == NULL) |
758 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | 749 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
759 | flags | MSG_CMSG_COMPAT, NULL); | 750 | flags | MSG_CMSG_COMPAT, NULL); |
diff --git a/net/core/dev.c b/net/core/dev.c index 8f9710c62e20..962ee9d71964 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -946,7 +946,7 @@ bool dev_valid_name(const char *name) | |||
946 | return false; | 946 | return false; |
947 | 947 | ||
948 | while (*name) { | 948 | while (*name) { |
949 | if (*name == '/' || isspace(*name)) | 949 | if (*name == '/' || *name == ':' || isspace(*name)) |
950 | return false; | 950 | return false; |
951 | name++; | 951 | name++; |
952 | } | 952 | } |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 91f74f3eb204..aa378ecef186 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -98,6 +98,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] | |||
98 | [NETIF_F_RXALL_BIT] = "rx-all", | 98 | [NETIF_F_RXALL_BIT] = "rx-all", |
99 | [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload", | 99 | [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload", |
100 | [NETIF_F_BUSY_POLL_BIT] = "busy-poll", | 100 | [NETIF_F_BUSY_POLL_BIT] = "busy-poll", |
101 | [NETIF_F_HW_SWITCH_OFFLOAD_BIT] = "hw-switch-offload", | ||
101 | }; | 102 | }; |
102 | 103 | ||
103 | static const char | 104 | static const char |
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c index 0c08062d1796..1e2f46a69d50 100644 --- a/net/core/gen_stats.c +++ b/net/core/gen_stats.c | |||
@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) | |||
32 | return 0; | 32 | return 0; |
33 | 33 | ||
34 | nla_put_failure: | 34 | nla_put_failure: |
35 | kfree(d->xstats); | ||
36 | d->xstats = NULL; | ||
37 | d->xstats_len = 0; | ||
35 | spin_unlock_bh(d->lock); | 38 | spin_unlock_bh(d->lock); |
36 | return -1; | 39 | return -1; |
37 | } | 40 | } |
@@ -305,7 +308,9 @@ int | |||
305 | gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) | 308 | gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) |
306 | { | 309 | { |
307 | if (d->compat_xstats) { | 310 | if (d->compat_xstats) { |
308 | d->xstats = st; | 311 | d->xstats = kmemdup(st, len, GFP_ATOMIC); |
312 | if (!d->xstats) | ||
313 | goto err_out; | ||
309 | d->xstats_len = len; | 314 | d->xstats_len = len; |
310 | } | 315 | } |
311 | 316 | ||
@@ -313,6 +318,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) | |||
313 | return gnet_stats_copy(d, TCA_STATS_APP, st, len); | 318 | return gnet_stats_copy(d, TCA_STATS_APP, st, len); |
314 | 319 | ||
315 | return 0; | 320 | return 0; |
321 | |||
322 | err_out: | ||
323 | d->xstats_len = 0; | ||
324 | spin_unlock_bh(d->lock); | ||
325 | return -1; | ||
316 | } | 326 | } |
317 | EXPORT_SYMBOL(gnet_stats_copy_app); | 327 | EXPORT_SYMBOL(gnet_stats_copy_app); |
318 | 328 | ||
@@ -345,6 +355,9 @@ gnet_stats_finish_copy(struct gnet_dump *d) | |||
345 | return -1; | 355 | return -1; |
346 | } | 356 | } |
347 | 357 | ||
358 | kfree(d->xstats); | ||
359 | d->xstats = NULL; | ||
360 | d->xstats_len = 0; | ||
348 | spin_unlock_bh(d->lock); | 361 | spin_unlock_bh(d->lock); |
349 | return 0; | 362 | return 0; |
350 | } | 363 | } |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index b4899f5b7388..508155b283dd 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1134,6 +1134,9 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1134 | return len; | 1134 | return len; |
1135 | 1135 | ||
1136 | i += len; | 1136 | i += len; |
1137 | if ((value > 1) && | ||
1138 | (!(pkt_dev->odev->priv_flags & IFF_TX_SKB_SHARING))) | ||
1139 | return -ENOTSUPP; | ||
1137 | pkt_dev->burst = value < 1 ? 1 : value; | 1140 | pkt_dev->burst = value < 1 ? 1 : value; |
1138 | sprintf(pg_result, "OK: burst=%d", pkt_dev->burst); | 1141 | sprintf(pg_result, "OK: burst=%d", pkt_dev->burst); |
1139 | return count; | 1142 | return count; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index ab293a3066b3..25b4b5d23485 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1300,7 +1300,6 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
1300 | s_h = cb->args[0]; | 1300 | s_h = cb->args[0]; |
1301 | s_idx = cb->args[1]; | 1301 | s_idx = cb->args[1]; |
1302 | 1302 | ||
1303 | rcu_read_lock(); | ||
1304 | cb->seq = net->dev_base_seq; | 1303 | cb->seq = net->dev_base_seq; |
1305 | 1304 | ||
1306 | /* A hack to preserve kernel<->userspace interface. | 1305 | /* A hack to preserve kernel<->userspace interface. |
@@ -1322,7 +1321,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
1322 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { | 1321 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { |
1323 | idx = 0; | 1322 | idx = 0; |
1324 | head = &net->dev_index_head[h]; | 1323 | head = &net->dev_index_head[h]; |
1325 | hlist_for_each_entry_rcu(dev, head, index_hlist) { | 1324 | hlist_for_each_entry(dev, head, index_hlist) { |
1326 | if (idx < s_idx) | 1325 | if (idx < s_idx) |
1327 | goto cont; | 1326 | goto cont; |
1328 | err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, | 1327 | err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, |
@@ -1344,7 +1343,6 @@ cont: | |||
1344 | } | 1343 | } |
1345 | } | 1344 | } |
1346 | out: | 1345 | out: |
1347 | rcu_read_unlock(); | ||
1348 | cb->args[1] = idx; | 1346 | cb->args[1] = idx; |
1349 | cb->args[0] = h; | 1347 | cb->args[0] = h; |
1350 | 1348 | ||
@@ -2012,8 +2010,8 @@ replay: | |||
2012 | } | 2010 | } |
2013 | 2011 | ||
2014 | if (1) { | 2012 | if (1) { |
2015 | struct nlattr *attr[ops ? ops->maxtype + 1 : 0]; | 2013 | struct nlattr *attr[ops ? ops->maxtype + 1 : 1]; |
2016 | struct nlattr *slave_attr[m_ops ? m_ops->slave_maxtype + 1 : 0]; | 2014 | struct nlattr *slave_attr[m_ops ? m_ops->slave_maxtype + 1 : 1]; |
2017 | struct nlattr **data = NULL; | 2015 | struct nlattr **data = NULL; |
2018 | struct nlattr **slave_data = NULL; | 2016 | struct nlattr **slave_data = NULL; |
2019 | struct net *dest_net, *link_net = NULL; | 2017 | struct net *dest_net, *link_net = NULL; |
@@ -2122,6 +2120,10 @@ replay: | |||
2122 | if (IS_ERR(dest_net)) | 2120 | if (IS_ERR(dest_net)) |
2123 | return PTR_ERR(dest_net); | 2121 | return PTR_ERR(dest_net); |
2124 | 2122 | ||
2123 | err = -EPERM; | ||
2124 | if (!netlink_ns_capable(skb, dest_net->user_ns, CAP_NET_ADMIN)) | ||
2125 | goto out; | ||
2126 | |||
2125 | if (tb[IFLA_LINK_NETNSID]) { | 2127 | if (tb[IFLA_LINK_NETNSID]) { |
2126 | int id = nla_get_s32(tb[IFLA_LINK_NETNSID]); | 2128 | int id = nla_get_s32(tb[IFLA_LINK_NETNSID]); |
2127 | 2129 | ||
@@ -2130,6 +2132,9 @@ replay: | |||
2130 | err = -EINVAL; | 2132 | err = -EINVAL; |
2131 | goto out; | 2133 | goto out; |
2132 | } | 2134 | } |
2135 | err = -EPERM; | ||
2136 | if (!netlink_ns_capable(skb, link_net->user_ns, CAP_NET_ADMIN)) | ||
2137 | goto out; | ||
2133 | } | 2138 | } |
2134 | 2139 | ||
2135 | dev = rtnl_create_link(link_net ? : dest_net, ifname, | 2140 | dev = rtnl_create_link(link_net ? : dest_net, ifname, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 88c613eab142..f80507823531 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3621,13 +3621,14 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) | |||
3621 | { | 3621 | { |
3622 | struct sk_buff_head *q = &sk->sk_error_queue; | 3622 | struct sk_buff_head *q = &sk->sk_error_queue; |
3623 | struct sk_buff *skb, *skb_next; | 3623 | struct sk_buff *skb, *skb_next; |
3624 | unsigned long flags; | ||
3624 | int err = 0; | 3625 | int err = 0; |
3625 | 3626 | ||
3626 | spin_lock_bh(&q->lock); | 3627 | spin_lock_irqsave(&q->lock, flags); |
3627 | skb = __skb_dequeue(q); | 3628 | skb = __skb_dequeue(q); |
3628 | if (skb && (skb_next = skb_peek(q))) | 3629 | if (skb && (skb_next = skb_peek(q))) |
3629 | err = SKB_EXT_ERR(skb_next)->ee.ee_errno; | 3630 | err = SKB_EXT_ERR(skb_next)->ee.ee_errno; |
3630 | spin_unlock_bh(&q->lock); | 3631 | spin_unlock_irqrestore(&q->lock, flags); |
3631 | 3632 | ||
3632 | sk->sk_err = err; | 3633 | sk->sk_err = err; |
3633 | if (err) | 3634 | if (err) |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 1d7c1256e845..3b81092771f8 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1062,7 +1062,7 @@ source_ok: | |||
1062 | if (decnet_debug_level & 16) | 1062 | if (decnet_debug_level & 16) |
1063 | printk(KERN_DEBUG | 1063 | printk(KERN_DEBUG |
1064 | "dn_route_output_slow: initial checks complete." | 1064 | "dn_route_output_slow: initial checks complete." |
1065 | " dst=%o4x src=%04x oif=%d try_hard=%d\n", | 1065 | " dst=%04x src=%04x oif=%d try_hard=%d\n", |
1066 | le16_to_cpu(fld.daddr), le16_to_cpu(fld.saddr), | 1066 | le16_to_cpu(fld.daddr), le16_to_cpu(fld.saddr), |
1067 | fld.flowidn_oif, try_hard); | 1067 | fld.flowidn_oif, try_hard); |
1068 | 1068 | ||
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index a138d75751df..44d27469ae55 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c | |||
@@ -359,8 +359,11 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) | |||
359 | struct hsr_port *port; | 359 | struct hsr_port *port; |
360 | 360 | ||
361 | hsr = netdev_priv(hsr_dev); | 361 | hsr = netdev_priv(hsr_dev); |
362 | |||
363 | rtnl_lock(); | ||
362 | hsr_for_each_port(hsr, port) | 364 | hsr_for_each_port(hsr, port) |
363 | hsr_del_port(port); | 365 | hsr_del_port(port); |
366 | rtnl_unlock(); | ||
364 | 367 | ||
365 | del_timer_sync(&hsr->prune_timer); | 368 | del_timer_sync(&hsr->prune_timer); |
366 | del_timer_sync(&hsr->announce_timer); | 369 | del_timer_sync(&hsr->announce_timer); |
diff --git a/net/hsr/hsr_main.c b/net/hsr/hsr_main.c index 779d28b65417..cd37d0011b42 100644 --- a/net/hsr/hsr_main.c +++ b/net/hsr/hsr_main.c | |||
@@ -36,6 +36,10 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event, | |||
36 | return NOTIFY_DONE; /* Not an HSR device */ | 36 | return NOTIFY_DONE; /* Not an HSR device */ |
37 | hsr = netdev_priv(dev); | 37 | hsr = netdev_priv(dev); |
38 | port = hsr_port_get_hsr(hsr, HSR_PT_MASTER); | 38 | port = hsr_port_get_hsr(hsr, HSR_PT_MASTER); |
39 | if (port == NULL) { | ||
40 | /* Resend of notification concerning removed device? */ | ||
41 | return NOTIFY_DONE; | ||
42 | } | ||
39 | } else { | 43 | } else { |
40 | hsr = port->hsr; | 44 | hsr = port->hsr; |
41 | } | 45 | } |
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c index a348dcbcd683..7d37366cc695 100644 --- a/net/hsr/hsr_slave.c +++ b/net/hsr/hsr_slave.c | |||
@@ -181,8 +181,10 @@ void hsr_del_port(struct hsr_port *port) | |||
181 | list_del_rcu(&port->port_list); | 181 | list_del_rcu(&port->port_list); |
182 | 182 | ||
183 | if (port != master) { | 183 | if (port != master) { |
184 | netdev_update_features(master->dev); | 184 | if (master != NULL) { |
185 | dev_set_mtu(master->dev, hsr_get_max_mtu(hsr)); | 185 | netdev_update_features(master->dev); |
186 | dev_set_mtu(master->dev, hsr_get_max_mtu(hsr)); | ||
187 | } | ||
186 | netdev_rx_handler_unregister(port->dev); | 188 | netdev_rx_handler_unregister(port->dev); |
187 | dev_set_promiscuity(port->dev, -1); | 189 | dev_set_promiscuity(port->dev, -1); |
188 | } | 190 | } |
@@ -192,5 +194,7 @@ void hsr_del_port(struct hsr_port *port) | |||
192 | */ | 194 | */ |
193 | 195 | ||
194 | synchronize_rcu(); | 196 | synchronize_rcu(); |
195 | dev_put(port->dev); | 197 | |
198 | if (port != master) | ||
199 | dev_put(port->dev); | ||
196 | } | 200 | } |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index e5b6d0ddcb58..2c8d98e728c0 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -664,7 +664,7 @@ struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) | |||
664 | if (skb->protocol != htons(ETH_P_IP)) | 664 | if (skb->protocol != htons(ETH_P_IP)) |
665 | return skb; | 665 | return skb; |
666 | 666 | ||
667 | if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) | 667 | if (skb_copy_bits(skb, 0, &iph, sizeof(iph)) < 0) |
668 | return skb; | 668 | return skb; |
669 | 669 | ||
670 | if (iph.ihl < 5 || iph.version != 4) | 670 | if (iph.ihl < 5 || iph.version != 4) |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index d68199d9b2b0..a7aea2048a0d 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -888,7 +888,8 @@ static int __ip_append_data(struct sock *sk, | |||
888 | cork->length += length; | 888 | cork->length += length; |
889 | if (((length > mtu) || (skb && skb_is_gso(skb))) && | 889 | if (((length > mtu) || (skb && skb_is_gso(skb))) && |
890 | (sk->sk_protocol == IPPROTO_UDP) && | 890 | (sk->sk_protocol == IPPROTO_UDP) && |
891 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { | 891 | (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && |
892 | (sk->sk_type == SOCK_DGRAM)) { | ||
892 | err = ip_ufo_append_data(sk, queue, getfrag, from, length, | 893 | err = ip_ufo_append_data(sk, queue, getfrag, from, length, |
893 | hh_len, fragheaderlen, transhdrlen, | 894 | hh_len, fragheaderlen, transhdrlen, |
894 | maxfraglen, flags); | 895 | maxfraglen, flags); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 8fdd27b17306..fb4cf8b8e121 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4770,7 +4770,7 @@ static bool tcp_should_expand_sndbuf(const struct sock *sk) | |||
4770 | return false; | 4770 | return false; |
4771 | 4771 | ||
4772 | /* If we filled the congestion window, do not expand. */ | 4772 | /* If we filled the congestion window, do not expand. */ |
4773 | if (tp->packets_out >= tp->snd_cwnd) | 4773 | if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) |
4774 | return false; | 4774 | return false; |
4775 | 4775 | ||
4776 | return true; | 4776 | return true; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 98e4a63d72bb..b6030025f411 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4903,6 +4903,21 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int write, | |||
4903 | return ret; | 4903 | return ret; |
4904 | } | 4904 | } |
4905 | 4905 | ||
4906 | static | ||
4907 | int addrconf_sysctl_mtu(struct ctl_table *ctl, int write, | ||
4908 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
4909 | { | ||
4910 | struct inet6_dev *idev = ctl->extra1; | ||
4911 | int min_mtu = IPV6_MIN_MTU; | ||
4912 | struct ctl_table lctl; | ||
4913 | |||
4914 | lctl = *ctl; | ||
4915 | lctl.extra1 = &min_mtu; | ||
4916 | lctl.extra2 = idev ? &idev->dev->mtu : NULL; | ||
4917 | |||
4918 | return proc_dointvec_minmax(&lctl, write, buffer, lenp, ppos); | ||
4919 | } | ||
4920 | |||
4906 | static void dev_disable_change(struct inet6_dev *idev) | 4921 | static void dev_disable_change(struct inet6_dev *idev) |
4907 | { | 4922 | { |
4908 | struct netdev_notifier_info info; | 4923 | struct netdev_notifier_info info; |
@@ -5054,7 +5069,7 @@ static struct addrconf_sysctl_table | |||
5054 | .data = &ipv6_devconf.mtu6, | 5069 | .data = &ipv6_devconf.mtu6, |
5055 | .maxlen = sizeof(int), | 5070 | .maxlen = sizeof(int), |
5056 | .mode = 0644, | 5071 | .mode = 0644, |
5057 | .proc_handler = proc_dointvec, | 5072 | .proc_handler = addrconf_sysctl_mtu, |
5058 | }, | 5073 | }, |
5059 | { | 5074 | { |
5060 | .procname = "accept_ra", | 5075 | .procname = "accept_ra", |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 7deebf102cba..0a04a37305d5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1298,7 +1298,8 @@ emsgsize: | |||
1298 | if (((length > mtu) || | 1298 | if (((length > mtu) || |
1299 | (skb && skb_is_gso(skb))) && | 1299 | (skb && skb_is_gso(skb))) && |
1300 | (sk->sk_protocol == IPPROTO_UDP) && | 1300 | (sk->sk_protocol == IPPROTO_UDP) && |
1301 | (rt->dst.dev->features & NETIF_F_UFO)) { | 1301 | (rt->dst.dev->features & NETIF_F_UFO) && |
1302 | (sk->sk_type == SOCK_DGRAM)) { | ||
1302 | err = ip6_ufo_append_data(sk, queue, getfrag, from, length, | 1303 | err = ip6_ufo_append_data(sk, queue, getfrag, from, length, |
1303 | hh_len, fragheaderlen, | 1304 | hh_len, fragheaderlen, |
1304 | transhdrlen, mtu, flags, rt); | 1305 | transhdrlen, mtu, flags, rt); |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 40695b9751c1..683346d2d633 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -798,7 +798,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) | |||
798 | orig_jiffies = jiffies; | 798 | orig_jiffies = jiffies; |
799 | 799 | ||
800 | /* Set poll time to 200 ms */ | 800 | /* Set poll time to 200 ms */ |
801 | poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); | 801 | poll_time = msecs_to_jiffies(200); |
802 | if (timeout) | ||
803 | poll_time = min_t(unsigned long, timeout, poll_time); | ||
802 | 804 | ||
803 | spin_lock_irqsave(&self->spinlock, flags); | 805 | spin_lock_irqsave(&self->spinlock, flags); |
804 | while (self->tx_skb && self->tx_skb->len) { | 806 | while (self->tx_skb && self->tx_skb->len) { |
@@ -811,7 +813,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) | |||
811 | break; | 813 | break; |
812 | } | 814 | } |
813 | spin_unlock_irqrestore(&self->spinlock, flags); | 815 | spin_unlock_irqrestore(&self->spinlock, flags); |
814 | current->state = TASK_RUNNING; | 816 | __set_current_state(TASK_RUNNING); |
815 | } | 817 | } |
816 | 818 | ||
817 | /* | 819 | /* |
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c index 3c83a1e5ab03..1215693fdd22 100644 --- a/net/irda/irnet/irnet_ppp.c +++ b/net/irda/irnet/irnet_ppp.c | |||
@@ -305,7 +305,7 @@ irnet_ctrl_read(irnet_socket * ap, | |||
305 | 305 | ||
306 | /* Put ourselves on the wait queue to be woken up */ | 306 | /* Put ourselves on the wait queue to be woken up */ |
307 | add_wait_queue(&irnet_events.rwait, &wait); | 307 | add_wait_queue(&irnet_events.rwait, &wait); |
308 | current->state = TASK_INTERRUPTIBLE; | 308 | set_current_state(TASK_INTERRUPTIBLE); |
309 | for(;;) | 309 | for(;;) |
310 | { | 310 | { |
311 | /* If there is unread events */ | 311 | /* If there is unread events */ |
@@ -321,7 +321,7 @@ irnet_ctrl_read(irnet_socket * ap, | |||
321 | /* Yield and wait to be woken up */ | 321 | /* Yield and wait to be woken up */ |
322 | schedule(); | 322 | schedule(); |
323 | } | 323 | } |
324 | current->state = TASK_RUNNING; | 324 | __set_current_state(TASK_RUNNING); |
325 | remove_wait_queue(&irnet_events.rwait, &wait); | 325 | remove_wait_queue(&irnet_events.rwait, &wait); |
326 | 326 | ||
327 | /* Did we got it ? */ | 327 | /* Did we got it ? */ |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index ff0d2db09df9..5bcd4e5589d3 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -1508,6 +1508,8 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) | |||
1508 | if (ieee80211_chanctx_refcount(local, ctx) == 0) | 1508 | if (ieee80211_chanctx_refcount(local, ctx) == 0) |
1509 | ieee80211_free_chanctx(local, ctx); | 1509 | ieee80211_free_chanctx(local, ctx); |
1510 | 1510 | ||
1511 | sdata->radar_required = false; | ||
1512 | |||
1511 | /* Unreserving may ready an in-place reservation. */ | 1513 | /* Unreserving may ready an in-place reservation. */ |
1512 | if (use_reserved_switch) | 1514 | if (use_reserved_switch) |
1513 | ieee80211_vif_use_reserved_switch(local); | 1515 | ieee80211_vif_use_reserved_switch(local); |
@@ -1566,6 +1568,9 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, | |||
1566 | ieee80211_recalc_smps_chanctx(local, ctx); | 1568 | ieee80211_recalc_smps_chanctx(local, ctx); |
1567 | ieee80211_recalc_radar_chanctx(local, ctx); | 1569 | ieee80211_recalc_radar_chanctx(local, ctx); |
1568 | out: | 1570 | out: |
1571 | if (ret) | ||
1572 | sdata->radar_required = false; | ||
1573 | |||
1569 | mutex_unlock(&local->chanctx_mtx); | 1574 | mutex_unlock(&local->chanctx_mtx); |
1570 | return ret; | 1575 | return ret; |
1571 | } | 1576 | } |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 7c86a002df95..ef6e8a6c4253 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -373,7 +373,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
373 | rate++; | 373 | rate++; |
374 | mi->sample_deferred++; | 374 | mi->sample_deferred++; |
375 | } else { | 375 | } else { |
376 | if (!msr->sample_limit != 0) | 376 | if (!msr->sample_limit) |
377 | return; | 377 | return; |
378 | 378 | ||
379 | mi->sample_packets++; | 379 | mi->sample_packets++; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 88a18ffe2975..07bd8db00af8 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -566,6 +566,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) | |||
566 | if (tx->sdata->control_port_no_encrypt) | 566 | if (tx->sdata->control_port_no_encrypt) |
567 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 567 | info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
568 | info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; | 568 | info->control.flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO; |
569 | info->flags |= IEEE80211_TX_CTL_USE_MINRATE; | ||
569 | } | 570 | } |
570 | 571 | ||
571 | return TX_CONTINUE; | 572 | return TX_CONTINUE; |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index e55759056361..ed99448671c3 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3402,7 +3402,7 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info) | |||
3402 | if (udest.af == 0) | 3402 | if (udest.af == 0) |
3403 | udest.af = svc->af; | 3403 | udest.af = svc->af; |
3404 | 3404 | ||
3405 | if (udest.af != svc->af) { | 3405 | if (udest.af != svc->af && cmd != IPVS_CMD_DEL_DEST) { |
3406 | /* The synchronization protocol is incompatible | 3406 | /* The synchronization protocol is incompatible |
3407 | * with mixed family services | 3407 | * with mixed family services |
3408 | */ | 3408 | */ |
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index c598f74063a1..1279cd85663e 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -625,8 +625,12 @@ nft_match_select_ops(const struct nft_ctx *ctx, | |||
625 | struct xt_match *match = nft_match->ops.data; | 625 | struct xt_match *match = nft_match->ops.data; |
626 | 626 | ||
627 | if (strcmp(match->name, mt_name) == 0 && | 627 | if (strcmp(match->name, mt_name) == 0 && |
628 | match->revision == rev && match->family == family) | 628 | match->revision == rev && match->family == family) { |
629 | if (!try_module_get(match->me)) | ||
630 | return ERR_PTR(-ENOENT); | ||
631 | |||
629 | return &nft_match->ops; | 632 | return &nft_match->ops; |
633 | } | ||
630 | } | 634 | } |
631 | 635 | ||
632 | match = xt_request_find_match(family, mt_name, rev); | 636 | match = xt_request_find_match(family, mt_name, rev); |
@@ -695,8 +699,12 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
695 | struct xt_target *target = nft_target->ops.data; | 699 | struct xt_target *target = nft_target->ops.data; |
696 | 700 | ||
697 | if (strcmp(target->name, tg_name) == 0 && | 701 | if (strcmp(target->name, tg_name) == 0 && |
698 | target->revision == rev && target->family == family) | 702 | target->revision == rev && target->family == family) { |
703 | if (!try_module_get(target->me)) | ||
704 | return ERR_PTR(-ENOENT); | ||
705 | |||
699 | return &nft_target->ops; | 706 | return &nft_target->ops; |
707 | } | ||
700 | } | 708 | } |
701 | 709 | ||
702 | target = xt_request_find_target(family, tg_name, rev); | 710 | target = xt_request_find_target(family, tg_name, rev); |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index 61e6c407476a..c82df0a48fcd 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
@@ -192,8 +192,6 @@ static int nft_hash_init(const struct nft_set *set, | |||
192 | .key_offset = offsetof(struct nft_hash_elem, key), | 192 | .key_offset = offsetof(struct nft_hash_elem, key), |
193 | .key_len = set->klen, | 193 | .key_len = set->klen, |
194 | .hashfn = jhash, | 194 | .hashfn = jhash, |
195 | .grow_decision = rht_grow_above_75, | ||
196 | .shrink_decision = rht_shrink_below_30, | ||
197 | }; | 195 | }; |
198 | 196 | ||
199 | return rhashtable_init(priv, ¶ms); | 197 | return rhashtable_init(priv, ¶ms); |
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 30dbe34915ae..45e1b30e4fb2 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -378,12 +378,11 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
378 | mutex_lock(&recent_mutex); | 378 | mutex_lock(&recent_mutex); |
379 | t = recent_table_lookup(recent_net, info->name); | 379 | t = recent_table_lookup(recent_net, info->name); |
380 | if (t != NULL) { | 380 | if (t != NULL) { |
381 | if (info->hit_count > t->nstamps_max_mask) { | 381 | if (nstamp_mask > t->nstamps_max_mask) { |
382 | pr_info("hitcount (%u) is larger than packets to be remembered (%u) for table %s\n", | 382 | spin_lock_bh(&recent_lock); |
383 | info->hit_count, t->nstamps_max_mask + 1, | 383 | recent_table_flush(t); |
384 | info->name); | 384 | t->nstamps_max_mask = nstamp_mask; |
385 | ret = -EINVAL; | 385 | spin_unlock_bh(&recent_lock); |
386 | goto out; | ||
387 | } | 386 | } |
388 | 387 | ||
389 | t->refcnt++; | 388 | t->refcnt++; |
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index 1ba67931eb1b..13332dbf291d 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -243,12 +243,13 @@ static int | |||
243 | extract_icmp6_fields(const struct sk_buff *skb, | 243 | extract_icmp6_fields(const struct sk_buff *skb, |
244 | unsigned int outside_hdrlen, | 244 | unsigned int outside_hdrlen, |
245 | int *protocol, | 245 | int *protocol, |
246 | struct in6_addr **raddr, | 246 | const struct in6_addr **raddr, |
247 | struct in6_addr **laddr, | 247 | const struct in6_addr **laddr, |
248 | __be16 *rport, | 248 | __be16 *rport, |
249 | __be16 *lport) | 249 | __be16 *lport, |
250 | struct ipv6hdr *ipv6_var) | ||
250 | { | 251 | { |
251 | struct ipv6hdr *inside_iph, _inside_iph; | 252 | const struct ipv6hdr *inside_iph; |
252 | struct icmp6hdr *icmph, _icmph; | 253 | struct icmp6hdr *icmph, _icmph; |
253 | __be16 *ports, _ports[2]; | 254 | __be16 *ports, _ports[2]; |
254 | u8 inside_nexthdr; | 255 | u8 inside_nexthdr; |
@@ -263,12 +264,14 @@ extract_icmp6_fields(const struct sk_buff *skb, | |||
263 | if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK) | 264 | if (icmph->icmp6_type & ICMPV6_INFOMSG_MASK) |
264 | return 1; | 265 | return 1; |
265 | 266 | ||
266 | inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), sizeof(_inside_iph), &_inside_iph); | 267 | inside_iph = skb_header_pointer(skb, outside_hdrlen + sizeof(_icmph), |
268 | sizeof(*ipv6_var), ipv6_var); | ||
267 | if (inside_iph == NULL) | 269 | if (inside_iph == NULL) |
268 | return 1; | 270 | return 1; |
269 | inside_nexthdr = inside_iph->nexthdr; | 271 | inside_nexthdr = inside_iph->nexthdr; |
270 | 272 | ||
271 | inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + sizeof(_inside_iph), | 273 | inside_hdrlen = ipv6_skip_exthdr(skb, outside_hdrlen + sizeof(_icmph) + |
274 | sizeof(*ipv6_var), | ||
272 | &inside_nexthdr, &inside_fragoff); | 275 | &inside_nexthdr, &inside_fragoff); |
273 | if (inside_hdrlen < 0) | 276 | if (inside_hdrlen < 0) |
274 | return 1; /* hjm: Packet has no/incomplete transport layer headers. */ | 277 | return 1; /* hjm: Packet has no/incomplete transport layer headers. */ |
@@ -315,10 +318,10 @@ xt_socket_get_sock_v6(struct net *net, const u8 protocol, | |||
315 | static bool | 318 | static bool |
316 | socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) | 319 | socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) |
317 | { | 320 | { |
318 | struct ipv6hdr *iph = ipv6_hdr(skb); | 321 | struct ipv6hdr ipv6_var, *iph = ipv6_hdr(skb); |
319 | struct udphdr _hdr, *hp = NULL; | 322 | struct udphdr _hdr, *hp = NULL; |
320 | struct sock *sk = skb->sk; | 323 | struct sock *sk = skb->sk; |
321 | struct in6_addr *daddr = NULL, *saddr = NULL; | 324 | const struct in6_addr *daddr = NULL, *saddr = NULL; |
322 | __be16 uninitialized_var(dport), uninitialized_var(sport); | 325 | __be16 uninitialized_var(dport), uninitialized_var(sport); |
323 | int thoff = 0, uninitialized_var(tproto); | 326 | int thoff = 0, uninitialized_var(tproto); |
324 | const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo; | 327 | const struct xt_socket_mtinfo1 *info = (struct xt_socket_mtinfo1 *) par->matchinfo; |
@@ -342,7 +345,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) | |||
342 | 345 | ||
343 | } else if (tproto == IPPROTO_ICMPV6) { | 346 | } else if (tproto == IPPROTO_ICMPV6) { |
344 | if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr, | 347 | if (extract_icmp6_fields(skb, thoff, &tproto, &saddr, &daddr, |
345 | &sport, &dport)) | 348 | &sport, &dport, &ipv6_var)) |
346 | return false; | 349 | return false; |
347 | } else { | 350 | } else { |
348 | return false; | 351 | return false; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 2702673f0f23..05919bf3f670 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -3126,8 +3126,6 @@ static int __init netlink_proto_init(void) | |||
3126 | .key_len = sizeof(u32), /* portid */ | 3126 | .key_len = sizeof(u32), /* portid */ |
3127 | .hashfn = jhash, | 3127 | .hashfn = jhash, |
3128 | .max_shift = 16, /* 64K */ | 3128 | .max_shift = 16, /* 64K */ |
3129 | .grow_decision = rht_grow_above_75, | ||
3130 | .shrink_decision = rht_shrink_below_30, | ||
3131 | }; | 3129 | }; |
3132 | 3130 | ||
3133 | if (err != 0) | 3131 | if (err != 0) |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index ae5e77cdc0ca..5bae7243c577 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -2194,14 +2194,55 @@ static int __net_init ovs_init_net(struct net *net) | |||
2194 | return 0; | 2194 | return 0; |
2195 | } | 2195 | } |
2196 | 2196 | ||
2197 | static void __net_exit ovs_exit_net(struct net *net) | 2197 | static void __net_exit list_vports_from_net(struct net *net, struct net *dnet, |
2198 | struct list_head *head) | ||
2198 | { | 2199 | { |
2199 | struct datapath *dp, *dp_next; | ||
2200 | struct ovs_net *ovs_net = net_generic(net, ovs_net_id); | 2200 | struct ovs_net *ovs_net = net_generic(net, ovs_net_id); |
2201 | struct datapath *dp; | ||
2202 | |||
2203 | list_for_each_entry(dp, &ovs_net->dps, list_node) { | ||
2204 | int i; | ||
2205 | |||
2206 | for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) { | ||
2207 | struct vport *vport; | ||
2208 | |||
2209 | hlist_for_each_entry(vport, &dp->ports[i], dp_hash_node) { | ||
2210 | struct netdev_vport *netdev_vport; | ||
2211 | |||
2212 | if (vport->ops->type != OVS_VPORT_TYPE_INTERNAL) | ||
2213 | continue; | ||
2214 | |||
2215 | netdev_vport = netdev_vport_priv(vport); | ||
2216 | if (dev_net(netdev_vport->dev) == dnet) | ||
2217 | list_add(&vport->detach_list, head); | ||
2218 | } | ||
2219 | } | ||
2220 | } | ||
2221 | } | ||
2222 | |||
2223 | static void __net_exit ovs_exit_net(struct net *dnet) | ||
2224 | { | ||
2225 | struct datapath *dp, *dp_next; | ||
2226 | struct ovs_net *ovs_net = net_generic(dnet, ovs_net_id); | ||
2227 | struct vport *vport, *vport_next; | ||
2228 | struct net *net; | ||
2229 | LIST_HEAD(head); | ||
2201 | 2230 | ||
2202 | ovs_lock(); | 2231 | ovs_lock(); |
2203 | list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) | 2232 | list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node) |
2204 | __dp_destroy(dp); | 2233 | __dp_destroy(dp); |
2234 | |||
2235 | rtnl_lock(); | ||
2236 | for_each_net(net) | ||
2237 | list_vports_from_net(net, dnet, &head); | ||
2238 | rtnl_unlock(); | ||
2239 | |||
2240 | /* Detach all vports from given namespace. */ | ||
2241 | list_for_each_entry_safe(vport, vport_next, &head, detach_list) { | ||
2242 | list_del(&vport->detach_list); | ||
2243 | ovs_dp_detach_port(vport); | ||
2244 | } | ||
2245 | |||
2205 | ovs_unlock(); | 2246 | ovs_unlock(); |
2206 | 2247 | ||
2207 | cancel_work_sync(&ovs_net->dp_notify_work); | 2248 | cancel_work_sync(&ovs_net->dp_notify_work); |
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 216f20b90aa5..22b18c145c92 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -2253,14 +2253,20 @@ static int masked_set_action_to_set_action_attr(const struct nlattr *a, | |||
2253 | struct sk_buff *skb) | 2253 | struct sk_buff *skb) |
2254 | { | 2254 | { |
2255 | const struct nlattr *ovs_key = nla_data(a); | 2255 | const struct nlattr *ovs_key = nla_data(a); |
2256 | struct nlattr *nla; | ||
2256 | size_t key_len = nla_len(ovs_key) / 2; | 2257 | size_t key_len = nla_len(ovs_key) / 2; |
2257 | 2258 | ||
2258 | /* Revert the conversion we did from a non-masked set action to | 2259 | /* Revert the conversion we did from a non-masked set action to |
2259 | * masked set action. | 2260 | * masked set action. |
2260 | */ | 2261 | */ |
2261 | if (nla_put(skb, OVS_ACTION_ATTR_SET, nla_len(a) - key_len, ovs_key)) | 2262 | nla = nla_nest_start(skb, OVS_ACTION_ATTR_SET); |
2263 | if (!nla) | ||
2262 | return -EMSGSIZE; | 2264 | return -EMSGSIZE; |
2263 | 2265 | ||
2266 | if (nla_put(skb, nla_type(ovs_key), key_len, nla_data(ovs_key))) | ||
2267 | return -EMSGSIZE; | ||
2268 | |||
2269 | nla_nest_end(skb, nla); | ||
2264 | return 0; | 2270 | return 0; |
2265 | } | 2271 | } |
2266 | 2272 | ||
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h index f8ae295fb001..bc85331a6c60 100644 --- a/net/openvswitch/vport.h +++ b/net/openvswitch/vport.h | |||
@@ -103,6 +103,7 @@ struct vport_portids { | |||
103 | * @ops: Class structure. | 103 | * @ops: Class structure. |
104 | * @percpu_stats: Points to per-CPU statistics used and maintained by vport | 104 | * @percpu_stats: Points to per-CPU statistics used and maintained by vport |
105 | * @err_stats: Points to error statistics used and maintained by vport | 105 | * @err_stats: Points to error statistics used and maintained by vport |
106 | * @detach_list: list used for detaching vport in net-exit call. | ||
106 | */ | 107 | */ |
107 | struct vport { | 108 | struct vport { |
108 | struct rcu_head rcu; | 109 | struct rcu_head rcu; |
@@ -117,6 +118,7 @@ struct vport { | |||
117 | struct pcpu_sw_netstats __percpu *percpu_stats; | 118 | struct pcpu_sw_netstats __percpu *percpu_stats; |
118 | 119 | ||
119 | struct vport_err_stats err_stats; | 120 | struct vport_err_stats err_stats; |
121 | struct list_head detach_list; | ||
120 | }; | 122 | }; |
121 | 123 | ||
122 | /** | 124 | /** |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9c28cec1a083..5bf1e968a728 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -698,6 +698,10 @@ static void prb_retire_rx_blk_timer_expired(unsigned long data) | |||
698 | 698 | ||
699 | if (pkc->last_kactive_blk_num == pkc->kactive_blk_num) { | 699 | if (pkc->last_kactive_blk_num == pkc->kactive_blk_num) { |
700 | if (!frozen) { | 700 | if (!frozen) { |
701 | if (!BLOCK_NUM_PKTS(pbd)) { | ||
702 | /* An empty block. Just refresh the timer. */ | ||
703 | goto refresh_timer; | ||
704 | } | ||
701 | prb_retire_current_block(pkc, po, TP_STATUS_BLK_TMO); | 705 | prb_retire_current_block(pkc, po, TP_STATUS_BLK_TMO); |
702 | if (!prb_dispatch_next_block(pkc, po)) | 706 | if (!prb_dispatch_next_block(pkc, po)) |
703 | goto refresh_timer; | 707 | goto refresh_timer; |
@@ -798,7 +802,11 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1, | |||
798 | h1->ts_last_pkt.ts_sec = last_pkt->tp_sec; | 802 | h1->ts_last_pkt.ts_sec = last_pkt->tp_sec; |
799 | h1->ts_last_pkt.ts_nsec = last_pkt->tp_nsec; | 803 | h1->ts_last_pkt.ts_nsec = last_pkt->tp_nsec; |
800 | } else { | 804 | } else { |
801 | /* Ok, we tmo'd - so get the current time */ | 805 | /* Ok, we tmo'd - so get the current time. |
806 | * | ||
807 | * It shouldn't really happen as we don't close empty | ||
808 | * blocks. See prb_retire_rx_blk_timer_expired(). | ||
809 | */ | ||
802 | struct timespec ts; | 810 | struct timespec ts; |
803 | getnstimeofday(&ts); | 811 | getnstimeofday(&ts); |
804 | h1->ts_last_pkt.ts_sec = ts.tv_sec; | 812 | h1->ts_last_pkt.ts_sec = ts.tv_sec; |
@@ -1349,14 +1357,14 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, | |||
1349 | return 0; | 1357 | return 0; |
1350 | } | 1358 | } |
1351 | 1359 | ||
1360 | if (fanout_has_flag(f, PACKET_FANOUT_FLAG_DEFRAG)) { | ||
1361 | skb = ip_check_defrag(skb, IP_DEFRAG_AF_PACKET); | ||
1362 | if (!skb) | ||
1363 | return 0; | ||
1364 | } | ||
1352 | switch (f->type) { | 1365 | switch (f->type) { |
1353 | case PACKET_FANOUT_HASH: | 1366 | case PACKET_FANOUT_HASH: |
1354 | default: | 1367 | default: |
1355 | if (fanout_has_flag(f, PACKET_FANOUT_FLAG_DEFRAG)) { | ||
1356 | skb = ip_check_defrag(skb, IP_DEFRAG_AF_PACKET); | ||
1357 | if (!skb) | ||
1358 | return 0; | ||
1359 | } | ||
1360 | idx = fanout_demux_hash(f, skb, num); | 1368 | idx = fanout_demux_hash(f, skb, num); |
1361 | break; | 1369 | break; |
1362 | case PACKET_FANOUT_LB: | 1370 | case PACKET_FANOUT_LB: |
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c index c6be17a959a6..e0547f521f20 100644 --- a/net/rxrpc/ar-ack.c +++ b/net/rxrpc/ar-ack.c | |||
@@ -218,7 +218,8 @@ static void rxrpc_resend(struct rxrpc_call *call) | |||
218 | struct rxrpc_header *hdr; | 218 | struct rxrpc_header *hdr; |
219 | struct sk_buff *txb; | 219 | struct sk_buff *txb; |
220 | unsigned long *p_txb, resend_at; | 220 | unsigned long *p_txb, resend_at; |
221 | int loop, stop; | 221 | bool stop; |
222 | int loop; | ||
222 | u8 resend; | 223 | u8 resend; |
223 | 224 | ||
224 | _enter("{%d,%d,%d,%d},", | 225 | _enter("{%d,%d,%d,%d},", |
@@ -226,7 +227,7 @@ static void rxrpc_resend(struct rxrpc_call *call) | |||
226 | atomic_read(&call->sequence), | 227 | atomic_read(&call->sequence), |
227 | CIRC_CNT(call->acks_head, call->acks_tail, call->acks_winsz)); | 228 | CIRC_CNT(call->acks_head, call->acks_tail, call->acks_winsz)); |
228 | 229 | ||
229 | stop = 0; | 230 | stop = false; |
230 | resend = 0; | 231 | resend = 0; |
231 | resend_at = 0; | 232 | resend_at = 0; |
232 | 233 | ||
@@ -255,11 +256,11 @@ static void rxrpc_resend(struct rxrpc_call *call) | |||
255 | _proto("Tx DATA %%%u { #%d }", | 256 | _proto("Tx DATA %%%u { #%d }", |
256 | ntohl(sp->hdr.serial), ntohl(sp->hdr.seq)); | 257 | ntohl(sp->hdr.serial), ntohl(sp->hdr.seq)); |
257 | if (rxrpc_send_packet(call->conn->trans, txb) < 0) { | 258 | if (rxrpc_send_packet(call->conn->trans, txb) < 0) { |
258 | stop = 0; | 259 | stop = true; |
259 | sp->resend_at = jiffies + 3; | 260 | sp->resend_at = jiffies + 3; |
260 | } else { | 261 | } else { |
261 | sp->resend_at = | 262 | sp->resend_at = |
262 | jiffies + rxrpc_resend_timeout * HZ; | 263 | jiffies + rxrpc_resend_timeout; |
263 | } | 264 | } |
264 | } | 265 | } |
265 | 266 | ||
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 6742200b1307..fbb7ebfc58c6 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -228,6 +228,7 @@ static int tcf_em_validate(struct tcf_proto *tp, | |||
228 | * to replay the request. | 228 | * to replay the request. |
229 | */ | 229 | */ |
230 | module_put(em->ops->owner); | 230 | module_put(em->ops->owner); |
231 | em->ops = NULL; | ||
231 | err = -EAGAIN; | 232 | err = -EAGAIN; |
232 | } | 233 | } |
233 | #endif | 234 | #endif |
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index abbb7dcd1689..59eeed43eda2 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c | |||
@@ -217,6 +217,8 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg) | |||
217 | 217 | ||
218 | for (i = 0; i < arg->npages && arg->pages[i]; i++) | 218 | for (i = 0; i < arg->npages && arg->pages[i]; i++) |
219 | __free_page(arg->pages[i]); | 219 | __free_page(arg->pages[i]); |
220 | |||
221 | kfree(arg->pages); | ||
220 | } | 222 | } |
221 | 223 | ||
222 | static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) | 224 | static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 224a82f24d3c..1095be9c80ab 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -463,6 +463,8 @@ static int rsc_parse(struct cache_detail *cd, | |||
463 | /* number of additional gid's */ | 463 | /* number of additional gid's */ |
464 | if (get_int(&mesg, &N)) | 464 | if (get_int(&mesg, &N)) |
465 | goto out; | 465 | goto out; |
466 | if (N < 0 || N > NGROUPS_MAX) | ||
467 | goto out; | ||
466 | status = -ENOMEM; | 468 | status = -ENOMEM; |
467 | rsci.cred.cr_group_info = groups_alloc(N); | 469 | rsci.cred.cr_group_info = groups_alloc(N); |
468 | if (rsci.cred.cr_group_info == NULL) | 470 | if (rsci.cred.cr_group_info == NULL) |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 33fb105d4352..5199bb1a017e 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -921,7 +921,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, | |||
921 | poll_wait(filp, &queue_wait, wait); | 921 | poll_wait(filp, &queue_wait, wait); |
922 | 922 | ||
923 | /* alway allow write */ | 923 | /* alway allow write */ |
924 | mask = POLL_OUT | POLLWRNORM; | 924 | mask = POLLOUT | POLLWRNORM; |
925 | 925 | ||
926 | if (!rp) | 926 | if (!rp) |
927 | return mask; | 927 | return mask; |
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 7e9acd9361c5..91ffde82fa0c 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c | |||
@@ -738,8 +738,9 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep) | |||
738 | struct rpc_xprt *xprt = rep->rr_xprt; | 738 | struct rpc_xprt *xprt = rep->rr_xprt; |
739 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); | 739 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
740 | __be32 *iptr; | 740 | __be32 *iptr; |
741 | int credits, rdmalen, status; | 741 | int rdmalen, status; |
742 | unsigned long cwnd; | 742 | unsigned long cwnd; |
743 | u32 credits; | ||
743 | 744 | ||
744 | /* Check status. If bad, signal disconnect and return rep to pool */ | 745 | /* Check status. If bad, signal disconnect and return rep to pool */ |
745 | if (rep->rr_len == ~0U) { | 746 | if (rep->rr_len == ~0U) { |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index d1b70397c60f..0a16fb6f0885 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
@@ -285,7 +285,7 @@ rpcr_to_rdmar(struct rpc_rqst *rqst) | |||
285 | */ | 285 | */ |
286 | struct rpcrdma_buffer { | 286 | struct rpcrdma_buffer { |
287 | spinlock_t rb_lock; /* protects indexes */ | 287 | spinlock_t rb_lock; /* protects indexes */ |
288 | int rb_max_requests;/* client max requests */ | 288 | u32 rb_max_requests;/* client max requests */ |
289 | struct list_head rb_mws; /* optional memory windows/fmrs/frmrs */ | 289 | struct list_head rb_mws; /* optional memory windows/fmrs/frmrs */ |
290 | struct list_head rb_all; | 290 | struct list_head rb_all; |
291 | int rb_send_index; | 291 | int rb_send_index; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index f73e975af80b..b4d4467d0bb0 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -2364,8 +2364,6 @@ int tipc_sk_rht_init(struct net *net) | |||
2364 | .hashfn = jhash, | 2364 | .hashfn = jhash, |
2365 | .max_shift = 20, /* 1M */ | 2365 | .max_shift = 20, /* 1M */ |
2366 | .min_shift = 8, /* 256 */ | 2366 | .min_shift = 8, /* 256 */ |
2367 | .grow_decision = rht_grow_above_75, | ||
2368 | .shrink_decision = rht_shrink_below_30, | ||
2369 | }; | 2367 | }; |
2370 | 2368 | ||
2371 | return rhashtable_init(&tn->sk_rht, &rht_params); | 2369 | return rhashtable_init(&tn->sk_rht, &rht_params); |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 3af0ecf1cc16..2a0bbd22854b 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -1199,6 +1199,7 @@ out_fail_wq: | |||
1199 | regulatory_exit(); | 1199 | regulatory_exit(); |
1200 | out_fail_reg: | 1200 | out_fail_reg: |
1201 | debugfs_remove(ieee80211_debugfs_dir); | 1201 | debugfs_remove(ieee80211_debugfs_dir); |
1202 | nl80211_exit(); | ||
1202 | out_fail_nl80211: | 1203 | out_fail_nl80211: |
1203 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); | 1204 | unregister_netdevice_notifier(&cfg80211_netdev_notifier); |
1204 | out_fail_notifier: | 1205 | out_fail_notifier: |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d78fd8b54515..be2501538011 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2654,10 +2654,6 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2654 | return err; | 2654 | return err; |
2655 | } | 2655 | } |
2656 | 2656 | ||
2657 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | ||
2658 | if (!msg) | ||
2659 | return -ENOMEM; | ||
2660 | |||
2661 | err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? | 2657 | err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? |
2662 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, | 2658 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, |
2663 | &flags); | 2659 | &flags); |
@@ -2666,6 +2662,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2666 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) | 2662 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) |
2667 | return -EOPNOTSUPP; | 2663 | return -EOPNOTSUPP; |
2668 | 2664 | ||
2665 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | ||
2666 | if (!msg) | ||
2667 | return -ENOMEM; | ||
2668 | |||
2669 | wdev = rdev_add_virtual_intf(rdev, | 2669 | wdev = rdev_add_virtual_intf(rdev, |
2670 | nla_data(info->attrs[NL80211_ATTR_IFNAME]), | 2670 | nla_data(info->attrs[NL80211_ATTR_IFNAME]), |
2671 | type, err ? NULL : &flags, ¶ms); | 2671 | type, err ? NULL : &flags, ¶ms); |
@@ -12528,9 +12528,7 @@ static int cfg80211_net_detect_results(struct sk_buff *msg, | |||
12528 | } | 12528 | } |
12529 | 12529 | ||
12530 | for (j = 0; j < match->n_channels; j++) { | 12530 | for (j = 0; j < match->n_channels; j++) { |
12531 | if (nla_put_u32(msg, | 12531 | if (nla_put_u32(msg, j, match->channels[j])) { |
12532 | NL80211_ATTR_WIPHY_FREQ, | ||
12533 | match->channels[j])) { | ||
12534 | nla_nest_cancel(msg, nl_freqs); | 12532 | nla_nest_cancel(msg, nl_freqs); |
12535 | nla_nest_cancel(msg, nl_match); | 12533 | nla_nest_cancel(msg, nl_match); |
12536 | goto out; | 12534 | goto out; |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index b586d0dcb09e..48dfc7b4e981 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -228,7 +228,7 @@ static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work); | |||
228 | 228 | ||
229 | /* We keep a static world regulatory domain in case of the absence of CRDA */ | 229 | /* We keep a static world regulatory domain in case of the absence of CRDA */ |
230 | static const struct ieee80211_regdomain world_regdom = { | 230 | static const struct ieee80211_regdomain world_regdom = { |
231 | .n_reg_rules = 6, | 231 | .n_reg_rules = 8, |
232 | .alpha2 = "00", | 232 | .alpha2 = "00", |
233 | .reg_rules = { | 233 | .reg_rules = { |
234 | /* IEEE 802.11b/g, channels 1..11 */ | 234 | /* IEEE 802.11b/g, channels 1..11 */ |
diff --git a/scripts/gdb/linux/__init__.py b/scripts/gdb/linux/__init__.py new file mode 100644 index 000000000000..4680fb176337 --- /dev/null +++ b/scripts/gdb/linux/__init__.py | |||
@@ -0,0 +1 @@ | |||
# nothing to do for the initialization of this package | |||
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index b03a638b420c..279e24f61305 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1552,6 +1552,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) | |||
1552 | if (! snd_pcm_playback_empty(substream)) { | 1552 | if (! snd_pcm_playback_empty(substream)) { |
1553 | snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); | 1553 | snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); |
1554 | snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); | 1554 | snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); |
1555 | } else { | ||
1556 | runtime->status->state = SNDRV_PCM_STATE_SETUP; | ||
1555 | } | 1557 | } |
1556 | break; | 1558 | break; |
1557 | case SNDRV_PCM_STATE_RUNNING: | 1559 | case SNDRV_PCM_STATE_RUNNING: |
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index f62780ed64ad..7821b07415a7 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c | |||
@@ -105,6 +105,8 @@ static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum, | |||
105 | int pitchbend = chan->midi_pitchbend; | 105 | int pitchbend = chan->midi_pitchbend; |
106 | int segment; | 106 | int segment; |
107 | 107 | ||
108 | if (pitchbend < -0x2000) | ||
109 | pitchbend = -0x2000; | ||
108 | if (pitchbend > 0x1FFF) | 110 | if (pitchbend > 0x1FFF) |
109 | pitchbend = 0x1FFF; | 111 | pitchbend = 0x1FFF; |
110 | 112 | ||
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index 0d580186ef1a..5cc356db5351 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c | |||
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | #define MAX_MIDI_RX_BLOCKS 8 | 34 | #define MAX_MIDI_RX_BLOCKS 8 |
35 | 35 | ||
36 | #define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 µs */ | 36 | #define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 microseconds */ |
37 | 37 | ||
38 | /* isochronous header parameters */ | 38 | /* isochronous header parameters */ |
39 | #define ISO_DATA_LENGTH_SHIFT 16 | 39 | #define ISO_DATA_LENGTH_SHIFT 16 |
@@ -78,7 +78,7 @@ static void pcm_period_tasklet(unsigned long data); | |||
78 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, | 78 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, |
79 | enum amdtp_stream_direction dir, enum cip_flags flags) | 79 | enum amdtp_stream_direction dir, enum cip_flags flags) |
80 | { | 80 | { |
81 | s->unit = fw_unit_get(unit); | 81 | s->unit = unit; |
82 | s->direction = dir; | 82 | s->direction = dir; |
83 | s->flags = flags; | 83 | s->flags = flags; |
84 | s->context = ERR_PTR(-1); | 84 | s->context = ERR_PTR(-1); |
@@ -102,7 +102,6 @@ void amdtp_stream_destroy(struct amdtp_stream *s) | |||
102 | { | 102 | { |
103 | WARN_ON(amdtp_stream_running(s)); | 103 | WARN_ON(amdtp_stream_running(s)); |
104 | mutex_destroy(&s->mutex); | 104 | mutex_destroy(&s->mutex); |
105 | fw_unit_put(s->unit); | ||
106 | } | 105 | } |
107 | EXPORT_SYMBOL(amdtp_stream_destroy); | 106 | EXPORT_SYMBOL(amdtp_stream_destroy); |
108 | 107 | ||
diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index fc19c99654aa..611b7dae7ee5 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c | |||
@@ -116,11 +116,22 @@ end: | |||
116 | return err; | 116 | return err; |
117 | } | 117 | } |
118 | 118 | ||
119 | /* | ||
120 | * This module releases the FireWire unit data after all ALSA character devices | ||
121 | * are released by applications. This is for releasing stream data or finishing | ||
122 | * transactions safely. Thus at returning from .remove(), this module still keep | ||
123 | * references for the unit. | ||
124 | */ | ||
119 | static void | 125 | static void |
120 | bebob_card_free(struct snd_card *card) | 126 | bebob_card_free(struct snd_card *card) |
121 | { | 127 | { |
122 | struct snd_bebob *bebob = card->private_data; | 128 | struct snd_bebob *bebob = card->private_data; |
123 | 129 | ||
130 | snd_bebob_stream_destroy_duplex(bebob); | ||
131 | fw_unit_put(bebob->unit); | ||
132 | |||
133 | kfree(bebob->maudio_special_quirk); | ||
134 | |||
124 | if (bebob->card_index >= 0) { | 135 | if (bebob->card_index >= 0) { |
125 | mutex_lock(&devices_mutex); | 136 | mutex_lock(&devices_mutex); |
126 | clear_bit(bebob->card_index, devices_used); | 137 | clear_bit(bebob->card_index, devices_used); |
@@ -205,7 +216,7 @@ bebob_probe(struct fw_unit *unit, | |||
205 | card->private_free = bebob_card_free; | 216 | card->private_free = bebob_card_free; |
206 | 217 | ||
207 | bebob->card = card; | 218 | bebob->card = card; |
208 | bebob->unit = unit; | 219 | bebob->unit = fw_unit_get(unit); |
209 | bebob->spec = spec; | 220 | bebob->spec = spec; |
210 | mutex_init(&bebob->mutex); | 221 | mutex_init(&bebob->mutex); |
211 | spin_lock_init(&bebob->lock); | 222 | spin_lock_init(&bebob->lock); |
@@ -306,10 +317,11 @@ static void bebob_remove(struct fw_unit *unit) | |||
306 | if (bebob == NULL) | 317 | if (bebob == NULL) |
307 | return; | 318 | return; |
308 | 319 | ||
309 | kfree(bebob->maudio_special_quirk); | 320 | /* Awake bus-reset waiters. */ |
321 | if (!completion_done(&bebob->bus_reset)) | ||
322 | complete_all(&bebob->bus_reset); | ||
310 | 323 | ||
311 | snd_bebob_stream_destroy_duplex(bebob); | 324 | /* No need to wait for releasing card object in this context. */ |
312 | snd_card_disconnect(bebob->card); | ||
313 | snd_card_free_when_closed(bebob->card); | 325 | snd_card_free_when_closed(bebob->card); |
314 | } | 326 | } |
315 | 327 | ||
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 0ebcabfdc7ce..98e4fc8121a1 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c | |||
@@ -410,8 +410,6 @@ break_both_connections(struct snd_bebob *bebob) | |||
410 | static void | 410 | static void |
411 | destroy_both_connections(struct snd_bebob *bebob) | 411 | destroy_both_connections(struct snd_bebob *bebob) |
412 | { | 412 | { |
413 | break_both_connections(bebob); | ||
414 | |||
415 | cmp_connection_destroy(&bebob->in_conn); | 413 | cmp_connection_destroy(&bebob->in_conn); |
416 | cmp_connection_destroy(&bebob->out_conn); | 414 | cmp_connection_destroy(&bebob->out_conn); |
417 | } | 415 | } |
@@ -712,22 +710,16 @@ void snd_bebob_stream_update_duplex(struct snd_bebob *bebob) | |||
712 | mutex_unlock(&bebob->mutex); | 710 | mutex_unlock(&bebob->mutex); |
713 | } | 711 | } |
714 | 712 | ||
713 | /* | ||
714 | * This function should be called before starting streams or after stopping | ||
715 | * streams. | ||
716 | */ | ||
715 | void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) | 717 | void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) |
716 | { | 718 | { |
717 | mutex_lock(&bebob->mutex); | ||
718 | |||
719 | amdtp_stream_pcm_abort(&bebob->rx_stream); | ||
720 | amdtp_stream_pcm_abort(&bebob->tx_stream); | ||
721 | |||
722 | amdtp_stream_stop(&bebob->rx_stream); | ||
723 | amdtp_stream_stop(&bebob->tx_stream); | ||
724 | |||
725 | amdtp_stream_destroy(&bebob->rx_stream); | 719 | amdtp_stream_destroy(&bebob->rx_stream); |
726 | amdtp_stream_destroy(&bebob->tx_stream); | 720 | amdtp_stream_destroy(&bebob->tx_stream); |
727 | 721 | ||
728 | destroy_both_connections(bebob); | 722 | destroy_both_connections(bebob); |
729 | |||
730 | mutex_unlock(&bebob->mutex); | ||
731 | } | 723 | } |
732 | 724 | ||
733 | /* | 725 | /* |
diff --git a/sound/firewire/dice/dice-interface.h b/sound/firewire/dice/dice-interface.h index 27b044f84c81..de7602bd69b5 100644 --- a/sound/firewire/dice/dice-interface.h +++ b/sound/firewire/dice/dice-interface.h | |||
@@ -299,23 +299,23 @@ | |||
299 | #define RX_ISOCHRONOUS 0x008 | 299 | #define RX_ISOCHRONOUS 0x008 |
300 | 300 | ||
301 | /* | 301 | /* |
302 | * Index of first quadlet to be interpreted; read/write. If > 0, that many | ||
303 | * quadlets at the beginning of each data block will be ignored, and all the | ||
304 | * audio and MIDI quadlets will follow. | ||
305 | */ | ||
306 | #define RX_SEQ_START 0x00c | ||
307 | |||
308 | /* | ||
309 | * The number of audio channels; read-only. There will be one quadlet per | 302 | * The number of audio channels; read-only. There will be one quadlet per |
310 | * channel. | 303 | * channel. |
311 | */ | 304 | */ |
312 | #define RX_NUMBER_AUDIO 0x010 | 305 | #define RX_NUMBER_AUDIO 0x00c |
313 | 306 | ||
314 | /* | 307 | /* |
315 | * The number of MIDI ports, 0-8; read-only. If > 0, there will be one | 308 | * The number of MIDI ports, 0-8; read-only. If > 0, there will be one |
316 | * additional quadlet in each data block, following the audio quadlets. | 309 | * additional quadlet in each data block, following the audio quadlets. |
317 | */ | 310 | */ |
318 | #define RX_NUMBER_MIDI 0x014 | 311 | #define RX_NUMBER_MIDI 0x010 |
312 | |||
313 | /* | ||
314 | * Index of first quadlet to be interpreted; read/write. If > 0, that many | ||
315 | * quadlets at the beginning of each data block will be ignored, and all the | ||
316 | * audio and MIDI quadlets will follow. | ||
317 | */ | ||
318 | #define RX_SEQ_START 0x014 | ||
319 | 319 | ||
320 | /* | 320 | /* |
321 | * Names of all audio channels; read-only. Quadlets are byte-swapped. Names | 321 | * Names of all audio channels; read-only. Quadlets are byte-swapped. Names |
diff --git a/sound/firewire/dice/dice-proc.c b/sound/firewire/dice/dice-proc.c index f5c1d1bced59..ecfe20fd4de5 100644 --- a/sound/firewire/dice/dice-proc.c +++ b/sound/firewire/dice/dice-proc.c | |||
@@ -99,9 +99,9 @@ static void dice_proc_read(struct snd_info_entry *entry, | |||
99 | } tx; | 99 | } tx; |
100 | struct { | 100 | struct { |
101 | u32 iso; | 101 | u32 iso; |
102 | u32 seq_start; | ||
103 | u32 number_audio; | 102 | u32 number_audio; |
104 | u32 number_midi; | 103 | u32 number_midi; |
104 | u32 seq_start; | ||
105 | char names[RX_NAMES_SIZE]; | 105 | char names[RX_NAMES_SIZE]; |
106 | u32 ac3_caps; | 106 | u32 ac3_caps; |
107 | u32 ac3_enable; | 107 | u32 ac3_enable; |
@@ -204,10 +204,10 @@ static void dice_proc_read(struct snd_info_entry *entry, | |||
204 | break; | 204 | break; |
205 | snd_iprintf(buffer, "rx %u:\n", stream); | 205 | snd_iprintf(buffer, "rx %u:\n", stream); |
206 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.rx.iso); | 206 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.rx.iso); |
207 | snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start); | ||
208 | snd_iprintf(buffer, " audio channels: %u\n", | 207 | snd_iprintf(buffer, " audio channels: %u\n", |
209 | buf.rx.number_audio); | 208 | buf.rx.number_audio); |
210 | snd_iprintf(buffer, " midi ports: %u\n", buf.rx.number_midi); | 209 | snd_iprintf(buffer, " midi ports: %u\n", buf.rx.number_midi); |
210 | snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start); | ||
211 | if (quadlets >= 68) { | 211 | if (quadlets >= 68) { |
212 | dice_proc_fixup_string(buf.rx.names, RX_NAMES_SIZE); | 212 | dice_proc_fixup_string(buf.rx.names, RX_NAMES_SIZE); |
213 | snd_iprintf(buffer, " names: %s\n", buf.rx.names); | 213 | snd_iprintf(buffer, " names: %s\n", buf.rx.names); |
diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c index fa9cf761b610..07dbd01d7a6b 100644 --- a/sound/firewire/dice/dice-stream.c +++ b/sound/firewire/dice/dice-stream.c | |||
@@ -311,14 +311,21 @@ end: | |||
311 | return err; | 311 | return err; |
312 | } | 312 | } |
313 | 313 | ||
314 | /* | ||
315 | * This function should be called before starting streams or after stopping | ||
316 | * streams. | ||
317 | */ | ||
314 | static void destroy_stream(struct snd_dice *dice, struct amdtp_stream *stream) | 318 | static void destroy_stream(struct snd_dice *dice, struct amdtp_stream *stream) |
315 | { | 319 | { |
316 | amdtp_stream_destroy(stream); | 320 | struct fw_iso_resources *resources; |
317 | 321 | ||
318 | if (stream == &dice->tx_stream) | 322 | if (stream == &dice->tx_stream) |
319 | fw_iso_resources_destroy(&dice->tx_resources); | 323 | resources = &dice->tx_resources; |
320 | else | 324 | else |
321 | fw_iso_resources_destroy(&dice->rx_resources); | 325 | resources = &dice->rx_resources; |
326 | |||
327 | amdtp_stream_destroy(stream); | ||
328 | fw_iso_resources_destroy(resources); | ||
322 | } | 329 | } |
323 | 330 | ||
324 | int snd_dice_stream_init_duplex(struct snd_dice *dice) | 331 | int snd_dice_stream_init_duplex(struct snd_dice *dice) |
@@ -332,6 +339,8 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice) | |||
332 | goto end; | 339 | goto end; |
333 | 340 | ||
334 | err = init_stream(dice, &dice->rx_stream); | 341 | err = init_stream(dice, &dice->rx_stream); |
342 | if (err < 0) | ||
343 | destroy_stream(dice, &dice->tx_stream); | ||
335 | end: | 344 | end: |
336 | return err; | 345 | return err; |
337 | } | 346 | } |
@@ -340,10 +349,7 @@ void snd_dice_stream_destroy_duplex(struct snd_dice *dice) | |||
340 | { | 349 | { |
341 | snd_dice_transaction_clear_enable(dice); | 350 | snd_dice_transaction_clear_enable(dice); |
342 | 351 | ||
343 | stop_stream(dice, &dice->tx_stream); | ||
344 | destroy_stream(dice, &dice->tx_stream); | 352 | destroy_stream(dice, &dice->tx_stream); |
345 | |||
346 | stop_stream(dice, &dice->rx_stream); | ||
347 | destroy_stream(dice, &dice->rx_stream); | 353 | destroy_stream(dice, &dice->rx_stream); |
348 | 354 | ||
349 | dice->substreams_counter = 0; | 355 | dice->substreams_counter = 0; |
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index 90d8f40ff727..70a111d7f428 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c | |||
@@ -226,11 +226,20 @@ static void dice_card_strings(struct snd_dice *dice) | |||
226 | strcpy(card->mixername, "DICE"); | 226 | strcpy(card->mixername, "DICE"); |
227 | } | 227 | } |
228 | 228 | ||
229 | /* | ||
230 | * This module releases the FireWire unit data after all ALSA character devices | ||
231 | * are released by applications. This is for releasing stream data or finishing | ||
232 | * transactions safely. Thus at returning from .remove(), this module still keep | ||
233 | * references for the unit. | ||
234 | */ | ||
229 | static void dice_card_free(struct snd_card *card) | 235 | static void dice_card_free(struct snd_card *card) |
230 | { | 236 | { |
231 | struct snd_dice *dice = card->private_data; | 237 | struct snd_dice *dice = card->private_data; |
232 | 238 | ||
239 | snd_dice_stream_destroy_duplex(dice); | ||
233 | snd_dice_transaction_destroy(dice); | 240 | snd_dice_transaction_destroy(dice); |
241 | fw_unit_put(dice->unit); | ||
242 | |||
234 | mutex_destroy(&dice->mutex); | 243 | mutex_destroy(&dice->mutex); |
235 | } | 244 | } |
236 | 245 | ||
@@ -251,7 +260,7 @@ static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) | |||
251 | 260 | ||
252 | dice = card->private_data; | 261 | dice = card->private_data; |
253 | dice->card = card; | 262 | dice->card = card; |
254 | dice->unit = unit; | 263 | dice->unit = fw_unit_get(unit); |
255 | card->private_free = dice_card_free; | 264 | card->private_free = dice_card_free; |
256 | 265 | ||
257 | spin_lock_init(&dice->lock); | 266 | spin_lock_init(&dice->lock); |
@@ -305,10 +314,7 @@ static void dice_remove(struct fw_unit *unit) | |||
305 | { | 314 | { |
306 | struct snd_dice *dice = dev_get_drvdata(&unit->device); | 315 | struct snd_dice *dice = dev_get_drvdata(&unit->device); |
307 | 316 | ||
308 | snd_card_disconnect(dice->card); | 317 | /* No need to wait for releasing card object in this context. */ |
309 | |||
310 | snd_dice_stream_destroy_duplex(dice); | ||
311 | |||
312 | snd_card_free_when_closed(dice->card); | 318 | snd_card_free_when_closed(dice->card); |
313 | } | 319 | } |
314 | 320 | ||
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c index 3e2ed8e82cbc..2682e7e3e5c9 100644 --- a/sound/firewire/fireworks/fireworks.c +++ b/sound/firewire/fireworks/fireworks.c | |||
@@ -173,11 +173,23 @@ end: | |||
173 | return err; | 173 | return err; |
174 | } | 174 | } |
175 | 175 | ||
176 | /* | ||
177 | * This module releases the FireWire unit data after all ALSA character devices | ||
178 | * are released by applications. This is for releasing stream data or finishing | ||
179 | * transactions safely. Thus at returning from .remove(), this module still keep | ||
180 | * references for the unit. | ||
181 | */ | ||
176 | static void | 182 | static void |
177 | efw_card_free(struct snd_card *card) | 183 | efw_card_free(struct snd_card *card) |
178 | { | 184 | { |
179 | struct snd_efw *efw = card->private_data; | 185 | struct snd_efw *efw = card->private_data; |
180 | 186 | ||
187 | snd_efw_stream_destroy_duplex(efw); | ||
188 | snd_efw_transaction_remove_instance(efw); | ||
189 | fw_unit_put(efw->unit); | ||
190 | |||
191 | kfree(efw->resp_buf); | ||
192 | |||
181 | if (efw->card_index >= 0) { | 193 | if (efw->card_index >= 0) { |
182 | mutex_lock(&devices_mutex); | 194 | mutex_lock(&devices_mutex); |
183 | clear_bit(efw->card_index, devices_used); | 195 | clear_bit(efw->card_index, devices_used); |
@@ -185,7 +197,6 @@ efw_card_free(struct snd_card *card) | |||
185 | } | 197 | } |
186 | 198 | ||
187 | mutex_destroy(&efw->mutex); | 199 | mutex_destroy(&efw->mutex); |
188 | kfree(efw->resp_buf); | ||
189 | } | 200 | } |
190 | 201 | ||
191 | static int | 202 | static int |
@@ -218,7 +229,7 @@ efw_probe(struct fw_unit *unit, | |||
218 | card->private_free = efw_card_free; | 229 | card->private_free = efw_card_free; |
219 | 230 | ||
220 | efw->card = card; | 231 | efw->card = card; |
221 | efw->unit = unit; | 232 | efw->unit = fw_unit_get(unit); |
222 | mutex_init(&efw->mutex); | 233 | mutex_init(&efw->mutex); |
223 | spin_lock_init(&efw->lock); | 234 | spin_lock_init(&efw->lock); |
224 | init_waitqueue_head(&efw->hwdep_wait); | 235 | init_waitqueue_head(&efw->hwdep_wait); |
@@ -289,10 +300,7 @@ static void efw_remove(struct fw_unit *unit) | |||
289 | { | 300 | { |
290 | struct snd_efw *efw = dev_get_drvdata(&unit->device); | 301 | struct snd_efw *efw = dev_get_drvdata(&unit->device); |
291 | 302 | ||
292 | snd_efw_stream_destroy_duplex(efw); | 303 | /* No need to wait for releasing card object in this context. */ |
293 | snd_efw_transaction_remove_instance(efw); | ||
294 | |||
295 | snd_card_disconnect(efw->card); | ||
296 | snd_card_free_when_closed(efw->card); | 304 | snd_card_free_when_closed(efw->card); |
297 | } | 305 | } |
298 | 306 | ||
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c index 4f440e163667..c55db1bddc80 100644 --- a/sound/firewire/fireworks/fireworks_stream.c +++ b/sound/firewire/fireworks/fireworks_stream.c | |||
@@ -100,17 +100,22 @@ end: | |||
100 | return err; | 100 | return err; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* | ||
104 | * This function should be called before starting the stream or after stopping | ||
105 | * the streams. | ||
106 | */ | ||
103 | static void | 107 | static void |
104 | destroy_stream(struct snd_efw *efw, struct amdtp_stream *stream) | 108 | destroy_stream(struct snd_efw *efw, struct amdtp_stream *stream) |
105 | { | 109 | { |
106 | stop_stream(efw, stream); | 110 | struct cmp_connection *conn; |
107 | |||
108 | amdtp_stream_destroy(stream); | ||
109 | 111 | ||
110 | if (stream == &efw->tx_stream) | 112 | if (stream == &efw->tx_stream) |
111 | cmp_connection_destroy(&efw->out_conn); | 113 | conn = &efw->out_conn; |
112 | else | 114 | else |
113 | cmp_connection_destroy(&efw->in_conn); | 115 | conn = &efw->in_conn; |
116 | |||
117 | amdtp_stream_destroy(stream); | ||
118 | cmp_connection_destroy(&efw->out_conn); | ||
114 | } | 119 | } |
115 | 120 | ||
116 | static int | 121 | static int |
@@ -319,12 +324,8 @@ void snd_efw_stream_update_duplex(struct snd_efw *efw) | |||
319 | 324 | ||
320 | void snd_efw_stream_destroy_duplex(struct snd_efw *efw) | 325 | void snd_efw_stream_destroy_duplex(struct snd_efw *efw) |
321 | { | 326 | { |
322 | mutex_lock(&efw->mutex); | ||
323 | |||
324 | destroy_stream(efw, &efw->rx_stream); | 327 | destroy_stream(efw, &efw->rx_stream); |
325 | destroy_stream(efw, &efw->tx_stream); | 328 | destroy_stream(efw, &efw->tx_stream); |
326 | |||
327 | mutex_unlock(&efw->mutex); | ||
328 | } | 329 | } |
329 | 330 | ||
330 | void snd_efw_stream_lock_changed(struct snd_efw *efw) | 331 | void snd_efw_stream_lock_changed(struct snd_efw *efw) |
diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c index bda845afb470..e6757cd85724 100644 --- a/sound/firewire/oxfw/oxfw-stream.c +++ b/sound/firewire/oxfw/oxfw-stream.c | |||
@@ -171,9 +171,10 @@ static int start_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | /* Wait first packet */ | 173 | /* Wait first packet */ |
174 | err = amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT); | 174 | if (!amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT)) { |
175 | if (err < 0) | ||
176 | stop_stream(oxfw, stream); | 175 | stop_stream(oxfw, stream); |
176 | err = -ETIMEDOUT; | ||
177 | } | ||
177 | end: | 178 | end: |
178 | return err; | 179 | return err; |
179 | } | 180 | } |
@@ -337,6 +338,10 @@ void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw, | |||
337 | stop_stream(oxfw, stream); | 338 | stop_stream(oxfw, stream); |
338 | } | 339 | } |
339 | 340 | ||
341 | /* | ||
342 | * This function should be called before starting the stream or after stopping | ||
343 | * the streams. | ||
344 | */ | ||
340 | void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw, | 345 | void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw, |
341 | struct amdtp_stream *stream) | 346 | struct amdtp_stream *stream) |
342 | { | 347 | { |
@@ -347,8 +352,6 @@ void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw, | |||
347 | else | 352 | else |
348 | conn = &oxfw->in_conn; | 353 | conn = &oxfw->in_conn; |
349 | 354 | ||
350 | stop_stream(oxfw, stream); | ||
351 | |||
352 | amdtp_stream_destroy(stream); | 355 | amdtp_stream_destroy(stream); |
353 | cmp_connection_destroy(conn); | 356 | cmp_connection_destroy(conn); |
354 | } | 357 | } |
diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 60e5cad0531a..8c6ce019f437 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c | |||
@@ -104,11 +104,23 @@ end: | |||
104 | return err; | 104 | return err; |
105 | } | 105 | } |
106 | 106 | ||
107 | /* | ||
108 | * This module releases the FireWire unit data after all ALSA character devices | ||
109 | * are released by applications. This is for releasing stream data or finishing | ||
110 | * transactions safely. Thus at returning from .remove(), this module still keep | ||
111 | * references for the unit. | ||
112 | */ | ||
107 | static void oxfw_card_free(struct snd_card *card) | 113 | static void oxfw_card_free(struct snd_card *card) |
108 | { | 114 | { |
109 | struct snd_oxfw *oxfw = card->private_data; | 115 | struct snd_oxfw *oxfw = card->private_data; |
110 | unsigned int i; | 116 | unsigned int i; |
111 | 117 | ||
118 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); | ||
119 | if (oxfw->has_output) | ||
120 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); | ||
121 | |||
122 | fw_unit_put(oxfw->unit); | ||
123 | |||
112 | for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { | 124 | for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { |
113 | kfree(oxfw->tx_stream_formats[i]); | 125 | kfree(oxfw->tx_stream_formats[i]); |
114 | kfree(oxfw->rx_stream_formats[i]); | 126 | kfree(oxfw->rx_stream_formats[i]); |
@@ -136,7 +148,7 @@ static int oxfw_probe(struct fw_unit *unit, | |||
136 | oxfw = card->private_data; | 148 | oxfw = card->private_data; |
137 | oxfw->card = card; | 149 | oxfw->card = card; |
138 | mutex_init(&oxfw->mutex); | 150 | mutex_init(&oxfw->mutex); |
139 | oxfw->unit = unit; | 151 | oxfw->unit = fw_unit_get(unit); |
140 | oxfw->device_info = (const struct device_info *)id->driver_data; | 152 | oxfw->device_info = (const struct device_info *)id->driver_data; |
141 | spin_lock_init(&oxfw->lock); | 153 | spin_lock_init(&oxfw->lock); |
142 | init_waitqueue_head(&oxfw->hwdep_wait); | 154 | init_waitqueue_head(&oxfw->hwdep_wait); |
@@ -212,12 +224,7 @@ static void oxfw_remove(struct fw_unit *unit) | |||
212 | { | 224 | { |
213 | struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); | 225 | struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); |
214 | 226 | ||
215 | snd_card_disconnect(oxfw->card); | 227 | /* No need to wait for releasing card object in this context. */ |
216 | |||
217 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); | ||
218 | if (oxfw->has_output) | ||
219 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); | ||
220 | |||
221 | snd_card_free_when_closed(oxfw->card); | 228 | snd_card_free_when_closed(oxfw->card); |
222 | } | 229 | } |
223 | 230 | ||
diff --git a/sound/isa/msnd/msnd_pinnacle_mixer.c b/sound/isa/msnd/msnd_pinnacle_mixer.c index 17e49a071af4..b408540798c1 100644 --- a/sound/isa/msnd/msnd_pinnacle_mixer.c +++ b/sound/isa/msnd/msnd_pinnacle_mixer.c | |||
@@ -306,11 +306,12 @@ int snd_msndmix_new(struct snd_card *card) | |||
306 | spin_lock_init(&chip->mixer_lock); | 306 | spin_lock_init(&chip->mixer_lock); |
307 | strcpy(card->mixername, "MSND Pinnacle Mixer"); | 307 | strcpy(card->mixername, "MSND Pinnacle Mixer"); |
308 | 308 | ||
309 | for (idx = 0; idx < ARRAY_SIZE(snd_msnd_controls); idx++) | 309 | for (idx = 0; idx < ARRAY_SIZE(snd_msnd_controls); idx++) { |
310 | err = snd_ctl_add(card, | 310 | err = snd_ctl_add(card, |
311 | snd_ctl_new1(snd_msnd_controls + idx, chip)); | 311 | snd_ctl_new1(snd_msnd_controls + idx, chip)); |
312 | if (err < 0) | 312 | if (err < 0) |
313 | return err; | 313 | return err; |
314 | } | ||
314 | 315 | ||
315 | return 0; | 316 | return 0; |
316 | } | 317 | } |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index dfcb5e929f9f..a2ce773bdc62 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -961,7 +961,6 @@ static int azx_alloc_cmd_io(struct azx *chip) | |||
961 | dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); | 961 | dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); |
962 | return err; | 962 | return err; |
963 | } | 963 | } |
964 | EXPORT_SYMBOL_GPL(azx_alloc_cmd_io); | ||
965 | 964 | ||
966 | static void azx_init_cmd_io(struct azx *chip) | 965 | static void azx_init_cmd_io(struct azx *chip) |
967 | { | 966 | { |
@@ -1026,7 +1025,6 @@ static void azx_init_cmd_io(struct azx *chip) | |||
1026 | azx_writeb(chip, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); | 1025 | azx_writeb(chip, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); |
1027 | spin_unlock_irq(&chip->reg_lock); | 1026 | spin_unlock_irq(&chip->reg_lock); |
1028 | } | 1027 | } |
1029 | EXPORT_SYMBOL_GPL(azx_init_cmd_io); | ||
1030 | 1028 | ||
1031 | static void azx_free_cmd_io(struct azx *chip) | 1029 | static void azx_free_cmd_io(struct azx *chip) |
1032 | { | 1030 | { |
@@ -1036,7 +1034,6 @@ static void azx_free_cmd_io(struct azx *chip) | |||
1036 | azx_writeb(chip, CORBCTL, 0); | 1034 | azx_writeb(chip, CORBCTL, 0); |
1037 | spin_unlock_irq(&chip->reg_lock); | 1035 | spin_unlock_irq(&chip->reg_lock); |
1038 | } | 1036 | } |
1039 | EXPORT_SYMBOL_GPL(azx_free_cmd_io); | ||
1040 | 1037 | ||
1041 | static unsigned int azx_command_addr(u32 cmd) | 1038 | static unsigned int azx_command_addr(u32 cmd) |
1042 | { | 1039 | { |
@@ -1316,7 +1313,6 @@ static int azx_send_cmd(struct hda_bus *bus, unsigned int val) | |||
1316 | else | 1313 | else |
1317 | return azx_corb_send_cmd(bus, val); | 1314 | return azx_corb_send_cmd(bus, val); |
1318 | } | 1315 | } |
1319 | EXPORT_SYMBOL_GPL(azx_send_cmd); | ||
1320 | 1316 | ||
1321 | /* get a response */ | 1317 | /* get a response */ |
1322 | static unsigned int azx_get_response(struct hda_bus *bus, | 1318 | static unsigned int azx_get_response(struct hda_bus *bus, |
@@ -1330,7 +1326,6 @@ static unsigned int azx_get_response(struct hda_bus *bus, | |||
1330 | else | 1326 | else |
1331 | return azx_rirb_get_response(bus, addr); | 1327 | return azx_rirb_get_response(bus, addr); |
1332 | } | 1328 | } |
1333 | EXPORT_SYMBOL_GPL(azx_get_response); | ||
1334 | 1329 | ||
1335 | #ifdef CONFIG_SND_HDA_DSP_LOADER | 1330 | #ifdef CONFIG_SND_HDA_DSP_LOADER |
1336 | /* | 1331 | /* |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 36d2f20db7a4..4ca3d5d02436 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1966,7 +1966,7 @@ static const struct pci_device_id azx_ids[] = { | |||
1966 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, | 1966 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
1967 | /* Panther Point */ | 1967 | /* Panther Point */ |
1968 | { PCI_DEVICE(0x8086, 0x1e20), | 1968 | { PCI_DEVICE(0x8086, 0x1e20), |
1969 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1969 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
1970 | /* Lynx Point */ | 1970 | /* Lynx Point */ |
1971 | { PCI_DEVICE(0x8086, 0x8c20), | 1971 | { PCI_DEVICE(0x8086, 0x8c20), |
1972 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1972 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b2b24a8b3dac..526398a4a442 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -5209,6 +5209,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5209 | {0x17, 0x40000000}, | 5209 | {0x17, 0x40000000}, |
5210 | {0x1d, 0x40700001}, | 5210 | {0x1d, 0x40700001}, |
5211 | {0x21, 0x02211040}), | 5211 | {0x21, 0x02211040}), |
5212 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5213 | ALC255_STANDARD_PINS, | ||
5214 | {0x12, 0x90a60170}, | ||
5215 | {0x14, 0x90170140}, | ||
5216 | {0x17, 0x40000000}, | ||
5217 | {0x1d, 0x40700001}, | ||
5218 | {0x21, 0x02211050}), | ||
5212 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, | 5219 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, |
5213 | {0x12, 0x90a60130}, | 5220 | {0x12, 0x90a60130}, |
5214 | {0x13, 0x40000000}, | 5221 | {0x13, 0x40000000}, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6d36c5b78805..87eff3173ce9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -79,6 +79,7 @@ enum { | |||
79 | STAC_ALIENWARE_M17X, | 79 | STAC_ALIENWARE_M17X, |
80 | STAC_92HD89XX_HP_FRONT_JACK, | 80 | STAC_92HD89XX_HP_FRONT_JACK, |
81 | STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, | 81 | STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, |
82 | STAC_92HD73XX_ASUS_MOBO, | ||
82 | STAC_92HD73XX_MODELS | 83 | STAC_92HD73XX_MODELS |
83 | }; | 84 | }; |
84 | 85 | ||
@@ -1911,7 +1912,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { | |||
1911 | [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { | 1912 | [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { |
1912 | .type = HDA_FIXUP_PINS, | 1913 | .type = HDA_FIXUP_PINS, |
1913 | .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, | 1914 | .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, |
1914 | } | 1915 | }, |
1916 | [STAC_92HD73XX_ASUS_MOBO] = { | ||
1917 | .type = HDA_FIXUP_PINS, | ||
1918 | .v.pins = (const struct hda_pintbl[]) { | ||
1919 | /* enable 5.1 and SPDIF out */ | ||
1920 | { 0x0c, 0x01014411 }, | ||
1921 | { 0x0d, 0x01014410 }, | ||
1922 | { 0x0e, 0x01014412 }, | ||
1923 | { 0x22, 0x014b1180 }, | ||
1924 | { } | ||
1925 | } | ||
1926 | }, | ||
1915 | }; | 1927 | }; |
1916 | 1928 | ||
1917 | static const struct hda_model_fixup stac92hd73xx_models[] = { | 1929 | static const struct hda_model_fixup stac92hd73xx_models[] = { |
@@ -1923,6 +1935,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { | |||
1923 | { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, | 1935 | { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, |
1924 | { .id = STAC_DELL_EQ, .name = "dell-eq" }, | 1936 | { .id = STAC_DELL_EQ, .name = "dell-eq" }, |
1925 | { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, | 1937 | { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, |
1938 | { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, | ||
1926 | {} | 1939 | {} |
1927 | }; | 1940 | }; |
1928 | 1941 | ||
@@ -1975,6 +1988,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { | |||
1975 | "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), | 1988 | "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), |
1976 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, | 1989 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, |
1977 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), | 1990 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), |
1991 | SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", | ||
1992 | STAC_92HD73XX_ASUS_MOBO), | ||
1978 | {} /* terminator */ | 1993 | {} /* terminator */ |
1979 | }; | 1994 | }; |
1980 | 1995 | ||
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index f5ad214663f9..8de836165cf2 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
@@ -46,8 +46,6 @@ | |||
46 | #include <sound/pcm_params.h> | 46 | #include <sound/pcm_params.h> |
47 | #include <sound/soc.h> | 47 | #include <sound/soc.h> |
48 | 48 | ||
49 | #include <asm/mach-types.h> | ||
50 | |||
51 | #include "../codecs/wm8731.h" | 49 | #include "../codecs/wm8731.h" |
52 | #include "atmel-pcm.h" | 50 | #include "atmel-pcm.h" |
53 | #include "atmel_ssc_dai.h" | 51 | #include "atmel_ssc_dai.h" |
@@ -171,9 +169,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) | |||
171 | int ret; | 169 | int ret; |
172 | 170 | ||
173 | if (!np) { | 171 | if (!np) { |
174 | if (!(machine_is_at91sam9g20ek() || | 172 | return -ENODEV; |
175 | machine_is_at91sam9g20ek_2mmc())) | ||
176 | return -ENODEV; | ||
177 | } | 173 | } |
178 | 174 | ||
179 | ret = atmel_ssc_set_audio(0); | 175 | ret = atmel_ssc_set_audio(0); |
@@ -210,39 +206,37 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) | |||
210 | card->dev = &pdev->dev; | 206 | card->dev = &pdev->dev; |
211 | 207 | ||
212 | /* Parse device node info */ | 208 | /* Parse device node info */ |
213 | if (np) { | 209 | ret = snd_soc_of_parse_card_name(card, "atmel,model"); |
214 | ret = snd_soc_of_parse_card_name(card, "atmel,model"); | 210 | if (ret) |
215 | if (ret) | 211 | goto err; |
216 | goto err; | 212 | |
217 | 213 | ret = snd_soc_of_parse_audio_routing(card, | |
218 | ret = snd_soc_of_parse_audio_routing(card, | 214 | "atmel,audio-routing"); |
219 | "atmel,audio-routing"); | 215 | if (ret) |
220 | if (ret) | 216 | goto err; |
221 | goto err; | 217 | |
222 | 218 | /* Parse codec info */ | |
223 | /* Parse codec info */ | 219 | at91sam9g20ek_dai.codec_name = NULL; |
224 | at91sam9g20ek_dai.codec_name = NULL; | 220 | codec_np = of_parse_phandle(np, "atmel,audio-codec", 0); |
225 | codec_np = of_parse_phandle(np, "atmel,audio-codec", 0); | 221 | if (!codec_np) { |
226 | if (!codec_np) { | 222 | dev_err(&pdev->dev, "codec info missing\n"); |
227 | dev_err(&pdev->dev, "codec info missing\n"); | 223 | return -EINVAL; |
228 | return -EINVAL; | 224 | } |
229 | } | 225 | at91sam9g20ek_dai.codec_of_node = codec_np; |
230 | at91sam9g20ek_dai.codec_of_node = codec_np; | 226 | |
231 | 227 | /* Parse dai and platform info */ | |
232 | /* Parse dai and platform info */ | 228 | at91sam9g20ek_dai.cpu_dai_name = NULL; |
233 | at91sam9g20ek_dai.cpu_dai_name = NULL; | 229 | at91sam9g20ek_dai.platform_name = NULL; |
234 | at91sam9g20ek_dai.platform_name = NULL; | 230 | cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0); |
235 | cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0); | 231 | if (!cpu_np) { |
236 | if (!cpu_np) { | 232 | dev_err(&pdev->dev, "dai and pcm info missing\n"); |
237 | dev_err(&pdev->dev, "dai and pcm info missing\n"); | 233 | return -EINVAL; |
238 | return -EINVAL; | ||
239 | } | ||
240 | at91sam9g20ek_dai.cpu_of_node = cpu_np; | ||
241 | at91sam9g20ek_dai.platform_of_node = cpu_np; | ||
242 | |||
243 | of_node_put(codec_np); | ||
244 | of_node_put(cpu_np); | ||
245 | } | 234 | } |
235 | at91sam9g20ek_dai.cpu_of_node = cpu_np; | ||
236 | at91sam9g20ek_dai.platform_of_node = cpu_np; | ||
237 | |||
238 | of_node_put(codec_np); | ||
239 | of_node_put(cpu_np); | ||
246 | 240 | ||
247 | ret = snd_soc_register_card(card); | 241 | ret = snd_soc_register_card(card); |
248 | if (ret) { | 242 | if (ret) { |
diff --git a/sound/soc/cirrus/Kconfig b/sound/soc/cirrus/Kconfig index 7b7fbcd49e5e..c7cd60f009e9 100644 --- a/sound/soc/cirrus/Kconfig +++ b/sound/soc/cirrus/Kconfig | |||
@@ -16,7 +16,7 @@ config SND_EP93XX_SOC_AC97 | |||
16 | 16 | ||
17 | config SND_EP93XX_SOC_SNAPPERCL15 | 17 | config SND_EP93XX_SOC_SNAPPERCL15 |
18 | tristate "SoC Audio support for Bluewater Systems Snapper CL15 module" | 18 | tristate "SoC Audio support for Bluewater Systems Snapper CL15 module" |
19 | depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15 | 19 | depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15 && I2C |
20 | select SND_EP93XX_SOC_I2S | 20 | select SND_EP93XX_SOC_I2S |
21 | select SND_SOC_TLV320AIC23_I2C | 21 | select SND_SOC_TLV320AIC23_I2C |
22 | help | 22 | help |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 064e6c18e109..ea9f0e31f9d4 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -69,7 +69,7 @@ config SND_SOC_ALL_CODECS | |||
69 | select SND_SOC_MAX98088 if I2C | 69 | select SND_SOC_MAX98088 if I2C |
70 | select SND_SOC_MAX98090 if I2C | 70 | select SND_SOC_MAX98090 if I2C |
71 | select SND_SOC_MAX98095 if I2C | 71 | select SND_SOC_MAX98095 if I2C |
72 | select SND_SOC_MAX98357A | 72 | select SND_SOC_MAX98357A if GPIOLIB |
73 | select SND_SOC_MAX9850 if I2C | 73 | select SND_SOC_MAX9850 if I2C |
74 | select SND_SOC_MAX9768 if I2C | 74 | select SND_SOC_MAX9768 if I2C |
75 | select SND_SOC_MAX9877 if I2C | 75 | select SND_SOC_MAX9877 if I2C |
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index 1806333ea29e..e9e6efbc21dd 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c | |||
@@ -12,9 +12,19 @@ | |||
12 | * max98357a.c -- MAX98357A ALSA SoC Codec driver | 12 | * max98357a.c -- MAX98357A ALSA SoC Codec driver |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/device.h> |
16 | #include <linux/err.h> | ||
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <linux/gpio/consumer.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/mod_devicetable.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <sound/pcm.h> | ||
17 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
26 | #include <sound/soc-dai.h> | ||
27 | #include <sound/soc-dapm.h> | ||
18 | 28 | ||
19 | #define DRV_NAME "max98357a" | 29 | #define DRV_NAME "max98357a" |
20 | 30 | ||
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index e1a4a45c57e2..fd102613d20d 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -225,7 +225,6 @@ static bool rt5670_volatile_register(struct device *dev, unsigned int reg) | |||
225 | case RT5670_ADC_EQ_CTRL1: | 225 | case RT5670_ADC_EQ_CTRL1: |
226 | case RT5670_EQ_CTRL1: | 226 | case RT5670_EQ_CTRL1: |
227 | case RT5670_ALC_CTRL_1: | 227 | case RT5670_ALC_CTRL_1: |
228 | case RT5670_IRQ_CTRL1: | ||
229 | case RT5670_IRQ_CTRL2: | 228 | case RT5670_IRQ_CTRL2: |
230 | case RT5670_INT_IRQ_ST: | 229 | case RT5670_INT_IRQ_ST: |
231 | case RT5670_IL_CMD: | 230 | case RT5670_IL_CMD: |
@@ -2703,6 +2702,12 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | |||
2703 | 2702 | ||
2704 | regmap_write(rt5670->regmap, RT5670_RESET, 0); | 2703 | regmap_write(rt5670->regmap, RT5670_RESET, 0); |
2705 | 2704 | ||
2705 | regmap_read(rt5670->regmap, RT5670_VENDOR_ID, &val); | ||
2706 | if (val >= 4) | ||
2707 | regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0980); | ||
2708 | else | ||
2709 | regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0d00); | ||
2710 | |||
2706 | ret = regmap_register_patch(rt5670->regmap, init_list, | 2711 | ret = regmap_register_patch(rt5670->regmap, init_list, |
2707 | ARRAY_SIZE(init_list)); | 2712 | ARRAY_SIZE(init_list)); |
2708 | if (ret != 0) | 2713 | if (ret != 0) |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 5d0bb8748dd1..fb9c20eace3f 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -3284,8 +3284,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3284 | { "IB45 Bypass Mux", "Bypass", "IB45 Mux" }, | 3284 | { "IB45 Bypass Mux", "Bypass", "IB45 Mux" }, |
3285 | { "IB45 Bypass Mux", "Pass SRC", "IB45 Mux" }, | 3285 | { "IB45 Bypass Mux", "Pass SRC", "IB45 Mux" }, |
3286 | 3286 | ||
3287 | { "IB6 Mux", "IF1 DAC 6", "IF1 DAC6" }, | 3287 | { "IB6 Mux", "IF1 DAC 6", "IF1 DAC6 Mux" }, |
3288 | { "IB6 Mux", "IF2 DAC 6", "IF2 DAC6" }, | 3288 | { "IB6 Mux", "IF2 DAC 6", "IF2 DAC6 Mux" }, |
3289 | { "IB6 Mux", "SLB DAC 6", "SLB DAC6" }, | 3289 | { "IB6 Mux", "SLB DAC 6", "SLB DAC6" }, |
3290 | { "IB6 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" }, | 3290 | { "IB6 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" }, |
3291 | { "IB6 Mux", "IF4 DAC L", "IF4 DAC L" }, | 3291 | { "IB6 Mux", "IF4 DAC L", "IF4 DAC L" }, |
@@ -3293,8 +3293,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3293 | { "IB6 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, | 3293 | { "IB6 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, |
3294 | { "IB6 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, | 3294 | { "IB6 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, |
3295 | 3295 | ||
3296 | { "IB7 Mux", "IF1 DAC 7", "IF1 DAC7" }, | 3296 | { "IB7 Mux", "IF1 DAC 7", "IF1 DAC7 Mux" }, |
3297 | { "IB7 Mux", "IF2 DAC 7", "IF2 DAC7" }, | 3297 | { "IB7 Mux", "IF2 DAC 7", "IF2 DAC7 Mux" }, |
3298 | { "IB7 Mux", "SLB DAC 7", "SLB DAC7" }, | 3298 | { "IB7 Mux", "SLB DAC 7", "SLB DAC7" }, |
3299 | { "IB7 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" }, | 3299 | { "IB7 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" }, |
3300 | { "IB7 Mux", "IF4 DAC R", "IF4 DAC R" }, | 3300 | { "IB7 Mux", "IF4 DAC R", "IF4 DAC R" }, |
@@ -3635,15 +3635,15 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3635 | { "DAC1 FS", NULL, "DAC1 MIXL" }, | 3635 | { "DAC1 FS", NULL, "DAC1 MIXL" }, |
3636 | { "DAC1 FS", NULL, "DAC1 MIXR" }, | 3636 | { "DAC1 FS", NULL, "DAC1 MIXR" }, |
3637 | 3637 | ||
3638 | { "DAC2 L Mux", "IF1 DAC 2", "IF1 DAC2" }, | 3638 | { "DAC2 L Mux", "IF1 DAC 2", "IF1 DAC2 Mux" }, |
3639 | { "DAC2 L Mux", "IF2 DAC 2", "IF2 DAC2" }, | 3639 | { "DAC2 L Mux", "IF2 DAC 2", "IF2 DAC2 Mux" }, |
3640 | { "DAC2 L Mux", "IF3 DAC L", "IF3 DAC L" }, | 3640 | { "DAC2 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
3641 | { "DAC2 L Mux", "IF4 DAC L", "IF4 DAC L" }, | 3641 | { "DAC2 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
3642 | { "DAC2 L Mux", "SLB DAC 2", "SLB DAC2" }, | 3642 | { "DAC2 L Mux", "SLB DAC 2", "SLB DAC2" }, |
3643 | { "DAC2 L Mux", "OB 2", "OutBound2" }, | 3643 | { "DAC2 L Mux", "OB 2", "OutBound2" }, |
3644 | 3644 | ||
3645 | { "DAC2 R Mux", "IF1 DAC 3", "IF1 DAC3" }, | 3645 | { "DAC2 R Mux", "IF1 DAC 3", "IF1 DAC3 Mux" }, |
3646 | { "DAC2 R Mux", "IF2 DAC 3", "IF2 DAC3" }, | 3646 | { "DAC2 R Mux", "IF2 DAC 3", "IF2 DAC3 Mux" }, |
3647 | { "DAC2 R Mux", "IF3 DAC R", "IF3 DAC R" }, | 3647 | { "DAC2 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
3648 | { "DAC2 R Mux", "IF4 DAC R", "IF4 DAC R" }, | 3648 | { "DAC2 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
3649 | { "DAC2 R Mux", "SLB DAC 3", "SLB DAC3" }, | 3649 | { "DAC2 R Mux", "SLB DAC 3", "SLB DAC3" }, |
@@ -3651,29 +3651,29 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3651 | { "DAC2 R Mux", "Haptic Generator", "Haptic Generator" }, | 3651 | { "DAC2 R Mux", "Haptic Generator", "Haptic Generator" }, |
3652 | { "DAC2 R Mux", "VAD ADC", "VAD ADC Mux" }, | 3652 | { "DAC2 R Mux", "VAD ADC", "VAD ADC Mux" }, |
3653 | 3653 | ||
3654 | { "DAC3 L Mux", "IF1 DAC 4", "IF1 DAC4" }, | 3654 | { "DAC3 L Mux", "IF1 DAC 4", "IF1 DAC4 Mux" }, |
3655 | { "DAC3 L Mux", "IF2 DAC 4", "IF2 DAC4" }, | 3655 | { "DAC3 L Mux", "IF2 DAC 4", "IF2 DAC4 Mux" }, |
3656 | { "DAC3 L Mux", "IF3 DAC L", "IF3 DAC L" }, | 3656 | { "DAC3 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
3657 | { "DAC3 L Mux", "IF4 DAC L", "IF4 DAC L" }, | 3657 | { "DAC3 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
3658 | { "DAC3 L Mux", "SLB DAC 4", "SLB DAC4" }, | 3658 | { "DAC3 L Mux", "SLB DAC 4", "SLB DAC4" }, |
3659 | { "DAC3 L Mux", "OB 4", "OutBound4" }, | 3659 | { "DAC3 L Mux", "OB 4", "OutBound4" }, |
3660 | 3660 | ||
3661 | { "DAC3 R Mux", "IF1 DAC 5", "IF1 DAC4" }, | 3661 | { "DAC3 R Mux", "IF1 DAC 5", "IF1 DAC5 Mux" }, |
3662 | { "DAC3 R Mux", "IF2 DAC 5", "IF2 DAC4" }, | 3662 | { "DAC3 R Mux", "IF2 DAC 5", "IF2 DAC5 Mux" }, |
3663 | { "DAC3 R Mux", "IF3 DAC R", "IF3 DAC R" }, | 3663 | { "DAC3 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
3664 | { "DAC3 R Mux", "IF4 DAC R", "IF4 DAC R" }, | 3664 | { "DAC3 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
3665 | { "DAC3 R Mux", "SLB DAC 5", "SLB DAC5" }, | 3665 | { "DAC3 R Mux", "SLB DAC 5", "SLB DAC5" }, |
3666 | { "DAC3 R Mux", "OB 5", "OutBound5" }, | 3666 | { "DAC3 R Mux", "OB 5", "OutBound5" }, |
3667 | 3667 | ||
3668 | { "DAC4 L Mux", "IF1 DAC 6", "IF1 DAC6" }, | 3668 | { "DAC4 L Mux", "IF1 DAC 6", "IF1 DAC6 Mux" }, |
3669 | { "DAC4 L Mux", "IF2 DAC 6", "IF2 DAC6" }, | 3669 | { "DAC4 L Mux", "IF2 DAC 6", "IF2 DAC6 Mux" }, |
3670 | { "DAC4 L Mux", "IF3 DAC L", "IF3 DAC L" }, | 3670 | { "DAC4 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
3671 | { "DAC4 L Mux", "IF4 DAC L", "IF4 DAC L" }, | 3671 | { "DAC4 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
3672 | { "DAC4 L Mux", "SLB DAC 6", "SLB DAC6" }, | 3672 | { "DAC4 L Mux", "SLB DAC 6", "SLB DAC6" }, |
3673 | { "DAC4 L Mux", "OB 6", "OutBound6" }, | 3673 | { "DAC4 L Mux", "OB 6", "OutBound6" }, |
3674 | 3674 | ||
3675 | { "DAC4 R Mux", "IF1 DAC 7", "IF1 DAC7" }, | 3675 | { "DAC4 R Mux", "IF1 DAC 7", "IF1 DAC7 Mux" }, |
3676 | { "DAC4 R Mux", "IF2 DAC 7", "IF2 DAC7" }, | 3676 | { "DAC4 R Mux", "IF2 DAC 7", "IF2 DAC7 Mux" }, |
3677 | { "DAC4 R Mux", "IF3 DAC R", "IF3 DAC R" }, | 3677 | { "DAC4 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
3678 | { "DAC4 R Mux", "IF4 DAC R", "IF4 DAC R" }, | 3678 | { "DAC4 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
3679 | { "DAC4 R Mux", "SLB DAC 7", "SLB DAC7" }, | 3679 | { "DAC4 R Mux", "SLB DAC 7", "SLB DAC7" }, |
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 3a1343fa109b..007a0e3bc273 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
@@ -106,13 +106,11 @@ static const struct reg_default sta32x_regs[] = { | |||
106 | }; | 106 | }; |
107 | 107 | ||
108 | static const struct regmap_range sta32x_write_regs_range[] = { | 108 | static const struct regmap_range sta32x_write_regs_range[] = { |
109 | regmap_reg_range(STA32X_CONFA, STA32X_AUTO2), | 109 | regmap_reg_range(STA32X_CONFA, STA32X_FDRC2), |
110 | regmap_reg_range(STA32X_C1CFG, STA32X_FDRC2), | ||
111 | }; | 110 | }; |
112 | 111 | ||
113 | static const struct regmap_range sta32x_read_regs_range[] = { | 112 | static const struct regmap_range sta32x_read_regs_range[] = { |
114 | regmap_reg_range(STA32X_CONFA, STA32X_AUTO2), | 113 | regmap_reg_range(STA32X_CONFA, STA32X_FDRC2), |
115 | regmap_reg_range(STA32X_C1CFG, STA32X_FDRC2), | ||
116 | }; | 114 | }; |
117 | 115 | ||
118 | static const struct regmap_range sta32x_volatile_regs_range[] = { | 116 | static const struct regmap_range sta32x_volatile_regs_range[] = { |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 2595611e8a6d..b9fabbf69db6 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -603,10 +603,6 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, | |||
603 | factor = (div2 + 1) * (7 * psr + 1) * 2; | 603 | factor = (div2 + 1) * (7 * psr + 1) * 2; |
604 | 604 | ||
605 | for (i = 0; i < 255; i++) { | 605 | for (i = 0; i < 255; i++) { |
606 | /* The bclk rate must be smaller than 1/5 sysclk rate */ | ||
607 | if (factor * (i + 1) < 5) | ||
608 | continue; | ||
609 | |||
610 | tmprate = freq * factor * (i + 2); | 606 | tmprate = freq * factor * (i + 2); |
611 | 607 | ||
612 | if (baudclk_is_used) | 608 | if (baudclk_is_used) |
@@ -614,6 +610,13 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, | |||
614 | else | 610 | else |
615 | clkrate = clk_round_rate(ssi_private->baudclk, tmprate); | 611 | clkrate = clk_round_rate(ssi_private->baudclk, tmprate); |
616 | 612 | ||
613 | /* | ||
614 | * Hardware limitation: The bclk rate must be | ||
615 | * never greater than 1/5 IPG clock rate | ||
616 | */ | ||
617 | if (clkrate * 5 > clk_get_rate(ssi_private->clk)) | ||
618 | continue; | ||
619 | |||
617 | clkrate /= factor; | 620 | clkrate /= factor; |
618 | afreq = clkrate / (i + 1); | 621 | afreq = clkrate / (i + 1); |
619 | 622 | ||
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index f7c6734bd5da..fb550b5869d2 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -372,6 +372,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
372 | strlen(dai_link->cpu_dai_name) + | 372 | strlen(dai_link->cpu_dai_name) + |
373 | strlen(dai_link->codec_dai_name) + 2, | 373 | strlen(dai_link->codec_dai_name) + 2, |
374 | GFP_KERNEL); | 374 | GFP_KERNEL); |
375 | if (!name) { | ||
376 | ret = -ENOMEM; | ||
377 | goto dai_link_of_err; | ||
378 | } | ||
379 | |||
375 | sprintf(name, "%s-%s", dai_link->cpu_dai_name, | 380 | sprintf(name, "%s-%s", dai_link->cpu_dai_name, |
376 | dai_link->codec_dai_name); | 381 | dai_link->codec_dai_name); |
377 | dai_link->name = dai_link->stream_name = name; | 382 | dai_link->name = dai_link->stream_name = name; |
diff --git a/sound/soc/intel/sst-atom-controls.h b/sound/soc/intel/sst-atom-controls.h index dfebfdd5eb2a..daecc58f28af 100644 --- a/sound/soc/intel/sst-atom-controls.h +++ b/sound/soc/intel/sst-atom-controls.h | |||
@@ -150,7 +150,7 @@ enum sst_cmd_type { | |||
150 | 150 | ||
151 | enum sst_task { | 151 | enum sst_task { |
152 | SST_TASK_SBA = 1, | 152 | SST_TASK_SBA = 1, |
153 | SST_TASK_MMX, | 153 | SST_TASK_MMX = 3, |
154 | }; | 154 | }; |
155 | 155 | ||
156 | enum sst_type { | 156 | enum sst_type { |
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c index 8a8d56a146e7..11c578651c1c 100644 --- a/sound/soc/intel/sst/sst.c +++ b/sound/soc/intel/sst/sst.c | |||
@@ -350,7 +350,9 @@ static inline void sst_save_shim64(struct intel_sst_drv *ctx, | |||
350 | 350 | ||
351 | spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); | 351 | spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); |
352 | 352 | ||
353 | shim_regs->imrx = sst_shim_read64(shim, SST_IMRX), | 353 | shim_regs->imrx = sst_shim_read64(shim, SST_IMRX); |
354 | shim_regs->csr = sst_shim_read64(shim, SST_CSR); | ||
355 | |||
354 | 356 | ||
355 | spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); | 357 | spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); |
356 | } | 358 | } |
@@ -367,6 +369,7 @@ static inline void sst_restore_shim64(struct intel_sst_drv *ctx, | |||
367 | */ | 369 | */ |
368 | spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); | 370 | spin_lock_irqsave(&ctx->ipc_spin_lock, irq_flags); |
369 | sst_shim_write64(shim, SST_IMRX, shim_regs->imrx), | 371 | sst_shim_write64(shim, SST_IMRX, shim_regs->imrx), |
372 | sst_shim_write64(shim, SST_CSR, shim_regs->csr), | ||
370 | spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); | 373 | spin_unlock_irqrestore(&ctx->ipc_spin_lock, irq_flags); |
371 | } | 374 | } |
372 | 375 | ||
@@ -379,6 +382,10 @@ void sst_configure_runtime_pm(struct intel_sst_drv *ctx) | |||
379 | * initially active. So change the state to active before | 382 | * initially active. So change the state to active before |
380 | * enabling the pm | 383 | * enabling the pm |
381 | */ | 384 | */ |
385 | |||
386 | if (!acpi_disabled) | ||
387 | pm_runtime_set_active(ctx->dev); | ||
388 | |||
382 | pm_runtime_enable(ctx->dev); | 389 | pm_runtime_enable(ctx->dev); |
383 | 390 | ||
384 | if (acpi_disabled) | 391 | if (acpi_disabled) |
@@ -409,6 +416,7 @@ static int intel_sst_runtime_suspend(struct device *dev) | |||
409 | synchronize_irq(ctx->irq_num); | 416 | synchronize_irq(ctx->irq_num); |
410 | flush_workqueue(ctx->post_msg_wq); | 417 | flush_workqueue(ctx->post_msg_wq); |
411 | 418 | ||
419 | ctx->ops->reset(ctx); | ||
412 | /* save the shim registers because PMC doesn't save state */ | 420 | /* save the shim registers because PMC doesn't save state */ |
413 | sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64); | 421 | sst_save_shim64(ctx, ctx->shim, ctx->shim_regs64); |
414 | 422 | ||
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c index ccfb41c22e53..f7eb42aa3f38 100644 --- a/sound/soc/omap/omap-hdmi-audio.c +++ b/sound/soc/omap/omap-hdmi-audio.c | |||
@@ -352,6 +352,9 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev) | |||
352 | return ret; | 352 | return ret; |
353 | 353 | ||
354 | card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); | 354 | card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); |
355 | if (!card) | ||
356 | return -ENOMEM; | ||
357 | |||
355 | card->name = devm_kasprintf(dev, GFP_KERNEL, | 358 | card->name = devm_kasprintf(dev, GFP_KERNEL, |
356 | "HDMI %s", dev_name(ad->dssdev)); | 359 | "HDMI %s", dev_name(ad->dssdev)); |
357 | card->owner = THIS_MODULE; | 360 | card->owner = THIS_MODULE; |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index c7eb9dd67f60..fd99d89de6a8 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -530,8 +530,19 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
530 | 530 | ||
531 | case OMAP_MCBSP_SYSCLK_CLKX_EXT: | 531 | case OMAP_MCBSP_SYSCLK_CLKX_EXT: |
532 | regs->srgr2 |= CLKSM; | 532 | regs->srgr2 |= CLKSM; |
533 | regs->pcr0 |= SCLKME; | ||
534 | /* | ||
535 | * If McBSP is master but yet the CLKX/CLKR pin drives the SRG, | ||
536 | * disable output on those pins. This enables to inject the | ||
537 | * reference clock through CLKX/CLKR. For this to work | ||
538 | * set_dai_sysclk() _needs_ to be called after set_dai_fmt(). | ||
539 | */ | ||
540 | regs->pcr0 &= ~CLKXM; | ||
541 | break; | ||
533 | case OMAP_MCBSP_SYSCLK_CLKR_EXT: | 542 | case OMAP_MCBSP_SYSCLK_CLKR_EXT: |
534 | regs->pcr0 |= SCLKME; | 543 | regs->pcr0 |= SCLKME; |
544 | /* Disable ouput on CLKR pin in master mode */ | ||
545 | regs->pcr0 &= ~CLKRM; | ||
535 | break; | 546 | break; |
536 | default: | 547 | default: |
537 | err = -ENODEV; | 548 | err = -ENODEV; |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index f4b05bc23e4b..1343ecbf0bd5 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -201,7 +201,7 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
201 | struct snd_pcm *pcm = rtd->pcm; | 201 | struct snd_pcm *pcm = rtd->pcm; |
202 | int ret; | 202 | int ret; |
203 | 203 | ||
204 | ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(64)); | 204 | ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); |
205 | if (ret) | 205 | if (ret) |
206 | return ret; | 206 | return ret; |
207 | 207 | ||
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 3cebf6ca03df..0632a36852c8 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -174,7 +174,7 @@ config SND_SOC_SMDK_WM8994_PCM | |||
174 | 174 | ||
175 | config SND_SOC_SPEYSIDE | 175 | config SND_SOC_SPEYSIDE |
176 | tristate "Audio support for Wolfson Speyside" | 176 | tristate "Audio support for Wolfson Speyside" |
177 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 | 177 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 && I2C && SPI_MASTER |
178 | select SND_SAMSUNG_I2S | 178 | select SND_SAMSUNG_I2S |
179 | select SND_SOC_WM8996 | 179 | select SND_SOC_WM8996 |
180 | select SND_SOC_WM9081 | 180 | select SND_SOC_WM9081 |
@@ -189,7 +189,7 @@ config SND_SOC_TOBERMORY | |||
189 | 189 | ||
190 | config SND_SOC_BELLS | 190 | config SND_SOC_BELLS |
191 | tristate "Audio support for Wolfson Bells" | 191 | tristate "Audio support for Wolfson Bells" |
192 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 && MFD_ARIZONA | 192 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 && MFD_ARIZONA && I2C && SPI_MASTER |
193 | select SND_SAMSUNG_I2S | 193 | select SND_SAMSUNG_I2S |
194 | select SND_SOC_WM5102 | 194 | select SND_SOC_WM5102 |
195 | select SND_SOC_WM5110 | 195 | select SND_SOC_WM5110 |
@@ -206,7 +206,7 @@ config SND_SOC_LOWLAND | |||
206 | 206 | ||
207 | config SND_SOC_LITTLEMILL | 207 | config SND_SOC_LITTLEMILL |
208 | tristate "Audio support for Wolfson Littlemill" | 208 | tristate "Audio support for Wolfson Littlemill" |
209 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 | 209 | depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 && I2C |
210 | select SND_SAMSUNG_I2S | 210 | select SND_SAMSUNG_I2S |
211 | select MFD_WM8994 | 211 | select MFD_WM8994 |
212 | select SND_SOC_WM8994 | 212 | select SND_SOC_WM8994 |
@@ -223,7 +223,7 @@ config SND_SOC_SNOW | |||
223 | 223 | ||
224 | config SND_SOC_ODROIDX2 | 224 | config SND_SOC_ODROIDX2 |
225 | tristate "Audio support for Odroid-X2 and Odroid-U3" | 225 | tristate "Audio support for Odroid-X2 and Odroid-U3" |
226 | depends on SND_SOC_SAMSUNG | 226 | depends on SND_SOC_SAMSUNG && I2C |
227 | select SND_SOC_MAX98090 | 227 | select SND_SOC_MAX98090 |
228 | select SND_SAMSUNG_I2S | 228 | select SND_SAMSUNG_I2S |
229 | help | 229 | help |
@@ -231,6 +231,6 @@ config SND_SOC_ODROIDX2 | |||
231 | 231 | ||
232 | config SND_SOC_ARNDALE_RT5631_ALC5631 | 232 | config SND_SOC_ARNDALE_RT5631_ALC5631 |
233 | tristate "Audio support for RT5631(ALC5631) on Arndale Board" | 233 | tristate "Audio support for RT5631(ALC5631) on Arndale Board" |
234 | depends on SND_SOC_SAMSUNG | 234 | depends on SND_SOC_SAMSUNG && I2C |
235 | select SND_SAMSUNG_I2S | 235 | select SND_SAMSUNG_I2S |
236 | select SND_SOC_RT5631 | 236 | select SND_SOC_RT5631 |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 1b53605f7154..110577c52317 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -1252,6 +1252,8 @@ static int rsnd_probe(struct platform_device *pdev) | |||
1252 | goto exit_snd_probe; | 1252 | goto exit_snd_probe; |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | dev_set_drvdata(dev, priv); | ||
1256 | |||
1255 | /* | 1257 | /* |
1256 | * asoc register | 1258 | * asoc register |
1257 | */ | 1259 | */ |
@@ -1268,8 +1270,6 @@ static int rsnd_probe(struct platform_device *pdev) | |||
1268 | goto exit_snd_soc; | 1270 | goto exit_snd_soc; |
1269 | } | 1271 | } |
1270 | 1272 | ||
1271 | dev_set_drvdata(dev, priv); | ||
1272 | |||
1273 | pm_runtime_enable(dev); | 1273 | pm_runtime_enable(dev); |
1274 | 1274 | ||
1275 | dev_info(dev, "probed\n"); | 1275 | dev_info(dev, "probed\n"); |
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c index 05dee690f487..97ed593f6010 100644 --- a/sound/usb/line6/playback.c +++ b/sound/usb/line6/playback.c | |||
@@ -39,7 +39,7 @@ static void change_volume(struct urb *urb_out, int volume[], | |||
39 | for (; p < buf_end; ++p) { | 39 | for (; p < buf_end; ++p) { |
40 | short pv = le16_to_cpu(*p); | 40 | short pv = le16_to_cpu(*p); |
41 | int val = (pv * volume[chn & 1]) >> 8; | 41 | int val = (pv * volume[chn & 1]) >> 8; |
42 | pv = clamp(val, 0x7fff, -0x8000); | 42 | pv = clamp(val, -0x8000, 0x7fff); |
43 | *p = cpu_to_le16(pv); | 43 | *p = cpu_to_le16(pv); |
44 | ++chn; | 44 | ++chn; |
45 | } | 45 | } |
@@ -54,7 +54,7 @@ static void change_volume(struct urb *urb_out, int volume[], | |||
54 | 54 | ||
55 | val = p[0] + (p[1] << 8) + ((signed char)p[2] << 16); | 55 | val = p[0] + (p[1] << 8) + ((signed char)p[2] << 16); |
56 | val = (val * volume[chn & 1]) >> 8; | 56 | val = (val * volume[chn & 1]) >> 8; |
57 | val = clamp(val, 0x7fffff, -0x800000); | 57 | val = clamp(val, -0x800000, 0x7fffff); |
58 | p[0] = val; | 58 | p[0] = val; |
59 | p[1] = val >> 8; | 59 | p[1] = val >> 8; |
60 | p[2] = val >> 16; | 60 | p[2] = val >> 16; |
@@ -126,7 +126,7 @@ static void add_monitor_signal(struct urb *urb_out, unsigned char *signal, | |||
126 | short pov = le16_to_cpu(*po); | 126 | short pov = le16_to_cpu(*po); |
127 | short piv = le16_to_cpu(*pi); | 127 | short piv = le16_to_cpu(*pi); |
128 | int val = pov + ((piv * volume) >> 8); | 128 | int val = pov + ((piv * volume) >> 8); |
129 | pov = clamp(val, 0x7fff, -0x8000); | 129 | pov = clamp(val, -0x8000, 0x7fff); |
130 | *po = cpu_to_le16(pov); | 130 | *po = cpu_to_le16(pov); |
131 | } | 131 | } |
132 | } | 132 | } |
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c index 6c14afe8c1b1..db1d3a29d97f 100644 --- a/tools/perf/bench/mem-memcpy.c +++ b/tools/perf/bench/mem-memcpy.c | |||
@@ -289,7 +289,7 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault) | |||
289 | memcpy_t fn = r->fn.memcpy; | 289 | memcpy_t fn = r->fn.memcpy; |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | memcpy_alloc_mem(&src, &dst, len); | 292 | memcpy_alloc_mem(&dst, &src, len); |
293 | 293 | ||
294 | if (prefault) | 294 | if (prefault) |
295 | fn(dst, src, len); | 295 | fn(dst, src, len); |
@@ -312,7 +312,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len, | |||
312 | void *src = NULL, *dst = NULL; | 312 | void *src = NULL, *dst = NULL; |
313 | int i; | 313 | int i; |
314 | 314 | ||
315 | memcpy_alloc_mem(&src, &dst, len); | 315 | memcpy_alloc_mem(&dst, &src, len); |
316 | 316 | ||
317 | if (prefault) | 317 | if (prefault) |
318 | fn(dst, src, len); | 318 | fn(dst, src, len); |
diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch index ff95a68741d1..ac8721ffa6c8 100644 --- a/tools/perf/config/Makefile.arch +++ b/tools/perf/config/Makefile.arch | |||
@@ -21,6 +21,10 @@ ifeq ($(RAW_ARCH),x86_64) | |||
21 | endif | 21 | endif |
22 | endif | 22 | endif |
23 | 23 | ||
24 | ifeq ($(RAW_ARCH),sparc64) | ||
25 | ARCH ?= sparc | ||
26 | endif | ||
27 | |||
24 | ARCH ?= $(RAW_ARCH) | 28 | ARCH ?= $(RAW_ARCH) |
25 | 29 | ||
26 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) | 30 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 42ac05aaf8ac..b32ff3372514 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -49,7 +49,7 @@ test-hello.bin: | |||
49 | $(BUILD) | 49 | $(BUILD) |
50 | 50 | ||
51 | test-pthread-attr-setaffinity-np.bin: | 51 | test-pthread-attr-setaffinity-np.bin: |
52 | $(BUILD) -Werror -lpthread | 52 | $(BUILD) -D_GNU_SOURCE -Werror -lpthread |
53 | 53 | ||
54 | test-stackprotector-all.bin: | 54 | test-stackprotector-all.bin: |
55 | $(BUILD) -Werror -fstack-protector-all | 55 | $(BUILD) -Werror -fstack-protector-all |
diff --git a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c index 0a0d3ecb4e8a..2b81b72eca23 100644 --- a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c +++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | |||
@@ -5,10 +5,11 @@ int main(void) | |||
5 | { | 5 | { |
6 | int ret = 0; | 6 | int ret = 0; |
7 | pthread_attr_t thread_attr; | 7 | pthread_attr_t thread_attr; |
8 | cpu_set_t cs; | ||
8 | 9 | ||
9 | pthread_attr_init(&thread_attr); | 10 | pthread_attr_init(&thread_attr); |
10 | /* don't care abt exact args, just the API itself in libpthread */ | 11 | /* don't care abt exact args, just the API itself in libpthread */ |
11 | ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL); | 12 | ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs); |
12 | 13 | ||
13 | return ret; | 14 | return ret; |
14 | } | 15 | } |
diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index 47b78b3f0325..6da965bdbc2c 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c | |||
@@ -25,6 +25,10 @@ static int perf_flag_probe(void) | |||
25 | if (cpu < 0) | 25 | if (cpu < 0) |
26 | cpu = 0; | 26 | cpu = 0; |
27 | 27 | ||
28 | /* | ||
29 | * Using -1 for the pid is a workaround to avoid gratuitous jump label | ||
30 | * changes. | ||
31 | */ | ||
28 | while (1) { | 32 | while (1) { |
29 | /* check cloexec flag */ | 33 | /* check cloexec flag */ |
30 | fd = sys_perf_event_open(&attr, pid, cpu, -1, | 34 | fd = sys_perf_event_open(&attr, pid, cpu, -1, |
@@ -47,16 +51,24 @@ static int perf_flag_probe(void) | |||
47 | err, strerror_r(err, sbuf, sizeof(sbuf))); | 51 | err, strerror_r(err, sbuf, sizeof(sbuf))); |
48 | 52 | ||
49 | /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ | 53 | /* not supported, confirm error related to PERF_FLAG_FD_CLOEXEC */ |
50 | fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); | 54 | while (1) { |
55 | fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); | ||
56 | if (fd < 0 && pid == -1 && errno == EACCES) { | ||
57 | pid = 0; | ||
58 | continue; | ||
59 | } | ||
60 | break; | ||
61 | } | ||
51 | err = errno; | 62 | err = errno; |
52 | 63 | ||
64 | if (fd >= 0) | ||
65 | close(fd); | ||
66 | |||
53 | if (WARN_ONCE(fd < 0 && err != EBUSY, | 67 | if (WARN_ONCE(fd < 0 && err != EBUSY, |
54 | "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n", | 68 | "perf_event_open(..., 0) failed unexpectedly with error %d (%s)\n", |
55 | err, strerror_r(err, sbuf, sizeof(sbuf)))) | 69 | err, strerror_r(err, sbuf, sizeof(sbuf)))) |
56 | return -1; | 70 | return -1; |
57 | 71 | ||
58 | close(fd); | ||
59 | |||
60 | return 0; | 72 | return 0; |
61 | } | 73 | } |
62 | 74 | ||
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index c94a9e03ecf1..e99a67632831 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -28,7 +28,7 @@ struct perf_mmap { | |||
28 | int mask; | 28 | int mask; |
29 | int refcnt; | 29 | int refcnt; |
30 | unsigned int prev; | 30 | unsigned int prev; |
31 | char event_copy[PERF_SAMPLE_MAX_SIZE]; | 31 | char event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8))); |
32 | }; | 32 | }; |
33 | 33 | ||
34 | struct perf_evlist { | 34 | struct perf_evlist { |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index b24f9d8727a8..33b7a2aef713 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -11,6 +11,11 @@ | |||
11 | #include <symbol/kallsyms.h> | 11 | #include <symbol/kallsyms.h> |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | #ifndef EM_AARCH64 | ||
15 | #define EM_AARCH64 183 /* ARM 64 bit */ | ||
16 | #endif | ||
17 | |||
18 | |||
14 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT | 19 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
15 | extern char *cplus_demangle(const char *, int); | 20 | extern char *cplus_demangle(const char *, int); |
16 | 21 | ||
diff --git a/tools/thermal/tmon/.gitignore b/tools/thermal/tmon/.gitignore new file mode 100644 index 000000000000..06e96be65276 --- /dev/null +++ b/tools/thermal/tmon/.gitignore | |||
@@ -0,0 +1 @@ | |||
/tmon | |||
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index e775adcbd29f..0788621c8d76 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
@@ -2,8 +2,8 @@ VERSION = 1.0 | |||
2 | 2 | ||
3 | BINDIR=usr/bin | 3 | BINDIR=usr/bin |
4 | WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int | 4 | WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int |
5 | CFLAGS= -O1 ${WARNFLAGS} -fstack-protector | 5 | CFLAGS+= -O1 ${WARNFLAGS} -fstack-protector |
6 | CC=gcc | 6 | CC=$(CROSS_COMPILE)gcc |
7 | 7 | ||
8 | CFLAGS+=-D VERSION=\"$(VERSION)\" | 8 | CFLAGS+=-D VERSION=\"$(VERSION)\" |
9 | LDFLAGS+= | 9 | LDFLAGS+= |
@@ -16,12 +16,21 @@ INSTALL_CONFIGFILE=install -m 644 -p | |||
16 | CONFIG_FILE= | 16 | CONFIG_FILE= |
17 | CONFIG_PATH= | 17 | CONFIG_PATH= |
18 | 18 | ||
19 | # Static builds might require -ltinfo, for instance | ||
20 | ifneq ($(findstring -static, $(LDFLAGS)),) | ||
21 | STATIC := --static | ||
22 | endif | ||
23 | |||
24 | TMON_LIBS=-lm -lpthread | ||
25 | TMON_LIBS += $(shell pkg-config --libs $(STATIC) panelw ncursesw 2> /dev/null || \ | ||
26 | pkg-config --libs $(STATIC) panel ncurses 2> /dev/null || \ | ||
27 | echo -lpanel -lncurses) | ||
19 | 28 | ||
20 | OBJS = tmon.o tui.o sysfs.o pid.o | 29 | OBJS = tmon.o tui.o sysfs.o pid.o |
21 | OBJS += | 30 | OBJS += |
22 | 31 | ||
23 | tmon: $(OBJS) Makefile tmon.h | 32 | tmon: $(OBJS) Makefile tmon.h |
24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread | 33 | $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(TARGET) $(TMON_LIBS) |
25 | 34 | ||
26 | valgrind: tmon | 35 | valgrind: tmon |
27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null | 36 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null |
diff --git a/tools/thermal/tmon/tmon.8 b/tools/thermal/tmon/tmon.8 index 0be727cb9892..02d5179803aa 100644 --- a/tools/thermal/tmon/tmon.8 +++ b/tools/thermal/tmon/tmon.8 | |||
@@ -55,6 +55,8 @@ The \fB-l --log\fP option write data to /var/tmp/tmon.log | |||
55 | .PP | 55 | .PP |
56 | The \fB-t --time-interval\fP option sets the polling interval in seconds | 56 | The \fB-t --time-interval\fP option sets the polling interval in seconds |
57 | .PP | 57 | .PP |
58 | The \fB-T --target-temp\fP option sets the initial target temperature | ||
59 | .PP | ||
58 | The \fB-v --version\fP option shows the version of \fBtmon \fP | 60 | The \fB-v --version\fP option shows the version of \fBtmon \fP |
59 | .PP | 61 | .PP |
60 | The \fB-z --zone\fP option sets the target therma zone instance to be controlled | 62 | The \fB-z --zone\fP option sets the target therma zone instance to be controlled |
diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index 09b7c3218334..9aa19652e8e8 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c | |||
@@ -64,6 +64,7 @@ void usage() | |||
64 | printf(" -h, --help show this help message\n"); | 64 | printf(" -h, --help show this help message\n"); |
65 | printf(" -l, --log log data to /var/tmp/tmon.log\n"); | 65 | printf(" -l, --log log data to /var/tmp/tmon.log\n"); |
66 | printf(" -t, --time-interval sampling time interval, > 1 sec.\n"); | 66 | printf(" -t, --time-interval sampling time interval, > 1 sec.\n"); |
67 | printf(" -T, --target-temp initial target temperature\n"); | ||
67 | printf(" -v, --version show version\n"); | 68 | printf(" -v, --version show version\n"); |
68 | printf(" -z, --zone target thermal zone id\n"); | 69 | printf(" -z, --zone target thermal zone id\n"); |
69 | 70 | ||
@@ -219,6 +220,7 @@ static struct option opts[] = { | |||
219 | { "control", 1, NULL, 'c' }, | 220 | { "control", 1, NULL, 'c' }, |
220 | { "daemon", 0, NULL, 'd' }, | 221 | { "daemon", 0, NULL, 'd' }, |
221 | { "time-interval", 1, NULL, 't' }, | 222 | { "time-interval", 1, NULL, 't' }, |
223 | { "target-temp", 1, NULL, 'T' }, | ||
222 | { "log", 0, NULL, 'l' }, | 224 | { "log", 0, NULL, 'l' }, |
223 | { "help", 0, NULL, 'h' }, | 225 | { "help", 0, NULL, 'h' }, |
224 | { "version", 0, NULL, 'v' }, | 226 | { "version", 0, NULL, 'v' }, |
@@ -231,7 +233,7 @@ int main(int argc, char **argv) | |||
231 | { | 233 | { |
232 | int err = 0; | 234 | int err = 0; |
233 | int id2 = 0, c; | 235 | int id2 = 0, c; |
234 | double yk = 0.0; /* controller output */ | 236 | double yk = 0.0, temp; /* controller output */ |
235 | int target_tz_index; | 237 | int target_tz_index; |
236 | 238 | ||
237 | if (geteuid() != 0) { | 239 | if (geteuid() != 0) { |
@@ -239,7 +241,7 @@ int main(int argc, char **argv) | |||
239 | exit(EXIT_FAILURE); | 241 | exit(EXIT_FAILURE); |
240 | } | 242 | } |
241 | 243 | ||
242 | while ((c = getopt_long(argc, argv, "c:dlht:vgz:", opts, &id2)) != -1) { | 244 | while ((c = getopt_long(argc, argv, "c:dlht:T:vgz:", opts, &id2)) != -1) { |
243 | switch (c) { | 245 | switch (c) { |
244 | case 'c': | 246 | case 'c': |
245 | no_control = 0; | 247 | no_control = 0; |
@@ -254,6 +256,14 @@ int main(int argc, char **argv) | |||
254 | if (ticktime < 1) | 256 | if (ticktime < 1) |
255 | ticktime = 1; | 257 | ticktime = 1; |
256 | break; | 258 | break; |
259 | case 'T': | ||
260 | temp = strtod(optarg, NULL); | ||
261 | if (temp < 0) { | ||
262 | fprintf(stderr, "error: temperature must be positive\n"); | ||
263 | return 1; | ||
264 | } | ||
265 | target_temp_user = temp; | ||
266 | break; | ||
257 | case 'l': | 267 | case 'l': |
258 | printf("Logging data to /var/tmp/tmon.log\n"); | 268 | printf("Logging data to /var/tmp/tmon.log\n"); |
259 | logging = 1; | 269 | logging = 1; |
diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c index 89f8ef0e15c8..b5d1c6b22dd3 100644 --- a/tools/thermal/tmon/tui.c +++ b/tools/thermal/tmon/tui.c | |||
@@ -30,6 +30,18 @@ | |||
30 | 30 | ||
31 | #include "tmon.h" | 31 | #include "tmon.h" |
32 | 32 | ||
33 | #define min(x, y) ({ \ | ||
34 | typeof(x) _min1 = (x); \ | ||
35 | typeof(y) _min2 = (y); \ | ||
36 | (void) (&_min1 == &_min2); \ | ||
37 | _min1 < _min2 ? _min1 : _min2; }) | ||
38 | |||
39 | #define max(x, y) ({ \ | ||
40 | typeof(x) _max1 = (x); \ | ||
41 | typeof(y) _max2 = (y); \ | ||
42 | (void) (&_max1 == &_max2); \ | ||
43 | _max1 > _max2 ? _max1 : _max2; }) | ||
44 | |||
33 | static PANEL *data_panel; | 45 | static PANEL *data_panel; |
34 | static PANEL *dialogue_panel; | 46 | static PANEL *dialogue_panel; |
35 | static PANEL *top; | 47 | static PANEL *top; |
@@ -98,6 +110,18 @@ void write_status_bar(int x, char *line) | |||
98 | wrefresh(status_bar_window); | 110 | wrefresh(status_bar_window); |
99 | } | 111 | } |
100 | 112 | ||
113 | /* wrap at 5 */ | ||
114 | #define DIAG_DEV_ROWS 5 | ||
115 | /* | ||
116 | * list cooling devices + "set temp" entry; wraps after 5 rows, if they fit | ||
117 | */ | ||
118 | static int diag_dev_rows(void) | ||
119 | { | ||
120 | int entries = ptdata.nr_cooling_dev + 1; | ||
121 | int rows = max(DIAG_DEV_ROWS, (entries + 1) / 2); | ||
122 | return min(rows, entries); | ||
123 | } | ||
124 | |||
101 | void setup_windows(void) | 125 | void setup_windows(void) |
102 | { | 126 | { |
103 | int y_begin = 1; | 127 | int y_begin = 1; |
@@ -122,7 +146,7 @@ void setup_windows(void) | |||
122 | * dialogue window is a pop-up, when needed it lays on top of cdev win | 146 | * dialogue window is a pop-up, when needed it lays on top of cdev win |
123 | */ | 147 | */ |
124 | 148 | ||
125 | dialogue_window = subwin(stdscr, ptdata.nr_cooling_dev+5, maxx-50, | 149 | dialogue_window = subwin(stdscr, diag_dev_rows() + 5, maxx-50, |
126 | DIAG_Y, DIAG_X); | 150 | DIAG_Y, DIAG_X); |
127 | 151 | ||
128 | thermal_data_window = subwin(stdscr, ptdata.nr_tz_sensor * | 152 | thermal_data_window = subwin(stdscr, ptdata.nr_tz_sensor * |
@@ -258,21 +282,26 @@ void show_cooling_device(void) | |||
258 | } | 282 | } |
259 | 283 | ||
260 | const char DIAG_TITLE[] = "[ TUNABLES ]"; | 284 | const char DIAG_TITLE[] = "[ TUNABLES ]"; |
261 | #define DIAG_DEV_ROWS 5 | ||
262 | void show_dialogue(void) | 285 | void show_dialogue(void) |
263 | { | 286 | { |
264 | int j, x = 0, y = 0; | 287 | int j, x = 0, y = 0; |
288 | int rows, cols; | ||
265 | WINDOW *w = dialogue_window; | 289 | WINDOW *w = dialogue_window; |
266 | 290 | ||
267 | if (tui_disabled || !w) | 291 | if (tui_disabled || !w) |
268 | return; | 292 | return; |
269 | 293 | ||
294 | getmaxyx(w, rows, cols); | ||
295 | |||
296 | /* Silence compiler 'unused' warnings */ | ||
297 | (void)cols; | ||
298 | |||
270 | werase(w); | 299 | werase(w); |
271 | box(w, 0, 0); | 300 | box(w, 0, 0); |
272 | mvwprintw(w, 0, maxx/4, DIAG_TITLE); | 301 | mvwprintw(w, 0, maxx/4, DIAG_TITLE); |
273 | /* list all the available tunables */ | 302 | /* list all the available tunables */ |
274 | for (j = 0; j <= ptdata.nr_cooling_dev; j++) { | 303 | for (j = 0; j <= ptdata.nr_cooling_dev; j++) { |
275 | y = j % DIAG_DEV_ROWS; | 304 | y = j % diag_dev_rows(); |
276 | if (y == 0 && j != 0) | 305 | if (y == 0 && j != 0) |
277 | x += 20; | 306 | x += 20; |
278 | if (j == ptdata.nr_cooling_dev) | 307 | if (j == ptdata.nr_cooling_dev) |
@@ -283,12 +312,10 @@ void show_dialogue(void) | |||
283 | ptdata.cdi[j].type, ptdata.cdi[j].instance); | 312 | ptdata.cdi[j].type, ptdata.cdi[j].instance); |
284 | } | 313 | } |
285 | wattron(w, A_BOLD); | 314 | wattron(w, A_BOLD); |
286 | mvwprintw(w, DIAG_DEV_ROWS+1, 1, "Enter Choice [A-Z]?"); | 315 | mvwprintw(w, diag_dev_rows()+1, 1, "Enter Choice [A-Z]?"); |
287 | wattroff(w, A_BOLD); | 316 | wattroff(w, A_BOLD); |
288 | /* y size of dialogue win is nr cdev + 5, so print legend | 317 | /* print legend at the bottom line */ |
289 | * at the bottom line | 318 | mvwprintw(w, rows - 2, 1, |
290 | */ | ||
291 | mvwprintw(w, ptdata.nr_cooling_dev+3, 1, | ||
292 | "Legend: A=Active, P=Passive, C=Critical"); | 319 | "Legend: A=Active, P=Passive, C=Critical"); |
293 | 320 | ||
294 | wrefresh(dialogue_window); | 321 | wrefresh(dialogue_window); |
@@ -437,7 +464,7 @@ static void handle_input_choice(int ch) | |||
437 | snprintf(buf, sizeof(buf), "New Value for %.10s-%2d: ", | 464 | snprintf(buf, sizeof(buf), "New Value for %.10s-%2d: ", |
438 | ptdata.cdi[cdev_id].type, | 465 | ptdata.cdi[cdev_id].type, |
439 | ptdata.cdi[cdev_id].instance); | 466 | ptdata.cdi[cdev_id].instance); |
440 | write_dialogue_win(buf, DIAG_DEV_ROWS+2, 2); | 467 | write_dialogue_win(buf, diag_dev_rows() + 2, 2); |
441 | handle_input_val(cdev_id); | 468 | handle_input_val(cdev_id); |
442 | } else { | 469 | } else { |
443 | snprintf(buf, sizeof(buf), "Invalid selection %d", ch); | 470 | snprintf(buf, sizeof(buf), "Invalid selection %d", ch); |