diff options
author | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
---|---|---|
committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
commit | a215aa7b9ab3759c047201199fba64d3042d7f13 (patch) | |
tree | bca37493d9b2233450e6d3ffced1261d0e4f71fe | |
parent | d31199a77ef606f1d06894385f1852181ba6136b (diff) |
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
604 files changed, 5819 insertions, 2754 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 8dd7248508a9..48128ed08006 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -879,6 +879,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
879 | controller | 879 | controller |
880 | i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX | 880 | i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX |
881 | controllers | 881 | controllers |
882 | i8042.notimeout [HW] Ignore timeout condition signalled by conroller | ||
882 | i8042.reset [HW] Reset the controller during init and cleanup | 883 | i8042.reset [HW] Reset the controller during init and cleanup |
883 | i8042.unlock [HW] Unlock (ignore) the keylock | 884 | i8042.unlock [HW] Unlock (ignore) the keylock |
884 | 885 | ||
@@ -1745,7 +1746,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1745 | 1746 | ||
1746 | nousb [USB] Disable the USB subsystem | 1747 | nousb [USB] Disable the USB subsystem |
1747 | 1748 | ||
1748 | nowatchdog [KNL] Disable the lockup detector. | 1749 | nowatchdog [KNL] Disable the lockup detector (NMI watchdog). |
1749 | 1750 | ||
1750 | nowb [ARM] | 1751 | nowb [ARM] |
1751 | 1752 | ||
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 55b859b3bc72..506d9d916e41 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -336,8 +336,8 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h: | |||
336 | zero) | 336 | zero) |
337 | 337 | ||
338 | bool pm_runtime_suspended(struct device *dev); | 338 | bool pm_runtime_suspended(struct device *dev); |
339 | - return true if the device's runtime PM status is 'suspended', or false | 339 | - return true if the device's runtime PM status is 'suspended' and its |
340 | otherwise | 340 | 'power.disable_depth' field is equal to zero, or false otherwise |
341 | 341 | ||
342 | void pm_runtime_allow(struct device *dev); | 342 | void pm_runtime_allow(struct device *dev); |
343 | - set the power.runtime_auto flag for the device and decrease its usage | 343 | - set the power.runtime_auto flag for the device and decrease its usage |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 36 | 3 | SUBLEVEL = 36 |
4 | EXTRAVERSION =-litmus2010 | 4 | EXTRAVERSION =.4-litmus2010 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 6e8f05c8a1c8..d7575554e407 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h | |||
@@ -215,7 +215,7 @@ | |||
215 | @ Slightly optimised to avoid incrementing the pointer twice | 215 | @ Slightly optimised to avoid incrementing the pointer twice |
216 | usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort | 216 | usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort |
217 | .if \rept == 2 | 217 | .if \rept == 2 |
218 | usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort | 218 | usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort |
219 | .endif | 219 | .endif |
220 | 220 | ||
221 | add\cond \ptr, #\rept * \inc | 221 | add\cond \ptr, #\rept * \inc |
diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h index 08265993227f..48066ce9ea34 100644 --- a/arch/arm/include/asm/kgdb.h +++ b/arch/arm/include/asm/kgdb.h | |||
@@ -70,7 +70,8 @@ extern int kgdb_fault_expected; | |||
70 | #define _GP_REGS 16 | 70 | #define _GP_REGS 16 |
71 | #define _FP_REGS 8 | 71 | #define _FP_REGS 8 |
72 | #define _EXTRA_REGS 2 | 72 | #define _EXTRA_REGS 2 |
73 | #define DBG_MAX_REG_NUM (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) | 73 | #define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) |
74 | #define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS) | ||
74 | 75 | ||
75 | #define KGDB_MAX_NO_CPUS 1 | 76 | #define KGDB_MAX_NO_CPUS 1 |
76 | #define BUFMAX 400 | 77 | #define BUFMAX 400 |
@@ -93,7 +94,7 @@ extern int kgdb_fault_expected; | |||
93 | #define _SPT 13 | 94 | #define _SPT 13 |
94 | #define _LR 14 | 95 | #define _LR 14 |
95 | #define _PC 15 | 96 | #define _PC 15 |
96 | #define _CPSR (DBG_MAX_REG_NUM - 1) | 97 | #define _CPSR (GDB_MAX_REGS - 1) |
97 | 98 | ||
98 | /* | 99 | /* |
99 | * So that we can denote the end of a frame for tracing, | 100 | * So that we can denote the end of a frame for tracing, |
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index d6e8b4d2e60d..778c2f7024ff 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c | |||
@@ -79,7 +79,7 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) | |||
79 | return; | 79 | return; |
80 | 80 | ||
81 | /* Initialize to zero */ | 81 | /* Initialize to zero */ |
82 | for (regno = 0; regno < DBG_MAX_REG_NUM; regno++) | 82 | for (regno = 0; regno < GDB_MAX_REGS; regno++) |
83 | gdb_regs[regno] = 0; | 83 | gdb_regs[regno] = 0; |
84 | 84 | ||
85 | /* Otherwise, we have only some registers from switch_to() */ | 85 | /* Otherwise, we have only some registers from switch_to() */ |
diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 1e4cbd4e7be9..64f6bc1a9132 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S | |||
@@ -174,8 +174,8 @@ ENDPROC(_find_next_bit_be) | |||
174 | */ | 174 | */ |
175 | .L_found: | 175 | .L_found: |
176 | #if __LINUX_ARM_ARCH__ >= 5 | 176 | #if __LINUX_ARM_ARCH__ >= 5 |
177 | rsb r1, r3, #0 | 177 | rsb r0, r3, #0 |
178 | and r3, r3, r1 | 178 | and r3, r3, r0 |
179 | clz r3, r3 | 179 | clz r3, r3 |
180 | rsb r3, r3, #31 | 180 | rsb r3, r3, #31 |
181 | add r0, r2, r3 | 181 | add r0, r2, r3 |
@@ -190,5 +190,7 @@ ENDPROC(_find_next_bit_be) | |||
190 | addeq r2, r2, #1 | 190 | addeq r2, r2, #1 |
191 | mov r0, r2 | 191 | mov r0, r2 |
192 | #endif | 192 | #endif |
193 | cmp r1, r0 @ Clamp to maxbit | ||
194 | movlo r0, r1 | ||
193 | mov pc, lr | 195 | mov pc, lr |
194 | 196 | ||
diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h index 57f8ee154943..27ac6f550fe3 100644 --- a/arch/arm/mach-at91/include/mach/at91_mci.h +++ b/arch/arm/mach-at91/include/mach/at91_mci.h | |||
@@ -74,6 +74,8 @@ | |||
74 | #define AT91_MCI_TRTYP_BLOCK (0 << 19) | 74 | #define AT91_MCI_TRTYP_BLOCK (0 << 19) |
75 | #define AT91_MCI_TRTYP_MULTIPLE (1 << 19) | 75 | #define AT91_MCI_TRTYP_MULTIPLE (1 << 19) |
76 | #define AT91_MCI_TRTYP_STREAM (2 << 19) | 76 | #define AT91_MCI_TRTYP_STREAM (2 << 19) |
77 | #define AT91_MCI_TRTYP_SDIO_BYTE (4 << 19) | ||
78 | #define AT91_MCI_TRTYP_SDIO_BLOCK (5 << 19) | ||
77 | 79 | ||
78 | #define AT91_MCI_BLKR 0x18 /* Block Register */ | 80 | #define AT91_MCI_BLKR 0x18 /* Block Register */ |
79 | #define AT91_MCI_BLKR_BCNT(n) ((0xffff & (n)) << 0) /* Block count */ | 81 | #define AT91_MCI_BLKR_BCNT(n) ((0xffff & (n)) << 0) /* Block count */ |
diff --git a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S index d16ce7eb00e9..9b50442d4b9b 100644 --- a/arch/arm/mach-cns3xxx/include/mach/debug-macro.S +++ b/arch/arm/mach-cns3xxx/include/mach/debug-macro.S | |||
@@ -10,7 +10,7 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | .macro addruart,rx | 13 | .macro addruart,rx,rtmp |
14 | mrc p15, 0, \rx, c1, c0 | 14 | mrc p15, 0, \rx, c1, c0 |
15 | tst \rx, #1 @ MMU enabled? | 15 | tst \rx, #1 @ MMU enabled? |
16 | moveq \rx, #0x10000000 | 16 | moveq \rx, #0x10000000 |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 38088c36936c..78defd71a829 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
@@ -369,7 +369,7 @@ static int __init cns3xxx_pcie_init(void) | |||
369 | { | 369 | { |
370 | int i; | 370 | int i; |
371 | 371 | ||
372 | hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, | 372 | hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0, |
373 | "imprecise external abort"); | 373 | "imprecise external abort"); |
374 | 374 | ||
375 | for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) { | 375 | for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) { |
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S index 86aa689ef1aa..47010d8114b0 100644 --- a/arch/arm/mm/cache-v6.S +++ b/arch/arm/mm/cache-v6.S | |||
@@ -196,6 +196,10 @@ ENTRY(v6_flush_kern_dcache_area) | |||
196 | * - end - virtual end address of region | 196 | * - end - virtual end address of region |
197 | */ | 197 | */ |
198 | v6_dma_inv_range: | 198 | v6_dma_inv_range: |
199 | #ifdef CONFIG_DMA_CACHE_RWFO | ||
200 | ldrb r2, [r0] @ read for ownership | ||
201 | strb r2, [r0] @ write for ownership | ||
202 | #endif | ||
199 | tst r0, #D_CACHE_LINE_SIZE - 1 | 203 | tst r0, #D_CACHE_LINE_SIZE - 1 |
200 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 | 204 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 |
201 | #ifdef HARVARD_CACHE | 205 | #ifdef HARVARD_CACHE |
@@ -204,6 +208,10 @@ v6_dma_inv_range: | |||
204 | mcrne p15, 0, r0, c7, c11, 1 @ clean unified line | 208 | mcrne p15, 0, r0, c7, c11, 1 @ clean unified line |
205 | #endif | 209 | #endif |
206 | tst r1, #D_CACHE_LINE_SIZE - 1 | 210 | tst r1, #D_CACHE_LINE_SIZE - 1 |
211 | #ifdef CONFIG_DMA_CACHE_RWFO | ||
212 | ldrneb r2, [r1, #-1] @ read for ownership | ||
213 | strneb r2, [r1, #-1] @ write for ownership | ||
214 | #endif | ||
207 | bic r1, r1, #D_CACHE_LINE_SIZE - 1 | 215 | bic r1, r1, #D_CACHE_LINE_SIZE - 1 |
208 | #ifdef HARVARD_CACHE | 216 | #ifdef HARVARD_CACHE |
209 | mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line | 217 | mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line |
@@ -211,10 +219,6 @@ v6_dma_inv_range: | |||
211 | mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line | 219 | mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line |
212 | #endif | 220 | #endif |
213 | 1: | 221 | 1: |
214 | #ifdef CONFIG_DMA_CACHE_RWFO | ||
215 | ldr r2, [r0] @ read for ownership | ||
216 | str r2, [r0] @ write for ownership | ||
217 | #endif | ||
218 | #ifdef HARVARD_CACHE | 222 | #ifdef HARVARD_CACHE |
219 | mcr p15, 0, r0, c7, c6, 1 @ invalidate D line | 223 | mcr p15, 0, r0, c7, c6, 1 @ invalidate D line |
220 | #else | 224 | #else |
@@ -222,6 +226,10 @@ v6_dma_inv_range: | |||
222 | #endif | 226 | #endif |
223 | add r0, r0, #D_CACHE_LINE_SIZE | 227 | add r0, r0, #D_CACHE_LINE_SIZE |
224 | cmp r0, r1 | 228 | cmp r0, r1 |
229 | #ifdef CONFIG_DMA_CACHE_RWFO | ||
230 | ldrlo r2, [r0] @ read for ownership | ||
231 | strlo r2, [r0] @ write for ownership | ||
232 | #endif | ||
225 | blo 1b | 233 | blo 1b |
226 | mov r0, #0 | 234 | mov r0, #0 |
227 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | 235 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer |
@@ -256,12 +264,12 @@ v6_dma_clean_range: | |||
256 | * - end - virtual end address of region | 264 | * - end - virtual end address of region |
257 | */ | 265 | */ |
258 | ENTRY(v6_dma_flush_range) | 266 | ENTRY(v6_dma_flush_range) |
259 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 | ||
260 | 1: | ||
261 | #ifdef CONFIG_DMA_CACHE_RWFO | 267 | #ifdef CONFIG_DMA_CACHE_RWFO |
262 | ldr r2, [r0] @ read for ownership | 268 | ldrb r2, [r0] @ read for ownership |
263 | str r2, [r0] @ write for ownership | 269 | strb r2, [r0] @ write for ownership |
264 | #endif | 270 | #endif |
271 | bic r0, r0, #D_CACHE_LINE_SIZE - 1 | ||
272 | 1: | ||
265 | #ifdef HARVARD_CACHE | 273 | #ifdef HARVARD_CACHE |
266 | mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line | 274 | mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line |
267 | #else | 275 | #else |
@@ -269,6 +277,10 @@ ENTRY(v6_dma_flush_range) | |||
269 | #endif | 277 | #endif |
270 | add r0, r0, #D_CACHE_LINE_SIZE | 278 | add r0, r0, #D_CACHE_LINE_SIZE |
271 | cmp r0, r1 | 279 | cmp r0, r1 |
280 | #ifdef CONFIG_DMA_CACHE_RWFO | ||
281 | ldrlob r2, [r0] @ read for ownership | ||
282 | strlob r2, [r0] @ write for ownership | ||
283 | #endif | ||
272 | blo 1b | 284 | blo 1b |
273 | mov r0, #0 | 285 | mov r0, #0 |
274 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer | 286 | mcr p15, 0, r0, c7, c10, 4 @ drain write buffer |
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 9b906dec1ca1..56036ff04deb 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c | |||
@@ -65,6 +65,30 @@ static int do_adjust_pte(struct vm_area_struct *vma, unsigned long address, | |||
65 | return ret; | 65 | return ret; |
66 | } | 66 | } |
67 | 67 | ||
68 | #if USE_SPLIT_PTLOCKS | ||
69 | /* | ||
70 | * If we are using split PTE locks, then we need to take the page | ||
71 | * lock here. Otherwise we are using shared mm->page_table_lock | ||
72 | * which is already locked, thus cannot take it. | ||
73 | */ | ||
74 | static inline void do_pte_lock(spinlock_t *ptl) | ||
75 | { | ||
76 | /* | ||
77 | * Use nested version here to indicate that we are already | ||
78 | * holding one similar spinlock. | ||
79 | */ | ||
80 | spin_lock_nested(ptl, SINGLE_DEPTH_NESTING); | ||
81 | } | ||
82 | |||
83 | static inline void do_pte_unlock(spinlock_t *ptl) | ||
84 | { | ||
85 | spin_unlock(ptl); | ||
86 | } | ||
87 | #else /* !USE_SPLIT_PTLOCKS */ | ||
88 | static inline void do_pte_lock(spinlock_t *ptl) {} | ||
89 | static inline void do_pte_unlock(spinlock_t *ptl) {} | ||
90 | #endif /* USE_SPLIT_PTLOCKS */ | ||
91 | |||
68 | static int adjust_pte(struct vm_area_struct *vma, unsigned long address, | 92 | static int adjust_pte(struct vm_area_struct *vma, unsigned long address, |
69 | unsigned long pfn) | 93 | unsigned long pfn) |
70 | { | 94 | { |
@@ -89,11 +113,11 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address, | |||
89 | */ | 113 | */ |
90 | ptl = pte_lockptr(vma->vm_mm, pmd); | 114 | ptl = pte_lockptr(vma->vm_mm, pmd); |
91 | pte = pte_offset_map_nested(pmd, address); | 115 | pte = pte_offset_map_nested(pmd, address); |
92 | spin_lock(ptl); | 116 | do_pte_lock(ptl); |
93 | 117 | ||
94 | ret = do_adjust_pte(vma, address, pfn, pte); | 118 | ret = do_adjust_pte(vma, address, pfn, pte); |
95 | 119 | ||
96 | spin_unlock(ptl); | 120 | do_pte_unlock(ptl); |
97 | pte_unmap_nested(pte); | 121 | pte_unmap_nested(pte); |
98 | 122 | ||
99 | return ret; | 123 | return ret; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 7185b00650fe..4e2f620de09b 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -282,6 +282,12 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) | |||
282 | memblock_reserve(__pa(_stext), _end - _stext); | 282 | memblock_reserve(__pa(_stext), _end - _stext); |
283 | #endif | 283 | #endif |
284 | #ifdef CONFIG_BLK_DEV_INITRD | 284 | #ifdef CONFIG_BLK_DEV_INITRD |
285 | if (phys_initrd_size && | ||
286 | memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { | ||
287 | pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", | ||
288 | phys_initrd_start, phys_initrd_size); | ||
289 | phys_initrd_start = phys_initrd_size = 0; | ||
290 | } | ||
285 | if (phys_initrd_size) { | 291 | if (phys_initrd_size) { |
286 | memblock_reserve(phys_initrd_start, phys_initrd_size); | 292 | memblock_reserve(phys_initrd_start, phys_initrd_size); |
287 | 293 | ||
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index ec7eddf9e525..f5c5b8da9a87 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/irq.h> | 30 | #include <linux/irq.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/delay.h> | ||
33 | 34 | ||
34 | #include <asm/system.h> | 35 | #include <asm/system.h> |
35 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
@@ -996,11 +997,17 @@ void omap_start_dma(int lch) | |||
996 | l = dma_read(CCR(lch)); | 997 | l = dma_read(CCR(lch)); |
997 | 998 | ||
998 | /* | 999 | /* |
999 | * Errata: On ES2.0 BUFFERING disable must be set. | 1000 | * Errata: Inter Frame DMA buffering issue (All OMAP2420 and |
1000 | * This will always fail on ES1.0 | 1001 | * OMAP2430ES1.0): DMA will wrongly buffer elements if packing and |
1002 | * bursting is enabled. This might result in data gets stalled in | ||
1003 | * FIFO at the end of the block. | ||
1004 | * Workaround: DMA channels must have BUFFERING_DISABLED bit set to | ||
1005 | * guarantee no data will stay in the DMA FIFO in case inter frame | ||
1006 | * buffering occurs. | ||
1001 | */ | 1007 | */ |
1002 | if (cpu_is_omap24xx()) | 1008 | if (cpu_is_omap2420() || |
1003 | l |= OMAP_DMA_CCR_EN; | 1009 | (cpu_is_omap2430() && (omap_type() == OMAP2430_REV_ES1_0))) |
1010 | l |= OMAP_DMA_CCR_BUFFERING_DISABLE; | ||
1004 | 1011 | ||
1005 | l |= OMAP_DMA_CCR_EN; | 1012 | l |= OMAP_DMA_CCR_EN; |
1006 | dma_write(l, CCR(lch)); | 1013 | dma_write(l, CCR(lch)); |
@@ -1018,8 +1025,39 @@ void omap_stop_dma(int lch) | |||
1018 | dma_write(0, CICR(lch)); | 1025 | dma_write(0, CICR(lch)); |
1019 | 1026 | ||
1020 | l = dma_read(CCR(lch)); | 1027 | l = dma_read(CCR(lch)); |
1021 | l &= ~OMAP_DMA_CCR_EN; | 1028 | /* OMAP3 Errata i541: sDMA FIFO draining does not finish */ |
1022 | dma_write(l, CCR(lch)); | 1029 | if (cpu_is_omap34xx() && (l & OMAP_DMA_CCR_SEL_SRC_DST_SYNC)) { |
1030 | int i = 0; | ||
1031 | u32 sys_cf; | ||
1032 | |||
1033 | /* Configure No-Standby */ | ||
1034 | l = dma_read(OCP_SYSCONFIG); | ||
1035 | sys_cf = l; | ||
1036 | l &= ~DMA_SYSCONFIG_MIDLEMODE_MASK; | ||
1037 | l |= DMA_SYSCONFIG_MIDLEMODE(DMA_IDLEMODE_NO_IDLE); | ||
1038 | dma_write(l , OCP_SYSCONFIG); | ||
1039 | |||
1040 | l = dma_read(CCR(lch)); | ||
1041 | l &= ~OMAP_DMA_CCR_EN; | ||
1042 | dma_write(l, CCR(lch)); | ||
1043 | |||
1044 | /* Wait for sDMA FIFO drain */ | ||
1045 | l = dma_read(CCR(lch)); | ||
1046 | while (i < 100 && (l & (OMAP_DMA_CCR_RD_ACTIVE | | ||
1047 | OMAP_DMA_CCR_WR_ACTIVE))) { | ||
1048 | udelay(5); | ||
1049 | i++; | ||
1050 | l = dma_read(CCR(lch)); | ||
1051 | } | ||
1052 | if (i >= 100) | ||
1053 | printk(KERN_ERR "DMA drain did not complete on " | ||
1054 | "lch %d\n", lch); | ||
1055 | /* Restore OCP_SYSCONFIG */ | ||
1056 | dma_write(sys_cf, OCP_SYSCONFIG); | ||
1057 | } else { | ||
1058 | l &= ~OMAP_DMA_CCR_EN; | ||
1059 | dma_write(l, CCR(lch)); | ||
1060 | } | ||
1023 | 1061 | ||
1024 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { | 1062 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { |
1025 | int next_lch, cur_lch = lch; | 1063 | int next_lch, cur_lch = lch; |
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h index af3a03941add..cf66f85a011c 100644 --- a/arch/arm/plat-omap/include/plat/dma.h +++ b/arch/arm/plat-omap/include/plat/dma.h | |||
@@ -335,6 +335,10 @@ | |||
335 | #define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) | 335 | #define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) |
336 | 336 | ||
337 | #define OMAP_DMA_CCR_EN (1 << 7) | 337 | #define OMAP_DMA_CCR_EN (1 << 7) |
338 | #define OMAP_DMA_CCR_RD_ACTIVE (1 << 9) | ||
339 | #define OMAP_DMA_CCR_WR_ACTIVE (1 << 10) | ||
340 | #define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24) | ||
341 | #define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25) | ||
338 | 342 | ||
339 | #define OMAP_DMA_DATA_TYPE_S8 0x00 | 343 | #define OMAP_DMA_DATA_TYPE_S8 0x00 |
340 | #define OMAP_DMA_DATA_TYPE_S16 0x01 | 344 | #define OMAP_DMA_DATA_TYPE_S16 0x01 |
diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h index ab608b70b24d..730a461c606f 100644 --- a/arch/avr32/include/asm/syscalls.h +++ b/arch/avr32/include/asm/syscalls.h | |||
@@ -16,18 +16,9 @@ | |||
16 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
17 | 17 | ||
18 | /* kernel/process.c */ | 18 | /* kernel/process.c */ |
19 | asmlinkage int sys_fork(struct pt_regs *); | ||
20 | asmlinkage int sys_clone(unsigned long, unsigned long, | 19 | asmlinkage int sys_clone(unsigned long, unsigned long, |
21 | unsigned long, unsigned long, | 20 | unsigned long, unsigned long, |
22 | struct pt_regs *); | 21 | struct pt_regs *); |
23 | asmlinkage int sys_vfork(struct pt_regs *); | ||
24 | asmlinkage int sys_execve(const char __user *, char __user *__user *, | ||
25 | char __user *__user *, struct pt_regs *); | ||
26 | |||
27 | /* kernel/signal.c */ | ||
28 | asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *, | ||
29 | struct pt_regs *); | ||
30 | asmlinkage int sys_rt_sigreturn(struct pt_regs *); | ||
31 | 22 | ||
32 | /* mm/cache.c */ | 23 | /* mm/cache.c */ |
33 | asmlinkage int sys_cacheflush(int, void __user *, size_t); | 24 | asmlinkage int sys_cacheflush(int, void __user *, size_t); |
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index 592c7079de88..b07d990bbed8 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile | |||
@@ -72,12 +72,16 @@ export MMU DTB | |||
72 | 72 | ||
73 | all: linux.bin | 73 | all: linux.bin |
74 | 74 | ||
75 | BOOT_TARGETS = linux.bin linux.bin.gz simpleImage.% | 75 | # With make 3.82 we cannot mix normal and wildcard targets |
76 | BOOT_TARGETS1 = linux.bin linux.bin.gz | ||
77 | BOOT_TARGETS2 = simpleImage.% | ||
76 | 78 | ||
77 | archclean: | 79 | archclean: |
78 | $(Q)$(MAKE) $(clean)=$(boot) | 80 | $(Q)$(MAKE) $(clean)=$(boot) |
79 | 81 | ||
80 | $(BOOT_TARGETS): vmlinux | 82 | $(BOOT_TARGETS1): vmlinux |
83 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | ||
84 | $(BOOT_TARGETS2): vmlinux | ||
81 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 85 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
82 | 86 | ||
83 | define archhelp | 87 | define archhelp |
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c index 5742bb4d78f4..5c0a3575877c 100644 --- a/arch/mips/jz4740/board-qi_lb60.c +++ b/arch/mips/jz4740/board-qi_lb60.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (c) 2009 Qi Hardware inc., | 6 | * Copyright (c) 2009 Qi Hardware inc., |
7 | * Author: Xiangfu Liu <xiangfu@qi-hardware.com> | 7 | * Author: Xiangfu Liu <xiangfu@qi-hardware.com> |
8 | * Copyright 2010, Lars-Petrer Clausen <lars@metafoo.de> | 8 | * Copyright 2010, Lars-Peter Clausen <lars@metafoo.de> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 or later | 11 | * it under the terms of the GNU General Public License version 2 or later |
@@ -235,7 +235,7 @@ static const unsigned int qi_lb60_keypad_rows[] = { | |||
235 | QI_LB60_GPIO_KEYIN(3), | 235 | QI_LB60_GPIO_KEYIN(3), |
236 | QI_LB60_GPIO_KEYIN(4), | 236 | QI_LB60_GPIO_KEYIN(4), |
237 | QI_LB60_GPIO_KEYIN(5), | 237 | QI_LB60_GPIO_KEYIN(5), |
238 | QI_LB60_GPIO_KEYIN(7), | 238 | QI_LB60_GPIO_KEYIN(6), |
239 | QI_LB60_GPIO_KEYIN8, | 239 | QI_LB60_GPIO_KEYIN8, |
240 | }; | 240 | }; |
241 | 241 | ||
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c index df971fa0c32f..4896ed090585 100644 --- a/arch/parisc/kernel/firmware.c +++ b/arch/parisc/kernel/firmware.c | |||
@@ -1126,15 +1126,13 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) | |||
1126 | unsigned int i; | 1126 | unsigned int i; |
1127 | unsigned long flags; | 1127 | unsigned long flags; |
1128 | 1128 | ||
1129 | for (i = 0; i < count && i < 79;) { | 1129 | for (i = 0; i < count;) { |
1130 | switch(str[i]) { | 1130 | switch(str[i]) { |
1131 | case '\n': | 1131 | case '\n': |
1132 | iodc_dbuf[i+0] = '\r'; | 1132 | iodc_dbuf[i+0] = '\r'; |
1133 | iodc_dbuf[i+1] = '\n'; | 1133 | iodc_dbuf[i+1] = '\n'; |
1134 | i += 2; | 1134 | i += 2; |
1135 | goto print; | 1135 | goto print; |
1136 | case '\b': /* BS */ | ||
1137 | i--; /* overwrite last */ | ||
1138 | default: | 1136 | default: |
1139 | iodc_dbuf[i] = str[i]; | 1137 | iodc_dbuf[i] = str[i]; |
1140 | i++; | 1138 | i++; |
@@ -1142,15 +1140,6 @@ int pdc_iodc_print(const unsigned char *str, unsigned count) | |||
1142 | } | 1140 | } |
1143 | } | 1141 | } |
1144 | 1142 | ||
1145 | /* if we're at the end of line, and not already inserting a newline, | ||
1146 | * insert one anyway. iodc console doesn't claim to support >79 char | ||
1147 | * lines. don't account for this in the return value. | ||
1148 | */ | ||
1149 | if (i == 79 && iodc_dbuf[i-1] != '\n') { | ||
1150 | iodc_dbuf[i+0] = '\r'; | ||
1151 | iodc_dbuf[i+1] = '\n'; | ||
1152 | } | ||
1153 | |||
1154 | print: | 1143 | print: |
1155 | spin_lock_irqsave(&pdc_lock, flags); | 1144 | spin_lock_irqsave(&pdc_lock, flags); |
1156 | real32_call(PAGE0->mem_cons.iodc_io, | 1145 | real32_call(PAGE0->mem_cons.iodc_io, |
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts index 8bcb10b92677..d086e0f8bbd3 100644 --- a/arch/powerpc/boot/dts/p1022ds.dts +++ b/arch/powerpc/boot/dts/p1022ds.dts | |||
@@ -280,13 +280,13 @@ | |||
280 | ranges = <0x0 0xc100 0x200>; | 280 | ranges = <0x0 0xc100 0x200>; |
281 | cell-index = <1>; | 281 | cell-index = <1>; |
282 | dma00: dma-channel@0 { | 282 | dma00: dma-channel@0 { |
283 | compatible = "fsl,eloplus-dma-channel"; | 283 | compatible = "fsl,ssi-dma-channel"; |
284 | reg = <0x0 0x80>; | 284 | reg = <0x0 0x80>; |
285 | cell-index = <0>; | 285 | cell-index = <0>; |
286 | interrupts = <76 2>; | 286 | interrupts = <76 2>; |
287 | }; | 287 | }; |
288 | dma01: dma-channel@80 { | 288 | dma01: dma-channel@80 { |
289 | compatible = "fsl,eloplus-dma-channel"; | 289 | compatible = "fsl,ssi-dma-channel"; |
290 | reg = <0x80 0x80>; | 290 | reg = <0x80 0x80>; |
291 | cell-index = <1>; | 291 | cell-index = <1>; |
292 | interrupts = <77 2>; | 292 | interrupts = <77 2>; |
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S index 55cba4a8a959..f8cd9fba4d35 100644 --- a/arch/powerpc/kernel/cpu_setup_6xx.S +++ b/arch/powerpc/kernel/cpu_setup_6xx.S | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/mmu.h> | 18 | #include <asm/mmu.h> |
19 | 19 | ||
20 | _GLOBAL(__setup_cpu_603) | 20 | _GLOBAL(__setup_cpu_603) |
21 | mflr r4 | 21 | mflr r5 |
22 | BEGIN_MMU_FTR_SECTION | 22 | BEGIN_MMU_FTR_SECTION |
23 | li r10,0 | 23 | li r10,0 |
24 | mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ | 24 | mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ |
@@ -27,60 +27,60 @@ BEGIN_FTR_SECTION | |||
27 | bl __init_fpu_registers | 27 | bl __init_fpu_registers |
28 | END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) | 28 | END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) |
29 | bl setup_common_caches | 29 | bl setup_common_caches |
30 | mtlr r4 | 30 | mtlr r5 |
31 | blr | 31 | blr |
32 | _GLOBAL(__setup_cpu_604) | 32 | _GLOBAL(__setup_cpu_604) |
33 | mflr r4 | 33 | mflr r5 |
34 | bl setup_common_caches | 34 | bl setup_common_caches |
35 | bl setup_604_hid0 | 35 | bl setup_604_hid0 |
36 | mtlr r4 | 36 | mtlr r5 |
37 | blr | 37 | blr |
38 | _GLOBAL(__setup_cpu_750) | 38 | _GLOBAL(__setup_cpu_750) |
39 | mflr r4 | 39 | mflr r5 |
40 | bl __init_fpu_registers | 40 | bl __init_fpu_registers |
41 | bl setup_common_caches | 41 | bl setup_common_caches |
42 | bl setup_750_7400_hid0 | 42 | bl setup_750_7400_hid0 |
43 | mtlr r4 | 43 | mtlr r5 |
44 | blr | 44 | blr |
45 | _GLOBAL(__setup_cpu_750cx) | 45 | _GLOBAL(__setup_cpu_750cx) |
46 | mflr r4 | 46 | mflr r5 |
47 | bl __init_fpu_registers | 47 | bl __init_fpu_registers |
48 | bl setup_common_caches | 48 | bl setup_common_caches |
49 | bl setup_750_7400_hid0 | 49 | bl setup_750_7400_hid0 |
50 | bl setup_750cx | 50 | bl setup_750cx |
51 | mtlr r4 | 51 | mtlr r5 |
52 | blr | 52 | blr |
53 | _GLOBAL(__setup_cpu_750fx) | 53 | _GLOBAL(__setup_cpu_750fx) |
54 | mflr r4 | 54 | mflr r5 |
55 | bl __init_fpu_registers | 55 | bl __init_fpu_registers |
56 | bl setup_common_caches | 56 | bl setup_common_caches |
57 | bl setup_750_7400_hid0 | 57 | bl setup_750_7400_hid0 |
58 | bl setup_750fx | 58 | bl setup_750fx |
59 | mtlr r4 | 59 | mtlr r5 |
60 | blr | 60 | blr |
61 | _GLOBAL(__setup_cpu_7400) | 61 | _GLOBAL(__setup_cpu_7400) |
62 | mflr r4 | 62 | mflr r5 |
63 | bl __init_fpu_registers | 63 | bl __init_fpu_registers |
64 | bl setup_7400_workarounds | 64 | bl setup_7400_workarounds |
65 | bl setup_common_caches | 65 | bl setup_common_caches |
66 | bl setup_750_7400_hid0 | 66 | bl setup_750_7400_hid0 |
67 | mtlr r4 | 67 | mtlr r5 |
68 | blr | 68 | blr |
69 | _GLOBAL(__setup_cpu_7410) | 69 | _GLOBAL(__setup_cpu_7410) |
70 | mflr r4 | 70 | mflr r5 |
71 | bl __init_fpu_registers | 71 | bl __init_fpu_registers |
72 | bl setup_7410_workarounds | 72 | bl setup_7410_workarounds |
73 | bl setup_common_caches | 73 | bl setup_common_caches |
74 | bl setup_750_7400_hid0 | 74 | bl setup_750_7400_hid0 |
75 | li r3,0 | 75 | li r3,0 |
76 | mtspr SPRN_L2CR2,r3 | 76 | mtspr SPRN_L2CR2,r3 |
77 | mtlr r4 | 77 | mtlr r5 |
78 | blr | 78 | blr |
79 | _GLOBAL(__setup_cpu_745x) | 79 | _GLOBAL(__setup_cpu_745x) |
80 | mflr r4 | 80 | mflr r5 |
81 | bl setup_common_caches | 81 | bl setup_common_caches |
82 | bl setup_745x_specifics | 82 | bl setup_745x_specifics |
83 | mtlr r4 | 83 | mtlr r5 |
84 | blr | 84 | blr |
85 | 85 | ||
86 | /* Enable caches for 603's, 604, 750 & 7400 */ | 86 | /* Enable caches for 603's, 604, 750 & 7400 */ |
@@ -194,10 +194,10 @@ setup_750cx: | |||
194 | cror 4*cr0+eq,4*cr0+eq,4*cr1+eq | 194 | cror 4*cr0+eq,4*cr0+eq,4*cr1+eq |
195 | cror 4*cr0+eq,4*cr0+eq,4*cr2+eq | 195 | cror 4*cr0+eq,4*cr0+eq,4*cr2+eq |
196 | bnelr | 196 | bnelr |
197 | lwz r6,CPU_SPEC_FEATURES(r5) | 197 | lwz r6,CPU_SPEC_FEATURES(r4) |
198 | li r7,CPU_FTR_CAN_NAP | 198 | li r7,CPU_FTR_CAN_NAP |
199 | andc r6,r6,r7 | 199 | andc r6,r6,r7 |
200 | stw r6,CPU_SPEC_FEATURES(r5) | 200 | stw r6,CPU_SPEC_FEATURES(r4) |
201 | blr | 201 | blr |
202 | 202 | ||
203 | /* 750fx specific | 203 | /* 750fx specific |
@@ -225,12 +225,12 @@ BEGIN_FTR_SECTION | |||
225 | andis. r11,r11,L3CR_L3E@h | 225 | andis. r11,r11,L3CR_L3E@h |
226 | beq 1f | 226 | beq 1f |
227 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) | 227 | END_FTR_SECTION_IFSET(CPU_FTR_L3CR) |
228 | lwz r6,CPU_SPEC_FEATURES(r5) | 228 | lwz r6,CPU_SPEC_FEATURES(r4) |
229 | andi. r0,r6,CPU_FTR_L3_DISABLE_NAP | 229 | andi. r0,r6,CPU_FTR_L3_DISABLE_NAP |
230 | beq 1f | 230 | beq 1f |
231 | li r7,CPU_FTR_CAN_NAP | 231 | li r7,CPU_FTR_CAN_NAP |
232 | andc r6,r6,r7 | 232 | andc r6,r6,r7 |
233 | stw r6,CPU_SPEC_FEATURES(r5) | 233 | stw r6,CPU_SPEC_FEATURES(r4) |
234 | 1: | 234 | 1: |
235 | mfspr r11,SPRN_HID0 | 235 | mfspr r11,SPRN_HID0 |
236 | 236 | ||
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c index 8eff48e20dba..3fee685de4df 100644 --- a/arch/powerpc/kernel/ppc970-pmu.c +++ b/arch/powerpc/kernel/ppc970-pmu.c | |||
@@ -169,9 +169,11 @@ static int p970_marked_instr_event(u64 event) | |||
169 | switch (unit) { | 169 | switch (unit) { |
170 | case PM_VPU: | 170 | case PM_VPU: |
171 | mask = 0x4c; /* byte 0 bits 2,3,6 */ | 171 | mask = 0x4c; /* byte 0 bits 2,3,6 */ |
172 | break; | ||
172 | case PM_LSU0: | 173 | case PM_LSU0: |
173 | /* byte 2 bits 0,2,3,4,6; all of byte 1 */ | 174 | /* byte 2 bits 0,2,3,4,6; all of byte 1 */ |
174 | mask = 0x085dff00; | 175 | mask = 0x085dff00; |
176 | break; | ||
175 | case PM_LSU1L: | 177 | case PM_LSU1L: |
176 | mask = 0x50 << 24; /* byte 3 bits 4,6 */ | 178 | mask = 0x50 << 24; /* byte 3 bits 4,6 */ |
177 | break; | 179 | break; |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 09dffe6efa46..1eb64ba43a08 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -1122,7 +1122,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, | |||
1122 | else | 1122 | else |
1123 | #endif /* CONFIG_PPC_HAS_HASH_64K */ | 1123 | #endif /* CONFIG_PPC_HAS_HASH_64K */ |
1124 | rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize, | 1124 | rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize, |
1125 | subpage_protection(pgdir, ea)); | 1125 | subpage_protection(mm, ea)); |
1126 | 1126 | ||
1127 | /* Dump some info in case of hash insertion failure, they should | 1127 | /* Dump some info in case of hash insertion failure, they should |
1128 | * never happen so it is really useful to know if/when they do | 1128 | * never happen so it is really useful to know if/when they do |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 002878ccf90b..1537ab31880b 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -181,7 +181,7 @@ static void unmap_cpu_from_node(unsigned long cpu) | |||
181 | dbg("removing cpu %lu from node %d\n", cpu, node); | 181 | dbg("removing cpu %lu from node %d\n", cpu, node); |
182 | 182 | ||
183 | if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { | 183 | if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { |
184 | cpumask_set_cpu(cpu, node_to_cpumask_map[node]); | 184 | cpumask_clear_cpu(cpu, node_to_cpumask_map[node]); |
185 | } else { | 185 | } else { |
186 | printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", | 186 | printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", |
187 | cpu, node); | 187 | cpu, node); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index cf79b46d8f88..568b503d68bd 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -680,6 +680,13 @@ EXPORT_SYMBOL(arch_free_page); | |||
680 | /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ | 680 | /* NB: reg/unreg are called while guarded with the tracepoints_mutex */ |
681 | extern long hcall_tracepoint_refcount; | 681 | extern long hcall_tracepoint_refcount; |
682 | 682 | ||
683 | /* | ||
684 | * Since the tracing code might execute hcalls we need to guard against | ||
685 | * recursion. One example of this are spinlocks calling H_YIELD on | ||
686 | * shared processor partitions. | ||
687 | */ | ||
688 | static DEFINE_PER_CPU(unsigned int, hcall_trace_depth); | ||
689 | |||
683 | void hcall_tracepoint_regfunc(void) | 690 | void hcall_tracepoint_regfunc(void) |
684 | { | 691 | { |
685 | hcall_tracepoint_refcount++; | 692 | hcall_tracepoint_refcount++; |
@@ -692,12 +699,42 @@ void hcall_tracepoint_unregfunc(void) | |||
692 | 699 | ||
693 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args) | 700 | void __trace_hcall_entry(unsigned long opcode, unsigned long *args) |
694 | { | 701 | { |
702 | unsigned long flags; | ||
703 | unsigned int *depth; | ||
704 | |||
705 | local_irq_save(flags); | ||
706 | |||
707 | depth = &__get_cpu_var(hcall_trace_depth); | ||
708 | |||
709 | if (*depth) | ||
710 | goto out; | ||
711 | |||
712 | (*depth)++; | ||
695 | trace_hcall_entry(opcode, args); | 713 | trace_hcall_entry(opcode, args); |
714 | (*depth)--; | ||
715 | |||
716 | out: | ||
717 | local_irq_restore(flags); | ||
696 | } | 718 | } |
697 | 719 | ||
698 | void __trace_hcall_exit(long opcode, unsigned long retval, | 720 | void __trace_hcall_exit(long opcode, unsigned long retval, |
699 | unsigned long *retbuf) | 721 | unsigned long *retbuf) |
700 | { | 722 | { |
723 | unsigned long flags; | ||
724 | unsigned int *depth; | ||
725 | |||
726 | local_irq_save(flags); | ||
727 | |||
728 | depth = &__get_cpu_var(hcall_trace_depth); | ||
729 | |||
730 | if (*depth) | ||
731 | goto out; | ||
732 | |||
733 | (*depth)++; | ||
701 | trace_hcall_exit(opcode, retval, retbuf); | 734 | trace_hcall_exit(opcode, retval, retbuf); |
735 | (*depth)--; | ||
736 | |||
737 | out: | ||
738 | local_irq_restore(flags); | ||
702 | } | 739 | } |
703 | #endif | 740 | #endif |
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 3017532319c8..b7f02a484e54 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -954,7 +954,6 @@ fsl_rio_dbell_handler(int irq, void *dev_instance) | |||
954 | if (dsr & DOORBELL_DSR_QFI) { | 954 | if (dsr & DOORBELL_DSR_QFI) { |
955 | pr_info("RIO: doorbell queue full\n"); | 955 | pr_info("RIO: doorbell queue full\n"); |
956 | out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_QFI); | 956 | out_be32(&priv->msg_regs->dsr, DOORBELL_DSR_QFI); |
957 | goto out; | ||
958 | } | 957 | } |
959 | 958 | ||
960 | /* XXX Need to check/dispatch until queue empty */ | 959 | /* XXX Need to check/dispatch until queue empty */ |
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index ac151399ef34..1995c1712fc8 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c | |||
@@ -95,7 +95,6 @@ EXPORT_SYMBOL_GPL(s390_handle_mcck); | |||
95 | static int notrace s390_revalidate_registers(struct mci *mci) | 95 | static int notrace s390_revalidate_registers(struct mci *mci) |
96 | { | 96 | { |
97 | int kill_task; | 97 | int kill_task; |
98 | u64 tmpclock; | ||
99 | u64 zero; | 98 | u64 zero; |
100 | void *fpt_save_area, *fpt_creg_save_area; | 99 | void *fpt_save_area, *fpt_creg_save_area; |
101 | 100 | ||
@@ -214,11 +213,10 @@ static int notrace s390_revalidate_registers(struct mci *mci) | |||
214 | : "0", "cc"); | 213 | : "0", "cc"); |
215 | #endif | 214 | #endif |
216 | /* Revalidate clock comparator register */ | 215 | /* Revalidate clock comparator register */ |
217 | asm volatile( | 216 | if (S390_lowcore.clock_comparator == -1) |
218 | " stck 0(%1)\n" | 217 | set_clock_comparator(S390_lowcore.mcck_clock); |
219 | " sckc 0(%1)" | 218 | else |
220 | : "=m" (tmpclock) : "a" (&(tmpclock)) : "cc", "memory"); | 219 | set_clock_comparator(S390_lowcore.clock_comparator); |
221 | |||
222 | /* Check if old PSW is valid */ | 220 | /* Check if old PSW is valid */ |
223 | if (!mci->wp) | 221 | if (!mci->wp) |
224 | /* | 222 | /* |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 3479f1b0d4e0..c1e326cedea5 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel_stat.h> | 19 | #include <linux/kernel_stat.h> |
20 | #include <linux/rcupdate.h> | 20 | #include <linux/rcupdate.h> |
21 | #include <linux/posix-timers.h> | 21 | #include <linux/posix-timers.h> |
22 | #include <linux/cpu.h> | ||
22 | 23 | ||
23 | #include <asm/s390_ext.h> | 24 | #include <asm/s390_ext.h> |
24 | #include <asm/timer.h> | 25 | #include <asm/timer.h> |
@@ -565,6 +566,23 @@ void init_cpu_vtimer(void) | |||
565 | __ctl_set_bit(0,10); | 566 | __ctl_set_bit(0,10); |
566 | } | 567 | } |
567 | 568 | ||
569 | static int __cpuinit s390_nohz_notify(struct notifier_block *self, | ||
570 | unsigned long action, void *hcpu) | ||
571 | { | ||
572 | struct s390_idle_data *idle; | ||
573 | long cpu = (long) hcpu; | ||
574 | |||
575 | idle = &per_cpu(s390_idle, cpu); | ||
576 | switch (action) { | ||
577 | case CPU_DYING: | ||
578 | case CPU_DYING_FROZEN: | ||
579 | idle->nohz_delay = 0; | ||
580 | default: | ||
581 | break; | ||
582 | } | ||
583 | return NOTIFY_OK; | ||
584 | } | ||
585 | |||
568 | void __init vtime_init(void) | 586 | void __init vtime_init(void) |
569 | { | 587 | { |
570 | /* request the cpu timer external interrupt */ | 588 | /* request the cpu timer external interrupt */ |
@@ -573,5 +591,6 @@ void __init vtime_init(void) | |||
573 | 591 | ||
574 | /* Enable cpu timer interrupts on the boot cpu. */ | 592 | /* Enable cpu timer interrupts on the boot cpu. */ |
575 | init_cpu_vtimer(); | 593 | init_cpu_vtimer(); |
594 | cpu_notifier(s390_nohz_notify, 0); | ||
576 | } | 595 | } |
577 | 596 | ||
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 752b362bf651..7c37ec359ec2 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -29,17 +29,21 @@ static void __udelay_disabled(unsigned long long usecs) | |||
29 | { | 29 | { |
30 | unsigned long mask, cr0, cr0_saved; | 30 | unsigned long mask, cr0, cr0_saved; |
31 | u64 clock_saved; | 31 | u64 clock_saved; |
32 | u64 end; | ||
32 | 33 | ||
34 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; | ||
35 | end = get_clock() + (usecs << 12); | ||
33 | clock_saved = local_tick_disable(); | 36 | clock_saved = local_tick_disable(); |
34 | set_clock_comparator(get_clock() + (usecs << 12)); | ||
35 | __ctl_store(cr0_saved, 0, 0); | 37 | __ctl_store(cr0_saved, 0, 0); |
36 | cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; | 38 | cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; |
37 | __ctl_load(cr0 , 0, 0); | 39 | __ctl_load(cr0 , 0, 0); |
38 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; | ||
39 | lockdep_off(); | 40 | lockdep_off(); |
40 | trace_hardirqs_on(); | 41 | do { |
41 | __load_psw_mask(mask); | 42 | set_clock_comparator(end); |
42 | local_irq_disable(); | 43 | trace_hardirqs_on(); |
44 | __load_psw_mask(mask); | ||
45 | local_irq_disable(); | ||
46 | } while (get_clock() < end); | ||
43 | lockdep_on(); | 47 | lockdep_on(); |
44 | __ctl_load(cr0_saved, 0, 0); | 48 | __ctl_load(cr0_saved, 0, 0); |
45 | local_tick_enable(clock_saved); | 49 | local_tick_enable(clock_saved); |
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index b237d525d592..34ba197880dd 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h | |||
@@ -322,7 +322,15 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) | |||
322 | * mapping must be done by the PMB or by using page tables. | 322 | * mapping must be done by the PMB or by using page tables. |
323 | */ | 323 | */ |
324 | if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) { | 324 | if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) { |
325 | if (unlikely(pgprot_val(prot) & _PAGE_CACHABLE)) | 325 | u64 flags = pgprot_val(prot); |
326 | |||
327 | /* | ||
328 | * Anything using the legacy PTEA space attributes needs | ||
329 | * to be kicked down to page table mappings. | ||
330 | */ | ||
331 | if (unlikely(flags & _PAGE_PCC_MASK)) | ||
332 | return NULL; | ||
333 | if (unlikely(flags & _PAGE_CACHABLE)) | ||
326 | return (void __iomem *)P1SEGADDR(offset); | 334 | return (void __iomem *)P1SEGADDR(offset); |
327 | 335 | ||
328 | return (void __iomem *)P2SEGADDR(offset); | 336 | return (void __iomem *)P2SEGADDR(offset); |
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h index e172d696e52b..45743bffe865 100644 --- a/arch/sh/include/asm/pgtable_32.h +++ b/arch/sh/include/asm/pgtable_32.h | |||
@@ -76,6 +76,10 @@ | |||
76 | /* Wrapper for extended mode pgprot twiddling */ | 76 | /* Wrapper for extended mode pgprot twiddling */ |
77 | #define _PAGE_EXT(x) ((unsigned long long)(x) << 32) | 77 | #define _PAGE_EXT(x) ((unsigned long long)(x) << 32) |
78 | 78 | ||
79 | #ifdef CONFIG_X2TLB | ||
80 | #define _PAGE_PCC_MASK 0x00000000 /* No legacy PTEA support */ | ||
81 | #else | ||
82 | |||
79 | /* software: moves to PTEA.TC (Timing Control) */ | 83 | /* software: moves to PTEA.TC (Timing Control) */ |
80 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ | 84 | #define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ |
81 | #define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */ | 85 | #define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */ |
@@ -89,7 +93,8 @@ | |||
89 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ | 93 | #define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ |
90 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ | 94 | #define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ |
91 | 95 | ||
92 | #ifndef CONFIG_X2TLB | 96 | #define _PAGE_PCC_MASK 0xe0000001 |
97 | |||
93 | /* copy the ptea attributes */ | 98 | /* copy the ptea attributes */ |
94 | static inline unsigned long copy_ptea_attributes(unsigned long x) | 99 | static inline unsigned long copy_ptea_attributes(unsigned long x) |
95 | { | 100 | { |
diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h index be201fdc97aa..ae717e3c26d6 100644 --- a/arch/sh/include/asm/syscalls_32.h +++ b/arch/sh/include/asm/syscalls_32.h | |||
@@ -19,9 +19,10 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | |||
19 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, | 19 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, |
20 | unsigned long r6, unsigned long r7, | 20 | unsigned long r6, unsigned long r7, |
21 | struct pt_regs __regs); | 21 | struct pt_regs __regs); |
22 | asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv, | 22 | asmlinkage int sys_execve(const char __user *ufilename, |
23 | char __user * __user *uenvp, unsigned long r7, | 23 | const char __user *const __user *uargv, |
24 | struct pt_regs __regs); | 24 | const char __user *const __user *uenvp, |
25 | unsigned long r7, struct pt_regs __regs); | ||
25 | asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, | 26 | asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, |
26 | unsigned long r6, unsigned long r7, | 27 | unsigned long r6, unsigned long r7, |
27 | struct pt_regs __regs); | 28 | struct pt_regs __regs); |
diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h index 963e1a45c35f..f61a5017878f 100644 --- a/arch/sparc/include/asm/openprom.h +++ b/arch/sparc/include/asm/openprom.h | |||
@@ -37,7 +37,7 @@ struct linux_dev_v2_funcs { | |||
37 | int (*v2_dev_open)(char *devpath); | 37 | int (*v2_dev_open)(char *devpath); |
38 | void (*v2_dev_close)(int d); | 38 | void (*v2_dev_close)(int d); |
39 | int (*v2_dev_read)(int d, char *buf, int nbytes); | 39 | int (*v2_dev_read)(int d, char *buf, int nbytes); |
40 | int (*v2_dev_write)(int d, char *buf, int nbytes); | 40 | int (*v2_dev_write)(int d, const char *buf, int nbytes); |
41 | int (*v2_dev_seek)(int d, int hi, int lo); | 41 | int (*v2_dev_seek)(int d, int hi, int lo); |
42 | 42 | ||
43 | /* Never issued (multistage load support) */ | 43 | /* Never issued (multistage load support) */ |
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h index 33e31ce6b31f..618a5bd4660d 100644 --- a/arch/sparc/include/asm/oplib_32.h +++ b/arch/sparc/include/asm/oplib_32.h | |||
@@ -60,25 +60,6 @@ extern char *prom_getbootargs(void); | |||
60 | extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); | 60 | extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); |
61 | extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); | 61 | extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); |
62 | 62 | ||
63 | /* Device operations. */ | ||
64 | |||
65 | /* Open the device described by the passed string. Note, that the format | ||
66 | * of the string is different on V0 vs. V2->higher proms. The caller must | ||
67 | * know what he/she is doing! Returns the device descriptor, an int. | ||
68 | */ | ||
69 | extern int prom_devopen(char *device_string); | ||
70 | |||
71 | /* Close a previously opened device described by the passed integer | ||
72 | * descriptor. | ||
73 | */ | ||
74 | extern int prom_devclose(int device_handle); | ||
75 | |||
76 | /* Do a seek operation on the device described by the passed integer | ||
77 | * descriptor. | ||
78 | */ | ||
79 | extern void prom_seek(int device_handle, unsigned int seek_hival, | ||
80 | unsigned int seek_lowval); | ||
81 | |||
82 | /* Miscellaneous routines, don't really fit in any category per se. */ | 63 | /* Miscellaneous routines, don't really fit in any category per se. */ |
83 | 64 | ||
84 | /* Reboot the machine with the command line passed. */ | 65 | /* Reboot the machine with the command line passed. */ |
@@ -121,19 +102,8 @@ extern int prom_getrev(void); | |||
121 | /* Get the prom firmware revision. */ | 102 | /* Get the prom firmware revision. */ |
122 | extern int prom_getprev(void); | 103 | extern int prom_getprev(void); |
123 | 104 | ||
124 | /* Character operations to/from the console.... */ | 105 | /* Write a buffer of characters to the console. */ |
125 | 106 | extern void prom_console_write_buf(const char *buf, int len); | |
126 | /* Non-blocking get character from console. */ | ||
127 | extern int prom_nbgetchar(void); | ||
128 | |||
129 | /* Non-blocking put character to console. */ | ||
130 | extern int prom_nbputchar(char character); | ||
131 | |||
132 | /* Blocking get character from console. */ | ||
133 | extern char prom_getchar(void); | ||
134 | |||
135 | /* Blocking put character to console. */ | ||
136 | extern void prom_putchar(char character); | ||
137 | 107 | ||
138 | /* Prom's internal routines, don't use in kernel/boot code. */ | 108 | /* Prom's internal routines, don't use in kernel/boot code. */ |
139 | extern void prom_printf(const char *fmt, ...); | 109 | extern void prom_printf(const char *fmt, ...); |
@@ -238,7 +208,6 @@ extern int prom_node_has_property(int node, char *property); | |||
238 | extern int prom_setprop(int node, const char *prop_name, char *prop_value, | 208 | extern int prom_setprop(int node, const char *prop_name, char *prop_value, |
239 | int value_size); | 209 | int value_size); |
240 | 210 | ||
241 | extern int prom_pathtoinode(char *path); | ||
242 | extern int prom_inst2pkg(int); | 211 | extern int prom_inst2pkg(int); |
243 | 212 | ||
244 | /* Dorking with Bus ranges... */ | 213 | /* Dorking with Bus ranges... */ |
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h index 3e0b2d62303d..209463d62626 100644 --- a/arch/sparc/include/asm/oplib_64.h +++ b/arch/sparc/include/asm/oplib_64.h | |||
@@ -67,27 +67,6 @@ extern void prom_init(void *cif_handler, void *cif_stack); | |||
67 | /* Boot argument acquisition, returns the boot command line string. */ | 67 | /* Boot argument acquisition, returns the boot command line string. */ |
68 | extern char *prom_getbootargs(void); | 68 | extern char *prom_getbootargs(void); |
69 | 69 | ||
70 | /* Device utilities. */ | ||
71 | |||
72 | /* Device operations. */ | ||
73 | |||
74 | /* Open the device described by the passed string. Note, that the format | ||
75 | * of the string is different on V0 vs. V2->higher proms. The caller must | ||
76 | * know what he/she is doing! Returns the device descriptor, an int. | ||
77 | */ | ||
78 | extern int prom_devopen(const char *device_string); | ||
79 | |||
80 | /* Close a previously opened device described by the passed integer | ||
81 | * descriptor. | ||
82 | */ | ||
83 | extern int prom_devclose(int device_handle); | ||
84 | |||
85 | /* Do a seek operation on the device described by the passed integer | ||
86 | * descriptor. | ||
87 | */ | ||
88 | extern void prom_seek(int device_handle, unsigned int seek_hival, | ||
89 | unsigned int seek_lowval); | ||
90 | |||
91 | /* Miscellaneous routines, don't really fit in any category per se. */ | 70 | /* Miscellaneous routines, don't really fit in any category per se. */ |
92 | 71 | ||
93 | /* Reboot the machine with the command line passed. */ | 72 | /* Reboot the machine with the command line passed. */ |
@@ -109,33 +88,14 @@ extern void prom_halt(void) __attribute__ ((noreturn)); | |||
109 | /* Halt and power-off the machine. */ | 88 | /* Halt and power-off the machine. */ |
110 | extern void prom_halt_power_off(void) __attribute__ ((noreturn)); | 89 | extern void prom_halt_power_off(void) __attribute__ ((noreturn)); |
111 | 90 | ||
112 | /* Set the PROM 'sync' callback function to the passed function pointer. | ||
113 | * When the user gives the 'sync' command at the prom prompt while the | ||
114 | * kernel is still active, the prom will call this routine. | ||
115 | * | ||
116 | */ | ||
117 | typedef int (*callback_func_t)(long *cmd); | ||
118 | extern void prom_setcallback(callback_func_t func_ptr); | ||
119 | |||
120 | /* Acquire the IDPROM of the root node in the prom device tree. This | 91 | /* Acquire the IDPROM of the root node in the prom device tree. This |
121 | * gets passed a buffer where you would like it stuffed. The return value | 92 | * gets passed a buffer where you would like it stuffed. The return value |
122 | * is the format type of this idprom or 0xff on error. | 93 | * is the format type of this idprom or 0xff on error. |
123 | */ | 94 | */ |
124 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); | 95 | extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); |
125 | 96 | ||
126 | /* Character operations to/from the console.... */ | 97 | /* Write a buffer of characters to the console. */ |
127 | 98 | extern void prom_console_write_buf(const char *buf, int len); | |
128 | /* Non-blocking get character from console. */ | ||
129 | extern int prom_nbgetchar(void); | ||
130 | |||
131 | /* Non-blocking put character to console. */ | ||
132 | extern int prom_nbputchar(char character); | ||
133 | |||
134 | /* Blocking get character from console. */ | ||
135 | extern char prom_getchar(void); | ||
136 | |||
137 | /* Blocking put character to console. */ | ||
138 | extern void prom_putchar(char character); | ||
139 | 99 | ||
140 | /* Prom's internal routines, don't use in kernel/boot code. */ | 100 | /* Prom's internal routines, don't use in kernel/boot code. */ |
141 | extern void prom_printf(const char *fmt, ...); | 101 | extern void prom_printf(const char *fmt, ...); |
@@ -278,9 +238,7 @@ extern int prom_finddevice(const char *name); | |||
278 | extern int prom_setprop(int node, const char *prop_name, char *prop_value, | 238 | extern int prom_setprop(int node, const char *prop_name, char *prop_value, |
279 | int value_size); | 239 | int value_size); |
280 | 240 | ||
281 | extern int prom_pathtoinode(const char *path); | ||
282 | extern int prom_inst2pkg(int); | 241 | extern int prom_inst2pkg(int); |
283 | extern int prom_service_exists(const char *service_name); | ||
284 | extern void prom_sun4v_guest_soft_state(void); | 242 | extern void prom_sun4v_guest_soft_state(void); |
285 | 243 | ||
286 | extern int prom_ihandle2path(int handle, char *buffer, int bufsize); | 244 | extern int prom_ihandle2path(int handle, char *buffer, int bufsize); |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 6a7b4dbc8e09..dcefd2211552 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -114,7 +114,7 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
114 | if (leon3_gptimer_regs && leon3_irqctrl_regs) { | 114 | if (leon3_gptimer_regs && leon3_irqctrl_regs) { |
115 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0); | 115 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0); |
116 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld, | 116 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld, |
117 | (((1000000 / 100) - 1))); | 117 | (((1000000 / HZ) - 1))); |
118 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); | 118 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); |
119 | 119 | ||
120 | #ifdef CONFIG_SMP | 120 | #ifdef CONFIG_SMP |
@@ -128,7 +128,7 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0); | 130 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0); |
131 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1))); | 131 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/HZ) - 1))); |
132 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0); | 132 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0); |
133 | # endif | 133 | # endif |
134 | 134 | ||
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile index 1b8c073adb44..816c0fa12dc0 100644 --- a/arch/sparc/prom/Makefile +++ b/arch/sparc/prom/Makefile | |||
@@ -6,7 +6,6 @@ ccflags := -Werror | |||
6 | 6 | ||
7 | lib-y := bootstr_$(BITS).o | 7 | lib-y := bootstr_$(BITS).o |
8 | lib-$(CONFIG_SPARC32) += devmap.o | 8 | lib-$(CONFIG_SPARC32) += devmap.o |
9 | lib-y += devops_$(BITS).o | ||
10 | lib-y += init_$(BITS).o | 9 | lib-y += init_$(BITS).o |
11 | lib-$(CONFIG_SPARC32) += memory.o | 10 | lib-$(CONFIG_SPARC32) += memory.o |
12 | lib-y += misc_$(BITS).o | 11 | lib-y += misc_$(BITS).o |
diff --git a/arch/sparc/prom/console_32.c b/arch/sparc/prom/console_32.c index 5340264b78f5..48863108a44c 100644 --- a/arch/sparc/prom/console_32.c +++ b/arch/sparc/prom/console_32.c | |||
@@ -16,63 +16,26 @@ | |||
16 | 16 | ||
17 | extern void restore_current(void); | 17 | extern void restore_current(void); |
18 | 18 | ||
19 | /* Non blocking get character from console input device, returns -1 | ||
20 | * if no input was taken. This can be used for polling. | ||
21 | */ | ||
22 | int | ||
23 | prom_nbgetchar(void) | ||
24 | { | ||
25 | static char inc; | ||
26 | int i = -1; | ||
27 | unsigned long flags; | ||
28 | |||
29 | spin_lock_irqsave(&prom_lock, flags); | ||
30 | switch(prom_vers) { | ||
31 | case PROM_V0: | ||
32 | i = (*(romvec->pv_nbgetchar))(); | ||
33 | break; | ||
34 | case PROM_V2: | ||
35 | case PROM_V3: | ||
36 | if( (*(romvec->pv_v2devops).v2_dev_read)(*romvec->pv_v2bootargs.fd_stdin , &inc, 0x1) == 1) { | ||
37 | i = inc; | ||
38 | } else { | ||
39 | i = -1; | ||
40 | } | ||
41 | break; | ||
42 | default: | ||
43 | i = -1; | ||
44 | break; | ||
45 | }; | ||
46 | restore_current(); | ||
47 | spin_unlock_irqrestore(&prom_lock, flags); | ||
48 | return i; /* Ugh, we could spin forever on unsupported proms ;( */ | ||
49 | } | ||
50 | |||
51 | /* Non blocking put character to console device, returns -1 if | 19 | /* Non blocking put character to console device, returns -1 if |
52 | * unsuccessful. | 20 | * unsuccessful. |
53 | */ | 21 | */ |
54 | int | 22 | static int prom_nbputchar(const char *buf) |
55 | prom_nbputchar(char c) | ||
56 | { | 23 | { |
57 | static char outc; | ||
58 | unsigned long flags; | 24 | unsigned long flags; |
59 | int i = -1; | 25 | int i = -1; |
60 | 26 | ||
61 | spin_lock_irqsave(&prom_lock, flags); | 27 | spin_lock_irqsave(&prom_lock, flags); |
62 | switch(prom_vers) { | 28 | switch(prom_vers) { |
63 | case PROM_V0: | 29 | case PROM_V0: |
64 | i = (*(romvec->pv_nbputchar))(c); | 30 | i = (*(romvec->pv_nbputchar))(*buf); |
65 | break; | 31 | break; |
66 | case PROM_V2: | 32 | case PROM_V2: |
67 | case PROM_V3: | 33 | case PROM_V3: |
68 | outc = c; | 34 | if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, |
69 | if( (*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, &outc, 0x1) == 1) | 35 | buf, 0x1) == 1) |
70 | i = 0; | 36 | i = 0; |
71 | else | ||
72 | i = -1; | ||
73 | break; | 37 | break; |
74 | default: | 38 | default: |
75 | i = -1; | ||
76 | break; | 39 | break; |
77 | }; | 40 | }; |
78 | restore_current(); | 41 | restore_current(); |
@@ -80,18 +43,14 @@ prom_nbputchar(char c) | |||
80 | return i; /* Ugh, we could spin forever on unsupported proms ;( */ | 43 | return i; /* Ugh, we could spin forever on unsupported proms ;( */ |
81 | } | 44 | } |
82 | 45 | ||
83 | /* Blocking version of get character routine above. */ | 46 | void prom_console_write_buf(const char *buf, int len) |
84 | char | ||
85 | prom_getchar(void) | ||
86 | { | 47 | { |
87 | int character; | 48 | while (len) { |
88 | while((character = prom_nbgetchar()) == -1) ; | 49 | int n = prom_nbputchar(buf); |
89 | return (char) character; | 50 | if (n) |
51 | continue; | ||
52 | len--; | ||
53 | buf++; | ||
54 | } | ||
90 | } | 55 | } |
91 | 56 | ||
92 | /* Blocking version of put character routine above. */ | ||
93 | void | ||
94 | prom_putchar(char c) | ||
95 | { | ||
96 | while(prom_nbputchar(c) == -1) ; | ||
97 | } | ||
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c index 10322dc2f557..ed39e75828bd 100644 --- a/arch/sparc/prom/console_64.c +++ b/arch/sparc/prom/console_64.c | |||
@@ -15,85 +15,34 @@ | |||
15 | 15 | ||
16 | extern int prom_stdin, prom_stdout; | 16 | extern int prom_stdin, prom_stdout; |
17 | 17 | ||
18 | /* Non blocking get character from console input device, returns -1 | 18 | static int __prom_console_write_buf(const char *buf, int len) |
19 | * if no input was taken. This can be used for polling. | ||
20 | */ | ||
21 | inline int | ||
22 | prom_nbgetchar(void) | ||
23 | { | ||
24 | unsigned long args[7]; | ||
25 | char inc; | ||
26 | |||
27 | args[0] = (unsigned long) "read"; | ||
28 | args[1] = 3; | ||
29 | args[2] = 1; | ||
30 | args[3] = (unsigned int) prom_stdin; | ||
31 | args[4] = (unsigned long) &inc; | ||
32 | args[5] = 1; | ||
33 | args[6] = (unsigned long) -1; | ||
34 | |||
35 | p1275_cmd_direct(args); | ||
36 | |||
37 | if (args[6] == 1) | ||
38 | return inc; | ||
39 | return -1; | ||
40 | } | ||
41 | |||
42 | /* Non blocking put character to console device, returns -1 if | ||
43 | * unsuccessful. | ||
44 | */ | ||
45 | inline int | ||
46 | prom_nbputchar(char c) | ||
47 | { | 19 | { |
48 | unsigned long args[7]; | 20 | unsigned long args[7]; |
49 | char outc; | 21 | int ret; |
50 | |||
51 | outc = c; | ||
52 | 22 | ||
53 | args[0] = (unsigned long) "write"; | 23 | args[0] = (unsigned long) "write"; |
54 | args[1] = 3; | 24 | args[1] = 3; |
55 | args[2] = 1; | 25 | args[2] = 1; |
56 | args[3] = (unsigned int) prom_stdout; | 26 | args[3] = (unsigned int) prom_stdout; |
57 | args[4] = (unsigned long) &outc; | 27 | args[4] = (unsigned long) buf; |
58 | args[5] = 1; | 28 | args[5] = (unsigned int) len; |
59 | args[6] = (unsigned long) -1; | 29 | args[6] = (unsigned long) -1; |
60 | 30 | ||
61 | p1275_cmd_direct(args); | 31 | p1275_cmd_direct(args); |
62 | 32 | ||
63 | if (args[6] == 1) | 33 | ret = (int) args[6]; |
64 | return 0; | 34 | if (ret < 0) |
65 | else | ||
66 | return -1; | 35 | return -1; |
36 | return ret; | ||
67 | } | 37 | } |
68 | 38 | ||
69 | /* Blocking version of get character routine above. */ | 39 | void prom_console_write_buf(const char *buf, int len) |
70 | char | ||
71 | prom_getchar(void) | ||
72 | { | ||
73 | int character; | ||
74 | while((character = prom_nbgetchar()) == -1) ; | ||
75 | return (char) character; | ||
76 | } | ||
77 | |||
78 | /* Blocking version of put character routine above. */ | ||
79 | void | ||
80 | prom_putchar(char c) | ||
81 | { | 40 | { |
82 | prom_nbputchar(c); | 41 | while (len) { |
83 | } | 42 | int n = __prom_console_write_buf(buf, len); |
84 | 43 | if (n < 0) | |
85 | void | 44 | continue; |
86 | prom_puts(const char *s, int len) | 45 | len -= n; |
87 | { | 46 | buf += len; |
88 | unsigned long args[7]; | 47 | } |
89 | |||
90 | args[0] = (unsigned long) "write"; | ||
91 | args[1] = 3; | ||
92 | args[2] = 1; | ||
93 | args[3] = (unsigned int) prom_stdout; | ||
94 | args[4] = (unsigned long) s; | ||
95 | args[5] = len; | ||
96 | args[6] = (unsigned long) -1; | ||
97 | |||
98 | p1275_cmd_direct(args); | ||
99 | } | 48 | } |
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c index 6cb1581d6aef..2fdcebf9a5df 100644 --- a/arch/sparc/prom/misc_64.c +++ b/arch/sparc/prom/misc_64.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/system.h> | 18 | #include <asm/system.h> |
19 | #include <asm/ldc.h> | 19 | #include <asm/ldc.h> |
20 | 20 | ||
21 | int prom_service_exists(const char *service_name) | 21 | static int prom_service_exists(const char *service_name) |
22 | { | 22 | { |
23 | unsigned long args[5]; | 23 | unsigned long args[5]; |
24 | 24 | ||
@@ -150,20 +150,6 @@ void prom_halt_power_off(void) | |||
150 | prom_halt(); | 150 | prom_halt(); |
151 | } | 151 | } |
152 | 152 | ||
153 | /* Set prom sync handler to call function 'funcp'. */ | ||
154 | void prom_setcallback(callback_func_t funcp) | ||
155 | { | ||
156 | unsigned long args[5]; | ||
157 | if (!funcp) | ||
158 | return; | ||
159 | args[0] = (unsigned long) "set-callback"; | ||
160 | args[1] = 1; | ||
161 | args[2] = 1; | ||
162 | args[3] = (unsigned long) funcp; | ||
163 | args[4] = (unsigned long) -1; | ||
164 | p1275_cmd_direct(args); | ||
165 | } | ||
166 | |||
167 | /* Get the idprom and stuff it into buffer 'idbuf'. Returns the | 153 | /* Get the idprom and stuff it into buffer 'idbuf'. Returns the |
168 | * format type. 'num_bytes' is the number of bytes that your idbuf | 154 | * format type. 'num_bytes' is the number of bytes that your idbuf |
169 | * has space for. Returns 0xff on error. | 155 | * has space for. Returns 0xff on error. |
diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c index ca869266b9f3..d9682f06b3b0 100644 --- a/arch/sparc/prom/printf.c +++ b/arch/sparc/prom/printf.c | |||
@@ -15,22 +15,45 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/compiler.h> | 17 | #include <linux/compiler.h> |
18 | #include <linux/spinlock.h> | ||
18 | 19 | ||
19 | #include <asm/openprom.h> | 20 | #include <asm/openprom.h> |
20 | #include <asm/oplib.h> | 21 | #include <asm/oplib.h> |
21 | 22 | ||
23 | #define CONSOLE_WRITE_BUF_SIZE 1024 | ||
24 | |||
22 | static char ppbuf[1024]; | 25 | static char ppbuf[1024]; |
26 | static char console_write_buf[CONSOLE_WRITE_BUF_SIZE]; | ||
27 | static DEFINE_RAW_SPINLOCK(console_write_lock); | ||
23 | 28 | ||
24 | void notrace prom_write(const char *buf, unsigned int n) | 29 | void notrace prom_write(const char *buf, unsigned int n) |
25 | { | 30 | { |
26 | char ch; | 31 | unsigned int dest_len; |
32 | unsigned long flags; | ||
33 | char *dest; | ||
34 | |||
35 | dest = console_write_buf; | ||
36 | raw_spin_lock_irqsave(&console_write_lock, flags); | ||
27 | 37 | ||
28 | while (n != 0) { | 38 | dest_len = 0; |
29 | --n; | 39 | while (n-- != 0) { |
30 | if ((ch = *buf++) == '\n') | 40 | char ch = *buf++; |
31 | prom_putchar('\r'); | 41 | if (ch == '\n') { |
32 | prom_putchar(ch); | 42 | *dest++ = '\r'; |
43 | dest_len++; | ||
44 | } | ||
45 | *dest++ = ch; | ||
46 | dest_len++; | ||
47 | if (dest_len >= CONSOLE_WRITE_BUF_SIZE - 1) { | ||
48 | prom_console_write_buf(console_write_buf, dest_len); | ||
49 | dest = console_write_buf; | ||
50 | dest_len = 0; | ||
51 | } | ||
33 | } | 52 | } |
53 | if (dest_len) | ||
54 | prom_console_write_buf(console_write_buf, dest_len); | ||
55 | |||
56 | raw_spin_unlock_irqrestore(&console_write_lock, flags); | ||
34 | } | 57 | } |
35 | 58 | ||
36 | void notrace prom_printf(const char *fmt, ...) | 59 | void notrace prom_printf(const char *fmt, ...) |
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c index b21592f8e3fe..71e7f080a576 100644 --- a/arch/sparc/prom/tree_32.c +++ b/arch/sparc/prom/tree_32.c | |||
@@ -341,18 +341,3 @@ int prom_inst2pkg(int inst) | |||
341 | if (node == -1) return 0; | 341 | if (node == -1) return 0; |
342 | return node; | 342 | return node; |
343 | } | 343 | } |
344 | |||
345 | /* Return 'node' assigned to a particular prom 'path' | ||
346 | * FIXME: Should work for v0 as well | ||
347 | */ | ||
348 | int prom_pathtoinode(char *path) | ||
349 | { | ||
350 | int node, inst; | ||
351 | |||
352 | inst = prom_devopen (path); | ||
353 | if (inst == -1) return 0; | ||
354 | node = prom_inst2pkg (inst); | ||
355 | prom_devclose (inst); | ||
356 | if (node == -1) return 0; | ||
357 | return node; | ||
358 | } | ||
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c index 9d3f9137a43a..8327b1b68f4b 100644 --- a/arch/sparc/prom/tree_64.c +++ b/arch/sparc/prom/tree_64.c | |||
@@ -374,24 +374,6 @@ inline int prom_inst2pkg(int inst) | |||
374 | return node; | 374 | return node; |
375 | } | 375 | } |
376 | 376 | ||
377 | /* Return 'node' assigned to a particular prom 'path' | ||
378 | * FIXME: Should work for v0 as well | ||
379 | */ | ||
380 | int | ||
381 | prom_pathtoinode(const char *path) | ||
382 | { | ||
383 | int node, inst; | ||
384 | |||
385 | inst = prom_devopen (path); | ||
386 | if (inst == 0) | ||
387 | return 0; | ||
388 | node = prom_inst2pkg(inst); | ||
389 | prom_devclose(inst); | ||
390 | if (node == -1) | ||
391 | return 0; | ||
392 | return node; | ||
393 | } | ||
394 | |||
395 | int prom_ihandle2path(int handle, char *buffer, int bufsize) | 377 | int prom_ihandle2path(int handle, char *buffer, int bufsize) |
396 | { | 378 | { |
397 | unsigned long args[7]; | 379 | unsigned long args[7]; |
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 84c29111756c..aaf6282bacc3 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -212,6 +212,13 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, | |||
212 | childregs->sp = sp; /* override with new user stack pointer */ | 212 | childregs->sp = sp; /* override with new user stack pointer */ |
213 | 213 | ||
214 | /* | 214 | /* |
215 | * If CLONE_SETTLS is set, set "tp" in the new task to "r4", | ||
216 | * which is passed in as arg #5 to sys_clone(). | ||
217 | */ | ||
218 | if (clone_flags & CLONE_SETTLS) | ||
219 | childregs->tp = regs->regs[4]; | ||
220 | |||
221 | /* | ||
215 | * Copy the callee-saved registers from the passed pt_regs struct | 222 | * Copy the callee-saved registers from the passed pt_regs struct |
216 | * into the context-switch callee-saved registers area. | 223 | * into the context-switch callee-saved registers area. |
217 | * We have to restore the callee-saved registers since we may | 224 | * We have to restore the callee-saved registers since we may |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 7f7338c90784..1664cce7b0ac 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -727,6 +727,9 @@ struct winch { | |||
727 | 727 | ||
728 | static void free_winch(struct winch *winch, int free_irq_ok) | 728 | static void free_winch(struct winch *winch, int free_irq_ok) |
729 | { | 729 | { |
730 | if (free_irq_ok) | ||
731 | free_irq(WINCH_IRQ, winch); | ||
732 | |||
730 | list_del(&winch->list); | 733 | list_del(&winch->list); |
731 | 734 | ||
732 | if (winch->pid != -1) | 735 | if (winch->pid != -1) |
@@ -735,8 +738,6 @@ static void free_winch(struct winch *winch, int free_irq_ok) | |||
735 | os_close_file(winch->fd); | 738 | os_close_file(winch->fd); |
736 | if (winch->stack != 0) | 739 | if (winch->stack != 0) |
737 | free_stack(winch->stack, 0); | 740 | free_stack(winch->stack, 0); |
738 | if (free_irq_ok) | ||
739 | free_irq(WINCH_IRQ, winch); | ||
740 | kfree(winch); | 741 | kfree(winch); |
741 | } | 742 | } |
742 | 743 | ||
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index ec6378550671..9a873d765615 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S | |||
@@ -22,7 +22,7 @@ SECTIONS | |||
22 | _text = .; | 22 | _text = .; |
23 | _stext = .; | 23 | _stext = .; |
24 | __init_begin = .; | 24 | __init_begin = .; |
25 | INIT_TEXT_SECTION(PAGE_SIZE) | 25 | INIT_TEXT_SECTION(0) |
26 | . = ALIGN(PAGE_SIZE); | 26 | . = ALIGN(PAGE_SIZE); |
27 | 27 | ||
28 | .text : | 28 | .text : |
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index dec5678fc17f..6e3359d6a839 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -60,7 +60,7 @@ static inline long long timeval_to_ns(const struct timeval *tv) | |||
60 | long long disable_timer(void) | 60 | long long disable_timer(void) |
61 | { | 61 | { |
62 | struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); | 62 | struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); |
63 | int remain, max = UM_NSEC_PER_SEC / UM_HZ; | 63 | long long remain, max = UM_NSEC_PER_SEC / UM_HZ; |
64 | 64 | ||
65 | if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) | 65 | if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) |
66 | printk(UM_KERN_ERR "disable_timer - setitimer failed, " | 66 | printk(UM_KERN_ERR "disable_timer - setitimer failed, " |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 3f76523589af..f857bd39cdfb 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -152,7 +152,7 @@ | |||
152 | #define X86_FEATURE_3DNOWPREFETCH (6*32+ 8) /* 3DNow prefetch instructions */ | 152 | #define X86_FEATURE_3DNOWPREFETCH (6*32+ 8) /* 3DNow prefetch instructions */ |
153 | #define X86_FEATURE_OSVW (6*32+ 9) /* OS Visible Workaround */ | 153 | #define X86_FEATURE_OSVW (6*32+ 9) /* OS Visible Workaround */ |
154 | #define X86_FEATURE_IBS (6*32+10) /* Instruction Based Sampling */ | 154 | #define X86_FEATURE_IBS (6*32+10) /* Instruction Based Sampling */ |
155 | #define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */ | 155 | #define X86_FEATURE_XOP (6*32+11) /* extended AVX instructions */ |
156 | #define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ | 156 | #define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */ |
157 | #define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ | 157 | #define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */ |
158 | #define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */ | 158 | #define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */ |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 30a3e9776123..6a45ec41ec26 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
@@ -206,6 +206,7 @@ static inline void __iomem *ioremap(resource_size_t offset, unsigned long size) | |||
206 | 206 | ||
207 | extern void iounmap(volatile void __iomem *addr); | 207 | extern void iounmap(volatile void __iomem *addr); |
208 | 208 | ||
209 | extern void set_iounmap_nonlazy(void); | ||
209 | 210 | ||
210 | #ifdef __KERNEL__ | 211 | #ifdef __KERNEL__ |
211 | 212 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index c52e2eb40a1e..6986312bb670 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -79,7 +79,7 @@ | |||
79 | #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT) | 79 | #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT) |
80 | #define KVM_MIN_FREE_MMU_PAGES 5 | 80 | #define KVM_MIN_FREE_MMU_PAGES 5 |
81 | #define KVM_REFILL_PAGES 25 | 81 | #define KVM_REFILL_PAGES 25 |
82 | #define KVM_MAX_CPUID_ENTRIES 40 | 82 | #define KVM_MAX_CPUID_ENTRIES 80 |
83 | #define KVM_NR_FIXED_MTRR_REGION 88 | 83 | #define KVM_NR_FIXED_MTRR_REGION 88 |
84 | #define KVM_NR_VAR_MTRR 8 | 84 | #define KVM_NR_VAR_MTRR 8 |
85 | 85 | ||
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 4a2d4e0c18d9..8b5393ec1080 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
@@ -36,8 +36,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
36 | unsigned cpu = smp_processor_id(); | 36 | unsigned cpu = smp_processor_id(); |
37 | 37 | ||
38 | if (likely(prev != next)) { | 38 | if (likely(prev != next)) { |
39 | /* stop flush ipis for the previous mm */ | ||
40 | cpumask_clear_cpu(cpu, mm_cpumask(prev)); | ||
41 | #ifdef CONFIG_SMP | 39 | #ifdef CONFIG_SMP |
42 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); | 40 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); |
43 | percpu_write(cpu_tlbstate.active_mm, next); | 41 | percpu_write(cpu_tlbstate.active_mm, next); |
@@ -47,6 +45,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
47 | /* Re-load page tables */ | 45 | /* Re-load page tables */ |
48 | load_cr3(next->pgd); | 46 | load_cr3(next->pgd); |
49 | 47 | ||
48 | /* stop flush ipis for the previous mm */ | ||
49 | cpumask_clear_cpu(cpu, mm_cpumask(prev)); | ||
50 | |||
50 | /* | 51 | /* |
51 | * load the LDT, if the LDT is different: | 52 | * load the LDT, if the LDT is different: |
52 | */ | 53 | */ |
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h index 16350740edf6..33fc2966beb7 100644 --- a/arch/x86/include/asm/mrst.h +++ b/arch/x86/include/asm/mrst.h | |||
@@ -26,7 +26,7 @@ enum mrst_cpu_type { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | extern enum mrst_cpu_type __mrst_cpu_chip; | 28 | extern enum mrst_cpu_type __mrst_cpu_chip; |
29 | static enum mrst_cpu_type mrst_identify_cpu(void) | 29 | static inline enum mrst_cpu_type mrst_identify_cpu(void) |
30 | { | 30 | { |
31 | return __mrst_cpu_chip; | 31 | return __mrst_cpu_chip; |
32 | } | 32 | } |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index ebaa04a8d3af..37ea41c63b49 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -768,29 +768,6 @@ extern unsigned long idle_halt; | |||
768 | extern unsigned long idle_nomwait; | 768 | extern unsigned long idle_nomwait; |
769 | extern bool c1e_detected; | 769 | extern bool c1e_detected; |
770 | 770 | ||
771 | /* | ||
772 | * on systems with caches, caches must be flashed as the absolute | ||
773 | * last instruction before going into a suspended halt. Otherwise, | ||
774 | * dirty data can linger in the cache and become stale on resume, | ||
775 | * leading to strange errors. | ||
776 | * | ||
777 | * perform a variety of operations to guarantee that the compiler | ||
778 | * will not reorder instructions. wbinvd itself is serializing | ||
779 | * so the processor will not reorder. | ||
780 | * | ||
781 | * Systems without cache can just go into halt. | ||
782 | */ | ||
783 | static inline void wbinvd_halt(void) | ||
784 | { | ||
785 | mb(); | ||
786 | /* check for clflush to determine if wbinvd is legal */ | ||
787 | if (cpu_has_clflush) | ||
788 | asm volatile("cli; wbinvd; 1: hlt; jmp 1b" : : : "memory"); | ||
789 | else | ||
790 | while (1) | ||
791 | halt(); | ||
792 | } | ||
793 | |||
794 | extern void enable_sep_cpu(void); | 771 | extern void enable_sep_cpu(void); |
795 | extern int sysenter_setup(void); | 772 | extern int sysenter_setup(void); |
796 | 773 | ||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 4cfc90824068..4c2f63c7fc1b 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -50,7 +50,7 @@ struct smp_ops { | |||
50 | void (*smp_prepare_cpus)(unsigned max_cpus); | 50 | void (*smp_prepare_cpus)(unsigned max_cpus); |
51 | void (*smp_cpus_done)(unsigned max_cpus); | 51 | void (*smp_cpus_done)(unsigned max_cpus); |
52 | 52 | ||
53 | void (*smp_send_stop)(void); | 53 | void (*stop_other_cpus)(int wait); |
54 | void (*smp_send_reschedule)(int cpu); | 54 | void (*smp_send_reschedule)(int cpu); |
55 | 55 | ||
56 | int (*cpu_up)(unsigned cpu); | 56 | int (*cpu_up)(unsigned cpu); |
@@ -73,7 +73,12 @@ extern struct smp_ops smp_ops; | |||
73 | 73 | ||
74 | static inline void smp_send_stop(void) | 74 | static inline void smp_send_stop(void) |
75 | { | 75 | { |
76 | smp_ops.smp_send_stop(); | 76 | smp_ops.stop_other_cpus(0); |
77 | } | ||
78 | |||
79 | static inline void stop_other_cpus(void) | ||
80 | { | ||
81 | smp_ops.stop_other_cpus(1); | ||
77 | } | 82 | } |
78 | 83 | ||
79 | static inline void smp_prepare_boot_cpu(void) | 84 | static inline void smp_prepare_boot_cpu(void) |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index e3b534cda49a..e0f220e158c1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1340,6 +1340,14 @@ void __cpuinit end_local_APIC_setup(void) | |||
1340 | 1340 | ||
1341 | setup_apic_nmi_watchdog(NULL); | 1341 | setup_apic_nmi_watchdog(NULL); |
1342 | apic_pm_activate(); | 1342 | apic_pm_activate(); |
1343 | |||
1344 | /* | ||
1345 | * Now that local APIC setup is completed for BP, configure the fault | ||
1346 | * handling for interrupt remapping. | ||
1347 | */ | ||
1348 | if (!smp_processor_id() && intr_remapping_enabled) | ||
1349 | enable_drhd_fault_handling(); | ||
1350 | |||
1343 | } | 1351 | } |
1344 | 1352 | ||
1345 | #ifdef CONFIG_X86_X2APIC | 1353 | #ifdef CONFIG_X86_X2APIC |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 5c5b8f3dddb5..4d90327853b7 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1397,6 +1397,7 @@ int setup_ioapic_entry(int apic_id, int irq, | |||
1397 | irte.dlvry_mode = apic->irq_delivery_mode; | 1397 | irte.dlvry_mode = apic->irq_delivery_mode; |
1398 | irte.vector = vector; | 1398 | irte.vector = vector; |
1399 | irte.dest_id = IRTE_DEST(destination); | 1399 | irte.dest_id = IRTE_DEST(destination); |
1400 | irte.redir_hint = 1; | ||
1400 | 1401 | ||
1401 | /* Set source-id of interrupt request */ | 1402 | /* Set source-id of interrupt request */ |
1402 | set_ioapic_sid(&irte, apic_id); | 1403 | set_ioapic_sid(&irte, apic_id); |
@@ -3348,6 +3349,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, | |||
3348 | irte.dlvry_mode = apic->irq_delivery_mode; | 3349 | irte.dlvry_mode = apic->irq_delivery_mode; |
3349 | irte.vector = cfg->vector; | 3350 | irte.vector = cfg->vector; |
3350 | irte.dest_id = IRTE_DEST(dest); | 3351 | irte.dest_id = IRTE_DEST(dest); |
3352 | irte.redir_hint = 1; | ||
3351 | 3353 | ||
3352 | /* Set source-id of interrupt request */ | 3354 | /* Set source-id of interrupt request */ |
3353 | if (pdev) | 3355 | if (pdev) |
@@ -3624,6 +3626,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) | |||
3624 | msg.data |= MSI_DATA_VECTOR(cfg->vector); | 3626 | msg.data |= MSI_DATA_VECTOR(cfg->vector); |
3625 | msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; | 3627 | msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; |
3626 | msg.address_lo |= MSI_ADDR_DEST_ID(dest); | 3628 | msg.address_lo |= MSI_ADDR_DEST_ID(dest); |
3629 | msg.address_hi = MSI_ADDR_BASE_HI | MSI_ADDR_EXT_DEST_ID(dest); | ||
3627 | 3630 | ||
3628 | dmar_msi_write(irq, &msg); | 3631 | dmar_msi_write(irq, &msg); |
3629 | 3632 | ||
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index 83e9be4778e2..fac49a845064 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -76,13 +76,6 @@ void __init default_setup_apic_routing(void) | |||
76 | /* need to update phys_pkg_id */ | 76 | /* need to update phys_pkg_id */ |
77 | apic->phys_pkg_id = apicid_phys_pkg_id; | 77 | apic->phys_pkg_id = apicid_phys_pkg_id; |
78 | } | 78 | } |
79 | |||
80 | /* | ||
81 | * Now that apic routing model is selected, configure the | ||
82 | * fault handling for intr remapping. | ||
83 | */ | ||
84 | if (intr_remapping_enabled) | ||
85 | enable_drhd_fault_handling(); | ||
86 | } | 79 | } |
87 | 80 | ||
88 | /* Same for both flat and physical. */ | 81 | /* Same for both flat and physical. */ |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index ba5f62f45f01..81fa3cb12f39 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -305,8 +305,7 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) | |||
305 | /* use socket ID also for last level cache */ | 305 | /* use socket ID also for last level cache */ |
306 | per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; | 306 | per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; |
307 | /* fixup topology information on multi-node processors */ | 307 | /* fixup topology information on multi-node processors */ |
308 | if ((c->x86 == 0x10) && (c->x86_model == 9)) | 308 | amd_fixup_dcm(c); |
309 | amd_fixup_dcm(c); | ||
310 | #endif | 309 | #endif |
311 | } | 310 | } |
312 | 311 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index cd8da247dda1..a2baafb2fe6d 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -701,6 +701,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) | |||
701 | per_cpu(acfreq_data, policy->cpu) = NULL; | 701 | per_cpu(acfreq_data, policy->cpu) = NULL; |
702 | acpi_processor_unregister_performance(data->acpi_data, | 702 | acpi_processor_unregister_performance(data->acpi_data, |
703 | policy->cpu); | 703 | policy->cpu); |
704 | kfree(data->freq_table); | ||
704 | kfree(data); | 705 | kfree(data); |
705 | } | 706 | } |
706 | 707 | ||
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index c5f59d071425..ac140c7be396 100644 --- a/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c | |||
@@ -827,7 +827,7 @@ int __init amd_special_default_mtrr(void) | |||
827 | 827 | ||
828 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | 828 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) |
829 | return 0; | 829 | return 0; |
830 | if (boot_cpu_data.x86 < 0xf || boot_cpu_data.x86 > 0x11) | 830 | if (boot_cpu_data.x86 < 0xf) |
831 | return 0; | 831 | return 0; |
832 | /* In case some hypervisor doesn't pass SYSCFG through: */ | 832 | /* In case some hypervisor doesn't pass SYSCFG through: */ |
833 | if (rdmsr_safe(MSR_K8_SYSCFG, &l, &h) < 0) | 833 | if (rdmsr_safe(MSR_K8_SYSCFG, &l, &h) < 0) |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index 01c0f3ee6cc3..bebabec5b448 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -793,13 +793,21 @@ void set_mtrr_aps_delayed_init(void) | |||
793 | } | 793 | } |
794 | 794 | ||
795 | /* | 795 | /* |
796 | * MTRR initialization for all AP's | 796 | * Delayed MTRR initialization for all AP's |
797 | */ | 797 | */ |
798 | void mtrr_aps_init(void) | 798 | void mtrr_aps_init(void) |
799 | { | 799 | { |
800 | if (!use_intel()) | 800 | if (!use_intel()) |
801 | return; | 801 | return; |
802 | 802 | ||
803 | /* | ||
804 | * Check if someone has requested the delay of AP MTRR initialization, | ||
805 | * by doing set_mtrr_aps_delayed_init(), prior to this point. If not, | ||
806 | * then we are done. | ||
807 | */ | ||
808 | if (!mtrr_aps_delayed_init) | ||
809 | return; | ||
810 | |||
803 | set_mtrr(~0U, 0, 0, 0); | 811 | set_mtrr(~0U, 0, 0, 0); |
804 | mtrr_aps_delayed_init = false; | 812 | mtrr_aps_delayed_init = false; |
805 | } | 813 | } |
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c index c2897b7b4a3b..46d58448c3af 100644 --- a/arch/x86/kernel/cpu/perf_event_amd.c +++ b/arch/x86/kernel/cpu/perf_event_amd.c | |||
@@ -52,7 +52,7 @@ static __initconst const u64 amd_hw_cache_event_ids | |||
52 | [ C(DTLB) ] = { | 52 | [ C(DTLB) ] = { |
53 | [ C(OP_READ) ] = { | 53 | [ C(OP_READ) ] = { |
54 | [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */ | 54 | [ C(RESULT_ACCESS) ] = 0x0040, /* Data Cache Accesses */ |
55 | [ C(RESULT_MISS) ] = 0x0046, /* L1 DTLB and L2 DLTB Miss */ | 55 | [ C(RESULT_MISS) ] = 0x0746, /* L1_DTLB_AND_L2_DLTB_MISS.ALL */ |
56 | }, | 56 | }, |
57 | [ C(OP_WRITE) ] = { | 57 | [ C(OP_WRITE) ] = { |
58 | [ C(RESULT_ACCESS) ] = 0, | 58 | [ C(RESULT_ACCESS) ] = 0, |
@@ -66,7 +66,7 @@ static __initconst const u64 amd_hw_cache_event_ids | |||
66 | [ C(ITLB) ] = { | 66 | [ C(ITLB) ] = { |
67 | [ C(OP_READ) ] = { | 67 | [ C(OP_READ) ] = { |
68 | [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes */ | 68 | [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes */ |
69 | [ C(RESULT_MISS) ] = 0x0085, /* Instr. fetch ITLB misses */ | 69 | [ C(RESULT_MISS) ] = 0x0385, /* L1_ITLB_AND_L2_ITLB_MISS.ALL */ |
70 | }, | 70 | }, |
71 | [ C(OP_WRITE) ] = { | 71 | [ C(OP_WRITE) ] = { |
72 | [ C(RESULT_ACCESS) ] = -1, | 72 | [ C(RESULT_ACCESS) ] = -1, |
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c index 045b36cada65..994828899e09 100644 --- a/arch/x86/kernel/crash_dump_64.c +++ b/arch/x86/kernel/crash_dump_64.c | |||
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | |||
34 | if (!csize) | 34 | if (!csize) |
35 | return 0; | 35 | return 0; |
36 | 36 | ||
37 | vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); | 37 | vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE); |
38 | if (!vaddr) | 38 | if (!vaddr) |
39 | return -ENOMEM; | 39 | return -ENOMEM; |
40 | 40 | ||
@@ -46,6 +46,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | |||
46 | } else | 46 | } else |
47 | memcpy(buf, vaddr + offset, csize); | 47 | memcpy(buf, vaddr + offset, csize); |
48 | 48 | ||
49 | set_iounmap_nonlazy(); | ||
49 | iounmap(vaddr); | 50 | iounmap(vaddr); |
50 | return csize; | 51 | return csize; |
51 | } | 52 | } |
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index ff15c9dcc25d..42c594254507 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c | |||
@@ -433,6 +433,10 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args) | |||
433 | dr6_p = (unsigned long *)ERR_PTR(args->err); | 433 | dr6_p = (unsigned long *)ERR_PTR(args->err); |
434 | dr6 = *dr6_p; | 434 | dr6 = *dr6_p; |
435 | 435 | ||
436 | /* If it's a single step, TRAP bits are random */ | ||
437 | if (dr6 & DR_STEP) | ||
438 | return NOTIFY_DONE; | ||
439 | |||
436 | /* Do an early return if no trap bits are set in DR6 */ | 440 | /* Do an early return if no trap bits are set in DR6 */ |
437 | if ((dr6 & DR_TRAP_BITS) == 0) | 441 | if ((dr6 & DR_TRAP_BITS) == 0) |
438 | return NOTIFY_DONE; | 442 | return NOTIFY_DONE; |
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index 356170262a93..2573689bda77 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
@@ -364,8 +364,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
364 | 364 | ||
365 | /* For performance reasons, reuse mc area when possible */ | 365 | /* For performance reasons, reuse mc area when possible */ |
366 | if (!mc || mc_size > curr_mc_size) { | 366 | if (!mc || mc_size > curr_mc_size) { |
367 | if (mc) | 367 | vfree(mc); |
368 | vfree(mc); | ||
369 | mc = vmalloc(mc_size); | 368 | mc = vmalloc(mc_size); |
370 | if (!mc) | 369 | if (!mc) |
371 | break; | 370 | break; |
@@ -374,13 +373,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
374 | 373 | ||
375 | if (get_ucode_data(mc, ucode_ptr, mc_size) || | 374 | if (get_ucode_data(mc, ucode_ptr, mc_size) || |
376 | microcode_sanity_check(mc) < 0) { | 375 | microcode_sanity_check(mc) < 0) { |
377 | vfree(mc); | ||
378 | break; | 376 | break; |
379 | } | 377 | } |
380 | 378 | ||
381 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { | 379 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { |
382 | if (new_mc) | 380 | vfree(new_mc); |
383 | vfree(new_mc); | ||
384 | new_rev = mc_header.rev; | 381 | new_rev = mc_header.rev; |
385 | new_mc = mc; | 382 | new_mc = mc; |
386 | mc = NULL; /* trigger new vmalloc */ | 383 | mc = NULL; /* trigger new vmalloc */ |
@@ -390,12 +387,10 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
390 | leftover -= mc_size; | 387 | leftover -= mc_size; |
391 | } | 388 | } |
392 | 389 | ||
393 | if (mc) | 390 | vfree(mc); |
394 | vfree(mc); | ||
395 | 391 | ||
396 | if (leftover) { | 392 | if (leftover) { |
397 | if (new_mc) | 393 | vfree(new_mc); |
398 | vfree(new_mc); | ||
399 | state = UCODE_ERROR; | 394 | state = UCODE_ERROR; |
400 | goto out; | 395 | goto out; |
401 | } | 396 | } |
@@ -405,8 +400,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
405 | goto out; | 400 | goto out; |
406 | } | 401 | } |
407 | 402 | ||
408 | if (uci->mc) | 403 | vfree(uci->mc); |
409 | vfree(uci->mc); | ||
410 | uci->mc = (struct microcode_intel *)new_mc; | 404 | uci->mc = (struct microcode_intel *)new_mc; |
411 | 405 | ||
412 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", | 406 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", |
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c index 0e0cdde519be..a2bd899b2b83 100644 --- a/arch/x86/kernel/olpc.c +++ b/arch/x86/kernel/olpc.c | |||
@@ -114,6 +114,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, | |||
114 | unsigned long flags; | 114 | unsigned long flags; |
115 | int ret = -EIO; | 115 | int ret = -EIO; |
116 | int i; | 116 | int i; |
117 | int restarts = 0; | ||
117 | 118 | ||
118 | spin_lock_irqsave(&ec_lock, flags); | 119 | spin_lock_irqsave(&ec_lock, flags); |
119 | 120 | ||
@@ -169,7 +170,9 @@ restart: | |||
169 | if (wait_on_obf(0x6c, 1)) { | 170 | if (wait_on_obf(0x6c, 1)) { |
170 | printk(KERN_ERR "olpc-ec: timeout waiting for" | 171 | printk(KERN_ERR "olpc-ec: timeout waiting for" |
171 | " EC to provide data!\n"); | 172 | " EC to provide data!\n"); |
172 | goto restart; | 173 | if (restarts++ < 10) |
174 | goto restart; | ||
175 | goto err; | ||
173 | } | 176 | } |
174 | outbuf[i] = inb(0x68); | 177 | outbuf[i] = inb(0x68); |
175 | pr_devel("olpc-ec: received 0x%x\n", outbuf[i]); | 178 | pr_devel("olpc-ec: received 0x%x\n", outbuf[i]); |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index e3af342fe83a..76a0d715a031 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -641,7 +641,7 @@ void native_machine_shutdown(void) | |||
641 | /* O.K Now that I'm on the appropriate processor, | 641 | /* O.K Now that I'm on the appropriate processor, |
642 | * stop all of the others. | 642 | * stop all of the others. |
643 | */ | 643 | */ |
644 | smp_send_stop(); | 644 | stop_other_cpus(); |
645 | #endif | 645 | #endif |
646 | 646 | ||
647 | lapic_shutdown(); | 647 | lapic_shutdown(); |
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index 74cca6014c0e..96af3a8e7326 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
@@ -174,10 +174,10 @@ asmlinkage void smp_reboot_interrupt(void) | |||
174 | irq_exit(); | 174 | irq_exit(); |
175 | } | 175 | } |
176 | 176 | ||
177 | static void native_smp_send_stop(void) | 177 | static void native_stop_other_cpus(int wait) |
178 | { | 178 | { |
179 | unsigned long flags; | 179 | unsigned long flags; |
180 | unsigned long wait; | 180 | unsigned long timeout; |
181 | 181 | ||
182 | if (reboot_force) | 182 | if (reboot_force) |
183 | return; | 183 | return; |
@@ -194,9 +194,12 @@ static void native_smp_send_stop(void) | |||
194 | if (num_online_cpus() > 1) { | 194 | if (num_online_cpus() > 1) { |
195 | apic->send_IPI_allbutself(REBOOT_VECTOR); | 195 | apic->send_IPI_allbutself(REBOOT_VECTOR); |
196 | 196 | ||
197 | /* Don't wait longer than a second */ | 197 | /* |
198 | wait = USEC_PER_SEC; | 198 | * Don't wait longer than a second if the caller |
199 | while (num_online_cpus() > 1 && wait--) | 199 | * didn't ask us to wait. |
200 | */ | ||
201 | timeout = USEC_PER_SEC; | ||
202 | while (num_online_cpus() > 1 && (wait || timeout--)) | ||
200 | udelay(1); | 203 | udelay(1); |
201 | } | 204 | } |
202 | 205 | ||
@@ -254,7 +257,7 @@ struct smp_ops smp_ops = { | |||
254 | .smp_prepare_cpus = native_smp_prepare_cpus, | 257 | .smp_prepare_cpus = native_smp_prepare_cpus, |
255 | .smp_cpus_done = native_smp_cpus_done, | 258 | .smp_cpus_done = native_smp_cpus_done, |
256 | 259 | ||
257 | .smp_send_stop = native_smp_send_stop, | 260 | .stop_other_cpus = native_stop_other_cpus, |
258 | .smp_send_reschedule = native_smp_send_reschedule, | 261 | .smp_send_reschedule = native_smp_send_reschedule, |
259 | 262 | ||
260 | .cpu_up = native_cpu_up, | 263 | .cpu_up = native_cpu_up, |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8b3bfc4dd708..016179e5ba09 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1383,11 +1383,94 @@ void play_dead_common(void) | |||
1383 | local_irq_disable(); | 1383 | local_irq_disable(); |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | #define MWAIT_SUBSTATE_MASK 0xf | ||
1387 | #define MWAIT_SUBSTATE_SIZE 4 | ||
1388 | |||
1389 | #define CPUID_MWAIT_LEAF 5 | ||
1390 | #define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1 | ||
1391 | |||
1392 | /* | ||
1393 | * We need to flush the caches before going to sleep, lest we have | ||
1394 | * dirty data in our caches when we come back up. | ||
1395 | */ | ||
1396 | static inline void mwait_play_dead(void) | ||
1397 | { | ||
1398 | unsigned int eax, ebx, ecx, edx; | ||
1399 | unsigned int highest_cstate = 0; | ||
1400 | unsigned int highest_subcstate = 0; | ||
1401 | int i; | ||
1402 | void *mwait_ptr; | ||
1403 | |||
1404 | if (!cpu_has(¤t_cpu_data, X86_FEATURE_MWAIT)) | ||
1405 | return; | ||
1406 | if (!cpu_has(¤t_cpu_data, X86_FEATURE_CLFLSH)) | ||
1407 | return; | ||
1408 | if (current_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) | ||
1409 | return; | ||
1410 | |||
1411 | eax = CPUID_MWAIT_LEAF; | ||
1412 | ecx = 0; | ||
1413 | native_cpuid(&eax, &ebx, &ecx, &edx); | ||
1414 | |||
1415 | /* | ||
1416 | * eax will be 0 if EDX enumeration is not valid. | ||
1417 | * Initialized below to cstate, sub_cstate value when EDX is valid. | ||
1418 | */ | ||
1419 | if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED)) { | ||
1420 | eax = 0; | ||
1421 | } else { | ||
1422 | edx >>= MWAIT_SUBSTATE_SIZE; | ||
1423 | for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) { | ||
1424 | if (edx & MWAIT_SUBSTATE_MASK) { | ||
1425 | highest_cstate = i; | ||
1426 | highest_subcstate = edx & MWAIT_SUBSTATE_MASK; | ||
1427 | } | ||
1428 | } | ||
1429 | eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | | ||
1430 | (highest_subcstate - 1); | ||
1431 | } | ||
1432 | |||
1433 | /* | ||
1434 | * This should be a memory location in a cache line which is | ||
1435 | * unlikely to be touched by other processors. The actual | ||
1436 | * content is immaterial as it is not actually modified in any way. | ||
1437 | */ | ||
1438 | mwait_ptr = ¤t_thread_info()->flags; | ||
1439 | |||
1440 | wbinvd(); | ||
1441 | |||
1442 | while (1) { | ||
1443 | /* | ||
1444 | * The CLFLUSH is a workaround for erratum AAI65 for | ||
1445 | * the Xeon 7400 series. It's not clear it is actually | ||
1446 | * needed, but it should be harmless in either case. | ||
1447 | * The WBINVD is insufficient due to the spurious-wakeup | ||
1448 | * case where we return around the loop. | ||
1449 | */ | ||
1450 | clflush(mwait_ptr); | ||
1451 | __monitor(mwait_ptr, 0, 0); | ||
1452 | mb(); | ||
1453 | __mwait(eax, 0); | ||
1454 | } | ||
1455 | } | ||
1456 | |||
1457 | static inline void hlt_play_dead(void) | ||
1458 | { | ||
1459 | if (current_cpu_data.x86 >= 4) | ||
1460 | wbinvd(); | ||
1461 | |||
1462 | while (1) { | ||
1463 | native_halt(); | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1386 | void native_play_dead(void) | 1467 | void native_play_dead(void) |
1387 | { | 1468 | { |
1388 | play_dead_common(); | 1469 | play_dead_common(); |
1389 | tboot_shutdown(TB_SHUTDOWN_WFS); | 1470 | tboot_shutdown(TB_SHUTDOWN_WFS); |
1390 | wbinvd_halt(); | 1471 | |
1472 | mwait_play_dead(); /* Only returns on failure */ | ||
1473 | hlt_play_dead(); | ||
1391 | } | 1474 | } |
1392 | 1475 | ||
1393 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 1476 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 60788dee0f8a..9f4edeb21323 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -575,6 +575,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code) | |||
575 | if (regs->flags & X86_VM_MASK) { | 575 | if (regs->flags & X86_VM_MASK) { |
576 | handle_vm86_trap((struct kernel_vm86_regs *) regs, | 576 | handle_vm86_trap((struct kernel_vm86_regs *) regs, |
577 | error_code, 1); | 577 | error_code, 1); |
578 | preempt_conditional_cli(regs); | ||
578 | return; | 579 | return; |
579 | } | 580 | } |
580 | 581 | ||
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 5ffb5622f793..61fb98519622 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -551,8 +551,14 @@ cannot_handle: | |||
551 | int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno) | 551 | int handle_vm86_trap(struct kernel_vm86_regs *regs, long error_code, int trapno) |
552 | { | 552 | { |
553 | if (VMPI.is_vm86pus) { | 553 | if (VMPI.is_vm86pus) { |
554 | if ((trapno == 3) || (trapno == 1)) | 554 | if ((trapno == 3) || (trapno == 1)) { |
555 | return_to_32bit(regs, VM86_TRAP + (trapno << 8)); | 555 | KVM86->regs32->ax = VM86_TRAP + (trapno << 8); |
556 | /* setting this flag forces the code in entry_32.S to | ||
557 | call save_v86_state() and change the stack pointer | ||
558 | to KVM86->regs32 */ | ||
559 | set_thread_flag(TIF_IRET); | ||
560 | return 0; | ||
561 | } | ||
556 | do_int(regs, trapno, (unsigned char __user *) (regs->pt.ss << 4), SP(regs)); | 562 | do_int(regs, trapno, (unsigned char __user *) (regs->pt.ss << 4), SP(regs)); |
557 | return 0; | 563 | return 0; |
558 | } | 564 | } |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 9c253bd65e24..547128546cc3 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -394,7 +394,8 @@ static void __init setup_xstate_init(void) | |||
394 | * Setup init_xstate_buf to represent the init state of | 394 | * Setup init_xstate_buf to represent the init state of |
395 | * all the features managed by the xsave | 395 | * all the features managed by the xsave |
396 | */ | 396 | */ |
397 | init_xstate_buf = alloc_bootmem(xstate_size); | 397 | init_xstate_buf = alloc_bootmem_align(xstate_size, |
398 | __alignof__(struct xsave_struct)); | ||
398 | init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT; | 399 | init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT; |
399 | 400 | ||
400 | clts(); | 401 | clts(); |
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 4b7b73ce2098..9f163e61283c 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
@@ -570,6 +570,8 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm) | |||
570 | s->pics[1].elcr_mask = 0xde; | 570 | s->pics[1].elcr_mask = 0xde; |
571 | s->pics[0].pics_state = s; | 571 | s->pics[0].pics_state = s; |
572 | s->pics[1].pics_state = s; | 572 | s->pics[1].pics_state = s; |
573 | s->pics[0].isr_ack = 0xff; | ||
574 | s->pics[1].isr_ack = 0xff; | ||
573 | 575 | ||
574 | /* | 576 | /* |
575 | * Initialize PIO device | 577 | * Initialize PIO device |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 311f6dad8951..7fed5b793faf 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2254,6 +2254,10 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
2254 | return 0; | 2254 | return 0; |
2255 | } | 2255 | } |
2256 | direct = !is_paging(vcpu); | 2256 | direct = !is_paging(vcpu); |
2257 | |||
2258 | if (mmu_check_root(vcpu, root_gfn)) | ||
2259 | return 1; | ||
2260 | |||
2257 | for (i = 0; i < 4; ++i) { | 2261 | for (i = 0; i < 4; ++i) { |
2258 | hpa_t root = vcpu->arch.mmu.pae_root[i]; | 2262 | hpa_t root = vcpu->arch.mmu.pae_root[i]; |
2259 | 2263 | ||
@@ -2265,13 +2269,13 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
2265 | continue; | 2269 | continue; |
2266 | } | 2270 | } |
2267 | root_gfn = pdptr >> PAGE_SHIFT; | 2271 | root_gfn = pdptr >> PAGE_SHIFT; |
2272 | if (mmu_check_root(vcpu, root_gfn)) | ||
2273 | return 1; | ||
2268 | } else if (vcpu->arch.mmu.root_level == 0) | 2274 | } else if (vcpu->arch.mmu.root_level == 0) |
2269 | root_gfn = 0; | 2275 | root_gfn = 0; |
2270 | if (mmu_check_root(vcpu, root_gfn)) | ||
2271 | return 1; | ||
2272 | if (tdp_enabled) { | 2276 | if (tdp_enabled) { |
2273 | direct = 1; | 2277 | direct = 1; |
2274 | root_gfn = i << 30; | 2278 | root_gfn = i << (30 - PAGE_SHIFT); |
2275 | } | 2279 | } |
2276 | spin_lock(&vcpu->kvm->mmu_lock); | 2280 | spin_lock(&vcpu->kvm->mmu_lock); |
2277 | kvm_mmu_free_some_pages(vcpu); | 2281 | kvm_mmu_free_some_pages(vcpu); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 8a3f9f64f86f..e7c3f3bd08fc 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -88,6 +88,14 @@ struct nested_state { | |||
88 | /* A VMEXIT is required but not yet emulated */ | 88 | /* A VMEXIT is required but not yet emulated */ |
89 | bool exit_required; | 89 | bool exit_required; |
90 | 90 | ||
91 | /* | ||
92 | * If we vmexit during an instruction emulation we need this to restore | ||
93 | * the l1 guest rip after the emulation | ||
94 | */ | ||
95 | unsigned long vmexit_rip; | ||
96 | unsigned long vmexit_rsp; | ||
97 | unsigned long vmexit_rax; | ||
98 | |||
91 | /* cache for intercepts of the guest */ | 99 | /* cache for intercepts of the guest */ |
92 | u16 intercept_cr_read; | 100 | u16 intercept_cr_read; |
93 | u16 intercept_cr_write; | 101 | u16 intercept_cr_write; |
@@ -1206,8 +1214,12 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | |||
1206 | if (old == new) { | 1214 | if (old == new) { |
1207 | /* cr0 write with ts and mp unchanged */ | 1215 | /* cr0 write with ts and mp unchanged */ |
1208 | svm->vmcb->control.exit_code = SVM_EXIT_CR0_SEL_WRITE; | 1216 | svm->vmcb->control.exit_code = SVM_EXIT_CR0_SEL_WRITE; |
1209 | if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE) | 1217 | if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE) { |
1218 | svm->nested.vmexit_rip = kvm_rip_read(vcpu); | ||
1219 | svm->nested.vmexit_rsp = kvm_register_read(vcpu, VCPU_REGS_RSP); | ||
1220 | svm->nested.vmexit_rax = kvm_register_read(vcpu, VCPU_REGS_RAX); | ||
1210 | return; | 1221 | return; |
1222 | } | ||
1211 | } | 1223 | } |
1212 | } | 1224 | } |
1213 | 1225 | ||
@@ -2399,6 +2411,23 @@ static int emulate_on_interception(struct vcpu_svm *svm) | |||
2399 | return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE; | 2411 | return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE; |
2400 | } | 2412 | } |
2401 | 2413 | ||
2414 | static int cr0_write_interception(struct vcpu_svm *svm) | ||
2415 | { | ||
2416 | struct kvm_vcpu *vcpu = &svm->vcpu; | ||
2417 | int r; | ||
2418 | |||
2419 | r = emulate_instruction(&svm->vcpu, 0, 0, 0); | ||
2420 | |||
2421 | if (svm->nested.vmexit_rip) { | ||
2422 | kvm_register_write(vcpu, VCPU_REGS_RIP, svm->nested.vmexit_rip); | ||
2423 | kvm_register_write(vcpu, VCPU_REGS_RSP, svm->nested.vmexit_rsp); | ||
2424 | kvm_register_write(vcpu, VCPU_REGS_RAX, svm->nested.vmexit_rax); | ||
2425 | svm->nested.vmexit_rip = 0; | ||
2426 | } | ||
2427 | |||
2428 | return r == EMULATE_DONE; | ||
2429 | } | ||
2430 | |||
2402 | static int cr8_write_interception(struct vcpu_svm *svm) | 2431 | static int cr8_write_interception(struct vcpu_svm *svm) |
2403 | { | 2432 | { |
2404 | struct kvm_run *kvm_run = svm->vcpu.run; | 2433 | struct kvm_run *kvm_run = svm->vcpu.run; |
@@ -2672,7 +2701,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { | |||
2672 | [SVM_EXIT_READ_CR4] = emulate_on_interception, | 2701 | [SVM_EXIT_READ_CR4] = emulate_on_interception, |
2673 | [SVM_EXIT_READ_CR8] = emulate_on_interception, | 2702 | [SVM_EXIT_READ_CR8] = emulate_on_interception, |
2674 | [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, | 2703 | [SVM_EXIT_CR0_SEL_WRITE] = emulate_on_interception, |
2675 | [SVM_EXIT_WRITE_CR0] = emulate_on_interception, | 2704 | [SVM_EXIT_WRITE_CR0] = cr0_write_interception, |
2676 | [SVM_EXIT_WRITE_CR3] = emulate_on_interception, | 2705 | [SVM_EXIT_WRITE_CR3] = emulate_on_interception, |
2677 | [SVM_EXIT_WRITE_CR4] = emulate_on_interception, | 2706 | [SVM_EXIT_WRITE_CR4] = emulate_on_interception, |
2678 | [SVM_EXIT_WRITE_CR8] = cr8_write_interception, | 2707 | [SVM_EXIT_WRITE_CR8] = cr8_write_interception, |
@@ -3252,6 +3281,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
3252 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; | 3281 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; |
3253 | 3282 | ||
3254 | load_host_msrs(vcpu); | 3283 | load_host_msrs(vcpu); |
3284 | kvm_load_ldt(ldt_selector); | ||
3255 | loadsegment(fs, fs_selector); | 3285 | loadsegment(fs, fs_selector); |
3256 | #ifdef CONFIG_X86_64 | 3286 | #ifdef CONFIG_X86_64 |
3257 | load_gs_index(gs_selector); | 3287 | load_gs_index(gs_selector); |
@@ -3259,7 +3289,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
3259 | #else | 3289 | #else |
3260 | loadsegment(gs, gs_selector); | 3290 | loadsegment(gs, gs_selector); |
3261 | #endif | 3291 | #endif |
3262 | kvm_load_ldt(ldt_selector); | ||
3263 | 3292 | ||
3264 | reload_tss(vcpu); | 3293 | reload_tss(vcpu); |
3265 | 3294 | ||
@@ -3354,6 +3383,14 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu) | |||
3354 | static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) | 3383 | static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) |
3355 | { | 3384 | { |
3356 | switch (func) { | 3385 | switch (func) { |
3386 | case 0x00000001: | ||
3387 | /* Mask out xsave bit as long as it is not supported by SVM */ | ||
3388 | entry->ecx &= ~(bit(X86_FEATURE_XSAVE)); | ||
3389 | break; | ||
3390 | case 0x80000001: | ||
3391 | if (nested) | ||
3392 | entry->ecx |= (1 << 2); /* Set SVM bit */ | ||
3393 | break; | ||
3357 | case 0x8000000A: | 3394 | case 0x8000000A: |
3358 | entry->eax = 1; /* SVM revision 1 */ | 3395 | entry->eax = 1; /* SVM revision 1 */ |
3359 | entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper | 3396 | entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7bddfab12013..b3986fec7e68 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -828,10 +828,9 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) | |||
828 | #endif | 828 | #endif |
829 | 829 | ||
830 | #ifdef CONFIG_X86_64 | 830 | #ifdef CONFIG_X86_64 |
831 | if (is_long_mode(&vmx->vcpu)) { | 831 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
832 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); | 832 | if (is_long_mode(&vmx->vcpu)) |
833 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | 833 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); |
834 | } | ||
835 | #endif | 834 | #endif |
836 | for (i = 0; i < vmx->save_nmsrs; ++i) | 835 | for (i = 0; i < vmx->save_nmsrs; ++i) |
837 | kvm_set_shared_msr(vmx->guest_msrs[i].index, | 836 | kvm_set_shared_msr(vmx->guest_msrs[i].index, |
@@ -846,23 +845,23 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) | |||
846 | 845 | ||
847 | ++vmx->vcpu.stat.host_state_reload; | 846 | ++vmx->vcpu.stat.host_state_reload; |
848 | vmx->host_state.loaded = 0; | 847 | vmx->host_state.loaded = 0; |
849 | if (vmx->host_state.fs_reload_needed) | 848 | #ifdef CONFIG_X86_64 |
850 | loadsegment(fs, vmx->host_state.fs_sel); | 849 | if (is_long_mode(&vmx->vcpu)) |
850 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | ||
851 | #endif | ||
851 | if (vmx->host_state.gs_ldt_reload_needed) { | 852 | if (vmx->host_state.gs_ldt_reload_needed) { |
852 | kvm_load_ldt(vmx->host_state.ldt_sel); | 853 | kvm_load_ldt(vmx->host_state.ldt_sel); |
853 | #ifdef CONFIG_X86_64 | 854 | #ifdef CONFIG_X86_64 |
854 | load_gs_index(vmx->host_state.gs_sel); | 855 | load_gs_index(vmx->host_state.gs_sel); |
855 | wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); | ||
856 | #else | 856 | #else |
857 | loadsegment(gs, vmx->host_state.gs_sel); | 857 | loadsegment(gs, vmx->host_state.gs_sel); |
858 | #endif | 858 | #endif |
859 | } | 859 | } |
860 | if (vmx->host_state.fs_reload_needed) | ||
861 | loadsegment(fs, vmx->host_state.fs_sel); | ||
860 | reload_tss(); | 862 | reload_tss(); |
861 | #ifdef CONFIG_X86_64 | 863 | #ifdef CONFIG_X86_64 |
862 | if (is_long_mode(&vmx->vcpu)) { | 864 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
863 | rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); | ||
864 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); | ||
865 | } | ||
866 | #endif | 865 | #endif |
867 | if (current_thread_info()->status & TS_USEDFPU) | 866 | if (current_thread_info()->status & TS_USEDFPU) |
868 | clts(); | 867 | clts(); |
@@ -4249,11 +4248,6 @@ static int vmx_get_lpage_level(void) | |||
4249 | return PT_PDPE_LEVEL; | 4248 | return PT_PDPE_LEVEL; |
4250 | } | 4249 | } |
4251 | 4250 | ||
4252 | static inline u32 bit(int bitno) | ||
4253 | { | ||
4254 | return 1 << (bitno & 31); | ||
4255 | } | ||
4256 | |||
4257 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | 4251 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) |
4258 | { | 4252 | { |
4259 | struct kvm_cpuid_entry2 *best; | 4253 | struct kvm_cpuid_entry2 *best; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3a09c625d526..a5746de6f402 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -153,11 +153,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
153 | 153 | ||
154 | u64 __read_mostly host_xcr0; | 154 | u64 __read_mostly host_xcr0; |
155 | 155 | ||
156 | static inline u32 bit(int bitno) | ||
157 | { | ||
158 | return 1 << (bitno & 31); | ||
159 | } | ||
160 | |||
161 | static void kvm_on_user_return(struct user_return_notifier *urn) | 156 | static void kvm_on_user_return(struct user_return_notifier *urn) |
162 | { | 157 | { |
163 | unsigned slot; | 158 | unsigned slot; |
@@ -1994,9 +1989,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
1994 | 0 /* Reserved, AES */ | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX); | 1989 | 0 /* Reserved, AES */ | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX); |
1995 | /* cpuid 0x80000001.ecx */ | 1990 | /* cpuid 0x80000001.ecx */ |
1996 | const u32 kvm_supported_word6_x86_features = | 1991 | const u32 kvm_supported_word6_x86_features = |
1997 | F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ | | 1992 | F(LAHF_LM) | F(CMP_LEGACY) | 0 /*SVM*/ | 0 /* ExtApicSpace */ | |
1998 | F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) | | 1993 | F(CR8_LEGACY) | F(ABM) | F(SSE4A) | F(MISALIGNSSE) | |
1999 | F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(SSE5) | | 1994 | F(3DNOWPREFETCH) | 0 /* OSVW */ | 0 /* IBS */ | F(XOP) | |
2000 | 0 /* SKINIT */ | 0 /* WDT */; | 1995 | 0 /* SKINIT */ | 0 /* WDT */; |
2001 | 1996 | ||
2002 | /* all calls to cpuid_count() should be made on the same cpu */ | 1997 | /* all calls to cpuid_count() should be made on the same cpu */ |
@@ -2305,6 +2300,7 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | |||
2305 | !kvm_exception_is_soft(vcpu->arch.exception.nr); | 2300 | !kvm_exception_is_soft(vcpu->arch.exception.nr); |
2306 | events->exception.nr = vcpu->arch.exception.nr; | 2301 | events->exception.nr = vcpu->arch.exception.nr; |
2307 | events->exception.has_error_code = vcpu->arch.exception.has_error_code; | 2302 | events->exception.has_error_code = vcpu->arch.exception.has_error_code; |
2303 | events->exception.pad = 0; | ||
2308 | events->exception.error_code = vcpu->arch.exception.error_code; | 2304 | events->exception.error_code = vcpu->arch.exception.error_code; |
2309 | 2305 | ||
2310 | events->interrupt.injected = | 2306 | events->interrupt.injected = |
@@ -2318,12 +2314,14 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, | |||
2318 | events->nmi.injected = vcpu->arch.nmi_injected; | 2314 | events->nmi.injected = vcpu->arch.nmi_injected; |
2319 | events->nmi.pending = vcpu->arch.nmi_pending; | 2315 | events->nmi.pending = vcpu->arch.nmi_pending; |
2320 | events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); | 2316 | events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); |
2317 | events->nmi.pad = 0; | ||
2321 | 2318 | ||
2322 | events->sipi_vector = vcpu->arch.sipi_vector; | 2319 | events->sipi_vector = vcpu->arch.sipi_vector; |
2323 | 2320 | ||
2324 | events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING | 2321 | events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING |
2325 | | KVM_VCPUEVENT_VALID_SIPI_VECTOR | 2322 | | KVM_VCPUEVENT_VALID_SIPI_VECTOR |
2326 | | KVM_VCPUEVENT_VALID_SHADOW); | 2323 | | KVM_VCPUEVENT_VALID_SHADOW); |
2324 | memset(&events->reserved, 0, sizeof(events->reserved)); | ||
2327 | } | 2325 | } |
2328 | 2326 | ||
2329 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, | 2327 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
@@ -2366,6 +2364,7 @@ static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu, | |||
2366 | dbgregs->dr6 = vcpu->arch.dr6; | 2364 | dbgregs->dr6 = vcpu->arch.dr6; |
2367 | dbgregs->dr7 = vcpu->arch.dr7; | 2365 | dbgregs->dr7 = vcpu->arch.dr7; |
2368 | dbgregs->flags = 0; | 2366 | dbgregs->flags = 0; |
2367 | memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved)); | ||
2369 | } | 2368 | } |
2370 | 2369 | ||
2371 | static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, | 2370 | static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, |
@@ -2849,6 +2848,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) | |||
2849 | sizeof(ps->channels)); | 2848 | sizeof(ps->channels)); |
2850 | ps->flags = kvm->arch.vpit->pit_state.flags; | 2849 | ps->flags = kvm->arch.vpit->pit_state.flags; |
2851 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); | 2850 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); |
2851 | memset(&ps->reserved, 0, sizeof(ps->reserved)); | ||
2852 | return r; | 2852 | return r; |
2853 | } | 2853 | } |
2854 | 2854 | ||
@@ -2912,10 +2912,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2912 | struct kvm_memslots *slots, *old_slots; | 2912 | struct kvm_memslots *slots, *old_slots; |
2913 | unsigned long *dirty_bitmap; | 2913 | unsigned long *dirty_bitmap; |
2914 | 2914 | ||
2915 | spin_lock(&kvm->mmu_lock); | ||
2916 | kvm_mmu_slot_remove_write_access(kvm, log->slot); | ||
2917 | spin_unlock(&kvm->mmu_lock); | ||
2918 | |||
2919 | r = -ENOMEM; | 2915 | r = -ENOMEM; |
2920 | dirty_bitmap = vmalloc(n); | 2916 | dirty_bitmap = vmalloc(n); |
2921 | if (!dirty_bitmap) | 2917 | if (!dirty_bitmap) |
@@ -2937,6 +2933,10 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
2937 | dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; | 2933 | dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; |
2938 | kfree(old_slots); | 2934 | kfree(old_slots); |
2939 | 2935 | ||
2936 | spin_lock(&kvm->mmu_lock); | ||
2937 | kvm_mmu_slot_remove_write_access(kvm, log->slot); | ||
2938 | spin_unlock(&kvm->mmu_lock); | ||
2939 | |||
2940 | r = -EFAULT; | 2940 | r = -EFAULT; |
2941 | if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) { | 2941 | if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) { |
2942 | vfree(dirty_bitmap); | 2942 | vfree(dirty_bitmap); |
@@ -3229,6 +3229,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
3229 | now_ns = timespec_to_ns(&now); | 3229 | now_ns = timespec_to_ns(&now); |
3230 | user_ns.clock = kvm->arch.kvmclock_offset + now_ns; | 3230 | user_ns.clock = kvm->arch.kvmclock_offset + now_ns; |
3231 | user_ns.flags = 0; | 3231 | user_ns.flags = 0; |
3232 | memset(&user_ns.pad, 0, sizeof(user_ns.pad)); | ||
3232 | 3233 | ||
3233 | r = -EFAULT; | 3234 | r = -EFAULT; |
3234 | if (copy_to_user(argp, &user_ns, sizeof(user_ns))) | 3235 | if (copy_to_user(argp, &user_ns, sizeof(user_ns))) |
@@ -5111,6 +5112,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | |||
5111 | 5112 | ||
5112 | mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4; | 5113 | mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4; |
5113 | kvm_x86_ops->set_cr4(vcpu, sregs->cr4); | 5114 | kvm_x86_ops->set_cr4(vcpu, sregs->cr4); |
5115 | if (sregs->cr4 & X86_CR4_OSXSAVE) | ||
5116 | update_cpuid(vcpu); | ||
5114 | if (!is_long_mode(vcpu) && is_pae(vcpu)) { | 5117 | if (!is_long_mode(vcpu) && is_pae(vcpu)) { |
5115 | load_pdptrs(vcpu, vcpu->arch.cr3); | 5118 | load_pdptrs(vcpu, vcpu->arch.cr3); |
5116 | mmu_reset_needed = 1; | 5119 | mmu_reset_needed = 1; |
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index b7a404722d2b..0bf327453499 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
@@ -65,6 +65,11 @@ static inline int is_paging(struct kvm_vcpu *vcpu) | |||
65 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); | 65 | return kvm_read_cr0_bits(vcpu, X86_CR0_PG); |
66 | } | 66 | } |
67 | 67 | ||
68 | static inline u32 bit(int bitno) | ||
69 | { | ||
70 | return 1 << (bitno & 31); | ||
71 | } | ||
72 | |||
68 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); | 73 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); |
69 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); | 74 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); |
70 | 75 | ||
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index b67a6b5aa8d4..42623310c968 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -484,21 +484,29 @@ static int __init_ibs_nmi(void) | |||
484 | return 0; | 484 | return 0; |
485 | } | 485 | } |
486 | 486 | ||
487 | /* initialize the APIC for the IBS interrupts if available */ | 487 | /* |
488 | * check and reserve APIC extended interrupt LVT offset for IBS if | ||
489 | * available | ||
490 | * | ||
491 | * init_ibs() preforms implicitly cpu-local operations, so pin this | ||
492 | * thread to its current CPU | ||
493 | */ | ||
494 | |||
488 | static void init_ibs(void) | 495 | static void init_ibs(void) |
489 | { | 496 | { |
490 | ibs_caps = get_ibs_caps(); | 497 | preempt_disable(); |
491 | 498 | ||
499 | ibs_caps = get_ibs_caps(); | ||
492 | if (!ibs_caps) | 500 | if (!ibs_caps) |
493 | return; | 501 | goto out; |
494 | 502 | ||
495 | if (__init_ibs_nmi()) { | 503 | if (__init_ibs_nmi() < 0) |
496 | ibs_caps = 0; | 504 | ibs_caps = 0; |
497 | return; | 505 | else |
498 | } | 506 | printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps); |
499 | 507 | ||
500 | printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", | 508 | out: |
501 | (unsigned)ibs_caps); | 509 | preempt_enable(); |
502 | } | 510 | } |
503 | 511 | ||
504 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); | 512 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); |
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 4a2afa1bac51..b6552b189bcd 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -25,7 +25,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) | |||
25 | 25 | ||
26 | export CPPFLAGS_vdso.lds += -P -C | 26 | export CPPFLAGS_vdso.lds += -P -C |
27 | 27 | ||
28 | VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \ | 28 | VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ |
29 | -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 | 29 | -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 |
30 | 30 | ||
31 | $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so | 31 | $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so |
@@ -69,7 +69,7 @@ vdso32.so-$(VDSO32-y) += sysenter | |||
69 | vdso32-images = $(vdso32.so-y:%=vdso32-%.so) | 69 | vdso32-images = $(vdso32.so-y:%=vdso32-%.so) |
70 | 70 | ||
71 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) | 71 | CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) |
72 | VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1 | 72 | VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1 |
73 | 73 | ||
74 | # This makes sure the $(obj) subdirectory exists even though vdso32/ | 74 | # This makes sure the $(obj) subdirectory exists even though vdso32/ |
75 | # is not a kbuild sub-make subdirectory. | 75 | # is not a kbuild sub-make subdirectory. |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 7d46c8441418..0f6cd146f1ee 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1017,10 +1017,6 @@ static void xen_reboot(int reason) | |||
1017 | { | 1017 | { |
1018 | struct sched_shutdown r = { .reason = reason }; | 1018 | struct sched_shutdown r = { .reason = reason }; |
1019 | 1019 | ||
1020 | #ifdef CONFIG_SMP | ||
1021 | smp_send_stop(); | ||
1022 | #endif | ||
1023 | |||
1024 | if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) | 1020 | if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) |
1025 | BUG(); | 1021 | BUG(); |
1026 | } | 1022 | } |
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 25f232b18a82..f4d010031465 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -400,9 +400,9 @@ static void stop_self(void *v) | |||
400 | BUG(); | 400 | BUG(); |
401 | } | 401 | } |
402 | 402 | ||
403 | static void xen_smp_send_stop(void) | 403 | static void xen_stop_other_cpus(int wait) |
404 | { | 404 | { |
405 | smp_call_function(stop_self, NULL, 0); | 405 | smp_call_function(stop_self, NULL, wait); |
406 | } | 406 | } |
407 | 407 | ||
408 | static void xen_smp_send_reschedule(int cpu) | 408 | static void xen_smp_send_reschedule(int cpu) |
@@ -470,7 +470,7 @@ static const struct smp_ops xen_smp_ops __initdata = { | |||
470 | .cpu_disable = xen_cpu_disable, | 470 | .cpu_disable = xen_cpu_disable, |
471 | .play_dead = xen_play_dead, | 471 | .play_dead = xen_play_dead, |
472 | 472 | ||
473 | .smp_send_stop = xen_smp_send_stop, | 473 | .stop_other_cpus = xen_stop_other_cpus, |
474 | .smp_send_reschedule = xen_smp_send_reschedule, | 474 | .smp_send_reschedule = xen_smp_send_reschedule, |
475 | 475 | ||
476 | .send_call_func_ipi = xen_smp_send_call_function_ipi, | 476 | .send_call_func_ipi = xen_smp_send_call_function_ipi, |
diff --git a/block/blk-map.c b/block/blk-map.c index ade0a08c9099..267a57b77099 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -205,6 +205,8 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | |||
205 | unaligned = 1; | 205 | unaligned = 1; |
206 | break; | 206 | break; |
207 | } | 207 | } |
208 | if (!iov[i].iov_len) | ||
209 | return -EINVAL; | ||
208 | } | 210 | } |
209 | 211 | ||
210 | if (unaligned || (q->dma_pad_mask & len) || map_data) | 212 | if (unaligned || (q->dma_pad_mask & len) || map_data) |
diff --git a/block/blk-merge.c b/block/blk-merge.c index eafc94f68d79..c24bf43d51f0 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -21,7 +21,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | |||
21 | return 0; | 21 | return 0; |
22 | 22 | ||
23 | fbio = bio; | 23 | fbio = bio; |
24 | cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 24 | cluster = blk_queue_cluster(q); |
25 | seg_size = 0; | 25 | seg_size = 0; |
26 | nr_phys_segs = 0; | 26 | nr_phys_segs = 0; |
27 | for_each_bio(bio) { | 27 | for_each_bio(bio) { |
@@ -87,7 +87,7 @@ EXPORT_SYMBOL(blk_recount_segments); | |||
87 | static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, | 87 | static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio, |
88 | struct bio *nxt) | 88 | struct bio *nxt) |
89 | { | 89 | { |
90 | if (!test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags)) | 90 | if (!blk_queue_cluster(q)) |
91 | return 0; | 91 | return 0; |
92 | 92 | ||
93 | if (bio->bi_seg_back_size + nxt->bi_seg_front_size > | 93 | if (bio->bi_seg_back_size + nxt->bi_seg_front_size > |
@@ -123,7 +123,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq, | |||
123 | int nsegs, cluster; | 123 | int nsegs, cluster; |
124 | 124 | ||
125 | nsegs = 0; | 125 | nsegs = 0; |
126 | cluster = test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); | 126 | cluster = blk_queue_cluster(q); |
127 | 127 | ||
128 | /* | 128 | /* |
129 | * for each bio in rq | 129 | * for each bio in rq |
diff --git a/block/blk-settings.c b/block/blk-settings.c index a234f4bf1d6f..ea9430d3d7d2 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -125,7 +125,7 @@ void blk_set_default_limits(struct queue_limits *lim) | |||
125 | lim->alignment_offset = 0; | 125 | lim->alignment_offset = 0; |
126 | lim->io_opt = 0; | 126 | lim->io_opt = 0; |
127 | lim->misaligned = 0; | 127 | lim->misaligned = 0; |
128 | lim->no_cluster = 0; | 128 | lim->cluster = 1; |
129 | } | 129 | } |
130 | EXPORT_SYMBOL(blk_set_default_limits); | 130 | EXPORT_SYMBOL(blk_set_default_limits); |
131 | 131 | ||
@@ -343,7 +343,7 @@ EXPORT_SYMBOL(blk_queue_logical_block_size); | |||
343 | * hardware can operate on without reverting to read-modify-write | 343 | * hardware can operate on without reverting to read-modify-write |
344 | * operations. | 344 | * operations. |
345 | */ | 345 | */ |
346 | void blk_queue_physical_block_size(struct request_queue *q, unsigned short size) | 346 | void blk_queue_physical_block_size(struct request_queue *q, unsigned int size) |
347 | { | 347 | { |
348 | q->limits.physical_block_size = size; | 348 | q->limits.physical_block_size = size; |
349 | 349 | ||
@@ -468,15 +468,6 @@ EXPORT_SYMBOL(blk_queue_io_opt); | |||
468 | void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b) | 468 | void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b) |
469 | { | 469 | { |
470 | blk_stack_limits(&t->limits, &b->limits, 0); | 470 | blk_stack_limits(&t->limits, &b->limits, 0); |
471 | |||
472 | if (!t->queue_lock) | ||
473 | WARN_ON_ONCE(1); | ||
474 | else if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) { | ||
475 | unsigned long flags; | ||
476 | spin_lock_irqsave(t->queue_lock, flags); | ||
477 | queue_flag_clear(QUEUE_FLAG_CLUSTER, t); | ||
478 | spin_unlock_irqrestore(t->queue_lock, flags); | ||
479 | } | ||
480 | } | 471 | } |
481 | EXPORT_SYMBOL(blk_queue_stack_limits); | 472 | EXPORT_SYMBOL(blk_queue_stack_limits); |
482 | 473 | ||
@@ -547,7 +538,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
547 | t->io_min = max(t->io_min, b->io_min); | 538 | t->io_min = max(t->io_min, b->io_min); |
548 | t->io_opt = lcm(t->io_opt, b->io_opt); | 539 | t->io_opt = lcm(t->io_opt, b->io_opt); |
549 | 540 | ||
550 | t->no_cluster |= b->no_cluster; | 541 | t->cluster &= b->cluster; |
551 | t->discard_zeroes_data &= b->discard_zeroes_data; | 542 | t->discard_zeroes_data &= b->discard_zeroes_data; |
552 | 543 | ||
553 | /* Physical block size a multiple of the logical block size? */ | 544 | /* Physical block size a multiple of the logical block size? */ |
@@ -643,7 +634,6 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | |||
643 | sector_t offset) | 634 | sector_t offset) |
644 | { | 635 | { |
645 | struct request_queue *t = disk->queue; | 636 | struct request_queue *t = disk->queue; |
646 | struct request_queue *b = bdev_get_queue(bdev); | ||
647 | 637 | ||
648 | if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) { | 638 | if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) { |
649 | char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; | 639 | char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; |
@@ -654,17 +644,6 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, | |||
654 | printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n", | 644 | printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n", |
655 | top, bottom); | 645 | top, bottom); |
656 | } | 646 | } |
657 | |||
658 | if (!t->queue_lock) | ||
659 | WARN_ON_ONCE(1); | ||
660 | else if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) { | ||
661 | unsigned long flags; | ||
662 | |||
663 | spin_lock_irqsave(t->queue_lock, flags); | ||
664 | if (!test_bit(QUEUE_FLAG_CLUSTER, &b->queue_flags)) | ||
665 | queue_flag_clear(QUEUE_FLAG_CLUSTER, t); | ||
666 | spin_unlock_irqrestore(t->queue_lock, flags); | ||
667 | } | ||
668 | } | 647 | } |
669 | EXPORT_SYMBOL(disk_stack_limits); | 648 | EXPORT_SYMBOL(disk_stack_limits); |
670 | 649 | ||
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 0749b89c6885..a26c930db346 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -114,7 +114,7 @@ static ssize_t queue_max_segments_show(struct request_queue *q, char *page) | |||
114 | 114 | ||
115 | static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page) | 115 | static ssize_t queue_max_segment_size_show(struct request_queue *q, char *page) |
116 | { | 116 | { |
117 | if (test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags)) | 117 | if (blk_queue_cluster(q)) |
118 | return queue_var_show(queue_max_segment_size(q), (page)); | 118 | return queue_var_show(queue_max_segment_size(q), (page)); |
119 | 119 | ||
120 | return queue_var_show(PAGE_CACHE_SIZE, (page)); | 120 | return queue_var_show(PAGE_CACHE_SIZE, (page)); |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 9eba291eb6fd..909479cfa0af 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -3402,6 +3402,10 @@ static bool cfq_should_wait_busy(struct cfq_data *cfqd, struct cfq_queue *cfqq) | |||
3402 | { | 3402 | { |
3403 | struct cfq_io_context *cic = cfqd->active_cic; | 3403 | struct cfq_io_context *cic = cfqd->active_cic; |
3404 | 3404 | ||
3405 | /* If the queue already has requests, don't wait */ | ||
3406 | if (!RB_EMPTY_ROOT(&cfqq->sort_list)) | ||
3407 | return false; | ||
3408 | |||
3405 | /* If there are other queues in the group, don't wait */ | 3409 | /* If there are other queues in the group, don't wait */ |
3406 | if (cfqq->cfqg->nr_cfqq > 1) | 3410 | if (cfqq->cfqg->nr_cfqq > 1) |
3407 | return false; | 3411 | return false; |
diff --git a/block/genhd.c b/block/genhd.c index 59a2db6fecef..315afd2f2088 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -541,13 +541,15 @@ void add_disk(struct gendisk *disk) | |||
541 | disk->major = MAJOR(devt); | 541 | disk->major = MAJOR(devt); |
542 | disk->first_minor = MINOR(devt); | 542 | disk->first_minor = MINOR(devt); |
543 | 543 | ||
544 | /* Register BDI before referencing it from bdev */ | ||
545 | bdi = &disk->queue->backing_dev_info; | ||
546 | bdi_register_dev(bdi, disk_devt(disk)); | ||
547 | |||
544 | blk_register_region(disk_devt(disk), disk->minors, NULL, | 548 | blk_register_region(disk_devt(disk), disk->minors, NULL, |
545 | exact_match, exact_lock, disk); | 549 | exact_match, exact_lock, disk); |
546 | register_disk(disk); | 550 | register_disk(disk); |
547 | blk_register_queue(disk); | 551 | blk_register_queue(disk); |
548 | 552 | ||
549 | bdi = &disk->queue->backing_dev_info; | ||
550 | bdi_register_dev(bdi, disk_devt(disk)); | ||
551 | retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, | 553 | retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, |
552 | "bdi"); | 554 | "bdi"); |
553 | WARN_ON(retval); | 555 | WARN_ON(retval); |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index a8b5a10eb5b0..4f4230b79bb6 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -321,33 +321,47 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, | |||
321 | if (hdr->iovec_count) { | 321 | if (hdr->iovec_count) { |
322 | const int size = sizeof(struct sg_iovec) * hdr->iovec_count; | 322 | const int size = sizeof(struct sg_iovec) * hdr->iovec_count; |
323 | size_t iov_data_len; | 323 | size_t iov_data_len; |
324 | struct sg_iovec *iov; | 324 | struct sg_iovec *sg_iov; |
325 | struct iovec *iov; | ||
326 | int i; | ||
325 | 327 | ||
326 | iov = kmalloc(size, GFP_KERNEL); | 328 | sg_iov = kmalloc(size, GFP_KERNEL); |
327 | if (!iov) { | 329 | if (!sg_iov) { |
328 | ret = -ENOMEM; | 330 | ret = -ENOMEM; |
329 | goto out; | 331 | goto out; |
330 | } | 332 | } |
331 | 333 | ||
332 | if (copy_from_user(iov, hdr->dxferp, size)) { | 334 | if (copy_from_user(sg_iov, hdr->dxferp, size)) { |
333 | kfree(iov); | 335 | kfree(sg_iov); |
334 | ret = -EFAULT; | 336 | ret = -EFAULT; |
335 | goto out; | 337 | goto out; |
336 | } | 338 | } |
337 | 339 | ||
340 | /* | ||
341 | * Sum up the vecs, making sure they don't overflow | ||
342 | */ | ||
343 | iov = (struct iovec *) sg_iov; | ||
344 | iov_data_len = 0; | ||
345 | for (i = 0; i < hdr->iovec_count; i++) { | ||
346 | if (iov_data_len + iov[i].iov_len < iov_data_len) { | ||
347 | kfree(sg_iov); | ||
348 | ret = -EINVAL; | ||
349 | goto out; | ||
350 | } | ||
351 | iov_data_len += iov[i].iov_len; | ||
352 | } | ||
353 | |||
338 | /* SG_IO howto says that the shorter of the two wins */ | 354 | /* SG_IO howto says that the shorter of the two wins */ |
339 | iov_data_len = iov_length((struct iovec *)iov, | ||
340 | hdr->iovec_count); | ||
341 | if (hdr->dxfer_len < iov_data_len) { | 355 | if (hdr->dxfer_len < iov_data_len) { |
342 | hdr->iovec_count = iov_shorten((struct iovec *)iov, | 356 | hdr->iovec_count = iov_shorten(iov, |
343 | hdr->iovec_count, | 357 | hdr->iovec_count, |
344 | hdr->dxfer_len); | 358 | hdr->dxfer_len); |
345 | iov_data_len = hdr->dxfer_len; | 359 | iov_data_len = hdr->dxfer_len; |
346 | } | 360 | } |
347 | 361 | ||
348 | ret = blk_rq_map_user_iov(q, rq, NULL, iov, hdr->iovec_count, | 362 | ret = blk_rq_map_user_iov(q, rq, NULL, sg_iov, hdr->iovec_count, |
349 | iov_data_len, GFP_KERNEL); | 363 | iov_data_len, GFP_KERNEL); |
350 | kfree(iov); | 364 | kfree(sg_iov); |
351 | } else if (hdr->dxfer_len) | 365 | } else if (hdr->dxfer_len) |
352 | ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, | 366 | ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, |
353 | GFP_KERNEL); | 367 | GFP_KERNEL); |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index d555b374e314..6b0b5d08d97a 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
300 | * we must enter this object into the namespace. The created | 300 | * we must enter this object into the namespace. The created |
301 | * object is temporary and will be deleted upon completion of | 301 | * object is temporary and will be deleted upon completion of |
302 | * the execution of this method. | 302 | * the execution of this method. |
303 | * | ||
304 | * Note 10/2010: Except for the Scope() op. This opcode does | ||
305 | * not actually create a new object, it refers to an existing | ||
306 | * object. However, for Scope(), we want to indeed open a | ||
307 | * new scope. | ||
303 | */ | 308 | */ |
304 | status = acpi_ds_load2_begin_op(walk_state, NULL); | 309 | if (op->common.aml_opcode != AML_SCOPE_OP) { |
310 | status = | ||
311 | acpi_ds_load2_begin_op(walk_state, NULL); | ||
312 | } else { | ||
313 | status = | ||
314 | acpi_ds_scope_stack_push(op->named.node, | ||
315 | op->named.node-> | ||
316 | type, walk_state); | ||
317 | if (ACPI_FAILURE(status)) { | ||
318 | return_ACPI_STATUS(status); | ||
319 | } | ||
320 | } | ||
305 | } | 321 | } |
306 | |||
307 | break; | 322 | break; |
308 | 323 | ||
309 | case AML_CLASS_EXECUTE: | 324 | case AML_CLASS_EXECUTE: |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 98417201e9ce..4c0a0a37d46e 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -98,6 +98,7 @@ enum { | |||
98 | * due to bad math. | 98 | * due to bad math. |
99 | */ | 99 | */ |
100 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, | 100 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, |
101 | ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, | ||
101 | }; | 102 | }; |
102 | 103 | ||
103 | struct acpi_battery { | 104 | struct acpi_battery { |
@@ -412,6 +413,8 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
412 | result = extract_package(battery, buffer.pointer, | 413 | result = extract_package(battery, buffer.pointer, |
413 | info_offsets, ARRAY_SIZE(info_offsets)); | 414 | info_offsets, ARRAY_SIZE(info_offsets)); |
414 | kfree(buffer.pointer); | 415 | kfree(buffer.pointer); |
416 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) | ||
417 | battery->full_charge_capacity = battery->design_capacity; | ||
415 | return result; | 418 | return result; |
416 | } | 419 | } |
417 | 420 | ||
@@ -448,6 +451,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
448 | battery->rate_now != -1) | 451 | battery->rate_now != -1) |
449 | battery->rate_now = abs((s16)battery->rate_now); | 452 | battery->rate_now = abs((s16)battery->rate_now); |
450 | 453 | ||
454 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | ||
455 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | ||
456 | battery->capacity_now = (battery->capacity_now * | ||
457 | battery->full_charge_capacity) / 100; | ||
451 | return result; | 458 | return result; |
452 | } | 459 | } |
453 | 460 | ||
@@ -561,6 +568,33 @@ static void acpi_battery_quirks(struct acpi_battery *battery) | |||
561 | } | 568 | } |
562 | } | 569 | } |
563 | 570 | ||
571 | /* | ||
572 | * According to the ACPI spec, some kinds of primary batteries can | ||
573 | * report percentage battery remaining capacity directly to OS. | ||
574 | * In this case, it reports the Last Full Charged Capacity == 100 | ||
575 | * and BatteryPresentRate == 0xFFFFFFFF. | ||
576 | * | ||
577 | * Now we found some battery reports percentage remaining capacity | ||
578 | * even if it's rechargeable. | ||
579 | * https://bugzilla.kernel.org/show_bug.cgi?id=15979 | ||
580 | * | ||
581 | * Handle this correctly so that they won't break userspace. | ||
582 | */ | ||
583 | static void acpi_battery_quirks2(struct acpi_battery *battery) | ||
584 | { | ||
585 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) | ||
586 | return ; | ||
587 | |||
588 | if (battery->full_charge_capacity == 100 && | ||
589 | battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN && | ||
590 | battery->capacity_now >=0 && battery->capacity_now <= 100) { | ||
591 | set_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags); | ||
592 | battery->full_charge_capacity = battery->design_capacity; | ||
593 | battery->capacity_now = (battery->capacity_now * | ||
594 | battery->full_charge_capacity) / 100; | ||
595 | } | ||
596 | } | ||
597 | |||
564 | static int acpi_battery_update(struct acpi_battery *battery) | 598 | static int acpi_battery_update(struct acpi_battery *battery) |
565 | { | 599 | { |
566 | int result, old_present = acpi_battery_present(battery); | 600 | int result, old_present = acpi_battery_present(battery); |
@@ -586,7 +620,9 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
586 | if (!battery->bat.dev) | 620 | if (!battery->bat.dev) |
587 | sysfs_add_battery(battery); | 621 | sysfs_add_battery(battery); |
588 | #endif | 622 | #endif |
589 | return acpi_battery_get_state(battery); | 623 | result = acpi_battery_get_state(battery); |
624 | acpi_battery_quirks2(battery); | ||
625 | return result; | ||
590 | } | 626 | } |
591 | 627 | ||
592 | /* -------------------------------------------------------------------------- | 628 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 310e3b9749cb..d68bd61072bb 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -935,6 +935,12 @@ static int __init acpi_bus_init(void) | |||
935 | goto error1; | 935 | goto error1; |
936 | } | 936 | } |
937 | 937 | ||
938 | /* | ||
939 | * _PDC control method may load dynamic SSDT tables, | ||
940 | * and we need to install the table handler before that. | ||
941 | */ | ||
942 | acpi_sysfs_init(); | ||
943 | |||
938 | acpi_early_processor_set_pdc(); | 944 | acpi_early_processor_set_pdc(); |
939 | 945 | ||
940 | /* | 946 | /* |
@@ -1026,7 +1032,6 @@ static int __init acpi_init(void) | |||
1026 | acpi_scan_init(); | 1032 | acpi_scan_init(); |
1027 | acpi_ec_init(); | 1033 | acpi_ec_init(); |
1028 | acpi_power_init(); | 1034 | acpi_power_init(); |
1029 | acpi_sysfs_init(); | ||
1030 | acpi_debugfs_init(); | 1035 | acpi_debugfs_init(); |
1031 | acpi_sleep_proc_init(); | 1036 | acpi_sleep_proc_init(); |
1032 | acpi_wakeup_device_init(); | 1037 | acpi_wakeup_device_init(); |
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c index 7de27d49c4b9..74c4a398604a 100644 --- a/drivers/acpi/debugfs.c +++ b/drivers/acpi/debugfs.c | |||
@@ -79,7 +79,7 @@ int __init acpi_debugfs_init(void) | |||
79 | if (!acpi_dir) | 79 | if (!acpi_dir) |
80 | goto err; | 80 | goto err; |
81 | 81 | ||
82 | cm_dentry = debugfs_create_file("custom_method", S_IWUGO, | 82 | cm_dentry = debugfs_create_file("custom_method", S_IWUSR, |
83 | acpi_dir, NULL, &cm_fops); | 83 | acpi_dir, NULL, &cm_fops); |
84 | if (!cm_dentry) | 84 | if (!cm_dentry) |
85 | goto err; | 85 | goto err; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index f31291ba94d0..7bff18b33089 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -929,6 +929,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { | |||
929 | ec_flag_msi, "MSI hardware", { | 929 | ec_flag_msi, "MSI hardware", { |
930 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, | 930 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, |
931 | { | 931 | { |
932 | ec_flag_msi, "MSI hardware", { | ||
933 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, | ||
934 | { | ||
932 | ec_validate_ecdt, "ASUS hardware", { | 935 | ec_validate_ecdt, "ASUS hardware", { |
933 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, | 936 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, |
934 | {}, | 937 | {}, |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index e5fdeebf9ef0..d1a0f5bfdfeb 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -72,6 +72,7 @@ enum { | |||
72 | AHCI_CMD_RESET = (1 << 8), | 72 | AHCI_CMD_RESET = (1 << 8), |
73 | AHCI_CMD_CLR_BUSY = (1 << 10), | 73 | AHCI_CMD_CLR_BUSY = (1 << 10), |
74 | 74 | ||
75 | RX_FIS_PIO_SETUP = 0x20, /* offset of PIO Setup FIS data */ | ||
75 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ | 76 | RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ |
76 | RX_FIS_SDB = 0x58, /* offset of SDB FIS data */ | 77 | RX_FIS_SDB = 0x58, /* offset of SDB FIS data */ |
77 | RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ | 78 | RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 8eea309ea212..137514dbbf65 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1830,12 +1830,24 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
1830 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | 1830 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) |
1831 | { | 1831 | { |
1832 | struct ahci_port_priv *pp = qc->ap->private_data; | 1832 | struct ahci_port_priv *pp = qc->ap->private_data; |
1833 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 1833 | u8 *rx_fis = pp->rx_fis; |
1834 | 1834 | ||
1835 | if (pp->fbs_enabled) | 1835 | if (pp->fbs_enabled) |
1836 | d2h_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; | 1836 | rx_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; |
1837 | |||
1838 | /* | ||
1839 | * After a successful execution of an ATA PIO data-in command, | ||
1840 | * the device doesn't send D2H Reg FIS to update the TF and | ||
1841 | * the host should take TF and E_Status from the preceding PIO | ||
1842 | * Setup FIS. | ||
1843 | */ | ||
1844 | if (qc->tf.protocol == ATA_PROT_PIO && qc->dma_dir == DMA_FROM_DEVICE && | ||
1845 | !(qc->flags & ATA_QCFLAG_FAILED)) { | ||
1846 | ata_tf_from_fis(rx_fis + RX_FIS_PIO_SETUP, &qc->result_tf); | ||
1847 | qc->result_tf.command = (rx_fis + RX_FIS_PIO_SETUP)[15]; | ||
1848 | } else | ||
1849 | ata_tf_from_fis(rx_fis + RX_FIS_D2H_REG, &qc->result_tf); | ||
1837 | 1850 | ||
1838 | ata_tf_from_fis(d2h_fis, &qc->result_tf); | ||
1839 | return true; | 1851 | return true; |
1840 | } | 1852 | } |
1841 | 1853 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index a89172c100f5..7bb6787de550 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2577,8 +2577,11 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2577 | * | 2577 | * |
2578 | * If door lock fails, always clear sdev->locked to | 2578 | * If door lock fails, always clear sdev->locked to |
2579 | * avoid this infinite loop. | 2579 | * avoid this infinite loop. |
2580 | * | ||
2581 | * This may happen before SCSI scan is complete. Make | ||
2582 | * sure qc->dev->sdev isn't NULL before dereferencing. | ||
2580 | */ | 2583 | */ |
2581 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) | 2584 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) |
2582 | qc->dev->sdev->locked = 0; | 2585 | qc->dev->sdev->locked = 0; |
2583 | 2586 | ||
2584 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; | 2587 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index e30c537cce32..c55988b4f900 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1532,11 +1532,10 @@ static unsigned int __ata_sff_port_intr(struct ata_port *ap, | |||
1532 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | 1532 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
1533 | return ata_sff_idle_irq(ap); | 1533 | return ata_sff_idle_irq(ap); |
1534 | break; | 1534 | break; |
1535 | case HSM_ST: | 1535 | case HSM_ST_IDLE: |
1536 | case HSM_ST_LAST: | ||
1537 | break; | ||
1538 | default: | ||
1539 | return ata_sff_idle_irq(ap); | 1536 | return ata_sff_idle_irq(ap); |
1537 | default: | ||
1538 | break; | ||
1540 | } | 1539 | } |
1541 | 1540 | ||
1542 | /* check main status, clearing INTRQ if needed */ | 1541 | /* check main status, clearing INTRQ if needed */ |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 8cc536e49a0a..d7d8026cde99 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -610,7 +610,7 @@ static struct scsi_host_template mpc52xx_ata_sht = { | |||
610 | }; | 610 | }; |
611 | 611 | ||
612 | static struct ata_port_operations mpc52xx_ata_port_ops = { | 612 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
613 | .inherits = &ata_sff_port_ops, | 613 | .inherits = &ata_bmdma_port_ops, |
614 | .sff_dev_select = mpc52xx_ata_dev_select, | 614 | .sff_dev_select = mpc52xx_ata_dev_select, |
615 | .set_piomode = mpc52xx_ata_set_piomode, | 615 | .set_piomode = mpc52xx_ata_set_piomode, |
616 | .set_dmamode = mpc52xx_ata_set_dmamode, | 616 | .set_dmamode = mpc52xx_ata_set_dmamode, |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 4730c42a5ee5..c51b8d25cfa8 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -538,7 +538,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | static void svia_configure(struct pci_dev *pdev) | 541 | static void svia_configure(struct pci_dev *pdev, int board_id) |
542 | { | 542 | { |
543 | u8 tmp8; | 543 | u8 tmp8; |
544 | 544 | ||
@@ -577,7 +577,7 @@ static void svia_configure(struct pci_dev *pdev) | |||
577 | } | 577 | } |
578 | 578 | ||
579 | /* | 579 | /* |
580 | * vt6421 has problems talking to some drives. The following | 580 | * vt6420/1 has problems talking to some drives. The following |
581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. | 581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. |
582 | * | 582 | * |
583 | * When host issues HOLD, device may send up to 20DW of data | 583 | * When host issues HOLD, device may send up to 20DW of data |
@@ -596,8 +596,9 @@ static void svia_configure(struct pci_dev *pdev) | |||
596 | * | 596 | * |
597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 | 597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 |
598 | * http://article.gmane.org/gmane.linux.ide/46352 | 598 | * http://article.gmane.org/gmane.linux.ide/46352 |
599 | * http://thread.gmane.org/gmane.linux.kernel/1062139 | ||
599 | */ | 600 | */ |
600 | if (pdev->device == 0x3249) { | 601 | if (board_id == vt6420 || board_id == vt6421) { |
601 | pci_read_config_byte(pdev, 0x52, &tmp8); | 602 | pci_read_config_byte(pdev, 0x52, &tmp8); |
602 | tmp8 |= 1 << 2; | 603 | tmp8 |= 1 << 2; |
603 | pci_write_config_byte(pdev, 0x52, tmp8); | 604 | pci_write_config_byte(pdev, 0x52, tmp8); |
@@ -652,7 +653,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
652 | if (rc) | 653 | if (rc) |
653 | return rc; | 654 | return rc; |
654 | 655 | ||
655 | svia_configure(pdev); | 656 | svia_configure(pdev, board_id); |
656 | 657 | ||
657 | pci_set_master(pdev); | 658 | pci_set_master(pdev); |
658 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, | 659 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index ab735a605cf3..d773397575db 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -71,7 +71,7 @@ struct blk_shadow { | |||
71 | 71 | ||
72 | static const struct block_device_operations xlvbd_block_fops; | 72 | static const struct block_device_operations xlvbd_block_fops; |
73 | 73 | ||
74 | #define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) | 74 | #define BLK_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE) |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * We have one of these per vbd, whether ide, scsi or 'other'. They | 77 | * We have one of these per vbd, whether ide, scsi or 'other'. They |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 998833d93c13..17361bad46dd 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -256,9 +256,16 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
256 | 256 | ||
257 | BT_DBG("tty %p", tty); | 257 | BT_DBG("tty %p", tty); |
258 | 258 | ||
259 | /* FIXME: This btw is bogus, nothing requires the old ldisc to clear | ||
260 | the pointer */ | ||
259 | if (hu) | 261 | if (hu) |
260 | return -EEXIST; | 262 | return -EEXIST; |
261 | 263 | ||
264 | /* Error if the tty has no write op instead of leaving an exploitable | ||
265 | hole */ | ||
266 | if (tty->ops->write == NULL) | ||
267 | return -EOPNOTSUPP; | ||
268 | |||
262 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { | 269 | if (!(hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL))) { |
263 | BT_ERR("Can't allocate control structure"); | 270 | BT_ERR("Can't allocate control structure"); |
264 | return -ENFILE; | 271 | return -ENFILE; |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index cd18493c9527..aa5c782bf015 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -927,20 +927,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
927 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); | 927 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
928 | 928 | ||
929 | /* | 929 | /* |
930 | * If the device has not been properly setup, the following will catch | ||
931 | * the problem and should stop the system from crashing. | ||
932 | * 20030610 - hamish@zot.org | ||
933 | */ | ||
934 | if (pci_enable_device(pdev)) { | ||
935 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
936 | agp_put_bridge(bridge); | ||
937 | return -ENODEV; | ||
938 | } | ||
939 | |||
940 | /* | ||
941 | * The following fixes the case where the BIOS has "forgotten" to | 930 | * The following fixes the case where the BIOS has "forgotten" to |
942 | * provide an address range for the GART. | 931 | * provide an address range for the GART. |
943 | * 20030610 - hamish@zot.org | 932 | * 20030610 - hamish@zot.org |
933 | * This happens before pci_enable_device() intentionally; | ||
934 | * calling pci_enable_device() before assigning the resource | ||
935 | * will result in the GART being disabled on machines with such | ||
936 | * BIOSs (the GART ends up with a BAR starting at 0, which | ||
937 | * conflicts a lot of other devices). | ||
944 | */ | 938 | */ |
945 | r = &pdev->resource[0]; | 939 | r = &pdev->resource[0]; |
946 | if (!r->start && r->end) { | 940 | if (!r->start && r->end) { |
@@ -951,6 +945,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
951 | } | 945 | } |
952 | } | 946 | } |
953 | 947 | ||
948 | /* | ||
949 | * If the device has not been properly setup, the following will catch | ||
950 | * the problem and should stop the system from crashing. | ||
951 | * 20030610 - hamish@zot.org | ||
952 | */ | ||
953 | if (pci_enable_device(pdev)) { | ||
954 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
955 | agp_put_bridge(bridge); | ||
956 | return -ENODEV; | ||
957 | } | ||
958 | |||
954 | /* Fill in the mode register */ | 959 | /* Fill in the mode register */ |
955 | if (cap_ptr) { | 960 | if (cap_ptr) { |
956 | pci_read_config_dword(pdev, | 961 | pci_read_config_dword(pdev, |
@@ -1049,6 +1054,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
1049 | ID(PCI_DEVICE_ID_INTEL_G45_HB), | 1054 | ID(PCI_DEVICE_ID_INTEL_G45_HB), |
1050 | ID(PCI_DEVICE_ID_INTEL_G41_HB), | 1055 | ID(PCI_DEVICE_ID_INTEL_G41_HB), |
1051 | ID(PCI_DEVICE_ID_INTEL_B43_HB), | 1056 | ID(PCI_DEVICE_ID_INTEL_B43_HB), |
1057 | ID(PCI_DEVICE_ID_INTEL_B43_1_HB), | ||
1052 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), | 1058 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), |
1053 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), | 1059 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), |
1054 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), | 1060 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 75e0a3497888..6ea3bf6e5b1a 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -534,7 +534,7 @@ static void intel_i830_init_gtt_entries(void) | |||
534 | 534 | ||
535 | pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); | 535 | pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); |
536 | 536 | ||
537 | if (IS_I965) { | 537 | if (IS_G33 || IS_I965) { |
538 | u32 pgetbl_ctl; | 538 | u32 pgetbl_ctl; |
539 | pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); | 539 | pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); |
540 | 540 | ||
@@ -567,22 +567,6 @@ static void intel_i830_init_gtt_entries(void) | |||
567 | size = 512; | 567 | size = 512; |
568 | } | 568 | } |
569 | size += 4; /* add in BIOS popup space */ | 569 | size += 4; /* add in BIOS popup space */ |
570 | } else if (IS_G33 && !IS_PINEVIEW) { | ||
571 | /* G33's GTT size defined in gmch_ctrl */ | ||
572 | switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { | ||
573 | case G33_PGETBL_SIZE_1M: | ||
574 | size = 1024; | ||
575 | break; | ||
576 | case G33_PGETBL_SIZE_2M: | ||
577 | size = 2048; | ||
578 | break; | ||
579 | default: | ||
580 | dev_info(&agp_bridge->dev->dev, | ||
581 | "unknown page table size 0x%x, assuming 512KB\n", | ||
582 | (gmch_ctrl & G33_PGETBL_SIZE_MASK)); | ||
583 | size = 512; | ||
584 | } | ||
585 | size += 4; | ||
586 | } else if (IS_G4X || IS_PINEVIEW) { | 570 | } else if (IS_G4X || IS_PINEVIEW) { |
587 | /* On 4 series hardware, GTT stolen is separate from graphics | 571 | /* On 4 series hardware, GTT stolen is separate from graphics |
588 | * stolen, ignore it in stolen gtt entries counting. However, | 572 | * stolen, ignore it in stolen gtt entries counting. However, |
@@ -1257,24 +1241,31 @@ static int intel_i915_get_gtt_size(void) | |||
1257 | int size; | 1241 | int size; |
1258 | 1242 | ||
1259 | if (IS_G33) { | 1243 | if (IS_G33) { |
1260 | u16 gmch_ctrl; | 1244 | u32 pgetbl_ctl; |
1245 | pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); | ||
1261 | 1246 | ||
1262 | /* G33's GTT size defined in gmch_ctrl */ | 1247 | switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) { |
1263 | pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); | 1248 | case I965_PGETBL_SIZE_128KB: |
1264 | switch (gmch_ctrl & I830_GMCH_GMS_MASK) { | 1249 | size = 128; |
1265 | case I830_GMCH_GMS_STOLEN_512: | 1250 | break; |
1251 | case I965_PGETBL_SIZE_256KB: | ||
1252 | size = 256; | ||
1253 | break; | ||
1254 | case I965_PGETBL_SIZE_512KB: | ||
1266 | size = 512; | 1255 | size = 512; |
1267 | break; | 1256 | break; |
1268 | case I830_GMCH_GMS_STOLEN_1024: | 1257 | case I965_PGETBL_SIZE_1MB: |
1269 | size = 1024; | 1258 | size = 1024; |
1270 | break; | 1259 | break; |
1271 | case I830_GMCH_GMS_STOLEN_8192: | 1260 | case I965_PGETBL_SIZE_2MB: |
1272 | size = 8*1024; | 1261 | size = 2048; |
1262 | break; | ||
1263 | case I965_PGETBL_SIZE_1_5MB: | ||
1264 | size = 1024 + 512; | ||
1273 | break; | 1265 | break; |
1274 | default: | 1266 | default: |
1275 | dev_info(&agp_bridge->dev->dev, | 1267 | dev_info(&intel_private.pcidev->dev, |
1276 | "unknown page table size 0x%x, assuming 512KB\n", | 1268 | "unknown page table size, assuming 512KB\n"); |
1277 | (gmch_ctrl & I830_GMCH_GMS_MASK)); | ||
1278 | size = 512; | 1269 | size = 512; |
1279 | } | 1270 | } |
1280 | } else { | 1271 | } else { |
@@ -1306,14 +1297,6 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
1306 | pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); | 1297 | pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); |
1307 | pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); | 1298 | pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); |
1308 | 1299 | ||
1309 | gtt_map_size = intel_i915_get_gtt_size(); | ||
1310 | |||
1311 | intel_private.gtt = ioremap(temp2, gtt_map_size); | ||
1312 | if (!intel_private.gtt) | ||
1313 | return -ENOMEM; | ||
1314 | |||
1315 | intel_private.gtt_total_size = gtt_map_size / 4; | ||
1316 | |||
1317 | temp &= 0xfff80000; | 1300 | temp &= 0xfff80000; |
1318 | 1301 | ||
1319 | intel_private.registers = ioremap(temp, 128 * 4096); | 1302 | intel_private.registers = ioremap(temp, 128 * 4096); |
@@ -1322,6 +1305,14 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
1322 | return -ENOMEM; | 1305 | return -ENOMEM; |
1323 | } | 1306 | } |
1324 | 1307 | ||
1308 | gtt_map_size = intel_i915_get_gtt_size(); | ||
1309 | |||
1310 | intel_private.gtt = ioremap(temp2, gtt_map_size); | ||
1311 | if (!intel_private.gtt) | ||
1312 | return -ENOMEM; | ||
1313 | |||
1314 | intel_private.gtt_total_size = gtt_map_size / 4; | ||
1315 | |||
1325 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; | 1316 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; |
1326 | global_cache_flush(); /* FIXME: ? */ | 1317 | global_cache_flush(); /* FIXME: ? */ |
1327 | 1318 | ||
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index a0a1829d3198..f8e7d89ceb2c 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -479,6 +479,21 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
479 | if (irq) { | 479 | if (irq) { |
480 | unsigned long irq_flags; | 480 | unsigned long irq_flags; |
481 | 481 | ||
482 | if (devp->hd_flags & HPET_SHARED_IRQ) { | ||
483 | /* | ||
484 | * To prevent the interrupt handler from seeing an | ||
485 | * unwanted interrupt status bit, program the timer | ||
486 | * so that it will not fire in the near future ... | ||
487 | */ | ||
488 | writel(readl(&timer->hpet_config) & ~Tn_TYPE_CNF_MASK, | ||
489 | &timer->hpet_config); | ||
490 | write_counter(read_counter(&hpet->hpet_mc), | ||
491 | &timer->hpet_compare); | ||
492 | /* ... and clear any left-over status. */ | ||
493 | isr = 1 << (devp - devp->hd_hpets->hp_dev); | ||
494 | writel(isr, &hpet->hpet_isr); | ||
495 | } | ||
496 | |||
482 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); | 497 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); |
483 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ | 498 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ |
484 | ? IRQF_SHARED : IRQF_DISABLED; | 499 | ? IRQF_SHARED : IRQF_DISABLED; |
@@ -970,6 +985,8 @@ static int hpet_acpi_add(struct acpi_device *device) | |||
970 | return -ENODEV; | 985 | return -ENODEV; |
971 | 986 | ||
972 | if (!data.hd_address || !data.hd_nirqs) { | 987 | if (!data.hd_address || !data.hd_nirqs) { |
988 | if (data.hd_address) | ||
989 | iounmap(data.hd_address); | ||
973 | printk("%s: no address or irqs in _CRS\n", __func__); | 990 | printk("%s: no address or irqs in _CRS\n", __func__); |
974 | return -ENODEV; | 991 | return -ENODEV; |
975 | } | 992 | } |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 7bd7c45b53ef..22abd188fe12 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -320,6 +320,7 @@ static int unload_when_empty = 1; | |||
320 | static int add_smi(struct smi_info *smi); | 320 | static int add_smi(struct smi_info *smi); |
321 | static int try_smi_init(struct smi_info *smi); | 321 | static int try_smi_init(struct smi_info *smi); |
322 | static void cleanup_one_si(struct smi_info *to_clean); | 322 | static void cleanup_one_si(struct smi_info *to_clean); |
323 | static void cleanup_ipmi_si(void); | ||
323 | 324 | ||
324 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); | 325 | static ATOMIC_NOTIFIER_HEAD(xaction_notifier_list); |
325 | static int register_xaction_notifier(struct notifier_block *nb) | 326 | static int register_xaction_notifier(struct notifier_block *nb) |
@@ -1665,6 +1666,17 @@ static int check_hotmod_int_op(const char *curr, const char *option, | |||
1665 | return 0; | 1666 | return 0; |
1666 | } | 1667 | } |
1667 | 1668 | ||
1669 | static struct smi_info *smi_info_alloc(void) | ||
1670 | { | ||
1671 | struct smi_info *info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
1672 | |||
1673 | if (info) { | ||
1674 | spin_lock_init(&info->si_lock); | ||
1675 | spin_lock_init(&info->msg_lock); | ||
1676 | } | ||
1677 | return info; | ||
1678 | } | ||
1679 | |||
1668 | static int hotmod_handler(const char *val, struct kernel_param *kp) | 1680 | static int hotmod_handler(const char *val, struct kernel_param *kp) |
1669 | { | 1681 | { |
1670 | char *str = kstrdup(val, GFP_KERNEL); | 1682 | char *str = kstrdup(val, GFP_KERNEL); |
@@ -1779,7 +1791,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) | |||
1779 | } | 1791 | } |
1780 | 1792 | ||
1781 | if (op == HM_ADD) { | 1793 | if (op == HM_ADD) { |
1782 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 1794 | info = smi_info_alloc(); |
1783 | if (!info) { | 1795 | if (!info) { |
1784 | rv = -ENOMEM; | 1796 | rv = -ENOMEM; |
1785 | goto out; | 1797 | goto out; |
@@ -1844,7 +1856,7 @@ static __devinit void hardcode_find_bmc(void) | |||
1844 | if (!ports[i] && !addrs[i]) | 1856 | if (!ports[i] && !addrs[i]) |
1845 | continue; | 1857 | continue; |
1846 | 1858 | ||
1847 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 1859 | info = smi_info_alloc(); |
1848 | if (!info) | 1860 | if (!info) |
1849 | return; | 1861 | return; |
1850 | 1862 | ||
@@ -2028,7 +2040,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) | |||
2028 | return -ENODEV; | 2040 | return -ENODEV; |
2029 | } | 2041 | } |
2030 | 2042 | ||
2031 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2043 | info = smi_info_alloc(); |
2032 | if (!info) { | 2044 | if (!info) { |
2033 | printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); | 2045 | printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); |
2034 | return -ENOMEM; | 2046 | return -ENOMEM; |
@@ -2138,7 +2150,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2138 | if (!acpi_dev) | 2150 | if (!acpi_dev) |
2139 | return -ENODEV; | 2151 | return -ENODEV; |
2140 | 2152 | ||
2141 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2153 | info = smi_info_alloc(); |
2142 | if (!info) | 2154 | if (!info) |
2143 | return -ENOMEM; | 2155 | return -ENOMEM; |
2144 | 2156 | ||
@@ -2319,7 +2331,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data) | |||
2319 | { | 2331 | { |
2320 | struct smi_info *info; | 2332 | struct smi_info *info; |
2321 | 2333 | ||
2322 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2334 | info = smi_info_alloc(); |
2323 | if (!info) { | 2335 | if (!info) { |
2324 | printk(KERN_ERR PFX "Could not allocate SI data\n"); | 2336 | printk(KERN_ERR PFX "Could not allocate SI data\n"); |
2325 | return; | 2337 | return; |
@@ -2426,7 +2438,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
2426 | int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK; | 2438 | int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK; |
2427 | struct smi_info *info; | 2439 | struct smi_info *info; |
2428 | 2440 | ||
2429 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2441 | info = smi_info_alloc(); |
2430 | if (!info) | 2442 | if (!info) |
2431 | return -ENOMEM; | 2443 | return -ENOMEM; |
2432 | 2444 | ||
@@ -2567,7 +2579,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev, | |||
2567 | return -EINVAL; | 2579 | return -EINVAL; |
2568 | } | 2580 | } |
2569 | 2581 | ||
2570 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 2582 | info = smi_info_alloc(); |
2571 | 2583 | ||
2572 | if (!info) { | 2584 | if (!info) { |
2573 | dev_err(&dev->dev, | 2585 | dev_err(&dev->dev, |
@@ -3014,7 +3026,7 @@ static __devinit void default_find_bmc(void) | |||
3014 | if (check_legacy_ioport(ipmi_defaults[i].port)) | 3026 | if (check_legacy_ioport(ipmi_defaults[i].port)) |
3015 | continue; | 3027 | continue; |
3016 | #endif | 3028 | #endif |
3017 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 3029 | info = smi_info_alloc(); |
3018 | if (!info) | 3030 | if (!info) |
3019 | return; | 3031 | return; |
3020 | 3032 | ||
@@ -3139,9 +3151,6 @@ static int try_smi_init(struct smi_info *new_smi) | |||
3139 | goto out_err; | 3151 | goto out_err; |
3140 | } | 3152 | } |
3141 | 3153 | ||
3142 | spin_lock_init(&(new_smi->si_lock)); | ||
3143 | spin_lock_init(&(new_smi->msg_lock)); | ||
3144 | |||
3145 | /* Do low-level detection first. */ | 3154 | /* Do low-level detection first. */ |
3146 | if (new_smi->handlers->detect(new_smi->si_sm)) { | 3155 | if (new_smi->handlers->detect(new_smi->si_sm)) { |
3147 | if (new_smi->addr_source) | 3156 | if (new_smi->addr_source) |
@@ -3428,16 +3437,7 @@ static __devinit int init_ipmi_si(void) | |||
3428 | mutex_lock(&smi_infos_lock); | 3437 | mutex_lock(&smi_infos_lock); |
3429 | if (unload_when_empty && list_empty(&smi_infos)) { | 3438 | if (unload_when_empty && list_empty(&smi_infos)) { |
3430 | mutex_unlock(&smi_infos_lock); | 3439 | mutex_unlock(&smi_infos_lock); |
3431 | #ifdef CONFIG_PCI | 3440 | cleanup_ipmi_si(); |
3432 | if (pci_registered) | ||
3433 | pci_unregister_driver(&ipmi_pci_driver); | ||
3434 | #endif | ||
3435 | |||
3436 | #ifdef CONFIG_PPC_OF | ||
3437 | if (of_registered) | ||
3438 | of_unregister_platform_driver(&ipmi_of_platform_driver); | ||
3439 | #endif | ||
3440 | driver_unregister(&ipmi_driver.driver); | ||
3441 | printk(KERN_WARNING PFX | 3441 | printk(KERN_WARNING PFX |
3442 | "Unable to find any System Interface(s)\n"); | 3442 | "Unable to find any System Interface(s)\n"); |
3443 | return -ENODEV; | 3443 | return -ENODEV; |
diff --git a/drivers/char/n_gsm.c b/drivers/char/n_gsm.c index 04ef3ef0a422..0e62674072eb 100644 --- a/drivers/char/n_gsm.c +++ b/drivers/char/n_gsm.c | |||
@@ -716,8 +716,8 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg) | |||
716 | if (msg->len < 128) | 716 | if (msg->len < 128) |
717 | *--dp = (msg->len << 1) | EA; | 717 | *--dp = (msg->len << 1) | EA; |
718 | else { | 718 | else { |
719 | *--dp = (msg->len >> 6) | EA; | 719 | *--dp = (msg->len >> 7); /* bits 7 - 15 */ |
720 | *--dp = (msg->len & 127) << 1; | 720 | *--dp = (msg->len & 127) << 1; /* bits 0 - 6 */ |
721 | } | 721 | } |
722 | } | 722 | } |
723 | 723 | ||
@@ -968,6 +968,8 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data, | |||
968 | { | 968 | { |
969 | struct gsm_msg *msg; | 969 | struct gsm_msg *msg; |
970 | msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype); | 970 | msg = gsm_data_alloc(gsm, 0, dlen + 2, gsm->ftype); |
971 | if (msg == NULL) | ||
972 | return; | ||
971 | msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ | 973 | msg->data[0] = (cmd & 0xFE) << 1 | EA; /* Clear C/R */ |
972 | msg->data[1] = (dlen << 1) | EA; | 974 | msg->data[1] = (dlen << 1) | EA; |
973 | memcpy(msg->data + 2, data, dlen); | 975 | memcpy(msg->data + 2, data, dlen); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 9ecd6bef5d3b..45f9fad4f5dc 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -4127,6 +4127,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
4127 | if (cmd != SIOCWANDEV) | 4127 | if (cmd != SIOCWANDEV) |
4128 | return hdlc_ioctl(dev, ifr, cmd); | 4128 | return hdlc_ioctl(dev, ifr, cmd); |
4129 | 4129 | ||
4130 | memset(&new_line, 0, size); | ||
4131 | |||
4130 | switch(ifr->ifr_settings.type) { | 4132 | switch(ifr->ifr_settings.type) { |
4131 | case IF_GET_IFACE: /* return current sync_serial_settings */ | 4133 | case IF_GET_IFACE: /* return current sync_serial_settings */ |
4132 | 4134 | ||
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 74f00b5ffa36..9445f48c692f 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | 28 | ||
29 | #define RAMOOPS_KERNMSG_HDR "====" | 29 | #define RAMOOPS_KERNMSG_HDR "====" |
30 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) | ||
31 | 30 | ||
32 | #define RECORD_SIZE 4096 | 31 | #define RECORD_SIZE 4096 |
33 | 32 | ||
@@ -63,8 +62,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
63 | struct ramoops_context, dump); | 62 | struct ramoops_context, dump); |
64 | unsigned long s1_start, s2_start; | 63 | unsigned long s1_start, s2_start; |
65 | unsigned long l1_cpy, l2_cpy; | 64 | unsigned long l1_cpy, l2_cpy; |
66 | int res; | 65 | int res, hdr_size; |
67 | char *buf; | 66 | char *buf, *buf_orig; |
68 | struct timeval timestamp; | 67 | struct timeval timestamp; |
69 | 68 | ||
70 | /* Only dump oopses if dump_oops is set */ | 69 | /* Only dump oopses if dump_oops is set */ |
@@ -72,6 +71,8 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
72 | return; | 71 | return; |
73 | 72 | ||
74 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); | 73 | buf = (char *)(cxt->virt_addr + (cxt->count * RECORD_SIZE)); |
74 | buf_orig = buf; | ||
75 | |||
75 | memset(buf, '\0', RECORD_SIZE); | 76 | memset(buf, '\0', RECORD_SIZE); |
76 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); | 77 | res = sprintf(buf, "%s", RAMOOPS_KERNMSG_HDR); |
77 | buf += res; | 78 | buf += res; |
@@ -79,8 +80,9 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
79 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); | 80 | res = sprintf(buf, "%lu.%lu\n", (long)timestamp.tv_sec, (long)timestamp.tv_usec); |
80 | buf += res; | 81 | buf += res; |
81 | 82 | ||
82 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE)); | 83 | hdr_size = buf - buf_orig; |
83 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - RAMOOPS_HEADER_SIZE) - l2_cpy); | 84 | l2_cpy = min(l2, (unsigned long)(RECORD_SIZE - hdr_size)); |
85 | l1_cpy = min(l1, (unsigned long)(RECORD_SIZE - hdr_size) - l2_cpy); | ||
84 | 86 | ||
85 | s2_start = l2 - l2_cpy; | 87 | s2_start = l2 - l2_cpy; |
86 | s1_start = l1 - l1_cpy; | 88 | s1_start = l1 - l1_cpy; |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 05ad4a17a28f..2ec5f33cdbd0 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -354,12 +354,14 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, | |||
354 | tpm_protected_ordinal_duration[ordinal & | 354 | tpm_protected_ordinal_duration[ordinal & |
355 | TPM_PROTECTED_ORDINAL_MASK]; | 355 | TPM_PROTECTED_ORDINAL_MASK]; |
356 | 356 | ||
357 | if (duration_idx != TPM_UNDEFINED) | 357 | if (duration_idx != TPM_UNDEFINED) { |
358 | duration = chip->vendor.duration[duration_idx]; | 358 | duration = chip->vendor.duration[duration_idx]; |
359 | if (duration <= 0) | 359 | /* if duration is 0, it's because chip->vendor.duration wasn't */ |
360 | /* filled yet, so we set the lowest timeout just to give enough */ | ||
361 | /* time for tpm_get_timeouts() to succeed */ | ||
362 | return (duration <= 0 ? HZ : duration); | ||
363 | } else | ||
360 | return 2 * 60 * HZ; | 364 | return 2 * 60 * HZ; |
361 | else | ||
362 | return duration; | ||
363 | } | 365 | } |
364 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | 366 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
365 | 367 | ||
@@ -565,9 +567,11 @@ duration: | |||
565 | if (rc) | 567 | if (rc) |
566 | return; | 568 | return; |
567 | 569 | ||
568 | if (be32_to_cpu(tpm_cmd.header.out.return_code) | 570 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || |
569 | != 3 * sizeof(u32)) | 571 | be32_to_cpu(tpm_cmd.header.out.length) |
572 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | ||
570 | return; | 573 | return; |
574 | |||
571 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 575 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
572 | chip->vendor.duration[TPM_SHORT] = | 576 | chip->vendor.duration[TPM_SHORT] = |
573 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); | 577 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |
@@ -911,6 +915,18 @@ ssize_t tpm_show_caps_1_2(struct device * dev, | |||
911 | } | 915 | } |
912 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); | 916 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); |
913 | 917 | ||
918 | ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, | ||
919 | char *buf) | ||
920 | { | ||
921 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
922 | |||
923 | return sprintf(buf, "%d %d %d\n", | ||
924 | jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), | ||
925 | jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), | ||
926 | jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); | ||
927 | } | ||
928 | EXPORT_SYMBOL_GPL(tpm_show_timeouts); | ||
929 | |||
914 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | 930 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
915 | const char *buf, size_t count) | 931 | const char *buf, size_t count) |
916 | { | 932 | { |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 792868d24f2a..ba1779c2cffd 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -56,6 +56,8 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, | |||
56 | char *); | 56 | char *); |
57 | extern ssize_t tpm_show_temp_deactivated(struct device *, | 57 | extern ssize_t tpm_show_temp_deactivated(struct device *, |
58 | struct device_attribute *attr, char *); | 58 | struct device_attribute *attr, char *); |
59 | extern ssize_t tpm_show_timeouts(struct device *, | ||
60 | struct device_attribute *attr, char *); | ||
59 | 61 | ||
60 | struct tpm_chip; | 62 | struct tpm_chip; |
61 | 63 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 1030f8420137..3e1f2bbeec11 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/wait.h> | 27 | #include <linux/wait.h> |
28 | #include <linux/acpi.h> | ||
28 | #include "tpm.h" | 29 | #include "tpm.h" |
29 | 30 | ||
30 | #define TPM_HEADER_SIZE 10 | 31 | #define TPM_HEADER_SIZE 10 |
@@ -78,6 +79,26 @@ enum tis_defaults { | |||
78 | static LIST_HEAD(tis_chips); | 79 | static LIST_HEAD(tis_chips); |
79 | static DEFINE_SPINLOCK(tis_lock); | 80 | static DEFINE_SPINLOCK(tis_lock); |
80 | 81 | ||
82 | #ifdef CONFIG_ACPI | ||
83 | static int is_itpm(struct pnp_dev *dev) | ||
84 | { | ||
85 | struct acpi_device *acpi = pnp_acpi_device(dev); | ||
86 | struct acpi_hardware_id *id; | ||
87 | |||
88 | list_for_each_entry(id, &acpi->pnp.ids, list) { | ||
89 | if (!strcmp("INTC0102", id->id)) | ||
90 | return 1; | ||
91 | } | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | #else | ||
96 | static int is_itpm(struct pnp_dev *dev) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | #endif | ||
101 | |||
81 | static int check_locality(struct tpm_chip *chip, int l) | 102 | static int check_locality(struct tpm_chip *chip, int l) |
82 | { | 103 | { |
83 | if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & | 104 | if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & |
@@ -355,6 +376,7 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, | |||
355 | NULL); | 376 | NULL); |
356 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); | 377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); |
357 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | 378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
379 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); | ||
358 | 380 | ||
359 | static struct attribute *tis_attrs[] = { | 381 | static struct attribute *tis_attrs[] = { |
360 | &dev_attr_pubek.attr, | 382 | &dev_attr_pubek.attr, |
@@ -364,7 +386,8 @@ static struct attribute *tis_attrs[] = { | |||
364 | &dev_attr_owned.attr, | 386 | &dev_attr_owned.attr, |
365 | &dev_attr_temp_deactivated.attr, | 387 | &dev_attr_temp_deactivated.attr, |
366 | &dev_attr_caps.attr, | 388 | &dev_attr_caps.attr, |
367 | &dev_attr_cancel.attr, NULL, | 389 | &dev_attr_cancel.attr, |
390 | &dev_attr_timeouts.attr, NULL, | ||
368 | }; | 391 | }; |
369 | 392 | ||
370 | static struct attribute_group tis_attr_grp = { | 393 | static struct attribute_group tis_attr_grp = { |
@@ -472,6 +495,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
472 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 495 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
473 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 496 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
474 | 497 | ||
498 | if (is_itpm(to_pnp_dev(dev))) | ||
499 | itpm = 1; | ||
500 | |||
475 | if (itpm) | 501 | if (itpm) |
476 | dev_info(dev, "Intel iTPM workaround enabled\n"); | 502 | dev_info(dev, "Intel iTPM workaround enabled\n"); |
477 | 503 | ||
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c index cc1e9850d655..d8210ca00720 100644 --- a/drivers/char/tty_buffer.c +++ b/drivers/char/tty_buffer.c | |||
@@ -413,7 +413,8 @@ static void flush_to_ldisc(struct work_struct *work) | |||
413 | spin_lock_irqsave(&tty->buf.lock, flags); | 413 | spin_lock_irqsave(&tty->buf.lock, flags); |
414 | 414 | ||
415 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { | 415 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { |
416 | struct tty_buffer *head; | 416 | struct tty_buffer *head, *tail = tty->buf.tail; |
417 | int seen_tail = 0; | ||
417 | while ((head = tty->buf.head) != NULL) { | 418 | while ((head = tty->buf.head) != NULL) { |
418 | int count; | 419 | int count; |
419 | char *char_buf; | 420 | char *char_buf; |
@@ -423,6 +424,15 @@ static void flush_to_ldisc(struct work_struct *work) | |||
423 | if (!count) { | 424 | if (!count) { |
424 | if (head->next == NULL) | 425 | if (head->next == NULL) |
425 | break; | 426 | break; |
427 | /* | ||
428 | There's a possibility tty might get new buffer | ||
429 | added during the unlock window below. We could | ||
430 | end up spinning in here forever hogging the CPU | ||
431 | completely. To avoid this let's have a rest each | ||
432 | time we processed the tail buffer. | ||
433 | */ | ||
434 | if (tail == head) | ||
435 | seen_tail = 1; | ||
426 | tty->buf.head = head->next; | 436 | tty->buf.head = head->next; |
427 | tty_buffer_free(tty, head); | 437 | tty_buffer_free(tty, head); |
428 | continue; | 438 | continue; |
@@ -432,7 +442,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
432 | line discipline as we want to empty the queue */ | 442 | line discipline as we want to empty the queue */ |
433 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) | 443 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) |
434 | break; | 444 | break; |
435 | if (!tty->receive_room) { | 445 | if (!tty->receive_room || seen_tail) { |
436 | schedule_delayed_work(&tty->buf.work, 1); | 446 | schedule_delayed_work(&tty->buf.work, 1); |
437 | break; | 447 | break; |
438 | } | 448 | } |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 613c852ee0fe..e0f7f4b8c286 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -553,6 +553,9 @@ void __tty_hangup(struct tty_struct *tty) | |||
553 | 553 | ||
554 | tty_lock(); | 554 | tty_lock(); |
555 | 555 | ||
556 | /* some functions below drop BTM, so we need this bit */ | ||
557 | set_bit(TTY_HUPPING, &tty->flags); | ||
558 | |||
556 | /* inuse_filps is protected by the single tty lock, | 559 | /* inuse_filps is protected by the single tty lock, |
557 | this really needs to change if we want to flush the | 560 | this really needs to change if we want to flush the |
558 | workqueue with the lock held */ | 561 | workqueue with the lock held */ |
@@ -572,6 +575,10 @@ void __tty_hangup(struct tty_struct *tty) | |||
572 | } | 575 | } |
573 | spin_unlock(&tty_files_lock); | 576 | spin_unlock(&tty_files_lock); |
574 | 577 | ||
578 | /* | ||
579 | * it drops BTM and thus races with reopen | ||
580 | * we protect the race by TTY_HUPPING | ||
581 | */ | ||
575 | tty_ldisc_hangup(tty); | 582 | tty_ldisc_hangup(tty); |
576 | 583 | ||
577 | read_lock(&tasklist_lock); | 584 | read_lock(&tasklist_lock); |
@@ -609,7 +616,6 @@ void __tty_hangup(struct tty_struct *tty) | |||
609 | tty->session = NULL; | 616 | tty->session = NULL; |
610 | tty->pgrp = NULL; | 617 | tty->pgrp = NULL; |
611 | tty->ctrl_status = 0; | 618 | tty->ctrl_status = 0; |
612 | set_bit(TTY_HUPPED, &tty->flags); | ||
613 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); | 619 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
614 | 620 | ||
615 | /* Account for the p->signal references we killed */ | 621 | /* Account for the p->signal references we killed */ |
@@ -635,6 +641,7 @@ void __tty_hangup(struct tty_struct *tty) | |||
635 | * can't yet guarantee all that. | 641 | * can't yet guarantee all that. |
636 | */ | 642 | */ |
637 | set_bit(TTY_HUPPED, &tty->flags); | 643 | set_bit(TTY_HUPPED, &tty->flags); |
644 | clear_bit(TTY_HUPPING, &tty->flags); | ||
638 | tty_ldisc_enable(tty); | 645 | tty_ldisc_enable(tty); |
639 | 646 | ||
640 | tty_unlock(); | 647 | tty_unlock(); |
@@ -1304,7 +1311,9 @@ static int tty_reopen(struct tty_struct *tty) | |||
1304 | { | 1311 | { |
1305 | struct tty_driver *driver = tty->driver; | 1312 | struct tty_driver *driver = tty->driver; |
1306 | 1313 | ||
1307 | if (test_bit(TTY_CLOSING, &tty->flags)) | 1314 | if (test_bit(TTY_CLOSING, &tty->flags) || |
1315 | test_bit(TTY_HUPPING, &tty->flags) || | ||
1316 | test_bit(TTY_LDISC_CHANGING, &tty->flags)) | ||
1308 | return -EIO; | 1317 | return -EIO; |
1309 | 1318 | ||
1310 | if (driver->type == TTY_DRIVER_TYPE_PTY && | 1319 | if (driver->type == TTY_DRIVER_TYPE_PTY && |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 412f9775d19c..4214d58276f7 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -47,6 +47,7 @@ | |||
47 | 47 | ||
48 | static DEFINE_SPINLOCK(tty_ldisc_lock); | 48 | static DEFINE_SPINLOCK(tty_ldisc_lock); |
49 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); | 49 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
50 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle); | ||
50 | /* Line disc dispatch table */ | 51 | /* Line disc dispatch table */ |
51 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; | 52 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; |
52 | 53 | ||
@@ -83,6 +84,7 @@ static void put_ldisc(struct tty_ldisc *ld) | |||
83 | return; | 84 | return; |
84 | } | 85 | } |
85 | local_irq_restore(flags); | 86 | local_irq_restore(flags); |
87 | wake_up(&tty_ldisc_idle); | ||
86 | } | 88 | } |
87 | 89 | ||
88 | /** | 90 | /** |
@@ -452,6 +454,8 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld) | |||
452 | /* BTM here locks versus a hangup event */ | 454 | /* BTM here locks versus a hangup event */ |
453 | WARN_ON(!tty_locked()); | 455 | WARN_ON(!tty_locked()); |
454 | ret = ld->ops->open(tty); | 456 | ret = ld->ops->open(tty); |
457 | if (ret) | ||
458 | clear_bit(TTY_LDISC_OPEN, &tty->flags); | ||
455 | return ret; | 459 | return ret; |
456 | } | 460 | } |
457 | return 0; | 461 | return 0; |
@@ -531,6 +535,23 @@ static int tty_ldisc_halt(struct tty_struct *tty) | |||
531 | } | 535 | } |
532 | 536 | ||
533 | /** | 537 | /** |
538 | * tty_ldisc_wait_idle - wait for the ldisc to become idle | ||
539 | * @tty: tty to wait for | ||
540 | * | ||
541 | * Wait for the line discipline to become idle. The discipline must | ||
542 | * have been halted for this to guarantee it remains idle. | ||
543 | */ | ||
544 | static int tty_ldisc_wait_idle(struct tty_struct *tty) | ||
545 | { | ||
546 | int ret; | ||
547 | ret = wait_event_interruptible_timeout(tty_ldisc_idle, | ||
548 | atomic_read(&tty->ldisc->users) == 1, 5 * HZ); | ||
549 | if (ret < 0) | ||
550 | return ret; | ||
551 | return ret > 0 ? 0 : -EBUSY; | ||
552 | } | ||
553 | |||
554 | /** | ||
534 | * tty_set_ldisc - set line discipline | 555 | * tty_set_ldisc - set line discipline |
535 | * @tty: the terminal to set | 556 | * @tty: the terminal to set |
536 | * @ldisc: the line discipline | 557 | * @ldisc: the line discipline |
@@ -634,8 +655,17 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
634 | 655 | ||
635 | flush_scheduled_work(); | 656 | flush_scheduled_work(); |
636 | 657 | ||
658 | retval = tty_ldisc_wait_idle(tty); | ||
659 | |||
637 | tty_lock(); | 660 | tty_lock(); |
638 | mutex_lock(&tty->ldisc_mutex); | 661 | mutex_lock(&tty->ldisc_mutex); |
662 | |||
663 | /* handle wait idle failure locked */ | ||
664 | if (retval) { | ||
665 | tty_ldisc_put(new_ldisc); | ||
666 | goto enable; | ||
667 | } | ||
668 | |||
639 | if (test_bit(TTY_HUPPED, &tty->flags)) { | 669 | if (test_bit(TTY_HUPPED, &tty->flags)) { |
640 | /* We were raced by the hangup method. It will have stomped | 670 | /* We were raced by the hangup method. It will have stomped |
641 | the ldisc data and closed the ldisc down */ | 671 | the ldisc data and closed the ldisc down */ |
@@ -669,6 +699,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
669 | 699 | ||
670 | tty_ldisc_put(o_ldisc); | 700 | tty_ldisc_put(o_ldisc); |
671 | 701 | ||
702 | enable: | ||
672 | /* | 703 | /* |
673 | * Allow ldisc referencing to occur again | 704 | * Allow ldisc referencing to occur again |
674 | */ | 705 | */ |
@@ -714,9 +745,12 @@ static void tty_reset_termios(struct tty_struct *tty) | |||
714 | * state closed | 745 | * state closed |
715 | */ | 746 | */ |
716 | 747 | ||
717 | static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) | 748 | static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) |
718 | { | 749 | { |
719 | struct tty_ldisc *ld; | 750 | struct tty_ldisc *ld = tty_ldisc_get(ldisc); |
751 | |||
752 | if (IS_ERR(ld)) | ||
753 | return -1; | ||
720 | 754 | ||
721 | tty_ldisc_close(tty, tty->ldisc); | 755 | tty_ldisc_close(tty, tty->ldisc); |
722 | tty_ldisc_put(tty->ldisc); | 756 | tty_ldisc_put(tty->ldisc); |
@@ -724,10 +758,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) | |||
724 | /* | 758 | /* |
725 | * Switch the line discipline back | 759 | * Switch the line discipline back |
726 | */ | 760 | */ |
727 | ld = tty_ldisc_get(ldisc); | ||
728 | BUG_ON(IS_ERR(ld)); | ||
729 | tty_ldisc_assign(tty, ld); | 761 | tty_ldisc_assign(tty, ld); |
730 | tty_set_termios_ldisc(tty, ldisc); | 762 | tty_set_termios_ldisc(tty, ldisc); |
763 | |||
764 | return 0; | ||
731 | } | 765 | } |
732 | 766 | ||
733 | /** | 767 | /** |
@@ -802,13 +836,16 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
802 | a FIXME */ | 836 | a FIXME */ |
803 | if (tty->ldisc) { /* Not yet closed */ | 837 | if (tty->ldisc) { /* Not yet closed */ |
804 | if (reset == 0) { | 838 | if (reset == 0) { |
805 | tty_ldisc_reinit(tty, tty->termios->c_line); | 839 | |
806 | err = tty_ldisc_open(tty, tty->ldisc); | 840 | if (!tty_ldisc_reinit(tty, tty->termios->c_line)) |
841 | err = tty_ldisc_open(tty, tty->ldisc); | ||
842 | else | ||
843 | err = 1; | ||
807 | } | 844 | } |
808 | /* If the re-open fails or we reset then go to N_TTY. The | 845 | /* If the re-open fails or we reset then go to N_TTY. The |
809 | N_TTY open cannot fail */ | 846 | N_TTY open cannot fail */ |
810 | if (reset || err) { | 847 | if (reset || err) { |
811 | tty_ldisc_reinit(tty, N_TTY); | 848 | BUG_ON(tty_ldisc_reinit(tty, N_TTY)); |
812 | WARN_ON(tty_ldisc_open(tty, tty->ldisc)); | 849 | WARN_ON(tty_ldisc_open(tty, tty->ldisc)); |
813 | } | 850 | } |
814 | tty_ldisc_enable(tty); | 851 | tty_ldisc_enable(tty); |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 0f69c5ec0ecd..7dc855b074d3 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1314,6 +1314,17 @@ static void control_work_handler(struct work_struct *work) | |||
1314 | spin_unlock(&portdev->cvq_lock); | 1314 | spin_unlock(&portdev->cvq_lock); |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | static void out_intr(struct virtqueue *vq) | ||
1318 | { | ||
1319 | struct port *port; | ||
1320 | |||
1321 | port = find_port_by_vq(vq->vdev->priv, vq); | ||
1322 | if (!port) | ||
1323 | return; | ||
1324 | |||
1325 | wake_up_interruptible(&port->waitqueue); | ||
1326 | } | ||
1327 | |||
1317 | static void in_intr(struct virtqueue *vq) | 1328 | static void in_intr(struct virtqueue *vq) |
1318 | { | 1329 | { |
1319 | struct port *port; | 1330 | struct port *port; |
@@ -1430,7 +1441,7 @@ static int init_vqs(struct ports_device *portdev) | |||
1430 | */ | 1441 | */ |
1431 | j = 0; | 1442 | j = 0; |
1432 | io_callbacks[j] = in_intr; | 1443 | io_callbacks[j] = in_intr; |
1433 | io_callbacks[j + 1] = NULL; | 1444 | io_callbacks[j + 1] = out_intr; |
1434 | io_names[j] = "input"; | 1445 | io_names[j] = "input"; |
1435 | io_names[j + 1] = "output"; | 1446 | io_names[j + 1] = "output"; |
1436 | j += 2; | 1447 | j += 2; |
@@ -1444,7 +1455,7 @@ static int init_vqs(struct ports_device *portdev) | |||
1444 | for (i = 1; i < nr_ports; i++) { | 1455 | for (i = 1; i < nr_ports; i++) { |
1445 | j += 2; | 1456 | j += 2; |
1446 | io_callbacks[j] = in_intr; | 1457 | io_callbacks[j] = in_intr; |
1447 | io_callbacks[j + 1] = NULL; | 1458 | io_callbacks[j + 1] = out_intr; |
1448 | io_names[j] = "input"; | 1459 | io_names[j] = "input"; |
1449 | io_names[j + 1] = "output"; | 1460 | io_names[j + 1] = "output"; |
1450 | } | 1461 | } |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 38df8c19e74c..6b68a0fb4611 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -503,6 +503,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
503 | struct kbd_struct * kbd; | 503 | struct kbd_struct * kbd; |
504 | unsigned int console; | 504 | unsigned int console; |
505 | unsigned char ucval; | 505 | unsigned char ucval; |
506 | unsigned int uival; | ||
506 | void __user *up = (void __user *)arg; | 507 | void __user *up = (void __user *)arg; |
507 | int i, perm; | 508 | int i, perm; |
508 | int ret = 0; | 509 | int ret = 0; |
@@ -657,7 +658,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
657 | break; | 658 | break; |
658 | 659 | ||
659 | case KDGETMODE: | 660 | case KDGETMODE: |
660 | ucval = vc->vc_mode; | 661 | uival = vc->vc_mode; |
661 | goto setint; | 662 | goto setint; |
662 | 663 | ||
663 | case KDMAPDISP: | 664 | case KDMAPDISP: |
@@ -695,7 +696,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
695 | break; | 696 | break; |
696 | 697 | ||
697 | case KDGKBMODE: | 698 | case KDGKBMODE: |
698 | ucval = ((kbd->kbdmode == VC_RAW) ? K_RAW : | 699 | uival = ((kbd->kbdmode == VC_RAW) ? K_RAW : |
699 | (kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW : | 700 | (kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW : |
700 | (kbd->kbdmode == VC_UNICODE) ? K_UNICODE : | 701 | (kbd->kbdmode == VC_UNICODE) ? K_UNICODE : |
701 | K_XLATE); | 702 | K_XLATE); |
@@ -717,9 +718,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
717 | break; | 718 | break; |
718 | 719 | ||
719 | case KDGKBMETA: | 720 | case KDGKBMETA: |
720 | ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); | 721 | uival = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); |
721 | setint: | 722 | setint: |
722 | ret = put_user(ucval, (int __user *)arg); | 723 | ret = put_user(uival, (int __user *)arg); |
723 | break; | 724 | break; |
724 | 725 | ||
725 | case KDGETKEYCODE: | 726 | case KDGETKEYCODE: |
@@ -949,7 +950,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
949 | for (i = 0; i < MAX_NR_CONSOLES; ++i) | 950 | for (i = 0; i < MAX_NR_CONSOLES; ++i) |
950 | if (! VT_IS_IN_USE(i)) | 951 | if (! VT_IS_IN_USE(i)) |
951 | break; | 952 | break; |
952 | ucval = i < MAX_NR_CONSOLES ? (i+1) : -1; | 953 | uival = i < MAX_NR_CONSOLES ? (i+1) : -1; |
953 | goto setint; | 954 | goto setint; |
954 | 955 | ||
955 | /* | 956 | /* |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index a50710843378..97df791c74cb 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -154,6 +154,45 @@ void cpuidle_resume_and_unlock(void) | |||
154 | 154 | ||
155 | EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock); | 155 | EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock); |
156 | 156 | ||
157 | #ifdef CONFIG_ARCH_HAS_CPU_RELAX | ||
158 | static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st) | ||
159 | { | ||
160 | ktime_t t1, t2; | ||
161 | s64 diff; | ||
162 | int ret; | ||
163 | |||
164 | t1 = ktime_get(); | ||
165 | local_irq_enable(); | ||
166 | while (!need_resched()) | ||
167 | cpu_relax(); | ||
168 | |||
169 | t2 = ktime_get(); | ||
170 | diff = ktime_to_us(ktime_sub(t2, t1)); | ||
171 | if (diff > INT_MAX) | ||
172 | diff = INT_MAX; | ||
173 | |||
174 | ret = (int) diff; | ||
175 | return ret; | ||
176 | } | ||
177 | |||
178 | static void poll_idle_init(struct cpuidle_device *dev) | ||
179 | { | ||
180 | struct cpuidle_state *state = &dev->states[0]; | ||
181 | |||
182 | cpuidle_set_statedata(state, NULL); | ||
183 | |||
184 | snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); | ||
185 | snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); | ||
186 | state->exit_latency = 0; | ||
187 | state->target_residency = 0; | ||
188 | state->power_usage = -1; | ||
189 | state->flags = CPUIDLE_FLAG_POLL; | ||
190 | state->enter = poll_idle; | ||
191 | } | ||
192 | #else | ||
193 | static void poll_idle_init(struct cpuidle_device *dev) {} | ||
194 | #endif /* CONFIG_ARCH_HAS_CPU_RELAX */ | ||
195 | |||
157 | /** | 196 | /** |
158 | * cpuidle_enable_device - enables idle PM for a CPU | 197 | * cpuidle_enable_device - enables idle PM for a CPU |
159 | * @dev: the CPU | 198 | * @dev: the CPU |
@@ -178,6 +217,8 @@ int cpuidle_enable_device(struct cpuidle_device *dev) | |||
178 | return ret; | 217 | return ret; |
179 | } | 218 | } |
180 | 219 | ||
220 | poll_idle_init(dev); | ||
221 | |||
181 | if ((ret = cpuidle_add_state_sysfs(dev))) | 222 | if ((ret = cpuidle_add_state_sysfs(dev))) |
182 | return ret; | 223 | return ret; |
183 | 224 | ||
@@ -232,45 +273,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev) | |||
232 | 273 | ||
233 | EXPORT_SYMBOL_GPL(cpuidle_disable_device); | 274 | EXPORT_SYMBOL_GPL(cpuidle_disable_device); |
234 | 275 | ||
235 | #ifdef CONFIG_ARCH_HAS_CPU_RELAX | ||
236 | static int poll_idle(struct cpuidle_device *dev, struct cpuidle_state *st) | ||
237 | { | ||
238 | ktime_t t1, t2; | ||
239 | s64 diff; | ||
240 | int ret; | ||
241 | |||
242 | t1 = ktime_get(); | ||
243 | local_irq_enable(); | ||
244 | while (!need_resched()) | ||
245 | cpu_relax(); | ||
246 | |||
247 | t2 = ktime_get(); | ||
248 | diff = ktime_to_us(ktime_sub(t2, t1)); | ||
249 | if (diff > INT_MAX) | ||
250 | diff = INT_MAX; | ||
251 | |||
252 | ret = (int) diff; | ||
253 | return ret; | ||
254 | } | ||
255 | |||
256 | static void poll_idle_init(struct cpuidle_device *dev) | ||
257 | { | ||
258 | struct cpuidle_state *state = &dev->states[0]; | ||
259 | |||
260 | cpuidle_set_statedata(state, NULL); | ||
261 | |||
262 | snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); | ||
263 | snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); | ||
264 | state->exit_latency = 0; | ||
265 | state->target_residency = 0; | ||
266 | state->power_usage = -1; | ||
267 | state->flags = CPUIDLE_FLAG_POLL; | ||
268 | state->enter = poll_idle; | ||
269 | } | ||
270 | #else | ||
271 | static void poll_idle_init(struct cpuidle_device *dev) {} | ||
272 | #endif /* CONFIG_ARCH_HAS_CPU_RELAX */ | ||
273 | |||
274 | /** | 276 | /** |
275 | * __cpuidle_register_device - internal register function called before register | 277 | * __cpuidle_register_device - internal register function called before register |
276 | * and enable routines | 278 | * and enable routines |
@@ -291,8 +293,6 @@ static int __cpuidle_register_device(struct cpuidle_device *dev) | |||
291 | 293 | ||
292 | init_completion(&dev->kobj_unregister); | 294 | init_completion(&dev->kobj_unregister); |
293 | 295 | ||
294 | poll_idle_init(dev); | ||
295 | |||
296 | /* | 296 | /* |
297 | * cpuidle driver should set the dev->power_specified bit | 297 | * cpuidle driver should set the dev->power_specified bit |
298 | * before registering the device if the driver provides | 298 | * before registering the device if the driver provides |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 2e992bc8015b..8a515baa38f7 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -286,7 +286,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, | |||
286 | if (initial) | 286 | if (initial) |
287 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ | 287 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
288 | : "+S" (input), "+D" (output), "+a" (iv) | 288 | : "+S" (input), "+D" (output), "+a" (iv) |
289 | : "d" (control_word), "b" (key), "c" (count)); | 289 | : "d" (control_word), "b" (key), "c" (initial)); |
290 | 290 | ||
291 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ | 291 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
292 | : "+S" (input), "+D" (output), "+a" (iv) | 292 | : "+S" (input), "+D" (output), "+a" (iv) |
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 411d5bf50fc4..a25f5f61e0e0 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) | |||
449 | static void mv_xor_tasklet(unsigned long data) | 449 | static void mv_xor_tasklet(unsigned long data) |
450 | { | 450 | { |
451 | struct mv_xor_chan *chan = (struct mv_xor_chan *) data; | 451 | struct mv_xor_chan *chan = (struct mv_xor_chan *) data; |
452 | __mv_xor_slot_cleanup(chan); | 452 | mv_xor_slot_cleanup(chan); |
453 | } | 453 | } |
454 | 454 | ||
455 | static struct mv_xor_desc_slot * | 455 | static struct mv_xor_desc_slot * |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index e7d5d6b5dcf6..33780d856acb 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -1572,7 +1572,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int dram_range, | |||
1572 | debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", | 1572 | debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", |
1573 | hole_off, hole_valid, intlv_sel); | 1573 | hole_off, hole_valid, intlv_sel); |
1574 | 1574 | ||
1575 | if (intlv_en || | 1575 | if (intlv_en && |
1576 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) | 1576 | (intlv_sel != ((sys_addr >> 12) & intlv_en))) |
1577 | return -EINVAL; | 1577 | return -EINVAL; |
1578 | 1578 | ||
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 6b21e25f7a84..6d2e34d0f52a 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -578,14 +578,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev) | |||
578 | return NULL; | 578 | return NULL; |
579 | } | 579 | } |
580 | 580 | ||
581 | /* marking MCI offline */ | ||
582 | mci->op_state = OP_OFFLINE; | ||
583 | |||
584 | del_mc_from_global_list(mci); | 581 | del_mc_from_global_list(mci); |
585 | mutex_unlock(&mem_ctls_mutex); | 582 | mutex_unlock(&mem_ctls_mutex); |
586 | 583 | ||
587 | /* flush workq processes and remove sysfs */ | 584 | /* flush workq processes */ |
588 | edac_mc_workq_teardown(mci); | 585 | edac_mc_workq_teardown(mci); |
586 | |||
587 | /* marking MCI offline */ | ||
588 | mci->op_state = OP_OFFLINE; | ||
589 | |||
590 | /* remove from sysfs */ | ||
589 | edac_remove_sysfs_mci_device(mci); | 591 | edac_remove_sysfs_mci_device(mci); |
590 | 592 | ||
591 | edac_printk(KERN_INFO, EDAC_MC, | 593 | edac_printk(KERN_INFO, EDAC_MC, |
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index be0492398ef9..24ff35511e2b 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
@@ -75,6 +75,8 @@ static size_t config_rom_length = 1 + 4 + 1 + 1; | |||
75 | #define BIB_IRMC ((1) << 31) | 75 | #define BIB_IRMC ((1) << 31) |
76 | #define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ | 76 | #define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ |
77 | 77 | ||
78 | #define CANON_OUI 0x000085 | ||
79 | |||
78 | static void generate_config_rom(struct fw_card *card, __be32 *config_rom) | 80 | static void generate_config_rom(struct fw_card *card, __be32 *config_rom) |
79 | { | 81 | { |
80 | struct fw_descriptor *desc; | 82 | struct fw_descriptor *desc; |
@@ -284,6 +286,7 @@ static void bm_work(struct work_struct *work) | |||
284 | bool root_device_is_running; | 286 | bool root_device_is_running; |
285 | bool root_device_is_cmc; | 287 | bool root_device_is_cmc; |
286 | bool irm_is_1394_1995_only; | 288 | bool irm_is_1394_1995_only; |
289 | bool keep_this_irm; | ||
287 | 290 | ||
288 | spin_lock_irq(&card->lock); | 291 | spin_lock_irq(&card->lock); |
289 | 292 | ||
@@ -305,6 +308,10 @@ static void bm_work(struct work_struct *work) | |||
305 | irm_is_1394_1995_only = irm_device && irm_device->config_rom && | 308 | irm_is_1394_1995_only = irm_device && irm_device->config_rom && |
306 | (irm_device->config_rom[2] & 0x000000f0) == 0; | 309 | (irm_device->config_rom[2] & 0x000000f0) == 0; |
307 | 310 | ||
311 | /* Canon MV5i works unreliably if it is not root node. */ | ||
312 | keep_this_irm = irm_device && irm_device->config_rom && | ||
313 | irm_device->config_rom[3] >> 8 == CANON_OUI; | ||
314 | |||
308 | root_id = root_node->node_id; | 315 | root_id = root_node->node_id; |
309 | irm_id = card->irm_node->node_id; | 316 | irm_id = card->irm_node->node_id; |
310 | local_id = card->local_node->node_id; | 317 | local_id = card->local_node->node_id; |
@@ -333,7 +340,7 @@ static void bm_work(struct work_struct *work) | |||
333 | goto pick_me; | 340 | goto pick_me; |
334 | } | 341 | } |
335 | 342 | ||
336 | if (irm_is_1394_1995_only) { | 343 | if (irm_is_1394_1995_only && !keep_this_irm) { |
337 | new_root_id = local_id; | 344 | new_root_id = local_id; |
338 | fw_notify("%s, making local node (%02x) root.\n", | 345 | fw_notify("%s, making local node (%02x) root.\n", |
339 | "IRM is not 1394a compliant", new_root_id); | 346 | "IRM is not 1394a compliant", new_root_id); |
@@ -382,7 +389,7 @@ static void bm_work(struct work_struct *work) | |||
382 | 389 | ||
383 | spin_lock_irq(&card->lock); | 390 | spin_lock_irq(&card->lock); |
384 | 391 | ||
385 | if (rcode != RCODE_COMPLETE) { | 392 | if (rcode != RCODE_COMPLETE && !keep_this_irm) { |
386 | /* | 393 | /* |
387 | * The lock request failed, maybe the IRM | 394 | * The lock request failed, maybe the IRM |
388 | * isn't really IRM capable after all. Let's | 395 | * isn't really IRM capable after all. Let's |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 9dcb17d51aee..a03cb6acaeda 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -242,6 +242,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) | |||
242 | 242 | ||
243 | static char ohci_driver_name[] = KBUILD_MODNAME; | 243 | static char ohci_driver_name[] = KBUILD_MODNAME; |
244 | 244 | ||
245 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | ||
245 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 | 246 | #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 |
246 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 | 247 | #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 |
247 | 248 | ||
@@ -253,18 +254,34 @@ static char ohci_driver_name[] = KBUILD_MODNAME; | |||
253 | 254 | ||
254 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ | 255 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ |
255 | static const struct { | 256 | static const struct { |
256 | unsigned short vendor, device, flags; | 257 | unsigned short vendor, device, revision, flags; |
257 | } ohci_quirks[] = { | 258 | } ohci_quirks[] = { |
258 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER | | 259 | {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID, |
259 | QUIRK_RESET_PACKET | | 260 | QUIRK_CYCLE_TIMER}, |
260 | QUIRK_NO_1394A}, | 261 | |
261 | {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET}, | 262 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID, |
262 | {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 263 | QUIRK_BE_HEADERS}, |
263 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, | 264 | |
264 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 265 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
265 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 266 | QUIRK_NO_MSI}, |
266 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 267 | |
267 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, | 268 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, |
269 | QUIRK_NO_MSI}, | ||
270 | |||
271 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID, | ||
272 | QUIRK_CYCLE_TIMER}, | ||
273 | |||
274 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, | ||
275 | QUIRK_CYCLE_TIMER}, | ||
276 | |||
277 | {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, | ||
278 | QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, | ||
279 | |||
280 | {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID, | ||
281 | QUIRK_RESET_PACKET}, | ||
282 | |||
283 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, | ||
284 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, | ||
268 | }; | 285 | }; |
269 | 286 | ||
270 | /* This overrides anything that was found in ohci_quirks[]. */ | 287 | /* This overrides anything that was found in ohci_quirks[]. */ |
@@ -739,7 +756,7 @@ static void ar_context_tasklet(unsigned long data) | |||
739 | d = &ab->descriptor; | 756 | d = &ab->descriptor; |
740 | 757 | ||
741 | if (d->res_count == 0) { | 758 | if (d->res_count == 0) { |
742 | size_t size, rest, offset; | 759 | size_t size, size2, rest, pktsize, size3, offset; |
743 | dma_addr_t start_bus; | 760 | dma_addr_t start_bus; |
744 | void *start; | 761 | void *start; |
745 | 762 | ||
@@ -750,25 +767,61 @@ static void ar_context_tasklet(unsigned long data) | |||
750 | */ | 767 | */ |
751 | 768 | ||
752 | offset = offsetof(struct ar_buffer, data); | 769 | offset = offsetof(struct ar_buffer, data); |
753 | start = buffer = ab; | 770 | start = ab; |
754 | start_bus = le32_to_cpu(ab->descriptor.data_address) - offset; | 771 | start_bus = le32_to_cpu(ab->descriptor.data_address) - offset; |
772 | buffer = ab->data; | ||
755 | 773 | ||
756 | ab = ab->next; | 774 | ab = ab->next; |
757 | d = &ab->descriptor; | 775 | d = &ab->descriptor; |
758 | size = buffer + PAGE_SIZE - ctx->pointer; | 776 | size = start + PAGE_SIZE - ctx->pointer; |
777 | /* valid buffer data in the next page */ | ||
759 | rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count); | 778 | rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count); |
779 | /* what actually fits in this page */ | ||
780 | size2 = min(rest, (size_t)PAGE_SIZE - offset - size); | ||
760 | memmove(buffer, ctx->pointer, size); | 781 | memmove(buffer, ctx->pointer, size); |
761 | memcpy(buffer + size, ab->data, rest); | 782 | memcpy(buffer + size, ab->data, size2); |
762 | ctx->current_buffer = ab; | 783 | |
763 | ctx->pointer = (void *) ab->data + rest; | 784 | while (size > 0) { |
764 | end = buffer + size + rest; | 785 | void *next = handle_ar_packet(ctx, buffer); |
786 | pktsize = next - buffer; | ||
787 | if (pktsize >= size) { | ||
788 | /* | ||
789 | * We have handled all the data that was | ||
790 | * originally in this page, so we can now | ||
791 | * continue in the next page. | ||
792 | */ | ||
793 | buffer = next; | ||
794 | break; | ||
795 | } | ||
796 | /* move the next packet to the start of the buffer */ | ||
797 | memmove(buffer, next, size + size2 - pktsize); | ||
798 | size -= pktsize; | ||
799 | /* fill up this page again */ | ||
800 | size3 = min(rest - size2, | ||
801 | (size_t)PAGE_SIZE - offset - size - size2); | ||
802 | memcpy(buffer + size + size2, | ||
803 | (void *) ab->data + size2, size3); | ||
804 | size2 += size3; | ||
805 | } | ||
765 | 806 | ||
766 | while (buffer < end) | 807 | if (rest > 0) { |
767 | buffer = handle_ar_packet(ctx, buffer); | 808 | /* handle the packets that are fully in the next page */ |
809 | buffer = (void *) ab->data + | ||
810 | (buffer - (start + offset + size)); | ||
811 | end = (void *) ab->data + rest; | ||
812 | |||
813 | while (buffer < end) | ||
814 | buffer = handle_ar_packet(ctx, buffer); | ||
768 | 815 | ||
769 | dma_free_coherent(ohci->card.device, PAGE_SIZE, | 816 | ctx->current_buffer = ab; |
770 | start, start_bus); | 817 | ctx->pointer = end; |
771 | ar_context_add_page(ctx); | 818 | |
819 | dma_free_coherent(ohci->card.device, PAGE_SIZE, | ||
820 | start, start_bus); | ||
821 | ar_context_add_page(ctx); | ||
822 | } else { | ||
823 | ctx->pointer = start + PAGE_SIZE; | ||
824 | } | ||
772 | } else { | 825 | } else { |
773 | buffer = ctx->pointer; | 826 | buffer = ctx->pointer; |
774 | ctx->pointer = end = | 827 | ctx->pointer = end = |
@@ -2885,9 +2938,11 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2885 | } | 2938 | } |
2886 | 2939 | ||
2887 | for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) | 2940 | for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) |
2888 | if (ohci_quirks[i].vendor == dev->vendor && | 2941 | if ((ohci_quirks[i].vendor == dev->vendor) && |
2889 | (ohci_quirks[i].device == dev->device || | 2942 | (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID || |
2890 | ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) { | 2943 | ohci_quirks[i].device == dev->device) && |
2944 | (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID || | ||
2945 | ohci_quirks[i].revision >= dev->revision)) { | ||
2891 | ohci->quirks = ohci_quirks[i].flags; | 2946 | ohci->quirks = ohci_quirks[i].flags; |
2892 | break; | 2947 | break; |
2893 | } | 2948 | } |
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index e23c06893d19..d3e55a0ae92b 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -56,6 +56,29 @@ static struct cs5535_gpio_chip { | |||
56 | * registers, see include/linux/cs5535.h. | 56 | * registers, see include/linux/cs5535.h. |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static void errata_outl(struct cs5535_gpio_chip *chip, u32 val, | ||
60 | unsigned int reg) | ||
61 | { | ||
62 | unsigned long addr = chip->base + 0x80 + reg; | ||
63 | |||
64 | /* | ||
65 | * According to the CS5536 errata (#36), after suspend | ||
66 | * a write to the high bank GPIO register will clear all | ||
67 | * non-selected bits; the recommended workaround is a | ||
68 | * read-modify-write operation. | ||
69 | * | ||
70 | * Don't apply this errata to the edge status GPIOs, as writing | ||
71 | * to their lower bits will clear them. | ||
72 | */ | ||
73 | if (reg != GPIO_POSITIVE_EDGE_STS && reg != GPIO_NEGATIVE_EDGE_STS) { | ||
74 | if (val & 0xffff) | ||
75 | val |= (inl(addr) & 0xffff); /* ignore the high bits */ | ||
76 | else | ||
77 | val |= (inl(addr) ^ (val >> 16)); | ||
78 | } | ||
79 | outl(val, addr); | ||
80 | } | ||
81 | |||
59 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | 82 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
60 | unsigned int reg) | 83 | unsigned int reg) |
61 | { | 84 | { |
@@ -64,7 +87,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, | |||
64 | outl(1 << offset, chip->base + reg); | 87 | outl(1 << offset, chip->base + reg); |
65 | else | 88 | else |
66 | /* high bank register */ | 89 | /* high bank register */ |
67 | outl(1 << (offset - 16), chip->base + 0x80 + reg); | 90 | errata_outl(chip, 1 << (offset - 16), reg); |
68 | } | 91 | } |
69 | 92 | ||
70 | void cs5535_gpio_set(unsigned offset, unsigned int reg) | 93 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
@@ -86,7 +109,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, | |||
86 | outl(1 << (offset + 16), chip->base + reg); | 109 | outl(1 << (offset + 16), chip->base + reg); |
87 | else | 110 | else |
88 | /* high bank register */ | 111 | /* high bank register */ |
89 | outl(1 << offset, chip->base + 0x80 + reg); | 112 | errata_outl(chip, 1 << offset, reg); |
90 | } | 113 | } |
91 | 114 | ||
92 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) | 115 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c index 2762698e0204..897e0577e65e 100644 --- a/drivers/gpio/rdc321x-gpio.c +++ b/drivers/gpio/rdc321x-gpio.c | |||
@@ -135,7 +135,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev) | |||
135 | struct rdc321x_gpio *rdc321x_gpio_dev; | 135 | struct rdc321x_gpio *rdc321x_gpio_dev; |
136 | struct rdc321x_gpio_pdata *pdata; | 136 | struct rdc321x_gpio_pdata *pdata; |
137 | 137 | ||
138 | pdata = pdev->dev.platform_data; | 138 | pdata = platform_get_drvdata(pdev); |
139 | if (!pdata) { | 139 | if (!pdata) { |
140 | dev_err(&pdev->dev, "no platform data supplied\n"); | 140 | dev_err(&pdev->dev, "no platform data supplied\n"); |
141 | return -ENODEV; | 141 | return -ENODEV; |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 4cab0c6397e3..aa17594a674a 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -97,7 +97,10 @@ config DRM_I830 | |||
97 | config DRM_I915 | 97 | config DRM_I915 |
98 | tristate "i915 driver" | 98 | tristate "i915 driver" |
99 | depends on AGP_INTEL | 99 | depends on AGP_INTEL |
100 | # we need shmfs for the swappable backing store, and in particular | ||
101 | # the shmem_readpage() which depends upon tmpfs | ||
100 | select SHMEM | 102 | select SHMEM |
103 | select TMPFS | ||
101 | select DRM_KMS_HELPER | 104 | select DRM_KMS_HELPER |
102 | select FB_CFB_FILLRECT | 105 | select FB_CFB_FILLRECT |
103 | select FB_CFB_COPYAREA | 106 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 37e0b4fa482a..dfc635884619 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -156,12 +156,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | |||
156 | { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, | 156 | { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, |
157 | { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, | 157 | { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, |
158 | { DRM_MODE_CONNECTOR_Component, "Component", 0 }, | 158 | { DRM_MODE_CONNECTOR_Component, "Component", 0 }, |
159 | { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, | 159 | { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, |
160 | { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, | 160 | { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 }, |
161 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, | 161 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 }, |
162 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, | 162 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 }, |
163 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, | 163 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, |
164 | { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, | 164 | { DRM_MODE_CONNECTOR_eDP, "eDP", 0 }, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct drm_prop_enum_list drm_encoder_enum_list[] = | 167 | static struct drm_prop_enum_list drm_encoder_enum_list[] = |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index dcbeb98f195a..ae9fb7a3afd6 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -649,6 +649,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
649 | old_fb)) { | 649 | old_fb)) { |
650 | DRM_ERROR("failed to set mode on [CRTC:%d]\n", | 650 | DRM_ERROR("failed to set mode on [CRTC:%d]\n", |
651 | set->crtc->base.id); | 651 | set->crtc->base.id); |
652 | set->crtc->fb = old_fb; | ||
652 | ret = -EINVAL; | 653 | ret = -EINVAL; |
653 | goto fail; | 654 | goto fail; |
654 | } | 655 | } |
@@ -663,8 +664,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
663 | set->crtc->fb = set->fb; | 664 | set->crtc->fb = set->fb; |
664 | ret = crtc_funcs->mode_set_base(set->crtc, | 665 | ret = crtc_funcs->mode_set_base(set->crtc, |
665 | set->x, set->y, old_fb); | 666 | set->x, set->y, old_fb); |
666 | if (ret != 0) | 667 | if (ret != 0) { |
668 | set->crtc->fb = old_fb; | ||
667 | goto fail; | 669 | goto fail; |
670 | } | ||
668 | } | 671 | } |
669 | 672 | ||
670 | kfree(save_connectors); | 673 | kfree(save_connectors); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 2dd2c93ebfa3..e6fc48ea55a9 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "i915_drm.h" | 34 | #include "i915_drm.h" |
35 | #include "i915_drv.h" | 35 | #include "i915_drv.h" |
36 | #include "i915_trace.h" | 36 | #include "i915_trace.h" |
37 | #include "../../../platform/x86/intel_ips.h" | ||
37 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
38 | #include <linux/vgaarb.h> | 39 | #include <linux/vgaarb.h> |
39 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
@@ -1418,9 +1419,15 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1418 | if (ret) | 1419 | if (ret) |
1419 | DRM_INFO("failed to find VBIOS tables\n"); | 1420 | DRM_INFO("failed to find VBIOS tables\n"); |
1420 | 1421 | ||
1421 | /* if we have > 1 VGA cards, then disable the radeon VGA resources */ | 1422 | /* If we have > 1 VGA cards, then we need to arbitrate access |
1423 | * to the common VGA resources. | ||
1424 | * | ||
1425 | * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA), | ||
1426 | * then we do not take part in VGA arbitration and the | ||
1427 | * vga_client_register() fails with -ENODEV. | ||
1428 | */ | ||
1422 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); | 1429 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1423 | if (ret) | 1430 | if (ret && ret != -ENODEV) |
1424 | goto cleanup_ringbuffer; | 1431 | goto cleanup_ringbuffer; |
1425 | 1432 | ||
1426 | ret = vga_switcheroo_register_client(dev->pdev, | 1433 | ret = vga_switcheroo_register_client(dev->pdev, |
@@ -2047,6 +2054,26 @@ out_unlock: | |||
2047 | EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); | 2054 | EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); |
2048 | 2055 | ||
2049 | /** | 2056 | /** |
2057 | * Tells the intel_ips driver that the i915 driver is now loaded, if | ||
2058 | * IPS got loaded first. | ||
2059 | * | ||
2060 | * This awkward dance is so that neither module has to depend on the | ||
2061 | * other in order for IPS to do the appropriate communication of | ||
2062 | * GPU turbo limits to i915. | ||
2063 | */ | ||
2064 | static void | ||
2065 | ips_ping_for_i915_load(void) | ||
2066 | { | ||
2067 | void (*link)(void); | ||
2068 | |||
2069 | link = symbol_get(ips_link_to_i915_driver); | ||
2070 | if (link) { | ||
2071 | link(); | ||
2072 | symbol_put(ips_link_to_i915_driver); | ||
2073 | } | ||
2074 | } | ||
2075 | |||
2076 | /** | ||
2050 | * i915_driver_load - setup chip and create an initial config | 2077 | * i915_driver_load - setup chip and create an initial config |
2051 | * @dev: DRM device | 2078 | * @dev: DRM device |
2052 | * @flags: startup flags | 2079 | * @flags: startup flags |
@@ -2234,6 +2261,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2234 | /* XXX Prevent module unload due to memory corruption bugs. */ | 2261 | /* XXX Prevent module unload due to memory corruption bugs. */ |
2235 | __module_get(THIS_MODULE); | 2262 | __module_get(THIS_MODULE); |
2236 | 2263 | ||
2264 | ips_ping_for_i915_load(); | ||
2265 | |||
2237 | return 0; | 2266 | return 0; |
2238 | 2267 | ||
2239 | out_workqueue_free: | 2268 | out_workqueue_free: |
@@ -2306,6 +2335,9 @@ int i915_driver_unload(struct drm_device *dev) | |||
2306 | i915_gem_lastclose(dev); | 2335 | i915_gem_lastclose(dev); |
2307 | 2336 | ||
2308 | intel_cleanup_overlay(dev); | 2337 | intel_cleanup_overlay(dev); |
2338 | |||
2339 | if (!I915_NEED_GFX_HWS(dev)) | ||
2340 | i915_free_hws(dev); | ||
2309 | } | 2341 | } |
2310 | 2342 | ||
2311 | intel_teardown_mchbar(dev); | 2343 | intel_teardown_mchbar(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 6dbe14cc4f74..7792c8f7c6dd 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -53,7 +53,7 @@ extern int intel_agp_enabled; | |||
53 | 53 | ||
54 | #define INTEL_VGA_DEVICE(id, info) { \ | 54 | #define INTEL_VGA_DEVICE(id, info) { \ |
55 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ | 55 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
56 | .class_mask = 0xffff00, \ | 56 | .class_mask = 0xff0000, \ |
57 | .vendor = 0x8086, \ | 57 | .vendor = 0x8086, \ |
58 | .device = id, \ | 58 | .device = id, \ |
59 | .subvendor = PCI_ANY_ID, \ | 59 | .subvendor = PCI_ANY_ID, \ |
@@ -414,6 +414,14 @@ int i965_reset(struct drm_device *dev, u8 flags) | |||
414 | static int __devinit | 414 | static int __devinit |
415 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 415 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
416 | { | 416 | { |
417 | /* Only bind to function 0 of the device. Early generations | ||
418 | * used function 1 as a placeholder for multi-head. This causes | ||
419 | * us confusion instead, especially on the systems where both | ||
420 | * functions have the same PCI-ID! | ||
421 | */ | ||
422 | if (PCI_FUNC(pdev->devfn)) | ||
423 | return -ENODEV; | ||
424 | |||
417 | return drm_get_pci_dev(pdev, ent, &driver); | 425 | return drm_get_pci_dev(pdev, ent, &driver); |
418 | } | 426 | } |
419 | 427 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 744225ebb4b2..477e4ac66639 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -310,6 +310,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) | |||
310 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 310 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
311 | int ret = IRQ_NONE; | 311 | int ret = IRQ_NONE; |
312 | u32 de_iir, gt_iir, de_ier, pch_iir; | 312 | u32 de_iir, gt_iir, de_ier, pch_iir; |
313 | u32 hotplug_mask; | ||
313 | struct drm_i915_master_private *master_priv; | 314 | struct drm_i915_master_private *master_priv; |
314 | struct intel_ring_buffer *render_ring = &dev_priv->render_ring; | 315 | struct intel_ring_buffer *render_ring = &dev_priv->render_ring; |
315 | 316 | ||
@@ -325,6 +326,11 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) | |||
325 | if (de_iir == 0 && gt_iir == 0 && pch_iir == 0) | 326 | if (de_iir == 0 && gt_iir == 0 && pch_iir == 0) |
326 | goto done; | 327 | goto done; |
327 | 328 | ||
329 | if (HAS_PCH_CPT(dev)) | ||
330 | hotplug_mask = SDE_HOTPLUG_MASK_CPT; | ||
331 | else | ||
332 | hotplug_mask = SDE_HOTPLUG_MASK; | ||
333 | |||
328 | ret = IRQ_HANDLED; | 334 | ret = IRQ_HANDLED; |
329 | 335 | ||
330 | if (dev->primary->master) { | 336 | if (dev->primary->master) { |
@@ -366,10 +372,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) | |||
366 | drm_handle_vblank(dev, 1); | 372 | drm_handle_vblank(dev, 1); |
367 | 373 | ||
368 | /* check event from PCH */ | 374 | /* check event from PCH */ |
369 | if ((de_iir & DE_PCH_EVENT) && | 375 | if ((de_iir & DE_PCH_EVENT) && (pch_iir & hotplug_mask)) |
370 | (pch_iir & SDE_HOTPLUG_MASK)) { | ||
371 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); | 376 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); |
372 | } | ||
373 | 377 | ||
374 | if (de_iir & DE_PCU_EVENT) { | 378 | if (de_iir & DE_PCU_EVENT) { |
375 | I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); | 379 | I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); |
@@ -1424,8 +1428,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
1424 | u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | | 1428 | u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | |
1425 | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; | 1429 | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; |
1426 | u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT; | 1430 | u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT; |
1427 | u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | 1431 | u32 hotplug_mask; |
1428 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | ||
1429 | 1432 | ||
1430 | dev_priv->irq_mask_reg = ~display_mask; | 1433 | dev_priv->irq_mask_reg = ~display_mask; |
1431 | dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK; | 1434 | dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK; |
@@ -1450,6 +1453,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
1450 | I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg); | 1453 | I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg); |
1451 | (void) I915_READ(GTIER); | 1454 | (void) I915_READ(GTIER); |
1452 | 1455 | ||
1456 | if (HAS_PCH_CPT(dev)) { | ||
1457 | hotplug_mask = SDE_CRT_HOTPLUG_CPT | SDE_PORTB_HOTPLUG_CPT | | ||
1458 | SDE_PORTC_HOTPLUG_CPT | SDE_PORTD_HOTPLUG_CPT ; | ||
1459 | } else { | ||
1460 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | ||
1461 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | ||
1462 | } | ||
1463 | |||
1453 | dev_priv->pch_irq_mask_reg = ~hotplug_mask; | 1464 | dev_priv->pch_irq_mask_reg = ~hotplug_mask; |
1454 | dev_priv->pch_irq_enable_reg = hotplug_mask; | 1465 | dev_priv->pch_irq_enable_reg = hotplug_mask; |
1455 | 1466 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 4f5e15577e89..7103d24c8213 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -2551,6 +2551,10 @@ | |||
2551 | #define SDE_PORTD_HOTPLUG_CPT (1 << 23) | 2551 | #define SDE_PORTD_HOTPLUG_CPT (1 << 23) |
2552 | #define SDE_PORTC_HOTPLUG_CPT (1 << 22) | 2552 | #define SDE_PORTC_HOTPLUG_CPT (1 << 22) |
2553 | #define SDE_PORTB_HOTPLUG_CPT (1 << 21) | 2553 | #define SDE_PORTB_HOTPLUG_CPT (1 << 21) |
2554 | #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \ | ||
2555 | SDE_PORTD_HOTPLUG_CPT | \ | ||
2556 | SDE_PORTC_HOTPLUG_CPT | \ | ||
2557 | SDE_PORTB_HOTPLUG_CPT) | ||
2554 | 2558 | ||
2555 | #define SDEISR 0xc4000 | 2559 | #define SDEISR 0xc4000 |
2556 | #define SDEIMR 0xc4004 | 2560 | #define SDEIMR 0xc4004 |
@@ -2722,6 +2726,9 @@ | |||
2722 | #define FDI_RXB_CHICKEN 0xc2010 | 2726 | #define FDI_RXB_CHICKEN 0xc2010 |
2723 | #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) | 2727 | #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) |
2724 | 2728 | ||
2729 | #define SOUTH_DSPCLK_GATE_D 0xc2020 | ||
2730 | #define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29) | ||
2731 | |||
2725 | /* CPU: FDI_TX */ | 2732 | /* CPU: FDI_TX */ |
2726 | #define FDI_TXA_CTL 0x60100 | 2733 | #define FDI_TXA_CTL 0x60100 |
2727 | #define FDI_TXB_CTL 0x61100 | 2734 | #define FDI_TXB_CTL 0x61100 |
@@ -2946,6 +2953,7 @@ | |||
2946 | #define TRANS_DP_10BPC (1<<9) | 2953 | #define TRANS_DP_10BPC (1<<9) |
2947 | #define TRANS_DP_6BPC (2<<9) | 2954 | #define TRANS_DP_6BPC (2<<9) |
2948 | #define TRANS_DP_12BPC (3<<9) | 2955 | #define TRANS_DP_12BPC (3<<9) |
2956 | #define TRANS_DP_BPC_MASK (3<<9) | ||
2949 | #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) | 2957 | #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) |
2950 | #define TRANS_DP_VSYNC_ACTIVE_LOW 0 | 2958 | #define TRANS_DP_VSYNC_ACTIVE_LOW 0 |
2951 | #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) | 2959 | #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) |
@@ -2959,10 +2967,11 @@ | |||
2959 | #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) | 2967 | #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) |
2960 | #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) | 2968 | #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) |
2961 | /* SNB B-stepping */ | 2969 | /* SNB B-stepping */ |
2962 | #define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22) | 2970 | #define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22) |
2963 | #define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22) | 2971 | #define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22) |
2964 | #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22) | 2972 | #define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22) |
2965 | #define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22) | 2973 | #define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22) |
2974 | #define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22) | ||
2966 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) | 2975 | #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22) |
2967 | 2976 | ||
2968 | #endif /* _I915_REG_H_ */ | 2977 | #endif /* _I915_REG_H_ */ |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 31f08581e93a..2df5b9aadd5b 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -862,8 +862,10 @@ int i915_restore_state(struct drm_device *dev) | |||
862 | /* Clock gating state */ | 862 | /* Clock gating state */ |
863 | intel_init_clock_gating(dev); | 863 | intel_init_clock_gating(dev); |
864 | 864 | ||
865 | if (HAS_PCH_SPLIT(dev)) | 865 | if (HAS_PCH_SPLIT(dev)) { |
866 | ironlake_enable_drps(dev); | 866 | ironlake_enable_drps(dev); |
867 | intel_init_emon(dev); | ||
868 | } | ||
867 | 869 | ||
868 | /* Cache mode state */ | 870 | /* Cache mode state */ |
869 | I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); | 871 | I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 197d4f32585a..0f950e74db3c 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -191,7 +191,8 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) | |||
191 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); | 191 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); |
192 | 192 | ||
193 | if (turn_off_dac) { | 193 | if (turn_off_dac) { |
194 | I915_WRITE(PCH_ADPA, temp); | 194 | /* Make sure hotplug is enabled */ |
195 | I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE); | ||
195 | (void)I915_READ(PCH_ADPA); | 196 | (void)I915_READ(PCH_ADPA); |
196 | } | 197 | } |
197 | 198 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 979228594599..932a061f28d0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2044,9 +2044,11 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2044 | 2044 | ||
2045 | reg = I915_READ(trans_dp_ctl); | 2045 | reg = I915_READ(trans_dp_ctl); |
2046 | reg &= ~(TRANS_DP_PORT_SEL_MASK | | 2046 | reg &= ~(TRANS_DP_PORT_SEL_MASK | |
2047 | TRANS_DP_SYNC_MASK); | 2047 | TRANS_DP_SYNC_MASK | |
2048 | TRANS_DP_BPC_MASK); | ||
2048 | reg |= (TRANS_DP_OUTPUT_ENABLE | | 2049 | reg |= (TRANS_DP_OUTPUT_ENABLE | |
2049 | TRANS_DP_ENH_FRAMING); | 2050 | TRANS_DP_ENH_FRAMING); |
2051 | reg |= TRANS_DP_8BPC; | ||
2050 | 2052 | ||
2051 | if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) | 2053 | if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) |
2052 | reg |= TRANS_DP_HSYNC_ACTIVE_HIGH; | 2054 | reg |= TRANS_DP_HSYNC_ACTIVE_HIGH; |
@@ -5674,6 +5676,13 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
5674 | I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); | 5676 | I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); |
5675 | 5677 | ||
5676 | /* | 5678 | /* |
5679 | * On Ibex Peak and Cougar Point, we need to disable clock | ||
5680 | * gating for the panel power sequencer or it will fail to | ||
5681 | * start up when no ports are active. | ||
5682 | */ | ||
5683 | I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE); | ||
5684 | |||
5685 | /* | ||
5677 | * According to the spec the following bits should be set in | 5686 | * According to the spec the following bits should be set in |
5678 | * order to enable memory self-refresh | 5687 | * order to enable memory self-refresh |
5679 | * The bit 22/21 of 0x42004 | 5688 | * The bit 22/21 of 0x42004 |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 9ab8708ac6ba..0aa77f318790 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -425,6 +425,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
425 | uint16_t address = algo_data->address; | 425 | uint16_t address = algo_data->address; |
426 | uint8_t msg[5]; | 426 | uint8_t msg[5]; |
427 | uint8_t reply[2]; | 427 | uint8_t reply[2]; |
428 | unsigned retry; | ||
428 | int msg_bytes; | 429 | int msg_bytes; |
429 | int reply_bytes; | 430 | int reply_bytes; |
430 | int ret; | 431 | int ret; |
@@ -459,14 +460,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
459 | break; | 460 | break; |
460 | } | 461 | } |
461 | 462 | ||
462 | for (;;) { | 463 | for (retry = 0; retry < 5; retry++) { |
463 | ret = intel_dp_aux_ch(intel_dp, | 464 | ret = intel_dp_aux_ch(intel_dp, |
464 | msg, msg_bytes, | 465 | msg, msg_bytes, |
465 | reply, reply_bytes); | 466 | reply, reply_bytes); |
466 | if (ret < 0) { | 467 | if (ret < 0) { |
467 | DRM_DEBUG_KMS("aux_ch failed %d\n", ret); | 468 | DRM_DEBUG_KMS("aux_ch failed %d\n", ret); |
468 | return ret; | 469 | return ret; |
469 | } | 470 | } |
471 | |||
472 | switch (reply[0] & AUX_NATIVE_REPLY_MASK) { | ||
473 | case AUX_NATIVE_REPLY_ACK: | ||
474 | /* I2C-over-AUX Reply field is only valid | ||
475 | * when paired with AUX ACK. | ||
476 | */ | ||
477 | break; | ||
478 | case AUX_NATIVE_REPLY_NACK: | ||
479 | DRM_DEBUG_KMS("aux_ch native nack\n"); | ||
480 | return -EREMOTEIO; | ||
481 | case AUX_NATIVE_REPLY_DEFER: | ||
482 | udelay(100); | ||
483 | continue; | ||
484 | default: | ||
485 | DRM_ERROR("aux_ch invalid native reply 0x%02x\n", | ||
486 | reply[0]); | ||
487 | return -EREMOTEIO; | ||
488 | } | ||
489 | |||
470 | switch (reply[0] & AUX_I2C_REPLY_MASK) { | 490 | switch (reply[0] & AUX_I2C_REPLY_MASK) { |
471 | case AUX_I2C_REPLY_ACK: | 491 | case AUX_I2C_REPLY_ACK: |
472 | if (mode == MODE_I2C_READ) { | 492 | if (mode == MODE_I2C_READ) { |
@@ -474,17 +494,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | |||
474 | } | 494 | } |
475 | return reply_bytes - 1; | 495 | return reply_bytes - 1; |
476 | case AUX_I2C_REPLY_NACK: | 496 | case AUX_I2C_REPLY_NACK: |
477 | DRM_DEBUG_KMS("aux_ch nack\n"); | 497 | DRM_DEBUG_KMS("aux_i2c nack\n"); |
478 | return -EREMOTEIO; | 498 | return -EREMOTEIO; |
479 | case AUX_I2C_REPLY_DEFER: | 499 | case AUX_I2C_REPLY_DEFER: |
480 | DRM_DEBUG_KMS("aux_ch defer\n"); | 500 | DRM_DEBUG_KMS("aux_i2c defer\n"); |
481 | udelay(100); | 501 | udelay(100); |
482 | break; | 502 | break; |
483 | default: | 503 | default: |
484 | DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); | 504 | DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]); |
485 | return -EREMOTEIO; | 505 | return -EREMOTEIO; |
486 | } | 506 | } |
487 | } | 507 | } |
508 | |||
509 | DRM_ERROR("too many retries, giving up\n"); | ||
510 | return -EREMOTEIO; | ||
488 | } | 511 | } |
489 | 512 | ||
490 | static int | 513 | static int |
@@ -1070,18 +1093,27 @@ intel_dp_signal_levels(uint8_t train_set, int lane_count) | |||
1070 | static uint32_t | 1093 | static uint32_t |
1071 | intel_gen6_edp_signal_levels(uint8_t train_set) | 1094 | intel_gen6_edp_signal_levels(uint8_t train_set) |
1072 | { | 1095 | { |
1073 | switch (train_set & (DP_TRAIN_VOLTAGE_SWING_MASK|DP_TRAIN_PRE_EMPHASIS_MASK)) { | 1096 | int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK | |
1097 | DP_TRAIN_PRE_EMPHASIS_MASK); | ||
1098 | switch (signal_levels) { | ||
1074 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: | 1099 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0: |
1075 | return EDP_LINK_TRAIN_400MV_0DB_SNB_B; | 1100 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0: |
1101 | return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B; | ||
1102 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5: | ||
1103 | return EDP_LINK_TRAIN_400MV_3_5DB_SNB_B; | ||
1076 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: | 1104 | case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6: |
1077 | return EDP_LINK_TRAIN_400MV_6DB_SNB_B; | 1105 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6: |
1106 | return EDP_LINK_TRAIN_400_600MV_6DB_SNB_B; | ||
1078 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: | 1107 | case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5: |
1079 | return EDP_LINK_TRAIN_600MV_3_5DB_SNB_B; | 1108 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5: |
1109 | return EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B; | ||
1080 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: | 1110 | case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0: |
1081 | return EDP_LINK_TRAIN_800MV_0DB_SNB_B; | 1111 | case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0: |
1112 | return EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B; | ||
1082 | default: | 1113 | default: |
1083 | DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level\n"); | 1114 | DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:" |
1084 | return EDP_LINK_TRAIN_400MV_0DB_SNB_B; | 1115 | "0x%x\n", signal_levels); |
1116 | return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B; | ||
1085 | } | 1117 | } |
1086 | } | 1118 | } |
1087 | 1119 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 8828b3ac6414..2b161375a38d 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -250,6 +250,7 @@ extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
250 | extern void intel_init_clock_gating(struct drm_device *dev); | 250 | extern void intel_init_clock_gating(struct drm_device *dev); |
251 | extern void ironlake_enable_drps(struct drm_device *dev); | 251 | extern void ironlake_enable_drps(struct drm_device *dev); |
252 | extern void ironlake_disable_drps(struct drm_device *dev); | 252 | extern void ironlake_disable_drps(struct drm_device *dev); |
253 | extern void intel_init_emon(struct drm_device *dev); | ||
253 | 254 | ||
254 | extern int intel_pin_and_fence_fb_obj(struct drm_device *dev, | 255 | extern int intel_pin_and_fence_fb_obj(struct drm_device *dev, |
255 | struct drm_gem_object *obj); | 256 | struct drm_gem_object *obj); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 6ec39a86ed06..c3b2208508fb 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -701,6 +701,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
701 | }, | 701 | }, |
702 | { | 702 | { |
703 | .callback = intel_no_lvds_dmi_callback, | 703 | .callback = intel_no_lvds_dmi_callback, |
704 | .ident = "AOpen i915GMm-HFS", | ||
705 | .matches = { | ||
706 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
707 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | ||
708 | }, | ||
709 | }, | ||
710 | { | ||
711 | .callback = intel_no_lvds_dmi_callback, | ||
704 | .ident = "Aopen i945GTt-VFA", | 712 | .ident = "Aopen i945GTt-VFA", |
705 | .matches = { | 713 | .matches = { |
706 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), | 714 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 1d306a458be6..743664187fef 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -1367,6 +1367,12 @@ void intel_setup_overlay(struct drm_device *dev) | |||
1367 | goto out_free_bo; | 1367 | goto out_free_bo; |
1368 | } | 1368 | } |
1369 | overlay->flip_addr = overlay->reg_bo->gtt_offset; | 1369 | overlay->flip_addr = overlay->reg_bo->gtt_offset; |
1370 | |||
1371 | ret = i915_gem_object_set_to_gtt_domain(reg_bo, true); | ||
1372 | if (ret) { | ||
1373 | DRM_ERROR("failed to move overlay register bo into the GTT\n"); | ||
1374 | goto out_unpin_bo; | ||
1375 | } | ||
1370 | } else { | 1376 | } else { |
1371 | ret = i915_gem_attach_phys_object(dev, reg_bo, | 1377 | ret = i915_gem_attach_phys_object(dev, reg_bo, |
1372 | I915_GEM_PHYS_OVERLAY_REGS, | 1378 | I915_GEM_PHYS_OVERLAY_REGS, |
@@ -1399,6 +1405,8 @@ void intel_setup_overlay(struct drm_device *dev) | |||
1399 | DRM_INFO("initialized overlay support\n"); | 1405 | DRM_INFO("initialized overlay support\n"); |
1400 | return; | 1406 | return; |
1401 | 1407 | ||
1408 | out_unpin_bo: | ||
1409 | i915_gem_object_unpin(reg_bo); | ||
1402 | out_free_bo: | 1410 | out_free_bo: |
1403 | drm_gem_object_unreference(reg_bo); | 1411 | drm_gem_object_unreference(reg_bo); |
1404 | out_free: | 1412 | out_free: |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index ee73e428a84a..b60652bfd1a3 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1498,10 +1498,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
1498 | if (!intel_sdvo_write_cmd(intel_sdvo, | 1498 | if (!intel_sdvo_write_cmd(intel_sdvo, |
1499 | SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) | 1499 | SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) |
1500 | return connector_status_unknown; | 1500 | return connector_status_unknown; |
1501 | if (intel_sdvo->is_tv) { | 1501 | |
1502 | /* add 30ms delay when the output type is SDVO-TV */ | 1502 | /* add 30ms delay when the output type might be TV */ |
1503 | if (intel_sdvo->caps.output_flags & | ||
1504 | (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_CVBS0)) | ||
1503 | mdelay(30); | 1505 | mdelay(30); |
1504 | } | 1506 | |
1505 | if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) | 1507 | if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) |
1506 | return connector_status_unknown; | 1508 | return connector_status_unknown; |
1507 | 1509 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b1be617373b6..c926d8891a46 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -531,6 +531,12 @@ struct drm_nouveau_private { | |||
531 | struct work_struct irq_work; | 531 | struct work_struct irq_work; |
532 | struct work_struct hpd_work; | 532 | struct work_struct hpd_work; |
533 | 533 | ||
534 | struct { | ||
535 | spinlock_t lock; | ||
536 | uint32_t hpd0_bits; | ||
537 | uint32_t hpd1_bits; | ||
538 | } hpd_state; | ||
539 | |||
534 | struct list_head vbl_waiting; | 540 | struct list_head vbl_waiting; |
535 | 541 | ||
536 | struct { | 542 | struct { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 794b0ee30cf6..b62a601737a4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -52,6 +52,7 @@ nouveau_irq_preinstall(struct drm_device *dev) | |||
52 | if (dev_priv->card_type >= NV_50) { | 52 | if (dev_priv->card_type >= NV_50) { |
53 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); | 53 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); |
54 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); | 54 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); |
55 | spin_lock_init(&dev_priv->hpd_state.lock); | ||
55 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); | 56 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); |
56 | } | 57 | } |
57 | } | 58 | } |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 612fa6d6a0cb..d967cb65d641 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1012,11 +1012,18 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
1012 | struct drm_connector *connector; | 1012 | struct drm_connector *connector; |
1013 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; | 1013 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; |
1014 | uint32_t unplug_mask, plug_mask, change_mask; | 1014 | uint32_t unplug_mask, plug_mask, change_mask; |
1015 | uint32_t hpd0, hpd1 = 0; | 1015 | uint32_t hpd0, hpd1; |
1016 | 1016 | ||
1017 | hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); | 1017 | spin_lock_irq(&dev_priv->hpd_state.lock); |
1018 | hpd0 = dev_priv->hpd_state.hpd0_bits; | ||
1019 | dev_priv->hpd_state.hpd0_bits = 0; | ||
1020 | hpd1 = dev_priv->hpd_state.hpd1_bits; | ||
1021 | dev_priv->hpd_state.hpd1_bits = 0; | ||
1022 | spin_unlock_irq(&dev_priv->hpd_state.lock); | ||
1023 | |||
1024 | hpd0 &= nv_rd32(dev, 0xe050); | ||
1018 | if (dev_priv->chipset >= 0x90) | 1025 | if (dev_priv->chipset >= 0x90) |
1019 | hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); | 1026 | hpd1 &= nv_rd32(dev, 0xe070); |
1020 | 1027 | ||
1021 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); | 1028 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); |
1022 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); | 1029 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); |
@@ -1058,10 +1065,6 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
1058 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); | 1065 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); |
1059 | } | 1066 | } |
1060 | 1067 | ||
1061 | nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054)); | ||
1062 | if (dev_priv->chipset >= 0x90) | ||
1063 | nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074)); | ||
1064 | |||
1065 | drm_helper_hpd_irq_event(dev); | 1068 | drm_helper_hpd_irq_event(dev); |
1066 | } | 1069 | } |
1067 | 1070 | ||
@@ -1072,8 +1075,22 @@ nv50_display_irq_handler(struct drm_device *dev) | |||
1072 | uint32_t delayed = 0; | 1075 | uint32_t delayed = 0; |
1073 | 1076 | ||
1074 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { | 1077 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { |
1075 | if (!work_pending(&dev_priv->hpd_work)) | 1078 | uint32_t hpd0_bits, hpd1_bits = 0; |
1076 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | 1079 | |
1080 | hpd0_bits = nv_rd32(dev, 0xe054); | ||
1081 | nv_wr32(dev, 0xe054, hpd0_bits); | ||
1082 | |||
1083 | if (dev_priv->chipset >= 0x90) { | ||
1084 | hpd1_bits = nv_rd32(dev, 0xe074); | ||
1085 | nv_wr32(dev, 0xe074, hpd1_bits); | ||
1086 | } | ||
1087 | |||
1088 | spin_lock(&dev_priv->hpd_state.lock); | ||
1089 | dev_priv->hpd_state.hpd0_bits |= hpd0_bits; | ||
1090 | dev_priv->hpd_state.hpd1_bits |= hpd1_bits; | ||
1091 | spin_unlock(&dev_priv->hpd_state.lock); | ||
1092 | |||
1093 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | ||
1077 | } | 1094 | } |
1078 | 1095 | ||
1079 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { | 1096 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 8e421f644a54..05efb5b9f13e 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
112 | base += 3; | 112 | base += 3; |
113 | break; | 113 | break; |
114 | case ATOM_IIO_WRITE: | 114 | case ATOM_IIO_WRITE: |
115 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | ||
115 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); | 116 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
116 | base += 3; | 117 | base += 3; |
117 | break; | 118 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index cd0290f946cf..e226f47b497c 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
253 | case DRM_MODE_DPMS_SUSPEND: | 253 | case DRM_MODE_DPMS_SUSPEND: |
254 | case DRM_MODE_DPMS_OFF: | 254 | case DRM_MODE_DPMS_OFF: |
255 | drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); | 255 | drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); |
256 | atombios_blank_crtc(crtc, ATOM_ENABLE); | 256 | if (radeon_crtc->enabled) |
257 | atombios_blank_crtc(crtc, ATOM_ENABLE); | ||
257 | if (ASIC_IS_DCE3(rdev)) | 258 | if (ASIC_IS_DCE3(rdev)) |
258 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); | 259 | atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); |
259 | atombios_enable_crtc(crtc, ATOM_DISABLE); | 260 | atombios_enable_crtc(crtc, ATOM_DISABLE); |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 4e7778d44b8d..695de9a38506 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | |||
187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | 187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) |
188 | { | 188 | { |
189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); | 189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); |
190 | int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); | 190 | int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock); |
191 | 191 | ||
192 | if ((lanes == 0) || (bw == 0)) | 192 | if ((lanes == 0) || (dp_clock == 0)) |
193 | return MODE_CLOCK_HIGH; | 193 | return MODE_CLOCK_HIGH; |
194 | 194 | ||
195 | return MODE_OK; | 195 | return MODE_OK; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 2f93d46ae69a..9e3dd2fd2766 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1423,7 +1423,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev) | |||
1423 | static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | 1423 | static int evergreen_gpu_soft_reset(struct radeon_device *rdev) |
1424 | { | 1424 | { |
1425 | struct evergreen_mc_save save; | 1425 | struct evergreen_mc_save save; |
1426 | u32 srbm_reset = 0; | ||
1427 | u32 grbm_reset = 0; | 1426 | u32 grbm_reset = 0; |
1428 | 1427 | ||
1429 | dev_info(rdev->dev, "GPU softreset \n"); | 1428 | dev_info(rdev->dev, "GPU softreset \n"); |
@@ -1462,16 +1461,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
1462 | udelay(50); | 1461 | udelay(50); |
1463 | WREG32(GRBM_SOFT_RESET, 0); | 1462 | WREG32(GRBM_SOFT_RESET, 0); |
1464 | (void)RREG32(GRBM_SOFT_RESET); | 1463 | (void)RREG32(GRBM_SOFT_RESET); |
1465 | |||
1466 | /* reset all the system blocks */ | ||
1467 | srbm_reset = SRBM_SOFT_RESET_ALL_MASK; | ||
1468 | |||
1469 | dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset); | ||
1470 | WREG32(SRBM_SOFT_RESET, srbm_reset); | ||
1471 | (void)RREG32(SRBM_SOFT_RESET); | ||
1472 | udelay(50); | ||
1473 | WREG32(SRBM_SOFT_RESET, 0); | ||
1474 | (void)RREG32(SRBM_SOFT_RESET); | ||
1475 | /* Wait a little for things to settle down */ | 1464 | /* Wait a little for things to settle down */ |
1476 | udelay(50); | 1465 | udelay(50); |
1477 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", | 1466 | dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", |
@@ -1482,10 +1471,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev) | |||
1482 | RREG32(GRBM_STATUS_SE1)); | 1471 | RREG32(GRBM_STATUS_SE1)); |
1483 | dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", | 1472 | dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", |
1484 | RREG32(SRBM_STATUS)); | 1473 | RREG32(SRBM_STATUS)); |
1485 | /* After reset we need to reinit the asic as GPU often endup in an | ||
1486 | * incoherent state. | ||
1487 | */ | ||
1488 | atom_asic_init(rdev->mode_info.atom_context); | ||
1489 | evergreen_mc_resume(rdev, &save); | 1474 | evergreen_mc_resume(rdev, &save); |
1490 | return 0; | 1475 | return 0; |
1491 | } | 1476 | } |
@@ -2097,6 +2082,11 @@ int evergreen_resume(struct radeon_device *rdev) | |||
2097 | { | 2082 | { |
2098 | int r; | 2083 | int r; |
2099 | 2084 | ||
2085 | /* reset the asic, the gfx blocks are often in a bad state | ||
2086 | * after the driver is unloaded or after a resume | ||
2087 | */ | ||
2088 | if (radeon_asic_reset(rdev)) | ||
2089 | dev_warn(rdev->dev, "GPU reset failed !\n"); | ||
2100 | /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, | 2090 | /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, |
2101 | * posting will perform necessary task to bring back GPU into good | 2091 | * posting will perform necessary task to bring back GPU into good |
2102 | * shape. | 2092 | * shape. |
@@ -2193,6 +2183,11 @@ int evergreen_init(struct radeon_device *rdev) | |||
2193 | r = radeon_atombios_init(rdev); | 2183 | r = radeon_atombios_init(rdev); |
2194 | if (r) | 2184 | if (r) |
2195 | return r; | 2185 | return r; |
2186 | /* reset the asic, the gfx blocks are often in a bad state | ||
2187 | * after the driver is unloaded or after a resume | ||
2188 | */ | ||
2189 | if (radeon_asic_reset(rdev)) | ||
2190 | dev_warn(rdev->dev, "GPU reset failed !\n"); | ||
2196 | /* Post card if necessary */ | 2191 | /* Post card if necessary */ |
2197 | if (!evergreen_card_posted(rdev)) { | 2192 | if (!evergreen_card_posted(rdev)) { |
2198 | if (!rdev->bios) { | 2193 | if (!rdev->bios) { |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index e59422320bb6..0ba4163ee0a4 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2318,6 +2318,9 @@ void r100_vram_init_sizes(struct radeon_device *rdev) | |||
2318 | /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - | 2318 | /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - |
2319 | * Novell bug 204882 + along with lots of ubuntu ones | 2319 | * Novell bug 204882 + along with lots of ubuntu ones |
2320 | */ | 2320 | */ |
2321 | if (rdev->mc.aper_size > config_aper_size) | ||
2322 | config_aper_size = rdev->mc.aper_size; | ||
2323 | |||
2321 | if (config_aper_size > rdev->mc.real_vram_size) | 2324 | if (config_aper_size > rdev->mc.real_vram_size) |
2322 | rdev->mc.mc_vram_size = config_aper_size; | 2325 | rdev->mc.mc_vram_size = config_aper_size; |
2323 | else | 2326 | else |
@@ -3225,6 +3228,8 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, | |||
3225 | for (u = 0; u < track->num_texture; u++) { | 3228 | for (u = 0; u < track->num_texture; u++) { |
3226 | if (!track->textures[u].enabled) | 3229 | if (!track->textures[u].enabled) |
3227 | continue; | 3230 | continue; |
3231 | if (track->textures[u].lookup_disable) | ||
3232 | continue; | ||
3228 | robj = track->textures[u].robj; | 3233 | robj = track->textures[u].robj; |
3229 | if (robj == NULL) { | 3234 | if (robj == NULL) { |
3230 | DRM_ERROR("No texture bound to unit %u\n", u); | 3235 | DRM_ERROR("No texture bound to unit %u\n", u); |
@@ -3459,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track | |||
3459 | track->textures[i].robj = NULL; | 3464 | track->textures[i].robj = NULL; |
3460 | /* CS IB emission code makes sure texture unit are disabled */ | 3465 | /* CS IB emission code makes sure texture unit are disabled */ |
3461 | track->textures[i].enabled = false; | 3466 | track->textures[i].enabled = false; |
3467 | track->textures[i].lookup_disable = false; | ||
3462 | track->textures[i].roundup_w = true; | 3468 | track->textures[i].roundup_w = true; |
3463 | track->textures[i].roundup_h = true; | 3469 | track->textures[i].roundup_h = true; |
3464 | if (track->separate_cube) | 3470 | if (track->separate_cube) |
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h index f47cdca1c004..af65600e6564 100644 --- a/drivers/gpu/drm/radeon/r100_track.h +++ b/drivers/gpu/drm/radeon/r100_track.h | |||
@@ -46,6 +46,7 @@ struct r100_cs_track_texture { | |||
46 | unsigned height_11; | 46 | unsigned height_11; |
47 | bool use_pitch; | 47 | bool use_pitch; |
48 | bool enabled; | 48 | bool enabled; |
49 | bool lookup_disable; | ||
49 | bool roundup_w; | 50 | bool roundup_w; |
50 | bool roundup_h; | 51 | bool roundup_h; |
51 | unsigned compress_format; | 52 | unsigned compress_format; |
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c index 0266d72e0a4c..d2408c395619 100644 --- a/drivers/gpu/drm/radeon/r200.c +++ b/drivers/gpu/drm/radeon/r200.c | |||
@@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_parser *p, | |||
447 | track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); | 447 | track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); |
448 | track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); | 448 | track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); |
449 | } | 449 | } |
450 | if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE) | ||
451 | track->textures[i].lookup_disable = true; | ||
450 | switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { | 452 | switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { |
451 | case R200_TXFORMAT_I8: | 453 | case R200_TXFORMAT_I8: |
452 | case R200_TXFORMAT_RGB332: | 454 | case R200_TXFORMAT_RGB332: |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 7b65e4efe8af..74b9fb7a71df 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device *rdev) | |||
97 | { | 97 | { |
98 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> | 98 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> |
99 | ASIC_T_SHIFT; | 99 | ASIC_T_SHIFT; |
100 | u32 actual_temp = 0; | ||
101 | 100 | ||
102 | if ((temp >> 7) & 1) | 101 | return temp * 1000; |
103 | actual_temp = 0; | ||
104 | else | ||
105 | actual_temp = (temp >> 1) & 0xff; | ||
106 | |||
107 | return actual_temp * 1000; | ||
108 | } | 102 | } |
109 | 103 | ||
110 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) | 104 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) |
@@ -884,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
884 | u32 tmp; | 878 | u32 tmp; |
885 | 879 | ||
886 | /* flush hdp cache so updates hit vram */ | 880 | /* flush hdp cache so updates hit vram */ |
887 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { | 881 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
882 | !(rdev->flags & RADEON_IS_AGP)) { | ||
888 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; | 883 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; |
889 | u32 tmp; | 884 | u32 tmp; |
890 | 885 | ||
891 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 886 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
892 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 887 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL |
888 | * This seems to cause problems on some AGP cards. Just use the old | ||
889 | * method for them. | ||
893 | */ | 890 | */ |
894 | WREG32(HDP_DEBUG1, 0); | 891 | WREG32(HDP_DEBUG1, 0); |
895 | tmp = readl((void __iomem *)ptr); | 892 | tmp = readl((void __iomem *)ptr); |
@@ -1201,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
1201 | mc->vram_end, mc->real_vram_size >> 20); | 1198 | mc->vram_end, mc->real_vram_size >> 20); |
1202 | } else { | 1199 | } else { |
1203 | u64 base = 0; | 1200 | u64 base = 0; |
1204 | if (rdev->flags & RADEON_IS_IGP) | 1201 | if (rdev->flags & RADEON_IS_IGP) { |
1205 | base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; | 1202 | base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF; |
1203 | base <<= 24; | ||
1204 | } | ||
1206 | radeon_vram_location(rdev, &rdev->mc, base); | 1205 | radeon_vram_location(rdev, &rdev->mc, base); |
1207 | rdev->mc.gtt_base_align = 0; | 1206 | rdev->mc.gtt_base_align = 0; |
1208 | radeon_gtt_location(rdev, mc); | 1207 | radeon_gtt_location(rdev, mc); |
@@ -1608,8 +1607,11 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
1608 | rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; | 1607 | rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; |
1609 | rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); | 1608 | rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1610 | tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); | 1609 | tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1611 | tiling_config |= GROUP_SIZE(0); | 1610 | tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); |
1612 | rdev->config.r600.tiling_group_size = 256; | 1611 | if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) |
1612 | rdev->config.r600.tiling_group_size = 512; | ||
1613 | else | ||
1614 | rdev->config.r600.tiling_group_size = 256; | ||
1613 | tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; | 1615 | tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
1614 | if (tmp > 3) { | 1616 | if (tmp > 3) { |
1615 | tiling_config |= ROW_TILING(3); | 1617 | tiling_config |= ROW_TILING(3); |
@@ -3528,10 +3530,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev) | |||
3528 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) | 3530 | void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) |
3529 | { | 3531 | { |
3530 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 3532 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
3531 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 3533 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL. |
3534 | * This seems to cause problems on some AGP cards. Just use the old | ||
3535 | * method for them. | ||
3532 | */ | 3536 | */ |
3533 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && | 3537 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
3534 | rdev->vram_scratch.ptr) { | 3538 | rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) { |
3535 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | 3539 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; |
3536 | u32 tmp; | 3540 | u32 tmp; |
3537 | 3541 | ||
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 3473c00781ff..e5d4928fd2dc 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -650,8 +650,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev, | |||
650 | int src_x = src_gpu_addr & 255; | 650 | int src_x = src_gpu_addr & 255; |
651 | int dst_x = dst_gpu_addr & 255; | 651 | int dst_x = dst_gpu_addr & 255; |
652 | int h = 1; | 652 | int h = 1; |
653 | src_gpu_addr = src_gpu_addr & ~255; | 653 | src_gpu_addr = src_gpu_addr & ~255ULL; |
654 | dst_gpu_addr = dst_gpu_addr & ~255; | 654 | dst_gpu_addr = dst_gpu_addr & ~255ULL; |
655 | 655 | ||
656 | if (!src_x && !dst_x) { | 656 | if (!src_x && !dst_x) { |
657 | h = (cur_size / max_bytes); | 657 | h = (cur_size / max_bytes); |
@@ -744,8 +744,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev, | |||
744 | int src_x = (src_gpu_addr & 255); | 744 | int src_x = (src_gpu_addr & 255); |
745 | int dst_x = (dst_gpu_addr & 255); | 745 | int dst_x = (dst_gpu_addr & 255); |
746 | int h = 1; | 746 | int h = 1; |
747 | src_gpu_addr = src_gpu_addr & ~255; | 747 | src_gpu_addr = src_gpu_addr & ~255ULL; |
748 | dst_gpu_addr = dst_gpu_addr & ~255; | 748 | dst_gpu_addr = dst_gpu_addr & ~255ULL; |
749 | 749 | ||
750 | if (!src_x && !dst_x) { | 750 | if (!src_x && !dst_x) { |
751 | h = (cur_size / max_bytes); | 751 | h = (cur_size / max_bytes); |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 250a3a918193..478fddf08f9a 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -228,7 +228,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
228 | __func__, __LINE__, pitch); | 228 | __func__, __LINE__, pitch); |
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | } | 230 | } |
231 | if (!IS_ALIGNED((height / 8), track->nbanks)) { | 231 | if (!IS_ALIGNED((height / 8), track->npipes)) { |
232 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | 232 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", |
233 | __func__, __LINE__, height); | 233 | __func__, __LINE__, height); |
234 | return -EINVAL; | 234 | return -EINVAL; |
@@ -367,7 +367,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
367 | __func__, __LINE__, pitch); | 367 | __func__, __LINE__, pitch); |
368 | return -EINVAL; | 368 | return -EINVAL; |
369 | } | 369 | } |
370 | if ((height / 8) & (track->nbanks - 1)) { | 370 | if (!IS_ALIGNED((height / 8), track->npipes)) { |
371 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | 371 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", |
372 | __func__, __LINE__, height); | 372 | __func__, __LINE__, height); |
373 | return -EINVAL; | 373 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h index d84612ae47e0..33cda016b083 100644 --- a/drivers/gpu/drm/radeon/r600_reg.h +++ b/drivers/gpu/drm/radeon/r600_reg.h | |||
@@ -86,6 +86,7 @@ | |||
86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 | 86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 |
87 | 87 | ||
88 | #define R600_BUS_CNTL 0x5420 | 88 | #define R600_BUS_CNTL 0x5420 |
89 | # define R600_BIOS_ROM_DIS (1 << 1) | ||
89 | #define R600_CONFIG_CNTL 0x5424 | 90 | #define R600_CONFIG_CNTL 0x5424 |
90 | #define R600_CONFIG_MEMSIZE 0x5428 | 91 | #define R600_CONFIG_MEMSIZE 0x5428 |
91 | #define R600_CONFIG_F0_BASE 0x542C | 92 | #define R600_CONFIG_F0_BASE 0x542C |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 8e43ddae70cc..85a0d9f1f82b 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /* some DCE3 boards have bad data for this entry */ | ||
102 | if (ASIC_IS_DCE3(rdev)) { | ||
103 | if ((i == 4) && | ||
104 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | ||
105 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
106 | gpio->sucI2cId.ucAccess = 0x14; | ||
107 | } | ||
108 | |||
101 | if (gpio->sucI2cId.ucAccess == id) { | 109 | if (gpio->sucI2cId.ucAccess == id) { |
102 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 110 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
103 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 111 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
174 | } | 182 | } |
175 | } | 183 | } |
176 | 184 | ||
185 | /* some DCE3 boards have bad data for this entry */ | ||
186 | if (ASIC_IS_DCE3(rdev)) { | ||
187 | if ((i == 4) && | ||
188 | (gpio->usClkMaskRegisterIndex == 0x1fda) && | ||
189 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
190 | gpio->sucI2cId.ucAccess = 0x14; | ||
191 | } | ||
192 | |||
177 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 193 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
178 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | 194 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
179 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | 195 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; |
@@ -297,7 +313,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
297 | uint16_t *line_mux, | 313 | uint16_t *line_mux, |
298 | struct radeon_hpd *hpd) | 314 | struct radeon_hpd *hpd) |
299 | { | 315 | { |
300 | struct radeon_device *rdev = dev->dev_private; | ||
301 | 316 | ||
302 | /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ | 317 | /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ |
303 | if ((dev->pdev->device == 0x791e) && | 318 | if ((dev->pdev->device == 0x791e) && |
@@ -372,6 +387,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
372 | *line_mux = 0x90; | 387 | *line_mux = 0x90; |
373 | } | 388 | } |
374 | 389 | ||
390 | /* mac rv630, rv730, others */ | ||
391 | if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && | ||
392 | (*connector_type == DRM_MODE_CONNECTOR_DVII)) { | ||
393 | *connector_type = DRM_MODE_CONNECTOR_9PinDIN; | ||
394 | *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; | ||
395 | } | ||
396 | |||
375 | /* ASUS HD 3600 XT board lists the DVI port as HDMI */ | 397 | /* ASUS HD 3600 XT board lists the DVI port as HDMI */ |
376 | if ((dev->pdev->device == 0x9598) && | 398 | if ((dev->pdev->device == 0x9598) && |
377 | (dev->pdev->subsystem_vendor == 0x1043) && | 399 | (dev->pdev->subsystem_vendor == 0x1043) && |
@@ -409,21 +431,23 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
409 | } | 431 | } |
410 | } | 432 | } |
411 | 433 | ||
412 | /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ | 434 | /* Acer laptop (Acer TravelMate 5730G) has an HDMI port |
435 | * on the laptop and a DVI port on the docking station and | ||
436 | * both share the same encoder, hpd pin, and ddc line. | ||
437 | * So while the bios table is technically correct, | ||
438 | * we drop the DVI port here since xrandr has no concept of | ||
439 | * encoders and will try and drive both connectors | ||
440 | * with different crtcs which isn't possible on the hardware | ||
441 | * side and leaves no crtcs for LVDS or VGA. | ||
442 | */ | ||
413 | if ((dev->pdev->device == 0x95c4) && | 443 | if ((dev->pdev->device == 0x95c4) && |
414 | (dev->pdev->subsystem_vendor == 0x1025) && | 444 | (dev->pdev->subsystem_vendor == 0x1025) && |
415 | (dev->pdev->subsystem_device == 0x013c)) { | 445 | (dev->pdev->subsystem_device == 0x013c)) { |
416 | struct radeon_gpio_rec gpio; | ||
417 | |||
418 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && | 446 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && |
419 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { | 447 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { |
420 | gpio = radeon_lookup_gpio(rdev, 6); | 448 | /* actually it's a DVI-D port not DVI-I */ |
421 | *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); | ||
422 | *connector_type = DRM_MODE_CONNECTOR_DVID; | 449 | *connector_type = DRM_MODE_CONNECTOR_DVID; |
423 | } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && | 450 | return false; |
424 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { | ||
425 | gpio = radeon_lookup_gpio(rdev, 7); | ||
426 | *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); | ||
427 | } | 451 | } |
428 | } | 452 | } |
429 | 453 | ||
@@ -2279,7 +2303,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) | |||
2279 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; | 2303 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; |
2280 | 2304 | ||
2281 | /* tell the bios not to handle mode switching */ | 2305 | /* tell the bios not to handle mode switching */ |
2282 | bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); | 2306 | bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; |
2283 | 2307 | ||
2284 | if (rdev->family >= CHIP_R600) { | 2308 | if (rdev->family >= CHIP_R600) { |
2285 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); | 2309 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); |
@@ -2330,10 +2354,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) | |||
2330 | else | 2354 | else |
2331 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); | 2355 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); |
2332 | 2356 | ||
2333 | if (lock) | 2357 | if (lock) { |
2334 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; | 2358 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; |
2335 | else | 2359 | bios_6_scratch &= ~ATOM_S6_ACC_MODE; |
2360 | } else { | ||
2336 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; | 2361 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; |
2362 | bios_6_scratch |= ATOM_S6_ACC_MODE; | ||
2363 | } | ||
2337 | 2364 | ||
2338 | if (rdev->family >= CHIP_R600) | 2365 | if (rdev->family >= CHIP_R600) |
2339 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); | 2366 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 654787ec43f4..8f2c7b50dcf5 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) | |||
130 | } | 130 | } |
131 | return true; | 131 | return true; |
132 | } | 132 | } |
133 | |||
133 | static bool r700_read_disabled_bios(struct radeon_device *rdev) | 134 | static bool r700_read_disabled_bios(struct radeon_device *rdev) |
134 | { | 135 | { |
135 | uint32_t viph_control; | 136 | uint32_t viph_control; |
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
143 | bool r; | 144 | bool r; |
144 | 145 | ||
145 | viph_control = RREG32(RADEON_VIPH_CONTROL); | 146 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
146 | bus_cntl = RREG32(RADEON_BUS_CNTL); | 147 | bus_cntl = RREG32(R600_BUS_CNTL); |
147 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); | 148 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
148 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); | 149 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
149 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); | 150 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
152 | /* disable VIP */ | 153 | /* disable VIP */ |
153 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); | 154 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
154 | /* enable the rom */ | 155 | /* enable the rom */ |
155 | WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); | 156 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
156 | /* Disable VGA mode */ | 157 | /* Disable VGA mode */ |
157 | WREG32(AVIVO_D1VGA_CONTROL, | 158 | WREG32(AVIVO_D1VGA_CONTROL, |
158 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 159 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) | |||
191 | cg_spll_status = RREG32(R600_CG_SPLL_STATUS); | 192 | cg_spll_status = RREG32(R600_CG_SPLL_STATUS); |
192 | } | 193 | } |
193 | WREG32(RADEON_VIPH_CONTROL, viph_control); | 194 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
194 | WREG32(RADEON_BUS_CNTL, bus_cntl); | 195 | WREG32(R600_BUS_CNTL, bus_cntl); |
195 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); | 196 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
196 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); | 197 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
197 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | 198 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
216 | bool r; | 217 | bool r; |
217 | 218 | ||
218 | viph_control = RREG32(RADEON_VIPH_CONTROL); | 219 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
219 | bus_cntl = RREG32(RADEON_BUS_CNTL); | 220 | bus_cntl = RREG32(R600_BUS_CNTL); |
220 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); | 221 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
221 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); | 222 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
222 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); | 223 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
231 | /* disable VIP */ | 232 | /* disable VIP */ |
232 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); | 233 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
233 | /* enable the rom */ | 234 | /* enable the rom */ |
234 | WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); | 235 | WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
235 | /* Disable VGA mode */ | 236 | /* Disable VGA mode */ |
236 | WREG32(AVIVO_D1VGA_CONTROL, | 237 | WREG32(AVIVO_D1VGA_CONTROL, |
237 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | | 238 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) | |||
262 | 263 | ||
263 | /* restore regs */ | 264 | /* restore regs */ |
264 | WREG32(RADEON_VIPH_CONTROL, viph_control); | 265 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
265 | WREG32(RADEON_BUS_CNTL, bus_cntl); | 266 | WREG32(R600_BUS_CNTL, bus_cntl); |
266 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); | 267 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
267 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); | 268 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
268 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); | 269 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 7b7ea269549c..137b8075f6e7 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
571 | } | 571 | } |
572 | 572 | ||
573 | if (clk_mask && data_mask) { | 573 | if (clk_mask && data_mask) { |
574 | /* system specific masks */ | ||
574 | i2c.mask_clk_mask = clk_mask; | 575 | i2c.mask_clk_mask = clk_mask; |
575 | i2c.mask_data_mask = data_mask; | 576 | i2c.mask_data_mask = data_mask; |
576 | i2c.a_clk_mask = clk_mask; | 577 | i2c.a_clk_mask = clk_mask; |
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
579 | i2c.en_data_mask = data_mask; | 580 | i2c.en_data_mask = data_mask; |
580 | i2c.y_clk_mask = clk_mask; | 581 | i2c.y_clk_mask = clk_mask; |
581 | i2c.y_data_mask = data_mask; | 582 | i2c.y_data_mask = data_mask; |
583 | } else if ((ddc_line == RADEON_GPIOPAD_MASK) || | ||
584 | (ddc_line == RADEON_MDGPIO_MASK)) { | ||
585 | /* default gpiopad masks */ | ||
586 | i2c.mask_clk_mask = (0x20 << 8); | ||
587 | i2c.mask_data_mask = 0x80; | ||
588 | i2c.a_clk_mask = (0x20 << 8); | ||
589 | i2c.a_data_mask = 0x80; | ||
590 | i2c.en_clk_mask = (0x20 << 8); | ||
591 | i2c.en_data_mask = 0x80; | ||
592 | i2c.y_clk_mask = (0x20 << 8); | ||
593 | i2c.y_data_mask = 0x80; | ||
582 | } else { | 594 | } else { |
595 | /* default masks for ddc pads */ | ||
583 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | 596 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; |
584 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | 597 | i2c.mask_data_mask = RADEON_GPIO_EN_0; |
585 | i2c.a_clk_mask = RADEON_GPIO_A_1; | 598 | i2c.a_clk_mask = RADEON_GPIO_A_1; |
@@ -716,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) | |||
716 | clk = RBIOS8(offset + 3 + (i * 5) + 3); | 729 | clk = RBIOS8(offset + 3 + (i * 5) + 3); |
717 | data = RBIOS8(offset + 3 + (i * 5) + 4); | 730 | data = RBIOS8(offset + 3 + (i * 5) + 4); |
718 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, | 731 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, |
719 | clk, data); | 732 | (1 << clk), (1 << data)); |
720 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); | 733 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); |
721 | break; | 734 | break; |
722 | } | 735 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index ecc1a8fafbfd..5e222c9739c7 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1119 | /* no HPD on analog connectors */ | 1119 | /* no HPD on analog connectors */ |
1120 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1120 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1121 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 1121 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1122 | connector->interlace_allowed = true; | ||
1123 | connector->doublescan_allowed = true; | ||
1122 | break; | 1124 | break; |
1123 | case DRM_MODE_CONNECTOR_DVIA: | 1125 | case DRM_MODE_CONNECTOR_DVIA: |
1124 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1126 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
@@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1134 | 1); | 1136 | 1); |
1135 | /* no HPD on analog connectors */ | 1137 | /* no HPD on analog connectors */ |
1136 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1138 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1139 | connector->interlace_allowed = true; | ||
1140 | connector->doublescan_allowed = true; | ||
1137 | break; | 1141 | break; |
1138 | case DRM_MODE_CONNECTOR_DVII: | 1142 | case DRM_MODE_CONNECTOR_DVII: |
1139 | case DRM_MODE_CONNECTOR_DVID: | 1143 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1163 | rdev->mode_info.load_detect_property, | 1167 | rdev->mode_info.load_detect_property, |
1164 | 1); | 1168 | 1); |
1165 | } | 1169 | } |
1170 | connector->interlace_allowed = true; | ||
1171 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
1172 | connector->doublescan_allowed = true; | ||
1173 | else | ||
1174 | connector->doublescan_allowed = false; | ||
1166 | break; | 1175 | break; |
1167 | case DRM_MODE_CONNECTOR_HDMIA: | 1176 | case DRM_MODE_CONNECTOR_HDMIA: |
1168 | case DRM_MODE_CONNECTOR_HDMIB: | 1177 | case DRM_MODE_CONNECTOR_HDMIB: |
@@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1186 | rdev->mode_info.underscan_property, | 1195 | rdev->mode_info.underscan_property, |
1187 | UNDERSCAN_AUTO); | 1196 | UNDERSCAN_AUTO); |
1188 | subpixel_order = SubPixelHorizontalRGB; | 1197 | subpixel_order = SubPixelHorizontalRGB; |
1198 | connector->interlace_allowed = true; | ||
1199 | if (connector_type == DRM_MODE_CONNECTOR_HDMIB) | ||
1200 | connector->doublescan_allowed = true; | ||
1201 | else | ||
1202 | connector->doublescan_allowed = false; | ||
1189 | break; | 1203 | break; |
1190 | case DRM_MODE_CONNECTOR_DisplayPort: | 1204 | case DRM_MODE_CONNECTOR_DisplayPort: |
1191 | case DRM_MODE_CONNECTOR_eDP: | 1205 | case DRM_MODE_CONNECTOR_eDP: |
@@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1216 | drm_connector_attach_property(&radeon_connector->base, | 1230 | drm_connector_attach_property(&radeon_connector->base, |
1217 | rdev->mode_info.underscan_property, | 1231 | rdev->mode_info.underscan_property, |
1218 | UNDERSCAN_AUTO); | 1232 | UNDERSCAN_AUTO); |
1233 | connector->interlace_allowed = true; | ||
1234 | /* in theory with a DP to VGA converter... */ | ||
1235 | connector->doublescan_allowed = false; | ||
1219 | break; | 1236 | break; |
1220 | case DRM_MODE_CONNECTOR_SVIDEO: | 1237 | case DRM_MODE_CONNECTOR_SVIDEO: |
1221 | case DRM_MODE_CONNECTOR_Composite: | 1238 | case DRM_MODE_CONNECTOR_Composite: |
@@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1231 | radeon_atombios_get_tv_info(rdev)); | 1248 | radeon_atombios_get_tv_info(rdev)); |
1232 | /* no HPD on analog connectors */ | 1249 | /* no HPD on analog connectors */ |
1233 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1250 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1251 | connector->interlace_allowed = false; | ||
1252 | connector->doublescan_allowed = false; | ||
1234 | break; | 1253 | break; |
1235 | case DRM_MODE_CONNECTOR_LVDS: | 1254 | case DRM_MODE_CONNECTOR_LVDS: |
1236 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); | 1255 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
@@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1249 | dev->mode_config.scaling_mode_property, | 1268 | dev->mode_config.scaling_mode_property, |
1250 | DRM_MODE_SCALE_FULLSCREEN); | 1269 | DRM_MODE_SCALE_FULLSCREEN); |
1251 | subpixel_order = SubPixelHorizontalRGB; | 1270 | subpixel_order = SubPixelHorizontalRGB; |
1271 | connector->interlace_allowed = false; | ||
1272 | connector->doublescan_allowed = false; | ||
1252 | break; | 1273 | break; |
1253 | } | 1274 | } |
1254 | 1275 | ||
@@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1326 | /* no HPD on analog connectors */ | 1347 | /* no HPD on analog connectors */ |
1327 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1348 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1328 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 1349 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
1350 | connector->interlace_allowed = true; | ||
1351 | connector->doublescan_allowed = true; | ||
1329 | break; | 1352 | break; |
1330 | case DRM_MODE_CONNECTOR_DVIA: | 1353 | case DRM_MODE_CONNECTOR_DVIA: |
1331 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1354 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
@@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1341 | 1); | 1364 | 1); |
1342 | /* no HPD on analog connectors */ | 1365 | /* no HPD on analog connectors */ |
1343 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1366 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1367 | connector->interlace_allowed = true; | ||
1368 | connector->doublescan_allowed = true; | ||
1344 | break; | 1369 | break; |
1345 | case DRM_MODE_CONNECTOR_DVII: | 1370 | case DRM_MODE_CONNECTOR_DVII: |
1346 | case DRM_MODE_CONNECTOR_DVID: | 1371 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1358 | 1); | 1383 | 1); |
1359 | } | 1384 | } |
1360 | subpixel_order = SubPixelHorizontalRGB; | 1385 | subpixel_order = SubPixelHorizontalRGB; |
1386 | connector->interlace_allowed = true; | ||
1387 | if (connector_type == DRM_MODE_CONNECTOR_DVII) | ||
1388 | connector->doublescan_allowed = true; | ||
1389 | else | ||
1390 | connector->doublescan_allowed = false; | ||
1361 | break; | 1391 | break; |
1362 | case DRM_MODE_CONNECTOR_SVIDEO: | 1392 | case DRM_MODE_CONNECTOR_SVIDEO: |
1363 | case DRM_MODE_CONNECTOR_Composite: | 1393 | case DRM_MODE_CONNECTOR_Composite: |
@@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1380 | radeon_combios_get_tv_info(rdev)); | 1410 | radeon_combios_get_tv_info(rdev)); |
1381 | /* no HPD on analog connectors */ | 1411 | /* no HPD on analog connectors */ |
1382 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; | 1412 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
1413 | connector->interlace_allowed = false; | ||
1414 | connector->doublescan_allowed = false; | ||
1383 | break; | 1415 | break; |
1384 | case DRM_MODE_CONNECTOR_LVDS: | 1416 | case DRM_MODE_CONNECTOR_LVDS: |
1385 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 1417 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
@@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1393 | dev->mode_config.scaling_mode_property, | 1425 | dev->mode_config.scaling_mode_property, |
1394 | DRM_MODE_SCALE_FULLSCREEN); | 1426 | DRM_MODE_SCALE_FULLSCREEN); |
1395 | subpixel_order = SubPixelHorizontalRGB; | 1427 | subpixel_order = SubPixelHorizontalRGB; |
1428 | connector->interlace_allowed = false; | ||
1429 | connector->doublescan_allowed = false; | ||
1396 | break; | 1430 | break; |
1397 | } | 1431 | } |
1398 | 1432 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 256d204a6d24..ed5e153384ac 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -829,11 +829,6 @@ int radeon_resume_kms(struct drm_device *dev) | |||
829 | radeon_pm_resume(rdev); | 829 | radeon_pm_resume(rdev); |
830 | radeon_restore_bios_scratch_regs(rdev); | 830 | radeon_restore_bios_scratch_regs(rdev); |
831 | 831 | ||
832 | /* turn on display hw */ | ||
833 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
834 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | ||
835 | } | ||
836 | |||
837 | radeon_fbdev_set_suspend(rdev, 0); | 832 | radeon_fbdev_set_suspend(rdev, 0); |
838 | release_console_sem(); | 833 | release_console_sem(); |
839 | 834 | ||
@@ -841,6 +836,10 @@ int radeon_resume_kms(struct drm_device *dev) | |||
841 | radeon_hpd_init(rdev); | 836 | radeon_hpd_init(rdev); |
842 | /* blat the mode back in */ | 837 | /* blat the mode back in */ |
843 | drm_helper_resume_force_mode(dev); | 838 | drm_helper_resume_force_mode(dev); |
839 | /* turn on display hw */ | ||
840 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
841 | drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); | ||
842 | } | ||
844 | return 0; | 843 | return 0; |
845 | } | 844 | } |
846 | 845 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index b92d2f2fcbed..4da243ac79d7 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -629,6 +629,10 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll, | |||
629 | *frac_fb_div_p = best_frac_feedback_div; | 629 | *frac_fb_div_p = best_frac_feedback_div; |
630 | *ref_div_p = best_ref_div; | 630 | *ref_div_p = best_ref_div; |
631 | *post_div_p = best_post_div; | 631 | *post_div_p = best_post_div; |
632 | DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n", | ||
633 | freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div, | ||
634 | best_ref_div, best_post_div); | ||
635 | |||
632 | } | 636 | } |
633 | 637 | ||
634 | static bool | 638 | static bool |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 2c293e8304d6..b82015e148e6 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
595 | int | 595 | int |
596 | atombios_get_encoder_mode(struct drm_encoder *encoder) | 596 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
597 | { | 597 | { |
598 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
598 | struct drm_device *dev = encoder->dev; | 599 | struct drm_device *dev = encoder->dev; |
599 | struct radeon_device *rdev = dev->dev_private; | 600 | struct radeon_device *rdev = dev->dev_private; |
600 | struct drm_connector *connector; | 601 | struct drm_connector *connector; |
@@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
602 | struct radeon_connector_atom_dig *dig_connector; | 603 | struct radeon_connector_atom_dig *dig_connector; |
603 | 604 | ||
604 | connector = radeon_get_connector_for_encoder(encoder); | 605 | connector = radeon_get_connector_for_encoder(encoder); |
605 | if (!connector) | 606 | if (!connector) { |
606 | return 0; | 607 | switch (radeon_encoder->encoder_id) { |
607 | 608 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | |
609 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | ||
610 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | ||
611 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
612 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
613 | return ATOM_ENCODER_MODE_DVI; | ||
614 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | ||
615 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | ||
616 | default: | ||
617 | return ATOM_ENCODER_MODE_CRT; | ||
618 | } | ||
619 | } | ||
608 | radeon_connector = to_radeon_connector(connector); | 620 | radeon_connector = to_radeon_connector(connector); |
609 | 621 | ||
610 | switch (connector->connector_type) { | 622 | switch (connector->connector_type) { |
@@ -1547,6 +1559,23 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) | |||
1547 | struct radeon_device *rdev = dev->dev_private; | 1559 | struct radeon_device *rdev = dev->dev_private; |
1548 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1560 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1549 | struct radeon_encoder_atom_dig *dig; | 1561 | struct radeon_encoder_atom_dig *dig; |
1562 | |||
1563 | /* check for pre-DCE3 cards with shared encoders; | ||
1564 | * can't really use the links individually, so don't disable | ||
1565 | * the encoder if it's in use by another connector | ||
1566 | */ | ||
1567 | if (!ASIC_IS_DCE3(rdev)) { | ||
1568 | struct drm_encoder *other_encoder; | ||
1569 | struct radeon_encoder *other_radeon_encoder; | ||
1570 | |||
1571 | list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) { | ||
1572 | other_radeon_encoder = to_radeon_encoder(other_encoder); | ||
1573 | if ((radeon_encoder->encoder_id == other_radeon_encoder->encoder_id) && | ||
1574 | drm_helper_encoder_in_use(other_encoder)) | ||
1575 | goto disable_done; | ||
1576 | } | ||
1577 | } | ||
1578 | |||
1550 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | 1579 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); |
1551 | 1580 | ||
1552 | switch (radeon_encoder->encoder_id) { | 1581 | switch (radeon_encoder->encoder_id) { |
@@ -1586,6 +1615,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) | |||
1586 | break; | 1615 | break; |
1587 | } | 1616 | } |
1588 | 1617 | ||
1618 | disable_done: | ||
1589 | if (radeon_encoder_is_digital(encoder)) { | 1619 | if (radeon_encoder_is_digital(encoder)) { |
1590 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) | 1620 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) |
1591 | r600_hdmi_disable(encoder); | 1621 | r600_hdmi_disable(encoder); |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 6a13ee38a5b9..acae80ee91a2 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -946,6 +946,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | |||
946 | i2c->rec = *rec; | 946 | i2c->rec = *rec; |
947 | i2c->adapter.owner = THIS_MODULE; | 947 | i2c->adapter.owner = THIS_MODULE; |
948 | i2c->dev = dev; | 948 | i2c->dev = dev; |
949 | sprintf(i2c->adapter.name, "Radeon aux bus %s", name); | ||
949 | i2c_set_adapdata(&i2c->adapter, i2c); | 950 | i2c_set_adapdata(&i2c->adapter, i2c); |
950 | i2c->adapter.algo_data = &i2c->algo.dp; | 951 | i2c->adapter.algo_data = &i2c->algo.dp; |
951 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; | 952 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index b3b5306bb578..25d345ecee8e 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | |||
102 | type = ttm_bo_type_device; | 102 | type = ttm_bo_type_device; |
103 | } | 103 | } |
104 | *bo_ptr = NULL; | 104 | *bo_ptr = NULL; |
105 | |||
106 | retry: | ||
105 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); | 107 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
106 | if (bo == NULL) | 108 | if (bo == NULL) |
107 | return -ENOMEM; | 109 | return -ENOMEM; |
@@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | |||
109 | bo->gobj = gobj; | 111 | bo->gobj = gobj; |
110 | bo->surface_reg = -1; | 112 | bo->surface_reg = -1; |
111 | INIT_LIST_HEAD(&bo->list); | 113 | INIT_LIST_HEAD(&bo->list); |
112 | |||
113 | retry: | ||
114 | radeon_ttm_placement_from_domain(bo, domain); | 114 | radeon_ttm_placement_from_domain(bo, domain); |
115 | /* Kernel allocation are uninterruptible */ | 115 | /* Kernel allocation are uninterruptible */ |
116 | mutex_lock(&rdev->vram_mutex); | 116 | mutex_lock(&rdev->vram_mutex); |
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h index c332f46340d5..64928814de53 100644 --- a/drivers/gpu/drm/radeon/radeon_reg.h +++ b/drivers/gpu/drm/radeon/radeon_reg.h | |||
@@ -2836,6 +2836,7 @@ | |||
2836 | # define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) | 2836 | # define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) |
2837 | # define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) | 2837 | # define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) |
2838 | # define R200_TXFORMAT_ST_ROUTE_SHIFT 24 | 2838 | # define R200_TXFORMAT_ST_ROUTE_SHIFT 24 |
2839 | # define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27) | ||
2839 | # define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) | 2840 | # define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) |
2840 | # define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) | 2841 | # define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) |
2841 | # define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) | 2842 | # define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 9490da700749..b88353d6ed2e 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -643,10 +643,11 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
643 | else | 643 | else |
644 | gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); | 644 | gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
645 | rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); | 645 | rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); |
646 | 646 | gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); | |
647 | gb_tiling_config |= GROUP_SIZE(0); | 647 | if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) |
648 | rdev->config.rv770.tiling_group_size = 256; | 648 | rdev->config.rv770.tiling_group_size = 512; |
649 | 649 | else | |
650 | rdev->config.rv770.tiling_group_size = 256; | ||
650 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { | 651 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { |
651 | gb_tiling_config |= ROW_TILING(3); | 652 | gb_tiling_config |= ROW_TILING(3); |
652 | gb_tiling_config |= SAMPLE_SPLIT(3); | 653 | gb_tiling_config |= SAMPLE_SPLIT(3); |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index f366f968155a..d7def1790b41 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *pdev, void *cookie, | |||
636 | void (*irq_set_state)(void *cookie, bool state), | 636 | void (*irq_set_state)(void *cookie, bool state), |
637 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) | 637 | unsigned int (*set_vga_decode)(void *cookie, bool decode)) |
638 | { | 638 | { |
639 | int ret = -1; | 639 | int ret = -ENODEV; |
640 | struct vga_device *vgadev; | 640 | struct vga_device *vgadev; |
641 | unsigned long flags; | 641 | unsigned long flags; |
642 | 642 | ||
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c index 8ca7f65cf2f8..54b017ad258d 100644 --- a/drivers/hid/hid-egalax.c +++ b/drivers/hid/hid-egalax.c | |||
@@ -31,7 +31,7 @@ struct egalax_data { | |||
31 | bool first; /* is this the first finger in the frame? */ | 31 | bool first; /* is this the first finger in the frame? */ |
32 | bool valid; /* valid finger data, or just placeholder? */ | 32 | bool valid; /* valid finger data, or just placeholder? */ |
33 | bool activity; /* at least one active finger previously? */ | 33 | bool activity; /* at least one active finger previously? */ |
34 | __u16 lastx, lasty; /* latest valid (x, y) in the frame */ | 34 | __u16 lastx, lasty, lastz; /* latest valid (x, y, z) in the frame */ |
35 | }; | 35 | }; |
36 | 36 | ||
37 | static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, | 37 | static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
@@ -79,6 +79,10 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
79 | case HID_DG_TIPPRESSURE: | 79 | case HID_DG_TIPPRESSURE: |
80 | hid_map_usage(hi, usage, bit, max, | 80 | hid_map_usage(hi, usage, bit, max, |
81 | EV_ABS, ABS_MT_PRESSURE); | 81 | EV_ABS, ABS_MT_PRESSURE); |
82 | /* touchscreen emulation */ | ||
83 | input_set_abs_params(hi->input, ABS_PRESSURE, | ||
84 | field->logical_minimum, | ||
85 | field->logical_maximum, 0, 0); | ||
82 | return 1; | 86 | return 1; |
83 | } | 87 | } |
84 | return 0; | 88 | return 0; |
@@ -109,8 +113,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) | |||
109 | if (td->valid) { | 113 | if (td->valid) { |
110 | /* emit multitouch events */ | 114 | /* emit multitouch events */ |
111 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); | 115 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); |
112 | input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); | 116 | input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x >> 3); |
113 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); | 117 | input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y >> 3); |
114 | input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z); | 118 | input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z); |
115 | 119 | ||
116 | input_mt_sync(input); | 120 | input_mt_sync(input); |
@@ -121,6 +125,7 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) | |||
121 | */ | 125 | */ |
122 | td->lastx = td->x; | 126 | td->lastx = td->x; |
123 | td->lasty = td->y; | 127 | td->lasty = td->y; |
128 | td->lastz = td->z; | ||
124 | } | 129 | } |
125 | 130 | ||
126 | /* | 131 | /* |
@@ -129,8 +134,9 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) | |||
129 | * the oldest on the panel, the one we want for single touch | 134 | * the oldest on the panel, the one we want for single touch |
130 | */ | 135 | */ |
131 | if (!td->first && td->activity) { | 136 | if (!td->first && td->activity) { |
132 | input_event(input, EV_ABS, ABS_X, td->lastx); | 137 | input_event(input, EV_ABS, ABS_X, td->lastx >> 3); |
133 | input_event(input, EV_ABS, ABS_Y, td->lasty); | 138 | input_event(input, EV_ABS, ABS_Y, td->lasty >> 3); |
139 | input_event(input, EV_ABS, ABS_PRESSURE, td->lastz); | ||
134 | } | 140 | } |
135 | 141 | ||
136 | if (!td->valid) { | 142 | if (!td->valid) { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index f0260c699adb..859ee7e39f5b 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -34,7 +34,6 @@ static const struct hid_blacklist { | |||
34 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 34 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
35 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 35 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, | 36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, |
37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, | ||
38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, | 37 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, |
39 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, | 38 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, |
40 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 39 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 65335b268fa9..9975bbfb1b31 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -916,27 +916,27 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
916 | int nr = sensor_attr->index; | 916 | int nr = sensor_attr->index; |
917 | struct i2c_client *client = to_i2c_client(dev); | 917 | struct i2c_client *client = to_i2c_client(dev); |
918 | struct adm1026_data *data = i2c_get_clientdata(client); | 918 | struct adm1026_data *data = i2c_get_clientdata(client); |
919 | int val, orig_div, new_div, shift; | 919 | int val, orig_div, new_div; |
920 | 920 | ||
921 | val = simple_strtol(buf, NULL, 10); | 921 | val = simple_strtol(buf, NULL, 10); |
922 | new_div = DIV_TO_REG(val); | 922 | new_div = DIV_TO_REG(val); |
923 | if (new_div == 0) { | 923 | |
924 | return -EINVAL; | ||
925 | } | ||
926 | mutex_lock(&data->update_lock); | 924 | mutex_lock(&data->update_lock); |
927 | orig_div = data->fan_div[nr]; | 925 | orig_div = data->fan_div[nr]; |
928 | data->fan_div[nr] = DIV_FROM_REG(new_div); | 926 | data->fan_div[nr] = DIV_FROM_REG(new_div); |
929 | 927 | ||
930 | if (nr < 4) { /* 0 <= nr < 4 */ | 928 | if (nr < 4) { /* 0 <= nr < 4 */ |
931 | shift = 2 * nr; | ||
932 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, | 929 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, |
933 | ((DIV_TO_REG(orig_div) & (~(0x03 << shift))) | | 930 | (DIV_TO_REG(data->fan_div[0]) << 0) | |
934 | (new_div << shift))); | 931 | (DIV_TO_REG(data->fan_div[1]) << 2) | |
932 | (DIV_TO_REG(data->fan_div[2]) << 4) | | ||
933 | (DIV_TO_REG(data->fan_div[3]) << 6)); | ||
935 | } else { /* 3 < nr < 8 */ | 934 | } else { /* 3 < nr < 8 */ |
936 | shift = 2 * (nr - 4); | ||
937 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, | 935 | adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, |
938 | ((DIV_TO_REG(orig_div) & (~(0x03 << (2 * shift)))) | | 936 | (DIV_TO_REG(data->fan_div[4]) << 0) | |
939 | (new_div << shift))); | 937 | (DIV_TO_REG(data->fan_div[5]) << 2) | |
938 | (DIV_TO_REG(data->fan_div[6]) << 4) | | ||
939 | (DIV_TO_REG(data->fan_div[7]) << 6)); | ||
940 | } | 940 | } |
941 | 941 | ||
942 | if (data->fan_div[nr] != orig_div) { | 942 | if (data->fan_div[nr] != orig_div) { |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index b6598aa557a0..87a5fd51dd5e 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -162,6 +162,10 @@ static const char *temperature_sensors_sets[][41] = { | |||
162 | /* Set 22: MacBook Pro 7,1 */ | 162 | /* Set 22: MacBook Pro 7,1 */ |
163 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", | 163 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0P", "TN0D", "TN0P", "TN0S", |
164 | "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, | 164 | "TN1D", "TN1F", "TN1G", "TN1S", "Th1H", "Ts0P", "Ts0S", NULL }, |
165 | /* Set 23: MacBook Air 3,1 */ | ||
166 | { "TB0T", "TB1T", "TB2T", "TC0D", "TC0E", "TC0P", "TC1E", "TCZ3", | ||
167 | "TCZ4", "TCZ5", "TG0E", "TG1E", "TG2E", "TGZ3", "TGZ4", "TGZ5", | ||
168 | "TH0F", "TH0O", "TM0P" }, | ||
165 | }; | 169 | }; |
166 | 170 | ||
167 | /* List of keys used to read/write fan speeds */ | 171 | /* List of keys used to read/write fan speeds */ |
@@ -444,38 +448,22 @@ static int applesmc_read_motion_sensor(int index, s16* value) | |||
444 | } | 448 | } |
445 | 449 | ||
446 | /* | 450 | /* |
447 | * applesmc_device_init - initialize the accelerometer. Returns zero on success | 451 | * applesmc_device_init - initialize the accelerometer. Can sleep. |
448 | * and negative error code on failure. Can sleep. | ||
449 | */ | 452 | */ |
450 | static int applesmc_device_init(void) | 453 | static void applesmc_device_init(void) |
451 | { | 454 | { |
452 | int total, ret = -ENXIO; | 455 | int total; |
453 | u8 buffer[2]; | 456 | u8 buffer[2]; |
454 | 457 | ||
455 | if (!applesmc_accelerometer) | 458 | if (!applesmc_accelerometer) |
456 | return 0; | 459 | return; |
457 | 460 | ||
458 | mutex_lock(&applesmc_lock); | 461 | mutex_lock(&applesmc_lock); |
459 | 462 | ||
460 | for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { | 463 | for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { |
461 | if (debug) | ||
462 | printk(KERN_DEBUG "applesmc try %d\n", total); | ||
463 | if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && | 464 | if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && |
464 | (buffer[0] != 0x00 || buffer[1] != 0x00)) { | 465 | (buffer[0] != 0x00 || buffer[1] != 0x00)) |
465 | if (total == INIT_TIMEOUT_MSECS) { | ||
466 | printk(KERN_DEBUG "applesmc: device has" | ||
467 | " already been initialized" | ||
468 | " (0x%02x, 0x%02x).\n", | ||
469 | buffer[0], buffer[1]); | ||
470 | } else { | ||
471 | printk(KERN_DEBUG "applesmc: device" | ||
472 | " successfully initialized" | ||
473 | " (0x%02x, 0x%02x).\n", | ||
474 | buffer[0], buffer[1]); | ||
475 | } | ||
476 | ret = 0; | ||
477 | goto out; | 466 | goto out; |
478 | } | ||
479 | buffer[0] = 0xe0; | 467 | buffer[0] = 0xe0; |
480 | buffer[1] = 0x00; | 468 | buffer[1] = 0x00; |
481 | applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); | 469 | applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); |
@@ -486,7 +474,6 @@ static int applesmc_device_init(void) | |||
486 | 474 | ||
487 | out: | 475 | out: |
488 | mutex_unlock(&applesmc_lock); | 476 | mutex_unlock(&applesmc_lock); |
489 | return ret; | ||
490 | } | 477 | } |
491 | 478 | ||
492 | /* | 479 | /* |
@@ -512,13 +499,8 @@ static int applesmc_get_fan_count(void) | |||
512 | /* Device model stuff */ | 499 | /* Device model stuff */ |
513 | static int applesmc_probe(struct platform_device *dev) | 500 | static int applesmc_probe(struct platform_device *dev) |
514 | { | 501 | { |
515 | int ret; | 502 | applesmc_device_init(); |
516 | |||
517 | ret = applesmc_device_init(); | ||
518 | if (ret) | ||
519 | return ret; | ||
520 | 503 | ||
521 | printk(KERN_INFO "applesmc: device successfully initialized.\n"); | ||
522 | return 0; | 504 | return 0; |
523 | } | 505 | } |
524 | 506 | ||
@@ -535,9 +517,7 @@ static int applesmc_pm_resume(struct device *dev) | |||
535 | /* Reinitialize device on resume from hibernation */ | 517 | /* Reinitialize device on resume from hibernation */ |
536 | static int applesmc_pm_restore(struct device *dev) | 518 | static int applesmc_pm_restore(struct device *dev) |
537 | { | 519 | { |
538 | int ret = applesmc_device_init(); | 520 | applesmc_device_init(); |
539 | if (ret) | ||
540 | return ret; | ||
541 | return applesmc_pm_resume(dev); | 521 | return applesmc_pm_resume(dev); |
542 | } | 522 | } |
543 | 523 | ||
@@ -1524,11 +1504,17 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1524 | { .accelerometer = 1, .light = 1, .temperature_set = 21 }, | 1504 | { .accelerometer = 1, .light = 1, .temperature_set = 21 }, |
1525 | /* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ | 1505 | /* MacBook Pro 7,1: accelerometer, backlight and temperature set 22 */ |
1526 | { .accelerometer = 1, .light = 1, .temperature_set = 22 }, | 1506 | { .accelerometer = 1, .light = 1, .temperature_set = 22 }, |
1507 | /* MacBook Air 3,1: accelerometer, backlight and temperature set 23 */ | ||
1508 | { .accelerometer = 0, .light = 0, .temperature_set = 23 }, | ||
1527 | }; | 1509 | }; |
1528 | 1510 | ||
1529 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1511 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
1530 | * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ | 1512 | * So we need to put "Apple MacBook Pro" before "Apple MacBook". */ |
1531 | static __initdata struct dmi_system_id applesmc_whitelist[] = { | 1513 | static __initdata struct dmi_system_id applesmc_whitelist[] = { |
1514 | { applesmc_dmi_match, "Apple MacBook Air 3", { | ||
1515 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | ||
1516 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir3") }, | ||
1517 | &applesmc_dmi_data[23]}, | ||
1532 | { applesmc_dmi_match, "Apple MacBook Air 2", { | 1518 | { applesmc_dmi_match, "Apple MacBook Air 2", { |
1533 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), | 1519 | DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), |
1534 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, | 1520 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookAir2") }, |
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 776aeb3019d2..508cb291f71b 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -98,6 +98,9 @@ static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END }; | |||
98 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. | 98 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. |
99 | * For remote temperature, low and high limits, it uses signed 11-bit values | 99 | * For remote temperature, low and high limits, it uses signed 11-bit values |
100 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. | 100 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. |
101 | * For LM64 the actual remote diode temperature is 16 degree Celsius higher | ||
102 | * than the register reading. Remote temperature setpoints have to be | ||
103 | * adapted accordingly. | ||
101 | */ | 104 | */ |
102 | 105 | ||
103 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ | 106 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ |
@@ -165,6 +168,8 @@ struct lm63_data { | |||
165 | struct mutex update_lock; | 168 | struct mutex update_lock; |
166 | char valid; /* zero until following fields are valid */ | 169 | char valid; /* zero until following fields are valid */ |
167 | unsigned long last_updated; /* in jiffies */ | 170 | unsigned long last_updated; /* in jiffies */ |
171 | int kind; | ||
172 | int temp2_offset; | ||
168 | 173 | ||
169 | /* registers values */ | 174 | /* registers values */ |
170 | u8 config, config_fan; | 175 | u8 config, config_fan; |
@@ -247,16 +252,34 @@ static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *dum | |||
247 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); | 252 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); |
248 | } | 253 | } |
249 | 254 | ||
250 | static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, | 255 | /* |
251 | char *buf) | 256 | * There are 8bit registers for both local(temp1) and remote(temp2) sensor. |
257 | * For remote sensor registers temp2_offset has to be considered, | ||
258 | * for local sensor it must not. | ||
259 | * So we need separate 8bit accessors for local and remote sensor. | ||
260 | */ | ||
261 | static ssize_t show_local_temp8(struct device *dev, | ||
262 | struct device_attribute *devattr, | ||
263 | char *buf) | ||
252 | { | 264 | { |
253 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 265 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
254 | struct lm63_data *data = lm63_update_device(dev); | 266 | struct lm63_data *data = lm63_update_device(dev); |
255 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); | 267 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); |
256 | } | 268 | } |
257 | 269 | ||
258 | static ssize_t set_temp8(struct device *dev, struct device_attribute *dummy, | 270 | static ssize_t show_remote_temp8(struct device *dev, |
259 | const char *buf, size_t count) | 271 | struct device_attribute *devattr, |
272 | char *buf) | ||
273 | { | ||
274 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
275 | struct lm63_data *data = lm63_update_device(dev); | ||
276 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index]) | ||
277 | + data->temp2_offset); | ||
278 | } | ||
279 | |||
280 | static ssize_t set_local_temp8(struct device *dev, | ||
281 | struct device_attribute *dummy, | ||
282 | const char *buf, size_t count) | ||
260 | { | 283 | { |
261 | struct i2c_client *client = to_i2c_client(dev); | 284 | struct i2c_client *client = to_i2c_client(dev); |
262 | struct lm63_data *data = i2c_get_clientdata(client); | 285 | struct lm63_data *data = i2c_get_clientdata(client); |
@@ -274,7 +297,8 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, | |||
274 | { | 297 | { |
275 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 298 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
276 | struct lm63_data *data = lm63_update_device(dev); | 299 | struct lm63_data *data = lm63_update_device(dev); |
277 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])); | 300 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index]) |
301 | + data->temp2_offset); | ||
278 | } | 302 | } |
279 | 303 | ||
280 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, | 304 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, |
@@ -294,7 +318,7 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, | |||
294 | int nr = attr->index; | 318 | int nr = attr->index; |
295 | 319 | ||
296 | mutex_lock(&data->update_lock); | 320 | mutex_lock(&data->update_lock); |
297 | data->temp11[nr] = TEMP11_TO_REG(val); | 321 | data->temp11[nr] = TEMP11_TO_REG(val - data->temp2_offset); |
298 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], | 322 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], |
299 | data->temp11[nr] >> 8); | 323 | data->temp11[nr] >> 8); |
300 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], | 324 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], |
@@ -310,6 +334,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute | |||
310 | { | 334 | { |
311 | struct lm63_data *data = lm63_update_device(dev); | 335 | struct lm63_data *data = lm63_update_device(dev); |
312 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) | 336 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) |
337 | + data->temp2_offset | ||
313 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); | 338 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); |
314 | } | 339 | } |
315 | 340 | ||
@@ -324,7 +349,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute * | |||
324 | long hyst; | 349 | long hyst; |
325 | 350 | ||
326 | mutex_lock(&data->update_lock); | 351 | mutex_lock(&data->update_lock); |
327 | hyst = TEMP8_FROM_REG(data->temp8[2]) - val; | 352 | hyst = TEMP8_FROM_REG(data->temp8[2]) + data->temp2_offset - val; |
328 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, | 353 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, |
329 | HYST_TO_REG(hyst)); | 354 | HYST_TO_REG(hyst)); |
330 | mutex_unlock(&data->update_lock); | 355 | mutex_unlock(&data->update_lock); |
@@ -355,16 +380,21 @@ static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, | |||
355 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); | 380 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); |
356 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); | 381 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); |
357 | 382 | ||
358 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); | 383 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_local_temp8, NULL, 0); |
359 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp8, | 384 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_local_temp8, |
360 | set_temp8, 1); | 385 | set_local_temp8, 1); |
361 | 386 | ||
362 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); | 387 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); |
363 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, | 388 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, |
364 | set_temp11, 1); | 389 | set_temp11, 1); |
365 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, | 390 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, |
366 | set_temp11, 2); | 391 | set_temp11, 2); |
367 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); | 392 | /* |
393 | * On LM63, temp2_crit can be set only once, which should be job | ||
394 | * of the bootloader. | ||
395 | */ | ||
396 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_remote_temp8, | ||
397 | NULL, 2); | ||
368 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, | 398 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, |
369 | set_temp2_crit_hyst); | 399 | set_temp2_crit_hyst); |
370 | 400 | ||
@@ -479,7 +509,12 @@ static int lm63_probe(struct i2c_client *new_client, | |||
479 | data->valid = 0; | 509 | data->valid = 0; |
480 | mutex_init(&data->update_lock); | 510 | mutex_init(&data->update_lock); |
481 | 511 | ||
482 | /* Initialize the LM63 chip */ | 512 | /* Set the device type */ |
513 | data->kind = id->driver_data; | ||
514 | if (data->kind == lm64) | ||
515 | data->temp2_offset = 16000; | ||
516 | |||
517 | /* Initialize chip */ | ||
483 | lm63_init_client(new_client); | 518 | lm63_init_client(new_client); |
484 | 519 | ||
485 | /* Register sysfs hooks */ | 520 | /* Register sysfs hooks */ |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index b3841a615595..2e8f0c9458d4 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -1259,6 +1259,7 @@ static int lm85_probe(struct i2c_client *client, | |||
1259 | switch (data->type) { | 1259 | switch (data->type) { |
1260 | case adm1027: | 1260 | case adm1027: |
1261 | case adt7463: | 1261 | case adt7463: |
1262 | case adt7468: | ||
1262 | case emc6d100: | 1263 | case emc6d100: |
1263 | case emc6d102: | 1264 | case emc6d102: |
1264 | data->freq_map = adm1027_freq_map; | 1265 | data->freq_map = adm1027_freq_map; |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index f397ce7ad598..b2074e3ba2f1 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -687,6 +687,13 @@ static int __devexit via686a_remove(struct platform_device *pdev) | |||
687 | return 0; | 687 | return 0; |
688 | } | 688 | } |
689 | 689 | ||
690 | static void via686a_update_fan_div(struct via686a_data *data) | ||
691 | { | ||
692 | int reg = via686a_read_value(data, VIA686A_REG_FANDIV); | ||
693 | data->fan_div[0] = (reg >> 4) & 0x03; | ||
694 | data->fan_div[1] = reg >> 6; | ||
695 | } | ||
696 | |||
690 | static void __devinit via686a_init_device(struct via686a_data *data) | 697 | static void __devinit via686a_init_device(struct via686a_data *data) |
691 | { | 698 | { |
692 | u8 reg; | 699 | u8 reg; |
@@ -700,6 +707,9 @@ static void __devinit via686a_init_device(struct via686a_data *data) | |||
700 | via686a_write_value(data, VIA686A_REG_TEMP_MODE, | 707 | via686a_write_value(data, VIA686A_REG_TEMP_MODE, |
701 | (reg & ~VIA686A_TEMP_MODE_MASK) | 708 | (reg & ~VIA686A_TEMP_MODE_MASK) |
702 | | VIA686A_TEMP_MODE_CONTINUOUS); | 709 | | VIA686A_TEMP_MODE_CONTINUOUS); |
710 | |||
711 | /* Pre-read fan clock divisor values */ | ||
712 | via686a_update_fan_div(data); | ||
703 | } | 713 | } |
704 | 714 | ||
705 | static struct via686a_data *via686a_update_device(struct device *dev) | 715 | static struct via686a_data *via686a_update_device(struct device *dev) |
@@ -751,9 +761,7 @@ static struct via686a_data *via686a_update_device(struct device *dev) | |||
751 | (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & | 761 | (via686a_read_value(data, VIA686A_REG_TEMP_LOW23) & |
752 | 0xc0) >> 6; | 762 | 0xc0) >> 6; |
753 | 763 | ||
754 | i = via686a_read_value(data, VIA686A_REG_FANDIV); | 764 | via686a_update_fan_div(data); |
755 | data->fan_div[0] = (i >> 4) & 0x03; | ||
756 | data->fan_div[1] = i >> 6; | ||
757 | data->alarms = | 765 | data->alarms = |
758 | via686a_read_value(data, | 766 | via686a_read_value(data, |
759 | VIA686A_REG_ALARM1) | | 767 | VIA686A_REG_ALARM1) | |
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index 5f6d7f89e225..ace67995d7de 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
@@ -224,7 +224,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) | |||
224 | 224 | ||
225 | if (irq) { | 225 | if (irq) { |
226 | ret = request_irq(irq, i2c_pca_pf_handler, | 226 | ret = request_irq(irq, i2c_pca_pf_handler, |
227 | IRQF_TRIGGER_FALLING, i2c->adap.name, i2c); | 227 | IRQF_TRIGGER_FALLING, pdev->name, i2c); |
228 | if (ret) | 228 | if (ret) |
229 | goto e_reqirq; | 229 | goto e_reqirq; |
230 | } | 230 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index bea4c5021d26..c16a448dfd0d 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1005,6 +1005,14 @@ static int i2c_do_del_adapter(struct i2c_driver *driver, | |||
1005 | static int __unregister_client(struct device *dev, void *dummy) | 1005 | static int __unregister_client(struct device *dev, void *dummy) |
1006 | { | 1006 | { |
1007 | struct i2c_client *client = i2c_verify_client(dev); | 1007 | struct i2c_client *client = i2c_verify_client(dev); |
1008 | if (client && strcmp(client->name, "dummy")) | ||
1009 | i2c_unregister_device(client); | ||
1010 | return 0; | ||
1011 | } | ||
1012 | |||
1013 | static int __unregister_dummy(struct device *dev, void *dummy) | ||
1014 | { | ||
1015 | struct i2c_client *client = i2c_verify_client(dev); | ||
1008 | if (client) | 1016 | if (client) |
1009 | i2c_unregister_device(client); | 1017 | i2c_unregister_device(client); |
1010 | return 0; | 1018 | return 0; |
@@ -1059,8 +1067,12 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
1059 | mutex_unlock(&adap->userspace_clients_lock); | 1067 | mutex_unlock(&adap->userspace_clients_lock); |
1060 | 1068 | ||
1061 | /* Detach any active clients. This can't fail, thus we do not | 1069 | /* Detach any active clients. This can't fail, thus we do not |
1062 | checking the returned value. */ | 1070 | * check the returned value. This is a two-pass process, because |
1071 | * we can't remove the dummy devices during the first pass: they | ||
1072 | * could have been instantiated by real devices wishing to clean | ||
1073 | * them up properly, so we give them a chance to do that first. */ | ||
1063 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); | 1074 | res = device_for_each_child(&adap->dev, NULL, __unregister_client); |
1075 | res = device_for_each_child(&adap->dev, NULL, __unregister_dummy); | ||
1064 | 1076 | ||
1065 | #ifdef CONFIG_I2C_COMPAT | 1077 | #ifdef CONFIG_I2C_COMPAT |
1066 | class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, | 1078 | class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index c37ef64d1465..cf88588a8e80 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -276,7 +276,7 @@ static int intel_idle_probe(void) | |||
276 | 276 | ||
277 | case 0x1C: /* 28 - Atom Processor */ | 277 | case 0x1C: /* 28 - Atom Processor */ |
278 | case 0x26: /* 38 - Lincroft Atom Processor */ | 278 | case 0x26: /* 38 - Lincroft Atom Processor */ |
279 | lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */ | 279 | lapic_timer_reliable_states = (1 << 1); /* C1 */ |
280 | cpuidle_state_table = atom_cstates; | 280 | cpuidle_state_table = atom_cstates; |
281 | break; | 281 | break; |
282 | #ifdef FUTURE_USE | 282 | #ifdef FUTURE_USE |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 6fcfbeb24a23..abb87140f29f 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -891,68 +891,81 @@ out: | |||
891 | return ret ? ret : in_len; | 891 | return ret ? ret : in_len; |
892 | } | 892 | } |
893 | 893 | ||
894 | static int copy_wc_to_user(void __user *dest, struct ib_wc *wc) | ||
895 | { | ||
896 | struct ib_uverbs_wc tmp; | ||
897 | |||
898 | tmp.wr_id = wc->wr_id; | ||
899 | tmp.status = wc->status; | ||
900 | tmp.opcode = wc->opcode; | ||
901 | tmp.vendor_err = wc->vendor_err; | ||
902 | tmp.byte_len = wc->byte_len; | ||
903 | tmp.ex.imm_data = (__u32 __force) wc->ex.imm_data; | ||
904 | tmp.qp_num = wc->qp->qp_num; | ||
905 | tmp.src_qp = wc->src_qp; | ||
906 | tmp.wc_flags = wc->wc_flags; | ||
907 | tmp.pkey_index = wc->pkey_index; | ||
908 | tmp.slid = wc->slid; | ||
909 | tmp.sl = wc->sl; | ||
910 | tmp.dlid_path_bits = wc->dlid_path_bits; | ||
911 | tmp.port_num = wc->port_num; | ||
912 | tmp.reserved = 0; | ||
913 | |||
914 | if (copy_to_user(dest, &tmp, sizeof tmp)) | ||
915 | return -EFAULT; | ||
916 | |||
917 | return 0; | ||
918 | } | ||
919 | |||
894 | ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, | 920 | ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, |
895 | const char __user *buf, int in_len, | 921 | const char __user *buf, int in_len, |
896 | int out_len) | 922 | int out_len) |
897 | { | 923 | { |
898 | struct ib_uverbs_poll_cq cmd; | 924 | struct ib_uverbs_poll_cq cmd; |
899 | struct ib_uverbs_poll_cq_resp *resp; | 925 | struct ib_uverbs_poll_cq_resp resp; |
926 | u8 __user *header_ptr; | ||
927 | u8 __user *data_ptr; | ||
900 | struct ib_cq *cq; | 928 | struct ib_cq *cq; |
901 | struct ib_wc *wc; | 929 | struct ib_wc wc; |
902 | int ret = 0; | 930 | int ret; |
903 | int i; | ||
904 | int rsize; | ||
905 | 931 | ||
906 | if (copy_from_user(&cmd, buf, sizeof cmd)) | 932 | if (copy_from_user(&cmd, buf, sizeof cmd)) |
907 | return -EFAULT; | 933 | return -EFAULT; |
908 | 934 | ||
909 | wc = kmalloc(cmd.ne * sizeof *wc, GFP_KERNEL); | ||
910 | if (!wc) | ||
911 | return -ENOMEM; | ||
912 | |||
913 | rsize = sizeof *resp + cmd.ne * sizeof(struct ib_uverbs_wc); | ||
914 | resp = kmalloc(rsize, GFP_KERNEL); | ||
915 | if (!resp) { | ||
916 | ret = -ENOMEM; | ||
917 | goto out_wc; | ||
918 | } | ||
919 | |||
920 | cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); | 935 | cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); |
921 | if (!cq) { | 936 | if (!cq) |
922 | ret = -EINVAL; | 937 | return -EINVAL; |
923 | goto out; | ||
924 | } | ||
925 | 938 | ||
926 | resp->count = ib_poll_cq(cq, cmd.ne, wc); | 939 | /* we copy a struct ib_uverbs_poll_cq_resp to user space */ |
940 | header_ptr = (void __user *)(unsigned long) cmd.response; | ||
941 | data_ptr = header_ptr + sizeof resp; | ||
927 | 942 | ||
928 | put_cq_read(cq); | 943 | memset(&resp, 0, sizeof resp); |
944 | while (resp.count < cmd.ne) { | ||
945 | ret = ib_poll_cq(cq, 1, &wc); | ||
946 | if (ret < 0) | ||
947 | goto out_put; | ||
948 | if (!ret) | ||
949 | break; | ||
950 | |||
951 | ret = copy_wc_to_user(data_ptr, &wc); | ||
952 | if (ret) | ||
953 | goto out_put; | ||
929 | 954 | ||
930 | for (i = 0; i < resp->count; i++) { | 955 | data_ptr += sizeof(struct ib_uverbs_wc); |
931 | resp->wc[i].wr_id = wc[i].wr_id; | 956 | ++resp.count; |
932 | resp->wc[i].status = wc[i].status; | ||
933 | resp->wc[i].opcode = wc[i].opcode; | ||
934 | resp->wc[i].vendor_err = wc[i].vendor_err; | ||
935 | resp->wc[i].byte_len = wc[i].byte_len; | ||
936 | resp->wc[i].ex.imm_data = (__u32 __force) wc[i].ex.imm_data; | ||
937 | resp->wc[i].qp_num = wc[i].qp->qp_num; | ||
938 | resp->wc[i].src_qp = wc[i].src_qp; | ||
939 | resp->wc[i].wc_flags = wc[i].wc_flags; | ||
940 | resp->wc[i].pkey_index = wc[i].pkey_index; | ||
941 | resp->wc[i].slid = wc[i].slid; | ||
942 | resp->wc[i].sl = wc[i].sl; | ||
943 | resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits; | ||
944 | resp->wc[i].port_num = wc[i].port_num; | ||
945 | } | 957 | } |
946 | 958 | ||
947 | if (copy_to_user((void __user *) (unsigned long) cmd.response, resp, rsize)) | 959 | if (copy_to_user(header_ptr, &resp, sizeof resp)) { |
948 | ret = -EFAULT; | 960 | ret = -EFAULT; |
961 | goto out_put; | ||
962 | } | ||
949 | 963 | ||
950 | out: | 964 | ret = in_len; |
951 | kfree(resp); | ||
952 | 965 | ||
953 | out_wc: | 966 | out_put: |
954 | kfree(wc); | 967 | put_cq_read(cq); |
955 | return ret ? ret : in_len; | 968 | return ret; |
956 | } | 969 | } |
957 | 970 | ||
958 | ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, | 971 | ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 32d352a88d50..081d06110e33 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -383,7 +383,7 @@ static void send_flowc(struct c4iw_ep *ep, struct sk_buff *skb) | |||
383 | 16)) | FW_WR_FLOWID(ep->hwtid)); | 383 | 16)) | FW_WR_FLOWID(ep->hwtid)); |
384 | 384 | ||
385 | flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; | 385 | flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN; |
386 | flowc->mnemval[0].val = cpu_to_be32(0); | 386 | flowc->mnemval[0].val = cpu_to_be32(PCI_FUNC(ep->com.dev->rdev.lldi.pdev->devfn) << 8); |
387 | flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; | 387 | flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH; |
388 | flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); | 388 | flowc->mnemval[1].val = cpu_to_be32(ep->tx_chan); |
389 | flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; | 389 | flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT; |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index b95231763911..ee82851afe3e 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -55,6 +55,14 @@ | |||
55 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 | 55 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 |
56 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 | 56 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 |
57 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 | 57 | #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 |
58 | /* MacbookAir3,2 (unibody), aka wellspring5 */ | ||
59 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f | ||
60 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240 | ||
61 | #define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241 | ||
62 | /* MacbookAir3,1 (unibody), aka wellspring4 */ | ||
63 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242 | ||
64 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243 | ||
65 | #define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244 | ||
58 | 66 | ||
59 | #define BCM5974_DEVICE(prod) { \ | 67 | #define BCM5974_DEVICE(prod) { \ |
60 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 68 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -80,6 +88,14 @@ static const struct usb_device_id bcm5974_table[] = { | |||
80 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), | 88 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), |
81 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), | 89 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), |
82 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), | 90 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), |
91 | /* MacbookAir3,2 */ | ||
92 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI), | ||
93 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO), | ||
94 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS), | ||
95 | /* MacbookAir3,1 */ | ||
96 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI), | ||
97 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO), | ||
98 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS), | ||
83 | /* Terminating entry */ | 99 | /* Terminating entry */ |
84 | {} | 100 | {} |
85 | }; | 101 | }; |
@@ -234,6 +250,30 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
234 | { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, | 250 | { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, |
235 | { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } | 251 | { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } |
236 | }, | 252 | }, |
253 | { | ||
254 | USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI, | ||
255 | USB_DEVICE_ID_APPLE_WELLSPRING4_ISO, | ||
256 | USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, | ||
257 | HAS_INTEGRATED_BUTTON, | ||
258 | 0x84, sizeof(struct bt_data), | ||
259 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
260 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, | ||
261 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
262 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, | ||
263 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } | ||
264 | }, | ||
265 | { | ||
266 | USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI, | ||
267 | USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO, | ||
268 | USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, | ||
269 | HAS_INTEGRATED_BUTTON, | ||
270 | 0x84, sizeof(struct bt_data), | ||
271 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
272 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, | ||
273 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
274 | { DIM_X, DIM_X / SN_COORD, -4616, 5112 }, | ||
275 | { DIM_Y, DIM_Y / SN_COORD, -142, 5234 } | ||
276 | }, | ||
237 | {} | 277 | {} |
238 | }; | 278 | }; |
239 | 279 | ||
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index b6aa7d20d8a3..298c8e505cc2 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -51,7 +51,8 @@ | |||
51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | 53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) |
54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) | 54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
55 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | ||
55 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) | 56 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) |
56 | 57 | ||
57 | /* synaptics modes query bits */ | 58 | /* synaptics modes query bits */ |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index ed7ad7416b24..a0730fdd31c4 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -333,6 +333,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
333 | }, | 333 | }, |
334 | }, | 334 | }, |
335 | { | 335 | { |
336 | /* Sony Vaio VPCZ122GX */ | ||
337 | .matches = { | ||
338 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
339 | DMI_MATCH(DMI_PRODUCT_NAME, "VPCZ122GX"), | ||
340 | }, | ||
341 | }, | ||
342 | { | ||
336 | /* Sony Vaio FS-115b */ | 343 | /* Sony Vaio FS-115b */ |
337 | .matches = { | 344 | .matches = { |
338 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | 345 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
@@ -413,6 +420,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
413 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | 420 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), |
414 | }, | 421 | }, |
415 | }, | 422 | }, |
423 | { | ||
424 | /* Dell Vostro V13 */ | ||
425 | .matches = { | ||
426 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
427 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), | ||
428 | }, | ||
429 | }, | ||
416 | { } | 430 | { } |
417 | }; | 431 | }; |
418 | 432 | ||
@@ -534,6 +548,17 @@ static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = { | |||
534 | }; | 548 | }; |
535 | #endif | 549 | #endif |
536 | 550 | ||
551 | static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | ||
552 | { | ||
553 | /* Dell Vostro V13 */ | ||
554 | .matches = { | ||
555 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
556 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), | ||
557 | }, | ||
558 | }, | ||
559 | { } | ||
560 | }; | ||
561 | |||
537 | /* | 562 | /* |
538 | * Some Wistron based laptops need us to explicitly enable the 'Dritek | 563 | * Some Wistron based laptops need us to explicitly enable the 'Dritek |
539 | * keyboard extension' to make their extra keys start generating scancodes. | 564 | * keyboard extension' to make their extra keys start generating scancodes. |
@@ -886,6 +911,9 @@ static int __init i8042_platform_init(void) | |||
886 | if (dmi_check_system(i8042_dmi_nomux_table)) | 911 | if (dmi_check_system(i8042_dmi_nomux_table)) |
887 | i8042_nomux = true; | 912 | i8042_nomux = true; |
888 | 913 | ||
914 | if (dmi_check_system(i8042_dmi_notimeout_table)) | ||
915 | i8042_notimeout = true; | ||
916 | |||
889 | if (dmi_check_system(i8042_dmi_dritek_table)) | 917 | if (dmi_check_system(i8042_dmi_dritek_table)) |
890 | i8042_dritek = true; | 918 | i8042_dritek = true; |
891 | #endif /* CONFIG_X86 */ | 919 | #endif /* CONFIG_X86 */ |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index f58513160480..9e486502c03f 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -61,6 +61,10 @@ static bool i8042_noloop; | |||
61 | module_param_named(noloop, i8042_noloop, bool, 0); | 61 | module_param_named(noloop, i8042_noloop, bool, 0); |
62 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); | 62 | MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port"); |
63 | 63 | ||
64 | static bool i8042_notimeout; | ||
65 | module_param_named(notimeout, i8042_notimeout, bool, 0); | ||
66 | MODULE_PARM_DESC(notimeout, "Ignore timeouts signalled by i8042"); | ||
67 | |||
64 | #ifdef CONFIG_X86 | 68 | #ifdef CONFIG_X86 |
65 | static bool i8042_dritek; | 69 | static bool i8042_dritek; |
66 | module_param_named(dritek, i8042_dritek, bool, 0); | 70 | module_param_named(dritek, i8042_dritek, bool, 0); |
@@ -503,7 +507,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) | |||
503 | } else { | 507 | } else { |
504 | 508 | ||
505 | dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | | 509 | dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | |
506 | ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); | 510 | ((str & I8042_STR_TIMEOUT && !i8042_notimeout) ? SERIO_TIMEOUT : 0); |
507 | 511 | ||
508 | port_no = (str & I8042_STR_AUXDATA) ? | 512 | port_no = (str & I8042_STR_AUXDATA) ? |
509 | I8042_AUX_PORT_NO : I8042_KBD_PORT_NO; | 513 | I8042_AUX_PORT_NO : I8042_KBD_PORT_NO; |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 707d9c94cf9e..131976d880d0 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -438,23 +438,27 @@ static void cmd_in_timeout(unsigned long data) | |||
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | 440 | ||
441 | if (ucs->retry_cmd_in++ < BAS_RETRY) { | 441 | if (ucs->retry_cmd_in++ >= BAS_RETRY) { |
442 | dev_notice(cs->dev, "control read: timeout, retry %d\n", | ||
443 | ucs->retry_cmd_in); | ||
444 | rc = atread_submit(cs, BAS_TIMEOUT); | ||
445 | if (rc >= 0 || rc == -ENODEV) | ||
446 | /* resubmitted or disconnected */ | ||
447 | /* - bypass regular exit block */ | ||
448 | return; | ||
449 | } else { | ||
450 | dev_err(cs->dev, | 442 | dev_err(cs->dev, |
451 | "control read: timeout, giving up after %d tries\n", | 443 | "control read: timeout, giving up after %d tries\n", |
452 | ucs->retry_cmd_in); | 444 | ucs->retry_cmd_in); |
445 | kfree(ucs->rcvbuf); | ||
446 | ucs->rcvbuf = NULL; | ||
447 | ucs->rcvbuf_size = 0; | ||
448 | error_reset(cs); | ||
449 | return; | ||
450 | } | ||
451 | |||
452 | gig_dbg(DEBUG_USBREQ, "%s: timeout, retry %d", | ||
453 | __func__, ucs->retry_cmd_in); | ||
454 | rc = atread_submit(cs, BAS_TIMEOUT); | ||
455 | if (rc < 0) { | ||
456 | kfree(ucs->rcvbuf); | ||
457 | ucs->rcvbuf = NULL; | ||
458 | ucs->rcvbuf_size = 0; | ||
459 | if (rc != -ENODEV) | ||
460 | error_reset(cs); | ||
453 | } | 461 | } |
454 | kfree(ucs->rcvbuf); | ||
455 | ucs->rcvbuf = NULL; | ||
456 | ucs->rcvbuf_size = 0; | ||
457 | error_reset(cs); | ||
458 | } | 462 | } |
459 | 463 | ||
460 | /* read_ctrl_callback | 464 | /* read_ctrl_callback |
@@ -470,18 +474,11 @@ static void read_ctrl_callback(struct urb *urb) | |||
470 | struct cardstate *cs = inbuf->cs; | 474 | struct cardstate *cs = inbuf->cs; |
471 | struct bas_cardstate *ucs = cs->hw.bas; | 475 | struct bas_cardstate *ucs = cs->hw.bas; |
472 | int status = urb->status; | 476 | int status = urb->status; |
473 | int have_data = 0; | ||
474 | unsigned numbytes; | 477 | unsigned numbytes; |
475 | int rc; | 478 | int rc; |
476 | 479 | ||
477 | update_basstate(ucs, 0, BS_ATRDPEND); | 480 | update_basstate(ucs, 0, BS_ATRDPEND); |
478 | wake_up(&ucs->waitqueue); | 481 | wake_up(&ucs->waitqueue); |
479 | |||
480 | if (!ucs->rcvbuf_size) { | ||
481 | dev_warn(cs->dev, "%s: no receive in progress\n", __func__); | ||
482 | return; | ||
483 | } | ||
484 | |||
485 | del_timer(&ucs->timer_cmd_in); | 482 | del_timer(&ucs->timer_cmd_in); |
486 | 483 | ||
487 | switch (status) { | 484 | switch (status) { |
@@ -495,19 +492,10 @@ static void read_ctrl_callback(struct urb *urb) | |||
495 | numbytes = ucs->rcvbuf_size; | 492 | numbytes = ucs->rcvbuf_size; |
496 | } | 493 | } |
497 | 494 | ||
498 | /* copy received bytes to inbuf */ | 495 | /* copy received bytes to inbuf, notify event layer */ |
499 | have_data = gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes); | 496 | if (gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes)) { |
500 | 497 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | |
501 | if (unlikely(numbytes < ucs->rcvbuf_size)) { | 498 | gigaset_schedule_event(cs); |
502 | /* incomplete - resubmit for remaining bytes */ | ||
503 | ucs->rcvbuf_size -= numbytes; | ||
504 | ucs->retry_cmd_in = 0; | ||
505 | rc = atread_submit(cs, BAS_TIMEOUT); | ||
506 | if (rc >= 0 || rc == -ENODEV) | ||
507 | /* resubmitted or disconnected */ | ||
508 | /* - bypass regular exit block */ | ||
509 | return; | ||
510 | error_reset(cs); | ||
511 | } | 499 | } |
512 | break; | 500 | break; |
513 | 501 | ||
@@ -516,37 +504,32 @@ static void read_ctrl_callback(struct urb *urb) | |||
516 | case -EINPROGRESS: /* pending */ | 504 | case -EINPROGRESS: /* pending */ |
517 | case -ENODEV: /* device removed */ | 505 | case -ENODEV: /* device removed */ |
518 | case -ESHUTDOWN: /* device shut down */ | 506 | case -ESHUTDOWN: /* device shut down */ |
519 | /* no action necessary */ | 507 | /* no further action necessary */ |
520 | gig_dbg(DEBUG_USBREQ, "%s: %s", | 508 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
521 | __func__, get_usb_statmsg(status)); | 509 | __func__, get_usb_statmsg(status)); |
522 | break; | 510 | break; |
523 | 511 | ||
524 | default: /* severe trouble */ | 512 | default: /* other errors: retry */ |
525 | dev_warn(cs->dev, "control read: %s\n", | ||
526 | get_usb_statmsg(status)); | ||
527 | if (ucs->retry_cmd_in++ < BAS_RETRY) { | 513 | if (ucs->retry_cmd_in++ < BAS_RETRY) { |
528 | dev_notice(cs->dev, "control read: retry %d\n", | 514 | gig_dbg(DEBUG_USBREQ, "%s: %s, retry %d", __func__, |
529 | ucs->retry_cmd_in); | 515 | get_usb_statmsg(status), ucs->retry_cmd_in); |
530 | rc = atread_submit(cs, BAS_TIMEOUT); | 516 | rc = atread_submit(cs, BAS_TIMEOUT); |
531 | if (rc >= 0 || rc == -ENODEV) | 517 | if (rc >= 0) |
532 | /* resubmitted or disconnected */ | 518 | /* successfully resubmitted, skip freeing */ |
533 | /* - bypass regular exit block */ | ||
534 | return; | 519 | return; |
535 | } else { | 520 | if (rc == -ENODEV) |
536 | dev_err(cs->dev, | 521 | /* disconnect, no further action necessary */ |
537 | "control read: giving up after %d tries\n", | 522 | break; |
538 | ucs->retry_cmd_in); | ||
539 | } | 523 | } |
524 | dev_err(cs->dev, "control read: %s, giving up after %d tries\n", | ||
525 | get_usb_statmsg(status), ucs->retry_cmd_in); | ||
540 | error_reset(cs); | 526 | error_reset(cs); |
541 | } | 527 | } |
542 | 528 | ||
529 | /* read finished, free buffer */ | ||
543 | kfree(ucs->rcvbuf); | 530 | kfree(ucs->rcvbuf); |
544 | ucs->rcvbuf = NULL; | 531 | ucs->rcvbuf = NULL; |
545 | ucs->rcvbuf_size = 0; | 532 | ucs->rcvbuf_size = 0; |
546 | if (have_data) { | ||
547 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | ||
548 | gigaset_schedule_event(cs); | ||
549 | } | ||
550 | } | 533 | } |
551 | 534 | ||
552 | /* atread_submit | 535 | /* atread_submit |
@@ -1598,13 +1581,13 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1598 | 1581 | ||
1599 | ret = starturbs(bcs); | 1582 | ret = starturbs(bcs); |
1600 | if (ret < 0) { | 1583 | if (ret < 0) { |
1584 | spin_unlock_irqrestore(&cs->lock, flags); | ||
1601 | dev_err(cs->dev, | 1585 | dev_err(cs->dev, |
1602 | "could not start isochronous I/O for channel B%d: %s\n", | 1586 | "could not start isochronous I/O for channel B%d: %s\n", |
1603 | bcs->channel + 1, | 1587 | bcs->channel + 1, |
1604 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); | 1588 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); |
1605 | if (ret != -ENODEV) | 1589 | if (ret != -ENODEV) |
1606 | error_hangup(bcs); | 1590 | error_hangup(bcs); |
1607 | spin_unlock_irqrestore(&cs->lock, flags); | ||
1608 | return ret; | 1591 | return ret; |
1609 | } | 1592 | } |
1610 | 1593 | ||
@@ -1614,11 +1597,11 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1614 | dev_err(cs->dev, "could not open channel B%d\n", | 1597 | dev_err(cs->dev, "could not open channel B%d\n", |
1615 | bcs->channel + 1); | 1598 | bcs->channel + 1); |
1616 | stopurbs(bcs->hw.bas); | 1599 | stopurbs(bcs->hw.bas); |
1617 | if (ret != -ENODEV) | ||
1618 | error_hangup(bcs); | ||
1619 | } | 1600 | } |
1620 | 1601 | ||
1621 | spin_unlock_irqrestore(&cs->lock, flags); | 1602 | spin_unlock_irqrestore(&cs->lock, flags); |
1603 | if (ret < 0 && ret != -ENODEV) | ||
1604 | error_hangup(bcs); | ||
1622 | return ret; | 1605 | return ret; |
1623 | } | 1606 | } |
1624 | 1607 | ||
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 2dfd346fc889..f39ccdf87a17 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
842 | 842 | ||
843 | if (unlikely(bcs->ignore)) { | 843 | if (unlikely(bcs->ignore)) { |
844 | bcs->ignore--; | 844 | bcs->ignore--; |
845 | hdlc_flush(bcs); | ||
846 | return; | 845 | return; |
847 | } | 846 | } |
848 | skb = bcs->rx_skb; | 847 | skb = bcs->rx_skb; |
849 | if (skb == NULL) | 848 | if (skb == NULL) { |
850 | skb = gigaset_new_rx_skb(bcs); | 849 | skb = gigaset_new_rx_skb(bcs); |
851 | bcs->hw.bas->goodbytes += skb->len; | 850 | if (skb == NULL) |
851 | return; | ||
852 | } | ||
852 | dobytes = bcs->rx_bufsize - skb->len; | 853 | dobytes = bcs->rx_bufsize - skb->len; |
853 | while (count > 0) { | 854 | while (count > 0) { |
854 | dst = skb_put(skb, count < dobytes ? count : dobytes); | 855 | dst = skb_put(skb, count < dobytes ? count : dobytes); |
@@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
860 | if (dobytes == 0) { | 861 | if (dobytes == 0) { |
861 | dump_bytes(DEBUG_STREAM_DUMP, | 862 | dump_bytes(DEBUG_STREAM_DUMP, |
862 | "rcv data", skb->data, skb->len); | 863 | "rcv data", skb->data, skb->len); |
864 | bcs->hw.bas->goodbytes += skb->len; | ||
863 | gigaset_skb_rcvd(bcs, skb); | 865 | gigaset_skb_rcvd(bcs, skb); |
864 | skb = gigaset_new_rx_skb(bcs); | 866 | skb = gigaset_new_rx_skb(bcs); |
865 | if (skb == NULL) | 867 | if (skb == NULL) |
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c index a688293abd0b..614ebebaaa28 100644 --- a/drivers/leds/leds-ss4200.c +++ b/drivers/leds/leds-ss4200.c | |||
@@ -102,6 +102,7 @@ static struct dmi_system_id __initdata nas_led_whitelist[] = { | |||
102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") | 102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") |
103 | } | 103 | } |
104 | }, | 104 | }, |
105 | {} | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | /* | 108 | /* |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 487ecda90ad4..406091f9692b 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -33,7 +33,6 @@ struct pgpath { | |||
33 | unsigned fail_count; /* Cumulative failure count */ | 33 | unsigned fail_count; /* Cumulative failure count */ |
34 | 34 | ||
35 | struct dm_path path; | 35 | struct dm_path path; |
36 | struct work_struct deactivate_path; | ||
37 | struct work_struct activate_path; | 36 | struct work_struct activate_path; |
38 | }; | 37 | }; |
39 | 38 | ||
@@ -116,7 +115,6 @@ static struct workqueue_struct *kmultipathd, *kmpath_handlerd; | |||
116 | static void process_queued_ios(struct work_struct *work); | 115 | static void process_queued_ios(struct work_struct *work); |
117 | static void trigger_event(struct work_struct *work); | 116 | static void trigger_event(struct work_struct *work); |
118 | static void activate_path(struct work_struct *work); | 117 | static void activate_path(struct work_struct *work); |
119 | static void deactivate_path(struct work_struct *work); | ||
120 | 118 | ||
121 | 119 | ||
122 | /*----------------------------------------------- | 120 | /*----------------------------------------------- |
@@ -129,7 +127,6 @@ static struct pgpath *alloc_pgpath(void) | |||
129 | 127 | ||
130 | if (pgpath) { | 128 | if (pgpath) { |
131 | pgpath->is_active = 1; | 129 | pgpath->is_active = 1; |
132 | INIT_WORK(&pgpath->deactivate_path, deactivate_path); | ||
133 | INIT_WORK(&pgpath->activate_path, activate_path); | 130 | INIT_WORK(&pgpath->activate_path, activate_path); |
134 | } | 131 | } |
135 | 132 | ||
@@ -141,14 +138,6 @@ static void free_pgpath(struct pgpath *pgpath) | |||
141 | kfree(pgpath); | 138 | kfree(pgpath); |
142 | } | 139 | } |
143 | 140 | ||
144 | static void deactivate_path(struct work_struct *work) | ||
145 | { | ||
146 | struct pgpath *pgpath = | ||
147 | container_of(work, struct pgpath, deactivate_path); | ||
148 | |||
149 | blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); | ||
150 | } | ||
151 | |||
152 | static struct priority_group *alloc_priority_group(void) | 141 | static struct priority_group *alloc_priority_group(void) |
153 | { | 142 | { |
154 | struct priority_group *pg; | 143 | struct priority_group *pg; |
@@ -995,7 +984,6 @@ static int fail_path(struct pgpath *pgpath) | |||
995 | pgpath->path.dev->name, m->nr_valid_paths); | 984 | pgpath->path.dev->name, m->nr_valid_paths); |
996 | 985 | ||
997 | schedule_work(&m->trigger_event); | 986 | schedule_work(&m->trigger_event); |
998 | queue_work(kmultipathd, &pgpath->deactivate_path); | ||
999 | 987 | ||
1000 | out: | 988 | out: |
1001 | spin_unlock_irqrestore(&m->lock, flags); | 989 | spin_unlock_irqrestore(&m->lock, flags); |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index f9fc07d7a4b9..87e4e78790c0 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -1136,11 +1136,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | |||
1136 | */ | 1136 | */ |
1137 | q->limits = *limits; | 1137 | q->limits = *limits; |
1138 | 1138 | ||
1139 | if (limits->no_cluster) | ||
1140 | queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q); | ||
1141 | else | ||
1142 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q); | ||
1143 | |||
1144 | if (!dm_table_supports_discards(t)) | 1139 | if (!dm_table_supports_discards(t)) |
1145 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); | 1140 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q); |
1146 | else | 1141 | else |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index ac384b2a6a33..a173db5fc76a 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -2111,13 +2111,14 @@ static void event_callback(void *context) | |||
2111 | wake_up(&md->eventq); | 2111 | wake_up(&md->eventq); |
2112 | } | 2112 | } |
2113 | 2113 | ||
2114 | /* | ||
2115 | * Protected by md->suspend_lock obtained by dm_swap_table(). | ||
2116 | */ | ||
2114 | static void __set_size(struct mapped_device *md, sector_t size) | 2117 | static void __set_size(struct mapped_device *md, sector_t size) |
2115 | { | 2118 | { |
2116 | set_capacity(md->disk, size); | 2119 | set_capacity(md->disk, size); |
2117 | 2120 | ||
2118 | mutex_lock(&md->bdev->bd_inode->i_mutex); | ||
2119 | i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | 2121 | i_size_write(md->bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
2120 | mutex_unlock(&md->bdev->bd_inode->i_mutex); | ||
2121 | } | 2122 | } |
2122 | 2123 | ||
2123 | /* | 2124 | /* |
diff --git a/drivers/md/md.c b/drivers/md/md.c index f20d13e717d5..012859708a1b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -220,11 +220,14 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
220 | mddev_t *mddev = q->queuedata; | 220 | mddev_t *mddev = q->queuedata; |
221 | int rv; | 221 | int rv; |
222 | int cpu; | 222 | int cpu; |
223 | unsigned int sectors; | ||
223 | 224 | ||
224 | if (mddev == NULL || mddev->pers == NULL) { | 225 | if (mddev == NULL || mddev->pers == NULL |
226 | || !mddev->ready) { | ||
225 | bio_io_error(bio); | 227 | bio_io_error(bio); |
226 | return 0; | 228 | return 0; |
227 | } | 229 | } |
230 | smp_rmb(); /* Ensure implications of 'active' are visible */ | ||
228 | rcu_read_lock(); | 231 | rcu_read_lock(); |
229 | if (mddev->suspended || mddev->barrier) { | 232 | if (mddev->suspended || mddev->barrier) { |
230 | DEFINE_WAIT(__wait); | 233 | DEFINE_WAIT(__wait); |
@@ -242,12 +245,16 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
242 | atomic_inc(&mddev->active_io); | 245 | atomic_inc(&mddev->active_io); |
243 | rcu_read_unlock(); | 246 | rcu_read_unlock(); |
244 | 247 | ||
248 | /* | ||
249 | * save the sectors now since our bio can | ||
250 | * go away inside make_request | ||
251 | */ | ||
252 | sectors = bio_sectors(bio); | ||
245 | rv = mddev->pers->make_request(mddev, bio); | 253 | rv = mddev->pers->make_request(mddev, bio); |
246 | 254 | ||
247 | cpu = part_stat_lock(); | 255 | cpu = part_stat_lock(); |
248 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); | 256 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); |
249 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], | 257 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors); |
250 | bio_sectors(bio)); | ||
251 | part_stat_unlock(); | 258 | part_stat_unlock(); |
252 | 259 | ||
253 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) | 260 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) |
@@ -1329,7 +1336,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
1329 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, | 1336 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
1330 | rdev->sb_page); | 1337 | rdev->sb_page); |
1331 | md_super_wait(rdev->mddev); | 1338 | md_super_wait(rdev->mddev); |
1332 | return num_sectors / 2; /* kB for sysfs */ | 1339 | return num_sectors; |
1333 | } | 1340 | } |
1334 | 1341 | ||
1335 | 1342 | ||
@@ -1697,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
1697 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, | 1704 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
1698 | rdev->sb_page); | 1705 | rdev->sb_page); |
1699 | md_super_wait(rdev->mddev); | 1706 | md_super_wait(rdev->mddev); |
1700 | return num_sectors / 2; /* kB for sysfs */ | 1707 | return num_sectors; |
1701 | } | 1708 | } |
1702 | 1709 | ||
1703 | static struct super_type super_types[] = { | 1710 | static struct super_type super_types[] = { |
@@ -2172,6 +2179,8 @@ repeat: | |||
2172 | if (!mddev->persistent) { | 2179 | if (!mddev->persistent) { |
2173 | clear_bit(MD_CHANGE_CLEAN, &mddev->flags); | 2180 | clear_bit(MD_CHANGE_CLEAN, &mddev->flags); |
2174 | clear_bit(MD_CHANGE_DEVS, &mddev->flags); | 2181 | clear_bit(MD_CHANGE_DEVS, &mddev->flags); |
2182 | if (!mddev->external) | ||
2183 | clear_bit(MD_CHANGE_PENDING, &mddev->flags); | ||
2175 | wake_up(&mddev->sb_wait); | 2184 | wake_up(&mddev->sb_wait); |
2176 | return; | 2185 | return; |
2177 | } | 2186 | } |
@@ -3107,7 +3116,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
3107 | char nm[20]; | 3116 | char nm[20]; |
3108 | if (rdev->raid_disk < 0) | 3117 | if (rdev->raid_disk < 0) |
3109 | continue; | 3118 | continue; |
3110 | if (rdev->new_raid_disk > mddev->raid_disks) | 3119 | if (rdev->new_raid_disk >= mddev->raid_disks) |
3111 | rdev->new_raid_disk = -1; | 3120 | rdev->new_raid_disk = -1; |
3112 | if (rdev->new_raid_disk == rdev->raid_disk) | 3121 | if (rdev->new_raid_disk == rdev->raid_disk) |
3113 | continue; | 3122 | continue; |
@@ -4287,9 +4296,6 @@ static int md_alloc(dev_t dev, char *name) | |||
4287 | goto abort; | 4296 | goto abort; |
4288 | mddev->queue->queuedata = mddev; | 4297 | mddev->queue->queuedata = mddev; |
4289 | 4298 | ||
4290 | /* Can be unlocked because the queue is new: no concurrency */ | ||
4291 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, mddev->queue); | ||
4292 | |||
4293 | blk_queue_make_request(mddev->queue, md_make_request); | 4299 | blk_queue_make_request(mddev->queue, md_make_request); |
4294 | 4300 | ||
4295 | disk = alloc_disk(1 << shift); | 4301 | disk = alloc_disk(1 << shift); |
@@ -4555,7 +4561,8 @@ int md_run(mddev_t *mddev) | |||
4555 | mddev->safemode_timer.data = (unsigned long) mddev; | 4561 | mddev->safemode_timer.data = (unsigned long) mddev; |
4556 | mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ | 4562 | mddev->safemode_delay = (200 * HZ)/1000 +1; /* 200 msec delay */ |
4557 | mddev->in_sync = 1; | 4563 | mddev->in_sync = 1; |
4558 | 4564 | smp_wmb(); | |
4565 | mddev->ready = 1; | ||
4559 | list_for_each_entry(rdev, &mddev->disks, same_set) | 4566 | list_for_each_entry(rdev, &mddev->disks, same_set) |
4560 | if (rdev->raid_disk >= 0) { | 4567 | if (rdev->raid_disk >= 0) { |
4561 | char nm[20]; | 4568 | char nm[20]; |
@@ -4717,6 +4724,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes); | |||
4717 | 4724 | ||
4718 | void md_stop(mddev_t *mddev) | 4725 | void md_stop(mddev_t *mddev) |
4719 | { | 4726 | { |
4727 | mddev->ready = 0; | ||
4720 | mddev->pers->stop(mddev); | 4728 | mddev->pers->stop(mddev); |
4721 | if (mddev->pers->sync_request && mddev->to_remove == NULL) | 4729 | if (mddev->pers->sync_request && mddev->to_remove == NULL) |
4722 | mddev->to_remove = &md_redundancy_group; | 4730 | mddev->to_remove = &md_redundancy_group; |
@@ -5148,17 +5156,21 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5148 | PTR_ERR(rdev)); | 5156 | PTR_ERR(rdev)); |
5149 | return PTR_ERR(rdev); | 5157 | return PTR_ERR(rdev); |
5150 | } | 5158 | } |
5151 | /* set save_raid_disk if appropriate */ | 5159 | /* set saved_raid_disk if appropriate */ |
5152 | if (!mddev->persistent) { | 5160 | if (!mddev->persistent) { |
5153 | if (info->state & (1<<MD_DISK_SYNC) && | 5161 | if (info->state & (1<<MD_DISK_SYNC) && |
5154 | info->raid_disk < mddev->raid_disks) | 5162 | info->raid_disk < mddev->raid_disks) { |
5155 | rdev->raid_disk = info->raid_disk; | 5163 | rdev->raid_disk = info->raid_disk; |
5156 | else | 5164 | set_bit(In_sync, &rdev->flags); |
5165 | } else | ||
5157 | rdev->raid_disk = -1; | 5166 | rdev->raid_disk = -1; |
5158 | } else | 5167 | } else |
5159 | super_types[mddev->major_version]. | 5168 | super_types[mddev->major_version]. |
5160 | validate_super(mddev, rdev); | 5169 | validate_super(mddev, rdev); |
5161 | rdev->saved_raid_disk = rdev->raid_disk; | 5170 | if (test_bit(In_sync, &rdev->flags)) |
5171 | rdev->saved_raid_disk = rdev->raid_disk; | ||
5172 | else | ||
5173 | rdev->saved_raid_disk = -1; | ||
5162 | 5174 | ||
5163 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ | 5175 | clear_bit(In_sync, &rdev->flags); /* just to be sure */ |
5164 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) | 5176 | if (info->state & (1<<MD_DISK_WRITEMOSTLY)) |
@@ -6036,8 +6048,8 @@ static int md_thread(void * arg) | |||
6036 | thread->timeout); | 6048 | thread->timeout); |
6037 | 6049 | ||
6038 | clear_bit(THREAD_WAKEUP, &thread->flags); | 6050 | clear_bit(THREAD_WAKEUP, &thread->flags); |
6039 | 6051 | if (!kthread_should_stop()) | |
6040 | thread->run(thread->mddev); | 6052 | thread->run(thread->mddev); |
6041 | } | 6053 | } |
6042 | 6054 | ||
6043 | return 0; | 6055 | return 0; |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 3931299788dc..563ede31d5fc 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -149,7 +149,8 @@ struct mddev_s | |||
149 | * are happening, so run/ | 149 | * are happening, so run/ |
150 | * takeover/stop are not safe | 150 | * takeover/stop are not safe |
151 | */ | 151 | */ |
152 | 152 | int ready; /* See when safe to pass | |
153 | * IO requests down */ | ||
153 | struct gendisk *gendisk; | 154 | struct gendisk *gendisk; |
154 | 155 | ||
155 | struct kobject kobj; | 156 | struct kobject kobj; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 0b830bbe1d8b..d8b2d7b0c3be 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1210,6 +1210,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number) | |||
1210 | * is not possible. | 1210 | * is not possible. |
1211 | */ | 1211 | */ |
1212 | if (!test_bit(Faulty, &rdev->flags) && | 1212 | if (!test_bit(Faulty, &rdev->flags) && |
1213 | !mddev->recovery_disabled && | ||
1213 | mddev->degraded < conf->raid_disks) { | 1214 | mddev->degraded < conf->raid_disks) { |
1214 | err = -EBUSY; | 1215 | err = -EBUSY; |
1215 | goto abort; | 1216 | goto abort; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 84718383124d..838c275fd3c8 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -2396,13 +2396,13 @@ static int run(mddev_t *mddev) | |||
2396 | return 0; | 2396 | return 0; |
2397 | 2397 | ||
2398 | out_free_conf: | 2398 | out_free_conf: |
2399 | md_unregister_thread(mddev->thread); | ||
2399 | if (conf->r10bio_pool) | 2400 | if (conf->r10bio_pool) |
2400 | mempool_destroy(conf->r10bio_pool); | 2401 | mempool_destroy(conf->r10bio_pool); |
2401 | safe_put_page(conf->tmppage); | 2402 | safe_put_page(conf->tmppage); |
2402 | kfree(conf->mirrors); | 2403 | kfree(conf->mirrors); |
2403 | kfree(conf); | 2404 | kfree(conf); |
2404 | mddev->private = NULL; | 2405 | mddev->private = NULL; |
2405 | md_unregister_thread(mddev->thread); | ||
2406 | out: | 2406 | out: |
2407 | return -EIO; | 2407 | return -EIO; |
2408 | } | 2408 | } |
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 05bde9ccb770..1d1d8d200755 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c | |||
@@ -558,7 +558,7 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e | |||
558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) | 558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) |
559 | { | 559 | { |
560 | struct saa7146_vv *vv = dev->vv_data; | 560 | struct saa7146_vv *vv = dev->vv_data; |
561 | struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); | 561 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev, pixelformat); |
562 | 562 | ||
563 | int b_depth = vv->ov_fmt->depth; | 563 | int b_depth = vv->ov_fmt->depth; |
564 | int b_bpl = vv->ov_fb.fmt.bytesperline; | 564 | int b_bpl = vv->ov_fb.fmt.bytesperline; |
@@ -702,7 +702,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 | |||
702 | struct saa7146_vv *vv = dev->vv_data; | 702 | struct saa7146_vv *vv = dev->vv_data; |
703 | struct saa7146_video_dma vdma1; | 703 | struct saa7146_video_dma vdma1; |
704 | 704 | ||
705 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 705 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
706 | 706 | ||
707 | int width = buf->fmt->width; | 707 | int width = buf->fmt->width; |
708 | int height = buf->fmt->height; | 708 | int height = buf->fmt->height; |
@@ -827,7 +827,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 | |||
827 | struct saa7146_video_dma vdma2; | 827 | struct saa7146_video_dma vdma2; |
828 | struct saa7146_video_dma vdma3; | 828 | struct saa7146_video_dma vdma3; |
829 | 829 | ||
830 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 830 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
831 | 831 | ||
832 | int width = buf->fmt->width; | 832 | int width = buf->fmt->width; |
833 | int height = buf->fmt->height; | 833 | int height = buf->fmt->height; |
@@ -994,7 +994,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) | |||
994 | 994 | ||
995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) | 995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) |
996 | { | 996 | { |
997 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 997 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
998 | struct saa7146_vv *vv = dev->vv_data; | 998 | struct saa7146_vv *vv = dev->vv_data; |
999 | u32 vdma1_prot_addr; | 999 | u32 vdma1_prot_addr; |
1000 | 1000 | ||
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index a212a91a30f0..5f01da182aff 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -84,7 +84,7 @@ static struct saa7146_format formats[] = { | |||
84 | 84 | ||
85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); | 85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); |
86 | 86 | ||
87 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) | 87 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc) |
88 | { | 88 | { |
89 | int i, j = NUM_FORMATS; | 89 | int i, j = NUM_FORMATS; |
90 | 90 | ||
@@ -266,7 +266,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); | 266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
267 | struct scatterlist *list = dma->sglist; | 267 | struct scatterlist *list = dma->sglist; |
268 | int length = dma->sglen; | 268 | int length = dma->sglen; |
269 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 269 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
270 | 270 | ||
271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); | 271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); |
272 | 272 | ||
@@ -408,7 +408,7 @@ static int video_begin(struct saa7146_fh *fh) | |||
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 411 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
412 | /* we need to have a valid format set here */ | 412 | /* we need to have a valid format set here */ |
413 | BUG_ON(NULL == fmt); | 413 | BUG_ON(NULL == fmt); |
414 | 414 | ||
@@ -460,7 +460,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) | |||
460 | return -EBUSY; | 460 | return -EBUSY; |
461 | } | 461 | } |
462 | 462 | ||
463 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 463 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
464 | /* we need to have a valid format set here */ | 464 | /* we need to have a valid format set here */ |
465 | BUG_ON(NULL == fmt); | 465 | BUG_ON(NULL == fmt); |
466 | 466 | ||
@@ -536,7 +536,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
536 | return -EPERM; | 536 | return -EPERM; |
537 | 537 | ||
538 | /* check args */ | 538 | /* check args */ |
539 | fmt = format_by_fourcc(dev, fb->fmt.pixelformat); | 539 | fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat); |
540 | if (NULL == fmt) | 540 | if (NULL == fmt) |
541 | return -EINVAL; | 541 | return -EINVAL; |
542 | 542 | ||
@@ -760,7 +760,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
760 | 760 | ||
761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); |
762 | 762 | ||
763 | fmt = format_by_fourcc(dev, f->fmt.pix.pixelformat); | 763 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); |
764 | if (NULL == fmt) | 764 | if (NULL == fmt) |
765 | return -EINVAL; | 765 | return -EINVAL; |
766 | 766 | ||
@@ -1264,7 +1264,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1264 | buf->fmt = &fh->video_fmt; | 1264 | buf->fmt = &fh->video_fmt; |
1265 | buf->vb.field = fh->video_fmt.field; | 1265 | buf->vb.field = fh->video_fmt.field; |
1266 | 1266 | ||
1267 | sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 1267 | sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
1268 | 1268 | ||
1269 | release_all_pagetables(dev, buf); | 1269 | release_all_pagetables(dev, buf); |
1270 | if( 0 != IS_PLANAR(sfmt->trans)) { | 1270 | if( 0 != IS_PLANAR(sfmt->trans)) { |
@@ -1378,7 +1378,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; | 1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; |
1379 | fh->video_fmt.bytesperline = 0; | 1379 | fh->video_fmt.bytesperline = 0; |
1380 | fh->video_fmt.field = V4L2_FIELD_ANY; | 1380 | fh->video_fmt.field = V4L2_FIELD_ANY; |
1381 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 1381 | sfmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; | 1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; |
1383 | 1383 | ||
1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, | 1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, |
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 5bf4985daede..19448144eb3a 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/module.h> /* Modules */ | 31 | #include <linux/module.h> /* Modules */ |
32 | #include <linux/init.h> /* Initdata */ | 32 | #include <linux/init.h> /* Initdata */ |
33 | #include <linux/ioport.h> /* request_region */ | 33 | #include <linux/ioport.h> /* request_region */ |
34 | #include <linux/delay.h> /* udelay */ | ||
35 | #include <linux/videodev2.h> /* kernel radio structs */ | 34 | #include <linux/videodev2.h> /* kernel radio structs */ |
36 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ | 35 | #include <linux/version.h> /* for KERNEL_VERSION MACRO */ |
37 | #include <linux/io.h> /* outb, outb_p */ | 36 | #include <linux/io.h> /* outb, outb_p */ |
@@ -71,27 +70,17 @@ static struct rtrack rtrack_card; | |||
71 | 70 | ||
72 | /* local things */ | 71 | /* local things */ |
73 | 72 | ||
74 | static void sleep_delay(long n) | ||
75 | { | ||
76 | /* Sleep nicely for 'n' uS */ | ||
77 | int d = n / msecs_to_jiffies(1000); | ||
78 | if (!d) | ||
79 | udelay(n); | ||
80 | else | ||
81 | msleep(jiffies_to_msecs(d)); | ||
82 | } | ||
83 | |||
84 | static void rt_decvol(struct rtrack *rt) | 73 | static void rt_decvol(struct rtrack *rt) |
85 | { | 74 | { |
86 | outb(0x58, rt->io); /* volume down + sigstr + on */ | 75 | outb(0x58, rt->io); /* volume down + sigstr + on */ |
87 | sleep_delay(100000); | 76 | msleep(100); |
88 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ | 77 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ |
89 | } | 78 | } |
90 | 79 | ||
91 | static void rt_incvol(struct rtrack *rt) | 80 | static void rt_incvol(struct rtrack *rt) |
92 | { | 81 | { |
93 | outb(0x98, rt->io); /* volume up + sigstr + on */ | 82 | outb(0x98, rt->io); /* volume up + sigstr + on */ |
94 | sleep_delay(100000); | 83 | msleep(100); |
95 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ | 84 | outb(0xd8, rt->io); /* volume steady + sigstr + on */ |
96 | } | 85 | } |
97 | 86 | ||
@@ -120,7 +109,7 @@ static int rt_setvol(struct rtrack *rt, int vol) | |||
120 | 109 | ||
121 | if (vol == 0) { /* volume = 0 means mute the card */ | 110 | if (vol == 0) { /* volume = 0 means mute the card */ |
122 | outb(0x48, rt->io); /* volume down but still "on" */ | 111 | outb(0x48, rt->io); /* volume down but still "on" */ |
123 | sleep_delay(2000000); /* make sure it's totally down */ | 112 | msleep(2000); /* make sure it's totally down */ |
124 | outb(0xd0, rt->io); /* volume steady, off */ | 113 | outb(0xd0, rt->io); /* volume steady, off */ |
125 | rt->curvol = 0; /* track the volume state! */ | 114 | rt->curvol = 0; /* track the volume state! */ |
126 | mutex_unlock(&rt->lock); | 115 | mutex_unlock(&rt->lock); |
@@ -155,7 +144,7 @@ static void send_0_byte(struct rtrack *rt) | |||
155 | outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */ | 144 | outb_p(128+64+16+8+ 1, rt->io); /* on + wr-enable + data low */ |
156 | outb_p(128+64+16+8+2+1, rt->io); /* clock */ | 145 | outb_p(128+64+16+8+2+1, rt->io); /* clock */ |
157 | } | 146 | } |
158 | sleep_delay(1000); | 147 | msleep(1); |
159 | } | 148 | } |
160 | 149 | ||
161 | static void send_1_byte(struct rtrack *rt) | 150 | static void send_1_byte(struct rtrack *rt) |
@@ -169,7 +158,7 @@ static void send_1_byte(struct rtrack *rt) | |||
169 | outb_p(128+64+16+8+4+2+1, rt->io); /* clock */ | 158 | outb_p(128+64+16+8+4+2+1, rt->io); /* clock */ |
170 | } | 159 | } |
171 | 160 | ||
172 | sleep_delay(1000); | 161 | msleep(1); |
173 | } | 162 | } |
174 | 163 | ||
175 | static int rt_setfreq(struct rtrack *rt, unsigned long freq) | 164 | static int rt_setfreq(struct rtrack *rt, unsigned long freq) |
@@ -427,7 +416,7 @@ static int __init rtrack_init(void) | |||
427 | 416 | ||
428 | /* this ensures that the volume is all the way down */ | 417 | /* this ensures that the volume is all the way down */ |
429 | outb(0x48, rt->io); /* volume down but still "on" */ | 418 | outb(0x48, rt->io); /* volume down but still "on" */ |
430 | sleep_delay(2000000); /* make sure it's totally down */ | 419 | msleep(2000); /* make sure it's totally down */ |
431 | outb(0xc0, rt->io); /* steady volume, mute card */ | 420 | outb(0xc0, rt->io); /* steady volume, mute card */ |
432 | 421 | ||
433 | return 0; | 422 | return 0; |
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index f6b62e7398af..11c987eb6df9 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -815,6 +815,7 @@ static void cx23885_dev_checkrevision(struct cx23885_dev *dev) | |||
815 | case 0x0e: | 815 | case 0x0e: |
816 | /* CX23887-15Z */ | 816 | /* CX23887-15Z */ |
817 | dev->hwrevision = 0xc0; | 817 | dev->hwrevision = 0xc0; |
818 | break; | ||
818 | case 0x0f: | 819 | case 0x0f: |
819 | /* CX23887-14Z */ | 820 | /* CX23887-14Z */ |
820 | dev->hwrevision = 0xb1; | 821 | dev->hwrevision = 0xb1; |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index e7efb4bffabd..6e80376b8410 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -1621,11 +1621,11 @@ struct em28xx_board em28xx_boards[] = { | |||
1621 | .input = { { | 1621 | .input = { { |
1622 | .type = EM28XX_VMUX_COMPOSITE1, | 1622 | .type = EM28XX_VMUX_COMPOSITE1, |
1623 | .vmux = SAA7115_COMPOSITE0, | 1623 | .vmux = SAA7115_COMPOSITE0, |
1624 | .amux = EM28XX_AMUX_VIDEO2, | 1624 | .amux = EM28XX_AMUX_LINE_IN, |
1625 | }, { | 1625 | }, { |
1626 | .type = EM28XX_VMUX_SVIDEO, | 1626 | .type = EM28XX_VMUX_SVIDEO, |
1627 | .vmux = SAA7115_SVIDEO3, | 1627 | .vmux = SAA7115_SVIDEO3, |
1628 | .amux = EM28XX_AMUX_VIDEO2, | 1628 | .amux = EM28XX_AMUX_LINE_IN, |
1629 | } }, | 1629 | } }, |
1630 | }, | 1630 | }, |
1631 | [EM2860_BOARD_TERRATEC_AV350] = { | 1631 | [EM2860_BOARD_TERRATEC_AV350] = { |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 78abc1c1f9d5..a50bf65de06e 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -652,7 +652,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) | |||
652 | : USB_ENDPOINT_XFER_ISOC; | 652 | : USB_ENDPOINT_XFER_ISOC; |
653 | i = gspca_dev->alt; /* previous alt setting */ | 653 | i = gspca_dev->alt; /* previous alt setting */ |
654 | if (gspca_dev->cam.reverse_alts) { | 654 | if (gspca_dev->cam.reverse_alts) { |
655 | if (gspca_dev->audio) | 655 | if (gspca_dev->audio && i < gspca_dev->nbalt - 2) |
656 | i++; | 656 | i++; |
657 | while (++i < gspca_dev->nbalt) { | 657 | while (++i < gspca_dev->nbalt) { |
658 | ep = alt_xfer(&intf->altsetting[i], xfer); | 658 | ep = alt_xfer(&intf->altsetting[i], xfer); |
@@ -660,7 +660,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) | |||
660 | break; | 660 | break; |
661 | } | 661 | } |
662 | } else { | 662 | } else { |
663 | if (gspca_dev->audio) | 663 | if (gspca_dev->audio && i > 1) |
664 | i--; | 664 | i--; |
665 | while (--i >= 0) { | 665 | while (--i >= 0) { |
666 | ep = alt_xfer(&intf->altsetting[i], xfer); | 666 | ep = alt_xfer(&intf->altsetting[i], xfer); |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 370544361be2..248c2e62b278 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -56,6 +56,7 @@ struct sd { | |||
56 | u8 jpegqual; /* webcam quality */ | 56 | u8 jpegqual; /* webcam quality */ |
57 | 57 | ||
58 | u8 reg18; | 58 | u8 reg18; |
59 | u8 flags; | ||
59 | 60 | ||
60 | s8 ag_cnt; | 61 | s8 ag_cnt; |
61 | #define AG_CNT_START 13 | 62 | #define AG_CNT_START 13 |
@@ -87,6 +88,9 @@ enum sensors { | |||
87 | SENSOR_SP80708, | 88 | SENSOR_SP80708, |
88 | }; | 89 | }; |
89 | 90 | ||
91 | /* device flags */ | ||
92 | #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ | ||
93 | |||
90 | /* V4L2 controls supported by the driver */ | 94 | /* V4L2 controls supported by the driver */ |
91 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); | 95 | static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); |
92 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); | 96 | static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); |
@@ -1777,7 +1781,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1777 | struct cam *cam; | 1781 | struct cam *cam; |
1778 | 1782 | ||
1779 | sd->bridge = id->driver_info >> 16; | 1783 | sd->bridge = id->driver_info >> 16; |
1780 | sd->sensor = id->driver_info; | 1784 | sd->sensor = id->driver_info >> 8; |
1785 | sd->flags = id->driver_info; | ||
1781 | 1786 | ||
1782 | cam = &gspca_dev->cam; | 1787 | cam = &gspca_dev->cam; |
1783 | if (sd->sensor == SENSOR_ADCM1700) { | 1788 | if (sd->sensor == SENSOR_ADCM1700) { |
@@ -2474,8 +2479,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2474 | reg1 = 0x44; | 2479 | reg1 = 0x44; |
2475 | reg17 = 0xa2; | 2480 | reg17 = 0xa2; |
2476 | break; | 2481 | break; |
2477 | default: | 2482 | case SENSOR_SP80708: |
2478 | /* case SENSOR_SP80708: */ | ||
2479 | init = sp80708_sensor_param1; | 2483 | init = sp80708_sensor_param1; |
2480 | if (mode) { | 2484 | if (mode) { |
2481 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ | 2485 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ |
@@ -2985,14 +2989,18 @@ static const struct sd_desc sd_desc = { | |||
2985 | /* -- module initialisation -- */ | 2989 | /* -- module initialisation -- */ |
2986 | #define BS(bridge, sensor) \ | 2990 | #define BS(bridge, sensor) \ |
2987 | .driver_info = (BRIDGE_ ## bridge << 16) \ | 2991 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
2988 | | SENSOR_ ## sensor | 2992 | | (SENSOR_ ## sensor << 8) |
2993 | #define BSF(bridge, sensor, flags) \ | ||
2994 | .driver_info = (BRIDGE_ ## bridge << 16) \ | ||
2995 | | (SENSOR_ ## sensor << 8) \ | ||
2996 | | (flags) | ||
2989 | static const __devinitdata struct usb_device_id device_table[] = { | 2997 | static const __devinitdata struct usb_device_id device_table[] = { |
2990 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 2998 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
2991 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 2999 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
2992 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 3000 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
2993 | #endif | 3001 | #endif |
2994 | {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, | 3002 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, |
2995 | {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, | 3003 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, |
2996 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, | 3004 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
2997 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | 3005 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
2998 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | 3006 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 4863a21b1f24..93f795960a94 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -157,6 +157,7 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) | |||
157 | mem, dev->bulk_in_size, | 157 | mem, dev->bulk_in_size, |
158 | hdpvr_read_bulk_callback, buf); | 158 | hdpvr_read_bulk_callback, buf); |
159 | 159 | ||
160 | buf->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
160 | buf->status = BUFSTAT_AVAILABLE; | 161 | buf->status = BUFSTAT_AVAILABLE; |
161 | list_add_tail(&buf->buff_list, &dev->free_buff_list); | 162 | list_add_tail(&buf->buff_list, &dev->free_buff_list); |
162 | } | 163 | } |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 0e412131da7c..4897d90f6a25 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -382,7 +382,12 @@ static int msp_s_ctrl(struct v4l2_ctrl *ctrl) | |||
382 | 382 | ||
383 | void msp_update_volume(struct msp_state *state) | 383 | void msp_update_volume(struct msp_state *state) |
384 | { | 384 | { |
385 | v4l2_ctrl_s_ctrl(state->volume, v4l2_ctrl_g_ctrl(state->volume)); | 385 | /* Force an update of the volume/mute cluster */ |
386 | v4l2_ctrl_lock(state->volume); | ||
387 | state->volume->val = state->volume->cur.val; | ||
388 | state->muted->val = state->muted->cur.val; | ||
389 | msp_s_ctrl(state->volume); | ||
390 | v4l2_ctrl_unlock(state->volume); | ||
386 | } | 391 | } |
387 | 392 | ||
388 | /* --- v4l2 ioctls --- */ | 393 | /* --- v4l2 ioctls --- */ |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index b6ea67221d1d..15cb5b3f8ac2 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -791,8 +791,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd, | |||
791 | 791 | ||
792 | if (common_flags & SOCAM_PCLK_SAMPLE_RISING) | 792 | if (common_flags & SOCAM_PCLK_SAMPLE_RISING) |
793 | csicr1 |= CSICR1_REDGE; | 793 | csicr1 |= CSICR1_REDGE; |
794 | if (common_flags & SOCAM_PCLK_SAMPLE_FALLING) | ||
795 | csicr1 |= CSICR1_INV_PCLK; | ||
796 | if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) | 794 | if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) |
797 | csicr1 |= CSICR1_SOF_POL; | 795 | csicr1 |= CSICR1_SOF_POL; |
798 | if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) | 796 | if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH) |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index bb8d83d8ddaf..7c74751d299e 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6661 | .subdevice = 0x2804, | 6661 | .subdevice = 0x2804, |
6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, | 6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, |
6663 | }, { | 6663 | }, { |
6664 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6665 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6666 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6667 | .subdevice = 0x7190, | ||
6668 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6669 | }, { | ||
6670 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6671 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6672 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6673 | .subdevice = 0x7090, | ||
6674 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6675 | }, { | ||
6664 | /* --- boards without eeprom + subsystem ID --- */ | 6676 | /* --- boards without eeprom + subsystem ID --- */ |
6665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 6677 | .vendor = PCI_VENDOR_ID_PHILIPS, |
6666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 6678 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
@@ -6698,18 +6710,6 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6698 | .subvendor = PCI_ANY_ID, | 6710 | .subvendor = PCI_ANY_ID, |
6699 | .subdevice = PCI_ANY_ID, | 6711 | .subdevice = PCI_ANY_ID, |
6700 | .driver_data = SAA7134_BOARD_UNKNOWN, | 6712 | .driver_data = SAA7134_BOARD_UNKNOWN, |
6701 | }, { | ||
6702 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6703 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6704 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6705 | .subdevice = 0x7190, | ||
6706 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6707 | }, { | ||
6708 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6709 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6710 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6711 | .subdevice = 0x7090, | ||
6712 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6713 | },{ | 6713 | },{ |
6714 | /* --- end of list --- */ | 6714 | /* --- end of list --- */ |
6715 | } | 6715 | } |
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 1e7aaaf6cc6f..b5347167aa72 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
@@ -1464,7 +1464,11 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1464 | dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); | 1464 | dev_err(wm831x->dev, "Failed to read parent ID: %d\n", ret); |
1465 | goto err; | 1465 | goto err; |
1466 | } | 1466 | } |
1467 | if (ret != 0x6204) { | 1467 | switch (ret) { |
1468 | case 0x6204: | ||
1469 | case 0x6246: | ||
1470 | break; | ||
1471 | default: | ||
1468 | dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); | 1472 | dev_err(wm831x->dev, "Device is not a WM831x: ID %x\n", ret); |
1469 | ret = -EINVAL; | 1473 | ret = -EINVAL; |
1470 | goto err; | 1474 | goto err; |
@@ -1617,7 +1621,7 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1617 | case WM8321: | 1621 | case WM8321: |
1618 | ret = mfd_add_devices(wm831x->dev, -1, | 1622 | ret = mfd_add_devices(wm831x->dev, -1, |
1619 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | 1623 | wm8320_devs, ARRAY_SIZE(wm8320_devs), |
1620 | NULL, 0); | 1624 | NULL, wm831x->irq_base); |
1621 | break; | 1625 | break; |
1622 | 1626 | ||
1623 | default: | 1627 | default: |
diff --git a/drivers/misc/ad525x_dpot-spi.c b/drivers/misc/ad525x_dpot-spi.c index b8c6df9c8437..6cfcb636577a 100644 --- a/drivers/misc/ad525x_dpot-spi.c +++ b/drivers/misc/ad525x_dpot-spi.c | |||
@@ -53,13 +53,13 @@ static int write8(void *client, u8 val) | |||
53 | static int write16(void *client, u8 reg, u8 val) | 53 | static int write16(void *client, u8 reg, u8 val) |
54 | { | 54 | { |
55 | u8 data[2] = {reg, val}; | 55 | u8 data[2] = {reg, val}; |
56 | return spi_write(client, data, 1); | 56 | return spi_write(client, data, 2); |
57 | } | 57 | } |
58 | 58 | ||
59 | static int write24(void *client, u8 reg, u16 val) | 59 | static int write24(void *client, u8 reg, u16 val) |
60 | { | 60 | { |
61 | u8 data[3] = {reg, val >> 8, val}; | 61 | u8 data[3] = {reg, val >> 8, val}; |
62 | return spi_write(client, data, 1); | 62 | return spi_write(client, data, 3); |
63 | } | 63 | } |
64 | 64 | ||
65 | static int read8(void *client) | 65 | static int read8(void *client) |
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index d551f09ccb79..6956f7e7d439 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
@@ -439,18 +439,23 @@ xpc_discovery(void) | |||
439 | * nodes that can comprise an access protection grouping. The access | 439 | * nodes that can comprise an access protection grouping. The access |
440 | * protection is in regards to memory, IOI and IPI. | 440 | * protection is in regards to memory, IOI and IPI. |
441 | */ | 441 | */ |
442 | max_regions = 64; | ||
443 | region_size = xp_region_size; | 442 | region_size = xp_region_size; |
444 | 443 | ||
445 | switch (region_size) { | 444 | if (is_uv()) |
446 | case 128: | 445 | max_regions = 256; |
447 | max_regions *= 2; | 446 | else { |
448 | case 64: | 447 | max_regions = 64; |
449 | max_regions *= 2; | 448 | |
450 | case 32: | 449 | switch (region_size) { |
451 | max_regions *= 2; | 450 | case 128: |
452 | region_size = 16; | 451 | max_regions *= 2; |
453 | DBUG_ON(!is_shub2()); | 452 | case 64: |
453 | max_regions *= 2; | ||
454 | case 32: | ||
455 | max_regions *= 2; | ||
456 | region_size = 16; | ||
457 | DBUG_ON(!is_shub2()); | ||
458 | } | ||
454 | } | 459 | } |
455 | 460 | ||
456 | for (region = 0; region < max_regions; region++) { | 461 | for (region = 0; region < max_regions; region++) { |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index 1f59ee2226ca..17bbacb1b4b1 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -417,6 +417,7 @@ xpc_process_activate_IRQ_rcvd_uv(void) | |||
417 | static void | 417 | static void |
418 | xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | 418 | xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, |
419 | struct xpc_activate_mq_msghdr_uv *msg_hdr, | 419 | struct xpc_activate_mq_msghdr_uv *msg_hdr, |
420 | int part_setup, | ||
420 | int *wakeup_hb_checker) | 421 | int *wakeup_hb_checker) |
421 | { | 422 | { |
422 | unsigned long irq_flags; | 423 | unsigned long irq_flags; |
@@ -481,6 +482,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
481 | case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: { | 482 | case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: { |
482 | struct xpc_activate_mq_msg_chctl_closerequest_uv *msg; | 483 | struct xpc_activate_mq_msg_chctl_closerequest_uv *msg; |
483 | 484 | ||
485 | if (!part_setup) | ||
486 | break; | ||
487 | |||
484 | msg = container_of(msg_hdr, struct | 488 | msg = container_of(msg_hdr, struct |
485 | xpc_activate_mq_msg_chctl_closerequest_uv, | 489 | xpc_activate_mq_msg_chctl_closerequest_uv, |
486 | hdr); | 490 | hdr); |
@@ -497,6 +501,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
497 | case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: { | 501 | case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: { |
498 | struct xpc_activate_mq_msg_chctl_closereply_uv *msg; | 502 | struct xpc_activate_mq_msg_chctl_closereply_uv *msg; |
499 | 503 | ||
504 | if (!part_setup) | ||
505 | break; | ||
506 | |||
500 | msg = container_of(msg_hdr, struct | 507 | msg = container_of(msg_hdr, struct |
501 | xpc_activate_mq_msg_chctl_closereply_uv, | 508 | xpc_activate_mq_msg_chctl_closereply_uv, |
502 | hdr); | 509 | hdr); |
@@ -511,6 +518,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
511 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: { | 518 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: { |
512 | struct xpc_activate_mq_msg_chctl_openrequest_uv *msg; | 519 | struct xpc_activate_mq_msg_chctl_openrequest_uv *msg; |
513 | 520 | ||
521 | if (!part_setup) | ||
522 | break; | ||
523 | |||
514 | msg = container_of(msg_hdr, struct | 524 | msg = container_of(msg_hdr, struct |
515 | xpc_activate_mq_msg_chctl_openrequest_uv, | 525 | xpc_activate_mq_msg_chctl_openrequest_uv, |
516 | hdr); | 526 | hdr); |
@@ -528,6 +538,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
528 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: { | 538 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: { |
529 | struct xpc_activate_mq_msg_chctl_openreply_uv *msg; | 539 | struct xpc_activate_mq_msg_chctl_openreply_uv *msg; |
530 | 540 | ||
541 | if (!part_setup) | ||
542 | break; | ||
543 | |||
531 | msg = container_of(msg_hdr, struct | 544 | msg = container_of(msg_hdr, struct |
532 | xpc_activate_mq_msg_chctl_openreply_uv, hdr); | 545 | xpc_activate_mq_msg_chctl_openreply_uv, hdr); |
533 | args = &part->remote_openclose_args[msg->ch_number]; | 546 | args = &part->remote_openclose_args[msg->ch_number]; |
@@ -545,6 +558,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
545 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: { | 558 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: { |
546 | struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; | 559 | struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; |
547 | 560 | ||
561 | if (!part_setup) | ||
562 | break; | ||
563 | |||
548 | msg = container_of(msg_hdr, struct | 564 | msg = container_of(msg_hdr, struct |
549 | xpc_activate_mq_msg_chctl_opencomplete_uv, hdr); | 565 | xpc_activate_mq_msg_chctl_opencomplete_uv, hdr); |
550 | spin_lock_irqsave(&part->chctl_lock, irq_flags); | 566 | spin_lock_irqsave(&part->chctl_lock, irq_flags); |
@@ -621,6 +637,7 @@ xpc_handle_activate_IRQ_uv(int irq, void *dev_id) | |||
621 | 637 | ||
622 | part_referenced = xpc_part_ref(part); | 638 | part_referenced = xpc_part_ref(part); |
623 | xpc_handle_activate_mq_msg_uv(part, msg_hdr, | 639 | xpc_handle_activate_mq_msg_uv(part, msg_hdr, |
640 | part_referenced, | ||
624 | &wakeup_hb_checker); | 641 | &wakeup_hb_checker); |
625 | if (part_referenced) | 642 | if (part_referenced) |
626 | xpc_part_deref(part); | 643 | xpc_part_deref(part); |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 09eee6df0653..994454295184 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1514,7 +1514,7 @@ void mmc_stop_host(struct mmc_host *host) | |||
1514 | 1514 | ||
1515 | if (host->caps & MMC_CAP_DISABLE) | 1515 | if (host->caps & MMC_CAP_DISABLE) |
1516 | cancel_delayed_work(&host->disable); | 1516 | cancel_delayed_work(&host->disable); |
1517 | cancel_delayed_work(&host->detect); | 1517 | cancel_delayed_work_sync(&host->detect); |
1518 | mmc_flush_scheduled_work(); | 1518 | mmc_flush_scheduled_work(); |
1519 | 1519 | ||
1520 | /* clear pm flags now and let card drivers set them as needed */ | 1520 | /* clear pm flags now and let card drivers set them as needed */ |
@@ -1720,6 +1720,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, | |||
1720 | 1720 | ||
1721 | case PM_POST_SUSPEND: | 1721 | case PM_POST_SUSPEND: |
1722 | case PM_POST_HIBERNATION: | 1722 | case PM_POST_HIBERNATION: |
1723 | case PM_POST_RESTORE: | ||
1723 | 1724 | ||
1724 | spin_lock_irqsave(&host->lock, flags); | 1725 | spin_lock_irqsave(&host->lock, flags); |
1725 | host->rescan_disable = 0; | 1726 | host->rescan_disable = 0; |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 87226cd202a5..57bb421ba1b2 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/highmem.h> | 69 | #include <linux/highmem.h> |
70 | 70 | ||
71 | #include <linux/mmc/host.h> | 71 | #include <linux/mmc/host.h> |
72 | #include <linux/mmc/sdio.h> | ||
72 | 73 | ||
73 | #include <asm/io.h> | 74 | #include <asm/io.h> |
74 | #include <asm/irq.h> | 75 | #include <asm/irq.h> |
@@ -493,10 +494,14 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command | |||
493 | else if (data->flags & MMC_DATA_WRITE) | 494 | else if (data->flags & MMC_DATA_WRITE) |
494 | cmdr |= AT91_MCI_TRCMD_START; | 495 | cmdr |= AT91_MCI_TRCMD_START; |
495 | 496 | ||
496 | if (data->flags & MMC_DATA_STREAM) | 497 | if (cmd->opcode == SD_IO_RW_EXTENDED) { |
497 | cmdr |= AT91_MCI_TRTYP_STREAM; | 498 | cmdr |= AT91_MCI_TRTYP_SDIO_BLOCK; |
498 | if (data->blocks > 1) | 499 | } else { |
499 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; | 500 | if (data->flags & MMC_DATA_STREAM) |
501 | cmdr |= AT91_MCI_TRTYP_STREAM; | ||
502 | if (data->blocks > 1) | ||
503 | cmdr |= AT91_MCI_TRTYP_MULTIPLE; | ||
504 | } | ||
500 | } | 505 | } |
501 | else { | 506 | else { |
502 | block_length = 0; | 507 | block_length = 0; |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 95ef864ad8f9..3a569bfe3886 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/stat.h> | 26 | #include <linux/stat.h> |
27 | 27 | ||
28 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
29 | #include <linux/mmc/sdio.h> | ||
29 | 30 | ||
30 | #include <mach/atmel-mci.h> | 31 | #include <mach/atmel-mci.h> |
31 | #include <linux/atmel-mci.h> | 32 | #include <linux/atmel-mci.h> |
@@ -532,12 +533,17 @@ static u32 atmci_prepare_command(struct mmc_host *mmc, | |||
532 | data = cmd->data; | 533 | data = cmd->data; |
533 | if (data) { | 534 | if (data) { |
534 | cmdr |= MCI_CMDR_START_XFER; | 535 | cmdr |= MCI_CMDR_START_XFER; |
535 | if (data->flags & MMC_DATA_STREAM) | 536 | |
536 | cmdr |= MCI_CMDR_STREAM; | 537 | if (cmd->opcode == SD_IO_RW_EXTENDED) { |
537 | else if (data->blocks > 1) | 538 | cmdr |= MCI_CMDR_SDIO_BLOCK; |
538 | cmdr |= MCI_CMDR_MULTI_BLOCK; | 539 | } else { |
539 | else | 540 | if (data->flags & MMC_DATA_STREAM) |
540 | cmdr |= MCI_CMDR_BLOCK; | 541 | cmdr |= MCI_CMDR_STREAM; |
542 | else if (data->blocks > 1) | ||
543 | cmdr |= MCI_CMDR_MULTI_BLOCK; | ||
544 | else | ||
545 | cmdr |= MCI_CMDR_BLOCK; | ||
546 | } | ||
541 | 547 | ||
542 | if (data->flags & MMC_DATA_READ) | 548 | if (data->flags & MMC_DATA_READ) |
543 | cmdr |= MCI_CMDR_TRDIR_READ; | 549 | cmdr |= MCI_CMDR_TRDIR_READ; |
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index 4b0e677d7295..5164edfeabdd 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c | |||
@@ -462,7 +462,7 @@ static int __devinit sdh_probe(struct platform_device *pdev) | |||
462 | goto out; | 462 | goto out; |
463 | } | 463 | } |
464 | 464 | ||
465 | mmc = mmc_alloc_host(sizeof(*mmc), &pdev->dev); | 465 | mmc = mmc_alloc_host(sizeof(struct sdh_host), &pdev->dev); |
466 | if (!mmc) { | 466 | if (!mmc) { |
467 | ret = -ENOMEM; | 467 | ret = -ENOMEM; |
468 | goto out; | 468 | goto out; |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 4a4f6b81e32d..70609eefc2de 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -490,13 +490,11 @@ static inline unsigned int cp_rx_csum_ok (u32 status) | |||
490 | { | 490 | { |
491 | unsigned int protocol = (status >> 16) & 0x3; | 491 | unsigned int protocol = (status >> 16) & 0x3; |
492 | 492 | ||
493 | if (likely((protocol == RxProtoTCP) && (!(status & TCPFail)))) | 493 | if (((protocol == RxProtoTCP) && !(status & TCPFail)) || |
494 | ((protocol == RxProtoUDP) && !(status & UDPFail))) | ||
494 | return 1; | 495 | return 1; |
495 | else if ((protocol == RxProtoUDP) && (!(status & UDPFail))) | 496 | else |
496 | return 1; | 497 | return 0; |
497 | else if ((protocol == RxProtoIP) && (!(status & IPFail))) | ||
498 | return 1; | ||
499 | return 0; | ||
500 | } | 498 | } |
501 | 499 | ||
502 | static int cp_rx_poll(struct napi_struct *napi, int budget) | 500 | static int cp_rx_poll(struct napi_struct *napi, int budget) |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index c73be2848319..67f75c17919c 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -3503,6 +3503,8 @@ static int atl1_set_ringparam(struct net_device *netdev, | |||
3503 | struct atl1_rfd_ring rfd_old, rfd_new; | 3503 | struct atl1_rfd_ring rfd_old, rfd_new; |
3504 | struct atl1_rrd_ring rrd_old, rrd_new; | 3504 | struct atl1_rrd_ring rrd_old, rrd_new; |
3505 | struct atl1_ring_header rhdr_old, rhdr_new; | 3505 | struct atl1_ring_header rhdr_old, rhdr_new; |
3506 | struct atl1_smb smb; | ||
3507 | struct atl1_cmb cmb; | ||
3506 | int err; | 3508 | int err; |
3507 | 3509 | ||
3508 | tpd_old = adapter->tpd_ring; | 3510 | tpd_old = adapter->tpd_ring; |
@@ -3543,11 +3545,19 @@ static int atl1_set_ringparam(struct net_device *netdev, | |||
3543 | adapter->rrd_ring = rrd_old; | 3545 | adapter->rrd_ring = rrd_old; |
3544 | adapter->tpd_ring = tpd_old; | 3546 | adapter->tpd_ring = tpd_old; |
3545 | adapter->ring_header = rhdr_old; | 3547 | adapter->ring_header = rhdr_old; |
3548 | /* | ||
3549 | * Save SMB and CMB, since atl1_free_ring_resources | ||
3550 | * will clear them. | ||
3551 | */ | ||
3552 | smb = adapter->smb; | ||
3553 | cmb = adapter->cmb; | ||
3546 | atl1_free_ring_resources(adapter); | 3554 | atl1_free_ring_resources(adapter); |
3547 | adapter->rfd_ring = rfd_new; | 3555 | adapter->rfd_ring = rfd_new; |
3548 | adapter->rrd_ring = rrd_new; | 3556 | adapter->rrd_ring = rrd_new; |
3549 | adapter->tpd_ring = tpd_new; | 3557 | adapter->tpd_ring = tpd_new; |
3550 | adapter->ring_header = rhdr_new; | 3558 | adapter->ring_header = rhdr_new; |
3559 | adapter->smb = smb; | ||
3560 | adapter->cmb = cmb; | ||
3551 | 3561 | ||
3552 | err = atl1_up(adapter); | 3562 | err = atl1_up(adapter); |
3553 | if (err) | 3563 | if (err) |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 34abcc9403d6..dc913b986795 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1179,7 +1179,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, | |||
1179 | 1179 | ||
1180 | i = 0; | 1180 | i = 0; |
1181 | netdev_for_each_mc_addr(ha, netdev) | 1181 | netdev_for_each_mc_addr(ha, netdev) |
1182 | memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); | 1182 | memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN); |
1183 | } else { | 1183 | } else { |
1184 | req->promiscuous = 1; | 1184 | req->promiscuous = 1; |
1185 | } | 1185 | } |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index c6fdd851579a..c867cf901f9f 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -240,11 +240,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct n | |||
240 | 240 | ||
241 | bond_for_each_slave(bond, slave, i) { | 241 | bond_for_each_slave(bond, slave, i) { |
242 | if (slave->dev == slave_dev) { | 242 | if (slave->dev == slave_dev) { |
243 | break; | 243 | return slave; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | return slave; | 247 | return 0; |
248 | } | 248 | } |
249 | 249 | ||
250 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) | 250 | static inline struct bonding *bond_get_bond_by_slave(struct slave *slave) |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 5cc39ed289c6..71324286b1e7 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | char e1000_driver_name[] = "e1000"; | 32 | char e1000_driver_name[] = "e1000"; |
33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; |
34 | #define DRV_VERSION "7.3.21-k6-NAPI" | 34 | #define DRV_VERSION "7.3.21-k8-NAPI" |
35 | const char e1000_driver_version[] = DRV_VERSION; | 35 | const char e1000_driver_version[] = DRV_VERSION; |
36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
37 | 37 | ||
@@ -483,9 +483,6 @@ void e1000_down(struct e1000_adapter *adapter) | |||
483 | struct net_device *netdev = adapter->netdev; | 483 | struct net_device *netdev = adapter->netdev; |
484 | u32 rctl, tctl; | 484 | u32 rctl, tctl; |
485 | 485 | ||
486 | /* signal that we're down so the interrupt handler does not | ||
487 | * reschedule our watchdog timer */ | ||
488 | set_bit(__E1000_DOWN, &adapter->flags); | ||
489 | 486 | ||
490 | /* disable receives in the hardware */ | 487 | /* disable receives in the hardware */ |
491 | rctl = er32(RCTL); | 488 | rctl = er32(RCTL); |
@@ -506,6 +503,13 @@ void e1000_down(struct e1000_adapter *adapter) | |||
506 | 503 | ||
507 | e1000_irq_disable(adapter); | 504 | e1000_irq_disable(adapter); |
508 | 505 | ||
506 | /* | ||
507 | * Setting DOWN must be after irq_disable to prevent | ||
508 | * a screaming interrupt. Setting DOWN also prevents | ||
509 | * timers and tasks from rescheduling. | ||
510 | */ | ||
511 | set_bit(__E1000_DOWN, &adapter->flags); | ||
512 | |||
509 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 513 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
510 | del_timer_sync(&adapter->watchdog_timer); | 514 | del_timer_sync(&adapter->watchdog_timer); |
511 | del_timer_sync(&adapter->phy_info_timer); | 515 | del_timer_sync(&adapter->phy_info_timer); |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index cce32d43175f..52e9ca8de4b2 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -651,8 +651,8 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
651 | fep->mii_timeout = 0; | 651 | fep->mii_timeout = 0; |
652 | init_completion(&fep->mdio_done); | 652 | init_completion(&fep->mdio_done); |
653 | 653 | ||
654 | /* start a read op */ | 654 | /* start a write op */ |
655 | writel(FEC_MMFR_ST | FEC_MMFR_OP_READ | | 655 | writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE | |
656 | FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | | 656 | FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(regnum) | |
657 | FEC_MMFR_TA | FEC_MMFR_DATA(value), | 657 | FEC_MMFR_TA | FEC_MMFR_DATA(value), |
658 | fep->hwp + FEC_MII_DATA); | 658 | fep->hwp + FEC_MII_DATA); |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index ab9f675c5b8b..fe337bd121aa 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev) | |||
104 | rcu_read_unlock(); | 104 | rcu_read_unlock(); |
105 | dev_kfree_skb(skb); | 105 | dev_kfree_skb(skb); |
106 | stats->tx_dropped++; | 106 | stats->tx_dropped++; |
107 | if (skb_queue_len(&dp->tq) != 0) | ||
108 | goto resched; | ||
107 | break; | 109 | break; |
108 | } | 110 | } |
109 | rcu_read_unlock(); | 111 | rcu_read_unlock(); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index e32af434cc9d..0e7f086d28db 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2651,9 +2651,16 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) | |||
2651 | int rx_buf_len; | 2651 | int rx_buf_len; |
2652 | 2652 | ||
2653 | /* Decide whether to use packet split mode or not */ | 2653 | /* Decide whether to use packet split mode or not */ |
2654 | /* On by default */ | ||
2655 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | ||
2656 | |||
2654 | /* Do not use packet split if we're in SR-IOV Mode */ | 2657 | /* Do not use packet split if we're in SR-IOV Mode */ |
2655 | if (!adapter->num_vfs) | 2658 | if (adapter->num_vfs) |
2656 | adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; | 2659 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; |
2660 | |||
2661 | /* Disable packet split due to 82599 erratum #45 */ | ||
2662 | if (hw->mac.type == ixgbe_mac_82599EB) | ||
2663 | adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED; | ||
2657 | 2664 | ||
2658 | /* Set the RX buffer length according to the mode */ | 2665 | /* Set the RX buffer length according to the mode */ |
2659 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { | 2666 | if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { |
diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 99f24f5cac53..f0643ac4aff1 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c | |||
@@ -1575,6 +1575,16 @@ jme_free_irq(struct jme_adapter *jme) | |||
1575 | } | 1575 | } |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | static inline void | ||
1579 | jme_phy_on(struct jme_adapter *jme) | ||
1580 | { | ||
1581 | u32 bmcr; | ||
1582 | |||
1583 | bmcr = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_BMCR); | ||
1584 | bmcr &= ~BMCR_PDOWN; | ||
1585 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_BMCR, bmcr); | ||
1586 | } | ||
1587 | |||
1578 | static int | 1588 | static int |
1579 | jme_open(struct net_device *netdev) | 1589 | jme_open(struct net_device *netdev) |
1580 | { | 1590 | { |
@@ -1595,10 +1605,12 @@ jme_open(struct net_device *netdev) | |||
1595 | 1605 | ||
1596 | jme_start_irq(jme); | 1606 | jme_start_irq(jme); |
1597 | 1607 | ||
1598 | if (test_bit(JME_FLAG_SSET, &jme->flags)) | 1608 | if (test_bit(JME_FLAG_SSET, &jme->flags)) { |
1609 | jme_phy_on(jme); | ||
1599 | jme_set_settings(netdev, &jme->old_ecmd); | 1610 | jme_set_settings(netdev, &jme->old_ecmd); |
1600 | else | 1611 | } else { |
1601 | jme_reset_phy_processor(jme); | 1612 | jme_reset_phy_processor(jme); |
1613 | } | ||
1602 | 1614 | ||
1603 | jme_reset_link(jme); | 1615 | jme_reset_link(jme); |
1604 | 1616 | ||
@@ -3006,10 +3018,12 @@ jme_resume(struct pci_dev *pdev) | |||
3006 | jme_clear_pm(jme); | 3018 | jme_clear_pm(jme); |
3007 | pci_restore_state(pdev); | 3019 | pci_restore_state(pdev); |
3008 | 3020 | ||
3009 | if (test_bit(JME_FLAG_SSET, &jme->flags)) | 3021 | if (test_bit(JME_FLAG_SSET, &jme->flags)) { |
3022 | jme_phy_on(jme); | ||
3010 | jme_set_settings(netdev, &jme->old_ecmd); | 3023 | jme_set_settings(netdev, &jme->old_ecmd); |
3011 | else | 3024 | } else { |
3012 | jme_reset_phy_processor(jme); | 3025 | jme_reset_phy_processor(jme); |
3026 | } | ||
3013 | 3027 | ||
3014 | jme_start_irq(jme); | 3028 | jme_start_irq(jme); |
3015 | netif_device_attach(netdev); | 3029 | netif_device_attach(netdev); |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index f9b509a6b09a..b12553bb5ecc 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1622,6 +1622,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1622 | PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), | 1622 | PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), |
1623 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), | 1623 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), |
1624 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), | 1624 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), |
1625 | PCMCIA_DEVICE_PROD_ID12("corega", "Ether CF-TD", 0x0a21501a, 0x6589340a), | ||
1625 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), | 1626 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), |
1626 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), | 1627 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), |
1627 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), | 1628 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 0101f2bdf400..c1ba49b772ff 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -196,20 +196,27 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
196 | MII_88E1121_PHY_MSCR_PAGE); | 196 | MII_88E1121_PHY_MSCR_PAGE); |
197 | if (err < 0) | 197 | if (err < 0) |
198 | return err; | 198 | return err; |
199 | mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) & | ||
200 | MII_88E1121_PHY_MSCR_DELAY_MASK; | ||
201 | 199 | ||
202 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | 200 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
203 | mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY | | 201 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
204 | MII_88E1121_PHY_MSCR_TX_DELAY); | 202 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
205 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | 203 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { |
206 | mscr |= MII_88E1121_PHY_MSCR_RX_DELAY; | ||
207 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
208 | mscr |= MII_88E1121_PHY_MSCR_TX_DELAY; | ||
209 | 204 | ||
210 | err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr); | 205 | mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) & |
211 | if (err < 0) | 206 | MII_88E1121_PHY_MSCR_DELAY_MASK; |
212 | return err; | 207 | |
208 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
209 | mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY | | ||
210 | MII_88E1121_PHY_MSCR_TX_DELAY); | ||
211 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | ||
212 | mscr |= MII_88E1121_PHY_MSCR_RX_DELAY; | ||
213 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
214 | mscr |= MII_88E1121_PHY_MSCR_TX_DELAY; | ||
215 | |||
216 | err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr); | ||
217 | if (err < 0) | ||
218 | return err; | ||
219 | } | ||
213 | 220 | ||
214 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 221 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); |
215 | 222 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index c07de359dc07..6a3eae2407c1 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -948,7 +948,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) | |||
948 | 948 | ||
949 | abort: | 949 | abort: |
950 | kfree_skb(skb); | 950 | kfree_skb(skb); |
951 | return 0; | 951 | return 1; |
952 | } | 952 | } |
953 | 953 | ||
954 | /************************************************************************ | 954 | /************************************************************************ |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 142c381e1d73..80666f097ce6 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -893,16 +893,18 @@ static void r6040_multicast_list(struct net_device *dev) | |||
893 | /* Multicast Address 1~4 case */ | 893 | /* Multicast Address 1~4 case */ |
894 | i = 0; | 894 | i = 0; |
895 | netdev_for_each_mc_addr(ha, dev) { | 895 | netdev_for_each_mc_addr(ha, dev) { |
896 | if (i < MCAST_MAX) { | 896 | if (i >= MCAST_MAX) |
897 | adrp = (u16 *) ha->addr; | 897 | break; |
898 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); | 898 | adrp = (u16 *) ha->addr; |
899 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); | 899 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); |
900 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); | 900 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); |
901 | } else { | 901 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); |
902 | iowrite16(0xffff, ioaddr + MID_1L + 8 * i); | 902 | i++; |
903 | iowrite16(0xffff, ioaddr + MID_1M + 8 * i); | 903 | } |
904 | iowrite16(0xffff, ioaddr + MID_1H + 8 * i); | 904 | while (i < MCAST_MAX) { |
905 | } | 905 | iowrite16(0xffff, ioaddr + MID_1L + 8 * i); |
906 | iowrite16(0xffff, ioaddr + MID_1M + 8 * i); | ||
907 | iowrite16(0xffff, ioaddr + MID_1H + 8 * i); | ||
906 | i++; | 908 | i++; |
907 | } | 909 | } |
908 | } | 910 | } |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 992db2fa136e..ed65e4a473ec 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -855,10 +855,10 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
855 | else | 855 | else |
856 | tp->features &= ~RTL_FEATURE_WOL; | 856 | tp->features &= ~RTL_FEATURE_WOL; |
857 | __rtl8169_set_wol(tp, wol->wolopts); | 857 | __rtl8169_set_wol(tp, wol->wolopts); |
858 | device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts); | ||
859 | |||
860 | spin_unlock_irq(&tp->lock); | 858 | spin_unlock_irq(&tp->lock); |
861 | 859 | ||
860 | device_set_wakeup_enable(&tp->pci_dev->dev, wol->wolopts); | ||
861 | |||
862 | return 0; | 862 | return 0; |
863 | } | 863 | } |
864 | 864 | ||
@@ -2936,7 +2936,7 @@ static const struct rtl_cfg_info { | |||
2936 | .hw_start = rtl_hw_start_8168, | 2936 | .hw_start = rtl_hw_start_8168, |
2937 | .region = 2, | 2937 | .region = 2, |
2938 | .align = 8, | 2938 | .align = 8, |
2939 | .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | | 2939 | .intr_event = SYSErr | LinkChg | RxOverflow | |
2940 | TxErr | TxOK | RxOK | RxErr, | 2940 | TxErr | TxOK | RxOK | RxErr, |
2941 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, | 2941 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, |
2942 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, | 2942 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, |
@@ -4455,14 +4455,12 @@ static inline int rtl8169_fragmented_frame(u32 status) | |||
4455 | return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); | 4455 | return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); |
4456 | } | 4456 | } |
4457 | 4457 | ||
4458 | static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) | 4458 | static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1) |
4459 | { | 4459 | { |
4460 | u32 opts1 = le32_to_cpu(desc->opts1); | ||
4461 | u32 status = opts1 & RxProtoMask; | 4460 | u32 status = opts1 & RxProtoMask; |
4462 | 4461 | ||
4463 | if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || | 4462 | if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || |
4464 | ((status == RxProtoUDP) && !(opts1 & UDPFail)) || | 4463 | ((status == RxProtoUDP) && !(opts1 & UDPFail))) |
4465 | ((status == RxProtoIP) && !(opts1 & IPFail))) | ||
4466 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 4464 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
4467 | else | 4465 | else |
4468 | skb->ip_summed = CHECKSUM_NONE; | 4466 | skb->ip_summed = CHECKSUM_NONE; |
@@ -4551,8 +4549,6 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4551 | continue; | 4549 | continue; |
4552 | } | 4550 | } |
4553 | 4551 | ||
4554 | rtl8169_rx_csum(skb, desc); | ||
4555 | |||
4556 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { | 4552 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
4557 | dma_sync_single_for_device(&pdev->dev, addr, | 4553 | dma_sync_single_for_device(&pdev->dev, addr, |
4558 | pkt_size, PCI_DMA_FROMDEVICE); | 4554 | pkt_size, PCI_DMA_FROMDEVICE); |
@@ -4563,6 +4559,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4563 | tp->Rx_skbuff[entry] = NULL; | 4559 | tp->Rx_skbuff[entry] = NULL; |
4564 | } | 4560 | } |
4565 | 4561 | ||
4562 | rtl8169_rx_csum(skb, status); | ||
4566 | skb_put(skb, pkt_size); | 4563 | skb_put(skb, pkt_size); |
4567 | skb->protocol = eth_type_trans(skb, dev); | 4564 | skb->protocol = eth_type_trans(skb, dev); |
4568 | 4565 | ||
@@ -4630,7 +4627,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
4630 | } | 4627 | } |
4631 | 4628 | ||
4632 | /* Work around for rx fifo overflow */ | 4629 | /* Work around for rx fifo overflow */ |
4633 | if (unlikely(status & RxFIFOOver)) { | 4630 | if (unlikely(status & RxFIFOOver) && |
4631 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { | ||
4634 | netif_stop_queue(dev); | 4632 | netif_stop_queue(dev); |
4635 | rtl8169_tx_timeout(dev); | 4633 | rtl8169_tx_timeout(dev); |
4636 | break; | 4634 | break; |
@@ -4891,6 +4889,9 @@ static int rtl8169_resume(struct device *device) | |||
4891 | { | 4889 | { |
4892 | struct pci_dev *pdev = to_pci_dev(device); | 4890 | struct pci_dev *pdev = to_pci_dev(device); |
4893 | struct net_device *dev = pci_get_drvdata(pdev); | 4891 | struct net_device *dev = pci_get_drvdata(pdev); |
4892 | struct rtl8169_private *tp = netdev_priv(dev); | ||
4893 | |||
4894 | rtl8169_init_phy(dev, tp); | ||
4894 | 4895 | ||
4895 | if (netif_running(dev)) | 4896 | if (netif_running(dev)) |
4896 | __rtl8169_resume(dev); | 4897 | __rtl8169_resume(dev); |
@@ -4931,6 +4932,8 @@ static int rtl8169_runtime_resume(struct device *device) | |||
4931 | tp->saved_wolopts = 0; | 4932 | tp->saved_wolopts = 0; |
4932 | spin_unlock_irq(&tp->lock); | 4933 | spin_unlock_irq(&tp->lock); |
4933 | 4934 | ||
4935 | rtl8169_init_phy(dev, tp); | ||
4936 | |||
4934 | __rtl8169_resume(dev); | 4937 | __rtl8169_resume(dev); |
4935 | 4938 | ||
4936 | return 0; | 4939 | return 0; |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 737df6032bbc..2ce585a511d9 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -324,7 +324,7 @@ static int bdx_fw_load(struct bdx_priv *priv) | |||
324 | ENTER; | 324 | ENTER; |
325 | master = READ_REG(priv, regINIT_SEMAPHORE); | 325 | master = READ_REG(priv, regINIT_SEMAPHORE); |
326 | if (!READ_REG(priv, regINIT_STATUS) && master) { | 326 | if (!READ_REG(priv, regINIT_STATUS) && master) { |
327 | rc = request_firmware(&fw, "tehuti/firmware.bin", &priv->pdev->dev); | 327 | rc = request_firmware(&fw, "tehuti/bdx.bin", &priv->pdev->dev); |
328 | if (rc) | 328 | if (rc) |
329 | goto out; | 329 | goto out; |
330 | bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); | 330 | bdx_tx_push_desc_safe(priv, (char *)fw->data, fw->size); |
@@ -2516,4 +2516,4 @@ module_exit(bdx_module_exit); | |||
2516 | MODULE_LICENSE("GPL"); | 2516 | MODULE_LICENSE("GPL"); |
2517 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2517 | MODULE_AUTHOR(DRIVER_AUTHOR); |
2518 | MODULE_DESCRIPTION(BDX_DRV_DESC); | 2518 | MODULE_DESCRIPTION(BDX_DRV_DESC); |
2519 | MODULE_FIRMWARE("tehuti/firmware.bin"); | 2519 | MODULE_FIRMWARE("tehuti/bdx.bin"); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index ca7fc9df1ccf..c04d49e31f81 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/usb/usbnet.h> | 45 | #include <linux/usb/usbnet.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/kernel.h> | 47 | #include <linux/kernel.h> |
48 | #include <linux/pm_runtime.h> | ||
48 | 49 | ||
49 | #define DRIVER_VERSION "22-Aug-2005" | 50 | #define DRIVER_VERSION "22-Aug-2005" |
50 | 51 | ||
@@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1273 | struct usb_device *xdev; | 1274 | struct usb_device *xdev; |
1274 | int status; | 1275 | int status; |
1275 | const char *name; | 1276 | const char *name; |
1277 | struct usb_driver *driver = to_usb_driver(udev->dev.driver); | ||
1278 | |||
1279 | /* usbnet already took usb runtime pm, so have to enable the feature | ||
1280 | * for usb interface, otherwise usb_autopm_get_interface may return | ||
1281 | * failure if USB_SUSPEND(RUNTIME_PM) is enabled. | ||
1282 | */ | ||
1283 | if (!driver->supports_autosuspend) { | ||
1284 | driver->supports_autosuspend = 1; | ||
1285 | pm_runtime_enable(&udev->dev); | ||
1286 | } | ||
1276 | 1287 | ||
1277 | name = udev->dev.driver->name; | 1288 | name = udev->dev.driver->name; |
1278 | info = (struct driver_info *) prod->driver_info; | 1289 | info = (struct driver_info *) prod->driver_info; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4598e9d2608f..65d3d801a258 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq) | |||
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | static void virtnet_napi_enable(struct virtnet_info *vi) | ||
450 | { | ||
451 | napi_enable(&vi->napi); | ||
452 | |||
453 | /* If all buffers were filled by other side before we napi_enabled, we | ||
454 | * won't get another interrupt, so process any outstanding packets | ||
455 | * now. virtnet_poll wants re-enable the queue, so we disable here. | ||
456 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | ||
457 | if (napi_schedule_prep(&vi->napi)) { | ||
458 | virtqueue_disable_cb(vi->rvq); | ||
459 | __napi_schedule(&vi->napi); | ||
460 | } | ||
461 | } | ||
462 | |||
449 | static void refill_work(struct work_struct *work) | 463 | static void refill_work(struct work_struct *work) |
450 | { | 464 | { |
451 | struct virtnet_info *vi; | 465 | struct virtnet_info *vi; |
@@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work) | |||
454 | vi = container_of(work, struct virtnet_info, refill.work); | 468 | vi = container_of(work, struct virtnet_info, refill.work); |
455 | napi_disable(&vi->napi); | 469 | napi_disable(&vi->napi); |
456 | still_empty = !try_fill_recv(vi, GFP_KERNEL); | 470 | still_empty = !try_fill_recv(vi, GFP_KERNEL); |
457 | napi_enable(&vi->napi); | 471 | virtnet_napi_enable(vi); |
458 | 472 | ||
459 | /* In theory, this can happen: if we don't get any buffers in | 473 | /* In theory, this can happen: if we don't get any buffers in |
460 | * we will *never* try to fill again. */ | 474 | * we will *never* try to fill again. */ |
@@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev) | |||
638 | { | 652 | { |
639 | struct virtnet_info *vi = netdev_priv(dev); | 653 | struct virtnet_info *vi = netdev_priv(dev); |
640 | 654 | ||
641 | napi_enable(&vi->napi); | 655 | virtnet_napi_enable(vi); |
642 | |||
643 | /* If all buffers were filled by other side before we napi_enabled, we | ||
644 | * won't get another interrupt, so process any outstanding packets | ||
645 | * now. virtnet_poll wants re-enable the queue, so we disable here. | ||
646 | * We synchronize against interrupts via NAPI_STATE_SCHED */ | ||
647 | if (napi_schedule_prep(&vi->napi)) { | ||
648 | virtqueue_disable_cb(vi->rvq); | ||
649 | __napi_schedule(&vi->napi); | ||
650 | } | ||
651 | return 0; | 656 | return 0; |
652 | } | 657 | } |
653 | 658 | ||
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index d32f2828b098..a706202fa67c 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -119,6 +119,7 @@ struct ath_common { | |||
119 | 119 | ||
120 | u32 keymax; | 120 | u32 keymax; |
121 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 121 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
122 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | ||
122 | u8 splitmic; | 123 | u8 splitmic; |
123 | 124 | ||
124 | struct ath_regulatory regulatory; | 125 | struct ath_regulatory regulatory; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index fe7418aefc4a..d4ee07084c4d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c | |||
@@ -710,10 +710,6 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah, | |||
710 | 710 | ||
711 | /* Do NF cal only at longer intervals */ | 711 | /* Do NF cal only at longer intervals */ |
712 | if (longcal || nfcal_pending) { | 712 | if (longcal || nfcal_pending) { |
713 | /* Do periodic PAOffset Cal */ | ||
714 | ar9002_hw_pa_cal(ah, false); | ||
715 | ar9002_hw_olc_temp_compensation(ah); | ||
716 | |||
717 | /* | 713 | /* |
718 | * Get the value from the previous NF cal and update | 714 | * Get the value from the previous NF cal and update |
719 | * history buffer. | 715 | * history buffer. |
@@ -728,8 +724,12 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah, | |||
728 | ath9k_hw_loadnf(ah, ah->curchan); | 724 | ath9k_hw_loadnf(ah, ah->curchan); |
729 | } | 725 | } |
730 | 726 | ||
731 | if (longcal) | 727 | if (longcal) { |
732 | ath9k_hw_start_nfcal(ah, false); | 728 | ath9k_hw_start_nfcal(ah, false); |
729 | /* Do periodic PAOffset Cal */ | ||
730 | ar9002_hw_pa_cal(ah, false); | ||
731 | ar9002_hw_olc_temp_compensation(ah); | ||
732 | } | ||
733 | } | 733 | } |
734 | 734 | ||
735 | return iscaldone; | 735 | return iscaldone; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c index 303c63da5ea3..ab1c50b8326d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c | |||
@@ -411,6 +411,9 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, | |||
411 | val &= ~(AR_WA_BIT6 | AR_WA_BIT7); | 411 | val &= ~(AR_WA_BIT6 | AR_WA_BIT7); |
412 | } | 412 | } |
413 | 413 | ||
414 | if (AR_SREV_9280(ah)) | ||
415 | val |= AR_WA_BIT22; | ||
416 | |||
414 | if (AR_SREV_9285E_20(ah)) | 417 | if (AR_SREV_9285E_20(ah)) |
415 | val |= AR_WA_BIT23; | 418 | val |= AR_WA_BIT23; |
416 | 419 | ||
@@ -442,9 +445,8 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, | |||
442 | } | 445 | } |
443 | 446 | ||
444 | /* WAR for ASPM system hang */ | 447 | /* WAR for ASPM system hang */ |
445 | if (AR_SREV_9280(ah) || AR_SREV_9285(ah) || AR_SREV_9287(ah)) { | 448 | if (AR_SREV_9285(ah) || AR_SREV_9287(ah)) |
446 | val |= (AR_WA_BIT6 | AR_WA_BIT7); | 449 | val |= (AR_WA_BIT6 | AR_WA_BIT7); |
447 | } | ||
448 | 450 | ||
449 | if (AR_SREV_9285E_20(ah)) | 451 | if (AR_SREV_9285E_20(ah)) |
450 | val |= AR_WA_BIT23; | 452 | val |= AR_WA_BIT23; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index ec98ab50748a..a14a5e43cf56 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -34,6 +34,10 @@ static const u32 ar9300_2p2_radio_postamble[][5] = { | |||
34 | 34 | ||
35 | static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { | 35 | static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { |
36 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 36 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
37 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
38 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
39 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
40 | {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
37 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 41 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
38 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 42 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
39 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 43 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
@@ -99,6 +103,30 @@ static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { | |||
99 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 103 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
100 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 104 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
101 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 105 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
106 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
107 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
108 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
109 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
110 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
111 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
112 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
113 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
114 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
115 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
116 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
117 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
118 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
119 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
120 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
121 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
122 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
123 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
124 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
125 | {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
126 | {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
127 | {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
128 | {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
129 | {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
102 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 130 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
103 | {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, | 131 | {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, |
104 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 132 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
@@ -118,7 +146,7 @@ static const u32 ar9300Modes_fast_clock_2p2[][3] = { | |||
118 | {0x00008014, 0x044c044c, 0x08980898}, | 146 | {0x00008014, 0x044c044c, 0x08980898}, |
119 | {0x0000801c, 0x148ec02b, 0x148ec057}, | 147 | {0x0000801c, 0x148ec02b, 0x148ec057}, |
120 | {0x00008318, 0x000044c0, 0x00008980}, | 148 | {0x00008318, 0x000044c0, 0x00008980}, |
121 | {0x00009e00, 0x03721821, 0x03721821}, | 149 | {0x00009e00, 0x0372131c, 0x0372131c}, |
122 | {0x0000a230, 0x0000000b, 0x00000016}, | 150 | {0x0000a230, 0x0000000b, 0x00000016}, |
123 | {0x0000a254, 0x00000898, 0x00001130}, | 151 | {0x0000a254, 0x00000898, 0x00001130}, |
124 | }; | 152 | }; |
@@ -595,15 +623,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = { | |||
595 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, | 623 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
596 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, | 624 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, |
597 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, | 625 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, |
598 | {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, | 626 | {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, |
599 | {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, | 627 | {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, |
600 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, | 628 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, |
601 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, | 629 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, |
602 | {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, | 630 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, |
603 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 631 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
604 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 632 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
605 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 633 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, |
606 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 634 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
635 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, | ||
607 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, | 636 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, |
608 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, | 637 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, |
609 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, | 638 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
@@ -624,16 +653,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = { | |||
624 | {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, | 653 | {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, |
625 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, | 654 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, |
626 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, | 655 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, |
627 | {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, | 656 | {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, |
628 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 657 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
629 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 658 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
630 | {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 659 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, |
631 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 660 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
632 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 661 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
633 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | 662 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, |
634 | {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, | 663 | {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, |
635 | {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 664 | {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
636 | {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 665 | {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, |
637 | {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 666 | {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
638 | {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 667 | {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
639 | {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | 668 | {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, |
@@ -649,13 +678,13 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
649 | {0x00009814, 0x9280c00a}, | 678 | {0x00009814, 0x9280c00a}, |
650 | {0x00009818, 0x00000000}, | 679 | {0x00009818, 0x00000000}, |
651 | {0x0000981c, 0x00020028}, | 680 | {0x0000981c, 0x00020028}, |
652 | {0x00009834, 0x5f3ca3de}, | 681 | {0x00009834, 0x6400a290}, |
653 | {0x00009838, 0x0108ecff}, | 682 | {0x00009838, 0x0108ecff}, |
654 | {0x0000983c, 0x14750600}, | 683 | {0x0000983c, 0x14750600}, |
655 | {0x00009880, 0x201fff00}, | 684 | {0x00009880, 0x201fff00}, |
656 | {0x00009884, 0x00001042}, | 685 | {0x00009884, 0x00001042}, |
657 | {0x000098a4, 0x00200400}, | 686 | {0x000098a4, 0x00200400}, |
658 | {0x000098b0, 0x52440bbe}, | 687 | {0x000098b0, 0x32840bbe}, |
659 | {0x000098d0, 0x004b6a8e}, | 688 | {0x000098d0, 0x004b6a8e}, |
660 | {0x000098d4, 0x00000820}, | 689 | {0x000098d4, 0x00000820}, |
661 | {0x000098dc, 0x00000000}, | 690 | {0x000098dc, 0x00000000}, |
@@ -681,7 +710,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
681 | {0x00009e30, 0x06336f77}, | 710 | {0x00009e30, 0x06336f77}, |
682 | {0x00009e34, 0x6af6532f}, | 711 | {0x00009e34, 0x6af6532f}, |
683 | {0x00009e38, 0x0cc80c00}, | 712 | {0x00009e38, 0x0cc80c00}, |
684 | {0x00009e3c, 0xcf946222}, | ||
685 | {0x00009e40, 0x0d261820}, | 713 | {0x00009e40, 0x0d261820}, |
686 | {0x00009e4c, 0x00001004}, | 714 | {0x00009e4c, 0x00001004}, |
687 | {0x00009e50, 0x00ff03f1}, | 715 | {0x00009e50, 0x00ff03f1}, |
@@ -694,7 +722,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
694 | {0x0000a220, 0x00000000}, | 722 | {0x0000a220, 0x00000000}, |
695 | {0x0000a224, 0x00000000}, | 723 | {0x0000a224, 0x00000000}, |
696 | {0x0000a228, 0x10002310}, | 724 | {0x0000a228, 0x10002310}, |
697 | {0x0000a22c, 0x01036a1e}, | 725 | {0x0000a22c, 0x01036a27}, |
698 | {0x0000a23c, 0x00000000}, | 726 | {0x0000a23c, 0x00000000}, |
699 | {0x0000a244, 0x0c000000}, | 727 | {0x0000a244, 0x0c000000}, |
700 | {0x0000a2a0, 0x00000001}, | 728 | {0x0000a2a0, 0x00000001}, |
@@ -702,10 +730,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
702 | {0x0000a2c8, 0x00000000}, | 730 | {0x0000a2c8, 0x00000000}, |
703 | {0x0000a2cc, 0x18c43433}, | 731 | {0x0000a2cc, 0x18c43433}, |
704 | {0x0000a2d4, 0x00000000}, | 732 | {0x0000a2d4, 0x00000000}, |
705 | {0x0000a2dc, 0x00000000}, | ||
706 | {0x0000a2e0, 0x00000000}, | ||
707 | {0x0000a2e4, 0x00000000}, | ||
708 | {0x0000a2e8, 0x00000000}, | ||
709 | {0x0000a2ec, 0x00000000}, | 733 | {0x0000a2ec, 0x00000000}, |
710 | {0x0000a2f0, 0x00000000}, | 734 | {0x0000a2f0, 0x00000000}, |
711 | {0x0000a2f4, 0x00000000}, | 735 | {0x0000a2f4, 0x00000000}, |
@@ -753,33 +777,17 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
753 | {0x0000a430, 0x1ce739ce}, | 777 | {0x0000a430, 0x1ce739ce}, |
754 | {0x0000a434, 0x00000000}, | 778 | {0x0000a434, 0x00000000}, |
755 | {0x0000a438, 0x00001801}, | 779 | {0x0000a438, 0x00001801}, |
756 | {0x0000a43c, 0x00000000}, | 780 | {0x0000a43c, 0x00100000}, |
757 | {0x0000a440, 0x00000000}, | 781 | {0x0000a440, 0x00000000}, |
758 | {0x0000a444, 0x00000000}, | 782 | {0x0000a444, 0x00000000}, |
759 | {0x0000a448, 0x06000080}, | 783 | {0x0000a448, 0x06000080}, |
760 | {0x0000a44c, 0x00000001}, | 784 | {0x0000a44c, 0x00000001}, |
761 | {0x0000a450, 0x00010000}, | 785 | {0x0000a450, 0x00010000}, |
762 | {0x0000a458, 0x00000000}, | 786 | {0x0000a458, 0x00000000}, |
763 | {0x0000a600, 0x00000000}, | ||
764 | {0x0000a604, 0x00000000}, | ||
765 | {0x0000a608, 0x00000000}, | ||
766 | {0x0000a60c, 0x00000000}, | ||
767 | {0x0000a610, 0x00000000}, | ||
768 | {0x0000a614, 0x00000000}, | ||
769 | {0x0000a618, 0x00000000}, | ||
770 | {0x0000a61c, 0x00000000}, | ||
771 | {0x0000a620, 0x00000000}, | ||
772 | {0x0000a624, 0x00000000}, | ||
773 | {0x0000a628, 0x00000000}, | ||
774 | {0x0000a62c, 0x00000000}, | ||
775 | {0x0000a630, 0x00000000}, | ||
776 | {0x0000a634, 0x00000000}, | ||
777 | {0x0000a638, 0x00000000}, | ||
778 | {0x0000a63c, 0x00000000}, | ||
779 | {0x0000a640, 0x00000000}, | 787 | {0x0000a640, 0x00000000}, |
780 | {0x0000a644, 0x3fad9d74}, | 788 | {0x0000a644, 0x3fad9d74}, |
781 | {0x0000a648, 0x0048060a}, | 789 | {0x0000a648, 0x0048060a}, |
782 | {0x0000a64c, 0x00000637}, | 790 | {0x0000a64c, 0x00003c37}, |
783 | {0x0000a670, 0x03020100}, | 791 | {0x0000a670, 0x03020100}, |
784 | {0x0000a674, 0x09080504}, | 792 | {0x0000a674, 0x09080504}, |
785 | {0x0000a678, 0x0d0c0b0a}, | 793 | {0x0000a678, 0x0d0c0b0a}, |
@@ -802,10 +810,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
802 | {0x0000a8f4, 0x00000000}, | 810 | {0x0000a8f4, 0x00000000}, |
803 | {0x0000b2d0, 0x00000080}, | 811 | {0x0000b2d0, 0x00000080}, |
804 | {0x0000b2d4, 0x00000000}, | 812 | {0x0000b2d4, 0x00000000}, |
805 | {0x0000b2dc, 0x00000000}, | ||
806 | {0x0000b2e0, 0x00000000}, | ||
807 | {0x0000b2e4, 0x00000000}, | ||
808 | {0x0000b2e8, 0x00000000}, | ||
809 | {0x0000b2ec, 0x00000000}, | 813 | {0x0000b2ec, 0x00000000}, |
810 | {0x0000b2f0, 0x00000000}, | 814 | {0x0000b2f0, 0x00000000}, |
811 | {0x0000b2f4, 0x00000000}, | 815 | {0x0000b2f4, 0x00000000}, |
@@ -820,10 +824,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
820 | {0x0000b8f4, 0x00000000}, | 824 | {0x0000b8f4, 0x00000000}, |
821 | {0x0000c2d0, 0x00000080}, | 825 | {0x0000c2d0, 0x00000080}, |
822 | {0x0000c2d4, 0x00000000}, | 826 | {0x0000c2d4, 0x00000000}, |
823 | {0x0000c2dc, 0x00000000}, | ||
824 | {0x0000c2e0, 0x00000000}, | ||
825 | {0x0000c2e4, 0x00000000}, | ||
826 | {0x0000c2e8, 0x00000000}, | ||
827 | {0x0000c2ec, 0x00000000}, | 827 | {0x0000c2ec, 0x00000000}, |
828 | {0x0000c2f0, 0x00000000}, | 828 | {0x0000c2f0, 0x00000000}, |
829 | {0x0000c2f4, 0x00000000}, | 829 | {0x0000c2f4, 0x00000000}, |
@@ -835,6 +835,10 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
835 | 835 | ||
836 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | 836 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
837 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 837 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
838 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
839 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
840 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
841 | {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
838 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | 842 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
839 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 843 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
840 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | 844 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
@@ -855,7 +859,7 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | |||
855 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | 859 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
856 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | 860 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
857 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | 861 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
858 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | 862 | {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
859 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | 863 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
860 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | 864 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
861 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | 865 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
@@ -900,6 +904,30 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | |||
900 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 904 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
901 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 905 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
902 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 906 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
907 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
908 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
909 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
910 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
911 | {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
912 | {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
913 | {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
914 | {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
915 | {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
916 | {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
917 | {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
918 | {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
919 | {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
920 | {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
921 | {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
922 | {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
923 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
924 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
925 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
926 | {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
927 | {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
928 | {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
929 | {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
930 | {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
903 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, | 931 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
904 | {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, | 932 | {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, |
905 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, | 933 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
@@ -913,6 +941,10 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | |||
913 | 941 | ||
914 | static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { | 942 | static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { |
915 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 943 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
944 | {0x0000a2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, | ||
945 | {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, | ||
946 | {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, | ||
947 | {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
916 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | 948 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
917 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | 949 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
918 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | 950 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
@@ -933,7 +965,7 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { | |||
933 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | 965 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
934 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | 966 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
935 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | 967 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
936 | {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, | 968 | {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
937 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | 969 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
938 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | 970 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
939 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | 971 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
@@ -978,6 +1010,30 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { | |||
978 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 1010 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
979 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 1011 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
980 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | 1012 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
1013 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1014 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1015 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1016 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1017 | {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
1018 | {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
1019 | {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
1020 | {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
1021 | {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
1022 | {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
1023 | {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
1024 | {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1025 | {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1026 | {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1027 | {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1028 | {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
1029 | {0x0000b2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, | ||
1030 | {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, | ||
1031 | {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, | ||
1032 | {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1033 | {0x0000c2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, | ||
1034 | {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, | ||
1035 | {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, | ||
1036 | {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
981 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, | 1037 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
982 | {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, | 1038 | {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, |
983 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 1039 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
@@ -1151,14 +1207,14 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { | |||
1151 | {0x0000b074, 0x00000000}, | 1207 | {0x0000b074, 0x00000000}, |
1152 | {0x0000b078, 0x00000000}, | 1208 | {0x0000b078, 0x00000000}, |
1153 | {0x0000b07c, 0x00000000}, | 1209 | {0x0000b07c, 0x00000000}, |
1154 | {0x0000b080, 0x32323232}, | 1210 | {0x0000b080, 0x2a2d2f32}, |
1155 | {0x0000b084, 0x2f2f3232}, | 1211 | {0x0000b084, 0x21232328}, |
1156 | {0x0000b088, 0x23282a2d}, | 1212 | {0x0000b088, 0x19191c1e}, |
1157 | {0x0000b08c, 0x1c1e2123}, | 1213 | {0x0000b08c, 0x12141417}, |
1158 | {0x0000b090, 0x14171919}, | 1214 | {0x0000b090, 0x07070e0e}, |
1159 | {0x0000b094, 0x0e0e1214}, | 1215 | {0x0000b094, 0x03030305}, |
1160 | {0x0000b098, 0x03050707}, | 1216 | {0x0000b098, 0x00000003}, |
1161 | {0x0000b09c, 0x00030303}, | 1217 | {0x0000b09c, 0x00000000}, |
1162 | {0x0000b0a0, 0x00000000}, | 1218 | {0x0000b0a0, 0x00000000}, |
1163 | {0x0000b0a4, 0x00000000}, | 1219 | {0x0000b0a4, 0x00000000}, |
1164 | {0x0000b0a8, 0x00000000}, | 1220 | {0x0000b0a8, 0x00000000}, |
@@ -1251,6 +1307,10 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { | |||
1251 | 1307 | ||
1252 | static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { | 1308 | static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { |
1253 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 1309 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
1310 | {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
1311 | {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
1312 | {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
1313 | {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1254 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 1314 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
1255 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 1315 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
1256 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 1316 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
@@ -1316,6 +1376,30 @@ static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { | |||
1316 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 1376 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
1317 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 1377 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
1318 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, | 1378 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
1379 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1380 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1381 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1382 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1383 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1384 | {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, | ||
1385 | {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, | ||
1386 | {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, | ||
1387 | {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, | ||
1388 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | ||
1389 | {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, | ||
1390 | {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, | ||
1391 | {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1392 | {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1393 | {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1394 | {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, | ||
1395 | {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
1396 | {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
1397 | {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
1398 | {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1399 | {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, | ||
1400 | {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, | ||
1401 | {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, | ||
1402 | {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
1319 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 1403 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
1320 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, | 1404 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
1321 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 1405 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
@@ -1414,15 +1498,10 @@ static const u32 ar9300_2p2_mac_core[][2] = { | |||
1414 | {0x00008144, 0xffffffff}, | 1498 | {0x00008144, 0xffffffff}, |
1415 | {0x00008168, 0x00000000}, | 1499 | {0x00008168, 0x00000000}, |
1416 | {0x0000816c, 0x00000000}, | 1500 | {0x0000816c, 0x00000000}, |
1417 | {0x00008170, 0x18486200}, | ||
1418 | {0x00008174, 0x33332210}, | ||
1419 | {0x00008178, 0x00000000}, | ||
1420 | {0x0000817c, 0x00020000}, | ||
1421 | {0x000081c0, 0x00000000}, | 1501 | {0x000081c0, 0x00000000}, |
1422 | {0x000081c4, 0x33332210}, | 1502 | {0x000081c4, 0x33332210}, |
1423 | {0x000081c8, 0x00000000}, | 1503 | {0x000081c8, 0x00000000}, |
1424 | {0x000081cc, 0x00000000}, | 1504 | {0x000081cc, 0x00000000}, |
1425 | {0x000081d4, 0x00000000}, | ||
1426 | {0x000081ec, 0x00000000}, | 1505 | {0x000081ec, 0x00000000}, |
1427 | {0x000081f0, 0x00000000}, | 1506 | {0x000081f0, 0x00000000}, |
1428 | {0x000081f4, 0x00000000}, | 1507 | {0x000081f4, 0x00000000}, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 057fb69ddf7f..5f03c534af6e 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -22,12 +22,14 @@ | |||
22 | #define COMP_CKSUM_LEN 2 | 22 | #define COMP_CKSUM_LEN 2 |
23 | 23 | ||
24 | #define AR_CH0_TOP (0x00016288) | 24 | #define AR_CH0_TOP (0x00016288) |
25 | #define AR_CH0_TOP_XPABIASLVL (0x3) | 25 | #define AR_CH0_TOP_XPABIASLVL (0x300) |
26 | #define AR_CH0_TOP_XPABIASLVL_S (8) | 26 | #define AR_CH0_TOP_XPABIASLVL_S (8) |
27 | 27 | ||
28 | #define AR_CH0_THERM (0x00016290) | 28 | #define AR_CH0_THERM (0x00016290) |
29 | #define AR_CH0_THERM_SPARE (0x3f) | 29 | #define AR_CH0_THERM_XPABIASLVL_MSB 0x3 |
30 | #define AR_CH0_THERM_SPARE_S (0) | 30 | #define AR_CH0_THERM_XPABIASLVL_MSB_S 0 |
31 | #define AR_CH0_THERM_XPASHORT2GND 0x4 | ||
32 | #define AR_CH0_THERM_XPASHORT2GND_S 2 | ||
31 | 33 | ||
32 | #define AR_SWITCH_TABLE_COM_ALL (0xffff) | 34 | #define AR_SWITCH_TABLE_COM_ALL (0xffff) |
33 | #define AR_SWITCH_TABLE_COM_ALL_S (0) | 35 | #define AR_SWITCH_TABLE_COM_ALL_S (0) |
@@ -55,6 +57,8 @@ | |||
55 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ | 57 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ |
56 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ | 58 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ |
57 | 59 | ||
60 | #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6)) | ||
61 | |||
58 | static const struct ar9300_eeprom ar9300_default = { | 62 | static const struct ar9300_eeprom ar9300_default = { |
59 | .eepromVersion = 2, | 63 | .eepromVersion = 2, |
60 | .templateVersion = 2, | 64 | .templateVersion = 2, |
@@ -290,20 +294,21 @@ static const struct ar9300_eeprom ar9300_default = { | |||
290 | } | 294 | } |
291 | }, | 295 | }, |
292 | .ctlPowerData_2G = { | 296 | .ctlPowerData_2G = { |
293 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 297 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
294 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 298 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
295 | { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, | 299 | { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, |
296 | 300 | ||
297 | { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, | 301 | { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, |
298 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 302 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
299 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 303 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
300 | 304 | ||
301 | { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, | 305 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, |
302 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 306 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
303 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 307 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
304 | 308 | ||
305 | { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, | 309 | { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, |
306 | { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, | 310 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, |
311 | { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, | ||
307 | }, | 312 | }, |
308 | .modalHeader5G = { | 313 | .modalHeader5G = { |
309 | /* 4 idle,t1,t2,b (4 bits per setting) */ | 314 | /* 4 idle,t1,t2,b (4 bits per setting) */ |
@@ -568,56 +573,56 @@ static const struct ar9300_eeprom ar9300_default = { | |||
568 | .ctlPowerData_5G = { | 573 | .ctlPowerData_5G = { |
569 | { | 574 | { |
570 | { | 575 | { |
571 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 576 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
572 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 577 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
573 | } | 578 | } |
574 | }, | 579 | }, |
575 | { | 580 | { |
576 | { | 581 | { |
577 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 582 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
578 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 583 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
579 | } | 584 | } |
580 | }, | 585 | }, |
581 | { | 586 | { |
582 | { | 587 | { |
583 | {60, 0}, {60, 1}, {60, 0}, {60, 1}, | 588 | CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
584 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 589 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
585 | } | 590 | } |
586 | }, | 591 | }, |
587 | { | 592 | { |
588 | { | 593 | { |
589 | {60, 0}, {60, 1}, {60, 1}, {60, 0}, | 594 | CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
590 | {60, 1}, {60, 0}, {60, 0}, {60, 0}, | 595 | CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
591 | } | 596 | } |
592 | }, | 597 | }, |
593 | { | 598 | { |
594 | { | 599 | { |
595 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 600 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
596 | {60, 0}, {60, 0}, {60, 0}, {60, 0}, | 601 | CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
597 | } | 602 | } |
598 | }, | 603 | }, |
599 | { | 604 | { |
600 | { | 605 | { |
601 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 606 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
602 | {60, 1}, {60, 0}, {60, 0}, {60, 0}, | 607 | CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), |
603 | } | 608 | } |
604 | }, | 609 | }, |
605 | { | 610 | { |
606 | { | 611 | { |
607 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 612 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
608 | {60, 1}, {60, 1}, {60, 1}, {60, 1}, | 613 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), |
609 | } | 614 | } |
610 | }, | 615 | }, |
611 | { | 616 | { |
612 | { | 617 | { |
613 | {60, 1}, {60, 1}, {60, 0}, {60, 1}, | 618 | CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
614 | {60, 1}, {60, 1}, {60, 1}, {60, 0}, | 619 | CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), |
615 | } | 620 | } |
616 | }, | 621 | }, |
617 | { | 622 | { |
618 | { | 623 | { |
619 | {60, 1}, {60, 0}, {60, 1}, {60, 1}, | 624 | CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), |
620 | {60, 1}, {60, 1}, {60, 0}, {60, 1}, | 625 | CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), |
621 | } | 626 | } |
622 | }, | 627 | }, |
623 | } | 628 | } |
@@ -992,9 +997,9 @@ static s32 ar9003_hw_xpa_bias_level_get(struct ath_hw *ah, bool is2ghz) | |||
992 | static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) | 997 | static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) |
993 | { | 998 | { |
994 | int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz); | 999 | int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz); |
995 | REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, (bias & 0x3)); | 1000 | REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); |
996 | REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_SPARE, | 1001 | REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, bias >> 2); |
997 | ((bias >> 2) & 0x3)); | 1002 | REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1); |
998 | } | 1003 | } |
999 | 1004 | ||
1000 | static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) | 1005 | static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) |
@@ -1827,9 +1832,9 @@ static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep, | |||
1827 | struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; | 1832 | struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; |
1828 | 1833 | ||
1829 | if (is2GHz) | 1834 | if (is2GHz) |
1830 | return ctl_2g[idx].ctlEdges[edge].tPower; | 1835 | return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]); |
1831 | else | 1836 | else |
1832 | return ctl_5g[idx].ctlEdges[edge].tPower; | 1837 | return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]); |
1833 | } | 1838 | } |
1834 | 1839 | ||
1835 | static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, | 1840 | static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, |
@@ -1847,12 +1852,12 @@ static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, | |||
1847 | 1852 | ||
1848 | if (is2GHz) { | 1853 | if (is2GHz) { |
1849 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && | 1854 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && |
1850 | ctl_2g[idx].ctlEdges[edge - 1].flag) | 1855 | CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1])) |
1851 | return ctl_2g[idx].ctlEdges[edge - 1].tPower; | 1856 | return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]); |
1852 | } else { | 1857 | } else { |
1853 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && | 1858 | if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && |
1854 | ctl_5g[idx].ctlEdges[edge - 1].flag) | 1859 | CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1])) |
1855 | return ctl_5g[idx].ctlEdges[edge - 1].tPower; | 1860 | return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]); |
1856 | } | 1861 | } |
1857 | 1862 | ||
1858 | return AR9300_MAX_RATE_POWER; | 1863 | return AR9300_MAX_RATE_POWER; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h index 3c533bb983c7..655b3033396c 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | |||
@@ -261,17 +261,12 @@ struct cal_tgt_pow_ht { | |||
261 | u8 tPow2x[14]; | 261 | u8 tPow2x[14]; |
262 | } __packed; | 262 | } __packed; |
263 | 263 | ||
264 | struct cal_ctl_edge_pwr { | ||
265 | u8 tPower:6, | ||
266 | flag:2; | ||
267 | } __packed; | ||
268 | |||
269 | struct cal_ctl_data_2g { | 264 | struct cal_ctl_data_2g { |
270 | struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; | 265 | u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G]; |
271 | } __packed; | 266 | } __packed; |
272 | 267 | ||
273 | struct cal_ctl_data_5g { | 268 | struct cal_ctl_data_5g { |
274 | struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; | 269 | u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G]; |
275 | } __packed; | 270 | } __packed; |
276 | 271 | ||
277 | struct ar9300_eeprom { | 272 | struct ar9300_eeprom { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c index 5b995bee70ae..1a0ab706a18f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c | |||
@@ -616,7 +616,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, | |||
616 | rxs->rs_status |= ATH9K_RXERR_DECRYPT; | 616 | rxs->rs_status |= ATH9K_RXERR_DECRYPT; |
617 | } else if (rxsp->status11 & AR_MichaelErr) { | 617 | } else if (rxsp->status11 & AR_MichaelErr) { |
618 | rxs->rs_status |= ATH9K_RXERR_MIC; | 618 | rxs->rs_status |= ATH9K_RXERR_MIC; |
619 | } | 619 | } else if (rxsp->status11 & AR_KeyMiss) |
620 | rxs->rs_status |= ATH9K_RXERR_DECRYPT; | ||
620 | } | 621 | } |
621 | 622 | ||
622 | return 0; | 623 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 7c38229ba670..716db414c258 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
@@ -347,6 +347,10 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) | |||
347 | (((Y[6] - Y[3]) * 1 << scale_factor) + | 347 | (((Y[6] - Y[3]) * 1 << scale_factor) + |
348 | (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); | 348 | (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); |
349 | 349 | ||
350 | /* prevent division by zero */ | ||
351 | if (G_fxp == 0) | ||
352 | return false; | ||
353 | |||
350 | Y_intercept = | 354 | Y_intercept = |
351 | (G_fxp * (x_est[0] - x_est[3]) + | 355 | (G_fxp * (x_est[0] - x_est[3]) + |
352 | (1 << scale_factor)) / (1 << scale_factor) + Y[3]; | 356 | (1 << scale_factor)) / (1 << scale_factor) + Y[3]; |
@@ -356,14 +360,12 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) | |||
356 | 360 | ||
357 | for (i = 0; i <= 3; i++) { | 361 | for (i = 0; i <= 3; i++) { |
358 | y_est[i] = i * 32; | 362 | y_est[i] = i * 32; |
359 | |||
360 | /* prevent division by zero */ | ||
361 | if (G_fxp == 0) | ||
362 | return false; | ||
363 | |||
364 | x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; | 363 | x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; |
365 | } | 364 | } |
366 | 365 | ||
366 | if (y_est[max_index] == 0) | ||
367 | return false; | ||
368 | |||
367 | x_est_fxp1_nonlin = | 369 | x_est_fxp1_nonlin = |
368 | x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + | 370 | x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + |
369 | G_fxp) / G_fxp; | 371 | G_fxp) / G_fxp; |
@@ -457,6 +459,8 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) | |||
457 | 459 | ||
458 | Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); | 460 | Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); |
459 | scale_B = scale_B / (1 << Q_scale_B); | 461 | scale_B = scale_B / (1 << Q_scale_B); |
462 | if (scale_B == 0) | ||
463 | return false; | ||
460 | Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); | 464 | Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); |
461 | Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); | 465 | Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); |
462 | beta_raw = beta_raw / (1 << Q_beta); | 466 | beta_raw = beta_raw / (1 << Q_beta); |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 07f26ee7a723..852745c2b752 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -177,8 +177,8 @@ void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, | |||
177 | 177 | ||
178 | /* returns delimiter padding required given the packet length */ | 178 | /* returns delimiter padding required given the packet length */ |
179 | #define ATH_AGGR_GET_NDELIM(_len) \ | 179 | #define ATH_AGGR_GET_NDELIM(_len) \ |
180 | (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ? \ | 180 | (((_len) >= ATH_AGGR_MINPLEN) ? 0 : \ |
181 | (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2) | 181 | DIV_ROUND_UP(ATH_AGGR_MINPLEN - (_len), ATH_AGGR_DELIM_SZ)) |
182 | 182 | ||
183 | #define BAW_WITHIN(_start, _bawsz, _seqno) \ | 183 | #define BAW_WITHIN(_start, _bawsz, _seqno) \ |
184 | ((((_seqno) - (_start)) & 4095) < (_bawsz)) | 184 | ((((_seqno) - (_start)) & 4095) < (_bawsz)) |
@@ -312,7 +312,6 @@ struct ath_rx { | |||
312 | u8 rxotherant; | 312 | u8 rxotherant; |
313 | u32 *rxlink; | 313 | u32 *rxlink; |
314 | unsigned int rxfilter; | 314 | unsigned int rxfilter; |
315 | spinlock_t rxflushlock; | ||
316 | spinlock_t rxbuflock; | 315 | spinlock_t rxbuflock; |
317 | struct list_head rxbuf; | 316 | struct list_head rxbuf; |
318 | struct ath_descdma rxdma; | 317 | struct ath_descdma rxdma; |
@@ -346,8 +345,8 @@ void ath_tx_tasklet(struct ath_softc *sc); | |||
346 | void ath_tx_edma_tasklet(struct ath_softc *sc); | 345 | void ath_tx_edma_tasklet(struct ath_softc *sc); |
347 | void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb); | 346 | void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb); |
348 | bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); | 347 | bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); |
349 | void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | 348 | int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
350 | u16 tid, u16 *ssn); | 349 | u16 tid, u16 *ssn); |
351 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); | 350 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); |
352 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); | 351 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); |
353 | void ath9k_enable_ps(struct ath_softc *sc); | 352 | void ath9k_enable_ps(struct ath_softc *sc); |
@@ -516,7 +515,6 @@ void ath_deinit_leds(struct ath_softc *sc); | |||
516 | #define SC_OP_RXFLUSH BIT(7) | 515 | #define SC_OP_RXFLUSH BIT(7) |
517 | #define SC_OP_LED_ASSOCIATED BIT(8) | 516 | #define SC_OP_LED_ASSOCIATED BIT(8) |
518 | #define SC_OP_LED_ON BIT(9) | 517 | #define SC_OP_LED_ON BIT(9) |
519 | #define SC_OP_SCANNING BIT(10) | ||
520 | #define SC_OP_TSF_RESET BIT(11) | 518 | #define SC_OP_TSF_RESET BIT(11) |
521 | #define SC_OP_BT_PRIORITY_DETECTED BIT(12) | 519 | #define SC_OP_BT_PRIORITY_DETECTED BIT(12) |
522 | #define SC_OP_BT_SCAN BIT(13) | 520 | #define SC_OP_BT_SCAN BIT(13) |
@@ -558,9 +556,9 @@ struct ath_softc { | |||
558 | struct ath_hw *sc_ah; | 556 | struct ath_hw *sc_ah; |
559 | void __iomem *mem; | 557 | void __iomem *mem; |
560 | int irq; | 558 | int irq; |
561 | spinlock_t sc_resetlock; | ||
562 | spinlock_t sc_serial_rw; | 559 | spinlock_t sc_serial_rw; |
563 | spinlock_t sc_pm_lock; | 560 | spinlock_t sc_pm_lock; |
561 | spinlock_t sc_pcu_lock; | ||
564 | struct mutex mutex; | 562 | struct mutex mutex; |
565 | struct work_struct paprd_work; | 563 | struct work_struct paprd_work; |
566 | struct work_struct hw_check_work; | 564 | struct work_struct hw_check_work; |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c index 4d4b22d52dfd..20cf2d4e58b9 100644 --- a/drivers/net/wireless/ath/ath9k/beacon.c +++ b/drivers/net/wireless/ath/ath9k/beacon.c | |||
@@ -366,7 +366,7 @@ void ath_beacon_tasklet(unsigned long data) | |||
366 | ath_print(common, ATH_DBG_BEACON, | 366 | ath_print(common, ATH_DBG_BEACON, |
367 | "beacon is officially stuck\n"); | 367 | "beacon is officially stuck\n"); |
368 | sc->sc_flags |= SC_OP_TSF_RESET; | 368 | sc->sc_flags |= SC_OP_TSF_RESET; |
369 | ath_reset(sc, false); | 369 | ath_reset(sc, true); |
370 | } | 370 | } |
371 | 371 | ||
372 | return; | 372 | return; |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index c86f7d3593ab..108b43369f7c 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -366,9 +366,13 @@ int ath9k_cmn_key_config(struct ath_common *common, | |||
366 | set_bit(idx, common->keymap); | 366 | set_bit(idx, common->keymap); |
367 | if (key->alg == ALG_TKIP) { | 367 | if (key->alg == ALG_TKIP) { |
368 | set_bit(idx + 64, common->keymap); | 368 | set_bit(idx + 64, common->keymap); |
369 | set_bit(idx, common->tkip_keymap); | ||
370 | set_bit(idx + 64, common->tkip_keymap); | ||
369 | if (common->splitmic) { | 371 | if (common->splitmic) { |
370 | set_bit(idx + 32, common->keymap); | 372 | set_bit(idx + 32, common->keymap); |
371 | set_bit(idx + 64 + 32, common->keymap); | 373 | set_bit(idx + 64 + 32, common->keymap); |
374 | set_bit(idx + 32, common->tkip_keymap); | ||
375 | set_bit(idx + 64 + 32, common->tkip_keymap); | ||
372 | } | 376 | } |
373 | } | 377 | } |
374 | 378 | ||
@@ -393,10 +397,17 @@ void ath9k_cmn_key_delete(struct ath_common *common, | |||
393 | return; | 397 | return; |
394 | 398 | ||
395 | clear_bit(key->hw_key_idx + 64, common->keymap); | 399 | clear_bit(key->hw_key_idx + 64, common->keymap); |
400 | |||
401 | clear_bit(key->hw_key_idx, common->tkip_keymap); | ||
402 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); | ||
403 | |||
396 | if (common->splitmic) { | 404 | if (common->splitmic) { |
397 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); | 405 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); |
398 | clear_bit(key->hw_key_idx + 32, common->keymap); | 406 | clear_bit(key->hw_key_idx + 32, common->keymap); |
399 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); | 407 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |
408 | |||
409 | clear_bit(key->hw_key_idx + 32, common->tkip_keymap); | ||
410 | clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap); | ||
400 | } | 411 | } |
401 | } | 412 | } |
402 | EXPORT_SYMBOL(ath9k_cmn_key_delete); | 413 | EXPORT_SYMBOL(ath9k_cmn_key_delete); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c index 1266333f586d..2bbf94d0191e 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c | |||
@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, | |||
240 | for (i = 0; (i < num_band_edges) && | 240 | for (i = 0; (i < num_band_edges) && |
241 | (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { | 241 | (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { |
242 | if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { | 242 | if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { |
243 | twiceMaxEdgePower = pRdEdgesPower[i].tPower; | 243 | twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl); |
244 | break; | 244 | break; |
245 | } else if ((i > 0) && | 245 | } else if ((i > 0) && |
246 | (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, | 246 | (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, |
247 | is2GHz))) { | 247 | is2GHz))) { |
248 | if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, | 248 | if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, |
249 | is2GHz) < freq && | 249 | is2GHz) < freq && |
250 | pRdEdgesPower[i - 1].flag) { | 250 | CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) { |
251 | twiceMaxEdgePower = | 251 | twiceMaxEdgePower = |
252 | pRdEdgesPower[i - 1].tPower; | 252 | CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl); |
253 | } | 253 | } |
254 | break; | 254 | break; |
255 | } | 255 | } |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index 0b09db0f8e7d..17068f9c026e 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -233,6 +233,9 @@ | |||
233 | 233 | ||
234 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) | 234 | #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) |
235 | 235 | ||
236 | #define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) | ||
237 | #define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) | ||
238 | |||
236 | enum eeprom_param { | 239 | enum eeprom_param { |
237 | EEP_NFTHRESH_5, | 240 | EEP_NFTHRESH_5, |
238 | EEP_NFTHRESH_2, | 241 | EEP_NFTHRESH_2, |
@@ -533,18 +536,10 @@ struct cal_target_power_ht { | |||
533 | u8 tPow2x[8]; | 536 | u8 tPow2x[8]; |
534 | } __packed; | 537 | } __packed; |
535 | 538 | ||
536 | |||
537 | #ifdef __BIG_ENDIAN_BITFIELD | ||
538 | struct cal_ctl_edges { | ||
539 | u8 bChannel; | ||
540 | u8 flag:2, tPower:6; | ||
541 | } __packed; | ||
542 | #else | ||
543 | struct cal_ctl_edges { | 539 | struct cal_ctl_edges { |
544 | u8 bChannel; | 540 | u8 bChannel; |
545 | u8 tPower:6, flag:2; | 541 | u8 ctl; |
546 | } __packed; | 542 | } __packed; |
547 | #endif | ||
548 | 543 | ||
549 | struct cal_data_op_loop_ar9287 { | 544 | struct cal_data_op_loop_ar9287 { |
550 | u8 pwrPdg[2][5]; | 545 | u8 pwrPdg[2][5]; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index dff2da777312..7cb356e8a531 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -37,7 +37,7 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) | |||
37 | int addr, eep_start_loc; | 37 | int addr, eep_start_loc; |
38 | eep_data = (u16 *)eep; | 38 | eep_data = (u16 *)eep; |
39 | 39 | ||
40 | if (ah->hw_version.devid == 0x7015) | 40 | if (AR9287_HTC_DEVID(ah)) |
41 | eep_start_loc = AR9287_HTC_EEP_START_LOC; | 41 | eep_start_loc = AR9287_HTC_EEP_START_LOC; |
42 | else | 42 | else |
43 | eep_start_loc = AR9287_EEP_START_LOC; | 43 | eep_start_loc = AR9287_EEP_START_LOC; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index afa2b73ddbdd..a48eb570a47c 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -1062,15 +1062,19 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, | |||
1062 | case 1: | 1062 | case 1: |
1063 | break; | 1063 | break; |
1064 | case 2: | 1064 | case 2: |
1065 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 1065 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
1066 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
1067 | else | ||
1068 | scaledPower = 0; | ||
1066 | break; | 1069 | break; |
1067 | case 3: | 1070 | case 3: |
1068 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 1071 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
1072 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
1073 | else | ||
1074 | scaledPower = 0; | ||
1069 | break; | 1075 | break; |
1070 | } | 1076 | } |
1071 | 1077 | ||
1072 | scaledPower = max((u16)0, scaledPower); | ||
1073 | |||
1074 | if (IS_CHAN_2GHZ(chan)) { | 1078 | if (IS_CHAN_2GHZ(chan)) { |
1075 | numCtlModes = ARRAY_SIZE(ctlModesFor11g) - | 1079 | numCtlModes = ARRAY_SIZE(ctlModesFor11g) - |
1076 | SUB_NUM_CTL_MODES_AT_2G_40; | 1080 | SUB_NUM_CTL_MODES_AT_2G_40; |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 17e7a9a367e7..0e9bbb13ba66 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -35,8 +35,14 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { | |||
35 | { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ | 35 | { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ |
36 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ | 36 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ |
37 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ | 37 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ |
38 | { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */ | ||
39 | { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */ | ||
40 | { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ | ||
41 | { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ | ||
38 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ | 42 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
39 | { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ | 43 | { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ |
44 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ | ||
45 | { USB_DEVICE(0x1668, 0x1200) }, /* Verizon */ | ||
40 | { }, | 46 | { }, |
41 | }; | 47 | }; |
42 | 48 | ||
@@ -138,16 +144,36 @@ static void hif_usb_tx_cb(struct urb *urb) | |||
138 | case -ENODEV: | 144 | case -ENODEV: |
139 | case -ESHUTDOWN: | 145 | case -ESHUTDOWN: |
140 | /* | 146 | /* |
141 | * The URB has been killed, free the SKBs | 147 | * The URB has been killed, free the SKBs. |
142 | * and return. | ||
143 | */ | 148 | */ |
144 | ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue); | 149 | ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue); |
145 | return; | 150 | |
151 | /* | ||
152 | * If the URBs are being flushed, no need to add this | ||
153 | * URB to the free list. | ||
154 | */ | ||
155 | spin_lock(&hif_dev->tx.tx_lock); | ||
156 | if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) { | ||
157 | spin_unlock(&hif_dev->tx.tx_lock); | ||
158 | return; | ||
159 | } | ||
160 | spin_unlock(&hif_dev->tx.tx_lock); | ||
161 | |||
162 | /* | ||
163 | * In the stop() case, this URB has to be added to | ||
164 | * the free list. | ||
165 | */ | ||
166 | goto add_free; | ||
146 | default: | 167 | default: |
147 | break; | 168 | break; |
148 | } | 169 | } |
149 | 170 | ||
150 | /* Check if TX has been stopped */ | 171 | /* |
172 | * Check if TX has been stopped, this is needed because | ||
173 | * this CB could have been invoked just after the TX lock | ||
174 | * was released in hif_stop() and kill_urb() hasn't been | ||
175 | * called yet. | ||
176 | */ | ||
151 | spin_lock(&hif_dev->tx.tx_lock); | 177 | spin_lock(&hif_dev->tx.tx_lock); |
152 | if (hif_dev->tx.flags & HIF_USB_TX_STOP) { | 178 | if (hif_dev->tx.flags & HIF_USB_TX_STOP) { |
153 | spin_unlock(&hif_dev->tx.tx_lock); | 179 | spin_unlock(&hif_dev->tx.tx_lock); |
@@ -299,6 +325,7 @@ static void hif_usb_start(void *hif_handle, u8 pipe_id) | |||
299 | static void hif_usb_stop(void *hif_handle, u8 pipe_id) | 325 | static void hif_usb_stop(void *hif_handle, u8 pipe_id) |
300 | { | 326 | { |
301 | struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; | 327 | struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; |
328 | struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; | ||
302 | unsigned long flags; | 329 | unsigned long flags; |
303 | 330 | ||
304 | spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); | 331 | spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); |
@@ -306,6 +333,12 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id) | |||
306 | hif_dev->tx.tx_skb_cnt = 0; | 333 | hif_dev->tx.tx_skb_cnt = 0; |
307 | hif_dev->tx.flags |= HIF_USB_TX_STOP; | 334 | hif_dev->tx.flags |= HIF_USB_TX_STOP; |
308 | spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); | 335 | spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); |
336 | |||
337 | /* The pending URBs have to be canceled. */ | ||
338 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, | ||
339 | &hif_dev->tx.tx_pending, list) { | ||
340 | usb_kill_urb(tx_buf->urb); | ||
341 | } | ||
309 | } | 342 | } |
310 | 343 | ||
311 | static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb, | 344 | static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb, |
@@ -571,6 +604,7 @@ free: | |||
571 | static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) | 604 | static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) |
572 | { | 605 | { |
573 | struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; | 606 | struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; |
607 | unsigned long flags; | ||
574 | 608 | ||
575 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, | 609 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
576 | &hif_dev->tx.tx_buf, list) { | 610 | &hif_dev->tx.tx_buf, list) { |
@@ -581,6 +615,10 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev) | |||
581 | kfree(tx_buf); | 615 | kfree(tx_buf); |
582 | } | 616 | } |
583 | 617 | ||
618 | spin_lock_irqsave(&hif_dev->tx.tx_lock, flags); | ||
619 | hif_dev->tx.flags |= HIF_USB_TX_FLUSH; | ||
620 | spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags); | ||
621 | |||
584 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, | 622 | list_for_each_entry_safe(tx_buf, tx_buf_tmp, |
585 | &hif_dev->tx.tx_pending, list) { | 623 | &hif_dev->tx.tx_pending, list) { |
586 | usb_kill_urb(tx_buf->urb); | 624 | usb_kill_urb(tx_buf->urb); |
@@ -799,10 +837,18 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | |||
799 | } | 837 | } |
800 | kfree(buf); | 838 | kfree(buf); |
801 | 839 | ||
802 | if ((hif_dev->device_id == 0x7010) || (hif_dev->device_id == 0x7015)) | 840 | switch (hif_dev->device_id) { |
841 | case 0x7010: | ||
842 | case 0x7015: | ||
843 | case 0x9018: | ||
844 | case 0xA704: | ||
845 | case 0x1200: | ||
803 | firm_offset = AR7010_FIRMWARE_TEXT; | 846 | firm_offset = AR7010_FIRMWARE_TEXT; |
804 | else | 847 | break; |
848 | default: | ||
805 | firm_offset = AR9271_FIRMWARE_TEXT; | 849 | firm_offset = AR9271_FIRMWARE_TEXT; |
850 | break; | ||
851 | } | ||
806 | 852 | ||
807 | /* | 853 | /* |
808 | * Issue FW download complete command to firmware. | 854 | * Issue FW download complete command to firmware. |
@@ -903,6 +949,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
903 | case 0x7010: | 949 | case 0x7010: |
904 | case 0x7015: | 950 | case 0x7015: |
905 | case 0x9018: | 951 | case 0x9018: |
952 | case 0xA704: | ||
953 | case 0x1200: | ||
906 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) | 954 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) |
907 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; | 955 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; |
908 | else | 956 | else |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.h b/drivers/net/wireless/ath/ath9k/hif_usb.h index 2daf97b11c08..30d09389d437 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.h +++ b/drivers/net/wireless/ath/ath9k/hif_usb.h | |||
@@ -62,6 +62,7 @@ struct tx_buf { | |||
62 | }; | 62 | }; |
63 | 63 | ||
64 | #define HIF_USB_TX_STOP BIT(0) | 64 | #define HIF_USB_TX_STOP BIT(0) |
65 | #define HIF_USB_TX_FLUSH BIT(1) | ||
65 | 66 | ||
66 | struct hif_usb_tx { | 67 | struct hif_usb_tx { |
67 | u8 flags; | 68 | u8 flags; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 2d4279191d7a..e5a0122fc341 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -247,6 +247,8 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid) | |||
247 | case 0x7010: | 247 | case 0x7010: |
248 | case 0x7015: | 248 | case 0x7015: |
249 | case 0x9018: | 249 | case 0x9018: |
250 | case 0xA704: | ||
251 | case 0x1200: | ||
250 | priv->htc->credits = 45; | 252 | priv->htc->credits = 45; |
251 | break; | 253 | break; |
252 | default: | 254 | default: |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 2a6e45a293a9..f06eeab2a572 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -121,7 +121,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb) | |||
121 | tx_hdr.data_type = ATH9K_HTC_NORMAL; | 121 | tx_hdr.data_type = ATH9K_HTC_NORMAL; |
122 | } | 122 | } |
123 | 123 | ||
124 | if (ieee80211_is_data(fc)) { | 124 | if (ieee80211_is_data_qos(fc)) { |
125 | qc = ieee80211_get_qos_ctl(hdr); | 125 | qc = ieee80211_get_qos_ctl(hdr); |
126 | tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; | 126 | tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
127 | } | 127 | } |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 3384ca164562..5250c8dc83e1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -387,6 +387,9 @@ static void ath9k_hw_init_config(struct ath_hw *ah) | |||
387 | else | 387 | else |
388 | ah->config.ht_enable = 0; | 388 | ah->config.ht_enable = 0; |
389 | 389 | ||
390 | /* PAPRD needs some more work to be enabled */ | ||
391 | ah->config.paprd_disable = 1; | ||
392 | |||
390 | ah->config.rx_intr_mitigation = true; | 393 | ah->config.rx_intr_mitigation = true; |
391 | ah->config.pcieSerDesWrite = true; | 394 | ah->config.pcieSerDesWrite = true; |
392 | 395 | ||
@@ -486,6 +489,7 @@ static int ath9k_hw_post_init(struct ath_hw *ah) | |||
486 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, | 489 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
487 | "Failed allocating banks for " | 490 | "Failed allocating banks for " |
488 | "external radio\n"); | 491 | "external radio\n"); |
492 | ath9k_hw_rf_free_ext_banks(ah); | ||
489 | return ecode; | 493 | return ecode; |
490 | } | 494 | } |
491 | 495 | ||
@@ -2263,7 +2267,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2263 | pCap->rx_status_len = sizeof(struct ar9003_rxs); | 2267 | pCap->rx_status_len = sizeof(struct ar9003_rxs); |
2264 | pCap->tx_desc_len = sizeof(struct ar9003_txc); | 2268 | pCap->tx_desc_len = sizeof(struct ar9003_txc); |
2265 | pCap->txs_len = sizeof(struct ar9003_txs); | 2269 | pCap->txs_len = sizeof(struct ar9003_txs); |
2266 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) | 2270 | if (!ah->config.paprd_disable && |
2271 | ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) | ||
2267 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; | 2272 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; |
2268 | } else { | 2273 | } else { |
2269 | pCap->tx_desc_len = sizeof(struct ath_desc); | 2274 | pCap->tx_desc_len = sizeof(struct ath_desc); |
@@ -2350,7 +2355,8 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio) | |||
2350 | val = REG_READ(ah, AR7010_GPIO_IN); | 2355 | val = REG_READ(ah, AR7010_GPIO_IN); |
2351 | return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; | 2356 | return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; |
2352 | } else if (AR_SREV_9300_20_OR_LATER(ah)) | 2357 | } else if (AR_SREV_9300_20_OR_LATER(ah)) |
2353 | return MS_REG_READ(AR9300, gpio) != 0; | 2358 | return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) & |
2359 | AR_GPIO_BIT(gpio)) != 0; | ||
2354 | else if (AR_SREV_9271(ah)) | 2360 | else if (AR_SREV_9271(ah)) |
2355 | return MS_REG_READ(AR9271, gpio) != 0; | 2361 | return MS_REG_READ(AR9271, gpio) != 0; |
2356 | else if (AR_SREV_9287_10_OR_LATER(ah)) | 2362 | else if (AR_SREV_9287_10_OR_LATER(ah)) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 399f7c1283cd..e58ff11cb85c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -240,6 +240,7 @@ struct ath9k_ops_config { | |||
240 | u32 pcie_waen; | 240 | u32 pcie_waen; |
241 | u8 analog_shiftreg; | 241 | u8 analog_shiftreg; |
242 | u8 ht_enable; | 242 | u8 ht_enable; |
243 | u8 paprd_disable; | ||
243 | u32 ofdm_trig_low; | 244 | u32 ofdm_trig_low; |
244 | u32 ofdm_trig_high; | 245 | u32 ofdm_trig_high; |
245 | u32 cck_trig_high; | 246 | u32 cck_trig_high; |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 243c1775f343..2e4724f1c662 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(blink, "Enable LED blink on activity"); | |||
56 | * on 5 MHz steps, we support the channels which we know | 56 | * on 5 MHz steps, we support the channels which we know |
57 | * we have calibration data for all cards though to make | 57 | * we have calibration data for all cards though to make |
58 | * this static */ | 58 | * this static */ |
59 | static struct ieee80211_channel ath9k_2ghz_chantable[] = { | 59 | static const struct ieee80211_channel ath9k_2ghz_chantable[] = { |
60 | CHAN2G(2412, 0), /* Channel 1 */ | 60 | CHAN2G(2412, 0), /* Channel 1 */ |
61 | CHAN2G(2417, 1), /* Channel 2 */ | 61 | CHAN2G(2417, 1), /* Channel 2 */ |
62 | CHAN2G(2422, 2), /* Channel 3 */ | 62 | CHAN2G(2422, 2), /* Channel 3 */ |
@@ -77,7 +77,7 @@ static struct ieee80211_channel ath9k_2ghz_chantable[] = { | |||
77 | * on 5 MHz steps, we support the channels which we know | 77 | * on 5 MHz steps, we support the channels which we know |
78 | * we have calibration data for all cards though to make | 78 | * we have calibration data for all cards though to make |
79 | * this static */ | 79 | * this static */ |
80 | static struct ieee80211_channel ath9k_5ghz_chantable[] = { | 80 | static const struct ieee80211_channel ath9k_5ghz_chantable[] = { |
81 | /* _We_ call this UNII 1 */ | 81 | /* _We_ call this UNII 1 */ |
82 | CHAN5G(5180, 14), /* Channel 36 */ | 82 | CHAN5G(5180, 14), /* Channel 36 */ |
83 | CHAN5G(5200, 15), /* Channel 40 */ | 83 | CHAN5G(5200, 15), /* Channel 40 */ |
@@ -477,10 +477,17 @@ err: | |||
477 | return -EIO; | 477 | return -EIO; |
478 | } | 478 | } |
479 | 479 | ||
480 | static void ath9k_init_channels_rates(struct ath_softc *sc) | 480 | static int ath9k_init_channels_rates(struct ath_softc *sc) |
481 | { | 481 | { |
482 | void *channels; | ||
483 | |||
482 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { | 484 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { |
483 | sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; | 485 | channels = kmemdup(ath9k_2ghz_chantable, |
486 | sizeof(ath9k_2ghz_chantable), GFP_KERNEL); | ||
487 | if (!channels) | ||
488 | return -ENOMEM; | ||
489 | |||
490 | sc->sbands[IEEE80211_BAND_2GHZ].channels = channels; | ||
484 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; | 491 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; |
485 | sc->sbands[IEEE80211_BAND_2GHZ].n_channels = | 492 | sc->sbands[IEEE80211_BAND_2GHZ].n_channels = |
486 | ARRAY_SIZE(ath9k_2ghz_chantable); | 493 | ARRAY_SIZE(ath9k_2ghz_chantable); |
@@ -490,7 +497,15 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) | |||
490 | } | 497 | } |
491 | 498 | ||
492 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { | 499 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { |
493 | sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; | 500 | channels = kmemdup(ath9k_5ghz_chantable, |
501 | sizeof(ath9k_5ghz_chantable), GFP_KERNEL); | ||
502 | if (!channels) { | ||
503 | if (sc->sbands[IEEE80211_BAND_2GHZ].channels) | ||
504 | kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); | ||
505 | return -ENOMEM; | ||
506 | } | ||
507 | |||
508 | sc->sbands[IEEE80211_BAND_5GHZ].channels = channels; | ||
494 | sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; | 509 | sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; |
495 | sc->sbands[IEEE80211_BAND_5GHZ].n_channels = | 510 | sc->sbands[IEEE80211_BAND_5GHZ].n_channels = |
496 | ARRAY_SIZE(ath9k_5ghz_chantable); | 511 | ARRAY_SIZE(ath9k_5ghz_chantable); |
@@ -499,6 +514,7 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) | |||
499 | sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = | 514 | sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = |
500 | ARRAY_SIZE(ath9k_legacy_rates) - 4; | 515 | ARRAY_SIZE(ath9k_legacy_rates) - 4; |
501 | } | 516 | } |
517 | return 0; | ||
502 | } | 518 | } |
503 | 519 | ||
504 | static void ath9k_init_misc(struct ath_softc *sc) | 520 | static void ath9k_init_misc(struct ath_softc *sc) |
@@ -558,7 +574,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
558 | common->debug_mask = ath9k_debug; | 574 | common->debug_mask = ath9k_debug; |
559 | 575 | ||
560 | spin_lock_init(&sc->wiphy_lock); | 576 | spin_lock_init(&sc->wiphy_lock); |
561 | spin_lock_init(&sc->sc_resetlock); | ||
562 | spin_lock_init(&sc->sc_serial_rw); | 577 | spin_lock_init(&sc->sc_serial_rw); |
563 | spin_lock_init(&sc->sc_pm_lock); | 578 | spin_lock_init(&sc->sc_pm_lock); |
564 | mutex_init(&sc->mutex); | 579 | mutex_init(&sc->mutex); |
@@ -593,8 +608,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
593 | if (ret) | 608 | if (ret) |
594 | goto err_btcoex; | 609 | goto err_btcoex; |
595 | 610 | ||
611 | ret = ath9k_init_channels_rates(sc); | ||
612 | if (ret) | ||
613 | goto err_btcoex; | ||
614 | |||
596 | ath9k_init_crypto(sc); | 615 | ath9k_init_crypto(sc); |
597 | ath9k_init_channels_rates(sc); | ||
598 | ath9k_init_misc(sc); | 616 | ath9k_init_misc(sc); |
599 | 617 | ||
600 | return 0; | 618 | return 0; |
@@ -641,7 +659,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
641 | BIT(NL80211_IFTYPE_ADHOC) | | 659 | BIT(NL80211_IFTYPE_ADHOC) | |
642 | BIT(NL80211_IFTYPE_MESH_POINT); | 660 | BIT(NL80211_IFTYPE_MESH_POINT); |
643 | 661 | ||
644 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 662 | if (AR_SREV_5416(sc->sc_ah)) |
663 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | ||
645 | 664 | ||
646 | hw->queues = 4; | 665 | hw->queues = 4; |
647 | hw->max_rates = 4; | 666 | hw->max_rates = 4; |
@@ -751,6 +770,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
751 | { | 770 | { |
752 | int i = 0; | 771 | int i = 0; |
753 | 772 | ||
773 | if (sc->sbands[IEEE80211_BAND_2GHZ].channels) | ||
774 | kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); | ||
775 | |||
776 | if (sc->sbands[IEEE80211_BAND_5GHZ].channels) | ||
777 | kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels); | ||
778 | |||
754 | if ((sc->btcoex.no_stomp_timer) && | 779 | if ((sc->btcoex.no_stomp_timer) && |
755 | sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) | 780 | sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
756 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); | 781 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index e955bb9d98cb..79302b1e0910 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -713,6 +713,8 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, | |||
713 | rs->rs_status |= ATH9K_RXERR_DECRYPT; | 713 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
714 | else if (ads.ds_rxstatus8 & AR_MichaelErr) | 714 | else if (ads.ds_rxstatus8 & AR_MichaelErr) |
715 | rs->rs_status |= ATH9K_RXERR_MIC; | 715 | rs->rs_status |= ATH9K_RXERR_MIC; |
716 | else if (ads.ds_rxstatus8 & AR_KeyMiss) | ||
717 | rs->rs_status |= ATH9K_RXERR_DECRYPT; | ||
716 | } | 718 | } |
717 | 719 | ||
718 | return 0; | 720 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 3caa32316e7b..9790d3a86535 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -213,6 +213,9 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
213 | */ | 213 | */ |
214 | ath9k_hw_set_interrupts(ah, 0); | 214 | ath9k_hw_set_interrupts(ah, 0); |
215 | ath_drain_all_txq(sc, false); | 215 | ath_drain_all_txq(sc, false); |
216 | |||
217 | spin_lock_bh(&sc->sc_pcu_lock); | ||
218 | |||
216 | stopped = ath_stoprecv(sc); | 219 | stopped = ath_stoprecv(sc); |
217 | 220 | ||
218 | /* XXX: do not flush receive queue here. We don't want | 221 | /* XXX: do not flush receive queue here. We don't want |
@@ -230,34 +233,35 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, | |||
230 | sc->sc_ah->curchan->channel, | 233 | sc->sc_ah->curchan->channel, |
231 | channel->center_freq, conf_is_ht40(conf)); | 234 | channel->center_freq, conf_is_ht40(conf)); |
232 | 235 | ||
233 | spin_lock_bh(&sc->sc_resetlock); | ||
234 | |||
235 | r = ath9k_hw_reset(ah, hchan, caldata, fastcc); | 236 | r = ath9k_hw_reset(ah, hchan, caldata, fastcc); |
236 | if (r) { | 237 | if (r) { |
237 | ath_print(common, ATH_DBG_FATAL, | 238 | ath_print(common, ATH_DBG_FATAL, |
238 | "Unable to reset channel (%u MHz), " | 239 | "Unable to reset channel (%u MHz), " |
239 | "reset status %d\n", | 240 | "reset status %d\n", |
240 | channel->center_freq, r); | 241 | channel->center_freq, r); |
241 | spin_unlock_bh(&sc->sc_resetlock); | 242 | spin_unlock_bh(&sc->sc_pcu_lock); |
242 | goto ps_restore; | 243 | goto ps_restore; |
243 | } | 244 | } |
244 | spin_unlock_bh(&sc->sc_resetlock); | ||
245 | 245 | ||
246 | if (ath_startrecv(sc) != 0) { | 246 | if (ath_startrecv(sc) != 0) { |
247 | ath_print(common, ATH_DBG_FATAL, | 247 | ath_print(common, ATH_DBG_FATAL, |
248 | "Unable to restart recv logic\n"); | 248 | "Unable to restart recv logic\n"); |
249 | r = -EIO; | 249 | r = -EIO; |
250 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
250 | goto ps_restore; | 251 | goto ps_restore; |
251 | } | 252 | } |
252 | 253 | ||
254 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
255 | |||
253 | ath_cache_conf_rate(sc, &hw->conf); | 256 | ath_cache_conf_rate(sc, &hw->conf); |
254 | ath_update_txpow(sc); | 257 | ath_update_txpow(sc); |
255 | ath9k_hw_set_interrupts(ah, ah->imask); | 258 | ath9k_hw_set_interrupts(ah, ah->imask); |
256 | 259 | ||
257 | if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) { | 260 | if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) { |
258 | ath_start_ani(common); | 261 | if (sc->sc_flags & SC_OP_BEACONS) |
262 | ath_beacon_config(sc, NULL); | ||
259 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); | 263 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
260 | ath_beacon_config(sc, NULL); | 264 | ath_start_ani(common); |
261 | } | 265 | } |
262 | 266 | ||
263 | ps_restore: | 267 | ps_restore: |
@@ -269,6 +273,7 @@ static void ath_paprd_activate(struct ath_softc *sc) | |||
269 | { | 273 | { |
270 | struct ath_hw *ah = sc->sc_ah; | 274 | struct ath_hw *ah = sc->sc_ah; |
271 | struct ath9k_hw_cal_data *caldata = ah->caldata; | 275 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
276 | struct ath_common *common = ath9k_hw_common(ah); | ||
272 | int chain; | 277 | int chain; |
273 | 278 | ||
274 | if (!caldata || !caldata->paprd_done) | 279 | if (!caldata || !caldata->paprd_done) |
@@ -277,7 +282,7 @@ static void ath_paprd_activate(struct ath_softc *sc) | |||
277 | ath9k_ps_wakeup(sc); | 282 | ath9k_ps_wakeup(sc); |
278 | ar9003_paprd_enable(ah, false); | 283 | ar9003_paprd_enable(ah, false); |
279 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 284 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
280 | if (!(ah->caps.tx_chainmask & BIT(chain))) | 285 | if (!(common->tx_chainmask & BIT(chain))) |
281 | continue; | 286 | continue; |
282 | 287 | ||
283 | ar9003_paprd_populate_single_table(ah, caldata, chain); | 288 | ar9003_paprd_populate_single_table(ah, caldata, chain); |
@@ -299,6 +304,7 @@ void ath_paprd_calibrate(struct work_struct *work) | |||
299 | struct ieee80211_supported_band *sband = &sc->sbands[band]; | 304 | struct ieee80211_supported_band *sband = &sc->sbands[band]; |
300 | struct ath_tx_control txctl; | 305 | struct ath_tx_control txctl; |
301 | struct ath9k_hw_cal_data *caldata = ah->caldata; | 306 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
307 | struct ath_common *common = ath9k_hw_common(ah); | ||
302 | int qnum, ftype; | 308 | int qnum, ftype; |
303 | int chain_ok = 0; | 309 | int chain_ok = 0; |
304 | int chain; | 310 | int chain; |
@@ -332,7 +338,7 @@ void ath_paprd_calibrate(struct work_struct *work) | |||
332 | ath9k_ps_wakeup(sc); | 338 | ath9k_ps_wakeup(sc); |
333 | ar9003_paprd_init_table(ah); | 339 | ar9003_paprd_init_table(ah); |
334 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { | 340 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
335 | if (!(ah->caps.tx_chainmask & BIT(chain))) | 341 | if (!(common->tx_chainmask & BIT(chain))) |
336 | continue; | 342 | continue; |
337 | 343 | ||
338 | chain_ok = 0; | 344 | chain_ok = 0; |
@@ -550,7 +556,7 @@ void ath_hw_check(struct work_struct *work) | |||
550 | 556 | ||
551 | msleep(1); | 557 | msleep(1); |
552 | } | 558 | } |
553 | ath_reset(sc, false); | 559 | ath_reset(sc, true); |
554 | 560 | ||
555 | out: | 561 | out: |
556 | ath9k_ps_restore(sc); | 562 | ath9k_ps_restore(sc); |
@@ -568,7 +574,7 @@ void ath9k_tasklet(unsigned long data) | |||
568 | ath9k_ps_wakeup(sc); | 574 | ath9k_ps_wakeup(sc); |
569 | 575 | ||
570 | if (status & ATH9K_INT_FATAL) { | 576 | if (status & ATH9K_INT_FATAL) { |
571 | ath_reset(sc, false); | 577 | ath_reset(sc, true); |
572 | ath9k_ps_restore(sc); | 578 | ath9k_ps_restore(sc); |
573 | return; | 579 | return; |
574 | } | 580 | } |
@@ -583,7 +589,7 @@ void ath9k_tasklet(unsigned long data) | |||
583 | rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); | 589 | rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); |
584 | 590 | ||
585 | if (status & rxmask) { | 591 | if (status & rxmask) { |
586 | spin_lock_bh(&sc->rx.rxflushlock); | 592 | spin_lock_bh(&sc->sc_pcu_lock); |
587 | 593 | ||
588 | /* Check for high priority Rx first */ | 594 | /* Check for high priority Rx first */ |
589 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && | 595 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && |
@@ -591,7 +597,7 @@ void ath9k_tasklet(unsigned long data) | |||
591 | ath_rx_tasklet(sc, 0, true); | 597 | ath_rx_tasklet(sc, 0, true); |
592 | 598 | ||
593 | ath_rx_tasklet(sc, 0, false); | 599 | ath_rx_tasklet(sc, 0, false); |
594 | spin_unlock_bh(&sc->rx.rxflushlock); | 600 | spin_unlock_bh(&sc->sc_pcu_lock); |
595 | } | 601 | } |
596 | 602 | ||
597 | if (status & ATH9K_INT_TX) { | 603 | if (status & ATH9K_INT_TX) { |
@@ -838,7 +844,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
838 | if (!ah->curchan) | 844 | if (!ah->curchan) |
839 | ah->curchan = ath_get_curchannel(sc, sc->hw); | 845 | ah->curchan = ath_get_curchannel(sc, sc->hw); |
840 | 846 | ||
841 | spin_lock_bh(&sc->sc_resetlock); | 847 | spin_lock_bh(&sc->sc_pcu_lock); |
842 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | 848 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
843 | if (r) { | 849 | if (r) { |
844 | ath_print(common, ATH_DBG_FATAL, | 850 | ath_print(common, ATH_DBG_FATAL, |
@@ -846,14 +852,15 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
846 | "reset status %d\n", | 852 | "reset status %d\n", |
847 | channel->center_freq, r); | 853 | channel->center_freq, r); |
848 | } | 854 | } |
849 | spin_unlock_bh(&sc->sc_resetlock); | ||
850 | 855 | ||
851 | ath_update_txpow(sc); | 856 | ath_update_txpow(sc); |
852 | if (ath_startrecv(sc) != 0) { | 857 | if (ath_startrecv(sc) != 0) { |
853 | ath_print(common, ATH_DBG_FATAL, | 858 | ath_print(common, ATH_DBG_FATAL, |
854 | "Unable to restart recv logic\n"); | 859 | "Unable to restart recv logic\n"); |
860 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
855 | return; | 861 | return; |
856 | } | 862 | } |
863 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
857 | 864 | ||
858 | if (sc->sc_flags & SC_OP_BEACONS) | 865 | if (sc->sc_flags & SC_OP_BEACONS) |
859 | ath_beacon_config(sc, NULL); /* restart beacons */ | 866 | ath_beacon_config(sc, NULL); /* restart beacons */ |
@@ -892,13 +899,15 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
892 | ath9k_hw_set_interrupts(ah, 0); | 899 | ath9k_hw_set_interrupts(ah, 0); |
893 | 900 | ||
894 | ath_drain_all_txq(sc, false); /* clear pending tx frames */ | 901 | ath_drain_all_txq(sc, false); /* clear pending tx frames */ |
902 | |||
903 | spin_lock_bh(&sc->sc_pcu_lock); | ||
904 | |||
895 | ath_stoprecv(sc); /* turn off frame recv */ | 905 | ath_stoprecv(sc); /* turn off frame recv */ |
896 | ath_flushrecv(sc); /* flush recv queue */ | 906 | ath_flushrecv(sc); /* flush recv queue */ |
897 | 907 | ||
898 | if (!ah->curchan) | 908 | if (!ah->curchan) |
899 | ah->curchan = ath_get_curchannel(sc, hw); | 909 | ah->curchan = ath_get_curchannel(sc, hw); |
900 | 910 | ||
901 | spin_lock_bh(&sc->sc_resetlock); | ||
902 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); | 911 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
903 | if (r) { | 912 | if (r) { |
904 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, | 913 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, |
@@ -906,9 +915,11 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
906 | "reset status %d\n", | 915 | "reset status %d\n", |
907 | channel->center_freq, r); | 916 | channel->center_freq, r); |
908 | } | 917 | } |
909 | spin_unlock_bh(&sc->sc_resetlock); | ||
910 | 918 | ||
911 | ath9k_hw_phy_disable(ah); | 919 | ath9k_hw_phy_disable(ah); |
920 | |||
921 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
922 | |||
912 | ath9k_hw_configpcipowersave(ah, 1, 1); | 923 | ath9k_hw_configpcipowersave(ah, 1, 1); |
913 | ath9k_ps_restore(sc); | 924 | ath9k_ps_restore(sc); |
914 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 925 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
@@ -928,20 +939,23 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
928 | 939 | ||
929 | ath9k_hw_set_interrupts(ah, 0); | 940 | ath9k_hw_set_interrupts(ah, 0); |
930 | ath_drain_all_txq(sc, retry_tx); | 941 | ath_drain_all_txq(sc, retry_tx); |
942 | |||
943 | spin_lock_bh(&sc->sc_pcu_lock); | ||
944 | |||
931 | ath_stoprecv(sc); | 945 | ath_stoprecv(sc); |
932 | ath_flushrecv(sc); | 946 | ath_flushrecv(sc); |
933 | 947 | ||
934 | spin_lock_bh(&sc->sc_resetlock); | ||
935 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); | 948 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); |
936 | if (r) | 949 | if (r) |
937 | ath_print(common, ATH_DBG_FATAL, | 950 | ath_print(common, ATH_DBG_FATAL, |
938 | "Unable to reset hardware; reset status %d\n", r); | 951 | "Unable to reset hardware; reset status %d\n", r); |
939 | spin_unlock_bh(&sc->sc_resetlock); | ||
940 | 952 | ||
941 | if (ath_startrecv(sc) != 0) | 953 | if (ath_startrecv(sc) != 0) |
942 | ath_print(common, ATH_DBG_FATAL, | 954 | ath_print(common, ATH_DBG_FATAL, |
943 | "Unable to start recv logic\n"); | 955 | "Unable to start recv logic\n"); |
944 | 956 | ||
957 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
958 | |||
945 | /* | 959 | /* |
946 | * We may be doing a reset in response to a request | 960 | * We may be doing a reset in response to a request |
947 | * that changes the channel so update any state that | 961 | * that changes the channel so update any state that |
@@ -951,7 +965,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
951 | 965 | ||
952 | ath_update_txpow(sc); | 966 | ath_update_txpow(sc); |
953 | 967 | ||
954 | if (sc->sc_flags & SC_OP_BEACONS) | 968 | if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL))) |
955 | ath_beacon_config(sc, NULL); /* restart beacons */ | 969 | ath_beacon_config(sc, NULL); /* restart beacons */ |
956 | 970 | ||
957 | ath9k_hw_set_interrupts(ah, ah->imask); | 971 | ath9k_hw_set_interrupts(ah, ah->imask); |
@@ -1106,17 +1120,16 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1106 | * be followed by initialization of the appropriate bits | 1120 | * be followed by initialization of the appropriate bits |
1107 | * and then setup of the interrupt mask. | 1121 | * and then setup of the interrupt mask. |
1108 | */ | 1122 | */ |
1109 | spin_lock_bh(&sc->sc_resetlock); | 1123 | spin_lock_bh(&sc->sc_pcu_lock); |
1110 | r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); | 1124 | r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); |
1111 | if (r) { | 1125 | if (r) { |
1112 | ath_print(common, ATH_DBG_FATAL, | 1126 | ath_print(common, ATH_DBG_FATAL, |
1113 | "Unable to reset hardware; reset status %d " | 1127 | "Unable to reset hardware; reset status %d " |
1114 | "(freq %u MHz)\n", r, | 1128 | "(freq %u MHz)\n", r, |
1115 | curchan->center_freq); | 1129 | curchan->center_freq); |
1116 | spin_unlock_bh(&sc->sc_resetlock); | 1130 | spin_unlock_bh(&sc->sc_pcu_lock); |
1117 | goto mutex_unlock; | 1131 | goto mutex_unlock; |
1118 | } | 1132 | } |
1119 | spin_unlock_bh(&sc->sc_resetlock); | ||
1120 | 1133 | ||
1121 | /* | 1134 | /* |
1122 | * This is needed only to setup initial state | 1135 | * This is needed only to setup initial state |
@@ -1135,8 +1148,10 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1135 | ath_print(common, ATH_DBG_FATAL, | 1148 | ath_print(common, ATH_DBG_FATAL, |
1136 | "Unable to start recv logic\n"); | 1149 | "Unable to start recv logic\n"); |
1137 | r = -EIO; | 1150 | r = -EIO; |
1151 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1138 | goto mutex_unlock; | 1152 | goto mutex_unlock; |
1139 | } | 1153 | } |
1154 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1140 | 1155 | ||
1141 | /* Setup our intr mask. */ | 1156 | /* Setup our intr mask. */ |
1142 | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | | 1157 | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | |
@@ -1340,18 +1355,24 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1340 | 1355 | ||
1341 | if (!(sc->sc_flags & SC_OP_INVALID)) { | 1356 | if (!(sc->sc_flags & SC_OP_INVALID)) { |
1342 | ath_drain_all_txq(sc, false); | 1357 | ath_drain_all_txq(sc, false); |
1358 | spin_lock_bh(&sc->sc_pcu_lock); | ||
1343 | ath_stoprecv(sc); | 1359 | ath_stoprecv(sc); |
1344 | ath9k_hw_phy_disable(ah); | 1360 | ath9k_hw_phy_disable(ah); |
1345 | } else | 1361 | spin_unlock_bh(&sc->sc_pcu_lock); |
1362 | } else { | ||
1363 | spin_lock_bh(&sc->sc_pcu_lock); | ||
1346 | sc->rx.rxlink = NULL; | 1364 | sc->rx.rxlink = NULL; |
1365 | spin_unlock_bh(&sc->sc_pcu_lock); | ||
1366 | } | ||
1347 | 1367 | ||
1348 | /* disable HAL and put h/w to sleep */ | 1368 | /* disable HAL and put h/w to sleep */ |
1349 | ath9k_hw_disable(ah); | 1369 | ath9k_hw_disable(ah); |
1350 | ath9k_hw_configpcipowersave(ah, 1, 1); | 1370 | ath9k_hw_configpcipowersave(ah, 1, 1); |
1351 | ath9k_ps_restore(sc); | 1371 | ath9k_ps_restore(sc); |
1352 | 1372 | ||
1353 | /* Finally, put the chip in FULL SLEEP mode */ | 1373 | sc->ps_idle = true; |
1354 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); | 1374 | ath9k_set_wiphy_idle(aphy, true); |
1375 | ath_radio_disable(sc, hw); | ||
1355 | 1376 | ||
1356 | sc->sc_flags |= SC_OP_INVALID; | 1377 | sc->sc_flags |= SC_OP_INVALID; |
1357 | 1378 | ||
@@ -1455,6 +1476,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1455 | struct ath_softc *sc = aphy->sc; | 1476 | struct ath_softc *sc = aphy->sc; |
1456 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1477 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1457 | struct ath_vif *avp = (void *)vif->drv_priv; | 1478 | struct ath_vif *avp = (void *)vif->drv_priv; |
1479 | bool bs_valid = false; | ||
1458 | int i; | 1480 | int i; |
1459 | 1481 | ||
1460 | ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); | 1482 | ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); |
@@ -1483,7 +1505,15 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
1483 | "slot\n", __func__); | 1505 | "slot\n", __func__); |
1484 | sc->beacon.bslot[i] = NULL; | 1506 | sc->beacon.bslot[i] = NULL; |
1485 | sc->beacon.bslot_aphy[i] = NULL; | 1507 | sc->beacon.bslot_aphy[i] = NULL; |
1486 | } | 1508 | } else if (sc->beacon.bslot[i]) |
1509 | bs_valid = true; | ||
1510 | } | ||
1511 | if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) { | ||
1512 | /* Disable SWBA interrupt */ | ||
1513 | sc->sc_ah->imask &= ~ATH9K_INT_SWBA; | ||
1514 | ath9k_ps_wakeup(sc); | ||
1515 | ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); | ||
1516 | ath9k_ps_restore(sc); | ||
1487 | } | 1517 | } |
1488 | 1518 | ||
1489 | sc->nvifs--; | 1519 | sc->nvifs--; |
@@ -1556,6 +1586,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1556 | * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. | 1586 | * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. |
1557 | */ | 1587 | */ |
1558 | if (changed & IEEE80211_CONF_CHANGE_PS) { | 1588 | if (changed & IEEE80211_CONF_CHANGE_PS) { |
1589 | unsigned long flags; | ||
1590 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
1559 | if (conf->flags & IEEE80211_CONF_PS) { | 1591 | if (conf->flags & IEEE80211_CONF_PS) { |
1560 | sc->ps_flags |= PS_ENABLED; | 1592 | sc->ps_flags |= PS_ENABLED; |
1561 | /* | 1593 | /* |
@@ -1570,7 +1602,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1570 | sc->ps_enabled = false; | 1602 | sc->ps_enabled = false; |
1571 | sc->ps_flags &= ~(PS_ENABLED | | 1603 | sc->ps_flags &= ~(PS_ENABLED | |
1572 | PS_NULLFUNC_COMPLETED); | 1604 | PS_NULLFUNC_COMPLETED); |
1573 | ath9k_setpower(sc, ATH9K_PM_AWAKE); | 1605 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); |
1574 | if (!(ah->caps.hw_caps & | 1606 | if (!(ah->caps.hw_caps & |
1575 | ATH9K_HW_CAP_AUTOSLEEP)) { | 1607 | ATH9K_HW_CAP_AUTOSLEEP)) { |
1576 | ath9k_hw_setrxabort(sc->sc_ah, 0); | 1608 | ath9k_hw_setrxabort(sc->sc_ah, 0); |
@@ -1585,6 +1617,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1585 | } | 1617 | } |
1586 | } | 1618 | } |
1587 | } | 1619 | } |
1620 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
1588 | } | 1621 | } |
1589 | 1622 | ||
1590 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { | 1623 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { |
@@ -1968,8 +2001,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, | |||
1968 | break; | 2001 | break; |
1969 | case IEEE80211_AMPDU_TX_START: | 2002 | case IEEE80211_AMPDU_TX_START: |
1970 | ath9k_ps_wakeup(sc); | 2003 | ath9k_ps_wakeup(sc); |
1971 | ath_tx_aggr_start(sc, sta, tid, ssn); | 2004 | ret = ath_tx_aggr_start(sc, sta, tid, ssn); |
1972 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 2005 | if (!ret) |
2006 | ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); | ||
1973 | ath9k_ps_restore(sc); | 2007 | ath9k_ps_restore(sc); |
1974 | break; | 2008 | break; |
1975 | case IEEE80211_AMPDU_TX_STOP: | 2009 | case IEEE80211_AMPDU_TX_STOP: |
@@ -2032,7 +2066,6 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) | |||
2032 | 2066 | ||
2033 | aphy->state = ATH_WIPHY_SCAN; | 2067 | aphy->state = ATH_WIPHY_SCAN; |
2034 | ath9k_wiphy_pause_all_forced(sc, aphy); | 2068 | ath9k_wiphy_pause_all_forced(sc, aphy); |
2035 | sc->sc_flags |= SC_OP_SCANNING; | ||
2036 | mutex_unlock(&sc->mutex); | 2069 | mutex_unlock(&sc->mutex); |
2037 | } | 2070 | } |
2038 | 2071 | ||
@@ -2047,7 +2080,6 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) | |||
2047 | 2080 | ||
2048 | mutex_lock(&sc->mutex); | 2081 | mutex_lock(&sc->mutex); |
2049 | aphy->state = ATH_WIPHY_ACTIVE; | 2082 | aphy->state = ATH_WIPHY_ACTIVE; |
2050 | sc->sc_flags &= ~SC_OP_SCANNING; | ||
2051 | mutex_unlock(&sc->mutex); | 2083 | mutex_unlock(&sc->mutex); |
2052 | } | 2084 | } |
2053 | 2085 | ||
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index b5b651413e77..894ebadbb1d3 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -290,6 +290,10 @@ static int ath_pci_resume(struct pci_dev *pdev) | |||
290 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | 290 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
291 | ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); | 291 | ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); |
292 | 292 | ||
293 | sc->ps_idle = true; | ||
294 | ath9k_set_wiphy_idle(aphy, true); | ||
295 | ath_radio_disable(sc, hw); | ||
296 | |||
293 | return 0; | 297 | return 0; |
294 | } | 298 | } |
295 | 299 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index e49be733d546..5f825cec5b4d 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -538,7 +538,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | |||
538 | for (i = 0; i < rateset->rs_nrates; i++) { | 538 | for (i = 0; i < rateset->rs_nrates; i++) { |
539 | for (j = 0; j < rate_table->rate_cnt; j++) { | 539 | for (j = 0; j < rate_table->rate_cnt; j++) { |
540 | u32 phy = rate_table->info[j].phy; | 540 | u32 phy = rate_table->info[j].phy; |
541 | u16 rate_flags = rate_table->info[i].rate_flags; | 541 | u16 rate_flags = rate_table->info[j].rate_flags; |
542 | u8 rate = rateset->rs_rates[i]; | 542 | u8 rate = rateset->rs_rates[i]; |
543 | u8 dot11rate = rate_table->info[j].dot11rate; | 543 | u8 dot11rate = rate_table->info[j].dot11rate; |
544 | 544 | ||
@@ -1359,6 +1359,12 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1359 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) | 1359 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) |
1360 | return; | 1360 | return; |
1361 | 1361 | ||
1362 | if (!(tx_info->flags & IEEE80211_TX_STAT_AMPDU)) { | ||
1363 | tx_info->status.ampdu_ack_len = | ||
1364 | (tx_info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); | ||
1365 | tx_info->status.ampdu_len = 1; | ||
1366 | } | ||
1367 | |||
1362 | /* | 1368 | /* |
1363 | * If an underrun error is seen assume it as an excessive retry only | 1369 | * If an underrun error is seen assume it as an excessive retry only |
1364 | * if max frame trigger level has been reached (2 KB for singel stream, | 1370 | * if max frame trigger level has been reached (2 KB for singel stream, |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a3fc987ebab0..912f747593cd 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -288,19 +288,17 @@ static void ath_edma_start_recv(struct ath_softc *sc) | |||
288 | ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP, | 288 | ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP, |
289 | sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize); | 289 | sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize); |
290 | 290 | ||
291 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
292 | |||
293 | ath_opmode_init(sc); | 291 | ath_opmode_init(sc); |
294 | 292 | ||
295 | ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_SCANNING)); | 293 | ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_OFFCHANNEL)); |
294 | |||
295 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
296 | } | 296 | } |
297 | 297 | ||
298 | static void ath_edma_stop_recv(struct ath_softc *sc) | 298 | static void ath_edma_stop_recv(struct ath_softc *sc) |
299 | { | 299 | { |
300 | spin_lock_bh(&sc->rx.rxbuflock); | ||
301 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); | 300 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); |
302 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); | 301 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); |
303 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
304 | } | 302 | } |
305 | 303 | ||
306 | int ath_rx_init(struct ath_softc *sc, int nbufs) | 304 | int ath_rx_init(struct ath_softc *sc, int nbufs) |
@@ -310,7 +308,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
310 | struct ath_buf *bf; | 308 | struct ath_buf *bf; |
311 | int error = 0; | 309 | int error = 0; |
312 | 310 | ||
313 | spin_lock_init(&sc->rx.rxflushlock); | 311 | spin_lock_init(&sc->sc_pcu_lock); |
314 | sc->sc_flags &= ~SC_OP_RXFLUSH; | 312 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
315 | spin_lock_init(&sc->rx.rxbuflock); | 313 | spin_lock_init(&sc->rx.rxbuflock); |
316 | 314 | ||
@@ -496,9 +494,10 @@ int ath_startrecv(struct ath_softc *sc) | |||
496 | ath9k_hw_rxena(ah); | 494 | ath9k_hw_rxena(ah); |
497 | 495 | ||
498 | start_recv: | 496 | start_recv: |
499 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
500 | ath_opmode_init(sc); | 497 | ath_opmode_init(sc); |
501 | ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_SCANNING)); | 498 | ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_OFFCHANNEL)); |
499 | |||
500 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
502 | 501 | ||
503 | return 0; | 502 | return 0; |
504 | } | 503 | } |
@@ -508,7 +507,8 @@ bool ath_stoprecv(struct ath_softc *sc) | |||
508 | struct ath_hw *ah = sc->sc_ah; | 507 | struct ath_hw *ah = sc->sc_ah; |
509 | bool stopped; | 508 | bool stopped; |
510 | 509 | ||
511 | ath9k_hw_stoppcurecv(ah); | 510 | spin_lock_bh(&sc->rx.rxbuflock); |
511 | ath9k_hw_abortpcurecv(ah); | ||
512 | ath9k_hw_setrxfilter(ah, 0); | 512 | ath9k_hw_setrxfilter(ah, 0); |
513 | stopped = ath9k_hw_stopdmarecv(ah); | 513 | stopped = ath9k_hw_stopdmarecv(ah); |
514 | 514 | ||
@@ -516,19 +516,18 @@ bool ath_stoprecv(struct ath_softc *sc) | |||
516 | ath_edma_stop_recv(sc); | 516 | ath_edma_stop_recv(sc); |
517 | else | 517 | else |
518 | sc->rx.rxlink = NULL; | 518 | sc->rx.rxlink = NULL; |
519 | spin_unlock_bh(&sc->rx.rxbuflock); | ||
519 | 520 | ||
520 | return stopped; | 521 | return stopped; |
521 | } | 522 | } |
522 | 523 | ||
523 | void ath_flushrecv(struct ath_softc *sc) | 524 | void ath_flushrecv(struct ath_softc *sc) |
524 | { | 525 | { |
525 | spin_lock_bh(&sc->rx.rxflushlock); | ||
526 | sc->sc_flags |= SC_OP_RXFLUSH; | 526 | sc->sc_flags |= SC_OP_RXFLUSH; |
527 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | 527 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
528 | ath_rx_tasklet(sc, 1, true); | 528 | ath_rx_tasklet(sc, 1, true); |
529 | ath_rx_tasklet(sc, 1, false); | 529 | ath_rx_tasklet(sc, 1, false); |
530 | sc->sc_flags &= ~SC_OP_RXFLUSH; | 530 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
531 | spin_unlock_bh(&sc->rx.rxflushlock); | ||
532 | } | 531 | } |
533 | 532 | ||
534 | static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) | 533 | static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) |
@@ -631,7 +630,7 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb) | |||
631 | * No more broadcast/multicast frames to be received at this | 630 | * No more broadcast/multicast frames to be received at this |
632 | * point. | 631 | * point. |
633 | */ | 632 | */ |
634 | sc->ps_flags &= ~PS_WAIT_FOR_CAB; | 633 | sc->ps_flags &= ~(PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON); |
635 | ath_print(common, ATH_DBG_PS, | 634 | ath_print(common, ATH_DBG_PS, |
636 | "All PS CAB frames received, back to sleep\n"); | 635 | "All PS CAB frames received, back to sleep\n"); |
637 | } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && | 636 | } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && |
@@ -870,15 +869,18 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
870 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { | 869 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { |
871 | *decrypt_error = true; | 870 | *decrypt_error = true; |
872 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { | 871 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { |
873 | if (ieee80211_is_ctl(fc)) | 872 | /* |
874 | /* | 873 | * The MIC error bit is only valid if the frame |
875 | * Sometimes, we get invalid | 874 | * is not a control frame or fragment, and it was |
876 | * MIC failures on valid control frames. | 875 | * decrypted using a valid TKIP key. |
877 | * Remove these mic errors. | 876 | */ |
878 | */ | 877 | if (!ieee80211_is_ctl(fc) && |
879 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; | 878 | !ieee80211_has_morefrags(fc) && |
880 | else | 879 | !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && |
880 | test_bit(rx_stats->rs_keyix, common->tkip_keymap)) | ||
881 | rxs->flag |= RX_FLAG_MMIC_ERROR; | 881 | rxs->flag |= RX_FLAG_MMIC_ERROR; |
882 | else | ||
883 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; | ||
882 | } | 884 | } |
883 | /* | 885 | /* |
884 | * Reject error frames with the exception of | 886 | * Reject error frames with the exception of |
@@ -1033,9 +1035,11 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common, | |||
1033 | int hdrlen, padpos, padsize; | 1035 | int hdrlen, padpos, padsize; |
1034 | u8 keyix; | 1036 | u8 keyix; |
1035 | __le16 fc; | 1037 | __le16 fc; |
1038 | bool is_mc; | ||
1036 | 1039 | ||
1037 | /* see if any padding is done by the hw and remove it */ | 1040 | /* see if any padding is done by the hw and remove it */ |
1038 | hdr = (struct ieee80211_hdr *) skb->data; | 1041 | hdr = (struct ieee80211_hdr *) skb->data; |
1042 | is_mc = !!is_multicast_ether_addr(hdr->addr1); | ||
1039 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 1043 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
1040 | fc = hdr->frame_control; | 1044 | fc = hdr->frame_control; |
1041 | padpos = ath9k_cmn_padpos(hdr->frame_control); | 1045 | padpos = ath9k_cmn_padpos(hdr->frame_control); |
@@ -1056,7 +1060,7 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common, | |||
1056 | 1060 | ||
1057 | keyix = rx_stats->rs_keyix; | 1061 | keyix = rx_stats->rs_keyix; |
1058 | 1062 | ||
1059 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error && | 1063 | if ((is_mc || !(keyix == ATH9K_RXKEYIX_INVALID)) && !decrypt_error && |
1060 | ieee80211_has_protected(fc)) { | 1064 | ieee80211_has_protected(fc)) { |
1061 | rxs->flag |= RX_FLAG_DECRYPTED; | 1065 | rxs->flag |= RX_FLAG_DECRYPTED; |
1062 | } else if (ieee80211_has_protected(fc) | 1066 | } else if (ieee80211_has_protected(fc) |
@@ -1096,6 +1100,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1096 | u8 rx_status_len = ah->caps.rx_status_len; | 1100 | u8 rx_status_len = ah->caps.rx_status_len; |
1097 | u64 tsf = 0; | 1101 | u64 tsf = 0; |
1098 | u32 tsf_lower = 0; | 1102 | u32 tsf_lower = 0; |
1103 | unsigned long flags; | ||
1099 | 1104 | ||
1100 | if (edma) | 1105 | if (edma) |
1101 | dma_type = DMA_BIDIRECTIONAL; | 1106 | dma_type = DMA_BIDIRECTIONAL; |
@@ -1204,11 +1209,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1204 | sc->rx.rxotherant = 0; | 1209 | sc->rx.rxotherant = 0; |
1205 | } | 1210 | } |
1206 | 1211 | ||
1212 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
1207 | if (unlikely(ath9k_check_auto_sleep(sc) || | 1213 | if (unlikely(ath9k_check_auto_sleep(sc) || |
1208 | (sc->ps_flags & (PS_WAIT_FOR_BEACON | | 1214 | (sc->ps_flags & (PS_WAIT_FOR_BEACON | |
1209 | PS_WAIT_FOR_CAB | | 1215 | PS_WAIT_FOR_CAB | |
1210 | PS_WAIT_FOR_PSPOLL_DATA)))) | 1216 | PS_WAIT_FOR_PSPOLL_DATA)))) |
1211 | ath_rx_ps(sc, skb); | 1217 | ath_rx_ps(sc, skb); |
1218 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
1212 | 1219 | ||
1213 | ath_rx_send_to_mac80211(hw, sc, skb, rxs); | 1220 | ath_rx_send_to_mac80211(hw, sc, skb, rxs); |
1214 | 1221 | ||
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index d01c4adab8d6..86b0a4b1a72f 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -709,6 +709,7 @@ | |||
709 | #define AR_WA_RESET_EN (1 << 18) /* Sw Control to enable PCI-Reset to POR (bit 15) */ | 709 | #define AR_WA_RESET_EN (1 << 18) /* Sw Control to enable PCI-Reset to POR (bit 15) */ |
710 | #define AR_WA_ANALOG_SHIFT (1 << 20) | 710 | #define AR_WA_ANALOG_SHIFT (1 << 20) |
711 | #define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */ | 711 | #define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */ |
712 | #define AR_WA_BIT22 (1 << 22) | ||
712 | #define AR9285_WA_DEFAULT 0x004a050b | 713 | #define AR9285_WA_DEFAULT 0x004a050b |
713 | #define AR9280_WA_DEFAULT 0x0040073b | 714 | #define AR9280_WA_DEFAULT 0x0040073b |
714 | #define AR_WA_DEFAULT 0x0000073f | 715 | #define AR_WA_DEFAULT 0x0000073f |
@@ -900,7 +901,13 @@ | |||
900 | #define AR_DEVID_7010(_ah) \ | 901 | #define AR_DEVID_7010(_ah) \ |
901 | (((_ah)->hw_version.devid == 0x7010) || \ | 902 | (((_ah)->hw_version.devid == 0x7010) || \ |
902 | ((_ah)->hw_version.devid == 0x7015) || \ | 903 | ((_ah)->hw_version.devid == 0x7015) || \ |
903 | ((_ah)->hw_version.devid == 0x9018)) | 904 | ((_ah)->hw_version.devid == 0x9018) || \ |
905 | ((_ah)->hw_version.devid == 0xA704) || \ | ||
906 | ((_ah)->hw_version.devid == 0x1200)) | ||
907 | |||
908 | #define AR9287_HTC_DEVID(_ah) \ | ||
909 | (((_ah)->hw_version.devid == 0x7015) || \ | ||
910 | ((_ah)->hw_version.devid == 0x1200)) | ||
904 | 911 | ||
905 | #define AR_RADIO_SREV_MAJOR 0xf0 | 912 | #define AR_RADIO_SREV_MAJOR 0xf0 |
906 | #define AR_RAD5133_SREV_MAJOR 0xc0 | 913 | #define AR_RAD5133_SREV_MAJOR 0xc0 |
@@ -1012,11 +1019,13 @@ enum { | |||
1012 | #define AR9287_GPIO_IN_VAL_S 11 | 1019 | #define AR9287_GPIO_IN_VAL_S 11 |
1013 | #define AR9271_GPIO_IN_VAL 0xFFFF0000 | 1020 | #define AR9271_GPIO_IN_VAL 0xFFFF0000 |
1014 | #define AR9271_GPIO_IN_VAL_S 16 | 1021 | #define AR9271_GPIO_IN_VAL_S 16 |
1015 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | ||
1016 | #define AR9300_GPIO_IN_VAL_S 0 | ||
1017 | #define AR7010_GPIO_IN_VAL 0x0000FFFF | 1022 | #define AR7010_GPIO_IN_VAL 0x0000FFFF |
1018 | #define AR7010_GPIO_IN_VAL_S 0 | 1023 | #define AR7010_GPIO_IN_VAL_S 0 |
1019 | 1024 | ||
1025 | #define AR_GPIO_IN 0x404c | ||
1026 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | ||
1027 | #define AR9300_GPIO_IN_VAL_S 0 | ||
1028 | |||
1020 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) | 1029 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) |
1021 | #define AR_GPIO_OE_OUT_DRV 0x3 | 1030 | #define AR_GPIO_OE_OUT_DRV 0x3 |
1022 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 | 1031 | #define AR_GPIO_OE_OUT_DRV_NO 0x0 |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 4dda14e36227..8f00c6c13979 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -61,6 +61,8 @@ static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf, | |||
61 | struct ath_tx_status *ts, int txok); | 61 | struct ath_tx_status *ts, int txok); |
62 | static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, | 62 | static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, |
63 | int nbad, int txok, bool update_rc); | 63 | int nbad, int txok, bool update_rc); |
64 | static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, | ||
65 | int seqno); | ||
64 | 66 | ||
65 | enum { | 67 | enum { |
66 | MCS_HT20, | 68 | MCS_HT20, |
@@ -143,18 +145,23 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | |||
143 | struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum]; | 145 | struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum]; |
144 | struct ath_buf *bf; | 146 | struct ath_buf *bf; |
145 | struct list_head bf_head; | 147 | struct list_head bf_head; |
146 | INIT_LIST_HEAD(&bf_head); | 148 | struct ath_tx_status ts; |
147 | 149 | ||
148 | WARN_ON(!tid->paused); | 150 | INIT_LIST_HEAD(&bf_head); |
149 | 151 | ||
152 | memset(&ts, 0, sizeof(ts)); | ||
150 | spin_lock_bh(&txq->axq_lock); | 153 | spin_lock_bh(&txq->axq_lock); |
151 | tid->paused = false; | ||
152 | 154 | ||
153 | while (!list_empty(&tid->buf_q)) { | 155 | while (!list_empty(&tid->buf_q)) { |
154 | bf = list_first_entry(&tid->buf_q, struct ath_buf, list); | 156 | bf = list_first_entry(&tid->buf_q, struct ath_buf, list); |
155 | BUG_ON(bf_isretried(bf)); | ||
156 | list_move_tail(&bf->list, &bf_head); | 157 | list_move_tail(&bf->list, &bf_head); |
157 | ath_tx_send_ht_normal(sc, txq, tid, &bf_head); | 158 | |
159 | if (bf_isretried(bf)) { | ||
160 | ath_tx_update_baw(sc, tid, bf->bf_seqno); | ||
161 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); | ||
162 | } else { | ||
163 | ath_tx_send_ht_normal(sc, txq, tid, &bf_head); | ||
164 | } | ||
158 | } | 165 | } |
159 | 166 | ||
160 | spin_unlock_bh(&txq->axq_lock); | 167 | spin_unlock_bh(&txq->axq_lock); |
@@ -312,6 +319,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
312 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; | 319 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; |
313 | bool rc_update = true; | 320 | bool rc_update = true; |
314 | struct ieee80211_tx_rate rates[4]; | 321 | struct ieee80211_tx_rate rates[4]; |
322 | int nframes; | ||
315 | 323 | ||
316 | skb = bf->bf_mpdu; | 324 | skb = bf->bf_mpdu; |
317 | hdr = (struct ieee80211_hdr *)skb->data; | 325 | hdr = (struct ieee80211_hdr *)skb->data; |
@@ -320,6 +328,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
320 | hw = bf->aphy->hw; | 328 | hw = bf->aphy->hw; |
321 | 329 | ||
322 | memcpy(rates, tx_info->control.rates, sizeof(rates)); | 330 | memcpy(rates, tx_info->control.rates, sizeof(rates)); |
331 | nframes = bf->bf_nframes; | ||
323 | 332 | ||
324 | rcu_read_lock(); | 333 | rcu_read_lock(); |
325 | 334 | ||
@@ -337,7 +346,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
337 | !bf->bf_stale || bf_next != NULL) | 346 | !bf->bf_stale || bf_next != NULL) |
338 | list_move_tail(&bf->list, &bf_head); | 347 | list_move_tail(&bf->list, &bf_head); |
339 | 348 | ||
340 | ath_tx_rc_status(bf, ts, 0, 0, false); | 349 | ath_tx_rc_status(bf, ts, 1, 0, false); |
341 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, | 350 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, |
342 | 0, 0); | 351 | 0, 0); |
343 | 352 | ||
@@ -431,7 +440,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
431 | list_move_tail(&bf->list, &bf_head); | 440 | list_move_tail(&bf->list, &bf_head); |
432 | } | 441 | } |
433 | 442 | ||
434 | if (!txpending) { | 443 | if (!txpending || (tid->state & AGGR_CLEANUP)) { |
435 | /* | 444 | /* |
436 | * complete the acked-ones/xretried ones; update | 445 | * complete the acked-ones/xretried ones; update |
437 | * block-ack window | 446 | * block-ack window |
@@ -442,6 +451,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
442 | 451 | ||
443 | if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { | 452 | if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { |
444 | memcpy(tx_info->control.rates, rates, sizeof(rates)); | 453 | memcpy(tx_info->control.rates, rates, sizeof(rates)); |
454 | bf->bf_nframes = nframes; | ||
445 | ath_tx_rc_status(bf, ts, nbad, txok, true); | 455 | ath_tx_rc_status(bf, ts, nbad, txok, true); |
446 | rc_update = false; | 456 | rc_update = false; |
447 | } else { | 457 | } else { |
@@ -510,15 +520,12 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
510 | } | 520 | } |
511 | 521 | ||
512 | if (tid->state & AGGR_CLEANUP) { | 522 | if (tid->state & AGGR_CLEANUP) { |
523 | ath_tx_flush_tid(sc, tid); | ||
524 | |||
513 | if (tid->baw_head == tid->baw_tail) { | 525 | if (tid->baw_head == tid->baw_tail) { |
514 | tid->state &= ~AGGR_ADDBA_COMPLETE; | 526 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
515 | tid->state &= ~AGGR_CLEANUP; | 527 | tid->state &= ~AGGR_CLEANUP; |
516 | |||
517 | /* send buffered frames as singles */ | ||
518 | ath_tx_flush_tid(sc, tid); | ||
519 | } | 528 | } |
520 | rcu_read_unlock(); | ||
521 | return; | ||
522 | } | 529 | } |
523 | 530 | ||
524 | rcu_read_unlock(); | 531 | rcu_read_unlock(); |
@@ -785,17 +792,23 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
785 | status != ATH_AGGR_BAW_CLOSED); | 792 | status != ATH_AGGR_BAW_CLOSED); |
786 | } | 793 | } |
787 | 794 | ||
788 | void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | 795 | int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
789 | u16 tid, u16 *ssn) | 796 | u16 tid, u16 *ssn) |
790 | { | 797 | { |
791 | struct ath_atx_tid *txtid; | 798 | struct ath_atx_tid *txtid; |
792 | struct ath_node *an; | 799 | struct ath_node *an; |
793 | 800 | ||
794 | an = (struct ath_node *)sta->drv_priv; | 801 | an = (struct ath_node *)sta->drv_priv; |
795 | txtid = ATH_AN_2_TID(an, tid); | 802 | txtid = ATH_AN_2_TID(an, tid); |
803 | |||
804 | if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) | ||
805 | return -EAGAIN; | ||
806 | |||
796 | txtid->state |= AGGR_ADDBA_PROGRESS; | 807 | txtid->state |= AGGR_ADDBA_PROGRESS; |
797 | txtid->paused = true; | 808 | txtid->paused = true; |
798 | *ssn = txtid->seq_start; | 809 | *ssn = txtid->seq_start; |
810 | |||
811 | return 0; | ||
799 | } | 812 | } |
800 | 813 | ||
801 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | 814 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
@@ -803,12 +816,6 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | |||
803 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | 816 | struct ath_node *an = (struct ath_node *)sta->drv_priv; |
804 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); | 817 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); |
805 | struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum]; | 818 | struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum]; |
806 | struct ath_tx_status ts; | ||
807 | struct ath_buf *bf; | ||
808 | struct list_head bf_head; | ||
809 | |||
810 | memset(&ts, 0, sizeof(ts)); | ||
811 | INIT_LIST_HEAD(&bf_head); | ||
812 | 819 | ||
813 | if (txtid->state & AGGR_CLEANUP) | 820 | if (txtid->state & AGGR_CLEANUP) |
814 | return; | 821 | return; |
@@ -818,31 +825,22 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | |||
818 | return; | 825 | return; |
819 | } | 826 | } |
820 | 827 | ||
821 | /* drop all software retried frames and mark this TID */ | ||
822 | spin_lock_bh(&txq->axq_lock); | 828 | spin_lock_bh(&txq->axq_lock); |
823 | txtid->paused = true; | 829 | txtid->paused = true; |
824 | while (!list_empty(&txtid->buf_q)) { | ||
825 | bf = list_first_entry(&txtid->buf_q, struct ath_buf, list); | ||
826 | if (!bf_isretried(bf)) { | ||
827 | /* | ||
828 | * NB: it's based on the assumption that | ||
829 | * software retried frame will always stay | ||
830 | * at the head of software queue. | ||
831 | */ | ||
832 | break; | ||
833 | } | ||
834 | list_move_tail(&bf->list, &bf_head); | ||
835 | ath_tx_update_baw(sc, txtid, bf->bf_seqno); | ||
836 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); | ||
837 | } | ||
838 | spin_unlock_bh(&txq->axq_lock); | ||
839 | 830 | ||
840 | if (txtid->baw_head != txtid->baw_tail) { | 831 | /* |
832 | * If frames are still being transmitted for this TID, they will be | ||
833 | * cleaned up during tx completion. To prevent race conditions, this | ||
834 | * TID can only be reused after all in-progress subframes have been | ||
835 | * completed. | ||
836 | */ | ||
837 | if (txtid->baw_head != txtid->baw_tail) | ||
841 | txtid->state |= AGGR_CLEANUP; | 838 | txtid->state |= AGGR_CLEANUP; |
842 | } else { | 839 | else |
843 | txtid->state &= ~AGGR_ADDBA_COMPLETE; | 840 | txtid->state &= ~AGGR_ADDBA_COMPLETE; |
844 | ath_tx_flush_tid(sc, txtid); | 841 | spin_unlock_bh(&txq->axq_lock); |
845 | } | 842 | |
843 | ath_tx_flush_tid(sc, txtid); | ||
846 | } | 844 | } |
847 | 845 | ||
848 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) | 846 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
@@ -1103,15 +1101,6 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) | |||
1103 | txq->axq_tx_inprogress = false; | 1101 | txq->axq_tx_inprogress = false; |
1104 | spin_unlock_bh(&txq->axq_lock); | 1102 | spin_unlock_bh(&txq->axq_lock); |
1105 | 1103 | ||
1106 | /* flush any pending frames if aggregation is enabled */ | ||
1107 | if (sc->sc_flags & SC_OP_TXAGGR) { | ||
1108 | if (!retry_tx) { | ||
1109 | spin_lock_bh(&txq->axq_lock); | ||
1110 | ath_txq_drain_pending_buffers(sc, txq); | ||
1111 | spin_unlock_bh(&txq->axq_lock); | ||
1112 | } | ||
1113 | } | ||
1114 | |||
1115 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { | 1104 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
1116 | spin_lock_bh(&txq->axq_lock); | 1105 | spin_lock_bh(&txq->axq_lock); |
1117 | while (!list_empty(&txq->txq_fifo_pending)) { | 1106 | while (!list_empty(&txq->txq_fifo_pending)) { |
@@ -1132,6 +1121,15 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) | |||
1132 | } | 1121 | } |
1133 | spin_unlock_bh(&txq->axq_lock); | 1122 | spin_unlock_bh(&txq->axq_lock); |
1134 | } | 1123 | } |
1124 | |||
1125 | /* flush any pending frames if aggregation is enabled */ | ||
1126 | if (sc->sc_flags & SC_OP_TXAGGR) { | ||
1127 | if (!retry_tx) { | ||
1128 | spin_lock_bh(&txq->axq_lock); | ||
1129 | ath_txq_drain_pending_buffers(sc, txq); | ||
1130 | spin_unlock_bh(&txq->axq_lock); | ||
1131 | } | ||
1132 | } | ||
1135 | } | 1133 | } |
1136 | 1134 | ||
1137 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | 1135 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) |
@@ -1162,13 +1160,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) | |||
1162 | ath_print(common, ATH_DBG_FATAL, | 1160 | ath_print(common, ATH_DBG_FATAL, |
1163 | "Failed to stop TX DMA. Resetting hardware!\n"); | 1161 | "Failed to stop TX DMA. Resetting hardware!\n"); |
1164 | 1162 | ||
1165 | spin_lock_bh(&sc->sc_resetlock); | 1163 | spin_lock_bh(&sc->sc_pcu_lock); |
1166 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); | 1164 | r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); |
1167 | if (r) | 1165 | if (r) |
1168 | ath_print(common, ATH_DBG_FATAL, | 1166 | ath_print(common, ATH_DBG_FATAL, |
1169 | "Unable to reset hardware; reset status %d\n", | 1167 | "Unable to reset hardware; reset status %d\n", |
1170 | r); | 1168 | r); |
1171 | spin_unlock_bh(&sc->sc_resetlock); | 1169 | spin_unlock_bh(&sc->sc_pcu_lock); |
1172 | } | 1170 | } |
1173 | 1171 | ||
1174 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { | 1172 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { |
@@ -2024,9 +2022,15 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, | |||
2024 | 2022 | ||
2025 | if (ts->ts_status & ATH9K_TXERR_FILT) | 2023 | if (ts->ts_status & ATH9K_TXERR_FILT) |
2026 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 2024 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
2027 | if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) | 2025 | if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) { |
2028 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU; | 2026 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU; |
2029 | 2027 | ||
2028 | BUG_ON(nbad > bf->bf_nframes); | ||
2029 | |||
2030 | tx_info->status.ampdu_len = bf->bf_nframes; | ||
2031 | tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; | ||
2032 | } | ||
2033 | |||
2030 | if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && | 2034 | if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && |
2031 | (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { | 2035 | (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { |
2032 | if (ieee80211_is_data(hdr->frame_control)) { | 2036 | if (ieee80211_is_data(hdr->frame_control)) { |
@@ -2036,8 +2040,6 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, | |||
2036 | if ((ts->ts_status & ATH9K_TXERR_XRETRY) || | 2040 | if ((ts->ts_status & ATH9K_TXERR_XRETRY) || |
2037 | (ts->ts_status & ATH9K_TXERR_FIFO)) | 2041 | (ts->ts_status & ATH9K_TXERR_FIFO)) |
2038 | tx_info->pad[0] |= ATH_TX_INFO_XRETRY; | 2042 | tx_info->pad[0] |= ATH_TX_INFO_XRETRY; |
2039 | tx_info->status.ampdu_len = bf->bf_nframes; | ||
2040 | tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; | ||
2041 | } | 2043 | } |
2042 | } | 2044 | } |
2043 | 2045 | ||
@@ -2159,7 +2161,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2159 | */ | 2161 | */ |
2160 | if (ts.ts_status & ATH9K_TXERR_XRETRY) | 2162 | if (ts.ts_status & ATH9K_TXERR_XRETRY) |
2161 | bf->bf_state.bf_type |= BUF_XRETRY; | 2163 | bf->bf_state.bf_type |= BUF_XRETRY; |
2162 | ath_tx_rc_status(bf, &ts, 0, txok, true); | 2164 | ath_tx_rc_status(bf, &ts, txok ? 0 : 1, txok, true); |
2163 | } | 2165 | } |
2164 | 2166 | ||
2165 | if (bf_isampdu(bf)) | 2167 | if (bf_isampdu(bf)) |
@@ -2204,7 +2206,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work) | |||
2204 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, | 2206 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, |
2205 | "tx hung, resetting the chip\n"); | 2207 | "tx hung, resetting the chip\n"); |
2206 | ath9k_ps_wakeup(sc); | 2208 | ath9k_ps_wakeup(sc); |
2207 | ath_reset(sc, false); | 2209 | ath_reset(sc, true); |
2208 | ath9k_ps_restore(sc); | 2210 | ath9k_ps_restore(sc); |
2209 | } | 2211 | } |
2210 | 2212 | ||
@@ -2288,7 +2290,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) | |||
2288 | if (!bf_isampdu(bf)) { | 2290 | if (!bf_isampdu(bf)) { |
2289 | if (txs.ts_status & ATH9K_TXERR_XRETRY) | 2291 | if (txs.ts_status & ATH9K_TXERR_XRETRY) |
2290 | bf->bf_state.bf_type |= BUF_XRETRY; | 2292 | bf->bf_state.bf_type |= BUF_XRETRY; |
2291 | ath_tx_rc_status(bf, &txs, 0, txok, true); | 2293 | ath_tx_rc_status(bf, &txs, txok ? 0 : 1, txok, true); |
2292 | } | 2294 | } |
2293 | 2295 | ||
2294 | if (bf_isampdu(bf)) | 2296 | if (bf_isampdu(bf)) |
diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c index 45933cf8e8c2..09e2dfd7b175 100644 --- a/drivers/net/wireless/b43/sdio.c +++ b/drivers/net/wireless/b43/sdio.c | |||
@@ -163,6 +163,7 @@ static int b43_sdio_probe(struct sdio_func *func, | |||
163 | err_free_ssb: | 163 | err_free_ssb: |
164 | kfree(sdio); | 164 | kfree(sdio); |
165 | err_disable_func: | 165 | err_disable_func: |
166 | sdio_claim_host(func); | ||
166 | sdio_disable_func(func); | 167 | sdio_disable_func(func); |
167 | err_release_host: | 168 | err_release_host: |
168 | sdio_release_host(func); | 169 | sdio_release_host(func); |
@@ -175,7 +176,9 @@ static void b43_sdio_remove(struct sdio_func *func) | |||
175 | struct b43_sdio *sdio = sdio_get_drvdata(func); | 176 | struct b43_sdio *sdio = sdio_get_drvdata(func); |
176 | 177 | ||
177 | ssb_bus_unregister(&sdio->ssb); | 178 | ssb_bus_unregister(&sdio->ssb); |
179 | sdio_claim_host(func); | ||
178 | sdio_disable_func(func); | 180 | sdio_disable_func(func); |
181 | sdio_release_host(func); | ||
179 | kfree(sdio); | 182 | kfree(sdio); |
180 | sdio_set_drvdata(func, NULL); | 183 | sdio_set_drvdata(func, NULL); |
181 | } | 184 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 10d7b9b7f064..f735117d8fc2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1234,6 +1234,9 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv) | |||
1234 | /* only Re-enable if diabled by irq */ | 1234 | /* only Re-enable if diabled by irq */ |
1235 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1235 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1236 | iwl_enable_interrupts(priv); | 1236 | iwl_enable_interrupts(priv); |
1237 | /* Re-enable RF_KILL if it occurred */ | ||
1238 | else if (handled & CSR_INT_BIT_RF_KILL) | ||
1239 | iwl_enable_rfkill_int(priv); | ||
1237 | 1240 | ||
1238 | #ifdef CONFIG_IWLWIFI_DEBUG | 1241 | #ifdef CONFIG_IWLWIFI_DEBUG |
1239 | if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { | 1242 | if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) { |
@@ -1449,6 +1452,9 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1449 | /* only Re-enable if diabled by irq */ | 1452 | /* only Re-enable if diabled by irq */ |
1450 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) | 1453 | if (test_bit(STATUS_INT_ENABLED, &priv->status)) |
1451 | iwl_enable_interrupts(priv); | 1454 | iwl_enable_interrupts(priv); |
1455 | /* Re-enable RF_KILL if it occurred */ | ||
1456 | else if (handled & CSR_INT_BIT_RF_KILL) | ||
1457 | iwl_enable_rfkill_int(priv); | ||
1452 | } | 1458 | } |
1453 | 1459 | ||
1454 | /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ | 1460 | /* the threshold ratio of actual_ack_cnt to expected_ack_cnt in percent */ |
@@ -3260,9 +3266,10 @@ static void iwl_mac_stop(struct ieee80211_hw *hw) | |||
3260 | 3266 | ||
3261 | flush_workqueue(priv->workqueue); | 3267 | flush_workqueue(priv->workqueue); |
3262 | 3268 | ||
3263 | /* enable interrupts again in order to receive rfkill changes */ | 3269 | /* User space software may expect getting rfkill changes |
3270 | * even if interface is down */ | ||
3264 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 3271 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
3265 | iwl_enable_interrupts(priv); | 3272 | iwl_enable_rfkill_int(priv); |
3266 | 3273 | ||
3267 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3274 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
3268 | } | 3275 | } |
@@ -4103,14 +4110,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
4103 | * 8. Enable interrupts and read RFKILL state | 4110 | * 8. Enable interrupts and read RFKILL state |
4104 | *********************************************/ | 4111 | *********************************************/ |
4105 | 4112 | ||
4106 | /* enable interrupts if needed: hw bug w/a */ | 4113 | /* enable rfkill interrupt: hw bug w/a */ |
4107 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); | 4114 | pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd); |
4108 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { | 4115 | if (pci_cmd & PCI_COMMAND_INTX_DISABLE) { |
4109 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; | 4116 | pci_cmd &= ~PCI_COMMAND_INTX_DISABLE; |
4110 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); | 4117 | pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd); |
4111 | } | 4118 | } |
4112 | 4119 | ||
4113 | iwl_enable_interrupts(priv); | 4120 | iwl_enable_rfkill_int(priv); |
4114 | 4121 | ||
4115 | /* If platform's RF_KILL switch is NOT set to KILL */ | 4122 | /* If platform's RF_KILL switch is NOT set to KILL */ |
4116 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 4123 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 621abe3c5afc..1c6add90b5b4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h | |||
@@ -168,6 +168,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv) | |||
168 | IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); | 168 | IWL_DEBUG_ISR(priv, "Disabled interrupts\n"); |
169 | } | 169 | } |
170 | 170 | ||
171 | static inline void iwl_enable_rfkill_int(struct iwl_priv *priv) | ||
172 | { | ||
173 | IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); | ||
174 | iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL); | ||
175 | } | ||
176 | |||
171 | static inline void iwl_enable_interrupts(struct iwl_priv *priv) | 177 | static inline void iwl_enable_interrupts(struct iwl_priv *priv) |
172 | { | 178 | { |
173 | IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); | 179 | IWL_DEBUG_ISR(priv, "Enabling interrupts\n"); |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index e8e2d0f4763d..f800ef4e6554 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -1813,6 +1813,12 @@ static int __orinoco_commit(struct orinoco_private *priv) | |||
1813 | struct net_device *dev = priv->ndev; | 1813 | struct net_device *dev = priv->ndev; |
1814 | int err = 0; | 1814 | int err = 0; |
1815 | 1815 | ||
1816 | /* If we've called commit, we are reconfiguring or bringing the | ||
1817 | * interface up. Maintaining countermeasures across this would | ||
1818 | * be confusing, so note that we've disabled them. The port will | ||
1819 | * be enabled later in orinoco_commit or __orinoco_up. */ | ||
1820 | priv->tkip_cm_active = 0; | ||
1821 | |||
1816 | err = orinoco_hw_program_rids(priv); | 1822 | err = orinoco_hw_program_rids(priv); |
1817 | 1823 | ||
1818 | /* FIXME: what about netif_tx_lock */ | 1824 | /* FIXME: what about netif_tx_lock */ |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index ef46a2d88539..083999faaa98 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -248,20 +248,20 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
248 | goto failed; | 248 | goto failed; |
249 | } | 249 | } |
250 | 250 | ||
251 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
252 | if (ret) | ||
253 | goto failed; | ||
254 | |||
255 | /* We initialize the hermes structure before completing PCMCIA | ||
256 | * configuration just in case the interrupt handler gets | ||
257 | * called. */ | ||
258 | mem = ioport_map(link->resource[0]->start, | 251 | mem = ioport_map(link->resource[0]->start, |
259 | resource_size(link->resource[0])); | 252 | resource_size(link->resource[0])); |
260 | if (!mem) | 253 | if (!mem) |
261 | goto failed; | 254 | goto failed; |
262 | 255 | ||
256 | /* We initialize the hermes structure before completing PCMCIA | ||
257 | * configuration just in case the interrupt handler gets | ||
258 | * called. */ | ||
263 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 259 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
264 | 260 | ||
261 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
262 | if (ret) | ||
263 | goto failed; | ||
264 | |||
265 | /* | 265 | /* |
266 | * This actually configures the PCMCIA socket -- setting up | 266 | * This actually configures the PCMCIA socket -- setting up |
267 | * the I/O windows and the interrupt mapping, and putting the | 267 | * the I/O windows and the interrupt mapping, and putting the |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 873877e17e1b..93070a3a5233 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -310,21 +310,21 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
310 | goto failed; | 310 | goto failed; |
311 | } | 311 | } |
312 | 312 | ||
313 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
314 | if (ret) | ||
315 | goto failed; | ||
316 | |||
317 | /* We initialize the hermes structure before completing PCMCIA | ||
318 | * configuration just in case the interrupt handler gets | ||
319 | * called. */ | ||
320 | mem = ioport_map(link->resource[0]->start, | 313 | mem = ioport_map(link->resource[0]->start, |
321 | resource_size(link->resource[0])); | 314 | resource_size(link->resource[0])); |
322 | if (!mem) | 315 | if (!mem) |
323 | goto failed; | 316 | goto failed; |
324 | 317 | ||
318 | /* We initialize the hermes structure before completing PCMCIA | ||
319 | * configuration just in case the interrupt handler gets | ||
320 | * called. */ | ||
325 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 321 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
326 | hw->eeprom_pda = true; | 322 | hw->eeprom_pda = true; |
327 | 323 | ||
324 | ret = pcmcia_request_irq(link, orinoco_interrupt); | ||
325 | if (ret) | ||
326 | goto failed; | ||
327 | |||
328 | /* | 328 | /* |
329 | * This actually configures the PCMCIA socket -- setting up | 329 | * This actually configures the PCMCIA socket -- setting up |
330 | * the I/O windows and the interrupt mapping, and putting the | 330 | * the I/O windows and the interrupt mapping, and putting the |
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c index cf7be1eb6124..56aab61fd4cb 100644 --- a/drivers/net/wireless/orinoco/wext.c +++ b/drivers/net/wireless/orinoco/wext.c | |||
@@ -904,10 +904,10 @@ static int orinoco_ioctl_set_auth(struct net_device *dev, | |||
904 | */ | 904 | */ |
905 | if (param->value) { | 905 | if (param->value) { |
906 | priv->tkip_cm_active = 1; | 906 | priv->tkip_cm_active = 1; |
907 | ret = hermes_enable_port(hw, 0); | 907 | ret = hermes_disable_port(hw, 0); |
908 | } else { | 908 | } else { |
909 | priv->tkip_cm_active = 0; | 909 | priv->tkip_cm_active = 0; |
910 | ret = hermes_disable_port(hw, 0); | 910 | ret = hermes_enable_port(hw, 0); |
911 | } | 911 | } |
912 | break; | 912 | break; |
913 | 913 | ||
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index 78347041ec40..0a7ce37aa628 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c | |||
@@ -260,8 +260,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
260 | list->max_entries = max_channel_num; | 260 | list->max_entries = max_channel_num; |
261 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * | 261 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * |
262 | max_channel_num, GFP_KERNEL); | 262 | max_channel_num, GFP_KERNEL); |
263 | if (!list->channels) | 263 | if (!list->channels) { |
264 | ret = -ENOMEM; | ||
264 | goto free; | 265 | goto free; |
266 | } | ||
265 | 267 | ||
266 | for (i = 0; i < max_channel_num; i++) { | 268 | for (i = 0; i < max_channel_num; i++) { |
267 | if (i < priv->iq_autocal_len) { | 269 | if (i < priv->iq_autocal_len) { |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index ad595958b7df..2325e56a9b0b 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -33,8 +33,18 @@ MODULE_ALIAS("prism54usb"); | |||
33 | MODULE_FIRMWARE("isl3886usb"); | 33 | MODULE_FIRMWARE("isl3886usb"); |
34 | MODULE_FIRMWARE("isl3887usb"); | 34 | MODULE_FIRMWARE("isl3887usb"); |
35 | 35 | ||
36 | /* | ||
37 | * Note: | ||
38 | * | ||
39 | * Always update our wiki's device list (located at: | ||
40 | * http://wireless.kernel.org/en/users/Drivers/p54/devices ), | ||
41 | * whenever you add a new device. | ||
42 | */ | ||
43 | |||
36 | static struct usb_device_id p54u_table[] __devinitdata = { | 44 | static struct usb_device_id p54u_table[] __devinitdata = { |
37 | /* Version 1 devices (pci chip + net2280) */ | 45 | /* Version 1 devices (pci chip + net2280) */ |
46 | {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ | ||
47 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ | ||
38 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ | 48 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ |
39 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ | 49 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ |
40 | {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ | 50 | {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ |
@@ -47,7 +57,13 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
47 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ | 57 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ |
48 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ | 58 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ |
49 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ | 59 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ |
60 | {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ | ||
61 | {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ | ||
50 | {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ | 62 | {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ |
63 | {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ | ||
64 | {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */ | ||
65 | {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ | ||
66 | {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */ | ||
51 | {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ | 67 | {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ |
52 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ | 68 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ |
53 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ | 69 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ |
@@ -60,6 +76,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
60 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ | 76 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ |
61 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ | 77 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ |
62 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ | 78 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ |
79 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ | ||
63 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | 80 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ |
64 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | 81 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
65 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | 82 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
@@ -80,7 +97,9 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
80 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | 97 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ |
81 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | 98 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ |
82 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 99 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
100 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ | ||
83 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 101 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
102 | {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ | ||
84 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ | 103 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ |
85 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ | 104 | {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ |
86 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ | 105 | {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */ |
@@ -930,8 +949,8 @@ static int __devinit p54u_probe(struct usb_interface *intf, | |||
930 | #ifdef CONFIG_PM | 949 | #ifdef CONFIG_PM |
931 | /* ISL3887 needs a full reset on resume */ | 950 | /* ISL3887 needs a full reset on resume */ |
932 | udev->reset_resume = 1; | 951 | udev->reset_resume = 1; |
952 | #endif /* CONFIG_PM */ | ||
933 | err = p54u_device_reset(dev); | 953 | err = p54u_device_reset(dev); |
934 | #endif | ||
935 | 954 | ||
936 | priv->hw_type = P54U_3887; | 955 | priv->hw_type = P54U_3887; |
937 | dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); | 956 | dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr); |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 0e937dc0c9c4..3d5311330b4a 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -618,7 +618,7 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb, | |||
618 | else | 618 | else |
619 | *burst_possible = false; | 619 | *burst_possible = false; |
620 | 620 | ||
621 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) | 621 | if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) |
622 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; | 622 | *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR; |
623 | 623 | ||
624 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) | 624 | if (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE) |
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 5063e01410e5..6a6cd7142e31 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1488,8 +1488,10 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1488 | spec->channels_info = info; | 1488 | spec->channels_info = info; |
1489 | 1489 | ||
1490 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1490 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1491 | for (i = 0; i < 14; i++) | 1491 | for (i = 0; i < 14; i++) { |
1492 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1492 | info[i].max_power = TXPOWER_FROM_DEV(MAX_TXPOWER); |
1493 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1494 | } | ||
1493 | 1495 | ||
1494 | return 0; | 1496 | return 0; |
1495 | } | 1497 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index c2a555d5376b..ec3e8b329a67 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1802,12 +1802,16 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1802 | spec->channels_info = info; | 1802 | spec->channels_info = info; |
1803 | 1803 | ||
1804 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1804 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1805 | for (i = 0; i < 14; i++) | 1805 | for (i = 0; i < 14; i++) { |
1806 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1806 | info[i].max_power = MAX_TXPOWER; |
1807 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1808 | } | ||
1807 | 1809 | ||
1808 | if (spec->num_channels > 14) { | 1810 | if (spec->num_channels > 14) { |
1809 | for (i = 14; i < spec->num_channels; i++) | 1811 | for (i = 14; i < spec->num_channels; i++) { |
1810 | info[i].tx_power1 = DEFAULT_TXPOWER; | 1812 | info[i].max_power = MAX_TXPOWER; |
1813 | info[i].default_power1 = DEFAULT_TXPOWER; | ||
1814 | } | ||
1811 | } | 1815 | } |
1812 | 1816 | ||
1813 | return 0; | 1817 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index cdaf93f48263..ed4de3f02d40 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1705,12 +1705,16 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
1705 | spec->channels_info = info; | 1705 | spec->channels_info = info; |
1706 | 1706 | ||
1707 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); | 1707 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_START); |
1708 | for (i = 0; i < 14; i++) | 1708 | for (i = 0; i < 14; i++) { |
1709 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 1709 | info[i].max_power = MAX_TXPOWER; |
1710 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
1711 | } | ||
1710 | 1712 | ||
1711 | if (spec->num_channels > 14) { | 1713 | if (spec->num_channels > 14) { |
1712 | for (i = 14; i < spec->num_channels; i++) | 1714 | for (i = 14; i < spec->num_channels; i++) { |
1713 | info[i].tx_power1 = DEFAULT_TXPOWER; | 1715 | info[i].max_power = MAX_TXPOWER; |
1716 | info[i].default_power1 = DEFAULT_TXPOWER; | ||
1717 | } | ||
1714 | } | 1718 | } |
1715 | 1719 | ||
1716 | return 0; | 1720 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index ed4ebcdde7c9..616b71a4ad1f 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -1841,6 +1841,13 @@ struct mac_iveiv_entry { | |||
1841 | #define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) | 1841 | #define EEPROM_RSSI_A2_LNA_A2 FIELD16(0xff00) |
1842 | 1842 | ||
1843 | /* | 1843 | /* |
1844 | * EEPROM Maximum TX power values | ||
1845 | */ | ||
1846 | #define EEPROM_MAX_TX_POWER 0x0027 | ||
1847 | #define EEPROM_MAX_TX_POWER_24GHZ FIELD16(0x00ff) | ||
1848 | #define EEPROM_MAX_TX_POWER_5GHZ FIELD16(0xff00) | ||
1849 | |||
1850 | /* | ||
1844 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. | 1851 | * EEPROM TXpower delta: 20MHZ AND 40 MHZ use different power. |
1845 | * This is delta in 40MHZ. | 1852 | * This is delta in 40MHZ. |
1846 | * VALUE: Tx Power dalta value (MAX=4) | 1853 | * VALUE: Tx Power dalta value (MAX=4) |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index b66e0fd8f0fa..60039d3fe0a0 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -1120,27 +1120,27 @@ static void rt2800_config_channel_rf2xxx(struct rt2x00_dev *rt2x00dev, | |||
1120 | * double meaning, and we should set a 7DBm boost flag. | 1120 | * double meaning, and we should set a 7DBm boost flag. |
1121 | */ | 1121 | */ |
1122 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, | 1122 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A_7DBM_BOOST, |
1123 | (info->tx_power1 >= 0)); | 1123 | (info->default_power1 >= 0)); |
1124 | 1124 | ||
1125 | if (info->tx_power1 < 0) | 1125 | if (info->default_power1 < 0) |
1126 | info->tx_power1 += 7; | 1126 | info->default_power1 += 7; |
1127 | 1127 | ||
1128 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, | 1128 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_A, |
1129 | TXPOWER_A_TO_DEV(info->tx_power1)); | 1129 | TXPOWER_A_TO_DEV(info->default_power1)); |
1130 | 1130 | ||
1131 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, | 1131 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A_7DBM_BOOST, |
1132 | (info->tx_power2 >= 0)); | 1132 | (info->default_power2 >= 0)); |
1133 | 1133 | ||
1134 | if (info->tx_power2 < 0) | 1134 | if (info->default_power2 < 0) |
1135 | info->tx_power2 += 7; | 1135 | info->default_power2 += 7; |
1136 | 1136 | ||
1137 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, | 1137 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_A, |
1138 | TXPOWER_A_TO_DEV(info->tx_power2)); | 1138 | TXPOWER_A_TO_DEV(info->default_power2)); |
1139 | } else { | 1139 | } else { |
1140 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, | 1140 | rt2x00_set_field32(&rf->rf3, RF3_TXPOWER_G, |
1141 | TXPOWER_G_TO_DEV(info->tx_power1)); | 1141 | TXPOWER_G_TO_DEV(info->default_power1)); |
1142 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, | 1142 | rt2x00_set_field32(&rf->rf4, RF4_TXPOWER_G, |
1143 | TXPOWER_G_TO_DEV(info->tx_power2)); | 1143 | TXPOWER_G_TO_DEV(info->default_power2)); |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); | 1146 | rt2x00_set_field32(&rf->rf4, RF4_HT40, conf_is_ht40(conf)); |
@@ -1180,13 +1180,11 @@ static void rt2800_config_channel_rf3xxx(struct rt2x00_dev *rt2x00dev, | |||
1180 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); | 1180 | rt2800_rfcsr_write(rt2x00dev, 6, rfcsr); |
1181 | 1181 | ||
1182 | rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); | 1182 | rt2800_rfcsr_read(rt2x00dev, 12, &rfcsr); |
1183 | rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, | 1183 | rt2x00_set_field8(&rfcsr, RFCSR12_TX_POWER, info->default_power1); |
1184 | TXPOWER_G_TO_DEV(info->tx_power1)); | ||
1185 | rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); | 1184 | rt2800_rfcsr_write(rt2x00dev, 12, rfcsr); |
1186 | 1185 | ||
1187 | rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); | 1186 | rt2800_rfcsr_read(rt2x00dev, 13, &rfcsr); |
1188 | rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, | 1187 | rt2x00_set_field8(&rfcsr, RFCSR13_TX_POWER, info->default_power2); |
1189 | TXPOWER_G_TO_DEV(info->tx_power2)); | ||
1190 | rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); | 1188 | rt2800_rfcsr_write(rt2x00dev, 13, rfcsr); |
1191 | 1189 | ||
1192 | rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); | 1190 | rt2800_rfcsr_read(rt2x00dev, 23, &rfcsr); |
@@ -2516,6 +2514,13 @@ int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2516 | default_lna_gain); | 2514 | default_lna_gain); |
2517 | rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); | 2515 | rt2x00_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word); |
2518 | 2516 | ||
2517 | rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &word); | ||
2518 | if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_24GHZ) == 0xff) | ||
2519 | rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_24GHZ, MAX_G_TXPOWER); | ||
2520 | if (rt2x00_get_field16(word, EEPROM_MAX_TX_POWER_5GHZ) == 0xff) | ||
2521 | rt2x00_set_field16(&word, EEPROM_MAX_TX_POWER_5GHZ, MAX_A_TXPOWER); | ||
2522 | rt2x00_eeprom_write(rt2x00dev, EEPROM_MAX_TX_POWER, word); | ||
2523 | |||
2519 | return 0; | 2524 | return 0; |
2520 | } | 2525 | } |
2521 | EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); | 2526 | EXPORT_SYMBOL_GPL(rt2800_validate_eeprom); |
@@ -2755,9 +2760,10 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2755 | { | 2760 | { |
2756 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 2761 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
2757 | struct channel_info *info; | 2762 | struct channel_info *info; |
2758 | char *tx_power1; | 2763 | char *default_power1; |
2759 | char *tx_power2; | 2764 | char *default_power2; |
2760 | unsigned int i; | 2765 | unsigned int i; |
2766 | unsigned short max_power; | ||
2761 | u16 eeprom; | 2767 | u16 eeprom; |
2762 | 2768 | ||
2763 | /* | 2769 | /* |
@@ -2871,21 +2877,26 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2871 | 2877 | ||
2872 | spec->channels_info = info; | 2878 | spec->channels_info = info; |
2873 | 2879 | ||
2874 | tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); | 2880 | rt2x00_eeprom_read(rt2x00dev, EEPROM_MAX_TX_POWER, &eeprom); |
2875 | tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); | 2881 | max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_24GHZ); |
2882 | default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); | ||
2883 | default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); | ||
2876 | 2884 | ||
2877 | for (i = 0; i < 14; i++) { | 2885 | for (i = 0; i < 14; i++) { |
2878 | info[i].tx_power1 = TXPOWER_G_FROM_DEV(tx_power1[i]); | 2886 | info[i].max_power = max_power; |
2879 | info[i].tx_power2 = TXPOWER_G_FROM_DEV(tx_power2[i]); | 2887 | info[i].default_power1 = TXPOWER_G_FROM_DEV(default_power1[i]); |
2888 | info[i].default_power2 = TXPOWER_G_FROM_DEV(default_power2[i]); | ||
2880 | } | 2889 | } |
2881 | 2890 | ||
2882 | if (spec->num_channels > 14) { | 2891 | if (spec->num_channels > 14) { |
2883 | tx_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); | 2892 | max_power = rt2x00_get_field16(eeprom, EEPROM_MAX_TX_POWER_5GHZ); |
2884 | tx_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); | 2893 | default_power1 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A1); |
2894 | default_power2 = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A2); | ||
2885 | 2895 | ||
2886 | for (i = 14; i < spec->num_channels; i++) { | 2896 | for (i = 14; i < spec->num_channels; i++) { |
2887 | info[i].tx_power1 = TXPOWER_A_FROM_DEV(tx_power1[i]); | 2897 | info[i].max_power = max_power; |
2888 | info[i].tx_power2 = TXPOWER_A_FROM_DEV(tx_power2[i]); | 2898 | info[i].default_power1 = TXPOWER_A_FROM_DEV(default_power1[i]); |
2899 | info[i].default_power2 = TXPOWER_A_FROM_DEV(default_power2[i]); | ||
2889 | } | 2900 | } |
2890 | } | 2901 | } |
2891 | 2902 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index c21af38cc5af..6b2b92bfbc6b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -212,8 +212,9 @@ struct channel_info { | |||
212 | unsigned int flags; | 212 | unsigned int flags; |
213 | #define GEOGRAPHY_ALLOWED 0x00000001 | 213 | #define GEOGRAPHY_ALLOWED 0x00000001 |
214 | 214 | ||
215 | short tx_power1; | 215 | short max_power; |
216 | short tx_power2; | 216 | short default_power1; |
217 | short default_power2; | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | /* | 220 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 585e8166f22a..19f86ce13df5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -710,7 +710,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
710 | for (i = 0; i < spec->num_channels; i++) { | 710 | for (i = 0; i < spec->num_channels; i++) { |
711 | rt2x00lib_channel(&channels[i], | 711 | rt2x00lib_channel(&channels[i], |
712 | spec->channels[i].channel, | 712 | spec->channels[i].channel, |
713 | spec->channels_info[i].tx_power1, i); | 713 | spec->channels_info[i].max_power, i); |
714 | } | 714 | } |
715 | 715 | ||
716 | /* | 716 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index e539c6cb636f..73d6382663b4 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2661,13 +2661,17 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2661 | spec->channels_info = info; | 2661 | spec->channels_info = info; |
2662 | 2662 | ||
2663 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); | 2663 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); |
2664 | for (i = 0; i < 14; i++) | 2664 | for (i = 0; i < 14; i++) { |
2665 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2665 | info[i].max_power = MAX_TXPOWER; |
2666 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2667 | } | ||
2666 | 2668 | ||
2667 | if (spec->num_channels > 14) { | 2669 | if (spec->num_channels > 14) { |
2668 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | 2670 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); |
2669 | for (i = 14; i < spec->num_channels; i++) | 2671 | for (i = 14; i < spec->num_channels; i++) { |
2670 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2672 | info[i].max_power = MAX_TXPOWER; |
2673 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2674 | } | ||
2671 | } | 2675 | } |
2672 | 2676 | ||
2673 | return 0; | 2677 | return 0; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index aa9de18fd410..c457d65f81a7 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2091,13 +2091,17 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2091 | spec->channels_info = info; | 2091 | spec->channels_info = info; |
2092 | 2092 | ||
2093 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); | 2093 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); |
2094 | for (i = 0; i < 14; i++) | 2094 | for (i = 0; i < 14; i++) { |
2095 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2095 | info[i].max_power = MAX_TXPOWER; |
2096 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2097 | } | ||
2096 | 2098 | ||
2097 | if (spec->num_channels > 14) { | 2099 | if (spec->num_channels > 14) { |
2098 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | 2100 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); |
2099 | for (i = 14; i < spec->num_channels; i++) | 2101 | for (i = 14; i < spec->num_channels; i++) { |
2100 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | 2102 | info[i].max_power = MAX_TXPOWER; |
2103 | info[i].default_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2104 | } | ||
2101 | } | 2105 | } |
2102 | 2106 | ||
2103 | return 0; | 2107 | return 0; |
@@ -2391,6 +2395,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2391 | { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, | 2395 | { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, |
2392 | { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, | 2396 | { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, |
2393 | { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, | 2397 | { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, |
2398 | { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2394 | /* Qcom */ | 2399 | /* Qcom */ |
2395 | { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, | 2400 | { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, |
2396 | { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, | 2401 | { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index b50fedcef8ac..42dad59cadb0 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -66,8 +66,8 @@ struct netfront_cb { | |||
66 | 66 | ||
67 | #define GRANT_INVALID_REF 0 | 67 | #define GRANT_INVALID_REF 0 |
68 | 68 | ||
69 | #define NET_TX_RING_SIZE __RING_SIZE((struct xen_netif_tx_sring *)0, PAGE_SIZE) | 69 | #define NET_TX_RING_SIZE __CONST_RING_SIZE(xen_netif_tx, PAGE_SIZE) |
70 | #define NET_RX_RING_SIZE __RING_SIZE((struct xen_netif_rx_sring *)0, PAGE_SIZE) | 70 | #define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE) |
71 | #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) | 71 | #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) |
72 | 72 | ||
73 | struct netfront_info { | 73 | struct netfront_info { |
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c index dc0ae4d14dff..010725117dbb 100644 --- a/drivers/oprofile/timer_int.c +++ b/drivers/oprofile/timer_int.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "oprof.h" | 21 | #include "oprof.h" |
22 | 22 | ||
23 | static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer); | 23 | static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer); |
24 | static int ctr_running; | ||
24 | 25 | ||
25 | static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer) | 26 | static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer) |
26 | { | 27 | { |
@@ -33,6 +34,9 @@ static void __oprofile_hrtimer_start(void *unused) | |||
33 | { | 34 | { |
34 | struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer); | 35 | struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer); |
35 | 36 | ||
37 | if (!ctr_running) | ||
38 | return; | ||
39 | |||
36 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 40 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
37 | hrtimer->function = oprofile_hrtimer_notify; | 41 | hrtimer->function = oprofile_hrtimer_notify; |
38 | 42 | ||
@@ -42,7 +46,10 @@ static void __oprofile_hrtimer_start(void *unused) | |||
42 | 46 | ||
43 | static int oprofile_hrtimer_start(void) | 47 | static int oprofile_hrtimer_start(void) |
44 | { | 48 | { |
49 | get_online_cpus(); | ||
50 | ctr_running = 1; | ||
45 | on_each_cpu(__oprofile_hrtimer_start, NULL, 1); | 51 | on_each_cpu(__oprofile_hrtimer_start, NULL, 1); |
52 | put_online_cpus(); | ||
46 | return 0; | 53 | return 0; |
47 | } | 54 | } |
48 | 55 | ||
@@ -50,6 +57,9 @@ static void __oprofile_hrtimer_stop(int cpu) | |||
50 | { | 57 | { |
51 | struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); | 58 | struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); |
52 | 59 | ||
60 | if (!ctr_running) | ||
61 | return; | ||
62 | |||
53 | hrtimer_cancel(hrtimer); | 63 | hrtimer_cancel(hrtimer); |
54 | } | 64 | } |
55 | 65 | ||
@@ -57,8 +67,11 @@ static void oprofile_hrtimer_stop(void) | |||
57 | { | 67 | { |
58 | int cpu; | 68 | int cpu; |
59 | 69 | ||
70 | get_online_cpus(); | ||
60 | for_each_online_cpu(cpu) | 71 | for_each_online_cpu(cpu) |
61 | __oprofile_hrtimer_stop(cpu); | 72 | __oprofile_hrtimer_stop(cpu); |
73 | ctr_running = 0; | ||
74 | put_online_cpus(); | ||
62 | } | 75 | } |
63 | 76 | ||
64 | static int __cpuinit oprofile_cpu_notify(struct notifier_block *self, | 77 | static int __cpuinit oprofile_cpu_notify(struct notifier_block *self, |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 0a19708074c2..a286959db67e 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -1414,6 +1414,11 @@ int __init enable_drhd_fault_handling(void) | |||
1414 | (unsigned long long)drhd->reg_base_addr, ret); | 1414 | (unsigned long long)drhd->reg_base_addr, ret); |
1415 | return -1; | 1415 | return -1; |
1416 | } | 1416 | } |
1417 | |||
1418 | /* | ||
1419 | * Clear any previous faults. | ||
1420 | */ | ||
1421 | dmar_fault(iommu->irq, iommu); | ||
1417 | } | 1422 | } |
1418 | 1423 | ||
1419 | return 0; | 1424 | return 0; |
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c index f7b68ca6cc98..4ae494bb1d50 100644 --- a/drivers/pci/pci-stub.c +++ b/drivers/pci/pci-stub.c | |||
@@ -54,6 +54,9 @@ static int __init pci_stub_init(void) | |||
54 | subdevice = PCI_ANY_ID, class=0, class_mask=0; | 54 | subdevice = PCI_ANY_ID, class=0, class_mask=0; |
55 | int fields; | 55 | int fields; |
56 | 56 | ||
57 | if (!strlen(id)) | ||
58 | continue; | ||
59 | |||
57 | fields = sscanf(id, "%x:%x:%x:%x:%x:%x", | 60 | fields = sscanf(id, "%x:%x:%x:%x:%x:%x", |
58 | &vendor, &device, &subvendor, &subdevice, | 61 | &vendor, &device, &subvendor, &subdevice, |
59 | &class, &class_mask); | 62 | &class, &class_mask); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index b5a7d9bfcb24..4835a02ec017 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -705,17 +705,21 @@ void pci_remove_legacy_files(struct pci_bus *b) | |||
705 | 705 | ||
706 | #ifdef HAVE_PCI_MMAP | 706 | #ifdef HAVE_PCI_MMAP |
707 | 707 | ||
708 | int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) | 708 | int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma, |
709 | enum pci_mmap_api mmap_api) | ||
709 | { | 710 | { |
710 | unsigned long nr, start, size; | 711 | unsigned long nr, start, size, pci_start; |
711 | 712 | ||
713 | if (pci_resource_len(pdev, resno) == 0) | ||
714 | return 0; | ||
712 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 715 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
713 | start = vma->vm_pgoff; | 716 | start = vma->vm_pgoff; |
714 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; | 717 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; |
715 | if (start < size && size - start >= nr) | 718 | pci_start = (mmap_api == PCI_MMAP_PROCFS) ? |
719 | pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0; | ||
720 | if (start >= pci_start && start < pci_start + size && | ||
721 | start + nr <= pci_start + size) | ||
716 | return 1; | 722 | return 1; |
717 | WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", | ||
718 | current->comm, start, start+nr, pci_name(pdev), resno, size); | ||
719 | return 0; | 723 | return 0; |
720 | } | 724 | } |
721 | 725 | ||
@@ -745,8 +749,14 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, | |||
745 | if (i >= PCI_ROM_RESOURCE) | 749 | if (i >= PCI_ROM_RESOURCE) |
746 | return -ENODEV; | 750 | return -ENODEV; |
747 | 751 | ||
748 | if (!pci_mmap_fits(pdev, i, vma)) | 752 | if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { |
753 | WARN(1, "process \"%s\" tried to map 0x%08lx bytes " | ||
754 | "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", | ||
755 | current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, | ||
756 | pci_name(pdev), i, | ||
757 | pci_resource_start(pdev, i), pci_resource_len(pdev, i)); | ||
749 | return -EINVAL; | 758 | return -EINVAL; |
759 | } | ||
750 | 760 | ||
751 | /* pci_mmap_page_range() expects the same kind of entry as coming | 761 | /* pci_mmap_page_range() expects the same kind of entry as coming |
752 | * from /proc/bus/pci/ which is a "user visible" value. If this is | 762 | * from /proc/bus/pci/ which is a "user visible" value. If this is |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 6beb11b617a9..1001b1d7e041 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -22,8 +22,13 @@ extern void pci_remove_firmware_label_files(struct pci_dev *pdev); | |||
22 | #endif | 22 | #endif |
23 | extern void pci_cleanup_rom(struct pci_dev *dev); | 23 | extern void pci_cleanup_rom(struct pci_dev *dev); |
24 | #ifdef HAVE_PCI_MMAP | 24 | #ifdef HAVE_PCI_MMAP |
25 | enum pci_mmap_api { | ||
26 | PCI_MMAP_SYSFS, /* mmap on /sys/bus/pci/devices/<BDF>/resource<N> */ | ||
27 | PCI_MMAP_PROCFS /* mmap on /proc/bus/pci/<BDF> */ | ||
28 | }; | ||
25 | extern int pci_mmap_fits(struct pci_dev *pdev, int resno, | 29 | extern int pci_mmap_fits(struct pci_dev *pdev, int resno, |
26 | struct vm_area_struct *vma); | 30 | struct vm_area_struct *vmai, |
31 | enum pci_mmap_api mmap_api); | ||
27 | #endif | 32 | #endif |
28 | int pci_probe_reset_function(struct pci_dev *dev); | 33 | int pci_probe_reset_function(struct pci_dev *dev); |
29 | 34 | ||
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 01f0306525a5..4aae016c79d0 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -260,7 +260,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) | |||
260 | 260 | ||
261 | /* Make sure the caller is mapping a real resource for this device */ | 261 | /* Make sure the caller is mapping a real resource for this device */ |
262 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { | 262 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { |
263 | if (pci_mmap_fits(dev, i, vma)) | 263 | if (pci_mmap_fits(dev, i, vma, PCI_MMAP_PROCFS)) |
264 | break; | 264 | break; |
265 | } | 265 | } |
266 | 266 | ||
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 857ae01734a6..32ae8188c094 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -2714,6 +2714,29 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_m | |||
2714 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | 2714 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); |
2715 | #endif /*CONFIG_MMC_RICOH_MMC*/ | 2715 | #endif /*CONFIG_MMC_RICOH_MMC*/ |
2716 | 2716 | ||
2717 | #if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) | ||
2718 | #define VTUNCERRMSK_REG 0x1ac | ||
2719 | #define VTD_MSK_SPEC_ERRORS (1 << 31) | ||
2720 | /* | ||
2721 | * This is a quirk for masking vt-d spec defined errors to platform error | ||
2722 | * handling logic. With out this, platforms using Intel 7500, 5500 chipsets | ||
2723 | * (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based | ||
2724 | * on the RAS config settings of the platform) when a vt-d fault happens. | ||
2725 | * The resulting SMI caused the system to hang. | ||
2726 | * | ||
2727 | * VT-d spec related errors are already handled by the VT-d OS code, so no | ||
2728 | * need to report the same error through other channels. | ||
2729 | */ | ||
2730 | static void vtd_mask_spec_errors(struct pci_dev *dev) | ||
2731 | { | ||
2732 | u32 word; | ||
2733 | |||
2734 | pci_read_config_dword(dev, VTUNCERRMSK_REG, &word); | ||
2735 | pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS); | ||
2736 | } | ||
2737 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, vtd_mask_spec_errors); | ||
2738 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors); | ||
2739 | #endif | ||
2717 | 2740 | ||
2718 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, | 2741 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, |
2719 | struct pci_fixup *end) | 2742 | struct pci_fixup *end) |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 6f1a86b43c60..fd4c25ac18ec 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -65,6 +65,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, | |||
65 | va_end(args); | 65 | va_end(args); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | EXPORT_SYMBOL(soc_pcmcia_debug); | ||
68 | 69 | ||
69 | #endif | 70 | #endif |
70 | 71 | ||
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index b756e07d41b4..e8acb1c7b194 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -1065,9 +1065,9 @@ static ssize_t store_gps(struct device *dev, struct device_attribute *attr, | |||
1065 | */ | 1065 | */ |
1066 | static int asus_gps_rfkill_set(void *data, bool blocked) | 1066 | static int asus_gps_rfkill_set(void *data, bool blocked) |
1067 | { | 1067 | { |
1068 | acpi_handle handle = data; | 1068 | struct asus_laptop *asus = data; |
1069 | 1069 | ||
1070 | return asus_gps_switch(handle, !blocked); | 1070 | return asus_gps_switch(asus, !blocked); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | static const struct rfkill_ops asus_gps_rfkill_ops = { | 1073 | static const struct rfkill_ops asus_gps_rfkill_ops = { |
@@ -1094,7 +1094,7 @@ static int asus_rfkill_init(struct asus_laptop *asus) | |||
1094 | 1094 | ||
1095 | asus->gps_rfkill = rfkill_alloc("asus-gps", &asus->platform_device->dev, | 1095 | asus->gps_rfkill = rfkill_alloc("asus-gps", &asus->platform_device->dev, |
1096 | RFKILL_TYPE_GPS, | 1096 | RFKILL_TYPE_GPS, |
1097 | &asus_gps_rfkill_ops, NULL); | 1097 | &asus_gps_rfkill_ops, asus); |
1098 | if (!asus->gps_rfkill) | 1098 | if (!asus->gps_rfkill) |
1099 | return -EINVAL; | 1099 | return -EINVAL; |
1100 | 1100 | ||
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index c44a5e8b8b82..f0b3ad13c273 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -75,6 +75,7 @@ | |||
75 | #include <drm/i915_drm.h> | 75 | #include <drm/i915_drm.h> |
76 | #include <asm/msr.h> | 76 | #include <asm/msr.h> |
77 | #include <asm/processor.h> | 77 | #include <asm/processor.h> |
78 | #include "intel_ips.h" | ||
78 | 79 | ||
79 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 | 80 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 |
80 | 81 | ||
@@ -245,6 +246,7 @@ | |||
245 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) | 246 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) |
246 | 247 | ||
247 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ | 248 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ |
249 | static bool late_i915_load = false; | ||
248 | 250 | ||
249 | /* For initial average collection */ | 251 | /* For initial average collection */ |
250 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ | 252 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ |
@@ -339,6 +341,9 @@ struct ips_driver { | |||
339 | u64 orig_turbo_ratios; | 341 | u64 orig_turbo_ratios; |
340 | }; | 342 | }; |
341 | 343 | ||
344 | static bool | ||
345 | ips_gpu_turbo_enabled(struct ips_driver *ips); | ||
346 | |||
342 | /** | 347 | /** |
343 | * ips_cpu_busy - is CPU busy? | 348 | * ips_cpu_busy - is CPU busy? |
344 | * @ips: IPS driver struct | 349 | * @ips: IPS driver struct |
@@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) | |||
517 | */ | 522 | */ |
518 | static bool ips_gpu_busy(struct ips_driver *ips) | 523 | static bool ips_gpu_busy(struct ips_driver *ips) |
519 | { | 524 | { |
520 | if (!ips->gpu_turbo_enabled) | 525 | if (!ips_gpu_turbo_enabled(ips)) |
521 | return false; | 526 | return false; |
522 | 527 | ||
523 | return ips->gpu_busy(); | 528 | return ips->gpu_busy(); |
@@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips) | |||
532 | */ | 537 | */ |
533 | static void ips_gpu_raise(struct ips_driver *ips) | 538 | static void ips_gpu_raise(struct ips_driver *ips) |
534 | { | 539 | { |
535 | if (!ips->gpu_turbo_enabled) | 540 | if (!ips_gpu_turbo_enabled(ips)) |
536 | return; | 541 | return; |
537 | 542 | ||
538 | if (!ips->gpu_raise()) | 543 | if (!ips->gpu_raise()) |
@@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips) | |||
549 | */ | 554 | */ |
550 | static void ips_gpu_lower(struct ips_driver *ips) | 555 | static void ips_gpu_lower(struct ips_driver *ips) |
551 | { | 556 | { |
552 | if (!ips->gpu_turbo_enabled) | 557 | if (!ips_gpu_turbo_enabled(ips)) |
553 | return; | 558 | return; |
554 | 559 | ||
555 | if (!ips->gpu_lower()) | 560 | if (!ips->gpu_lower()) |
@@ -1454,6 +1459,31 @@ out_err: | |||
1454 | return false; | 1459 | return false; |
1455 | } | 1460 | } |
1456 | 1461 | ||
1462 | static bool | ||
1463 | ips_gpu_turbo_enabled(struct ips_driver *ips) | ||
1464 | { | ||
1465 | if (!ips->gpu_busy && late_i915_load) { | ||
1466 | if (ips_get_i915_syms(ips)) { | ||
1467 | dev_info(&ips->dev->dev, | ||
1468 | "i915 driver attached, reenabling gpu turbo\n"); | ||
1469 | ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS); | ||
1470 | } | ||
1471 | } | ||
1472 | |||
1473 | return ips->gpu_turbo_enabled; | ||
1474 | } | ||
1475 | |||
1476 | void | ||
1477 | ips_link_to_i915_driver() | ||
1478 | { | ||
1479 | /* We can't cleanly get at the various ips_driver structs from | ||
1480 | * this caller (the i915 driver), so just set a flag saying | ||
1481 | * that it's time to try getting the symbols again. | ||
1482 | */ | ||
1483 | late_i915_load = true; | ||
1484 | } | ||
1485 | EXPORT_SYMBOL_GPL(ips_link_to_i915_driver); | ||
1486 | |||
1457 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { | 1487 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { |
1458 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | 1488 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, |
1459 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, | 1489 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index b2978a04317f..677783475d84 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -801,7 +801,7 @@ static bool guid_already_parsed(const char *guid_string) | |||
801 | wblock = list_entry(p, struct wmi_block, list); | 801 | wblock = list_entry(p, struct wmi_block, list); |
802 | gblock = &wblock->gblock; | 802 | gblock = &wblock->gblock; |
803 | 803 | ||
804 | if (strncmp(gblock->guid, guid_string, 16) == 0) | 804 | if (memcmp(gblock->guid, guid_string, 16) == 0) |
805 | return true; | 805 | return true; |
806 | } | 806 | } |
807 | return false; | 807 | return false; |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index dc4e32e031e9..0d943eea1c2d 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "../base.h" | 28 | #include "../base.h" |
29 | #include "pnpacpi.h" | 29 | #include "pnpacpi.h" |
30 | 30 | ||
31 | static int num = 0; | 31 | static int num; |
32 | 32 | ||
33 | /* We need only to blacklist devices that have already an acpi driver that | 33 | /* We need only to blacklist devices that have already an acpi driver that |
34 | * can't use pnp layer. We don't need to blacklist device that are directly | 34 | * can't use pnp layer. We don't need to blacklist device that are directly |
@@ -180,11 +180,24 @@ struct pnp_protocol pnpacpi_protocol = { | |||
180 | }; | 180 | }; |
181 | EXPORT_SYMBOL(pnpacpi_protocol); | 181 | EXPORT_SYMBOL(pnpacpi_protocol); |
182 | 182 | ||
183 | static char *pnpacpi_get_id(struct acpi_device *device) | ||
184 | { | ||
185 | struct acpi_hardware_id *id; | ||
186 | |||
187 | list_for_each_entry(id, &device->pnp.ids, list) { | ||
188 | if (ispnpidacpi(id->id)) | ||
189 | return id->id; | ||
190 | } | ||
191 | |||
192 | return NULL; | ||
193 | } | ||
194 | |||
183 | static int __init pnpacpi_add_device(struct acpi_device *device) | 195 | static int __init pnpacpi_add_device(struct acpi_device *device) |
184 | { | 196 | { |
185 | acpi_handle temp = NULL; | 197 | acpi_handle temp = NULL; |
186 | acpi_status status; | 198 | acpi_status status; |
187 | struct pnp_dev *dev; | 199 | struct pnp_dev *dev; |
200 | char *pnpid; | ||
188 | struct acpi_hardware_id *id; | 201 | struct acpi_hardware_id *id; |
189 | 202 | ||
190 | /* | 203 | /* |
@@ -192,11 +205,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
192 | * driver should not be loaded. | 205 | * driver should not be loaded. |
193 | */ | 206 | */ |
194 | status = acpi_get_handle(device->handle, "_CRS", &temp); | 207 | status = acpi_get_handle(device->handle, "_CRS", &temp); |
195 | if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || | 208 | if (ACPI_FAILURE(status)) |
196 | is_exclusive_device(device) || (!device->status.present)) | 209 | return 0; |
210 | |||
211 | pnpid = pnpacpi_get_id(device); | ||
212 | if (!pnpid) | ||
213 | return 0; | ||
214 | |||
215 | if (is_exclusive_device(device) || !device->status.present) | ||
197 | return 0; | 216 | return 0; |
198 | 217 | ||
199 | dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); | 218 | dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid); |
200 | if (!dev) | 219 | if (!dev) |
201 | return -ENOMEM; | 220 | return -ENOMEM; |
202 | 221 | ||
@@ -227,7 +246,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
227 | pnpacpi_parse_resource_option_data(dev); | 246 | pnpacpi_parse_resource_option_data(dev); |
228 | 247 | ||
229 | list_for_each_entry(id, &device->pnp.ids, list) { | 248 | list_for_each_entry(id, &device->pnp.ids, list) { |
230 | if (!strcmp(id->id, acpi_device_hid(device))) | 249 | if (!strcmp(id->id, pnpid)) |
231 | continue; | 250 | continue; |
232 | if (!ispnpidacpi(id->id)) | 251 | if (!ispnpidacpi(id->id)) |
233 | continue; | 252 | continue; |
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c index 4d3b27228a2e..c8d26df9f145 100644 --- a/drivers/power/ds2760_battery.c +++ b/drivers/power/ds2760_battery.c | |||
@@ -212,7 +212,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di) | |||
212 | if (di->rem_capacity > 100) | 212 | if (di->rem_capacity > 100) |
213 | di->rem_capacity = 100; | 213 | di->rem_capacity = 100; |
214 | 214 | ||
215 | if (di->current_uA >= 100L) | 215 | if (di->current_uA < -100L) |
216 | di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) | 216 | di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) |
217 | / (di->current_uA / 100L); | 217 | / (di->current_uA / 100L); |
218 | else | 218 | else |
diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c index 20c4b952e9bd..a74cb0ac3d48 100644 --- a/drivers/power/jz4740-battery.c +++ b/drivers/power/jz4740-battery.c | |||
@@ -47,6 +47,8 @@ struct jz_battery { | |||
47 | 47 | ||
48 | struct power_supply battery; | 48 | struct power_supply battery; |
49 | struct delayed_work work; | 49 | struct delayed_work work; |
50 | |||
51 | struct mutex lock; | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) | 54 | static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) |
@@ -68,6 +70,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) | |||
68 | unsigned long val; | 70 | unsigned long val; |
69 | long voltage; | 71 | long voltage; |
70 | 72 | ||
73 | mutex_lock(&battery->lock); | ||
74 | |||
71 | INIT_COMPLETION(battery->read_completion); | 75 | INIT_COMPLETION(battery->read_completion); |
72 | 76 | ||
73 | enable_irq(battery->irq); | 77 | enable_irq(battery->irq); |
@@ -91,6 +95,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) | |||
91 | battery->cell->disable(battery->pdev); | 95 | battery->cell->disable(battery->pdev); |
92 | disable_irq(battery->irq); | 96 | disable_irq(battery->irq); |
93 | 97 | ||
98 | mutex_unlock(&battery->lock); | ||
99 | |||
94 | return voltage; | 100 | return voltage; |
95 | } | 101 | } |
96 | 102 | ||
@@ -291,6 +297,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev) | |||
291 | jz_battery->pdev = pdev; | 297 | jz_battery->pdev = pdev; |
292 | 298 | ||
293 | init_completion(&jz_battery->read_completion); | 299 | init_completion(&jz_battery->read_completion); |
300 | mutex_init(&jz_battery->lock); | ||
294 | 301 | ||
295 | INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); | 302 | INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); |
296 | 303 | ||
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index aafc1c506eda..5bc1dcf7785e 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c | |||
@@ -271,14 +271,14 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
271 | if (ret) | 271 | if (ret) |
272 | return ret; | 272 | return ret; |
273 | 273 | ||
274 | val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32; | 274 | val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32; |
275 | break; | 275 | break; |
276 | case POWER_SUPPLY_PROP_CURRENT_AVG: | 276 | case POWER_SUPPLY_PROP_CURRENT_AVG: |
277 | ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); | 277 | ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); |
278 | if (ret) | 278 | if (ret) |
279 | return ret; | 279 | return ret; |
280 | 280 | ||
281 | val->intval = (int)be16_to_cpu(ec_word) * 15625L / 120; | 281 | val->intval = (s16)be16_to_cpu(ec_word) * 15625L / 120; |
282 | break; | 282 | break; |
283 | case POWER_SUPPLY_PROP_CAPACITY: | 283 | case POWER_SUPPLY_PROP_CAPACITY: |
284 | ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1); | 284 | ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1); |
@@ -299,7 +299,7 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
299 | if (ret) | 299 | if (ret) |
300 | return ret; | 300 | return ret; |
301 | 301 | ||
302 | val->intval = (int)be16_to_cpu(ec_word) * 100 / 256; | 302 | val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256; |
303 | break; | 303 | break; |
304 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: | 304 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: |
305 | ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); | 305 | ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); |
@@ -313,7 +313,7 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
313 | if (ret) | 313 | if (ret) |
314 | return ret; | 314 | return ret; |
315 | 315 | ||
316 | val->intval = (int)be16_to_cpu(ec_word) * 6250 / 15; | 316 | val->intval = (s16)be16_to_cpu(ec_word) * 6250 / 15; |
317 | break; | 317 | break; |
318 | case POWER_SUPPLY_PROP_SERIAL_NUMBER: | 318 | case POWER_SUPPLY_PROP_SERIAL_NUMBER: |
319 | ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); | 319 | ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 5856167a0c90..dd8242d489b8 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/mod_devicetable.h> | 37 | #include <linux/mod_devicetable.h> |
38 | #include <linux/log2.h> | 38 | #include <linux/log2.h> |
39 | #include <linux/pm.h> | ||
39 | 40 | ||
40 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ | 41 | /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ |
41 | #include <asm-generic/rtc.h> | 42 | #include <asm-generic/rtc.h> |
@@ -850,7 +851,7 @@ static void __exit cmos_do_remove(struct device *dev) | |||
850 | 851 | ||
851 | #ifdef CONFIG_PM | 852 | #ifdef CONFIG_PM |
852 | 853 | ||
853 | static int cmos_suspend(struct device *dev, pm_message_t mesg) | 854 | static int cmos_suspend(struct device *dev) |
854 | { | 855 | { |
855 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 856 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
856 | unsigned char tmp; | 857 | unsigned char tmp; |
@@ -898,7 +899,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) | |||
898 | */ | 899 | */ |
899 | static inline int cmos_poweroff(struct device *dev) | 900 | static inline int cmos_poweroff(struct device *dev) |
900 | { | 901 | { |
901 | return cmos_suspend(dev, PMSG_HIBERNATE); | 902 | return cmos_suspend(dev); |
902 | } | 903 | } |
903 | 904 | ||
904 | static int cmos_resume(struct device *dev) | 905 | static int cmos_resume(struct device *dev) |
@@ -945,9 +946,9 @@ static int cmos_resume(struct device *dev) | |||
945 | return 0; | 946 | return 0; |
946 | } | 947 | } |
947 | 948 | ||
949 | static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume); | ||
950 | |||
948 | #else | 951 | #else |
949 | #define cmos_suspend NULL | ||
950 | #define cmos_resume NULL | ||
951 | 952 | ||
952 | static inline int cmos_poweroff(struct device *dev) | 953 | static inline int cmos_poweroff(struct device *dev) |
953 | { | 954 | { |
@@ -1077,7 +1078,7 @@ static void __exit cmos_pnp_remove(struct pnp_dev *pnp) | |||
1077 | 1078 | ||
1078 | static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg) | 1079 | static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg) |
1079 | { | 1080 | { |
1080 | return cmos_suspend(&pnp->dev, mesg); | 1081 | return cmos_suspend(&pnp->dev); |
1081 | } | 1082 | } |
1082 | 1083 | ||
1083 | static int cmos_pnp_resume(struct pnp_dev *pnp) | 1084 | static int cmos_pnp_resume(struct pnp_dev *pnp) |
@@ -1157,8 +1158,9 @@ static struct platform_driver cmos_platform_driver = { | |||
1157 | .shutdown = cmos_platform_shutdown, | 1158 | .shutdown = cmos_platform_shutdown, |
1158 | .driver = { | 1159 | .driver = { |
1159 | .name = (char *) driver_name, | 1160 | .name = (char *) driver_name, |
1160 | .suspend = cmos_suspend, | 1161 | #ifdef CONFIG_PM |
1161 | .resume = cmos_resume, | 1162 | .pm = &cmos_pm_ops, |
1163 | #endif | ||
1162 | } | 1164 | } |
1163 | }; | 1165 | }; |
1164 | 1166 | ||
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 90cf0a6ff23e..dd14e202c2c8 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -207,7 +207,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
207 | static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) | 207 | static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) |
208 | { | 208 | { |
209 | struct rs5c372 *rs5c = i2c_get_clientdata(client); | 209 | struct rs5c372 *rs5c = i2c_get_clientdata(client); |
210 | unsigned char buf[8]; | 210 | unsigned char buf[7]; |
211 | int addr; | 211 | int addr; |
212 | 212 | ||
213 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " | 213 | dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d " |
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index f0037eefd44e..142af5bc3a4f 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
@@ -91,6 +91,12 @@ enum qdio_irq_states { | |||
91 | #define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ | 91 | #define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ |
92 | #define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ | 92 | #define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ |
93 | 93 | ||
94 | /* SIGA flags */ | ||
95 | #define QDIO_SIGA_WRITE 0x00 | ||
96 | #define QDIO_SIGA_READ 0x01 | ||
97 | #define QDIO_SIGA_SYNC 0x02 | ||
98 | #define QDIO_SIGA_QEBSM_FLAG 0x80 | ||
99 | |||
94 | #ifdef CONFIG_64BIT | 100 | #ifdef CONFIG_64BIT |
95 | static inline int do_sqbs(u64 token, unsigned char state, int queue, | 101 | static inline int do_sqbs(u64 token, unsigned char state, int queue, |
96 | int *start, int *count) | 102 | int *start, int *count) |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 00520f9a7a8e..1763afcd89ec 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -29,11 +29,12 @@ MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>,"\ | |||
29 | MODULE_DESCRIPTION("QDIO base support"); | 29 | MODULE_DESCRIPTION("QDIO base support"); |
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
32 | static inline int do_siga_sync(struct subchannel_id schid, | 32 | static inline int do_siga_sync(unsigned long schid, |
33 | unsigned int out_mask, unsigned int in_mask) | 33 | unsigned int out_mask, unsigned int in_mask, |
34 | unsigned int fc) | ||
34 | { | 35 | { |
35 | register unsigned long __fc asm ("0") = 2; | 36 | register unsigned long __fc asm ("0") = fc; |
36 | register struct subchannel_id __schid asm ("1") = schid; | 37 | register unsigned long __schid asm ("1") = schid; |
37 | register unsigned long out asm ("2") = out_mask; | 38 | register unsigned long out asm ("2") = out_mask; |
38 | register unsigned long in asm ("3") = in_mask; | 39 | register unsigned long in asm ("3") = in_mask; |
39 | int cc; | 40 | int cc; |
@@ -47,10 +48,11 @@ static inline int do_siga_sync(struct subchannel_id schid, | |||
47 | return cc; | 48 | return cc; |
48 | } | 49 | } |
49 | 50 | ||
50 | static inline int do_siga_input(struct subchannel_id schid, unsigned int mask) | 51 | static inline int do_siga_input(unsigned long schid, unsigned int mask, |
52 | unsigned int fc) | ||
51 | { | 53 | { |
52 | register unsigned long __fc asm ("0") = 1; | 54 | register unsigned long __fc asm ("0") = fc; |
53 | register struct subchannel_id __schid asm ("1") = schid; | 55 | register unsigned long __schid asm ("1") = schid; |
54 | register unsigned long __mask asm ("2") = mask; | 56 | register unsigned long __mask asm ("2") = mask; |
55 | int cc; | 57 | int cc; |
56 | 58 | ||
@@ -279,6 +281,8 @@ void qdio_init_buf_states(struct qdio_irq *irq_ptr) | |||
279 | static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, | 281 | static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, |
280 | unsigned int input) | 282 | unsigned int input) |
281 | { | 283 | { |
284 | unsigned long schid = *((u32 *) &q->irq_ptr->schid); | ||
285 | unsigned int fc = QDIO_SIGA_SYNC; | ||
282 | int cc; | 286 | int cc; |
283 | 287 | ||
284 | if (!need_siga_sync(q)) | 288 | if (!need_siga_sync(q)) |
@@ -287,7 +291,12 @@ static inline int qdio_siga_sync(struct qdio_q *q, unsigned int output, | |||
287 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); | 291 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-s:%1d", q->nr); |
288 | qperf_inc(q, siga_sync); | 292 | qperf_inc(q, siga_sync); |
289 | 293 | ||
290 | cc = do_siga_sync(q->irq_ptr->schid, output, input); | 294 | if (is_qebsm(q)) { |
295 | schid = q->irq_ptr->sch_token; | ||
296 | fc |= QDIO_SIGA_QEBSM_FLAG; | ||
297 | } | ||
298 | |||
299 | cc = do_siga_sync(schid, output, input, fc); | ||
291 | if (cc) | 300 | if (cc) |
292 | DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc); | 301 | DBF_ERROR("%4x SIGA-S:%2d", SCH_NO(q), cc); |
293 | return cc; | 302 | return cc; |
@@ -313,8 +322,8 @@ static inline int qdio_siga_sync_all(struct qdio_q *q) | |||
313 | 322 | ||
314 | static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) | 323 | static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) |
315 | { | 324 | { |
316 | unsigned long schid; | 325 | unsigned long schid = *((u32 *) &q->irq_ptr->schid); |
317 | unsigned int fc = 0; | 326 | unsigned int fc = QDIO_SIGA_WRITE; |
318 | u64 start_time = 0; | 327 | u64 start_time = 0; |
319 | int cc; | 328 | int cc; |
320 | 329 | ||
@@ -323,11 +332,8 @@ static int qdio_siga_output(struct qdio_q *q, unsigned int *busy_bit) | |||
323 | 332 | ||
324 | if (is_qebsm(q)) { | 333 | if (is_qebsm(q)) { |
325 | schid = q->irq_ptr->sch_token; | 334 | schid = q->irq_ptr->sch_token; |
326 | fc |= 0x80; | 335 | fc |= QDIO_SIGA_QEBSM_FLAG; |
327 | } | 336 | } |
328 | else | ||
329 | schid = *((u32 *)&q->irq_ptr->schid); | ||
330 | |||
331 | again: | 337 | again: |
332 | cc = do_siga_output(schid, q->mask, busy_bit, fc); | 338 | cc = do_siga_output(schid, q->mask, busy_bit, fc); |
333 | 339 | ||
@@ -347,12 +353,19 @@ again: | |||
347 | 353 | ||
348 | static inline int qdio_siga_input(struct qdio_q *q) | 354 | static inline int qdio_siga_input(struct qdio_q *q) |
349 | { | 355 | { |
356 | unsigned long schid = *((u32 *) &q->irq_ptr->schid); | ||
357 | unsigned int fc = QDIO_SIGA_READ; | ||
350 | int cc; | 358 | int cc; |
351 | 359 | ||
352 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); | 360 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "siga-r:%1d", q->nr); |
353 | qperf_inc(q, siga_read); | 361 | qperf_inc(q, siga_read); |
354 | 362 | ||
355 | cc = do_siga_input(q->irq_ptr->schid, q->mask); | 363 | if (is_qebsm(q)) { |
364 | schid = q->irq_ptr->sch_token; | ||
365 | fc |= QDIO_SIGA_QEBSM_FLAG; | ||
366 | } | ||
367 | |||
368 | cc = do_siga_input(schid, q->mask, fc); | ||
356 | if (cc) | 369 | if (cc) |
357 | DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc); | 370 | DBF_ERROR("%4x SIGA-R:%2d", SCH_NO(q), cc); |
358 | return cc; | 371 | return cc; |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index b860d650a563..4cf7ffa2dad3 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -4175,6 +4175,14 @@ static int ioc_general(void __user *arg, char *cmnd) | |||
4175 | ha = gdth_find_ha(gen.ionode); | 4175 | ha = gdth_find_ha(gen.ionode); |
4176 | if (!ha) | 4176 | if (!ha) |
4177 | return -EFAULT; | 4177 | return -EFAULT; |
4178 | |||
4179 | if (gen.data_len > INT_MAX) | ||
4180 | return -EINVAL; | ||
4181 | if (gen.sense_len > INT_MAX) | ||
4182 | return -EINVAL; | ||
4183 | if (gen.data_len + gen.sense_len > INT_MAX) | ||
4184 | return -EINVAL; | ||
4185 | |||
4178 | if (gen.data_len + gen.sense_len != 0) { | 4186 | if (gen.data_len + gen.sense_len != 0) { |
4179 | if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, | 4187 | if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, |
4180 | FALSE, &paddr))) | 4188 | FALSE, &paddr))) |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 042153cbbde1..ddbade7beec9 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -347,6 +347,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in, | |||
347 | static struct ata_port_operations sas_sata_ops = { | 347 | static struct ata_port_operations sas_sata_ops = { |
348 | .phy_reset = sas_ata_phy_reset, | 348 | .phy_reset = sas_ata_phy_reset, |
349 | .post_internal_cmd = sas_ata_post_internal, | 349 | .post_internal_cmd = sas_ata_post_internal, |
350 | .qc_defer = ata_std_qc_defer, | ||
350 | .qc_prep = ata_noop_qc_prep, | 351 | .qc_prep = ata_noop_qc_prep, |
351 | .qc_issue = sas_ata_qc_issue, | 352 | .qc_issue = sas_ata_qc_issue, |
352 | .qc_fill_rtf = sas_ata_qc_fill_rtf, | 353 | .qc_fill_rtf = sas_ata_qc_fill_rtf, |
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index f0cfba9a1fc8..baf2b6039952 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c | |||
@@ -649,6 +649,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost) | |||
649 | 649 | ||
650 | spin_lock_irqsave(shost->host_lock, flags); | 650 | spin_lock_irqsave(shost->host_lock, flags); |
651 | list_splice_init(&shost->eh_cmd_q, &eh_work_q); | 651 | list_splice_init(&shost->eh_cmd_q, &eh_work_q); |
652 | shost->host_eh_scheduled = 0; | ||
652 | spin_unlock_irqrestore(shost->host_lock, flags); | 653 | spin_unlock_irqrestore(shost->host_lock, flags); |
653 | 654 | ||
654 | SAS_DPRINTK("Enter %s\n", __func__); | 655 | SAS_DPRINTK("Enter %s\n", __func__); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 57bcd5c9dcff..9e590265a020 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -2057,9 +2057,9 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2057 | /* adjust hba_queue_depth, reply_free_queue_depth, | 2057 | /* adjust hba_queue_depth, reply_free_queue_depth, |
2058 | * and queue_size | 2058 | * and queue_size |
2059 | */ | 2059 | */ |
2060 | ioc->hba_queue_depth -= queue_diff; | 2060 | ioc->hba_queue_depth -= (queue_diff / 2); |
2061 | ioc->reply_free_queue_depth -= queue_diff; | 2061 | ioc->reply_free_queue_depth -= (queue_diff / 2); |
2062 | queue_size -= queue_diff; | 2062 | queue_size = facts->MaxReplyDescriptorPostQueueDepth; |
2063 | } | 2063 | } |
2064 | ioc->reply_post_queue_depth = queue_size; | 2064 | ioc->reply_post_queue_depth = queue_size; |
2065 | 2065 | ||
@@ -3662,6 +3662,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3662 | ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; | 3662 | ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; |
3663 | mutex_init(&ioc->scsih_cmds.mutex); | 3663 | mutex_init(&ioc->scsih_cmds.mutex); |
3664 | 3664 | ||
3665 | /* scsih internal command bits */ | ||
3666 | ioc->scsih_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | ||
3667 | ioc->scsih_cmds.status = MPT2_CMD_NOT_USED; | ||
3668 | mutex_init(&ioc->scsih_cmds.mutex); | ||
3669 | |||
3665 | /* task management internal command bits */ | 3670 | /* task management internal command bits */ |
3666 | ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); | 3671 | ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL); |
3667 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; | 3672 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
@@ -3786,6 +3791,8 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) | |||
3786 | static void | 3791 | static void |
3787 | _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) | 3792 | _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) |
3788 | { | 3793 | { |
3794 | mpt2sas_scsih_reset_handler(ioc, reset_phase); | ||
3795 | mpt2sas_ctl_reset_handler(ioc, reset_phase); | ||
3789 | switch (reset_phase) { | 3796 | switch (reset_phase) { |
3790 | case MPT2_IOC_PRE_RESET: | 3797 | case MPT2_IOC_PRE_RESET: |
3791 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " | 3798 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: " |
@@ -3816,8 +3823,6 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) | |||
3816 | "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); | 3823 | "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); |
3817 | break; | 3824 | break; |
3818 | } | 3825 | } |
3819 | mpt2sas_scsih_reset_handler(ioc, reset_phase); | ||
3820 | mpt2sas_ctl_reset_handler(ioc, reset_phase); | ||
3821 | } | 3826 | } |
3822 | 3827 | ||
3823 | /** | 3828 | /** |
@@ -3871,6 +3876,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
3871 | { | 3876 | { |
3872 | int r; | 3877 | int r; |
3873 | unsigned long flags; | 3878 | unsigned long flags; |
3879 | u8 pe_complete = ioc->wait_for_port_enable_to_complete; | ||
3874 | 3880 | ||
3875 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, | 3881 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
3876 | __func__)); | 3882 | __func__)); |
@@ -3913,6 +3919,14 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
3913 | if (r) | 3919 | if (r) |
3914 | goto out; | 3920 | goto out; |
3915 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); | 3921 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); |
3922 | |||
3923 | /* If this hard reset is called while port enable is active, then | ||
3924 | * there is no reason to call make_ioc_operational | ||
3925 | */ | ||
3926 | if (pe_complete) { | ||
3927 | r = -EFAULT; | ||
3928 | goto out; | ||
3929 | } | ||
3916 | r = _base_make_ioc_operational(ioc, sleep_flag); | 3930 | r = _base_make_ioc_operational(ioc, sleep_flag); |
3917 | if (!r) | 3931 | if (!r) |
3918 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); | 3932 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index 16e99b686354..794d927f70c1 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -819,7 +819,7 @@ _scsih_is_end_device(u32 device_info) | |||
819 | } | 819 | } |
820 | 820 | ||
821 | /** | 821 | /** |
822 | * mptscsih_get_scsi_lookup - returns scmd entry | 822 | * _scsih_scsi_lookup_get - returns scmd entry |
823 | * @ioc: per adapter object | 823 | * @ioc: per adapter object |
824 | * @smid: system request message index | 824 | * @smid: system request message index |
825 | * | 825 | * |
@@ -832,6 +832,28 @@ _scsih_scsi_lookup_get(struct MPT2SAS_ADAPTER *ioc, u16 smid) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | /** | 834 | /** |
835 | * _scsih_scsi_lookup_get_clear - returns scmd entry | ||
836 | * @ioc: per adapter object | ||
837 | * @smid: system request message index | ||
838 | * | ||
839 | * Returns the smid stored scmd pointer. | ||
840 | * Then will derefrence the stored scmd pointer. | ||
841 | */ | ||
842 | static inline struct scsi_cmnd * | ||
843 | _scsih_scsi_lookup_get_clear(struct MPT2SAS_ADAPTER *ioc, u16 smid) | ||
844 | { | ||
845 | unsigned long flags; | ||
846 | struct scsi_cmnd *scmd; | ||
847 | |||
848 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
849 | scmd = ioc->scsi_lookup[smid - 1].scmd; | ||
850 | ioc->scsi_lookup[smid - 1].scmd = NULL; | ||
851 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | ||
852 | |||
853 | return scmd; | ||
854 | } | ||
855 | |||
856 | /** | ||
835 | * _scsih_scsi_lookup_find_by_scmd - scmd lookup | 857 | * _scsih_scsi_lookup_find_by_scmd - scmd lookup |
836 | * @ioc: per adapter object | 858 | * @ioc: per adapter object |
837 | * @smid: system request message index | 859 | * @smid: system request message index |
@@ -2957,9 +2979,6 @@ _scsih_check_topo_delete_events(struct MPT2SAS_ADAPTER *ioc, | |||
2957 | u16 handle; | 2979 | u16 handle; |
2958 | 2980 | ||
2959 | for (i = 0 ; i < event_data->NumEntries; i++) { | 2981 | for (i = 0 ; i < event_data->NumEntries; i++) { |
2960 | if (event_data->PHY[i].PhyStatus & | ||
2961 | MPI2_EVENT_SAS_TOPO_PHYSTATUS_VACANT) | ||
2962 | continue; | ||
2963 | handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); | 2982 | handle = le16_to_cpu(event_data->PHY[i].AttachedDevHandle); |
2964 | if (!handle) | 2983 | if (!handle) |
2965 | continue; | 2984 | continue; |
@@ -3186,7 +3205,7 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc) | |||
3186 | u16 count = 0; | 3205 | u16 count = 0; |
3187 | 3206 | ||
3188 | for (smid = 1; smid <= ioc->scsiio_depth; smid++) { | 3207 | for (smid = 1; smid <= ioc->scsiio_depth; smid++) { |
3189 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 3208 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
3190 | if (!scmd) | 3209 | if (!scmd) |
3191 | continue; | 3210 | continue; |
3192 | count++; | 3211 | count++; |
@@ -3778,7 +3797,7 @@ _scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
3778 | u32 response_code = 0; | 3797 | u32 response_code = 0; |
3779 | 3798 | ||
3780 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); | 3799 | mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); |
3781 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 3800 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
3782 | if (scmd == NULL) | 3801 | if (scmd == NULL) |
3783 | return 1; | 3802 | return 1; |
3784 | 3803 | ||
@@ -4940,6 +4959,12 @@ _scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc, | |||
4940 | event_data); | 4959 | event_data); |
4941 | #endif | 4960 | #endif |
4942 | 4961 | ||
4962 | /* In MPI Revision K (0xC), the internal device reset complete was | ||
4963 | * implemented, so avoid setting tm_busy flag for older firmware. | ||
4964 | */ | ||
4965 | if ((ioc->facts.HeaderVersion >> 8) < 0xC) | ||
4966 | return; | ||
4967 | |||
4943 | if (event_data->ReasonCode != | 4968 | if (event_data->ReasonCode != |
4944 | MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && | 4969 | MPI2_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET && |
4945 | event_data->ReasonCode != | 4970 | event_data->ReasonCode != |
@@ -5034,6 +5059,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5034 | struct fw_event_work *fw_event) | 5059 | struct fw_event_work *fw_event) |
5035 | { | 5060 | { |
5036 | struct scsi_cmnd *scmd; | 5061 | struct scsi_cmnd *scmd; |
5062 | struct scsi_device *sdev; | ||
5037 | u16 smid, handle; | 5063 | u16 smid, handle; |
5038 | u32 lun; | 5064 | u32 lun; |
5039 | struct MPT2SAS_DEVICE *sas_device_priv_data; | 5065 | struct MPT2SAS_DEVICE *sas_device_priv_data; |
@@ -5044,12 +5070,17 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5044 | Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; | 5070 | Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data; |
5045 | #endif | 5071 | #endif |
5046 | u16 ioc_status; | 5072 | u16 ioc_status; |
5073 | unsigned long flags; | ||
5074 | int r; | ||
5075 | |||
5047 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " | 5076 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "broadcast primative: " |
5048 | "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, | 5077 | "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, |
5049 | event_data->PortWidth)); | 5078 | event_data->PortWidth)); |
5050 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, | 5079 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, |
5051 | __func__)); | 5080 | __func__)); |
5052 | 5081 | ||
5082 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5083 | ioc->broadcast_aen_busy = 0; | ||
5053 | termination_count = 0; | 5084 | termination_count = 0; |
5054 | query_count = 0; | 5085 | query_count = 0; |
5055 | mpi_reply = ioc->tm_cmds.reply; | 5086 | mpi_reply = ioc->tm_cmds.reply; |
@@ -5057,7 +5088,8 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5057 | scmd = _scsih_scsi_lookup_get(ioc, smid); | 5088 | scmd = _scsih_scsi_lookup_get(ioc, smid); |
5058 | if (!scmd) | 5089 | if (!scmd) |
5059 | continue; | 5090 | continue; |
5060 | sas_device_priv_data = scmd->device->hostdata; | 5091 | sdev = scmd->device; |
5092 | sas_device_priv_data = sdev->hostdata; | ||
5061 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) | 5093 | if (!sas_device_priv_data || !sas_device_priv_data->sas_target) |
5062 | continue; | 5094 | continue; |
5063 | /* skip hidden raid components */ | 5095 | /* skip hidden raid components */ |
@@ -5073,6 +5105,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5073 | lun = sas_device_priv_data->lun; | 5105 | lun = sas_device_priv_data->lun; |
5074 | query_count++; | 5106 | query_count++; |
5075 | 5107 | ||
5108 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | ||
5076 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, | 5109 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, |
5077 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); | 5110 | MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30, NULL); |
5078 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; | 5111 | ioc->tm_cmds.status = MPT2_CMD_NOT_USED; |
@@ -5082,14 +5115,20 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, | |||
5082 | (mpi_reply->ResponseCode == | 5115 | (mpi_reply->ResponseCode == |
5083 | MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || | 5116 | MPI2_SCSITASKMGMT_RSP_TM_SUCCEEDED || |
5084 | mpi_reply->ResponseCode == | 5117 | mpi_reply->ResponseCode == |
5085 | MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) | 5118 | MPI2_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC)) { |
5119 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5086 | continue; | 5120 | continue; |
5087 | 5121 | } | |
5088 | mpt2sas_scsih_issue_tm(ioc, handle, 0, 0, lun, | 5122 | r = mpt2sas_scsih_issue_tm(ioc, handle, sdev->channel, sdev->id, |
5089 | MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30, NULL); | 5123 | sdev->lun, MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK, smid, 30, |
5124 | scmd); | ||
5125 | if (r == FAILED) | ||
5126 | sdev_printk(KERN_WARNING, sdev, "task abort: FAILED " | ||
5127 | "scmd(%p)\n", scmd); | ||
5090 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); | 5128 | termination_count += le32_to_cpu(mpi_reply->TerminationCount); |
5129 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | ||
5091 | } | 5130 | } |
5092 | ioc->broadcast_aen_busy = 0; | 5131 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
5093 | 5132 | ||
5094 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT | 5133 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT |
5095 | "%s - exit, query_count = %d termination_count = %d\n", | 5134 | "%s - exit, query_count = %d termination_count = %d\n", |
@@ -6685,6 +6724,7 @@ _scsih_remove(struct pci_dev *pdev) | |||
6685 | destroy_workqueue(wq); | 6724 | destroy_workqueue(wq); |
6686 | 6725 | ||
6687 | /* release all the volumes */ | 6726 | /* release all the volumes */ |
6727 | _scsih_ir_shutdown(ioc); | ||
6688 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, | 6728 | list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, |
6689 | list) { | 6729 | list) { |
6690 | if (raid_device->starget) { | 6730 | if (raid_device->starget) { |
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h index 6cfa0145a1d7..dd78f9e8eb9b 100644 --- a/drivers/scsi/pmcraid.h +++ b/drivers/scsi/pmcraid.h | |||
@@ -568,7 +568,6 @@ struct pmcraid_cmd { | |||
568 | struct pmcraid_control_block *ioa_cb; | 568 | struct pmcraid_control_block *ioa_cb; |
569 | dma_addr_t ioa_cb_bus_addr; | 569 | dma_addr_t ioa_cb_bus_addr; |
570 | dma_addr_t dma_handle; | 570 | dma_addr_t dma_handle; |
571 | u8 *sense_buffer; | ||
572 | 571 | ||
573 | /* pointer to mid layer structure of SCSI commands */ | 572 | /* pointer to mid layer structure of SCSI commands */ |
574 | struct scsi_cmnd *scsi_cmd; | 573 | struct scsi_cmnd *scsi_cmd; |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 1a1b281cea33..16df82ac1b26 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -92,6 +92,7 @@ extern int ql2xshiftctondsd; | |||
92 | extern int ql2xdbwr; | 92 | extern int ql2xdbwr; |
93 | extern int ql2xdontresethba; | 93 | extern int ql2xdontresethba; |
94 | extern int ql2xasynctmfenable; | 94 | extern int ql2xasynctmfenable; |
95 | extern int ql2xgffidenable; | ||
95 | extern int ql2xenabledif; | 96 | extern int ql2xenabledif; |
96 | extern int ql2xenablehba_err_chk; | 97 | extern int ql2xenablehba_err_chk; |
97 | extern int ql2xtargetreset; | 98 | extern int ql2xtargetreset; |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 9c383baebe27..49e7b0916364 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -3258,8 +3258,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha, | |||
3258 | continue; | 3258 | continue; |
3259 | 3259 | ||
3260 | /* Bypass ports whose FCP-4 type is not FCP_SCSI */ | 3260 | /* Bypass ports whose FCP-4 type is not FCP_SCSI */ |
3261 | if (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && | 3261 | if (ql2xgffidenable && |
3262 | new_fcport->fc4_type != FC4_TYPE_UNKNOWN) | 3262 | (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && |
3263 | new_fcport->fc4_type != FC4_TYPE_UNKNOWN)) | ||
3263 | continue; | 3264 | continue; |
3264 | 3265 | ||
3265 | /* Locate matching device in database. */ | 3266 | /* Locate matching device in database. */ |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 579f02854665..de844996743c 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -1061,6 +1061,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
1061 | fcp_cmnd->additional_cdb_len |= 2; | 1061 | fcp_cmnd->additional_cdb_len |= 2; |
1062 | 1062 | ||
1063 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); | 1063 | int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); |
1064 | host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun)); | ||
1064 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); | 1065 | memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); |
1065 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); | 1066 | cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); |
1066 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( | 1067 | cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index 0a71cc71eab2..424cf189af27 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
@@ -2740,6 +2740,7 @@ sufficient_dsds: | |||
2740 | goto queuing_error_fcp_cmnd; | 2740 | goto queuing_error_fcp_cmnd; |
2741 | 2741 | ||
2742 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); | 2742 | int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); |
2743 | host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); | ||
2743 | 2744 | ||
2744 | /* build FCP_CMND IU */ | 2745 | /* build FCP_CMND IU */ |
2745 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); | 2746 | memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 1e4bff695254..202a31ab2f18 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -160,6 +160,11 @@ MODULE_PARM_DESC(ql2xtargetreset, | |||
160 | "Enable target reset." | 160 | "Enable target reset." |
161 | "Default is 1 - use hw defaults."); | 161 | "Default is 1 - use hw defaults."); |
162 | 162 | ||
163 | int ql2xgffidenable; | ||
164 | module_param(ql2xgffidenable, int, S_IRUGO|S_IRUSR); | ||
165 | MODULE_PARM_DESC(ql2xgffidenable, | ||
166 | "Enables GFF_ID checks of port type. " | ||
167 | "Default is 0 - Do not use GFF_ID information."); | ||
163 | 168 | ||
164 | int ql2xasynctmfenable; | 169 | int ql2xasynctmfenable; |
165 | module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); | 170 | module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); |
@@ -2090,6 +2095,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2090 | ha->init_cb_size = sizeof(struct mid_init_cb_81xx); | 2095 | ha->init_cb_size = sizeof(struct mid_init_cb_81xx); |
2091 | ha->gid_list_info_size = 8; | 2096 | ha->gid_list_info_size = 8; |
2092 | ha->optrom_size = OPTROM_SIZE_82XX; | 2097 | ha->optrom_size = OPTROM_SIZE_82XX; |
2098 | ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; | ||
2093 | ha->isp_ops = &qla82xx_isp_ops; | 2099 | ha->isp_ops = &qla82xx_isp_ops; |
2094 | ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; | 2100 | ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; |
2095 | ha->flash_data_off = FARX_ACCESS_FLASH_DATA; | 2101 | ha->flash_data_off = FARX_ACCESS_FLASH_DATA; |
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c index 5d4a3822382d..449256f2c5f8 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.c +++ b/drivers/scsi/qla4xxx/ql4_nx.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * See LICENSE.qla4xxx for copyright and licensing details. | 5 | * See LICENSE.qla4xxx for copyright and licensing details. |
6 | */ | 6 | */ |
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | #include <linux/io.h> | ||
8 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
9 | #include "ql4_def.h" | 10 | #include "ql4_def.h" |
10 | #include "ql4_glbl.h" | 11 | #include "ql4_glbl.h" |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ee02d3838a0a..5bff8a2396e4 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1632,9 +1632,8 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
1632 | 1632 | ||
1633 | blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); | 1633 | blk_queue_max_segment_size(q, dma_get_max_seg_size(dev)); |
1634 | 1634 | ||
1635 | /* New queue, no concurrency on queue_flags */ | ||
1636 | if (!shost->use_clustering) | 1635 | if (!shost->use_clustering) |
1637 | queue_flag_clear_unlocked(QUEUE_FLAG_CLUSTER, q); | 1636 | q->limits.cluster = 0; |
1638 | 1637 | ||
1639 | /* | 1638 | /* |
1640 | * set a reasonable default alignment on word boundaries: the | 1639 | * set a reasonable default alignment on word boundaries: the |
@@ -2428,7 +2427,8 @@ scsi_internal_device_unblock(struct scsi_device *sdev) | |||
2428 | sdev->sdev_state = SDEV_RUNNING; | 2427 | sdev->sdev_state = SDEV_RUNNING; |
2429 | else if (sdev->sdev_state == SDEV_CREATED_BLOCK) | 2428 | else if (sdev->sdev_state == SDEV_CREATED_BLOCK) |
2430 | sdev->sdev_state = SDEV_CREATED; | 2429 | sdev->sdev_state = SDEV_CREATED; |
2431 | else | 2430 | else if (sdev->sdev_state != SDEV_CANCEL && |
2431 | sdev->sdev_state != SDEV_OFFLINE) | ||
2432 | return -EINVAL; | 2432 | return -EINVAL; |
2433 | 2433 | ||
2434 | spin_lock_irqsave(q->queue_lock, flags); | 2434 | spin_lock_irqsave(q->queue_lock, flags); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index c3f67373a4f8..7a0ca6fdbd79 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -962,10 +962,11 @@ static void __scsi_remove_target(struct scsi_target *starget) | |||
962 | list_for_each_entry(sdev, &shost->__devices, siblings) { | 962 | list_for_each_entry(sdev, &shost->__devices, siblings) { |
963 | if (sdev->channel != starget->channel || | 963 | if (sdev->channel != starget->channel || |
964 | sdev->id != starget->id || | 964 | sdev->id != starget->id || |
965 | sdev->sdev_state == SDEV_DEL) | 965 | scsi_device_get(sdev)) |
966 | continue; | 966 | continue; |
967 | spin_unlock_irqrestore(shost->host_lock, flags); | 967 | spin_unlock_irqrestore(shost->host_lock, flags); |
968 | scsi_remove_device(sdev); | 968 | scsi_remove_device(sdev); |
969 | scsi_device_put(sdev); | ||
969 | spin_lock_irqsave(shost->host_lock, flags); | 970 | spin_lock_irqsave(shost->host_lock, flags); |
970 | goto restart; | 971 | goto restart; |
971 | } | 972 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ffa0689ee840..c52273c1327a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1153,6 +1153,12 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1153 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); | 1153 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
1154 | u64 bad_lba; | 1154 | u64 bad_lba; |
1155 | int info_valid; | 1155 | int info_valid; |
1156 | /* | ||
1157 | * resid is optional but mostly filled in. When it's unused, | ||
1158 | * its value is zero, so we assume the whole buffer transferred | ||
1159 | */ | ||
1160 | unsigned int transferred = scsi_bufflen(scmd) - scsi_get_resid(scmd); | ||
1161 | unsigned int good_bytes; | ||
1156 | 1162 | ||
1157 | if (scmd->request->cmd_type != REQ_TYPE_FS) | 1163 | if (scmd->request->cmd_type != REQ_TYPE_FS) |
1158 | return 0; | 1164 | return 0; |
@@ -1186,7 +1192,8 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1186 | /* This computation should always be done in terms of | 1192 | /* This computation should always be done in terms of |
1187 | * the resolution of the device's medium. | 1193 | * the resolution of the device's medium. |
1188 | */ | 1194 | */ |
1189 | return (bad_lba - start_lba) * scmd->device->sector_size; | 1195 | good_bytes = (bad_lba - start_lba) * scmd->device->sector_size; |
1196 | return min(good_bytes, transferred); | ||
1190 | } | 1197 | } |
1191 | 1198 | ||
1192 | /** | 1199 | /** |
@@ -2252,11 +2259,10 @@ static void sd_probe_async(void *data, async_cookie_t cookie) | |||
2252 | index = sdkp->index; | 2259 | index = sdkp->index; |
2253 | dev = &sdp->sdev_gendev; | 2260 | dev = &sdp->sdev_gendev; |
2254 | 2261 | ||
2255 | if (index < SD_MAX_DISKS) { | 2262 | gd->major = sd_major((index & 0xf0) >> 4); |
2256 | gd->major = sd_major((index & 0xf0) >> 4); | 2263 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); |
2257 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); | 2264 | gd->minors = SD_MINORS; |
2258 | gd->minors = SD_MINORS; | 2265 | |
2259 | } | ||
2260 | gd->fops = &sd_fops; | 2266 | gd->fops = &sd_fops; |
2261 | gd->private_data = &sdkp->driver; | 2267 | gd->private_data = &sdkp->driver; |
2262 | gd->queue = sdkp->device->request_queue; | 2268 | gd->queue = sdkp->device->request_queue; |
@@ -2346,6 +2352,12 @@ static int sd_probe(struct device *dev) | |||
2346 | if (error) | 2352 | if (error) |
2347 | goto out_put; | 2353 | goto out_put; |
2348 | 2354 | ||
2355 | if (index >= SD_MAX_DISKS) { | ||
2356 | error = -ENODEV; | ||
2357 | sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name space exhausted.\n"); | ||
2358 | goto out_free_index; | ||
2359 | } | ||
2360 | |||
2349 | error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN); | 2361 | error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN); |
2350 | if (error) | 2362 | if (error) |
2351 | goto out_free_index; | 2363 | goto out_free_index; |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 24110f6f61e0..c9e86deba5e3 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -241,7 +241,8 @@ static const struct serial8250_config uart_config[] = { | |||
241 | .fifo_size = 128, | 241 | .fifo_size = 128, |
242 | .tx_loadsz = 128, | 242 | .tx_loadsz = 128, |
243 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, | 243 | .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
244 | .flags = UART_CAP_FIFO | UART_CAP_EFR | UART_CAP_SLEEP, | 244 | /* UART_CAP_EFR breaks billionon CF bluetooth card. */ |
245 | .flags = UART_CAP_FIFO | UART_CAP_SLEEP, | ||
245 | }, | 246 | }, |
246 | [PORT_16654] = { | 247 | [PORT_16654] = { |
247 | .name = "ST16654", | 248 | .name = "ST16654", |
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index 5dff45c76d32..f083f7c90c29 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -892,8 +892,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
892 | unsigned char cval, fcr = 0; | 892 | unsigned char cval, fcr = 0; |
893 | unsigned long flags; | 893 | unsigned long flags; |
894 | unsigned int baud, quot; | 894 | unsigned int baud, quot; |
895 | u32 mul = 0x3600; | 895 | u32 ps, mul; |
896 | u32 ps = 0x10; | ||
897 | 896 | ||
898 | switch (termios->c_cflag & CSIZE) { | 897 | switch (termios->c_cflag & CSIZE) { |
899 | case CS5: | 898 | case CS5: |
@@ -937,20 +936,19 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
937 | ps = 0xC; | 936 | ps = 0xC; |
938 | quot = 1; | 937 | quot = 1; |
939 | break; | 938 | break; |
940 | case 2500000: | ||
941 | mul = 0x2710; | ||
942 | ps = 0x10; | ||
943 | quot = 1; | ||
944 | break; | ||
945 | case 18432000: | 939 | case 18432000: |
946 | mul = 0x2400; | 940 | mul = 0x2400; |
947 | ps = 0x10; | 941 | ps = 0x10; |
948 | quot = 1; | 942 | quot = 1; |
949 | break; | 943 | break; |
944 | case 3000000: | ||
945 | case 2500000: | ||
946 | case 2000000: | ||
950 | case 1500000: | 947 | case 1500000: |
951 | mul = 0x1D4C; | 948 | case 1000000: |
952 | ps = 0xc; | 949 | case 500000: |
953 | quot = 1; | 950 | /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */ |
951 | mul = baud / 500000 * 0x9C4; | ||
954 | break; | 952 | break; |
955 | default: | 953 | default: |
956 | ; | 954 | ; |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index ef9c6a04ad8f..744d3f6e4709 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -24,6 +24,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { | |||
24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, | 24 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, |
25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, | 25 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, |
26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, | 26 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, |
27 | { PCI_DEVICE(PCI_VENDOR_ID_BCM_GVC, 0x4318) }, | ||
27 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, | 28 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, |
28 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, | 29 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, |
29 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, | 30 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 526682d68de8..17053a5eb258 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -734,7 +734,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
734 | 734 | ||
735 | /* Fetch the vendor specific tuples. */ | 735 | /* Fetch the vendor specific tuples. */ |
736 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, | 736 | res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, |
737 | ssb_pcmcia_do_get_invariants, sprom); | 737 | ssb_pcmcia_do_get_invariants, iv); |
738 | if ((res == 0) || (res == -ENOSPC)) | 738 | if ((res == 0) || (res == -ENOSPC)) |
739 | return 0; | 739 | return 0; |
740 | 740 | ||
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 5b279fb30f3f..62445551eecf 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
@@ -620,13 +620,13 @@ static ssize_t class_set_picture(struct device *device, | |||
620 | 620 | ||
621 | #define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file | 621 | #define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file |
622 | 622 | ||
623 | static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, | 623 | static DEVICE_ATTR(asus_oled_enabled, S_IWUSR | S_IRUGO, |
624 | get_enabled, set_enabled); | 624 | get_enabled, set_enabled); |
625 | static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture); | 625 | static DEVICE_ATTR(asus_oled_picture, S_IWUSR , NULL, set_picture); |
626 | 626 | ||
627 | static DEVICE_ATTR(enabled, S_IWUGO | S_IRUGO, | 627 | static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO, |
628 | class_get_enabled, class_set_enabled); | 628 | class_get_enabled, class_set_enabled); |
629 | static DEVICE_ATTR(picture, S_IWUGO, NULL, class_set_picture); | 629 | static DEVICE_ATTR(picture, S_IWUSR, NULL, class_set_picture); |
630 | 630 | ||
631 | static int asus_oled_probe(struct usb_interface *interface, | 631 | static int asus_oled_probe(struct usb_interface *interface, |
632 | const struct usb_device_id *id) | 632 | const struct usb_device_id *id) |
diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c index 2ea97de435ce..876be5a2913d 100644 --- a/drivers/staging/batman-adv/soft-interface.c +++ b/drivers/staging/batman-adv/soft-interface.c | |||
@@ -246,6 +246,10 @@ void interface_rx(struct sk_buff *skb, int hdr_size) | |||
246 | skb_pull_rcsum(skb, hdr_size); | 246 | skb_pull_rcsum(skb, hdr_size); |
247 | /* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ | 247 | /* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ |
248 | 248 | ||
249 | if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) { | ||
250 | kfree_skb(skb); | ||
251 | return; | ||
252 | } | ||
249 | skb->dev = dev; | 253 | skb->dev = dev; |
250 | skb->protocol = eth_type_trans(skb, dev); | 254 | skb->protocol = eth_type_trans(skb, dev); |
251 | 255 | ||
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index 8b383ee959b2..5c6c72744167 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c | |||
@@ -54,6 +54,7 @@ Devices: [JR3] PCI force sensor board (jr3_pci) | |||
54 | 54 | ||
55 | #define PCI_VENDOR_ID_JR3 0x1762 | 55 | #define PCI_VENDOR_ID_JR3 0x1762 |
56 | #define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111 | 56 | #define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111 |
57 | #define PCI_DEVICE_ID_JR3_1_CHANNEL_NEW 0x1111 | ||
57 | #define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112 | 58 | #define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112 |
58 | #define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113 | 59 | #define PCI_DEVICE_ID_JR3_3_CHANNEL 0x3113 |
59 | #define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114 | 60 | #define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114 |
@@ -73,6 +74,8 @@ static DEFINE_PCI_DEVICE_TABLE(jr3_pci_pci_table) = { | |||
73 | { | 74 | { |
74 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL, | 75 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL, |
75 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { | 76 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { |
77 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_1_CHANNEL_NEW, | ||
78 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { | ||
76 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL, | 79 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_2_CHANNEL, |
77 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { | 80 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { |
78 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL, | 81 | PCI_VENDOR_ID_JR3, PCI_DEVICE_ID_JR3_3_CHANNEL, |
@@ -807,6 +810,10 @@ static int jr3_pci_attach(struct comedi_device *dev, | |||
807 | devpriv->n_channels = 1; | 810 | devpriv->n_channels = 1; |
808 | } | 811 | } |
809 | break; | 812 | break; |
813 | case PCI_DEVICE_ID_JR3_1_CHANNEL_NEW:{ | ||
814 | devpriv->n_channels = 1; | ||
815 | } | ||
816 | break; | ||
810 | case PCI_DEVICE_ID_JR3_2_CHANNEL:{ | 817 | case PCI_DEVICE_ID_JR3_2_CHANNEL:{ |
811 | devpriv->n_channels = 2; | 818 | devpriv->n_channels = 2; |
812 | } | 819 | } |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 3acf7e62bec4..681312d1911c 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -572,7 +572,8 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, | |||
572 | /* grab our IRQ */ | 572 | /* grab our IRQ */ |
573 | if (irq) { | 573 | if (irq) { |
574 | isr_flags = 0; | 574 | isr_flags = 0; |
575 | if (thisboard->bustype == pci_bustype) | 575 | if (thisboard->bustype == pci_bustype |
576 | || thisboard->bustype == pcmcia_bustype) | ||
576 | isr_flags |= IRQF_SHARED; | 577 | isr_flags |= IRQF_SHARED; |
577 | if (request_irq(irq, labpc_interrupt, isr_flags, | 578 | if (request_irq(irq, labpc_interrupt, isr_flags, |
578 | driver_labpc.driver_name, dev)) { | 579 | driver_labpc.driver_name, dev)) { |
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index 1d5e8796d383..0d318c739528 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c | |||
@@ -92,7 +92,7 @@ int cx25821_get_format_size(void) | |||
92 | return ARRAY_SIZE(formats); | 92 | return ARRAY_SIZE(formats); |
93 | } | 93 | } |
94 | 94 | ||
95 | struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) | 95 | struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc) |
96 | { | 96 | { |
97 | unsigned int i; | 97 | unsigned int i; |
98 | 98 | ||
@@ -848,7 +848,7 @@ static int video_open(struct file *file) | |||
848 | pix_format = | 848 | pix_format = |
849 | (dev->channels[ch_id].pixel_formats == | 849 | (dev->channels[ch_id].pixel_formats == |
850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; | 850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; |
851 | fh->fmt = format_by_fourcc(pix_format); | 851 | fh->fmt = cx25821_format_by_fourcc(pix_format); |
852 | 852 | ||
853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); | 853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); |
854 | 854 | ||
@@ -1009,7 +1009,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1009 | if (0 != err) | 1009 | if (0 != err) |
1010 | return err; | 1010 | return err; |
1011 | 1011 | ||
1012 | fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1012 | fh->fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
1013 | fh->vidq.field = f->fmt.pix.field; | 1013 | fh->vidq.field = f->fmt.pix.field; |
1014 | 1014 | ||
1015 | /* check if width and height is valid based on set standard */ | 1015 | /* check if width and height is valid based on set standard */ |
@@ -1117,7 +1117,7 @@ int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fo | |||
1117 | enum v4l2_field field; | 1117 | enum v4l2_field field; |
1118 | unsigned int maxw, maxh; | 1118 | unsigned int maxw, maxh; |
1119 | 1119 | ||
1120 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1120 | fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
1121 | if (NULL == fmt) | 1121 | if (NULL == fmt) |
1122 | return -EINVAL; | 1122 | return -EINVAL; |
1123 | 1123 | ||
diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h index cc6034b1a95d..a2415d33235b 100644 --- a/drivers/staging/cx25821/cx25821-video.h +++ b/drivers/staging/cx25821/cx25821-video.h | |||
@@ -87,7 +87,7 @@ extern unsigned int vid_limit; | |||
87 | 87 | ||
88 | #define FORMAT_FLAGS_PACKED 0x01 | 88 | #define FORMAT_FLAGS_PACKED 0x01 |
89 | extern struct cx25821_fmt formats[]; | 89 | extern struct cx25821_fmt formats[]; |
90 | extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); | 90 | extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc); |
91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; | 91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; |
92 | 92 | ||
93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, | 93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, |
diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index eed74f0fe0b6..f21a0e8d8d9b 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c | |||
@@ -204,7 +204,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) | |||
204 | t->value = temp; \ | 204 | t->value = temp; \ |
205 | return count; \ | 205 | return count; \ |
206 | } \ | 206 | } \ |
207 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 207 | static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value); |
208 | 208 | ||
209 | show_int(enable); | 209 | show_int(enable); |
210 | show_int(offline); | 210 | show_int(offline); |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index ff1d24720f11..26d3677755d1 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -369,6 +369,7 @@ static int blkvsc_probe(struct device *device) | |||
369 | blkdev->gd->first_minor = 0; | 369 | blkdev->gd->first_minor = 0; |
370 | blkdev->gd->fops = &block_ops; | 370 | blkdev->gd->fops = &block_ops; |
371 | blkdev->gd->private_data = blkdev; | 371 | blkdev->gd->private_data = blkdev; |
372 | blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device); | ||
372 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); | 373 | sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum); |
373 | 374 | ||
374 | blkvsc_do_inquiry(blkdev); | 375 | blkvsc_do_inquiry(blkdev); |
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index 1d2ebbe17e2c..95dee473d81d 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c | |||
@@ -1250,7 +1250,7 @@ static void NetVscOnChannelCallback(void *Context) | |||
1250 | /* ASSERT(device); */ | 1250 | /* ASSERT(device); */ |
1251 | 1251 | ||
1252 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), | 1252 | packet = kzalloc(NETVSC_PACKET_SIZE * sizeof(unsigned char), |
1253 | GFP_KERNEL); | 1253 | GFP_ATOMIC); |
1254 | if (!packet) | 1254 | if (!packet) |
1255 | return; | 1255 | return; |
1256 | buffer = packet; | 1256 | buffer = packet; |
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index 64a01147ecae..d2d5608b5eb4 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
@@ -233,6 +233,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
233 | if (status == 1) { | 233 | if (status == 1) { |
234 | netif_carrier_on(net); | 234 | netif_carrier_on(net); |
235 | netif_wake_queue(net); | 235 | netif_wake_queue(net); |
236 | netif_notify_peers(net); | ||
236 | } else { | 237 | } else { |
237 | netif_carrier_off(net); | 238 | netif_carrier_off(net); |
238 | netif_stop_queue(net); | 239 | netif_stop_queue(net); |
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index bb7d76539cd7..ab2d5fa0349f 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c | |||
@@ -506,7 +506,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, | |||
506 | adis16220_write_reset, 0); | 506 | adis16220_write_reset, 0); |
507 | 507 | ||
508 | #define IIO_DEV_ATTR_CAPTURE(_store) \ | 508 | #define IIO_DEV_ATTR_CAPTURE(_store) \ |
509 | IIO_DEVICE_ATTR(capture, S_IWUGO, NULL, _store, 0) | 509 | IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0) |
510 | 510 | ||
511 | static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); | 511 | static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); |
512 | 512 | ||
diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c index 0b598526de62..e414571938a3 100644 --- a/drivers/staging/line6/control.c +++ b/drivers/staging/line6/control.c | |||
@@ -268,210 +268,210 @@ VARIAX_PARAM_R(float, mix2); | |||
268 | VARIAX_PARAM_R(float, mix1); | 268 | VARIAX_PARAM_R(float, mix1); |
269 | VARIAX_PARAM_R(int, pickup_wiring); | 269 | VARIAX_PARAM_R(int, pickup_wiring); |
270 | 270 | ||
271 | static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak); | 271 | static DEVICE_ATTR(tweak, S_IWUSR | S_IRUGO, pod_get_tweak, pod_set_tweak); |
272 | static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, | 272 | static DEVICE_ATTR(wah_position, S_IWUSR | S_IRUGO, pod_get_wah_position, |
273 | pod_set_wah_position); | 273 | pod_set_wah_position); |
274 | static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, | 274 | static DEVICE_ATTR(compression_gain, S_IWUSR | S_IRUGO, |
275 | pod_get_compression_gain, pod_set_compression_gain); | 275 | pod_get_compression_gain, pod_set_compression_gain); |
276 | static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, | 276 | static DEVICE_ATTR(vol_pedal_position, S_IWUSR | S_IRUGO, |
277 | pod_get_vol_pedal_position, pod_set_vol_pedal_position); | 277 | pod_get_vol_pedal_position, pod_set_vol_pedal_position); |
278 | static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, | 278 | static DEVICE_ATTR(compression_threshold, S_IWUSR | S_IRUGO, |
279 | pod_get_compression_threshold, | 279 | pod_get_compression_threshold, |
280 | pod_set_compression_threshold); | 280 | pod_set_compression_threshold); |
281 | static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan); | 281 | static DEVICE_ATTR(pan, S_IWUSR | S_IRUGO, pod_get_pan, pod_set_pan); |
282 | static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, | 282 | static DEVICE_ATTR(amp_model_setup, S_IWUSR | S_IRUGO, pod_get_amp_model_setup, |
283 | pod_set_amp_model_setup); | 283 | pod_set_amp_model_setup); |
284 | static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, | 284 | static DEVICE_ATTR(amp_model, S_IWUSR | S_IRUGO, pod_get_amp_model, |
285 | pod_set_amp_model); | 285 | pod_set_amp_model); |
286 | static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive); | 286 | static DEVICE_ATTR(drive, S_IWUSR | S_IRUGO, pod_get_drive, pod_set_drive); |
287 | static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass); | 287 | static DEVICE_ATTR(bass, S_IWUSR | S_IRUGO, pod_get_bass, pod_set_bass); |
288 | static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid); | 288 | static DEVICE_ATTR(mid, S_IWUSR | S_IRUGO, pod_get_mid, pod_set_mid); |
289 | static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid); | 289 | static DEVICE_ATTR(lowmid, S_IWUSR | S_IRUGO, pod_get_lowmid, pod_set_lowmid); |
290 | static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble); | 290 | static DEVICE_ATTR(treble, S_IWUSR | S_IRUGO, pod_get_treble, pod_set_treble); |
291 | static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, | 291 | static DEVICE_ATTR(highmid, S_IWUSR | S_IRUGO, pod_get_highmid, |
292 | pod_set_highmid); | 292 | pod_set_highmid); |
293 | static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, | 293 | static DEVICE_ATTR(chan_vol, S_IWUSR | S_IRUGO, pod_get_chan_vol, |
294 | pod_set_chan_vol); | 294 | pod_set_chan_vol); |
295 | static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, | 295 | static DEVICE_ATTR(reverb_mix, S_IWUSR | S_IRUGO, pod_get_reverb_mix, |
296 | pod_set_reverb_mix); | 296 | pod_set_reverb_mix); |
297 | static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, | 297 | static DEVICE_ATTR(effect_setup, S_IWUSR | S_IRUGO, pod_get_effect_setup, |
298 | pod_set_effect_setup); | 298 | pod_set_effect_setup); |
299 | static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, | 299 | static DEVICE_ATTR(band_1_frequency, S_IWUSR | S_IRUGO, |
300 | pod_get_band_1_frequency, pod_set_band_1_frequency); | 300 | pod_get_band_1_frequency, pod_set_band_1_frequency); |
301 | static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, | 301 | static DEVICE_ATTR(presence, S_IWUSR | S_IRUGO, pod_get_presence, |
302 | pod_set_presence); | 302 | pod_set_presence); |
303 | static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, | 303 | static DEVICE_ATTR2(treble__bass, treble, S_IWUSR | S_IRUGO, |
304 | pod_get_treble__bass, pod_set_treble__bass); | 304 | pod_get_treble__bass, pod_set_treble__bass); |
305 | static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, | 305 | static DEVICE_ATTR(noise_gate_enable, S_IWUSR | S_IRUGO, |
306 | pod_get_noise_gate_enable, pod_set_noise_gate_enable); | 306 | pod_get_noise_gate_enable, pod_set_noise_gate_enable); |
307 | static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, | 307 | static DEVICE_ATTR(gate_threshold, S_IWUSR | S_IRUGO, pod_get_gate_threshold, |
308 | pod_set_gate_threshold); | 308 | pod_set_gate_threshold); |
309 | static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, | 309 | static DEVICE_ATTR(gate_decay_time, S_IWUSR | S_IRUGO, pod_get_gate_decay_time, |
310 | pod_set_gate_decay_time); | 310 | pod_set_gate_decay_time); |
311 | static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, | 311 | static DEVICE_ATTR(stomp_enable, S_IWUSR | S_IRUGO, pod_get_stomp_enable, |
312 | pod_set_stomp_enable); | 312 | pod_set_stomp_enable); |
313 | static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, | 313 | static DEVICE_ATTR(comp_enable, S_IWUSR | S_IRUGO, pod_get_comp_enable, |
314 | pod_set_comp_enable); | 314 | pod_set_comp_enable); |
315 | static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, | 315 | static DEVICE_ATTR(stomp_time, S_IWUSR | S_IRUGO, pod_get_stomp_time, |
316 | pod_set_stomp_time); | 316 | pod_set_stomp_time); |
317 | static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, | 317 | static DEVICE_ATTR(delay_enable, S_IWUSR | S_IRUGO, pod_get_delay_enable, |
318 | pod_set_delay_enable); | 318 | pod_set_delay_enable); |
319 | static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, | 319 | static DEVICE_ATTR(mod_param_1, S_IWUSR | S_IRUGO, pod_get_mod_param_1, |
320 | pod_set_mod_param_1); | 320 | pod_set_mod_param_1); |
321 | static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, | 321 | static DEVICE_ATTR(delay_param_1, S_IWUSR | S_IRUGO, pod_get_delay_param_1, |
322 | pod_set_delay_param_1); | 322 | pod_set_delay_param_1); |
323 | static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, | 323 | static DEVICE_ATTR(delay_param_1_note_value, S_IWUSR | S_IRUGO, |
324 | pod_get_delay_param_1_note_value, | 324 | pod_get_delay_param_1_note_value, |
325 | pod_set_delay_param_1_note_value); | 325 | pod_set_delay_param_1_note_value); |
326 | static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, | 326 | static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUSR | S_IRUGO, |
327 | pod_get_band_2_frequency__bass, | 327 | pod_get_band_2_frequency__bass, |
328 | pod_set_band_2_frequency__bass); | 328 | pod_set_band_2_frequency__bass); |
329 | static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, | 329 | static DEVICE_ATTR(delay_param_2, S_IWUSR | S_IRUGO, pod_get_delay_param_2, |
330 | pod_set_delay_param_2); | 330 | pod_set_delay_param_2); |
331 | static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, | 331 | static DEVICE_ATTR(delay_volume_mix, S_IWUSR | S_IRUGO, |
332 | pod_get_delay_volume_mix, pod_set_delay_volume_mix); | 332 | pod_get_delay_volume_mix, pod_set_delay_volume_mix); |
333 | static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, | 333 | static DEVICE_ATTR(delay_param_3, S_IWUSR | S_IRUGO, pod_get_delay_param_3, |
334 | pod_set_delay_param_3); | 334 | pod_set_delay_param_3); |
335 | static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, | 335 | static DEVICE_ATTR(reverb_enable, S_IWUSR | S_IRUGO, pod_get_reverb_enable, |
336 | pod_set_reverb_enable); | 336 | pod_set_reverb_enable); |
337 | static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, | 337 | static DEVICE_ATTR(reverb_type, S_IWUSR | S_IRUGO, pod_get_reverb_type, |
338 | pod_set_reverb_type); | 338 | pod_set_reverb_type); |
339 | static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, | 339 | static DEVICE_ATTR(reverb_decay, S_IWUSR | S_IRUGO, pod_get_reverb_decay, |
340 | pod_set_reverb_decay); | 340 | pod_set_reverb_decay); |
341 | static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, | 341 | static DEVICE_ATTR(reverb_tone, S_IWUSR | S_IRUGO, pod_get_reverb_tone, |
342 | pod_set_reverb_tone); | 342 | pod_set_reverb_tone); |
343 | static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, | 343 | static DEVICE_ATTR(reverb_pre_delay, S_IWUSR | S_IRUGO, |
344 | pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); | 344 | pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); |
345 | static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, | 345 | static DEVICE_ATTR(reverb_pre_post, S_IWUSR | S_IRUGO, pod_get_reverb_pre_post, |
346 | pod_set_reverb_pre_post); | 346 | pod_set_reverb_pre_post); |
347 | static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, | 347 | static DEVICE_ATTR(band_2_frequency, S_IWUSR | S_IRUGO, |
348 | pod_get_band_2_frequency, pod_set_band_2_frequency); | 348 | pod_get_band_2_frequency, pod_set_band_2_frequency); |
349 | static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, | 349 | static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUSR | S_IRUGO, |
350 | pod_get_band_3_frequency__bass, | 350 | pod_get_band_3_frequency__bass, |
351 | pod_set_band_3_frequency__bass); | 351 | pod_set_band_3_frequency__bass); |
352 | static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, | 352 | static DEVICE_ATTR(wah_enable, S_IWUSR | S_IRUGO, pod_get_wah_enable, |
353 | pod_set_wah_enable); | 353 | pod_set_wah_enable); |
354 | static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, | 354 | static DEVICE_ATTR(modulation_lo_cut, S_IWUSR | S_IRUGO, |
355 | pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); | 355 | pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); |
356 | static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, | 356 | static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUSR | S_IRUGO, |
357 | pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); | 357 | pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); |
358 | static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, | 358 | static DEVICE_ATTR(volume_pedal_minimum, S_IWUSR | S_IRUGO, |
359 | pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); | 359 | pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); |
360 | static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, | 360 | static DEVICE_ATTR(eq_pre_post, S_IWUSR | S_IRUGO, pod_get_eq_pre_post, |
361 | pod_set_eq_pre_post); | 361 | pod_set_eq_pre_post); |
362 | static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, | 362 | static DEVICE_ATTR(volume_pre_post, S_IWUSR | S_IRUGO, pod_get_volume_pre_post, |
363 | pod_set_volume_pre_post); | 363 | pod_set_volume_pre_post); |
364 | static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, | 364 | static DEVICE_ATTR(di_model, S_IWUSR | S_IRUGO, pod_get_di_model, |
365 | pod_set_di_model); | 365 | pod_set_di_model); |
366 | static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, | 366 | static DEVICE_ATTR(di_delay, S_IWUSR | S_IRUGO, pod_get_di_delay, |
367 | pod_set_di_delay); | 367 | pod_set_di_delay); |
368 | static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, | 368 | static DEVICE_ATTR(mod_enable, S_IWUSR | S_IRUGO, pod_get_mod_enable, |
369 | pod_set_mod_enable); | 369 | pod_set_mod_enable); |
370 | static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, | 370 | static DEVICE_ATTR(mod_param_1_note_value, S_IWUSR | S_IRUGO, |
371 | pod_get_mod_param_1_note_value, | 371 | pod_get_mod_param_1_note_value, |
372 | pod_set_mod_param_1_note_value); | 372 | pod_set_mod_param_1_note_value); |
373 | static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, | 373 | static DEVICE_ATTR(mod_param_2, S_IWUSR | S_IRUGO, pod_get_mod_param_2, |
374 | pod_set_mod_param_2); | 374 | pod_set_mod_param_2); |
375 | static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, | 375 | static DEVICE_ATTR(mod_param_3, S_IWUSR | S_IRUGO, pod_get_mod_param_3, |
376 | pod_set_mod_param_3); | 376 | pod_set_mod_param_3); |
377 | static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, | 377 | static DEVICE_ATTR(mod_param_4, S_IWUSR | S_IRUGO, pod_get_mod_param_4, |
378 | pod_set_mod_param_4); | 378 | pod_set_mod_param_4); |
379 | static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, | 379 | static DEVICE_ATTR(mod_param_5, S_IWUSR | S_IRUGO, pod_get_mod_param_5, |
380 | pod_set_mod_param_5); | 380 | pod_set_mod_param_5); |
381 | static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, | 381 | static DEVICE_ATTR(mod_volume_mix, S_IWUSR | S_IRUGO, pod_get_mod_volume_mix, |
382 | pod_set_mod_volume_mix); | 382 | pod_set_mod_volume_mix); |
383 | static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, | 383 | static DEVICE_ATTR(mod_pre_post, S_IWUSR | S_IRUGO, pod_get_mod_pre_post, |
384 | pod_set_mod_pre_post); | 384 | pod_set_mod_pre_post); |
385 | static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, | 385 | static DEVICE_ATTR(modulation_model, S_IWUSR | S_IRUGO, |
386 | pod_get_modulation_model, pod_set_modulation_model); | 386 | pod_get_modulation_model, pod_set_modulation_model); |
387 | static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, | 387 | static DEVICE_ATTR(band_3_frequency, S_IWUSR | S_IRUGO, |
388 | pod_get_band_3_frequency, pod_set_band_3_frequency); | 388 | pod_get_band_3_frequency, pod_set_band_3_frequency); |
389 | static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, | 389 | static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUSR | S_IRUGO, |
390 | pod_get_band_4_frequency__bass, | 390 | pod_get_band_4_frequency__bass, |
391 | pod_set_band_4_frequency__bass); | 391 | pod_set_band_4_frequency__bass); |
392 | static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, | 392 | static DEVICE_ATTR(mod_param_1_double_precision, S_IWUSR | S_IRUGO, |
393 | pod_get_mod_param_1_double_precision, | 393 | pod_get_mod_param_1_double_precision, |
394 | pod_set_mod_param_1_double_precision); | 394 | pod_set_mod_param_1_double_precision); |
395 | static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, | 395 | static DEVICE_ATTR(delay_param_1_double_precision, S_IWUSR | S_IRUGO, |
396 | pod_get_delay_param_1_double_precision, | 396 | pod_get_delay_param_1_double_precision, |
397 | pod_set_delay_param_1_double_precision); | 397 | pod_set_delay_param_1_double_precision); |
398 | static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, | 398 | static DEVICE_ATTR(eq_enable, S_IWUSR | S_IRUGO, pod_get_eq_enable, |
399 | pod_set_eq_enable); | 399 | pod_set_eq_enable); |
400 | static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap); | 400 | static DEVICE_ATTR(tap, S_IWUSR | S_IRUGO, pod_get_tap, pod_set_tap); |
401 | static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, | 401 | static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUSR | S_IRUGO, |
402 | pod_get_volume_tweak_pedal_assign, | 402 | pod_get_volume_tweak_pedal_assign, |
403 | pod_set_volume_tweak_pedal_assign); | 403 | pod_set_volume_tweak_pedal_assign); |
404 | static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, | 404 | static DEVICE_ATTR(band_5_frequency, S_IWUSR | S_IRUGO, |
405 | pod_get_band_5_frequency, pod_set_band_5_frequency); | 405 | pod_get_band_5_frequency, pod_set_band_5_frequency); |
406 | static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner); | 406 | static DEVICE_ATTR(tuner, S_IWUSR | S_IRUGO, pod_get_tuner, pod_set_tuner); |
407 | static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, | 407 | static DEVICE_ATTR(mic_selection, S_IWUSR | S_IRUGO, pod_get_mic_selection, |
408 | pod_set_mic_selection); | 408 | pod_set_mic_selection); |
409 | static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, | 409 | static DEVICE_ATTR(cabinet_model, S_IWUSR | S_IRUGO, pod_get_cabinet_model, |
410 | pod_set_cabinet_model); | 410 | pod_set_cabinet_model); |
411 | static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, | 411 | static DEVICE_ATTR(stomp_model, S_IWUSR | S_IRUGO, pod_get_stomp_model, |
412 | pod_set_stomp_model); | 412 | pod_set_stomp_model); |
413 | static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, | 413 | static DEVICE_ATTR(roomlevel, S_IWUSR | S_IRUGO, pod_get_roomlevel, |
414 | pod_set_roomlevel); | 414 | pod_set_roomlevel); |
415 | static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, | 415 | static DEVICE_ATTR(band_4_frequency, S_IWUSR | S_IRUGO, |
416 | pod_get_band_4_frequency, pod_set_band_4_frequency); | 416 | pod_get_band_4_frequency, pod_set_band_4_frequency); |
417 | static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, | 417 | static DEVICE_ATTR(band_6_frequency, S_IWUSR | S_IRUGO, |
418 | pod_get_band_6_frequency, pod_set_band_6_frequency); | 418 | pod_get_band_6_frequency, pod_set_band_6_frequency); |
419 | static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, | 419 | static DEVICE_ATTR(stomp_param_1_note_value, S_IWUSR | S_IRUGO, |
420 | pod_get_stomp_param_1_note_value, | 420 | pod_get_stomp_param_1_note_value, |
421 | pod_set_stomp_param_1_note_value); | 421 | pod_set_stomp_param_1_note_value); |
422 | static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, | 422 | static DEVICE_ATTR(stomp_param_2, S_IWUSR | S_IRUGO, pod_get_stomp_param_2, |
423 | pod_set_stomp_param_2); | 423 | pod_set_stomp_param_2); |
424 | static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, | 424 | static DEVICE_ATTR(stomp_param_3, S_IWUSR | S_IRUGO, pod_get_stomp_param_3, |
425 | pod_set_stomp_param_3); | 425 | pod_set_stomp_param_3); |
426 | static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, | 426 | static DEVICE_ATTR(stomp_param_4, S_IWUSR | S_IRUGO, pod_get_stomp_param_4, |
427 | pod_set_stomp_param_4); | 427 | pod_set_stomp_param_4); |
428 | static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, | 428 | static DEVICE_ATTR(stomp_param_5, S_IWUSR | S_IRUGO, pod_get_stomp_param_5, |
429 | pod_set_stomp_param_5); | 429 | pod_set_stomp_param_5); |
430 | static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, | 430 | static DEVICE_ATTR(stomp_param_6, S_IWUSR | S_IRUGO, pod_get_stomp_param_6, |
431 | pod_set_stomp_param_6); | 431 | pod_set_stomp_param_6); |
432 | static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, | 432 | static DEVICE_ATTR(amp_switch_select, S_IWUSR | S_IRUGO, |
433 | pod_get_amp_switch_select, pod_set_amp_switch_select); | 433 | pod_get_amp_switch_select, pod_set_amp_switch_select); |
434 | static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, | 434 | static DEVICE_ATTR(delay_param_4, S_IWUSR | S_IRUGO, pod_get_delay_param_4, |
435 | pod_set_delay_param_4); | 435 | pod_set_delay_param_4); |
436 | static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, | 436 | static DEVICE_ATTR(delay_param_5, S_IWUSR | S_IRUGO, pod_get_delay_param_5, |
437 | pod_set_delay_param_5); | 437 | pod_set_delay_param_5); |
438 | static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, | 438 | static DEVICE_ATTR(delay_pre_post, S_IWUSR | S_IRUGO, pod_get_delay_pre_post, |
439 | pod_set_delay_pre_post); | 439 | pod_set_delay_pre_post); |
440 | static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, | 440 | static DEVICE_ATTR(delay_model, S_IWUSR | S_IRUGO, pod_get_delay_model, |
441 | pod_set_delay_model); | 441 | pod_set_delay_model); |
442 | static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, | 442 | static DEVICE_ATTR(delay_verb_model, S_IWUSR | S_IRUGO, |
443 | pod_get_delay_verb_model, pod_set_delay_verb_model); | 443 | pod_get_delay_verb_model, pod_set_delay_verb_model); |
444 | static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, | 444 | static DEVICE_ATTR(tempo_msb, S_IWUSR | S_IRUGO, pod_get_tempo_msb, |
445 | pod_set_tempo_msb); | 445 | pod_set_tempo_msb); |
446 | static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, | 446 | static DEVICE_ATTR(tempo_lsb, S_IWUSR | S_IRUGO, pod_get_tempo_lsb, |
447 | pod_set_tempo_lsb); | 447 | pod_set_tempo_lsb); |
448 | static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, | 448 | static DEVICE_ATTR(wah_model, S_IWUSR | S_IRUGO, pod_get_wah_model, |
449 | pod_set_wah_model); | 449 | pod_set_wah_model); |
450 | static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, | 450 | static DEVICE_ATTR(bypass_volume, S_IWUSR | S_IRUGO, pod_get_bypass_volume, |
451 | pod_set_bypass_volume); | 451 | pod_set_bypass_volume); |
452 | static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, | 452 | static DEVICE_ATTR(fx_loop_on_off, S_IWUSR | S_IRUGO, pod_get_fx_loop_on_off, |
453 | pod_set_fx_loop_on_off); | 453 | pod_set_fx_loop_on_off); |
454 | static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, | 454 | static DEVICE_ATTR(tweak_param_select, S_IWUSR | S_IRUGO, |
455 | pod_get_tweak_param_select, pod_set_tweak_param_select); | 455 | pod_get_tweak_param_select, pod_set_tweak_param_select); |
456 | static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, | 456 | static DEVICE_ATTR(amp1_engage, S_IWUSR | S_IRUGO, pod_get_amp1_engage, |
457 | pod_set_amp1_engage); | 457 | pod_set_amp1_engage); |
458 | static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, | 458 | static DEVICE_ATTR(band_1_gain, S_IWUSR | S_IRUGO, pod_get_band_1_gain, |
459 | pod_set_band_1_gain); | 459 | pod_set_band_1_gain); |
460 | static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, | 460 | static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUSR | S_IRUGO, |
461 | pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); | 461 | pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); |
462 | static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, | 462 | static DEVICE_ATTR(band_2_gain, S_IWUSR | S_IRUGO, pod_get_band_2_gain, |
463 | pod_set_band_2_gain); | 463 | pod_set_band_2_gain); |
464 | static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, | 464 | static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUSR | S_IRUGO, |
465 | pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); | 465 | pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); |
466 | static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, | 466 | static DEVICE_ATTR(band_3_gain, S_IWUSR | S_IRUGO, pod_get_band_3_gain, |
467 | pod_set_band_3_gain); | 467 | pod_set_band_3_gain); |
468 | static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, | 468 | static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUSR | S_IRUGO, |
469 | pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); | 469 | pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); |
470 | static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, | 470 | static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUSR | S_IRUGO, |
471 | pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); | 471 | pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); |
472 | static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, | 472 | static DEVICE_ATTR(band_4_gain, S_IWUSR | S_IRUGO, pod_get_band_4_gain, |
473 | pod_set_band_4_gain); | 473 | pod_set_band_4_gain); |
474 | static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, | 474 | static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUSR | S_IRUGO, |
475 | pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); | 475 | pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); |
476 | static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); | 476 | static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); |
477 | static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, | 477 | static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, |
diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c index 32b6ca75cadb..9b42e34763f1 100644 --- a/drivers/staging/line6/midi.c +++ b/drivers/staging/line6/midi.c | |||
@@ -362,8 +362,8 @@ static ssize_t midi_set_midi_mask_receive(struct device *dev, | |||
362 | return count; | 362 | return count; |
363 | } | 363 | } |
364 | 364 | ||
365 | static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); | 365 | static DEVICE_ATTR(midi_mask_transmit, S_IWUSR | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); |
366 | static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); | 366 | static DEVICE_ATTR(midi_mask_receive, S_IWUSR | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); |
367 | 367 | ||
368 | /* MIDI device destructor */ | 368 | /* MIDI device destructor */ |
369 | static int snd_line6_midi_free(struct snd_device *device) | 369 | static int snd_line6_midi_free(struct snd_device *device) |
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 28f514611abc..63318d717cd7 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c | |||
@@ -952,33 +952,33 @@ POD_GET_SYSTEM_PARAM(tuner_pitch, 1, 1); | |||
952 | #undef GET_SYSTEM_PARAM | 952 | #undef GET_SYSTEM_PARAM |
953 | 953 | ||
954 | /* POD special files: */ | 954 | /* POD special files: */ |
955 | static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, pod_set_channel); | 955 | static DEVICE_ATTR(channel, S_IWUSR | S_IRUGO, pod_get_channel, pod_set_channel); |
956 | static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); | 956 | static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); |
957 | static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); | 957 | static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); |
958 | static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); | 958 | static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); |
959 | static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump); | 959 | static DEVICE_ATTR(dump, S_IWUSR | S_IRUGO, pod_get_dump, pod_set_dump); |
960 | static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); | 960 | static DEVICE_ATTR(dump_buf, S_IWUSR | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); |
961 | static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish); | 961 | static DEVICE_ATTR(finish, S_IWUSR, line6_nop_read, pod_set_finish); |
962 | static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write); | 962 | static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write); |
963 | static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); | 963 | static DEVICE_ATTR(midi_postprocess, S_IWUSR | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); |
964 | static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); | 964 | static DEVICE_ATTR(monitor_level, S_IWUSR | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); |
965 | static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); | 965 | static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); |
966 | static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); | 966 | static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); |
967 | static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_amp_setup); | 967 | static DEVICE_ATTR(retrieve_amp_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_amp_setup); |
968 | static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, pod_set_retrieve_channel); | 968 | static DEVICE_ATTR(retrieve_channel, S_IWUSR, line6_nop_read, pod_set_retrieve_channel); |
969 | static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_effects_setup); | 969 | static DEVICE_ATTR(retrieve_effects_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_effects_setup); |
970 | static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, pod_set_routing); | 970 | static DEVICE_ATTR(routing, S_IWUSR | S_IRUGO, pod_get_routing, pod_set_routing); |
971 | static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write); | 971 | static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write); |
972 | static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, pod_set_store_amp_setup); | 972 | static DEVICE_ATTR(store_amp_setup, S_IWUSR, line6_nop_read, pod_set_store_amp_setup); |
973 | static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, pod_set_store_channel); | 973 | static DEVICE_ATTR(store_channel, S_IWUSR, line6_nop_read, pod_set_store_channel); |
974 | static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, pod_set_store_effects_setup); | 974 | static DEVICE_ATTR(store_effects_setup, S_IWUSR, line6_nop_read, pod_set_store_effects_setup); |
975 | static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); | 975 | static DEVICE_ATTR(tuner_freq, S_IWUSR | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); |
976 | static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); | 976 | static DEVICE_ATTR(tuner_mute, S_IWUSR | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); |
977 | static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); | 977 | static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); |
978 | static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); | 978 | static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); |
979 | 979 | ||
980 | #if CREATE_RAW_FILE | 980 | #if CREATE_RAW_FILE |
981 | static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); | 981 | static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
982 | #endif | 982 | #endif |
983 | 983 | ||
984 | /* | 984 | /* |
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c index e6770ea17936..db421781d550 100644 --- a/drivers/staging/line6/toneport.c +++ b/drivers/staging/line6/toneport.c | |||
@@ -124,9 +124,9 @@ static ssize_t toneport_set_led_green(struct device *dev, | |||
124 | return count; | 124 | return count; |
125 | } | 125 | } |
126 | 126 | ||
127 | static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, | 127 | static DEVICE_ATTR(led_red, S_IWUSR | S_IRUGO, line6_nop_read, |
128 | toneport_set_led_red); | 128 | toneport_set_led_red); |
129 | static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, | 129 | static DEVICE_ATTR(led_green, S_IWUSR | S_IRUGO, line6_nop_read, |
130 | toneport_set_led_green); | 130 | toneport_set_led_green); |
131 | 131 | ||
132 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) | 132 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) |
diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c index 58ddbe6393ff..b2fc09b05939 100644 --- a/drivers/staging/line6/variax.c +++ b/drivers/staging/line6/variax.c | |||
@@ -389,17 +389,17 @@ static ssize_t variax_set_raw2(struct device *dev, | |||
389 | #endif | 389 | #endif |
390 | 390 | ||
391 | /* Variax workbench special files: */ | 391 | /* Variax workbench special files: */ |
392 | static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, variax_set_model); | 392 | static DEVICE_ATTR(model, S_IWUSR | S_IRUGO, variax_get_model, variax_set_model); |
393 | static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, variax_set_volume); | 393 | static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO, variax_get_volume, variax_set_volume); |
394 | static DEVICE_ATTR(tone, S_IWUGO | S_IRUGO, variax_get_tone, variax_set_tone); | 394 | static DEVICE_ATTR(tone, S_IWUSR | S_IRUGO, variax_get_tone, variax_set_tone); |
395 | static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); | 395 | static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); |
396 | static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); | 396 | static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); |
397 | static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); | 397 | static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); |
398 | static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, variax_set_active); | 398 | static DEVICE_ATTR(active, S_IWUSR | S_IRUGO, variax_get_active, variax_set_active); |
399 | 399 | ||
400 | #if CREATE_RAW_FILE | 400 | #if CREATE_RAW_FILE |
401 | static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); | 401 | static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
402 | static DEVICE_ATTR(raw2, S_IWUGO, line6_nop_read, variax_set_raw2); | 402 | static DEVICE_ATTR(raw2, S_IWUSR, line6_nop_read, variax_set_raw2); |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | 405 | ||
diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c index 42783d7367e3..677152044f45 100644 --- a/drivers/staging/phison/phison.c +++ b/drivers/staging/phison/phison.c | |||
@@ -62,7 +62,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
62 | }; | 62 | }; |
63 | const struct ata_port_info *ppi[] = { &info, NULL }; | 63 | const struct ata_port_info *ppi[] = { &info, NULL }; |
64 | 64 | ||
65 | ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL, 0); | 65 | ret = ata_pci_bmdma_init_one(pdev, ppi, &phison_sht, NULL, 0); |
66 | 66 | ||
67 | dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); | 67 | dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); |
68 | 68 | ||
diff --git a/drivers/staging/rt2860/chips/rt3090.c b/drivers/staging/rt2860/chips/rt3090.c index c2933c69bc04..cbc59f8a7c24 100644 --- a/drivers/staging/rt2860/chips/rt3090.c +++ b/drivers/staging/rt2860/chips/rt3090.c | |||
@@ -51,7 +51,8 @@ void NICInitRT3090RFRegisters(struct rt_rtmp_adapter *pAd) | |||
51 | if (IS_RT3090(pAd)) { | 51 | if (IS_RT3090(pAd)) { |
52 | /* Init RF calibration */ | 52 | /* Init RF calibration */ |
53 | /* Driver should toggle RF R30 bit7 before init RF registers */ | 53 | /* Driver should toggle RF R30 bit7 before init RF registers */ |
54 | u32 RfReg = 0, data; | 54 | u8 RfReg; |
55 | u32 data; | ||
55 | 56 | ||
56 | RT30xxReadRFRegister(pAd, RF_R30, (u8 *)&RfReg); | 57 | RT30xxReadRFRegister(pAd, RF_R30, (u8 *)&RfReg); |
57 | RfReg |= 0x80; | 58 | RfReg |= 0x80; |
diff --git a/drivers/staging/rt2860/chips/rt30xx.c b/drivers/staging/rt2860/chips/rt30xx.c index 4367a196aeff..88eba5192edc 100644 --- a/drivers/staging/rt2860/chips/rt30xx.c +++ b/drivers/staging/rt2860/chips/rt30xx.c | |||
@@ -53,7 +53,7 @@ struct rt_reg_pair RT30xx_RFRegTable[] = { | |||
53 | , | 53 | , |
54 | {RF_R06, 0x02} | 54 | {RF_R06, 0x02} |
55 | , | 55 | , |
56 | {RF_R07, 0x70} | 56 | {RF_R07, 0x60} |
57 | , | 57 | , |
58 | {RF_R09, 0x0F} | 58 | {RF_R09, 0x0F} |
59 | , | 59 | , |
@@ -441,7 +441,7 @@ void RT30xxReverseRFSleepModeSetup(struct rt_rtmp_adapter *pAd) | |||
441 | 441 | ||
442 | /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */ | 442 | /* VCO_IC, RF R7 register Bit 4 & Bit 5 to 1 */ |
443 | RT30xxReadRFRegister(pAd, RF_R07, &RFValue); | 443 | RT30xxReadRFRegister(pAd, RF_R07, &RFValue); |
444 | RFValue |= 0x30; | 444 | RFValue |= 0x20; |
445 | RT30xxWriteRFRegister(pAd, RF_R07, RFValue); | 445 | RT30xxWriteRFRegister(pAd, RF_R07, RFValue); |
446 | 446 | ||
447 | /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */ | 447 | /* Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1 */ |
diff --git a/drivers/staging/rt2860/rt_main_dev.c b/drivers/staging/rt2860/rt_main_dev.c index ad60ceaf4b88..caf8b7623cb1 100644 --- a/drivers/staging/rt2860/rt_main_dev.c +++ b/drivers/staging/rt2860/rt_main_dev.c | |||
@@ -483,8 +483,6 @@ struct net_device *RtmpPhyNetDevInit(struct rt_rtmp_adapter *pAd, | |||
483 | net_dev->ml_priv = (void *)pAd; | 483 | net_dev->ml_priv = (void *)pAd; |
484 | pAd->net_dev = net_dev; | 484 | pAd->net_dev = net_dev; |
485 | 485 | ||
486 | netif_stop_queue(net_dev); | ||
487 | |||
488 | return net_dev; | 486 | return net_dev; |
489 | 487 | ||
490 | } | 488 | } |
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c index ebf9074a9083..aca0c468fa6c 100644 --- a/drivers/staging/rt2860/usb_main_dev.c +++ b/drivers/staging/rt2860/usb_main_dev.c | |||
@@ -65,6 +65,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
65 | {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ | 65 | {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ |
66 | {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ | 66 | {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ |
67 | {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */ | 67 | {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */ |
68 | {USB_DEVICE(0x050D, 0x935A)}, /* Belkin F6D4050 v1 */ | ||
68 | {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */ | 69 | {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */ |
69 | {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ | 70 | {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ |
70 | {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ | 71 | {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ |
@@ -105,6 +106,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
105 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ | 106 | {USB_DEVICE(0x0411, 0x016f)}, /* MelCo.,Inc. WLI-UC-G301N */ |
106 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ | 107 | {USB_DEVICE(0x1737, 0x0070)}, /* Linksys WUSB100 */ |
107 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ | 108 | {USB_DEVICE(0x1737, 0x0071)}, /* Linksys WUSB600N */ |
109 | {USB_DEVICE(0x1737, 0x0078)}, /* Linksys WUSB100v2 */ | ||
108 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ | 110 | {USB_DEVICE(0x0411, 0x00e8)}, /* Buffalo WLI-UC-G300N */ |
109 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ | 111 | {USB_DEVICE(0x050d, 0x815c)}, /* Belkin F5D8053 */ |
110 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ | 112 | {USB_DEVICE(0x100D, 0x9031)}, /* Motorola 2770 */ |
@@ -181,6 +183,7 @@ struct usb_device_id rtusb_usb_id[] = { | |||
181 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ | 183 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ |
182 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ | 184 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ |
183 | {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ | 185 | {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ |
186 | {USB_DEVICE(0x0411, 0x015D)}, /* Buffalo Airstation WLI-UC-GN */ | ||
184 | {} /* Terminating entry */ | 187 | {} /* Terminating entry */ |
185 | }; | 188 | }; |
186 | 189 | ||
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c index a0ece1fd64a5..e7e8745c9478 100644 --- a/drivers/staging/rtl8187se/r8185b_init.c +++ b/drivers/staging/rtl8187se/r8185b_init.c | |||
@@ -268,8 +268,12 @@ HwHSSIThreeWire( | |||
268 | } | 268 | } |
269 | udelay(10); | 269 | udelay(10); |
270 | } | 270 | } |
271 | if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) | 271 | if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { |
272 | panic("HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n", u1bTmp); | 272 | printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" |
273 | " %#X RE|WE bits are not clear!!\n", u1bTmp); | ||
274 | dump_stack(); | ||
275 | return 0; | ||
276 | } | ||
273 | 277 | ||
274 | // RTL8187S HSSI Read/Write Function | 278 | // RTL8187S HSSI Read/Write Function |
275 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); | 279 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); |
@@ -309,13 +313,23 @@ HwHSSIThreeWire( | |||
309 | int idx; | 313 | int idx; |
310 | int ByteCnt = nDataBufBitCnt / 8; | 314 | int ByteCnt = nDataBufBitCnt / 8; |
311 | //printk("%d\n",nDataBufBitCnt); | 315 | //printk("%d\n",nDataBufBitCnt); |
312 | if ((nDataBufBitCnt % 8) != 0) | 316 | if ((nDataBufBitCnt % 8) != 0) { |
313 | panic("HwThreeWire(): nDataBufBitCnt(%d) should be multiple of 8!!!\n", | 317 | printk(KERN_ERR "rtl8187se: " |
314 | nDataBufBitCnt); | 318 | "HwThreeWire(): nDataBufBitCnt(%d)" |
319 | " should be multiple of 8!!!\n", | ||
320 | nDataBufBitCnt); | ||
321 | dump_stack(); | ||
322 | nDataBufBitCnt += 8; | ||
323 | nDataBufBitCnt &= ~7; | ||
324 | } | ||
315 | 325 | ||
316 | if (nDataBufBitCnt > 64) | 326 | if (nDataBufBitCnt > 64) { |
317 | panic("HwThreeWire(): nDataBufBitCnt(%d) should <= 64!!!\n", | 327 | printk(KERN_ERR "rtl8187se: HwThreeWire():" |
318 | nDataBufBitCnt); | 328 | " nDataBufBitCnt(%d) should <= 64!!!\n", |
329 | nDataBufBitCnt); | ||
330 | dump_stack(); | ||
331 | nDataBufBitCnt = 64; | ||
332 | } | ||
319 | 333 | ||
320 | for(idx = 0; idx < ByteCnt; idx++) | 334 | for(idx = 0; idx < ByteCnt; idx++) |
321 | { | 335 | { |
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c index eb44b60e1eb5..ac2bf11e1119 100644 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ b/drivers/staging/samsung-laptop/samsung-laptop.c | |||
@@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct device *dev, | |||
356 | } | 356 | } |
357 | return count; | 357 | return count; |
358 | } | 358 | } |
359 | static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, | 359 | static DEVICE_ATTR(silent, S_IWUSR | S_IRUGO, |
360 | get_silent_state, set_silent_state); | 360 | get_silent_state, set_silent_state); |
361 | 361 | ||
362 | 362 | ||
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c index c7e061e5e04d..456cd5c95765 100644 --- a/drivers/staging/udlfb/udlfb.c +++ b/drivers/staging/udlfb/udlfb.c | |||
@@ -1143,7 +1143,7 @@ static struct device_attribute fb_device_attrs[] = { | |||
1143 | __ATTR_RO(metrics_bytes_sent), | 1143 | __ATTR_RO(metrics_bytes_sent), |
1144 | __ATTR_RO(metrics_cpu_kcycles_used), | 1144 | __ATTR_RO(metrics_cpu_kcycles_used), |
1145 | __ATTR_RO(metrics_misc), | 1145 | __ATTR_RO(metrics_misc), |
1146 | __ATTR(metrics_reset, S_IWUGO, NULL, metrics_reset_store), | 1146 | __ATTR(metrics_reset, S_IWUSR, NULL, metrics_reset_store), |
1147 | __ATTR_RW(use_defio), | 1147 | __ATTR_RW(use_defio), |
1148 | }; | 1148 | }; |
1149 | 1149 | ||
diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c index a2566f1075d5..af3832b03e4b 100644 --- a/drivers/staging/usbip/usbip_event.c +++ b/drivers/staging/usbip/usbip_event.c | |||
@@ -38,21 +38,13 @@ static int event_handler(struct usbip_device *ud) | |||
38 | ud->eh_ops.shutdown(ud); | 38 | ud->eh_ops.shutdown(ud); |
39 | 39 | ||
40 | ud->event &= ~USBIP_EH_SHUTDOWN; | 40 | ud->event &= ~USBIP_EH_SHUTDOWN; |
41 | |||
42 | break; | ||
43 | } | 41 | } |
44 | 42 | ||
45 | /* Stop the error handler. */ | ||
46 | if (ud->event & USBIP_EH_BYE) | ||
47 | return -1; | ||
48 | |||
49 | /* Reset the device. */ | 43 | /* Reset the device. */ |
50 | if (ud->event & USBIP_EH_RESET) { | 44 | if (ud->event & USBIP_EH_RESET) { |
51 | ud->eh_ops.reset(ud); | 45 | ud->eh_ops.reset(ud); |
52 | 46 | ||
53 | ud->event &= ~USBIP_EH_RESET; | 47 | ud->event &= ~USBIP_EH_RESET; |
54 | |||
55 | break; | ||
56 | } | 48 | } |
57 | 49 | ||
58 | /* Mark the device as unusable. */ | 50 | /* Mark the device as unusable. */ |
@@ -60,13 +52,11 @@ static int event_handler(struct usbip_device *ud) | |||
60 | ud->eh_ops.unusable(ud); | 52 | ud->eh_ops.unusable(ud); |
61 | 53 | ||
62 | ud->event &= ~USBIP_EH_UNUSABLE; | 54 | ud->event &= ~USBIP_EH_UNUSABLE; |
63 | |||
64 | break; | ||
65 | } | 55 | } |
66 | 56 | ||
67 | /* NOTREACHED */ | 57 | /* Stop the error handler. */ |
68 | printk(KERN_ERR "%s: unknown event\n", __func__); | 58 | if (ud->event & USBIP_EH_BYE) |
69 | return -1; | 59 | return -1; |
70 | } | 60 | } |
71 | 61 | ||
72 | return 0; | 62 | return 0; |
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index 0574d848b900..08bd26a245d5 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c | |||
@@ -164,6 +164,8 @@ void rh_port_disconnect(int rhport) | |||
164 | * spin_unlock(&vdev->ud.lock); */ | 164 | * spin_unlock(&vdev->ud.lock); */ |
165 | 165 | ||
166 | spin_unlock_irqrestore(&the_controller->lock, flags); | 166 | spin_unlock_irqrestore(&the_controller->lock, flags); |
167 | |||
168 | usb_hcd_poll_rh_status(vhci_to_hcd(the_controller)); | ||
167 | } | 169 | } |
168 | 170 | ||
169 | 171 | ||
@@ -797,20 +799,6 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
797 | spin_unlock_irqrestore(&vdev->priv_lock, flags2); | 799 | spin_unlock_irqrestore(&vdev->priv_lock, flags2); |
798 | } | 800 | } |
799 | 801 | ||
800 | |||
801 | if (!vdev->ud.tcp_socket) { | ||
802 | /* tcp connection is closed */ | ||
803 | usbip_uinfo("vhci_hcd: vhci_urb_dequeue() gives back urb %p\n", | ||
804 | urb); | ||
805 | |||
806 | usb_hcd_unlink_urb_from_ep(hcd, urb); | ||
807 | |||
808 | spin_unlock_irqrestore(&the_controller->lock, flags); | ||
809 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, | ||
810 | urb->status); | ||
811 | spin_lock_irqsave(&the_controller->lock, flags); | ||
812 | } | ||
813 | |||
814 | spin_unlock_irqrestore(&the_controller->lock, flags); | 802 | spin_unlock_irqrestore(&the_controller->lock, flags); |
815 | 803 | ||
816 | usbip_dbg_vhci_hc("leave\n"); | 804 | usbip_dbg_vhci_hc("leave\n"); |
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 722c840ac638..7e89383599e1 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
@@ -235,6 +235,7 @@ static int zram_read(struct zram *zram, struct bio *bio) | |||
235 | 235 | ||
236 | if (zram_test_flag(zram, index, ZRAM_ZERO)) { | 236 | if (zram_test_flag(zram, index, ZRAM_ZERO)) { |
237 | handle_zero_page(page); | 237 | handle_zero_page(page); |
238 | index++; | ||
238 | continue; | 239 | continue; |
239 | } | 240 | } |
240 | 241 | ||
@@ -243,12 +244,14 @@ static int zram_read(struct zram *zram, struct bio *bio) | |||
243 | pr_debug("Read before write: sector=%lu, size=%u", | 244 | pr_debug("Read before write: sector=%lu, size=%u", |
244 | (ulong)(bio->bi_sector), bio->bi_size); | 245 | (ulong)(bio->bi_sector), bio->bi_size); |
245 | /* Do nothing */ | 246 | /* Do nothing */ |
247 | index++; | ||
246 | continue; | 248 | continue; |
247 | } | 249 | } |
248 | 250 | ||
249 | /* Page is stored uncompressed since it's incompressible */ | 251 | /* Page is stored uncompressed since it's incompressible */ |
250 | if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { | 252 | if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { |
251 | handle_uncompressed_page(zram, page, index); | 253 | handle_uncompressed_page(zram, page, index); |
254 | index++; | ||
252 | continue; | 255 | continue; |
253 | } | 256 | } |
254 | 257 | ||
@@ -324,6 +327,7 @@ static int zram_write(struct zram *zram, struct bio *bio) | |||
324 | mutex_unlock(&zram->lock); | 327 | mutex_unlock(&zram->lock); |
325 | zram_stat_inc(&zram->stats.pages_zero); | 328 | zram_stat_inc(&zram->stats.pages_zero); |
326 | zram_set_flag(zram, index, ZRAM_ZERO); | 329 | zram_set_flag(zram, index, ZRAM_ZERO); |
330 | index++; | ||
327 | continue; | 331 | continue; |
328 | } | 332 | } |
329 | 333 | ||
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index ea071a5b6eee..44447f54942f 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -2301,7 +2301,7 @@ out: | |||
2301 | return ret; | 2301 | return ret; |
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); | 2304 | static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); |
2305 | 2305 | ||
2306 | static ssize_t read_human_status(struct device *dev, | 2306 | static ssize_t read_human_status(struct device *dev, |
2307 | struct device_attribute *attr, char *buf) | 2307 | struct device_attribute *attr, char *buf) |
@@ -2364,8 +2364,7 @@ out: | |||
2364 | return ret; | 2364 | return ret; |
2365 | } | 2365 | } |
2366 | 2366 | ||
2367 | static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, | 2367 | static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); |
2368 | read_human_status, NULL); | ||
2369 | 2368 | ||
2370 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | 2369 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, |
2371 | char *buf) | 2370 | char *buf) |
@@ -2397,7 +2396,7 @@ out: | |||
2397 | return ret; | 2396 | return ret; |
2398 | } | 2397 | } |
2399 | 2398 | ||
2400 | static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); | 2399 | static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); |
2401 | 2400 | ||
2402 | #define UEA_ATTR(name, reset) \ | 2401 | #define UEA_ATTR(name, reset) \ |
2403 | \ | 2402 | \ |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index bc62fae0680f..3ffa43477609 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1607,6 +1607,7 @@ static const struct usb_device_id acm_ids[] = { | |||
1607 | { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ | 1607 | { NOKIA_PCSUITE_ACM_INFO(0x0154), }, /* Nokia 5800 XpressMusic */ |
1608 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ | 1608 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ |
1609 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ | 1609 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ |
1610 | { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */ | ||
1610 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ | 1611 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ |
1611 | 1612 | ||
1612 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1613 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index f1aaff6202a5..045bb4b823e1 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) | |||
965 | 965 | ||
966 | static int proc_connectinfo(struct dev_state *ps, void __user *arg) | 966 | static int proc_connectinfo(struct dev_state *ps, void __user *arg) |
967 | { | 967 | { |
968 | struct usbdevfs_connectinfo ci; | 968 | struct usbdevfs_connectinfo ci = { |
969 | .devnum = ps->dev->devnum, | ||
970 | .slow = ps->dev->speed == USB_SPEED_LOW | ||
971 | }; | ||
969 | 972 | ||
970 | ci.devnum = ps->dev->devnum; | ||
971 | ci.slow = ps->dev->speed == USB_SPEED_LOW; | ||
972 | if (copy_to_user(arg, &ci, sizeof(ci))) | 973 | if (copy_to_user(arg, &ci, sizeof(ci))) |
973 | return -EFAULT; | 974 | return -EFAULT; |
974 | return 0; | 975 | return 0; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 5cca00a6d09d..b5c965c031f9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1945,7 +1945,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1945 | 1945 | ||
1946 | dev_dbg(&rhdev->dev, "usb %s%s\n", | 1946 | dev_dbg(&rhdev->dev, "usb %s%s\n", |
1947 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); | 1947 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); |
1948 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1949 | if (!hcd->driver->bus_resume) | 1948 | if (!hcd->driver->bus_resume) |
1950 | return -ENOENT; | 1949 | return -ENOENT; |
1951 | if (hcd->state == HC_STATE_RUNNING) | 1950 | if (hcd->state == HC_STATE_RUNNING) |
@@ -1953,6 +1952,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1953 | 1952 | ||
1954 | hcd->state = HC_STATE_RESUMING; | 1953 | hcd->state = HC_STATE_RESUMING; |
1955 | status = hcd->driver->bus_resume(hcd); | 1954 | status = hcd->driver->bus_resume(hcd); |
1955 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1956 | if (status == 0) { | 1956 | if (status == 0) { |
1957 | /* TRSMRCY = 10 msec */ | 1957 | /* TRSMRCY = 10 msec */ |
1958 | msleep(10); | 1958 | msleep(10); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 84c1897188d2..6c16c4f2c741 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -677,6 +677,8 @@ static void hub_init_func3(struct work_struct *ws); | |||
677 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | 677 | static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
678 | { | 678 | { |
679 | struct usb_device *hdev = hub->hdev; | 679 | struct usb_device *hdev = hub->hdev; |
680 | struct usb_hcd *hcd; | ||
681 | int ret; | ||
680 | int port1; | 682 | int port1; |
681 | int status; | 683 | int status; |
682 | bool need_debounce_delay = false; | 684 | bool need_debounce_delay = false; |
@@ -715,6 +717,25 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
715 | usb_autopm_get_interface_no_resume( | 717 | usb_autopm_get_interface_no_resume( |
716 | to_usb_interface(hub->intfdev)); | 718 | to_usb_interface(hub->intfdev)); |
717 | return; /* Continues at init2: below */ | 719 | return; /* Continues at init2: below */ |
720 | } else if (type == HUB_RESET_RESUME) { | ||
721 | /* The internal host controller state for the hub device | ||
722 | * may be gone after a host power loss on system resume. | ||
723 | * Update the device's info so the HW knows it's a hub. | ||
724 | */ | ||
725 | hcd = bus_to_hcd(hdev->bus); | ||
726 | if (hcd->driver->update_hub_device) { | ||
727 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
728 | &hub->tt, GFP_NOIO); | ||
729 | if (ret < 0) { | ||
730 | dev_err(hub->intfdev, "Host not " | ||
731 | "accepting hub info " | ||
732 | "update.\n"); | ||
733 | dev_err(hub->intfdev, "LS/FS devices " | ||
734 | "and hubs may not work " | ||
735 | "under this hub\n."); | ||
736 | } | ||
737 | } | ||
738 | hub_power_on(hub, true); | ||
718 | } else { | 739 | } else { |
719 | hub_power_on(hub, true); | 740 | hub_power_on(hub, true); |
720 | } | 741 | } |
@@ -2722,6 +2743,11 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2722 | udev->ttport = hdev->ttport; | 2743 | udev->ttport = hdev->ttport; |
2723 | } else if (udev->speed != USB_SPEED_HIGH | 2744 | } else if (udev->speed != USB_SPEED_HIGH |
2724 | && hdev->speed == USB_SPEED_HIGH) { | 2745 | && hdev->speed == USB_SPEED_HIGH) { |
2746 | if (!hub->tt.hub) { | ||
2747 | dev_err(&udev->dev, "parent hub has no TT\n"); | ||
2748 | retval = -EINVAL; | ||
2749 | goto fail; | ||
2750 | } | ||
2725 | udev->tt = &hub->tt; | 2751 | udev->tt = &hub->tt; |
2726 | udev->ttport = port1; | 2752 | udev->ttport = port1; |
2727 | } | 2753 | } |
@@ -2860,13 +2886,16 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2860 | else | 2886 | else |
2861 | i = udev->descriptor.bMaxPacketSize0; | 2887 | i = udev->descriptor.bMaxPacketSize0; |
2862 | if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { | 2888 | if (le16_to_cpu(udev->ep0.desc.wMaxPacketSize) != i) { |
2863 | if (udev->speed != USB_SPEED_FULL || | 2889 | if (udev->speed == USB_SPEED_LOW || |
2864 | !(i == 8 || i == 16 || i == 32 || i == 64)) { | 2890 | !(i == 8 || i == 16 || i == 32 || i == 64)) { |
2865 | dev_err(&udev->dev, "ep0 maxpacket = %d\n", i); | 2891 | dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", i); |
2866 | retval = -EMSGSIZE; | 2892 | retval = -EMSGSIZE; |
2867 | goto fail; | 2893 | goto fail; |
2868 | } | 2894 | } |
2869 | dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); | 2895 | if (udev->speed == USB_SPEED_FULL) |
2896 | dev_dbg(&udev->dev, "ep0 maxpacket = %d\n", i); | ||
2897 | else | ||
2898 | dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i); | ||
2870 | udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); | 2899 | udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i); |
2871 | usb_ep0_reinit(udev); | 2900 | usb_ep0_reinit(udev); |
2872 | } | 2901 | } |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 9f0ce7de0e36..d6e3e410477e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1140,13 +1140,6 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1140 | { | 1140 | { |
1141 | int i; | 1141 | int i; |
1142 | 1142 | ||
1143 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, | ||
1144 | skip_ep0 ? "non-ep0" : "all"); | ||
1145 | for (i = skip_ep0; i < 16; ++i) { | ||
1146 | usb_disable_endpoint(dev, i, true); | ||
1147 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
1148 | } | ||
1149 | |||
1150 | /* getting rid of interfaces will disconnect | 1143 | /* getting rid of interfaces will disconnect |
1151 | * any drivers bound to them (a key side effect) | 1144 | * any drivers bound to them (a key side effect) |
1152 | */ | 1145 | */ |
@@ -1176,6 +1169,13 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1176 | if (dev->state == USB_STATE_CONFIGURED) | 1169 | if (dev->state == USB_STATE_CONFIGURED) |
1177 | usb_set_device_state(dev, USB_STATE_ADDRESS); | 1170 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
1178 | } | 1171 | } |
1172 | |||
1173 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, | ||
1174 | skip_ep0 ? "non-ep0" : "all"); | ||
1175 | for (i = skip_ep0; i < 16; ++i) { | ||
1176 | usb_disable_endpoint(dev, i, true); | ||
1177 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
1178 | } | ||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | /** | 1181 | /** |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index d623c7bda1f6..2d19d88846ef 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
@@ -2014,6 +2014,9 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
2014 | } else { | 2014 | } else { |
2015 | disable_irq(gpio_to_irq(udc->vbus_pin)); | 2015 | disable_irq(gpio_to_irq(udc->vbus_pin)); |
2016 | } | 2016 | } |
2017 | } else { | ||
2018 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ | ||
2019 | udc->vbus_pin = -EINVAL; | ||
2017 | } | 2020 | } |
2018 | } | 2021 | } |
2019 | 2022 | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 1160c55de7f2..67746b19ac54 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -901,7 +901,8 @@ unknown: | |||
901 | */ | 901 | */ |
902 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 902 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
903 | case USB_RECIP_INTERFACE: | 903 | case USB_RECIP_INTERFACE: |
904 | f = cdev->config->interface[intf]; | 904 | if (cdev->config) |
905 | f = cdev->config->interface[intf]; | ||
905 | break; | 906 | break; |
906 | 907 | ||
907 | case USB_RECIP_ENDPOINT: | 908 | case USB_RECIP_ENDPOINT: |
@@ -1082,14 +1083,6 @@ static int composite_bind(struct usb_gadget *gadget) | |||
1082 | */ | 1083 | */ |
1083 | usb_ep_autoconfig_reset(cdev->gadget); | 1084 | usb_ep_autoconfig_reset(cdev->gadget); |
1084 | 1085 | ||
1085 | /* standardized runtime overrides for device ID data */ | ||
1086 | if (idVendor) | ||
1087 | cdev->desc.idVendor = cpu_to_le16(idVendor); | ||
1088 | if (idProduct) | ||
1089 | cdev->desc.idProduct = cpu_to_le16(idProduct); | ||
1090 | if (bcdDevice) | ||
1091 | cdev->desc.bcdDevice = cpu_to_le16(bcdDevice); | ||
1092 | |||
1093 | /* composite gadget needs to assign strings for whole device (like | 1086 | /* composite gadget needs to assign strings for whole device (like |
1094 | * serial number), register function drivers, potentially update | 1087 | * serial number), register function drivers, potentially update |
1095 | * power state and consumption, etc | 1088 | * power state and consumption, etc |
@@ -1101,6 +1094,14 @@ static int composite_bind(struct usb_gadget *gadget) | |||
1101 | cdev->desc = *composite->dev; | 1094 | cdev->desc = *composite->dev; |
1102 | cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; | 1095 | cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; |
1103 | 1096 | ||
1097 | /* standardized runtime overrides for device ID data */ | ||
1098 | if (idVendor) | ||
1099 | cdev->desc.idVendor = cpu_to_le16(idVendor); | ||
1100 | if (idProduct) | ||
1101 | cdev->desc.idProduct = cpu_to_le16(idProduct); | ||
1102 | if (bcdDevice) | ||
1103 | cdev->desc.bcdDevice = cpu_to_le16(bcdDevice); | ||
1104 | |||
1104 | /* strings can't be assigned before bind() allocates the | 1105 | /* strings can't be assigned before bind() allocates the |
1105 | * releavnt identifiers | 1106 | * releavnt identifiers |
1106 | */ | 1107 | */ |
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index d47a123f15ab..bd6226cbae86 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c | |||
@@ -111,7 +111,7 @@ acm_iad_descriptor = { | |||
111 | .bInterfaceCount = 2, // control + data | 111 | .bInterfaceCount = 2, // control + data |
112 | .bFunctionClass = USB_CLASS_COMM, | 112 | .bFunctionClass = USB_CLASS_COMM, |
113 | .bFunctionSubClass = USB_CDC_SUBCLASS_ACM, | 113 | .bFunctionSubClass = USB_CDC_SUBCLASS_ACM, |
114 | .bFunctionProtocol = USB_CDC_PROTO_NONE, | 114 | .bFunctionProtocol = USB_CDC_ACM_PROTO_AT_V25TER, |
115 | /* .iFunction = DYNAMIC */ | 115 | /* .iFunction = DYNAMIC */ |
116 | }; | 116 | }; |
117 | 117 | ||
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index a9474f8d5325..3c2f0a43c9c6 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -53,8 +53,8 @@ MODULE_AUTHOR("Michal Nazarewicz"); | |||
53 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
54 | 54 | ||
55 | 55 | ||
56 | static unsigned short gfs_vendor_id = 0x0525; /* XXX NetChip */ | 56 | static unsigned short gfs_vendor_id = 0x1d6b; /* Linux Foundation */ |
57 | static unsigned short gfs_product_id = 0xa4ac; /* XXX */ | 57 | static unsigned short gfs_product_id = 0x0105; /* FunctionFS Gadget */ |
58 | 58 | ||
59 | static struct usb_device_descriptor gfs_dev_desc = { | 59 | static struct usb_device_descriptor gfs_dev_desc = { |
60 | .bLength = sizeof gfs_dev_desc, | 60 | .bLength = sizeof gfs_dev_desc, |
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 795d76232167..36d67a32abef 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -74,8 +74,8 @@ MODULE_LICENSE("GPL"); | |||
74 | 74 | ||
75 | /***************************** Device Descriptor ****************************/ | 75 | /***************************** Device Descriptor ****************************/ |
76 | 76 | ||
77 | #define MULTI_VENDOR_NUM 0x0525 /* XXX NetChip */ | 77 | #define MULTI_VENDOR_NUM 0x1d6b /* Linux Foundation */ |
78 | #define MULTI_PRODUCT_NUM 0xa4ab /* XXX */ | 78 | #define MULTI_PRODUCT_NUM 0x0104 /* Multifunction Composite Gadget */ |
79 | 79 | ||
80 | 80 | ||
81 | enum { | 81 | enum { |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index cf241c371a71..15222ebf3422 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; | |||
131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). | 131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static ushort __initdata idVendor; | 134 | static ushort idVendor; |
135 | module_param(idVendor, ushort, S_IRUGO); | 135 | module_param(idVendor, ushort, S_IRUGO); |
136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); | 136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
137 | 137 | ||
138 | static ushort __initdata idProduct; | 138 | static ushort idProduct; |
139 | module_param(idProduct, ushort, S_IRUGO); | 139 | module_param(idProduct, ushort, S_IRUGO); |
140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); | 140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
141 | 141 | ||
142 | static ushort __initdata bcdDevice; | 142 | static ushort bcdDevice; |
143 | module_param(bcdDevice, ushort, S_IRUGO); | 143 | module_param(bcdDevice, ushort, S_IRUGO); |
144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); | 144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
145 | 145 | ||
146 | static char *__initdata iManufacturer; | 146 | static char *iManufacturer; |
147 | module_param(iManufacturer, charp, S_IRUGO); | 147 | module_param(iManufacturer, charp, S_IRUGO); |
148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); | 148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
149 | 149 | ||
150 | static char *__initdata iProduct; | 150 | static char *iProduct; |
151 | module_param(iProduct, charp, S_IRUGO); | 151 | module_param(iProduct, charp, S_IRUGO); |
152 | MODULE_PARM_DESC(iProduct, "USB Product string"); | 152 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
153 | 153 | ||
154 | static char *__initdata iSerialNum; | 154 | static char *iSerialNum; |
155 | module_param(iSerialNum, charp, S_IRUGO); | 155 | module_param(iSerialNum, charp, S_IRUGO); |
156 | MODULE_PARM_DESC(iSerialNum, "1"); | 156 | MODULE_PARM_DESC(iSerialNum, "1"); |
157 | 157 | ||
158 | static char *__initdata iPNPstring; | 158 | static char *iPNPstring; |
159 | module_param(iPNPstring, charp, S_IRUGO); | 159 | module_param(iPNPstring, charp, S_IRUGO); |
160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); | 160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
161 | 161 | ||
@@ -1596,13 +1596,12 @@ cleanup(void) | |||
1596 | int status; | 1596 | int status; |
1597 | 1597 | ||
1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); | 1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1599 | class_destroy(usb_gadget_class); | ||
1600 | unregister_chrdev_region(g_printer_devno, 2); | ||
1601 | |||
1602 | status = usb_gadget_unregister_driver(&printer_driver); | 1599 | status = usb_gadget_unregister_driver(&printer_driver); |
1603 | if (status) | 1600 | if (status) |
1604 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1601 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1605 | 1602 | ||
1603 | unregister_chrdev_region(g_printer_devno, 2); | ||
1604 | class_destroy(usb_gadget_class); | ||
1606 | mutex_unlock(&usb_printer_gadget.lock_printer_io); | 1605 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1607 | } | 1606 | } |
1608 | module_exit(cleanup); | 1607 | module_exit(cleanup); |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 2baf8a849086..a869e3c103d3 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -227,8 +227,8 @@ static int ehci_hcd_au1xxx_drv_suspend(struct device *dev) | |||
227 | * mark HW unaccessible. The PM and USB cores make sure that | 227 | * mark HW unaccessible. The PM and USB cores make sure that |
228 | * the root hub is either suspended or stopped. | 228 | * the root hub is either suspended or stopped. |
229 | */ | 229 | */ |
230 | spin_lock_irqsave(&ehci->lock, flags); | ||
231 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); | 230 | ehci_prepare_ports_for_controller_suspend(ehci, device_may_wakeup(dev)); |
231 | spin_lock_irqsave(&ehci->lock, flags); | ||
232 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | 232 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
233 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | 233 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
234 | 234 | ||
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 76b7fd2d838a..b349021c052b 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -1063,7 +1063,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
1063 | &debug_registers_fops)) | 1063 | &debug_registers_fops)) |
1064 | goto file_error; | 1064 | goto file_error; |
1065 | 1065 | ||
1066 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, | 1066 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, |
1067 | &debug_lpm_fops)) | 1067 | &debug_lpm_fops)) |
1068 | goto file_error; | 1068 | goto file_error; |
1069 | 1069 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 34a928d3b7d2..597ed102d54f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -114,6 +114,9 @@ MODULE_PARM_DESC(hird, "host initiated resume duration, +1 for each 75us\n"); | |||
114 | 114 | ||
115 | #define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) | 115 | #define INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT) |
116 | 116 | ||
117 | /* for ASPM quirk of ISOC on AMD SB800 */ | ||
118 | static struct pci_dev *amd_nb_dev; | ||
119 | |||
117 | /*-------------------------------------------------------------------------*/ | 120 | /*-------------------------------------------------------------------------*/ |
118 | 121 | ||
119 | #include "ehci.h" | 122 | #include "ehci.h" |
@@ -514,6 +517,11 @@ static void ehci_stop (struct usb_hcd *hcd) | |||
514 | spin_unlock_irq (&ehci->lock); | 517 | spin_unlock_irq (&ehci->lock); |
515 | ehci_mem_cleanup (ehci); | 518 | ehci_mem_cleanup (ehci); |
516 | 519 | ||
520 | if (amd_nb_dev) { | ||
521 | pci_dev_put(amd_nb_dev); | ||
522 | amd_nb_dev = NULL; | ||
523 | } | ||
524 | |||
517 | #ifdef EHCI_STATS | 525 | #ifdef EHCI_STATS |
518 | ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n", | 526 | ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld (lost %ld)\n", |
519 | ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim, | 527 | ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim, |
@@ -549,6 +557,8 @@ static int ehci_init(struct usb_hcd *hcd) | |||
549 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; | 557 | ehci->iaa_watchdog.function = ehci_iaa_watchdog; |
550 | ehci->iaa_watchdog.data = (unsigned long) ehci; | 558 | ehci->iaa_watchdog.data = (unsigned long) ehci; |
551 | 559 | ||
560 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
561 | |||
552 | /* | 562 | /* |
553 | * hw default: 1K periodic list heads, one per frame. | 563 | * hw default: 1K periodic list heads, one per frame. |
554 | * periodic_size can shrink by USBCMD update if hcc_params allows. | 564 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
@@ -556,11 +566,20 @@ static int ehci_init(struct usb_hcd *hcd) | |||
556 | ehci->periodic_size = DEFAULT_I_TDPS; | 566 | ehci->periodic_size = DEFAULT_I_TDPS; |
557 | INIT_LIST_HEAD(&ehci->cached_itd_list); | 567 | INIT_LIST_HEAD(&ehci->cached_itd_list); |
558 | INIT_LIST_HEAD(&ehci->cached_sitd_list); | 568 | INIT_LIST_HEAD(&ehci->cached_sitd_list); |
569 | |||
570 | if (HCC_PGM_FRAMELISTLEN(hcc_params)) { | ||
571 | /* periodic schedule size can be smaller than default */ | ||
572 | switch (EHCI_TUNE_FLS) { | ||
573 | case 0: ehci->periodic_size = 1024; break; | ||
574 | case 1: ehci->periodic_size = 512; break; | ||
575 | case 2: ehci->periodic_size = 256; break; | ||
576 | default: BUG(); | ||
577 | } | ||
578 | } | ||
559 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) | 579 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
560 | return retval; | 580 | return retval; |
561 | 581 | ||
562 | /* controllers may cache some of the periodic schedule ... */ | 582 | /* controllers may cache some of the periodic schedule ... */ |
563 | hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params); | ||
564 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache | 583 | if (HCC_ISOC_CACHE(hcc_params)) // full frame cache |
565 | ehci->i_thresh = 2 + 8; | 584 | ehci->i_thresh = 2 + 8; |
566 | else // N microframes cached | 585 | else // N microframes cached |
@@ -614,12 +633,6 @@ static int ehci_init(struct usb_hcd *hcd) | |||
614 | /* periodic schedule size can be smaller than default */ | 633 | /* periodic schedule size can be smaller than default */ |
615 | temp &= ~(3 << 2); | 634 | temp &= ~(3 << 2); |
616 | temp |= (EHCI_TUNE_FLS << 2); | 635 | temp |= (EHCI_TUNE_FLS << 2); |
617 | switch (EHCI_TUNE_FLS) { | ||
618 | case 0: ehci->periodic_size = 1024; break; | ||
619 | case 1: ehci->periodic_size = 512; break; | ||
620 | case 2: ehci->periodic_size = 256; break; | ||
621 | default: BUG(); | ||
622 | } | ||
623 | } | 636 | } |
624 | if (HCC_LPM(hcc_params)) { | 637 | if (HCC_LPM(hcc_params)) { |
625 | /* support link power management EHCI 1.1 addendum */ | 638 | /* support link power management EHCI 1.1 addendum */ |
@@ -1048,10 +1061,11 @@ rescan: | |||
1048 | tmp && tmp != qh; | 1061 | tmp && tmp != qh; |
1049 | tmp = tmp->qh_next.qh) | 1062 | tmp = tmp->qh_next.qh) |
1050 | continue; | 1063 | continue; |
1051 | /* periodic qh self-unlinks on empty */ | 1064 | /* periodic qh self-unlinks on empty, and a COMPLETING qh |
1052 | if (!tmp) | 1065 | * may already be unlinked. |
1053 | goto nogood; | 1066 | */ |
1054 | unlink_async (ehci, qh); | 1067 | if (tmp) |
1068 | unlink_async(ehci, qh); | ||
1055 | /* FALL THROUGH */ | 1069 | /* FALL THROUGH */ |
1056 | case QH_STATE_UNLINK: /* wait for hw to finish? */ | 1070 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
1057 | case QH_STATE_UNLINK_WAIT: | 1071 | case QH_STATE_UNLINK_WAIT: |
@@ -1068,7 +1082,6 @@ idle_timeout: | |||
1068 | } | 1082 | } |
1069 | /* else FALL THROUGH */ | 1083 | /* else FALL THROUGH */ |
1070 | default: | 1084 | default: |
1071 | nogood: | ||
1072 | /* caller was supposed to have unlinked any requests; | 1085 | /* caller was supposed to have unlinked any requests; |
1073 | * that's not our job. just leak this memory. | 1086 | * that's not our job. just leak this memory. |
1074 | */ | 1087 | */ |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 796ea0c8900f..8a515f0d5988 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -111,6 +111,7 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
111 | { | 111 | { |
112 | int port; | 112 | int port; |
113 | u32 temp; | 113 | u32 temp; |
114 | unsigned long flags; | ||
114 | 115 | ||
115 | /* If remote wakeup is enabled for the root hub but disabled | 116 | /* If remote wakeup is enabled for the root hub but disabled |
116 | * for the controller, we must adjust all the port wakeup flags | 117 | * for the controller, we must adjust all the port wakeup flags |
@@ -120,6 +121,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
120 | if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) | 121 | if (!ehci_to_hcd(ehci)->self.root_hub->do_remote_wakeup || do_wakeup) |
121 | return; | 122 | return; |
122 | 123 | ||
124 | spin_lock_irqsave(&ehci->lock, flags); | ||
125 | |||
123 | /* clear phy low-power mode before changing wakeup flags */ | 126 | /* clear phy low-power mode before changing wakeup flags */ |
124 | if (ehci->has_hostpc) { | 127 | if (ehci->has_hostpc) { |
125 | port = HCS_N_PORTS(ehci->hcs_params); | 128 | port = HCS_N_PORTS(ehci->hcs_params); |
@@ -131,7 +134,9 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
131 | temp = ehci_readl(ehci, hostpc_reg); | 134 | temp = ehci_readl(ehci, hostpc_reg); |
132 | ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); | 135 | ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); |
133 | } | 136 | } |
137 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
134 | msleep(5); | 138 | msleep(5); |
139 | spin_lock_irqsave(&ehci->lock, flags); | ||
135 | } | 140 | } |
136 | 141 | ||
137 | port = HCS_N_PORTS(ehci->hcs_params); | 142 | port = HCS_N_PORTS(ehci->hcs_params); |
@@ -170,6 +175,8 @@ static void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci, | |||
170 | /* Does the root hub have a port wakeup pending? */ | 175 | /* Does the root hub have a port wakeup pending? */ |
171 | if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) | 176 | if (!suspending && (ehci_readl(ehci, &ehci->regs->status) & STS_PCD)) |
172 | usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); | 177 | usb_hcd_resume_root_hub(ehci_to_hcd(ehci)); |
178 | |||
179 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
173 | } | 180 | } |
174 | 181 | ||
175 | static int ehci_bus_suspend (struct usb_hcd *hcd) | 182 | static int ehci_bus_suspend (struct usb_hcd *hcd) |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index a1e8d273103f..566791e04e8c 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -41,6 +41,42 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
41 | return 0; | 41 | return 0; |
42 | } | 42 | } |
43 | 43 | ||
44 | static int ehci_quirk_amd_hudson(struct ehci_hcd *ehci) | ||
45 | { | ||
46 | struct pci_dev *amd_smbus_dev; | ||
47 | u8 rev = 0; | ||
48 | |||
49 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | ||
50 | if (amd_smbus_dev) { | ||
51 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
52 | if (rev < 0x40) { | ||
53 | pci_dev_put(amd_smbus_dev); | ||
54 | amd_smbus_dev = NULL; | ||
55 | return 0; | ||
56 | } | ||
57 | } else { | ||
58 | amd_smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x780b, NULL); | ||
59 | if (!amd_smbus_dev) | ||
60 | return 0; | ||
61 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
62 | if (rev < 0x11 || rev > 0x18) { | ||
63 | pci_dev_put(amd_smbus_dev); | ||
64 | amd_smbus_dev = NULL; | ||
65 | return 0; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | if (!amd_nb_dev) | ||
70 | amd_nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); | ||
71 | |||
72 | ehci_info(ehci, "QUIRK: Enable exception for AMD Hudson ASPM\n"); | ||
73 | |||
74 | pci_dev_put(amd_smbus_dev); | ||
75 | amd_smbus_dev = NULL; | ||
76 | |||
77 | return 1; | ||
78 | } | ||
79 | |||
44 | /* called during probe() after chip reset completes */ | 80 | /* called during probe() after chip reset completes */ |
45 | static int ehci_pci_setup(struct usb_hcd *hcd) | 81 | static int ehci_pci_setup(struct usb_hcd *hcd) |
46 | { | 82 | { |
@@ -99,6 +135,9 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
99 | /* cache this readonly data; minimize chip reads */ | 135 | /* cache this readonly data; minimize chip reads */ |
100 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 136 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
101 | 137 | ||
138 | if (ehci_quirk_amd_hudson(ehci)) | ||
139 | ehci->amd_l1_fix = 1; | ||
140 | |||
102 | retval = ehci_halt(ehci); | 141 | retval = ehci_halt(ehci); |
103 | if (retval) | 142 | if (retval) |
104 | return retval; | 143 | return retval; |
@@ -148,6 +187,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
148 | if (pdev->revision < 0xa4) | 187 | if (pdev->revision < 0xa4) |
149 | ehci->no_selective_suspend = 1; | 188 | ehci->no_selective_suspend = 1; |
150 | break; | 189 | break; |
190 | |||
191 | /* MCP89 chips on the MacBookAir3,1 give EPROTO when | ||
192 | * fetching device descriptors unless LPM is disabled. | ||
193 | * There are also intermittent problems enumerating | ||
194 | * devices with PPCD enabled. | ||
195 | */ | ||
196 | case 0x0d9d: | ||
197 | ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89"); | ||
198 | ehci->has_lpm = 0; | ||
199 | ehci->has_ppcd = 0; | ||
200 | ehci->command &= ~CMD_PPCEE; | ||
201 | break; | ||
151 | } | 202 | } |
152 | break; | 203 | break; |
153 | case PCI_VENDOR_ID_VIA: | 204 | case PCI_VENDOR_ID_VIA: |
@@ -296,8 +347,8 @@ static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
296 | * mark HW unaccessible. The PM and USB cores make sure that | 347 | * mark HW unaccessible. The PM and USB cores make sure that |
297 | * the root hub is either suspended or stopped. | 348 | * the root hub is either suspended or stopped. |
298 | */ | 349 | */ |
299 | spin_lock_irqsave (&ehci->lock, flags); | ||
300 | ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); | 350 | ehci_prepare_ports_for_controller_suspend(ehci, do_wakeup); |
351 | spin_lock_irqsave (&ehci->lock, flags); | ||
301 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); | 352 | ehci_writel(ehci, 0, &ehci->regs->intr_enable); |
302 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); | 353 | (void)ehci_readl(ehci, &ehci->regs->intr_enable); |
303 | 354 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index a92526d6e5ae..724ba7133c4f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1583,6 +1583,63 @@ itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd) | |||
1583 | *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); | 1583 | *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); |
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | #define AB_REG_BAR_LOW 0xe0 | ||
1587 | #define AB_REG_BAR_HIGH 0xe1 | ||
1588 | #define AB_INDX(addr) ((addr) + 0x00) | ||
1589 | #define AB_DATA(addr) ((addr) + 0x04) | ||
1590 | #define NB_PCIE_INDX_ADDR 0xe0 | ||
1591 | #define NB_PCIE_INDX_DATA 0xe4 | ||
1592 | #define NB_PIF0_PWRDOWN_0 0x01100012 | ||
1593 | #define NB_PIF0_PWRDOWN_1 0x01100013 | ||
1594 | |||
1595 | static void ehci_quirk_amd_L1(struct ehci_hcd *ehci, int disable) | ||
1596 | { | ||
1597 | u32 addr, addr_low, addr_high, val; | ||
1598 | |||
1599 | outb_p(AB_REG_BAR_LOW, 0xcd6); | ||
1600 | addr_low = inb_p(0xcd7); | ||
1601 | outb_p(AB_REG_BAR_HIGH, 0xcd6); | ||
1602 | addr_high = inb_p(0xcd7); | ||
1603 | addr = addr_high << 8 | addr_low; | ||
1604 | outl_p(0x30, AB_INDX(addr)); | ||
1605 | outl_p(0x40, AB_DATA(addr)); | ||
1606 | outl_p(0x34, AB_INDX(addr)); | ||
1607 | val = inl_p(AB_DATA(addr)); | ||
1608 | |||
1609 | if (disable) { | ||
1610 | val &= ~0x8; | ||
1611 | val |= (1 << 4) | (1 << 9); | ||
1612 | } else { | ||
1613 | val |= 0x8; | ||
1614 | val &= ~((1 << 4) | (1 << 9)); | ||
1615 | } | ||
1616 | outl_p(val, AB_DATA(addr)); | ||
1617 | |||
1618 | if (amd_nb_dev) { | ||
1619 | addr = NB_PIF0_PWRDOWN_0; | ||
1620 | pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr); | ||
1621 | pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val); | ||
1622 | if (disable) | ||
1623 | val &= ~(0x3f << 7); | ||
1624 | else | ||
1625 | val |= 0x3f << 7; | ||
1626 | |||
1627 | pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val); | ||
1628 | |||
1629 | addr = NB_PIF0_PWRDOWN_1; | ||
1630 | pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_ADDR, addr); | ||
1631 | pci_read_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, &val); | ||
1632 | if (disable) | ||
1633 | val &= ~(0x3f << 7); | ||
1634 | else | ||
1635 | val |= 0x3f << 7; | ||
1636 | |||
1637 | pci_write_config_dword(amd_nb_dev, NB_PCIE_INDX_DATA, val); | ||
1638 | } | ||
1639 | |||
1640 | return; | ||
1641 | } | ||
1642 | |||
1586 | /* fit urb's itds into the selected schedule slot; activate as needed */ | 1643 | /* fit urb's itds into the selected schedule slot; activate as needed */ |
1587 | static int | 1644 | static int |
1588 | itd_link_urb ( | 1645 | itd_link_urb ( |
@@ -1609,6 +1666,12 @@ itd_link_urb ( | |||
1609 | urb->interval, | 1666 | urb->interval, |
1610 | next_uframe >> 3, next_uframe & 0x7); | 1667 | next_uframe >> 3, next_uframe & 0x7); |
1611 | } | 1668 | } |
1669 | |||
1670 | if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { | ||
1671 | if (ehci->amd_l1_fix == 1) | ||
1672 | ehci_quirk_amd_L1(ehci, 1); | ||
1673 | } | ||
1674 | |||
1612 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; | 1675 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; |
1613 | 1676 | ||
1614 | /* fill iTDs uframe by uframe */ | 1677 | /* fill iTDs uframe by uframe */ |
@@ -1733,6 +1796,11 @@ itd_complete ( | |||
1733 | (void) disable_periodic(ehci); | 1796 | (void) disable_periodic(ehci); |
1734 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; | 1797 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
1735 | 1798 | ||
1799 | if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { | ||
1800 | if (ehci->amd_l1_fix == 1) | ||
1801 | ehci_quirk_amd_L1(ehci, 0); | ||
1802 | } | ||
1803 | |||
1736 | if (unlikely(list_is_singular(&stream->td_list))) { | 1804 | if (unlikely(list_is_singular(&stream->td_list))) { |
1737 | ehci_to_hcd(ehci)->self.bandwidth_allocated | 1805 | ehci_to_hcd(ehci)->self.bandwidth_allocated |
1738 | -= stream->bandwidth; | 1806 | -= stream->bandwidth; |
@@ -2018,6 +2086,12 @@ sitd_link_urb ( | |||
2018 | (next_uframe >> 3) & (ehci->periodic_size - 1), | 2086 | (next_uframe >> 3) & (ehci->periodic_size - 1), |
2019 | stream->interval, hc32_to_cpu(ehci, stream->splits)); | 2087 | stream->interval, hc32_to_cpu(ehci, stream->splits)); |
2020 | } | 2088 | } |
2089 | |||
2090 | if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { | ||
2091 | if (ehci->amd_l1_fix == 1) | ||
2092 | ehci_quirk_amd_L1(ehci, 1); | ||
2093 | } | ||
2094 | |||
2021 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; | 2095 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++; |
2022 | 2096 | ||
2023 | /* fill sITDs frame by frame */ | 2097 | /* fill sITDs frame by frame */ |
@@ -2118,6 +2192,11 @@ sitd_complete ( | |||
2118 | (void) disable_periodic(ehci); | 2192 | (void) disable_periodic(ehci); |
2119 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; | 2193 | ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; |
2120 | 2194 | ||
2195 | if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { | ||
2196 | if (ehci->amd_l1_fix == 1) | ||
2197 | ehci_quirk_amd_L1(ehci, 0); | ||
2198 | } | ||
2199 | |||
2121 | if (list_is_singular(&stream->td_list)) { | 2200 | if (list_is_singular(&stream->td_list)) { |
2122 | ehci_to_hcd(ehci)->self.bandwidth_allocated | 2201 | ehci_to_hcd(ehci)->self.bandwidth_allocated |
2123 | -= stream->bandwidth; | 2202 | -= stream->bandwidth; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bde823f704e9..fd1c53da89e4 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -130,6 +130,7 @@ struct ehci_hcd { /* one per controller */ | |||
130 | unsigned has_amcc_usb23:1; | 130 | unsigned has_amcc_usb23:1; |
131 | unsigned need_io_watchdog:1; | 131 | unsigned need_io_watchdog:1; |
132 | unsigned broken_periodic:1; | 132 | unsigned broken_periodic:1; |
133 | unsigned amd_l1_fix:1; | ||
133 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ | 134 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ |
134 | 135 | ||
135 | /* required for usb32 quirk */ | 136 | /* required for usb32 quirk */ |
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index 10e1872f3ab9..931d588c3fb5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c | |||
@@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_jz4740_driver = { | |||
273 | }, | 273 | }, |
274 | }; | 274 | }; |
275 | 275 | ||
276 | MODULE_ALIAS("platfrom:jz4740-ohci"); | 276 | MODULE_ALIAS("platform:jz4740-ohci"); |
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 95d0f5adfdcf..25563e9a90bc 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
@@ -227,7 +227,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
227 | int odd = len & 0x0001; | 227 | int odd = len & 0x0001; |
228 | 228 | ||
229 | len = len / 2; | 229 | len = len / 2; |
230 | ioread16_rep(fifoaddr, buf, len); | 230 | iowrite16_rep(fifoaddr, buf, len); |
231 | if (unlikely(odd)) { | 231 | if (unlikely(odd)) { |
232 | buf = &buf[len]; | 232 | buf = &buf[len]; |
233 | iowrite8((unsigned char)*buf, fifoaddr); | 233 | iowrite8((unsigned char)*buf, fifoaddr); |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index a1a7a9795536..480936a870ce 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -132,6 +132,13 @@ static u32 xhci_port_state_to_neutral(u32 state) | |||
132 | static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, | 132 | static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, |
133 | u32 __iomem *addr, u32 port_status) | 133 | u32 __iomem *addr, u32 port_status) |
134 | { | 134 | { |
135 | /* Don't allow the USB core to disable SuperSpeed ports. */ | ||
136 | if (xhci->port_array[wIndex] == 0x03) { | ||
137 | xhci_dbg(xhci, "Ignoring request to disable " | ||
138 | "SuperSpeed port.\n"); | ||
139 | return; | ||
140 | } | ||
141 | |||
135 | /* Write 1 to disable the port */ | 142 | /* Write 1 to disable the port */ |
136 | xhci_writel(xhci, port_status | PORT_PE, addr); | 143 | xhci_writel(xhci, port_status | PORT_PE, addr); |
137 | port_status = xhci_readl(xhci, addr); | 144 | port_status = xhci_readl(xhci, addr); |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 4e51343ddffc..6627a956fa8e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1043,7 +1043,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | |||
1043 | if (udev->speed == USB_SPEED_SUPER) | 1043 | if (udev->speed == USB_SPEED_SUPER) |
1044 | return ep->ss_ep_comp.wBytesPerInterval; | 1044 | return ep->ss_ep_comp.wBytesPerInterval; |
1045 | 1045 | ||
1046 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1046 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
1047 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; | 1047 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; |
1048 | /* A 0 in max burst means 1 transfer per ESIT */ | 1048 | /* A 0 in max burst means 1 transfer per ESIT */ |
1049 | return max_packet * (max_burst + 1); | 1049 | return max_packet * (max_burst + 1); |
@@ -1133,7 +1133,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
1133 | /* Fall through */ | 1133 | /* Fall through */ |
1134 | case USB_SPEED_FULL: | 1134 | case USB_SPEED_FULL: |
1135 | case USB_SPEED_LOW: | 1135 | case USB_SPEED_LOW: |
1136 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1136 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
1137 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); | 1137 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
1138 | break; | 1138 | break; |
1139 | default: | 1139 | default: |
@@ -1441,6 +1441,13 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1441 | xhci->dcbaa = NULL; | 1441 | xhci->dcbaa = NULL; |
1442 | 1442 | ||
1443 | scratchpad_free(xhci); | 1443 | scratchpad_free(xhci); |
1444 | |||
1445 | xhci->num_usb2_ports = 0; | ||
1446 | xhci->num_usb3_ports = 0; | ||
1447 | kfree(xhci->usb2_ports); | ||
1448 | kfree(xhci->usb3_ports); | ||
1449 | kfree(xhci->port_array); | ||
1450 | |||
1444 | xhci->page_size = 0; | 1451 | xhci->page_size = 0; |
1445 | xhci->page_shift = 0; | 1452 | xhci->page_shift = 0; |
1446 | } | 1453 | } |
@@ -1624,6 +1631,166 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) | |||
1624 | &xhci->ir_set->erst_dequeue); | 1631 | &xhci->ir_set->erst_dequeue); |
1625 | } | 1632 | } |
1626 | 1633 | ||
1634 | static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, | ||
1635 | u32 __iomem *addr, u8 major_revision) | ||
1636 | { | ||
1637 | u32 temp, port_offset, port_count; | ||
1638 | int i; | ||
1639 | |||
1640 | if (major_revision > 0x03) { | ||
1641 | xhci_warn(xhci, "Ignoring unknown port speed, " | ||
1642 | "Ext Cap %p, revision = 0x%x\n", | ||
1643 | addr, major_revision); | ||
1644 | /* Ignoring port protocol we can't understand. FIXME */ | ||
1645 | return; | ||
1646 | } | ||
1647 | |||
1648 | /* Port offset and count in the third dword, see section 7.2 */ | ||
1649 | temp = xhci_readl(xhci, addr + 2); | ||
1650 | port_offset = XHCI_EXT_PORT_OFF(temp); | ||
1651 | port_count = XHCI_EXT_PORT_COUNT(temp); | ||
1652 | xhci_dbg(xhci, "Ext Cap %p, port offset = %u, " | ||
1653 | "count = %u, revision = 0x%x\n", | ||
1654 | addr, port_offset, port_count, major_revision); | ||
1655 | /* Port count includes the current port offset */ | ||
1656 | if (port_offset == 0 || (port_offset + port_count - 1) > num_ports) | ||
1657 | /* WTF? "Valid values are ‘1’ to MaxPorts" */ | ||
1658 | return; | ||
1659 | port_offset--; | ||
1660 | for (i = port_offset; i < (port_offset + port_count); i++) { | ||
1661 | /* Duplicate entry. Ignore the port if the revisions differ. */ | ||
1662 | if (xhci->port_array[i] != 0) { | ||
1663 | xhci_warn(xhci, "Duplicate port entry, Ext Cap %p," | ||
1664 | " port %u\n", addr, i); | ||
1665 | xhci_warn(xhci, "Port was marked as USB %u, " | ||
1666 | "duplicated as USB %u\n", | ||
1667 | xhci->port_array[i], major_revision); | ||
1668 | /* Only adjust the roothub port counts if we haven't | ||
1669 | * found a similar duplicate. | ||
1670 | */ | ||
1671 | if (xhci->port_array[i] != major_revision && | ||
1672 | xhci->port_array[i] != (u8) -1) { | ||
1673 | if (xhci->port_array[i] == 0x03) | ||
1674 | xhci->num_usb3_ports--; | ||
1675 | else | ||
1676 | xhci->num_usb2_ports--; | ||
1677 | xhci->port_array[i] = (u8) -1; | ||
1678 | } | ||
1679 | /* FIXME: Should we disable the port? */ | ||
1680 | continue; | ||
1681 | } | ||
1682 | xhci->port_array[i] = major_revision; | ||
1683 | if (major_revision == 0x03) | ||
1684 | xhci->num_usb3_ports++; | ||
1685 | else | ||
1686 | xhci->num_usb2_ports++; | ||
1687 | } | ||
1688 | /* FIXME: Should we disable ports not in the Extended Capabilities? */ | ||
1689 | } | ||
1690 | |||
1691 | /* | ||
1692 | * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that | ||
1693 | * specify what speeds each port is supposed to be. We can't count on the port | ||
1694 | * speed bits in the PORTSC register being correct until a device is connected, | ||
1695 | * but we need to set up the two fake roothubs with the correct number of USB | ||
1696 | * 3.0 and USB 2.0 ports at host controller initialization time. | ||
1697 | */ | ||
1698 | static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | ||
1699 | { | ||
1700 | u32 __iomem *addr; | ||
1701 | u32 offset; | ||
1702 | unsigned int num_ports; | ||
1703 | int i, port_index; | ||
1704 | |||
1705 | addr = &xhci->cap_regs->hcc_params; | ||
1706 | offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr)); | ||
1707 | if (offset == 0) { | ||
1708 | xhci_err(xhci, "No Extended Capability registers, " | ||
1709 | "unable to set up roothub.\n"); | ||
1710 | return -ENODEV; | ||
1711 | } | ||
1712 | |||
1713 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | ||
1714 | xhci->port_array = kzalloc(sizeof(*xhci->port_array)*num_ports, flags); | ||
1715 | if (!xhci->port_array) | ||
1716 | return -ENOMEM; | ||
1717 | |||
1718 | /* | ||
1719 | * For whatever reason, the first capability offset is from the | ||
1720 | * capability register base, not from the HCCPARAMS register. | ||
1721 | * See section 5.3.6 for offset calculation. | ||
1722 | */ | ||
1723 | addr = &xhci->cap_regs->hc_capbase + offset; | ||
1724 | while (1) { | ||
1725 | u32 cap_id; | ||
1726 | |||
1727 | cap_id = xhci_readl(xhci, addr); | ||
1728 | if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) | ||
1729 | xhci_add_in_port(xhci, num_ports, addr, | ||
1730 | (u8) XHCI_EXT_PORT_MAJOR(cap_id)); | ||
1731 | offset = XHCI_EXT_CAPS_NEXT(cap_id); | ||
1732 | if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports) | ||
1733 | == num_ports) | ||
1734 | break; | ||
1735 | /* | ||
1736 | * Once you're into the Extended Capabilities, the offset is | ||
1737 | * always relative to the register holding the offset. | ||
1738 | */ | ||
1739 | addr += offset; | ||
1740 | } | ||
1741 | |||
1742 | if (xhci->num_usb2_ports == 0 && xhci->num_usb3_ports == 0) { | ||
1743 | xhci_warn(xhci, "No ports on the roothubs?\n"); | ||
1744 | return -ENODEV; | ||
1745 | } | ||
1746 | xhci_dbg(xhci, "Found %u USB 2.0 ports and %u USB 3.0 ports.\n", | ||
1747 | xhci->num_usb2_ports, xhci->num_usb3_ports); | ||
1748 | /* | ||
1749 | * Note we could have all USB 3.0 ports, or all USB 2.0 ports. | ||
1750 | * Not sure how the USB core will handle a hub with no ports... | ||
1751 | */ | ||
1752 | if (xhci->num_usb2_ports) { | ||
1753 | xhci->usb2_ports = kmalloc(sizeof(*xhci->usb2_ports)* | ||
1754 | xhci->num_usb2_ports, flags); | ||
1755 | if (!xhci->usb2_ports) | ||
1756 | return -ENOMEM; | ||
1757 | |||
1758 | port_index = 0; | ||
1759 | for (i = 0; i < num_ports; i++) { | ||
1760 | if (xhci->port_array[i] == 0x03 || | ||
1761 | xhci->port_array[i] == 0 || | ||
1762 | xhci->port_array[i] == -1) | ||
1763 | continue; | ||
1764 | |||
1765 | xhci->usb2_ports[port_index] = | ||
1766 | &xhci->op_regs->port_status_base + | ||
1767 | NUM_PORT_REGS*i; | ||
1768 | xhci_dbg(xhci, "USB 2.0 port at index %u, " | ||
1769 | "addr = %p\n", i, | ||
1770 | xhci->usb2_ports[port_index]); | ||
1771 | port_index++; | ||
1772 | } | ||
1773 | } | ||
1774 | if (xhci->num_usb3_ports) { | ||
1775 | xhci->usb3_ports = kmalloc(sizeof(*xhci->usb3_ports)* | ||
1776 | xhci->num_usb3_ports, flags); | ||
1777 | if (!xhci->usb3_ports) | ||
1778 | return -ENOMEM; | ||
1779 | |||
1780 | port_index = 0; | ||
1781 | for (i = 0; i < num_ports; i++) | ||
1782 | if (xhci->port_array[i] == 0x03) { | ||
1783 | xhci->usb3_ports[port_index] = | ||
1784 | &xhci->op_regs->port_status_base + | ||
1785 | NUM_PORT_REGS*i; | ||
1786 | xhci_dbg(xhci, "USB 3.0 port at index %u, " | ||
1787 | "addr = %p\n", i, | ||
1788 | xhci->usb3_ports[port_index]); | ||
1789 | port_index++; | ||
1790 | } | ||
1791 | } | ||
1792 | return 0; | ||
1793 | } | ||
1627 | 1794 | ||
1628 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | 1795 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
1629 | { | 1796 | { |
@@ -1804,6 +1971,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1804 | 1971 | ||
1805 | if (scratchpad_alloc(xhci, flags)) | 1972 | if (scratchpad_alloc(xhci, flags)) |
1806 | goto fail; | 1973 | goto fail; |
1974 | if (xhci_setup_port_arrays(xhci, flags)) | ||
1975 | goto fail; | ||
1807 | 1976 | ||
1808 | return 0; | 1977 | return 0; |
1809 | 1978 | ||
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 48e60d166ff0..e7547d8b3d67 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2028,7 +2028,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
2028 | 2028 | ||
2029 | if (!(status & STS_EINT)) { | 2029 | if (!(status & STS_EINT)) { |
2030 | spin_unlock(&xhci->lock); | 2030 | spin_unlock(&xhci->lock); |
2031 | xhci_warn(xhci, "Spurious interrupt.\n"); | ||
2032 | return IRQ_NONE; | 2031 | return IRQ_NONE; |
2033 | } | 2032 | } |
2034 | xhci_dbg(xhci, "op reg status = %08x\n", status); | 2033 | xhci_dbg(xhci, "op reg status = %08x\n", status); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d5c550ea3e68..96ef552cfeb3 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -508,9 +508,10 @@ void xhci_stop(struct usb_hcd *hcd) | |||
508 | spin_lock_irq(&xhci->lock); | 508 | spin_lock_irq(&xhci->lock); |
509 | xhci_halt(xhci); | 509 | xhci_halt(xhci); |
510 | xhci_reset(xhci); | 510 | xhci_reset(xhci); |
511 | xhci_cleanup_msix(xhci); | ||
512 | spin_unlock_irq(&xhci->lock); | 511 | spin_unlock_irq(&xhci->lock); |
513 | 512 | ||
513 | xhci_cleanup_msix(xhci); | ||
514 | |||
514 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 515 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
515 | /* Tell the event ring poll function not to reschedule */ | 516 | /* Tell the event ring poll function not to reschedule */ |
516 | xhci->zombie = 1; | 517 | xhci->zombie = 1; |
@@ -544,9 +545,10 @@ void xhci_shutdown(struct usb_hcd *hcd) | |||
544 | 545 | ||
545 | spin_lock_irq(&xhci->lock); | 546 | spin_lock_irq(&xhci->lock); |
546 | xhci_halt(xhci); | 547 | xhci_halt(xhci); |
547 | xhci_cleanup_msix(xhci); | ||
548 | spin_unlock_irq(&xhci->lock); | 548 | spin_unlock_irq(&xhci->lock); |
549 | 549 | ||
550 | xhci_cleanup_msix(xhci); | ||
551 | |||
550 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", | 552 | xhci_dbg(xhci, "xhci_shutdown completed - status = %x\n", |
551 | xhci_readl(xhci, &xhci->op_regs->status)); | 553 | xhci_readl(xhci, &xhci->op_regs->status)); |
552 | } | 554 | } |
@@ -1284,6 +1286,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, | |||
1284 | cmd_completion = command->completion; | 1286 | cmd_completion = command->completion; |
1285 | cmd_status = &command->status; | 1287 | cmd_status = &command->status; |
1286 | command->command_trb = xhci->cmd_ring->enqueue; | 1288 | command->command_trb = xhci->cmd_ring->enqueue; |
1289 | |||
1290 | /* Enqueue pointer can be left pointing to the link TRB, | ||
1291 | * we must handle that | ||
1292 | */ | ||
1293 | if ((command->command_trb->link.control & TRB_TYPE_BITMASK) | ||
1294 | == TRB_TYPE(TRB_LINK)) | ||
1295 | command->command_trb = | ||
1296 | xhci->cmd_ring->enq_seg->next->trbs; | ||
1297 | |||
1287 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); | 1298 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); |
1288 | } else { | 1299 | } else { |
1289 | in_ctx = virt_dev->in_ctx; | 1300 | in_ctx = virt_dev->in_ctx; |
@@ -1993,6 +2004,15 @@ int xhci_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
1993 | /* Attempt to submit the Reset Device command to the command ring */ | 2004 | /* Attempt to submit the Reset Device command to the command ring */ |
1994 | spin_lock_irqsave(&xhci->lock, flags); | 2005 | spin_lock_irqsave(&xhci->lock, flags); |
1995 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; | 2006 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; |
2007 | |||
2008 | /* Enqueue pointer can be left pointing to the link TRB, | ||
2009 | * we must handle that | ||
2010 | */ | ||
2011 | if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK) | ||
2012 | == TRB_TYPE(TRB_LINK)) | ||
2013 | reset_device_cmd->command_trb = | ||
2014 | xhci->cmd_ring->enq_seg->next->trbs; | ||
2015 | |||
1996 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); | 2016 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); |
1997 | ret = xhci_queue_reset_device(xhci, slot_id); | 2017 | ret = xhci_queue_reset_device(xhci, slot_id); |
1998 | if (ret) { | 2018 | if (ret) { |
@@ -2148,8 +2168,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
2148 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 2168 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
2149 | return 0; | 2169 | return 0; |
2150 | } | 2170 | } |
2151 | /* xhci_alloc_virt_device() does not touch rings; no need to lock */ | 2171 | /* xhci_alloc_virt_device() does not touch rings; no need to lock. |
2152 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_KERNEL)) { | 2172 | * Use GFP_NOIO, since this function can be called from |
2173 | * xhci_discover_or_reset_device(), which may be called as part of | ||
2174 | * mass storage driver error handling. | ||
2175 | */ | ||
2176 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | ||
2153 | /* Disable slot, if we can do it without mem alloc */ | 2177 | /* Disable slot, if we can do it without mem alloc */ |
2154 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 2178 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
2155 | spin_lock_irqsave(&xhci->lock, flags); | 2179 | spin_lock_irqsave(&xhci->lock, flags); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 34a60d9f056a..404ecbce5128 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -448,6 +448,24 @@ struct xhci_doorbell_array { | |||
448 | 448 | ||
449 | 449 | ||
450 | /** | 450 | /** |
451 | * struct xhci_protocol_caps | ||
452 | * @revision: major revision, minor revision, capability ID, | ||
453 | * and next capability pointer. | ||
454 | * @name_string: Four ASCII characters to say which spec this xHC | ||
455 | * follows, typically "USB ". | ||
456 | * @port_info: Port offset, count, and protocol-defined information. | ||
457 | */ | ||
458 | struct xhci_protocol_caps { | ||
459 | u32 revision; | ||
460 | u32 name_string; | ||
461 | u32 port_info; | ||
462 | }; | ||
463 | |||
464 | #define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff) | ||
465 | #define XHCI_EXT_PORT_OFF(x) ((x) & 0xff) | ||
466 | #define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff) | ||
467 | |||
468 | /** | ||
451 | * struct xhci_container_ctx | 469 | * struct xhci_container_ctx |
452 | * @type: Type of context. Used to calculated offsets to contained contexts. | 470 | * @type: Type of context. Used to calculated offsets to contained contexts. |
453 | * @size: Size of the context data | 471 | * @size: Size of the context data |
@@ -614,6 +632,11 @@ struct xhci_ep_ctx { | |||
614 | #define MAX_PACKET_MASK (0xffff << 16) | 632 | #define MAX_PACKET_MASK (0xffff << 16) |
615 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) | 633 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
616 | 634 | ||
635 | /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. | ||
636 | * USB2.0 spec 9.6.6. | ||
637 | */ | ||
638 | #define GET_MAX_PACKET(p) ((p) & 0x7ff) | ||
639 | |||
617 | /* tx_info bitmasks */ | 640 | /* tx_info bitmasks */ |
618 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) | 641 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
619 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) | 642 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
@@ -1199,6 +1222,15 @@ struct xhci_hcd { | |||
1199 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1222 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
1200 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1223 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
1201 | #define XHCI_NEC_HOST (1 << 2) | 1224 | #define XHCI_NEC_HOST (1 << 2) |
1225 | |||
1226 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | ||
1227 | u8 *port_array; | ||
1228 | /* Array of pointers to USB 3.0 PORTSC registers */ | ||
1229 | u32 __iomem **usb3_ports; | ||
1230 | unsigned int num_usb3_ports; | ||
1231 | /* Array of pointers to USB 2.0 PORTSC registers */ | ||
1232 | u32 __iomem **usb2_ports; | ||
1233 | unsigned int num_usb2_ports; | ||
1202 | }; | 1234 | }; |
1203 | 1235 | ||
1204 | /* For testing purposes */ | 1236 | /* For testing purposes */ |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 2f43c57743c9..9251773ecef4 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
@@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, | |||
196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
197 | } | 197 | } |
198 | 198 | ||
199 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | 199 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); |
200 | get_port0_handler, set_port0_handler); | ||
201 | 200 | ||
202 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | 201 | static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); |
203 | get_port1_handler, set_port1_handler); | ||
204 | 202 | ||
205 | 203 | ||
206 | static int cypress_probe(struct usb_interface *interface, | 204 | static int cypress_probe(struct usb_interface *interface, |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index bc88c79875a1..0db05b252e3b 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, | |||
553 | /* needed for power consumption */ | 553 | /* needed for power consumption */ |
554 | struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; | 554 | struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; |
555 | 555 | ||
556 | memset(&info, 0, sizeof(info)); | ||
556 | /* directly from the descriptor */ | 557 | /* directly from the descriptor */ |
557 | info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); | 558 | info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); |
558 | info.product = dev->product_id; | 559 | info.product = dev->product_id; |
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 70d00e99a4b4..dd573abd2d1e 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
3008 | #else | 3008 | #else |
3009 | x.sisusb_conactive = 0; | 3009 | x.sisusb_conactive = 0; |
3010 | #endif | 3010 | #endif |
3011 | memset(x.sisusb_reserved, 0, sizeof(x.sisusb_reserved)); | ||
3011 | 3012 | ||
3012 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) | 3013 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) |
3013 | retval = -EFAULT; | 3014 | retval = -EFAULT; |
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index d77aba46ae85..f63776a48e2a 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c | |||
@@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, | |||
86 | return count; | 86 | return count; |
87 | } | 87 | } |
88 | 88 | ||
89 | static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); | 89 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); |
90 | 90 | ||
91 | static int tv_probe(struct usb_interface *interface, | 91 | static int tv_probe(struct usb_interface *interface, |
92 | const struct usb_device_id *id) | 92 | const struct usb_device_id *id) |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 63da2c3c838f..c96f51de1696 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co | |||
94 | change_color(led); \ | 94 | change_color(led); \ |
95 | return count; \ | 95 | return count; \ |
96 | } \ | 96 | } \ |
97 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 97 | static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); |
98 | show_set(blue); | 98 | show_set(blue); |
99 | show_set(red); | 99 | show_set(red); |
100 | show_set(green); | 100 | show_set(green); |
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index de8ef945b536..417b8f207e8b 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c | |||
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ | |||
192 | \ | 192 | \ |
193 | return count; \ | 193 | return count; \ |
194 | } \ | 194 | } \ |
195 | static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); | 195 | static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); |
196 | 196 | ||
197 | static ssize_t show_attr_text(struct device *dev, | 197 | static ssize_t show_attr_text(struct device *dev, |
198 | struct device_attribute *attr, char *buf) | 198 | struct device_attribute *attr, char *buf) |
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, | |||
223 | return count; | 223 | return count; |
224 | } | 224 | } |
225 | 225 | ||
226 | static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); | 226 | static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); |
227 | 227 | ||
228 | static ssize_t show_attr_decimals(struct device *dev, | 228 | static ssize_t show_attr_decimals(struct device *dev, |
229 | struct device_attribute *attr, char *buf) | 229 | struct device_attribute *attr, char *buf) |
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, | |||
272 | return count; | 272 | return count; |
273 | } | 273 | } |
274 | 274 | ||
275 | static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, | 275 | static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); |
276 | show_attr_decimals, set_attr_decimals); | ||
277 | 276 | ||
278 | static ssize_t show_attr_textmode(struct device *dev, | 277 | static ssize_t show_attr_textmode(struct device *dev, |
279 | struct device_attribute *attr, char *buf) | 278 | struct device_attribute *attr, char *buf) |
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, | |||
319 | return -EINVAL; | 318 | return -EINVAL; |
320 | } | 319 | } |
321 | 320 | ||
322 | static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, | 321 | static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); |
323 | show_attr_textmode, set_attr_textmode); | ||
324 | 322 | ||
325 | 323 | ||
326 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); | 324 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 796e2f68f749..4ff21587ab03 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -3,7 +3,7 @@ | |||
3 | /* | 3 | /* |
4 | * uss720.c -- USS720 USB Parport Cable. | 4 | * uss720.c -- USS720 USB Parport Cable. |
5 | * | 5 | * |
6 | * Copyright (C) 1999, 2005 | 6 | * Copyright (C) 1999, 2005, 2010 |
7 | * Thomas Sailer (t.sailer@alumni.ethz.ch) | 7 | * Thomas Sailer (t.sailer@alumni.ethz.ch) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
@@ -776,6 +776,8 @@ static const struct usb_device_id uss720_table[] = { | |||
776 | { USB_DEVICE(0x0557, 0x2001) }, | 776 | { USB_DEVICE(0x0557, 0x2001) }, |
777 | { USB_DEVICE(0x0729, 0x1284) }, | 777 | { USB_DEVICE(0x0729, 0x1284) }, |
778 | { USB_DEVICE(0x1293, 0x0002) }, | 778 | { USB_DEVICE(0x1293, 0x0002) }, |
779 | { USB_DEVICE(0x1293, 0x0002) }, | ||
780 | { USB_DEVICE(0x050d, 0x0002) }, | ||
779 | { } /* Terminating entry */ | 781 | { } /* Terminating entry */ |
780 | }; | 782 | }; |
781 | 783 | ||
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index b611420a8050..611a9d274363 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -342,8 +342,10 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
342 | 342 | ||
343 | usb_nop_xceiv_register(); | 343 | usb_nop_xceiv_register(); |
344 | musb->xceiv = otg_get_transceiver(); | 344 | musb->xceiv = otg_get_transceiver(); |
345 | if (!musb->xceiv) | 345 | if (!musb->xceiv) { |
346 | gpio_free(musb->config->gpio_vrsel); | ||
346 | return -ENODEV; | 347 | return -ENODEV; |
348 | } | ||
347 | 349 | ||
348 | if (ANOMALY_05000346) { | 350 | if (ANOMALY_05000346) { |
349 | bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); | 351 | bfin_write_USB_APHY_CALIB(ANOMALY_05000346_value); |
@@ -394,8 +396,9 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
394 | 396 | ||
395 | int musb_platform_exit(struct musb *musb) | 397 | int musb_platform_exit(struct musb *musb) |
396 | { | 398 | { |
397 | |||
398 | gpio_free(musb->config->gpio_vrsel); | 399 | gpio_free(musb->config->gpio_vrsel); |
399 | 400 | ||
401 | otg_put_transceiver(musb->xceiv); | ||
402 | usb_nop_xceiv_unregister(); | ||
400 | return 0; | 403 | return 0; |
401 | } | 404 | } |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 57624361c1de..6e67629f50cc 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -446,6 +446,7 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
446 | fail: | 446 | fail: |
447 | clk_disable(musb->clock); | 447 | clk_disable(musb->clock); |
448 | 448 | ||
449 | otg_put_transceiver(musb->xceiv); | ||
449 | usb_nop_xceiv_unregister(); | 450 | usb_nop_xceiv_unregister(); |
450 | return -ENODEV; | 451 | return -ENODEV; |
451 | } | 452 | } |
@@ -496,6 +497,7 @@ int musb_platform_exit(struct musb *musb) | |||
496 | 497 | ||
497 | clk_disable(musb->clock); | 498 | clk_disable(musb->clock); |
498 | 499 | ||
500 | otg_put_transceiver(musb->xceiv); | ||
499 | usb_nop_xceiv_unregister(); | 501 | usb_nop_xceiv_unregister(); |
500 | 502 | ||
501 | return 0; | 503 | return 0; |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 540c766c4f86..0707b296cce4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1921,10 +1921,6 @@ static void musb_free(struct musb *musb) | |||
1921 | dma_controller_destroy(c); | 1921 | dma_controller_destroy(c); |
1922 | } | 1922 | } |
1923 | 1923 | ||
1924 | #ifdef CONFIG_USB_MUSB_OTG | ||
1925 | put_device(musb->xceiv->dev); | ||
1926 | #endif | ||
1927 | |||
1928 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 1924 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
1929 | usb_put_hcd(musb_to_hcd(musb)); | 1925 | usb_put_hcd(musb_to_hcd(musb)); |
1930 | #else | 1926 | #else |
@@ -2247,7 +2243,6 @@ static int __exit musb_remove(struct platform_device *pdev) | |||
2247 | #endif | 2243 | #endif |
2248 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 2244 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
2249 | musb_platform_exit(musb); | 2245 | musb_platform_exit(musb); |
2250 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2251 | 2246 | ||
2252 | musb_free(musb); | 2247 | musb_free(musb); |
2253 | iounmap(ctrl_base); | 2248 | iounmap(ctrl_base); |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2111a241dd03..ed618bde1eec 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -320,5 +320,6 @@ int musb_platform_exit(struct musb *musb) | |||
320 | 320 | ||
321 | musb_platform_suspend(musb); | 321 | musb_platform_suspend(musb); |
322 | 322 | ||
323 | otg_put_transceiver(musb->xceiv); | ||
323 | return 0; | 324 | return 0; |
324 | } | 325 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 3c48e77a0aa2..bde40efc7046 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1152,6 +1152,8 @@ done: | |||
1152 | if (ret < 0) { | 1152 | if (ret < 0) { |
1153 | if (sync) | 1153 | if (sync) |
1154 | iounmap(sync); | 1154 | iounmap(sync); |
1155 | |||
1156 | otg_put_transceiver(musb->xceiv); | ||
1155 | usb_nop_xceiv_unregister(); | 1157 | usb_nop_xceiv_unregister(); |
1156 | } | 1158 | } |
1157 | return ret; | 1159 | return ret; |
@@ -1166,6 +1168,8 @@ int musb_platform_exit(struct musb *musb) | |||
1166 | musb->board_set_power(0); | 1168 | musb->board_set_power(0); |
1167 | 1169 | ||
1168 | iounmap(musb->sync_va); | 1170 | iounmap(musb->sync_va); |
1171 | |||
1172 | otg_put_transceiver(musb->xceiv); | ||
1169 | usb_nop_xceiv_unregister(); | 1173 | usb_nop_xceiv_unregister(); |
1170 | return 0; | 1174 | return 0; |
1171 | } | 1175 | } |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 63f7cc45bcac..7b8815ddf368 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -486,12 +486,22 @@ static void ch341_read_int_callback(struct urb *urb) | |||
486 | if (actual_length >= 4) { | 486 | if (actual_length >= 4) { |
487 | struct ch341_private *priv = usb_get_serial_port_data(port); | 487 | struct ch341_private *priv = usb_get_serial_port_data(port); |
488 | unsigned long flags; | 488 | unsigned long flags; |
489 | u8 prev_line_status = priv->line_status; | ||
489 | 490 | ||
490 | spin_lock_irqsave(&priv->lock, flags); | 491 | spin_lock_irqsave(&priv->lock, flags); |
491 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; | 492 | priv->line_status = (~(data[2])) & CH341_BITS_MODEM_STAT; |
492 | if ((data[1] & CH341_MULT_STAT)) | 493 | if ((data[1] & CH341_MULT_STAT)) |
493 | priv->multi_status_change = 1; | 494 | priv->multi_status_change = 1; |
494 | spin_unlock_irqrestore(&priv->lock, flags); | 495 | spin_unlock_irqrestore(&priv->lock, flags); |
496 | |||
497 | if ((priv->line_status ^ prev_line_status) & CH341_BIT_DCD) { | ||
498 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
499 | if (tty) | ||
500 | usb_serial_handle_dcd_change(port, tty, | ||
501 | priv->line_status & CH341_BIT_DCD); | ||
502 | tty_kref_put(tty); | ||
503 | } | ||
504 | |||
495 | wake_up_interruptible(&priv->delta_msr_wait); | 505 | wake_up_interruptible(&priv->delta_msr_wait); |
496 | } | 506 | } |
497 | 507 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 4f1744c5871f..735ea03157ab 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -49,11 +49,11 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
49 | static void cp210x_break_ctl(struct tty_struct *, int); | 49 | static void cp210x_break_ctl(struct tty_struct *, int); |
50 | static int cp210x_startup(struct usb_serial *); | 50 | static int cp210x_startup(struct usb_serial *); |
51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | 51 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
52 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
53 | 52 | ||
54 | static int debug; | 53 | static int debug; |
55 | 54 | ||
56 | static const struct usb_device_id id_table[] = { | 55 | static const struct usb_device_id id_table[] = { |
56 | { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */ | ||
57 | { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ | 57 | { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ |
58 | { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ | 58 | { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ |
59 | { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ | 59 | { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */ |
@@ -86,7 +86,6 @@ static const struct usb_device_id id_table[] = { | |||
86 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ | 86 | { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ |
87 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | 87 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ |
88 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ | 88 | { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ |
89 | { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */ | ||
90 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ | 89 | { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ |
91 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 90 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
92 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 91 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
@@ -109,7 +108,9 @@ static const struct usb_device_id id_table[] = { | |||
109 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ | 108 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
110 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ | 109 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
111 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ | 110 | { USB_DEVICE(0x10C4, 0x83A8) }, /* Amber Wireless AMB2560 */ |
111 | { USB_DEVICE(0x10C4, 0x83D8) }, /* DekTec DTA Plus VHF/UHF Booster/Attenuator */ | ||
112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ | 112 | { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ |
113 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ | ||
113 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ | 114 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
114 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ | 115 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
115 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 116 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
@@ -132,6 +133,7 @@ static const struct usb_device_id id_table[] = { | |||
132 | { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ | 133 | { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ |
133 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | 134 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
134 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 135 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
136 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | ||
135 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | 137 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ |
136 | { } /* Terminating Entry */ | 138 | { } /* Terminating Entry */ |
137 | }; | 139 | }; |
@@ -163,8 +165,7 @@ static struct usb_serial_driver cp210x_device = { | |||
163 | .tiocmget = cp210x_tiocmget, | 165 | .tiocmget = cp210x_tiocmget, |
164 | .tiocmset = cp210x_tiocmset, | 166 | .tiocmset = cp210x_tiocmset, |
165 | .attach = cp210x_startup, | 167 | .attach = cp210x_startup, |
166 | .dtr_rts = cp210x_dtr_rts, | 168 | .dtr_rts = cp210x_dtr_rts |
167 | .carrier_raised = cp210x_carrier_raised | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | /* Config request types */ | 171 | /* Config request types */ |
@@ -763,15 +764,6 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
763 | return result; | 764 | return result; |
764 | } | 765 | } |
765 | 766 | ||
766 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
767 | { | ||
768 | unsigned int control; | ||
769 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
770 | if (control & CONTROL_DCD) | ||
771 | return 1; | ||
772 | return 0; | ||
773 | } | ||
774 | |||
775 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 767 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
776 | { | 768 | { |
777 | struct usb_serial_port *port = tty->driver_data; | 769 | struct usb_serial_port *port = tty->driver_data; |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index b92070c103cd..666e5a6edd82 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -455,7 +455,6 @@ static int digi_write_room(struct tty_struct *tty); | |||
455 | static int digi_chars_in_buffer(struct tty_struct *tty); | 455 | static int digi_chars_in_buffer(struct tty_struct *tty); |
456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); | 456 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); |
457 | static void digi_close(struct usb_serial_port *port); | 457 | static void digi_close(struct usb_serial_port *port); |
458 | static int digi_carrier_raised(struct usb_serial_port *port); | ||
459 | static void digi_dtr_rts(struct usb_serial_port *port, int on); | 458 | static void digi_dtr_rts(struct usb_serial_port *port, int on); |
460 | static int digi_startup_device(struct usb_serial *serial); | 459 | static int digi_startup_device(struct usb_serial *serial); |
461 | static int digi_startup(struct usb_serial *serial); | 460 | static int digi_startup(struct usb_serial *serial); |
@@ -511,7 +510,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
511 | .open = digi_open, | 510 | .open = digi_open, |
512 | .close = digi_close, | 511 | .close = digi_close, |
513 | .dtr_rts = digi_dtr_rts, | 512 | .dtr_rts = digi_dtr_rts, |
514 | .carrier_raised = digi_carrier_raised, | ||
515 | .write = digi_write, | 513 | .write = digi_write, |
516 | .write_room = digi_write_room, | 514 | .write_room = digi_write_room, |
517 | .write_bulk_callback = digi_write_bulk_callback, | 515 | .write_bulk_callback = digi_write_bulk_callback, |
@@ -1339,14 +1337,6 @@ static void digi_dtr_rts(struct usb_serial_port *port, int on) | |||
1339 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); | 1337 | digi_set_modem_signals(port, on * (TIOCM_DTR|TIOCM_RTS), 1); |
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | static int digi_carrier_raised(struct usb_serial_port *port) | ||
1343 | { | ||
1344 | struct digi_port *priv = usb_get_serial_port_data(port); | ||
1345 | if (priv->dp_modem_signals & TIOCM_CD) | ||
1346 | return 1; | ||
1347 | return 0; | ||
1348 | } | ||
1349 | |||
1350 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) | 1340 | static int digi_open(struct tty_struct *tty, struct usb_serial_port *port) |
1351 | { | 1341 | { |
1352 | int ret; | 1342 | int ret; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 97cc87d654ce..88bef0276876 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -99,6 +99,7 @@ struct ftdi_sio_quirk { | |||
99 | static int ftdi_jtag_probe(struct usb_serial *serial); | 99 | static int ftdi_jtag_probe(struct usb_serial *serial); |
100 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); | 100 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
101 | static int ftdi_NDI_device_setup(struct usb_serial *serial); | 101 | static int ftdi_NDI_device_setup(struct usb_serial *serial); |
102 | static int ftdi_stmclite_probe(struct usb_serial *serial); | ||
102 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); | 103 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
103 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); | 104 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
104 | 105 | ||
@@ -122,6 +123,10 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
122 | .port_probe = ftdi_HE_TIRA1_setup, | 123 | .port_probe = ftdi_HE_TIRA1_setup, |
123 | }; | 124 | }; |
124 | 125 | ||
126 | static struct ftdi_sio_quirk ftdi_stmclite_quirk = { | ||
127 | .probe = ftdi_stmclite_probe, | ||
128 | }; | ||
129 | |||
125 | /* | 130 | /* |
126 | * The 8U232AM has the same API as the sio except for: | 131 | * The 8U232AM has the same API as the sio except for: |
127 | * - it can support MUCH higher baudrates; up to: | 132 | * - it can support MUCH higher baudrates; up to: |
@@ -177,6 +182,7 @@ static struct usb_device_id id_table_combined [] = { | |||
177 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, | 182 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_SNIFFER_PID) }, |
178 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, | 183 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) }, |
179 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, | 184 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) }, |
185 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, | ||
180 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 186 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
181 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 187 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
182 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, | 188 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, |
@@ -200,6 +206,7 @@ static struct usb_device_id id_table_combined [] = { | |||
200 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 206 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
201 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 207 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
202 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, | 208 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, |
209 | { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, | ||
203 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, | 210 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
204 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, | 211 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
205 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, | 212 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
@@ -613,6 +620,7 @@ static struct usb_device_id id_table_combined [] = { | |||
613 | { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, | 620 | { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, |
614 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, | 621 | { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, |
615 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, | 622 | { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, |
623 | { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, | ||
616 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, | 624 | { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, |
617 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, | 625 | { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, |
618 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, | 626 | { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, |
@@ -673,8 +681,17 @@ static struct usb_device_id id_table_combined [] = { | |||
673 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 681 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
674 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | 682 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, |
675 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | 683 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, |
676 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 684 | { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, |
677 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | 685 | { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, |
686 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) }, | ||
687 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C2_PID) }, | ||
688 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2D_PID) }, | ||
689 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VT_PID) }, | ||
690 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2VR_PID) }, | ||
691 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVT_PID) }, | ||
692 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP4KVR_PID) }, | ||
693 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVT_PID) }, | ||
694 | { USB_DEVICE(ICOM_VID, ICOM_ID_RP2KVR_PID) }, | ||
678 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 695 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
679 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 696 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
680 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 697 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
@@ -696,6 +713,7 @@ static struct usb_device_id id_table_combined [] = { | |||
696 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 713 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
697 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 714 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
698 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | 715 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, |
716 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, | ||
699 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 717 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
700 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 718 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
701 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 719 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
@@ -715,8 +733,37 @@ static struct usb_device_id id_table_combined [] = { | |||
715 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 733 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
716 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | 734 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, |
717 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, | 735 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, |
736 | |||
737 | /* Papouch devices based on FTDI chip */ | ||
738 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_PID) }, | ||
739 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_PID) }, | ||
740 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_PID) }, | ||
741 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485_2_PID) }, | ||
742 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AP485_2_PID) }, | ||
743 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB422_2_PID) }, | ||
744 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485S_PID) }, | ||
745 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB485C_PID) }, | ||
746 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_LEC_PID) }, | ||
747 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SB232_PID) }, | ||
748 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | ||
749 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_IRAMP_PID) }, | ||
750 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK5_PID) }, | ||
751 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO8x8_PID) }, | ||
718 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, | 752 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, |
753 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x2_PID) }, | ||
754 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO10x1_PID) }, | ||
755 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO30x3_PID) }, | ||
756 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO60x3_PID) }, | ||
757 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO2x16_PID) }, | ||
758 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO3x32_PID) }, | ||
759 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_DRAK6_PID) }, | ||
760 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_UPSUSB_PID) }, | ||
761 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_MU_PID) }, | ||
762 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_SIMUKEY_PID) }, | ||
719 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, | 763 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_AD4USB_PID) }, |
764 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMUX_PID) }, | ||
765 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_GMSR_PID) }, | ||
766 | |||
720 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, | 767 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) }, |
721 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, | 768 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, |
722 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, | 769 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, |
@@ -751,6 +798,7 @@ static struct usb_device_id id_table_combined [] = { | |||
751 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), | 798 | { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID), |
752 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 799 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
753 | { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, | 800 | { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) }, |
801 | { USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) }, | ||
754 | { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), | 802 | { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID), |
755 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 803 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
756 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, | 804 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) }, |
@@ -761,6 +809,14 @@ static struct usb_device_id id_table_combined [] = { | |||
761 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, | 809 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MAXI_WING_PID) }, |
762 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, | 810 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_MEDIA_WING_PID) }, |
763 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, | 811 | { USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_WING_PID) }, |
812 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, | ||
813 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, | ||
814 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, | ||
815 | { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, | ||
816 | { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), | ||
817 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
818 | { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), | ||
819 | .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, | ||
764 | { }, /* Optional parameter entry */ | 820 | { }, /* Optional parameter entry */ |
765 | { } /* Terminating entry */ | 821 | { } /* Terminating entry */ |
766 | }; | 822 | }; |
@@ -1642,6 +1698,25 @@ static int ftdi_jtag_probe(struct usb_serial *serial) | |||
1642 | } | 1698 | } |
1643 | 1699 | ||
1644 | /* | 1700 | /* |
1701 | * First and second port on STMCLiteadaptors is reserved for JTAG interface | ||
1702 | * and the forth port for pio | ||
1703 | */ | ||
1704 | static int ftdi_stmclite_probe(struct usb_serial *serial) | ||
1705 | { | ||
1706 | struct usb_device *udev = serial->dev; | ||
1707 | struct usb_interface *interface = serial->interface; | ||
1708 | |||
1709 | dbg("%s", __func__); | ||
1710 | |||
1711 | if (interface == udev->actconfig->interface[2]) | ||
1712 | return 0; | ||
1713 | |||
1714 | dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); | ||
1715 | |||
1716 | return -ENODEV; | ||
1717 | } | ||
1718 | |||
1719 | /* | ||
1645 | * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. | 1720 | * The Matrix Orbital VK204-25-USB has an invalid IN endpoint. |
1646 | * We have to correct it if we want to read from it. | 1721 | * We have to correct it if we want to read from it. |
1647 | */ | 1722 | */ |
@@ -2028,8 +2103,6 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2028 | "urb failed to set to rts/cts flow control\n"); | 2103 | "urb failed to set to rts/cts flow control\n"); |
2029 | } | 2104 | } |
2030 | 2105 | ||
2031 | /* raise DTR/RTS */ | ||
2032 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); | ||
2033 | } else { | 2106 | } else { |
2034 | /* | 2107 | /* |
2035 | * Xon/Xoff code | 2108 | * Xon/Xoff code |
@@ -2077,8 +2150,6 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
2077 | } | 2150 | } |
2078 | } | 2151 | } |
2079 | 2152 | ||
2080 | /* lower DTR/RTS */ | ||
2081 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | ||
2082 | } | 2153 | } |
2083 | return; | 2154 | return; |
2084 | } | 2155 | } |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 15a4583775ad..3523df534a27 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -61,6 +61,7 @@ | |||
61 | #define FTDI_OPENDCC_SNIFFER_PID 0xBFD9 | 61 | #define FTDI_OPENDCC_SNIFFER_PID 0xBFD9 |
62 | #define FTDI_OPENDCC_THROTTLE_PID 0xBFDA | 62 | #define FTDI_OPENDCC_THROTTLE_PID 0xBFDA |
63 | #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB | 63 | #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB |
64 | #define FTDI_OPENDCC_GBM_PID 0xBFDC | ||
64 | 65 | ||
65 | /* | 66 | /* |
66 | * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) | 67 | * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) |
@@ -113,6 +114,9 @@ | |||
113 | /* Lenz LI-USB Computer Interface. */ | 114 | /* Lenz LI-USB Computer Interface. */ |
114 | #define FTDI_LENZ_LIUSB_PID 0xD780 | 115 | #define FTDI_LENZ_LIUSB_PID 0xD780 |
115 | 116 | ||
117 | /* Vardaan Enterprises Serial Interface VEUSB422R3 */ | ||
118 | #define FTDI_VARDAAN_PID 0xF070 | ||
119 | |||
116 | /* | 120 | /* |
117 | * Xsens Technologies BV products (http://www.xsens.com). | 121 | * Xsens Technologies BV products (http://www.xsens.com). |
118 | */ | 122 | */ |
@@ -514,6 +518,12 @@ | |||
514 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | 518 | #define RATOC_PRODUCT_ID_USB60F 0xb020 |
515 | 519 | ||
516 | /* | 520 | /* |
521 | * Acton Research Corp. | ||
522 | */ | ||
523 | #define ACTON_VID 0x0647 /* Vendor ID */ | ||
524 | #define ACTON_SPECTRAPRO_PID 0x0100 | ||
525 | |||
526 | /* | ||
517 | * Contec products (http://www.contec.com) | 527 | * Contec products (http://www.contec.com) |
518 | * Submitted by Daniel Sangorrin | 528 | * Submitted by Daniel Sangorrin |
519 | */ | 529 | */ |
@@ -565,11 +575,23 @@ | |||
565 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 575 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
566 | 576 | ||
567 | /* | 577 | /* |
568 | * Icom ID-1 digital transceiver | 578 | * Definitions for Icom Inc. devices |
569 | */ | 579 | */ |
570 | 580 | #define ICOM_VID 0x0C26 /* Icom vendor ID */ | |
571 | #define ICOM_ID1_VID 0x0C26 | 581 | /* Note: ID-1 is a communications tranceiver for HAM-radio operators */ |
572 | #define ICOM_ID1_PID 0x0004 | 582 | #define ICOM_ID_1_PID 0x0004 /* ID-1 USB to RS-232 */ |
583 | /* Note: OPC is an Optional cable to connect an Icom Tranceiver */ | ||
584 | #define ICOM_OPC_U_UC_PID 0x0018 /* OPC-478UC, OPC-1122U cloning cable */ | ||
585 | /* Note: ID-RP* devices are Icom Repeater Devices for HAM-radio */ | ||
586 | #define ICOM_ID_RP2C1_PID 0x0009 /* ID-RP2C Asset 1 to RS-232 */ | ||
587 | #define ICOM_ID_RP2C2_PID 0x000A /* ID-RP2C Asset 2 to RS-232 */ | ||
588 | #define ICOM_ID_RP2D_PID 0x000B /* ID-RP2D configuration port*/ | ||
589 | #define ICOM_ID_RP2VT_PID 0x000C /* ID-RP2V Transmit config port */ | ||
590 | #define ICOM_ID_RP2VR_PID 0x000D /* ID-RP2V Receive config port */ | ||
591 | #define ICOM_ID_RP4KVT_PID 0x0010 /* ID-RP4000V Transmit config port */ | ||
592 | #define ICOM_ID_RP4KVR_PID 0x0011 /* ID-RP4000V Receive config port */ | ||
593 | #define ICOM_ID_RP2KVT_PID 0x0012 /* ID-RP2000V Transmit config port */ | ||
594 | #define ICOM_ID_RP2KVR_PID 0x0013 /* ID-RP2000V Receive config port */ | ||
573 | 595 | ||
574 | /* | 596 | /* |
575 | * GN Otometrics (http://www.otometrics.com) | 597 | * GN Otometrics (http://www.otometrics.com) |
@@ -720,6 +742,7 @@ | |||
720 | */ | 742 | */ |
721 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 743 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
722 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | 744 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ |
745 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ | ||
723 | 746 | ||
724 | /* | 747 | /* |
725 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. | 748 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. |
@@ -1017,14 +1040,45 @@ | |||
1017 | #define WHT_PID 0x0004 /* Wireless Handheld Terminal */ | 1040 | #define WHT_PID 0x0004 /* Wireless Handheld Terminal */ |
1018 | 1041 | ||
1019 | /* | 1042 | /* |
1043 | * STMicroelectonics | ||
1044 | */ | ||
1045 | #define ST_VID 0x0483 | ||
1046 | #define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */ | ||
1047 | |||
1048 | /* | ||
1020 | * Papouch products (http://www.papouch.com/) | 1049 | * Papouch products (http://www.papouch.com/) |
1021 | * Submitted by Folkert van Heusden | 1050 | * Submitted by Folkert van Heusden |
1022 | */ | 1051 | */ |
1023 | 1052 | ||
1024 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ | 1053 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ |
1054 | #define PAPOUCH_SB485_PID 0x0100 /* Papouch SB485 USB-485/422 Converter */ | ||
1055 | #define PAPOUCH_AP485_PID 0x0101 /* AP485 USB-RS485 Converter */ | ||
1056 | #define PAPOUCH_SB422_PID 0x0102 /* Papouch SB422 USB-RS422 Converter */ | ||
1057 | #define PAPOUCH_SB485_2_PID 0x0103 /* Papouch SB485 USB-485/422 Converter */ | ||
1058 | #define PAPOUCH_AP485_2_PID 0x0104 /* AP485 USB-RS485 Converter */ | ||
1059 | #define PAPOUCH_SB422_2_PID 0x0105 /* Papouch SB422 USB-RS422 Converter */ | ||
1060 | #define PAPOUCH_SB485S_PID 0x0106 /* Papouch SB485S USB-485/422 Converter */ | ||
1061 | #define PAPOUCH_SB485C_PID 0x0107 /* Papouch SB485C USB-485/422 Converter */ | ||
1062 | #define PAPOUCH_LEC_PID 0x0300 /* LEC USB Converter */ | ||
1063 | #define PAPOUCH_SB232_PID 0x0301 /* Papouch SB232 USB-RS232 Converter */ | ||
1025 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ | 1064 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ |
1026 | #define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */ | 1065 | #define PAPOUCH_IRAMP_PID 0x0500 /* Papouch IRAmp Duplex */ |
1066 | #define PAPOUCH_DRAK5_PID 0x0700 /* Papouch DRAK5 */ | ||
1067 | #define PAPOUCH_QUIDO8x8_PID 0x0800 /* Papouch Quido 8/8 Module */ | ||
1068 | #define PAPOUCH_QUIDO4x4_PID 0x0900 /* Papouch Quido 4/4 Module */ | ||
1069 | #define PAPOUCH_QUIDO2x2_PID 0x0a00 /* Papouch Quido 2/2 Module */ | ||
1070 | #define PAPOUCH_QUIDO10x1_PID 0x0b00 /* Papouch Quido 10/1 Module */ | ||
1071 | #define PAPOUCH_QUIDO30x3_PID 0x0c00 /* Papouch Quido 30/3 Module */ | ||
1072 | #define PAPOUCH_QUIDO60x3_PID 0x0d00 /* Papouch Quido 60(100)/3 Module */ | ||
1073 | #define PAPOUCH_QUIDO2x16_PID 0x0e00 /* Papouch Quido 2/16 Module */ | ||
1074 | #define PAPOUCH_QUIDO3x32_PID 0x0f00 /* Papouch Quido 3/32 Module */ | ||
1075 | #define PAPOUCH_DRAK6_PID 0x1000 /* Papouch DRAK6 */ | ||
1076 | #define PAPOUCH_UPSUSB_PID 0x8000 /* Papouch UPS-USB adapter */ | ||
1077 | #define PAPOUCH_MU_PID 0x8001 /* MU controller */ | ||
1078 | #define PAPOUCH_SIMUKEY_PID 0x8002 /* Papouch SimuKey */ | ||
1027 | #define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */ | 1079 | #define PAPOUCH_AD4USB_PID 0x8003 /* AD4USB Measurement Module */ |
1080 | #define PAPOUCH_GMUX_PID 0x8004 /* Papouch GOLIATH MUX */ | ||
1081 | #define PAPOUCH_GMSR_PID 0x8005 /* Papouch GOLIATH MSR */ | ||
1028 | 1082 | ||
1029 | /* | 1083 | /* |
1030 | * Marvell SheevaPlug | 1084 | * Marvell SheevaPlug |
@@ -1051,6 +1105,11 @@ | |||
1051 | #define MJSG_HD_RADIO_PID 0x937C | 1105 | #define MJSG_HD_RADIO_PID 0x937C |
1052 | 1106 | ||
1053 | /* | 1107 | /* |
1108 | * D.O.Tec products (http://www.directout.eu) | ||
1109 | */ | ||
1110 | #define FTDI_DOTEC_PID 0x9868 | ||
1111 | |||
1112 | /* | ||
1054 | * Xverve Signalyzer tools (http://www.signalyzer.com/) | 1113 | * Xverve Signalyzer tools (http://www.signalyzer.com/) |
1055 | */ | 1114 | */ |
1056 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 | 1115 | #define XVERVE_SIGNALYZER_ST_PID 0xBCA0 |
@@ -1063,3 +1122,21 @@ | |||
1063 | * Submitted by John G. Rogers | 1122 | * Submitted by John G. Rogers |
1064 | */ | 1123 | */ |
1065 | #define SEGWAY_RMP200_PID 0xe729 | 1124 | #define SEGWAY_RMP200_PID 0xe729 |
1125 | |||
1126 | |||
1127 | /* | ||
1128 | * Accesio USB Data Acquisition products (http://www.accesio.com/) | ||
1129 | */ | ||
1130 | #define ACCESIO_COM4SM_PID 0xD578 | ||
1131 | |||
1132 | /* www.sciencescope.co.uk educational dataloggers */ | ||
1133 | #define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18 | ||
1134 | #define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C | ||
1135 | #define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D | ||
1136 | |||
1137 | /* | ||
1138 | * Milkymist One JTAG/Serial | ||
1139 | */ | ||
1140 | #define QIHARDWARE_VID 0x20B7 | ||
1141 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 | ||
1142 | |||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index e6833e216fc9..e4db5ad2bc55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -479,6 +479,26 @@ int usb_serial_handle_break(struct usb_serial_port *port) | |||
479 | } | 479 | } |
480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); | 480 | EXPORT_SYMBOL_GPL(usb_serial_handle_break); |
481 | 481 | ||
482 | /** | ||
483 | * usb_serial_handle_dcd_change - handle a change of carrier detect state | ||
484 | * @port: usb_serial_port structure for the open port | ||
485 | * @tty: tty_struct structure for the port | ||
486 | * @status: new carrier detect status, nonzero if active | ||
487 | */ | ||
488 | void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
489 | struct tty_struct *tty, unsigned int status) | ||
490 | { | ||
491 | struct tty_port *port = &usb_port->port; | ||
492 | |||
493 | dbg("%s - port %d, status %d", __func__, usb_port->number, status); | ||
494 | |||
495 | if (status) | ||
496 | wake_up_interruptible(&port->open_wait); | ||
497 | else if (tty && !C_CLOCAL(tty)) | ||
498 | tty_hangup(tty); | ||
499 | } | ||
500 | EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); | ||
501 | |||
482 | int usb_serial_generic_resume(struct usb_serial *serial) | 502 | int usb_serial_generic_resume(struct usb_serial *serial) |
483 | { | 503 | { |
484 | struct usb_serial_port *port; | 504 | struct usb_serial_port *port; |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 76e6fb3aab7a..db0e3fe4acf5 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2894,8 +2894,8 @@ static void load_application_firmware(struct edgeport_serial *edge_serial) | |||
2894 | 2894 | ||
2895 | dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); | 2895 | dbg("%s %d.%d.%d", fw_info, rec->data[0], rec->data[1], build); |
2896 | 2896 | ||
2897 | edge_serial->product_info.FirmwareMajorVersion = fw->data[0]; | 2897 | edge_serial->product_info.FirmwareMajorVersion = rec->data[0]; |
2898 | edge_serial->product_info.FirmwareMinorVersion = fw->data[1]; | 2898 | edge_serial->product_info.FirmwareMinorVersion = rec->data[1]; |
2899 | edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); | 2899 | edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); |
2900 | 2900 | ||
2901 | for (rec = ihex_next_binrec(rec); rec; | 2901 | for (rec = ihex_next_binrec(rec); rec; |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index feb56a4ca799..1021a2c1c927 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
@@ -196,6 +196,7 @@ static struct usb_serial_driver epic_device = { | |||
196 | .name = "epic", | 196 | .name = "epic", |
197 | }, | 197 | }, |
198 | .description = "EPiC device", | 198 | .description = "EPiC device", |
199 | .usb_driver = &io_driver, | ||
199 | .id_table = Epic_port_id_table, | 200 | .id_table = Epic_port_id_table, |
200 | .num_ports = 1, | 201 | .num_ports = 1, |
201 | .open = edge_open, | 202 | .open = edge_open, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index efc72113216b..7d26e3558721 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1276,6 +1276,7 @@ static struct usb_serial_driver iuu_device = { | |||
1276 | .name = "iuu_phoenix", | 1276 | .name = "iuu_phoenix", |
1277 | }, | 1277 | }, |
1278 | .id_table = id_table, | 1278 | .id_table = id_table, |
1279 | .usb_driver = &iuu_driver, | ||
1279 | .num_ports = 1, | 1280 | .num_ports = 1, |
1280 | .bulk_in_size = 512, | 1281 | .bulk_in_size = 512, |
1281 | .bulk_out_size = 512, | 1282 | .bulk_out_size = 512, |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index bf3297ddd186..1ab6ea8c4602 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -546,6 +546,7 @@ static struct usb_serial_driver keyspan_pre_device = { | |||
546 | .name = "keyspan_no_firm", | 546 | .name = "keyspan_no_firm", |
547 | }, | 547 | }, |
548 | .description = "Keyspan - (without firmware)", | 548 | .description = "Keyspan - (without firmware)", |
549 | .usb_driver = &keyspan_driver, | ||
549 | .id_table = keyspan_pre_ids, | 550 | .id_table = keyspan_pre_ids, |
550 | .num_ports = 1, | 551 | .num_ports = 1, |
551 | .attach = keyspan_fake_startup, | 552 | .attach = keyspan_fake_startup, |
@@ -557,6 +558,7 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
557 | .name = "keyspan_1", | 558 | .name = "keyspan_1", |
558 | }, | 559 | }, |
559 | .description = "Keyspan 1 port adapter", | 560 | .description = "Keyspan 1 port adapter", |
561 | .usb_driver = &keyspan_driver, | ||
560 | .id_table = keyspan_1port_ids, | 562 | .id_table = keyspan_1port_ids, |
561 | .num_ports = 1, | 563 | .num_ports = 1, |
562 | .open = keyspan_open, | 564 | .open = keyspan_open, |
@@ -579,6 +581,7 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
579 | .name = "keyspan_2", | 581 | .name = "keyspan_2", |
580 | }, | 582 | }, |
581 | .description = "Keyspan 2 port adapter", | 583 | .description = "Keyspan 2 port adapter", |
584 | .usb_driver = &keyspan_driver, | ||
582 | .id_table = keyspan_2port_ids, | 585 | .id_table = keyspan_2port_ids, |
583 | .num_ports = 2, | 586 | .num_ports = 2, |
584 | .open = keyspan_open, | 587 | .open = keyspan_open, |
@@ -601,6 +604,7 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
601 | .name = "keyspan_4", | 604 | .name = "keyspan_4", |
602 | }, | 605 | }, |
603 | .description = "Keyspan 4 port adapter", | 606 | .description = "Keyspan 4 port adapter", |
607 | .usb_driver = &keyspan_driver, | ||
604 | .id_table = keyspan_4port_ids, | 608 | .id_table = keyspan_4port_ids, |
605 | .num_ports = 4, | 609 | .num_ports = 4, |
606 | .open = keyspan_open, | 610 | .open = keyspan_open, |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 185fe9a7d4e0..2cbd661a92f7 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -680,22 +680,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | |||
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
684 | { | ||
685 | struct usb_serial *serial = port->serial; | ||
686 | unsigned char modembits; | ||
687 | |||
688 | /* If we can read the modem status and the DCD is low then | ||
689 | carrier is not raised yet */ | ||
690 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
691 | if (!(modembits & (1>>6))) | ||
692 | return 0; | ||
693 | } | ||
694 | /* Carrier raised, or we failed (eg disconnected) so | ||
695 | progress accordingly */ | ||
696 | return 1; | ||
697 | } | ||
698 | |||
699 | 683 | ||
700 | static int keyspan_pda_open(struct tty_struct *tty, | 684 | static int keyspan_pda_open(struct tty_struct *tty, |
701 | struct usb_serial_port *port) | 685 | struct usb_serial_port *port) |
@@ -882,7 +866,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
882 | .id_table = id_table_std, | 866 | .id_table = id_table_std, |
883 | .num_ports = 1, | 867 | .num_ports = 1, |
884 | .dtr_rts = keyspan_pda_dtr_rts, | 868 | .dtr_rts = keyspan_pda_dtr_rts, |
885 | .carrier_raised = keyspan_pda_carrier_raised, | ||
886 | .open = keyspan_pda_open, | 869 | .open = keyspan_pda_open, |
887 | .close = keyspan_pda_close, | 870 | .close = keyspan_pda_close, |
888 | .write = keyspan_pda_write, | 871 | .write = keyspan_pda_write, |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 7aa01b95b1d4..2849f8c32015 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -549,9 +549,12 @@ static void mct_u232_close(struct usb_serial_port *port) | |||
549 | { | 549 | { |
550 | dbg("%s port %d", __func__, port->number); | 550 | dbg("%s port %d", __func__, port->number); |
551 | 551 | ||
552 | usb_serial_generic_close(port); | 552 | if (port->serial->dev) { |
553 | if (port->serial->dev) | 553 | /* shutdown our urbs */ |
554 | usb_kill_urb(port->write_urb); | ||
555 | usb_kill_urb(port->read_urb); | ||
554 | usb_kill_urb(port->interrupt_in_urb); | 556 | usb_kill_urb(port->interrupt_in_urb); |
557 | } | ||
555 | } /* mct_u232_close */ | 558 | } /* mct_u232_close */ |
556 | 559 | ||
557 | 560 | ||
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c index cf1718394e18..653465f61d4a 100644 --- a/drivers/usb/serial/moto_modem.c +++ b/drivers/usb/serial/moto_modem.c | |||
@@ -44,6 +44,7 @@ static struct usb_serial_driver moto_device = { | |||
44 | .name = "moto-modem", | 44 | .name = "moto-modem", |
45 | }, | 45 | }, |
46 | .id_table = id_table, | 46 | .id_table = id_table, |
47 | .usb_driver = &moto_driver, | ||
47 | .num_ports = 1, | 48 | .num_ports = 1, |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index ed01f3b2de8c..9ff19c8a122e 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -96,8 +96,8 @@ static void opticon_bulk_callback(struct urb *urb) | |||
96 | /* real data, send it to the tty layer */ | 96 | /* real data, send it to the tty layer */ |
97 | tty = tty_port_tty_get(&port->port); | 97 | tty = tty_port_tty_get(&port->port); |
98 | if (tty) { | 98 | if (tty) { |
99 | tty_insert_flip_string(tty, data, | 99 | tty_insert_flip_string(tty, data + 2, |
100 | data_length); | 100 | data_length); |
101 | tty_flip_buffer_push(tty); | 101 | tty_flip_buffer_push(tty); |
102 | tty_kref_put(tty); | 102 | tty_kref_put(tty); |
103 | } | 103 | } |
@@ -130,7 +130,7 @@ exit: | |||
130 | priv->bulk_address), | 130 | priv->bulk_address), |
131 | priv->bulk_in_buffer, priv->buffer_size, | 131 | priv->bulk_in_buffer, priv->buffer_size, |
132 | opticon_bulk_callback, priv); | 132 | opticon_bulk_callback, priv); |
133 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 133 | result = usb_submit_urb(priv->bulk_read_urb, GFP_ATOMIC); |
134 | if (result) | 134 | if (result) |
135 | dev_err(&port->dev, | 135 | dev_err(&port->dev, |
136 | "%s - failed resubmitting read urb, error %d\n", | 136 | "%s - failed resubmitting read urb, error %d\n", |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index c46911af282f..0dbcf124689d 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -382,7 +382,16 @@ static void option_instat_callback(struct urb *urb); | |||
382 | #define HAIER_VENDOR_ID 0x201e | 382 | #define HAIER_VENDOR_ID 0x201e |
383 | #define HAIER_PRODUCT_CE100 0x2009 | 383 | #define HAIER_PRODUCT_CE100 0x2009 |
384 | 384 | ||
385 | #define CINTERION_VENDOR_ID 0x0681 | 385 | /* Cinterion (formerly Siemens) products */ |
386 | #define SIEMENS_VENDOR_ID 0x0681 | ||
387 | #define CINTERION_VENDOR_ID 0x1e2d | ||
388 | #define CINTERION_PRODUCT_HC25_MDM 0x0047 | ||
389 | #define CINTERION_PRODUCT_HC25_MDMNET 0x0040 | ||
390 | #define CINTERION_PRODUCT_HC28_MDM 0x004C | ||
391 | #define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ | ||
392 | #define CINTERION_PRODUCT_EU3_E 0x0051 | ||
393 | #define CINTERION_PRODUCT_EU3_P 0x0052 | ||
394 | #define CINTERION_PRODUCT_PH8 0x0053 | ||
386 | 395 | ||
387 | /* Olivetti products */ | 396 | /* Olivetti products */ |
388 | #define OLIVETTI_VENDOR_ID 0x0b3c | 397 | #define OLIVETTI_VENDOR_ID 0x0b3c |
@@ -512,7 +521,7 @@ static const struct usb_device_id option_ids[] = { | |||
512 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, | 521 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, |
513 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, | 522 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, |
514 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, | 523 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
515 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, | 524 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, |
516 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | 525 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
517 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | 526 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
518 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | 527 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
@@ -622,6 +631,7 @@ static const struct usb_device_id option_ids[] = { | |||
622 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, | 631 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0011, 0xff, 0xff, 0xff) }, |
623 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, | 632 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff) }, |
624 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, | 633 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, |
634 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, | ||
625 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, | 635 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, |
626 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, | 636 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, |
627 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) }, | 637 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff) }, |
@@ -633,38 +643,52 @@ static const struct usb_device_id option_ids[] = { | |||
633 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, | 643 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0023, 0xff, 0xff, 0xff) }, |
634 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, | 644 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, |
635 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, | 645 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff) }, |
636 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, | 646 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */ |
637 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, | 647 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, |
638 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, | 648 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, |
639 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, | 649 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, |
640 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) }, | 650 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626, 0xff, 0xff, 0xff) }, |
641 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, | 651 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0032, 0xff, 0xff, 0xff) }, |
642 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, | 652 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0033, 0xff, 0xff, 0xff) }, |
653 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0034, 0xff, 0xff, 0xff) }, | ||
643 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, | 654 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0037, 0xff, 0xff, 0xff) }, |
655 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0038, 0xff, 0xff, 0xff) }, | ||
644 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, | 656 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0039, 0xff, 0xff, 0xff) }, |
657 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0040, 0xff, 0xff, 0xff) }, | ||
645 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, | 658 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0042, 0xff, 0xff, 0xff) }, |
646 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, | 659 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0043, 0xff, 0xff, 0xff) }, |
660 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0044, 0xff, 0xff, 0xff) }, | ||
647 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, | 661 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0048, 0xff, 0xff, 0xff) }, |
648 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, | 662 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0049, 0xff, 0xff, 0xff) }, |
663 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0050, 0xff, 0xff, 0xff) }, | ||
649 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, | 664 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, |
650 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, | 665 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff) }, |
666 | /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */ | ||
651 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, | 667 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, |
652 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, | 668 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff) }, |
669 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0056, 0xff, 0xff, 0xff) }, | ||
653 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, | 670 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, |
654 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, | 671 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff) }, |
672 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, | ||
655 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, | 673 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, |
656 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, | 674 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, |
657 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, | 675 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff) }, |
658 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, | 676 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0064, 0xff, 0xff, 0xff) }, |
677 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0065, 0xff, 0xff, 0xff) }, | ||
659 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, | 678 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, |
679 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) }, | ||
660 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, | 680 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, |
681 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, | ||
661 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, | 682 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, |
683 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) }, | ||
662 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, | 684 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, |
685 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0079, 0xff, 0xff, 0xff) }, | ||
663 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) }, | 686 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0082, 0xff, 0xff, 0xff) }, |
687 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, | ||
664 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, | 688 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, |
665 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, | 689 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, |
666 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | ||
667 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, | 690 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) }, |
691 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, | ||
668 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, | 692 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) }, |
669 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, | 693 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) }, |
670 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) }, | 694 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) }, |
@@ -880,6 +904,8 @@ static const struct usb_device_id option_ids[] = { | |||
880 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, | 904 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, |
881 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, | 905 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, |
882 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, | 906 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, |
907 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, | ||
908 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | ||
883 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, | 909 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, |
884 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, | 910 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, |
885 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | 911 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, |
@@ -922,7 +948,17 @@ static const struct usb_device_id option_ids[] = { | |||
922 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, | 948 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_100F) }, |
923 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, | 949 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1011)}, |
924 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, | 950 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1012)}, |
925 | { USB_DEVICE(CINTERION_VENDOR_ID, 0x0047) }, | 951 | /* Cinterion */ |
952 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | ||
953 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | ||
954 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | ||
955 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, | ||
956 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
957 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, | ||
958 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | ||
959 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | ||
960 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | ||
961 | |||
926 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 962 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
927 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 963 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
928 | { } /* Terminating entry */ | 964 | { } /* Terminating entry */ |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index e199b0f4f99c..1c46a863295b 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -157,6 +157,7 @@ static struct usb_serial_driver oti6858_device = { | |||
157 | .name = "oti6858", | 157 | .name = "oti6858", |
158 | }, | 158 | }, |
159 | .id_table = id_table, | 159 | .id_table = id_table, |
160 | .usb_driver = &oti6858_driver, | ||
160 | .num_ports = 1, | 161 | .num_ports = 1, |
161 | .open = oti6858_open, | 162 | .open = oti6858_open, |
162 | .close = oti6858_close, | 163 | .close = oti6858_close, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 8ae4c6cbc38a..08c9181b8e48 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -50,6 +50,7 @@ static const struct usb_device_id id_table[] = { | |||
50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | 50 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, | 51 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, | 52 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, | ||
53 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
54 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 55 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
55 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 56 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -677,9 +678,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
677 | { | 678 | { |
678 | 679 | ||
679 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 680 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
681 | struct tty_struct *tty; | ||
680 | unsigned long flags; | 682 | unsigned long flags; |
681 | u8 status_idx = UART_STATE; | 683 | u8 status_idx = UART_STATE; |
682 | u8 length = UART_STATE + 1; | 684 | u8 length = UART_STATE + 1; |
685 | u8 prev_line_status; | ||
683 | u16 idv, idp; | 686 | u16 idv, idp; |
684 | 687 | ||
685 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); | 688 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
@@ -701,11 +704,20 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
701 | 704 | ||
702 | /* Save off the uart status for others to look at */ | 705 | /* Save off the uart status for others to look at */ |
703 | spin_lock_irqsave(&priv->lock, flags); | 706 | spin_lock_irqsave(&priv->lock, flags); |
707 | prev_line_status = priv->line_status; | ||
704 | priv->line_status = data[status_idx]; | 708 | priv->line_status = data[status_idx]; |
705 | spin_unlock_irqrestore(&priv->lock, flags); | 709 | spin_unlock_irqrestore(&priv->lock, flags); |
706 | if (priv->line_status & UART_BREAK_ERROR) | 710 | if (priv->line_status & UART_BREAK_ERROR) |
707 | usb_serial_handle_break(port); | 711 | usb_serial_handle_break(port); |
708 | wake_up_interruptible(&priv->delta_msr_wait); | 712 | wake_up_interruptible(&priv->delta_msr_wait); |
713 | |||
714 | tty = tty_port_tty_get(&port->port); | ||
715 | if (!tty) | ||
716 | return; | ||
717 | if ((priv->line_status ^ prev_line_status) & UART_DCD) | ||
718 | usb_serial_handle_dcd_change(port, tty, | ||
719 | priv->line_status & UART_DCD); | ||
720 | tty_kref_put(tty); | ||
709 | } | 721 | } |
710 | 722 | ||
711 | static void pl2303_read_int_callback(struct urb *urb) | 723 | static void pl2303_read_int_callback(struct urb *urb) |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 43eb9bdad422..1b025f75dafd 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define PL2303_PRODUCT_ID_MMX 0x0612 | 21 | #define PL2303_PRODUCT_ID_MMX 0x0612 |
22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 | 22 | #define PL2303_PRODUCT_ID_GPRS 0x0609 |
23 | #define PL2303_PRODUCT_ID_HCR331 0x331a | 23 | #define PL2303_PRODUCT_ID_HCR331 0x331a |
24 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 | ||
24 | 25 | ||
25 | #define ATEN_VENDOR_ID 0x0557 | 26 | #define ATEN_VENDOR_ID 0x0557 |
26 | #define ATEN_VENDOR_ID2 0x0547 | 27 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c index 214a3e504292..30b73e68a904 100644 --- a/drivers/usb/serial/qcaux.c +++ b/drivers/usb/serial/qcaux.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 | 36 | #define UTSTARCOM_PRODUCT_UM175_V1 0x3712 |
37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 | 37 | #define UTSTARCOM_PRODUCT_UM175_V2 0x3714 |
38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 | 38 | #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 |
39 | #define PANTECH_PRODUCT_UML290_VZW 0x3718 | ||
39 | 40 | ||
40 | /* CMOTECH devices */ | 41 | /* CMOTECH devices */ |
41 | #define CMOTECH_VENDOR_ID 0x16d8 | 42 | #define CMOTECH_VENDOR_ID 0x16d8 |
@@ -66,6 +67,7 @@ static struct usb_device_id id_table[] = { | |||
66 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, | 67 | { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, |
67 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, | 68 | { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, |
68 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, | 69 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, |
70 | { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, | ||
69 | { }, | 71 | { }, |
70 | }; | 72 | }; |
71 | MODULE_DEVICE_TABLE(usb, id_table); | 73 | MODULE_DEVICE_TABLE(usb, id_table); |
@@ -84,6 +86,7 @@ static struct usb_serial_driver qcaux_device = { | |||
84 | .name = "qcaux", | 86 | .name = "qcaux", |
85 | }, | 87 | }, |
86 | .id_table = id_table, | 88 | .id_table = id_table, |
89 | .usb_driver = &qcaux_driver, | ||
87 | .num_ports = 1, | 90 | .num_ports = 1, |
88 | }; | 91 | }; |
89 | 92 | ||
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c index cb8195cabfde..74cd4ccdb3fc 100644 --- a/drivers/usb/serial/siemens_mpi.c +++ b/drivers/usb/serial/siemens_mpi.c | |||
@@ -42,6 +42,7 @@ static struct usb_serial_driver siemens_usb_mpi_device = { | |||
42 | .name = "siemens_mpi", | 42 | .name = "siemens_mpi", |
43 | }, | 43 | }, |
44 | .id_table = id_table, | 44 | .id_table = id_table, |
45 | .usb_driver = &siemens_usb_mpi_driver, | ||
45 | .num_ports = 1, | 46 | .num_ports = 1, |
46 | }; | 47 | }; |
47 | 48 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 329d311a35d9..f88bc511da65 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -133,7 +133,7 @@ struct spcp8x5_usb_ctrl_arg { | |||
133 | 133 | ||
134 | /* how come ??? */ | 134 | /* how come ??? */ |
135 | #define UART_STATE 0x08 | 135 | #define UART_STATE 0x08 |
136 | #define UART_STATE_TRANSIENT_MASK 0x74 | 136 | #define UART_STATE_TRANSIENT_MASK 0x75 |
137 | #define UART_DCD 0x01 | 137 | #define UART_DCD 0x01 |
138 | #define UART_DSR 0x02 | 138 | #define UART_DSR 0x02 |
139 | #define UART_BREAK_ERROR 0x04 | 139 | #define UART_BREAK_ERROR 0x04 |
@@ -526,6 +526,10 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
526 | /* overrun is special, not associated with a char */ | 526 | /* overrun is special, not associated with a char */ |
527 | if (status & UART_OVERRUN_ERROR) | 527 | if (status & UART_OVERRUN_ERROR) |
528 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 528 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
529 | |||
530 | if (status & UART_DCD) | ||
531 | usb_serial_handle_dcd_change(port, tty, | ||
532 | priv->line_status & MSR_STATUS_LINE_DCD); | ||
529 | } | 533 | } |
530 | 534 | ||
531 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, | 535 | tty_insert_flip_string_fixed_flag(tty, data, tty_flag, |
@@ -646,6 +650,7 @@ static struct usb_serial_driver spcp8x5_device = { | |||
646 | .name = "SPCP8x5", | 650 | .name = "SPCP8x5", |
647 | }, | 651 | }, |
648 | .id_table = id_table, | 652 | .id_table = id_table, |
653 | .usb_driver = &spcp8x5_driver, | ||
649 | .num_ports = 1, | 654 | .num_ports = 1, |
650 | .open = spcp8x5_open, | 655 | .open = spcp8x5_open, |
651 | .dtr_rts = spcp8x5_dtr_rts, | 656 | .dtr_rts = spcp8x5_dtr_rts, |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 90979a1f5311..c58ef5434733 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -365,9 +365,9 @@ failed_1port: | |||
365 | 365 | ||
366 | static void __exit ti_exit(void) | 366 | static void __exit ti_exit(void) |
367 | { | 367 | { |
368 | usb_deregister(&ti_usb_driver); | ||
368 | usb_serial_deregister(&ti_1port_device); | 369 | usb_serial_deregister(&ti_1port_device); |
369 | usb_serial_deregister(&ti_2port_device); | 370 | usb_serial_deregister(&ti_2port_device); |
370 | usb_deregister(&ti_usb_driver); | ||
371 | } | 371 | } |
372 | 372 | ||
373 | 373 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7a2177c79bde..6afd8e848117 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -52,6 +52,7 @@ static struct usb_driver usb_serial_driver = { | |||
52 | .suspend = usb_serial_suspend, | 52 | .suspend = usb_serial_suspend, |
53 | .resume = usb_serial_resume, | 53 | .resume = usb_serial_resume, |
54 | .no_dynamic_id = 1, | 54 | .no_dynamic_id = 1, |
55 | .supports_autosuspend = 1, | ||
55 | }; | 56 | }; |
56 | 57 | ||
57 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead | 58 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead |
@@ -1334,6 +1335,12 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1334 | 1335 | ||
1335 | if (!driver->description) | 1336 | if (!driver->description) |
1336 | driver->description = driver->driver.name; | 1337 | driver->description = driver->driver.name; |
1338 | if (!driver->usb_driver) { | ||
1339 | WARN(1, "Serial driver %s has no usb_driver\n", | ||
1340 | driver->description); | ||
1341 | return -EINVAL; | ||
1342 | } | ||
1343 | driver->usb_driver->supports_autosuspend = 1; | ||
1337 | 1344 | ||
1338 | /* Add this device to our list of devices */ | 1345 | /* Add this device to our list of devices */ |
1339 | mutex_lock(&table_lock); | 1346 | mutex_lock(&table_lock); |
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c index f2ed6a31be77..95a82148ee81 100644 --- a/drivers/usb/serial/usb_debug.c +++ b/drivers/usb/serial/usb_debug.c | |||
@@ -75,6 +75,7 @@ static struct usb_serial_driver debug_device = { | |||
75 | .name = "debug", | 75 | .name = "debug", |
76 | }, | 76 | }, |
77 | .id_table = id_table, | 77 | .id_table = id_table, |
78 | .usb_driver = &debug_driver, | ||
78 | .num_ports = 1, | 79 | .num_ports = 1, |
79 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, | 80 | .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, |
80 | .break_ctl = usb_debug_break_ctl, | 81 | .break_ctl = usb_debug_break_ctl, |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index eb76aaef4268..15a5d89b7f39 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -606,6 +606,10 @@ static int treo_attach(struct usb_serial *serial) | |||
606 | 606 | ||
607 | static int clie_5_attach(struct usb_serial *serial) | 607 | static int clie_5_attach(struct usb_serial *serial) |
608 | { | 608 | { |
609 | struct usb_serial_port *port; | ||
610 | unsigned int pipe; | ||
611 | int j; | ||
612 | |||
609 | dbg("%s", __func__); | 613 | dbg("%s", __func__); |
610 | 614 | ||
611 | /* TH55 registers 2 ports. | 615 | /* TH55 registers 2 ports. |
@@ -621,9 +625,14 @@ static int clie_5_attach(struct usb_serial *serial) | |||
621 | return -1; | 625 | return -1; |
622 | 626 | ||
623 | /* port 0 now uses the modified endpoint Address */ | 627 | /* port 0 now uses the modified endpoint Address */ |
624 | serial->port[0]->bulk_out_endpointAddress = | 628 | port = serial->port[0]; |
629 | port->bulk_out_endpointAddress = | ||
625 | serial->port[1]->bulk_out_endpointAddress; | 630 | serial->port[1]->bulk_out_endpointAddress; |
626 | 631 | ||
632 | pipe = usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress); | ||
633 | for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) | ||
634 | port->write_urbs[j]->pipe = pipe; | ||
635 | |||
627 | return 0; | 636 | return 0; |
628 | } | 637 | } |
629 | 638 | ||
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 57fc2f532cab..ceba512f84d0 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c | |||
@@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, | |||
121 | } | 121 | } |
122 | return result; | 122 | return result; |
123 | } | 123 | } |
124 | static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); | 124 | static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); |
125 | 125 | ||
126 | int sierra_ms_init(struct us_data *us) | 126 | int sierra_ms_init(struct us_data *us) |
127 | { | 127 | { |
diff --git a/drivers/usb/storage/unusual_cypress.h b/drivers/usb/storage/unusual_cypress.h index 44be6d75dab6..fba2824085b4 100644 --- a/drivers/usb/storage/unusual_cypress.h +++ b/drivers/usb/storage/unusual_cypress.h | |||
@@ -31,4 +31,9 @@ UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999, | |||
31 | "Cypress ISD-300LP", | 31 | "Cypress ISD-300LP", |
32 | US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0), | 32 | US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0), |
33 | 33 | ||
34 | UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999, | ||
35 | "Super Top", | ||
36 | "USB 2.0 SATA BRIDGE", | ||
37 | US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0), | ||
38 | |||
34 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ | 39 | #endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 2c897eefadde..b0c0a33910e8 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -481,6 +481,13 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220, | |||
481 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 481 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
482 | US_FL_MAX_SECTORS_64), | 482 | US_FL_MAX_SECTORS_64), |
483 | 483 | ||
484 | /* Reported by Vitaly Kuznetsov <vitty@altlinux.ru> */ | ||
485 | UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | ||
486 | "Samsung", | ||
487 | "YP-CP3", | ||
488 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
489 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | ||
490 | |||
484 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 491 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
485 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 492 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
486 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 493 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
@@ -1036,6 +1043,15 @@ UNUSUAL_DEV( 0x084d, 0x0011, 0x0110, 0x0110, | |||
1036 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1043 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1037 | US_FL_BULK32), | 1044 | US_FL_BULK32), |
1038 | 1045 | ||
1046 | /* Reported by <ttkspam@free.fr> | ||
1047 | * The device reports a vendor-specific device class, requiring an | ||
1048 | * explicit vendor/product match. | ||
1049 | */ | ||
1050 | UNUSUAL_DEV( 0x0851, 0x1542, 0x0002, 0x0002, | ||
1051 | "MagicPixel", | ||
1052 | "FW_Omega2", | ||
1053 | US_SC_DEVICE, US_PR_DEVICE, NULL, 0), | ||
1054 | |||
1039 | /* Andrew Lunn <andrew@lunn.ch> | 1055 | /* Andrew Lunn <andrew@lunn.ch> |
1040 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL | 1056 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL |
1041 | * on LUN 4. | 1057 | * on LUN 4. |
@@ -1380,6 +1396,13 @@ UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100, | |||
1380 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1396 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1381 | US_FL_IGNORE_RESIDUE ), | 1397 | US_FL_IGNORE_RESIDUE ), |
1382 | 1398 | ||
1399 | /* Submitted by Nick Holloway */ | ||
1400 | UNUSUAL_DEV( 0x0f88, 0x042e, 0x0100, 0x0100, | ||
1401 | "VTech", | ||
1402 | "Kidizoom", | ||
1403 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1404 | US_FL_FIX_CAPACITY ), | ||
1405 | |||
1383 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1406 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1384 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1407 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1385 | "Sony Ericsson", | 1408 | "Sony Ericsson", |
@@ -1859,6 +1882,22 @@ UNUSUAL_DEV( 0x1908, 0x1320, 0x0000, 0x0000, | |||
1859 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1882 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1860 | US_FL_BAD_SENSE ), | 1883 | US_FL_BAD_SENSE ), |
1861 | 1884 | ||
1885 | /* Patch by Richard Schütz <r.schtz@t-online.de> | ||
1886 | * This external hard drive enclosure uses a JMicron chip which | ||
1887 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | ||
1888 | UNUSUAL_DEV( 0x1e68, 0x001b, 0x0000, 0x0000, | ||
1889 | "TrekStor GmbH & Co. KG", | ||
1890 | "DataStation maxi g.u", | ||
1891 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1892 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | ||
1893 | |||
1894 | /* Reported by Jasper Mackenzie <scarletpimpernal@hotmail.com> */ | ||
1895 | UNUSUAL_DEV( 0x1e74, 0x4621, 0x0000, 0x0000, | ||
1896 | "Coby Electronics", | ||
1897 | "MP3 Player", | ||
1898 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1899 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), | ||
1900 | |||
1862 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, | 1901 | UNUSUAL_DEV( 0x2116, 0x0320, 0x0001, 0x0001, |
1863 | "ST", | 1902 | "ST", |
1864 | "2A", | 1903 | "2A", |
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 38ffc3fbcbe4..c06c667e9ca9 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #define MAX_BRIGHTNESS (0xFF) | 21 | #define MAX_BRIGHTNESS (0xFF) |
22 | #define MIN_BRIGHTNESS (0) | 22 | #define MIN_BRIGHTNESS (0) |
23 | 23 | ||
24 | #define CURRENT_MASK (0x1F << 1) | 24 | #define CURRENT_BITMASK (0x1F << 1) |
25 | 25 | ||
26 | struct pm860x_backlight_data { | 26 | struct pm860x_backlight_data { |
27 | struct pm860x_chip *chip; | 27 | struct pm860x_chip *chip; |
@@ -85,7 +85,7 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness) | |||
85 | if ((data->current_brightness == 0) && brightness) { | 85 | if ((data->current_brightness == 0) && brightness) { |
86 | if (data->iset) { | 86 | if (data->iset) { |
87 | ret = pm860x_set_bits(data->i2c, wled_idc(data->port), | 87 | ret = pm860x_set_bits(data->i2c, wled_idc(data->port), |
88 | CURRENT_MASK, data->iset); | 88 | CURRENT_BITMASK, data->iset); |
89 | if (ret < 0) | 89 | if (ret < 0) |
90 | goto out; | 90 | goto out; |
91 | } | 91 | } |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index e207810bba3c..08703299ef61 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state) | |||
197 | { | 197 | { |
198 | struct backlight_device *bd = to_backlight_device(dev); | 198 | struct backlight_device *bd = to_backlight_device(dev); |
199 | 199 | ||
200 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 200 | mutex_lock(&bd->ops_lock); |
201 | mutex_lock(&bd->ops_lock); | 201 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
202 | bd->props.state |= BL_CORE_SUSPENDED; | 202 | bd->props.state |= BL_CORE_SUSPENDED; |
203 | backlight_update_status(bd); | 203 | backlight_update_status(bd); |
204 | mutex_unlock(&bd->ops_lock); | ||
205 | } | 204 | } |
205 | mutex_unlock(&bd->ops_lock); | ||
206 | 206 | ||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
@@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev) | |||
211 | { | 211 | { |
212 | struct backlight_device *bd = to_backlight_device(dev); | 212 | struct backlight_device *bd = to_backlight_device(dev); |
213 | 213 | ||
214 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 214 | mutex_lock(&bd->ops_lock); |
215 | mutex_lock(&bd->ops_lock); | 215 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
216 | bd->props.state &= ~BL_CORE_SUSPENDED; | 216 | bd->props.state &= ~BL_CORE_SUSPENDED; |
217 | backlight_update_status(bd); | 217 | backlight_update_status(bd); |
218 | mutex_unlock(&bd->ops_lock); | ||
219 | } | 218 | } |
219 | mutex_unlock(&bd->ops_lock); | ||
220 | 220 | ||
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c index e44893ea590d..c2f4e6e166f1 100644 --- a/drivers/video/via/accel.c +++ b/drivers/video/via/accel.c | |||
@@ -283,11 +283,12 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height, | |||
283 | writel(tmp, engine + 0x1C); | 283 | writel(tmp, engine + 0x1C); |
284 | } | 284 | } |
285 | 285 | ||
286 | if (op != VIA_BITBLT_COLOR) | 286 | if (op == VIA_BITBLT_FILL) { |
287 | writel(fg_color, engine + 0x58); | ||
288 | } else if (op == VIA_BITBLT_MONO) { | ||
287 | writel(fg_color, engine + 0x4C); | 289 | writel(fg_color, engine + 0x4C); |
288 | |||
289 | if (op == VIA_BITBLT_MONO) | ||
290 | writel(bg_color, engine + 0x50); | 290 | writel(bg_color, engine + 0x50); |
291 | } | ||
291 | 292 | ||
292 | if (op == VIA_BITBLT_FILL) | 293 | if (op == VIA_BITBLT_FILL) |
293 | ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; | 294 | ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; |
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c index da9e4ca94b17..021112e279de 100644 --- a/drivers/video/via/via_i2c.c +++ b/drivers/video/via/via_i2c.c | |||
@@ -114,6 +114,7 @@ static void via_i2c_setsda(void *data, int state) | |||
114 | 114 | ||
115 | int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) | 115 | int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) |
116 | { | 116 | { |
117 | int ret; | ||
117 | u8 mm1[] = {0x00}; | 118 | u8 mm1[] = {0x00}; |
118 | struct i2c_msg msgs[2]; | 119 | struct i2c_msg msgs[2]; |
119 | 120 | ||
@@ -126,11 +127,18 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) | |||
126 | mm1[0] = index; | 127 | mm1[0] = index; |
127 | msgs[0].len = 1; msgs[1].len = 1; | 128 | msgs[0].len = 1; msgs[1].len = 1; |
128 | msgs[0].buf = mm1; msgs[1].buf = pdata; | 129 | msgs[0].buf = mm1; msgs[1].buf = pdata; |
129 | return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); | 130 | ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
131 | if (ret == 2) | ||
132 | ret = 0; | ||
133 | else if (ret >= 0) | ||
134 | ret = -EIO; | ||
135 | |||
136 | return ret; | ||
130 | } | 137 | } |
131 | 138 | ||
132 | int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) | 139 | int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) |
133 | { | 140 | { |
141 | int ret; | ||
134 | u8 msg[2] = { index, data }; | 142 | u8 msg[2] = { index, data }; |
135 | struct i2c_msg msgs; | 143 | struct i2c_msg msgs; |
136 | 144 | ||
@@ -140,11 +148,18 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) | |||
140 | msgs.addr = slave_addr / 2; | 148 | msgs.addr = slave_addr / 2; |
141 | msgs.len = 2; | 149 | msgs.len = 2; |
142 | msgs.buf = msg; | 150 | msgs.buf = msg; |
143 | return i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); | 151 | ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); |
152 | if (ret == 1) | ||
153 | ret = 0; | ||
154 | else if (ret >= 0) | ||
155 | ret = -EIO; | ||
156 | |||
157 | return ret; | ||
144 | } | 158 | } |
145 | 159 | ||
146 | int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) | 160 | int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) |
147 | { | 161 | { |
162 | int ret; | ||
148 | u8 mm1[] = {0x00}; | 163 | u8 mm1[] = {0x00}; |
149 | struct i2c_msg msgs[2]; | 164 | struct i2c_msg msgs[2]; |
150 | 165 | ||
@@ -156,7 +171,13 @@ int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len | |||
156 | mm1[0] = index; | 171 | mm1[0] = index; |
157 | msgs[0].len = 1; msgs[1].len = buff_len; | 172 | msgs[0].len = 1; msgs[1].len = buff_len; |
158 | msgs[0].buf = mm1; msgs[1].buf = buff; | 173 | msgs[0].buf = mm1; msgs[1].buf = buff; |
159 | return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); | 174 | ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
175 | if (ret == 2) | ||
176 | ret = 0; | ||
177 | else if (ret >= 0) | ||
178 | ret = -EIO; | ||
179 | |||
180 | return ret; | ||
160 | } | 181 | } |
161 | 182 | ||
162 | /* | 183 | /* |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index ef8d9d558fc7..4fb5b2bf2348 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -96,11 +96,6 @@ static struct pci_device_id virtio_pci_id_table[] = { | |||
96 | 96 | ||
97 | MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); | 97 | MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); |
98 | 98 | ||
99 | /* A PCI device has it's own struct device and so does a virtio device so | ||
100 | * we create a place for the virtio devices to show up in sysfs. I think it | ||
101 | * would make more sense for virtio to not insist on having it's own device. */ | ||
102 | static struct device *virtio_pci_root; | ||
103 | |||
104 | /* Convert a generic virtio device to our structure */ | 99 | /* Convert a generic virtio device to our structure */ |
105 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) | 100 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) |
106 | { | 101 | { |
@@ -629,7 +624,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
629 | if (vp_dev == NULL) | 624 | if (vp_dev == NULL) |
630 | return -ENOMEM; | 625 | return -ENOMEM; |
631 | 626 | ||
632 | vp_dev->vdev.dev.parent = virtio_pci_root; | 627 | vp_dev->vdev.dev.parent = &pci_dev->dev; |
633 | vp_dev->vdev.dev.release = virtio_pci_release_dev; | 628 | vp_dev->vdev.dev.release = virtio_pci_release_dev; |
634 | vp_dev->vdev.config = &virtio_pci_config_ops; | 629 | vp_dev->vdev.config = &virtio_pci_config_ops; |
635 | vp_dev->pci_dev = pci_dev; | 630 | vp_dev->pci_dev = pci_dev; |
@@ -717,17 +712,7 @@ static struct pci_driver virtio_pci_driver = { | |||
717 | 712 | ||
718 | static int __init virtio_pci_init(void) | 713 | static int __init virtio_pci_init(void) |
719 | { | 714 | { |
720 | int err; | 715 | return pci_register_driver(&virtio_pci_driver); |
721 | |||
722 | virtio_pci_root = root_device_register("virtio-pci"); | ||
723 | if (IS_ERR(virtio_pci_root)) | ||
724 | return PTR_ERR(virtio_pci_root); | ||
725 | |||
726 | err = pci_register_driver(&virtio_pci_driver); | ||
727 | if (err) | ||
728 | root_device_unregister(virtio_pci_root); | ||
729 | |||
730 | return err; | ||
731 | } | 716 | } |
732 | 717 | ||
733 | module_init(virtio_pci_init); | 718 | module_init(virtio_pci_init); |
@@ -735,7 +720,6 @@ module_init(virtio_pci_init); | |||
735 | static void __exit virtio_pci_exit(void) | 720 | static void __exit virtio_pci_exit(void) |
736 | { | 721 | { |
737 | pci_unregister_driver(&virtio_pci_driver); | 722 | pci_unregister_driver(&virtio_pci_driver); |
738 | root_device_unregister(virtio_pci_root); | ||
739 | } | 723 | } |
740 | 724 | ||
741 | module_exit(virtio_pci_exit); | 725 | module_exit(virtio_pci_exit); |
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index 428f8a1583e8..3939e53f5f98 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -231,7 +231,7 @@ static int __devinit rdc321x_wdt_probe(struct platform_device *pdev) | |||
231 | struct resource *r; | 231 | struct resource *r; |
232 | struct rdc321x_wdt_pdata *pdata; | 232 | struct rdc321x_wdt_pdata *pdata; |
233 | 233 | ||
234 | pdata = pdev->dev.platform_data; | 234 | pdata = platform_get_drvdata(pdev); |
235 | if (!pdata) { | 235 | if (!pdata) { |
236 | dev_err(&pdev->dev, "no platform data supplied\n"); | 236 | dev_err(&pdev->dev, "no platform data supplied\n"); |
237 | return -ENODEV; | 237 | return -ENODEV; |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 13365ba35218..a68cc62574ed 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -261,7 +261,7 @@ static void init_evtchn_cpu_bindings(void) | |||
261 | } | 261 | } |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); | 264 | memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s)); |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline void clear_evtchn(int port) | 267 | static inline void clear_evtchn(int port) |
@@ -370,6 +370,9 @@ struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) | |||
370 | { | 370 | { |
371 | struct bio *bio; | 371 | struct bio *bio; |
372 | 372 | ||
373 | if (nr_iovecs > UIO_MAXIOV) | ||
374 | return NULL; | ||
375 | |||
373 | bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), | 376 | bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), |
374 | gfp_mask); | 377 | gfp_mask); |
375 | if (unlikely(!bio)) | 378 | if (unlikely(!bio)) |
@@ -697,8 +700,12 @@ static void bio_free_map_data(struct bio_map_data *bmd) | |||
697 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, | 700 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, |
698 | gfp_t gfp_mask) | 701 | gfp_t gfp_mask) |
699 | { | 702 | { |
700 | struct bio_map_data *bmd = kmalloc(sizeof(*bmd), gfp_mask); | 703 | struct bio_map_data *bmd; |
701 | 704 | ||
705 | if (iov_count > UIO_MAXIOV) | ||
706 | return NULL; | ||
707 | |||
708 | bmd = kmalloc(sizeof(*bmd), gfp_mask); | ||
702 | if (!bmd) | 709 | if (!bmd) |
703 | return NULL; | 710 | return NULL; |
704 | 711 | ||
@@ -827,6 +834,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
827 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 834 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
828 | start = uaddr >> PAGE_SHIFT; | 835 | start = uaddr >> PAGE_SHIFT; |
829 | 836 | ||
837 | /* | ||
838 | * Overflow, abort | ||
839 | */ | ||
840 | if (end < start) | ||
841 | return ERR_PTR(-EINVAL); | ||
842 | |||
830 | nr_pages += end - start; | 843 | nr_pages += end - start; |
831 | len += iov[i].iov_len; | 844 | len += iov[i].iov_len; |
832 | } | 845 | } |
@@ -955,6 +968,12 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
955 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 968 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
956 | unsigned long start = uaddr >> PAGE_SHIFT; | 969 | unsigned long start = uaddr >> PAGE_SHIFT; |
957 | 970 | ||
971 | /* | ||
972 | * Overflow, abort | ||
973 | */ | ||
974 | if (end < start) | ||
975 | return ERR_PTR(-EINVAL); | ||
976 | |||
958 | nr_pages += end - start; | 977 | nr_pages += end - start; |
959 | /* | 978 | /* |
960 | * buffer must be aligned to at least hardsector size for now | 979 | * buffer must be aligned to at least hardsector size for now |
@@ -982,7 +1001,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
982 | unsigned long start = uaddr >> PAGE_SHIFT; | 1001 | unsigned long start = uaddr >> PAGE_SHIFT; |
983 | const int local_nr_pages = end - start; | 1002 | const int local_nr_pages = end - start; |
984 | const int page_limit = cur_page + local_nr_pages; | 1003 | const int page_limit = cur_page + local_nr_pages; |
985 | 1004 | ||
986 | ret = get_user_pages_fast(uaddr, local_nr_pages, | 1005 | ret = get_user_pages_fast(uaddr, local_nr_pages, |
987 | write_to_vm, &pages[cur_page]); | 1006 | write_to_vm, &pages[cur_page]); |
988 | if (ret < local_nr_pages) { | 1007 | if (ret < local_nr_pages) { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1d60c655e3e0..f110e0e7e947 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -107,7 +107,8 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, | |||
107 | 107 | ||
108 | extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, | 108 | extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, |
109 | __u16 fileHandle, struct file *file, | 109 | __u16 fileHandle, struct file *file, |
110 | struct vfsmount *mnt, unsigned int oflags); | 110 | struct vfsmount *mnt, unsigned int oflags, |
111 | __u32 oplock); | ||
111 | extern int cifs_posix_open(char *full_path, struct inode **pinode, | 112 | extern int cifs_posix_open(char *full_path, struct inode **pinode, |
112 | struct super_block *sb, | 113 | struct super_block *sb, |
113 | int mode, int oflags, | 114 | int mode, int oflags, |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index f9ed0751cc12..0f947bf73f8e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -132,9 +132,9 @@ cifs_bp_rename_retry: | |||
132 | 132 | ||
133 | struct cifsFileInfo * | 133 | struct cifsFileInfo * |
134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | 134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, |
135 | struct file *file, struct vfsmount *mnt, unsigned int oflags) | 135 | struct file *file, struct vfsmount *mnt, unsigned int oflags, |
136 | __u32 oplock) | ||
136 | { | 137 | { |
137 | int oplock = 0; | ||
138 | struct cifsFileInfo *pCifsFile; | 138 | struct cifsFileInfo *pCifsFile; |
139 | struct cifsInodeInfo *pCifsInode; | 139 | struct cifsInodeInfo *pCifsInode; |
140 | struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); | 140 | struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); |
@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | |||
143 | if (pCifsFile == NULL) | 143 | if (pCifsFile == NULL) |
144 | return pCifsFile; | 144 | return pCifsFile; |
145 | 145 | ||
146 | if (oplockEnabled) | ||
147 | oplock = REQ_OPLOCK; | ||
148 | |||
149 | pCifsFile->netfid = fileHandle; | 146 | pCifsFile->netfid = fileHandle; |
150 | pCifsFile->pid = current->tgid; | 147 | pCifsFile->pid = current->tgid; |
151 | pCifsFile->pInode = igrab(newinode); | 148 | pCifsFile->pInode = igrab(newinode); |
@@ -468,7 +465,7 @@ cifs_create_set_dentry: | |||
468 | } | 465 | } |
469 | 466 | ||
470 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, | 467 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, |
471 | nd->path.mnt, oflags); | 468 | nd->path.mnt, oflags, oplock); |
472 | if (pfile_info == NULL) { | 469 | if (pfile_info == NULL) { |
473 | fput(filp); | 470 | fput(filp); |
474 | CIFSSMBClose(xid, tcon, fileHandle); | 471 | CIFSSMBClose(xid, tcon, fileHandle); |
@@ -729,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
729 | 726 | ||
730 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, | 727 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, |
731 | nd->path.mnt, | 728 | nd->path.mnt, |
732 | nd->intent.open.flags); | 729 | nd->intent.open.flags, |
730 | oplock); | ||
733 | if (cfile == NULL) { | 731 | if (cfile == NULL) { |
734 | fput(filp); | 732 | fput(filp); |
735 | CIFSSMBClose(xid, pTcon, fileHandle); | 733 | CIFSSMBClose(xid, pTcon, fileHandle); |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 0eb87026cad3..548f06230a6d 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | |||
66 | /* Search for server name delimiter */ | 66 | /* Search for server name delimiter */ |
67 | sep = memchr(hostname, '\\', len); | 67 | sep = memchr(hostname, '\\', len); |
68 | if (sep) | 68 | if (sep) |
69 | len = sep - unc; | 69 | len = sep - hostname; |
70 | else | 70 | else |
71 | cFYI(1, "%s: probably server name is whole unc: %s", | 71 | cFYI(1, "%s: probably server name is whole unc: %s", |
72 | __func__, unc); | 72 | __func__, unc); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index de748c652d11..681761c3e90c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -277,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
277 | 277 | ||
278 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, | 278 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, |
279 | file->f_path.mnt, | 279 | file->f_path.mnt, |
280 | oflags); | 280 | oflags, oplock); |
281 | if (pCifsFile == NULL) { | 281 | if (pCifsFile == NULL) { |
282 | CIFSSMBClose(xid, tcon, netfid); | 282 | CIFSSMBClose(xid, tcon, netfid); |
283 | rc = -ENOMEM; | 283 | rc = -ENOMEM; |
@@ -370,7 +370,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
370 | goto out; | 370 | goto out; |
371 | 371 | ||
372 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, | 372 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, |
373 | file->f_flags); | 373 | file->f_flags, oplock); |
374 | if (pCifsFile == NULL) { | 374 | if (pCifsFile == NULL) { |
375 | rc = -ENOMEM; | 375 | rc = -ENOMEM; |
376 | goto out; | 376 | goto out; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 53cce8cc2224..00d1ff339ae6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -835,8 +835,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
835 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 835 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
836 | xid, NULL); | 836 | xid, NULL); |
837 | 837 | ||
838 | if (!inode) | 838 | if (!inode) { |
839 | return ERR_PTR(rc); | 839 | inode = ERR_PTR(rc); |
840 | goto out; | ||
841 | } | ||
840 | 842 | ||
841 | #ifdef CONFIG_CIFS_FSCACHE | 843 | #ifdef CONFIG_CIFS_FSCACHE |
842 | /* populate tcon->resource_id */ | 844 | /* populate tcon->resource_id */ |
@@ -852,13 +854,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
852 | inode->i_uid = cifs_sb->mnt_uid; | 854 | inode->i_uid = cifs_sb->mnt_uid; |
853 | inode->i_gid = cifs_sb->mnt_gid; | 855 | inode->i_gid = cifs_sb->mnt_gid; |
854 | } else if (rc) { | 856 | } else if (rc) { |
855 | kfree(full_path); | ||
856 | _FreeXid(xid); | ||
857 | iget_failed(inode); | 857 | iget_failed(inode); |
858 | return ERR_PTR(rc); | 858 | inode = ERR_PTR(rc); |
859 | } | 859 | } |
860 | 860 | ||
861 | 861 | out: | |
862 | kfree(full_path); | 862 | kfree(full_path); |
863 | /* can not call macro FreeXid here since in a void func | 863 | /* can not call macro FreeXid here since in a void func |
864 | * TODO: This is no longer true | 864 | * TODO: This is no longer true |
diff --git a/fs/compat.c b/fs/compat.c index 0644a154672b..8b41dcdcdc67 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1378,6 +1378,10 @@ static int compat_count(compat_uptr_t __user *argv, int max) | |||
1378 | argv++; | 1378 | argv++; |
1379 | if (i++ >= max) | 1379 | if (i++ >= max) |
1380 | return -E2BIG; | 1380 | return -E2BIG; |
1381 | |||
1382 | if (fatal_signal_pending(current)) | ||
1383 | return -ERESTARTNOHAND; | ||
1384 | cond_resched(); | ||
1381 | } | 1385 | } |
1382 | } | 1386 | } |
1383 | return i; | 1387 | return i; |
@@ -1419,6 +1423,12 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1419 | while (len > 0) { | 1423 | while (len > 0) { |
1420 | int offset, bytes_to_copy; | 1424 | int offset, bytes_to_copy; |
1421 | 1425 | ||
1426 | if (fatal_signal_pending(current)) { | ||
1427 | ret = -ERESTARTNOHAND; | ||
1428 | goto out; | ||
1429 | } | ||
1430 | cond_resched(); | ||
1431 | |||
1422 | offset = pos % PAGE_SIZE; | 1432 | offset = pos % PAGE_SIZE; |
1423 | if (offset == 0) | 1433 | if (offset == 0) |
1424 | offset = PAGE_SIZE; | 1434 | offset = PAGE_SIZE; |
@@ -1435,18 +1445,8 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1435 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { | 1445 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { |
1436 | struct page *page; | 1446 | struct page *page; |
1437 | 1447 | ||
1438 | #ifdef CONFIG_STACK_GROWSUP | 1448 | page = get_arg_page(bprm, pos, 1); |
1439 | ret = expand_stack_downwards(bprm->vma, pos); | 1449 | if (!page) { |
1440 | if (ret < 0) { | ||
1441 | /* We've exceed the stack rlimit. */ | ||
1442 | ret = -E2BIG; | ||
1443 | goto out; | ||
1444 | } | ||
1445 | #endif | ||
1446 | ret = get_user_pages(current, bprm->mm, pos, | ||
1447 | 1, 1, 1, &page, NULL); | ||
1448 | if (ret <= 0) { | ||
1449 | /* We've exceed the stack rlimit. */ | ||
1450 | ret = -E2BIG; | 1450 | ret = -E2BIG; |
1451 | goto out; | 1451 | goto out; |
1452 | } | 1452 | } |
@@ -1567,8 +1567,10 @@ int compat_do_execve(char * filename, | |||
1567 | return retval; | 1567 | return retval; |
1568 | 1568 | ||
1569 | out: | 1569 | out: |
1570 | if (bprm->mm) | 1570 | if (bprm->mm) { |
1571 | acct_arg_size(bprm, 0); | ||
1571 | mmput(bprm->mm); | 1572 | mmput(bprm->mm); |
1573 | } | ||
1572 | 1574 | ||
1573 | out_file: | 1575 | out_file: |
1574 | if (bprm->file) { | 1576 | if (bprm->file) { |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 48d74c7391d1..92030e371a94 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -325,12 +325,16 @@ void dio_end_io(struct bio *bio, int error) | |||
325 | } | 325 | } |
326 | EXPORT_SYMBOL_GPL(dio_end_io); | 326 | EXPORT_SYMBOL_GPL(dio_end_io); |
327 | 327 | ||
328 | static int | 328 | static void |
329 | dio_bio_alloc(struct dio *dio, struct block_device *bdev, | 329 | dio_bio_alloc(struct dio *dio, struct block_device *bdev, |
330 | sector_t first_sector, int nr_vecs) | 330 | sector_t first_sector, int nr_vecs) |
331 | { | 331 | { |
332 | struct bio *bio; | 332 | struct bio *bio; |
333 | 333 | ||
334 | /* | ||
335 | * bio_alloc() is guaranteed to return a bio when called with | ||
336 | * __GFP_WAIT and we request a valid number of vectors. | ||
337 | */ | ||
334 | bio = bio_alloc(GFP_KERNEL, nr_vecs); | 338 | bio = bio_alloc(GFP_KERNEL, nr_vecs); |
335 | 339 | ||
336 | bio->bi_bdev = bdev; | 340 | bio->bi_bdev = bdev; |
@@ -342,7 +346,6 @@ dio_bio_alloc(struct dio *dio, struct block_device *bdev, | |||
342 | 346 | ||
343 | dio->bio = bio; | 347 | dio->bio = bio; |
344 | dio->logical_offset_in_bio = dio->cur_page_fs_offset; | 348 | dio->logical_offset_in_bio = dio->cur_page_fs_offset; |
345 | return 0; | ||
346 | } | 349 | } |
347 | 350 | ||
348 | /* | 351 | /* |
@@ -583,8 +586,9 @@ static int dio_new_bio(struct dio *dio, sector_t start_sector) | |||
583 | goto out; | 586 | goto out; |
584 | sector = start_sector << (dio->blkbits - 9); | 587 | sector = start_sector << (dio->blkbits - 9); |
585 | nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); | 588 | nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); |
589 | nr_pages = min(nr_pages, BIO_MAX_PAGES); | ||
586 | BUG_ON(nr_pages <= 0); | 590 | BUG_ON(nr_pages <= 0); |
587 | ret = dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); | 591 | dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); |
588 | dio->boundary = 0; | 592 | dio->boundary = 0; |
589 | out: | 593 | out: |
590 | return ret; | 594 | return ret; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 3fbc94203380..9d1a22d62765 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/crypto.h> | 32 | #include <linux/crypto.h> |
33 | #include <linux/fs_stack.h> | 33 | #include <linux/fs_stack.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/xattr.h> | ||
35 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
36 | #include "ecryptfs_kernel.h" | 37 | #include "ecryptfs_kernel.h" |
37 | 38 | ||
@@ -70,15 +71,19 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
70 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 71 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
71 | struct dentry *dentry_save; | 72 | struct dentry *dentry_save; |
72 | struct vfsmount *vfsmount_save; | 73 | struct vfsmount *vfsmount_save; |
74 | unsigned int flags_save; | ||
73 | int rc; | 75 | int rc; |
74 | 76 | ||
75 | dentry_save = nd->path.dentry; | 77 | dentry_save = nd->path.dentry; |
76 | vfsmount_save = nd->path.mnt; | 78 | vfsmount_save = nd->path.mnt; |
79 | flags_save = nd->flags; | ||
77 | nd->path.dentry = lower_dentry; | 80 | nd->path.dentry = lower_dentry; |
78 | nd->path.mnt = lower_mnt; | 81 | nd->path.mnt = lower_mnt; |
82 | nd->flags &= ~LOOKUP_OPEN; | ||
79 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); | 83 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); |
80 | nd->path.dentry = dentry_save; | 84 | nd->path.dentry = dentry_save; |
81 | nd->path.mnt = vfsmount_save; | 85 | nd->path.mnt = vfsmount_save; |
86 | nd->flags = flags_save; | ||
82 | return rc; | 87 | return rc; |
83 | } | 88 | } |
84 | 89 | ||
@@ -1108,10 +1113,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
1108 | rc = -EOPNOTSUPP; | 1113 | rc = -EOPNOTSUPP; |
1109 | goto out; | 1114 | goto out; |
1110 | } | 1115 | } |
1111 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1116 | |
1112 | rc = lower_dentry->d_inode->i_op->setxattr(lower_dentry, name, value, | 1117 | rc = vfs_setxattr(lower_dentry, name, value, size, flags); |
1113 | size, flags); | ||
1114 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | ||
1115 | out: | 1118 | out: |
1116 | return rc; | 1119 | return rc; |
1117 | } | 1120 | } |
@@ -159,7 +159,26 @@ out: | |||
159 | 159 | ||
160 | #ifdef CONFIG_MMU | 160 | #ifdef CONFIG_MMU |
161 | 161 | ||
162 | static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | 162 | void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
163 | { | ||
164 | struct mm_struct *mm = current->mm; | ||
165 | long diff = (long)(pages - bprm->vma_pages); | ||
166 | |||
167 | if (!mm || !diff) | ||
168 | return; | ||
169 | |||
170 | bprm->vma_pages = pages; | ||
171 | |||
172 | #ifdef SPLIT_RSS_COUNTING | ||
173 | add_mm_counter(mm, MM_ANONPAGES, diff); | ||
174 | #else | ||
175 | spin_lock(&mm->page_table_lock); | ||
176 | add_mm_counter(mm, MM_ANONPAGES, diff); | ||
177 | spin_unlock(&mm->page_table_lock); | ||
178 | #endif | ||
179 | } | ||
180 | |||
181 | struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | ||
163 | int write) | 182 | int write) |
164 | { | 183 | { |
165 | struct page *page; | 184 | struct page *page; |
@@ -181,6 +200,8 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | |||
181 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; | 200 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; |
182 | struct rlimit *rlim; | 201 | struct rlimit *rlim; |
183 | 202 | ||
203 | acct_arg_size(bprm, size / PAGE_SIZE); | ||
204 | |||
184 | /* | 205 | /* |
185 | * We've historically supported up to 32 pages (ARG_MAX) | 206 | * We've historically supported up to 32 pages (ARG_MAX) |
186 | * of argument strings even with small stacks | 207 | * of argument strings even with small stacks |
@@ -249,6 +270,11 @@ static int __bprm_mm_init(struct linux_binprm *bprm) | |||
249 | vma->vm_flags = VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; | 270 | vma->vm_flags = VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; |
250 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | 271 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
251 | INIT_LIST_HEAD(&vma->anon_vma_chain); | 272 | INIT_LIST_HEAD(&vma->anon_vma_chain); |
273 | |||
274 | err = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1); | ||
275 | if (err) | ||
276 | goto err; | ||
277 | |||
252 | err = insert_vm_struct(mm, vma); | 278 | err = insert_vm_struct(mm, vma); |
253 | if (err) | 279 | if (err) |
254 | goto err; | 280 | goto err; |
@@ -271,7 +297,11 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len) | |||
271 | 297 | ||
272 | #else | 298 | #else |
273 | 299 | ||
274 | static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | 300 | void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
301 | { | ||
302 | } | ||
303 | |||
304 | struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | ||
275 | int write) | 305 | int write) |
276 | { | 306 | { |
277 | struct page *page; | 307 | struct page *page; |
@@ -994,6 +1024,7 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
994 | /* | 1024 | /* |
995 | * Release all of the old mmap stuff | 1025 | * Release all of the old mmap stuff |
996 | */ | 1026 | */ |
1027 | acct_arg_size(bprm, 0); | ||
997 | retval = exec_mmap(bprm->mm); | 1028 | retval = exec_mmap(bprm->mm); |
998 | if (retval) | 1029 | if (retval) |
999 | goto out; | 1030 | goto out; |
@@ -1419,8 +1450,10 @@ int do_execve(const char * filename, | |||
1419 | return retval; | 1450 | return retval; |
1420 | 1451 | ||
1421 | out: | 1452 | out: |
1422 | if (bprm->mm) | 1453 | if (bprm->mm) { |
1423 | mmput (bprm->mm); | 1454 | acct_arg_size(bprm, 0); |
1455 | mmput(bprm->mm); | ||
1456 | } | ||
1424 | 1457 | ||
1425 | out_file: | 1458 | out_file: |
1426 | if (bprm->file) { | 1459 | if (bprm->file) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4b8debeb3965..8705e36f32d6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4530,6 +4530,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4530 | (__le32 *) bh->b_data, | 4530 | (__le32 *) bh->b_data, |
4531 | (__le32 *) bh->b_data + addr_per_block, | 4531 | (__le32 *) bh->b_data + addr_per_block, |
4532 | depth); | 4532 | depth); |
4533 | brelse(bh); | ||
4533 | 4534 | ||
4534 | /* | 4535 | /* |
4535 | * Everything below this this pointer has been | 4536 | * Everything below this this pointer has been |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 26147746c272..751997d2cefe 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -719,6 +719,7 @@ static void ext4_put_super(struct super_block *sb) | |||
719 | ext4_abort(sb, "Couldn't clean up the journal"); | 719 | ext4_abort(sb, "Couldn't clean up the journal"); |
720 | } | 720 | } |
721 | 721 | ||
722 | del_timer(&sbi->s_err_report); | ||
722 | ext4_release_system_zone(sb); | 723 | ext4_release_system_zone(sb); |
723 | ext4_mb_release(sb); | 724 | ext4_mb_release(sb); |
724 | ext4_ext_release(sb); | 725 | ext4_ext_release(sb); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c8224587123f..6c2717d421e8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/compat.h> | ||
16 | 17 | ||
17 | static const struct file_operations fuse_direct_io_file_operations; | 18 | static const struct file_operations fuse_direct_io_file_operations; |
18 | 19 | ||
@@ -134,6 +135,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open); | |||
134 | void fuse_finish_open(struct inode *inode, struct file *file) | 135 | void fuse_finish_open(struct inode *inode, struct file *file) |
135 | { | 136 | { |
136 | struct fuse_file *ff = file->private_data; | 137 | struct fuse_file *ff = file->private_data; |
138 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
137 | 139 | ||
138 | if (ff->open_flags & FOPEN_DIRECT_IO) | 140 | if (ff->open_flags & FOPEN_DIRECT_IO) |
139 | file->f_op = &fuse_direct_io_file_operations; | 141 | file->f_op = &fuse_direct_io_file_operations; |
@@ -141,6 +143,15 @@ void fuse_finish_open(struct inode *inode, struct file *file) | |||
141 | invalidate_inode_pages2(inode->i_mapping); | 143 | invalidate_inode_pages2(inode->i_mapping); |
142 | if (ff->open_flags & FOPEN_NONSEEKABLE) | 144 | if (ff->open_flags & FOPEN_NONSEEKABLE) |
143 | nonseekable_open(inode, file); | 145 | nonseekable_open(inode, file); |
146 | if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { | ||
147 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
148 | |||
149 | spin_lock(&fc->lock); | ||
150 | fi->attr_version = ++fc->attr_version; | ||
151 | i_size_write(inode, 0); | ||
152 | spin_unlock(&fc->lock); | ||
153 | fuse_invalidate_attr(inode); | ||
154 | } | ||
144 | } | 155 | } |
145 | 156 | ||
146 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | 157 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
@@ -1617,6 +1628,58 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov, | |||
1617 | return 0; | 1628 | return 0; |
1618 | } | 1629 | } |
1619 | 1630 | ||
1631 | /* Make sure iov_length() won't overflow */ | ||
1632 | static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count) | ||
1633 | { | ||
1634 | size_t n; | ||
1635 | u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT; | ||
1636 | |||
1637 | for (n = 0; n < count; n++) { | ||
1638 | if (iov->iov_len > (size_t) max) | ||
1639 | return -ENOMEM; | ||
1640 | max -= iov->iov_len; | ||
1641 | } | ||
1642 | return 0; | ||
1643 | } | ||
1644 | |||
1645 | /* | ||
1646 | * CUSE servers compiled on 32bit broke on 64bit kernels because the | ||
1647 | * ABI was defined to be 'struct iovec' which is different on 32bit | ||
1648 | * and 64bit. Fortunately we can determine which structure the server | ||
1649 | * used from the size of the reply. | ||
1650 | */ | ||
1651 | static int fuse_copy_ioctl_iovec(struct iovec *dst, void *src, | ||
1652 | size_t transferred, unsigned count, | ||
1653 | bool is_compat) | ||
1654 | { | ||
1655 | #ifdef CONFIG_COMPAT | ||
1656 | if (count * sizeof(struct compat_iovec) == transferred) { | ||
1657 | struct compat_iovec *ciov = src; | ||
1658 | unsigned i; | ||
1659 | |||
1660 | /* | ||
1661 | * With this interface a 32bit server cannot support | ||
1662 | * non-compat (i.e. ones coming from 64bit apps) ioctl | ||
1663 | * requests | ||
1664 | */ | ||
1665 | if (!is_compat) | ||
1666 | return -EINVAL; | ||
1667 | |||
1668 | for (i = 0; i < count; i++) { | ||
1669 | dst[i].iov_base = compat_ptr(ciov[i].iov_base); | ||
1670 | dst[i].iov_len = ciov[i].iov_len; | ||
1671 | } | ||
1672 | return 0; | ||
1673 | } | ||
1674 | #endif | ||
1675 | |||
1676 | if (count * sizeof(struct iovec) != transferred) | ||
1677 | return -EIO; | ||
1678 | |||
1679 | memcpy(dst, src, transferred); | ||
1680 | return 0; | ||
1681 | } | ||
1682 | |||
1620 | /* | 1683 | /* |
1621 | * For ioctls, there is no generic way to determine how much memory | 1684 | * For ioctls, there is no generic way to determine how much memory |
1622 | * needs to be read and/or written. Furthermore, ioctls are allowed | 1685 | * needs to be read and/or written. Furthermore, ioctls are allowed |
@@ -1798,18 +1861,25 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, | |||
1798 | in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) | 1861 | in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) |
1799 | goto out; | 1862 | goto out; |
1800 | 1863 | ||
1801 | err = -EIO; | ||
1802 | if ((in_iovs + out_iovs) * sizeof(struct iovec) != transferred) | ||
1803 | goto out; | ||
1804 | |||
1805 | /* okay, copy in iovs and retry */ | ||
1806 | vaddr = kmap_atomic(pages[0], KM_USER0); | 1864 | vaddr = kmap_atomic(pages[0], KM_USER0); |
1807 | memcpy(page_address(iov_page), vaddr, transferred); | 1865 | err = fuse_copy_ioctl_iovec(page_address(iov_page), vaddr, |
1866 | transferred, in_iovs + out_iovs, | ||
1867 | (flags & FUSE_IOCTL_COMPAT) != 0); | ||
1808 | kunmap_atomic(vaddr, KM_USER0); | 1868 | kunmap_atomic(vaddr, KM_USER0); |
1869 | if (err) | ||
1870 | goto out; | ||
1809 | 1871 | ||
1810 | in_iov = page_address(iov_page); | 1872 | in_iov = page_address(iov_page); |
1811 | out_iov = in_iov + in_iovs; | 1873 | out_iov = in_iov + in_iovs; |
1812 | 1874 | ||
1875 | err = fuse_verify_ioctl_iov(in_iov, in_iovs); | ||
1876 | if (err) | ||
1877 | goto out; | ||
1878 | |||
1879 | err = fuse_verify_ioctl_iov(out_iov, out_iovs); | ||
1880 | if (err) | ||
1881 | goto out; | ||
1882 | |||
1813 | goto retry; | 1883 | goto retry; |
1814 | } | 1884 | } |
1815 | 1885 | ||
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index 6bbd75c5589b..3ccb4e45b8dc 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h | |||
@@ -96,7 +96,6 @@ extern int rename_file(char *from, char *to); | |||
96 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, | 96 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
97 | long long *bfree_out, long long *bavail_out, | 97 | long long *bfree_out, long long *bavail_out, |
98 | long long *files_out, long long *ffree_out, | 98 | long long *files_out, long long *ffree_out, |
99 | void *fsid_out, int fsid_size, long *namelen_out, | 99 | void *fsid_out, int fsid_size, long *namelen_out); |
100 | long *spare_out); | ||
101 | 100 | ||
102 | #endif | 101 | #endif |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index f7dc9b5f9ef8..cd7c93917cc7 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -217,7 +217,7 @@ int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf) | |||
217 | err = do_statfs(dentry->d_sb->s_fs_info, | 217 | err = do_statfs(dentry->d_sb->s_fs_info, |
218 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, | 218 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, |
219 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), | 219 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), |
220 | &sf->f_namelen, sf->f_spare); | 220 | &sf->f_namelen); |
221 | if (err) | 221 | if (err) |
222 | return err; | 222 | return err; |
223 | sf->f_blocks = f_blocks; | 223 | sf->f_blocks = f_blocks; |
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c index 6777aa06ce2c..8d02683585e0 100644 --- a/fs/hostfs/hostfs_user.c +++ b/fs/hostfs/hostfs_user.c | |||
@@ -364,8 +364,7 @@ int rename_file(char *from, char *to) | |||
364 | int do_statfs(char *root, long *bsize_out, long long *blocks_out, | 364 | int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
365 | long long *bfree_out, long long *bavail_out, | 365 | long long *bfree_out, long long *bavail_out, |
366 | long long *files_out, long long *ffree_out, | 366 | long long *files_out, long long *ffree_out, |
367 | void *fsid_out, int fsid_size, long *namelen_out, | 367 | void *fsid_out, int fsid_size, long *namelen_out) |
368 | long *spare_out) | ||
369 | { | 368 | { |
370 | struct statfs64 buf; | 369 | struct statfs64 buf; |
371 | int err; | 370 | int err; |
@@ -384,10 +383,6 @@ int do_statfs(char *root, long *bsize_out, long long *blocks_out, | |||
384 | sizeof(buf.f_fsid) > fsid_size ? fsid_size : | 383 | sizeof(buf.f_fsid) > fsid_size ? fsid_size : |
385 | sizeof(buf.f_fsid)); | 384 | sizeof(buf.f_fsid)); |
386 | *namelen_out = buf.f_namelen; | 385 | *namelen_out = buf.f_namelen; |
387 | spare_out[0] = buf.f_spare[0]; | 386 | |
388 | spare_out[1] = buf.f_spare[1]; | ||
389 | spare_out[2] = buf.f_spare[2]; | ||
390 | spare_out[3] = buf.f_spare[3]; | ||
391 | spare_out[4] = buf.f_spare[4]; | ||
392 | return 0; | 387 | return 0; |
393 | } | 388 | } |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index b9c3c43cea1d..98e8e35c4408 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) | 25 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) |
26 | { | 26 | { |
27 | if (delegation->cred) | ||
28 | put_rpccred(delegation->cred); | ||
29 | kfree(delegation); | 27 | kfree(delegation); |
30 | } | 28 | } |
31 | 29 | ||
@@ -38,6 +36,10 @@ static void nfs_free_delegation_callback(struct rcu_head *head) | |||
38 | 36 | ||
39 | static void nfs_free_delegation(struct nfs_delegation *delegation) | 37 | static void nfs_free_delegation(struct nfs_delegation *delegation) |
40 | { | 38 | { |
39 | if (delegation->cred) { | ||
40 | put_rpccred(delegation->cred); | ||
41 | delegation->cred = NULL; | ||
42 | } | ||
41 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | 43 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); |
42 | } | 44 | } |
43 | 45 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 064a80961677..e0e9d49773bd 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -407,15 +407,18 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
407 | pos += vec->iov_len; | 407 | pos += vec->iov_len; |
408 | } | 408 | } |
409 | 409 | ||
410 | /* | ||
411 | * If no bytes were started, return the error, and let the | ||
412 | * generic layer handle the completion. | ||
413 | */ | ||
414 | if (requested_bytes == 0) { | ||
415 | nfs_direct_req_release(dreq); | ||
416 | return result < 0 ? result : -EIO; | ||
417 | } | ||
418 | |||
410 | if (put_dreq(dreq)) | 419 | if (put_dreq(dreq)) |
411 | nfs_direct_complete(dreq); | 420 | nfs_direct_complete(dreq); |
412 | 421 | return 0; | |
413 | if (requested_bytes != 0) | ||
414 | return 0; | ||
415 | |||
416 | if (result < 0) | ||
417 | return result; | ||
418 | return -EIO; | ||
419 | } | 422 | } |
420 | 423 | ||
421 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, | 424 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, |
@@ -841,15 +844,18 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
841 | pos += vec->iov_len; | 844 | pos += vec->iov_len; |
842 | } | 845 | } |
843 | 846 | ||
847 | /* | ||
848 | * If no bytes were started, return the error, and let the | ||
849 | * generic layer handle the completion. | ||
850 | */ | ||
851 | if (requested_bytes == 0) { | ||
852 | nfs_direct_req_release(dreq); | ||
853 | return result < 0 ? result : -EIO; | ||
854 | } | ||
855 | |||
844 | if (put_dreq(dreq)) | 856 | if (put_dreq(dreq)) |
845 | nfs_direct_write_complete(dreq, dreq->inode); | 857 | nfs_direct_write_complete(dreq, dreq->inode); |
846 | 858 | return 0; | |
847 | if (requested_bytes != 0) | ||
848 | return 0; | ||
849 | |||
850 | if (result < 0) | ||
851 | return result; | ||
852 | return -EIO; | ||
853 | } | 859 | } |
854 | 860 | ||
855 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | 861 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, |
@@ -873,7 +879,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
873 | dreq->inode = inode; | 879 | dreq->inode = inode; |
874 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 880 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
875 | dreq->l_ctx = nfs_get_lock_context(dreq->ctx); | 881 | dreq->l_ctx = nfs_get_lock_context(dreq->ctx); |
876 | if (dreq->l_ctx != NULL) | 882 | if (dreq->l_ctx == NULL) |
877 | goto out_release; | 883 | goto out_release; |
878 | if (!is_sync_kiocb(iocb)) | 884 | if (!is_sync_kiocb(iocb)) |
879 | dreq->iocb = iocb; | 885 | dreq->iocb = iocb; |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 05bf3c0dc751..22a185b328ef 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -551,7 +551,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
551 | struct file *filp = vma->vm_file; | 551 | struct file *filp = vma->vm_file; |
552 | struct dentry *dentry = filp->f_path.dentry; | 552 | struct dentry *dentry = filp->f_path.dentry; |
553 | unsigned pagelen; | 553 | unsigned pagelen; |
554 | int ret = -EINVAL; | 554 | int ret = VM_FAULT_NOPAGE; |
555 | struct address_space *mapping; | 555 | struct address_space *mapping; |
556 | 556 | ||
557 | dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", | 557 | dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", |
@@ -567,21 +567,20 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
567 | if (mapping != dentry->d_inode->i_mapping) | 567 | if (mapping != dentry->d_inode->i_mapping) |
568 | goto out_unlock; | 568 | goto out_unlock; |
569 | 569 | ||
570 | ret = 0; | ||
571 | pagelen = nfs_page_length(page); | 570 | pagelen = nfs_page_length(page); |
572 | if (pagelen == 0) | 571 | if (pagelen == 0) |
573 | goto out_unlock; | 572 | goto out_unlock; |
574 | 573 | ||
575 | ret = nfs_flush_incompatible(filp, page); | 574 | ret = VM_FAULT_LOCKED; |
576 | if (ret != 0) | 575 | if (nfs_flush_incompatible(filp, page) == 0 && |
577 | goto out_unlock; | 576 | nfs_updatepage(filp, page, 0, pagelen) == 0) |
577 | goto out; | ||
578 | 578 | ||
579 | ret = nfs_updatepage(filp, page, 0, pagelen); | 579 | ret = VM_FAULT_SIGBUS; |
580 | out_unlock: | 580 | out_unlock: |
581 | if (!ret) | ||
582 | return VM_FAULT_LOCKED; | ||
583 | unlock_page(page); | 581 | unlock_page(page); |
584 | return VM_FAULT_SIGBUS; | 582 | out: |
583 | return ret; | ||
585 | } | 584 | } |
586 | 585 | ||
587 | static const struct vm_operations_struct nfs_file_vm_ops = { | 586 | static const struct vm_operations_struct nfs_file_vm_ops = { |
@@ -688,6 +687,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl) | |||
688 | { | 687 | { |
689 | struct inode *inode = filp->f_mapping->host; | 688 | struct inode *inode = filp->f_mapping->host; |
690 | int status = 0; | 689 | int status = 0; |
690 | unsigned int saved_type = fl->fl_type; | ||
691 | 691 | ||
692 | /* Try local locking first */ | 692 | /* Try local locking first */ |
693 | posix_test_lock(filp, fl); | 693 | posix_test_lock(filp, fl); |
@@ -695,6 +695,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl) | |||
695 | /* found a conflict */ | 695 | /* found a conflict */ |
696 | goto out; | 696 | goto out; |
697 | } | 697 | } |
698 | fl->fl_type = saved_type; | ||
698 | 699 | ||
699 | if (nfs_have_delegation(inode, FMODE_READ)) | 700 | if (nfs_have_delegation(inode, FMODE_READ)) |
700 | goto out_noconflict; | 701 | goto out_noconflict; |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 59047f8d7d72..3dde50c093b5 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -503,13 +503,13 @@ static struct rpc_procinfo mnt3_procedures[] = { | |||
503 | 503 | ||
504 | static struct rpc_version mnt_version1 = { | 504 | static struct rpc_version mnt_version1 = { |
505 | .number = 1, | 505 | .number = 1, |
506 | .nrprocs = 2, | 506 | .nrprocs = ARRAY_SIZE(mnt_procedures), |
507 | .procs = mnt_procedures, | 507 | .procs = mnt_procedures, |
508 | }; | 508 | }; |
509 | 509 | ||
510 | static struct rpc_version mnt_version3 = { | 510 | static struct rpc_version mnt_version3 = { |
511 | .number = 3, | 511 | .number = 3, |
512 | .nrprocs = 2, | 512 | .nrprocs = ARRAY_SIZE(mnt3_procedures), |
513 | .procs = mnt3_procedures, | 513 | .procs = mnt3_procedures, |
514 | }; | 514 | }; |
515 | 515 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 089da5b5d20a..74aa54e1712e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -255,9 +255,6 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
255 | nfs4_state_mark_reclaim_nograce(clp, state); | 255 | nfs4_state_mark_reclaim_nograce(clp, state); |
256 | goto do_state_recovery; | 256 | goto do_state_recovery; |
257 | case -NFS4ERR_STALE_STATEID: | 257 | case -NFS4ERR_STALE_STATEID: |
258 | if (state == NULL) | ||
259 | break; | ||
260 | nfs4_state_mark_reclaim_reboot(clp, state); | ||
261 | case -NFS4ERR_STALE_CLIENTID: | 258 | case -NFS4ERR_STALE_CLIENTID: |
262 | case -NFS4ERR_EXPIRED: | 259 | case -NFS4ERR_EXPIRED: |
263 | goto do_state_recovery; | 260 | goto do_state_recovery; |
@@ -1120,6 +1117,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1120 | clear_bit(NFS_DELEGATED_STATE, &state->flags); | 1117 | clear_bit(NFS_DELEGATED_STATE, &state->flags); |
1121 | smp_rmb(); | 1118 | smp_rmb(); |
1122 | if (state->n_rdwr != 0) { | 1119 | if (state->n_rdwr != 0) { |
1120 | clear_bit(NFS_O_RDWR_STATE, &state->flags); | ||
1123 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); | 1121 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); |
1124 | if (ret != 0) | 1122 | if (ret != 0) |
1125 | return ret; | 1123 | return ret; |
@@ -1127,6 +1125,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1127 | return -ESTALE; | 1125 | return -ESTALE; |
1128 | } | 1126 | } |
1129 | if (state->n_wronly != 0) { | 1127 | if (state->n_wronly != 0) { |
1128 | clear_bit(NFS_O_WRONLY_STATE, &state->flags); | ||
1130 | ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); | 1129 | ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); |
1131 | if (ret != 0) | 1130 | if (ret != 0) |
1132 | return ret; | 1131 | return ret; |
@@ -1134,6 +1133,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1134 | return -ESTALE; | 1133 | return -ESTALE; |
1135 | } | 1134 | } |
1136 | if (state->n_rdonly != 0) { | 1135 | if (state->n_rdonly != 0) { |
1136 | clear_bit(NFS_O_RDONLY_STATE, &state->flags); | ||
1137 | ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); | 1137 | ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); |
1138 | if (ret != 0) | 1138 | if (ret != 0) |
1139 | return ret; | 1139 | return ret; |
@@ -3490,9 +3490,6 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3490 | nfs4_state_mark_reclaim_nograce(clp, state); | 3490 | nfs4_state_mark_reclaim_nograce(clp, state); |
3491 | goto do_state_recovery; | 3491 | goto do_state_recovery; |
3492 | case -NFS4ERR_STALE_STATEID: | 3492 | case -NFS4ERR_STALE_STATEID: |
3493 | if (state == NULL) | ||
3494 | break; | ||
3495 | nfs4_state_mark_reclaim_reboot(clp, state); | ||
3496 | case -NFS4ERR_STALE_CLIENTID: | 3493 | case -NFS4ERR_STALE_CLIENTID: |
3497 | case -NFS4ERR_EXPIRED: | 3494 | case -NFS4ERR_EXPIRED: |
3498 | goto do_state_recovery; | 3495 | goto do_state_recovery; |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 3e2f19b04c06..940cf7c070af 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1138,16 +1138,14 @@ static void nfs4_reclaim_complete(struct nfs_client *clp, | |||
1138 | (void)ops->reclaim_complete(clp); | 1138 | (void)ops->reclaim_complete(clp); |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | 1141 | static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) |
1142 | { | 1142 | { |
1143 | struct nfs4_state_owner *sp; | 1143 | struct nfs4_state_owner *sp; |
1144 | struct rb_node *pos; | 1144 | struct rb_node *pos; |
1145 | struct nfs4_state *state; | 1145 | struct nfs4_state *state; |
1146 | 1146 | ||
1147 | if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) | 1147 | if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) |
1148 | return; | 1148 | return 0; |
1149 | |||
1150 | nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); | ||
1151 | 1149 | ||
1152 | for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { | 1150 | for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { |
1153 | sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); | 1151 | sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); |
@@ -1161,6 +1159,14 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | |||
1161 | } | 1159 | } |
1162 | 1160 | ||
1163 | nfs_delegation_reap_unclaimed(clp); | 1161 | nfs_delegation_reap_unclaimed(clp); |
1162 | return 1; | ||
1163 | } | ||
1164 | |||
1165 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | ||
1166 | { | ||
1167 | if (!nfs4_state_clear_reclaim_reboot(clp)) | ||
1168 | return; | ||
1169 | nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); | ||
1164 | } | 1170 | } |
1165 | 1171 | ||
1166 | static void nfs_delegation_clear_all(struct nfs_client *clp) | 1172 | static void nfs_delegation_clear_all(struct nfs_client *clp) |
@@ -1187,7 +1193,7 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | |||
1187 | case -NFS4ERR_STALE_CLIENTID: | 1193 | case -NFS4ERR_STALE_CLIENTID: |
1188 | case -NFS4ERR_LEASE_MOVED: | 1194 | case -NFS4ERR_LEASE_MOVED: |
1189 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 1195 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
1190 | nfs4_state_end_reclaim_reboot(clp); | 1196 | nfs4_state_clear_reclaim_reboot(clp); |
1191 | nfs4_state_start_reclaim_reboot(clp); | 1197 | nfs4_state_start_reclaim_reboot(clp); |
1192 | break; | 1198 | break; |
1193 | case -NFS4ERR_EXPIRED: | 1199 | case -NFS4ERR_EXPIRED: |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 919490232e17..137b549e63db 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -65,6 +65,13 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, | |||
65 | if (req == NULL) | 65 | if (req == NULL) |
66 | return ERR_PTR(-ENOMEM); | 66 | return ERR_PTR(-ENOMEM); |
67 | 67 | ||
68 | /* get lock context early so we can deal with alloc failures */ | ||
69 | req->wb_lock_context = nfs_get_lock_context(ctx); | ||
70 | if (req->wb_lock_context == NULL) { | ||
71 | nfs_page_free(req); | ||
72 | return ERR_PTR(-ENOMEM); | ||
73 | } | ||
74 | |||
68 | /* Initialize the request struct. Initially, we assume a | 75 | /* Initialize the request struct. Initially, we assume a |
69 | * long write-back delay. This will be adjusted in | 76 | * long write-back delay. This will be adjusted in |
70 | * update_nfs_request below if the region is not locked. */ | 77 | * update_nfs_request below if the region is not locked. */ |
@@ -79,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, | |||
79 | req->wb_pgbase = offset; | 86 | req->wb_pgbase = offset; |
80 | req->wb_bytes = count; | 87 | req->wb_bytes = count; |
81 | req->wb_context = get_nfs_open_context(ctx); | 88 | req->wb_context = get_nfs_open_context(ctx); |
82 | req->wb_lock_context = nfs_get_lock_context(ctx); | ||
83 | kref_init(&req->wb_kref); | 89 | kref_init(&req->wb_kref); |
84 | return req; | 90 | return req; |
85 | } | 91 | } |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 2a533a0af2a9..7e84a852cdae 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -260,9 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp) | |||
260 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, | 260 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, |
261 | &fhp->fh_post_attr); | 261 | &fhp->fh_post_attr); |
262 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; | 262 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; |
263 | if (err) | 263 | if (err) { |
264 | fhp->fh_post_saved = 0; | 264 | fhp->fh_post_saved = 0; |
265 | else | 265 | /* Grab the ctime anyway - set_change_info might use it */ |
266 | fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; | ||
267 | } else | ||
266 | fhp->fh_post_saved = 1; | 268 | fhp->fh_post_saved = 1; |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 4d476ff08ae6..60fce3dc5cb5 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -484,18 +484,17 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | |||
484 | static inline void | 484 | static inline void |
485 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) | 485 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) |
486 | { | 486 | { |
487 | BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); | 487 | BUG_ON(!fhp->fh_pre_saved); |
488 | cinfo->atomic = 1; | 488 | cinfo->atomic = fhp->fh_post_saved; |
489 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); | 489 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); |
490 | if (cinfo->change_supported) { | 490 | |
491 | cinfo->before_change = fhp->fh_pre_change; | 491 | cinfo->before_change = fhp->fh_pre_change; |
492 | cinfo->after_change = fhp->fh_post_change; | 492 | cinfo->after_change = fhp->fh_post_change; |
493 | } else { | 493 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; |
494 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; | 494 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; |
495 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; | 495 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; |
496 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; | 496 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; |
497 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; | 497 | |
498 | } | ||
499 | } | 498 | } |
500 | 499 | ||
501 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | 500 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 922263393c76..57878bd94411 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -733,7 +733,8 @@ static int nilfs_setup_super(struct nilfs_sb_info *sbi) | |||
733 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); | 733 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); |
734 | sbp[0]->s_mtime = cpu_to_le64(get_seconds()); | 734 | sbp[0]->s_mtime = cpu_to_le64(get_seconds()); |
735 | /* synchronize sbp[1] with sbp[0] */ | 735 | /* synchronize sbp[1] with sbp[0] */ |
736 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | 736 | if (sbp[1]) |
737 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | ||
737 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); | 738 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); |
738 | } | 739 | } |
739 | 740 | ||
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index bf7f6d776c31..5b7c6fe7fb61 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -751,6 +751,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
751 | if (ret >= 0) | 751 | if (ret >= 0) |
752 | return ret; | 752 | return ret; |
753 | 753 | ||
754 | fsnotify_put_group(group); | ||
754 | atomic_dec(&user->inotify_devs); | 755 | atomic_dec(&user->inotify_devs); |
755 | out_free_uid: | 756 | out_free_uid: |
756 | free_uid(user); | 757 | free_uid(user); |
@@ -382,7 +382,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
382 | error = ops->confirm(pipe, buf); | 382 | error = ops->confirm(pipe, buf); |
383 | if (error) { | 383 | if (error) { |
384 | if (!ret) | 384 | if (!ret) |
385 | error = ret; | 385 | ret = error; |
386 | break; | 386 | break; |
387 | } | 387 | } |
388 | 388 | ||
@@ -1197,12 +1197,24 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, | |||
1197 | return ret; | 1197 | return ret; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | /* | ||
1201 | * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same | ||
1202 | * location, so checking ->i_pipe is not enough to verify that this is a | ||
1203 | * pipe. | ||
1204 | */ | ||
1205 | struct pipe_inode_info *get_pipe_info(struct file *file) | ||
1206 | { | ||
1207 | struct inode *i = file->f_path.dentry->d_inode; | ||
1208 | |||
1209 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; | ||
1210 | } | ||
1211 | |||
1200 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | 1212 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
1201 | { | 1213 | { |
1202 | struct pipe_inode_info *pipe; | 1214 | struct pipe_inode_info *pipe; |
1203 | long ret; | 1215 | long ret; |
1204 | 1216 | ||
1205 | pipe = file->f_path.dentry->d_inode->i_pipe; | 1217 | pipe = get_pipe_info(file); |
1206 | if (!pipe) | 1218 | if (!pipe) |
1207 | return -EBADF; | 1219 | return -EBADF; |
1208 | 1220 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 8e4addaa5424..632b9071ad2e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1526,7 +1526,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen) | |||
1526 | if (!tmp) | 1526 | if (!tmp) |
1527 | return -ENOMEM; | 1527 | return -ENOMEM; |
1528 | 1528 | ||
1529 | pathname = d_path_with_unreachable(path, tmp, PAGE_SIZE); | 1529 | pathname = d_path(path, tmp, PAGE_SIZE); |
1530 | len = PTR_ERR(pathname); | 1530 | len = PTR_ERR(pathname); |
1531 | if (IS_ERR(pathname)) | 1531 | if (IS_ERR(pathname)) |
1532 | goto out; | 1532 | goto out; |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 6f37c391468d..d245cb23dd72 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -558,7 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
558 | static const struct file_operations proc_kcore_operations = { | 558 | static const struct file_operations proc_kcore_operations = { |
559 | .read = read_kcore, | 559 | .read = read_kcore, |
560 | .open = open_kcore, | 560 | .open = open_kcore, |
561 | .llseek = generic_file_llseek, | 561 | .llseek = default_llseek, |
562 | }; | 562 | }; |
563 | 563 | ||
564 | #ifdef CONFIG_MEMORY_HOTPLUG | 564 | #ifdef CONFIG_MEMORY_HOTPLUG |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 5cbb81e134ac..4131f4a49391 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -186,12 +186,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* we need to make sure nobody is changing the file size beneath | ||
190 | ** us | ||
191 | */ | ||
192 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
193 | depth = reiserfs_write_lock_once(inode->i_sb); | 189 | depth = reiserfs_write_lock_once(inode->i_sb); |
194 | 190 | ||
191 | /* we need to make sure nobody is changing the file size beneath us */ | ||
192 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
193 | |||
195 | write_from = inode->i_size & (blocksize - 1); | 194 | write_from = inode->i_size & (blocksize - 1); |
196 | /* if we are on a block boundary, we are already unpacked. */ | 195 | /* if we are on a block boundary, we are already unpacked. */ |
197 | if (write_from == 0) { | 196 | if (write_from == 0) { |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 536d697a8a28..90d2fcb67a31 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -472,7 +472,9 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
472 | struct reiserfs_transaction_handle th; | 472 | struct reiserfs_transaction_handle th; |
473 | size_t size = reiserfs_xattr_nblocks(inode, | 473 | size_t size = reiserfs_xattr_nblocks(inode, |
474 | reiserfs_acl_size(clone->a_count)); | 474 | reiserfs_acl_size(clone->a_count)); |
475 | reiserfs_write_lock(inode->i_sb); | 475 | int depth; |
476 | |||
477 | depth = reiserfs_write_lock_once(inode->i_sb); | ||
476 | error = journal_begin(&th, inode->i_sb, size * 2); | 478 | error = journal_begin(&th, inode->i_sb, size * 2); |
477 | if (!error) { | 479 | if (!error) { |
478 | int error2; | 480 | int error2; |
@@ -482,7 +484,7 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
482 | if (error2) | 484 | if (error2) |
483 | error = error2; | 485 | error = error2; |
484 | } | 486 | } |
485 | reiserfs_write_unlock(inode->i_sb); | 487 | reiserfs_write_unlock_once(inode->i_sb, depth); |
486 | } | 488 | } |
487 | posix_acl_release(clone); | 489 | posix_acl_release(clone); |
488 | return error; | 490 | return error; |
diff --git a/fs/splice.c b/fs/splice.c index 8f1dfaecc8f0..ce2f02579e35 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1311,18 +1311,6 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1311 | static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, | 1311 | static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, |
1312 | struct pipe_inode_info *opipe, | 1312 | struct pipe_inode_info *opipe, |
1313 | size_t len, unsigned int flags); | 1313 | size_t len, unsigned int flags); |
1314 | /* | ||
1315 | * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same | ||
1316 | * location, so checking ->i_pipe is not enough to verify that this is a | ||
1317 | * pipe. | ||
1318 | */ | ||
1319 | static inline struct pipe_inode_info *pipe_info(struct inode *inode) | ||
1320 | { | ||
1321 | if (S_ISFIFO(inode->i_mode)) | ||
1322 | return inode->i_pipe; | ||
1323 | |||
1324 | return NULL; | ||
1325 | } | ||
1326 | 1314 | ||
1327 | /* | 1315 | /* |
1328 | * Determine where to splice to/from. | 1316 | * Determine where to splice to/from. |
@@ -1336,8 +1324,8 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1336 | loff_t offset, *off; | 1324 | loff_t offset, *off; |
1337 | long ret; | 1325 | long ret; |
1338 | 1326 | ||
1339 | ipipe = pipe_info(in->f_path.dentry->d_inode); | 1327 | ipipe = get_pipe_info(in); |
1340 | opipe = pipe_info(out->f_path.dentry->d_inode); | 1328 | opipe = get_pipe_info(out); |
1341 | 1329 | ||
1342 | if (ipipe && opipe) { | 1330 | if (ipipe && opipe) { |
1343 | if (off_in || off_out) | 1331 | if (off_in || off_out) |
@@ -1555,7 +1543,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *iov, | |||
1555 | int error; | 1543 | int error; |
1556 | long ret; | 1544 | long ret; |
1557 | 1545 | ||
1558 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1546 | pipe = get_pipe_info(file); |
1559 | if (!pipe) | 1547 | if (!pipe) |
1560 | return -EBADF; | 1548 | return -EBADF; |
1561 | 1549 | ||
@@ -1642,7 +1630,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1642 | }; | 1630 | }; |
1643 | long ret; | 1631 | long ret; |
1644 | 1632 | ||
1645 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1633 | pipe = get_pipe_info(file); |
1646 | if (!pipe) | 1634 | if (!pipe) |
1647 | return -EBADF; | 1635 | return -EBADF; |
1648 | 1636 | ||
@@ -2022,8 +2010,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
2022 | static long do_tee(struct file *in, struct file *out, size_t len, | 2010 | static long do_tee(struct file *in, struct file *out, size_t len, |
2023 | unsigned int flags) | 2011 | unsigned int flags) |
2024 | { | 2012 | { |
2025 | struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode); | 2013 | struct pipe_inode_info *ipipe = get_pipe_info(in); |
2026 | struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode); | 2014 | struct pipe_inode_info *opipe = get_pipe_info(out); |
2027 | int ret = -EINVAL; | 2015 | int ret = -EINVAL; |
2028 | 2016 | ||
2029 | /* | 2017 | /* |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 883c1d439899..40b1f0e14963 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -28,7 +28,6 @@ | |||
28 | {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ | 28 | {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ |
29 | {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \ | 29 | {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP}, \ |
30 | {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ | 30 | {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ |
31 | {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \ | ||
32 | {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ | 31 | {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
33 | {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ | 32 | {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
34 | {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ | 33 | {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index a065612fc928..64a7114a9394 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -29,6 +29,7 @@ struct linux_binprm{ | |||
29 | char buf[BINPRM_BUF_SIZE]; | 29 | char buf[BINPRM_BUF_SIZE]; |
30 | #ifdef CONFIG_MMU | 30 | #ifdef CONFIG_MMU |
31 | struct vm_area_struct *vma; | 31 | struct vm_area_struct *vma; |
32 | unsigned long vma_pages; | ||
32 | #else | 33 | #else |
33 | # define MAX_ARG_PAGES 32 | 34 | # define MAX_ARG_PAGES 32 |
34 | struct page *page[MAX_ARG_PAGES]; | 35 | struct page *page[MAX_ARG_PAGES]; |
@@ -59,6 +60,10 @@ struct linux_binprm{ | |||
59 | unsigned long loader, exec; | 60 | unsigned long loader, exec; |
60 | }; | 61 | }; |
61 | 62 | ||
63 | extern void acct_arg_size(struct linux_binprm *bprm, unsigned long pages); | ||
64 | extern struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | ||
65 | int write); | ||
66 | |||
62 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 | 67 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 |
63 | #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) | 68 | #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) |
64 | 69 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2c54906f678f..f142a7f300f8 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -246,7 +246,7 @@ struct queue_limits { | |||
246 | 246 | ||
247 | unsigned char misaligned; | 247 | unsigned char misaligned; |
248 | unsigned char discard_misaligned; | 248 | unsigned char discard_misaligned; |
249 | unsigned char no_cluster; | 249 | unsigned char cluster; |
250 | signed char discard_zeroes_data; | 250 | signed char discard_zeroes_data; |
251 | }; | 251 | }; |
252 | 252 | ||
@@ -369,7 +369,6 @@ struct request_queue | |||
369 | #endif | 369 | #endif |
370 | }; | 370 | }; |
371 | 371 | ||
372 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ | ||
373 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ | 372 | #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ |
374 | #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ | 373 | #define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ |
375 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ | 374 | #define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */ |
@@ -392,7 +391,6 @@ struct request_queue | |||
392 | #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ | 391 | #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ |
393 | 392 | ||
394 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 393 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
395 | (1 << QUEUE_FLAG_CLUSTER) | \ | ||
396 | (1 << QUEUE_FLAG_STACKABLE) | \ | 394 | (1 << QUEUE_FLAG_STACKABLE) | \ |
397 | (1 << QUEUE_FLAG_SAME_COMP) | \ | 395 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
398 | (1 << QUEUE_FLAG_ADD_RANDOM)) | 396 | (1 << QUEUE_FLAG_ADD_RANDOM)) |
@@ -550,6 +548,11 @@ enum { | |||
550 | 548 | ||
551 | #define rq_data_dir(rq) ((rq)->cmd_flags & 1) | 549 | #define rq_data_dir(rq) ((rq)->cmd_flags & 1) |
552 | 550 | ||
551 | static inline unsigned int blk_queue_cluster(struct request_queue *q) | ||
552 | { | ||
553 | return q->limits.cluster; | ||
554 | } | ||
555 | |||
553 | /* | 556 | /* |
554 | * We regard a request as sync, if either a read or a sync write | 557 | * We regard a request as sync, if either a read or a sync write |
555 | */ | 558 | */ |
@@ -851,7 +854,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); | |||
851 | extern void blk_queue_max_discard_sectors(struct request_queue *q, | 854 | extern void blk_queue_max_discard_sectors(struct request_queue *q, |
852 | unsigned int max_discard_sectors); | 855 | unsigned int max_discard_sectors); |
853 | extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); | 856 | extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); |
854 | extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); | 857 | extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); |
855 | extern void blk_queue_alignment_offset(struct request_queue *q, | 858 | extern void blk_queue_alignment_offset(struct request_queue *q, |
856 | unsigned int alignment); | 859 | unsigned int alignment); |
857 | extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); | 860 | extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); |
@@ -1004,7 +1007,7 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q) | |||
1004 | return q->limits.physical_block_size; | 1007 | return q->limits.physical_block_size; |
1005 | } | 1008 | } |
1006 | 1009 | ||
1007 | static inline int bdev_physical_block_size(struct block_device *bdev) | 1010 | static inline unsigned int bdev_physical_block_size(struct block_device *bdev) |
1008 | { | 1011 | { |
1009 | return queue_physical_block_size(bdev_get_queue(bdev)); | 1012 | return queue_physical_block_size(bdev_get_queue(bdev)); |
1010 | } | 1013 | } |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 266ab9291232..499dfe982a0e 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -105,6 +105,8 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, | |||
105 | 105 | ||
106 | #define alloc_bootmem(x) \ | 106 | #define alloc_bootmem(x) \ |
107 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 107 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
108 | #define alloc_bootmem_align(x, align) \ | ||
109 | __alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS)) | ||
108 | #define alloc_bootmem_nopanic(x) \ | 110 | #define alloc_bootmem_nopanic(x) \ |
109 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 111 | __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
110 | #define alloc_bootmem_pages(x) \ | 112 | #define alloc_bootmem_pages(x) \ |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 975609cb8548..81483c20735f 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -339,7 +339,7 @@ void drain_local_pages(void *dummy); | |||
339 | 339 | ||
340 | extern gfp_t gfp_allowed_mask; | 340 | extern gfp_t gfp_allowed_mask; |
341 | 341 | ||
342 | extern void set_gfp_allowed_mask(gfp_t mask); | 342 | extern void pm_restrict_gfp_mask(void); |
343 | extern gfp_t clear_gfp_allowed_mask(gfp_t mask); | 343 | extern void pm_restore_gfp_mask(void); |
344 | 344 | ||
345 | #endif /* __LINUX_GFP_H */ | 345 | #endif /* __LINUX_GFP_H */ |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 97b2eae6a22c..731854ccb840 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -959,7 +959,7 @@ struct ieee80211_ht_info { | |||
959 | /* block-ack parameters */ | 959 | /* block-ack parameters */ |
960 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 | 960 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
961 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C | 961 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
962 | #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 | 962 | #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 |
963 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 | 963 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
964 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 | 964 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 |
965 | 965 | ||
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 62dbee554f60..c238ad2f82ea 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -171,11 +171,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); | |||
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | static inline unsigned int __must_check | 174 | /* __kfifo_must_check_helper() is temporarily disabled because it was faulty */ |
175 | __kfifo_must_check_helper(unsigned int val) | 175 | #define __kfifo_must_check_helper(x) (x) |
176 | { | ||
177 | return val; | ||
178 | } | ||
179 | 176 | ||
180 | /** | 177 | /** |
181 | * kfifo_initialized - Check if the fifo is initialized | 178 | * kfifo_initialized - Check if the fifo is initialized |
diff --git a/include/linux/klist.h b/include/linux/klist.h index e91a4e59b771..a370ce57cf1d 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
@@ -22,7 +22,7 @@ struct klist { | |||
22 | struct list_head k_list; | 22 | struct list_head k_list; |
23 | void (*get)(struct klist_node *); | 23 | void (*get)(struct klist_node *); |
24 | void (*put)(struct klist_node *); | 24 | void (*put)(struct klist_node *); |
25 | } __attribute__ ((aligned (4))); | 25 | } __attribute__ ((aligned (sizeof(void *)))); |
26 | 26 | ||
27 | #define KLIST_INIT(_name, _get, _put) \ | 27 | #define KLIST_INIT(_name, _get, _put) \ |
28 | { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ | 28 | { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ |
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index 5c51f367c061..add8a1b8bcf0 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
@@ -29,7 +29,7 @@ struct wm8994_ldo_pdata { | |||
29 | #define WM8994_CONFIGURE_GPIO 0x8000 | 29 | #define WM8994_CONFIGURE_GPIO 0x8000 |
30 | 30 | ||
31 | #define WM8994_DRC_REGS 5 | 31 | #define WM8994_DRC_REGS 5 |
32 | #define WM8994_EQ_REGS 19 | 32 | #define WM8994_EQ_REGS 20 |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * DRC configurations are specified with a label and a set of register | 35 | * DRC configurations are specified with a label and a set of register |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 3984c4eb41fd..8d789d732e87 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -448,12 +448,6 @@ static inline int zone_is_oom_locked(const struct zone *zone) | |||
448 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); | 448 | return test_bit(ZONE_OOM_LOCKED, &zone->flags); |
449 | } | 449 | } |
450 | 450 | ||
451 | #ifdef CONFIG_SMP | ||
452 | unsigned long zone_nr_free_pages(struct zone *zone); | ||
453 | #else | ||
454 | #define zone_nr_free_pages(zone) zone_page_state(zone, NR_FREE_PAGES) | ||
455 | #endif /* CONFIG_SMP */ | ||
456 | |||
457 | /* | 451 | /* |
458 | * The "priority" of VM scanning is how much of the queues we will scan in one | 452 | * The "priority" of VM scanning is how much of the queues we will scan in one |
459 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the | 453 | * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the |
@@ -651,7 +645,9 @@ typedef struct pglist_data { | |||
651 | extern struct mutex zonelists_mutex; | 645 | extern struct mutex zonelists_mutex; |
652 | void build_all_zonelists(void *data); | 646 | void build_all_zonelists(void *data); |
653 | void wakeup_kswapd(struct zone *zone, int order); | 647 | void wakeup_kswapd(struct zone *zone, int order); |
654 | int zone_watermark_ok(struct zone *z, int order, unsigned long mark, | 648 | bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
649 | int classzone_idx, int alloc_flags); | ||
650 | bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, | ||
655 | int classzone_idx, int alloc_flags); | 651 | int classzone_idx, int alloc_flags); |
656 | enum memmap_context { | 652 | enum memmap_context { |
657 | MEMMAP_EARLY, | 653 | MEMMAP_EARLY, |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 89341c32631a..03317c8d4077 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -215,7 +215,7 @@ NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, | |||
215 | int ret; | 215 | int ret; |
216 | 216 | ||
217 | if (!cond || | 217 | if (!cond || |
218 | (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) | 218 | ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1)) |
219 | ret = okfn(skb); | 219 | ret = okfn(skb); |
220 | return ret; | 220 | return ret; |
221 | } | 221 | } |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 570fddeb0388..db8aa93ce494 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2041,6 +2041,7 @@ | |||
2041 | #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 | 2041 | #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 |
2042 | #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 | 2042 | #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 |
2043 | 2043 | ||
2044 | #define PCI_VENDOR_ID_BCM_GVC 0x14a4 | ||
2044 | #define PCI_VENDOR_ID_BROADCOM 0x14e4 | 2045 | #define PCI_VENDOR_ID_BROADCOM 0x14e4 |
2045 | #define PCI_DEVICE_ID_TIGON3_5752 0x1600 | 2046 | #define PCI_DEVICE_ID_TIGON3_5752 0x1600 |
2046 | #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 | 2047 | #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 716f99b682c1..1d42c6ecd00a 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -788,6 +788,7 @@ struct perf_event_context { | |||
788 | int nr_active; | 788 | int nr_active; |
789 | int is_active; | 789 | int is_active; |
790 | int nr_stat; | 790 | int nr_stat; |
791 | int rotate_disable; | ||
791 | atomic_t refcount; | 792 | atomic_t refcount; |
792 | struct task_struct *task; | 793 | struct task_struct *task; |
793 | 794 | ||
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 445796945ac9..bb27d7ec2fb9 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -160,5 +160,6 @@ void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); | |||
160 | 160 | ||
161 | /* for F_SETPIPE_SZ and F_GETPIPE_SZ */ | 161 | /* for F_SETPIPE_SZ and F_GETPIPE_SZ */ |
162 | long pipe_fcntl(struct file *, unsigned int, unsigned long arg); | 162 | long pipe_fcntl(struct file *, unsigned int, unsigned long arg); |
163 | struct pipe_inode_info *get_pipe_info(struct file *file); | ||
163 | 164 | ||
164 | #endif | 165 | #endif |
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 6e81888c6222..5ea4b1582b07 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -67,7 +67,8 @@ static inline void device_set_run_wake(struct device *dev, bool enable) | |||
67 | 67 | ||
68 | static inline bool pm_runtime_suspended(struct device *dev) | 68 | static inline bool pm_runtime_suspended(struct device *dev) |
69 | { | 69 | { |
70 | return dev->power.runtime_status == RPM_SUSPENDED; | 70 | return dev->power.runtime_status == RPM_SUSPENDED |
71 | && !dev->power.disable_depth; | ||
71 | } | 72 | } |
72 | 73 | ||
73 | #else /* !CONFIG_PM_RUNTIME */ | 74 | #else /* !CONFIG_PM_RUNTIME */ |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 634b8e674ac5..9f38fe50217e 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -36,17 +36,6 @@ | |||
36 | * RCU. | 36 | * RCU. |
37 | */ | 37 | */ |
38 | #define RADIX_TREE_INDIRECT_PTR 1 | 38 | #define RADIX_TREE_INDIRECT_PTR 1 |
39 | #define RADIX_TREE_RETRY ((void *)-1UL) | ||
40 | |||
41 | static inline void *radix_tree_ptr_to_indirect(void *ptr) | ||
42 | { | ||
43 | return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR); | ||
44 | } | ||
45 | |||
46 | static inline void *radix_tree_indirect_to_ptr(void *ptr) | ||
47 | { | ||
48 | return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR); | ||
49 | } | ||
50 | 39 | ||
51 | static inline int radix_tree_is_indirect_ptr(void *ptr) | 40 | static inline int radix_tree_is_indirect_ptr(void *ptr) |
52 | { | 41 | { |
@@ -138,16 +127,29 @@ do { \ | |||
138 | * removed. | 127 | * removed. |
139 | * | 128 | * |
140 | * For use with radix_tree_lookup_slot(). Caller must hold tree at least read | 129 | * For use with radix_tree_lookup_slot(). Caller must hold tree at least read |
141 | * locked across slot lookup and dereference. More likely, will be used with | 130 | * locked across slot lookup and dereference. Not required if write lock is |
142 | * radix_tree_replace_slot(), as well, so caller will hold tree write locked. | 131 | * held (ie. items cannot be concurrently inserted). |
132 | * | ||
133 | * radix_tree_deref_retry must be used to confirm validity of the pointer if | ||
134 | * only the read lock is held. | ||
143 | */ | 135 | */ |
144 | static inline void *radix_tree_deref_slot(void **pslot) | 136 | static inline void *radix_tree_deref_slot(void **pslot) |
145 | { | 137 | { |
146 | void *ret = rcu_dereference(*pslot); | 138 | return rcu_dereference(*pslot); |
147 | if (unlikely(radix_tree_is_indirect_ptr(ret))) | ||
148 | ret = RADIX_TREE_RETRY; | ||
149 | return ret; | ||
150 | } | 139 | } |
140 | |||
141 | /** | ||
142 | * radix_tree_deref_retry - check radix_tree_deref_slot | ||
143 | * @arg: pointer returned by radix_tree_deref_slot | ||
144 | * Returns: 0 if retry is not required, otherwise retry is required | ||
145 | * | ||
146 | * radix_tree_deref_retry must be used with radix_tree_deref_slot. | ||
147 | */ | ||
148 | static inline int radix_tree_deref_retry(void *arg) | ||
149 | { | ||
150 | return unlikely((unsigned long)arg & RADIX_TREE_INDIRECT_PTR); | ||
151 | } | ||
152 | |||
151 | /** | 153 | /** |
152 | * radix_tree_replace_slot - replace item in a slot | 154 | * radix_tree_replace_slot - replace item in a slot |
153 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot | 155 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot |
diff --git a/include/linux/sched.h b/include/linux/sched.h index c9ac4fc837ba..cdb9672a11ea 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -147,7 +147,7 @@ extern unsigned long nr_iowait_cpu(int cpu); | |||
147 | extern unsigned long this_cpu_load(void); | 147 | extern unsigned long this_cpu_load(void); |
148 | 148 | ||
149 | 149 | ||
150 | extern void calc_global_load(void); | 150 | extern void calc_global_load(unsigned long ticks); |
151 | 151 | ||
152 | extern unsigned long get_parent_ip(unsigned long addr); | 152 | extern unsigned long get_parent_ip(unsigned long addr); |
153 | 153 | ||
diff --git a/include/linux/socket.h b/include/linux/socket.h index a8f56e1ec760..a2fada9becb6 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -322,7 +322,7 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, | |||
322 | int offset, | 322 | int offset, |
323 | unsigned int len, __wsum *csump); | 323 | unsigned int len, __wsum *csump); |
324 | 324 | ||
325 | extern long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); | 325 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); |
326 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); | 326 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
327 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, | 327 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, |
328 | int offset, int len); | 328 | int offset, int len); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 67d64e6efe7a..6f62c3055819 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -365,6 +365,7 @@ struct tty_file_private { | |||
365 | #define TTY_HUPPED 18 /* Post driver->hangup() */ | 365 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
366 | #define TTY_FLUSHING 19 /* Flushing to ldisc in progress */ | 366 | #define TTY_FLUSHING 19 /* Flushing to ldisc in progress */ |
367 | #define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */ | 367 | #define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */ |
368 | #define TTY_HUPPING 21 /* ->hangup() in progress */ | ||
368 | 369 | ||
369 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) | 370 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
370 | 371 | ||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 55675b1efb28..e02848c55bd6 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -345,6 +345,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, | |||
345 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | 345 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, |
346 | unsigned int ch); | 346 | unsigned int ch); |
347 | extern int usb_serial_handle_break(struct usb_serial_port *port); | 347 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
348 | extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | ||
349 | struct tty_struct *tty, | ||
350 | unsigned int status); | ||
348 | 351 | ||
349 | 352 | ||
350 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | 353 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index eaaea37b3b75..e4cc21cf5870 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -254,6 +254,8 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item); | |||
254 | extern void __dec_zone_state(struct zone *, enum zone_stat_item); | 254 | extern void __dec_zone_state(struct zone *, enum zone_stat_item); |
255 | 255 | ||
256 | void refresh_cpu_vm_stats(int); | 256 | void refresh_cpu_vm_stats(int); |
257 | void reduce_pgdat_percpu_threshold(pg_data_t *pgdat); | ||
258 | void restore_pgdat_percpu_threshold(pg_data_t *pgdat); | ||
257 | #else /* CONFIG_SMP */ | 259 | #else /* CONFIG_SMP */ |
258 | 260 | ||
259 | /* | 261 | /* |
@@ -298,6 +300,9 @@ static inline void __dec_zone_page_state(struct page *page, | |||
298 | #define dec_zone_page_state __dec_zone_page_state | 300 | #define dec_zone_page_state __dec_zone_page_state |
299 | #define mod_zone_page_state __mod_zone_page_state | 301 | #define mod_zone_page_state __mod_zone_page_state |
300 | 302 | ||
303 | static inline void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) { } | ||
304 | static inline void restore_pgdat_percpu_threshold(pg_data_t *pgdat) { } | ||
305 | |||
301 | static inline void refresh_cpu_vm_stats(int cpu) { } | 306 | static inline void refresh_cpu_vm_stats(int cpu) { } |
302 | #endif | 307 | #endif |
303 | 308 | ||
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 7a9f76ecbbbd..ac7ce00f39cf 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
@@ -161,7 +161,7 @@ extern struct list_head saa7146_devices; | |||
161 | extern struct mutex saa7146_devices_lock; | 161 | extern struct mutex saa7146_devices_lock; |
162 | int saa7146_register_extension(struct saa7146_extension*); | 162 | int saa7146_register_extension(struct saa7146_extension*); |
163 | int saa7146_unregister_extension(struct saa7146_extension*); | 163 | int saa7146_unregister_extension(struct saa7146_extension*); |
164 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc); | 164 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc); |
165 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); | 165 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); |
166 | void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); | 166 | void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); |
167 | int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); | 167 | int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 90c9e2872f27..18e5c3f67580 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -10,6 +10,7 @@ extern void unix_inflight(struct file *fp); | |||
10 | extern void unix_notinflight(struct file *fp); | 10 | extern void unix_notinflight(struct file *fp); |
11 | extern void unix_gc(void); | 11 | extern void unix_gc(void); |
12 | extern void wait_for_unix_gc(void); | 12 | extern void wait_for_unix_gc(void); |
13 | extern struct sock *unix_get_socket(struct file *filp); | ||
13 | 14 | ||
14 | #define UNIX_HASH_SIZE 256 | 15 | #define UNIX_HASH_SIZE 256 |
15 | 16 | ||
@@ -56,6 +57,7 @@ struct unix_sock { | |||
56 | spinlock_t lock; | 57 | spinlock_t lock; |
57 | unsigned int gc_candidate : 1; | 58 | unsigned int gc_candidate : 1; |
58 | unsigned int gc_maybe_cycle : 1; | 59 | unsigned int gc_maybe_cycle : 1; |
60 | unsigned char recursion_level; | ||
59 | struct socket_wq peer_wq; | 61 | struct socket_wq peer_wq; |
60 | }; | 62 | }; |
61 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 63 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2fd06c60ffbb..a1662a52fb7d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1201,13 +1201,14 @@ struct cfg80211_ops { | |||
1201 | * initiator is %REGDOM_SET_BY_CORE). | 1201 | * initiator is %REGDOM_SET_BY_CORE). |
1202 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will | 1202 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will |
1203 | * ignore regulatory domain settings until it gets its own regulatory | 1203 | * ignore regulatory domain settings until it gets its own regulatory |
1204 | * domain via its regulatory_hint(). After its gets its own regulatory | 1204 | * domain via its regulatory_hint() unless the regulatory hint is |
1205 | * domain it will only allow further regulatory domain settings to | 1205 | * from a country IE. After its gets its own regulatory domain it will |
1206 | * further enhance compliance. For example if channel 13 and 14 are | 1206 | * only allow further regulatory domain settings to further enhance |
1207 | * disabled by this regulatory domain no user regulatory domain can | 1207 | * compliance. For example if channel 13 and 14 are disabled by this |
1208 | * enable these channels at a later time. This can be used for devices | 1208 | * regulatory domain no user regulatory domain can enable these channels |
1209 | * which do not have calibration information gauranteed for frequencies | 1209 | * at a later time. This can be used for devices which do not have |
1210 | * or settings outside of its regulatory domain. | 1210 | * calibration information guaranteed for frequencies or settings |
1211 | * outside of its regulatory domain. | ||
1211 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure | 1212 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure |
1212 | * that passive scan flags and beaconing flags may not be lifted by | 1213 | * that passive scan flags and beaconing flags may not be lifted by |
1213 | * cfg80211 due to regulatory beacon hints. For more information on beacon | 1214 | * cfg80211 due to regulatory beacon hints. For more information on beacon |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index b0787a1dea90..05aaa8789848 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -315,6 +315,9 @@ struct ieee80211_bss_conf { | |||
315 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame | 315 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame |
316 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this | 316 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this |
317 | * frame and selects the maximum number of streams that it can use. | 317 | * frame and selects the maximum number of streams that it can use. |
318 | * | ||
319 | * Note: If you have to add new flags to the enumeration, then don't | ||
320 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. | ||
318 | */ | 321 | */ |
319 | enum mac80211_tx_control_flags { | 322 | enum mac80211_tx_control_flags { |
320 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 323 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
@@ -344,6 +347,19 @@ enum mac80211_tx_control_flags { | |||
344 | 347 | ||
345 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 | 348 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 |
346 | 349 | ||
350 | /* | ||
351 | * This definition is used as a mask to clear all temporary flags, which are | ||
352 | * set by the tx handlers for each transmission attempt by the mac80211 stack. | ||
353 | */ | ||
354 | #define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \ | ||
355 | IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \ | ||
356 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ | ||
357 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ | ||
358 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ | ||
359 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_PSPOLL_RESPONSE | \ | ||
360 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ | ||
361 | IEEE80211_TX_CTL_STBC) | ||
362 | |||
347 | /** | 363 | /** |
348 | * enum mac80211_rate_control_flags - per-rate flags set by the | 364 | * enum mac80211_rate_control_flags - per-rate flags set by the |
349 | * Rate Control algorithm. | 365 | * Rate Control algorithm. |
diff --git a/include/net/sock.h b/include/net/sock.h index adab9dc58183..6892a5e89c23 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1155,6 +1155,8 @@ extern void sk_common_release(struct sock *sk); | |||
1155 | /* Initialise core socket variables */ | 1155 | /* Initialise core socket variables */ |
1156 | extern void sock_init_data(struct socket *sock, struct sock *sk); | 1156 | extern void sock_init_data(struct socket *sock, struct sock *sk); |
1157 | 1157 | ||
1158 | extern void sk_filter_release_rcu(struct rcu_head *rcu); | ||
1159 | |||
1158 | /** | 1160 | /** |
1159 | * sk_filter_release - release a socket filter | 1161 | * sk_filter_release - release a socket filter |
1160 | * @fp: filter to remove | 1162 | * @fp: filter to remove |
@@ -1165,7 +1167,7 @@ extern void sock_init_data(struct socket *sock, struct sock *sk); | |||
1165 | static inline void sk_filter_release(struct sk_filter *fp) | 1167 | static inline void sk_filter_release(struct sk_filter *fp) |
1166 | { | 1168 | { |
1167 | if (atomic_dec_and_test(&fp->refcnt)) | 1169 | if (atomic_dec_and_test(&fp->refcnt)) |
1168 | kfree(fp); | 1170 | call_rcu_bh(&fp->rcu, sk_filter_release_rcu); |
1169 | } | 1171 | } |
1170 | 1172 | ||
1171 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | 1173 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 8fcb6e0e9e72..d38b58e735dc 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define _SCSI_SCSI_H | 9 | #define _SCSI_SCSI_H |
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/scatterlist.h> | ||
12 | 13 | ||
13 | struct scsi_cmnd; | 14 | struct scsi_cmnd; |
14 | 15 | ||
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index e8cbf431c8cc..75271b9a8f61 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h | |||
@@ -24,8 +24,15 @@ typedef unsigned int RING_IDX; | |||
24 | * A ring contains as many entries as will fit, rounded down to the nearest | 24 | * A ring contains as many entries as will fit, rounded down to the nearest |
25 | * power of two (so we can mask with (size-1) to loop around). | 25 | * power of two (so we can mask with (size-1) to loop around). |
26 | */ | 26 | */ |
27 | #define __RING_SIZE(_s, _sz) \ | 27 | #define __CONST_RING_SIZE(_s, _sz) \ |
28 | (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) | 28 | (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \ |
29 | sizeof(((struct _s##_sring *)0)->ring[0]))) | ||
30 | |||
31 | /* | ||
32 | * The same for passing in an actual pointer instead of a name tag. | ||
33 | */ | ||
34 | #define __RING_SIZE(_s, _sz) \ | ||
35 | (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) | ||
29 | 36 | ||
30 | /* | 37 | /* |
31 | * Macros to make the correct C datatypes for a new kind of ring. | 38 | * Macros to make the correct C datatypes for a new kind of ring. |
diff --git a/init/calibrate.c b/init/calibrate.c index 6eb48e53d61c..24fe022c55f9 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
@@ -66,7 +66,7 @@ static unsigned long __cpuinit calibrate_delay_direct(void) | |||
66 | pre_start = 0; | 66 | pre_start = 0; |
67 | read_current_timer(&start); | 67 | read_current_timer(&start); |
68 | start_jiffies = jiffies; | 68 | start_jiffies = jiffies; |
69 | while (jiffies <= (start_jiffies + 1)) { | 69 | while (time_before_eq(jiffies, start_jiffies + 1)) { |
70 | pre_start = start; | 70 | pre_start = start; |
71 | read_current_timer(&start); | 71 | read_current_timer(&start); |
72 | } | 72 | } |
@@ -74,8 +74,8 @@ static unsigned long __cpuinit calibrate_delay_direct(void) | |||
74 | 74 | ||
75 | pre_end = 0; | 75 | pre_end = 0; |
76 | end = post_start; | 76 | end = post_start; |
77 | while (jiffies <= | 77 | while (time_before_eq(jiffies, start_jiffies + 1 + |
78 | (start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) { | 78 | DELAY_CALIBRATION_TICKS)) { |
79 | pre_end = end; | 79 | pre_end = end; |
80 | read_current_timer(&end); | 80 | read_current_timer(&end); |
81 | } | 81 | } |
diff --git a/ipc/compat.c b/ipc/compat.c index 9dc2c7d3c9e6..845a28738d3a 100644 --- a/ipc/compat.c +++ b/ipc/compat.c | |||
@@ -241,6 +241,8 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr) | |||
241 | struct semid64_ds __user *up64; | 241 | struct semid64_ds __user *up64; |
242 | int version = compat_ipc_parse_version(&third); | 242 | int version = compat_ipc_parse_version(&third); |
243 | 243 | ||
244 | memset(&s64, 0, sizeof(s64)); | ||
245 | |||
244 | if (!uptr) | 246 | if (!uptr) |
245 | return -EINVAL; | 247 | return -EINVAL; |
246 | if (get_user(pad, (u32 __user *) uptr)) | 248 | if (get_user(pad, (u32 __user *) uptr)) |
@@ -421,6 +423,8 @@ long compat_sys_msgctl(int first, int second, void __user *uptr) | |||
421 | int version = compat_ipc_parse_version(&second); | 423 | int version = compat_ipc_parse_version(&second); |
422 | void __user *p; | 424 | void __user *p; |
423 | 425 | ||
426 | memset(&m64, 0, sizeof(m64)); | ||
427 | |||
424 | switch (second & (~IPC_64)) { | 428 | switch (second & (~IPC_64)) { |
425 | case IPC_INFO: | 429 | case IPC_INFO: |
426 | case IPC_RMID: | 430 | case IPC_RMID: |
@@ -594,6 +598,8 @@ long compat_sys_shmctl(int first, int second, void __user *uptr) | |||
594 | int err, err2; | 598 | int err, err2; |
595 | int version = compat_ipc_parse_version(&second); | 599 | int version = compat_ipc_parse_version(&second); |
596 | 600 | ||
601 | memset(&s64, 0, sizeof(s64)); | ||
602 | |||
597 | switch (second & (~IPC_64)) { | 603 | switch (second & (~IPC_64)) { |
598 | case IPC_RMID: | 604 | case IPC_RMID: |
599 | case SHM_LOCK: | 605 | case SHM_LOCK: |
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c index d8d1e9ff4e88..380ea4fe08e7 100644 --- a/ipc/compat_mq.c +++ b/ipc/compat_mq.c | |||
@@ -53,6 +53,9 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name, | |||
53 | void __user *p = NULL; | 53 | void __user *p = NULL; |
54 | if (u_attr && oflag & O_CREAT) { | 54 | if (u_attr && oflag & O_CREAT) { |
55 | struct mq_attr attr; | 55 | struct mq_attr attr; |
56 | |||
57 | memset(&attr, 0, sizeof(attr)); | ||
58 | |||
56 | p = compat_alloc_user_space(sizeof(attr)); | 59 | p = compat_alloc_user_space(sizeof(attr)); |
57 | if (get_compat_mq_attr(&attr, u_attr) || | 60 | if (get_compat_mq_attr(&attr, u_attr) || |
58 | copy_to_user(p, &attr, sizeof(attr))) | 61 | copy_to_user(p, &attr, sizeof(attr))) |
@@ -127,6 +130,8 @@ asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, | |||
127 | struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p)); | 130 | struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p)); |
128 | long ret; | 131 | long ret; |
129 | 132 | ||
133 | memset(&mqstat, 0, sizeof(mqstat)); | ||
134 | |||
130 | if (u_mqstat) { | 135 | if (u_mqstat) { |
131 | if (get_compat_mq_attr(&mqstat, u_mqstat) || | 136 | if (get_compat_mq_attr(&mqstat, u_mqstat) || |
132 | copy_to_user(p, &mqstat, sizeof(mqstat))) | 137 | copy_to_user(p, &mqstat, sizeof(mqstat))) |
@@ -473,6 +473,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ | |||
473 | { | 473 | { |
474 | struct shmid_ds out; | 474 | struct shmid_ds out; |
475 | 475 | ||
476 | memset(&out, 0, sizeof(out)); | ||
476 | ipc64_perm_to_ipc_perm(&in->shm_perm, &out.shm_perm); | 477 | ipc64_perm_to_ipc_perm(&in->shm_perm, &out.shm_perm); |
477 | out.shm_segsz = in->shm_segsz; | 478 | out.shm_segsz = in->shm_segsz; |
478 | out.shm_atime = in->shm_atime; | 479 | out.shm_atime = in->shm_atime; |
diff --git a/kernel/exit.c b/kernel/exit.c index b9d3bc6c21ec..ad7e51488291 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -97,6 +97,14 @@ static void __exit_signal(struct task_struct *tsk) | |||
97 | sig->tty = NULL; | 97 | sig->tty = NULL; |
98 | } else { | 98 | } else { |
99 | /* | 99 | /* |
100 | * This can only happen if the caller is de_thread(). | ||
101 | * FIXME: this is the temporary hack, we should teach | ||
102 | * posix-cpu-timers to handle this case correctly. | ||
103 | */ | ||
104 | if (unlikely(has_group_leader_pid(tsk))) | ||
105 | posix_cpu_timers_exit_group(tsk); | ||
106 | |||
107 | /* | ||
100 | * If there is any task waiting for the group exit | 108 | * If there is any task waiting for the group exit |
101 | * then notify it: | 109 | * then notify it: |
102 | */ | 110 | */ |
@@ -905,6 +913,15 @@ NORET_TYPE void do_exit(long code) | |||
905 | if (unlikely(!tsk->pid)) | 913 | if (unlikely(!tsk->pid)) |
906 | panic("Attempted to kill the idle task!"); | 914 | panic("Attempted to kill the idle task!"); |
907 | 915 | ||
916 | /* | ||
917 | * If do_exit is called because this processes oopsed, it's possible | ||
918 | * that get_fs() was left as KERNEL_DS, so reset it to USER_DS before | ||
919 | * continuing. Amongst other possible reasons, this is to prevent | ||
920 | * mm_release()->clear_child_tid() from writing to a user-controlled | ||
921 | * kernel address. | ||
922 | */ | ||
923 | set_fs(USER_DS); | ||
924 | |||
908 | tracehook_report_exit(&code); | 925 | tracehook_report_exit(&code); |
909 | 926 | ||
910 | validate_creds_for_do_exit(tsk); | 927 | validate_creds_for_do_exit(tsk); |
diff --git a/kernel/fork.c b/kernel/fork.c index ab7f29d906c7..d01a7514125b 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -279,6 +279,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
279 | 279 | ||
280 | setup_thread_stack(tsk, orig); | 280 | setup_thread_stack(tsk, orig); |
281 | clear_user_return_notifier(tsk); | 281 | clear_user_return_notifier(tsk); |
282 | clear_tsk_need_resched(tsk); | ||
282 | stackend = end_of_stack(tsk); | 283 | stackend = end_of_stack(tsk); |
283 | *stackend = STACK_END_MAGIC; /* for overflow detection */ | 284 | *stackend = STACK_END_MAGIC; /* for overflow detection */ |
284 | 285 | ||
diff --git a/kernel/futex.c b/kernel/futex.c index 6a3a5fa1526d..e328f574c97c 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1363,7 +1363,6 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) | |||
1363 | { | 1363 | { |
1364 | struct futex_hash_bucket *hb; | 1364 | struct futex_hash_bucket *hb; |
1365 | 1365 | ||
1366 | get_futex_key_refs(&q->key); | ||
1367 | hb = hash_futex(&q->key); | 1366 | hb = hash_futex(&q->key); |
1368 | q->lock_ptr = &hb->lock; | 1367 | q->lock_ptr = &hb->lock; |
1369 | 1368 | ||
@@ -1375,7 +1374,6 @@ static inline void | |||
1375 | queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb) | 1374 | queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb) |
1376 | { | 1375 | { |
1377 | spin_unlock(&hb->lock); | 1376 | spin_unlock(&hb->lock); |
1378 | drop_futex_key_refs(&q->key); | ||
1379 | } | 1377 | } |
1380 | 1378 | ||
1381 | /** | 1379 | /** |
@@ -1480,8 +1478,6 @@ static void unqueue_me_pi(struct futex_q *q) | |||
1480 | q->pi_state = NULL; | 1478 | q->pi_state = NULL; |
1481 | 1479 | ||
1482 | spin_unlock(q->lock_ptr); | 1480 | spin_unlock(q->lock_ptr); |
1483 | |||
1484 | drop_futex_key_refs(&q->key); | ||
1485 | } | 1481 | } |
1486 | 1482 | ||
1487 | /* | 1483 | /* |
@@ -1812,7 +1808,10 @@ static int futex_wait(u32 __user *uaddr, int fshared, | |||
1812 | } | 1808 | } |
1813 | 1809 | ||
1814 | retry: | 1810 | retry: |
1815 | /* Prepare to wait on uaddr. */ | 1811 | /* |
1812 | * Prepare to wait on uaddr. On success, holds hb lock and increments | ||
1813 | * q.key refs. | ||
1814 | */ | ||
1816 | ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); | 1815 | ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); |
1817 | if (ret) | 1816 | if (ret) |
1818 | goto out; | 1817 | goto out; |
@@ -1822,24 +1821,23 @@ retry: | |||
1822 | 1821 | ||
1823 | /* If we were woken (and unqueued), we succeeded, whatever. */ | 1822 | /* If we were woken (and unqueued), we succeeded, whatever. */ |
1824 | ret = 0; | 1823 | ret = 0; |
1824 | /* unqueue_me() drops q.key ref */ | ||
1825 | if (!unqueue_me(&q)) | 1825 | if (!unqueue_me(&q)) |
1826 | goto out_put_key; | 1826 | goto out; |
1827 | ret = -ETIMEDOUT; | 1827 | ret = -ETIMEDOUT; |
1828 | if (to && !to->task) | 1828 | if (to && !to->task) |
1829 | goto out_put_key; | 1829 | goto out; |
1830 | 1830 | ||
1831 | /* | 1831 | /* |
1832 | * We expect signal_pending(current), but we might be the | 1832 | * We expect signal_pending(current), but we might be the |
1833 | * victim of a spurious wakeup as well. | 1833 | * victim of a spurious wakeup as well. |
1834 | */ | 1834 | */ |
1835 | if (!signal_pending(current)) { | 1835 | if (!signal_pending(current)) |
1836 | put_futex_key(fshared, &q.key); | ||
1837 | goto retry; | 1836 | goto retry; |
1838 | } | ||
1839 | 1837 | ||
1840 | ret = -ERESTARTSYS; | 1838 | ret = -ERESTARTSYS; |
1841 | if (!abs_time) | 1839 | if (!abs_time) |
1842 | goto out_put_key; | 1840 | goto out; |
1843 | 1841 | ||
1844 | restart = ¤t_thread_info()->restart_block; | 1842 | restart = ¤t_thread_info()->restart_block; |
1845 | restart->fn = futex_wait_restart; | 1843 | restart->fn = futex_wait_restart; |
@@ -1856,8 +1854,6 @@ retry: | |||
1856 | 1854 | ||
1857 | ret = -ERESTART_RESTARTBLOCK; | 1855 | ret = -ERESTART_RESTARTBLOCK; |
1858 | 1856 | ||
1859 | out_put_key: | ||
1860 | put_futex_key(fshared, &q.key); | ||
1861 | out: | 1857 | out: |
1862 | if (to) { | 1858 | if (to) { |
1863 | hrtimer_cancel(&to->timer); | 1859 | hrtimer_cancel(&to->timer); |
@@ -2236,7 +2232,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, | |||
2236 | q.rt_waiter = &rt_waiter; | 2232 | q.rt_waiter = &rt_waiter; |
2237 | q.requeue_pi_key = &key2; | 2233 | q.requeue_pi_key = &key2; |
2238 | 2234 | ||
2239 | /* Prepare to wait on uaddr. */ | 2235 | /* |
2236 | * Prepare to wait on uaddr. On success, increments q.key (key1) ref | ||
2237 | * count. | ||
2238 | */ | ||
2240 | ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); | 2239 | ret = futex_wait_setup(uaddr, val, fshared, &q, &hb); |
2241 | if (ret) | 2240 | if (ret) |
2242 | goto out_key2; | 2241 | goto out_key2; |
@@ -2254,7 +2253,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared, | |||
2254 | * In order for us to be here, we know our q.key == key2, and since | 2253 | * In order for us to be here, we know our q.key == key2, and since |
2255 | * we took the hb->lock above, we also know that futex_requeue() has | 2254 | * we took the hb->lock above, we also know that futex_requeue() has |
2256 | * completed and we no longer have to concern ourselves with a wakeup | 2255 | * completed and we no longer have to concern ourselves with a wakeup |
2257 | * race with the atomic proxy lock acquition by the requeue code. | 2256 | * race with the atomic proxy lock acquisition by the requeue code. The |
2257 | * futex_requeue dropped our key1 reference and incremented our key2 | ||
2258 | * reference count. | ||
2258 | */ | 2259 | */ |
2259 | 2260 | ||
2260 | /* Check if the requeue code acquired the second futex for us. */ | 2261 | /* Check if the requeue code acquired the second futex for us. */ |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 09a2ee540bd2..345e0b75fe1e 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -214,7 +214,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v) | |||
214 | 214 | ||
215 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) | 215 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) |
216 | { | 216 | { |
217 | return single_open(file, irq_spurious_proc_show, NULL); | 217 | return single_open(file, irq_spurious_proc_show, PDE(inode)->data); |
218 | } | 218 | } |
219 | 219 | ||
220 | static const struct file_operations irq_spurious_proc_fops = { | 220 | static const struct file_operations irq_spurious_proc_fops = { |
diff --git a/kernel/latencytop.c b/kernel/latencytop.c index 877fb306d415..17110a4a4fc2 100644 --- a/kernel/latencytop.c +++ b/kernel/latencytop.c | |||
@@ -194,14 +194,7 @@ __account_scheduler_latency(struct task_struct *tsk, int usecs, int inter) | |||
194 | 194 | ||
195 | account_global_scheduler_latency(tsk, &lat); | 195 | account_global_scheduler_latency(tsk, &lat); |
196 | 196 | ||
197 | /* | 197 | for (i = 0; i < tsk->latency_record_count; i++) { |
198 | * short term hack; if we're > 32 we stop; future we recycle: | ||
199 | */ | ||
200 | tsk->latency_record_count++; | ||
201 | if (tsk->latency_record_count >= LT_SAVECOUNT) | ||
202 | goto out_unlock; | ||
203 | |||
204 | for (i = 0; i < LT_SAVECOUNT; i++) { | ||
205 | struct latency_record *mylat; | 198 | struct latency_record *mylat; |
206 | int same = 1; | 199 | int same = 1; |
207 | 200 | ||
@@ -227,8 +220,14 @@ __account_scheduler_latency(struct task_struct *tsk, int usecs, int inter) | |||
227 | } | 220 | } |
228 | } | 221 | } |
229 | 222 | ||
223 | /* | ||
224 | * short term hack; if we're > 32 we stop; future we recycle: | ||
225 | */ | ||
226 | if (tsk->latency_record_count >= LT_SAVECOUNT) | ||
227 | goto out_unlock; | ||
228 | |||
230 | /* Allocated a new one: */ | 229 | /* Allocated a new one: */ |
231 | i = tsk->latency_record_count; | 230 | i = tsk->latency_record_count++; |
232 | memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); | 231 | memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); |
233 | 232 | ||
234 | out_unlock: | 233 | out_unlock: |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index b98bed3d8182..65b09a836cc3 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -1620,8 +1620,12 @@ static void rotate_ctx(struct perf_event_context *ctx) | |||
1620 | { | 1620 | { |
1621 | raw_spin_lock(&ctx->lock); | 1621 | raw_spin_lock(&ctx->lock); |
1622 | 1622 | ||
1623 | /* Rotate the first entry last of non-pinned groups */ | 1623 | /* |
1624 | list_rotate_left(&ctx->flexible_groups); | 1624 | * Rotate the first entry last of non-pinned groups. Rotation might be |
1625 | * disabled by the inheritance code. | ||
1626 | */ | ||
1627 | if (!ctx->rotate_disable) | ||
1628 | list_rotate_left(&ctx->flexible_groups); | ||
1625 | 1629 | ||
1626 | raw_spin_unlock(&ctx->lock); | 1630 | raw_spin_unlock(&ctx->lock); |
1627 | } | 1631 | } |
@@ -1773,7 +1777,13 @@ static u64 perf_event_read(struct perf_event *event) | |||
1773 | unsigned long flags; | 1777 | unsigned long flags; |
1774 | 1778 | ||
1775 | raw_spin_lock_irqsave(&ctx->lock, flags); | 1779 | raw_spin_lock_irqsave(&ctx->lock, flags); |
1776 | update_context_time(ctx); | 1780 | /* |
1781 | * may read while context is not active | ||
1782 | * (e.g., thread is blocked), in that case | ||
1783 | * we cannot update context time | ||
1784 | */ | ||
1785 | if (ctx->is_active) | ||
1786 | update_context_time(ctx); | ||
1777 | update_event_times(event); | 1787 | update_event_times(event); |
1778 | raw_spin_unlock_irqrestore(&ctx->lock, flags); | 1788 | raw_spin_unlock_irqrestore(&ctx->lock, flags); |
1779 | } | 1789 | } |
@@ -5616,6 +5626,7 @@ int perf_event_init_task(struct task_struct *child) | |||
5616 | struct perf_event *event; | 5626 | struct perf_event *event; |
5617 | struct task_struct *parent = current; | 5627 | struct task_struct *parent = current; |
5618 | int inherited_all = 1; | 5628 | int inherited_all = 1; |
5629 | unsigned long flags; | ||
5619 | int ret = 0; | 5630 | int ret = 0; |
5620 | 5631 | ||
5621 | child->perf_event_ctxp = NULL; | 5632 | child->perf_event_ctxp = NULL; |
@@ -5656,6 +5667,15 @@ int perf_event_init_task(struct task_struct *child) | |||
5656 | break; | 5667 | break; |
5657 | } | 5668 | } |
5658 | 5669 | ||
5670 | /* | ||
5671 | * We can't hold ctx->lock when iterating the ->flexible_group list due | ||
5672 | * to allocations, but we need to prevent rotation because | ||
5673 | * rotate_ctx() will change the list from interrupt context. | ||
5674 | */ | ||
5675 | raw_spin_lock_irqsave(&parent_ctx->lock, flags); | ||
5676 | parent_ctx->rotate_disable = 1; | ||
5677 | raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); | ||
5678 | |||
5659 | list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) { | 5679 | list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) { |
5660 | ret = inherit_task_group(event, parent, parent_ctx, child, | 5680 | ret = inherit_task_group(event, parent, parent_ctx, child, |
5661 | &inherited_all); | 5681 | &inherited_all); |
@@ -5663,6 +5683,10 @@ int perf_event_init_task(struct task_struct *child) | |||
5663 | break; | 5683 | break; |
5664 | } | 5684 | } |
5665 | 5685 | ||
5686 | raw_spin_lock_irqsave(&parent_ctx->lock, flags); | ||
5687 | parent_ctx->rotate_disable = 0; | ||
5688 | raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); | ||
5689 | |||
5666 | child_ctx = child->perf_event_ctxp; | 5690 | child_ctx = child->perf_event_ctxp; |
5667 | 5691 | ||
5668 | if (child_ctx && inherited_all) { | 5692 | if (child_ctx && inherited_all) { |
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c index 645e541a45f6..0da2837416eb 100644 --- a/kernel/pm_qos_params.c +++ b/kernel/pm_qos_params.c | |||
@@ -120,10 +120,10 @@ static inline int pm_qos_get_value(struct pm_qos_object *o) | |||
120 | 120 | ||
121 | switch (o->type) { | 121 | switch (o->type) { |
122 | case PM_QOS_MIN: | 122 | case PM_QOS_MIN: |
123 | return plist_last(&o->requests)->prio; | 123 | return plist_first(&o->requests)->prio; |
124 | 124 | ||
125 | case PM_QOS_MAX: | 125 | case PM_QOS_MAX: |
126 | return plist_first(&o->requests)->prio; | 126 | return plist_last(&o->requests)->prio; |
127 | 127 | ||
128 | default: | 128 | default: |
129 | /* runtime check for not using enum */ | 129 | /* runtime check for not using enum */ |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 8dc31e02ae12..7a931a90e4a2 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -326,7 +326,6 @@ static int create_image(int platform_mode) | |||
326 | int hibernation_snapshot(int platform_mode) | 326 | int hibernation_snapshot(int platform_mode) |
327 | { | 327 | { |
328 | int error; | 328 | int error; |
329 | gfp_t saved_mask; | ||
330 | 329 | ||
331 | error = platform_begin(platform_mode); | 330 | error = platform_begin(platform_mode); |
332 | if (error) | 331 | if (error) |
@@ -338,7 +337,7 @@ int hibernation_snapshot(int platform_mode) | |||
338 | goto Close; | 337 | goto Close; |
339 | 338 | ||
340 | suspend_console(); | 339 | suspend_console(); |
341 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | 340 | pm_restrict_gfp_mask(); |
342 | error = dpm_suspend_start(PMSG_FREEZE); | 341 | error = dpm_suspend_start(PMSG_FREEZE); |
343 | if (error) | 342 | if (error) |
344 | goto Recover_platform; | 343 | goto Recover_platform; |
@@ -347,7 +346,10 @@ int hibernation_snapshot(int platform_mode) | |||
347 | goto Recover_platform; | 346 | goto Recover_platform; |
348 | 347 | ||
349 | error = create_image(platform_mode); | 348 | error = create_image(platform_mode); |
350 | /* Control returns here after successful restore */ | 349 | /* |
350 | * Control returns here (1) after the image has been created or the | ||
351 | * image creation has failed and (2) after a successful restore. | ||
352 | */ | ||
351 | 353 | ||
352 | Resume_devices: | 354 | Resume_devices: |
353 | /* We may need to release the preallocated image pages here. */ | 355 | /* We may need to release the preallocated image pages here. */ |
@@ -356,7 +358,10 @@ int hibernation_snapshot(int platform_mode) | |||
356 | 358 | ||
357 | dpm_resume_end(in_suspend ? | 359 | dpm_resume_end(in_suspend ? |
358 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 360 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
359 | set_gfp_allowed_mask(saved_mask); | 361 | |
362 | if (error || !in_suspend) | ||
363 | pm_restore_gfp_mask(); | ||
364 | |||
360 | resume_console(); | 365 | resume_console(); |
361 | Close: | 366 | Close: |
362 | platform_end(platform_mode); | 367 | platform_end(platform_mode); |
@@ -451,17 +456,16 @@ static int resume_target_kernel(bool platform_mode) | |||
451 | int hibernation_restore(int platform_mode) | 456 | int hibernation_restore(int platform_mode) |
452 | { | 457 | { |
453 | int error; | 458 | int error; |
454 | gfp_t saved_mask; | ||
455 | 459 | ||
456 | pm_prepare_console(); | 460 | pm_prepare_console(); |
457 | suspend_console(); | 461 | suspend_console(); |
458 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | 462 | pm_restrict_gfp_mask(); |
459 | error = dpm_suspend_start(PMSG_QUIESCE); | 463 | error = dpm_suspend_start(PMSG_QUIESCE); |
460 | if (!error) { | 464 | if (!error) { |
461 | error = resume_target_kernel(platform_mode); | 465 | error = resume_target_kernel(platform_mode); |
462 | dpm_resume_end(PMSG_RECOVER); | 466 | dpm_resume_end(PMSG_RECOVER); |
463 | } | 467 | } |
464 | set_gfp_allowed_mask(saved_mask); | 468 | pm_restore_gfp_mask(); |
465 | resume_console(); | 469 | resume_console(); |
466 | pm_restore_console(); | 470 | pm_restore_console(); |
467 | return error; | 471 | return error; |
@@ -475,7 +479,6 @@ int hibernation_restore(int platform_mode) | |||
475 | int hibernation_platform_enter(void) | 479 | int hibernation_platform_enter(void) |
476 | { | 480 | { |
477 | int error; | 481 | int error; |
478 | gfp_t saved_mask; | ||
479 | 482 | ||
480 | if (!hibernation_ops) | 483 | if (!hibernation_ops) |
481 | return -ENOSYS; | 484 | return -ENOSYS; |
@@ -491,7 +494,6 @@ int hibernation_platform_enter(void) | |||
491 | 494 | ||
492 | entering_platform_hibernation = true; | 495 | entering_platform_hibernation = true; |
493 | suspend_console(); | 496 | suspend_console(); |
494 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | ||
495 | error = dpm_suspend_start(PMSG_HIBERNATE); | 497 | error = dpm_suspend_start(PMSG_HIBERNATE); |
496 | if (error) { | 498 | if (error) { |
497 | if (hibernation_ops->recover) | 499 | if (hibernation_ops->recover) |
@@ -535,7 +537,6 @@ int hibernation_platform_enter(void) | |||
535 | Resume_devices: | 537 | Resume_devices: |
536 | entering_platform_hibernation = false; | 538 | entering_platform_hibernation = false; |
537 | dpm_resume_end(PMSG_RESTORE); | 539 | dpm_resume_end(PMSG_RESTORE); |
538 | set_gfp_allowed_mask(saved_mask); | ||
539 | resume_console(); | 540 | resume_console(); |
540 | 541 | ||
541 | Close: | 542 | Close: |
@@ -643,6 +644,7 @@ int hibernate(void) | |||
643 | swsusp_free(); | 644 | swsusp_free(); |
644 | if (!error) | 645 | if (!error) |
645 | power_down(); | 646 | power_down(); |
647 | pm_restore_gfp_mask(); | ||
646 | } else { | 648 | } else { |
647 | pr_debug("PM: Image restored successfully.\n"); | 649 | pr_debug("PM: Image restored successfully.\n"); |
648 | } | 650 | } |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 7335952ee473..ecf770509d0d 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -197,7 +197,6 @@ static int suspend_enter(suspend_state_t state) | |||
197 | int suspend_devices_and_enter(suspend_state_t state) | 197 | int suspend_devices_and_enter(suspend_state_t state) |
198 | { | 198 | { |
199 | int error; | 199 | int error; |
200 | gfp_t saved_mask; | ||
201 | 200 | ||
202 | if (!suspend_ops) | 201 | if (!suspend_ops) |
203 | return -ENOSYS; | 202 | return -ENOSYS; |
@@ -208,7 +207,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
208 | goto Close; | 207 | goto Close; |
209 | } | 208 | } |
210 | suspend_console(); | 209 | suspend_console(); |
211 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | 210 | pm_restrict_gfp_mask(); |
212 | suspend_test_start(); | 211 | suspend_test_start(); |
213 | error = dpm_suspend_start(PMSG_SUSPEND); | 212 | error = dpm_suspend_start(PMSG_SUSPEND); |
214 | if (error) { | 213 | if (error) { |
@@ -225,7 +224,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
225 | suspend_test_start(); | 224 | suspend_test_start(); |
226 | dpm_resume_end(PMSG_RESUME); | 225 | dpm_resume_end(PMSG_RESUME); |
227 | suspend_test_finish("resume devices"); | 226 | suspend_test_finish("resume devices"); |
228 | set_gfp_allowed_mask(saved_mask); | 227 | pm_restore_gfp_mask(); |
229 | resume_console(); | 228 | resume_console(); |
230 | Close: | 229 | Close: |
231 | if (suspend_ops->end) | 230 | if (suspend_ops->end) |
diff --git a/kernel/power/user.c b/kernel/power/user.c index e819e17877ca..c36c3b9e8a84 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -137,7 +137,7 @@ static int snapshot_release(struct inode *inode, struct file *filp) | |||
137 | free_all_swap_pages(data->swap); | 137 | free_all_swap_pages(data->swap); |
138 | if (data->frozen) | 138 | if (data->frozen) |
139 | thaw_processes(); | 139 | thaw_processes(); |
140 | pm_notifier_call_chain(data->mode == O_WRONLY ? | 140 | pm_notifier_call_chain(data->mode == O_RDONLY ? |
141 | PM_POST_HIBERNATION : PM_POST_RESTORE); | 141 | PM_POST_HIBERNATION : PM_POST_RESTORE); |
142 | atomic_inc(&snapshot_device_available); | 142 | atomic_inc(&snapshot_device_available); |
143 | 143 | ||
@@ -263,6 +263,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
263 | case SNAPSHOT_UNFREEZE: | 263 | case SNAPSHOT_UNFREEZE: |
264 | if (!data->frozen || data->ready) | 264 | if (!data->frozen || data->ready) |
265 | break; | 265 | break; |
266 | pm_restore_gfp_mask(); | ||
266 | thaw_processes(); | 267 | thaw_processes(); |
267 | usermodehelper_enable(); | 268 | usermodehelper_enable(); |
268 | data->frozen = 0; | 269 | data->frozen = 0; |
@@ -275,6 +276,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
275 | error = -EPERM; | 276 | error = -EPERM; |
276 | break; | 277 | break; |
277 | } | 278 | } |
279 | pm_restore_gfp_mask(); | ||
278 | error = hibernation_snapshot(data->platform_support); | 280 | error = hibernation_snapshot(data->platform_support); |
279 | if (!error) | 281 | if (!error) |
280 | error = put_user(in_suspend, (int __user *)arg); | 282 | error = put_user(in_suspend, (int __user *)arg); |
diff --git a/kernel/printk.c b/kernel/printk.c index 9dc8ea140426..2dc36b49d2d2 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1072,13 +1072,15 @@ void printk_tick(void) | |||
1072 | 1072 | ||
1073 | int printk_needs_cpu(int cpu) | 1073 | int printk_needs_cpu(int cpu) |
1074 | { | 1074 | { |
1075 | if (unlikely(cpu_is_offline(cpu))) | ||
1076 | printk_tick(); | ||
1075 | return per_cpu(printk_pending, cpu); | 1077 | return per_cpu(printk_pending, cpu); |
1076 | } | 1078 | } |
1077 | 1079 | ||
1078 | void wake_up_klogd(void) | 1080 | void wake_up_klogd(void) |
1079 | { | 1081 | { |
1080 | if (!trace_override && waitqueue_active(&log_wait)) | 1082 | if (!trace_override && waitqueue_active(&log_wait)) |
1081 | __raw_get_cpu_var(printk_pending) = 1; | 1083 | this_cpu_write(printk_pending, 1); |
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | /** | 1086 | /** |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index f34d798ef4a2..bf768d739e7d 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -313,7 +313,7 @@ int ptrace_detach(struct task_struct *child, unsigned int data) | |||
313 | child->exit_code = data; | 313 | child->exit_code = data; |
314 | dead = __ptrace_detach(current, child); | 314 | dead = __ptrace_detach(current, child); |
315 | if (!child->exit_state) | 315 | if (!child->exit_state) |
316 | wake_up_process(child); | 316 | wake_up_state(child, TASK_TRACED | TASK_STOPPED); |
317 | } | 317 | } |
318 | write_unlock_irq(&tasklist_lock); | 318 | write_unlock_irq(&tasklist_lock); |
319 | 319 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 093df593e45d..b3f2b4187859 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -583,7 +583,7 @@ void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags) | |||
583 | * cases. LITMUS^RT amplifies the effects of this problem. Hence, we | 583 | * cases. LITMUS^RT amplifies the effects of this problem. Hence, we |
584 | * turn it off to avoid stalling clocks. */ | 584 | * turn it off to avoid stalling clocks. */ |
585 | /* | 585 | /* |
586 | if (test_tsk_need_resched(p)) | 586 | if (rq->curr->se.on_rq && test_tsk_need_resched(p)) |
587 | rq->skip_clock_update = 1; | 587 | rq->skip_clock_update = 1; |
588 | */ | 588 | */ |
589 | } | 589 | } |
@@ -741,7 +741,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf, | |||
741 | size_t cnt, loff_t *ppos) | 741 | size_t cnt, loff_t *ppos) |
742 | { | 742 | { |
743 | char buf[64]; | 743 | char buf[64]; |
744 | char *cmp = buf; | 744 | char *cmp; |
745 | int neg = 0; | 745 | int neg = 0; |
746 | int i; | 746 | int i; |
747 | 747 | ||
@@ -752,6 +752,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf, | |||
752 | return -EFAULT; | 752 | return -EFAULT; |
753 | 753 | ||
754 | buf[cnt] = 0; | 754 | buf[cnt] = 0; |
755 | cmp = strstrip(buf); | ||
755 | 756 | ||
756 | if (strncmp(buf, "NO_", 3) == 0) { | 757 | if (strncmp(buf, "NO_", 3) == 0) { |
757 | neg = 1; | 758 | neg = 1; |
@@ -759,9 +760,7 @@ sched_feat_write(struct file *filp, const char __user *ubuf, | |||
759 | } | 760 | } |
760 | 761 | ||
761 | for (i = 0; sched_feat_names[i]; i++) { | 762 | for (i = 0; sched_feat_names[i]; i++) { |
762 | int len = strlen(sched_feat_names[i]); | 763 | if (strcmp(cmp, sched_feat_names[i]) == 0) { |
763 | |||
764 | if (strncmp(cmp, sched_feat_names[i], len) == 0) { | ||
765 | if (neg) | 764 | if (neg) |
766 | sysctl_sched_features &= ~(1UL << i); | 765 | sysctl_sched_features &= ~(1UL << i); |
767 | else | 766 | else |
@@ -1877,12 +1876,6 @@ static void dec_nr_running(struct rq *rq) | |||
1877 | 1876 | ||
1878 | static void set_load_weight(struct task_struct *p) | 1877 | static void set_load_weight(struct task_struct *p) |
1879 | { | 1878 | { |
1880 | if (task_has_rt_policy(p)) { | ||
1881 | p->se.load.weight = 0; | ||
1882 | p->se.load.inv_weight = WMULT_CONST; | ||
1883 | return; | ||
1884 | } | ||
1885 | |||
1886 | /* | 1879 | /* |
1887 | * SCHED_IDLE tasks get minimal weight: | 1880 | * SCHED_IDLE tasks get minimal weight: |
1888 | */ | 1881 | */ |
@@ -3011,6 +3004,15 @@ static long calc_load_fold_active(struct rq *this_rq) | |||
3011 | return delta; | 3004 | return delta; |
3012 | } | 3005 | } |
3013 | 3006 | ||
3007 | static unsigned long | ||
3008 | calc_load(unsigned long load, unsigned long exp, unsigned long active) | ||
3009 | { | ||
3010 | load *= exp; | ||
3011 | load += active * (FIXED_1 - exp); | ||
3012 | load += 1UL << (FSHIFT - 1); | ||
3013 | return load >> FSHIFT; | ||
3014 | } | ||
3015 | |||
3014 | #ifdef CONFIG_NO_HZ | 3016 | #ifdef CONFIG_NO_HZ |
3015 | /* | 3017 | /* |
3016 | * For NO_HZ we delay the active fold to the next LOAD_FREQ update. | 3018 | * For NO_HZ we delay the active fold to the next LOAD_FREQ update. |
@@ -3040,6 +3042,128 @@ static long calc_load_fold_idle(void) | |||
3040 | 3042 | ||
3041 | return delta; | 3043 | return delta; |
3042 | } | 3044 | } |
3045 | |||
3046 | /** | ||
3047 | * fixed_power_int - compute: x^n, in O(log n) time | ||
3048 | * | ||
3049 | * @x: base of the power | ||
3050 | * @frac_bits: fractional bits of @x | ||
3051 | * @n: power to raise @x to. | ||
3052 | * | ||
3053 | * By exploiting the relation between the definition of the natural power | ||
3054 | * function: x^n := x*x*...*x (x multiplied by itself for n times), and | ||
3055 | * the binary encoding of numbers used by computers: n := \Sum n_i * 2^i, | ||
3056 | * (where: n_i \elem {0, 1}, the binary vector representing n), | ||
3057 | * we find: x^n := x^(\Sum n_i * 2^i) := \Prod x^(n_i * 2^i), which is | ||
3058 | * of course trivially computable in O(log_2 n), the length of our binary | ||
3059 | * vector. | ||
3060 | */ | ||
3061 | static unsigned long | ||
3062 | fixed_power_int(unsigned long x, unsigned int frac_bits, unsigned int n) | ||
3063 | { | ||
3064 | unsigned long result = 1UL << frac_bits; | ||
3065 | |||
3066 | if (n) for (;;) { | ||
3067 | if (n & 1) { | ||
3068 | result *= x; | ||
3069 | result += 1UL << (frac_bits - 1); | ||
3070 | result >>= frac_bits; | ||
3071 | } | ||
3072 | n >>= 1; | ||
3073 | if (!n) | ||
3074 | break; | ||
3075 | x *= x; | ||
3076 | x += 1UL << (frac_bits - 1); | ||
3077 | x >>= frac_bits; | ||
3078 | } | ||
3079 | |||
3080 | return result; | ||
3081 | } | ||
3082 | |||
3083 | /* | ||
3084 | * a1 = a0 * e + a * (1 - e) | ||
3085 | * | ||
3086 | * a2 = a1 * e + a * (1 - e) | ||
3087 | * = (a0 * e + a * (1 - e)) * e + a * (1 - e) | ||
3088 | * = a0 * e^2 + a * (1 - e) * (1 + e) | ||
3089 | * | ||
3090 | * a3 = a2 * e + a * (1 - e) | ||
3091 | * = (a0 * e^2 + a * (1 - e) * (1 + e)) * e + a * (1 - e) | ||
3092 | * = a0 * e^3 + a * (1 - e) * (1 + e + e^2) | ||
3093 | * | ||
3094 | * ... | ||
3095 | * | ||
3096 | * an = a0 * e^n + a * (1 - e) * (1 + e + ... + e^n-1) [1] | ||
3097 | * = a0 * e^n + a * (1 - e) * (1 - e^n)/(1 - e) | ||
3098 | * = a0 * e^n + a * (1 - e^n) | ||
3099 | * | ||
3100 | * [1] application of the geometric series: | ||
3101 | * | ||
3102 | * n 1 - x^(n+1) | ||
3103 | * S_n := \Sum x^i = ------------- | ||
3104 | * i=0 1 - x | ||
3105 | */ | ||
3106 | static unsigned long | ||
3107 | calc_load_n(unsigned long load, unsigned long exp, | ||
3108 | unsigned long active, unsigned int n) | ||
3109 | { | ||
3110 | |||
3111 | return calc_load(load, fixed_power_int(exp, FSHIFT, n), active); | ||
3112 | } | ||
3113 | |||
3114 | /* | ||
3115 | * NO_HZ can leave us missing all per-cpu ticks calling | ||
3116 | * calc_load_account_active(), but since an idle CPU folds its delta into | ||
3117 | * calc_load_tasks_idle per calc_load_account_idle(), all we need to do is fold | ||
3118 | * in the pending idle delta if our idle period crossed a load cycle boundary. | ||
3119 | * | ||
3120 | * Once we've updated the global active value, we need to apply the exponential | ||
3121 | * weights adjusted to the number of cycles missed. | ||
3122 | */ | ||
3123 | static void calc_global_nohz(unsigned long ticks) | ||
3124 | { | ||
3125 | long delta, active, n; | ||
3126 | |||
3127 | if (time_before(jiffies, calc_load_update)) | ||
3128 | return; | ||
3129 | |||
3130 | /* | ||
3131 | * If we crossed a calc_load_update boundary, make sure to fold | ||
3132 | * any pending idle changes, the respective CPUs might have | ||
3133 | * missed the tick driven calc_load_account_active() update | ||
3134 | * due to NO_HZ. | ||
3135 | */ | ||
3136 | delta = calc_load_fold_idle(); | ||
3137 | if (delta) | ||
3138 | atomic_long_add(delta, &calc_load_tasks); | ||
3139 | |||
3140 | /* | ||
3141 | * If we were idle for multiple load cycles, apply them. | ||
3142 | */ | ||
3143 | if (ticks >= LOAD_FREQ) { | ||
3144 | n = ticks / LOAD_FREQ; | ||
3145 | |||
3146 | active = atomic_long_read(&calc_load_tasks); | ||
3147 | active = active > 0 ? active * FIXED_1 : 0; | ||
3148 | |||
3149 | avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n); | ||
3150 | avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n); | ||
3151 | avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n); | ||
3152 | |||
3153 | calc_load_update += n * LOAD_FREQ; | ||
3154 | } | ||
3155 | |||
3156 | /* | ||
3157 | * Its possible the remainder of the above division also crosses | ||
3158 | * a LOAD_FREQ period, the regular check in calc_global_load() | ||
3159 | * which comes after this will take care of that. | ||
3160 | * | ||
3161 | * Consider us being 11 ticks before a cycle completion, and us | ||
3162 | * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will | ||
3163 | * age us 4 cycles, and the test in calc_global_load() will | ||
3164 | * pick up the final one. | ||
3165 | */ | ||
3166 | } | ||
3043 | #else | 3167 | #else |
3044 | static void calc_load_account_idle(struct rq *this_rq) | 3168 | static void calc_load_account_idle(struct rq *this_rq) |
3045 | { | 3169 | { |
@@ -3049,6 +3173,10 @@ static inline long calc_load_fold_idle(void) | |||
3049 | { | 3173 | { |
3050 | return 0; | 3174 | return 0; |
3051 | } | 3175 | } |
3176 | |||
3177 | static void calc_global_nohz(unsigned long ticks) | ||
3178 | { | ||
3179 | } | ||
3052 | #endif | 3180 | #endif |
3053 | 3181 | ||
3054 | /** | 3182 | /** |
@@ -3066,24 +3194,17 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift) | |||
3066 | loads[2] = (avenrun[2] + offset) << shift; | 3194 | loads[2] = (avenrun[2] + offset) << shift; |
3067 | } | 3195 | } |
3068 | 3196 | ||
3069 | static unsigned long | ||
3070 | calc_load(unsigned long load, unsigned long exp, unsigned long active) | ||
3071 | { | ||
3072 | load *= exp; | ||
3073 | load += active * (FIXED_1 - exp); | ||
3074 | return load >> FSHIFT; | ||
3075 | } | ||
3076 | |||
3077 | /* | 3197 | /* |
3078 | * calc_load - update the avenrun load estimates 10 ticks after the | 3198 | * calc_load - update the avenrun load estimates 10 ticks after the |
3079 | * CPUs have updated calc_load_tasks. | 3199 | * CPUs have updated calc_load_tasks. |
3080 | */ | 3200 | */ |
3081 | void calc_global_load(void) | 3201 | void calc_global_load(unsigned long ticks) |
3082 | { | 3202 | { |
3083 | unsigned long upd = calc_load_update + 10; | ||
3084 | long active; | 3203 | long active; |
3085 | 3204 | ||
3086 | if (time_before(jiffies, upd)) | 3205 | calc_global_nohz(ticks); |
3206 | |||
3207 | if (time_before(jiffies, calc_load_update + 10)) | ||
3087 | return; | 3208 | return; |
3088 | 3209 | ||
3089 | active = atomic_long_read(&calc_load_tasks); | 3210 | active = atomic_long_read(&calc_load_tasks); |
@@ -3745,7 +3866,6 @@ static void put_prev_task(struct rq *rq, struct task_struct *prev) | |||
3745 | { | 3866 | { |
3746 | if (prev->se.on_rq) | 3867 | if (prev->se.on_rq) |
3747 | update_rq_clock(rq); | 3868 | update_rq_clock(rq); |
3748 | rq->skip_clock_update = 0; | ||
3749 | prev->sched_class->put_prev_task(rq, prev); | 3869 | prev->sched_class->put_prev_task(rq, prev); |
3750 | } | 3870 | } |
3751 | 3871 | ||
@@ -3821,7 +3941,6 @@ need_resched_nonpreemptible: | |||
3821 | hrtick_clear(rq); | 3941 | hrtick_clear(rq); |
3822 | 3942 | ||
3823 | raw_spin_lock_irq(&rq->lock); | 3943 | raw_spin_lock_irq(&rq->lock); |
3824 | clear_tsk_need_resched(prev); | ||
3825 | 3944 | ||
3826 | switch_count = &prev->nivcsw; | 3945 | switch_count = &prev->nivcsw; |
3827 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { | 3946 | if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { |
@@ -3853,6 +3972,8 @@ need_resched_nonpreemptible: | |||
3853 | 3972 | ||
3854 | put_prev_task(rq, prev); | 3973 | put_prev_task(rq, prev); |
3855 | next = pick_next_task(rq); | 3974 | next = pick_next_task(rq); |
3975 | clear_tsk_need_resched(prev); | ||
3976 | rq->skip_clock_update = 0; | ||
3856 | 3977 | ||
3857 | if (likely(prev != next)) { | 3978 | if (likely(prev != next)) { |
3858 | sched_info_switch(prev, next); | 3979 | sched_info_switch(prev, next); |
@@ -5439,7 +5560,19 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
5439 | idle->se.exec_start = sched_clock(); | 5560 | idle->se.exec_start = sched_clock(); |
5440 | 5561 | ||
5441 | cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); | 5562 | cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); |
5563 | /* | ||
5564 | * We're having a chicken and egg problem, even though we are | ||
5565 | * holding rq->lock, the cpu isn't yet set to this cpu so the | ||
5566 | * lockdep check in task_group() will fail. | ||
5567 | * | ||
5568 | * Similar case to sched_fork(). / Alternatively we could | ||
5569 | * use task_rq_lock() here and obtain the other rq->lock. | ||
5570 | * | ||
5571 | * Silence PROVE_RCU | ||
5572 | */ | ||
5573 | rcu_read_lock(); | ||
5442 | __set_task_cpu(idle, cpu); | 5574 | __set_task_cpu(idle, cpu); |
5575 | rcu_read_unlock(); | ||
5443 | 5576 | ||
5444 | rq->curr = rq->idle = idle; | 5577 | rq->curr = rq->idle = idle; |
5445 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) | 5578 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) |
diff --git a/kernel/smp.c b/kernel/smp.c index ed6aacfcb7ef..1ba1ba4b42f8 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -194,6 +194,24 @@ void generic_smp_call_function_interrupt(void) | |||
194 | list_for_each_entry_rcu(data, &call_function.queue, csd.list) { | 194 | list_for_each_entry_rcu(data, &call_function.queue, csd.list) { |
195 | int refs; | 195 | int refs; |
196 | 196 | ||
197 | /* | ||
198 | * Since we walk the list without any locks, we might | ||
199 | * see an entry that was completed, removed from the | ||
200 | * list and is in the process of being reused. | ||
201 | * | ||
202 | * We must check that the cpu is in the cpumask before | ||
203 | * checking the refs, and both must be set before | ||
204 | * executing the callback on this cpu. | ||
205 | */ | ||
206 | |||
207 | if (!cpumask_test_cpu(cpu, data->cpumask)) | ||
208 | continue; | ||
209 | |||
210 | smp_rmb(); | ||
211 | |||
212 | if (atomic_read(&data->refs) == 0) | ||
213 | continue; | ||
214 | |||
197 | if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) | 215 | if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) |
198 | continue; | 216 | continue; |
199 | 217 | ||
@@ -202,6 +220,8 @@ void generic_smp_call_function_interrupt(void) | |||
202 | refs = atomic_dec_return(&data->refs); | 220 | refs = atomic_dec_return(&data->refs); |
203 | WARN_ON(refs < 0); | 221 | WARN_ON(refs < 0); |
204 | if (!refs) { | 222 | if (!refs) { |
223 | WARN_ON(!cpumask_empty(data->cpumask)); | ||
224 | |||
205 | raw_spin_lock(&call_function.lock); | 225 | raw_spin_lock(&call_function.lock); |
206 | list_del_rcu(&data->csd.list); | 226 | list_del_rcu(&data->csd.list); |
207 | raw_spin_unlock(&call_function.lock); | 227 | raw_spin_unlock(&call_function.lock); |
@@ -453,11 +473,21 @@ void smp_call_function_many(const struct cpumask *mask, | |||
453 | 473 | ||
454 | data = &__get_cpu_var(cfd_data); | 474 | data = &__get_cpu_var(cfd_data); |
455 | csd_lock(&data->csd); | 475 | csd_lock(&data->csd); |
476 | BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask)); | ||
456 | 477 | ||
457 | data->csd.func = func; | 478 | data->csd.func = func; |
458 | data->csd.info = info; | 479 | data->csd.info = info; |
459 | cpumask_and(data->cpumask, mask, cpu_online_mask); | 480 | cpumask_and(data->cpumask, mask, cpu_online_mask); |
460 | cpumask_clear_cpu(this_cpu, data->cpumask); | 481 | cpumask_clear_cpu(this_cpu, data->cpumask); |
482 | |||
483 | /* | ||
484 | * To ensure the interrupt handler gets an complete view | ||
485 | * we order the cpumask and refs writes and order the read | ||
486 | * of them in the interrupt handler. In addition we may | ||
487 | * only clear our own cpu bit from the mask. | ||
488 | */ | ||
489 | smp_wmb(); | ||
490 | |||
461 | atomic_set(&data->refs, cpumask_weight(data->cpumask)); | 491 | atomic_set(&data->refs, cpumask_weight(data->cpumask)); |
462 | 492 | ||
463 | raw_spin_lock_irqsave(&call_function.lock, flags); | 493 | raw_spin_lock_irqsave(&call_function.lock, flags); |
diff --git a/kernel/sys.c b/kernel/sys.c index 7f5a0cd296a9..66136ca33a7b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1377,7 +1377,8 @@ static int check_prlimit_permission(struct task_struct *task) | |||
1377 | const struct cred *cred = current_cred(), *tcred; | 1377 | const struct cred *cred = current_cred(), *tcred; |
1378 | 1378 | ||
1379 | tcred = __task_cred(task); | 1379 | tcred = __task_cred(task); |
1380 | if ((cred->uid != tcred->euid || | 1380 | if (current != task && |
1381 | (cred->uid != tcred->euid || | ||
1381 | cred->uid != tcred->suid || | 1382 | cred->uid != tcred->suid || |
1382 | cred->uid != tcred->uid || | 1383 | cred->uid != tcred->uid || |
1383 | cred->gid != tcred->egid || | 1384 | cred->gid != tcred->egid || |
diff --git a/kernel/timer.c b/kernel/timer.c index 97bf05baade7..102ad370dddb 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1252,6 +1252,12 @@ unsigned long get_next_timer_interrupt(unsigned long now) | |||
1252 | struct tvec_base *base = __get_cpu_var(tvec_bases); | 1252 | struct tvec_base *base = __get_cpu_var(tvec_bases); |
1253 | unsigned long expires; | 1253 | unsigned long expires; |
1254 | 1254 | ||
1255 | /* | ||
1256 | * Pretend that there is no timer pending if the cpu is offline. | ||
1257 | * Possible pending timers will be migrated later to an active cpu. | ||
1258 | */ | ||
1259 | if (cpu_is_offline(smp_processor_id())) | ||
1260 | return now + NEXT_TIMER_MAX_DELTA; | ||
1255 | spin_lock(&base->lock); | 1261 | spin_lock(&base->lock); |
1256 | if (time_before_eq(base->next_timer, base->timer_jiffies)) | 1262 | if (time_before_eq(base->next_timer, base->timer_jiffies)) |
1257 | base->next_timer = __next_timer_interrupt(base); | 1263 | base->next_timer = __next_timer_interrupt(base); |
@@ -1316,7 +1322,7 @@ void do_timer(unsigned long ticks) | |||
1316 | { | 1322 | { |
1317 | jiffies_64 += ticks; | 1323 | jiffies_64 += ticks; |
1318 | update_wall_time(); | 1324 | update_wall_time(); |
1319 | calc_global_load(); | 1325 | calc_global_load(ticks); |
1320 | } | 1326 | } |
1321 | 1327 | ||
1322 | #ifdef __ARCH_WANT_SYS_ALARM | 1328 | #ifdef __ARCH_WANT_SYS_ALARM |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 9ec59f541156..7702f5aecd07 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2320,11 +2320,19 @@ tracing_write_stub(struct file *filp, const char __user *ubuf, | |||
2320 | return count; | 2320 | return count; |
2321 | } | 2321 | } |
2322 | 2322 | ||
2323 | static loff_t tracing_seek(struct file *file, loff_t offset, int origin) | ||
2324 | { | ||
2325 | if (file->f_mode & FMODE_READ) | ||
2326 | return seq_lseek(file, offset, origin); | ||
2327 | else | ||
2328 | return 0; | ||
2329 | } | ||
2330 | |||
2323 | static const struct file_operations tracing_fops = { | 2331 | static const struct file_operations tracing_fops = { |
2324 | .open = tracing_open, | 2332 | .open = tracing_open, |
2325 | .read = seq_read, | 2333 | .read = seq_read, |
2326 | .write = tracing_write_stub, | 2334 | .write = tracing_write_stub, |
2327 | .llseek = seq_lseek, | 2335 | .llseek = tracing_seek, |
2328 | .release = tracing_release, | 2336 | .release = tracing_release, |
2329 | }; | 2337 | }; |
2330 | 2338 | ||
diff --git a/kernel/user.c b/kernel/user.c index 7e72614b736d..8ce395f74d47 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -157,6 +157,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid) | |||
157 | spin_lock_irq(&uidhash_lock); | 157 | spin_lock_irq(&uidhash_lock); |
158 | up = uid_hash_find(uid, hashent); | 158 | up = uid_hash_find(uid, hashent); |
159 | if (up) { | 159 | if (up) { |
160 | put_user_ns(ns); | ||
160 | key_put(new->uid_keyring); | 161 | key_put(new->uid_keyring); |
161 | key_put(new->session_keyring); | 162 | key_put(new->session_keyring); |
162 | kmem_cache_free(uid_cachep, new); | 163 | kmem_cache_free(uid_cachep, new); |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 7f9c3c52ecc1..e359b2e7e7d5 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -377,7 +377,8 @@ static int watchdog_nmi_enable(int cpu) | |||
377 | goto out_save; | 377 | goto out_save; |
378 | } | 378 | } |
379 | 379 | ||
380 | printk(KERN_ERR "NMI watchdog failed to create perf event on cpu%i: %p\n", cpu, event); | 380 | printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n", |
381 | cpu, PTR_ERR(event)); | ||
381 | return -1; | 382 | return -1; |
382 | 383 | ||
383 | /* success path */ | 384 | /* success path */ |
@@ -440,9 +441,6 @@ static int watchdog_enable(int cpu) | |||
440 | wake_up_process(p); | 441 | wake_up_process(p); |
441 | } | 442 | } |
442 | 443 | ||
443 | /* if any cpu succeeds, watchdog is considered enabled for the system */ | ||
444 | watchdog_enabled = 1; | ||
445 | |||
446 | return 0; | 444 | return 0; |
447 | } | 445 | } |
448 | 446 | ||
@@ -470,12 +468,16 @@ static void watchdog_disable(int cpu) | |||
470 | static void watchdog_enable_all_cpus(void) | 468 | static void watchdog_enable_all_cpus(void) |
471 | { | 469 | { |
472 | int cpu; | 470 | int cpu; |
473 | int result = 0; | 471 | |
472 | watchdog_enabled = 0; | ||
474 | 473 | ||
475 | for_each_online_cpu(cpu) | 474 | for_each_online_cpu(cpu) |
476 | result += watchdog_enable(cpu); | 475 | if (!watchdog_enable(cpu)) |
476 | /* if any cpu succeeds, watchdog is considered | ||
477 | enabled for the system */ | ||
478 | watchdog_enabled = 1; | ||
477 | 479 | ||
478 | if (result) | 480 | if (!watchdog_enabled) |
479 | printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n"); | 481 | printk(KERN_ERR "watchdog: failed to be enabled on some cpus\n"); |
480 | 482 | ||
481 | } | 483 | } |
@@ -503,10 +505,12 @@ int proc_dowatchdog_enabled(struct ctl_table *table, int write, | |||
503 | { | 505 | { |
504 | proc_dointvec(table, write, buffer, length, ppos); | 506 | proc_dointvec(table, write, buffer, length, ppos); |
505 | 507 | ||
506 | if (watchdog_enabled) | 508 | if (write) { |
507 | watchdog_enable_all_cpus(); | 509 | if (watchdog_enabled) |
508 | else | 510 | watchdog_enable_all_cpus(); |
509 | watchdog_disable_all_cpus(); | 511 | else |
512 | watchdog_disable_all_cpus(); | ||
513 | } | ||
510 | return 0; | 514 | return 0; |
511 | } | 515 | } |
512 | 516 | ||
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index ec9048e74f44..209448e1d2b9 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c | |||
@@ -76,6 +76,7 @@ int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, | |||
76 | if (!fbc->counters) | 76 | if (!fbc->counters) |
77 | return -ENOMEM; | 77 | return -ENOMEM; |
78 | #ifdef CONFIG_HOTPLUG_CPU | 78 | #ifdef CONFIG_HOTPLUG_CPU |
79 | INIT_LIST_HEAD(&fbc->list); | ||
79 | mutex_lock(&percpu_counters_lock); | 80 | mutex_lock(&percpu_counters_lock); |
80 | list_add(&fbc->list, &percpu_counters); | 81 | list_add(&fbc->list, &percpu_counters); |
81 | mutex_unlock(&percpu_counters_lock); | 82 | mutex_unlock(&percpu_counters_lock); |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index efd16fa80b1c..296eb8105cec 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -82,6 +82,16 @@ struct radix_tree_preload { | |||
82 | }; | 82 | }; |
83 | static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; | 83 | static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; |
84 | 84 | ||
85 | static inline void *ptr_to_indirect(void *ptr) | ||
86 | { | ||
87 | return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR); | ||
88 | } | ||
89 | |||
90 | static inline void *indirect_to_ptr(void *ptr) | ||
91 | { | ||
92 | return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR); | ||
93 | } | ||
94 | |||
85 | static inline gfp_t root_gfp_mask(struct radix_tree_root *root) | 95 | static inline gfp_t root_gfp_mask(struct radix_tree_root *root) |
86 | { | 96 | { |
87 | return root->gfp_mask & __GFP_BITS_MASK; | 97 | return root->gfp_mask & __GFP_BITS_MASK; |
@@ -265,7 +275,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
265 | return -ENOMEM; | 275 | return -ENOMEM; |
266 | 276 | ||
267 | /* Increase the height. */ | 277 | /* Increase the height. */ |
268 | node->slots[0] = radix_tree_indirect_to_ptr(root->rnode); | 278 | node->slots[0] = indirect_to_ptr(root->rnode); |
269 | 279 | ||
270 | /* Propagate the aggregated tag info into the new root */ | 280 | /* Propagate the aggregated tag info into the new root */ |
271 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { | 281 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
@@ -276,7 +286,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
276 | newheight = root->height+1; | 286 | newheight = root->height+1; |
277 | node->height = newheight; | 287 | node->height = newheight; |
278 | node->count = 1; | 288 | node->count = 1; |
279 | node = radix_tree_ptr_to_indirect(node); | 289 | node = ptr_to_indirect(node); |
280 | rcu_assign_pointer(root->rnode, node); | 290 | rcu_assign_pointer(root->rnode, node); |
281 | root->height = newheight; | 291 | root->height = newheight; |
282 | } while (height > root->height); | 292 | } while (height > root->height); |
@@ -309,7 +319,7 @@ int radix_tree_insert(struct radix_tree_root *root, | |||
309 | return error; | 319 | return error; |
310 | } | 320 | } |
311 | 321 | ||
312 | slot = radix_tree_indirect_to_ptr(root->rnode); | 322 | slot = indirect_to_ptr(root->rnode); |
313 | 323 | ||
314 | height = root->height; | 324 | height = root->height; |
315 | shift = (height-1) * RADIX_TREE_MAP_SHIFT; | 325 | shift = (height-1) * RADIX_TREE_MAP_SHIFT; |
@@ -325,8 +335,7 @@ int radix_tree_insert(struct radix_tree_root *root, | |||
325 | rcu_assign_pointer(node->slots[offset], slot); | 335 | rcu_assign_pointer(node->slots[offset], slot); |
326 | node->count++; | 336 | node->count++; |
327 | } else | 337 | } else |
328 | rcu_assign_pointer(root->rnode, | 338 | rcu_assign_pointer(root->rnode, ptr_to_indirect(slot)); |
329 | radix_tree_ptr_to_indirect(slot)); | ||
330 | } | 339 | } |
331 | 340 | ||
332 | /* Go a level down */ | 341 | /* Go a level down */ |
@@ -374,7 +383,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root, | |||
374 | return NULL; | 383 | return NULL; |
375 | return is_slot ? (void *)&root->rnode : node; | 384 | return is_slot ? (void *)&root->rnode : node; |
376 | } | 385 | } |
377 | node = radix_tree_indirect_to_ptr(node); | 386 | node = indirect_to_ptr(node); |
378 | 387 | ||
379 | height = node->height; | 388 | height = node->height; |
380 | if (index > radix_tree_maxindex(height)) | 389 | if (index > radix_tree_maxindex(height)) |
@@ -393,7 +402,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root, | |||
393 | height--; | 402 | height--; |
394 | } while (height > 0); | 403 | } while (height > 0); |
395 | 404 | ||
396 | return is_slot ? (void *)slot:node; | 405 | return is_slot ? (void *)slot : indirect_to_ptr(node); |
397 | } | 406 | } |
398 | 407 | ||
399 | /** | 408 | /** |
@@ -455,7 +464,7 @@ void *radix_tree_tag_set(struct radix_tree_root *root, | |||
455 | height = root->height; | 464 | height = root->height; |
456 | BUG_ON(index > radix_tree_maxindex(height)); | 465 | BUG_ON(index > radix_tree_maxindex(height)); |
457 | 466 | ||
458 | slot = radix_tree_indirect_to_ptr(root->rnode); | 467 | slot = indirect_to_ptr(root->rnode); |
459 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; | 468 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
460 | 469 | ||
461 | while (height > 0) { | 470 | while (height > 0) { |
@@ -509,7 +518,7 @@ void *radix_tree_tag_clear(struct radix_tree_root *root, | |||
509 | 518 | ||
510 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; | 519 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
511 | pathp->node = NULL; | 520 | pathp->node = NULL; |
512 | slot = radix_tree_indirect_to_ptr(root->rnode); | 521 | slot = indirect_to_ptr(root->rnode); |
513 | 522 | ||
514 | while (height > 0) { | 523 | while (height > 0) { |
515 | int offset; | 524 | int offset; |
@@ -579,7 +588,7 @@ int radix_tree_tag_get(struct radix_tree_root *root, | |||
579 | 588 | ||
580 | if (!radix_tree_is_indirect_ptr(node)) | 589 | if (!radix_tree_is_indirect_ptr(node)) |
581 | return (index == 0); | 590 | return (index == 0); |
582 | node = radix_tree_indirect_to_ptr(node); | 591 | node = indirect_to_ptr(node); |
583 | 592 | ||
584 | height = node->height; | 593 | height = node->height; |
585 | if (index > radix_tree_maxindex(height)) | 594 | if (index > radix_tree_maxindex(height)) |
@@ -666,7 +675,7 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, | |||
666 | } | 675 | } |
667 | 676 | ||
668 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; | 677 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
669 | slot = radix_tree_indirect_to_ptr(root->rnode); | 678 | slot = indirect_to_ptr(root->rnode); |
670 | 679 | ||
671 | /* | 680 | /* |
672 | * we fill the path from (root->height - 2) to 0, leaving the index at | 681 | * we fill the path from (root->height - 2) to 0, leaving the index at |
@@ -897,7 +906,7 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | |||
897 | results[0] = node; | 906 | results[0] = node; |
898 | return 1; | 907 | return 1; |
899 | } | 908 | } |
900 | node = radix_tree_indirect_to_ptr(node); | 909 | node = indirect_to_ptr(node); |
901 | 910 | ||
902 | max_index = radix_tree_maxindex(node->height); | 911 | max_index = radix_tree_maxindex(node->height); |
903 | 912 | ||
@@ -916,7 +925,8 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | |||
916 | slot = *(((void ***)results)[ret + i]); | 925 | slot = *(((void ***)results)[ret + i]); |
917 | if (!slot) | 926 | if (!slot) |
918 | continue; | 927 | continue; |
919 | results[ret + nr_found] = rcu_dereference_raw(slot); | 928 | results[ret + nr_found] = |
929 | indirect_to_ptr(rcu_dereference_raw(slot)); | ||
920 | nr_found++; | 930 | nr_found++; |
921 | } | 931 | } |
922 | ret += nr_found; | 932 | ret += nr_found; |
@@ -965,7 +975,7 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, | |||
965 | results[0] = (void **)&root->rnode; | 975 | results[0] = (void **)&root->rnode; |
966 | return 1; | 976 | return 1; |
967 | } | 977 | } |
968 | node = radix_tree_indirect_to_ptr(node); | 978 | node = indirect_to_ptr(node); |
969 | 979 | ||
970 | max_index = radix_tree_maxindex(node->height); | 980 | max_index = radix_tree_maxindex(node->height); |
971 | 981 | ||
@@ -1090,7 +1100,7 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | |||
1090 | results[0] = node; | 1100 | results[0] = node; |
1091 | return 1; | 1101 | return 1; |
1092 | } | 1102 | } |
1093 | node = radix_tree_indirect_to_ptr(node); | 1103 | node = indirect_to_ptr(node); |
1094 | 1104 | ||
1095 | max_index = radix_tree_maxindex(node->height); | 1105 | max_index = radix_tree_maxindex(node->height); |
1096 | 1106 | ||
@@ -1109,7 +1119,8 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | |||
1109 | slot = *(((void ***)results)[ret + i]); | 1119 | slot = *(((void ***)results)[ret + i]); |
1110 | if (!slot) | 1120 | if (!slot) |
1111 | continue; | 1121 | continue; |
1112 | results[ret + nr_found] = rcu_dereference_raw(slot); | 1122 | results[ret + nr_found] = |
1123 | indirect_to_ptr(rcu_dereference_raw(slot)); | ||
1113 | nr_found++; | 1124 | nr_found++; |
1114 | } | 1125 | } |
1115 | ret += nr_found; | 1126 | ret += nr_found; |
@@ -1159,7 +1170,7 @@ radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, | |||
1159 | results[0] = (void **)&root->rnode; | 1170 | results[0] = (void **)&root->rnode; |
1160 | return 1; | 1171 | return 1; |
1161 | } | 1172 | } |
1162 | node = radix_tree_indirect_to_ptr(node); | 1173 | node = indirect_to_ptr(node); |
1163 | 1174 | ||
1164 | max_index = radix_tree_maxindex(node->height); | 1175 | max_index = radix_tree_maxindex(node->height); |
1165 | 1176 | ||
@@ -1195,7 +1206,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) | |||
1195 | void *newptr; | 1206 | void *newptr; |
1196 | 1207 | ||
1197 | BUG_ON(!radix_tree_is_indirect_ptr(to_free)); | 1208 | BUG_ON(!radix_tree_is_indirect_ptr(to_free)); |
1198 | to_free = radix_tree_indirect_to_ptr(to_free); | 1209 | to_free = indirect_to_ptr(to_free); |
1199 | 1210 | ||
1200 | /* | 1211 | /* |
1201 | * The candidate node has more than one child, or its child | 1212 | * The candidate node has more than one child, or its child |
@@ -1208,16 +1219,39 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) | |||
1208 | 1219 | ||
1209 | /* | 1220 | /* |
1210 | * We don't need rcu_assign_pointer(), since we are simply | 1221 | * We don't need rcu_assign_pointer(), since we are simply |
1211 | * moving the node from one part of the tree to another. If | 1222 | * moving the node from one part of the tree to another: if it |
1212 | * it was safe to dereference the old pointer to it | 1223 | * was safe to dereference the old pointer to it |
1213 | * (to_free->slots[0]), it will be safe to dereference the new | 1224 | * (to_free->slots[0]), it will be safe to dereference the new |
1214 | * one (root->rnode). | 1225 | * one (root->rnode) as far as dependent read barriers go. |
1215 | */ | 1226 | */ |
1216 | newptr = to_free->slots[0]; | 1227 | newptr = to_free->slots[0]; |
1217 | if (root->height > 1) | 1228 | if (root->height > 1) |
1218 | newptr = radix_tree_ptr_to_indirect(newptr); | 1229 | newptr = ptr_to_indirect(newptr); |
1219 | root->rnode = newptr; | 1230 | root->rnode = newptr; |
1220 | root->height--; | 1231 | root->height--; |
1232 | |||
1233 | /* | ||
1234 | * We have a dilemma here. The node's slot[0] must not be | ||
1235 | * NULLed in case there are concurrent lookups expecting to | ||
1236 | * find the item. However if this was a bottom-level node, | ||
1237 | * then it may be subject to the slot pointer being visible | ||
1238 | * to callers dereferencing it. If item corresponding to | ||
1239 | * slot[0] is subsequently deleted, these callers would expect | ||
1240 | * their slot to become empty sooner or later. | ||
1241 | * | ||
1242 | * For example, lockless pagecache will look up a slot, deref | ||
1243 | * the page pointer, and if the page is 0 refcount it means it | ||
1244 | * was concurrently deleted from pagecache so try the deref | ||
1245 | * again. Fortunately there is already a requirement for logic | ||
1246 | * to retry the entire slot lookup -- the indirect pointer | ||
1247 | * problem (replacing direct root node with an indirect pointer | ||
1248 | * also results in a stale slot). So tag the slot as indirect | ||
1249 | * to force callers to retry. | ||
1250 | */ | ||
1251 | if (root->height == 0) | ||
1252 | *((unsigned long *)&to_free->slots[0]) |= | ||
1253 | RADIX_TREE_INDIRECT_PTR; | ||
1254 | |||
1221 | radix_tree_node_free(to_free); | 1255 | radix_tree_node_free(to_free); |
1222 | } | 1256 | } |
1223 | } | 1257 | } |
@@ -1254,7 +1288,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
1254 | root->rnode = NULL; | 1288 | root->rnode = NULL; |
1255 | goto out; | 1289 | goto out; |
1256 | } | 1290 | } |
1257 | slot = radix_tree_indirect_to_ptr(slot); | 1291 | slot = indirect_to_ptr(slot); |
1258 | 1292 | ||
1259 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; | 1293 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
1260 | pathp->node = NULL; | 1294 | pathp->node = NULL; |
@@ -1296,8 +1330,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
1296 | radix_tree_node_free(to_free); | 1330 | radix_tree_node_free(to_free); |
1297 | 1331 | ||
1298 | if (pathp->node->count) { | 1332 | if (pathp->node->count) { |
1299 | if (pathp->node == | 1333 | if (pathp->node == indirect_to_ptr(root->rnode)) |
1300 | radix_tree_indirect_to_ptr(root->rnode)) | ||
1301 | radix_tree_shrink(root); | 1334 | radix_tree_shrink(root); |
1302 | goto out; | 1335 | goto out; |
1303 | } | 1336 | } |
diff --git a/mm/filemap.c b/mm/filemap.c index 3d4df44e4221..9701a501f769 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -631,7 +631,9 @@ repeat: | |||
631 | pagep = radix_tree_lookup_slot(&mapping->page_tree, offset); | 631 | pagep = radix_tree_lookup_slot(&mapping->page_tree, offset); |
632 | if (pagep) { | 632 | if (pagep) { |
633 | page = radix_tree_deref_slot(pagep); | 633 | page = radix_tree_deref_slot(pagep); |
634 | if (unlikely(!page || page == RADIX_TREE_RETRY)) | 634 | if (unlikely(!page)) |
635 | goto out; | ||
636 | if (radix_tree_deref_retry(page)) | ||
635 | goto repeat; | 637 | goto repeat; |
636 | 638 | ||
637 | if (!page_cache_get_speculative(page)) | 639 | if (!page_cache_get_speculative(page)) |
@@ -647,6 +649,7 @@ repeat: | |||
647 | goto repeat; | 649 | goto repeat; |
648 | } | 650 | } |
649 | } | 651 | } |
652 | out: | ||
650 | rcu_read_unlock(); | 653 | rcu_read_unlock(); |
651 | 654 | ||
652 | return page; | 655 | return page; |
@@ -764,12 +767,11 @@ repeat: | |||
764 | page = radix_tree_deref_slot((void **)pages[i]); | 767 | page = radix_tree_deref_slot((void **)pages[i]); |
765 | if (unlikely(!page)) | 768 | if (unlikely(!page)) |
766 | continue; | 769 | continue; |
767 | /* | 770 | if (radix_tree_deref_retry(page)) { |
768 | * this can only trigger if nr_found == 1, making livelock | 771 | if (ret) |
769 | * a non issue. | 772 | start = pages[ret-1]->index; |
770 | */ | ||
771 | if (unlikely(page == RADIX_TREE_RETRY)) | ||
772 | goto restart; | 773 | goto restart; |
774 | } | ||
773 | 775 | ||
774 | if (!page_cache_get_speculative(page)) | 776 | if (!page_cache_get_speculative(page)) |
775 | goto repeat; | 777 | goto repeat; |
@@ -817,11 +819,7 @@ repeat: | |||
817 | page = radix_tree_deref_slot((void **)pages[i]); | 819 | page = radix_tree_deref_slot((void **)pages[i]); |
818 | if (unlikely(!page)) | 820 | if (unlikely(!page)) |
819 | continue; | 821 | continue; |
820 | /* | 822 | if (radix_tree_deref_retry(page)) |
821 | * this can only trigger if nr_found == 1, making livelock | ||
822 | * a non issue. | ||
823 | */ | ||
824 | if (unlikely(page == RADIX_TREE_RETRY)) | ||
825 | goto restart; | 823 | goto restart; |
826 | 824 | ||
827 | if (page->mapping == NULL || page->index != index) | 825 | if (page->mapping == NULL || page->index != index) |
@@ -874,11 +872,7 @@ repeat: | |||
874 | page = radix_tree_deref_slot((void **)pages[i]); | 872 | page = radix_tree_deref_slot((void **)pages[i]); |
875 | if (unlikely(!page)) | 873 | if (unlikely(!page)) |
876 | continue; | 874 | continue; |
877 | /* | 875 | if (radix_tree_deref_retry(page)) |
878 | * this can only trigger if nr_found == 1, making livelock | ||
879 | * a non issue. | ||
880 | */ | ||
881 | if (unlikely(page == RADIX_TREE_RETRY)) | ||
882 | goto restart; | 876 | goto restart; |
883 | 877 | ||
884 | if (!page_cache_get_speculative(page)) | 878 | if (!page_cache_get_speculative(page)) |
@@ -1016,6 +1010,9 @@ find_page: | |||
1016 | goto page_not_up_to_date; | 1010 | goto page_not_up_to_date; |
1017 | if (!trylock_page(page)) | 1011 | if (!trylock_page(page)) |
1018 | goto page_not_up_to_date; | 1012 | goto page_not_up_to_date; |
1013 | /* Did it get truncated before we got the lock? */ | ||
1014 | if (!page->mapping) | ||
1015 | goto page_not_up_to_date_locked; | ||
1019 | if (!mapping->a_ops->is_partially_uptodate(page, | 1016 | if (!mapping->a_ops->is_partially_uptodate(page, |
1020 | desc, offset)) | 1017 | desc, offset)) |
1021 | goto page_not_up_to_date_locked; | 1018 | goto page_not_up_to_date_locked; |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c03273807182..2697806746d0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2380,8 +2380,11 @@ retry_avoidcopy: | |||
2380 | * When the original hugepage is shared one, it does not have | 2380 | * When the original hugepage is shared one, it does not have |
2381 | * anon_vma prepared. | 2381 | * anon_vma prepared. |
2382 | */ | 2382 | */ |
2383 | if (unlikely(anon_vma_prepare(vma))) | 2383 | if (unlikely(anon_vma_prepare(vma))) { |
2384 | /* Caller expects lock to be held */ | ||
2385 | spin_lock(&mm->page_table_lock); | ||
2384 | return VM_FAULT_OOM; | 2386 | return VM_FAULT_OOM; |
2387 | } | ||
2385 | 2388 | ||
2386 | copy_huge_page(new_page, old_page, address, vma); | 2389 | copy_huge_page(new_page, old_page, address, vma); |
2387 | __SetPageUptodate(new_page); | 2390 | __SetPageUptodate(new_page); |
@@ -2665,7 +2668,8 @@ out_page_table_lock: | |||
2665 | unlock_page(pagecache_page); | 2668 | unlock_page(pagecache_page); |
2666 | put_page(pagecache_page); | 2669 | put_page(pagecache_page); |
2667 | } | 2670 | } |
2668 | unlock_page(page); | 2671 | if (page != pagecache_page) |
2672 | unlock_page(page); | ||
2669 | 2673 | ||
2670 | out_mutex: | 2674 | out_mutex: |
2671 | mutex_unlock(&hugetlb_instantiation_mutex); | 2675 | mutex_unlock(&hugetlb_instantiation_mutex); |
diff --git a/mm/internal.h b/mm/internal.h index 6a697bb97fc5..dedb0aff673f 100644 --- a/mm/internal.h +++ b/mm/internal.h | |||
@@ -62,7 +62,7 @@ extern bool is_free_buddy_page(struct page *page); | |||
62 | */ | 62 | */ |
63 | static inline unsigned long page_order(struct page *page) | 63 | static inline unsigned long page_order(struct page *page) |
64 | { | 64 | { |
65 | VM_BUG_ON(!PageBuddy(page)); | 65 | /* PageBuddy() must be checked by the caller */ |
66 | return page_private(page); | 66 | return page_private(page); |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9be3cf8a5da4..a9a534a38ac0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -269,13 +269,14 @@ enum move_type { | |||
269 | 269 | ||
270 | /* "mc" and its members are protected by cgroup_mutex */ | 270 | /* "mc" and its members are protected by cgroup_mutex */ |
271 | static struct move_charge_struct { | 271 | static struct move_charge_struct { |
272 | spinlock_t lock; /* for from, to, moving_task */ | 272 | spinlock_t lock; /* for from, to */ |
273 | struct mem_cgroup *from; | 273 | struct mem_cgroup *from; |
274 | struct mem_cgroup *to; | 274 | struct mem_cgroup *to; |
275 | unsigned long precharge; | 275 | unsigned long precharge; |
276 | unsigned long moved_charge; | 276 | unsigned long moved_charge; |
277 | unsigned long moved_swap; | 277 | unsigned long moved_swap; |
278 | struct task_struct *moving_task; /* a task moving charges */ | 278 | struct task_struct *moving_task; /* a task moving charges */ |
279 | struct mm_struct *mm; | ||
279 | wait_queue_head_t waitq; /* a waitq for other context */ | 280 | wait_queue_head_t waitq; /* a waitq for other context */ |
280 | } mc = { | 281 | } mc = { |
281 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), | 282 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), |
@@ -1646,6 +1647,7 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask, | |||
1646 | if (likely(!ret)) | 1647 | if (likely(!ret)) |
1647 | return CHARGE_OK; | 1648 | return CHARGE_OK; |
1648 | 1649 | ||
1650 | res_counter_uncharge(&mem->res, csize); | ||
1649 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); | 1651 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); |
1650 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; | 1652 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; |
1651 | } else | 1653 | } else |
@@ -1729,19 +1731,18 @@ again: | |||
1729 | 1731 | ||
1730 | rcu_read_lock(); | 1732 | rcu_read_lock(); |
1731 | p = rcu_dereference(mm->owner); | 1733 | p = rcu_dereference(mm->owner); |
1732 | VM_BUG_ON(!p); | ||
1733 | /* | 1734 | /* |
1734 | * because we don't have task_lock(), "p" can exit while | 1735 | * Because we don't have task_lock(), "p" can exit. |
1735 | * we're here. In that case, "mem" can point to root | 1736 | * In that case, "mem" can point to root or p can be NULL with |
1736 | * cgroup but never be NULL. (and task_struct itself is freed | 1737 | * race with swapoff. Then, we have small risk of mis-accouning. |
1737 | * by RCU, cgroup itself is RCU safe.) Then, we have small | 1738 | * But such kind of mis-account by race always happens because |
1738 | * risk here to get wrong cgroup. But such kind of mis-account | 1739 | * we don't have cgroup_mutex(). It's overkill and we allo that |
1739 | * by race always happens because we don't have cgroup_mutex(). | 1740 | * small race, here. |
1740 | * It's overkill and we allow that small race, here. | 1741 | * (*) swapoff at el will charge against mm-struct not against |
1742 | * task-struct. So, mm->owner can be NULL. | ||
1741 | */ | 1743 | */ |
1742 | mem = mem_cgroup_from_task(p); | 1744 | mem = mem_cgroup_from_task(p); |
1743 | VM_BUG_ON(!mem); | 1745 | if (!mem || mem_cgroup_is_root(mem)) { |
1744 | if (mem_cgroup_is_root(mem)) { | ||
1745 | rcu_read_unlock(); | 1746 | rcu_read_unlock(); |
1746 | goto done; | 1747 | goto done; |
1747 | } | 1748 | } |
@@ -4445,7 +4446,7 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
4445 | unsigned long precharge; | 4446 | unsigned long precharge; |
4446 | struct vm_area_struct *vma; | 4447 | struct vm_area_struct *vma; |
4447 | 4448 | ||
4448 | down_read(&mm->mmap_sem); | 4449 | /* We've already held the mmap_sem */ |
4449 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4450 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
4450 | struct mm_walk mem_cgroup_count_precharge_walk = { | 4451 | struct mm_walk mem_cgroup_count_precharge_walk = { |
4451 | .pmd_entry = mem_cgroup_count_precharge_pte_range, | 4452 | .pmd_entry = mem_cgroup_count_precharge_pte_range, |
@@ -4457,7 +4458,6 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
4457 | walk_page_range(vma->vm_start, vma->vm_end, | 4458 | walk_page_range(vma->vm_start, vma->vm_end, |
4458 | &mem_cgroup_count_precharge_walk); | 4459 | &mem_cgroup_count_precharge_walk); |
4459 | } | 4460 | } |
4460 | up_read(&mm->mmap_sem); | ||
4461 | 4461 | ||
4462 | precharge = mc.precharge; | 4462 | precharge = mc.precharge; |
4463 | mc.precharge = 0; | 4463 | mc.precharge = 0; |
@@ -4508,11 +4508,16 @@ static void mem_cgroup_clear_mc(void) | |||
4508 | 4508 | ||
4509 | mc.moved_swap = 0; | 4509 | mc.moved_swap = 0; |
4510 | } | 4510 | } |
4511 | if (mc.mm) { | ||
4512 | up_read(&mc.mm->mmap_sem); | ||
4513 | mmput(mc.mm); | ||
4514 | } | ||
4511 | spin_lock(&mc.lock); | 4515 | spin_lock(&mc.lock); |
4512 | mc.from = NULL; | 4516 | mc.from = NULL; |
4513 | mc.to = NULL; | 4517 | mc.to = NULL; |
4514 | mc.moving_task = NULL; | ||
4515 | spin_unlock(&mc.lock); | 4518 | spin_unlock(&mc.lock); |
4519 | mc.moving_task = NULL; | ||
4520 | mc.mm = NULL; | ||
4516 | memcg_oom_recover(from); | 4521 | memcg_oom_recover(from); |
4517 | memcg_oom_recover(to); | 4522 | memcg_oom_recover(to); |
4518 | wake_up_all(&mc.waitq); | 4523 | wake_up_all(&mc.waitq); |
@@ -4537,26 +4542,37 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | |||
4537 | return 0; | 4542 | return 0; |
4538 | /* We move charges only when we move a owner of the mm */ | 4543 | /* We move charges only when we move a owner of the mm */ |
4539 | if (mm->owner == p) { | 4544 | if (mm->owner == p) { |
4545 | /* | ||
4546 | * We do all the move charge works under one mmap_sem to | ||
4547 | * avoid deadlock with down_write(&mmap_sem) | ||
4548 | * -> try_charge() -> if (mc.moving_task) -> sleep. | ||
4549 | */ | ||
4550 | down_read(&mm->mmap_sem); | ||
4551 | |||
4540 | VM_BUG_ON(mc.from); | 4552 | VM_BUG_ON(mc.from); |
4541 | VM_BUG_ON(mc.to); | 4553 | VM_BUG_ON(mc.to); |
4542 | VM_BUG_ON(mc.precharge); | 4554 | VM_BUG_ON(mc.precharge); |
4543 | VM_BUG_ON(mc.moved_charge); | 4555 | VM_BUG_ON(mc.moved_charge); |
4544 | VM_BUG_ON(mc.moved_swap); | 4556 | VM_BUG_ON(mc.moved_swap); |
4545 | VM_BUG_ON(mc.moving_task); | 4557 | VM_BUG_ON(mc.moving_task); |
4558 | VM_BUG_ON(mc.mm); | ||
4559 | |||
4546 | spin_lock(&mc.lock); | 4560 | spin_lock(&mc.lock); |
4547 | mc.from = from; | 4561 | mc.from = from; |
4548 | mc.to = mem; | 4562 | mc.to = mem; |
4549 | mc.precharge = 0; | 4563 | mc.precharge = 0; |
4550 | mc.moved_charge = 0; | 4564 | mc.moved_charge = 0; |
4551 | mc.moved_swap = 0; | 4565 | mc.moved_swap = 0; |
4552 | mc.moving_task = current; | ||
4553 | spin_unlock(&mc.lock); | 4566 | spin_unlock(&mc.lock); |
4567 | mc.moving_task = current; | ||
4568 | mc.mm = mm; | ||
4554 | 4569 | ||
4555 | ret = mem_cgroup_precharge_mc(mm); | 4570 | ret = mem_cgroup_precharge_mc(mm); |
4556 | if (ret) | 4571 | if (ret) |
4557 | mem_cgroup_clear_mc(); | 4572 | mem_cgroup_clear_mc(); |
4558 | } | 4573 | /* We call up_read() and mmput() in clear_mc(). */ |
4559 | mmput(mm); | 4574 | } else |
4575 | mmput(mm); | ||
4560 | } | 4576 | } |
4561 | return ret; | 4577 | return ret; |
4562 | } | 4578 | } |
@@ -4644,7 +4660,7 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
4644 | struct vm_area_struct *vma; | 4660 | struct vm_area_struct *vma; |
4645 | 4661 | ||
4646 | lru_add_drain_all(); | 4662 | lru_add_drain_all(); |
4647 | down_read(&mm->mmap_sem); | 4663 | /* We've already held the mmap_sem */ |
4648 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4664 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
4649 | int ret; | 4665 | int ret; |
4650 | struct mm_walk mem_cgroup_move_charge_walk = { | 4666 | struct mm_walk mem_cgroup_move_charge_walk = { |
@@ -4663,7 +4679,6 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
4663 | */ | 4679 | */ |
4664 | break; | 4680 | break; |
4665 | } | 4681 | } |
4666 | up_read(&mm->mmap_sem); | ||
4667 | } | 4682 | } |
4668 | 4683 | ||
4669 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, | 4684 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, |
@@ -4672,17 +4687,11 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, | |||
4672 | struct task_struct *p, | 4687 | struct task_struct *p, |
4673 | bool threadgroup) | 4688 | bool threadgroup) |
4674 | { | 4689 | { |
4675 | struct mm_struct *mm; | 4690 | if (!mc.mm) |
4676 | |||
4677 | if (!mc.to) | ||
4678 | /* no need to move charge */ | 4691 | /* no need to move charge */ |
4679 | return; | 4692 | return; |
4680 | 4693 | ||
4681 | mm = get_task_mm(p); | 4694 | mem_cgroup_move_charge(mc.mm); |
4682 | if (mm) { | ||
4683 | mem_cgroup_move_charge(mm); | ||
4684 | mmput(mm); | ||
4685 | } | ||
4686 | mem_cgroup_clear_mc(); | 4695 | mem_cgroup_clear_mc(); |
4687 | } | 4696 | } |
4688 | #else /* !CONFIG_MMU */ | 4697 | #else /* !CONFIG_MMU */ |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index dd186c1a5d53..6345dfe78d2c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -659,7 +659,7 @@ static int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) | |||
659 | * Scanning pfn is much easier than scanning lru list. | 659 | * Scanning pfn is much easier than scanning lru list. |
660 | * Scan pfn from start to end and Find LRU page. | 660 | * Scan pfn from start to end and Find LRU page. |
661 | */ | 661 | */ |
662 | int scan_lru_pages(unsigned long start, unsigned long end) | 662 | unsigned long scan_lru_pages(unsigned long start, unsigned long end) |
663 | { | 663 | { |
664 | unsigned long pfn; | 664 | unsigned long pfn; |
665 | struct page *page; | 665 | struct page *page; |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index f969da5dd8a2..c1002c68d617 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1588,7 +1588,7 @@ unsigned slab_node(struct mempolicy *policy) | |||
1588 | (void)first_zones_zonelist(zonelist, highest_zoneidx, | 1588 | (void)first_zones_zonelist(zonelist, highest_zoneidx, |
1589 | &policy->v.nodes, | 1589 | &policy->v.nodes, |
1590 | &zone); | 1590 | &zone); |
1591 | return zone->node; | 1591 | return zone ? zone->node : numa_node_id(); |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | default: | 1594 | default: |
diff --git a/mm/migrate.c b/mm/migrate.c index 38e7cad782f4..2cfa9bf1f0d4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -553,7 +553,6 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, | |||
553 | int *result = NULL; | 553 | int *result = NULL; |
554 | struct page *newpage = get_new_page(page, private, &result); | 554 | struct page *newpage = get_new_page(page, private, &result); |
555 | int remap_swapcache = 1; | 555 | int remap_swapcache = 1; |
556 | int rcu_locked = 0; | ||
557 | int charge = 0; | 556 | int charge = 0; |
558 | struct mem_cgroup *mem = NULL; | 557 | struct mem_cgroup *mem = NULL; |
559 | struct anon_vma *anon_vma = NULL; | 558 | struct anon_vma *anon_vma = NULL; |
@@ -605,20 +604,26 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, | |||
605 | /* | 604 | /* |
606 | * By try_to_unmap(), page->mapcount goes down to 0 here. In this case, | 605 | * By try_to_unmap(), page->mapcount goes down to 0 here. In this case, |
607 | * we cannot notice that anon_vma is freed while we migrates a page. | 606 | * we cannot notice that anon_vma is freed while we migrates a page. |
608 | * This rcu_read_lock() delays freeing anon_vma pointer until the end | 607 | * This get_anon_vma() delays freeing anon_vma pointer until the end |
609 | * of migration. File cache pages are no problem because of page_lock() | 608 | * of migration. File cache pages are no problem because of page_lock() |
610 | * File Caches may use write_page() or lock_page() in migration, then, | 609 | * File Caches may use write_page() or lock_page() in migration, then, |
611 | * just care Anon page here. | 610 | * just care Anon page here. |
612 | */ | 611 | */ |
613 | if (PageAnon(page)) { | 612 | if (PageAnon(page)) { |
614 | rcu_read_lock(); | 613 | /* |
615 | rcu_locked = 1; | 614 | * Only page_lock_anon_vma() understands the subtleties of |
616 | 615 | * getting a hold on an anon_vma from outside one of its mms. | |
617 | /* Determine how to safely use anon_vma */ | 616 | */ |
618 | if (!page_mapped(page)) { | 617 | anon_vma = page_lock_anon_vma(page); |
619 | if (!PageSwapCache(page)) | 618 | if (anon_vma) { |
620 | goto rcu_unlock; | 619 | /* |
621 | 620 | * Take a reference count on the anon_vma if the | |
621 | * page is mapped so that it is guaranteed to | ||
622 | * exist when the page is remapped later | ||
623 | */ | ||
624 | get_anon_vma(anon_vma); | ||
625 | page_unlock_anon_vma(anon_vma); | ||
626 | } else if (PageSwapCache(page)) { | ||
622 | /* | 627 | /* |
623 | * We cannot be sure that the anon_vma of an unmapped | 628 | * We cannot be sure that the anon_vma of an unmapped |
624 | * swapcache page is safe to use because we don't | 629 | * swapcache page is safe to use because we don't |
@@ -633,13 +638,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, | |||
633 | */ | 638 | */ |
634 | remap_swapcache = 0; | 639 | remap_swapcache = 0; |
635 | } else { | 640 | } else { |
636 | /* | 641 | goto uncharge; |
637 | * Take a reference count on the anon_vma if the | ||
638 | * page is mapped so that it is guaranteed to | ||
639 | * exist when the page is remapped later | ||
640 | */ | ||
641 | anon_vma = page_anon_vma(page); | ||
642 | get_anon_vma(anon_vma); | ||
643 | } | 642 | } |
644 | } | 643 | } |
645 | 644 | ||
@@ -656,16 +655,10 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private, | |||
656 | * free the metadata, so the page can be freed. | 655 | * free the metadata, so the page can be freed. |
657 | */ | 656 | */ |
658 | if (!page->mapping) { | 657 | if (!page->mapping) { |
659 | if (!PageAnon(page) && page_has_private(page)) { | 658 | VM_BUG_ON(PageAnon(page)); |
660 | /* | 659 | if (page_has_private(page)) { |
661 | * Go direct to try_to_free_buffers() here because | ||
662 | * a) that's what try_to_release_page() would do anyway | ||
663 | * b) we may be under rcu_read_lock() here, so we can't | ||
664 | * use GFP_KERNEL which is what try_to_release_page() | ||
665 | * needs to be effective. | ||
666 | */ | ||
667 | try_to_free_buffers(page); | 660 | try_to_free_buffers(page); |
668 | goto rcu_unlock; | 661 | goto uncharge; |
669 | } | 662 | } |
670 | goto skip_unmap; | 663 | goto skip_unmap; |
671 | } | 664 | } |
@@ -679,14 +672,11 @@ skip_unmap: | |||
679 | 672 | ||
680 | if (rc && remap_swapcache) | 673 | if (rc && remap_swapcache) |
681 | remove_migration_ptes(page, page); | 674 | remove_migration_ptes(page, page); |
682 | rcu_unlock: | ||
683 | 675 | ||
684 | /* Drop an anon_vma reference if we took one */ | 676 | /* Drop an anon_vma reference if we took one */ |
685 | if (anon_vma) | 677 | if (anon_vma) |
686 | drop_anon_vma(anon_vma); | 678 | drop_anon_vma(anon_vma); |
687 | 679 | ||
688 | if (rcu_locked) | ||
689 | rcu_read_unlock(); | ||
690 | uncharge: | 680 | uncharge: |
691 | if (!charge) | 681 | if (!charge) |
692 | mem_cgroup_end_migration(mem, page, newpage); | 682 | mem_cgroup_end_migration(mem, page, newpage); |
@@ -2460,6 +2460,7 @@ int install_special_mapping(struct mm_struct *mm, | |||
2460 | unsigned long addr, unsigned long len, | 2460 | unsigned long addr, unsigned long len, |
2461 | unsigned long vm_flags, struct page **pages) | 2461 | unsigned long vm_flags, struct page **pages) |
2462 | { | 2462 | { |
2463 | int ret; | ||
2463 | struct vm_area_struct *vma; | 2464 | struct vm_area_struct *vma; |
2464 | 2465 | ||
2465 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); | 2466 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
@@ -2477,16 +2478,23 @@ int install_special_mapping(struct mm_struct *mm, | |||
2477 | vma->vm_ops = &special_mapping_vmops; | 2478 | vma->vm_ops = &special_mapping_vmops; |
2478 | vma->vm_private_data = pages; | 2479 | vma->vm_private_data = pages; |
2479 | 2480 | ||
2480 | if (unlikely(insert_vm_struct(mm, vma))) { | 2481 | ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1); |
2481 | kmem_cache_free(vm_area_cachep, vma); | 2482 | if (ret) |
2482 | return -ENOMEM; | 2483 | goto out; |
2483 | } | 2484 | |
2485 | ret = insert_vm_struct(mm, vma); | ||
2486 | if (ret) | ||
2487 | goto out; | ||
2484 | 2488 | ||
2485 | mm->total_vm += len >> PAGE_SHIFT; | 2489 | mm->total_vm += len >> PAGE_SHIFT; |
2486 | 2490 | ||
2487 | perf_event_mmap(vma); | 2491 | perf_event_mmap(vma); |
2488 | 2492 | ||
2489 | return 0; | 2493 | return 0; |
2494 | |||
2495 | out: | ||
2496 | kmem_cache_free(vm_area_cachep, vma); | ||
2497 | return ret; | ||
2490 | } | 2498 | } |
2491 | 2499 | ||
2492 | static DEFINE_MUTEX(mm_all_locks_mutex); | 2500 | static DEFINE_MUTEX(mm_all_locks_mutex); |
diff --git a/mm/mmzone.c b/mm/mmzone.c index e35bfb82c855..f5b7d1760213 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c | |||
@@ -87,24 +87,3 @@ int memmap_valid_within(unsigned long pfn, | |||
87 | return 1; | 87 | return 1; |
88 | } | 88 | } |
89 | #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ | 89 | #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ |
90 | |||
91 | #ifdef CONFIG_SMP | ||
92 | /* Called when a more accurate view of NR_FREE_PAGES is needed */ | ||
93 | unsigned long zone_nr_free_pages(struct zone *zone) | ||
94 | { | ||
95 | unsigned long nr_free_pages = zone_page_state(zone, NR_FREE_PAGES); | ||
96 | |||
97 | /* | ||
98 | * While kswapd is awake, it is considered the zone is under some | ||
99 | * memory pressure. Under pressure, there is a risk that | ||
100 | * per-cpu-counter-drift will allow the min watermark to be breached | ||
101 | * potentially causing a live-lock. While kswapd is awake and | ||
102 | * free pages are low, get a better estimate for free pages | ||
103 | */ | ||
104 | if (nr_free_pages < zone->percpu_drift_mark && | ||
105 | !waitqueue_active(&zone->zone_pgdat->kswapd_wait)) | ||
106 | return zone_page_state_snapshot(zone, NR_FREE_PAGES); | ||
107 | |||
108 | return nr_free_pages; | ||
109 | } | ||
110 | #endif /* CONFIG_SMP */ | ||
diff --git a/mm/mprotect.c b/mm/mprotect.c index 2d1bf7cf8851..4c5133873097 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -211,6 +211,7 @@ success: | |||
211 | mmu_notifier_invalidate_range_end(mm, start, end); | 211 | mmu_notifier_invalidate_range_end(mm, start, end); |
212 | vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); | 212 | vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); |
213 | vm_stat_account(mm, newflags, vma->vm_file, nrpages); | 213 | vm_stat_account(mm, newflags, vma->vm_file, nrpages); |
214 | perf_event_mmap(vma); | ||
214 | return 0; | 215 | return 0; |
215 | 216 | ||
216 | fail: | 217 | fail: |
@@ -299,7 +300,6 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, | |||
299 | error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); | 300 | error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); |
300 | if (error) | 301 | if (error) |
301 | goto out; | 302 | goto out; |
302 | perf_event_mmap(vma); | ||
303 | nstart = tmp; | 303 | nstart = tmp; |
304 | 304 | ||
305 | if (nstart < prev->vm_end) | 305 | if (nstart < prev->vm_end) |
diff --git a/mm/nommu.c b/mm/nommu.c index 88ff091eb07a..acb3bd3c1cb9 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1668,6 +1668,7 @@ void exit_mmap(struct mm_struct *mm) | |||
1668 | mm->mmap = vma->vm_next; | 1668 | mm->mmap = vma->vm_next; |
1669 | delete_vma_from_mm(vma); | 1669 | delete_vma_from_mm(vma); |
1670 | delete_vma(mm, vma); | 1670 | delete_vma(mm, vma); |
1671 | cond_resched(); | ||
1671 | } | 1672 | } |
1672 | 1673 | ||
1673 | kleave(""); | 1674 | kleave(""); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f12ad1836abe..985e072a3dd9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -103,19 +103,24 @@ gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; | |||
103 | * only be modified with pm_mutex held, unless the suspend/hibernate code is | 103 | * only be modified with pm_mutex held, unless the suspend/hibernate code is |
104 | * guaranteed not to run in parallel with that modification). | 104 | * guaranteed not to run in parallel with that modification). |
105 | */ | 105 | */ |
106 | void set_gfp_allowed_mask(gfp_t mask) | 106 | |
107 | static gfp_t saved_gfp_mask; | ||
108 | |||
109 | void pm_restore_gfp_mask(void) | ||
107 | { | 110 | { |
108 | WARN_ON(!mutex_is_locked(&pm_mutex)); | 111 | WARN_ON(!mutex_is_locked(&pm_mutex)); |
109 | gfp_allowed_mask = mask; | 112 | if (saved_gfp_mask) { |
113 | gfp_allowed_mask = saved_gfp_mask; | ||
114 | saved_gfp_mask = 0; | ||
115 | } | ||
110 | } | 116 | } |
111 | 117 | ||
112 | gfp_t clear_gfp_allowed_mask(gfp_t mask) | 118 | void pm_restrict_gfp_mask(void) |
113 | { | 119 | { |
114 | gfp_t ret = gfp_allowed_mask; | ||
115 | |||
116 | WARN_ON(!mutex_is_locked(&pm_mutex)); | 120 | WARN_ON(!mutex_is_locked(&pm_mutex)); |
117 | gfp_allowed_mask &= ~mask; | 121 | WARN_ON(saved_gfp_mask); |
118 | return ret; | 122 | saved_gfp_mask = gfp_allowed_mask; |
123 | gfp_allowed_mask &= ~GFP_IOFS; | ||
119 | } | 124 | } |
120 | #endif /* CONFIG_PM_SLEEP */ | 125 | #endif /* CONFIG_PM_SLEEP */ |
121 | 126 | ||
@@ -530,7 +535,7 @@ static inline void __free_one_page(struct page *page, | |||
530 | * so it's less likely to be used soon and more likely to be merged | 535 | * so it's less likely to be used soon and more likely to be merged |
531 | * as a higher order page | 536 | * as a higher order page |
532 | */ | 537 | */ |
533 | if ((order < MAX_ORDER-1) && pfn_valid_within(page_to_pfn(buddy))) { | 538 | if ((order < MAX_ORDER-2) && pfn_valid_within(page_to_pfn(buddy))) { |
534 | struct page *higher_page, *higher_buddy; | 539 | struct page *higher_page, *higher_buddy; |
535 | combined_idx = __find_combined_index(page_idx, order); | 540 | combined_idx = __find_combined_index(page_idx, order); |
536 | higher_page = page + combined_idx - page_idx; | 541 | higher_page = page + combined_idx - page_idx; |
@@ -1454,24 +1459,24 @@ static inline int should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) | |||
1454 | #endif /* CONFIG_FAIL_PAGE_ALLOC */ | 1459 | #endif /* CONFIG_FAIL_PAGE_ALLOC */ |
1455 | 1460 | ||
1456 | /* | 1461 | /* |
1457 | * Return 1 if free pages are above 'mark'. This takes into account the order | 1462 | * Return true if free pages are above 'mark'. This takes into account the order |
1458 | * of the allocation. | 1463 | * of the allocation. |
1459 | */ | 1464 | */ |
1460 | int zone_watermark_ok(struct zone *z, int order, unsigned long mark, | 1465 | static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, |
1461 | int classzone_idx, int alloc_flags) | 1466 | int classzone_idx, int alloc_flags, long free_pages) |
1462 | { | 1467 | { |
1463 | /* free_pages my go negative - that's OK */ | 1468 | /* free_pages my go negative - that's OK */ |
1464 | long min = mark; | 1469 | long min = mark; |
1465 | long free_pages = zone_nr_free_pages(z) - (1 << order) + 1; | ||
1466 | int o; | 1470 | int o; |
1467 | 1471 | ||
1472 | free_pages -= (1 << order) + 1; | ||
1468 | if (alloc_flags & ALLOC_HIGH) | 1473 | if (alloc_flags & ALLOC_HIGH) |
1469 | min -= min / 2; | 1474 | min -= min / 2; |
1470 | if (alloc_flags & ALLOC_HARDER) | 1475 | if (alloc_flags & ALLOC_HARDER) |
1471 | min -= min / 4; | 1476 | min -= min / 4; |
1472 | 1477 | ||
1473 | if (free_pages <= min + z->lowmem_reserve[classzone_idx]) | 1478 | if (free_pages <= min + z->lowmem_reserve[classzone_idx]) |
1474 | return 0; | 1479 | return false; |
1475 | for (o = 0; o < order; o++) { | 1480 | for (o = 0; o < order; o++) { |
1476 | /* At the next order, this order's pages become unavailable */ | 1481 | /* At the next order, this order's pages become unavailable */ |
1477 | free_pages -= z->free_area[o].nr_free << o; | 1482 | free_pages -= z->free_area[o].nr_free << o; |
@@ -1480,9 +1485,28 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark, | |||
1480 | min >>= 1; | 1485 | min >>= 1; |
1481 | 1486 | ||
1482 | if (free_pages <= min) | 1487 | if (free_pages <= min) |
1483 | return 0; | 1488 | return false; |
1484 | } | 1489 | } |
1485 | return 1; | 1490 | return true; |
1491 | } | ||
1492 | |||
1493 | bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, | ||
1494 | int classzone_idx, int alloc_flags) | ||
1495 | { | ||
1496 | return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, | ||
1497 | zone_page_state(z, NR_FREE_PAGES)); | ||
1498 | } | ||
1499 | |||
1500 | bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, | ||
1501 | int classzone_idx, int alloc_flags) | ||
1502 | { | ||
1503 | long free_pages = zone_page_state(z, NR_FREE_PAGES); | ||
1504 | |||
1505 | if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) | ||
1506 | free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); | ||
1507 | |||
1508 | return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, | ||
1509 | free_pages); | ||
1486 | } | 1510 | } |
1487 | 1511 | ||
1488 | #ifdef CONFIG_NUMA | 1512 | #ifdef CONFIG_NUMA |
@@ -2436,7 +2460,7 @@ void show_free_areas(void) | |||
2436 | " all_unreclaimable? %s" | 2460 | " all_unreclaimable? %s" |
2437 | "\n", | 2461 | "\n", |
2438 | zone->name, | 2462 | zone->name, |
2439 | K(zone_nr_free_pages(zone)), | 2463 | K(zone_page_state(zone, NR_FREE_PAGES)), |
2440 | K(min_wmark_pages(zone)), | 2464 | K(min_wmark_pages(zone)), |
2441 | K(low_wmark_pages(zone)), | 2465 | K(low_wmark_pages(zone)), |
2442 | K(high_wmark_pages(zone)), | 2466 | K(high_wmark_pages(zone)), |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 6b8889da69a6..d8087f0db507 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -517,6 +517,15 @@ static atomic_t vmap_lazy_nr = ATOMIC_INIT(0); | |||
517 | static void purge_fragmented_blocks_allcpus(void); | 517 | static void purge_fragmented_blocks_allcpus(void); |
518 | 518 | ||
519 | /* | 519 | /* |
520 | * called before a call to iounmap() if the caller wants vm_area_struct's | ||
521 | * immediately freed. | ||
522 | */ | ||
523 | void set_iounmap_nonlazy(void) | ||
524 | { | ||
525 | atomic_set(&vmap_lazy_nr, lazy_max_pages()+1); | ||
526 | } | ||
527 | |||
528 | /* | ||
520 | * Purges all lazily-freed vmap areas. | 529 | * Purges all lazily-freed vmap areas. |
521 | * | 530 | * |
522 | * If sync is 0 then don't purge if there is already a purge in progress. | 531 | * If sync is 0 then don't purge if there is already a purge in progress. |
diff --git a/mm/vmscan.c b/mm/vmscan.c index c5dfabf25f11..3e71cb1ee28c 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2082,7 +2082,7 @@ static int sleeping_prematurely(pg_data_t *pgdat, int order, long remaining) | |||
2082 | if (zone->all_unreclaimable) | 2082 | if (zone->all_unreclaimable) |
2083 | continue; | 2083 | continue; |
2084 | 2084 | ||
2085 | if (!zone_watermark_ok(zone, order, high_wmark_pages(zone), | 2085 | if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone), |
2086 | 0, 0)) | 2086 | 0, 0)) |
2087 | return 1; | 2087 | return 1; |
2088 | } | 2088 | } |
@@ -2169,7 +2169,7 @@ loop_again: | |||
2169 | shrink_active_list(SWAP_CLUSTER_MAX, zone, | 2169 | shrink_active_list(SWAP_CLUSTER_MAX, zone, |
2170 | &sc, priority, 0); | 2170 | &sc, priority, 0); |
2171 | 2171 | ||
2172 | if (!zone_watermark_ok(zone, order, | 2172 | if (!zone_watermark_ok_safe(zone, order, |
2173 | high_wmark_pages(zone), 0, 0)) { | 2173 | high_wmark_pages(zone), 0, 0)) { |
2174 | end_zone = i; | 2174 | end_zone = i; |
2175 | break; | 2175 | break; |
@@ -2215,7 +2215,7 @@ loop_again: | |||
2215 | * We put equal pressure on every zone, unless one | 2215 | * We put equal pressure on every zone, unless one |
2216 | * zone has way too many pages free already. | 2216 | * zone has way too many pages free already. |
2217 | */ | 2217 | */ |
2218 | if (!zone_watermark_ok(zone, order, | 2218 | if (!zone_watermark_ok_safe(zone, order, |
2219 | 8*high_wmark_pages(zone), end_zone, 0)) | 2219 | 8*high_wmark_pages(zone), end_zone, 0)) |
2220 | shrink_zone(priority, zone, &sc); | 2220 | shrink_zone(priority, zone, &sc); |
2221 | reclaim_state->reclaimed_slab = 0; | 2221 | reclaim_state->reclaimed_slab = 0; |
@@ -2236,7 +2236,7 @@ loop_again: | |||
2236 | total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) | 2236 | total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) |
2237 | sc.may_writepage = 1; | 2237 | sc.may_writepage = 1; |
2238 | 2238 | ||
2239 | if (!zone_watermark_ok(zone, order, | 2239 | if (!zone_watermark_ok_safe(zone, order, |
2240 | high_wmark_pages(zone), end_zone, 0)) { | 2240 | high_wmark_pages(zone), end_zone, 0)) { |
2241 | all_zones_ok = 0; | 2241 | all_zones_ok = 0; |
2242 | /* | 2242 | /* |
@@ -2244,7 +2244,7 @@ loop_again: | |||
2244 | * means that we have a GFP_ATOMIC allocation | 2244 | * means that we have a GFP_ATOMIC allocation |
2245 | * failure risk. Hurry up! | 2245 | * failure risk. Hurry up! |
2246 | */ | 2246 | */ |
2247 | if (!zone_watermark_ok(zone, order, | 2247 | if (!zone_watermark_ok_safe(zone, order, |
2248 | min_wmark_pages(zone), end_zone, 0)) | 2248 | min_wmark_pages(zone), end_zone, 0)) |
2249 | has_under_min_watermark_zone = 1; | 2249 | has_under_min_watermark_zone = 1; |
2250 | } | 2250 | } |
@@ -2378,7 +2378,9 @@ static int kswapd(void *p) | |||
2378 | */ | 2378 | */ |
2379 | if (!sleeping_prematurely(pgdat, order, remaining)) { | 2379 | if (!sleeping_prematurely(pgdat, order, remaining)) { |
2380 | trace_mm_vmscan_kswapd_sleep(pgdat->node_id); | 2380 | trace_mm_vmscan_kswapd_sleep(pgdat->node_id); |
2381 | restore_pgdat_percpu_threshold(pgdat); | ||
2381 | schedule(); | 2382 | schedule(); |
2383 | reduce_pgdat_percpu_threshold(pgdat); | ||
2382 | } else { | 2384 | } else { |
2383 | if (remaining) | 2385 | if (remaining) |
2384 | count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); | 2386 | count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); |
@@ -2417,16 +2419,17 @@ void wakeup_kswapd(struct zone *zone, int order) | |||
2417 | if (!populated_zone(zone)) | 2419 | if (!populated_zone(zone)) |
2418 | return; | 2420 | return; |
2419 | 2421 | ||
2420 | pgdat = zone->zone_pgdat; | 2422 | if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) |
2421 | if (zone_watermark_ok(zone, order, low_wmark_pages(zone), 0, 0)) | ||
2422 | return; | 2423 | return; |
2424 | pgdat = zone->zone_pgdat; | ||
2423 | if (pgdat->kswapd_max_order < order) | 2425 | if (pgdat->kswapd_max_order < order) |
2424 | pgdat->kswapd_max_order = order; | 2426 | pgdat->kswapd_max_order = order; |
2425 | trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); | ||
2426 | if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) | ||
2427 | return; | ||
2428 | if (!waitqueue_active(&pgdat->kswapd_wait)) | 2427 | if (!waitqueue_active(&pgdat->kswapd_wait)) |
2429 | return; | 2428 | return; |
2429 | if (zone_watermark_ok_safe(zone, order, low_wmark_pages(zone), 0, 0)) | ||
2430 | return; | ||
2431 | |||
2432 | trace_mm_vmscan_wakeup_kswapd(pgdat->node_id, zone_idx(zone), order); | ||
2430 | wake_up_interruptible(&pgdat->kswapd_wait); | 2433 | wake_up_interruptible(&pgdat->kswapd_wait); |
2431 | } | 2434 | } |
2432 | 2435 | ||
diff --git a/mm/vmstat.c b/mm/vmstat.c index 355a9e669aaa..4d7faebb9b70 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -81,6 +81,30 @@ EXPORT_SYMBOL(vm_stat); | |||
81 | 81 | ||
82 | #ifdef CONFIG_SMP | 82 | #ifdef CONFIG_SMP |
83 | 83 | ||
84 | static int calculate_pressure_threshold(struct zone *zone) | ||
85 | { | ||
86 | int threshold; | ||
87 | int watermark_distance; | ||
88 | |||
89 | /* | ||
90 | * As vmstats are not up to date, there is drift between the estimated | ||
91 | * and real values. For high thresholds and a high number of CPUs, it | ||
92 | * is possible for the min watermark to be breached while the estimated | ||
93 | * value looks fine. The pressure threshold is a reduced value such | ||
94 | * that even the maximum amount of drift will not accidentally breach | ||
95 | * the min watermark | ||
96 | */ | ||
97 | watermark_distance = low_wmark_pages(zone) - min_wmark_pages(zone); | ||
98 | threshold = max(1, (int)(watermark_distance / num_online_cpus())); | ||
99 | |||
100 | /* | ||
101 | * Maximum threshold is 125 | ||
102 | */ | ||
103 | threshold = min(125, threshold); | ||
104 | |||
105 | return threshold; | ||
106 | } | ||
107 | |||
84 | static int calculate_threshold(struct zone *zone) | 108 | static int calculate_threshold(struct zone *zone) |
85 | { | 109 | { |
86 | int threshold; | 110 | int threshold; |
@@ -159,6 +183,48 @@ static void refresh_zone_stat_thresholds(void) | |||
159 | } | 183 | } |
160 | } | 184 | } |
161 | 185 | ||
186 | void reduce_pgdat_percpu_threshold(pg_data_t *pgdat) | ||
187 | { | ||
188 | struct zone *zone; | ||
189 | int cpu; | ||
190 | int threshold; | ||
191 | int i; | ||
192 | |||
193 | get_online_cpus(); | ||
194 | for (i = 0; i < pgdat->nr_zones; i++) { | ||
195 | zone = &pgdat->node_zones[i]; | ||
196 | if (!zone->percpu_drift_mark) | ||
197 | continue; | ||
198 | |||
199 | threshold = calculate_pressure_threshold(zone); | ||
200 | for_each_online_cpu(cpu) | ||
201 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold | ||
202 | = threshold; | ||
203 | } | ||
204 | put_online_cpus(); | ||
205 | } | ||
206 | |||
207 | void restore_pgdat_percpu_threshold(pg_data_t *pgdat) | ||
208 | { | ||
209 | struct zone *zone; | ||
210 | int cpu; | ||
211 | int threshold; | ||
212 | int i; | ||
213 | |||
214 | get_online_cpus(); | ||
215 | for (i = 0; i < pgdat->nr_zones; i++) { | ||
216 | zone = &pgdat->node_zones[i]; | ||
217 | if (!zone->percpu_drift_mark) | ||
218 | continue; | ||
219 | |||
220 | threshold = calculate_threshold(zone); | ||
221 | for_each_online_cpu(cpu) | ||
222 | per_cpu_ptr(zone->pageset, cpu)->stat_threshold | ||
223 | = threshold; | ||
224 | } | ||
225 | put_online_cpus(); | ||
226 | } | ||
227 | |||
162 | /* | 228 | /* |
163 | * For use when we know that interrupts are disabled. | 229 | * For use when we know that interrupts are disabled. |
164 | */ | 230 | */ |
@@ -826,7 +892,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, | |||
826 | "\n scanned %lu" | 892 | "\n scanned %lu" |
827 | "\n spanned %lu" | 893 | "\n spanned %lu" |
828 | "\n present %lu", | 894 | "\n present %lu", |
829 | zone_nr_free_pages(zone), | 895 | zone_page_state(zone, NR_FREE_PAGES), |
830 | min_wmark_pages(zone), | 896 | min_wmark_pages(zone), |
831 | low_wmark_pages(zone), | 897 | low_wmark_pages(zone), |
832 | high_wmark_pages(zone), | 898 | high_wmark_pages(zone), |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 0eb96f7e44be..2dcff0be8acb 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -43,6 +43,9 @@ int vlan_hwaccel_do_receive(struct sk_buff *skb) | |||
43 | struct net_device *dev = skb->dev; | 43 | struct net_device *dev = skb->dev; |
44 | struct vlan_rx_stats *rx_stats; | 44 | struct vlan_rx_stats *rx_stats; |
45 | 45 | ||
46 | if (unlikely(!is_vlan_dev(dev))) | ||
47 | return 0; | ||
48 | |||
46 | skb->dev = vlan_dev_info(dev)->real_dev; | 49 | skb->dev = vlan_dev_info(dev)->real_dev; |
47 | netif_nit_deliver(skb); | 50 | netif_nit_deliver(skb); |
48 | 51 | ||
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index cfdfd7e2a172..6e2371a493b7 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -1392,6 +1392,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1392 | ax25_cb *ax25; | 1392 | ax25_cb *ax25; |
1393 | int err = 0; | 1393 | int err = 0; |
1394 | 1394 | ||
1395 | memset(fsa, 0, sizeof(fsa)); | ||
1395 | lock_sock(sk); | 1396 | lock_sock(sk); |
1396 | ax25 = ax25_sk(sk); | 1397 | ax25 = ax25_sk(sk); |
1397 | 1398 | ||
@@ -1403,7 +1404,6 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1403 | 1404 | ||
1404 | fsa->fsa_ax25.sax25_family = AF_AX25; | 1405 | fsa->fsa_ax25.sax25_family = AF_AX25; |
1405 | fsa->fsa_ax25.sax25_call = ax25->dest_addr; | 1406 | fsa->fsa_ax25.sax25_call = ax25->dest_addr; |
1406 | fsa->fsa_ax25.sax25_ndigis = 0; | ||
1407 | 1407 | ||
1408 | if (ax25->digipeat != NULL) { | 1408 | if (ax25->digipeat != NULL) { |
1409 | ndigi = ax25->digipeat->ndigi; | 1409 | ndigi = ax25->digipeat->ndigi; |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 0b54b7dd8401..dc6020570a32 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -2891,7 +2891,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
2891 | struct l2cap_chan_list *list = &conn->chan_list; | 2891 | struct l2cap_chan_list *list = &conn->chan_list; |
2892 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; | 2892 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; |
2893 | struct l2cap_conn_rsp rsp; | 2893 | struct l2cap_conn_rsp rsp; |
2894 | struct sock *parent, *uninitialized_var(sk); | 2894 | struct sock *parent, *sk = NULL; |
2895 | int result, status = L2CAP_CS_NO_INFO; | 2895 | int result, status = L2CAP_CS_NO_INFO; |
2896 | 2896 | ||
2897 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); | 2897 | u16 dcid = 0, scid = __le16_to_cpu(req->scid); |
@@ -3000,7 +3000,7 @@ sendresp: | |||
3000 | L2CAP_INFO_REQ, sizeof(info), &info); | 3000 | L2CAP_INFO_REQ, sizeof(info), &info); |
3001 | } | 3001 | } |
3002 | 3002 | ||
3003 | if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) && | 3003 | if (sk && !(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) && |
3004 | result == L2CAP_CR_SUCCESS) { | 3004 | result == L2CAP_CR_SUCCESS) { |
3005 | u8 buf[128]; | 3005 | u8 buf[128]; |
3006 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; | 3006 | l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index eb5b256ffc88..f19e347f56f6 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -437,7 +437,7 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
437 | ip6h = ipv6_hdr(skb); | 437 | ip6h = ipv6_hdr(skb); |
438 | 438 | ||
439 | *(__force __be32 *)ip6h = htonl(0x60000000); | 439 | *(__force __be32 *)ip6h = htonl(0x60000000); |
440 | ip6h->payload_len = 8 + sizeof(*mldq); | 440 | ip6h->payload_len = htons(8 + sizeof(*mldq)); |
441 | ip6h->nexthdr = IPPROTO_HOPOPTS; | 441 | ip6h->nexthdr = IPPROTO_HOPOPTS; |
442 | ip6h->hop_limit = 1; | 442 | ip6h->hop_limit = 1; |
443 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); | 443 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 08ffe9e4be20..6faa8256e10c 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -125,7 +125,7 @@ struct bcm_sock { | |||
125 | struct list_head tx_ops; | 125 | struct list_head tx_ops; |
126 | unsigned long dropped_usr_msgs; | 126 | unsigned long dropped_usr_msgs; |
127 | struct proc_dir_entry *bcm_proc_read; | 127 | struct proc_dir_entry *bcm_proc_read; |
128 | char procname [9]; /* pointer printed in ASCII with \0 */ | 128 | char procname [20]; /* pointer printed in ASCII with \0 */ |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) | 131 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) |
diff --git a/net/compat.c b/net/compat.c index 63d260e81472..3649d5895361 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -41,10 +41,12 @@ static inline int iov_from_user_compat_to_kern(struct iovec *kiov, | |||
41 | compat_size_t len; | 41 | compat_size_t len; |
42 | 42 | ||
43 | if (get_user(len, &uiov32->iov_len) || | 43 | if (get_user(len, &uiov32->iov_len) || |
44 | get_user(buf, &uiov32->iov_base)) { | 44 | get_user(buf, &uiov32->iov_base)) |
45 | tot_len = -EFAULT; | 45 | return -EFAULT; |
46 | break; | 46 | |
47 | } | 47 | if (len > INT_MAX - tot_len) |
48 | len = INT_MAX - tot_len; | ||
49 | |||
48 | tot_len += len; | 50 | tot_len += len; |
49 | kiov->iov_base = compat_ptr(buf); | 51 | kiov->iov_base = compat_ptr(buf); |
50 | kiov->iov_len = (__kernel_size_t) len; | 52 | kiov->iov_len = (__kernel_size_t) len; |
diff --git a/net/core/dev.c b/net/core/dev.c index 660dd41aaaa6..1dad6c0926f2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1648,10 +1648,10 @@ EXPORT_SYMBOL(netif_device_attach); | |||
1648 | 1648 | ||
1649 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) | 1649 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) |
1650 | { | 1650 | { |
1651 | return ((features & NETIF_F_GEN_CSUM) || | 1651 | return ((features & NETIF_F_NO_CSUM) || |
1652 | ((features & NETIF_F_IP_CSUM) && | 1652 | ((features & NETIF_F_V4_CSUM) && |
1653 | protocol == htons(ETH_P_IP)) || | 1653 | protocol == htons(ETH_P_IP)) || |
1654 | ((features & NETIF_F_IPV6_CSUM) && | 1654 | ((features & NETIF_F_V6_CSUM) && |
1655 | protocol == htons(ETH_P_IPV6)) || | 1655 | protocol == htons(ETH_P_IPV6)) || |
1656 | ((features & NETIF_F_FCOE_CRC) && | 1656 | ((features & NETIF_F_FCOE_CRC) && |
1657 | protocol == htons(ETH_P_FCOE))); | 1657 | protocol == htons(ETH_P_FCOE))); |
@@ -2891,6 +2891,15 @@ static int __netif_receive_skb(struct sk_buff *skb) | |||
2891 | ncls: | 2891 | ncls: |
2892 | #endif | 2892 | #endif |
2893 | 2893 | ||
2894 | /* If we got this far with a hardware accelerated VLAN tag, it means | ||
2895 | * that we were put in promiscuous mode but nobody is interested in | ||
2896 | * this vid. Drop the packet now to prevent it from getting propagated | ||
2897 | * to other parts of the stack that won't know how to deal with packets | ||
2898 | * tagged in this manner. | ||
2899 | */ | ||
2900 | if (unlikely(vlan_tx_tag_present(skb))) | ||
2901 | goto bypass; | ||
2902 | |||
2894 | /* Handle special case of bridge or macvlan */ | 2903 | /* Handle special case of bridge or macvlan */ |
2895 | rx_handler = rcu_dereference(skb->dev->rx_handler); | 2904 | rx_handler = rcu_dereference(skb->dev->rx_handler); |
2896 | if (rx_handler) { | 2905 | if (rx_handler) { |
@@ -2927,6 +2936,7 @@ ncls: | |||
2927 | } | 2936 | } |
2928 | } | 2937 | } |
2929 | 2938 | ||
2939 | bypass: | ||
2930 | if (pt_prev) { | 2940 | if (pt_prev) { |
2931 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); | 2941 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
2932 | } else { | 2942 | } else { |
diff --git a/net/core/dst.c b/net/core/dst.c index 6c41b1fac3db..2844639dfb79 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -343,6 +343,7 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, | |||
343 | 343 | ||
344 | static struct notifier_block dst_dev_notifier = { | 344 | static struct notifier_block dst_dev_notifier = { |
345 | .notifier_call = dst_dev_event, | 345 | .notifier_call = dst_dev_event, |
346 | .priority = -10, /* must be called after other network notifiers */ | ||
346 | }; | 347 | }; |
347 | 348 | ||
348 | void __init dst_init(void) | 349 | void __init dst_init(void) |
diff --git a/net/core/filter.c b/net/core/filter.c index 52b051f82a01..71a433cdf7d3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -112,39 +112,41 @@ EXPORT_SYMBOL(sk_filter); | |||
112 | */ | 112 | */ |
113 | unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) | 113 | unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) |
114 | { | 114 | { |
115 | struct sock_filter *fentry; /* We walk down these */ | ||
116 | void *ptr; | 115 | void *ptr; |
117 | u32 A = 0; /* Accumulator */ | 116 | u32 A = 0; /* Accumulator */ |
118 | u32 X = 0; /* Index Register */ | 117 | u32 X = 0; /* Index Register */ |
119 | u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ | 118 | u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ |
119 | unsigned long memvalid = 0; | ||
120 | u32 tmp; | 120 | u32 tmp; |
121 | int k; | 121 | int k; |
122 | int pc; | 122 | int pc; |
123 | 123 | ||
124 | BUILD_BUG_ON(BPF_MEMWORDS > BITS_PER_LONG); | ||
124 | /* | 125 | /* |
125 | * Process array of filter instructions. | 126 | * Process array of filter instructions. |
126 | */ | 127 | */ |
127 | for (pc = 0; pc < flen; pc++) { | 128 | for (pc = 0; pc < flen; pc++) { |
128 | fentry = &filter[pc]; | 129 | const struct sock_filter *fentry = &filter[pc]; |
130 | u32 f_k = fentry->k; | ||
129 | 131 | ||
130 | switch (fentry->code) { | 132 | switch (fentry->code) { |
131 | case BPF_S_ALU_ADD_X: | 133 | case BPF_S_ALU_ADD_X: |
132 | A += X; | 134 | A += X; |
133 | continue; | 135 | continue; |
134 | case BPF_S_ALU_ADD_K: | 136 | case BPF_S_ALU_ADD_K: |
135 | A += fentry->k; | 137 | A += f_k; |
136 | continue; | 138 | continue; |
137 | case BPF_S_ALU_SUB_X: | 139 | case BPF_S_ALU_SUB_X: |
138 | A -= X; | 140 | A -= X; |
139 | continue; | 141 | continue; |
140 | case BPF_S_ALU_SUB_K: | 142 | case BPF_S_ALU_SUB_K: |
141 | A -= fentry->k; | 143 | A -= f_k; |
142 | continue; | 144 | continue; |
143 | case BPF_S_ALU_MUL_X: | 145 | case BPF_S_ALU_MUL_X: |
144 | A *= X; | 146 | A *= X; |
145 | continue; | 147 | continue; |
146 | case BPF_S_ALU_MUL_K: | 148 | case BPF_S_ALU_MUL_K: |
147 | A *= fentry->k; | 149 | A *= f_k; |
148 | continue; | 150 | continue; |
149 | case BPF_S_ALU_DIV_X: | 151 | case BPF_S_ALU_DIV_X: |
150 | if (X == 0) | 152 | if (X == 0) |
@@ -152,49 +154,49 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
152 | A /= X; | 154 | A /= X; |
153 | continue; | 155 | continue; |
154 | case BPF_S_ALU_DIV_K: | 156 | case BPF_S_ALU_DIV_K: |
155 | A /= fentry->k; | 157 | A /= f_k; |
156 | continue; | 158 | continue; |
157 | case BPF_S_ALU_AND_X: | 159 | case BPF_S_ALU_AND_X: |
158 | A &= X; | 160 | A &= X; |
159 | continue; | 161 | continue; |
160 | case BPF_S_ALU_AND_K: | 162 | case BPF_S_ALU_AND_K: |
161 | A &= fentry->k; | 163 | A &= f_k; |
162 | continue; | 164 | continue; |
163 | case BPF_S_ALU_OR_X: | 165 | case BPF_S_ALU_OR_X: |
164 | A |= X; | 166 | A |= X; |
165 | continue; | 167 | continue; |
166 | case BPF_S_ALU_OR_K: | 168 | case BPF_S_ALU_OR_K: |
167 | A |= fentry->k; | 169 | A |= f_k; |
168 | continue; | 170 | continue; |
169 | case BPF_S_ALU_LSH_X: | 171 | case BPF_S_ALU_LSH_X: |
170 | A <<= X; | 172 | A <<= X; |
171 | continue; | 173 | continue; |
172 | case BPF_S_ALU_LSH_K: | 174 | case BPF_S_ALU_LSH_K: |
173 | A <<= fentry->k; | 175 | A <<= f_k; |
174 | continue; | 176 | continue; |
175 | case BPF_S_ALU_RSH_X: | 177 | case BPF_S_ALU_RSH_X: |
176 | A >>= X; | 178 | A >>= X; |
177 | continue; | 179 | continue; |
178 | case BPF_S_ALU_RSH_K: | 180 | case BPF_S_ALU_RSH_K: |
179 | A >>= fentry->k; | 181 | A >>= f_k; |
180 | continue; | 182 | continue; |
181 | case BPF_S_ALU_NEG: | 183 | case BPF_S_ALU_NEG: |
182 | A = -A; | 184 | A = -A; |
183 | continue; | 185 | continue; |
184 | case BPF_S_JMP_JA: | 186 | case BPF_S_JMP_JA: |
185 | pc += fentry->k; | 187 | pc += f_k; |
186 | continue; | 188 | continue; |
187 | case BPF_S_JMP_JGT_K: | 189 | case BPF_S_JMP_JGT_K: |
188 | pc += (A > fentry->k) ? fentry->jt : fentry->jf; | 190 | pc += (A > f_k) ? fentry->jt : fentry->jf; |
189 | continue; | 191 | continue; |
190 | case BPF_S_JMP_JGE_K: | 192 | case BPF_S_JMP_JGE_K: |
191 | pc += (A >= fentry->k) ? fentry->jt : fentry->jf; | 193 | pc += (A >= f_k) ? fentry->jt : fentry->jf; |
192 | continue; | 194 | continue; |
193 | case BPF_S_JMP_JEQ_K: | 195 | case BPF_S_JMP_JEQ_K: |
194 | pc += (A == fentry->k) ? fentry->jt : fentry->jf; | 196 | pc += (A == f_k) ? fentry->jt : fentry->jf; |
195 | continue; | 197 | continue; |
196 | case BPF_S_JMP_JSET_K: | 198 | case BPF_S_JMP_JSET_K: |
197 | pc += (A & fentry->k) ? fentry->jt : fentry->jf; | 199 | pc += (A & f_k) ? fentry->jt : fentry->jf; |
198 | continue; | 200 | continue; |
199 | case BPF_S_JMP_JGT_X: | 201 | case BPF_S_JMP_JGT_X: |
200 | pc += (A > X) ? fentry->jt : fentry->jf; | 202 | pc += (A > X) ? fentry->jt : fentry->jf; |
@@ -209,7 +211,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
209 | pc += (A & X) ? fentry->jt : fentry->jf; | 211 | pc += (A & X) ? fentry->jt : fentry->jf; |
210 | continue; | 212 | continue; |
211 | case BPF_S_LD_W_ABS: | 213 | case BPF_S_LD_W_ABS: |
212 | k = fentry->k; | 214 | k = f_k; |
213 | load_w: | 215 | load_w: |
214 | ptr = load_pointer(skb, k, 4, &tmp); | 216 | ptr = load_pointer(skb, k, 4, &tmp); |
215 | if (ptr != NULL) { | 217 | if (ptr != NULL) { |
@@ -218,7 +220,7 @@ load_w: | |||
218 | } | 220 | } |
219 | break; | 221 | break; |
220 | case BPF_S_LD_H_ABS: | 222 | case BPF_S_LD_H_ABS: |
221 | k = fentry->k; | 223 | k = f_k; |
222 | load_h: | 224 | load_h: |
223 | ptr = load_pointer(skb, k, 2, &tmp); | 225 | ptr = load_pointer(skb, k, 2, &tmp); |
224 | if (ptr != NULL) { | 226 | if (ptr != NULL) { |
@@ -227,7 +229,7 @@ load_h: | |||
227 | } | 229 | } |
228 | break; | 230 | break; |
229 | case BPF_S_LD_B_ABS: | 231 | case BPF_S_LD_B_ABS: |
230 | k = fentry->k; | 232 | k = f_k; |
231 | load_b: | 233 | load_b: |
232 | ptr = load_pointer(skb, k, 1, &tmp); | 234 | ptr = load_pointer(skb, k, 1, &tmp); |
233 | if (ptr != NULL) { | 235 | if (ptr != NULL) { |
@@ -242,32 +244,34 @@ load_b: | |||
242 | X = skb->len; | 244 | X = skb->len; |
243 | continue; | 245 | continue; |
244 | case BPF_S_LD_W_IND: | 246 | case BPF_S_LD_W_IND: |
245 | k = X + fentry->k; | 247 | k = X + f_k; |
246 | goto load_w; | 248 | goto load_w; |
247 | case BPF_S_LD_H_IND: | 249 | case BPF_S_LD_H_IND: |
248 | k = X + fentry->k; | 250 | k = X + f_k; |
249 | goto load_h; | 251 | goto load_h; |
250 | case BPF_S_LD_B_IND: | 252 | case BPF_S_LD_B_IND: |
251 | k = X + fentry->k; | 253 | k = X + f_k; |
252 | goto load_b; | 254 | goto load_b; |
253 | case BPF_S_LDX_B_MSH: | 255 | case BPF_S_LDX_B_MSH: |
254 | ptr = load_pointer(skb, fentry->k, 1, &tmp); | 256 | ptr = load_pointer(skb, f_k, 1, &tmp); |
255 | if (ptr != NULL) { | 257 | if (ptr != NULL) { |
256 | X = (*(u8 *)ptr & 0xf) << 2; | 258 | X = (*(u8 *)ptr & 0xf) << 2; |
257 | continue; | 259 | continue; |
258 | } | 260 | } |
259 | return 0; | 261 | return 0; |
260 | case BPF_S_LD_IMM: | 262 | case BPF_S_LD_IMM: |
261 | A = fentry->k; | 263 | A = f_k; |
262 | continue; | 264 | continue; |
263 | case BPF_S_LDX_IMM: | 265 | case BPF_S_LDX_IMM: |
264 | X = fentry->k; | 266 | X = f_k; |
265 | continue; | 267 | continue; |
266 | case BPF_S_LD_MEM: | 268 | case BPF_S_LD_MEM: |
267 | A = mem[fentry->k]; | 269 | A = (memvalid & (1UL << f_k)) ? |
270 | mem[f_k] : 0; | ||
268 | continue; | 271 | continue; |
269 | case BPF_S_LDX_MEM: | 272 | case BPF_S_LDX_MEM: |
270 | X = mem[fentry->k]; | 273 | X = (memvalid & (1UL << f_k)) ? |
274 | mem[f_k] : 0; | ||
271 | continue; | 275 | continue; |
272 | case BPF_S_MISC_TAX: | 276 | case BPF_S_MISC_TAX: |
273 | X = A; | 277 | X = A; |
@@ -276,14 +280,16 @@ load_b: | |||
276 | A = X; | 280 | A = X; |
277 | continue; | 281 | continue; |
278 | case BPF_S_RET_K: | 282 | case BPF_S_RET_K: |
279 | return fentry->k; | 283 | return f_k; |
280 | case BPF_S_RET_A: | 284 | case BPF_S_RET_A: |
281 | return A; | 285 | return A; |
282 | case BPF_S_ST: | 286 | case BPF_S_ST: |
283 | mem[fentry->k] = A; | 287 | memvalid |= 1UL << f_k; |
288 | mem[f_k] = A; | ||
284 | continue; | 289 | continue; |
285 | case BPF_S_STX: | 290 | case BPF_S_STX: |
286 | mem[fentry->k] = X; | 291 | memvalid |= 1UL << f_k; |
292 | mem[f_k] = X; | ||
287 | continue; | 293 | continue; |
288 | default: | 294 | default: |
289 | WARN_ON(1); | 295 | WARN_ON(1); |
@@ -583,23 +589,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
583 | EXPORT_SYMBOL(sk_chk_filter); | 589 | EXPORT_SYMBOL(sk_chk_filter); |
584 | 590 | ||
585 | /** | 591 | /** |
586 | * sk_filter_rcu_release: Release a socket filter by rcu_head | 592 | * sk_filter_release_rcu - Release a socket filter by rcu_head |
587 | * @rcu: rcu_head that contains the sk_filter to free | 593 | * @rcu: rcu_head that contains the sk_filter to free |
588 | */ | 594 | */ |
589 | static void sk_filter_rcu_release(struct rcu_head *rcu) | 595 | void sk_filter_release_rcu(struct rcu_head *rcu) |
590 | { | 596 | { |
591 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 597 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
592 | 598 | ||
593 | sk_filter_release(fp); | 599 | kfree(fp); |
594 | } | ||
595 | |||
596 | static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp) | ||
597 | { | ||
598 | unsigned int size = sk_filter_len(fp); | ||
599 | |||
600 | atomic_sub(size, &sk->sk_omem_alloc); | ||
601 | call_rcu_bh(&fp->rcu, sk_filter_rcu_release); | ||
602 | } | 600 | } |
601 | EXPORT_SYMBOL(sk_filter_release_rcu); | ||
603 | 602 | ||
604 | /** | 603 | /** |
605 | * sk_attach_filter - attach a socket filter | 604 | * sk_attach_filter - attach a socket filter |
@@ -644,7 +643,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
644 | rcu_read_unlock_bh(); | 643 | rcu_read_unlock_bh(); |
645 | 644 | ||
646 | if (old_fp) | 645 | if (old_fp) |
647 | sk_filter_delayed_uncharge(sk, old_fp); | 646 | sk_filter_uncharge(sk, old_fp); |
648 | return 0; | 647 | return 0; |
649 | } | 648 | } |
650 | EXPORT_SYMBOL_GPL(sk_attach_filter); | 649 | EXPORT_SYMBOL_GPL(sk_attach_filter); |
@@ -658,7 +657,7 @@ int sk_detach_filter(struct sock *sk) | |||
658 | filter = rcu_dereference_bh(sk->sk_filter); | 657 | filter = rcu_dereference_bh(sk->sk_filter); |
659 | if (filter) { | 658 | if (filter) { |
660 | rcu_assign_pointer(sk->sk_filter, NULL); | 659 | rcu_assign_pointer(sk->sk_filter, NULL); |
661 | sk_filter_delayed_uncharge(sk, filter); | 660 | sk_filter_uncharge(sk, filter); |
662 | ret = 0; | 661 | ret = 0; |
663 | } | 662 | } |
664 | rcu_read_unlock_bh(); | 663 | rcu_read_unlock_bh(); |
diff --git a/net/core/iovec.c b/net/core/iovec.c index e6b133b77ccb..58eb9999f89d 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c | |||
@@ -35,10 +35,9 @@ | |||
35 | * in any case. | 35 | * in any case. |
36 | */ | 36 | */ |
37 | 37 | ||
38 | long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) | 38 | int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) |
39 | { | 39 | { |
40 | int size, ct; | 40 | int size, ct, err; |
41 | long err; | ||
42 | 41 | ||
43 | if (m->msg_namelen) { | 42 | if (m->msg_namelen) { |
44 | if (mode == VERIFY_READ) { | 43 | if (mode == VERIFY_READ) { |
@@ -60,14 +59,13 @@ long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, | |||
60 | err = 0; | 59 | err = 0; |
61 | 60 | ||
62 | for (ct = 0; ct < m->msg_iovlen; ct++) { | 61 | for (ct = 0; ct < m->msg_iovlen; ct++) { |
63 | err += iov[ct].iov_len; | 62 | size_t len = iov[ct].iov_len; |
64 | /* | 63 | |
65 | * Goal is not to verify user data, but to prevent returning | 64 | if (len > INT_MAX - err) { |
66 | * negative value, which is interpreted as errno. | 65 | len = INT_MAX - err; |
67 | * Overflow is still possible, but it is harmless. | 66 | iov[ct].iov_len = len; |
68 | */ | 67 | } |
69 | if (err < 0) | 68 | err += len; |
70 | return -EMSGSIZE; | ||
71 | } | 69 | } |
72 | 70 | ||
73 | return err; | 71 | return err; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index f78d821bd935..29d7bce933f2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1546,6 +1546,9 @@ replay: | |||
1546 | snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); | 1546 | snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); |
1547 | 1547 | ||
1548 | dest_net = rtnl_link_get_net(net, tb); | 1548 | dest_net = rtnl_link_get_net(net, tb); |
1549 | if (IS_ERR(dest_net)) | ||
1550 | return PTR_ERR(dest_net); | ||
1551 | |||
1549 | dev = rtnl_create_link(net, dest_net, ifname, ops, tb); | 1552 | dev = rtnl_create_link(net, dest_net, ifname, ops, tb); |
1550 | 1553 | ||
1551 | if (IS_ERR(dev)) | 1554 | if (IS_ERR(dev)) |
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index 0ae6c22da85b..c19bb4ee405e 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c | |||
@@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) | |||
96 | struct phy_device *phydev; | 96 | struct phy_device *phydev; |
97 | unsigned int type; | 97 | unsigned int type; |
98 | 98 | ||
99 | skb_push(skb, ETH_HLEN); | 99 | if (skb_headroom(skb) < ETH_HLEN) |
100 | return false; | ||
101 | __skb_push(skb, ETH_HLEN); | ||
100 | 102 | ||
101 | type = classify(skb); | 103 | type = classify(skb); |
102 | 104 | ||
103 | skb_pull(skb, ETH_HLEN); | 105 | __skb_pull(skb, ETH_HLEN); |
104 | 106 | ||
105 | switch (type) { | 107 | switch (type) { |
106 | case PTP_CLASS_V1_IPV4: | 108 | case PTP_CLASS_V1_IPV4: |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index d6b93d19790f..cf38f52be4f7 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -1556,6 +1556,8 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us | |||
1556 | if (r_len > sizeof(struct linkinfo_dn)) | 1556 | if (r_len > sizeof(struct linkinfo_dn)) |
1557 | r_len = sizeof(struct linkinfo_dn); | 1557 | r_len = sizeof(struct linkinfo_dn); |
1558 | 1558 | ||
1559 | memset(&link, 0, sizeof(link)); | ||
1560 | |||
1559 | switch(sock->state) { | 1561 | switch(sock->state) { |
1560 | case SS_CONNECTING: | 1562 | case SS_CONNECTING: |
1561 | link.idn_linkstate = LL_CONNECTING; | 1563 | link.idn_linkstate = LL_CONNECTING; |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index dc54bd0d083b..172a6a91a214 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
32 | #include <linux/udp.h> | 32 | #include <linux/udp.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/vmalloc.h> | ||
34 | #include <net/sock.h> | 35 | #include <net/sock.h> |
35 | #include <net/inet_common.h> | 36 | #include <net/inet_common.h> |
36 | #include <linux/stat.h> | 37 | #include <linux/stat.h> |
@@ -276,12 +277,12 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
276 | #endif | 277 | #endif |
277 | #ifdef CONFIG_ECONET_AUNUDP | 278 | #ifdef CONFIG_ECONET_AUNUDP |
278 | struct msghdr udpmsg; | 279 | struct msghdr udpmsg; |
279 | struct iovec iov[msg->msg_iovlen+1]; | 280 | struct iovec iov[2]; |
280 | struct aunhdr ah; | 281 | struct aunhdr ah; |
281 | struct sockaddr_in udpdest; | 282 | struct sockaddr_in udpdest; |
282 | __kernel_size_t size; | 283 | __kernel_size_t size; |
283 | int i; | ||
284 | mm_segment_t oldfs; | 284 | mm_segment_t oldfs; |
285 | char *userbuf; | ||
285 | #endif | 286 | #endif |
286 | 287 | ||
287 | /* | 288 | /* |
@@ -297,23 +298,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
297 | 298 | ||
298 | mutex_lock(&econet_mutex); | 299 | mutex_lock(&econet_mutex); |
299 | 300 | ||
300 | if (saddr == NULL) { | 301 | if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
301 | struct econet_sock *eo = ec_sk(sk); | 302 | mutex_unlock(&econet_mutex); |
302 | 303 | return -EINVAL; | |
303 | addr.station = eo->station; | 304 | } |
304 | addr.net = eo->net; | 305 | addr.station = saddr->addr.station; |
305 | port = eo->port; | 306 | addr.net = saddr->addr.net; |
306 | cb = eo->cb; | 307 | port = saddr->port; |
307 | } else { | 308 | cb = saddr->cb; |
308 | if (msg->msg_namelen < sizeof(struct sockaddr_ec)) { | ||
309 | mutex_unlock(&econet_mutex); | ||
310 | return -EINVAL; | ||
311 | } | ||
312 | addr.station = saddr->addr.station; | ||
313 | addr.net = saddr->addr.net; | ||
314 | port = saddr->port; | ||
315 | cb = saddr->cb; | ||
316 | } | ||
317 | 309 | ||
318 | /* Look for a device with the right network number. */ | 310 | /* Look for a device with the right network number. */ |
319 | dev = net2dev_map[addr.net]; | 311 | dev = net2dev_map[addr.net]; |
@@ -328,17 +320,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
328 | } | 320 | } |
329 | } | 321 | } |
330 | 322 | ||
331 | if (len + 15 > dev->mtu) { | ||
332 | mutex_unlock(&econet_mutex); | ||
333 | return -EMSGSIZE; | ||
334 | } | ||
335 | |||
336 | if (dev->type == ARPHRD_ECONET) { | 323 | if (dev->type == ARPHRD_ECONET) { |
337 | /* Real hardware Econet. We're not worthy etc. */ | 324 | /* Real hardware Econet. We're not worthy etc. */ |
338 | #ifdef CONFIG_ECONET_NATIVE | 325 | #ifdef CONFIG_ECONET_NATIVE |
339 | unsigned short proto = 0; | 326 | unsigned short proto = 0; |
340 | int res; | 327 | int res; |
341 | 328 | ||
329 | if (len + 15 > dev->mtu) { | ||
330 | mutex_unlock(&econet_mutex); | ||
331 | return -EMSGSIZE; | ||
332 | } | ||
333 | |||
342 | dev_hold(dev); | 334 | dev_hold(dev); |
343 | 335 | ||
344 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), | 336 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), |
@@ -351,7 +343,6 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
351 | 343 | ||
352 | eb = (struct ec_cb *)&skb->cb; | 344 | eb = (struct ec_cb *)&skb->cb; |
353 | 345 | ||
354 | /* BUG: saddr may be NULL */ | ||
355 | eb->cookie = saddr->cookie; | 346 | eb->cookie = saddr->cookie; |
356 | eb->sec = *saddr; | 347 | eb->sec = *saddr; |
357 | eb->sent = ec_tx_done; | 348 | eb->sent = ec_tx_done; |
@@ -415,6 +406,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
415 | return -ENETDOWN; /* No socket - can't send */ | 406 | return -ENETDOWN; /* No socket - can't send */ |
416 | } | 407 | } |
417 | 408 | ||
409 | if (len > 32768) { | ||
410 | err = -E2BIG; | ||
411 | goto error; | ||
412 | } | ||
413 | |||
418 | /* Make up a UDP datagram and hand it off to some higher intellect. */ | 414 | /* Make up a UDP datagram and hand it off to some higher intellect. */ |
419 | 415 | ||
420 | memset(&udpdest, 0, sizeof(udpdest)); | 416 | memset(&udpdest, 0, sizeof(udpdest)); |
@@ -446,36 +442,26 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
446 | 442 | ||
447 | /* tack our header on the front of the iovec */ | 443 | /* tack our header on the front of the iovec */ |
448 | size = sizeof(struct aunhdr); | 444 | size = sizeof(struct aunhdr); |
449 | /* | ||
450 | * XXX: that is b0rken. We can't mix userland and kernel pointers | ||
451 | * in iovec, since on a lot of platforms copy_from_user() will | ||
452 | * *not* work with the kernel and userland ones at the same time, | ||
453 | * regardless of what we do with set_fs(). And we are talking about | ||
454 | * econet-over-ethernet here, so "it's only ARM anyway" doesn't | ||
455 | * apply. Any suggestions on fixing that code? -- AV | ||
456 | */ | ||
457 | iov[0].iov_base = (void *)&ah; | 445 | iov[0].iov_base = (void *)&ah; |
458 | iov[0].iov_len = size; | 446 | iov[0].iov_len = size; |
459 | for (i = 0; i < msg->msg_iovlen; i++) { | 447 | |
460 | void __user *base = msg->msg_iov[i].iov_base; | 448 | userbuf = vmalloc(len); |
461 | size_t iov_len = msg->msg_iov[i].iov_len; | 449 | if (userbuf == NULL) { |
462 | /* Check it now since we switch to KERNEL_DS later. */ | 450 | err = -ENOMEM; |
463 | if (!access_ok(VERIFY_READ, base, iov_len)) { | 451 | goto error; |
464 | mutex_unlock(&econet_mutex); | ||
465 | return -EFAULT; | ||
466 | } | ||
467 | iov[i+1].iov_base = base; | ||
468 | iov[i+1].iov_len = iov_len; | ||
469 | size += iov_len; | ||
470 | } | 452 | } |
471 | 453 | ||
454 | iov[1].iov_base = userbuf; | ||
455 | iov[1].iov_len = len; | ||
456 | err = memcpy_fromiovec(userbuf, msg->msg_iov, len); | ||
457 | if (err) | ||
458 | goto error_free_buf; | ||
459 | |||
472 | /* Get a skbuff (no data, just holds our cb information) */ | 460 | /* Get a skbuff (no data, just holds our cb information) */ |
473 | if ((skb = sock_alloc_send_skb(sk, 0, | 461 | if ((skb = sock_alloc_send_skb(sk, 0, |
474 | msg->msg_flags & MSG_DONTWAIT, | 462 | msg->msg_flags & MSG_DONTWAIT, |
475 | &err)) == NULL) { | 463 | &err)) == NULL) |
476 | mutex_unlock(&econet_mutex); | 464 | goto error_free_buf; |
477 | return err; | ||
478 | } | ||
479 | 465 | ||
480 | eb = (struct ec_cb *)&skb->cb; | 466 | eb = (struct ec_cb *)&skb->cb; |
481 | 467 | ||
@@ -491,7 +477,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
491 | udpmsg.msg_name = (void *)&udpdest; | 477 | udpmsg.msg_name = (void *)&udpdest; |
492 | udpmsg.msg_namelen = sizeof(udpdest); | 478 | udpmsg.msg_namelen = sizeof(udpdest); |
493 | udpmsg.msg_iov = &iov[0]; | 479 | udpmsg.msg_iov = &iov[0]; |
494 | udpmsg.msg_iovlen = msg->msg_iovlen + 1; | 480 | udpmsg.msg_iovlen = 2; |
495 | udpmsg.msg_control = NULL; | 481 | udpmsg.msg_control = NULL; |
496 | udpmsg.msg_controllen = 0; | 482 | udpmsg.msg_controllen = 0; |
497 | udpmsg.msg_flags=0; | 483 | udpmsg.msg_flags=0; |
@@ -499,9 +485,13 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
499 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ | 485 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ |
500 | err = sock_sendmsg(udpsock, &udpmsg, size); | 486 | err = sock_sendmsg(udpsock, &udpmsg, size); |
501 | set_fs(oldfs); | 487 | set_fs(oldfs); |
488 | |||
489 | error_free_buf: | ||
490 | vfree(userbuf); | ||
502 | #else | 491 | #else |
503 | err = -EPROTOTYPE; | 492 | err = -EPROTOTYPE; |
504 | #endif | 493 | #endif |
494 | error: | ||
505 | mutex_unlock(&econet_mutex); | 495 | mutex_unlock(&econet_mutex); |
506 | 496 | ||
507 | return err; | 497 | return err; |
@@ -671,6 +661,11 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
671 | err = 0; | 661 | err = 0; |
672 | switch (cmd) { | 662 | switch (cmd) { |
673 | case SIOCSIFADDR: | 663 | case SIOCSIFADDR: |
664 | if (!capable(CAP_NET_ADMIN)) { | ||
665 | err = -EPERM; | ||
666 | break; | ||
667 | } | ||
668 | |||
674 | edev = dev->ec_ptr; | 669 | edev = dev->ec_ptr; |
675 | if (edev == NULL) { | 670 | if (edev == NULL) { |
676 | /* Magic up a new one. */ | 671 | /* Magic up a new one. */ |
@@ -856,9 +851,13 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
856 | { | 851 | { |
857 | struct iphdr *ip = ip_hdr(skb); | 852 | struct iphdr *ip = ip_hdr(skb); |
858 | unsigned char stn = ntohl(ip->saddr) & 0xff; | 853 | unsigned char stn = ntohl(ip->saddr) & 0xff; |
854 | struct dst_entry *dst = skb_dst(skb); | ||
855 | struct ec_device *edev = NULL; | ||
859 | struct sock *sk = NULL; | 856 | struct sock *sk = NULL; |
860 | struct sk_buff *newskb; | 857 | struct sk_buff *newskb; |
861 | struct ec_device *edev = skb->dev->ec_ptr; | 858 | |
859 | if (dst) | ||
860 | edev = dst->dev->ec_ptr; | ||
862 | 861 | ||
863 | if (! edev) | 862 | if (! edev) |
864 | goto bad; | 863 | goto bad; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f115ea68a4ef..6adb1abf05e0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2246,7 +2246,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
2246 | /* Values greater than interface MTU won't take effect. However | 2246 | /* Values greater than interface MTU won't take effect. However |
2247 | * at the point when this call is done we typically don't yet | 2247 | * at the point when this call is done we typically don't yet |
2248 | * know which interface is going to be used */ | 2248 | * know which interface is going to be used */ |
2249 | if (val < 8 || val > MAX_TCP_WINDOW) { | 2249 | if (val < TCP_MIN_MSS || val > MAX_TCP_WINDOW) { |
2250 | err = -EINVAL; | 2250 | err = -EINVAL; |
2251 | break; | 2251 | break; |
2252 | } | 2252 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 020766292bb0..cb8d305cb5b4 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -415,6 +415,9 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
415 | !icsk->icsk_backoff) | 415 | !icsk->icsk_backoff) |
416 | break; | 416 | break; |
417 | 417 | ||
418 | if (sock_owned_by_user(sk)) | ||
419 | break; | ||
420 | |||
418 | icsk->icsk_backoff--; | 421 | icsk->icsk_backoff--; |
419 | inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) << | 422 | inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) << |
420 | icsk->icsk_backoff; | 423 | icsk->icsk_backoff; |
@@ -429,11 +432,6 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
429 | if (remaining) { | 432 | if (remaining) { |
430 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | 433 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |
431 | remaining, TCP_RTO_MAX); | 434 | remaining, TCP_RTO_MAX); |
432 | } else if (sock_owned_by_user(sk)) { | ||
433 | /* RTO revert clocked out retransmission, | ||
434 | * but socket is locked. Will defer. */ | ||
435 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | ||
436 | HZ/20, TCP_RTO_MAX); | ||
437 | } else { | 435 | } else { |
438 | /* RTO revert clocked out retransmission. | 436 | /* RTO revert clocked out retransmission. |
439 | * Will retransmit now */ | 437 | * Will retransmit now */ |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index de3bd8458588..7abecf73add9 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -237,11 +237,10 @@ void tcp_select_initial_window(int __space, __u32 mss, | |||
237 | /* when initializing use the value from init_rcv_wnd | 237 | /* when initializing use the value from init_rcv_wnd |
238 | * rather than the default from above | 238 | * rather than the default from above |
239 | */ | 239 | */ |
240 | if (init_rcv_wnd && | 240 | if (init_rcv_wnd) |
241 | (*rcv_wnd > init_rcv_wnd * mss)) | 241 | *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); |
242 | *rcv_wnd = init_rcv_wnd * mss; | 242 | else |
243 | else if (*rcv_wnd > init_cwnd * mss) | 243 | *rcv_wnd = min(*rcv_wnd, init_cwnd * mss); |
244 | *rcv_wnd = init_cwnd * mss; | ||
245 | } | 244 | } |
246 | 245 | ||
247 | /* Set the clamp no higher than max representable value */ | 246 | /* Set the clamp no higher than max representable value */ |
@@ -392,27 +391,30 @@ struct tcp_out_options { | |||
392 | */ | 391 | */ |
393 | static u8 tcp_cookie_size_check(u8 desired) | 392 | static u8 tcp_cookie_size_check(u8 desired) |
394 | { | 393 | { |
395 | if (desired > 0) { | 394 | int cookie_size; |
395 | |||
396 | if (desired > 0) | ||
396 | /* previously specified */ | 397 | /* previously specified */ |
397 | return desired; | 398 | return desired; |
398 | } | 399 | |
399 | if (sysctl_tcp_cookie_size <= 0) { | 400 | cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size); |
401 | if (cookie_size <= 0) | ||
400 | /* no default specified */ | 402 | /* no default specified */ |
401 | return 0; | 403 | return 0; |
402 | } | 404 | |
403 | if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) { | 405 | if (cookie_size <= TCP_COOKIE_MIN) |
404 | /* value too small, specify minimum */ | 406 | /* value too small, specify minimum */ |
405 | return TCP_COOKIE_MIN; | 407 | return TCP_COOKIE_MIN; |
406 | } | 408 | |
407 | if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) { | 409 | if (cookie_size >= TCP_COOKIE_MAX) |
408 | /* value too large, specify maximum */ | 410 | /* value too large, specify maximum */ |
409 | return TCP_COOKIE_MAX; | 411 | return TCP_COOKIE_MAX; |
410 | } | 412 | |
411 | if (0x1 & sysctl_tcp_cookie_size) { | 413 | if (cookie_size & 1) |
412 | /* 8-bit multiple, illegal, fix it */ | 414 | /* 8-bit multiple, illegal, fix it */ |
413 | return (u8)(sysctl_tcp_cookie_size + 0x1); | 415 | cookie_size++; |
414 | } | 416 | |
415 | return (u8)sysctl_tcp_cookie_size; | 417 | return (u8)cookie_size; |
416 | } | 418 | } |
417 | 419 | ||
418 | /* Write previously computed TCP options to the packet. | 420 | /* Write previously computed TCP options to the packet. |
@@ -1519,6 +1521,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) | |||
1519 | struct tcp_sock *tp = tcp_sk(sk); | 1521 | struct tcp_sock *tp = tcp_sk(sk); |
1520 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1522 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1521 | u32 send_win, cong_win, limit, in_flight; | 1523 | u32 send_win, cong_win, limit, in_flight; |
1524 | int win_divisor; | ||
1522 | 1525 | ||
1523 | if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) | 1526 | if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) |
1524 | goto send_now; | 1527 | goto send_now; |
@@ -1550,13 +1553,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) | |||
1550 | if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) | 1553 | if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) |
1551 | goto send_now; | 1554 | goto send_now; |
1552 | 1555 | ||
1553 | if (sysctl_tcp_tso_win_divisor) { | 1556 | win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor); |
1557 | if (win_divisor) { | ||
1554 | u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); | 1558 | u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); |
1555 | 1559 | ||
1556 | /* If at least some fraction of a window is available, | 1560 | /* If at least some fraction of a window is available, |
1557 | * just use it. | 1561 | * just use it. |
1558 | */ | 1562 | */ |
1559 | chunk /= sysctl_tcp_tso_win_divisor; | 1563 | chunk /= win_divisor; |
1560 | if (limit >= chunk) | 1564 | if (limit >= chunk) |
1561 | goto send_now; | 1565 | goto send_now; |
1562 | } else { | 1566 | } else { |
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index fce364c6c71a..5b743bdd89ba 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -502,7 +502,8 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); | 502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); |
503 | 503 | ||
504 | /* Make sure the string is null-terminated */ | 504 | /* Make sure the string is null-terminated */ |
505 | fp[n+value_len] = 0x00; | 505 | if (n + value_len < skb->len) |
506 | fp[n + value_len] = 0x00; | ||
506 | IRDA_DEBUG(4, "Got string %s\n", fp+n); | 507 | IRDA_DEBUG(4, "Got string %s\n", fp+n); |
507 | 508 | ||
508 | /* Will truncate to IAS_MAX_STRING bytes */ | 509 | /* Will truncate to IAS_MAX_STRING bytes */ |
diff --git a/net/irda/parameters.c b/net/irda/parameters.c index fc1a20565e2d..71cd38c1a67f 100644 --- a/net/irda/parameters.c +++ b/net/irda/parameters.c | |||
@@ -298,6 +298,8 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
298 | 298 | ||
299 | p.pi = pi; /* In case handler needs to know */ | 299 | p.pi = pi; /* In case handler needs to know */ |
300 | p.pl = buf[1]; /* Extract length of value */ | 300 | p.pl = buf[1]; /* Extract length of value */ |
301 | if (p.pl > 32) | ||
302 | p.pl = 32; | ||
301 | 303 | ||
302 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, | 304 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, |
303 | p.pi, p.pl); | 305 | p.pi, p.pl); |
@@ -318,7 +320,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
318 | (__u8) str[0], (__u8) str[1]); | 320 | (__u8) str[0], (__u8) str[1]); |
319 | 321 | ||
320 | /* Null terminate string */ | 322 | /* Null terminate string */ |
321 | str[p.pl+1] = '\0'; | 323 | str[p.pl] = '\0'; |
322 | 324 | ||
323 | p.pv.c = str; /* Handler will need to take a copy */ | 325 | p.pv.c = str; /* Handler will need to take a copy */ |
324 | 326 | ||
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 226a0ae3bcfd..a2cec796a321 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -676,4 +676,8 @@ MODULE_LICENSE("GPL"); | |||
676 | MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); | 676 | MODULE_AUTHOR("James Chapman <jchapman@katalix.com>"); |
677 | MODULE_DESCRIPTION("L2TP over IP"); | 677 | MODULE_DESCRIPTION("L2TP over IP"); |
678 | MODULE_VERSION("1.0"); | 678 | MODULE_VERSION("1.0"); |
679 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, SOCK_DGRAM, IPPROTO_L2TP); | 679 | |
680 | /* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like | ||
681 | * enums | ||
682 | */ | ||
683 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); | ||
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 582612998211..e35dbe55f520 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -317,8 +317,9 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
317 | goto out; | 317 | goto out; |
318 | rc = -ENODEV; | 318 | rc = -ENODEV; |
319 | rtnl_lock(); | 319 | rtnl_lock(); |
320 | rcu_read_lock(); | ||
320 | if (sk->sk_bound_dev_if) { | 321 | if (sk->sk_bound_dev_if) { |
321 | llc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if); | 322 | llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if); |
322 | if (llc->dev) { | 323 | if (llc->dev) { |
323 | if (!addr->sllc_arphrd) | 324 | if (!addr->sllc_arphrd) |
324 | addr->sllc_arphrd = llc->dev->type; | 325 | addr->sllc_arphrd = llc->dev->type; |
@@ -329,13 +330,13 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) | |||
329 | !llc_mac_match(addr->sllc_mac, | 330 | !llc_mac_match(addr->sllc_mac, |
330 | llc->dev->dev_addr)) { | 331 | llc->dev->dev_addr)) { |
331 | rc = -EINVAL; | 332 | rc = -EINVAL; |
332 | dev_put(llc->dev); | ||
333 | llc->dev = NULL; | 333 | llc->dev = NULL; |
334 | } | 334 | } |
335 | } | 335 | } |
336 | } else | 336 | } else |
337 | llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, | 337 | llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, |
338 | addr->sllc_mac); | 338 | addr->sllc_mac); |
339 | rcu_read_unlock(); | ||
339 | rtnl_unlock(); | 340 | rtnl_unlock(); |
340 | if (!llc->dev) | 341 | if (!llc->dev) |
341 | goto out; | 342 | goto out; |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 965b272499fd..2f6903e48dd9 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -172,8 +172,6 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
172 | struct ieee80211_mgmt *mgmt, | 172 | struct ieee80211_mgmt *mgmt, |
173 | size_t len) | 173 | size_t len) |
174 | { | 174 | { |
175 | struct ieee80211_hw *hw = &local->hw; | ||
176 | struct ieee80211_conf *conf = &hw->conf; | ||
177 | struct tid_ampdu_rx *tid_agg_rx; | 175 | struct tid_ampdu_rx *tid_agg_rx; |
178 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; | 176 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; |
179 | u8 dialog_token; | 177 | u8 dialog_token; |
@@ -218,13 +216,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, | |||
218 | goto end_no_lock; | 216 | goto end_no_lock; |
219 | } | 217 | } |
220 | /* determine default buffer size */ | 218 | /* determine default buffer size */ |
221 | if (buf_size == 0) { | 219 | if (buf_size == 0) |
222 | struct ieee80211_supported_band *sband; | 220 | buf_size = IEEE80211_MAX_AMPDU_BUF; |
223 | |||
224 | sband = local->hw.wiphy->bands[conf->channel->band]; | ||
225 | buf_size = IEEE80211_MIN_AMPDU_BUF; | ||
226 | buf_size = buf_size << sband->ht_cap.ampdu_factor; | ||
227 | } | ||
228 | 221 | ||
229 | 222 | ||
230 | /* examine state machine */ | 223 | /* examine state machine */ |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 29ac8e1a509e..2095602dcc3a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -634,6 +634,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
634 | struct sta_info *sta, | 634 | struct sta_info *sta, |
635 | struct station_parameters *params) | 635 | struct station_parameters *params) |
636 | { | 636 | { |
637 | unsigned long flags; | ||
637 | u32 rates; | 638 | u32 rates; |
638 | int i, j; | 639 | int i, j; |
639 | struct ieee80211_supported_band *sband; | 640 | struct ieee80211_supported_band *sband; |
@@ -642,7 +643,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
642 | 643 | ||
643 | sband = local->hw.wiphy->bands[local->oper_channel->band]; | 644 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
644 | 645 | ||
645 | spin_lock_bh(&sta->lock); | 646 | spin_lock_irqsave(&sta->flaglock, flags); |
646 | mask = params->sta_flags_mask; | 647 | mask = params->sta_flags_mask; |
647 | set = params->sta_flags_set; | 648 | set = params->sta_flags_set; |
648 | 649 | ||
@@ -669,7 +670,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
669 | if (set & BIT(NL80211_STA_FLAG_MFP)) | 670 | if (set & BIT(NL80211_STA_FLAG_MFP)) |
670 | sta->flags |= WLAN_STA_MFP; | 671 | sta->flags |= WLAN_STA_MFP; |
671 | } | 672 | } |
672 | spin_unlock_bh(&sta->lock); | 673 | spin_unlock_irqrestore(&sta->flaglock, flags); |
673 | 674 | ||
674 | /* | 675 | /* |
675 | * cfg80211 validates this (1-2007) and allows setting the AID | 676 | * cfg80211 validates this (1-2007) and allows setting the AID |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index c691780725a7..45c99f096c7b 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -435,6 +435,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, | |||
435 | if (!sta) | 435 | if (!sta) |
436 | return NULL; | 436 | return NULL; |
437 | 437 | ||
438 | sta->last_rx = jiffies; | ||
438 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); | 439 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); |
439 | 440 | ||
440 | /* make sure mandatory rates are always added */ | 441 | /* make sure mandatory rates are always added */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 65e0ed6c2975..3546054505ab 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1003,6 +1003,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); | |||
1003 | void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); | 1003 | void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); |
1004 | void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | 1004 | void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
1005 | struct sk_buff *skb); | 1005 | struct sk_buff *skb); |
1006 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); | ||
1007 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); | ||
1006 | 1008 | ||
1007 | /* IBSS code */ | 1009 | /* IBSS code */ |
1008 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); | 1010 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 1b9d87ed143a..3f76484221a2 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -323,6 +323,12 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key) | |||
323 | if (!key) | 323 | if (!key) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | /* | ||
327 | * Synchronize so the TX path can no longer be using | ||
328 | * this key before we free/remove it. | ||
329 | */ | ||
330 | synchronize_rcu(); | ||
331 | |||
326 | if (key->local) | 332 | if (key->local) |
327 | ieee80211_key_disable_hw_accel(key); | 333 | ieee80211_key_disable_hw_accel(key); |
328 | 334 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index ded5c3843e06..e8acdb2fb2ca 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -108,7 +108,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) | |||
108 | chan = scan_chan; | 108 | chan = scan_chan; |
109 | channel_type = NL80211_CHAN_NO_HT; | 109 | channel_type = NL80211_CHAN_NO_HT; |
110 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; | 110 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; |
111 | } else if (local->tmp_channel) { | 111 | } else if (local->tmp_channel && |
112 | local->oper_channel != local->tmp_channel) { | ||
112 | chan = scan_chan = local->tmp_channel; | 113 | chan = scan_chan = local->tmp_channel; |
113 | channel_type = local->tmp_channel_type; | 114 | channel_type = local->tmp_channel_type; |
114 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; | 115 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index ea13a80a476c..1c91f0f3c307 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -412,7 +412,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
412 | enum plink_event event; | 412 | enum plink_event event; |
413 | enum plink_frame_type ftype; | 413 | enum plink_frame_type ftype; |
414 | size_t baselen; | 414 | size_t baselen; |
415 | bool deactivated; | 415 | bool deactivated, matches_local = true; |
416 | u8 ie_len; | 416 | u8 ie_len; |
417 | u8 *baseaddr; | 417 | u8 *baseaddr; |
418 | __le16 plid, llid, reason; | 418 | __le16 plid, llid, reason; |
@@ -487,6 +487,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
487 | /* Now we will figure out the appropriate event... */ | 487 | /* Now we will figure out the appropriate event... */ |
488 | event = PLINK_UNDEFINED; | 488 | event = PLINK_UNDEFINED; |
489 | if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) { | 489 | if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) { |
490 | matches_local = false; | ||
490 | switch (ftype) { | 491 | switch (ftype) { |
491 | case PLINK_OPEN: | 492 | case PLINK_OPEN: |
492 | event = OPN_RJCT; | 493 | event = OPN_RJCT; |
@@ -498,7 +499,15 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
498 | /* avoid warning */ | 499 | /* avoid warning */ |
499 | break; | 500 | break; |
500 | } | 501 | } |
501 | spin_lock_bh(&sta->lock); | 502 | } |
503 | |||
504 | if (!sta && !matches_local) { | ||
505 | rcu_read_unlock(); | ||
506 | reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION); | ||
507 | llid = 0; | ||
508 | mesh_plink_frame_tx(sdata, PLINK_CLOSE, mgmt->sa, llid, | ||
509 | plid, reason); | ||
510 | return; | ||
502 | } else if (!sta) { | 511 | } else if (!sta) { |
503 | /* ftype == PLINK_OPEN */ | 512 | /* ftype == PLINK_OPEN */ |
504 | u32 rates; | 513 | u32 rates; |
@@ -522,7 +531,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
522 | } | 531 | } |
523 | event = OPN_ACPT; | 532 | event = OPN_ACPT; |
524 | spin_lock_bh(&sta->lock); | 533 | spin_lock_bh(&sta->lock); |
525 | } else { | 534 | } else if (matches_local) { |
526 | spin_lock_bh(&sta->lock); | 535 | spin_lock_bh(&sta->lock); |
527 | switch (ftype) { | 536 | switch (ftype) { |
528 | case PLINK_OPEN: | 537 | case PLINK_OPEN: |
@@ -564,6 +573,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m | |||
564 | rcu_read_unlock(); | 573 | rcu_read_unlock(); |
565 | return; | 574 | return; |
566 | } | 575 | } |
576 | } else { | ||
577 | spin_lock_bh(&sta->lock); | ||
567 | } | 578 | } |
568 | 579 | ||
569 | mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", | 580 | mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index b6c163ac22da..4c5eed9446f4 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -109,7 +109,7 @@ static void run_again(struct ieee80211_if_managed *ifmgd, | |||
109 | mod_timer(&ifmgd->timer, timeout); | 109 | mod_timer(&ifmgd->timer, timeout); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) | 112 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) |
113 | { | 113 | { |
114 | if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) | 114 | if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) |
115 | return; | 115 | return; |
@@ -118,6 +118,19 @@ static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) | |||
118 | round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); | 118 | round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); |
119 | } | 119 | } |
120 | 120 | ||
121 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata) | ||
122 | { | ||
123 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
124 | |||
125 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | ||
126 | return; | ||
127 | |||
128 | mod_timer(&sdata->u.mgd.conn_mon_timer, | ||
129 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); | ||
130 | |||
131 | ifmgd->probe_send_count = 0; | ||
132 | } | ||
133 | |||
121 | static int ecw2cw(int ecw) | 134 | static int ecw2cw(int ecw) |
122 | { | 135 | { |
123 | return (1 << ecw) - 1; | 136 | return (1 << ecw) - 1; |
@@ -1006,21 +1019,26 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1006 | if (is_multicast_ether_addr(hdr->addr1)) | 1019 | if (is_multicast_ether_addr(hdr->addr1)) |
1007 | return; | 1020 | return; |
1008 | 1021 | ||
1009 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | 1022 | ieee80211_sta_reset_conn_monitor(sdata); |
1010 | return; | ||
1011 | |||
1012 | mod_timer(&sdata->u.mgd.conn_mon_timer, | ||
1013 | round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); | ||
1014 | } | 1023 | } |
1015 | 1024 | ||
1016 | static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) | 1025 | static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) |
1017 | { | 1026 | { |
1018 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 1027 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
1019 | const u8 *ssid; | 1028 | const u8 *ssid; |
1029 | u8 *dst = ifmgd->associated->bssid; | ||
1030 | u8 unicast_limit = max(1, IEEE80211_MAX_PROBE_TRIES - 3); | ||
1031 | |||
1032 | /* | ||
1033 | * Try sending broadcast probe requests for the last three | ||
1034 | * probe requests after the first ones failed since some | ||
1035 | * buggy APs only support broadcast probe requests. | ||
1036 | */ | ||
1037 | if (ifmgd->probe_send_count >= unicast_limit) | ||
1038 | dst = NULL; | ||
1020 | 1039 | ||
1021 | ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); | 1040 | ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); |
1022 | ieee80211_send_probe_req(sdata, ifmgd->associated->bssid, | 1041 | ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0); |
1023 | ssid + 2, ssid[1], NULL, 0); | ||
1024 | 1042 | ||
1025 | ifmgd->probe_send_count++; | 1043 | ifmgd->probe_send_count++; |
1026 | ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; | 1044 | ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; |
@@ -1262,7 +1280,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1262 | 1280 | ||
1263 | rates = 0; | 1281 | rates = 0; |
1264 | basic_rates = 0; | 1282 | basic_rates = 0; |
1265 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1283 | sband = local->hw.wiphy->bands[wk->chan->band]; |
1266 | 1284 | ||
1267 | for (i = 0; i < elems.supp_rates_len; i++) { | 1285 | for (i = 0; i < elems.supp_rates_len; i++) { |
1268 | int rate = (elems.supp_rates[i] & 0x7f) * 5; | 1286 | int rate = (elems.supp_rates[i] & 0x7f) * 5; |
@@ -1298,11 +1316,11 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1298 | } | 1316 | } |
1299 | } | 1317 | } |
1300 | 1318 | ||
1301 | sta->sta.supp_rates[local->hw.conf.channel->band] = rates; | 1319 | sta->sta.supp_rates[wk->chan->band] = rates; |
1302 | sdata->vif.bss_conf.basic_rates = basic_rates; | 1320 | sdata->vif.bss_conf.basic_rates = basic_rates; |
1303 | 1321 | ||
1304 | /* cf. IEEE 802.11 9.2.12 */ | 1322 | /* cf. IEEE 802.11 9.2.12 */ |
1305 | if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && | 1323 | if (wk->chan->band == IEEE80211_BAND_2GHZ && |
1306 | have_higher_than_11mbit) | 1324 | have_higher_than_11mbit) |
1307 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; | 1325 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; |
1308 | else | 1326 | else |
@@ -1362,7 +1380,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, | |||
1362 | * Also start the timer that will detect beacon loss. | 1380 | * Also start the timer that will detect beacon loss. |
1363 | */ | 1381 | */ |
1364 | ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); | 1382 | ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); |
1365 | mod_beacon_timer(sdata); | 1383 | ieee80211_sta_reset_beacon_monitor(sdata); |
1366 | 1384 | ||
1367 | return true; | 1385 | return true; |
1368 | } | 1386 | } |
@@ -1465,7 +1483,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, | |||
1465 | * we have or will be receiving any beacons or data, so let's | 1483 | * we have or will be receiving any beacons or data, so let's |
1466 | * schedule the timers again, just in case. | 1484 | * schedule the timers again, just in case. |
1467 | */ | 1485 | */ |
1468 | mod_beacon_timer(sdata); | 1486 | ieee80211_sta_reset_beacon_monitor(sdata); |
1469 | 1487 | ||
1470 | mod_timer(&ifmgd->conn_mon_timer, | 1488 | mod_timer(&ifmgd->conn_mon_timer, |
1471 | round_jiffies_up(jiffies + | 1489 | round_jiffies_up(jiffies + |
@@ -1540,7 +1558,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1540 | ifmgd->last_beacon_signal = rx_status->signal; | 1558 | ifmgd->last_beacon_signal = rx_status->signal; |
1541 | if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { | 1559 | if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { |
1542 | ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; | 1560 | ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; |
1543 | ifmgd->ave_beacon_signal = rx_status->signal; | 1561 | ifmgd->ave_beacon_signal = rx_status->signal * 16; |
1544 | ifmgd->last_cqm_event_signal = 0; | 1562 | ifmgd->last_cqm_event_signal = 0; |
1545 | } else { | 1563 | } else { |
1546 | ifmgd->ave_beacon_signal = | 1564 | ifmgd->ave_beacon_signal = |
@@ -1588,7 +1606,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1588 | * Push the beacon loss detection into the future since | 1606 | * Push the beacon loss detection into the future since |
1589 | * we are processing a beacon from the AP just now. | 1607 | * we are processing a beacon from the AP just now. |
1590 | */ | 1608 | */ |
1591 | mod_beacon_timer(sdata); | 1609 | ieee80211_sta_reset_beacon_monitor(sdata); |
1592 | 1610 | ||
1593 | ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); | 1611 | ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); |
1594 | ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, | 1612 | ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, |
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index c36b1911987a..cf5ee305785b 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -22,12 +22,16 @@ | |||
22 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) | 22 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) |
23 | { | 23 | { |
24 | struct ieee80211_local *local = sdata->local; | 24 | struct ieee80211_local *local = sdata->local; |
25 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
25 | 26 | ||
26 | local->offchannel_ps_enabled = false; | 27 | local->offchannel_ps_enabled = false; |
27 | 28 | ||
28 | /* FIXME: what to do when local->pspolling is true? */ | 29 | /* FIXME: what to do when local->pspolling is true? */ |
29 | 30 | ||
30 | del_timer_sync(&local->dynamic_ps_timer); | 31 | del_timer_sync(&local->dynamic_ps_timer); |
32 | del_timer_sync(&ifmgd->bcn_mon_timer); | ||
33 | del_timer_sync(&ifmgd->conn_mon_timer); | ||
34 | |||
31 | cancel_work_sync(&local->dynamic_ps_enable_work); | 35 | cancel_work_sync(&local->dynamic_ps_enable_work); |
32 | 36 | ||
33 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { | 37 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
@@ -85,6 +89,9 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) | |||
85 | mod_timer(&local->dynamic_ps_timer, jiffies + | 89 | mod_timer(&local->dynamic_ps_timer, jiffies + |
86 | msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); | 90 | msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); |
87 | } | 91 | } |
92 | |||
93 | ieee80211_sta_reset_beacon_monitor(sdata); | ||
94 | ieee80211_sta_reset_conn_monitor(sdata); | ||
88 | } | 95 | } |
89 | 96 | ||
90 | void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) | 97 | void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index be04d46110fe..82d5750a110a 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -328,6 +328,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, | |||
328 | * if needed. | 328 | * if needed. |
329 | */ | 329 | */ |
330 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { | 330 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
331 | /* Skip invalid rates */ | ||
332 | if (info->control.rates[i].idx < 0) | ||
333 | break; | ||
331 | /* Rate masking supports only legacy rates for now */ | 334 | /* Rate masking supports only legacy rates for now */ |
332 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) | 335 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) |
333 | continue; | 336 | continue; |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index c5b465904e3b..2a18d6602d4a 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -397,8 +397,9 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
397 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) | 397 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
398 | return; | 398 | return; |
399 | 399 | ||
400 | if (!info->status.ampdu_len) { | 400 | if (!(info->flags & IEEE80211_TX_STAT_AMPDU)) { |
401 | info->status.ampdu_ack_len = 1; | 401 | info->status.ampdu_ack_len = |
402 | (info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); | ||
402 | info->status.ampdu_len = 1; | 403 | info->status.ampdu_len = 1; |
403 | } | 404 | } |
404 | 405 | ||
@@ -426,7 +427,7 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
426 | group = minstrel_ht_get_group_idx(&ar[i]); | 427 | group = minstrel_ht_get_group_idx(&ar[i]); |
427 | rate = &mi->groups[group].rates[ar[i].idx % 8]; | 428 | rate = &mi->groups[group].rates[ar[i].idx % 8]; |
428 | 429 | ||
429 | if (last && (info->flags & IEEE80211_TX_STAT_ACK)) | 430 | if (last) |
430 | rate->success += info->status.ampdu_ack_len; | 431 | rate->success += info->status.ampdu_ack_len; |
431 | 432 | ||
432 | rate->attempts += ar[i].count * info->status.ampdu_len; | 433 | rate->attempts += ar[i].count * info->status.ampdu_len; |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 28624282c5f3..2bec9b9dba09 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1715,6 +1715,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1715 | if (!fwd_skb && net_ratelimit()) | 1715 | if (!fwd_skb && net_ratelimit()) |
1716 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", | 1716 | printk(KERN_DEBUG "%s: failed to clone mesh frame\n", |
1717 | sdata->name); | 1717 | sdata->name); |
1718 | if (!fwd_skb) | ||
1719 | goto out; | ||
1718 | 1720 | ||
1719 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; | 1721 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
1720 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); | 1722 | memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); |
@@ -1752,6 +1754,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1752 | } | 1754 | } |
1753 | } | 1755 | } |
1754 | 1756 | ||
1757 | out: | ||
1755 | if (is_multicast_ether_addr(hdr->addr1) || | 1758 | if (is_multicast_ether_addr(hdr->addr1) || |
1756 | sdata->dev->flags & IFF_PROMISC) | 1759 | sdata->dev->flags & IFF_PROMISC) |
1757 | return RX_CONTINUE; | 1760 | return RX_CONTINUE; |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 34da67995d94..6ffa26a9de39 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -58,6 +58,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, | |||
58 | info->control.vif = &sta->sdata->vif; | 58 | info->control.vif = &sta->sdata->vif; |
59 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | | 59 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | |
60 | IEEE80211_TX_INTFL_RETRANSMISSION; | 60 | IEEE80211_TX_INTFL_RETRANSMISSION; |
61 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; | ||
61 | 62 | ||
62 | sta->tx_filtered_count++; | 63 | sta->tx_filtered_count++; |
63 | 64 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c54db966926b..9d5af5dd0d98 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1694,7 +1694,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1694 | { | 1694 | { |
1695 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1695 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
1696 | struct ieee80211_local *local = sdata->local; | 1696 | struct ieee80211_local *local = sdata->local; |
1697 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1697 | struct ieee80211_tx_info *info; |
1698 | int ret = NETDEV_TX_BUSY, head_need; | 1698 | int ret = NETDEV_TX_BUSY, head_need; |
1699 | u16 ethertype, hdrlen, meshhdrlen = 0; | 1699 | u16 ethertype, hdrlen, meshhdrlen = 0; |
1700 | __le16 fc; | 1700 | __le16 fc; |
@@ -1705,15 +1705,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1705 | int nh_pos, h_pos; | 1705 | int nh_pos, h_pos; |
1706 | struct sta_info *sta = NULL; | 1706 | struct sta_info *sta = NULL; |
1707 | u32 sta_flags = 0; | 1707 | u32 sta_flags = 0; |
1708 | struct sk_buff *tmp_skb; | ||
1708 | 1709 | ||
1709 | if (unlikely(skb->len < ETH_HLEN)) { | 1710 | if (unlikely(skb->len < ETH_HLEN)) { |
1710 | ret = NETDEV_TX_OK; | 1711 | ret = NETDEV_TX_OK; |
1711 | goto fail; | 1712 | goto fail; |
1712 | } | 1713 | } |
1713 | 1714 | ||
1714 | nh_pos = skb_network_header(skb) - skb->data; | ||
1715 | h_pos = skb_transport_header(skb) - skb->data; | ||
1716 | |||
1717 | /* convert Ethernet header to proper 802.11 header (based on | 1715 | /* convert Ethernet header to proper 802.11 header (based on |
1718 | * operation mode) */ | 1716 | * operation mode) */ |
1719 | ethertype = (skb->data[12] << 8) | skb->data[13]; | 1717 | ethertype = (skb->data[12] << 8) | skb->data[13]; |
@@ -1885,6 +1883,20 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1885 | goto fail; | 1883 | goto fail; |
1886 | } | 1884 | } |
1887 | 1885 | ||
1886 | /* | ||
1887 | * If the skb is shared we need to obtain our own copy. | ||
1888 | */ | ||
1889 | if (skb_shared(skb)) { | ||
1890 | tmp_skb = skb; | ||
1891 | skb = skb_copy(skb, GFP_ATOMIC); | ||
1892 | kfree_skb(tmp_skb); | ||
1893 | |||
1894 | if (!skb) { | ||
1895 | ret = NETDEV_TX_OK; | ||
1896 | goto fail; | ||
1897 | } | ||
1898 | } | ||
1899 | |||
1888 | hdr.frame_control = fc; | 1900 | hdr.frame_control = fc; |
1889 | hdr.duration_id = 0; | 1901 | hdr.duration_id = 0; |
1890 | hdr.seq_ctrl = 0; | 1902 | hdr.seq_ctrl = 0; |
@@ -1903,6 +1915,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1903 | encaps_len = 0; | 1915 | encaps_len = 0; |
1904 | } | 1916 | } |
1905 | 1917 | ||
1918 | nh_pos = skb_network_header(skb) - skb->data; | ||
1919 | h_pos = skb_transport_header(skb) - skb->data; | ||
1920 | |||
1906 | skb_pull(skb, skip_header_bytes); | 1921 | skb_pull(skb, skip_header_bytes); |
1907 | nh_pos -= skip_header_bytes; | 1922 | nh_pos -= skip_header_bytes; |
1908 | h_pos -= skip_header_bytes; | 1923 | h_pos -= skip_header_bytes; |
@@ -1969,6 +1984,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1969 | skb_set_network_header(skb, nh_pos); | 1984 | skb_set_network_header(skb, nh_pos); |
1970 | skb_set_transport_header(skb, h_pos); | 1985 | skb_set_transport_header(skb, h_pos); |
1971 | 1986 | ||
1987 | info = IEEE80211_SKB_CB(skb); | ||
1972 | memset(info, 0, sizeof(*info)); | 1988 | memset(info, 0, sizeof(*info)); |
1973 | 1989 | ||
1974 | dev->trans_start = jiffies; | 1990 | dev->trans_start = jiffies; |
@@ -2160,6 +2176,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2160 | 2176 | ||
2161 | sdata = vif_to_sdata(vif); | 2177 | sdata = vif_to_sdata(vif); |
2162 | 2178 | ||
2179 | if (!ieee80211_sdata_running(sdata)) | ||
2180 | goto out; | ||
2181 | |||
2163 | if (tim_offset) | 2182 | if (tim_offset) |
2164 | *tim_offset = 0; | 2183 | *tim_offset = 0; |
2165 | if (tim_length) | 2184 | if (tim_length) |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index df3eedb142ff..a37a6b188eda 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1260,7 +1260,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls) | |||
1260 | if (!hash) { | 1260 | if (!hash) { |
1261 | *vmalloced = 1; | 1261 | *vmalloced = 1; |
1262 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); | 1262 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); |
1263 | hash = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 1263 | hash = __vmalloc(sz, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, |
1264 | PAGE_KERNEL); | ||
1264 | } | 1265 | } |
1265 | 1266 | ||
1266 | if (hash && nulls) | 1267 | if (hash && nulls) |
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c index 23b2d6c486b5..364ad1600129 100644 --- a/net/netfilter/xt_SECMARK.c +++ b/net/netfilter/xt_SECMARK.c | |||
@@ -101,7 +101,7 @@ static int secmark_tg_check(const struct xt_tgchk_param *par) | |||
101 | switch (info->mode) { | 101 | switch (info->mode) { |
102 | case SECMARK_MODE_SEL: | 102 | case SECMARK_MODE_SEL: |
103 | err = checkentry_selinux(info); | 103 | err = checkentry_selinux(info); |
104 | if (err <= 0) | 104 | if (err) |
105 | return err; | 105 | return err; |
106 | break; | 106 | break; |
107 | 107 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 9a17f28b1253..9ba70146a4fe 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1610,9 +1610,11 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1610 | 1610 | ||
1611 | err = -EINVAL; | 1611 | err = -EINVAL; |
1612 | vnet_hdr_len = sizeof(vnet_hdr); | 1612 | vnet_hdr_len = sizeof(vnet_hdr); |
1613 | if ((len -= vnet_hdr_len) < 0) | 1613 | if (len < vnet_hdr_len) |
1614 | goto out_free; | 1614 | goto out_free; |
1615 | 1615 | ||
1616 | len -= vnet_hdr_len; | ||
1617 | |||
1616 | if (skb_is_gso(skb)) { | 1618 | if (skb_is_gso(skb)) { |
1617 | struct skb_shared_info *sinfo = skb_shinfo(skb); | 1619 | struct skb_shared_info *sinfo = skb_shinfo(skb); |
1618 | 1620 | ||
@@ -1719,7 +1721,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | |||
1719 | rcu_read_lock(); | 1721 | rcu_read_lock(); |
1720 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); | 1722 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); |
1721 | if (dev) | 1723 | if (dev) |
1722 | strlcpy(uaddr->sa_data, dev->name, 15); | 1724 | strncpy(uaddr->sa_data, dev->name, 14); |
1723 | else | 1725 | else |
1724 | memset(uaddr->sa_data, 0, 14); | 1726 | memset(uaddr->sa_data, 0, 14); |
1725 | rcu_read_unlock(); | 1727 | rcu_read_unlock(); |
@@ -1742,6 +1744,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1742 | sll->sll_family = AF_PACKET; | 1744 | sll->sll_family = AF_PACKET; |
1743 | sll->sll_ifindex = po->ifindex; | 1745 | sll->sll_ifindex = po->ifindex; |
1744 | sll->sll_protocol = po->num; | 1746 | sll->sll_protocol = po->num; |
1747 | sll->sll_pkttype = 0; | ||
1745 | rcu_read_lock(); | 1748 | rcu_read_lock(); |
1746 | dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex); | 1749 | dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex); |
1747 | if (dev) { | 1750 | if (dev) { |
diff --git a/net/rds/rdma.c b/net/rds/rdma.c index 75fd13bb631b..39989678c2d2 100644 --- a/net/rds/rdma.c +++ b/net/rds/rdma.c | |||
@@ -474,7 +474,7 @@ static struct rds_rdma_op *rds_rdma_prepare(struct rds_sock *rs, | |||
474 | goto out; | 474 | goto out; |
475 | } | 475 | } |
476 | 476 | ||
477 | if (args->nr_local > (u64)UINT_MAX) { | 477 | if (args->nr_local > UIO_MAXIOV) { |
478 | ret = -EMSGSIZE; | 478 | ret = -EMSGSIZE; |
479 | goto out; | 479 | goto out; |
480 | } | 480 | } |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 78ef2c5e130b..08be223fb3dc 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -34,8 +34,6 @@ struct cgroup_subsys net_cls_subsys = { | |||
34 | .populate = cgrp_populate, | 34 | .populate = cgrp_populate, |
35 | #ifdef CONFIG_NET_CLS_CGROUP | 35 | #ifdef CONFIG_NET_CLS_CGROUP |
36 | .subsys_id = net_cls_subsys_id, | 36 | .subsys_id = net_cls_subsys_id, |
37 | #else | ||
38 | #define net_cls_subsys_id net_cls_subsys.subsys_id | ||
39 | #endif | 37 | #endif |
40 | .module = THIS_MODULE, | 38 | .module = THIS_MODULE, |
41 | }; | 39 | }; |
diff --git a/net/socket.c b/net/socket.c index 2270b941bcc7..58dfc915a3a5 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1651,6 +1651,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, | |||
1651 | struct iovec iov; | 1651 | struct iovec iov; |
1652 | int fput_needed; | 1652 | int fput_needed; |
1653 | 1653 | ||
1654 | if (len > INT_MAX) | ||
1655 | len = INT_MAX; | ||
1654 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1656 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1655 | if (!sock) | 1657 | if (!sock) |
1656 | goto out; | 1658 | goto out; |
@@ -1708,6 +1710,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, | |||
1708 | int err, err2; | 1710 | int err, err2; |
1709 | int fput_needed; | 1711 | int fput_needed; |
1710 | 1712 | ||
1713 | if (size > INT_MAX) | ||
1714 | size = INT_MAX; | ||
1711 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1715 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1712 | if (!sock) | 1716 | if (!sock) |
1713 | goto out; | 1717 | goto out; |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index fa5549079d79..cbc5b8ccc8be 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1675,7 +1675,7 @@ rpc_verify_header(struct rpc_task *task) | |||
1675 | rpcauth_invalcred(task); | 1675 | rpcauth_invalcred(task); |
1676 | /* Ensure we obtain a new XID! */ | 1676 | /* Ensure we obtain a new XID! */ |
1677 | xprt_release(task); | 1677 | xprt_release(task); |
1678 | task->tk_action = call_refresh; | 1678 | task->tk_action = call_reserve; |
1679 | goto out_retry; | 1679 | goto out_retry; |
1680 | case RPC_AUTH_BADCRED: | 1680 | case RPC_AUTH_BADCRED: |
1681 | case RPC_AUTH_BADVERF: | 1681 | case RPC_AUTH_BADVERF: |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index cbc084939dd8..2f5fb71854d3 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -212,6 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
212 | spin_lock(&svc_xprt_class_lock); | 212 | spin_lock(&svc_xprt_class_lock); |
213 | list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { | 213 | list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { |
214 | struct svc_xprt *newxprt; | 214 | struct svc_xprt *newxprt; |
215 | unsigned short newport; | ||
215 | 216 | ||
216 | if (strcmp(xprt_name, xcl->xcl_name)) | 217 | if (strcmp(xprt_name, xcl->xcl_name)) |
217 | continue; | 218 | continue; |
@@ -230,8 +231,9 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
230 | spin_lock_bh(&serv->sv_lock); | 231 | spin_lock_bh(&serv->sv_lock); |
231 | list_add(&newxprt->xpt_list, &serv->sv_permsocks); | 232 | list_add(&newxprt->xpt_list, &serv->sv_permsocks); |
232 | spin_unlock_bh(&serv->sv_lock); | 233 | spin_unlock_bh(&serv->sv_lock); |
234 | newport = svc_xprt_local_port(newxprt); | ||
233 | clear_bit(XPT_BUSY, &newxprt->xpt_flags); | 235 | clear_bit(XPT_BUSY, &newxprt->xpt_flags); |
234 | return svc_xprt_local_port(newxprt); | 236 | return newport; |
235 | } | 237 | } |
236 | err: | 238 | err: |
237 | spin_unlock(&svc_xprt_class_lock); | 239 | spin_unlock(&svc_xprt_class_lock); |
@@ -431,8 +433,13 @@ void svc_xprt_received(struct svc_xprt *xprt) | |||
431 | { | 433 | { |
432 | BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); | 434 | BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); |
433 | xprt->xpt_pool = NULL; | 435 | xprt->xpt_pool = NULL; |
436 | /* As soon as we clear busy, the xprt could be closed and | ||
437 | * 'put', so we need a reference to call svc_xprt_enqueue with: | ||
438 | */ | ||
439 | svc_xprt_get(xprt); | ||
434 | clear_bit(XPT_BUSY, &xprt->xpt_flags); | 440 | clear_bit(XPT_BUSY, &xprt->xpt_flags); |
435 | svc_xprt_enqueue(xprt); | 441 | svc_xprt_enqueue(xprt); |
442 | svc_xprt_put(xprt); | ||
436 | } | 443 | } |
437 | EXPORT_SYMBOL_GPL(svc_xprt_received); | 444 | EXPORT_SYMBOL_GPL(svc_xprt_received); |
438 | 445 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 0b39b2451ea5..b4cfe207a6ac 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1343,9 +1343,25 @@ static void unix_destruct_scm(struct sk_buff *skb) | |||
1343 | sock_wfree(skb); | 1343 | sock_wfree(skb); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | #define MAX_RECURSION_LEVEL 4 | ||
1347 | |||
1346 | static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | 1348 | static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) |
1347 | { | 1349 | { |
1348 | int i; | 1350 | int i; |
1351 | unsigned char max_level = 0; | ||
1352 | int unix_sock_count = 0; | ||
1353 | |||
1354 | for (i = scm->fp->count - 1; i >= 0; i--) { | ||
1355 | struct sock *sk = unix_get_socket(scm->fp->fp[i]); | ||
1356 | |||
1357 | if (sk) { | ||
1358 | unix_sock_count++; | ||
1359 | max_level = max(max_level, | ||
1360 | unix_sk(sk)->recursion_level); | ||
1361 | } | ||
1362 | } | ||
1363 | if (unlikely(max_level > MAX_RECURSION_LEVEL)) | ||
1364 | return -ETOOMANYREFS; | ||
1349 | 1365 | ||
1350 | /* | 1366 | /* |
1351 | * Need to duplicate file references for the sake of garbage | 1367 | * Need to duplicate file references for the sake of garbage |
@@ -1356,9 +1372,11 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | |||
1356 | if (!UNIXCB(skb).fp) | 1372 | if (!UNIXCB(skb).fp) |
1357 | return -ENOMEM; | 1373 | return -ENOMEM; |
1358 | 1374 | ||
1359 | for (i = scm->fp->count-1; i >= 0; i--) | 1375 | if (unix_sock_count) { |
1360 | unix_inflight(scm->fp->fp[i]); | 1376 | for (i = scm->fp->count - 1; i >= 0; i--) |
1361 | return 0; | 1377 | unix_inflight(scm->fp->fp[i]); |
1378 | } | ||
1379 | return max_level; | ||
1362 | } | 1380 | } |
1363 | 1381 | ||
1364 | static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) | 1382 | static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) |
@@ -1393,6 +1411,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1393 | struct sk_buff *skb; | 1411 | struct sk_buff *skb; |
1394 | long timeo; | 1412 | long timeo; |
1395 | struct scm_cookie tmp_scm; | 1413 | struct scm_cookie tmp_scm; |
1414 | int max_level; | ||
1396 | 1415 | ||
1397 | if (NULL == siocb->scm) | 1416 | if (NULL == siocb->scm) |
1398 | siocb->scm = &tmp_scm; | 1417 | siocb->scm = &tmp_scm; |
@@ -1431,8 +1450,9 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1431 | goto out; | 1450 | goto out; |
1432 | 1451 | ||
1433 | err = unix_scm_to_skb(siocb->scm, skb, true); | 1452 | err = unix_scm_to_skb(siocb->scm, skb, true); |
1434 | if (err) | 1453 | if (err < 0) |
1435 | goto out_free; | 1454 | goto out_free; |
1455 | max_level = err + 1; | ||
1436 | unix_get_secdata(siocb->scm, skb); | 1456 | unix_get_secdata(siocb->scm, skb); |
1437 | 1457 | ||
1438 | skb_reset_transport_header(skb); | 1458 | skb_reset_transport_header(skb); |
@@ -1512,6 +1532,8 @@ restart: | |||
1512 | } | 1532 | } |
1513 | 1533 | ||
1514 | skb_queue_tail(&other->sk_receive_queue, skb); | 1534 | skb_queue_tail(&other->sk_receive_queue, skb); |
1535 | if (max_level > unix_sk(other)->recursion_level) | ||
1536 | unix_sk(other)->recursion_level = max_level; | ||
1515 | unix_state_unlock(other); | 1537 | unix_state_unlock(other); |
1516 | other->sk_data_ready(other, len); | 1538 | other->sk_data_ready(other, len); |
1517 | sock_put(other); | 1539 | sock_put(other); |
@@ -1542,6 +1564,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1542 | int sent = 0; | 1564 | int sent = 0; |
1543 | struct scm_cookie tmp_scm; | 1565 | struct scm_cookie tmp_scm; |
1544 | bool fds_sent = false; | 1566 | bool fds_sent = false; |
1567 | int max_level; | ||
1545 | 1568 | ||
1546 | if (NULL == siocb->scm) | 1569 | if (NULL == siocb->scm) |
1547 | siocb->scm = &tmp_scm; | 1570 | siocb->scm = &tmp_scm; |
@@ -1605,10 +1628,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1605 | 1628 | ||
1606 | /* Only send the fds in the first buffer */ | 1629 | /* Only send the fds in the first buffer */ |
1607 | err = unix_scm_to_skb(siocb->scm, skb, !fds_sent); | 1630 | err = unix_scm_to_skb(siocb->scm, skb, !fds_sent); |
1608 | if (err) { | 1631 | if (err < 0) { |
1609 | kfree_skb(skb); | 1632 | kfree_skb(skb); |
1610 | goto out_err; | 1633 | goto out_err; |
1611 | } | 1634 | } |
1635 | max_level = err + 1; | ||
1612 | fds_sent = true; | 1636 | fds_sent = true; |
1613 | 1637 | ||
1614 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); | 1638 | err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size); |
@@ -1624,6 +1648,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1624 | goto pipe_err_free; | 1648 | goto pipe_err_free; |
1625 | 1649 | ||
1626 | skb_queue_tail(&other->sk_receive_queue, skb); | 1650 | skb_queue_tail(&other->sk_receive_queue, skb); |
1651 | if (max_level > unix_sk(other)->recursion_level) | ||
1652 | unix_sk(other)->recursion_level = max_level; | ||
1627 | unix_state_unlock(other); | 1653 | unix_state_unlock(other); |
1628 | other->sk_data_ready(other, size); | 1654 | other->sk_data_ready(other, size); |
1629 | sent += size; | 1655 | sent += size; |
@@ -1840,6 +1866,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1840 | unix_state_lock(sk); | 1866 | unix_state_lock(sk); |
1841 | skb = skb_dequeue(&sk->sk_receive_queue); | 1867 | skb = skb_dequeue(&sk->sk_receive_queue); |
1842 | if (skb == NULL) { | 1868 | if (skb == NULL) { |
1869 | unix_sk(sk)->recursion_level = 0; | ||
1843 | if (copied >= target) | 1870 | if (copied >= target) |
1844 | goto unlock; | 1871 | goto unlock; |
1845 | 1872 | ||
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index c8df6fda0b1f..f89f83bf828e 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -96,7 +96,7 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait); | |||
96 | unsigned int unix_tot_inflight; | 96 | unsigned int unix_tot_inflight; |
97 | 97 | ||
98 | 98 | ||
99 | static struct sock *unix_get_socket(struct file *filp) | 99 | struct sock *unix_get_socket(struct file *filp) |
100 | { | 100 | { |
101 | struct sock *u_sock = NULL; | 101 | struct sock *u_sock = NULL; |
102 | struct inode *inode = filp->f_path.dentry->d_inode; | 102 | struct inode *inode = filp->f_path.dentry->d_inode; |
@@ -259,9 +259,16 @@ static void inc_inflight_move_tail(struct unix_sock *u) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | static bool gc_in_progress = false; | 261 | static bool gc_in_progress = false; |
262 | #define UNIX_INFLIGHT_TRIGGER_GC 16000 | ||
262 | 263 | ||
263 | void wait_for_unix_gc(void) | 264 | void wait_for_unix_gc(void) |
264 | { | 265 | { |
266 | /* | ||
267 | * If number of inflight sockets is insane, | ||
268 | * force a garbage collect right now. | ||
269 | */ | ||
270 | if (unix_tot_inflight > UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) | ||
271 | unix_gc(); | ||
265 | wait_event(unix_gc_wait, gc_in_progress == false); | 272 | wait_event(unix_gc_wait, gc_in_progress == false); |
266 | } | 273 | } |
267 | 274 | ||
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index d0c92dddb26b..d8f443b70b08 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -44,6 +44,36 @@ rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | |||
44 | return chan; | 44 | return chan; |
45 | } | 45 | } |
46 | 46 | ||
47 | static bool can_beacon_sec_chan(struct wiphy *wiphy, | ||
48 | struct ieee80211_channel *chan, | ||
49 | enum nl80211_channel_type channel_type) | ||
50 | { | ||
51 | struct ieee80211_channel *sec_chan; | ||
52 | int diff; | ||
53 | |||
54 | switch (channel_type) { | ||
55 | case NL80211_CHAN_HT40PLUS: | ||
56 | diff = 20; | ||
57 | case NL80211_CHAN_HT40MINUS: | ||
58 | diff = -20; | ||
59 | default: | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); | ||
64 | if (!sec_chan) | ||
65 | return false; | ||
66 | |||
67 | /* we'll need a DFS capability later */ | ||
68 | if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | | ||
69 | IEEE80211_CHAN_PASSIVE_SCAN | | ||
70 | IEEE80211_CHAN_NO_IBSS | | ||
71 | IEEE80211_CHAN_RADAR)) | ||
72 | return false; | ||
73 | |||
74 | return true; | ||
75 | } | ||
76 | |||
47 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, | 77 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
48 | struct wireless_dev *wdev, int freq, | 78 | struct wireless_dev *wdev, int freq, |
49 | enum nl80211_channel_type channel_type) | 79 | enum nl80211_channel_type channel_type) |
@@ -68,6 +98,27 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, | |||
68 | if (!chan) | 98 | if (!chan) |
69 | return -EINVAL; | 99 | return -EINVAL; |
70 | 100 | ||
101 | /* Both channels should be able to initiate communication */ | ||
102 | if (wdev && (wdev->iftype == NL80211_IFTYPE_ADHOC || | ||
103 | wdev->iftype == NL80211_IFTYPE_AP || | ||
104 | wdev->iftype == NL80211_IFTYPE_AP_VLAN || | ||
105 | wdev->iftype == NL80211_IFTYPE_MESH_POINT)) { | ||
106 | switch (channel_type) { | ||
107 | case NL80211_CHAN_HT40PLUS: | ||
108 | case NL80211_CHAN_HT40MINUS: | ||
109 | if (!can_beacon_sec_chan(&rdev->wiphy, chan, | ||
110 | channel_type)) { | ||
111 | printk(KERN_DEBUG | ||
112 | "cfg80211: Secondary channel not " | ||
113 | "allowed to initiate communication\n"); | ||
114 | return -EINVAL; | ||
115 | } | ||
116 | break; | ||
117 | default: | ||
118 | break; | ||
119 | } | ||
120 | } | ||
121 | |||
71 | result = rdev->ops->set_channel(&rdev->wiphy, | 122 | result = rdev->ops->set_channel(&rdev->wiphy, |
72 | wdev ? wdev->netdev : NULL, | 123 | wdev ? wdev->netdev : NULL, |
73 | chan, channel_type); | 124 | chan, channel_type); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 37902a54e9c1..9a8cde999955 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -761,11 +761,13 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) | |||
761 | 761 | ||
762 | result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); | 762 | result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); |
763 | if (result) | 763 | if (result) |
764 | goto unlock; | 764 | goto unlock_rtnl; |
765 | 765 | ||
766 | result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); | 766 | result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); |
767 | 767 | ||
768 | unlock: | 768 | dev_put(netdev); |
769 | cfg80211_unlock_rdev(rdev); | ||
770 | unlock_rtnl: | ||
769 | rtnl_unlock(); | 771 | rtnl_unlock(); |
770 | 772 | ||
771 | return result; | 773 | return result; |
@@ -4996,7 +4998,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, | |||
4996 | 4998 | ||
4997 | err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); | 4999 | err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); |
4998 | if (err) | 5000 | if (err) |
4999 | goto unlock_rdev; | 5001 | goto unlock_rtnl; |
5000 | 5002 | ||
5001 | wdev = dev->ieee80211_ptr; | 5003 | wdev = dev->ieee80211_ptr; |
5002 | 5004 | ||
@@ -5013,9 +5015,10 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, | |||
5013 | err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, | 5015 | err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, |
5014 | threshold, hysteresis); | 5016 | threshold, hysteresis); |
5015 | 5017 | ||
5016 | unlock_rdev: | 5018 | unlock_rdev: |
5017 | cfg80211_unlock_rdev(rdev); | 5019 | cfg80211_unlock_rdev(rdev); |
5018 | dev_put(dev); | 5020 | dev_put(dev); |
5021 | unlock_rtnl: | ||
5019 | rtnl_unlock(); | 5022 | rtnl_unlock(); |
5020 | 5023 | ||
5021 | return err; | 5024 | return err; |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index f180db0de66c..edccc093e71b 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -723,7 +723,9 @@ EXPORT_SYMBOL(freq_reg_info); | |||
723 | * on the wiphy with the target_bw specified. Then we can simply use | 723 | * on the wiphy with the target_bw specified. Then we can simply use |
724 | * that below for the desired_bw_khz below. | 724 | * that below for the desired_bw_khz below. |
725 | */ | 725 | */ |
726 | static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | 726 | static void handle_channel(struct wiphy *wiphy, |
727 | enum nl80211_reg_initiator initiator, | ||
728 | enum ieee80211_band band, | ||
727 | unsigned int chan_idx) | 729 | unsigned int chan_idx) |
728 | { | 730 | { |
729 | int r; | 731 | int r; |
@@ -787,7 +789,9 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
787 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); | 789 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); |
788 | } | 790 | } |
789 | 791 | ||
790 | static void handle_band(struct wiphy *wiphy, enum ieee80211_band band) | 792 | static void handle_band(struct wiphy *wiphy, |
793 | enum ieee80211_band band, | ||
794 | enum nl80211_reg_initiator initiator) | ||
791 | { | 795 | { |
792 | unsigned int i; | 796 | unsigned int i; |
793 | struct ieee80211_supported_band *sband; | 797 | struct ieee80211_supported_band *sband; |
@@ -796,7 +800,7 @@ static void handle_band(struct wiphy *wiphy, enum ieee80211_band band) | |||
796 | sband = wiphy->bands[band]; | 800 | sband = wiphy->bands[band]; |
797 | 801 | ||
798 | for (i = 0; i < sband->n_channels; i++) | 802 | for (i = 0; i < sband->n_channels; i++) |
799 | handle_channel(wiphy, band, i); | 803 | handle_channel(wiphy, initiator, band, i); |
800 | } | 804 | } |
801 | 805 | ||
802 | static bool ignore_reg_update(struct wiphy *wiphy, | 806 | static bool ignore_reg_update(struct wiphy *wiphy, |
@@ -812,6 +816,7 @@ static bool ignore_reg_update(struct wiphy *wiphy, | |||
812 | * desired regulatory domain set | 816 | * desired regulatory domain set |
813 | */ | 817 | */ |
814 | if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd && | 818 | if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd && |
819 | initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && | ||
815 | !is_world_regdom(last_request->alpha2)) | 820 | !is_world_regdom(last_request->alpha2)) |
816 | return true; | 821 | return true; |
817 | return false; | 822 | return false; |
@@ -1033,7 +1038,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy, | |||
1033 | goto out; | 1038 | goto out; |
1034 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | 1039 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
1035 | if (wiphy->bands[band]) | 1040 | if (wiphy->bands[band]) |
1036 | handle_band(wiphy, band); | 1041 | handle_band(wiphy, band, initiator); |
1037 | } | 1042 | } |
1038 | out: | 1043 | out: |
1039 | reg_process_beacons(wiphy); | 1044 | reg_process_beacons(wiphy); |
@@ -1170,7 +1175,7 @@ static int ignore_request(struct wiphy *wiphy, | |||
1170 | return 0; | 1175 | return 0; |
1171 | return -EALREADY; | 1176 | return -EALREADY; |
1172 | } | 1177 | } |
1173 | return REG_INTERSECT; | 1178 | return 0; |
1174 | case NL80211_REGDOM_SET_BY_DRIVER: | 1179 | case NL80211_REGDOM_SET_BY_DRIVER: |
1175 | if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { | 1180 | if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { |
1176 | if (regdom_changes(pending_request->alpha2)) | 1181 | if (regdom_changes(pending_request->alpha2)) |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 5ca8c7180141..503ebb86ba18 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -650,14 +650,14 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) | |||
650 | bss = container_of(pub, struct cfg80211_internal_bss, pub); | 650 | bss = container_of(pub, struct cfg80211_internal_bss, pub); |
651 | 651 | ||
652 | spin_lock_bh(&dev->bss_lock); | 652 | spin_lock_bh(&dev->bss_lock); |
653 | if (!list_empty(&bss->list)) { | ||
654 | list_del_init(&bss->list); | ||
655 | dev->bss_generation++; | ||
656 | rb_erase(&bss->rbn, &dev->bss_tree); | ||
653 | 657 | ||
654 | list_del(&bss->list); | 658 | kref_put(&bss->ref, bss_release); |
655 | dev->bss_generation++; | 659 | } |
656 | rb_erase(&bss->rbn, &dev->bss_tree); | ||
657 | |||
658 | spin_unlock_bh(&dev->bss_lock); | 660 | spin_unlock_bh(&dev->bss_lock); |
659 | |||
660 | kref_put(&bss->ref, bss_release); | ||
661 | } | 661 | } |
662 | EXPORT_SYMBOL(cfg80211_unlink_bss); | 662 | EXPORT_SYMBOL(cfg80211_unlink_bss); |
663 | 663 | ||
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index 771bab00754b..55187c8f6420 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c | |||
@@ -61,6 +61,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
61 | while (len > 0) { | 61 | while (len > 0) { |
62 | switch (*p & X25_FAC_CLASS_MASK) { | 62 | switch (*p & X25_FAC_CLASS_MASK) { |
63 | case X25_FAC_CLASS_A: | 63 | case X25_FAC_CLASS_A: |
64 | if (len < 2) | ||
65 | return 0; | ||
64 | switch (*p) { | 66 | switch (*p) { |
65 | case X25_FAC_REVERSE: | 67 | case X25_FAC_REVERSE: |
66 | if((p[1] & 0x81) == 0x81) { | 68 | if((p[1] & 0x81) == 0x81) { |
@@ -104,6 +106,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
104 | len -= 2; | 106 | len -= 2; |
105 | break; | 107 | break; |
106 | case X25_FAC_CLASS_B: | 108 | case X25_FAC_CLASS_B: |
109 | if (len < 3) | ||
110 | return 0; | ||
107 | switch (*p) { | 111 | switch (*p) { |
108 | case X25_FAC_PACKET_SIZE: | 112 | case X25_FAC_PACKET_SIZE: |
109 | facilities->pacsize_in = p[1]; | 113 | facilities->pacsize_in = p[1]; |
@@ -125,6 +129,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
125 | len -= 3; | 129 | len -= 3; |
126 | break; | 130 | break; |
127 | case X25_FAC_CLASS_C: | 131 | case X25_FAC_CLASS_C: |
132 | if (len < 4) | ||
133 | return 0; | ||
128 | printk(KERN_DEBUG "X.25: unknown facility %02X, " | 134 | printk(KERN_DEBUG "X.25: unknown facility %02X, " |
129 | "values %02X, %02X, %02X\n", | 135 | "values %02X, %02X, %02X\n", |
130 | p[0], p[1], p[2], p[3]); | 136 | p[0], p[1], p[2], p[3]); |
@@ -132,26 +138,26 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, | |||
132 | len -= 4; | 138 | len -= 4; |
133 | break; | 139 | break; |
134 | case X25_FAC_CLASS_D: | 140 | case X25_FAC_CLASS_D: |
141 | if (len < p[1] + 2) | ||
142 | return 0; | ||
135 | switch (*p) { | 143 | switch (*p) { |
136 | case X25_FAC_CALLING_AE: | 144 | case X25_FAC_CALLING_AE: |
137 | if (p[1] > X25_MAX_DTE_FACIL_LEN) | 145 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
138 | break; | 146 | return 0; |
139 | dte_facs->calling_len = p[2]; | 147 | dte_facs->calling_len = p[2]; |
140 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); | 148 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); |
141 | *vc_fac_mask |= X25_MASK_CALLING_AE; | 149 | *vc_fac_mask |= X25_MASK_CALLING_AE; |
142 | break; | 150 | break; |
143 | case X25_FAC_CALLED_AE: | 151 | case X25_FAC_CALLED_AE: |
144 | if (p[1] > X25_MAX_DTE_FACIL_LEN) | 152 | if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
145 | break; | 153 | return 0; |
146 | dte_facs->called_len = p[2]; | 154 | dte_facs->called_len = p[2]; |
147 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); | 155 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); |
148 | *vc_fac_mask |= X25_MASK_CALLED_AE; | 156 | *vc_fac_mask |= X25_MASK_CALLED_AE; |
149 | break; | 157 | break; |
150 | default: | 158 | default: |
151 | printk(KERN_DEBUG "X.25: unknown facility %02X," | 159 | printk(KERN_DEBUG "X.25: unknown facility %02X," |
152 | "length %d, values %02X, %02X, " | 160 | "length %d\n", p[0], p[1]); |
153 | "%02X, %02X\n", | ||
154 | p[0], p[1], p[2], p[3], p[4], p[5]); | ||
155 | break; | 161 | break; |
156 | } | 162 | } |
157 | len -= p[1] + 2; | 163 | len -= p[1] + 2; |
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index 63178961efac..f729f022be69 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c | |||
@@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp | |||
119 | &x25->vc_facil_mask); | 119 | &x25->vc_facil_mask); |
120 | if (len > 0) | 120 | if (len > 0) |
121 | skb_pull(skb, len); | 121 | skb_pull(skb, len); |
122 | else | ||
123 | return -1; | ||
122 | /* | 124 | /* |
123 | * Copy any Call User Data. | 125 | * Copy any Call User Data. |
124 | */ | 126 | */ |
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 73e7b954ad28..b25c6463c3e9 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c | |||
@@ -394,6 +394,7 @@ void __exit x25_link_free(void) | |||
394 | list_for_each_safe(entry, tmp, &x25_neigh_list) { | 394 | list_for_each_safe(entry, tmp, &x25_neigh_list) { |
395 | nb = list_entry(entry, struct x25_neigh, node); | 395 | nb = list_entry(entry, struct x25_neigh, node); |
396 | __x25_remove_neigh(nb); | 396 | __x25_remove_neigh(nb); |
397 | dev_put(nb->dev); | ||
397 | } | 398 | } |
398 | write_unlock_bh(&x25_neigh_list_lock); | 399 | write_unlock_bh(&x25_neigh_list_lock); |
399 | } | 400 | } |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 7ef429cd5cb3..6968f5b6569a 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -466,7 +466,7 @@ int main(int ac, char **av) | |||
466 | bindtextdomain(PACKAGE, LOCALEDIR); | 466 | bindtextdomain(PACKAGE, LOCALEDIR); |
467 | textdomain(PACKAGE); | 467 | textdomain(PACKAGE); |
468 | 468 | ||
469 | while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { | 469 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
470 | input_mode = (enum input_mode)opt; | 470 | input_mode = (enum input_mode)opt; |
471 | switch (opt) { | 471 | switch (opt) { |
472 | case silentoldconfig: | 472 | case silentoldconfig: |
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index aef8c0a923ab..d661afbe474c 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
@@ -253,6 +253,8 @@ static int ima_lsm_rule_init(struct ima_measure_rule_entry *entry, | |||
253 | result = security_filter_rule_init(entry->lsm[lsm_rule].type, | 253 | result = security_filter_rule_init(entry->lsm[lsm_rule].type, |
254 | Audit_equal, args, | 254 | Audit_equal, args, |
255 | &entry->lsm[lsm_rule].rule); | 255 | &entry->lsm[lsm_rule].rule); |
256 | if (!entry->lsm[lsm_rule].rule) | ||
257 | return -EINVAL; | ||
256 | return result; | 258 | return result; |
257 | } | 259 | } |
258 | 260 | ||
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 0088dd8bf68a..0ea52d25a6bd 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
@@ -403,7 +403,6 @@ link_check_failed: | |||
403 | return ret; | 403 | return ret; |
404 | 404 | ||
405 | link_prealloc_failed: | 405 | link_prealloc_failed: |
406 | up_write(&dest_keyring->sem); | ||
407 | mutex_unlock(&user->cons_lock); | 406 | mutex_unlock(&user->cons_lock); |
408 | kleave(" = %d [prelink]", ret); | 407 | kleave(" = %d [prelink]", ret); |
409 | return ret; | 408 | return ret; |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4796ddd4e721..a6238281186a 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2529,7 +2529,10 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, | |||
2529 | sid = tsec->sid; | 2529 | sid = tsec->sid; |
2530 | newsid = tsec->create_sid; | 2530 | newsid = tsec->create_sid; |
2531 | 2531 | ||
2532 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { | 2532 | if ((sbsec->flags & SE_SBINITIALIZED) && |
2533 | (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) | ||
2534 | newsid = sbsec->mntpoint_sid; | ||
2535 | else if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { | ||
2533 | rc = security_transition_sid(sid, dsec->sid, | 2536 | rc = security_transition_sid(sid, dsec->sid, |
2534 | inode_mode_to_security_class(inode->i_mode), | 2537 | inode_mode_to_security_class(inode->i_mode), |
2535 | &newsid); | 2538 | &newsid); |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 75ec0c6ebacd..8b02b2137da2 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
@@ -65,6 +65,8 @@ static struct nlmsg_perm nlmsg_route_perms[] = | |||
65 | { RTM_NEWADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, | 65 | { RTM_NEWADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
66 | { RTM_DELADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, | 66 | { RTM_DELADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, |
67 | { RTM_GETADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_READ }, | 67 | { RTM_GETADDRLABEL, NETLINK_ROUTE_SOCKET__NLMSG_READ }, |
68 | { RTM_GETDCB, NETLINK_ROUTE_SOCKET__NLMSG_READ }, | ||
69 | { RTM_SETDCB, NETLINK_ROUTE_SOCKET__NLMSG_WRITE }, | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | static struct nlmsg_perm nlmsg_firewall_perms[] = | 72 | static struct nlmsg_perm nlmsg_firewall_perms[] = |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 10c3a871a12d..b310702c646e 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
@@ -33,9 +33,12 @@ | |||
33 | #include <linux/dw_dmac.h> | 33 | #include <linux/dw_dmac.h> |
34 | 34 | ||
35 | #include <mach/cpu.h> | 35 | #include <mach/cpu.h> |
36 | #include <mach/hardware.h> | ||
37 | #include <mach/gpio.h> | 36 | #include <mach/gpio.h> |
38 | 37 | ||
38 | #ifdef CONFIG_ARCH_AT91 | ||
39 | #include <mach/hardware.h> | ||
40 | #endif | ||
41 | |||
39 | #include "ac97c.h" | 42 | #include "ac97c.h" |
40 | 43 | ||
41 | enum { | 44 | enum { |
diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c index 7730575bfadd..07efa29dfd4a 100644 --- a/sound/core/hrtimer.c +++ b/sound/core/hrtimer.c | |||
@@ -45,12 +45,13 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | |||
45 | { | 45 | { |
46 | struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); | 46 | struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt); |
47 | struct snd_timer *t = stime->timer; | 47 | struct snd_timer *t = stime->timer; |
48 | unsigned long oruns; | ||
48 | 49 | ||
49 | if (!atomic_read(&stime->running)) | 50 | if (!atomic_read(&stime->running)) |
50 | return HRTIMER_NORESTART; | 51 | return HRTIMER_NORESTART; |
51 | 52 | ||
52 | hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); | 53 | oruns = hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution)); |
53 | snd_timer_interrupt(stime->timer, t->sticks); | 54 | snd_timer_interrupt(stime->timer, t->sticks * oruns); |
54 | 55 | ||
55 | if (!atomic_read(&stime->running)) | 56 | if (!atomic_read(&stime->running)) |
56 | return HRTIMER_NORESTART; | 57 | return HRTIMER_NORESTART; |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index f50ebf20df96..8442a088677d 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -618,8 +618,10 @@ static void snd_mixer_oss_put_volume1_vol(struct snd_mixer_oss_file *fmixer, | |||
618 | if (numid == ID_UNKNOWN) | 618 | if (numid == ID_UNKNOWN) |
619 | return; | 619 | return; |
620 | down_read(&card->controls_rwsem); | 620 | down_read(&card->controls_rwsem); |
621 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) | 621 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { |
622 | up_read(&card->controls_rwsem); | ||
622 | return; | 623 | return; |
624 | } | ||
623 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); | 625 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
624 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 626 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
625 | if (uinfo == NULL || uctl == NULL) | 627 | if (uinfo == NULL || uctl == NULL) |
@@ -658,7 +660,7 @@ static void snd_mixer_oss_put_volume1_sw(struct snd_mixer_oss_file *fmixer, | |||
658 | return; | 660 | return; |
659 | down_read(&card->controls_rwsem); | 661 | down_read(&card->controls_rwsem); |
660 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { | 662 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { |
661 | up_read(&fmixer->card->controls_rwsem); | 663 | up_read(&card->controls_rwsem); |
662 | return; | 664 | return; |
663 | } | 665 | } |
664 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); | 666 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
@@ -797,7 +799,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned | |||
797 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 799 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
798 | if (uinfo == NULL || uctl == NULL) { | 800 | if (uinfo == NULL || uctl == NULL) { |
799 | err = -ENOMEM; | 801 | err = -ENOMEM; |
800 | goto __unlock; | 802 | goto __free_only; |
801 | } | 803 | } |
802 | down_read(&card->controls_rwsem); | 804 | down_read(&card->controls_rwsem); |
803 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 805 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
@@ -826,6 +828,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned | |||
826 | err = 0; | 828 | err = 0; |
827 | __unlock: | 829 | __unlock: |
828 | up_read(&card->controls_rwsem); | 830 | up_read(&card->controls_rwsem); |
831 | __free_only: | ||
829 | kfree(uctl); | 832 | kfree(uctl); |
830 | kfree(uinfo); | 833 | kfree(uinfo); |
831 | return err; | 834 | return err; |
@@ -847,7 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned | |||
847 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 850 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
848 | if (uinfo == NULL || uctl == NULL) { | 851 | if (uinfo == NULL || uctl == NULL) { |
849 | err = -ENOMEM; | 852 | err = -ENOMEM; |
850 | goto __unlock; | 853 | goto __free_only; |
851 | } | 854 | } |
852 | down_read(&card->controls_rwsem); | 855 | down_read(&card->controls_rwsem); |
853 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 856 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
@@ -880,6 +883,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned | |||
880 | err = 0; | 883 | err = 0; |
881 | __unlock: | 884 | __unlock: |
882 | up_read(&card->controls_rwsem); | 885 | up_read(&card->controls_rwsem); |
886 | __free_only: | ||
883 | kfree(uctl); | 887 | kfree(uctl); |
884 | kfree(uinfo); | 888 | kfree(uinfo); |
885 | return err; | 889 | return err; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 5c8c7dff8ede..aed06c90a96a 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use | |||
1510 | static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) | 1510 | static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) |
1511 | { | 1511 | { |
1512 | struct snd_pcm_substream *substream; | 1512 | struct snd_pcm_substream *substream; |
1513 | struct snd_pcm_runtime *runtime; | ||
1514 | int i; | ||
1513 | 1515 | ||
1514 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; | 1516 | for (i = 0; i < 2; i++) { |
1515 | if (substream != NULL) { | 1517 | substream = pcm_oss_file->streams[i]; |
1516 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 1518 | if (!substream) |
1517 | substream->runtime->oss.prepare = 1; | 1519 | continue; |
1518 | } | 1520 | runtime = substream->runtime; |
1519 | substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; | ||
1520 | if (substream != NULL) { | ||
1521 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); | 1521 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
1522 | substream->runtime->oss.prepare = 1; | 1522 | runtime->oss.prepare = 1; |
1523 | runtime->oss.buffer_used = 0; | ||
1524 | runtime->oss.prev_hw_ptr_period = 0; | ||
1525 | runtime->oss.period_ptr = 0; | ||
1523 | } | 1526 | } |
1524 | return 0; | 1527 | return 0; |
1525 | } | 1528 | } |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 07f803e6d203..3f420ff273f8 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -86,7 +86,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
86 | int i, n; | 86 | int i, n; |
87 | 87 | ||
88 | for (i = 0; i < num_mixer_volumes; i++) { | 88 | for (i = 0; i < num_mixer_volumes; i++) { |
89 | if (strcmp(name, mixer_vols[i].name) == 0) { | 89 | if (strncmp(name, mixer_vols[i].name, 32) == 0) { |
90 | if (present) | 90 | if (present) |
91 | mixer_vols[i].num = i; | 91 | mixer_vols[i].num = i; |
92 | return mixer_vols[i].levels; | 92 | return mixer_vols[i].levels; |
@@ -98,7 +98,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
98 | } | 98 | } |
99 | n = num_mixer_volumes++; | 99 | n = num_mixer_volumes++; |
100 | 100 | ||
101 | strcpy(mixer_vols[n].name, name); | 101 | strncpy(mixer_vols[n].name, name, 32); |
102 | 102 | ||
103 | if (present) | 103 | if (present) |
104 | mixer_vols[n].num = n; | 104 | mixer_vols[n].num = n; |
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index b9d2f202cf9b..5439d662d104 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c | |||
@@ -42,11 +42,7 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_adb = { | |||
42 | .rate_min = 5000, | 42 | .rate_min = 5000, |
43 | .rate_max = 48000, | 43 | .rate_max = 48000, |
44 | .channels_min = 1, | 44 | .channels_min = 1, |
45 | #ifdef CHIP_AU8830 | ||
46 | .channels_max = 4, | ||
47 | #else | ||
48 | .channels_max = 2, | 45 | .channels_max = 2, |
49 | #endif | ||
50 | .buffer_bytes_max = 0x10000, | 46 | .buffer_bytes_max = 0x10000, |
51 | .period_bytes_min = 0x1, | 47 | .period_bytes_min = 0x1, |
52 | .period_bytes_max = 0x1000, | 48 | .period_bytes_max = 0x1000, |
@@ -115,6 +111,17 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_wt = { | |||
115 | .periods_max = 64, | 111 | .periods_max = 64, |
116 | }; | 112 | }; |
117 | #endif | 113 | #endif |
114 | #ifdef CHIP_AU8830 | ||
115 | static unsigned int au8830_channels[3] = { | ||
116 | 1, 2, 4, | ||
117 | }; | ||
118 | |||
119 | static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = { | ||
120 | .count = ARRAY_SIZE(au8830_channels), | ||
121 | .list = au8830_channels, | ||
122 | .mask = 0, | ||
123 | }; | ||
124 | #endif | ||
118 | /* open callback */ | 125 | /* open callback */ |
119 | static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) | 126 | static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) |
120 | { | 127 | { |
@@ -156,6 +163,15 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream) | |||
156 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB | 163 | if (VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB |
157 | || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) | 164 | || VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_I2S) |
158 | runtime->hw = snd_vortex_playback_hw_adb; | 165 | runtime->hw = snd_vortex_playback_hw_adb; |
166 | #ifdef CHIP_AU8830 | ||
167 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && | ||
168 | VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) { | ||
169 | runtime->hw.channels_max = 4; | ||
170 | snd_pcm_hw_constraint_list(runtime, 0, | ||
171 | SNDRV_PCM_HW_PARAM_CHANNELS, | ||
172 | &hw_constraints_au8830_channels); | ||
173 | } | ||
174 | #endif | ||
159 | substream->runtime->private_data = NULL; | 175 | substream->runtime->private_data = NULL; |
160 | } | 176 | } |
161 | #ifndef CHIP_AU8810 | 177 | #ifndef CHIP_AU8810 |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 14829210ef0b..b959c9f1e6fb 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1216,6 +1216,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
1216 | struct hda_codec *c; | 1216 | struct hda_codec *c; |
1217 | struct hda_cvt_setup *p; | 1217 | struct hda_cvt_setup *p; |
1218 | unsigned int oldval, newval; | 1218 | unsigned int oldval, newval; |
1219 | int type; | ||
1219 | int i; | 1220 | int i; |
1220 | 1221 | ||
1221 | if (!nid) | 1222 | if (!nid) |
@@ -1254,10 +1255,12 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
1254 | p->dirty = 0; | 1255 | p->dirty = 0; |
1255 | 1256 | ||
1256 | /* make other inactive cvts with the same stream-tag dirty */ | 1257 | /* make other inactive cvts with the same stream-tag dirty */ |
1258 | type = get_wcaps_type(get_wcaps(codec, nid)); | ||
1257 | list_for_each_entry(c, &codec->bus->codec_list, list) { | 1259 | list_for_each_entry(c, &codec->bus->codec_list, list) { |
1258 | for (i = 0; i < c->cvt_setups.used; i++) { | 1260 | for (i = 0; i < c->cvt_setups.used; i++) { |
1259 | p = snd_array_elem(&c->cvt_setups, i); | 1261 | p = snd_array_elem(&c->cvt_setups, i); |
1260 | if (!p->active && p->stream_tag == stream_tag) | 1262 | if (!p->active && p->stream_tag == stream_tag && |
1263 | get_wcaps_type(get_wcaps(codec, p->nid)) == type) | ||
1261 | p->dirty = 1; | 1264 | p->dirty = 1; |
1262 | } | 1265 | } |
1263 | } | 1266 | } |
@@ -1281,6 +1284,9 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
1281 | if (!nid) | 1284 | if (!nid) |
1282 | return; | 1285 | return; |
1283 | 1286 | ||
1287 | if (codec->no_sticky_stream) | ||
1288 | do_now = 1; | ||
1289 | |||
1284 | snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); | 1290 | snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); |
1285 | p = get_hda_cvt_setup(codec, nid); | 1291 | p = get_hda_cvt_setup(codec, nid); |
1286 | if (p) { | 1292 | if (p) { |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 62c702240108..c3ad37470f8f 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -850,6 +850,7 @@ struct hda_codec { | |||
850 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index | 850 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index |
851 | * (e.g. Conexant codecs) | 851 | * (e.g. Conexant codecs) |
852 | */ | 852 | */ |
853 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ | ||
853 | unsigned int pins_shutup:1; /* pins are shut up */ | 854 | unsigned int pins_shutup:1; /* pins are shut up */ |
854 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | 855 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
855 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 856 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 26c3ade73583..3c17a0a5ea81 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -381,7 +381,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
381 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 381 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); |
382 | 382 | ||
383 | if (a->format == AUDIO_CODING_TYPE_LPCM) | 383 | if (a->format == AUDIO_CODING_TYPE_LPCM) |
384 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8)); | 384 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); |
385 | else if (a->max_bitrate) | 385 | else if (a->max_bitrate) |
386 | snprintf(buf2, sizeof(buf2), | 386 | snprintf(buf2, sizeof(buf2), |
387 | ", max bitrate = %d", a->max_bitrate); | 387 | ", max bitrate = %d", a->max_bitrate); |
@@ -604,24 +604,19 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, | |||
604 | { | 604 | { |
605 | int i; | 605 | int i; |
606 | 606 | ||
607 | pcm->rates = 0; | 607 | /* assume basic audio support (the basic audio flag is not in ELD; |
608 | pcm->formats = 0; | 608 | * however, all audio capable sinks are required to support basic |
609 | pcm->maxbps = 0; | 609 | * audio) */ |
610 | pcm->channels_min = -1; | 610 | pcm->rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; |
611 | pcm->channels_max = 0; | 611 | pcm->formats = SNDRV_PCM_FMTBIT_S16_LE; |
612 | pcm->maxbps = 16; | ||
613 | pcm->channels_max = 2; | ||
612 | for (i = 0; i < eld->sad_count; i++) { | 614 | for (i = 0; i < eld->sad_count; i++) { |
613 | struct cea_sad *a = &eld->sad[i]; | 615 | struct cea_sad *a = &eld->sad[i]; |
614 | pcm->rates |= a->rates; | 616 | pcm->rates |= a->rates; |
615 | if (a->channels < pcm->channels_min) | ||
616 | pcm->channels_min = a->channels; | ||
617 | if (a->channels > pcm->channels_max) | 617 | if (a->channels > pcm->channels_max) |
618 | pcm->channels_max = a->channels; | 618 | pcm->channels_max = a->channels; |
619 | if (a->format == AUDIO_CODING_TYPE_LPCM) { | 619 | if (a->format == AUDIO_CODING_TYPE_LPCM) { |
620 | if (a->sample_bits & AC_SUPPCM_BITS_16) { | ||
621 | pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE; | ||
622 | if (pcm->maxbps < 16) | ||
623 | pcm->maxbps = 16; | ||
624 | } | ||
625 | if (a->sample_bits & AC_SUPPCM_BITS_20) { | 620 | if (a->sample_bits & AC_SUPPCM_BITS_20) { |
626 | pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; | 621 | pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; |
627 | if (pcm->maxbps < 20) | 622 | if (pcm->maxbps < 20) |
@@ -641,7 +636,6 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, | |||
641 | /* restrict the parameters by the values the codec provides */ | 636 | /* restrict the parameters by the values the codec provides */ |
642 | pcm->rates &= codec_pars->rates; | 637 | pcm->rates &= codec_pars->rates; |
643 | pcm->formats &= codec_pars->formats; | 638 | pcm->formats &= codec_pars->formats; |
644 | pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min); | ||
645 | pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); | 639 | pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); |
646 | pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); | 640 | pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); |
647 | } | 641 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 34940a079051..a8c6f3420344 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -458,6 +458,7 @@ enum { | |||
458 | AZX_DRIVER_ULI, | 458 | AZX_DRIVER_ULI, |
459 | AZX_DRIVER_NVIDIA, | 459 | AZX_DRIVER_NVIDIA, |
460 | AZX_DRIVER_TERA, | 460 | AZX_DRIVER_TERA, |
461 | AZX_DRIVER_CTX, | ||
461 | AZX_DRIVER_GENERIC, | 462 | AZX_DRIVER_GENERIC, |
462 | AZX_NUM_DRIVERS, /* keep this as last entry */ | 463 | AZX_NUM_DRIVERS, /* keep this as last entry */ |
463 | }; | 464 | }; |
@@ -473,6 +474,7 @@ static char *driver_short_names[] __devinitdata = { | |||
473 | [AZX_DRIVER_ULI] = "HDA ULI M5461", | 474 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
474 | [AZX_DRIVER_NVIDIA] = "HDA NVidia", | 475 | [AZX_DRIVER_NVIDIA] = "HDA NVidia", |
475 | [AZX_DRIVER_TERA] = "HDA Teradici", | 476 | [AZX_DRIVER_TERA] = "HDA Teradici", |
477 | [AZX_DRIVER_CTX] = "HDA Creative", | ||
476 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 478 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
477 | }; | 479 | }; |
478 | 480 | ||
@@ -563,7 +565,10 @@ static void azx_init_cmd_io(struct azx *chip) | |||
563 | /* reset the rirb hw write pointer */ | 565 | /* reset the rirb hw write pointer */ |
564 | azx_writew(chip, RIRBWP, ICH6_RIRBWP_RST); | 566 | azx_writew(chip, RIRBWP, ICH6_RIRBWP_RST); |
565 | /* set N=1, get RIRB response interrupt for new entry */ | 567 | /* set N=1, get RIRB response interrupt for new entry */ |
566 | azx_writew(chip, RINTCNT, 1); | 568 | if (chip->driver_type == AZX_DRIVER_CTX) |
569 | azx_writew(chip, RINTCNT, 0xc0); | ||
570 | else | ||
571 | azx_writew(chip, RINTCNT, 1); | ||
567 | /* enable rirb dma and response irq */ | 572 | /* enable rirb dma and response irq */ |
568 | azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN); | 573 | azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN); |
569 | spin_unlock_irq(&chip->reg_lock); | 574 | spin_unlock_irq(&chip->reg_lock); |
@@ -1136,8 +1141,11 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
1136 | /* clear rirb int */ | 1141 | /* clear rirb int */ |
1137 | status = azx_readb(chip, RIRBSTS); | 1142 | status = azx_readb(chip, RIRBSTS); |
1138 | if (status & RIRB_INT_MASK) { | 1143 | if (status & RIRB_INT_MASK) { |
1139 | if (status & RIRB_INT_RESPONSE) | 1144 | if (status & RIRB_INT_RESPONSE) { |
1145 | if (chip->driver_type == AZX_DRIVER_CTX) | ||
1146 | udelay(80); | ||
1140 | azx_update_rirb(chip); | 1147 | azx_update_rirb(chip); |
1148 | } | ||
1141 | azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); | 1149 | azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); |
1142 | } | 1150 | } |
1143 | 1151 | ||
@@ -1647,7 +1655,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1647 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1655 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1648 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 1656 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
1649 | struct snd_pcm_runtime *runtime = substream->runtime; | 1657 | struct snd_pcm_runtime *runtime = substream->runtime; |
1650 | unsigned int bufsize, period_bytes, format_val; | 1658 | unsigned int bufsize, period_bytes, format_val, stream_tag; |
1651 | int err; | 1659 | int err; |
1652 | 1660 | ||
1653 | azx_stream_reset(chip, azx_dev); | 1661 | azx_stream_reset(chip, azx_dev); |
@@ -1689,7 +1697,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1689 | else | 1697 | else |
1690 | azx_dev->fifo_size = 0; | 1698 | azx_dev->fifo_size = 0; |
1691 | 1699 | ||
1692 | return snd_hda_codec_prepare(apcm->codec, hinfo, azx_dev->stream_tag, | 1700 | stream_tag = azx_dev->stream_tag; |
1701 | /* CA-IBG chips need the playback stream starting from 1 */ | ||
1702 | if (chip->driver_type == AZX_DRIVER_CTX && | ||
1703 | stream_tag > chip->capture_streams) | ||
1704 | stream_tag -= chip->capture_streams; | ||
1705 | return snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, | ||
1693 | azx_dev->format_val, substream); | 1706 | azx_dev->format_val, substream); |
1694 | } | 1707 | } |
1695 | 1708 | ||
@@ -2285,9 +2298,11 @@ static int azx_dev_free(struct snd_device *device) | |||
2285 | */ | 2298 | */ |
2286 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { | 2299 | static struct snd_pci_quirk position_fix_list[] __devinitdata = { |
2287 | SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB), | 2300 | SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB), |
2301 | SND_PCI_QUIRK(0x1025, 0x026f, "Acer Aspire 5538", POS_FIX_LPIB), | ||
2288 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2302 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2289 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2303 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2290 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | 2304 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), |
2305 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell Inspiron 1120", POS_FIX_LPIB), | ||
2291 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2306 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2292 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2307 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2293 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2308 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
@@ -2794,10 +2809,10 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2794 | { PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_ANY_ID), | 2809 | { PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_ANY_ID), |
2795 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, | 2810 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2796 | .class_mask = 0xffffff, | 2811 | .class_mask = 0xffffff, |
2797 | .driver_data = AZX_DRIVER_GENERIC }, | 2812 | .driver_data = AZX_DRIVER_CTX }, |
2798 | #else | 2813 | #else |
2799 | /* this entry seems still valid -- i.e. without emu20kx chip */ | 2814 | /* this entry seems still valid -- i.e. without emu20kx chip */ |
2800 | { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_GENERIC }, | 2815 | { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_CTX }, |
2801 | #endif | 2816 | #endif |
2802 | /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ | 2817 | /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ |
2803 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), | 2818 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 10bbbaf6ebc3..0da636d28fb4 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -1276,6 +1276,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1276 | spec->multiout.no_share_stream = 1; | 1276 | spec->multiout.no_share_stream = 1; |
1277 | 1277 | ||
1278 | codec->no_trigger_sense = 1; | 1278 | codec->no_trigger_sense = 1; |
1279 | codec->no_sticky_stream = 1; | ||
1279 | 1280 | ||
1280 | return 0; | 1281 | return 0; |
1281 | } | 1282 | } |
@@ -1463,6 +1464,7 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1463 | codec->patch_ops = ad198x_patch_ops; | 1464 | codec->patch_ops = ad198x_patch_ops; |
1464 | 1465 | ||
1465 | codec->no_trigger_sense = 1; | 1466 | codec->no_trigger_sense = 1; |
1467 | codec->no_sticky_stream = 1; | ||
1466 | 1468 | ||
1467 | return 0; | 1469 | return 0; |
1468 | } | 1470 | } |
@@ -1917,6 +1919,7 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1917 | } | 1919 | } |
1918 | 1920 | ||
1919 | codec->no_trigger_sense = 1; | 1921 | codec->no_trigger_sense = 1; |
1922 | codec->no_sticky_stream = 1; | ||
1920 | 1923 | ||
1921 | return 0; | 1924 | return 0; |
1922 | } | 1925 | } |
@@ -3235,6 +3238,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3235 | spec->vmaster_nid = 0x04; | 3238 | spec->vmaster_nid = 0x04; |
3236 | 3239 | ||
3237 | codec->no_trigger_sense = 1; | 3240 | codec->no_trigger_sense = 1; |
3241 | codec->no_sticky_stream = 1; | ||
3238 | 3242 | ||
3239 | return 0; | 3243 | return 0; |
3240 | } | 3244 | } |
@@ -3449,6 +3453,7 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3449 | codec->patch_ops = ad198x_patch_ops; | 3453 | codec->patch_ops = ad198x_patch_ops; |
3450 | 3454 | ||
3451 | codec->no_trigger_sense = 1; | 3455 | codec->no_trigger_sense = 1; |
3456 | codec->no_sticky_stream = 1; | ||
3452 | 3457 | ||
3453 | return 0; | 3458 | return 0; |
3454 | } | 3459 | } |
@@ -4422,6 +4427,7 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
4422 | } | 4427 | } |
4423 | 4428 | ||
4424 | codec->no_trigger_sense = 1; | 4429 | codec->no_trigger_sense = 1; |
4430 | codec->no_sticky_stream = 1; | ||
4425 | 4431 | ||
4426 | return 0; | 4432 | return 0; |
4427 | } | 4433 | } |
@@ -4761,6 +4767,7 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4761 | } | 4767 | } |
4762 | 4768 | ||
4763 | codec->no_trigger_sense = 1; | 4769 | codec->no_trigger_sense = 1; |
4770 | codec->no_sticky_stream = 1; | ||
4764 | 4771 | ||
4765 | return 0; | 4772 | return 0; |
4766 | } | 4773 | } |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index af478019088e..9544463cf862 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -489,7 +489,7 @@ static void parse_digital(struct hda_codec *codec) | |||
489 | if (cfg->dig_outs && | 489 | if (cfg->dig_outs && |
490 | snd_hda_get_connections(codec, cfg->dig_out_pins[0], | 490 | snd_hda_get_connections(codec, cfg->dig_out_pins[0], |
491 | &spec->dig_out, 1) == 1) | 491 | &spec->dig_out, 1) == 1) |
492 | spec->multiout.dig_out_nid = cfg->dig_out_pins[0]; | 492 | spec->multiout.dig_out_nid = spec->dig_out; |
493 | } | 493 | } |
494 | 494 | ||
495 | static int ca0110_parse_auto_config(struct hda_codec *codec) | 495 | static int ca0110_parse_auto_config(struct hda_codec *codec) |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 972e7c453b3d..5dbff4507a93 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -393,10 +393,16 @@ static int conexant_add_jack(struct hda_codec *codec, | |||
393 | struct conexant_spec *spec; | 393 | struct conexant_spec *spec; |
394 | struct conexant_jack *jack; | 394 | struct conexant_jack *jack; |
395 | const char *name; | 395 | const char *name; |
396 | int err; | 396 | int i, err; |
397 | 397 | ||
398 | spec = codec->spec; | 398 | spec = codec->spec; |
399 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | 399 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
400 | |||
401 | jack = spec->jacks.list; | ||
402 | for (i = 0; i < spec->jacks.used; i++, jack++) | ||
403 | if (jack->nid == nid) | ||
404 | return 0 ; /* already present */ | ||
405 | |||
400 | jack = snd_array_new(&spec->jacks); | 406 | jack = snd_array_new(&spec->jacks); |
401 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | 407 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; |
402 | 408 | ||
@@ -3085,13 +3091,13 @@ static const char *cxt5066_models[CXT5066_MODELS] = { | |||
3085 | static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | 3091 | static struct snd_pci_quirk cxt5066_cfg_tbl[] = { |
3086 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", | 3092 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", |
3087 | CXT5066_LAPTOP), | 3093 | CXT5066_LAPTOP), |
3088 | SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", | 3094 | SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD), |
3089 | CXT5066_DELL_LAPTOP), | ||
3090 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), | 3095 | SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), |
3091 | SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTO), | 3096 | SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTO), |
3092 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), | 3097 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), |
3093 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3098 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3094 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3099 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3100 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), | ||
3095 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | 3101 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
3096 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3102 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
3097 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | 3103 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
@@ -3099,6 +3105,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3099 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), | 3105 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), |
3100 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), | 3106 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), |
3101 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), | 3107 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), |
3108 | SND_PCI_QUIRK(0x17aa, 0x21c8, "Thinkpad Edge 11", CXT5066_IDEAPAD), | ||
3102 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), | 3109 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), |
3103 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), | 3110 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), |
3104 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), | 3111 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index afd6022a96a7..4ab7c5c80838 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -779,7 +779,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, | |||
779 | return -ENODEV; | 779 | return -ENODEV; |
780 | } else { | 780 | } else { |
781 | /* fallback to the codec default */ | 781 | /* fallback to the codec default */ |
782 | hinfo->channels_min = codec_pars->channels_min; | ||
783 | hinfo->channels_max = codec_pars->channels_max; | 782 | hinfo->channels_max = codec_pars->channels_max; |
784 | hinfo->rates = codec_pars->rates; | 783 | hinfo->rates = codec_pars->rates; |
785 | hinfo->formats = codec_pars->formats; | 784 | hinfo->formats = codec_pars->formats; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a432e6efd19b..52b07fb942d4 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1438,6 +1438,7 @@ do_sku: | |||
1438 | spec->init_amp = ALC_INIT_GPIO3; | 1438 | spec->init_amp = ALC_INIT_GPIO3; |
1439 | break; | 1439 | break; |
1440 | case 5: | 1440 | case 5: |
1441 | default: | ||
1441 | spec->init_amp = ALC_INIT_DEFAULT; | 1442 | spec->init_amp = ALC_INIT_DEFAULT; |
1442 | break; | 1443 | break; |
1443 | } | 1444 | } |
@@ -4388,6 +4389,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { | |||
4388 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | 4389 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
4389 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | 4390 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
4390 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | 4391 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
4392 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), | ||
4391 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | 4393 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
4392 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | 4394 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
4393 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | 4395 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
@@ -9664,7 +9666,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9664 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 9666 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9665 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 9667 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9666 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | 9668 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
9667 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | ||
9668 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | 9669 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
9669 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 9670 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
9670 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 9671 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
@@ -16557,7 +16558,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
16557 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | 16558 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
16558 | const struct auto_pin_cfg *cfg) | 16559 | const struct auto_pin_cfg *cfg) |
16559 | { | 16560 | { |
16560 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | 16561 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
16561 | } | 16562 | } |
16562 | 16563 | ||
16563 | 16564 | ||
@@ -18612,6 +18613,8 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |||
18612 | return 0x02; | 18613 | return 0x02; |
18613 | else if (nid >= 0x0c && nid <= 0x0e) | 18614 | else if (nid >= 0x0c && nid <= 0x0e) |
18614 | return nid - 0x0c + 0x02; | 18615 | return nid - 0x0c + 0x02; |
18616 | else if (nid == 0x26) /* ALC887-VD has this DAC too */ | ||
18617 | return 0x25; | ||
18615 | else | 18618 | else |
18616 | return 0; | 18619 | return 0; |
18617 | } | 18620 | } |
@@ -18620,7 +18623,7 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | |||
18620 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | 18623 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
18621 | hda_nid_t dac) | 18624 | hda_nid_t dac) |
18622 | { | 18625 | { |
18623 | hda_nid_t mix[4]; | 18626 | hda_nid_t mix[5]; |
18624 | int i, num; | 18627 | int i, num; |
18625 | 18628 | ||
18626 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | 18629 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
@@ -18935,6 +18938,37 @@ static void alc662_auto_init(struct hda_codec *codec) | |||
18935 | alc_inithook(codec); | 18938 | alc_inithook(codec); |
18936 | } | 18939 | } |
18937 | 18940 | ||
18941 | enum { | ||
18942 | ALC662_FIXUP_ASPIRE, | ||
18943 | ALC662_FIXUP_IDEAPAD, | ||
18944 | }; | ||
18945 | |||
18946 | static const struct alc_fixup alc662_fixups[] = { | ||
18947 | [ALC662_FIXUP_ASPIRE] = { | ||
18948 | .pins = (const struct alc_pincfg[]) { | ||
18949 | { 0x15, 0x99130112 }, /* subwoofer */ | ||
18950 | { } | ||
18951 | } | ||
18952 | }, | ||
18953 | [ALC662_FIXUP_IDEAPAD] = { | ||
18954 | .pins = (const struct alc_pincfg[]) { | ||
18955 | { 0x17, 0x99130112 }, /* subwoofer */ | ||
18956 | { } | ||
18957 | } | ||
18958 | }, | ||
18959 | }; | ||
18960 | |||
18961 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | ||
18962 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | ||
18963 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | ||
18964 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | ||
18965 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | ||
18966 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | ||
18967 | {} | ||
18968 | }; | ||
18969 | |||
18970 | |||
18971 | |||
18938 | static int patch_alc662(struct hda_codec *codec) | 18972 | static int patch_alc662(struct hda_codec *codec) |
18939 | { | 18973 | { |
18940 | struct alc_spec *spec; | 18974 | struct alc_spec *spec; |
@@ -18967,6 +19001,7 @@ static int patch_alc662(struct hda_codec *codec) | |||
18967 | } | 19001 | } |
18968 | 19002 | ||
18969 | if (board_config == ALC662_AUTO) { | 19003 | if (board_config == ALC662_AUTO) { |
19004 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); | ||
18970 | /* automatic parse from the BIOS config */ | 19005 | /* automatic parse from the BIOS config */ |
18971 | err = alc662_parse_auto_config(codec); | 19006 | err = alc662_parse_auto_config(codec); |
18972 | if (err < 0) { | 19007 | if (err < 0) { |
@@ -19025,8 +19060,11 @@ static int patch_alc662(struct hda_codec *codec) | |||
19025 | spec->vmaster_nid = 0x02; | 19060 | spec->vmaster_nid = 0x02; |
19026 | 19061 | ||
19027 | codec->patch_ops = alc_patch_ops; | 19062 | codec->patch_ops = alc_patch_ops; |
19028 | if (board_config == ALC662_AUTO) | 19063 | if (board_config == ALC662_AUTO) { |
19029 | spec->init_hook = alc662_auto_init; | 19064 | spec->init_hook = alc662_auto_init; |
19065 | alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); | ||
19066 | } | ||
19067 | |||
19030 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 19068 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
19031 | if (!spec->loopback.amplist) | 19069 | if (!spec->loopback.amplist) |
19032 | spec->loopback.amplist = alc662_loopbacks; | 19070 | spec->loopback.amplist = alc662_loopbacks; |
@@ -19039,7 +19077,10 @@ static int patch_alc888(struct hda_codec *codec) | |||
19039 | { | 19077 | { |
19040 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | 19078 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
19041 | kfree(codec->chip_name); | 19079 | kfree(codec->chip_name); |
19042 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | 19080 | if (codec->vendor_id == 0x10ec0887) |
19081 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | ||
19082 | else | ||
19083 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | ||
19043 | if (!codec->chip_name) { | 19084 | if (!codec->chip_name) { |
19044 | alc_free(codec); | 19085 | alc_free(codec); |
19045 | return -ENOMEM; | 19086 | return -ENOMEM; |
@@ -19521,7 +19562,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
19521 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 19562 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
19522 | .patch = patch_alc882 }, | 19563 | .patch = patch_alc882 }, |
19523 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 19564 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
19524 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | 19565 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
19525 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 19566 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
19526 | .patch = patch_alc882 }, | 19567 | .patch = patch_alc882 }, |
19527 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | 19568 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index c16c5ba0fda0..78f12064b2bf 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -93,6 +93,7 @@ enum { | |||
93 | STAC_92HD83XXX_REF, | 93 | STAC_92HD83XXX_REF, |
94 | STAC_92HD83XXX_PWR_REF, | 94 | STAC_92HD83XXX_PWR_REF, |
95 | STAC_DELL_S14, | 95 | STAC_DELL_S14, |
96 | STAC_DELL_E6410, | ||
96 | STAC_92HD83XXX_HP, | 97 | STAC_92HD83XXX_HP, |
97 | STAC_HP_DV7_4000, | 98 | STAC_HP_DV7_4000, |
98 | STAC_92HD83XXX_MODELS | 99 | STAC_92HD83XXX_MODELS |
@@ -1618,6 +1619,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1618 | static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { | 1619 | static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { |
1619 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, | 1620 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, |
1620 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1621 | "Alienware M17x", STAC_ALIENWARE_M17X), |
1622 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, | ||
1623 | "Alienware M17x", STAC_ALIENWARE_M17X), | ||
1621 | {} /* terminator */ | 1624 | {} /* terminator */ |
1622 | }; | 1625 | }; |
1623 | 1626 | ||
@@ -1633,6 +1636,13 @@ static unsigned int dell_s14_pin_configs[10] = { | |||
1633 | 0x40f000f0, 0x40f000f0, | 1636 | 0x40f000f0, 0x40f000f0, |
1634 | }; | 1637 | }; |
1635 | 1638 | ||
1639 | /* Deliberately turn off 0x0f (Dock Mic) to make it choose Int Mic instead */ | ||
1640 | static unsigned int dell_e6410_pin_configs[10] = { | ||
1641 | 0x04a11020, 0x0421101f, 0x400000f0, 0x90170110, | ||
1642 | 0x23011050, 0x40f000f0, 0x400000f0, 0x90a60130, | ||
1643 | 0x40f000f0, 0x40f000f0, | ||
1644 | }; | ||
1645 | |||
1636 | static unsigned int hp_dv7_4000_pin_configs[10] = { | 1646 | static unsigned int hp_dv7_4000_pin_configs[10] = { |
1637 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, | 1647 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
1638 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, | 1648 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
@@ -1643,6 +1653,7 @@ static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | |||
1643 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | 1653 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
1644 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, | 1654 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
1645 | [STAC_DELL_S14] = dell_s14_pin_configs, | 1655 | [STAC_DELL_S14] = dell_s14_pin_configs, |
1656 | [STAC_DELL_E6410] = dell_e6410_pin_configs, | ||
1646 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, | 1657 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
1647 | }; | 1658 | }; |
1648 | 1659 | ||
@@ -1651,6 +1662,7 @@ static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | |||
1651 | [STAC_92HD83XXX_REF] = "ref", | 1662 | [STAC_92HD83XXX_REF] = "ref", |
1652 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", | 1663 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
1653 | [STAC_DELL_S14] = "dell-s14", | 1664 | [STAC_DELL_S14] = "dell-s14", |
1665 | [STAC_DELL_E6410] = "dell-e6410", | ||
1654 | [STAC_92HD83XXX_HP] = "hp", | 1666 | [STAC_92HD83XXX_HP] = "hp", |
1655 | [STAC_HP_DV7_4000] = "hp-dv7-4000", | 1667 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
1656 | }; | 1668 | }; |
@@ -1663,6 +1675,10 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1663 | "DFI LanParty", STAC_92HD83XXX_REF), | 1675 | "DFI LanParty", STAC_92HD83XXX_REF), |
1664 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, | 1676 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
1665 | "unknown Dell", STAC_DELL_S14), | 1677 | "unknown Dell", STAC_DELL_S14), |
1678 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x040a, | ||
1679 | "Dell E6410", STAC_DELL_E6410), | ||
1680 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x040b, | ||
1681 | "Dell E6510", STAC_DELL_E6410), | ||
1666 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, | 1682 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, |
1667 | "HP", STAC_92HD83XXX_HP), | 1683 | "HP", STAC_92HD83XXX_HP), |
1668 | {} /* terminator */ | 1684 | {} /* terminator */ |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 467749249576..ebfa1f8b70c1 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -1866,6 +1866,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1866 | }, | 1866 | }, |
1867 | { | 1867 | { |
1868 | .subvendor = 0x1028, | 1868 | .subvendor = 0x1028, |
1869 | .subdevice = 0x0182, | ||
1870 | .name = "Dell Latitude D610", /* STAC9750/51 */ | ||
1871 | .type = AC97_TUNE_HP_ONLY | ||
1872 | }, | ||
1873 | { | ||
1874 | .subvendor = 0x1028, | ||
1869 | .subdevice = 0x0186, | 1875 | .subdevice = 0x0186, |
1870 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ | 1876 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ |
1871 | .type = AC97_TUNE_HP_MUTE_LED | 1877 | .type = AC97_TUNE_HP_MUTE_LED |
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index c0eba5109980..d91f2e44e7e6 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -260,9 +260,9 @@ static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) | |||
260 | pr_debug("%s : sport %d\n", __func__, dai->id); | 260 | pr_debug("%s : sport %d\n", __func__, dai->id); |
261 | if (!dai->active) | 261 | if (!dai->active) |
262 | return 0; | 262 | return 0; |
263 | if (dai->capture.active) | 263 | if (dai->capture_active) |
264 | sport_rx_stop(sport); | 264 | sport_rx_stop(sport); |
265 | if (dai->playback.active) | 265 | if (dai->playback_active) |
266 | sport_tx_stop(sport); | 266 | sport_tx_stop(sport); |
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index 24c14269f4bc..25037789ddb6 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c | |||
@@ -210,7 +210,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai, | |||
210 | #ifdef CONFIG_PM | 210 | #ifdef CONFIG_PM |
211 | static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) | 211 | static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) |
212 | { | 212 | { |
213 | struct sport_device *sport = dai->private_data; | 213 | struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
214 | 214 | ||
215 | if (!dai->active) | 215 | if (!dai->active) |
216 | return 0; | 216 | return 0; |
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 72deeabef4fe..a961fc6f0c5f 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -171,7 +171,7 @@ | |||
171 | static const u16 wm8580_reg[] = { | 171 | static const u16 wm8580_reg[] = { |
172 | 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/ | 172 | 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/ |
173 | 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/ | 173 | 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/ |
174 | 0x001c, 0x0002, 0x0002, 0x00c2, /*R11*/ | 174 | 0x0010, 0x0002, 0x0002, 0x00c2, /*R11*/ |
175 | 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/ | 175 | 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/ |
176 | 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/ | 176 | 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/ |
177 | 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/ | 177 | 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/ |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 5da17a704e5a..4b8ffc2ea71d 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -188,7 +188,6 @@ static int wm8900_volatile_register(unsigned int reg) | |||
188 | { | 188 | { |
189 | switch (reg) { | 189 | switch (reg) { |
190 | case WM8900_REG_ID: | 190 | case WM8900_REG_ID: |
191 | case WM8900_REG_POWER1: | ||
192 | return 1; | 191 | return 1; |
193 | default: | 192 | default: |
194 | return 0; | 193 | return 0; |
@@ -1236,11 +1235,6 @@ static __devinit int wm8900_i2c_probe(struct i2c_client *i2c, | |||
1236 | goto err; | 1235 | goto err; |
1237 | } | 1236 | } |
1238 | 1237 | ||
1239 | /* Read back from the chip */ | ||
1240 | reg = snd_soc_read(codec, WM8900_REG_POWER1); | ||
1241 | reg = (reg >> 12) & 0xf; | ||
1242 | dev_info(&i2c->dev, "WM8900 revision %d\n", reg); | ||
1243 | |||
1244 | wm8900_reset(codec); | 1238 | wm8900_reset(codec); |
1245 | 1239 | ||
1246 | /* Turn the chip on */ | 1240 | /* Turn the chip on */ |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index f7dcabf6283c..f0897d8f444e 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -820,7 +820,8 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, | |||
820 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 820 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
821 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 821 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
822 | 822 | ||
823 | return wm8904->deemph; | 823 | ucontrol->value.enumerated.item[0] = wm8904->deemph; |
824 | return 0; | ||
824 | } | 825 | } |
825 | 826 | ||
826 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, | 827 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 5f025593d84d..004e83765642 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -384,7 +384,8 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, | |||
384 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 384 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
385 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 385 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
386 | 386 | ||
387 | return wm8955->deemph; | 387 | ucontrol->value.enumerated.item[0] = wm8955->deemph; |
388 | return 0; | ||
388 | } | 389 | } |
389 | 390 | ||
390 | static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, | 391 | static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 3c6ee61f6c95..2331f51b0d11 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -137,7 +137,8 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol, | |||
137 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 137 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
138 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); | 138 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); |
139 | 139 | ||
140 | return wm8960->deemph; | 140 | ucontrol->value.enumerated.item[0] = wm8960->deemph; |
141 | return 0; | ||
141 | } | 142 | } |
142 | 143 | ||
143 | static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, | 144 | static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, |
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 2549d3a297ab..3bd65c88d4a0 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
@@ -711,7 +711,7 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, | |||
711 | if (fs <= 24000) | 711 | if (fs <= 24000) |
712 | reg |= WM8961_DACSLOPE; | 712 | reg |= WM8961_DACSLOPE; |
713 | else | 713 | else |
714 | reg &= WM8961_DACSLOPE; | 714 | reg &= ~WM8961_DACSLOPE; |
715 | snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); | 715 | snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); |
716 | 716 | ||
717 | return 0; | 717 | return 0; |
@@ -736,7 +736,7 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
736 | freq /= 2; | 736 | freq /= 2; |
737 | } else { | 737 | } else { |
738 | dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq); | 738 | dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq); |
739 | reg &= WM8961_MCLKDIV; | 739 | reg &= ~WM8961_MCLKDIV; |
740 | } | 740 | } |
741 | 741 | ||
742 | snd_soc_write(codec, WM8961_CLOCKING1, reg); | 742 | snd_soc_write(codec, WM8961_CLOCKING1, reg); |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index dd8d909788c1..0022c7adb893 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -1183,7 +1183,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1183 | WM8990_VMIDTOG); | 1183 | WM8990_VMIDTOG); |
1184 | 1184 | ||
1185 | /* Delay to allow output caps to discharge */ | 1185 | /* Delay to allow output caps to discharge */ |
1186 | msleep(msecs_to_jiffies(300)); | 1186 | msleep(300); |
1187 | 1187 | ||
1188 | /* Disable VMIDTOG */ | 1188 | /* Disable VMIDTOG */ |
1189 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | | 1189 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | |
@@ -1195,17 +1195,17 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1195 | /* Enable outputs */ | 1195 | /* Enable outputs */ |
1196 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1b00); | 1196 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1b00); |
1197 | 1197 | ||
1198 | msleep(msecs_to_jiffies(50)); | 1198 | msleep(50); |
1199 | 1199 | ||
1200 | /* Enable VMID at 2x50k */ | 1200 | /* Enable VMID at 2x50k */ |
1201 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f02); | 1201 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f02); |
1202 | 1202 | ||
1203 | msleep(msecs_to_jiffies(100)); | 1203 | msleep(100); |
1204 | 1204 | ||
1205 | /* Enable VREF */ | 1205 | /* Enable VREF */ |
1206 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03); | 1206 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03); |
1207 | 1207 | ||
1208 | msleep(msecs_to_jiffies(600)); | 1208 | msleep(600); |
1209 | 1209 | ||
1210 | /* Enable BUFIOEN */ | 1210 | /* Enable BUFIOEN */ |
1211 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | | 1211 | snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | |
@@ -1250,7 +1250,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1250 | /* Disable VMID */ | 1250 | /* Disable VMID */ |
1251 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f01); | 1251 | snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f01); |
1252 | 1252 | ||
1253 | msleep(msecs_to_jiffies(300)); | 1253 | msleep(300); |
1254 | 1254 | ||
1255 | /* Enable all output discharge bits */ | 1255 | /* Enable all output discharge bits */ |
1256 | snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | | 1256 | snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 522249d5c2b4..f3732c20806f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -2519,18 +2519,18 @@ SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), | |||
2519 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | 2519 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), |
2520 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), | 2520 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), |
2521 | 2521 | ||
2522 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", "AIF1 Capture", | 2522 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, |
2523 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), | 2523 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), |
2524 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", "AIF1 Capture", | 2524 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, |
2525 | 0, WM8994_POWER_MANAGEMENT_4, 8, 0), | 2525 | 0, WM8994_POWER_MANAGEMENT_4, 8, 0), |
2526 | SND_SOC_DAPM_AIF_IN("AIF1DAC1L", NULL, 0, | 2526 | SND_SOC_DAPM_AIF_IN("AIF1DAC1L", NULL, 0, |
2527 | WM8994_POWER_MANAGEMENT_5, 9, 0), | 2527 | WM8994_POWER_MANAGEMENT_5, 9, 0), |
2528 | SND_SOC_DAPM_AIF_IN("AIF1DAC1R", NULL, 0, | 2528 | SND_SOC_DAPM_AIF_IN("AIF1DAC1R", NULL, 0, |
2529 | WM8994_POWER_MANAGEMENT_5, 8, 0), | 2529 | WM8994_POWER_MANAGEMENT_5, 8, 0), |
2530 | 2530 | ||
2531 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", "AIF1 Capture", | 2531 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, |
2532 | 0, WM8994_POWER_MANAGEMENT_4, 11, 0), | 2532 | 0, WM8994_POWER_MANAGEMENT_4, 11, 0), |
2533 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", "AIF1 Capture", | 2533 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, |
2534 | 0, WM8994_POWER_MANAGEMENT_4, 10, 0), | 2534 | 0, WM8994_POWER_MANAGEMENT_4, 10, 0), |
2535 | SND_SOC_DAPM_AIF_IN("AIF1DAC2L", NULL, 0, | 2535 | SND_SOC_DAPM_AIF_IN("AIF1DAC2L", NULL, 0, |
2536 | WM8994_POWER_MANAGEMENT_5, 11, 0), | 2536 | WM8994_POWER_MANAGEMENT_5, 11, 0), |
@@ -2571,6 +2571,7 @@ SND_SOC_DAPM_AIF_IN("AIF2DACR", NULL, 0, | |||
2571 | 2571 | ||
2572 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), | 2572 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), |
2573 | SND_SOC_DAPM_AIF_IN("AIF2DACDAT", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0), | 2573 | SND_SOC_DAPM_AIF_IN("AIF2DACDAT", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0), |
2574 | SND_SOC_DAPM_AIF_OUT("AIF1ADCDAT", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), | ||
2574 | SND_SOC_DAPM_AIF_OUT("AIF2ADCDAT", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0), | 2575 | SND_SOC_DAPM_AIF_OUT("AIF2ADCDAT", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0), |
2575 | 2576 | ||
2576 | SND_SOC_DAPM_MUX("AIF1DAC Mux", SND_SOC_NOPM, 0, 0, &aif1dac_mux), | 2577 | SND_SOC_DAPM_MUX("AIF1DAC Mux", SND_SOC_NOPM, 0, 0, &aif1dac_mux), |
@@ -2766,6 +2767,11 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
2766 | { "AIF2DAC2R Mixer", "Left Sidetone Switch", "Left Sidetone" }, | 2767 | { "AIF2DAC2R Mixer", "Left Sidetone Switch", "Left Sidetone" }, |
2767 | { "AIF2DAC2R Mixer", "Right Sidetone Switch", "Right Sidetone" }, | 2768 | { "AIF2DAC2R Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
2768 | 2769 | ||
2770 | { "AIF1ADCDAT", NULL, "AIF1ADC1L" }, | ||
2771 | { "AIF1ADCDAT", NULL, "AIF1ADC1R" }, | ||
2772 | { "AIF1ADCDAT", NULL, "AIF1ADC2L" }, | ||
2773 | { "AIF1ADCDAT", NULL, "AIF1ADC2R" }, | ||
2774 | |||
2769 | { "AIF2ADCDAT", NULL, "AIF2ADC Mux" }, | 2775 | { "AIF2ADCDAT", NULL, "AIF2ADC Mux" }, |
2770 | 2776 | ||
2771 | /* AIF3 output */ | 2777 | /* AIF3 output */ |
@@ -2914,6 +2920,7 @@ static int wm8994_set_fll(struct snd_soc_dai *dai, int id, int src, | |||
2914 | /* Allow no source specification when stopping */ | 2920 | /* Allow no source specification when stopping */ |
2915 | if (freq_out) | 2921 | if (freq_out) |
2916 | return -EINVAL; | 2922 | return -EINVAL; |
2923 | src = wm8994->fll[id].src; | ||
2917 | break; | 2924 | break; |
2918 | case WM8994_FLL_SRC_MCLK1: | 2925 | case WM8994_FLL_SRC_MCLK1: |
2919 | case WM8994_FLL_SRC_MCLK2: | 2926 | case WM8994_FLL_SRC_MCLK2: |
@@ -3485,7 +3492,7 @@ static int wm8994_set_tristate(struct snd_soc_dai *codec_dai, int tristate) | |||
3485 | else | 3492 | else |
3486 | val = 0; | 3493 | val = 0; |
3487 | 3494 | ||
3488 | return snd_soc_update_bits(codec, reg, mask, reg); | 3495 | return snd_soc_update_bits(codec, reg, mask, val); |
3489 | } | 3496 | } |
3490 | 3497 | ||
3491 | #define WM8994_RATES SNDRV_PCM_RATE_8000_96000 | 3498 | #define WM8994_RATES SNDRV_PCM_RATE_8000_96000 |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 2cb81538cd91..359ad8869349 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -92,6 +92,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) | |||
92 | static void calibrate_dc_servo(struct snd_soc_codec *codec) | 92 | static void calibrate_dc_servo(struct snd_soc_codec *codec) |
93 | { | 93 | { |
94 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 94 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
95 | s8 offset; | ||
95 | u16 reg, reg_l, reg_r, dcs_cfg; | 96 | u16 reg, reg_l, reg_r, dcs_cfg; |
96 | 97 | ||
97 | /* Set for 32 series updates */ | 98 | /* Set for 32 series updates */ |
@@ -130,16 +131,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) | |||
130 | dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); | 131 | dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); |
131 | 132 | ||
132 | /* HPOUT1L */ | 133 | /* HPOUT1L */ |
133 | if (reg_l + hubs->dcs_codes > 0 && | 134 | offset = reg_l; |
134 | reg_l + hubs->dcs_codes < 0xff) | 135 | offset += hubs->dcs_codes; |
135 | reg_l += hubs->dcs_codes; | 136 | dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
136 | dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT; | ||
137 | 137 | ||
138 | /* HPOUT1R */ | 138 | /* HPOUT1R */ |
139 | if (reg_r + hubs->dcs_codes > 0 && | 139 | offset = reg_r; |
140 | reg_r + hubs->dcs_codes < 0xff) | 140 | offset += hubs->dcs_codes; |
141 | reg_r += hubs->dcs_codes; | 141 | dcs_cfg |= (u8)offset; |
142 | dcs_cfg |= reg_r; | ||
143 | 142 | ||
144 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); | 143 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); |
145 | 144 | ||
@@ -293,7 +292,7 @@ SOC_DOUBLE_R("Speaker Switch", | |||
293 | SOC_DOUBLE_R("Speaker ZC Switch", | 292 | SOC_DOUBLE_R("Speaker ZC Switch", |
294 | WM8993_SPEAKER_VOLUME_LEFT, WM8993_SPEAKER_VOLUME_RIGHT, | 293 | WM8993_SPEAKER_VOLUME_LEFT, WM8993_SPEAKER_VOLUME_RIGHT, |
295 | 7, 1, 0), | 294 | 7, 1, 0), |
296 | SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 0, 3, 7, 0, | 295 | SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 3, 0, 7, 0, |
297 | spkboost_tlv), | 296 | spkboost_tlv), |
298 | SOC_ENUM("Speaker Reference", speaker_ref), | 297 | SOC_ENUM("Speaker Reference", speaker_ref), |
299 | SOC_ENUM("Speaker Mode", speaker_mode), | 298 | SOC_ENUM("Speaker Mode", speaker_mode), |
diff --git a/sound/usb/midi.c b/sound/usb/midi.c index b9c2bc65f51a..0eb1ade87345 100644 --- a/sound/usb/midi.c +++ b/sound/usb/midi.c | |||
@@ -843,8 +843,8 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep, | |||
843 | return; | 843 | return; |
844 | } | 844 | } |
845 | 845 | ||
846 | memset(urb->transfer_buffer + count, 0xFD, 9 - count); | 846 | memset(urb->transfer_buffer + count, 0xFD, ep->max_transfer - count); |
847 | urb->transfer_buffer_length = count; | 847 | urb->transfer_buffer_length = ep->max_transfer; |
848 | } | 848 | } |
849 | 849 | ||
850 | static struct usb_protocol_ops snd_usbmidi_122l_ops = { | 850 | static struct usb_protocol_ops snd_usbmidi_122l_ops = { |
@@ -1288,6 +1288,13 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, | |||
1288 | case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */ | 1288 | case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */ |
1289 | ep->max_transfer = 4; | 1289 | ep->max_transfer = 4; |
1290 | break; | 1290 | break; |
1291 | /* | ||
1292 | * Some devices only work with 9 bytes packet size: | ||
1293 | */ | ||
1294 | case USB_ID(0x0644, 0x800E): /* Tascam US-122L */ | ||
1295 | case USB_ID(0x0644, 0x800F): /* Tascam US-144 */ | ||
1296 | ep->max_transfer = 9; | ||
1297 | break; | ||
1291 | } | 1298 | } |
1292 | for (i = 0; i < OUTPUT_URBS; ++i) { | 1299 | for (i = 0; i < OUTPUT_URBS; ++i) { |
1293 | buffer = usb_alloc_coherent(umidi->dev, | 1300 | buffer = usb_alloc_coherent(umidi->dev, |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 6ef68e42138e..084e6fc8d5bf 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -273,29 +273,26 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, | |||
273 | struct file *file, poll_table *wait) | 273 | struct file *file, poll_table *wait) |
274 | { | 274 | { |
275 | struct us122l *us122l = hw->private_data; | 275 | struct us122l *us122l = hw->private_data; |
276 | struct usb_stream *s = us122l->sk.s; | ||
277 | unsigned *polled; | 276 | unsigned *polled; |
278 | unsigned int mask; | 277 | unsigned int mask; |
279 | 278 | ||
280 | poll_wait(file, &us122l->sk.sleep, wait); | 279 | poll_wait(file, &us122l->sk.sleep, wait); |
281 | 280 | ||
282 | switch (s->state) { | 281 | mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR; |
283 | case usb_stream_ready: | 282 | if (mutex_trylock(&us122l->mutex)) { |
284 | if (us122l->first == file) | 283 | struct usb_stream *s = us122l->sk.s; |
285 | polled = &s->periods_polled; | 284 | if (s && s->state == usb_stream_ready) { |
286 | else | 285 | if (us122l->first == file) |
287 | polled = &us122l->second_periods_polled; | 286 | polled = &s->periods_polled; |
288 | if (*polled != s->periods_done) { | 287 | else |
289 | *polled = s->periods_done; | 288 | polled = &us122l->second_periods_polled; |
290 | mask = POLLIN | POLLOUT | POLLWRNORM; | 289 | if (*polled != s->periods_done) { |
291 | break; | 290 | *polled = s->periods_done; |
291 | mask = POLLIN | POLLOUT | POLLWRNORM; | ||
292 | } else | ||
293 | mask = 0; | ||
292 | } | 294 | } |
293 | /* Fall through */ | 295 | mutex_unlock(&us122l->mutex); |
294 | mask = 0; | ||
295 | break; | ||
296 | default: | ||
297 | mask = POLLIN | POLLOUT | POLLWRNORM | POLLERR; | ||
298 | break; | ||
299 | } | 296 | } |
300 | return mask; | 297 | return mask; |
301 | } | 298 | } |
@@ -381,6 +378,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
381 | { | 378 | { |
382 | struct usb_stream_config *cfg; | 379 | struct usb_stream_config *cfg; |
383 | struct us122l *us122l = hw->private_data; | 380 | struct us122l *us122l = hw->private_data; |
381 | struct usb_stream *s; | ||
384 | unsigned min_period_frames; | 382 | unsigned min_period_frames; |
385 | int err = 0; | 383 | int err = 0; |
386 | bool high_speed; | 384 | bool high_speed; |
@@ -426,18 +424,18 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
426 | snd_power_wait(hw->card, SNDRV_CTL_POWER_D0); | 424 | snd_power_wait(hw->card, SNDRV_CTL_POWER_D0); |
427 | 425 | ||
428 | mutex_lock(&us122l->mutex); | 426 | mutex_lock(&us122l->mutex); |
427 | s = us122l->sk.s; | ||
429 | if (!us122l->master) | 428 | if (!us122l->master) |
430 | us122l->master = file; | 429 | us122l->master = file; |
431 | else if (us122l->master != file) { | 430 | else if (us122l->master != file) { |
432 | if (memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg))) { | 431 | if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg))) { |
433 | err = -EIO; | 432 | err = -EIO; |
434 | goto unlock; | 433 | goto unlock; |
435 | } | 434 | } |
436 | us122l->slave = file; | 435 | us122l->slave = file; |
437 | } | 436 | } |
438 | if (!us122l->sk.s || | 437 | if (!s || memcmp(cfg, &s->cfg, sizeof(*cfg)) || |
439 | memcmp(cfg, &us122l->sk.s->cfg, sizeof(*cfg)) || | 438 | s->state == usb_stream_xrun) { |
440 | us122l->sk.s->state == usb_stream_xrun) { | ||
441 | us122l_stop(us122l); | 439 | us122l_stop(us122l); |
442 | if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames)) | 440 | if (!us122l_start(us122l, cfg->sample_rate, cfg->period_frames)) |
443 | err = -EIO; | 441 | err = -EIO; |
@@ -448,6 +446,7 @@ unlock: | |||
448 | mutex_unlock(&us122l->mutex); | 446 | mutex_unlock(&us122l->mutex); |
449 | free: | 447 | free: |
450 | kfree(cfg); | 448 | kfree(cfg); |
449 | wake_up_all(&us122l->sk.sleep); | ||
451 | return err; | 450 | return err; |
452 | } | 451 | } |
453 | 452 | ||