diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-11-08 10:45:38 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-08 10:45:38 -0500 |
commit | a6bc732b5a96b5403c2637e85c350b95ec6591f3 (patch) | |
tree | 4b1c3967cd1de42a5e36e567cbdd18e1f4e8446f | |
parent | 9a22a8f558d09a83965d2bbe168294eb8ffb70e9 (diff) | |
parent | dd212bd5bb8b15889821ef79213cdb5bd47c6f85 (diff) |
Merge tag 'asoc-v3.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v3.13
Some additional fixes for v3.13, the majority of which are removals and
downgrades of BUG()s from Takashi.
126 files changed, 1049 insertions, 867 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 3438384d270c..ffcaf975bed7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -8917,61 +8917,14 @@ W: http://pegasus2.sourceforge.net/ | |||
8917 | S: Maintained | 8917 | S: Maintained |
8918 | F: drivers/net/usb/rtl8150.c | 8918 | F: drivers/net/usb/rtl8150.c |
8919 | 8919 | ||
8920 | USB SERIAL BELKIN F5U103 DRIVER | 8920 | USB SERIAL SUBSYSTEM |
8921 | M: William Greathouse <wgreathouse@smva.com> | 8921 | M: Johan Hovold <jhovold@gmail.com> |
8922 | L: linux-usb@vger.kernel.org | 8922 | L: linux-usb@vger.kernel.org |
8923 | S: Maintained | 8923 | S: Maintained |
8924 | F: drivers/usb/serial/belkin_sa.* | ||
8925 | |||
8926 | USB SERIAL CYPRESS M8 DRIVER | ||
8927 | M: Lonnie Mendez <dignome@gmail.com> | ||
8928 | L: linux-usb@vger.kernel.org | ||
8929 | S: Maintained | ||
8930 | W: http://geocities.com/i0xox0i | ||
8931 | W: http://firstlight.net/cvs | ||
8932 | F: drivers/usb/serial/cypress_m8.* | ||
8933 | |||
8934 | USB SERIAL CYBERJACK DRIVER | ||
8935 | M: Matthias Bruestle and Harald Welte <support@reiner-sct.com> | ||
8936 | W: http://www.reiner-sct.de/support/treiber_cyberjack.php | ||
8937 | S: Maintained | ||
8938 | F: drivers/usb/serial/cyberjack.c | ||
8939 | |||
8940 | USB SERIAL DIGI ACCELEPORT DRIVER | ||
8941 | M: Peter Berger <pberger@brimson.com> | ||
8942 | M: Al Borchers <alborchers@steinerpoint.com> | ||
8943 | L: linux-usb@vger.kernel.org | ||
8944 | S: Maintained | ||
8945 | F: drivers/usb/serial/digi_acceleport.c | ||
8946 | |||
8947 | USB SERIAL DRIVER | ||
8948 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
8949 | L: linux-usb@vger.kernel.org | ||
8950 | S: Supported | ||
8951 | F: Documentation/usb/usb-serial.txt | 8924 | F: Documentation/usb/usb-serial.txt |
8952 | F: drivers/usb/serial/generic.c | 8925 | F: drivers/usb/serial/ |
8953 | F: drivers/usb/serial/usb-serial.c | ||
8954 | F: include/linux/usb/serial.h | 8926 | F: include/linux/usb/serial.h |
8955 | 8927 | ||
8956 | USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER | ||
8957 | M: Gary Brubaker <xavyer@ix.netcom.com> | ||
8958 | L: linux-usb@vger.kernel.org | ||
8959 | S: Maintained | ||
8960 | F: drivers/usb/serial/empeg.c | ||
8961 | |||
8962 | USB SERIAL KEYSPAN DRIVER | ||
8963 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
8964 | L: linux-usb@vger.kernel.org | ||
8965 | S: Maintained | ||
8966 | F: drivers/usb/serial/*keyspan* | ||
8967 | |||
8968 | USB SERIAL WHITEHEAT DRIVER | ||
8969 | M: Support Department <support@connecttech.com> | ||
8970 | L: linux-usb@vger.kernel.org | ||
8971 | W: http://www.connecttech.com | ||
8972 | S: Supported | ||
8973 | F: drivers/usb/serial/whiteheat* | ||
8974 | |||
8975 | USB SMSC75XX ETHERNET DRIVER | 8928 | USB SMSC75XX ETHERNET DRIVER |
8976 | M: Steve Glendinning <steve.glendinning@shawell.net> | 8929 | M: Steve Glendinning <steve.glendinning@shawell.net> |
8977 | L: netdev@vger.kernel.org | 8930 | L: netdev@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 12 | 2 | PATCHLEVEL = 12 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc7 | 4 | EXTRAVERSION = |
5 | NAME = One Giant Leap for Frogkind | 5 | NAME = One Giant Leap for Frogkind |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index d63f3de0cd5b..0c14d8a52683 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <asm/pgalloc.h> | 17 | #include <asm/pgalloc.h> |
18 | #include <asm/mmu.h> | 18 | #include <asm/mmu.h> |
19 | 19 | ||
20 | static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address) | 20 | static int handle_vmalloc_fault(unsigned long address) |
21 | { | 21 | { |
22 | /* | 22 | /* |
23 | * Synchronize this task's top level page-table | 23 | * Synchronize this task's top level page-table |
@@ -27,7 +27,7 @@ static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address) | |||
27 | pud_t *pud, *pud_k; | 27 | pud_t *pud, *pud_k; |
28 | pmd_t *pmd, *pmd_k; | 28 | pmd_t *pmd, *pmd_k; |
29 | 29 | ||
30 | pgd = pgd_offset_fast(mm, address); | 30 | pgd = pgd_offset_fast(current->active_mm, address); |
31 | pgd_k = pgd_offset_k(address); | 31 | pgd_k = pgd_offset_k(address); |
32 | 32 | ||
33 | if (!pgd_present(*pgd_k)) | 33 | if (!pgd_present(*pgd_k)) |
@@ -72,7 +72,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address) | |||
72 | * nothing more. | 72 | * nothing more. |
73 | */ | 73 | */ |
74 | if (address >= VMALLOC_START && address <= VMALLOC_END) { | 74 | if (address >= VMALLOC_START && address <= VMALLOC_END) { |
75 | ret = handle_vmalloc_fault(mm, address); | 75 | ret = handle_vmalloc_fault(address); |
76 | if (unlikely(ret)) | 76 | if (unlikely(ret)) |
77 | goto bad_area_nosemaphore; | 77 | goto bad_area_nosemaphore; |
78 | else | 78 | else |
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index 45f1ffcf1a4b..24cdf64789c3 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -971,11 +971,11 @@ static const struct mips_perf_event mipsxx74Kcore_cache_map | |||
971 | [C(LL)] = { | 971 | [C(LL)] = { |
972 | [C(OP_READ)] = { | 972 | [C(OP_READ)] = { |
973 | [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, | 973 | [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, |
974 | [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P }, | 974 | [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P }, |
975 | }, | 975 | }, |
976 | [C(OP_WRITE)] = { | 976 | [C(OP_WRITE)] = { |
977 | [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, | 977 | [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P }, |
978 | [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P }, | 978 | [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN, P }, |
979 | }, | 979 | }, |
980 | }, | 980 | }, |
981 | [C(ITLB)] = { | 981 | [C(ITLB)] = { |
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index c69da3734699..5b28e81d94a0 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -473,7 +473,7 @@ static void __init fill_ipi_map(void) | |||
473 | { | 473 | { |
474 | int cpu; | 474 | int cpu; |
475 | 475 | ||
476 | for (cpu = 0; cpu < NR_CPUS; cpu++) { | 476 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) { |
477 | fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); | 477 | fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); |
478 | fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); | 478 | fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); |
479 | } | 479 | } |
@@ -574,8 +574,9 @@ void __init arch_init_irq(void) | |||
574 | /* FIXME */ | 574 | /* FIXME */ |
575 | int i; | 575 | int i; |
576 | #if defined(CONFIG_MIPS_MT_SMP) | 576 | #if defined(CONFIG_MIPS_MT_SMP) |
577 | gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; | 577 | gic_call_int_base = GIC_NUM_INTRS - |
578 | gic_resched_int_base = gic_call_int_base - NR_CPUS; | 578 | (NR_CPUS - nr_cpu_ids) * 2 - nr_cpu_ids; |
579 | gic_resched_int_base = gic_call_int_base - nr_cpu_ids; | ||
579 | fill_ipi_map(); | 580 | fill_ipi_map(); |
580 | #endif | 581 | #endif |
581 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, | 582 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, |
@@ -599,7 +600,7 @@ void __init arch_init_irq(void) | |||
599 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); | 600 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); |
600 | write_c0_status(0x1100dc00); | 601 | write_c0_status(0x1100dc00); |
601 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); | 602 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); |
602 | for (i = 0; i < NR_CPUS; i++) { | 603 | for (i = 0; i < nr_cpu_ids; i++) { |
603 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + | 604 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + |
604 | GIC_RESCHED_INT(i), &irq_resched); | 605 | GIC_RESCHED_INT(i), &irq_resched); |
605 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + | 606 | arch_init_ipiirq(MIPS_GIC_IRQ_BASE + |
diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c index e49241a2c39a..202785709441 100644 --- a/arch/mips/ralink/timer.c +++ b/arch/mips/ralink/timer.c | |||
@@ -126,7 +126,7 @@ static int rt_timer_probe(struct platform_device *pdev) | |||
126 | return -ENOENT; | 126 | return -ENOENT; |
127 | } | 127 | } |
128 | 128 | ||
129 | rt->membase = devm_request_and_ioremap(&pdev->dev, res); | 129 | rt->membase = devm_ioremap_resource(&pdev->dev, res); |
130 | if (IS_ERR(rt->membase)) | 130 | if (IS_ERR(rt->membase)) |
131 | return PTR_ERR(rt->membase); | 131 | return PTR_ERR(rt->membase); |
132 | 132 | ||
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c index 829df49dee99..41ebbfebb333 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c | |||
@@ -40,9 +40,11 @@ static ssize_t exitcode_proc_write(struct file *file, | |||
40 | const char __user *buffer, size_t count, loff_t *pos) | 40 | const char __user *buffer, size_t count, loff_t *pos) |
41 | { | 41 | { |
42 | char *end, buf[sizeof("nnnnn\0")]; | 42 | char *end, buf[sizeof("nnnnn\0")]; |
43 | size_t size; | ||
43 | int tmp; | 44 | int tmp; |
44 | 45 | ||
45 | if (copy_from_user(buf, buffer, count)) | 46 | size = min(count, sizeof(buf)); |
47 | if (copy_from_user(buf, buffer, size)) | ||
46 | return -EFAULT; | 48 | return -EFAULT; |
47 | 49 | ||
48 | tmp = simple_strtol(buf, &end, 0); | 50 | tmp = simple_strtol(buf, &end, 0); |
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 0da5200ee79d..b3e18f800302 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -128,7 +128,8 @@ do { \ | |||
128 | do { \ | 128 | do { \ |
129 | typedef typeof(var) pao_T__; \ | 129 | typedef typeof(var) pao_T__; \ |
130 | const int pao_ID__ = (__builtin_constant_p(val) && \ | 130 | const int pao_ID__ = (__builtin_constant_p(val) && \ |
131 | ((val) == 1 || (val) == -1)) ? (val) : 0; \ | 131 | ((val) == 1 || (val) == -1)) ? \ |
132 | (int)(val) : 0; \ | ||
132 | if (0) { \ | 133 | if (0) { \ |
133 | pao_T__ pao_tmp__; \ | 134 | pao_T__ pao_tmp__; \ |
134 | pao_tmp__ = (val); \ | 135 | pao_tmp__ = (val); \ |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 9d8449158cf9..8a87a3224121 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1276,16 +1276,16 @@ void perf_events_lapic_init(void) | |||
1276 | static int __kprobes | 1276 | static int __kprobes |
1277 | perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs) | 1277 | perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs) |
1278 | { | 1278 | { |
1279 | int ret; | ||
1280 | u64 start_clock; | 1279 | u64 start_clock; |
1281 | u64 finish_clock; | 1280 | u64 finish_clock; |
1281 | int ret; | ||
1282 | 1282 | ||
1283 | if (!atomic_read(&active_events)) | 1283 | if (!atomic_read(&active_events)) |
1284 | return NMI_DONE; | 1284 | return NMI_DONE; |
1285 | 1285 | ||
1286 | start_clock = local_clock(); | 1286 | start_clock = sched_clock(); |
1287 | ret = x86_pmu.handle_irq(regs); | 1287 | ret = x86_pmu.handle_irq(regs); |
1288 | finish_clock = local_clock(); | 1288 | finish_clock = sched_clock(); |
1289 | 1289 | ||
1290 | perf_sample_event_took(finish_clock - start_clock); | 1290 | perf_sample_event_took(finish_clock - start_clock); |
1291 | 1291 | ||
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a0e2a8a80c94..b2046e4d0b59 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -609,7 +609,7 @@ static struct dentry *d_kvm_debug; | |||
609 | 609 | ||
610 | struct dentry *kvm_init_debugfs(void) | 610 | struct dentry *kvm_init_debugfs(void) |
611 | { | 611 | { |
612 | d_kvm_debug = debugfs_create_dir("kvm", NULL); | 612 | d_kvm_debug = debugfs_create_dir("kvm-guest", NULL); |
613 | if (!d_kvm_debug) | 613 | if (!d_kvm_debug) |
614 | printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); | 614 | printk(KERN_WARNING "Could not create 'kvm' debugfs directory\n"); |
615 | 615 | ||
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index ba77ebc2c353..6fcb49ce50a1 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c | |||
@@ -113,10 +113,10 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2 | |||
113 | u64 before, delta, whole_msecs; | 113 | u64 before, delta, whole_msecs; |
114 | int remainder_ns, decimal_msecs, thishandled; | 114 | int remainder_ns, decimal_msecs, thishandled; |
115 | 115 | ||
116 | before = local_clock(); | 116 | before = sched_clock(); |
117 | thishandled = a->handler(type, regs); | 117 | thishandled = a->handler(type, regs); |
118 | handled += thishandled; | 118 | handled += thishandled; |
119 | delta = local_clock() - before; | 119 | delta = sched_clock() - before; |
120 | trace_nmi_handler(a->handler, (int)delta, thishandled); | 120 | trace_nmi_handler(a->handler, (int)delta, thishandled); |
121 | 121 | ||
122 | if (delta < nmi_longest_ns) | 122 | if (delta < nmi_longest_ns) |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index de1dfa18d0a1..21dbe6bdb8ed 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1122,7 +1122,7 @@ ENDPROC(fast_syscall_spill_registers) | |||
1122 | * a3: exctable, original value in excsave1 | 1122 | * a3: exctable, original value in excsave1 |
1123 | */ | 1123 | */ |
1124 | 1124 | ||
1125 | fast_syscall_spill_registers_fixup: | 1125 | ENTRY(fast_syscall_spill_registers_fixup) |
1126 | 1126 | ||
1127 | rsr a2, windowbase # get current windowbase (a2 is saved) | 1127 | rsr a2, windowbase # get current windowbase (a2 is saved) |
1128 | xsr a0, depc # restore depc and a0 | 1128 | xsr a0, depc # restore depc and a0 |
@@ -1134,22 +1134,26 @@ fast_syscall_spill_registers_fixup: | |||
1134 | */ | 1134 | */ |
1135 | 1135 | ||
1136 | xsr a3, excsave1 # get spill-mask | 1136 | xsr a3, excsave1 # get spill-mask |
1137 | slli a2, a3, 1 # shift left by one | 1137 | slli a3, a3, 1 # shift left by one |
1138 | 1138 | ||
1139 | slli a3, a2, 32-WSBITS | 1139 | slli a2, a3, 32-WSBITS |
1140 | src a2, a2, a3 # a1 = xxwww1yyxxxwww1yy...... | 1140 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... |
1141 | wsr a2, windowstart # set corrected windowstart | 1141 | wsr a2, windowstart # set corrected windowstart |
1142 | 1142 | ||
1143 | rsr a3, excsave1 | 1143 | srli a3, a3, 1 |
1144 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE # restore a2 | 1144 | rsr a2, excsave1 |
1145 | l32i a3, a3, EXC_TABLE_PARAM # original WB (in user task) | 1145 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 |
1146 | xsr a2, excsave1 | ||
1147 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1148 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1149 | xsr a2, excsave1 | ||
1146 | 1150 | ||
1147 | /* Return to the original (user task) WINDOWBASE. | 1151 | /* Return to the original (user task) WINDOWBASE. |
1148 | * We leave the following frame behind: | 1152 | * We leave the following frame behind: |
1149 | * a0, a1, a2 same | 1153 | * a0, a1, a2 same |
1150 | * a3: trashed (saved in excsave_1) | 1154 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) |
1151 | * depc: depc (we have to return to that address) | 1155 | * depc: depc (we have to return to that address) |
1152 | * excsave_1: a3 | 1156 | * excsave_1: exctable |
1153 | */ | 1157 | */ |
1154 | 1158 | ||
1155 | wsr a3, windowbase | 1159 | wsr a3, windowbase |
@@ -1159,9 +1163,9 @@ fast_syscall_spill_registers_fixup: | |||
1159 | * a0: return address | 1163 | * a0: return address |
1160 | * a1: used, stack pointer | 1164 | * a1: used, stack pointer |
1161 | * a2: kernel stack pointer | 1165 | * a2: kernel stack pointer |
1162 | * a3: available, saved in EXCSAVE_1 | 1166 | * a3: available |
1163 | * depc: exception address | 1167 | * depc: exception address |
1164 | * excsave: a3 | 1168 | * excsave: exctable |
1165 | * Note: This frame might be the same as above. | 1169 | * Note: This frame might be the same as above. |
1166 | */ | 1170 | */ |
1167 | 1171 | ||
@@ -1181,9 +1185,12 @@ fast_syscall_spill_registers_fixup: | |||
1181 | rsr a0, exccause | 1185 | rsr a0, exccause |
1182 | addx4 a0, a0, a3 # find entry in table | 1186 | addx4 a0, a0, a3 # find entry in table |
1183 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | 1187 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler |
1188 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1184 | jx a0 | 1189 | jx a0 |
1185 | 1190 | ||
1186 | fast_syscall_spill_registers_fixup_return: | 1191 | ENDPROC(fast_syscall_spill_registers_fixup) |
1192 | |||
1193 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1187 | 1194 | ||
1188 | /* When we return here, all registers have been restored (a2: DEPC) */ | 1195 | /* When we return here, all registers have been restored (a2: DEPC) */ |
1189 | 1196 | ||
@@ -1191,13 +1198,13 @@ fast_syscall_spill_registers_fixup_return: | |||
1191 | 1198 | ||
1192 | /* Restore fixup handler. */ | 1199 | /* Restore fixup handler. */ |
1193 | 1200 | ||
1194 | xsr a3, excsave1 | 1201 | rsr a2, excsave1 |
1195 | movi a2, fast_syscall_spill_registers_fixup | 1202 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE |
1196 | s32i a2, a3, EXC_TABLE_FIXUP | 1203 | movi a3, fast_syscall_spill_registers_fixup |
1197 | s32i a0, a3, EXC_TABLE_DOUBLE_SAVE | 1204 | s32i a3, a2, EXC_TABLE_FIXUP |
1198 | rsr a2, windowbase | 1205 | rsr a3, windowbase |
1199 | s32i a2, a3, EXC_TABLE_PARAM | 1206 | s32i a3, a2, EXC_TABLE_PARAM |
1200 | l32i a2, a3, EXC_TABLE_KSTK | 1207 | l32i a2, a2, EXC_TABLE_KSTK |
1201 | 1208 | ||
1202 | /* Load WB at the time the exception occurred. */ | 1209 | /* Load WB at the time the exception occurred. */ |
1203 | 1210 | ||
@@ -1206,8 +1213,12 @@ fast_syscall_spill_registers_fixup_return: | |||
1206 | wsr a3, windowbase | 1213 | wsr a3, windowbase |
1207 | rsync | 1214 | rsync |
1208 | 1215 | ||
1216 | rsr a3, excsave1 | ||
1217 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1218 | |||
1209 | rfde | 1219 | rfde |
1210 | 1220 | ||
1221 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1211 | 1222 | ||
1212 | /* | 1223 | /* |
1213 | * spill all registers. | 1224 | * spill all registers. |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index 718eca1850bd..98b67d5f1514 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
@@ -341,7 +341,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
341 | 341 | ||
342 | sp = regs->areg[1]; | 342 | sp = regs->areg[1]; |
343 | 343 | ||
344 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp)) { | 344 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && sas_ss_flags(sp) == 0) { |
345 | sp = current->sas_ss_sp + current->sas_ss_size; | 345 | sp = current->sas_ss_sp + current->sas_ss_size; |
346 | } | 346 | } |
347 | 347 | ||
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c index 56f88b7afe2f..e9e1aad8c271 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c | |||
@@ -737,7 +737,8 @@ static int __init iss_net_setup(char *str) | |||
737 | return 1; | 737 | return 1; |
738 | } | 738 | } |
739 | 739 | ||
740 | if ((new = alloc_bootmem(sizeof new)) == NULL) { | 740 | new = alloc_bootmem(sizeof(*new)); |
741 | if (new == NULL) { | ||
741 | printk("Alloc_bootmem failed\n"); | 742 | printk("Alloc_bootmem failed\n"); |
742 | return 1; | 743 | return 1; |
743 | } | 744 | } |
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 51410c2ac2cb..4d978a3c88f7 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c | |||
@@ -27,6 +27,14 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define SRC_CR 0x00U | 29 | #define SRC_CR 0x00U |
30 | #define SRC_CR_T0_ENSEL BIT(15) | ||
31 | #define SRC_CR_T1_ENSEL BIT(17) | ||
32 | #define SRC_CR_T2_ENSEL BIT(19) | ||
33 | #define SRC_CR_T3_ENSEL BIT(21) | ||
34 | #define SRC_CR_T4_ENSEL BIT(23) | ||
35 | #define SRC_CR_T5_ENSEL BIT(25) | ||
36 | #define SRC_CR_T6_ENSEL BIT(27) | ||
37 | #define SRC_CR_T7_ENSEL BIT(29) | ||
30 | #define SRC_XTALCR 0x0CU | 38 | #define SRC_XTALCR 0x0CU |
31 | #define SRC_XTALCR_XTALTIMEN BIT(20) | 39 | #define SRC_XTALCR_XTALTIMEN BIT(20) |
32 | #define SRC_XTALCR_SXTALDIS BIT(19) | 40 | #define SRC_XTALCR_SXTALDIS BIT(19) |
@@ -543,6 +551,19 @@ void __init nomadik_clk_init(void) | |||
543 | __func__, np->name); | 551 | __func__, np->name); |
544 | return; | 552 | return; |
545 | } | 553 | } |
554 | |||
555 | /* Set all timers to use the 2.4 MHz TIMCLK */ | ||
556 | val = readl(src_base + SRC_CR); | ||
557 | val |= SRC_CR_T0_ENSEL; | ||
558 | val |= SRC_CR_T1_ENSEL; | ||
559 | val |= SRC_CR_T2_ENSEL; | ||
560 | val |= SRC_CR_T3_ENSEL; | ||
561 | val |= SRC_CR_T4_ENSEL; | ||
562 | val |= SRC_CR_T5_ENSEL; | ||
563 | val |= SRC_CR_T6_ENSEL; | ||
564 | val |= SRC_CR_T7_ENSEL; | ||
565 | writel(val, src_base + SRC_CR); | ||
566 | |||
546 | val = readl(src_base + SRC_XTALCR); | 567 | val = readl(src_base + SRC_XTALCR); |
547 | pr_info("SXTALO is %s\n", | 568 | pr_info("SXTALO is %s\n", |
548 | (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); | 569 | (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled"); |
diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c index fc777bdc1886..81a202d12a7a 100644 --- a/drivers/clk/mvebu/armada-370.c +++ b/drivers/clk/mvebu/armada-370.c | |||
@@ -39,8 +39,8 @@ static const struct coreclk_ratio a370_coreclk_ratios[] __initconst = { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | static const u32 a370_tclk_freqs[] __initconst = { | 41 | static const u32 a370_tclk_freqs[] __initconst = { |
42 | 16600000, | 42 | 166000000, |
43 | 20000000, | 43 | 200000000, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static u32 __init a370_get_tclk_freq(void __iomem *sar) | 46 | static u32 __init a370_get_tclk_freq(void __iomem *sar) |
diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c index 5bb848cac6ec..81dd31a686df 100644 --- a/drivers/clk/socfpga/clk.c +++ b/drivers/clk/socfpga/clk.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #define SOCFPGA_L4_SP_CLK "l4_sp_clk" | 49 | #define SOCFPGA_L4_SP_CLK "l4_sp_clk" |
50 | #define SOCFPGA_NAND_CLK "nand_clk" | 50 | #define SOCFPGA_NAND_CLK "nand_clk" |
51 | #define SOCFPGA_NAND_X_CLK "nand_x_clk" | 51 | #define SOCFPGA_NAND_X_CLK "nand_x_clk" |
52 | #define SOCFPGA_MMC_CLK "mmc_clk" | 52 | #define SOCFPGA_MMC_CLK "sdmmc_clk" |
53 | #define SOCFPGA_DB_CLK "gpio_db_clk" | 53 | #define SOCFPGA_DB_CLK "gpio_db_clk" |
54 | 54 | ||
55 | #define div_mask(width) ((1 << (width)) - 1) | 55 | #define div_mask(width) ((1 << (width)) - 1) |
diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index 67ccf4aa7277..f5e4c21b301f 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c | |||
@@ -107,7 +107,7 @@ static int icst_set_rate(struct clk_hw *hw, unsigned long rate, | |||
107 | 107 | ||
108 | vco = icst_hz_to_vco(icst->params, rate); | 108 | vco = icst_hz_to_vco(icst->params, rate); |
109 | icst->rate = icst_hz(icst->params, vco); | 109 | icst->rate = icst_hz(icst->params, vco); |
110 | vco_set(icst->vcoreg, icst->lockreg, vco); | 110 | vco_set(icst->lockreg, icst->vcoreg, vco); |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 05ad9ba0a67e..fe58d0833a11 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -61,7 +61,7 @@ static int drm_version(struct drm_device *dev, void *data, | |||
61 | 61 | ||
62 | /** Ioctl table */ | 62 | /** Ioctl table */ |
63 | static const struct drm_ioctl_desc drm_ioctls[] = { | 63 | static const struct drm_ioctl_desc drm_ioctls[] = { |
64 | DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED), | 64 | DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED|DRM_RENDER_ALLOW), |
65 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), | 65 | DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), |
66 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), | 66 | DRM_IOCTL_DEF(DRM_IOCTL_GET_MAGIC, drm_getmagic, 0), |
67 | DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), | 67 | DRM_IOCTL_DEF(DRM_IOCTL_IRQ_BUSID, drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY), |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index ea9022ef15d5..10d1de5bce6f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -83,8 +83,7 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder, | |||
83 | return true; | 83 | return true; |
84 | } | 84 | } |
85 | 85 | ||
86 | static void intel_crt_get_config(struct intel_encoder *encoder, | 86 | static unsigned int intel_crt_get_flags(struct intel_encoder *encoder) |
87 | struct intel_crtc_config *pipe_config) | ||
88 | { | 87 | { |
89 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 88 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
90 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | 89 | struct intel_crt *crt = intel_encoder_to_crt(encoder); |
@@ -102,7 +101,25 @@ static void intel_crt_get_config(struct intel_encoder *encoder, | |||
102 | else | 101 | else |
103 | flags |= DRM_MODE_FLAG_NVSYNC; | 102 | flags |= DRM_MODE_FLAG_NVSYNC; |
104 | 103 | ||
105 | pipe_config->adjusted_mode.flags |= flags; | 104 | return flags; |
105 | } | ||
106 | |||
107 | static void intel_crt_get_config(struct intel_encoder *encoder, | ||
108 | struct intel_crtc_config *pipe_config) | ||
109 | { | ||
110 | pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder); | ||
111 | } | ||
112 | |||
113 | static void hsw_crt_get_config(struct intel_encoder *encoder, | ||
114 | struct intel_crtc_config *pipe_config) | ||
115 | { | ||
116 | intel_ddi_get_config(encoder, pipe_config); | ||
117 | |||
118 | pipe_config->adjusted_mode.flags &= ~(DRM_MODE_FLAG_PHSYNC | | ||
119 | DRM_MODE_FLAG_NHSYNC | | ||
120 | DRM_MODE_FLAG_PVSYNC | | ||
121 | DRM_MODE_FLAG_NVSYNC); | ||
122 | pipe_config->adjusted_mode.flags |= intel_crt_get_flags(encoder); | ||
106 | } | 123 | } |
107 | 124 | ||
108 | /* Note: The caller is required to filter out dpms modes not supported by the | 125 | /* Note: The caller is required to filter out dpms modes not supported by the |
@@ -799,7 +816,10 @@ void intel_crt_init(struct drm_device *dev) | |||
799 | crt->base.mode_set = intel_crt_mode_set; | 816 | crt->base.mode_set = intel_crt_mode_set; |
800 | crt->base.disable = intel_disable_crt; | 817 | crt->base.disable = intel_disable_crt; |
801 | crt->base.enable = intel_enable_crt; | 818 | crt->base.enable = intel_enable_crt; |
802 | crt->base.get_config = intel_crt_get_config; | 819 | if (IS_HASWELL(dev)) |
820 | crt->base.get_config = hsw_crt_get_config; | ||
821 | else | ||
822 | crt->base.get_config = intel_crt_get_config; | ||
803 | if (I915_HAS_HOTPLUG(dev)) | 823 | if (I915_HAS_HOTPLUG(dev)) |
804 | crt->base.hpd_pin = HPD_CRT; | 824 | crt->base.hpd_pin = HPD_CRT; |
805 | if (HAS_DDI(dev)) | 825 | if (HAS_DDI(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 63de2701b974..b53fff84a7d5 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -1249,8 +1249,8 @@ static void intel_ddi_hot_plug(struct intel_encoder *intel_encoder) | |||
1249 | intel_dp_check_link_status(intel_dp); | 1249 | intel_dp_check_link_status(intel_dp); |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | static void intel_ddi_get_config(struct intel_encoder *encoder, | 1252 | void intel_ddi_get_config(struct intel_encoder *encoder, |
1253 | struct intel_crtc_config *pipe_config) | 1253 | struct intel_crtc_config *pipe_config) |
1254 | { | 1254 | { |
1255 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 1255 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
1256 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); | 1256 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
@@ -1268,6 +1268,23 @@ static void intel_ddi_get_config(struct intel_encoder *encoder, | |||
1268 | flags |= DRM_MODE_FLAG_NVSYNC; | 1268 | flags |= DRM_MODE_FLAG_NVSYNC; |
1269 | 1269 | ||
1270 | pipe_config->adjusted_mode.flags |= flags; | 1270 | pipe_config->adjusted_mode.flags |= flags; |
1271 | |||
1272 | switch (temp & TRANS_DDI_BPC_MASK) { | ||
1273 | case TRANS_DDI_BPC_6: | ||
1274 | pipe_config->pipe_bpp = 18; | ||
1275 | break; | ||
1276 | case TRANS_DDI_BPC_8: | ||
1277 | pipe_config->pipe_bpp = 24; | ||
1278 | break; | ||
1279 | case TRANS_DDI_BPC_10: | ||
1280 | pipe_config->pipe_bpp = 30; | ||
1281 | break; | ||
1282 | case TRANS_DDI_BPC_12: | ||
1283 | pipe_config->pipe_bpp = 36; | ||
1284 | break; | ||
1285 | default: | ||
1286 | break; | ||
1287 | } | ||
1271 | } | 1288 | } |
1272 | 1289 | ||
1273 | static void intel_ddi_destroy(struct drm_encoder *encoder) | 1290 | static void intel_ddi_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 581fb4b2f766..d78d33f9337d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2327,9 +2327,10 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) | |||
2327 | FDI_FE_ERRC_ENABLE); | 2327 | FDI_FE_ERRC_ENABLE); |
2328 | } | 2328 | } |
2329 | 2329 | ||
2330 | static bool pipe_has_enabled_pch(struct intel_crtc *intel_crtc) | 2330 | static bool pipe_has_enabled_pch(struct intel_crtc *crtc) |
2331 | { | 2331 | { |
2332 | return intel_crtc->base.enabled && intel_crtc->config.has_pch_encoder; | 2332 | return crtc->base.enabled && crtc->active && |
2333 | crtc->config.has_pch_encoder; | ||
2333 | } | 2334 | } |
2334 | 2335 | ||
2335 | static void ivb_modeset_global_resources(struct drm_device *dev) | 2336 | static void ivb_modeset_global_resources(struct drm_device *dev) |
@@ -2979,6 +2980,48 @@ static void ironlake_pch_transcoder_set_timings(struct intel_crtc *crtc, | |||
2979 | I915_READ(VSYNCSHIFT(cpu_transcoder))); | 2980 | I915_READ(VSYNCSHIFT(cpu_transcoder))); |
2980 | } | 2981 | } |
2981 | 2982 | ||
2983 | static void cpt_enable_fdi_bc_bifurcation(struct drm_device *dev) | ||
2984 | { | ||
2985 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2986 | uint32_t temp; | ||
2987 | |||
2988 | temp = I915_READ(SOUTH_CHICKEN1); | ||
2989 | if (temp & FDI_BC_BIFURCATION_SELECT) | ||
2990 | return; | ||
2991 | |||
2992 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_B)) & FDI_RX_ENABLE); | ||
2993 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_C)) & FDI_RX_ENABLE); | ||
2994 | |||
2995 | temp |= FDI_BC_BIFURCATION_SELECT; | ||
2996 | DRM_DEBUG_KMS("enabling fdi C rx\n"); | ||
2997 | I915_WRITE(SOUTH_CHICKEN1, temp); | ||
2998 | POSTING_READ(SOUTH_CHICKEN1); | ||
2999 | } | ||
3000 | |||
3001 | static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc) | ||
3002 | { | ||
3003 | struct drm_device *dev = intel_crtc->base.dev; | ||
3004 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
3005 | |||
3006 | switch (intel_crtc->pipe) { | ||
3007 | case PIPE_A: | ||
3008 | break; | ||
3009 | case PIPE_B: | ||
3010 | if (intel_crtc->config.fdi_lanes > 2) | ||
3011 | WARN_ON(I915_READ(SOUTH_CHICKEN1) & FDI_BC_BIFURCATION_SELECT); | ||
3012 | else | ||
3013 | cpt_enable_fdi_bc_bifurcation(dev); | ||
3014 | |||
3015 | break; | ||
3016 | case PIPE_C: | ||
3017 | cpt_enable_fdi_bc_bifurcation(dev); | ||
3018 | |||
3019 | break; | ||
3020 | default: | ||
3021 | BUG(); | ||
3022 | } | ||
3023 | } | ||
3024 | |||
2982 | /* | 3025 | /* |
2983 | * Enable PCH resources required for PCH ports: | 3026 | * Enable PCH resources required for PCH ports: |
2984 | * - PCH PLLs | 3027 | * - PCH PLLs |
@@ -2997,6 +3040,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc) | |||
2997 | 3040 | ||
2998 | assert_pch_transcoder_disabled(dev_priv, pipe); | 3041 | assert_pch_transcoder_disabled(dev_priv, pipe); |
2999 | 3042 | ||
3043 | if (IS_IVYBRIDGE(dev)) | ||
3044 | ivybridge_update_fdi_bc_bifurcation(intel_crtc); | ||
3045 | |||
3000 | /* Write the TU size bits before fdi link training, so that error | 3046 | /* Write the TU size bits before fdi link training, so that error |
3001 | * detection works. */ | 3047 | * detection works. */ |
3002 | I915_WRITE(FDI_RX_TUSIZE1(pipe), | 3048 | I915_WRITE(FDI_RX_TUSIZE1(pipe), |
@@ -4983,6 +5029,22 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, | |||
4983 | if (!(tmp & PIPECONF_ENABLE)) | 5029 | if (!(tmp & PIPECONF_ENABLE)) |
4984 | return false; | 5030 | return false; |
4985 | 5031 | ||
5032 | if (IS_G4X(dev) || IS_VALLEYVIEW(dev)) { | ||
5033 | switch (tmp & PIPECONF_BPC_MASK) { | ||
5034 | case PIPECONF_6BPC: | ||
5035 | pipe_config->pipe_bpp = 18; | ||
5036 | break; | ||
5037 | case PIPECONF_8BPC: | ||
5038 | pipe_config->pipe_bpp = 24; | ||
5039 | break; | ||
5040 | case PIPECONF_10BPC: | ||
5041 | pipe_config->pipe_bpp = 30; | ||
5042 | break; | ||
5043 | default: | ||
5044 | break; | ||
5045 | } | ||
5046 | } | ||
5047 | |||
4986 | intel_get_pipe_timings(crtc, pipe_config); | 5048 | intel_get_pipe_timings(crtc, pipe_config); |
4987 | 5049 | ||
4988 | i9xx_get_pfit_config(crtc, pipe_config); | 5050 | i9xx_get_pfit_config(crtc, pipe_config); |
@@ -5576,48 +5638,6 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, | |||
5576 | return true; | 5638 | return true; |
5577 | } | 5639 | } |
5578 | 5640 | ||
5579 | static void cpt_enable_fdi_bc_bifurcation(struct drm_device *dev) | ||
5580 | { | ||
5581 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5582 | uint32_t temp; | ||
5583 | |||
5584 | temp = I915_READ(SOUTH_CHICKEN1); | ||
5585 | if (temp & FDI_BC_BIFURCATION_SELECT) | ||
5586 | return; | ||
5587 | |||
5588 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_B)) & FDI_RX_ENABLE); | ||
5589 | WARN_ON(I915_READ(FDI_RX_CTL(PIPE_C)) & FDI_RX_ENABLE); | ||
5590 | |||
5591 | temp |= FDI_BC_BIFURCATION_SELECT; | ||
5592 | DRM_DEBUG_KMS("enabling fdi C rx\n"); | ||
5593 | I915_WRITE(SOUTH_CHICKEN1, temp); | ||
5594 | POSTING_READ(SOUTH_CHICKEN1); | ||
5595 | } | ||
5596 | |||
5597 | static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc) | ||
5598 | { | ||
5599 | struct drm_device *dev = intel_crtc->base.dev; | ||
5600 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5601 | |||
5602 | switch (intel_crtc->pipe) { | ||
5603 | case PIPE_A: | ||
5604 | break; | ||
5605 | case PIPE_B: | ||
5606 | if (intel_crtc->config.fdi_lanes > 2) | ||
5607 | WARN_ON(I915_READ(SOUTH_CHICKEN1) & FDI_BC_BIFURCATION_SELECT); | ||
5608 | else | ||
5609 | cpt_enable_fdi_bc_bifurcation(dev); | ||
5610 | |||
5611 | break; | ||
5612 | case PIPE_C: | ||
5613 | cpt_enable_fdi_bc_bifurcation(dev); | ||
5614 | |||
5615 | break; | ||
5616 | default: | ||
5617 | BUG(); | ||
5618 | } | ||
5619 | } | ||
5620 | |||
5621 | int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp) | 5641 | int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp) |
5622 | { | 5642 | { |
5623 | /* | 5643 | /* |
@@ -5811,9 +5831,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5811 | &intel_crtc->config.fdi_m_n); | 5831 | &intel_crtc->config.fdi_m_n); |
5812 | } | 5832 | } |
5813 | 5833 | ||
5814 | if (IS_IVYBRIDGE(dev)) | ||
5815 | ivybridge_update_fdi_bc_bifurcation(intel_crtc); | ||
5816 | |||
5817 | ironlake_set_pipeconf(crtc); | 5834 | ironlake_set_pipeconf(crtc); |
5818 | 5835 | ||
5819 | /* Set up the display plane register */ | 5836 | /* Set up the display plane register */ |
@@ -5881,6 +5898,23 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | |||
5881 | if (!(tmp & PIPECONF_ENABLE)) | 5898 | if (!(tmp & PIPECONF_ENABLE)) |
5882 | return false; | 5899 | return false; |
5883 | 5900 | ||
5901 | switch (tmp & PIPECONF_BPC_MASK) { | ||
5902 | case PIPECONF_6BPC: | ||
5903 | pipe_config->pipe_bpp = 18; | ||
5904 | break; | ||
5905 | case PIPECONF_8BPC: | ||
5906 | pipe_config->pipe_bpp = 24; | ||
5907 | break; | ||
5908 | case PIPECONF_10BPC: | ||
5909 | pipe_config->pipe_bpp = 30; | ||
5910 | break; | ||
5911 | case PIPECONF_12BPC: | ||
5912 | pipe_config->pipe_bpp = 36; | ||
5913 | break; | ||
5914 | default: | ||
5915 | break; | ||
5916 | } | ||
5917 | |||
5884 | if (I915_READ(PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) { | 5918 | if (I915_READ(PCH_TRANSCONF(crtc->pipe)) & TRANS_ENABLE) { |
5885 | struct intel_shared_dpll *pll; | 5919 | struct intel_shared_dpll *pll; |
5886 | 5920 | ||
@@ -8612,6 +8646,9 @@ intel_pipe_config_compare(struct drm_device *dev, | |||
8612 | PIPE_CONF_CHECK_X(dpll_hw_state.fp0); | 8646 | PIPE_CONF_CHECK_X(dpll_hw_state.fp0); |
8613 | PIPE_CONF_CHECK_X(dpll_hw_state.fp1); | 8647 | PIPE_CONF_CHECK_X(dpll_hw_state.fp1); |
8614 | 8648 | ||
8649 | if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5) | ||
8650 | PIPE_CONF_CHECK_I(pipe_bpp); | ||
8651 | |||
8615 | #undef PIPE_CONF_CHECK_X | 8652 | #undef PIPE_CONF_CHECK_X |
8616 | #undef PIPE_CONF_CHECK_I | 8653 | #undef PIPE_CONF_CHECK_I |
8617 | #undef PIPE_CONF_CHECK_FLAGS | 8654 | #undef PIPE_CONF_CHECK_FLAGS |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2c555f91bfae..1a431377d83b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1401,6 +1401,26 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
1401 | else | 1401 | else |
1402 | pipe_config->port_clock = 270000; | 1402 | pipe_config->port_clock = 270000; |
1403 | } | 1403 | } |
1404 | |||
1405 | if (is_edp(intel_dp) && dev_priv->vbt.edp_bpp && | ||
1406 | pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) { | ||
1407 | /* | ||
1408 | * This is a big fat ugly hack. | ||
1409 | * | ||
1410 | * Some machines in UEFI boot mode provide us a VBT that has 18 | ||
1411 | * bpp and 1.62 GHz link bandwidth for eDP, which for reasons | ||
1412 | * unknown we fail to light up. Yet the same BIOS boots up with | ||
1413 | * 24 bpp and 2.7 GHz link. Use the same bpp as the BIOS uses as | ||
1414 | * max, not what it tells us to use. | ||
1415 | * | ||
1416 | * Note: This will still be broken if the eDP panel is not lit | ||
1417 | * up by the BIOS, and thus we can't get the mode at module | ||
1418 | * load. | ||
1419 | */ | ||
1420 | DRM_DEBUG_KMS("pipe has %d bpp for eDP panel, overriding BIOS-provided max %d bpp\n", | ||
1421 | pipe_config->pipe_bpp, dev_priv->vbt.edp_bpp); | ||
1422 | dev_priv->vbt.edp_bpp = pipe_config->pipe_bpp; | ||
1423 | } | ||
1404 | } | 1424 | } |
1405 | 1425 | ||
1406 | static bool is_edp_psr(struct intel_dp *intel_dp) | 1426 | static bool is_edp_psr(struct intel_dp *intel_dp) |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 9b7b68fd5d47..7f2b384ac939 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -765,6 +765,8 @@ extern void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder); | |||
765 | extern bool | 765 | extern bool |
766 | intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector); | 766 | intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector); |
767 | extern void intel_ddi_fdi_disable(struct drm_crtc *crtc); | 767 | extern void intel_ddi_fdi_disable(struct drm_crtc *crtc); |
768 | extern void intel_ddi_get_config(struct intel_encoder *encoder, | ||
769 | struct intel_crtc_config *pipe_config); | ||
768 | 770 | ||
769 | extern void intel_display_handle_reset(struct drm_device *dev); | 771 | extern void intel_display_handle_reset(struct drm_device *dev); |
770 | extern bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, | 772 | extern bool intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 831a5c021c4b..b8af94a5be39 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -700,6 +700,22 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
700 | }, | 700 | }, |
701 | { | 701 | { |
702 | .callback = intel_no_lvds_dmi_callback, | 702 | .callback = intel_no_lvds_dmi_callback, |
703 | .ident = "Intel D410PT", | ||
704 | .matches = { | ||
705 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | ||
706 | DMI_MATCH(DMI_BOARD_NAME, "D410PT"), | ||
707 | }, | ||
708 | }, | ||
709 | { | ||
710 | .callback = intel_no_lvds_dmi_callback, | ||
711 | .ident = "Intel D425KT", | ||
712 | .matches = { | ||
713 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | ||
714 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "D425KT"), | ||
715 | }, | ||
716 | }, | ||
717 | { | ||
718 | .callback = intel_no_lvds_dmi_callback, | ||
703 | .ident = "Intel D510MO", | 719 | .ident = "Intel D510MO", |
704 | .matches = { | 720 | .matches = { |
705 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), | 721 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel"), |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index fe1de855775e..57fcc4b16a52 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -291,6 +291,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
291 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ | 291 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ |
292 | 292 | ||
293 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, | 293 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, |
294 | HDMI_ACR_SOURCE | /* select SW CTS value */ | ||
294 | HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ | 295 | HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ |
295 | 296 | ||
296 | evergreen_hdmi_update_ACR(encoder, mode->clock); | 297 | evergreen_hdmi_update_ACR(encoder, mode->clock); |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 71399065db04..b41905573cd2 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2635,7 +2635,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2635 | pi->caps_sclk_ds = true; | 2635 | pi->caps_sclk_ds = true; |
2636 | pi->enable_auto_thermal_throttling = true; | 2636 | pi->enable_auto_thermal_throttling = true; |
2637 | pi->disable_nb_ps3_in_battery = false; | 2637 | pi->disable_nb_ps3_in_battery = false; |
2638 | pi->bapm_enable = true; | 2638 | pi->bapm_enable = false; |
2639 | pi->voltage_drop_t = 0; | 2639 | pi->voltage_drop_t = 0; |
2640 | pi->caps_sclk_throttle_low_notification = false; | 2640 | pi->caps_sclk_throttle_low_notification = false; |
2641 | pi->caps_fps = false; /* true? */ | 2641 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a400ac1c4147..24f4960f59ee 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1272,8 +1272,8 @@ struct radeon_blacklist_clocks | |||
1272 | struct radeon_clock_and_voltage_limits { | 1272 | struct radeon_clock_and_voltage_limits { |
1273 | u32 sclk; | 1273 | u32 sclk; |
1274 | u32 mclk; | 1274 | u32 mclk; |
1275 | u32 vddc; | 1275 | u16 vddc; |
1276 | u32 vddci; | 1276 | u16 vddci; |
1277 | }; | 1277 | }; |
1278 | 1278 | ||
1279 | struct radeon_clock_array { | 1279 | struct radeon_clock_array { |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c04469928925..e75d015024a1 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1734,6 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class); | |||
1734 | */ | 1734 | */ |
1735 | struct input_dev *input_allocate_device(void) | 1735 | struct input_dev *input_allocate_device(void) |
1736 | { | 1736 | { |
1737 | static atomic_t input_no = ATOMIC_INIT(0); | ||
1737 | struct input_dev *dev; | 1738 | struct input_dev *dev; |
1738 | 1739 | ||
1739 | dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); | 1740 | dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); |
@@ -1743,9 +1744,13 @@ struct input_dev *input_allocate_device(void) | |||
1743 | device_initialize(&dev->dev); | 1744 | device_initialize(&dev->dev); |
1744 | mutex_init(&dev->mutex); | 1745 | mutex_init(&dev->mutex); |
1745 | spin_lock_init(&dev->event_lock); | 1746 | spin_lock_init(&dev->event_lock); |
1747 | init_timer(&dev->timer); | ||
1746 | INIT_LIST_HEAD(&dev->h_list); | 1748 | INIT_LIST_HEAD(&dev->h_list); |
1747 | INIT_LIST_HEAD(&dev->node); | 1749 | INIT_LIST_HEAD(&dev->node); |
1748 | 1750 | ||
1751 | dev_set_name(&dev->dev, "input%ld", | ||
1752 | (unsigned long) atomic_inc_return(&input_no) - 1); | ||
1753 | |||
1749 | __module_get(THIS_MODULE); | 1754 | __module_get(THIS_MODULE); |
1750 | } | 1755 | } |
1751 | 1756 | ||
@@ -2019,7 +2024,6 @@ static void devm_input_device_unregister(struct device *dev, void *res) | |||
2019 | */ | 2024 | */ |
2020 | int input_register_device(struct input_dev *dev) | 2025 | int input_register_device(struct input_dev *dev) |
2021 | { | 2026 | { |
2022 | static atomic_t input_no = ATOMIC_INIT(0); | ||
2023 | struct input_devres *devres = NULL; | 2027 | struct input_devres *devres = NULL; |
2024 | struct input_handler *handler; | 2028 | struct input_handler *handler; |
2025 | unsigned int packet_size; | 2029 | unsigned int packet_size; |
@@ -2059,7 +2063,6 @@ int input_register_device(struct input_dev *dev) | |||
2059 | * If delay and period are pre-set by the driver, then autorepeating | 2063 | * If delay and period are pre-set by the driver, then autorepeating |
2060 | * is handled by the driver itself and we don't do it in input.c. | 2064 | * is handled by the driver itself and we don't do it in input.c. |
2061 | */ | 2065 | */ |
2062 | init_timer(&dev->timer); | ||
2063 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { | 2066 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { |
2064 | dev->timer.data = (long) dev; | 2067 | dev->timer.data = (long) dev; |
2065 | dev->timer.function = input_repeat_key; | 2068 | dev->timer.function = input_repeat_key; |
@@ -2073,9 +2076,6 @@ int input_register_device(struct input_dev *dev) | |||
2073 | if (!dev->setkeycode) | 2076 | if (!dev->setkeycode) |
2074 | dev->setkeycode = input_default_setkeycode; | 2077 | dev->setkeycode = input_default_setkeycode; |
2075 | 2078 | ||
2076 | dev_set_name(&dev->dev, "input%ld", | ||
2077 | (unsigned long) atomic_inc_return(&input_no) - 1); | ||
2078 | |||
2079 | error = device_add(&dev->dev); | 2079 | error = device_add(&dev->dev); |
2080 | if (error) | 2080 | if (error) |
2081 | goto err_free_vals; | 2081 | goto err_free_vals; |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 134c3b404a54..a2e758d27584 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -786,10 +786,17 @@ static int pxa27x_keypad_probe(struct platform_device *pdev) | |||
786 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | 786 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
787 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | 787 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); |
788 | 788 | ||
789 | if (pdata) | 789 | if (pdata) { |
790 | error = pxa27x_keypad_build_keycode(keypad); | 790 | error = pxa27x_keypad_build_keycode(keypad); |
791 | else | 791 | } else { |
792 | error = pxa27x_keypad_build_keycode_from_dt(keypad); | 792 | error = pxa27x_keypad_build_keycode_from_dt(keypad); |
793 | /* | ||
794 | * Data that we get from DT resides in dynamically | ||
795 | * allocated memory so we need to update our pdata | ||
796 | * pointer. | ||
797 | */ | ||
798 | pdata = keypad->pdata; | ||
799 | } | ||
793 | if (error) { | 800 | if (error) { |
794 | dev_err(&pdev->dev, "failed to build keycode\n"); | 801 | dev_err(&pdev->dev, "failed to build keycode\n"); |
795 | goto failed_put_clk; | 802 | goto failed_put_clk; |
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index 082684e7f390..9365535ba7f1 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c | |||
@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
351 | if (status) { | 351 | if (status) { |
352 | if (status == -ESHUTDOWN) | 352 | if (status == -ESHUTDOWN) |
353 | return; | 353 | return; |
354 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); | 354 | dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n", |
355 | __func__, status); | ||
356 | goto out; | ||
355 | } | 357 | } |
356 | 358 | ||
357 | /* Special keys */ | 359 | /* Special keys */ |
@@ -418,8 +420,12 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
418 | dev->ctl_data->byte[2], | 420 | dev->ctl_data->byte[2], |
419 | dev->ctl_data->byte[3]); | 421 | dev->ctl_data->byte[3]); |
420 | 422 | ||
421 | if (status) | 423 | if (status) { |
422 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); | 424 | if (status == -ESHUTDOWN) |
425 | return; | ||
426 | dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n", | ||
427 | __func__, status); | ||
428 | } | ||
423 | 429 | ||
424 | spin_lock(&dev->ctl_submit_lock); | 430 | spin_lock(&dev->ctl_submit_lock); |
425 | 431 | ||
@@ -427,7 +433,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
427 | 433 | ||
428 | if (likely(!dev->shutdown)) { | 434 | if (likely(!dev->shutdown)) { |
429 | 435 | ||
430 | if (dev->buzzer_pending) { | 436 | if (dev->buzzer_pending || status) { |
431 | dev->buzzer_pending = 0; | 437 | dev->buzzer_pending = 0; |
432 | dev->ctl_urb_pending = 1; | 438 | dev->ctl_urb_pending = 1; |
433 | cm109_submit_buzz_toggle(dev); | 439 | cm109_submit_buzz_toggle(dev); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 7c5d72a6a26a..83658472ad25 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -103,6 +103,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
103 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ | 103 | /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ |
104 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, | 104 | { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, |
105 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, | 105 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, |
106 | { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_DUALPOINT }, /* Dell XT2 */ | ||
106 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ | 107 | { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
107 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, | 108 | { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, |
108 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ | 109 | ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 78e4de42efaa..52c9ebf94729 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -223,21 +223,26 @@ static int i8042_flush(void) | |||
223 | { | 223 | { |
224 | unsigned long flags; | 224 | unsigned long flags; |
225 | unsigned char data, str; | 225 | unsigned char data, str; |
226 | int i = 0; | 226 | int count = 0; |
227 | int retval = 0; | ||
227 | 228 | ||
228 | spin_lock_irqsave(&i8042_lock, flags); | 229 | spin_lock_irqsave(&i8042_lock, flags); |
229 | 230 | ||
230 | while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { | 231 | while ((str = i8042_read_status()) & I8042_STR_OBF) { |
231 | udelay(50); | 232 | if (count++ < I8042_BUFFER_SIZE) { |
232 | data = i8042_read_data(); | 233 | udelay(50); |
233 | i++; | 234 | data = i8042_read_data(); |
234 | dbg("%02x <- i8042 (flush, %s)\n", | 235 | dbg("%02x <- i8042 (flush, %s)\n", |
235 | data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); | 236 | data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); |
237 | } else { | ||
238 | retval = -EIO; | ||
239 | break; | ||
240 | } | ||
236 | } | 241 | } |
237 | 242 | ||
238 | spin_unlock_irqrestore(&i8042_lock, flags); | 243 | spin_unlock_irqrestore(&i8042_lock, flags); |
239 | 244 | ||
240 | return i; | 245 | return retval; |
241 | } | 246 | } |
242 | 247 | ||
243 | /* | 248 | /* |
@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void) | |||
849 | 854 | ||
850 | static int i8042_controller_check(void) | 855 | static int i8042_controller_check(void) |
851 | { | 856 | { |
852 | if (i8042_flush() == I8042_BUFFER_SIZE) { | 857 | if (i8042_flush()) { |
853 | pr_err("No controller found\n"); | 858 | pr_err("No controller found\n"); |
854 | return -ENODEV; | 859 | return -ENODEV; |
855 | } | 860 | } |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 79b69ea47f74..e53416a4d7f3 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -1031,6 +1031,7 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static enum power_supply_property wacom_battery_props[] = { | 1033 | static enum power_supply_property wacom_battery_props[] = { |
1034 | POWER_SUPPLY_PROP_SCOPE, | ||
1034 | POWER_SUPPLY_PROP_CAPACITY | 1035 | POWER_SUPPLY_PROP_CAPACITY |
1035 | }; | 1036 | }; |
1036 | 1037 | ||
@@ -1042,6 +1043,9 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
1042 | int ret = 0; | 1043 | int ret = 0; |
1043 | 1044 | ||
1044 | switch (psp) { | 1045 | switch (psp) { |
1046 | case POWER_SUPPLY_PROP_SCOPE: | ||
1047 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | ||
1048 | break; | ||
1045 | case POWER_SUPPLY_PROP_CAPACITY: | 1049 | case POWER_SUPPLY_PROP_CAPACITY: |
1046 | val->intval = | 1050 | val->intval = |
1047 | wacom->wacom_wac.battery_capacity * 100 / 31; | 1051 | wacom->wacom_wac.battery_capacity * 100 / 31; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index b2aa503c16b1..c59b797eeafa 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -2054,6 +2054,12 @@ static const struct wacom_features wacom_features_0x101 = | |||
2054 | static const struct wacom_features wacom_features_0x10D = | 2054 | static const struct wacom_features wacom_features_0x10D = |
2055 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2055 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2056 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2056 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2057 | static const struct wacom_features wacom_features_0x10E = | ||
2058 | { "Wacom ISDv4 10E", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | ||
2059 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2060 | static const struct wacom_features wacom_features_0x10F = | ||
2061 | { "Wacom ISDv4 10F", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | ||
2062 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2057 | static const struct wacom_features wacom_features_0x4001 = | 2063 | static const struct wacom_features wacom_features_0x4001 = |
2058 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2064 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, |
2059 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2065 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2248,6 +2254,8 @@ const struct usb_device_id wacom_ids[] = { | |||
2248 | { USB_DEVICE_WACOM(0x100) }, | 2254 | { USB_DEVICE_WACOM(0x100) }, |
2249 | { USB_DEVICE_WACOM(0x101) }, | 2255 | { USB_DEVICE_WACOM(0x101) }, |
2250 | { USB_DEVICE_WACOM(0x10D) }, | 2256 | { USB_DEVICE_WACOM(0x10D) }, |
2257 | { USB_DEVICE_WACOM(0x10E) }, | ||
2258 | { USB_DEVICE_WACOM(0x10F) }, | ||
2251 | { USB_DEVICE_WACOM(0x300) }, | 2259 | { USB_DEVICE_WACOM(0x300) }, |
2252 | { USB_DEVICE_WACOM(0x301) }, | 2260 | { USB_DEVICE_WACOM(0x301) }, |
2253 | { USB_DEVICE_WACOM(0x304) }, | 2261 | { USB_DEVICE_WACOM(0x304) }, |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index be12fbfcae10..1ea75236a15f 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -552,9 +552,8 @@ static void __ref enable_slot(struct acpiphp_slot *slot) | |||
552 | struct acpiphp_func *func; | 552 | struct acpiphp_func *func; |
553 | int max, pass; | 553 | int max, pass; |
554 | LIST_HEAD(add_list); | 554 | LIST_HEAD(add_list); |
555 | int nr_found; | ||
556 | 555 | ||
557 | nr_found = acpiphp_rescan_slot(slot); | 556 | acpiphp_rescan_slot(slot); |
558 | max = acpiphp_max_busnr(bus); | 557 | max = acpiphp_max_busnr(bus); |
559 | for (pass = 0; pass < 2; pass++) { | 558 | for (pass = 0; pass < 2; pass++) { |
560 | list_for_each_entry(dev, &bus->devices, bus_list) { | 559 | list_for_each_entry(dev, &bus->devices, bus_list) { |
@@ -574,9 +573,6 @@ static void __ref enable_slot(struct acpiphp_slot *slot) | |||
574 | } | 573 | } |
575 | } | 574 | } |
576 | __pci_bus_assign_resources(bus, &add_list, NULL); | 575 | __pci_bus_assign_resources(bus, &add_list, NULL); |
577 | /* Nothing more to do here if there are no new devices on this bus. */ | ||
578 | if (!nr_found && (slot->flags & SLOT_ENABLED)) | ||
579 | return; | ||
580 | 576 | ||
581 | acpiphp_sanitize_bus(bus); | 577 | acpiphp_sanitize_bus(bus); |
582 | acpiphp_set_hpp_values(bus); | 578 | acpiphp_set_hpp_values(bus); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 408a42ef787a..f0d432c139d0 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -771,6 +771,8 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
771 | static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | 771 | static int aac_compat_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) |
772 | { | 772 | { |
773 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; | 773 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; |
774 | if (!capable(CAP_SYS_RAWIO)) | ||
775 | return -EPERM; | ||
774 | return aac_compat_do_ioctl(dev, cmd, (unsigned long)arg); | 776 | return aac_compat_do_ioctl(dev, cmd, (unsigned long)arg); |
775 | } | 777 | } |
776 | 778 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 5cbc4bb1b395..df5e961484e1 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -105,8 +105,11 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ; | |||
105 | static int sg_add(struct device *, struct class_interface *); | 105 | static int sg_add(struct device *, struct class_interface *); |
106 | static void sg_remove(struct device *, struct class_interface *); | 106 | static void sg_remove(struct device *, struct class_interface *); |
107 | 107 | ||
108 | static DEFINE_SPINLOCK(sg_open_exclusive_lock); | ||
109 | |||
108 | static DEFINE_IDR(sg_index_idr); | 110 | static DEFINE_IDR(sg_index_idr); |
109 | static DEFINE_RWLOCK(sg_index_lock); | 111 | static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock |
112 | file descriptor list for device */ | ||
110 | 113 | ||
111 | static struct class_interface sg_interface = { | 114 | static struct class_interface sg_interface = { |
112 | .add_dev = sg_add, | 115 | .add_dev = sg_add, |
@@ -143,7 +146,8 @@ typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ | |||
143 | } Sg_request; | 146 | } Sg_request; |
144 | 147 | ||
145 | typedef struct sg_fd { /* holds the state of a file descriptor */ | 148 | typedef struct sg_fd { /* holds the state of a file descriptor */ |
146 | struct list_head sfd_siblings; /* protected by sfd_lock of device */ | 149 | /* sfd_siblings is protected by sg_index_lock */ |
150 | struct list_head sfd_siblings; | ||
147 | struct sg_device *parentdp; /* owning device */ | 151 | struct sg_device *parentdp; /* owning device */ |
148 | wait_queue_head_t read_wait; /* queue read until command done */ | 152 | wait_queue_head_t read_wait; /* queue read until command done */ |
149 | rwlock_t rq_list_lock; /* protect access to list in req_arr */ | 153 | rwlock_t rq_list_lock; /* protect access to list in req_arr */ |
@@ -166,12 +170,13 @@ typedef struct sg_fd { /* holds the state of a file descriptor */ | |||
166 | 170 | ||
167 | typedef struct sg_device { /* holds the state of each scsi generic device */ | 171 | typedef struct sg_device { /* holds the state of each scsi generic device */ |
168 | struct scsi_device *device; | 172 | struct scsi_device *device; |
173 | wait_queue_head_t o_excl_wait; /* queue open() when O_EXCL in use */ | ||
169 | int sg_tablesize; /* adapter's max scatter-gather table size */ | 174 | int sg_tablesize; /* adapter's max scatter-gather table size */ |
170 | u32 index; /* device index number */ | 175 | u32 index; /* device index number */ |
171 | spinlock_t sfd_lock; /* protect file descriptor list for device */ | 176 | /* sfds is protected by sg_index_lock */ |
172 | struct list_head sfds; | 177 | struct list_head sfds; |
173 | struct rw_semaphore o_sem; /* exclude open should hold this rwsem */ | ||
174 | volatile char detached; /* 0->attached, 1->detached pending removal */ | 178 | volatile char detached; /* 0->attached, 1->detached pending removal */ |
179 | /* exclude protected by sg_open_exclusive_lock */ | ||
175 | char exclude; /* opened for exclusive access */ | 180 | char exclude; /* opened for exclusive access */ |
176 | char sgdebug; /* 0->off, 1->sense, 9->dump dev, 10-> all devs */ | 181 | char sgdebug; /* 0->off, 1->sense, 9->dump dev, 10-> all devs */ |
177 | struct gendisk *disk; | 182 | struct gendisk *disk; |
@@ -220,14 +225,35 @@ static int sg_allow_access(struct file *filp, unsigned char *cmd) | |||
220 | return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); | 225 | return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE); |
221 | } | 226 | } |
222 | 227 | ||
228 | static int get_exclude(Sg_device *sdp) | ||
229 | { | ||
230 | unsigned long flags; | ||
231 | int ret; | ||
232 | |||
233 | spin_lock_irqsave(&sg_open_exclusive_lock, flags); | ||
234 | ret = sdp->exclude; | ||
235 | spin_unlock_irqrestore(&sg_open_exclusive_lock, flags); | ||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static int set_exclude(Sg_device *sdp, char val) | ||
240 | { | ||
241 | unsigned long flags; | ||
242 | |||
243 | spin_lock_irqsave(&sg_open_exclusive_lock, flags); | ||
244 | sdp->exclude = val; | ||
245 | spin_unlock_irqrestore(&sg_open_exclusive_lock, flags); | ||
246 | return val; | ||
247 | } | ||
248 | |||
223 | static int sfds_list_empty(Sg_device *sdp) | 249 | static int sfds_list_empty(Sg_device *sdp) |
224 | { | 250 | { |
225 | unsigned long flags; | 251 | unsigned long flags; |
226 | int ret; | 252 | int ret; |
227 | 253 | ||
228 | spin_lock_irqsave(&sdp->sfd_lock, flags); | 254 | read_lock_irqsave(&sg_index_lock, flags); |
229 | ret = list_empty(&sdp->sfds); | 255 | ret = list_empty(&sdp->sfds); |
230 | spin_unlock_irqrestore(&sdp->sfd_lock, flags); | 256 | read_unlock_irqrestore(&sg_index_lock, flags); |
231 | return ret; | 257 | return ret; |
232 | } | 258 | } |
233 | 259 | ||
@@ -239,6 +265,7 @@ sg_open(struct inode *inode, struct file *filp) | |||
239 | struct request_queue *q; | 265 | struct request_queue *q; |
240 | Sg_device *sdp; | 266 | Sg_device *sdp; |
241 | Sg_fd *sfp; | 267 | Sg_fd *sfp; |
268 | int res; | ||
242 | int retval; | 269 | int retval; |
243 | 270 | ||
244 | nonseekable_open(inode, filp); | 271 | nonseekable_open(inode, filp); |
@@ -267,52 +294,54 @@ sg_open(struct inode *inode, struct file *filp) | |||
267 | goto error_out; | 294 | goto error_out; |
268 | } | 295 | } |
269 | 296 | ||
270 | if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE))) { | 297 | if (flags & O_EXCL) { |
271 | retval = -EPERM; /* Can't lock it with read only access */ | 298 | if (O_RDONLY == (flags & O_ACCMODE)) { |
272 | goto error_out; | 299 | retval = -EPERM; /* Can't lock it with read only access */ |
273 | } | 300 | goto error_out; |
274 | if (flags & O_NONBLOCK) { | 301 | } |
275 | if (flags & O_EXCL) { | 302 | if (!sfds_list_empty(sdp) && (flags & O_NONBLOCK)) { |
276 | if (!down_write_trylock(&sdp->o_sem)) { | 303 | retval = -EBUSY; |
277 | retval = -EBUSY; | 304 | goto error_out; |
278 | goto error_out; | 305 | } |
279 | } | 306 | res = wait_event_interruptible(sdp->o_excl_wait, |
280 | } else { | 307 | ((!sfds_list_empty(sdp) || get_exclude(sdp)) ? 0 : set_exclude(sdp, 1))); |
281 | if (!down_read_trylock(&sdp->o_sem)) { | 308 | if (res) { |
282 | retval = -EBUSY; | 309 | retval = res; /* -ERESTARTSYS because signal hit process */ |
283 | goto error_out; | 310 | goto error_out; |
284 | } | 311 | } |
312 | } else if (get_exclude(sdp)) { /* some other fd has an exclusive lock on dev */ | ||
313 | if (flags & O_NONBLOCK) { | ||
314 | retval = -EBUSY; | ||
315 | goto error_out; | ||
316 | } | ||
317 | res = wait_event_interruptible(sdp->o_excl_wait, !get_exclude(sdp)); | ||
318 | if (res) { | ||
319 | retval = res; /* -ERESTARTSYS because signal hit process */ | ||
320 | goto error_out; | ||
285 | } | 321 | } |
286 | } else { | ||
287 | if (flags & O_EXCL) | ||
288 | down_write(&sdp->o_sem); | ||
289 | else | ||
290 | down_read(&sdp->o_sem); | ||
291 | } | 322 | } |
292 | /* Since write lock is held, no need to check sfd_list */ | 323 | if (sdp->detached) { |
293 | if (flags & O_EXCL) | 324 | retval = -ENODEV; |
294 | sdp->exclude = 1; /* used by release lock */ | 325 | goto error_out; |
295 | 326 | } | |
296 | if (sfds_list_empty(sdp)) { /* no existing opens on this device */ | 327 | if (sfds_list_empty(sdp)) { /* no existing opens on this device */ |
297 | sdp->sgdebug = 0; | 328 | sdp->sgdebug = 0; |
298 | q = sdp->device->request_queue; | 329 | q = sdp->device->request_queue; |
299 | sdp->sg_tablesize = queue_max_segments(q); | 330 | sdp->sg_tablesize = queue_max_segments(q); |
300 | } | 331 | } |
301 | sfp = sg_add_sfp(sdp, dev); | 332 | if ((sfp = sg_add_sfp(sdp, dev))) |
302 | if (!IS_ERR(sfp)) | ||
303 | filp->private_data = sfp; | 333 | filp->private_data = sfp; |
304 | /* retval is already provably zero at this point because of the | ||
305 | * check after retval = scsi_autopm_get_device(sdp->device)) | ||
306 | */ | ||
307 | else { | 334 | else { |
308 | retval = PTR_ERR(sfp); | ||
309 | |||
310 | if (flags & O_EXCL) { | 335 | if (flags & O_EXCL) { |
311 | sdp->exclude = 0; /* undo if error */ | 336 | set_exclude(sdp, 0); /* undo if error */ |
312 | up_write(&sdp->o_sem); | 337 | wake_up_interruptible(&sdp->o_excl_wait); |
313 | } else | 338 | } |
314 | up_read(&sdp->o_sem); | 339 | retval = -ENOMEM; |
340 | goto error_out; | ||
341 | } | ||
342 | retval = 0; | ||
315 | error_out: | 343 | error_out: |
344 | if (retval) { | ||
316 | scsi_autopm_put_device(sdp->device); | 345 | scsi_autopm_put_device(sdp->device); |
317 | sdp_put: | 346 | sdp_put: |
318 | scsi_device_put(sdp->device); | 347 | scsi_device_put(sdp->device); |
@@ -329,18 +358,13 @@ sg_release(struct inode *inode, struct file *filp) | |||
329 | { | 358 | { |
330 | Sg_device *sdp; | 359 | Sg_device *sdp; |
331 | Sg_fd *sfp; | 360 | Sg_fd *sfp; |
332 | int excl; | ||
333 | 361 | ||
334 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 362 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
335 | return -ENXIO; | 363 | return -ENXIO; |
336 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); | 364 | SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name)); |
337 | 365 | ||
338 | excl = sdp->exclude; | 366 | set_exclude(sdp, 0); |
339 | sdp->exclude = 0; | 367 | wake_up_interruptible(&sdp->o_excl_wait); |
340 | if (excl) | ||
341 | up_write(&sdp->o_sem); | ||
342 | else | ||
343 | up_read(&sdp->o_sem); | ||
344 | 368 | ||
345 | scsi_autopm_put_device(sdp->device); | 369 | scsi_autopm_put_device(sdp->device); |
346 | kref_put(&sfp->f_ref, sg_remove_sfp); | 370 | kref_put(&sfp->f_ref, sg_remove_sfp); |
@@ -1391,9 +1415,8 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1391 | disk->first_minor = k; | 1415 | disk->first_minor = k; |
1392 | sdp->disk = disk; | 1416 | sdp->disk = disk; |
1393 | sdp->device = scsidp; | 1417 | sdp->device = scsidp; |
1394 | spin_lock_init(&sdp->sfd_lock); | ||
1395 | INIT_LIST_HEAD(&sdp->sfds); | 1418 | INIT_LIST_HEAD(&sdp->sfds); |
1396 | init_rwsem(&sdp->o_sem); | 1419 | init_waitqueue_head(&sdp->o_excl_wait); |
1397 | sdp->sg_tablesize = queue_max_segments(q); | 1420 | sdp->sg_tablesize = queue_max_segments(q); |
1398 | sdp->index = k; | 1421 | sdp->index = k; |
1399 | kref_init(&sdp->d_ref); | 1422 | kref_init(&sdp->d_ref); |
@@ -1526,13 +1549,11 @@ static void sg_remove(struct device *cl_dev, struct class_interface *cl_intf) | |||
1526 | 1549 | ||
1527 | /* Need a write lock to set sdp->detached. */ | 1550 | /* Need a write lock to set sdp->detached. */ |
1528 | write_lock_irqsave(&sg_index_lock, iflags); | 1551 | write_lock_irqsave(&sg_index_lock, iflags); |
1529 | spin_lock(&sdp->sfd_lock); | ||
1530 | sdp->detached = 1; | 1552 | sdp->detached = 1; |
1531 | list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) { | 1553 | list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) { |
1532 | wake_up_interruptible(&sfp->read_wait); | 1554 | wake_up_interruptible(&sfp->read_wait); |
1533 | kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP); | 1555 | kill_fasync(&sfp->async_qp, SIGPOLL, POLL_HUP); |
1534 | } | 1556 | } |
1535 | spin_unlock(&sdp->sfd_lock); | ||
1536 | write_unlock_irqrestore(&sg_index_lock, iflags); | 1557 | write_unlock_irqrestore(&sg_index_lock, iflags); |
1537 | 1558 | ||
1538 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); | 1559 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); |
@@ -2043,7 +2064,7 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2043 | 2064 | ||
2044 | sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); | 2065 | sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN); |
2045 | if (!sfp) | 2066 | if (!sfp) |
2046 | return ERR_PTR(-ENOMEM); | 2067 | return NULL; |
2047 | 2068 | ||
2048 | init_waitqueue_head(&sfp->read_wait); | 2069 | init_waitqueue_head(&sfp->read_wait); |
2049 | rwlock_init(&sfp->rq_list_lock); | 2070 | rwlock_init(&sfp->rq_list_lock); |
@@ -2057,13 +2078,9 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2057 | sfp->cmd_q = SG_DEF_COMMAND_Q; | 2078 | sfp->cmd_q = SG_DEF_COMMAND_Q; |
2058 | sfp->keep_orphan = SG_DEF_KEEP_ORPHAN; | 2079 | sfp->keep_orphan = SG_DEF_KEEP_ORPHAN; |
2059 | sfp->parentdp = sdp; | 2080 | sfp->parentdp = sdp; |
2060 | spin_lock_irqsave(&sdp->sfd_lock, iflags); | 2081 | write_lock_irqsave(&sg_index_lock, iflags); |
2061 | if (sdp->detached) { | ||
2062 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | ||
2063 | return ERR_PTR(-ENODEV); | ||
2064 | } | ||
2065 | list_add_tail(&sfp->sfd_siblings, &sdp->sfds); | 2082 | list_add_tail(&sfp->sfd_siblings, &sdp->sfds); |
2066 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | 2083 | write_unlock_irqrestore(&sg_index_lock, iflags); |
2067 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp)); | 2084 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp)); |
2068 | if (unlikely(sg_big_buff != def_reserved_size)) | 2085 | if (unlikely(sg_big_buff != def_reserved_size)) |
2069 | sg_big_buff = def_reserved_size; | 2086 | sg_big_buff = def_reserved_size; |
@@ -2113,9 +2130,10 @@ static void sg_remove_sfp(struct kref *kref) | |||
2113 | struct sg_device *sdp = sfp->parentdp; | 2130 | struct sg_device *sdp = sfp->parentdp; |
2114 | unsigned long iflags; | 2131 | unsigned long iflags; |
2115 | 2132 | ||
2116 | spin_lock_irqsave(&sdp->sfd_lock, iflags); | 2133 | write_lock_irqsave(&sg_index_lock, iflags); |
2117 | list_del(&sfp->sfd_siblings); | 2134 | list_del(&sfp->sfd_siblings); |
2118 | spin_unlock_irqrestore(&sdp->sfd_lock, iflags); | 2135 | write_unlock_irqrestore(&sg_index_lock, iflags); |
2136 | wake_up_interruptible(&sdp->o_excl_wait); | ||
2119 | 2137 | ||
2120 | INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext); | 2138 | INIT_WORK(&sfp->ew.work, sg_remove_sfp_usercontext); |
2121 | schedule_work(&sfp->ew.work); | 2139 | schedule_work(&sfp->ew.work); |
@@ -2502,7 +2520,7 @@ static int sg_proc_seq_show_devstrs(struct seq_file *s, void *v) | |||
2502 | return 0; | 2520 | return 0; |
2503 | } | 2521 | } |
2504 | 2522 | ||
2505 | /* must be called while holding sg_index_lock and sfd_lock */ | 2523 | /* must be called while holding sg_index_lock */ |
2506 | static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) | 2524 | static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) |
2507 | { | 2525 | { |
2508 | int k, m, new_interface, blen, usg; | 2526 | int k, m, new_interface, blen, usg; |
@@ -2587,26 +2605,22 @@ static int sg_proc_seq_show_debug(struct seq_file *s, void *v) | |||
2587 | 2605 | ||
2588 | read_lock_irqsave(&sg_index_lock, iflags); | 2606 | read_lock_irqsave(&sg_index_lock, iflags); |
2589 | sdp = it ? sg_lookup_dev(it->index) : NULL; | 2607 | sdp = it ? sg_lookup_dev(it->index) : NULL; |
2590 | if (sdp) { | 2608 | if (sdp && !list_empty(&sdp->sfds)) { |
2591 | spin_lock(&sdp->sfd_lock); | 2609 | struct scsi_device *scsidp = sdp->device; |
2592 | if (!list_empty(&sdp->sfds)) { | ||
2593 | struct scsi_device *scsidp = sdp->device; | ||
2594 | 2610 | ||
2595 | seq_printf(s, " >>> device=%s ", sdp->disk->disk_name); | 2611 | seq_printf(s, " >>> device=%s ", sdp->disk->disk_name); |
2596 | if (sdp->detached) | 2612 | if (sdp->detached) |
2597 | seq_printf(s, "detached pending close "); | 2613 | seq_printf(s, "detached pending close "); |
2598 | else | 2614 | else |
2599 | seq_printf | 2615 | seq_printf |
2600 | (s, "scsi%d chan=%d id=%d lun=%d em=%d", | 2616 | (s, "scsi%d chan=%d id=%d lun=%d em=%d", |
2601 | scsidp->host->host_no, | 2617 | scsidp->host->host_no, |
2602 | scsidp->channel, scsidp->id, | 2618 | scsidp->channel, scsidp->id, |
2603 | scsidp->lun, | 2619 | scsidp->lun, |
2604 | scsidp->host->hostt->emulated); | 2620 | scsidp->host->hostt->emulated); |
2605 | seq_printf(s, " sg_tablesize=%d excl=%d\n", | 2621 | seq_printf(s, " sg_tablesize=%d excl=%d\n", |
2606 | sdp->sg_tablesize, sdp->exclude); | 2622 | sdp->sg_tablesize, get_exclude(sdp)); |
2607 | sg_proc_debug_helper(s, sdp); | 2623 | sg_proc_debug_helper(s, sdp); |
2608 | } | ||
2609 | spin_unlock(&sdp->sfd_lock); | ||
2610 | } | 2624 | } |
2611 | read_unlock_irqrestore(&sg_index_lock, iflags); | 2625 | read_unlock_irqrestore(&sg_index_lock, iflags); |
2612 | return 0; | 2626 | return 0; |
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index f91bc1fdd895..639ba96adb36 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c | |||
@@ -1960,6 +1960,7 @@ cntrlEnd: | |||
1960 | 1960 | ||
1961 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); | 1961 | BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Called IOCTL_BCM_GET_DEVICE_DRIVER_INFO\n"); |
1962 | 1962 | ||
1963 | memset(&DevInfo, 0, sizeof(DevInfo)); | ||
1963 | DevInfo.MaxRDMBufferSize = BUFFER_4K; | 1964 | DevInfo.MaxRDMBufferSize = BUFFER_4K; |
1964 | DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; | 1965 | DevInfo.u32DSDStartOffset = EEPROM_CALPARAM_START; |
1965 | DevInfo.u32RxAlignmentCorrection = 0; | 1966 | DevInfo.u32RxAlignmentCorrection = 0; |
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 6ccb64fb0786..6ce0af9977d8 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c | |||
@@ -155,6 +155,9 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf, | |||
155 | struct oz_app_hdr *app_hdr; | 155 | struct oz_app_hdr *app_hdr; |
156 | struct oz_serial_ctx *ctx; | 156 | struct oz_serial_ctx *ctx; |
157 | 157 | ||
158 | if (count > sizeof(ei->data) - sizeof(*elt) - sizeof(*app_hdr)) | ||
159 | return -EINVAL; | ||
160 | |||
158 | spin_lock_bh(&g_cdev.lock); | 161 | spin_lock_bh(&g_cdev.lock); |
159 | pd = g_cdev.active_pd; | 162 | pd = g_cdev.active_pd; |
160 | if (pd) | 163 | if (pd) |
diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c index 23db32f07fd5..a10cdb17038b 100644 --- a/drivers/staging/sb105x/sb_pci_mp.c +++ b/drivers/staging/sb105x/sb_pci_mp.c | |||
@@ -1063,7 +1063,7 @@ static int mp_wait_modem_status(struct sb_uart_state *state, unsigned long arg) | |||
1063 | 1063 | ||
1064 | static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) | 1064 | static int mp_get_count(struct sb_uart_state *state, struct serial_icounter_struct *icnt) |
1065 | { | 1065 | { |
1066 | struct serial_icounter_struct icount; | 1066 | struct serial_icounter_struct icount = {}; |
1067 | struct sb_uart_icount cnow; | 1067 | struct sb_uart_icount cnow; |
1068 | struct sb_uart_port *port = state->port; | 1068 | struct sb_uart_port *port = state->port; |
1069 | 1069 | ||
diff --git a/drivers/staging/wlags49_h2/wl_priv.c b/drivers/staging/wlags49_h2/wl_priv.c index c97e0e154d28..7e10dcdc3090 100644 --- a/drivers/staging/wlags49_h2/wl_priv.c +++ b/drivers/staging/wlags49_h2/wl_priv.c | |||
@@ -570,6 +570,7 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) | |||
570 | ltv_t *pLtv; | 570 | ltv_t *pLtv; |
571 | bool_t ltvAllocated = FALSE; | 571 | bool_t ltvAllocated = FALSE; |
572 | ENCSTRCT sEncryption; | 572 | ENCSTRCT sEncryption; |
573 | size_t len; | ||
573 | 574 | ||
574 | #ifdef USE_WDS | 575 | #ifdef USE_WDS |
575 | hcf_16 hcfPort = HCF_PORT_0; | 576 | hcf_16 hcfPort = HCF_PORT_0; |
@@ -686,7 +687,8 @@ int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) | |||
686 | break; | 687 | break; |
687 | case CFG_CNF_OWN_NAME: | 688 | case CFG_CNF_OWN_NAME: |
688 | memset(lp->StationName, 0, sizeof(lp->StationName)); | 689 | memset(lp->StationName, 0, sizeof(lp->StationName)); |
689 | memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]); | 690 | len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName)); |
691 | strlcpy(lp->StationName, &pLtv->u.u8[2], len); | ||
690 | pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); | 692 | pLtv->u.u16[0] = CNV_INT_TO_LITTLE(pLtv->u.u16[0]); |
691 | break; | 693 | break; |
692 | case CFG_CNF_LOAD_BALANCING: | 694 | case CFG_CNF_LOAD_BALANCING: |
@@ -1783,6 +1785,7 @@ int wvlan_set_station_nickname(struct net_device *dev, | |||
1783 | { | 1785 | { |
1784 | struct wl_private *lp = wl_priv(dev); | 1786 | struct wl_private *lp = wl_priv(dev); |
1785 | unsigned long flags; | 1787 | unsigned long flags; |
1788 | size_t len; | ||
1786 | int ret = 0; | 1789 | int ret = 0; |
1787 | /*------------------------------------------------------------------------*/ | 1790 | /*------------------------------------------------------------------------*/ |
1788 | 1791 | ||
@@ -1793,8 +1796,8 @@ int wvlan_set_station_nickname(struct net_device *dev, | |||
1793 | wl_lock(lp, &flags); | 1796 | wl_lock(lp, &flags); |
1794 | 1797 | ||
1795 | memset(lp->StationName, 0, sizeof(lp->StationName)); | 1798 | memset(lp->StationName, 0, sizeof(lp->StationName)); |
1796 | 1799 | len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName)); | |
1797 | memcpy(lp->StationName, extra, wrqu->data.length); | 1800 | strlcpy(lp->StationName, extra, len); |
1798 | 1801 | ||
1799 | /* Commit the adapter parameters */ | 1802 | /* Commit the adapter parameters */ |
1800 | wl_apply(lp); | 1803 | wl_apply(lp); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index d067285a2d20..6b0f75eac8a2 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -1499,7 +1499,7 @@ static void atmel_set_ops(struct uart_port *port) | |||
1499 | /* | 1499 | /* |
1500 | * Get ip name usart or uart | 1500 | * Get ip name usart or uart |
1501 | */ | 1501 | */ |
1502 | static int atmel_get_ip_name(struct uart_port *port) | 1502 | static void atmel_get_ip_name(struct uart_port *port) |
1503 | { | 1503 | { |
1504 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1504 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
1505 | int name = UART_GET_IP_NAME(port); | 1505 | int name = UART_GET_IP_NAME(port); |
@@ -1518,10 +1518,7 @@ static int atmel_get_ip_name(struct uart_port *port) | |||
1518 | atmel_port->is_usart = false; | 1518 | atmel_port->is_usart = false; |
1519 | } else { | 1519 | } else { |
1520 | dev_err(port->dev, "Not supported ip name, set to uart\n"); | 1520 | dev_err(port->dev, "Not supported ip name, set to uart\n"); |
1521 | return -EINVAL; | ||
1522 | } | 1521 | } |
1523 | |||
1524 | return 0; | ||
1525 | } | 1522 | } |
1526 | 1523 | ||
1527 | /* | 1524 | /* |
@@ -2405,9 +2402,7 @@ static int atmel_serial_probe(struct platform_device *pdev) | |||
2405 | /* | 2402 | /* |
2406 | * Get port name of usart or uart | 2403 | * Get port name of usart or uart |
2407 | */ | 2404 | */ |
2408 | ret = atmel_get_ip_name(&port->uart); | 2405 | atmel_get_ip_name(&port->uart); |
2409 | if (ret < 0) | ||
2410 | goto err_add_port; | ||
2411 | 2406 | ||
2412 | return 0; | 2407 | return 0; |
2413 | 2408 | ||
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index ba475632c5fa..0e808cf91d97 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -642,16 +642,29 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
642 | { | 642 | { |
643 | struct uio_device *idev = vma->vm_private_data; | 643 | struct uio_device *idev = vma->vm_private_data; |
644 | int mi = uio_find_mem_index(vma); | 644 | int mi = uio_find_mem_index(vma); |
645 | struct uio_mem *mem; | ||
645 | if (mi < 0) | 646 | if (mi < 0) |
646 | return -EINVAL; | 647 | return -EINVAL; |
648 | mem = idev->info->mem + mi; | ||
647 | 649 | ||
648 | vma->vm_ops = &uio_physical_vm_ops; | 650 | if (vma->vm_end - vma->vm_start > mem->size) |
651 | return -EINVAL; | ||
649 | 652 | ||
653 | vma->vm_ops = &uio_physical_vm_ops; | ||
650 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 654 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
651 | 655 | ||
656 | /* | ||
657 | * We cannot use the vm_iomap_memory() helper here, | ||
658 | * because vma->vm_pgoff is the map index we looked | ||
659 | * up above in uio_find_mem_index(), rather than an | ||
660 | * actual page offset into the mmap. | ||
661 | * | ||
662 | * So we just do the physical mmap without a page | ||
663 | * offset. | ||
664 | */ | ||
652 | return remap_pfn_range(vma, | 665 | return remap_pfn_range(vma, |
653 | vma->vm_start, | 666 | vma->vm_start, |
654 | idev->info->mem[mi].addr >> PAGE_SHIFT, | 667 | mem->addr >> PAGE_SHIFT, |
655 | vma->vm_end - vma->vm_start, | 668 | vma->vm_end - vma->vm_start, |
656 | vma->vm_page_prot); | 669 | vma->vm_page_prot); |
657 | } | 670 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c45f9c0a1b34..b21d553c245b 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -904,6 +904,7 @@ static struct usb_device_id id_table_combined [] = { | |||
904 | { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, | 904 | { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, |
905 | /* Crucible Devices */ | 905 | /* Crucible Devices */ |
906 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, | 906 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, |
907 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, | ||
907 | { } /* Terminating entry */ | 908 | { } /* Terminating entry */ |
908 | }; | 909 | }; |
909 | 910 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1b8af461b522..a7019d1e3058 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1307,3 +1307,9 @@ | |||
1307 | * Manufacturer: Crucible Technologies | 1307 | * Manufacturer: Crucible Technologies |
1308 | */ | 1308 | */ |
1309 | #define FTDI_CT_COMET_PID 0x8e08 | 1309 | #define FTDI_CT_COMET_PID 0x8e08 |
1310 | |||
1311 | /* | ||
1312 | * Product: Z3X Box | ||
1313 | * Manufacturer: Smart GSM Team | ||
1314 | */ | ||
1315 | #define FTDI_Z3X_PID 0x0011 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index bedf8e47713b..1e6de4cd079d 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -4,11 +4,6 @@ | |||
4 | * Copyright (C) 2001-2007 Greg Kroah-Hartman (greg@kroah.com) | 4 | * Copyright (C) 2001-2007 Greg Kroah-Hartman (greg@kroah.com) |
5 | * Copyright (C) 2003 IBM Corp. | 5 | * Copyright (C) 2003 IBM Corp. |
6 | * | 6 | * |
7 | * Copyright (C) 2009, 2013 Frank Schäfer <fschaefer.oss@googlemail.com> | ||
8 | * - fixes, improvements and documentation for the baud rate encoding methods | ||
9 | * Copyright (C) 2013 Reinhard Max <max@suse.de> | ||
10 | * - fixes and improvements for the divisor based baud rate encoding method | ||
11 | * | ||
12 | * Original driver for 2.2.x by anonymous | 7 | * Original driver for 2.2.x by anonymous |
13 | * | 8 | * |
14 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
@@ -134,18 +129,10 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
134 | 129 | ||
135 | 130 | ||
136 | enum pl2303_type { | 131 | enum pl2303_type { |
137 | type_0, /* H version ? */ | 132 | type_0, /* don't know the difference between type 0 and */ |
138 | type_1, /* H version ? */ | 133 | type_1, /* type 1, until someone from prolific tells us... */ |
139 | HX_TA, /* HX(A) / X(A) / TA version */ /* TODO: improve */ | 134 | HX, /* HX version of the pl2303 chip */ |
140 | HXD_EA_RA_SA, /* HXD / EA / RA / SA version */ /* TODO: improve */ | ||
141 | TB, /* TB version */ | ||
142 | HX_CLONE, /* Cheap and less functional clone of the HX chip */ | ||
143 | }; | 135 | }; |
144 | /* | ||
145 | * NOTE: don't know the difference between type 0 and type 1, | ||
146 | * until someone from Prolific tells us... | ||
147 | * TODO: distinguish between X/HX, TA and HXD, EA, RA, SA variants | ||
148 | */ | ||
149 | 136 | ||
150 | struct pl2303_serial_private { | 137 | struct pl2303_serial_private { |
151 | enum pl2303_type type; | 138 | enum pl2303_type type; |
@@ -185,7 +172,6 @@ static int pl2303_startup(struct usb_serial *serial) | |||
185 | { | 172 | { |
186 | struct pl2303_serial_private *spriv; | 173 | struct pl2303_serial_private *spriv; |
187 | enum pl2303_type type = type_0; | 174 | enum pl2303_type type = type_0; |
188 | char *type_str = "unknown (treating as type_0)"; | ||
189 | unsigned char *buf; | 175 | unsigned char *buf; |
190 | 176 | ||
191 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); | 177 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); |
@@ -198,53 +184,15 @@ static int pl2303_startup(struct usb_serial *serial) | |||
198 | return -ENOMEM; | 184 | return -ENOMEM; |
199 | } | 185 | } |
200 | 186 | ||
201 | if (serial->dev->descriptor.bDeviceClass == 0x02) { | 187 | if (serial->dev->descriptor.bDeviceClass == 0x02) |
202 | type = type_0; | 188 | type = type_0; |
203 | type_str = "type_0"; | 189 | else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40) |
204 | } else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40) { | 190 | type = HX; |
205 | /* | 191 | else if (serial->dev->descriptor.bDeviceClass == 0x00) |
206 | * NOTE: The bcdDevice version is the only difference between | ||
207 | * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB | ||
208 | */ | ||
209 | if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) { | ||
210 | /* Check if the device is a clone */ | ||
211 | pl2303_vendor_read(0x9494, 0, serial, buf); | ||
212 | /* | ||
213 | * NOTE: Not sure if this read is really needed. | ||
214 | * The HX returns 0x00, the clone 0x02, but the Windows | ||
215 | * driver seems to ignore the value and continues. | ||
216 | */ | ||
217 | pl2303_vendor_write(0x0606, 0xaa, serial); | ||
218 | pl2303_vendor_read(0x8686, 0, serial, buf); | ||
219 | if (buf[0] != 0xaa) { | ||
220 | type = HX_CLONE; | ||
221 | type_str = "X/HX clone (limited functionality)"; | ||
222 | } else { | ||
223 | type = HX_TA; | ||
224 | type_str = "X/HX/TA"; | ||
225 | } | ||
226 | pl2303_vendor_write(0x0606, 0x00, serial); | ||
227 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) | ||
228 | == 0x400) { | ||
229 | type = HXD_EA_RA_SA; | ||
230 | type_str = "HXD/EA/RA/SA"; | ||
231 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) | ||
232 | == 0x500) { | ||
233 | type = TB; | ||
234 | type_str = "TB"; | ||
235 | } else { | ||
236 | dev_info(&serial->interface->dev, | ||
237 | "unknown/unsupported device type\n"); | ||
238 | kfree(spriv); | ||
239 | kfree(buf); | ||
240 | return -ENODEV; | ||
241 | } | ||
242 | } else if (serial->dev->descriptor.bDeviceClass == 0x00 | ||
243 | || serial->dev->descriptor.bDeviceClass == 0xFF) { | ||
244 | type = type_1; | 192 | type = type_1; |
245 | type_str = "type_1"; | 193 | else if (serial->dev->descriptor.bDeviceClass == 0xFF) |
246 | } | 194 | type = type_1; |
247 | dev_dbg(&serial->interface->dev, "device type: %s\n", type_str); | 195 | dev_dbg(&serial->interface->dev, "device type: %d\n", type); |
248 | 196 | ||
249 | spriv->type = type; | 197 | spriv->type = type; |
250 | usb_set_serial_data(serial, spriv); | 198 | usb_set_serial_data(serial, spriv); |
@@ -259,10 +207,10 @@ static int pl2303_startup(struct usb_serial *serial) | |||
259 | pl2303_vendor_read(0x8383, 0, serial, buf); | 207 | pl2303_vendor_read(0x8383, 0, serial, buf); |
260 | pl2303_vendor_write(0, 1, serial); | 208 | pl2303_vendor_write(0, 1, serial); |
261 | pl2303_vendor_write(1, 0, serial); | 209 | pl2303_vendor_write(1, 0, serial); |
262 | if (type == type_0 || type == type_1) | 210 | if (type == HX) |
263 | pl2303_vendor_write(2, 0x24, serial); | ||
264 | else | ||
265 | pl2303_vendor_write(2, 0x44, serial); | 211 | pl2303_vendor_write(2, 0x44, serial); |
212 | else | ||
213 | pl2303_vendor_write(2, 0x24, serial); | ||
266 | 214 | ||
267 | kfree(buf); | 215 | kfree(buf); |
268 | return 0; | 216 | return 0; |
@@ -316,174 +264,65 @@ static int pl2303_set_control_lines(struct usb_serial_port *port, u8 value) | |||
316 | return retval; | 264 | return retval; |
317 | } | 265 | } |
318 | 266 | ||
319 | static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | 267 | static void pl2303_encode_baudrate(struct tty_struct *tty, |
320 | u8 buf[4]) | 268 | struct usb_serial_port *port, |
269 | u8 buf[4]) | ||
321 | { | 270 | { |
322 | /* | ||
323 | * NOTE: Only the values defined in baud_sup are supported ! | ||
324 | * => if unsupported values are set, the PL2303 uses 9600 baud instead | ||
325 | * => HX clones just don't work at unsupported baud rates < 115200 baud, | ||
326 | * for baud rates > 115200 they run at 115200 baud | ||
327 | */ | ||
328 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, | 271 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, |
329 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, | 272 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, |
330 | 57600, 115200, 230400, 460800, 614400, 921600, | 273 | 57600, 115200, 230400, 460800, 500000, 614400, |
331 | 1228800, 2457600, 3000000, 6000000, 12000000 }; | 274 | 921600, 1228800, 2457600, 3000000, 6000000 }; |
275 | |||
276 | struct usb_serial *serial = port->serial; | ||
277 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | ||
278 | int baud; | ||
279 | int i; | ||
280 | |||
332 | /* | 281 | /* |
333 | * NOTE: With the exception of type_0/1 devices, the following | 282 | * NOTE: Only the values defined in baud_sup are supported! |
334 | * additional baud rates are supported (tested with HX rev. 3A only): | 283 | * => if unsupported values are set, the PL2303 seems to use |
335 | * 110*, 56000*, 128000, 134400, 161280, 201600, 256000*, 268800, | 284 | * 9600 baud (at least my PL2303X always does) |
336 | * 403200, 806400. (*: not HX and HX clones) | ||
337 | * | ||
338 | * Maximum values: HXD, TB: 12000000; HX, TA: 6000000; | ||
339 | * type_0+1: 1228800; RA: 921600; HX clones, SA: 115200 | ||
340 | * | ||
341 | * As long as we are not using this encoding method for anything else | ||
342 | * than the type_0+1, HX and HX clone chips, there is no point in | ||
343 | * complicating the code to support them. | ||
344 | */ | 285 | */ |
345 | int i; | 286 | baud = tty_get_baud_rate(tty); |
287 | dev_dbg(&port->dev, "baud requested = %d\n", baud); | ||
288 | if (!baud) | ||
289 | return; | ||
346 | 290 | ||
347 | /* Set baudrate to nearest supported value */ | 291 | /* Set baudrate to nearest supported value */ |
348 | for (i = 0; i < ARRAY_SIZE(baud_sup); ++i) { | 292 | for (i = 0; i < ARRAY_SIZE(baud_sup); ++i) { |
349 | if (baud_sup[i] > baud) | 293 | if (baud_sup[i] > baud) |
350 | break; | 294 | break; |
351 | } | 295 | } |
296 | |||
352 | if (i == ARRAY_SIZE(baud_sup)) | 297 | if (i == ARRAY_SIZE(baud_sup)) |
353 | baud = baud_sup[i - 1]; | 298 | baud = baud_sup[i - 1]; |
354 | else if (i > 0 && (baud_sup[i] - baud) > (baud - baud_sup[i - 1])) | 299 | else if (i > 0 && (baud_sup[i] - baud) > (baud - baud_sup[i - 1])) |
355 | baud = baud_sup[i - 1]; | 300 | baud = baud_sup[i - 1]; |
356 | else | 301 | else |
357 | baud = baud_sup[i]; | 302 | baud = baud_sup[i]; |
358 | /* Respect the chip type specific baud rate limits */ | ||
359 | /* | ||
360 | * FIXME: as long as we don't know how to distinguish between the | ||
361 | * HXD, EA, RA, and SA chip variants, allow the max. value of 12M. | ||
362 | */ | ||
363 | if (type == HX_TA) | ||
364 | baud = min_t(int, baud, 6000000); | ||
365 | else if (type == type_0 || type == type_1) | ||
366 | baud = min_t(int, baud, 1228800); | ||
367 | else if (type == HX_CLONE) | ||
368 | baud = min_t(int, baud, 115200); | ||
369 | /* Direct (standard) baud rate encoding method */ | ||
370 | put_unaligned_le32(baud, buf); | ||
371 | |||
372 | return baud; | ||
373 | } | ||
374 | 303 | ||
375 | static int pl2303_baudrate_encode_divisor(int baud, enum pl2303_type type, | 304 | /* type_0, type_1 only support up to 1228800 baud */ |
376 | u8 buf[4]) | 305 | if (spriv->type != HX) |
377 | { | 306 | baud = min_t(int, baud, 1228800); |
378 | /* | ||
379 | * Divisor based baud rate encoding method | ||
380 | * | ||
381 | * NOTE: HX clones do NOT support this method. | ||
382 | * It's not clear if the type_0/1 chips support it. | ||
383 | * | ||
384 | * divisor = 12MHz * 32 / baudrate = 2^A * B | ||
385 | * | ||
386 | * with | ||
387 | * | ||
388 | * A = buf[1] & 0x0e | ||
389 | * B = buf[0] + (buf[1] & 0x01) << 8 | ||
390 | * | ||
391 | * Special cases: | ||
392 | * => 8 < B < 16: device seems to work not properly | ||
393 | * => B <= 8: device uses the max. value B = 512 instead | ||
394 | */ | ||
395 | unsigned int A, B; | ||
396 | 307 | ||
397 | /* | 308 | if (baud <= 115200) { |
398 | * NOTE: The Windows driver allows maximum baud rates of 110% of the | 309 | put_unaligned_le32(baud, buf); |
399 | * specified maximium value. | ||
400 | * Quick tests with early (2004) HX (rev. A) chips suggest, that even | ||
401 | * higher baud rates (up to the maximum of 24M baud !) are working fine, | ||
402 | * but that should really be tested carefully in "real life" scenarios | ||
403 | * before removing the upper limit completely. | ||
404 | * Baud rates smaller than the specified 75 baud are definitely working | ||
405 | * fine. | ||
406 | */ | ||
407 | if (type == type_0 || type == type_1) | ||
408 | baud = min_t(int, baud, 1228800 * 1.1); | ||
409 | else if (type == HX_TA) | ||
410 | baud = min_t(int, baud, 6000000 * 1.1); | ||
411 | else if (type == HXD_EA_RA_SA) | ||
412 | /* HXD, EA: 12Mbps; RA: 1Mbps; SA: 115200 bps */ | ||
413 | /* | ||
414 | * FIXME: as long as we don't know how to distinguish between | ||
415 | * these chip variants, allow the max. of these values | ||
416 | */ | ||
417 | baud = min_t(int, baud, 12000000 * 1.1); | ||
418 | else if (type == TB) | ||
419 | baud = min_t(int, baud, 12000000 * 1.1); | ||
420 | /* Determine factors A and B */ | ||
421 | A = 0; | ||
422 | B = 12000000 * 32 / baud; /* 12MHz */ | ||
423 | B <<= 1; /* Add one bit for rounding */ | ||
424 | while (B > (512 << 1) && A <= 14) { | ||
425 | A += 2; | ||
426 | B >>= 2; | ||
427 | } | ||
428 | if (A > 14) { /* max. divisor = min. baudrate reached */ | ||
429 | A = 14; | ||
430 | B = 512; | ||
431 | /* => ~45.78 baud */ | ||
432 | } else { | 310 | } else { |
433 | B = (B + 1) >> 1; /* Round the last bit */ | ||
434 | } | ||
435 | /* Handle special cases */ | ||
436 | if (B == 512) | ||
437 | B = 0; /* also: 1 to 8 */ | ||
438 | else if (B < 16) | ||
439 | /* | 311 | /* |
440 | * NOTE: With the current algorithm this happens | 312 | * Apparently the formula for higher speeds is: |
441 | * only for A=0 and means that the min. divisor | 313 | * baudrate = 12M * 32 / (2^buf[1]) / buf[0] |
442 | * (respectively: the max. baudrate) is reached. | ||
443 | */ | 314 | */ |
444 | B = 16; /* => 24 MBaud */ | 315 | unsigned tmp = 12000000 * 32 / baud; |
445 | /* Encode the baud rate */ | 316 | buf[3] = 0x80; |
446 | buf[3] = 0x80; /* Select divisor encoding method */ | 317 | buf[2] = 0; |
447 | buf[2] = 0; | 318 | buf[1] = (tmp >= 256); |
448 | buf[1] = (A & 0x0e); /* A */ | 319 | while (tmp >= 256) { |
449 | buf[1] |= ((B & 0x100) >> 8); /* MSB of B */ | 320 | tmp >>= 2; |
450 | buf[0] = B & 0xff; /* 8 LSBs of B */ | 321 | buf[1] <<= 1; |
451 | /* Calculate the actual/resulting baud rate */ | 322 | } |
452 | if (B <= 8) | 323 | buf[0] = tmp; |
453 | B = 512; | 324 | } |
454 | baud = 12000000 * 32 / ((1 << A) * B); | ||
455 | |||
456 | return baud; | ||
457 | } | ||
458 | |||
459 | static void pl2303_encode_baudrate(struct tty_struct *tty, | ||
460 | struct usb_serial_port *port, | ||
461 | enum pl2303_type type, | ||
462 | u8 buf[4]) | ||
463 | { | ||
464 | int baud; | ||
465 | 325 | ||
466 | baud = tty_get_baud_rate(tty); | ||
467 | dev_dbg(&port->dev, "baud requested = %d\n", baud); | ||
468 | if (!baud) | ||
469 | return; | ||
470 | /* | ||
471 | * There are two methods for setting/encoding the baud rate | ||
472 | * 1) Direct method: encodes the baud rate value directly | ||
473 | * => supported by all chip types | ||
474 | * 2) Divisor based method: encodes a divisor to a base value (12MHz*32) | ||
475 | * => not supported by HX clones (and likely type_0/1 chips) | ||
476 | * | ||
477 | * NOTE: Although the divisor based baud rate encoding method is much | ||
478 | * more flexible, some of the standard baud rate values can not be | ||
479 | * realized exactly. But the difference is very small (max. 0.2%) and | ||
480 | * the device likely uses the same baud rate generator for both methods | ||
481 | * so that there is likley no difference. | ||
482 | */ | ||
483 | if (type == type_0 || type == type_1 || type == HX_CLONE) | ||
484 | baud = pl2303_baudrate_encode_direct(baud, type, buf); | ||
485 | else | ||
486 | baud = pl2303_baudrate_encode_divisor(baud, type, buf); | ||
487 | /* Save resulting baud rate */ | 326 | /* Save resulting baud rate */ |
488 | tty_encode_baud_rate(tty, baud, baud); | 327 | tty_encode_baud_rate(tty, baud, baud); |
489 | dev_dbg(&port->dev, "baud set = %d\n", baud); | 328 | dev_dbg(&port->dev, "baud set = %d\n", baud); |
@@ -540,8 +379,8 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
540 | dev_dbg(&port->dev, "data bits = %d\n", buf[6]); | 379 | dev_dbg(&port->dev, "data bits = %d\n", buf[6]); |
541 | } | 380 | } |
542 | 381 | ||
543 | /* For reference: buf[0]:buf[3] baud rate value */ | 382 | /* For reference buf[0]:buf[3] baud rate value */ |
544 | pl2303_encode_baudrate(tty, port, spriv->type, buf); | 383 | pl2303_encode_baudrate(tty, port, &buf[0]); |
545 | 384 | ||
546 | /* For reference buf[4]=0 is 1 stop bits */ | 385 | /* For reference buf[4]=0 is 1 stop bits */ |
547 | /* For reference buf[4]=1 is 1.5 stop bits */ | 386 | /* For reference buf[4]=1 is 1.5 stop bits */ |
@@ -618,10 +457,10 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
618 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); | 457 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); |
619 | 458 | ||
620 | if (C_CRTSCTS(tty)) { | 459 | if (C_CRTSCTS(tty)) { |
621 | if (spriv->type == type_0 || spriv->type == type_1) | 460 | if (spriv->type == HX) |
622 | pl2303_vendor_write(0x0, 0x41, serial); | ||
623 | else | ||
624 | pl2303_vendor_write(0x0, 0x61, serial); | 461 | pl2303_vendor_write(0x0, 0x61, serial); |
462 | else | ||
463 | pl2303_vendor_write(0x0, 0x41, serial); | ||
625 | } else { | 464 | } else { |
626 | pl2303_vendor_write(0x0, 0x0, serial); | 465 | pl2303_vendor_write(0x0, 0x0, serial); |
627 | } | 466 | } |
@@ -658,7 +497,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
658 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | 497 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); |
659 | int result; | 498 | int result; |
660 | 499 | ||
661 | if (spriv->type == type_0 || spriv->type == type_1) { | 500 | if (spriv->type != HX) { |
662 | usb_clear_halt(serial->dev, port->write_urb->pipe); | 501 | usb_clear_halt(serial->dev, port->write_urb->pipe); |
663 | usb_clear_halt(serial->dev, port->read_urb->pipe); | 502 | usb_clear_halt(serial->dev, port->read_urb->pipe); |
664 | } else { | 503 | } else { |
@@ -833,7 +672,6 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | |||
833 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 672 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
834 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, | 673 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, |
835 | 0, NULL, 0, 100); | 674 | 0, NULL, 0, 100); |
836 | /* NOTE: HX clones don't support sending breaks, -EPIPE is returned */ | ||
837 | if (result) | 675 | if (result) |
838 | dev_err(&port->dev, "error sending break = %d\n", result); | 676 | dev_err(&port->dev, "error sending break = %d\n", result); |
839 | } | 677 | } |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index a54ccdc4d661..22ad85242e5b 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -361,37 +361,13 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle) | |||
361 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) | 361 | int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) |
362 | { | 362 | { |
363 | struct au1100fb_device *fbdev; | 363 | struct au1100fb_device *fbdev; |
364 | unsigned int len; | ||
365 | unsigned long start=0, off; | ||
366 | 364 | ||
367 | fbdev = to_au1100fb_device(fbi); | 365 | fbdev = to_au1100fb_device(fbi); |
368 | 366 | ||
369 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | ||
370 | return -EINVAL; | ||
371 | } | ||
372 | |||
373 | start = fbdev->fb_phys & PAGE_MASK; | ||
374 | len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); | ||
375 | |||
376 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
377 | |||
378 | if ((vma->vm_end - vma->vm_start + off) > len) { | ||
379 | return -EINVAL; | ||
380 | } | ||
381 | |||
382 | off += start; | ||
383 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
384 | |||
385 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 367 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
386 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 | 368 | pgprot_val(vma->vm_page_prot) |= (6 << 9); //CCA=6 |
387 | 369 | ||
388 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 370 | return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
389 | vma->vm_end - vma->vm_start, | ||
390 | vma->vm_page_prot)) { | ||
391 | return -EAGAIN; | ||
392 | } | ||
393 | |||
394 | return 0; | ||
395 | } | 371 | } |
396 | 372 | ||
397 | static struct fb_ops au1100fb_ops = | 373 | static struct fb_ops au1100fb_ops = |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 301224ecc950..1d02897d17f2 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -1233,34 +1233,13 @@ static int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi) | |||
1233 | * method mainly to allow the use of the TLB streaming flag (CCA=6) | 1233 | * method mainly to allow the use of the TLB streaming flag (CCA=6) |
1234 | */ | 1234 | */ |
1235 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | 1235 | static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
1236 | |||
1237 | { | 1236 | { |
1238 | unsigned int len; | ||
1239 | unsigned long start=0, off; | ||
1240 | struct au1200fb_device *fbdev = info->par; | 1237 | struct au1200fb_device *fbdev = info->par; |
1241 | 1238 | ||
1242 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { | ||
1243 | return -EINVAL; | ||
1244 | } | ||
1245 | |||
1246 | start = fbdev->fb_phys & PAGE_MASK; | ||
1247 | len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); | ||
1248 | |||
1249 | off = vma->vm_pgoff << PAGE_SHIFT; | ||
1250 | |||
1251 | if ((vma->vm_end - vma->vm_start + off) > len) { | ||
1252 | return -EINVAL; | ||
1253 | } | ||
1254 | |||
1255 | off += start; | ||
1256 | vma->vm_pgoff = off >> PAGE_SHIFT; | ||
1257 | |||
1258 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 1239 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
1259 | pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ | 1240 | pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ |
1260 | 1241 | ||
1261 | return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | 1242 | return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len); |
1262 | vma->vm_end - vma->vm_start, | ||
1263 | vma->vm_page_prot); | ||
1264 | } | 1243 | } |
1265 | 1244 | ||
1266 | static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) | 1245 | static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) |
diff --git a/fs/dcache.c b/fs/dcache.c index 20532cb0b06e..ae6ebb88ceff 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -542,7 +542,7 @@ EXPORT_SYMBOL(d_drop); | |||
542 | * If ref is non-zero, then decrement the refcount too. | 542 | * If ref is non-zero, then decrement the refcount too. |
543 | * Returns dentry requiring refcount drop, or NULL if we're done. | 543 | * Returns dentry requiring refcount drop, or NULL if we're done. |
544 | */ | 544 | */ |
545 | static inline struct dentry * | 545 | static struct dentry * |
546 | dentry_kill(struct dentry *dentry, int unlock_on_failure) | 546 | dentry_kill(struct dentry *dentry, int unlock_on_failure) |
547 | __releases(dentry->d_lock) | 547 | __releases(dentry->d_lock) |
548 | { | 548 | { |
@@ -630,7 +630,8 @@ repeat: | |||
630 | goto kill_it; | 630 | goto kill_it; |
631 | } | 631 | } |
632 | 632 | ||
633 | dentry->d_flags |= DCACHE_REFERENCED; | 633 | if (!(dentry->d_flags & DCACHE_REFERENCED)) |
634 | dentry->d_flags |= DCACHE_REFERENCED; | ||
634 | dentry_lru_add(dentry); | 635 | dentry_lru_add(dentry); |
635 | 636 | ||
636 | dentry->d_lockref.count--; | 637 | dentry->d_lockref.count--; |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 473e09da7d02..810c28fb8c3c 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/anon_inodes.h> | 35 | #include <linux/anon_inodes.h> |
36 | #include <linux/device.h> | 36 | #include <linux/device.h> |
37 | #include <linux/freezer.h> | ||
38 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
39 | #include <asm/io.h> | 38 | #include <asm/io.h> |
40 | #include <asm/mman.h> | 39 | #include <asm/mman.h> |
@@ -1605,8 +1604,7 @@ fetch_events: | |||
1605 | } | 1604 | } |
1606 | 1605 | ||
1607 | spin_unlock_irqrestore(&ep->lock, flags); | 1606 | spin_unlock_irqrestore(&ep->lock, flags); |
1608 | if (!freezable_schedule_hrtimeout_range(to, slack, | 1607 | if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) |
1609 | HRTIMER_MODE_ABS)) | ||
1610 | timed_out = 1; | 1608 | timed_out = 1; |
1611 | 1609 | ||
1612 | spin_lock_irqsave(&ep->lock, flags); | 1610 | spin_lock_irqsave(&ep->lock, flags); |
diff --git a/fs/select.c b/fs/select.c index 35d4adc749d9..dfd5cb18c012 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -238,8 +238,7 @@ int poll_schedule_timeout(struct poll_wqueues *pwq, int state, | |||
238 | 238 | ||
239 | set_current_state(state); | 239 | set_current_state(state); |
240 | if (!pwq->triggered) | 240 | if (!pwq->triggered) |
241 | rc = freezable_schedule_hrtimeout_range(expires, slack, | 241 | rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS); |
242 | HRTIMER_MODE_ABS); | ||
243 | __set_current_state(TASK_RUNNING); | 242 | __set_current_state(TASK_RUNNING); |
244 | 243 | ||
245 | /* | 244 | /* |
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index 19c19a5eee29..f6c82de12541 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -34,9 +34,9 @@ struct ipc_namespace { | |||
34 | int sem_ctls[4]; | 34 | int sem_ctls[4]; |
35 | int used_sems; | 35 | int used_sems; |
36 | 36 | ||
37 | int msg_ctlmax; | 37 | unsigned int msg_ctlmax; |
38 | int msg_ctlmnb; | 38 | unsigned int msg_ctlmnb; |
39 | int msg_ctlmni; | 39 | unsigned int msg_ctlmni; |
40 | atomic_t msg_bytes; | 40 | atomic_t msg_bytes; |
41 | atomic_t msg_hdrs; | 41 | atomic_t msg_hdrs; |
42 | int auto_msgmni; | 42 | int auto_msgmni; |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index cc88172c7d9a..c74088ab103b 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -332,7 +332,7 @@ do { \ | |||
332 | #endif | 332 | #endif |
333 | 333 | ||
334 | #ifndef this_cpu_sub | 334 | #ifndef this_cpu_sub |
335 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(val)) | 335 | # define this_cpu_sub(pcp, val) this_cpu_add((pcp), -(typeof(pcp))(val)) |
336 | #endif | 336 | #endif |
337 | 337 | ||
338 | #ifndef this_cpu_inc | 338 | #ifndef this_cpu_inc |
@@ -418,7 +418,7 @@ do { \ | |||
418 | # define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) | 418 | # define this_cpu_add_return(pcp, val) __pcpu_size_call_return2(this_cpu_add_return_, pcp, val) |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(val)) | 421 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, -(typeof(pcp))(val)) |
422 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) | 422 | #define this_cpu_inc_return(pcp) this_cpu_add_return(pcp, 1) |
423 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) | 423 | #define this_cpu_dec_return(pcp) this_cpu_add_return(pcp, -1) |
424 | 424 | ||
@@ -586,7 +586,7 @@ do { \ | |||
586 | #endif | 586 | #endif |
587 | 587 | ||
588 | #ifndef __this_cpu_sub | 588 | #ifndef __this_cpu_sub |
589 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(val)) | 589 | # define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val)) |
590 | #endif | 590 | #endif |
591 | 591 | ||
592 | #ifndef __this_cpu_inc | 592 | #ifndef __this_cpu_inc |
@@ -668,7 +668,7 @@ do { \ | |||
668 | __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) | 668 | __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) |
669 | #endif | 669 | #endif |
670 | 670 | ||
671 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(val)) | 671 | #define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) |
672 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) | 672 | #define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) |
673 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) | 673 | #define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) |
674 | 674 | ||
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 009a655a5d35..2fc1602e23bb 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
@@ -456,13 +456,15 @@ struct perf_event_mmap_page { | |||
456 | /* | 456 | /* |
457 | * Control data for the mmap() data buffer. | 457 | * Control data for the mmap() data buffer. |
458 | * | 458 | * |
459 | * User-space reading the @data_head value should issue an rmb(), on | 459 | * User-space reading the @data_head value should issue an smp_rmb(), |
460 | * SMP capable platforms, after reading this value -- see | 460 | * after reading this value. |
461 | * perf_event_wakeup(). | ||
462 | * | 461 | * |
463 | * When the mapping is PROT_WRITE the @data_tail value should be | 462 | * When the mapping is PROT_WRITE the @data_tail value should be |
464 | * written by userspace to reflect the last read data. In this case | 463 | * written by userspace to reflect the last read data, after issueing |
465 | * the kernel will not over-write unread data. | 464 | * an smp_mb() to separate the data read from the ->data_tail store. |
465 | * In this case the kernel will not over-write unread data. | ||
466 | * | ||
467 | * See perf_output_put_handle() for the data ordering. | ||
466 | */ | 468 | */ |
467 | __u64 data_head; /* head in the data section */ | 469 | __u64 data_head; /* head in the data section */ |
468 | __u64 data_tail; /* user-space written tail */ | 470 | __u64 data_tail; /* user-space written tail */ |
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c index 130dfece27ac..b0e99deb6d05 100644 --- a/ipc/ipc_sysctl.c +++ b/ipc/ipc_sysctl.c | |||
@@ -62,7 +62,7 @@ static int proc_ipc_dointvec_minmax_orphans(ctl_table *table, int write, | |||
62 | return err; | 62 | return err; |
63 | } | 63 | } |
64 | 64 | ||
65 | static int proc_ipc_callback_dointvec(ctl_table *table, int write, | 65 | static int proc_ipc_callback_dointvec_minmax(ctl_table *table, int write, |
66 | void __user *buffer, size_t *lenp, loff_t *ppos) | 66 | void __user *buffer, size_t *lenp, loff_t *ppos) |
67 | { | 67 | { |
68 | struct ctl_table ipc_table; | 68 | struct ctl_table ipc_table; |
@@ -72,7 +72,7 @@ static int proc_ipc_callback_dointvec(ctl_table *table, int write, | |||
72 | memcpy(&ipc_table, table, sizeof(ipc_table)); | 72 | memcpy(&ipc_table, table, sizeof(ipc_table)); |
73 | ipc_table.data = get_ipc(table); | 73 | ipc_table.data = get_ipc(table); |
74 | 74 | ||
75 | rc = proc_dointvec(&ipc_table, write, buffer, lenp, ppos); | 75 | rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); |
76 | 76 | ||
77 | if (write && !rc && lenp_bef == *lenp) | 77 | if (write && !rc && lenp_bef == *lenp) |
78 | /* | 78 | /* |
@@ -152,15 +152,13 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, | |||
152 | #define proc_ipc_dointvec NULL | 152 | #define proc_ipc_dointvec NULL |
153 | #define proc_ipc_dointvec_minmax NULL | 153 | #define proc_ipc_dointvec_minmax NULL |
154 | #define proc_ipc_dointvec_minmax_orphans NULL | 154 | #define proc_ipc_dointvec_minmax_orphans NULL |
155 | #define proc_ipc_callback_dointvec NULL | 155 | #define proc_ipc_callback_dointvec_minmax NULL |
156 | #define proc_ipcauto_dointvec_minmax NULL | 156 | #define proc_ipcauto_dointvec_minmax NULL |
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | static int zero; | 159 | static int zero; |
160 | static int one = 1; | 160 | static int one = 1; |
161 | #ifdef CONFIG_CHECKPOINT_RESTORE | ||
162 | static int int_max = INT_MAX; | 161 | static int int_max = INT_MAX; |
163 | #endif | ||
164 | 162 | ||
165 | static struct ctl_table ipc_kern_table[] = { | 163 | static struct ctl_table ipc_kern_table[] = { |
166 | { | 164 | { |
@@ -198,21 +196,27 @@ static struct ctl_table ipc_kern_table[] = { | |||
198 | .data = &init_ipc_ns.msg_ctlmax, | 196 | .data = &init_ipc_ns.msg_ctlmax, |
199 | .maxlen = sizeof (init_ipc_ns.msg_ctlmax), | 197 | .maxlen = sizeof (init_ipc_ns.msg_ctlmax), |
200 | .mode = 0644, | 198 | .mode = 0644, |
201 | .proc_handler = proc_ipc_dointvec, | 199 | .proc_handler = proc_ipc_dointvec_minmax, |
200 | .extra1 = &zero, | ||
201 | .extra2 = &int_max, | ||
202 | }, | 202 | }, |
203 | { | 203 | { |
204 | .procname = "msgmni", | 204 | .procname = "msgmni", |
205 | .data = &init_ipc_ns.msg_ctlmni, | 205 | .data = &init_ipc_ns.msg_ctlmni, |
206 | .maxlen = sizeof (init_ipc_ns.msg_ctlmni), | 206 | .maxlen = sizeof (init_ipc_ns.msg_ctlmni), |
207 | .mode = 0644, | 207 | .mode = 0644, |
208 | .proc_handler = proc_ipc_callback_dointvec, | 208 | .proc_handler = proc_ipc_callback_dointvec_minmax, |
209 | .extra1 = &zero, | ||
210 | .extra2 = &int_max, | ||
209 | }, | 211 | }, |
210 | { | 212 | { |
211 | .procname = "msgmnb", | 213 | .procname = "msgmnb", |
212 | .data = &init_ipc_ns.msg_ctlmnb, | 214 | .data = &init_ipc_ns.msg_ctlmnb, |
213 | .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), | 215 | .maxlen = sizeof (init_ipc_ns.msg_ctlmnb), |
214 | .mode = 0644, | 216 | .mode = 0644, |
215 | .proc_handler = proc_ipc_dointvec, | 217 | .proc_handler = proc_ipc_dointvec_minmax, |
218 | .extra1 = &zero, | ||
219 | .extra2 = &int_max, | ||
216 | }, | 220 | }, |
217 | { | 221 | { |
218 | .procname = "sem", | 222 | .procname = "sem", |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index cd55144270b5..9c2ddfbf4525 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -87,10 +87,31 @@ again: | |||
87 | goto out; | 87 | goto out; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Publish the known good head. Rely on the full barrier implied | 90 | * Since the mmap() consumer (userspace) can run on a different CPU: |
91 | * by atomic_dec_and_test() order the rb->head read and this | 91 | * |
92 | * write. | 92 | * kernel user |
93 | * | ||
94 | * READ ->data_tail READ ->data_head | ||
95 | * smp_mb() (A) smp_rmb() (C) | ||
96 | * WRITE $data READ $data | ||
97 | * smp_wmb() (B) smp_mb() (D) | ||
98 | * STORE ->data_head WRITE ->data_tail | ||
99 | * | ||
100 | * Where A pairs with D, and B pairs with C. | ||
101 | * | ||
102 | * I don't think A needs to be a full barrier because we won't in fact | ||
103 | * write data until we see the store from userspace. So we simply don't | ||
104 | * issue the data WRITE until we observe it. Be conservative for now. | ||
105 | * | ||
106 | * OTOH, D needs to be a full barrier since it separates the data READ | ||
107 | * from the tail WRITE. | ||
108 | * | ||
109 | * For B a WMB is sufficient since it separates two WRITEs, and for C | ||
110 | * an RMB is sufficient since it separates two READs. | ||
111 | * | ||
112 | * See perf_output_begin(). | ||
93 | */ | 113 | */ |
114 | smp_wmb(); | ||
94 | rb->user_page->data_head = head; | 115 | rb->user_page->data_head = head; |
95 | 116 | ||
96 | /* | 117 | /* |
@@ -154,9 +175,11 @@ int perf_output_begin(struct perf_output_handle *handle, | |||
154 | * Userspace could choose to issue a mb() before updating the | 175 | * Userspace could choose to issue a mb() before updating the |
155 | * tail pointer. So that all reads will be completed before the | 176 | * tail pointer. So that all reads will be completed before the |
156 | * write is issued. | 177 | * write is issued. |
178 | * | ||
179 | * See perf_output_put_handle(). | ||
157 | */ | 180 | */ |
158 | tail = ACCESS_ONCE(rb->user_page->data_tail); | 181 | tail = ACCESS_ONCE(rb->user_page->data_tail); |
159 | smp_rmb(); | 182 | smp_mb(); |
160 | offset = head = local_read(&rb->head); | 183 | offset = head = local_read(&rb->head); |
161 | head += size; | 184 | head += size; |
162 | if (unlikely(!perf_output_space(rb, tail, offset, head))) | 185 | if (unlikely(!perf_output_space(rb, tail, offset, head))) |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 06344d986eb9..094f3152ec2b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -983,7 +983,7 @@ config DEBUG_KOBJECT | |||
983 | 983 | ||
984 | config DEBUG_KOBJECT_RELEASE | 984 | config DEBUG_KOBJECT_RELEASE |
985 | bool "kobject release debugging" | 985 | bool "kobject release debugging" |
986 | depends on DEBUG_KERNEL | 986 | depends on DEBUG_OBJECTS_TIMERS |
987 | help | 987 | help |
988 | kobjects are reference counted objects. This means that their | 988 | kobjects are reference counted objects. This means that their |
989 | last reference count put is not predictable, and the kobject can | 989 | last reference count put is not predictable, and the kobject can |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index a685c8a79578..d16fa295ae1d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
@@ -577,7 +577,8 @@ void sg_miter_stop(struct sg_mapping_iter *miter) | |||
577 | miter->__offset += miter->consumed; | 577 | miter->__offset += miter->consumed; |
578 | miter->__remaining -= miter->consumed; | 578 | miter->__remaining -= miter->consumed; |
579 | 579 | ||
580 | if (miter->__flags & SG_MITER_TO_SG) | 580 | if ((miter->__flags & SG_MITER_TO_SG) && |
581 | !PageSlab(miter->page)) | ||
581 | flush_kernel_dcache_page(miter->page); | 582 | flush_kernel_dcache_page(miter->page); |
582 | 583 | ||
583 | if (miter->__flags & SG_MITER_ATOMIC) { | 584 | if (miter->__flags & SG_MITER_ATOMIC) { |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 610e3df2768a..cca80d96e509 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1278,64 +1278,90 @@ out: | |||
1278 | int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | 1278 | int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, |
1279 | unsigned long addr, pmd_t pmd, pmd_t *pmdp) | 1279 | unsigned long addr, pmd_t pmd, pmd_t *pmdp) |
1280 | { | 1280 | { |
1281 | struct anon_vma *anon_vma = NULL; | ||
1281 | struct page *page; | 1282 | struct page *page; |
1282 | unsigned long haddr = addr & HPAGE_PMD_MASK; | 1283 | unsigned long haddr = addr & HPAGE_PMD_MASK; |
1284 | int page_nid = -1, this_nid = numa_node_id(); | ||
1283 | int target_nid; | 1285 | int target_nid; |
1284 | int current_nid = -1; | 1286 | bool page_locked; |
1285 | bool migrated; | 1287 | bool migrated = false; |
1286 | 1288 | ||
1287 | spin_lock(&mm->page_table_lock); | 1289 | spin_lock(&mm->page_table_lock); |
1288 | if (unlikely(!pmd_same(pmd, *pmdp))) | 1290 | if (unlikely(!pmd_same(pmd, *pmdp))) |
1289 | goto out_unlock; | 1291 | goto out_unlock; |
1290 | 1292 | ||
1291 | page = pmd_page(pmd); | 1293 | page = pmd_page(pmd); |
1292 | get_page(page); | 1294 | page_nid = page_to_nid(page); |
1293 | current_nid = page_to_nid(page); | ||
1294 | count_vm_numa_event(NUMA_HINT_FAULTS); | 1295 | count_vm_numa_event(NUMA_HINT_FAULTS); |
1295 | if (current_nid == numa_node_id()) | 1296 | if (page_nid == this_nid) |
1296 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); | 1297 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); |
1297 | 1298 | ||
1299 | /* | ||
1300 | * Acquire the page lock to serialise THP migrations but avoid dropping | ||
1301 | * page_table_lock if at all possible | ||
1302 | */ | ||
1303 | page_locked = trylock_page(page); | ||
1298 | target_nid = mpol_misplaced(page, vma, haddr); | 1304 | target_nid = mpol_misplaced(page, vma, haddr); |
1299 | if (target_nid == -1) { | 1305 | if (target_nid == -1) { |
1300 | put_page(page); | 1306 | /* If the page was locked, there are no parallel migrations */ |
1301 | goto clear_pmdnuma; | 1307 | if (page_locked) |
1308 | goto clear_pmdnuma; | ||
1309 | |||
1310 | /* | ||
1311 | * Otherwise wait for potential migrations and retry. We do | ||
1312 | * relock and check_same as the page may no longer be mapped. | ||
1313 | * As the fault is being retried, do not account for it. | ||
1314 | */ | ||
1315 | spin_unlock(&mm->page_table_lock); | ||
1316 | wait_on_page_locked(page); | ||
1317 | page_nid = -1; | ||
1318 | goto out; | ||
1302 | } | 1319 | } |
1303 | 1320 | ||
1304 | /* Acquire the page lock to serialise THP migrations */ | 1321 | /* Page is misplaced, serialise migrations and parallel THP splits */ |
1322 | get_page(page); | ||
1305 | spin_unlock(&mm->page_table_lock); | 1323 | spin_unlock(&mm->page_table_lock); |
1306 | lock_page(page); | 1324 | if (!page_locked) |
1325 | lock_page(page); | ||
1326 | anon_vma = page_lock_anon_vma_read(page); | ||
1307 | 1327 | ||
1308 | /* Confirm the PTE did not while locked */ | 1328 | /* Confirm the PTE did not while locked */ |
1309 | spin_lock(&mm->page_table_lock); | 1329 | spin_lock(&mm->page_table_lock); |
1310 | if (unlikely(!pmd_same(pmd, *pmdp))) { | 1330 | if (unlikely(!pmd_same(pmd, *pmdp))) { |
1311 | unlock_page(page); | 1331 | unlock_page(page); |
1312 | put_page(page); | 1332 | put_page(page); |
1333 | page_nid = -1; | ||
1313 | goto out_unlock; | 1334 | goto out_unlock; |
1314 | } | 1335 | } |
1315 | spin_unlock(&mm->page_table_lock); | ||
1316 | 1336 | ||
1317 | /* Migrate the THP to the requested node */ | 1337 | /* |
1338 | * Migrate the THP to the requested node, returns with page unlocked | ||
1339 | * and pmd_numa cleared. | ||
1340 | */ | ||
1341 | spin_unlock(&mm->page_table_lock); | ||
1318 | migrated = migrate_misplaced_transhuge_page(mm, vma, | 1342 | migrated = migrate_misplaced_transhuge_page(mm, vma, |
1319 | pmdp, pmd, addr, page, target_nid); | 1343 | pmdp, pmd, addr, page, target_nid); |
1320 | if (!migrated) | 1344 | if (migrated) |
1321 | goto check_same; | 1345 | page_nid = target_nid; |
1322 | |||
1323 | task_numa_fault(target_nid, HPAGE_PMD_NR, true); | ||
1324 | return 0; | ||
1325 | 1346 | ||
1326 | check_same: | 1347 | goto out; |
1327 | spin_lock(&mm->page_table_lock); | ||
1328 | if (unlikely(!pmd_same(pmd, *pmdp))) | ||
1329 | goto out_unlock; | ||
1330 | clear_pmdnuma: | 1348 | clear_pmdnuma: |
1349 | BUG_ON(!PageLocked(page)); | ||
1331 | pmd = pmd_mknonnuma(pmd); | 1350 | pmd = pmd_mknonnuma(pmd); |
1332 | set_pmd_at(mm, haddr, pmdp, pmd); | 1351 | set_pmd_at(mm, haddr, pmdp, pmd); |
1333 | VM_BUG_ON(pmd_numa(*pmdp)); | 1352 | VM_BUG_ON(pmd_numa(*pmdp)); |
1334 | update_mmu_cache_pmd(vma, addr, pmdp); | 1353 | update_mmu_cache_pmd(vma, addr, pmdp); |
1354 | unlock_page(page); | ||
1335 | out_unlock: | 1355 | out_unlock: |
1336 | spin_unlock(&mm->page_table_lock); | 1356 | spin_unlock(&mm->page_table_lock); |
1337 | if (current_nid != -1) | 1357 | |
1338 | task_numa_fault(current_nid, HPAGE_PMD_NR, false); | 1358 | out: |
1359 | if (anon_vma) | ||
1360 | page_unlock_anon_vma_read(anon_vma); | ||
1361 | |||
1362 | if (page_nid != -1) | ||
1363 | task_numa_fault(page_nid, HPAGE_PMD_NR, migrated); | ||
1364 | |||
1339 | return 0; | 1365 | return 0; |
1340 | } | 1366 | } |
1341 | 1367 | ||
diff --git a/mm/list_lru.c b/mm/list_lru.c index 72467914b856..72f9decb0104 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c | |||
@@ -81,8 +81,9 @@ restart: | |||
81 | * decrement nr_to_walk first so that we don't livelock if we | 81 | * decrement nr_to_walk first so that we don't livelock if we |
82 | * get stuck on large numbesr of LRU_RETRY items | 82 | * get stuck on large numbesr of LRU_RETRY items |
83 | */ | 83 | */ |
84 | if (--(*nr_to_walk) == 0) | 84 | if (!*nr_to_walk) |
85 | break; | 85 | break; |
86 | --*nr_to_walk; | ||
86 | 87 | ||
87 | ret = isolate(item, &nlru->lock, cb_arg); | 88 | ret = isolate(item, &nlru->lock, cb_arg); |
88 | switch (ret) { | 89 | switch (ret) { |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 34d3ca9572d6..13b9d0f221b8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/page_cgroup.h> | 54 | #include <linux/page_cgroup.h> |
55 | #include <linux/cpu.h> | 55 | #include <linux/cpu.h> |
56 | #include <linux/oom.h> | 56 | #include <linux/oom.h> |
57 | #include <linux/lockdep.h> | ||
57 | #include "internal.h" | 58 | #include "internal.h" |
58 | #include <net/sock.h> | 59 | #include <net/sock.h> |
59 | #include <net/ip.h> | 60 | #include <net/ip.h> |
@@ -2046,6 +2047,12 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg, | |||
2046 | return total; | 2047 | return total; |
2047 | } | 2048 | } |
2048 | 2049 | ||
2050 | #ifdef CONFIG_LOCKDEP | ||
2051 | static struct lockdep_map memcg_oom_lock_dep_map = { | ||
2052 | .name = "memcg_oom_lock", | ||
2053 | }; | ||
2054 | #endif | ||
2055 | |||
2049 | static DEFINE_SPINLOCK(memcg_oom_lock); | 2056 | static DEFINE_SPINLOCK(memcg_oom_lock); |
2050 | 2057 | ||
2051 | /* | 2058 | /* |
@@ -2083,7 +2090,8 @@ static bool mem_cgroup_oom_trylock(struct mem_cgroup *memcg) | |||
2083 | } | 2090 | } |
2084 | iter->oom_lock = false; | 2091 | iter->oom_lock = false; |
2085 | } | 2092 | } |
2086 | } | 2093 | } else |
2094 | mutex_acquire(&memcg_oom_lock_dep_map, 0, 1, _RET_IP_); | ||
2087 | 2095 | ||
2088 | spin_unlock(&memcg_oom_lock); | 2096 | spin_unlock(&memcg_oom_lock); |
2089 | 2097 | ||
@@ -2095,6 +2103,7 @@ static void mem_cgroup_oom_unlock(struct mem_cgroup *memcg) | |||
2095 | struct mem_cgroup *iter; | 2103 | struct mem_cgroup *iter; |
2096 | 2104 | ||
2097 | spin_lock(&memcg_oom_lock); | 2105 | spin_lock(&memcg_oom_lock); |
2106 | mutex_release(&memcg_oom_lock_dep_map, 1, _RET_IP_); | ||
2098 | for_each_mem_cgroup_tree(iter, memcg) | 2107 | for_each_mem_cgroup_tree(iter, memcg) |
2099 | iter->oom_lock = false; | 2108 | iter->oom_lock = false; |
2100 | spin_unlock(&memcg_oom_lock); | 2109 | spin_unlock(&memcg_oom_lock); |
@@ -2765,10 +2774,10 @@ done: | |||
2765 | *ptr = memcg; | 2774 | *ptr = memcg; |
2766 | return 0; | 2775 | return 0; |
2767 | nomem: | 2776 | nomem: |
2768 | *ptr = NULL; | 2777 | if (!(gfp_mask & __GFP_NOFAIL)) { |
2769 | if (gfp_mask & __GFP_NOFAIL) | 2778 | *ptr = NULL; |
2770 | return 0; | 2779 | return -ENOMEM; |
2771 | return -ENOMEM; | 2780 | } |
2772 | bypass: | 2781 | bypass: |
2773 | *ptr = root_mem_cgroup; | 2782 | *ptr = root_mem_cgroup; |
2774 | return -EINTR; | 2783 | return -EINTR; |
@@ -3773,8 +3782,7 @@ void mem_cgroup_move_account_page_stat(struct mem_cgroup *from, | |||
3773 | { | 3782 | { |
3774 | /* Update stat data for mem_cgroup */ | 3783 | /* Update stat data for mem_cgroup */ |
3775 | preempt_disable(); | 3784 | preempt_disable(); |
3776 | WARN_ON_ONCE(from->stat->count[idx] < nr_pages); | 3785 | __this_cpu_sub(from->stat->count[idx], nr_pages); |
3777 | __this_cpu_add(from->stat->count[idx], -nr_pages); | ||
3778 | __this_cpu_add(to->stat->count[idx], nr_pages); | 3786 | __this_cpu_add(to->stat->count[idx], nr_pages); |
3779 | preempt_enable(); | 3787 | preempt_enable(); |
3780 | } | 3788 | } |
@@ -4950,31 +4958,18 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg) | |||
4950 | } while (usage > 0); | 4958 | } while (usage > 0); |
4951 | } | 4959 | } |
4952 | 4960 | ||
4953 | /* | ||
4954 | * This mainly exists for tests during the setting of set of use_hierarchy. | ||
4955 | * Since this is the very setting we are changing, the current hierarchy value | ||
4956 | * is meaningless | ||
4957 | */ | ||
4958 | static inline bool __memcg_has_children(struct mem_cgroup *memcg) | ||
4959 | { | ||
4960 | struct cgroup_subsys_state *pos; | ||
4961 | |||
4962 | /* bounce at first found */ | ||
4963 | css_for_each_child(pos, &memcg->css) | ||
4964 | return true; | ||
4965 | return false; | ||
4966 | } | ||
4967 | |||
4968 | /* | ||
4969 | * Must be called with memcg_create_mutex held, unless the cgroup is guaranteed | ||
4970 | * to be already dead (as in mem_cgroup_force_empty, for instance). This is | ||
4971 | * from mem_cgroup_count_children(), in the sense that we don't really care how | ||
4972 | * many children we have; we only need to know if we have any. It also counts | ||
4973 | * any memcg without hierarchy as infertile. | ||
4974 | */ | ||
4975 | static inline bool memcg_has_children(struct mem_cgroup *memcg) | 4961 | static inline bool memcg_has_children(struct mem_cgroup *memcg) |
4976 | { | 4962 | { |
4977 | return memcg->use_hierarchy && __memcg_has_children(memcg); | 4963 | lockdep_assert_held(&memcg_create_mutex); |
4964 | /* | ||
4965 | * The lock does not prevent addition or deletion to the list | ||
4966 | * of children, but it prevents a new child from being | ||
4967 | * initialized based on this parent in css_online(), so it's | ||
4968 | * enough to decide whether hierarchically inherited | ||
4969 | * attributes can still be changed or not. | ||
4970 | */ | ||
4971 | return memcg->use_hierarchy && | ||
4972 | !list_empty(&memcg->css.cgroup->children); | ||
4978 | } | 4973 | } |
4979 | 4974 | ||
4980 | /* | 4975 | /* |
@@ -5054,7 +5049,7 @@ static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css, | |||
5054 | */ | 5049 | */ |
5055 | if ((!parent_memcg || !parent_memcg->use_hierarchy) && | 5050 | if ((!parent_memcg || !parent_memcg->use_hierarchy) && |
5056 | (val == 1 || val == 0)) { | 5051 | (val == 1 || val == 0)) { |
5057 | if (!__memcg_has_children(memcg)) | 5052 | if (list_empty(&memcg->css.cgroup->children)) |
5058 | memcg->use_hierarchy = val; | 5053 | memcg->use_hierarchy = val; |
5059 | else | 5054 | else |
5060 | retval = -EBUSY; | 5055 | retval = -EBUSY; |
diff --git a/mm/memory.c b/mm/memory.c index 1311f26497e6..d176154c243f 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3521,12 +3521,12 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3521 | } | 3521 | } |
3522 | 3522 | ||
3523 | int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, | 3523 | int numa_migrate_prep(struct page *page, struct vm_area_struct *vma, |
3524 | unsigned long addr, int current_nid) | 3524 | unsigned long addr, int page_nid) |
3525 | { | 3525 | { |
3526 | get_page(page); | 3526 | get_page(page); |
3527 | 3527 | ||
3528 | count_vm_numa_event(NUMA_HINT_FAULTS); | 3528 | count_vm_numa_event(NUMA_HINT_FAULTS); |
3529 | if (current_nid == numa_node_id()) | 3529 | if (page_nid == numa_node_id()) |
3530 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); | 3530 | count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); |
3531 | 3531 | ||
3532 | return mpol_misplaced(page, vma, addr); | 3532 | return mpol_misplaced(page, vma, addr); |
@@ -3537,7 +3537,7 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3537 | { | 3537 | { |
3538 | struct page *page = NULL; | 3538 | struct page *page = NULL; |
3539 | spinlock_t *ptl; | 3539 | spinlock_t *ptl; |
3540 | int current_nid = -1; | 3540 | int page_nid = -1; |
3541 | int target_nid; | 3541 | int target_nid; |
3542 | bool migrated = false; | 3542 | bool migrated = false; |
3543 | 3543 | ||
@@ -3567,15 +3567,10 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3567 | return 0; | 3567 | return 0; |
3568 | } | 3568 | } |
3569 | 3569 | ||
3570 | current_nid = page_to_nid(page); | 3570 | page_nid = page_to_nid(page); |
3571 | target_nid = numa_migrate_prep(page, vma, addr, current_nid); | 3571 | target_nid = numa_migrate_prep(page, vma, addr, page_nid); |
3572 | pte_unmap_unlock(ptep, ptl); | 3572 | pte_unmap_unlock(ptep, ptl); |
3573 | if (target_nid == -1) { | 3573 | if (target_nid == -1) { |
3574 | /* | ||
3575 | * Account for the fault against the current node if it not | ||
3576 | * being replaced regardless of where the page is located. | ||
3577 | */ | ||
3578 | current_nid = numa_node_id(); | ||
3579 | put_page(page); | 3574 | put_page(page); |
3580 | goto out; | 3575 | goto out; |
3581 | } | 3576 | } |
@@ -3583,11 +3578,11 @@ int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3583 | /* Migrate to the requested node */ | 3578 | /* Migrate to the requested node */ |
3584 | migrated = migrate_misplaced_page(page, target_nid); | 3579 | migrated = migrate_misplaced_page(page, target_nid); |
3585 | if (migrated) | 3580 | if (migrated) |
3586 | current_nid = target_nid; | 3581 | page_nid = target_nid; |
3587 | 3582 | ||
3588 | out: | 3583 | out: |
3589 | if (current_nid != -1) | 3584 | if (page_nid != -1) |
3590 | task_numa_fault(current_nid, 1, migrated); | 3585 | task_numa_fault(page_nid, 1, migrated); |
3591 | return 0; | 3586 | return 0; |
3592 | } | 3587 | } |
3593 | 3588 | ||
@@ -3602,7 +3597,6 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3602 | unsigned long offset; | 3597 | unsigned long offset; |
3603 | spinlock_t *ptl; | 3598 | spinlock_t *ptl; |
3604 | bool numa = false; | 3599 | bool numa = false; |
3605 | int local_nid = numa_node_id(); | ||
3606 | 3600 | ||
3607 | spin_lock(&mm->page_table_lock); | 3601 | spin_lock(&mm->page_table_lock); |
3608 | pmd = *pmdp; | 3602 | pmd = *pmdp; |
@@ -3625,9 +3619,10 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3625 | for (addr = _addr + offset; addr < _addr + PMD_SIZE; pte++, addr += PAGE_SIZE) { | 3619 | for (addr = _addr + offset; addr < _addr + PMD_SIZE; pte++, addr += PAGE_SIZE) { |
3626 | pte_t pteval = *pte; | 3620 | pte_t pteval = *pte; |
3627 | struct page *page; | 3621 | struct page *page; |
3628 | int curr_nid = local_nid; | 3622 | int page_nid = -1; |
3629 | int target_nid; | 3623 | int target_nid; |
3630 | bool migrated; | 3624 | bool migrated = false; |
3625 | |||
3631 | if (!pte_present(pteval)) | 3626 | if (!pte_present(pteval)) |
3632 | continue; | 3627 | continue; |
3633 | if (!pte_numa(pteval)) | 3628 | if (!pte_numa(pteval)) |
@@ -3649,25 +3644,19 @@ static int do_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3649 | if (unlikely(page_mapcount(page) != 1)) | 3644 | if (unlikely(page_mapcount(page) != 1)) |
3650 | continue; | 3645 | continue; |
3651 | 3646 | ||
3652 | /* | 3647 | page_nid = page_to_nid(page); |
3653 | * Note that the NUMA fault is later accounted to either | 3648 | target_nid = numa_migrate_prep(page, vma, addr, page_nid); |
3654 | * the node that is currently running or where the page is | 3649 | pte_unmap_unlock(pte, ptl); |
3655 | * migrated to. | 3650 | if (target_nid != -1) { |
3656 | */ | 3651 | migrated = migrate_misplaced_page(page, target_nid); |
3657 | curr_nid = local_nid; | 3652 | if (migrated) |
3658 | target_nid = numa_migrate_prep(page, vma, addr, | 3653 | page_nid = target_nid; |
3659 | page_to_nid(page)); | 3654 | } else { |
3660 | if (target_nid == -1) { | ||
3661 | put_page(page); | 3655 | put_page(page); |
3662 | continue; | ||
3663 | } | 3656 | } |
3664 | 3657 | ||
3665 | /* Migrate to the requested node */ | 3658 | if (page_nid != -1) |
3666 | pte_unmap_unlock(pte, ptl); | 3659 | task_numa_fault(page_nid, 1, migrated); |
3667 | migrated = migrate_misplaced_page(page, target_nid); | ||
3668 | if (migrated) | ||
3669 | curr_nid = target_nid; | ||
3670 | task_numa_fault(curr_nid, 1, migrated); | ||
3671 | 3660 | ||
3672 | pte = pte_offset_map_lock(mm, pmdp, addr, &ptl); | 3661 | pte = pte_offset_map_lock(mm, pmdp, addr, &ptl); |
3673 | } | 3662 | } |
diff --git a/mm/migrate.c b/mm/migrate.c index 7a7325ee1d08..c04692774e88 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1715,12 +1715,12 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1715 | unlock_page(new_page); | 1715 | unlock_page(new_page); |
1716 | put_page(new_page); /* Free it */ | 1716 | put_page(new_page); /* Free it */ |
1717 | 1717 | ||
1718 | unlock_page(page); | 1718 | /* Retake the callers reference and putback on LRU */ |
1719 | get_page(page); | ||
1719 | putback_lru_page(page); | 1720 | putback_lru_page(page); |
1720 | 1721 | mod_zone_page_state(page_zone(page), | |
1721 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); | 1722 | NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR); |
1722 | isolated = 0; | 1723 | goto out_fail; |
1723 | goto out; | ||
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | /* | 1726 | /* |
@@ -1737,9 +1737,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1737 | entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); | 1737 | entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); |
1738 | entry = pmd_mkhuge(entry); | 1738 | entry = pmd_mkhuge(entry); |
1739 | 1739 | ||
1740 | page_add_new_anon_rmap(new_page, vma, haddr); | 1740 | pmdp_clear_flush(vma, haddr, pmd); |
1741 | |||
1742 | set_pmd_at(mm, haddr, pmd, entry); | 1741 | set_pmd_at(mm, haddr, pmd, entry); |
1742 | page_add_new_anon_rmap(new_page, vma, haddr); | ||
1743 | update_mmu_cache_pmd(vma, address, &entry); | 1743 | update_mmu_cache_pmd(vma, address, &entry); |
1744 | page_remove_rmap(page); | 1744 | page_remove_rmap(page); |
1745 | /* | 1745 | /* |
@@ -1758,7 +1758,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
1758 | count_vm_events(PGMIGRATE_SUCCESS, HPAGE_PMD_NR); | 1758 | count_vm_events(PGMIGRATE_SUCCESS, HPAGE_PMD_NR); |
1759 | count_vm_numa_events(NUMA_PAGE_MIGRATE, HPAGE_PMD_NR); | 1759 | count_vm_numa_events(NUMA_PAGE_MIGRATE, HPAGE_PMD_NR); |
1760 | 1760 | ||
1761 | out: | ||
1762 | mod_zone_page_state(page_zone(page), | 1761 | mod_zone_page_state(page_zone(page), |
1763 | NR_ISOLATED_ANON + page_lru, | 1762 | NR_ISOLATED_ANON + page_lru, |
1764 | -HPAGE_PMD_NR); | 1763 | -HPAGE_PMD_NR); |
@@ -1767,6 +1766,10 @@ out: | |||
1767 | out_fail: | 1766 | out_fail: |
1768 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); | 1767 | count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); |
1769 | out_dropref: | 1768 | out_dropref: |
1769 | entry = pmd_mknonnuma(entry); | ||
1770 | set_pmd_at(mm, haddr, pmd, entry); | ||
1771 | update_mmu_cache_pmd(vma, address, &entry); | ||
1772 | |||
1770 | unlock_page(page); | 1773 | unlock_page(page); |
1771 | put_page(page); | 1774 | put_page(page); |
1772 | return 0; | 1775 | return 0; |
diff --git a/mm/mprotect.c b/mm/mprotect.c index a3af058f68e4..412ba2b7326a 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -148,7 +148,7 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma, | |||
148 | split_huge_page_pmd(vma, addr, pmd); | 148 | split_huge_page_pmd(vma, addr, pmd); |
149 | else if (change_huge_pmd(vma, pmd, addr, newprot, | 149 | else if (change_huge_pmd(vma, pmd, addr, newprot, |
150 | prot_numa)) { | 150 | prot_numa)) { |
151 | pages += HPAGE_PMD_NR; | 151 | pages++; |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
154 | /* fall through */ | 154 | /* fall through */ |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 5da2cbcfdbb5..2beeabf502c5 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
@@ -242,7 +242,7 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
242 | if (err) | 242 | if (err) |
243 | break; | 243 | break; |
244 | pgd++; | 244 | pgd++; |
245 | } while (addr = next, addr != end); | 245 | } while (addr = next, addr < end); |
246 | 246 | ||
247 | return err; | 247 | return err; |
248 | } | 248 | } |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 487ac6f37ca2..9a11f9f799f4 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -55,6 +55,7 @@ static struct sym_entry *table; | |||
55 | static unsigned int table_size, table_cnt; | 55 | static unsigned int table_size, table_cnt; |
56 | static int all_symbols = 0; | 56 | static int all_symbols = 0; |
57 | static char symbol_prefix_char = '\0'; | 57 | static char symbol_prefix_char = '\0'; |
58 | static unsigned long long kernel_start_addr = 0; | ||
58 | 59 | ||
59 | int token_profit[0x10000]; | 60 | int token_profit[0x10000]; |
60 | 61 | ||
@@ -65,7 +66,10 @@ unsigned char best_table_len[256]; | |||
65 | 66 | ||
66 | static void usage(void) | 67 | static void usage(void) |
67 | { | 68 | { |
68 | fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); | 69 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " |
70 | "[--symbol-prefix=<prefix char>] " | ||
71 | "[--page-offset=<CONFIG_PAGE_OFFSET>] " | ||
72 | "< in.map > out.S\n"); | ||
69 | exit(1); | 73 | exit(1); |
70 | } | 74 | } |
71 | 75 | ||
@@ -194,6 +198,9 @@ static int symbol_valid(struct sym_entry *s) | |||
194 | int i; | 198 | int i; |
195 | int offset = 1; | 199 | int offset = 1; |
196 | 200 | ||
201 | if (s->addr < kernel_start_addr) | ||
202 | return 0; | ||
203 | |||
197 | /* skip prefix char */ | 204 | /* skip prefix char */ |
198 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) | 205 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) |
199 | offset++; | 206 | offset++; |
@@ -646,6 +653,9 @@ int main(int argc, char **argv) | |||
646 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) | 653 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) |
647 | p++; | 654 | p++; |
648 | symbol_prefix_char = *p; | 655 | symbol_prefix_char = *p; |
656 | } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { | ||
657 | const char *p = &argv[i][14]; | ||
658 | kernel_start_addr = strtoull(p, NULL, 16); | ||
649 | } else | 659 | } else |
650 | usage(); | 660 | usage(); |
651 | } | 661 | } |
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 014994936b1c..32b10f53d0b4 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh | |||
@@ -82,6 +82,8 @@ kallsyms() | |||
82 | kallsymopt="${kallsymopt} --all-symbols" | 82 | kallsymopt="${kallsymopt} --all-symbols" |
83 | fi | 83 | fi |
84 | 84 | ||
85 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" | ||
86 | |||
85 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ | 87 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ |
86 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" | 88 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" |
87 | 89 | ||
diff --git a/sound/soc/blackfin/bf5xx-sport.c b/sound/soc/blackfin/bf5xx-sport.c index 695351241db8..9dfa1241ea66 100644 --- a/sound/soc/blackfin/bf5xx-sport.c +++ b/sound/soc/blackfin/bf5xx-sport.c | |||
@@ -179,8 +179,9 @@ static inline int sport_hook_rx_dummy(struct sport_device *sport) | |||
179 | struct dmasg *desc, temp_desc; | 179 | struct dmasg *desc, temp_desc; |
180 | unsigned long flags; | 180 | unsigned long flags; |
181 | 181 | ||
182 | BUG_ON(sport->dummy_rx_desc == NULL); | 182 | if (WARN_ON(!sport->dummy_rx_desc) || |
183 | BUG_ON(sport->curr_rx_desc == sport->dummy_rx_desc); | 183 | WARN_ON(sport->curr_rx_desc == sport->dummy_rx_desc)) |
184 | return -EINVAL; | ||
184 | 185 | ||
185 | /* Maybe the dummy buffer descriptor ring is damaged */ | 186 | /* Maybe the dummy buffer descriptor ring is damaged */ |
186 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; | 187 | sport->dummy_rx_desc->next_desc_addr = sport->dummy_rx_desc + 1; |
@@ -250,8 +251,9 @@ int sport_rx_start(struct sport_device *sport) | |||
250 | return -EBUSY; | 251 | return -EBUSY; |
251 | if (sport->tx_run) { | 252 | if (sport->tx_run) { |
252 | /* tx is running, rx is not running */ | 253 | /* tx is running, rx is not running */ |
253 | BUG_ON(sport->dma_rx_desc == NULL); | 254 | if (WARN_ON(!sport->dma_rx_desc) || |
254 | BUG_ON(sport->curr_rx_desc != sport->dummy_rx_desc); | 255 | WARN_ON(sport->curr_rx_desc != sport->dummy_rx_desc)) |
256 | return -EINVAL; | ||
255 | local_irq_save(flags); | 257 | local_irq_save(flags); |
256 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - | 258 | while ((get_dma_curr_desc_ptr(sport->dma_rx_chan) - |
257 | sizeof(struct dmasg)) != sport->dummy_rx_desc) | 259 | sizeof(struct dmasg)) != sport->dummy_rx_desc) |
@@ -298,8 +300,9 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport) | |||
298 | struct dmasg *desc, temp_desc; | 300 | struct dmasg *desc, temp_desc; |
299 | unsigned long flags; | 301 | unsigned long flags; |
300 | 302 | ||
301 | BUG_ON(sport->dummy_tx_desc == NULL); | 303 | if (WARN_ON(!sport->dummy_tx_desc) || |
302 | BUG_ON(sport->curr_tx_desc == sport->dummy_tx_desc); | 304 | WARN_ON(sport->curr_tx_desc == sport->dummy_tx_desc)) |
305 | return -EINVAL; | ||
303 | 306 | ||
304 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; | 307 | sport->dummy_tx_desc->next_desc_addr = sport->dummy_tx_desc + 1; |
305 | 308 | ||
@@ -331,8 +334,9 @@ int sport_tx_start(struct sport_device *sport) | |||
331 | if (sport->tx_run) | 334 | if (sport->tx_run) |
332 | return -EBUSY; | 335 | return -EBUSY; |
333 | if (sport->rx_run) { | 336 | if (sport->rx_run) { |
334 | BUG_ON(sport->dma_tx_desc == NULL); | 337 | if (WARN_ON(!sport->dma_tx_desc) || |
335 | BUG_ON(sport->curr_tx_desc != sport->dummy_tx_desc); | 338 | WARN_ON(sport->curr_tx_desc != sport->dummy_tx_desc)) |
339 | return -EINVAL; | ||
336 | /* Hook the normal buffer descriptor */ | 340 | /* Hook the normal buffer descriptor */ |
337 | local_irq_save(flags); | 341 | local_irq_save(flags); |
338 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - | 342 | while ((get_dma_curr_desc_ptr(sport->dma_tx_chan) - |
@@ -767,7 +771,8 @@ static irqreturn_t err_handler(int irq, void *dev_id) | |||
767 | int sport_set_rx_callback(struct sport_device *sport, | 771 | int sport_set_rx_callback(struct sport_device *sport, |
768 | void (*rx_callback)(void *), void *rx_data) | 772 | void (*rx_callback)(void *), void *rx_data) |
769 | { | 773 | { |
770 | BUG_ON(rx_callback == NULL); | 774 | if (WARN_ON(!rx_callback)) |
775 | return -EINVAL; | ||
771 | sport->rx_callback = rx_callback; | 776 | sport->rx_callback = rx_callback; |
772 | sport->rx_data = rx_data; | 777 | sport->rx_data = rx_data; |
773 | 778 | ||
@@ -778,7 +783,8 @@ EXPORT_SYMBOL(sport_set_rx_callback); | |||
778 | int sport_set_tx_callback(struct sport_device *sport, | 783 | int sport_set_tx_callback(struct sport_device *sport, |
779 | void (*tx_callback)(void *), void *tx_data) | 784 | void (*tx_callback)(void *), void *tx_data) |
780 | { | 785 | { |
781 | BUG_ON(tx_callback == NULL); | 786 | if (WARN_ON(!tx_callback)) |
787 | return -EINVAL; | ||
782 | sport->tx_callback = tx_callback; | 788 | sport->tx_callback = tx_callback; |
783 | sport->tx_data = tx_data; | 789 | sport->tx_data = tx_data; |
784 | 790 | ||
@@ -789,7 +795,8 @@ EXPORT_SYMBOL(sport_set_tx_callback); | |||
789 | int sport_set_err_callback(struct sport_device *sport, | 795 | int sport_set_err_callback(struct sport_device *sport, |
790 | void (*err_callback)(void *), void *err_data) | 796 | void (*err_callback)(void *), void *err_data) |
791 | { | 797 | { |
792 | BUG_ON(err_callback == NULL); | 798 | if (WARN_ON(!err_callback)) |
799 | return -EINVAL; | ||
793 | sport->err_callback = err_callback; | 800 | sport->err_callback = err_callback; |
794 | sport->err_data = err_data; | 801 | sport->err_data = err_data; |
795 | 802 | ||
@@ -856,7 +863,8 @@ struct sport_device *sport_init(struct platform_device *pdev, | |||
856 | 863 | ||
857 | param.wdsize = wdsize; | 864 | param.wdsize = wdsize; |
858 | param.dummy_count = dummy_count; | 865 | param.dummy_count = dummy_count; |
859 | BUG_ON(param.wdsize == 0 || param.dummy_count == 0); | 866 | if (WARN_ON(param.wdsize == 0 || param.dummy_count == 0)) |
867 | return NULL; | ||
860 | 868 | ||
861 | ret = sport_config_pdev(pdev, ¶m); | 869 | ret = sport_config_pdev(pdev, ¶m); |
862 | if (ret) | 870 | if (ret) |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 66ceee22fdad..53d7dab4e054 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
@@ -568,8 +568,9 @@ static void m98088_eq_band(struct snd_soc_codec *codec, unsigned int dai, | |||
568 | unsigned int eq_reg; | 568 | unsigned int eq_reg; |
569 | unsigned int i; | 569 | unsigned int i; |
570 | 570 | ||
571 | BUG_ON(band > 4); | 571 | if (WARN_ON(band > 4) || |
572 | BUG_ON(dai > 1); | 572 | WARN_ON(dai > 1)) |
573 | return; | ||
573 | 574 | ||
574 | /* Load the base register address */ | 575 | /* Load the base register address */ |
575 | eq_reg = dai ? M98088_REG_84_DAI2_EQ_BASE : M98088_REG_52_DAI1_EQ_BASE; | 576 | eq_reg = dai ? M98088_REG_84_DAI2_EQ_BASE : M98088_REG_52_DAI1_EQ_BASE; |
@@ -909,7 +910,8 @@ static int max98088_line_pga(struct snd_soc_dapm_widget *w, | |||
909 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); | 910 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); |
910 | u8 *state; | 911 | u8 *state; |
911 | 912 | ||
912 | BUG_ON(!((channel == 1) || (channel == 2))); | 913 | if (WARN_ON(!(channel == 1 || channel == 2))) |
914 | return -EINVAL; | ||
913 | 915 | ||
914 | switch (line) { | 916 | switch (line) { |
915 | case LINE_INA: | 917 | case LINE_INA: |
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 8fb072455802..67244315c721 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c | |||
@@ -516,8 +516,9 @@ static void m98095_eq_band(struct snd_soc_codec *codec, unsigned int dai, | |||
516 | unsigned int eq_reg; | 516 | unsigned int eq_reg; |
517 | unsigned int i; | 517 | unsigned int i; |
518 | 518 | ||
519 | BUG_ON(band > 4); | 519 | if (WARN_ON(band > 4) || |
520 | BUG_ON(dai > 1); | 520 | WARN_ON(dai > 1)) |
521 | return; | ||
521 | 522 | ||
522 | /* Load the base register address */ | 523 | /* Load the base register address */ |
523 | eq_reg = dai ? M98095_142_DAI2_EQ_BASE : M98095_110_DAI1_EQ_BASE; | 524 | eq_reg = dai ? M98095_142_DAI2_EQ_BASE : M98095_110_DAI1_EQ_BASE; |
@@ -541,8 +542,9 @@ static void m98095_biquad_band(struct snd_soc_codec *codec, unsigned int dai, | |||
541 | unsigned int bq_reg; | 542 | unsigned int bq_reg; |
542 | unsigned int i; | 543 | unsigned int i; |
543 | 544 | ||
544 | BUG_ON(band > 1); | 545 | if (WARN_ON(band > 1) || |
545 | BUG_ON(dai > 1); | 546 | WARN_ON(dai > 1)) |
547 | return; | ||
546 | 548 | ||
547 | /* Load the base register address */ | 549 | /* Load the base register address */ |
548 | bq_reg = dai ? M98095_17E_DAI2_BQ_BASE : M98095_174_DAI1_BQ_BASE; | 550 | bq_reg = dai ? M98095_17E_DAI2_BQ_BASE : M98095_174_DAI1_BQ_BASE; |
@@ -890,7 +892,8 @@ static int max98095_line_pga(struct snd_soc_dapm_widget *w, | |||
890 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); | 892 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); |
891 | u8 *state; | 893 | u8 *state; |
892 | 894 | ||
893 | BUG_ON(!((channel == 1) || (channel == 2))); | 895 | if (WARN_ON(!(channel == 1 || channel == 2))) |
896 | return -EINVAL; | ||
894 | 897 | ||
895 | state = &max98095->lin_state; | 898 | state = &max98095->lin_state; |
896 | 899 | ||
@@ -1740,7 +1743,8 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, | |||
1740 | int fs, best, best_val, i; | 1743 | int fs, best, best_val, i; |
1741 | int regmask, regsave; | 1744 | int regmask, regsave; |
1742 | 1745 | ||
1743 | BUG_ON(channel > 1); | 1746 | if (WARN_ON(channel > 1)) |
1747 | return -EINVAL; | ||
1744 | 1748 | ||
1745 | if (!pdata || !max98095->eq_textcnt) | 1749 | if (!pdata || !max98095->eq_textcnt) |
1746 | return 0; | 1750 | return 0; |
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 998555f2a8aa..b27c396037d4 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -56,7 +56,8 @@ static int tpa6130a2_i2c_read(int reg) | |||
56 | struct tpa6130a2_data *data; | 56 | struct tpa6130a2_data *data; |
57 | int val; | 57 | int val; |
58 | 58 | ||
59 | BUG_ON(tpa6130a2_client == NULL); | 59 | if (WARN_ON(!tpa6130a2_client)) |
60 | return -EINVAL; | ||
60 | data = i2c_get_clientdata(tpa6130a2_client); | 61 | data = i2c_get_clientdata(tpa6130a2_client); |
61 | 62 | ||
62 | /* If powered off, return the cached value */ | 63 | /* If powered off, return the cached value */ |
@@ -78,7 +79,8 @@ static int tpa6130a2_i2c_write(int reg, u8 value) | |||
78 | struct tpa6130a2_data *data; | 79 | struct tpa6130a2_data *data; |
79 | int val = 0; | 80 | int val = 0; |
80 | 81 | ||
81 | BUG_ON(tpa6130a2_client == NULL); | 82 | if (WARN_ON(!tpa6130a2_client)) |
83 | return -EINVAL; | ||
82 | data = i2c_get_clientdata(tpa6130a2_client); | 84 | data = i2c_get_clientdata(tpa6130a2_client); |
83 | 85 | ||
84 | if (data->power_state) { | 86 | if (data->power_state) { |
@@ -99,7 +101,8 @@ static u8 tpa6130a2_read(int reg) | |||
99 | { | 101 | { |
100 | struct tpa6130a2_data *data; | 102 | struct tpa6130a2_data *data; |
101 | 103 | ||
102 | BUG_ON(tpa6130a2_client == NULL); | 104 | if (WARN_ON(!tpa6130a2_client)) |
105 | return 0; | ||
103 | data = i2c_get_clientdata(tpa6130a2_client); | 106 | data = i2c_get_clientdata(tpa6130a2_client); |
104 | 107 | ||
105 | return data->regs[reg]; | 108 | return data->regs[reg]; |
@@ -110,7 +113,8 @@ static int tpa6130a2_initialize(void) | |||
110 | struct tpa6130a2_data *data; | 113 | struct tpa6130a2_data *data; |
111 | int i, ret = 0; | 114 | int i, ret = 0; |
112 | 115 | ||
113 | BUG_ON(tpa6130a2_client == NULL); | 116 | if (WARN_ON(!tpa6130a2_client)) |
117 | return -EINVAL; | ||
114 | data = i2c_get_clientdata(tpa6130a2_client); | 118 | data = i2c_get_clientdata(tpa6130a2_client); |
115 | 119 | ||
116 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { | 120 | for (i = 1; i < TPA6130A2_REG_VERSION; i++) { |
@@ -128,7 +132,8 @@ static int tpa6130a2_power(u8 power) | |||
128 | u8 val; | 132 | u8 val; |
129 | int ret = 0; | 133 | int ret = 0; |
130 | 134 | ||
131 | BUG_ON(tpa6130a2_client == NULL); | 135 | if (WARN_ON(!tpa6130a2_client)) |
136 | return -EINVAL; | ||
132 | data = i2c_get_clientdata(tpa6130a2_client); | 137 | data = i2c_get_clientdata(tpa6130a2_client); |
133 | 138 | ||
134 | mutex_lock(&data->mutex); | 139 | mutex_lock(&data->mutex); |
@@ -194,7 +199,8 @@ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, | |||
194 | unsigned int mask = (1 << fls(max)) - 1; | 199 | unsigned int mask = (1 << fls(max)) - 1; |
195 | unsigned int invert = mc->invert; | 200 | unsigned int invert = mc->invert; |
196 | 201 | ||
197 | BUG_ON(tpa6130a2_client == NULL); | 202 | if (WARN_ON(!tpa6130a2_client)) |
203 | return -EINVAL; | ||
198 | data = i2c_get_clientdata(tpa6130a2_client); | 204 | data = i2c_get_clientdata(tpa6130a2_client); |
199 | 205 | ||
200 | mutex_lock(&data->mutex); | 206 | mutex_lock(&data->mutex); |
@@ -224,7 +230,8 @@ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol, | |||
224 | unsigned int val = (ucontrol->value.integer.value[0] & mask); | 230 | unsigned int val = (ucontrol->value.integer.value[0] & mask); |
225 | unsigned int val_reg; | 231 | unsigned int val_reg; |
226 | 232 | ||
227 | BUG_ON(tpa6130a2_client == NULL); | 233 | if (WARN_ON(!tpa6130a2_client)) |
234 | return -EINVAL; | ||
228 | data = i2c_get_clientdata(tpa6130a2_client); | 235 | data = i2c_get_clientdata(tpa6130a2_client); |
229 | 236 | ||
230 | if (invert) | 237 | if (invert) |
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index bf7804a12863..71ce3159a62e 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c | |||
@@ -372,7 +372,8 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec) | |||
372 | offset = 0; | 372 | offset = 0; |
373 | dsp = inforec->dsp_target; | 373 | dsp = inforec->dsp_target; |
374 | wm0010->boot_failed = false; | 374 | wm0010->boot_failed = false; |
375 | BUG_ON(!list_empty(&xfer_list)); | 375 | if (WARN_ON(!list_empty(&xfer_list))) |
376 | return -EINVAL; | ||
376 | init_completion(&done); | 377 | init_completion(&done); |
377 | 378 | ||
378 | /* First record should be INFO */ | 379 | /* First record should be INFO */ |
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 7fefd766b582..8ae50274ea8f 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -137,7 +137,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) | |||
137 | unsigned long rate; | 137 | unsigned long rate; |
138 | int ret; | 138 | int ret; |
139 | 139 | ||
140 | BUG_ON(wm2000->anc_mode != ANC_OFF); | 140 | if (WARN_ON(wm2000->anc_mode != ANC_OFF)) |
141 | return -EINVAL; | ||
141 | 142 | ||
142 | dev_dbg(&i2c->dev, "Beginning power up\n"); | 143 | dev_dbg(&i2c->dev, "Beginning power up\n"); |
143 | 144 | ||
@@ -277,7 +278,8 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue) | |||
277 | { | 278 | { |
278 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); | 279 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); |
279 | 280 | ||
280 | BUG_ON(wm2000->anc_mode != ANC_ACTIVE); | 281 | if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE)) |
282 | return -EINVAL; | ||
281 | 283 | ||
282 | if (analogue) { | 284 | if (analogue) { |
283 | wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, | 285 | wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, |
@@ -315,7 +317,8 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue) | |||
315 | { | 317 | { |
316 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); | 318 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); |
317 | 319 | ||
318 | BUG_ON(wm2000->anc_mode != ANC_BYPASS); | 320 | if (WARN_ON(wm2000->anc_mode != ANC_BYPASS)) |
321 | return -EINVAL; | ||
319 | 322 | ||
320 | wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); | 323 | wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); |
321 | 324 | ||
@@ -349,7 +352,8 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue) | |||
349 | { | 352 | { |
350 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); | 353 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); |
351 | 354 | ||
352 | BUG_ON(wm2000->anc_mode != ANC_ACTIVE); | 355 | if (WARN_ON(wm2000->anc_mode != ANC_ACTIVE)) |
356 | return -EINVAL; | ||
353 | 357 | ||
354 | if (analogue) { | 358 | if (analogue) { |
355 | wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4); | 359 | wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4); |
@@ -392,7 +396,8 @@ static int wm2000_exit_standby(struct i2c_client *i2c, int analogue) | |||
392 | { | 396 | { |
393 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); | 397 | struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); |
394 | 398 | ||
395 | BUG_ON(wm2000->anc_mode != ANC_STANDBY); | 399 | if (WARN_ON(wm2000->anc_mode != ANC_STANDBY)) |
400 | return -EINVAL; | ||
396 | 401 | ||
397 | wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); | 402 | wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); |
398 | 403 | ||
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index ac1745d030d6..4cf91deabc02 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c | |||
@@ -1972,7 +1972,8 @@ static void wm5100_set_detect_mode(struct wm5100_priv *wm5100, int the_mode) | |||
1972 | { | 1972 | { |
1973 | struct wm5100_jack_mode *mode = &wm5100->pdata.jack_modes[the_mode]; | 1973 | struct wm5100_jack_mode *mode = &wm5100->pdata.jack_modes[the_mode]; |
1974 | 1974 | ||
1975 | BUG_ON(the_mode >= ARRAY_SIZE(wm5100->pdata.jack_modes)); | 1975 | if (WARN_ON(the_mode >= ARRAY_SIZE(wm5100->pdata.jack_modes))) |
1976 | return; | ||
1976 | 1977 | ||
1977 | gpio_set_value_cansleep(wm5100->pdata.hp_pol, mode->hp_pol); | 1978 | gpio_set_value_cansleep(wm5100->pdata.hp_pol, mode->hp_pol); |
1978 | regmap_update_bits(wm5100->regmap, WM5100_ACCESSORY_DETECT_MODE_1, | 1979 | regmap_update_bits(wm5100->regmap, WM5100_ACCESSORY_DETECT_MODE_1, |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index af1318ddb062..a183dcf3d5c1 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -274,7 +274,7 @@ static int pga_event(struct snd_soc_dapm_widget *w, | |||
274 | break; | 274 | break; |
275 | 275 | ||
276 | default: | 276 | default: |
277 | BUG(); | 277 | WARN(1, "Invalid shift %d\n", w->shift); |
278 | return -1; | 278 | return -1; |
279 | } | 279 | } |
280 | 280 | ||
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 5e9c40fa7eb2..08a414b57b1e 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -736,7 +736,7 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
736 | break; | 736 | break; |
737 | 737 | ||
738 | default: | 738 | default: |
739 | BUG_ON("Unknown DAI driver ID\n"); | 739 | WARN(1, "Unknown DAI driver ID\n"); |
740 | return -EINVAL; | 740 | return -EINVAL; |
741 | } | 741 | } |
742 | 742 | ||
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index f31017ed1381..942d58e455f3 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -325,7 +325,8 @@ static int wm8776_set_sysclk(struct snd_soc_dai *dai, | |||
325 | struct snd_soc_codec *codec = dai->codec; | 325 | struct snd_soc_codec *codec = dai->codec; |
326 | struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); | 326 | struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); |
327 | 327 | ||
328 | BUG_ON(dai->driver->id >= ARRAY_SIZE(wm8776->sysclk)); | 328 | if (WARN_ON(dai->driver->id >= ARRAY_SIZE(wm8776->sysclk))) |
329 | return -EINVAL; | ||
329 | 330 | ||
330 | wm8776->sysclk[dai->driver->id] = freq; | 331 | wm8776->sysclk[dai->driver->id] = freq; |
331 | 332 | ||
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 7c8257c5a17b..734209e252c3 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -279,7 +279,8 @@ static int wm8900_hp_event(struct snd_soc_dapm_widget *w, | |||
279 | break; | 279 | break; |
280 | 280 | ||
281 | default: | 281 | default: |
282 | BUG(); | 282 | WARN(1, "Invalid event %d\n", event); |
283 | break; | ||
283 | } | 284 | } |
284 | 285 | ||
285 | return 0; | 286 | return 0; |
@@ -691,7 +692,8 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | |||
691 | unsigned int K, Ndiv, Nmod, target; | 692 | unsigned int K, Ndiv, Nmod, target; |
692 | unsigned int div; | 693 | unsigned int div; |
693 | 694 | ||
694 | BUG_ON(!Fout); | 695 | if (WARN_ON(!Fout)) |
696 | return -EINVAL; | ||
695 | 697 | ||
696 | /* The FLL must run at 90-100MHz which is then scaled down to | 698 | /* The FLL must run at 90-100MHz which is then scaled down to |
697 | * the output value by FLLCLK_DIV. */ | 699 | * the output value by FLLCLK_DIV. */ |
@@ -742,8 +744,9 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | |||
742 | /* Move down to proper range now rounding is done */ | 744 | /* Move down to proper range now rounding is done */ |
743 | fll_div->k = K / 10; | 745 | fll_div->k = K / 10; |
744 | 746 | ||
745 | BUG_ON(target != Fout * (fll_div->fllclk_div << 2)); | 747 | if (WARN_ON(target != Fout * (fll_div->fllclk_div << 2)) || |
746 | BUG_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n); | 748 | WARN_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n)) |
749 | return -EINVAL; | ||
747 | 750 | ||
748 | return 0; | 751 | return 0; |
749 | } | 752 | } |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 4dfa8dceeabf..3938fb1c203e 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -658,7 +658,8 @@ SOC_SINGLE_TLV("EQ5 Volume", WM8904_EQ6, 0, 24, 0, eq_tlv), | |||
658 | static int cp_event(struct snd_soc_dapm_widget *w, | 658 | static int cp_event(struct snd_soc_dapm_widget *w, |
659 | struct snd_kcontrol *kcontrol, int event) | 659 | struct snd_kcontrol *kcontrol, int event) |
660 | { | 660 | { |
661 | BUG_ON(event != SND_SOC_DAPM_POST_PMU); | 661 | if (WARN_ON(event != SND_SOC_DAPM_POST_PMU)) |
662 | return -EINVAL; | ||
662 | 663 | ||
663 | /* Maximum startup time */ | 664 | /* Maximum startup time */ |
664 | udelay(500); | 665 | udelay(500); |
@@ -740,7 +741,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
740 | dcs_r = 3; | 741 | dcs_r = 3; |
741 | break; | 742 | break; |
742 | default: | 743 | default: |
743 | BUG(); | 744 | WARN(1, "Invalid reg %d\n", reg); |
744 | return -EINVAL; | 745 | return -EINVAL; |
745 | } | 746 | } |
746 | 747 | ||
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index b0710d817a65..b7488f190d2b 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -348,7 +348,7 @@ static void wm8958_dsp_apply(struct snd_soc_codec *codec, int path, int start) | |||
348 | aif = 1; | 348 | aif = 1; |
349 | break; | 349 | break; |
350 | default: | 350 | default: |
351 | BUG(); | 351 | WARN(1, "Invalid path %d\n", path); |
352 | return; | 352 | return; |
353 | } | 353 | } |
354 | 354 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 3a2f96c5442c..ac1ff9947a90 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -1853,7 +1853,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
1853 | break; | 1853 | break; |
1854 | 1854 | ||
1855 | default: | 1855 | default: |
1856 | BUG(); | 1856 | WARN(1, "Invalid event %d\n", event); |
1857 | return -EINVAL; | 1857 | return -EINVAL; |
1858 | } | 1858 | } |
1859 | 1859 | ||
@@ -1945,7 +1945,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, | |||
1945 | break; | 1945 | break; |
1946 | 1946 | ||
1947 | default: | 1947 | default: |
1948 | BUG(); | 1948 | WARN(1, "Invalid event %d\n", event); |
1949 | return -EINVAL; | 1949 | return -EINVAL; |
1950 | 1950 | ||
1951 | } | 1951 | } |
@@ -1974,7 +1974,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
1974 | reg = WM8962_SPKOUTL_VOLUME; | 1974 | reg = WM8962_SPKOUTL_VOLUME; |
1975 | break; | 1975 | break; |
1976 | default: | 1976 | default: |
1977 | BUG(); | 1977 | WARN(1, "Invalid shift %d\n", w->shift); |
1978 | return -EINVAL; | 1978 | return -EINVAL; |
1979 | } | 1979 | } |
1980 | 1980 | ||
@@ -1982,7 +1982,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
1982 | case SND_SOC_DAPM_POST_PMU: | 1982 | case SND_SOC_DAPM_POST_PMU: |
1983 | return snd_soc_write(codec, reg, snd_soc_read(codec, reg)); | 1983 | return snd_soc_write(codec, reg, snd_soc_read(codec, reg)); |
1984 | default: | 1984 | default: |
1985 | BUG(); | 1985 | WARN(1, "Invalid event %d\n", event); |
1986 | return -EINVAL; | 1986 | return -EINVAL; |
1987 | } | 1987 | } |
1988 | } | 1988 | } |
@@ -2005,7 +2005,7 @@ static int dsp2_event(struct snd_soc_dapm_widget *w, | |||
2005 | break; | 2005 | break; |
2006 | 2006 | ||
2007 | default: | 2007 | default: |
2008 | BUG(); | 2008 | WARN(1, "Invalid event %d\n", event); |
2009 | return -EINVAL; | 2009 | return -EINVAL; |
2010 | } | 2010 | } |
2011 | 2011 | ||
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index b70379ebd142..1a7655b0aa22 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -610,7 +610,7 @@ static int bg_event(struct snd_soc_dapm_widget *w, | |||
610 | wm8996_bg_disable(codec); | 610 | wm8996_bg_disable(codec); |
611 | break; | 611 | break; |
612 | default: | 612 | default: |
613 | BUG(); | 613 | WARN(1, "Invalid event %d\n", event); |
614 | ret = -EINVAL; | 614 | ret = -EINVAL; |
615 | } | 615 | } |
616 | 616 | ||
@@ -627,7 +627,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
627 | msleep(5); | 627 | msleep(5); |
628 | break; | 628 | break; |
629 | default: | 629 | default: |
630 | BUG(); | 630 | WARN(1, "Invalid event %d\n", event); |
631 | ret = -EINVAL; | 631 | ret = -EINVAL; |
632 | } | 632 | } |
633 | 633 | ||
@@ -648,7 +648,7 @@ static int rmv_short_event(struct snd_soc_dapm_widget *w, | |||
648 | wm8996->hpout_pending |= w->shift; | 648 | wm8996->hpout_pending |= w->shift; |
649 | break; | 649 | break; |
650 | default: | 650 | default: |
651 | BUG(); | 651 | WARN(1, "Invalid event %d\n", event); |
652 | return -EINVAL; | 652 | return -EINVAL; |
653 | } | 653 | } |
654 | 654 | ||
@@ -769,7 +769,7 @@ static int dcs_start(struct snd_soc_dapm_widget *w, | |||
769 | wm8996->dcs_pending |= 1 << w->shift; | 769 | wm8996->dcs_pending |= 1 << w->shift; |
770 | break; | 770 | break; |
771 | default: | 771 | default: |
772 | BUG(); | 772 | WARN(1, "Invalid event %d\n", event); |
773 | return -EINVAL; | 773 | return -EINVAL; |
774 | } | 774 | } |
775 | 775 | ||
@@ -1658,7 +1658,7 @@ static int wm8996_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
1658 | lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2; | 1658 | lrclk_rx_reg = WM8996_AIF2_RX_LRCLK_2; |
1659 | break; | 1659 | break; |
1660 | default: | 1660 | default: |
1661 | BUG(); | 1661 | WARN(1, "Invalid dai id %d\n", dai->id); |
1662 | return -EINVAL; | 1662 | return -EINVAL; |
1663 | } | 1663 | } |
1664 | 1664 | ||
@@ -1770,7 +1770,7 @@ static int wm8996_hw_params(struct snd_pcm_substream *substream, | |||
1770 | dsp_shift = WM8996_DSP2_DIV_SHIFT; | 1770 | dsp_shift = WM8996_DSP2_DIV_SHIFT; |
1771 | break; | 1771 | break; |
1772 | default: | 1772 | default: |
1773 | BUG(); | 1773 | WARN(1, "Invalid dai id %d\n", dai->id); |
1774 | return -EINVAL; | 1774 | return -EINVAL; |
1775 | } | 1775 | } |
1776 | 1776 | ||
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index a53e175c015a..acea8927905b 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -221,7 +221,8 @@ static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w, | |||
221 | struct snd_soc_codec *codec = w->codec; | 221 | struct snd_soc_codec *codec = w->codec; |
222 | u16 status, rate; | 222 | u16 status, rate; |
223 | 223 | ||
224 | BUG_ON(event != SND_SOC_DAPM_PRE_PMD); | 224 | if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD)) |
225 | return -EINVAL; | ||
225 | 226 | ||
226 | /* Gracefully shut down the voice interface. */ | 227 | /* Gracefully shut down the voice interface. */ |
227 | status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000; | 228 | status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000; |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 53b6033658a6..46ec0e9744d4 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -341,6 +341,8 @@ static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, | |||
341 | static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, | 341 | static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, |
342 | unsigned int offset) | 342 | unsigned int offset) |
343 | { | 343 | { |
344 | if (WARN_ON(!region)) | ||
345 | return offset; | ||
344 | switch (region->type) { | 346 | switch (region->type) { |
345 | case WMFW_ADSP1_PM: | 347 | case WMFW_ADSP1_PM: |
346 | return region->base + (offset * 3); | 348 | return region->base + (offset * 3); |
@@ -353,7 +355,7 @@ static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region, | |||
353 | case WMFW_ADSP1_ZM: | 355 | case WMFW_ADSP1_ZM: |
354 | return region->base + (offset * 2); | 356 | return region->base + (offset * 2); |
355 | default: | 357 | default: |
356 | WARN_ON(NULL != "Unknown memory region type"); | 358 | WARN(1, "Unknown memory region type"); |
357 | return offset; | 359 | return offset; |
358 | } | 360 | } |
359 | } | 361 | } |
@@ -605,7 +607,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
605 | break; | 607 | break; |
606 | 608 | ||
607 | default: | 609 | default: |
608 | BUG_ON(NULL == "Unknown DSP type"); | 610 | WARN(1, "Unknown DSP type"); |
609 | goto out_fw; | 611 | goto out_fw; |
610 | } | 612 | } |
611 | 613 | ||
@@ -645,27 +647,22 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
645 | reg = offset; | 647 | reg = offset; |
646 | break; | 648 | break; |
647 | case WMFW_ADSP1_PM: | 649 | case WMFW_ADSP1_PM: |
648 | BUG_ON(!mem); | ||
649 | region_name = "PM"; | 650 | region_name = "PM"; |
650 | reg = wm_adsp_region_to_reg(mem, offset); | 651 | reg = wm_adsp_region_to_reg(mem, offset); |
651 | break; | 652 | break; |
652 | case WMFW_ADSP1_DM: | 653 | case WMFW_ADSP1_DM: |
653 | BUG_ON(!mem); | ||
654 | region_name = "DM"; | 654 | region_name = "DM"; |
655 | reg = wm_adsp_region_to_reg(mem, offset); | 655 | reg = wm_adsp_region_to_reg(mem, offset); |
656 | break; | 656 | break; |
657 | case WMFW_ADSP2_XM: | 657 | case WMFW_ADSP2_XM: |
658 | BUG_ON(!mem); | ||
659 | region_name = "XM"; | 658 | region_name = "XM"; |
660 | reg = wm_adsp_region_to_reg(mem, offset); | 659 | reg = wm_adsp_region_to_reg(mem, offset); |
661 | break; | 660 | break; |
662 | case WMFW_ADSP2_YM: | 661 | case WMFW_ADSP2_YM: |
663 | BUG_ON(!mem); | ||
664 | region_name = "YM"; | 662 | region_name = "YM"; |
665 | reg = wm_adsp_region_to_reg(mem, offset); | 663 | reg = wm_adsp_region_to_reg(mem, offset); |
666 | break; | 664 | break; |
667 | case WMFW_ADSP1_ZM: | 665 | case WMFW_ADSP1_ZM: |
668 | BUG_ON(!mem); | ||
669 | region_name = "ZM"; | 666 | region_name = "ZM"; |
670 | reg = wm_adsp_region_to_reg(mem, offset); | 667 | reg = wm_adsp_region_to_reg(mem, offset); |
671 | break; | 668 | break; |
@@ -905,10 +902,8 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
905 | break; | 902 | break; |
906 | } | 903 | } |
907 | 904 | ||
908 | if (mem == NULL) { | 905 | if (WARN_ON(!mem)) |
909 | BUG_ON(mem != NULL); | ||
910 | return -EINVAL; | 906 | return -EINVAL; |
911 | } | ||
912 | 907 | ||
913 | switch (dsp->type) { | 908 | switch (dsp->type) { |
914 | case WMFW_ADSP1: | 909 | case WMFW_ADSP1: |
@@ -1002,7 +997,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1002 | break; | 997 | break; |
1003 | 998 | ||
1004 | default: | 999 | default: |
1005 | BUG_ON(NULL == "Unknown DSP type"); | 1000 | WARN(1, "Unknown DSP type"); |
1006 | return -EINVAL; | 1001 | return -EINVAL; |
1007 | } | 1002 | } |
1008 | 1003 | ||
@@ -1066,6 +1061,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1066 | if (i + 1 < algs) { | 1061 | if (i + 1 < algs) { |
1067 | region->len = be32_to_cpu(adsp1_alg[i + 1].dm); | 1062 | region->len = be32_to_cpu(adsp1_alg[i + 1].dm); |
1068 | region->len -= be32_to_cpu(adsp1_alg[i].dm); | 1063 | region->len -= be32_to_cpu(adsp1_alg[i].dm); |
1064 | region->len *= 4; | ||
1069 | wm_adsp_create_control(dsp, region); | 1065 | wm_adsp_create_control(dsp, region); |
1070 | } else { | 1066 | } else { |
1071 | adsp_warn(dsp, "Missing length info for region DM with ID %x\n", | 1067 | adsp_warn(dsp, "Missing length info for region DM with ID %x\n", |
@@ -1083,6 +1079,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1083 | if (i + 1 < algs) { | 1079 | if (i + 1 < algs) { |
1084 | region->len = be32_to_cpu(adsp1_alg[i + 1].zm); | 1080 | region->len = be32_to_cpu(adsp1_alg[i + 1].zm); |
1085 | region->len -= be32_to_cpu(adsp1_alg[i].zm); | 1081 | region->len -= be32_to_cpu(adsp1_alg[i].zm); |
1082 | region->len *= 4; | ||
1086 | wm_adsp_create_control(dsp, region); | 1083 | wm_adsp_create_control(dsp, region); |
1087 | } else { | 1084 | } else { |
1088 | adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", | 1085 | adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", |
@@ -1112,6 +1109,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1112 | if (i + 1 < algs) { | 1109 | if (i + 1 < algs) { |
1113 | region->len = be32_to_cpu(adsp2_alg[i + 1].xm); | 1110 | region->len = be32_to_cpu(adsp2_alg[i + 1].xm); |
1114 | region->len -= be32_to_cpu(adsp2_alg[i].xm); | 1111 | region->len -= be32_to_cpu(adsp2_alg[i].xm); |
1112 | region->len *= 4; | ||
1115 | wm_adsp_create_control(dsp, region); | 1113 | wm_adsp_create_control(dsp, region); |
1116 | } else { | 1114 | } else { |
1117 | adsp_warn(dsp, "Missing length info for region XM with ID %x\n", | 1115 | adsp_warn(dsp, "Missing length info for region XM with ID %x\n", |
@@ -1129,6 +1127,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1129 | if (i + 1 < algs) { | 1127 | if (i + 1 < algs) { |
1130 | region->len = be32_to_cpu(adsp2_alg[i + 1].ym); | 1128 | region->len = be32_to_cpu(adsp2_alg[i + 1].ym); |
1131 | region->len -= be32_to_cpu(adsp2_alg[i].ym); | 1129 | region->len -= be32_to_cpu(adsp2_alg[i].ym); |
1130 | region->len *= 4; | ||
1132 | wm_adsp_create_control(dsp, region); | 1131 | wm_adsp_create_control(dsp, region); |
1133 | } else { | 1132 | } else { |
1134 | adsp_warn(dsp, "Missing length info for region YM with ID %x\n", | 1133 | adsp_warn(dsp, "Missing length info for region YM with ID %x\n", |
@@ -1146,6 +1145,7 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1146 | if (i + 1 < algs) { | 1145 | if (i + 1 < algs) { |
1147 | region->len = be32_to_cpu(adsp2_alg[i + 1].zm); | 1146 | region->len = be32_to_cpu(adsp2_alg[i + 1].zm); |
1148 | region->len -= be32_to_cpu(adsp2_alg[i].zm); | 1147 | region->len -= be32_to_cpu(adsp2_alg[i].zm); |
1148 | region->len *= 4; | ||
1149 | wm_adsp_create_control(dsp, region); | 1149 | wm_adsp_create_control(dsp, region); |
1150 | } else { | 1150 | } else { |
1151 | adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", | 1151 | adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 01daf655e20b..b371066dd5bc 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -611,7 +611,7 @@ static int earpiece_event(struct snd_soc_dapm_widget *w, | |||
611 | break; | 611 | break; |
612 | 612 | ||
613 | default: | 613 | default: |
614 | BUG(); | 614 | WARN(1, "Invalid event %d\n", event); |
615 | break; | 615 | break; |
616 | } | 616 | } |
617 | 617 | ||
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 76c742a09ef9..55193a5596ca 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c | |||
@@ -1107,11 +1107,6 @@ static int fsl_spdif_probe(struct platform_device *pdev) | |||
1107 | 1107 | ||
1108 | /* Get the addresses and IRQ */ | 1108 | /* Get the addresses and IRQ */ |
1109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1109 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1110 | if (!res) { | ||
1111 | dev_err(&pdev->dev, "could not determine device resources\n"); | ||
1112 | return -ENXIO; | ||
1113 | } | ||
1114 | |||
1115 | regs = devm_ioremap_resource(&pdev->dev, res); | 1110 | regs = devm_ioremap_resource(&pdev->dev, res); |
1116 | if (IS_ERR(regs)) | 1111 | if (IS_ERR(regs)) |
1117 | return PTR_ERR(regs); | 1112 | return PTR_ERR(regs); |
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c index 34043c55f2a6..10e330514ed8 100644 --- a/sound/soc/fsl/imx-pcm-fiq.c +++ b/sound/soc/fsl/imx-pcm-fiq.c | |||
@@ -39,8 +39,6 @@ struct imx_pcm_runtime_data { | |||
39 | unsigned int period; | 39 | unsigned int period; |
40 | int periods; | 40 | int periods; |
41 | unsigned long offset; | 41 | unsigned long offset; |
42 | unsigned long last_offset; | ||
43 | unsigned long size; | ||
44 | struct hrtimer hrt; | 42 | struct hrtimer hrt; |
45 | int poll_time_ns; | 43 | int poll_time_ns; |
46 | struct snd_pcm_substream *substream; | 44 | struct snd_pcm_substream *substream; |
@@ -52,9 +50,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | |||
52 | struct imx_pcm_runtime_data *iprtd = | 50 | struct imx_pcm_runtime_data *iprtd = |
53 | container_of(hrt, struct imx_pcm_runtime_data, hrt); | 51 | container_of(hrt, struct imx_pcm_runtime_data, hrt); |
54 | struct snd_pcm_substream *substream = iprtd->substream; | 52 | struct snd_pcm_substream *substream = iprtd->substream; |
55 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
56 | struct pt_regs regs; | 53 | struct pt_regs regs; |
57 | unsigned long delta; | ||
58 | 54 | ||
59 | if (!atomic_read(&iprtd->running)) | 55 | if (!atomic_read(&iprtd->running)) |
60 | return HRTIMER_NORESTART; | 56 | return HRTIMER_NORESTART; |
@@ -66,19 +62,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) | |||
66 | else | 62 | else |
67 | iprtd->offset = regs.ARM_r9 & 0xffff; | 63 | iprtd->offset = regs.ARM_r9 & 0xffff; |
68 | 64 | ||
69 | /* How much data have we transferred since the last period report? */ | 65 | snd_pcm_period_elapsed(substream); |
70 | if (iprtd->offset >= iprtd->last_offset) | ||
71 | delta = iprtd->offset - iprtd->last_offset; | ||
72 | else | ||
73 | delta = runtime->buffer_size + iprtd->offset | ||
74 | - iprtd->last_offset; | ||
75 | |||
76 | /* If we've transferred at least a period then report it and | ||
77 | * reset our poll time */ | ||
78 | if (delta >= iprtd->period) { | ||
79 | snd_pcm_period_elapsed(substream); | ||
80 | iprtd->last_offset = iprtd->offset; | ||
81 | } | ||
82 | 66 | ||
83 | hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); | 67 | hrtimer_forward_now(hrt, ns_to_ktime(iprtd->poll_time_ns)); |
84 | 68 | ||
@@ -95,11 +79,9 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | |||
95 | struct snd_pcm_runtime *runtime = substream->runtime; | 79 | struct snd_pcm_runtime *runtime = substream->runtime; |
96 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 80 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
97 | 81 | ||
98 | iprtd->size = params_buffer_bytes(params); | ||
99 | iprtd->periods = params_periods(params); | 82 | iprtd->periods = params_periods(params); |
100 | iprtd->period = params_period_bytes(params) ; | 83 | iprtd->period = params_period_bytes(params); |
101 | iprtd->offset = 0; | 84 | iprtd->offset = 0; |
102 | iprtd->last_offset = 0; | ||
103 | iprtd->poll_time_ns = 1000000000 / params_rate(params) * | 85 | iprtd->poll_time_ns = 1000000000 / params_rate(params) * |
104 | params_period_size(params); | 86 | params_period_size(params); |
105 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 87 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 72064e995687..361f94f09b11 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c | |||
@@ -279,8 +279,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) | |||
279 | return 0; | 279 | return 0; |
280 | 280 | ||
281 | clk_fail: | 281 | clk_fail: |
282 | if (!IS_ERR(data->codec_clk)) | 282 | clk_disable_unprepare(data->codec_clk); |
283 | clk_disable_unprepare(data->codec_clk); | ||
284 | fail: | 283 | fail: |
285 | if (ssi_np) | 284 | if (ssi_np) |
286 | of_node_put(ssi_np); | 285 | of_node_put(ssi_np); |
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 392fc0b8f5b8..b6b5eb698d33 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c | |||
@@ -40,7 +40,8 @@ static DEFINE_MUTEX(sst_lock); | |||
40 | 40 | ||
41 | int sst_register_dsp(struct sst_device *dev) | 41 | int sst_register_dsp(struct sst_device *dev) |
42 | { | 42 | { |
43 | BUG_ON(!dev); | 43 | if (WARN_ON(!dev)) |
44 | return -EINVAL; | ||
44 | if (!try_module_get(dev->dev->driver->owner)) | 45 | if (!try_module_get(dev->dev->driver->owner)) |
45 | return -ENODEV; | 46 | return -ENODEV; |
46 | mutex_lock(&sst_lock); | 47 | mutex_lock(&sst_lock); |
@@ -59,7 +60,8 @@ EXPORT_SYMBOL_GPL(sst_register_dsp); | |||
59 | 60 | ||
60 | int sst_unregister_dsp(struct sst_device *dev) | 61 | int sst_unregister_dsp(struct sst_device *dev) |
61 | { | 62 | { |
62 | BUG_ON(!dev); | 63 | if (WARN_ON(!dev)) |
64 | return -EINVAL; | ||
63 | if (dev != sst) | 65 | if (dev != sst) |
64 | return -EINVAL; | 66 | return -EINVAL; |
65 | 67 | ||
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 5e8d640d314f..6d216cb6c19b 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
@@ -344,8 +344,11 @@ static int __init n810_soc_init(void) | |||
344 | clk_set_parent(sys_clkout2_src, func96m_clk); | 344 | clk_set_parent(sys_clkout2_src, func96m_clk); |
345 | clk_set_rate(sys_clkout2, 12000000); | 345 | clk_set_rate(sys_clkout2, 12000000); |
346 | 346 | ||
347 | BUG_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) || | 347 | if (WARN_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) || |
348 | (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0)); | 348 | (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0))) { |
349 | err = -EINVAL; | ||
350 | goto err4; | ||
351 | } | ||
349 | 352 | ||
350 | gpio_direction_output(N810_HEADSET_AMP_GPIO, 0); | 353 | gpio_direction_output(N810_HEADSET_AMP_GPIO, 0); |
351 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); | 354 | gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0); |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index d5340a088858..c0d648d3339f 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -165,7 +165,8 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
165 | { | 165 | { |
166 | struct snd_dmaengine_dai_dma_data *dma_data; | 166 | struct snd_dmaengine_dai_dma_data *dma_data; |
167 | 167 | ||
168 | BUG_ON(IS_ERR(clk_i2s)); | 168 | if (WARN_ON(IS_ERR(clk_i2s))) |
169 | return -EINVAL; | ||
169 | clk_prepare_enable(clk_i2s); | 170 | clk_prepare_enable(clk_i2s); |
170 | clk_ena = 1; | 171 | clk_ena = 1; |
171 | pxa_i2s_wait(); | 172 | pxa_i2s_wait(); |
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c index d0740a762963..5cfaa5464eba 100644 --- a/sound/soc/s6000/s6000-pcm.c +++ b/sound/soc/s6000/s6000-pcm.c | |||
@@ -90,7 +90,8 @@ static void s6000_pcm_enqueue_dma(struct snd_pcm_substream *substream) | |||
90 | return; | 90 | return; |
91 | } | 91 | } |
92 | 92 | ||
93 | BUG_ON(period_size & 15); | 93 | if (WARN_ON(period_size & 15)) |
94 | return; | ||
94 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), | 95 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), |
95 | src, dst, period_size); | 96 | src, dst, period_size); |
96 | 97 | ||
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 56d8ff6a402d..14011d90d70a 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig | |||
@@ -37,7 +37,6 @@ config SND_SOC_SH4_SIU | |||
37 | config SND_SOC_RCAR | 37 | config SND_SOC_RCAR |
38 | tristate "R-Car series SRU/SCU/SSIU/SSI support" | 38 | tristate "R-Car series SRU/SCU/SSIU/SSI support" |
39 | select SND_SIMPLE_CARD | 39 | select SND_SIMPLE_CARD |
40 | select RCAR_CLK_ADG | ||
41 | help | 40 | help |
42 | This option enables R-Car SUR/SCU/SSIU/SSI sound support | 41 | This option enables R-Car SUR/SCU/SSIU/SSI sound support |
43 | 42 | ||
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 1ab1bce6be7f..f4453e33a847 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c | |||
@@ -198,7 +198,8 @@ static struct rsnd_mod_ops rsnd_scu_ops = { | |||
198 | 198 | ||
199 | struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) | 199 | struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) |
200 | { | 200 | { |
201 | BUG_ON(id < 0 || id >= rsnd_scu_nr(priv)); | 201 | if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv))) |
202 | id = 0; | ||
202 | 203 | ||
203 | return &((struct rsnd_scu *)(priv->scu) + id)->mod; | 204 | return &((struct rsnd_scu *)(priv->scu) + id)->mod; |
204 | } | 205 | } |
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index b71cf9d7dd3f..5ac20cd5e006 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -611,7 +611,8 @@ struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv, | |||
611 | 611 | ||
612 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) | 612 | struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id) |
613 | { | 613 | { |
614 | BUG_ON(id < 0 || id >= rsnd_ssi_nr(priv)); | 614 | if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) |
615 | id = 0; | ||
615 | 616 | ||
616 | return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod; | 617 | return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod; |
617 | } | 618 | } |
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 9dc24ffa892a..d55babee14f8 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c | |||
@@ -543,7 +543,8 @@ static void siu_dai_shutdown(struct snd_pcm_substream *substream, | |||
543 | /* Stop the siu if the other stream is not using it */ | 543 | /* Stop the siu if the other stream is not using it */ |
544 | if (!port_info->play_cap) { | 544 | if (!port_info->play_cap) { |
545 | /* during stmread or stmwrite ? */ | 545 | /* during stmread or stmwrite ? */ |
546 | BUG_ON(port_info->playback.rw_flg || port_info->capture.rw_flg); | 546 | if (WARN_ON(port_info->playback.rw_flg || port_info->capture.rw_flg)) |
547 | return; | ||
547 | siu_dai_spbstop(port_info); | 548 | siu_dai_spbstop(port_info); |
548 | siu_dai_stop(port_info); | 549 | siu_dai_stop(port_info); |
549 | } | 550 | } |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 1b6663f45b34..375dc6dfba4e 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -36,7 +36,8 @@ static bool snd_soc_set_cache_val(void *base, unsigned int idx, | |||
36 | break; | 36 | break; |
37 | } | 37 | } |
38 | default: | 38 | default: |
39 | BUG(); | 39 | WARN(1, "Invalid word_size %d\n", word_size); |
40 | break; | ||
40 | } | 41 | } |
41 | return false; | 42 | return false; |
42 | } | 43 | } |
@@ -57,7 +58,8 @@ static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx, | |||
57 | return cache[idx]; | 58 | return cache[idx]; |
58 | } | 59 | } |
59 | default: | 60 | default: |
60 | BUG(); | 61 | WARN(1, "Invalid word_size %d\n", word_size); |
62 | break; | ||
61 | } | 63 | } |
62 | /* unreachable */ | 64 | /* unreachable */ |
63 | return -1; | 65 | return -1; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bdc1d74eb7b0..4e53d87e881d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -662,6 +662,8 @@ int snd_soc_suspend(struct device *dev) | |||
662 | codec->cache_sync = 1; | 662 | codec->cache_sync = 1; |
663 | if (codec->using_regmap) | 663 | if (codec->using_regmap) |
664 | regcache_mark_dirty(codec->control_data); | 664 | regcache_mark_dirty(codec->control_data); |
665 | /* deactivate pins to sleep state */ | ||
666 | pinctrl_pm_select_sleep_state(codec->dev); | ||
665 | break; | 667 | break; |
666 | default: | 668 | default: |
667 | dev_dbg(codec->dev, | 669 | dev_dbg(codec->dev, |
@@ -679,6 +681,9 @@ int snd_soc_suspend(struct device *dev) | |||
679 | 681 | ||
680 | if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control) | 682 | if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control) |
681 | cpu_dai->driver->suspend(cpu_dai); | 683 | cpu_dai->driver->suspend(cpu_dai); |
684 | |||
685 | /* deactivate pins to sleep state */ | ||
686 | pinctrl_pm_select_sleep_state(cpu_dai->dev); | ||
682 | } | 687 | } |
683 | 688 | ||
684 | if (card->suspend_post) | 689 | if (card->suspend_post) |
@@ -807,6 +812,16 @@ int snd_soc_resume(struct device *dev) | |||
807 | if (list_empty(&card->codec_dev_list)) | 812 | if (list_empty(&card->codec_dev_list)) |
808 | return 0; | 813 | return 0; |
809 | 814 | ||
815 | /* activate pins from sleep state */ | ||
816 | for (i = 0; i < card->num_rtd; i++) { | ||
817 | struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; | ||
818 | struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai; | ||
819 | if (cpu_dai->active) | ||
820 | pinctrl_pm_select_default_state(cpu_dai->dev); | ||
821 | if (codec_dai->active) | ||
822 | pinctrl_pm_select_default_state(codec_dai->dev); | ||
823 | } | ||
824 | |||
810 | /* AC97 devices might have other drivers hanging off them so | 825 | /* AC97 devices might have other drivers hanging off them so |
811 | * need to resume immediately. Other drivers don't have that | 826 | * need to resume immediately. Other drivers don't have that |
812 | * problem and may take a substantial amount of time to resume | 827 | * problem and may take a substantial amount of time to resume |
@@ -1929,6 +1944,14 @@ int snd_soc_poweroff(struct device *dev) | |||
1929 | 1944 | ||
1930 | snd_soc_dapm_shutdown(card); | 1945 | snd_soc_dapm_shutdown(card); |
1931 | 1946 | ||
1947 | /* deactivate pins to sleep state */ | ||
1948 | for (i = 0; i < card->num_rtd; i++) { | ||
1949 | struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; | ||
1950 | struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai; | ||
1951 | pinctrl_pm_select_sleep_state(codec_dai->dev); | ||
1952 | pinctrl_pm_select_sleep_state(cpu_dai->dev); | ||
1953 | } | ||
1954 | |||
1932 | return 0; | 1955 | return 0; |
1933 | } | 1956 | } |
1934 | EXPORT_SYMBOL_GPL(snd_soc_poweroff); | 1957 | EXPORT_SYMBOL_GPL(snd_soc_poweroff); |
@@ -3767,6 +3790,16 @@ int snd_soc_register_card(struct snd_soc_card *card) | |||
3767 | if (ret != 0) | 3790 | if (ret != 0) |
3768 | soc_cleanup_card_debugfs(card); | 3791 | soc_cleanup_card_debugfs(card); |
3769 | 3792 | ||
3793 | /* deactivate pins to sleep state */ | ||
3794 | for (i = 0; i < card->num_rtd; i++) { | ||
3795 | struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai; | ||
3796 | struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai; | ||
3797 | if (!codec_dai->active) | ||
3798 | pinctrl_pm_select_sleep_state(codec_dai->dev); | ||
3799 | if (!cpu_dai->active) | ||
3800 | pinctrl_pm_select_sleep_state(cpu_dai->dev); | ||
3801 | } | ||
3802 | |||
3770 | return ret; | 3803 | return ret; |
3771 | } | 3804 | } |
3772 | EXPORT_SYMBOL_GPL(snd_soc_register_card); | 3805 | EXPORT_SYMBOL_GPL(snd_soc_register_card); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index cc36caaf6443..dcade130157f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1427,7 +1427,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card, | |||
1427 | power = 0; | 1427 | power = 0; |
1428 | break; | 1428 | break; |
1429 | default: | 1429 | default: |
1430 | BUG(); | 1430 | WARN(1, "Unknown event %d\n", event); |
1431 | return; | 1431 | return; |
1432 | } | 1432 | } |
1433 | 1433 | ||
@@ -1460,7 +1460,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, | |||
1460 | power_list)->reg; | 1460 | power_list)->reg; |
1461 | 1461 | ||
1462 | list_for_each_entry(w, pending, power_list) { | 1462 | list_for_each_entry(w, pending, power_list) { |
1463 | BUG_ON(reg != w->reg); | 1463 | WARN_ON(reg != w->reg); |
1464 | w->power = w->new_power; | 1464 | w->power = w->new_power; |
1465 | 1465 | ||
1466 | mask |= w->mask << w->shift; | 1466 | mask |= w->mask << w->shift; |
@@ -2026,7 +2026,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | |||
2026 | level = "Off\n"; | 2026 | level = "Off\n"; |
2027 | break; | 2027 | break; |
2028 | default: | 2028 | default: |
2029 | BUG(); | 2029 | WARN(1, "Unknown bias_level %d\n", dapm->bias_level); |
2030 | level = "Unknown\n"; | 2030 | level = "Unknown\n"; |
2031 | break; | 2031 | break; |
2032 | } | 2032 | } |
@@ -3359,8 +3359,9 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3359 | u64 fmt; | 3359 | u64 fmt; |
3360 | int ret; | 3360 | int ret; |
3361 | 3361 | ||
3362 | BUG_ON(!config); | 3362 | if (WARN_ON(!config) || |
3363 | BUG_ON(list_empty(&w->sources) || list_empty(&w->sinks)); | 3363 | WARN_ON(list_empty(&w->sources) || list_empty(&w->sinks))) |
3364 | return -EINVAL; | ||
3364 | 3365 | ||
3365 | /* We only support a single source and sink, pick the first */ | 3366 | /* We only support a single source and sink, pick the first */ |
3366 | source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, | 3367 | source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, |
@@ -3368,9 +3369,10 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3368 | sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, | 3369 | sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, |
3369 | list_source); | 3370 | list_source); |
3370 | 3371 | ||
3371 | BUG_ON(!source_p || !sink_p); | 3372 | if (WARN_ON(!source_p || !sink_p) || |
3372 | BUG_ON(!sink_p->source || !source_p->sink); | 3373 | WARN_ON(!sink_p->source || !source_p->sink) || |
3373 | BUG_ON(!source_p->source || !sink_p->sink); | 3374 | WARN_ON(!source_p->source || !sink_p->sink)) |
3375 | return -EINVAL; | ||
3374 | 3376 | ||
3375 | source = source_p->source->priv; | 3377 | source = source_p->source->priv; |
3376 | sink = sink_p->sink->priv; | 3378 | sink = sink_p->sink->priv; |
@@ -3446,7 +3448,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, | |||
3446 | break; | 3448 | break; |
3447 | 3449 | ||
3448 | default: | 3450 | default: |
3449 | BUG(); | 3451 | WARN(1, "Unknown event %d\n", event); |
3450 | return -EINVAL; | 3452 | return -EINVAL; |
3451 | } | 3453 | } |
3452 | 3454 | ||
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 51fded3640a5..cbc9c96ce1f4 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c | |||
@@ -90,6 +90,8 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, | |||
90 | struct dma_slave_config slave_config; | 90 | struct dma_slave_config slave_config; |
91 | int ret; | 91 | int ret; |
92 | 92 | ||
93 | memset(&slave_config, 0, sizeof(slave_config)); | ||
94 | |||
93 | if (!pcm->config) | 95 | if (!pcm->config) |
94 | prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; | 96 | prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
95 | else | 97 | else |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 591f0f3074c5..42782c01e413 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/pinctrl/consumer.h> | ||
22 | #include <linux/pm_runtime.h> | 23 | #include <linux/pm_runtime.h> |
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
@@ -183,6 +184,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) | |||
183 | struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver; | 184 | struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver; |
184 | int ret = 0; | 185 | int ret = 0; |
185 | 186 | ||
187 | pinctrl_pm_select_default_state(cpu_dai->dev); | ||
188 | pinctrl_pm_select_default_state(codec_dai->dev); | ||
186 | pm_runtime_get_sync(cpu_dai->dev); | 189 | pm_runtime_get_sync(cpu_dai->dev); |
187 | pm_runtime_get_sync(codec_dai->dev); | 190 | pm_runtime_get_sync(codec_dai->dev); |
188 | pm_runtime_get_sync(platform->dev); | 191 | pm_runtime_get_sync(platform->dev); |
@@ -317,6 +320,10 @@ out: | |||
317 | pm_runtime_put(platform->dev); | 320 | pm_runtime_put(platform->dev); |
318 | pm_runtime_put(codec_dai->dev); | 321 | pm_runtime_put(codec_dai->dev); |
319 | pm_runtime_put(cpu_dai->dev); | 322 | pm_runtime_put(cpu_dai->dev); |
323 | if (!codec_dai->active) | ||
324 | pinctrl_pm_select_sleep_state(codec_dai->dev); | ||
325 | if (!cpu_dai->active) | ||
326 | pinctrl_pm_select_sleep_state(cpu_dai->dev); | ||
320 | 327 | ||
321 | return ret; | 328 | return ret; |
322 | } | 329 | } |
@@ -426,6 +433,10 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
426 | pm_runtime_put(platform->dev); | 433 | pm_runtime_put(platform->dev); |
427 | pm_runtime_put(codec_dai->dev); | 434 | pm_runtime_put(codec_dai->dev); |
428 | pm_runtime_put(cpu_dai->dev); | 435 | pm_runtime_put(cpu_dai->dev); |
436 | if (!codec_dai->active) | ||
437 | pinctrl_pm_select_sleep_state(codec_dai->dev); | ||
438 | if (!cpu_dai->active) | ||
439 | pinctrl_pm_select_sleep_state(cpu_dai->dev); | ||
429 | 440 | ||
430 | return 0; | 441 | return 0; |
431 | } | 442 | } |
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 45a6428cba8d..fbd077f4de72 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -115,8 +115,8 @@ static void txx9aclc_dma_complete(void *arg) | |||
115 | spin_lock_irqsave(&dmadata->dma_lock, flags); | 115 | spin_lock_irqsave(&dmadata->dma_lock, flags); |
116 | if (dmadata->frag_count >= 0) { | 116 | if (dmadata->frag_count >= 0) { |
117 | dmadata->dmacount--; | 117 | dmadata->dmacount--; |
118 | BUG_ON(dmadata->dmacount < 0); | 118 | if (!WARN_ON(dmadata->dmacount < 0)) |
119 | tasklet_schedule(&dmadata->tasklet); | 119 | tasklet_schedule(&dmadata->tasklet); |
120 | } | 120 | } |
121 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 121 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |
122 | } | 122 | } |
@@ -181,7 +181,10 @@ static void txx9aclc_dma_tasklet(unsigned long data) | |||
181 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 181 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | BUG_ON(dmadata->dmacount >= NR_DMA_CHAIN); | 184 | if (WARN_ON(dmadata->dmacount >= NR_DMA_CHAIN)) { |
185 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | ||
186 | return; | ||
187 | } | ||
185 | while (dmadata->dmacount < NR_DMA_CHAIN) { | 188 | while (dmadata->dmacount < NR_DMA_CHAIN) { |
186 | dmadata->dmacount++; | 189 | dmadata->dmacount++; |
187 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); | 190 | spin_unlock_irqrestore(&dmadata->dma_lock, flags); |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e297b74471b8..ca0d3d9f4bac 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -90,8 +90,20 @@ OPTIONS | |||
90 | Number of mmap data pages. Must be a power of two. | 90 | Number of mmap data pages. Must be a power of two. |
91 | 91 | ||
92 | -g:: | 92 | -g:: |
93 | Enables call-graph (stack chain/backtrace) recording. | ||
94 | |||
93 | --call-graph:: | 95 | --call-graph:: |
94 | Do call-graph (stack chain/backtrace) recording. | 96 | Setup and enable call-graph (stack chain/backtrace) recording, |
97 | implies -g. | ||
98 | |||
99 | Allows specifying "fp" (frame pointer) or "dwarf" | ||
100 | (DWARF's CFI - Call Frame Information) as the method to collect | ||
101 | the information used to show the call graphs. | ||
102 | |||
103 | In some systems, where binaries are build with gcc | ||
104 | --fomit-frame-pointer, using the "fp" method will produce bogus | ||
105 | call graphs, using "dwarf", if available (perf tools linked to | ||
106 | the libunwind library) should be used instead. | ||
95 | 107 | ||
96 | -q:: | 108 | -q:: |
97 | --quiet:: | 109 | --quiet:: |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 58d6598a9686..6a118e71d003 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -140,20 +140,12 @@ Default is to monitor all CPUS. | |||
140 | --asm-raw:: | 140 | --asm-raw:: |
141 | Show raw instruction encoding of assembly instructions. | 141 | Show raw instruction encoding of assembly instructions. |
142 | 142 | ||
143 | -G [type,min,order]:: | 143 | -G:: |
144 | Enables call-graph (stack chain/backtrace) recording. | ||
145 | |||
144 | --call-graph:: | 146 | --call-graph:: |
145 | Display call chains using type, min percent threshold and order. | 147 | Setup and enable call-graph (stack chain/backtrace) recording, |
146 | type can be either: | 148 | implies -G. |
147 | - flat: single column, linear exposure of call chains. | ||
148 | - graph: use a graph tree, displaying absolute overhead rates. | ||
149 | - fractal: like graph, but displays relative rates. Each branch of | ||
150 | the tree is considered as a new profiled object. | ||
151 | |||
152 | order can be either: | ||
153 | - callee: callee based call graph. | ||
154 | - caller: inverted caller based call graph. | ||
155 | |||
156 | Default: fractal,0.5,callee. | ||
157 | 149 | ||
158 | --ignore-callees=<regex>:: | 150 | --ignore-callees=<regex>:: |
159 | Ignore callees of the function(s) matching the given regex. | 151 | Ignore callees of the function(s) matching the given regex. |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 935d52216c89..fbc2888d6495 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -888,11 +888,18 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx, | |||
888 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { | 888 | while ((event = perf_evlist__mmap_read(kvm->evlist, idx)) != NULL) { |
889 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); | 889 | err = perf_evlist__parse_sample(kvm->evlist, event, &sample); |
890 | if (err) { | 890 | if (err) { |
891 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
891 | pr_err("Failed to parse sample\n"); | 892 | pr_err("Failed to parse sample\n"); |
892 | return -1; | 893 | return -1; |
893 | } | 894 | } |
894 | 895 | ||
895 | err = perf_session_queue_event(kvm->session, event, &sample, 0); | 896 | err = perf_session_queue_event(kvm->session, event, &sample, 0); |
897 | /* | ||
898 | * FIXME: Here we can't consume the event, as perf_session_queue_event will | ||
899 | * point to it, and it'll get possibly overwritten by the kernel. | ||
900 | */ | ||
901 | perf_evlist__mmap_consume(kvm->evlist, idx); | ||
902 | |||
896 | if (err) { | 903 | if (err) { |
897 | pr_err("Failed to enqueue sample: %d\n", err); | 904 | pr_err("Failed to enqueue sample: %d\n", err); |
898 | return -1; | 905 | return -1; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a41ac41546c9..d04651484640 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -712,21 +712,12 @@ static int get_stack_size(char *str, unsigned long *_size) | |||
712 | } | 712 | } |
713 | #endif /* LIBUNWIND_SUPPORT */ | 713 | #endif /* LIBUNWIND_SUPPORT */ |
714 | 714 | ||
715 | int record_parse_callchain_opt(const struct option *opt, | 715 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts) |
716 | const char *arg, int unset) | ||
717 | { | 716 | { |
718 | struct perf_record_opts *opts = opt->value; | ||
719 | char *tok, *name, *saveptr = NULL; | 717 | char *tok, *name, *saveptr = NULL; |
720 | char *buf; | 718 | char *buf; |
721 | int ret = -1; | 719 | int ret = -1; |
722 | 720 | ||
723 | /* --no-call-graph */ | ||
724 | if (unset) | ||
725 | return 0; | ||
726 | |||
727 | /* We specified default option if none is provided. */ | ||
728 | BUG_ON(!arg); | ||
729 | |||
730 | /* We need buffer that we know we can write to. */ | 721 | /* We need buffer that we know we can write to. */ |
731 | buf = malloc(strlen(arg) + 1); | 722 | buf = malloc(strlen(arg) + 1); |
732 | if (!buf) | 723 | if (!buf) |
@@ -764,13 +755,9 @@ int record_parse_callchain_opt(const struct option *opt, | |||
764 | ret = get_stack_size(tok, &size); | 755 | ret = get_stack_size(tok, &size); |
765 | opts->stack_dump_size = size; | 756 | opts->stack_dump_size = size; |
766 | } | 757 | } |
767 | |||
768 | if (!ret) | ||
769 | pr_debug("callchain: stack dump size %d\n", | ||
770 | opts->stack_dump_size); | ||
771 | #endif /* LIBUNWIND_SUPPORT */ | 758 | #endif /* LIBUNWIND_SUPPORT */ |
772 | } else { | 759 | } else { |
773 | pr_err("callchain: Unknown -g option " | 760 | pr_err("callchain: Unknown --call-graph option " |
774 | "value: %s\n", arg); | 761 | "value: %s\n", arg); |
775 | break; | 762 | break; |
776 | } | 763 | } |
@@ -778,13 +765,52 @@ int record_parse_callchain_opt(const struct option *opt, | |||
778 | } while (0); | 765 | } while (0); |
779 | 766 | ||
780 | free(buf); | 767 | free(buf); |
768 | return ret; | ||
769 | } | ||
770 | |||
771 | static void callchain_debug(struct perf_record_opts *opts) | ||
772 | { | ||
773 | pr_debug("callchain: type %d\n", opts->call_graph); | ||
781 | 774 | ||
775 | if (opts->call_graph == CALLCHAIN_DWARF) | ||
776 | pr_debug("callchain: stack dump size %d\n", | ||
777 | opts->stack_dump_size); | ||
778 | } | ||
779 | |||
780 | int record_parse_callchain_opt(const struct option *opt, | ||
781 | const char *arg, | ||
782 | int unset) | ||
783 | { | ||
784 | struct perf_record_opts *opts = opt->value; | ||
785 | int ret; | ||
786 | |||
787 | /* --no-call-graph */ | ||
788 | if (unset) { | ||
789 | opts->call_graph = CALLCHAIN_NONE; | ||
790 | pr_debug("callchain: disabled\n"); | ||
791 | return 0; | ||
792 | } | ||
793 | |||
794 | ret = record_parse_callchain(arg, opts); | ||
782 | if (!ret) | 795 | if (!ret) |
783 | pr_debug("callchain: type %d\n", opts->call_graph); | 796 | callchain_debug(opts); |
784 | 797 | ||
785 | return ret; | 798 | return ret; |
786 | } | 799 | } |
787 | 800 | ||
801 | int record_callchain_opt(const struct option *opt, | ||
802 | const char *arg __maybe_unused, | ||
803 | int unset __maybe_unused) | ||
804 | { | ||
805 | struct perf_record_opts *opts = opt->value; | ||
806 | |||
807 | if (opts->call_graph == CALLCHAIN_NONE) | ||
808 | opts->call_graph = CALLCHAIN_FP; | ||
809 | |||
810 | callchain_debug(opts); | ||
811 | return 0; | ||
812 | } | ||
813 | |||
788 | static const char * const record_usage[] = { | 814 | static const char * const record_usage[] = { |
789 | "perf record [<options>] [<command>]", | 815 | "perf record [<options>] [<command>]", |
790 | "perf record [<options>] -- <command> [<options>]", | 816 | "perf record [<options>] -- <command> [<options>]", |
@@ -813,12 +839,12 @@ static struct perf_record record = { | |||
813 | }, | 839 | }, |
814 | }; | 840 | }; |
815 | 841 | ||
816 | #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: " | 842 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " |
817 | 843 | ||
818 | #ifdef LIBUNWIND_SUPPORT | 844 | #ifdef LIBUNWIND_SUPPORT |
819 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf"; | 845 | const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf"; |
820 | #else | 846 | #else |
821 | const char record_callchain_help[] = CALLCHAIN_HELP "[fp]"; | 847 | const char record_callchain_help[] = CALLCHAIN_HELP "fp"; |
822 | #endif | 848 | #endif |
823 | 849 | ||
824 | /* | 850 | /* |
@@ -858,9 +884,12 @@ const struct option record_options[] = { | |||
858 | "number of mmap data pages"), | 884 | "number of mmap data pages"), |
859 | OPT_BOOLEAN(0, "group", &record.opts.group, | 885 | OPT_BOOLEAN(0, "group", &record.opts.group, |
860 | "put the counters into a counter group"), | 886 | "put the counters into a counter group"), |
861 | OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts, | 887 | OPT_CALLBACK_NOOPT('g', NULL, &record.opts, |
862 | "mode[,dump_size]", record_callchain_help, | 888 | NULL, "enables call-graph recording" , |
863 | &record_parse_callchain_opt, "fp"), | 889 | &record_callchain_opt), |
890 | OPT_CALLBACK(0, "call-graph", &record.opts, | ||
891 | "mode[,dump_size]", record_callchain_help, | ||
892 | &record_parse_callchain_opt), | ||
864 | OPT_INCR('v', "verbose", &verbose, | 893 | OPT_INCR('v', "verbose", &verbose, |
865 | "be more verbose (show counter open errors, etc)"), | 894 | "be more verbose (show counter open errors, etc)"), |
866 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), | 895 | OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"), |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 212214162bb2..5a11f13e56f9 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -810,7 +810,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); | 810 | ret = perf_evlist__parse_sample(top->evlist, event, &sample); |
811 | if (ret) { | 811 | if (ret) { |
812 | pr_err("Can't parse sample, err = %d\n", ret); | 812 | pr_err("Can't parse sample, err = %d\n", ret); |
813 | continue; | 813 | goto next_event; |
814 | } | 814 | } |
815 | 815 | ||
816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); | 816 | evsel = perf_evlist__id2evsel(session->evlist, sample.id); |
@@ -825,13 +825,13 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
825 | case PERF_RECORD_MISC_USER: | 825 | case PERF_RECORD_MISC_USER: |
826 | ++top->us_samples; | 826 | ++top->us_samples; |
827 | if (top->hide_user_symbols) | 827 | if (top->hide_user_symbols) |
828 | continue; | 828 | goto next_event; |
829 | machine = &session->machines.host; | 829 | machine = &session->machines.host; |
830 | break; | 830 | break; |
831 | case PERF_RECORD_MISC_KERNEL: | 831 | case PERF_RECORD_MISC_KERNEL: |
832 | ++top->kernel_samples; | 832 | ++top->kernel_samples; |
833 | if (top->hide_kernel_symbols) | 833 | if (top->hide_kernel_symbols) |
834 | continue; | 834 | goto next_event; |
835 | machine = &session->machines.host; | 835 | machine = &session->machines.host; |
836 | break; | 836 | break; |
837 | case PERF_RECORD_MISC_GUEST_KERNEL: | 837 | case PERF_RECORD_MISC_GUEST_KERNEL: |
@@ -847,7 +847,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
847 | */ | 847 | */ |
848 | /* Fall thru */ | 848 | /* Fall thru */ |
849 | default: | 849 | default: |
850 | continue; | 850 | goto next_event; |
851 | } | 851 | } |
852 | 852 | ||
853 | 853 | ||
@@ -859,6 +859,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) | |||
859 | machine__process_event(machine, event); | 859 | machine__process_event(machine, event); |
860 | } else | 860 | } else |
861 | ++session->stats.nr_unknown_events; | 861 | ++session->stats.nr_unknown_events; |
862 | next_event: | ||
863 | perf_evlist__mmap_consume(top->evlist, idx); | ||
862 | } | 864 | } |
863 | } | 865 | } |
864 | 866 | ||
@@ -1016,16 +1018,16 @@ out_delete: | |||
1016 | } | 1018 | } |
1017 | 1019 | ||
1018 | static int | 1020 | static int |
1019 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | 1021 | callchain_opt(const struct option *opt, const char *arg, int unset) |
1020 | { | 1022 | { |
1021 | /* | ||
1022 | * --no-call-graph | ||
1023 | */ | ||
1024 | if (unset) | ||
1025 | return 0; | ||
1026 | |||
1027 | symbol_conf.use_callchain = true; | 1023 | symbol_conf.use_callchain = true; |
1024 | return record_callchain_opt(opt, arg, unset); | ||
1025 | } | ||
1028 | 1026 | ||
1027 | static int | ||
1028 | parse_callchain_opt(const struct option *opt, const char *arg, int unset) | ||
1029 | { | ||
1030 | symbol_conf.use_callchain = true; | ||
1029 | return record_parse_callchain_opt(opt, arg, unset); | 1031 | return record_parse_callchain_opt(opt, arg, unset); |
1030 | } | 1032 | } |
1031 | 1033 | ||
@@ -1106,9 +1108,12 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1106 | "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"), | 1108 | "sort by key(s): pid, comm, dso, symbol, parent, weight, local_weight"), |
1107 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | 1109 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, |
1108 | "Show a column with the number of samples"), | 1110 | "Show a column with the number of samples"), |
1109 | OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts, | 1111 | OPT_CALLBACK_NOOPT('G', NULL, &top.record_opts, |
1110 | "mode[,dump_size]", record_callchain_help, | 1112 | NULL, "enables call-graph recording", |
1111 | &parse_callchain_opt, "fp"), | 1113 | &callchain_opt), |
1114 | OPT_CALLBACK(0, "call-graph", &top.record_opts, | ||
1115 | "mode[,dump_size]", record_callchain_help, | ||
1116 | &parse_callchain_opt), | ||
1112 | OPT_CALLBACK(0, "ignore-callees", NULL, "regex", | 1117 | OPT_CALLBACK(0, "ignore-callees", NULL, "regex", |
1113 | "ignore callees of these functions in call graphs", | 1118 | "ignore callees of these functions in call graphs", |
1114 | report_parse_ignore_callees_opt), | 1119 | report_parse_ignore_callees_opt), |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 71aa3e35406b..99c8d9ad6729 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -987,7 +987,7 @@ again: | |||
987 | err = perf_evlist__parse_sample(evlist, event, &sample); | 987 | err = perf_evlist__parse_sample(evlist, event, &sample); |
988 | if (err) { | 988 | if (err) { |
989 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); | 989 | fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err); |
990 | continue; | 990 | goto next_event; |
991 | } | 991 | } |
992 | 992 | ||
993 | if (trace->base_time == 0) | 993 | if (trace->base_time == 0) |
@@ -1001,18 +1001,20 @@ again: | |||
1001 | evsel = perf_evlist__id2evsel(evlist, sample.id); | 1001 | evsel = perf_evlist__id2evsel(evlist, sample.id); |
1002 | if (evsel == NULL) { | 1002 | if (evsel == NULL) { |
1003 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); | 1003 | fprintf(trace->output, "Unknown tp ID %" PRIu64 ", skipping...\n", sample.id); |
1004 | continue; | 1004 | goto next_event; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | if (sample.raw_data == NULL) { | 1007 | if (sample.raw_data == NULL) { |
1008 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", | 1008 | fprintf(trace->output, "%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", |
1009 | perf_evsel__name(evsel), sample.tid, | 1009 | perf_evsel__name(evsel), sample.tid, |
1010 | sample.cpu, sample.raw_size); | 1010 | sample.cpu, sample.raw_size); |
1011 | continue; | 1011 | goto next_event; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | handler = evsel->handler.func; | 1014 | handler = evsel->handler.func; |
1015 | handler(trace, evsel, &sample); | 1015 | handler(trace, evsel, &sample); |
1016 | next_event: | ||
1017 | perf_evlist__mmap_consume(evlist, i); | ||
1016 | 1018 | ||
1017 | if (done) | 1019 | if (done) |
1018 | goto out_unmap_evlist; | 1020 | goto out_unmap_evlist; |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 6fb781d5586c..e3fedfa2906e 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -290,6 +290,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist, | |||
290 | for (i = 0; i < evlist->nr_mmaps; i++) { | 290 | for (i = 0; i < evlist->nr_mmaps; i++) { |
291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { | 291 | while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { |
292 | ret = process_event(machine, evlist, event, state); | 292 | ret = process_event(machine, evlist, event, state); |
293 | perf_evlist__mmap_consume(evlist, i); | ||
293 | if (ret < 0) | 294 | if (ret < 0) |
294 | return ret; | 295 | return ret; |
295 | } | 296 | } |
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index d444ea2c47d9..376c35608534 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c | |||
@@ -36,6 +36,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm) | |||
36 | (pid_t)event->comm.tid == getpid() && | 36 | (pid_t)event->comm.tid == getpid() && |
37 | strcmp(event->comm.comm, comm) == 0) | 37 | strcmp(event->comm.comm, comm) == 0) |
38 | found += 1; | 38 | found += 1; |
39 | perf_evlist__mmap_consume(evlist, i); | ||
39 | } | 40 | } |
40 | } | 41 | } |
41 | return found; | 42 | return found; |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index c4185b9aeb80..a7232c204eb9 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -122,6 +122,7 @@ int test__basic_mmap(void) | |||
122 | goto out_munmap; | 122 | goto out_munmap; |
123 | } | 123 | } |
124 | nr_events[evsel->idx]++; | 124 | nr_events[evsel->idx]++; |
125 | perf_evlist__mmap_consume(evlist, 0); | ||
125 | } | 126 | } |
126 | 127 | ||
127 | err = 0; | 128 | err = 0; |
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c index fc5b9fca8b47..524b221b829b 100644 --- a/tools/perf/tests/open-syscall-tp-fields.c +++ b/tools/perf/tests/open-syscall-tp-fields.c | |||
@@ -77,8 +77,10 @@ int test__syscall_open_tp_fields(void) | |||
77 | 77 | ||
78 | ++nr_events; | 78 | ++nr_events; |
79 | 79 | ||
80 | if (type != PERF_RECORD_SAMPLE) | 80 | if (type != PERF_RECORD_SAMPLE) { |
81 | perf_evlist__mmap_consume(evlist, i); | ||
81 | continue; | 82 | continue; |
83 | } | ||
82 | 84 | ||
83 | err = perf_evsel__parse_sample(evsel, event, &sample); | 85 | err = perf_evsel__parse_sample(evsel, event, &sample); |
84 | if (err) { | 86 | if (err) { |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index b8a7056519ac..7923b06ffc91 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -263,6 +263,8 @@ int test__PERF_RECORD(void) | |||
263 | type); | 263 | type); |
264 | ++errs; | 264 | ++errs; |
265 | } | 265 | } |
266 | |||
267 | perf_evlist__mmap_consume(evlist, i); | ||
266 | } | 268 | } |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/tests/perf-time-to-tsc.c index 0ab61b1f408e..4ca1b938f6a6 100644 --- a/tools/perf/tests/perf-time-to-tsc.c +++ b/tools/perf/tests/perf-time-to-tsc.c | |||
@@ -122,7 +122,7 @@ int test__perf_time_to_tsc(void) | |||
122 | if (event->header.type != PERF_RECORD_COMM || | 122 | if (event->header.type != PERF_RECORD_COMM || |
123 | (pid_t)event->comm.pid != getpid() || | 123 | (pid_t)event->comm.pid != getpid() || |
124 | (pid_t)event->comm.tid != getpid()) | 124 | (pid_t)event->comm.tid != getpid()) |
125 | continue; | 125 | goto next_event; |
126 | 126 | ||
127 | if (strcmp(event->comm.comm, comm1) == 0) { | 127 | if (strcmp(event->comm.comm, comm1) == 0) { |
128 | CHECK__(perf_evsel__parse_sample(evsel, event, | 128 | CHECK__(perf_evsel__parse_sample(evsel, event, |
@@ -134,6 +134,8 @@ int test__perf_time_to_tsc(void) | |||
134 | &sample)); | 134 | &sample)); |
135 | comm2_time = sample.time; | 135 | comm2_time = sample.time; |
136 | } | 136 | } |
137 | next_event: | ||
138 | perf_evlist__mmap_consume(evlist, i); | ||
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | ||
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index 2e41e2d32ccc..6e2b44ec0749 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c | |||
@@ -78,7 +78,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
78 | struct perf_sample sample; | 78 | struct perf_sample sample; |
79 | 79 | ||
80 | if (event->header.type != PERF_RECORD_SAMPLE) | 80 | if (event->header.type != PERF_RECORD_SAMPLE) |
81 | continue; | 81 | goto next_event; |
82 | 82 | ||
83 | err = perf_evlist__parse_sample(evlist, event, &sample); | 83 | err = perf_evlist__parse_sample(evlist, event, &sample); |
84 | if (err < 0) { | 84 | if (err < 0) { |
@@ -88,6 +88,8 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) | |||
88 | 88 | ||
89 | total_periods += sample.period; | 89 | total_periods += sample.period; |
90 | nr_samples++; | 90 | nr_samples++; |
91 | next_event: | ||
92 | perf_evlist__mmap_consume(evlist, 0); | ||
91 | } | 93 | } |
92 | 94 | ||
93 | if ((u64) nr_samples == total_periods) { | 95 | if ((u64) nr_samples == total_periods) { |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 28fe5894b061..a3e64876e940 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -96,10 +96,10 @@ int test__task_exit(void) | |||
96 | 96 | ||
97 | retry: | 97 | retry: |
98 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { | 98 | while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { |
99 | if (event->header.type != PERF_RECORD_EXIT) | 99 | if (event->header.type == PERF_RECORD_EXIT) |
100 | continue; | 100 | nr_exit++; |
101 | 101 | ||
102 | nr_exit++; | 102 | perf_evlist__mmap_consume(evlist, 0); |
103 | } | 103 | } |
104 | 104 | ||
105 | if (!exited || !nr_exit) { | 105 | if (!exited || !nr_exit) { |
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 194e2f42ff5d..6c152686e837 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -315,8 +315,7 @@ static inline void advance_hpp(struct perf_hpp *hpp, int inc) | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, | 317 | static int hist_entry__period_snprintf(struct perf_hpp *hpp, |
318 | struct hist_entry *he, | 318 | struct hist_entry *he) |
319 | bool color) | ||
320 | { | 319 | { |
321 | const char *sep = symbol_conf.field_sep; | 320 | const char *sep = symbol_conf.field_sep; |
322 | struct perf_hpp_fmt *fmt; | 321 | struct perf_hpp_fmt *fmt; |
@@ -338,7 +337,7 @@ static int hist_entry__period_snprintf(struct perf_hpp *hpp, | |||
338 | } else | 337 | } else |
339 | first = false; | 338 | first = false; |
340 | 339 | ||
341 | if (color && fmt->color) | 340 | if (perf_hpp__use_color() && fmt->color) |
342 | ret = fmt->color(fmt, hpp, he); | 341 | ret = fmt->color(fmt, hpp, he); |
343 | else | 342 | else |
344 | ret = fmt->entry(fmt, hpp, he); | 343 | ret = fmt->entry(fmt, hpp, he); |
@@ -358,12 +357,11 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size, | |||
358 | .buf = bf, | 357 | .buf = bf, |
359 | .size = size, | 358 | .size = size, |
360 | }; | 359 | }; |
361 | bool color = !symbol_conf.field_sep; | ||
362 | 360 | ||
363 | if (size == 0 || size > bfsz) | 361 | if (size == 0 || size > bfsz) |
364 | size = hpp.size = bfsz; | 362 | size = hpp.size = bfsz; |
365 | 363 | ||
366 | ret = hist_entry__period_snprintf(&hpp, he, color); | 364 | ret = hist_entry__period_snprintf(&hpp, he); |
367 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); | 365 | hist_entry__sort_snprintf(he, bf + ret, size - ret, hists); |
368 | 366 | ||
369 | ret = fprintf(fp, "%s\n", bf); | 367 | ret = fprintf(fp, "%s\n", bf); |
@@ -482,6 +480,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
482 | 480 | ||
483 | print_entries: | 481 | print_entries: |
484 | linesz = hists__sort_list_width(hists) + 3 + 1; | 482 | linesz = hists__sort_list_width(hists) + 3 + 1; |
483 | linesz += perf_hpp__color_overhead(); | ||
485 | line = malloc(linesz); | 484 | line = malloc(linesz); |
486 | if (line == NULL) { | 485 | if (line == NULL) { |
487 | ret = -1; | 486 | ret = -1; |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 2b585bc308cf..9e99060408ae 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -147,6 +147,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor) | |||
147 | 147 | ||
148 | struct option; | 148 | struct option; |
149 | 149 | ||
150 | int record_parse_callchain(const char *arg, struct perf_record_opts *opts); | ||
150 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); | 151 | int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset); |
152 | int record_callchain_opt(const struct option *opt, const char *arg, int unset); | ||
153 | |||
151 | extern const char record_callchain_help[]; | 154 | extern const char record_callchain_help[]; |
152 | #endif /* __PERF_CALLCHAIN_H */ | 155 | #endif /* __PERF_CALLCHAIN_H */ |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 63df031fc9c7..49096ea58a15 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -213,7 +213,7 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
213 | &event->mmap.pgoff, | 213 | &event->mmap.pgoff, |
214 | execname); | 214 | execname); |
215 | 215 | ||
216 | if (n != 8) | 216 | if (n != 5) |
217 | continue; | 217 | continue; |
218 | 218 | ||
219 | if (prot[2] != 'x') | 219 | if (prot[2] != 'x') |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index f9f77bee0b1b..e584cd30b0f2 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -545,12 +545,19 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) | |||
545 | 545 | ||
546 | md->prev = old; | 546 | md->prev = old; |
547 | 547 | ||
548 | if (!evlist->overwrite) | ||
549 | perf_mmap__write_tail(md, old); | ||
550 | |||
551 | return event; | 548 | return event; |
552 | } | 549 | } |
553 | 550 | ||
551 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx) | ||
552 | { | ||
553 | if (!evlist->overwrite) { | ||
554 | struct perf_mmap *md = &evlist->mmap[idx]; | ||
555 | unsigned int old = md->prev; | ||
556 | |||
557 | perf_mmap__write_tail(md, old); | ||
558 | } | ||
559 | } | ||
560 | |||
554 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) | 561 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx) |
555 | { | 562 | { |
556 | if (evlist->mmap[idx].base != NULL) { | 563 | if (evlist->mmap[idx].base != NULL) { |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index 880d7139d2fb..206d09339306 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -89,6 +89,8 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id); | |||
89 | 89 | ||
90 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); | 90 | union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); |
91 | 91 | ||
92 | void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx); | ||
93 | |||
92 | int perf_evlist__open(struct perf_evlist *evlist); | 94 | int perf_evlist__open(struct perf_evlist *evlist); |
93 | void perf_evlist__close(struct perf_evlist *evlist); | 95 | void perf_evlist__close(struct perf_evlist *evlist); |
94 | 96 | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 1329b6b6ffe6..ce8dc61ce2c3 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <pthread.h> | 5 | #include <pthread.h> |
6 | #include "callchain.h" | 6 | #include "callchain.h" |
7 | #include "header.h" | 7 | #include "header.h" |
8 | #include "color.h" | ||
8 | 9 | ||
9 | extern struct callchain_param callchain_param; | 10 | extern struct callchain_param callchain_param; |
10 | 11 | ||
@@ -175,6 +176,18 @@ void perf_hpp__init(void); | |||
175 | void perf_hpp__column_register(struct perf_hpp_fmt *format); | 176 | void perf_hpp__column_register(struct perf_hpp_fmt *format); |
176 | void perf_hpp__column_enable(unsigned col); | 177 | void perf_hpp__column_enable(unsigned col); |
177 | 178 | ||
179 | static inline size_t perf_hpp__use_color(void) | ||
180 | { | ||
181 | return !symbol_conf.field_sep; | ||
182 | } | ||
183 | |||
184 | static inline size_t perf_hpp__color_overhead(void) | ||
185 | { | ||
186 | return perf_hpp__use_color() ? | ||
187 | (COLOR_MAXLEN + sizeof(PERF_COLOR_RESET)) * PERF_HPP__MAX_INDEX | ||
188 | : 0; | ||
189 | } | ||
190 | |||
178 | struct perf_evlist; | 191 | struct perf_evlist; |
179 | 192 | ||
180 | struct hist_browser_timer { | 193 | struct hist_browser_timer { |
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 71b5412bbbb9..2ac4bc92bb1f 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -822,6 +822,8 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, | |||
822 | PyObject *pyevent = pyrf_event__new(event); | 822 | PyObject *pyevent = pyrf_event__new(event); |
823 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; | 823 | struct pyrf_event *pevent = (struct pyrf_event *)pyevent; |
824 | 824 | ||
825 | perf_evlist__mmap_consume(evlist, cpu); | ||
826 | |||
825 | if (pyevent == NULL) | 827 | if (pyevent == NULL) |
826 | return PyErr_NoMemory(); | 828 | return PyErr_NoMemory(); |
827 | 829 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index cc75a3cef388..95d91a0b23af 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -56,6 +56,17 @@ static void handler_call_die(const char *handler_name) | |||
56 | Py_FatalError("problem in Python trace event handler"); | 56 | Py_FatalError("problem in Python trace event handler"); |
57 | } | 57 | } |
58 | 58 | ||
59 | /* | ||
60 | * Insert val into into the dictionary and decrement the reference counter. | ||
61 | * This is necessary for dictionaries since PyDict_SetItemString() does not | ||
62 | * steal a reference, as opposed to PyTuple_SetItem(). | ||
63 | */ | ||
64 | static void pydict_set_item_string_decref(PyObject *dict, const char *key, PyObject *val) | ||
65 | { | ||
66 | PyDict_SetItemString(dict, key, val); | ||
67 | Py_DECREF(val); | ||
68 | } | ||
69 | |||
59 | static void define_value(enum print_arg_type field_type, | 70 | static void define_value(enum print_arg_type field_type, |
60 | const char *ev_name, | 71 | const char *ev_name, |
61 | const char *field_name, | 72 | const char *field_name, |
@@ -279,11 +290,11 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
279 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); | 290 | PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); |
280 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); | 291 | PyTuple_SetItem(t, n++, PyString_FromString(comm)); |
281 | } else { | 292 | } else { |
282 | PyDict_SetItemString(dict, "common_cpu", PyInt_FromLong(cpu)); | 293 | pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu)); |
283 | PyDict_SetItemString(dict, "common_s", PyInt_FromLong(s)); | 294 | pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s)); |
284 | PyDict_SetItemString(dict, "common_ns", PyInt_FromLong(ns)); | 295 | pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns)); |
285 | PyDict_SetItemString(dict, "common_pid", PyInt_FromLong(pid)); | 296 | pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid)); |
286 | PyDict_SetItemString(dict, "common_comm", PyString_FromString(comm)); | 297 | pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm)); |
287 | } | 298 | } |
288 | for (field = event->format.fields; field; field = field->next) { | 299 | for (field = event->format.fields; field; field = field->next) { |
289 | if (field->flags & FIELD_IS_STRING) { | 300 | if (field->flags & FIELD_IS_STRING) { |
@@ -313,7 +324,7 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
313 | if (handler) | 324 | if (handler) |
314 | PyTuple_SetItem(t, n++, obj); | 325 | PyTuple_SetItem(t, n++, obj); |
315 | else | 326 | else |
316 | PyDict_SetItemString(dict, field->name, obj); | 327 | pydict_set_item_string_decref(dict, field->name, obj); |
317 | 328 | ||
318 | } | 329 | } |
319 | if (!handler) | 330 | if (!handler) |
@@ -370,21 +381,21 @@ static void python_process_general_event(union perf_event *perf_event | |||
370 | if (!handler || !PyCallable_Check(handler)) | 381 | if (!handler || !PyCallable_Check(handler)) |
371 | goto exit; | 382 | goto exit; |
372 | 383 | ||
373 | PyDict_SetItemString(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); | 384 | pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); |
374 | PyDict_SetItemString(dict, "attr", PyString_FromStringAndSize( | 385 | pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize( |
375 | (const char *)&evsel->attr, sizeof(evsel->attr))); | 386 | (const char *)&evsel->attr, sizeof(evsel->attr))); |
376 | PyDict_SetItemString(dict, "sample", PyString_FromStringAndSize( | 387 | pydict_set_item_string_decref(dict, "sample", PyString_FromStringAndSize( |
377 | (const char *)sample, sizeof(*sample))); | 388 | (const char *)sample, sizeof(*sample))); |
378 | PyDict_SetItemString(dict, "raw_buf", PyString_FromStringAndSize( | 389 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( |
379 | (const char *)sample->raw_data, sample->raw_size)); | 390 | (const char *)sample->raw_data, sample->raw_size)); |
380 | PyDict_SetItemString(dict, "comm", | 391 | pydict_set_item_string_decref(dict, "comm", |
381 | PyString_FromString(thread->comm)); | 392 | PyString_FromString(thread->comm)); |
382 | if (al->map) { | 393 | if (al->map) { |
383 | PyDict_SetItemString(dict, "dso", | 394 | pydict_set_item_string_decref(dict, "dso", |
384 | PyString_FromString(al->map->dso->name)); | 395 | PyString_FromString(al->map->dso->name)); |
385 | } | 396 | } |
386 | if (al->sym) { | 397 | if (al->sym) { |
387 | PyDict_SetItemString(dict, "symbol", | 398 | pydict_set_item_string_decref(dict, "symbol", |
388 | PyString_FromString(al->sym->name)); | 399 | PyString_FromString(al->sym->name)); |
389 | } | 400 | } |
390 | 401 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a9dd682cf5e3..1cf9ccb01013 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -3091,7 +3091,7 @@ static const struct file_operations *stat_fops[] = { | |||
3091 | 3091 | ||
3092 | static int kvm_init_debug(void) | 3092 | static int kvm_init_debug(void) |
3093 | { | 3093 | { |
3094 | int r = -EFAULT; | 3094 | int r = -EEXIST; |
3095 | struct kvm_stats_debugfs_item *p; | 3095 | struct kvm_stats_debugfs_item *p; |
3096 | 3096 | ||
3097 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); | 3097 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); |