diff options
112 files changed, 783 insertions, 382 deletions
diff --git a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl index 00e425faa2fd..78c9a7b2b58f 100644 --- a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl +++ b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl | |||
| @@ -47,7 +47,6 @@ use constant HIGH_KSWAPD_REWAKEUP => 21; | |||
| 47 | use constant HIGH_NR_SCANNED => 22; | 47 | use constant HIGH_NR_SCANNED => 22; |
| 48 | use constant HIGH_NR_TAKEN => 23; | 48 | use constant HIGH_NR_TAKEN => 23; |
| 49 | use constant HIGH_NR_RECLAIMED => 24; | 49 | use constant HIGH_NR_RECLAIMED => 24; |
| 50 | use constant HIGH_NR_CONTIG_DIRTY => 25; | ||
| 51 | 50 | ||
| 52 | my %perprocesspid; | 51 | my %perprocesspid; |
| 53 | my %perprocess; | 52 | my %perprocess; |
| @@ -105,7 +104,7 @@ my $regex_direct_end_default = 'nr_reclaimed=([0-9]*)'; | |||
| 105 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; | 104 | my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; |
| 106 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; | 105 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; |
| 107 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; | 106 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; |
| 108 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; | 107 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) file=([0-9]*)'; |
| 109 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; | 108 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; |
| 110 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; | 109 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; |
| 111 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; | 110 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; |
| @@ -200,7 +199,7 @@ $regex_lru_isolate = generate_traceevent_regex( | |||
| 200 | $regex_lru_isolate_default, | 199 | $regex_lru_isolate_default, |
| 201 | "isolate_mode", "order", | 200 | "isolate_mode", "order", |
| 202 | "nr_requested", "nr_scanned", "nr_taken", | 201 | "nr_requested", "nr_scanned", "nr_taken", |
| 203 | "contig_taken", "contig_dirty", "contig_failed"); | 202 | "file"); |
| 204 | $regex_lru_shrink_inactive = generate_traceevent_regex( | 203 | $regex_lru_shrink_inactive = generate_traceevent_regex( |
| 205 | "vmscan/mm_vmscan_lru_shrink_inactive", | 204 | "vmscan/mm_vmscan_lru_shrink_inactive", |
| 206 | $regex_lru_shrink_inactive_default, | 205 | $regex_lru_shrink_inactive_default, |
| @@ -375,7 +374,6 @@ EVENT_PROCESS: | |||
| 375 | } | 374 | } |
| 376 | my $isolate_mode = $1; | 375 | my $isolate_mode = $1; |
| 377 | my $nr_scanned = $4; | 376 | my $nr_scanned = $4; |
| 378 | my $nr_contig_dirty = $7; | ||
| 379 | 377 | ||
| 380 | # To closer match vmstat scanning statistics, only count isolate_both | 378 | # To closer match vmstat scanning statistics, only count isolate_both |
| 381 | # and isolate_inactive as scanning. isolate_active is rotation | 379 | # and isolate_inactive as scanning. isolate_active is rotation |
| @@ -385,7 +383,6 @@ EVENT_PROCESS: | |||
| 385 | if ($isolate_mode != 2) { | 383 | if ($isolate_mode != 2) { |
| 386 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; | 384 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; |
| 387 | } | 385 | } |
| 388 | $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; | ||
| 389 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { | 386 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { |
| 390 | $details = $6; | 387 | $details = $6; |
| 391 | if ($details !~ /$regex_lru_shrink_inactive/o) { | 388 | if ($details !~ /$regex_lru_shrink_inactive/o) { |
| @@ -539,13 +536,6 @@ sub dump_stats { | |||
| 539 | } | 536 | } |
| 540 | } | 537 | } |
| 541 | } | 538 | } |
| 542 | if ($stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}) { | ||
| 543 | print " "; | ||
| 544 | my $count = $stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}; | ||
| 545 | if ($count != 0) { | ||
| 546 | print "contig-dirty=$count "; | ||
| 547 | } | ||
| 548 | } | ||
| 549 | 539 | ||
| 550 | print "\n"; | 540 | print "\n"; |
| 551 | } | 541 | } |
diff --git a/MAINTAINERS b/MAINTAINERS index 702ca10a5a6c..8e8b1dc08dbd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -9406,12 +9406,6 @@ S: Maintained | |||
| 9406 | F: drivers/usb/host/isp116x* | 9406 | F: drivers/usb/host/isp116x* |
| 9407 | F: include/linux/usb/isp116x.h | 9407 | F: include/linux/usb/isp116x.h |
| 9408 | 9408 | ||
| 9409 | USB KAWASAKI LSI DRIVER | ||
| 9410 | M: Oliver Neukum <oliver@neukum.org> | ||
| 9411 | L: linux-usb@vger.kernel.org | ||
| 9412 | S: Maintained | ||
| 9413 | F: drivers/usb/serial/kl5kusb105.* | ||
| 9414 | |||
| 9415 | USB MASS STORAGE DRIVER | 9409 | USB MASS STORAGE DRIVER |
| 9416 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> | 9410 | M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> |
| 9417 | L: linux-usb@vger.kernel.org | 9411 | L: linux-usb@vger.kernel.org |
| @@ -9439,12 +9433,6 @@ S: Maintained | |||
| 9439 | F: Documentation/usb/ohci.txt | 9433 | F: Documentation/usb/ohci.txt |
| 9440 | F: drivers/usb/host/ohci* | 9434 | F: drivers/usb/host/ohci* |
| 9441 | 9435 | ||
| 9442 | USB OPTION-CARD DRIVER | ||
| 9443 | M: Matthias Urlichs <smurf@smurf.noris.de> | ||
| 9444 | L: linux-usb@vger.kernel.org | ||
| 9445 | S: Maintained | ||
| 9446 | F: drivers/usb/serial/option.c | ||
| 9447 | |||
| 9448 | USB PEGASUS DRIVER | 9436 | USB PEGASUS DRIVER |
| 9449 | M: Petko Manolov <petkan@nucleusys.com> | 9437 | M: Petko Manolov <petkan@nucleusys.com> |
| 9450 | L: linux-usb@vger.kernel.org | 9438 | L: linux-usb@vger.kernel.org |
| @@ -9477,7 +9465,7 @@ S: Maintained | |||
| 9477 | F: drivers/net/usb/rtl8150.c | 9465 | F: drivers/net/usb/rtl8150.c |
| 9478 | 9466 | ||
| 9479 | USB SERIAL SUBSYSTEM | 9467 | USB SERIAL SUBSYSTEM |
| 9480 | M: Johan Hovold <jhovold@gmail.com> | 9468 | M: Johan Hovold <johan@kernel.org> |
| 9481 | L: linux-usb@vger.kernel.org | 9469 | L: linux-usb@vger.kernel.org |
| 9482 | S: Maintained | 9470 | S: Maintained |
| 9483 | F: Documentation/usb/usb-serial.txt | 9471 | F: Documentation/usb/usb-serial.txt |
| @@ -126,7 +126,10 @@ PHONY += $(MAKECMDGOALS) sub-make | |||
| 126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make | 126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make |
| 127 | @: | 127 | @: |
| 128 | 128 | ||
| 129 | # Fake the "Entering directory" message once, so that IDEs/editors are | ||
| 130 | # able to understand relative filenames. | ||
| 129 | sub-make: FORCE | 131 | sub-make: FORCE |
| 132 | @echo "make[1]: Entering directory \`$(KBUILD_OUTPUT)'" | ||
| 130 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ | 133 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ |
| 131 | KBUILD_SRC=$(CURDIR) \ | 134 | KBUILD_SRC=$(CURDIR) \ |
| 132 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ | 135 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ |
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index cd5e4f568439..f3c56a182fd8 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
| @@ -384,6 +384,7 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
| 384 | 384 | ||
| 385 | kfree(vcpu->arch.guest_ebase); | 385 | kfree(vcpu->arch.guest_ebase); |
| 386 | kfree(vcpu->arch.kseg0_commpage); | 386 | kfree(vcpu->arch.kseg0_commpage); |
| 387 | kfree(vcpu); | ||
| 387 | } | 388 | } |
| 388 | 389 | ||
| 389 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) | 390 | void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) |
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild index 6a9a9eb645f5..736637363d31 100644 --- a/arch/s390/include/uapi/asm/Kbuild +++ b/arch/s390/include/uapi/asm/Kbuild | |||
| @@ -36,6 +36,7 @@ header-y += signal.h | |||
| 36 | header-y += socket.h | 36 | header-y += socket.h |
| 37 | header-y += sockios.h | 37 | header-y += sockios.h |
| 38 | header-y += sclp_ctl.h | 38 | header-y += sclp_ctl.h |
| 39 | header-y += sie.h | ||
| 39 | header-y += stat.h | 40 | header-y += stat.h |
| 40 | header-y += statfs.h | 41 | header-y += statfs.h |
| 41 | header-y += swab.h | 42 | header-y += swab.h |
diff --git a/arch/s390/include/uapi/asm/sie.h b/arch/s390/include/uapi/asm/sie.h index 3d97f610198d..5d9cc19462c4 100644 --- a/arch/s390/include/uapi/asm/sie.h +++ b/arch/s390/include/uapi/asm/sie.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef _UAPI_ASM_S390_SIE_H | 1 | #ifndef _UAPI_ASM_S390_SIE_H |
| 2 | #define _UAPI_ASM_S390_SIE_H | 2 | #define _UAPI_ASM_S390_SIE_H |
| 3 | 3 | ||
| 4 | #include <asm/sigp.h> | ||
| 5 | |||
| 6 | #define diagnose_codes \ | 4 | #define diagnose_codes \ |
| 7 | { 0x10, "DIAG (0x10) release pages" }, \ | 5 | { 0x10, "DIAG (0x10) release pages" }, \ |
| 8 | { 0x44, "DIAG (0x44) time slice end" }, \ | 6 | { 0x44, "DIAG (0x44) time slice end" }, \ |
| @@ -13,18 +11,18 @@ | |||
| 13 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ | 11 | { 0x500, "DIAG (0x500) KVM virtio functions" }, \ |
| 14 | { 0x501, "DIAG (0x501) KVM breakpoint" } | 12 | { 0x501, "DIAG (0x501) KVM breakpoint" } |
| 15 | 13 | ||
| 16 | #define sigp_order_codes \ | 14 | #define sigp_order_codes \ |
| 17 | { SIGP_SENSE, "SIGP sense" }, \ | 15 | { 0x01, "SIGP sense" }, \ |
| 18 | { SIGP_EXTERNAL_CALL, "SIGP external call" }, \ | 16 | { 0x02, "SIGP external call" }, \ |
| 19 | { SIGP_EMERGENCY_SIGNAL, "SIGP emergency signal" }, \ | 17 | { 0x03, "SIGP emergency signal" }, \ |
| 20 | { SIGP_STOP, "SIGP stop" }, \ | 18 | { 0x05, "SIGP stop" }, \ |
| 21 | { SIGP_STOP_AND_STORE_STATUS, "SIGP stop and store status" }, \ | 19 | { 0x06, "SIGP restart" }, \ |
| 22 | { SIGP_SET_ARCHITECTURE, "SIGP set architecture" }, \ | 20 | { 0x09, "SIGP stop and store status" }, \ |
| 23 | { SIGP_SET_PREFIX, "SIGP set prefix" }, \ | 21 | { 0x0b, "SIGP initial cpu reset" }, \ |
| 24 | { SIGP_SENSE_RUNNING, "SIGP sense running" }, \ | 22 | { 0x0d, "SIGP set prefix" }, \ |
| 25 | { SIGP_RESTART, "SIGP restart" }, \ | 23 | { 0x0e, "SIGP store status at address" }, \ |
| 26 | { SIGP_INITIAL_CPU_RESET, "SIGP initial cpu reset" }, \ | 24 | { 0x12, "SIGP set architecture" }, \ |
| 27 | { SIGP_STORE_STATUS_AT_ADDRESS, "SIGP store status at address" } | 25 | { 0x15, "SIGP sense running" } |
| 28 | 26 | ||
| 29 | #define icpt_prog_codes \ | 27 | #define icpt_prog_codes \ |
| 30 | { 0x0001, "Prog Operation" }, \ | 28 | { 0x0001, "Prog Operation" }, \ |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 49314155b66c..49205d01b9ad 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) | |||
| 95 | #define KVM_REFILL_PAGES 25 | 95 | #define KVM_REFILL_PAGES 25 |
| 96 | #define KVM_MAX_CPUID_ENTRIES 80 | 96 | #define KVM_MAX_CPUID_ENTRIES 80 |
| 97 | #define KVM_NR_FIXED_MTRR_REGION 88 | 97 | #define KVM_NR_FIXED_MTRR_REGION 88 |
| 98 | #define KVM_NR_VAR_MTRR 8 | 98 | #define KVM_NR_VAR_MTRR 10 |
| 99 | 99 | ||
| 100 | #define ASYNC_PF_PER_VCPU 64 | 100 | #define ASYNC_PF_PER_VCPU 64 |
| 101 | 101 | ||
| @@ -461,7 +461,7 @@ struct kvm_vcpu_arch { | |||
| 461 | bool nmi_injected; /* Trying to inject an NMI this entry */ | 461 | bool nmi_injected; /* Trying to inject an NMI this entry */ |
| 462 | 462 | ||
| 463 | struct mtrr_state_type mtrr_state; | 463 | struct mtrr_state_type mtrr_state; |
| 464 | u32 pat; | 464 | u64 pat; |
| 465 | 465 | ||
| 466 | unsigned switch_db_regs; | 466 | unsigned switch_db_regs; |
| 467 | unsigned long db[KVM_NR_DB_REGS]; | 467 | unsigned long db[KVM_NR_DB_REGS]; |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 14fd6fd75a19..6205f0c434db 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
| @@ -231,6 +231,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, | |||
| 231 | 231 | ||
| 232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO | 232 | #define ARCH_HAS_USER_SINGLE_STEP_INFO |
| 233 | 233 | ||
| 234 | /* | ||
| 235 | * When hitting ptrace_stop(), we cannot return using SYSRET because | ||
| 236 | * that does not restore the full CPU state, only a minimal set. The | ||
| 237 | * ptracer can change arbitrary register values, which is usually okay | ||
| 238 | * because the usual ptrace stops run off the signal delivery path which | ||
| 239 | * forces IRET; however, ptrace_event() stops happen in arbitrary places | ||
| 240 | * in the kernel and don't force IRET path. | ||
| 241 | * | ||
| 242 | * So force IRET path after a ptrace stop. | ||
| 243 | */ | ||
| 244 | #define arch_ptrace_stop_needed(code, info) \ | ||
| 245 | ({ \ | ||
| 246 | set_thread_flag(TIF_NOTIFY_RESUME); \ | ||
| 247 | false; \ | ||
| 248 | }) | ||
| 249 | |||
| 234 | struct user_desc; | 250 | struct user_desc; |
| 235 | extern int do_get_thread_area(struct task_struct *p, int idx, | 251 | extern int do_get_thread_area(struct task_struct *p, int idx, |
| 236 | struct user_desc __user *info); | 252 | struct user_desc __user *info); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ec8366c5cfea..b5e994ad0135 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -1462,6 +1462,7 @@ static void svm_get_segment(struct kvm_vcpu *vcpu, | |||
| 1462 | */ | 1462 | */ |
| 1463 | if (var->unusable) | 1463 | if (var->unusable) |
| 1464 | var->db = 0; | 1464 | var->db = 0; |
| 1465 | var->dpl = to_svm(vcpu)->vmcb->save.cpl; | ||
| 1465 | break; | 1466 | break; |
| 1466 | } | 1467 | } |
| 1467 | } | 1468 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f32a02578c0d..f6449334ec45 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -1898,7 +1898,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
| 1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) | 1898 | if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) |
| 1899 | break; | 1899 | break; |
| 1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; | 1900 | gfn = data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; |
| 1901 | if (kvm_write_guest(kvm, data, | 1901 | if (kvm_write_guest(kvm, gfn << HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT, |
| 1902 | &tsc_ref, sizeof(tsc_ref))) | 1902 | &tsc_ref, sizeof(tsc_ref))) |
| 1903 | return 1; | 1903 | return 1; |
| 1904 | mark_page_dirty(kvm, gfn); | 1904 | mark_page_dirty(kvm, gfn); |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 48eccb350180..089e72cd37be 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -622,8 +622,10 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) | |||
| 622 | memset(&zram->stats, 0, sizeof(zram->stats)); | 622 | memset(&zram->stats, 0, sizeof(zram->stats)); |
| 623 | 623 | ||
| 624 | zram->disksize = 0; | 624 | zram->disksize = 0; |
| 625 | if (reset_capacity) | 625 | if (reset_capacity) { |
| 626 | set_capacity(zram->disk, 0); | 626 | set_capacity(zram->disk, 0); |
| 627 | revalidate_disk(zram->disk); | ||
| 628 | } | ||
| 627 | up_write(&zram->init_lock); | 629 | up_write(&zram->init_lock); |
| 628 | } | 630 | } |
| 629 | 631 | ||
| @@ -664,6 +666,7 @@ static ssize_t disksize_store(struct device *dev, | |||
| 664 | zram->comp = comp; | 666 | zram->comp = comp; |
| 665 | zram->disksize = disksize; | 667 | zram->disksize = disksize; |
| 666 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); | 668 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); |
| 669 | revalidate_disk(zram->disk); | ||
| 667 | up_write(&zram->init_lock); | 670 | up_write(&zram->init_lock); |
| 668 | return len; | 671 | return len; |
| 669 | 672 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8218078b6133..8218078b6133 100755..100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 9ad0c6afc487..61cb90e729a6 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
| @@ -6038,6 +6038,27 @@ int i915_release_power_well(void) | |||
| 6038 | } | 6038 | } |
| 6039 | EXPORT_SYMBOL_GPL(i915_release_power_well); | 6039 | EXPORT_SYMBOL_GPL(i915_release_power_well); |
| 6040 | 6040 | ||
| 6041 | /* | ||
| 6042 | * Private interface for the audio driver to get CDCLK in kHz. | ||
| 6043 | * | ||
| 6044 | * Caller must request power well using i915_request_power_well() prior to | ||
| 6045 | * making the call. | ||
| 6046 | */ | ||
| 6047 | int i915_get_cdclk_freq(void) | ||
| 6048 | { | ||
| 6049 | struct drm_i915_private *dev_priv; | ||
| 6050 | |||
| 6051 | if (!hsw_pwr) | ||
| 6052 | return -ENODEV; | ||
| 6053 | |||
| 6054 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | ||
| 6055 | power_domains); | ||
| 6056 | |||
| 6057 | return intel_ddi_get_cdclk_freq(dev_priv); | ||
| 6058 | } | ||
| 6059 | EXPORT_SYMBOL_GPL(i915_get_cdclk_freq); | ||
| 6060 | |||
| 6061 | |||
| 6041 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) | 6062 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) |
| 6042 | 6063 | ||
| 6043 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ | 6064 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index c5b1f2da3954..35f4182c63b6 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
| @@ -403,16 +403,18 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
| 403 | { | 403 | { |
| 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
| 405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
| 406 | int ret, i; | 406 | int ret; |
| 407 | |||
| 408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
| 407 | 409 | ||
| 408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
| 409 | DP_DPCD_SIZE); | 411 | DP_DPCD_SIZE); |
| 410 | if (ret > 0) { | 412 | if (ret > 0) { |
| 411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
| 412 | DRM_DEBUG_KMS("DPCD: "); | 414 | |
| 413 | for (i = 0; i < DP_DPCD_SIZE; i++) | 415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), |
| 414 | DRM_DEBUG_KMS("%02x ", msg[i]); | 416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); |
| 415 | DRM_DEBUG_KMS("\n"); | 417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); |
| 416 | 418 | ||
| 417 | radeon_dp_probe_oui(radeon_connector); | 419 | radeon_dp_probe_oui(radeon_connector); |
| 418 | 420 | ||
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index ae88660f34ea..0c6e1b55d968 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
| @@ -1752,12 +1752,12 @@ | |||
| 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ | 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ |
| 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) | 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) |
| 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ | 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ |
| 1755 | #define EOP_TCL2_VOLATILE (1 << 24) | ||
| 1755 | #define EOP_CACHE_POLICY(x) ((x) << 25) | 1756 | #define EOP_CACHE_POLICY(x) ((x) << 25) |
| 1756 | /* 0 - LRU | 1757 | /* 0 - LRU |
| 1757 | * 1 - Stream | 1758 | * 1 - Stream |
| 1758 | * 2 - Bypass | 1759 | * 2 - Bypass |
| 1759 | */ | 1760 | */ |
| 1760 | #define EOP_TCL2_VOLATILE (1 << 27) | ||
| 1761 | #define DATA_SEL(x) ((x) << 29) | 1761 | #define DATA_SEL(x) ((x) << 29) |
| 1762 | /* 0 - discard | 1762 | /* 0 - discard |
| 1763 | * 1 - send low 32bit data | 1763 | * 1 - send low 32bit data |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 5a9a5f4d7888..47d31e915758 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
| @@ -1551,7 +1551,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
| 1551 | 1551 | ||
| 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; | 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; |
| 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = | 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = |
| 1554 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1554 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
| 1555 | } | 1555 | } |
| 1556 | 1556 | ||
| 1557 | return 0; | 1557 | return 0; |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 3f6e817d97ee..9ef8c38f2d66 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
| @@ -2726,7 +2726,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
| 2726 | pi->caps_sclk_ds = true; | 2726 | pi->caps_sclk_ds = true; |
| 2727 | pi->enable_auto_thermal_throttling = true; | 2727 | pi->enable_auto_thermal_throttling = true; |
| 2728 | pi->disable_nb_ps3_in_battery = false; | 2728 | pi->disable_nb_ps3_in_battery = false; |
| 2729 | pi->bapm_enable = false; | 2729 | pi->bapm_enable = true; |
| 2730 | pi->voltage_drop_t = 0; | 2730 | pi->voltage_drop_t = 0; |
| 2731 | pi->caps_sclk_throttle_low_notification = false; | 2731 | pi->caps_sclk_throttle_low_notification = false; |
| 2732 | pi->caps_fps = false; /* true? */ | 2732 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 004c931606c4..01fc4888e6fe 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
| @@ -1315,7 +1315,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
| 1315 | 1315 | ||
| 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; | 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; |
| 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = | 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = |
| 1318 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1318 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
| 1319 | } | 1319 | } |
| 1320 | } | 1320 | } |
| 1321 | 1321 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4b0bbf88d5c0..29d9cc04c04e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -102,6 +102,7 @@ extern int radeon_runtime_pm; | |||
| 102 | extern int radeon_hard_reset; | 102 | extern int radeon_hard_reset; |
| 103 | extern int radeon_vm_size; | 103 | extern int radeon_vm_size; |
| 104 | extern int radeon_vm_block_size; | 104 | extern int radeon_vm_block_size; |
| 105 | extern int radeon_deep_color; | ||
| 105 | 106 | ||
| 106 | /* | 107 | /* |
| 107 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 108 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
| @@ -749,10 +750,6 @@ union radeon_irq_stat_regs { | |||
| 749 | struct cik_irq_stat_regs cik; | 750 | struct cik_irq_stat_regs cik; |
| 750 | }; | 751 | }; |
| 751 | 752 | ||
| 752 | #define RADEON_MAX_HPD_PINS 7 | ||
| 753 | #define RADEON_MAX_CRTCS 6 | ||
| 754 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
| 755 | |||
| 756 | struct radeon_irq { | 753 | struct radeon_irq { |
| 757 | bool installed; | 754 | bool installed; |
| 758 | spinlock_t lock; | 755 | spinlock_t lock; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 30844814c25a..173f378428a9 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -1227,11 +1227,19 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
| 1227 | rdev->clock.default_dispclk = | 1227 | rdev->clock.default_dispclk = |
| 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); | 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); |
| 1229 | if (rdev->clock.default_dispclk == 0) { | 1229 | if (rdev->clock.default_dispclk == 0) { |
| 1230 | if (ASIC_IS_DCE5(rdev)) | 1230 | if (ASIC_IS_DCE6(rdev)) |
| 1231 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | ||
| 1232 | else if (ASIC_IS_DCE5(rdev)) | ||
| 1231 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ | 1233 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ |
| 1232 | else | 1234 | else |
| 1233 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | 1235 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ |
| 1234 | } | 1236 | } |
| 1237 | /* set a reasonable default for DP */ | ||
| 1238 | if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { | ||
| 1239 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", | ||
| 1240 | rdev->clock.default_dispclk / 100); | ||
| 1241 | rdev->clock.default_dispclk = 60000; | ||
| 1242 | } | ||
| 1235 | rdev->clock.dp_extclk = | 1243 | rdev->clock.dp_extclk = |
| 1236 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); | 1244 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
| 1237 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; | 1245 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 1b9177ed181f..44831197e82e 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -199,6 +199,9 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) | |||
| 199 | } | 199 | } |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | if ((radeon_deep_color == 0) && (bpc > 8)) | ||
| 203 | bpc = 8; | ||
| 204 | |||
| 202 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", | 205 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", |
| 203 | connector->name, connector->display_info.bpc, bpc); | 206 | connector->name, connector->display_info.bpc, bpc); |
| 204 | 207 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8fc362aa6a1a..13896edcf0b6 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -285,7 +285,6 @@ static void radeon_unpin_work_func(struct work_struct *__work) | |||
| 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) |
| 286 | { | 286 | { |
| 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 288 | struct radeon_flip_work *work; | ||
| 289 | unsigned long flags; | 288 | unsigned long flags; |
| 290 | u32 update_pending; | 289 | u32 update_pending; |
| 291 | int vpos, hpos; | 290 | int vpos, hpos; |
| @@ -295,8 +294,11 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | |||
| 295 | return; | 294 | return; |
| 296 | 295 | ||
| 297 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
| 298 | work = radeon_crtc->flip_work; | 297 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
| 299 | if (work == NULL) { | 298 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " |
| 299 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
| 300 | radeon_crtc->flip_status, | ||
| 301 | RADEON_FLIP_SUBMITTED); | ||
| 300 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 302 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
| 301 | return; | 303 | return; |
| 302 | } | 304 | } |
| @@ -344,12 +346,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
| 344 | 346 | ||
| 345 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 347 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
| 346 | work = radeon_crtc->flip_work; | 348 | work = radeon_crtc->flip_work; |
| 347 | if (work == NULL) { | 349 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
| 350 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " | ||
| 351 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
| 352 | radeon_crtc->flip_status, | ||
| 353 | RADEON_FLIP_SUBMITTED); | ||
| 348 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 354 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
| 349 | return; | 355 | return; |
| 350 | } | 356 | } |
| 351 | 357 | ||
| 352 | /* Pageflip completed. Clean up. */ | 358 | /* Pageflip completed. Clean up. */ |
| 359 | radeon_crtc->flip_status = RADEON_FLIP_NONE; | ||
| 353 | radeon_crtc->flip_work = NULL; | 360 | radeon_crtc->flip_work = NULL; |
| 354 | 361 | ||
| 355 | /* wakeup userspace */ | 362 | /* wakeup userspace */ |
| @@ -476,6 +483,7 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 476 | /* do the flip (mmio) */ | 483 | /* do the flip (mmio) */ |
| 477 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | 484 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); |
| 478 | 485 | ||
| 486 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
| 479 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 487 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 480 | up_read(&rdev->exclusive_lock); | 488 | up_read(&rdev->exclusive_lock); |
| 481 | 489 | ||
| @@ -544,7 +552,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
| 544 | /* We borrow the event spin lock for protecting flip_work */ | 552 | /* We borrow the event spin lock for protecting flip_work */ |
| 545 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 553 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
| 546 | 554 | ||
| 547 | if (radeon_crtc->flip_work) { | 555 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
| 548 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 556 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
| 549 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 557 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 550 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 558 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
| @@ -552,6 +560,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
| 552 | kfree(work); | 560 | kfree(work); |
| 553 | return -EBUSY; | 561 | return -EBUSY; |
| 554 | } | 562 | } |
| 563 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
| 555 | radeon_crtc->flip_work = work; | 564 | radeon_crtc->flip_work = work; |
| 556 | 565 | ||
| 557 | /* update crtc fb */ | 566 | /* update crtc fb */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 6e3017413386..cb1421369e3a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -175,6 +175,7 @@ int radeon_runtime_pm = -1; | |||
| 175 | int radeon_hard_reset = 0; | 175 | int radeon_hard_reset = 0; |
| 176 | int radeon_vm_size = 4096; | 176 | int radeon_vm_size = 4096; |
| 177 | int radeon_vm_block_size = 9; | 177 | int radeon_vm_block_size = 9; |
| 178 | int radeon_deep_color = 0; | ||
| 178 | 179 | ||
| 179 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 180 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
| 180 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 181 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
| @@ -248,6 +249,9 @@ module_param_named(vm_size, radeon_vm_size, int, 0444); | |||
| 248 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); | 249 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); |
| 249 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); | 250 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); |
| 250 | 251 | ||
| 252 | MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))"); | ||
| 253 | module_param_named(deep_color, radeon_deep_color, int, 0444); | ||
| 254 | |||
| 251 | static struct pci_device_id pciidlist[] = { | 255 | static struct pci_device_id pciidlist[] = { |
| 252 | radeon_PCI_IDS | 256 | radeon_PCI_IDS |
| 253 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index ad0e4b8cc7e3..0592ddb0904b 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -46,6 +46,10 @@ struct radeon_device; | |||
| 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
| 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
| 48 | 48 | ||
| 49 | #define RADEON_MAX_HPD_PINS 7 | ||
| 50 | #define RADEON_MAX_CRTCS 6 | ||
| 51 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
| 52 | |||
| 49 | enum radeon_rmx_type { | 53 | enum radeon_rmx_type { |
| 50 | RMX_OFF, | 54 | RMX_OFF, |
| 51 | RMX_FULL, | 55 | RMX_FULL, |
| @@ -233,8 +237,8 @@ struct radeon_mode_info { | |||
| 233 | struct card_info *atom_card_info; | 237 | struct card_info *atom_card_info; |
| 234 | enum radeon_connector_table connector_table; | 238 | enum radeon_connector_table connector_table; |
| 235 | bool mode_config_initialized; | 239 | bool mode_config_initialized; |
| 236 | struct radeon_crtc *crtcs[6]; | 240 | struct radeon_crtc *crtcs[RADEON_MAX_CRTCS]; |
| 237 | struct radeon_afmt *afmt[7]; | 241 | struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS]; |
| 238 | /* DVI-I properties */ | 242 | /* DVI-I properties */ |
| 239 | struct drm_property *coherent_mode_property; | 243 | struct drm_property *coherent_mode_property; |
| 240 | /* DAC enable load detect */ | 244 | /* DAC enable load detect */ |
| @@ -302,6 +306,12 @@ struct radeon_atom_ss { | |||
| 302 | uint16_t amount; | 306 | uint16_t amount; |
| 303 | }; | 307 | }; |
| 304 | 308 | ||
| 309 | enum radeon_flip_status { | ||
| 310 | RADEON_FLIP_NONE, | ||
| 311 | RADEON_FLIP_PENDING, | ||
| 312 | RADEON_FLIP_SUBMITTED | ||
| 313 | }; | ||
| 314 | |||
| 305 | struct radeon_crtc { | 315 | struct radeon_crtc { |
| 306 | struct drm_crtc base; | 316 | struct drm_crtc base; |
| 307 | int crtc_id; | 317 | int crtc_id; |
| @@ -327,6 +337,7 @@ struct radeon_crtc { | |||
| 327 | /* page flipping */ | 337 | /* page flipping */ |
| 328 | struct workqueue_struct *flip_queue; | 338 | struct workqueue_struct *flip_queue; |
| 329 | struct radeon_flip_work *flip_work; | 339 | struct radeon_flip_work *flip_work; |
| 340 | enum radeon_flip_status flip_status; | ||
| 330 | /* pll sharing */ | 341 | /* pll sharing */ |
| 331 | struct radeon_atom_ss ss; | 342 | struct radeon_atom_ss ss; |
| 332 | bool ss_enabled; | 343 | bool ss_enabled; |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 12c663e86ca1..e447e390d09a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -73,8 +73,10 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | |||
| 73 | rdev->pm.dpm.ac_power = true; | 73 | rdev->pm.dpm.ac_power = true; |
| 74 | else | 74 | else |
| 75 | rdev->pm.dpm.ac_power = false; | 75 | rdev->pm.dpm.ac_power = false; |
| 76 | if (rdev->asic->dpm.enable_bapm) | 76 | if (rdev->family == CHIP_ARUBA) { |
| 77 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | 77 | if (rdev->asic->dpm.enable_bapm) |
| 78 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | ||
| 79 | } | ||
| 78 | mutex_unlock(&rdev->pm.mutex); | 80 | mutex_unlock(&rdev->pm.mutex); |
| 79 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 81 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { |
| 80 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 82 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 899d9126cad6..eecff6bbd341 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
| @@ -495,7 +495,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
| 495 | mutex_unlock(&vm->mutex); | 495 | mutex_unlock(&vm->mutex); |
| 496 | 496 | ||
| 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, | 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, |
| 498 | RADEON_GPU_PAGE_SIZE, false, | 498 | RADEON_GPU_PAGE_SIZE, true, |
| 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); | 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); |
| 500 | if (r) | 500 | if (r) |
| 501 | return r; | 501 | return r; |
| @@ -992,7 +992,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 992 | return -ENOMEM; | 992 | return -ENOMEM; |
| 993 | } | 993 | } |
| 994 | 994 | ||
| 995 | r = radeon_bo_create(rdev, pd_size, align, false, | 995 | r = radeon_bo_create(rdev, pd_size, align, true, |
| 996 | RADEON_GEM_DOMAIN_VRAM, NULL, | 996 | RADEON_GEM_DOMAIN_VRAM, NULL, |
| 997 | &vm->page_directory); | 997 | &vm->page_directory); |
| 998 | if (r) | 998 | if (r) |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 2a2822c03329..20da6ff183df 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
| @@ -1874,7 +1874,15 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
| 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
| 1875 | pi->at[i] = TRINITY_AT_DFLT; | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
| 1876 | 1876 | ||
| 1877 | pi->enable_bapm = false; | 1877 | /* There are stability issues reported on latops with |
| 1878 | * bapm installed when switching between AC and battery | ||
| 1879 | * power. At the same time, some desktop boards hang | ||
| 1880 | * if it's not enabled and dpm is enabled. | ||
| 1881 | */ | ||
| 1882 | if (rdev->flags & RADEON_IS_MOBILITY) | ||
| 1883 | pi->enable_bapm = false; | ||
| 1884 | else | ||
| 1885 | pi->enable_bapm = true; | ||
| 1878 | pi->enable_nbps_policy = true; | 1886 | pi->enable_nbps_policy = true; |
| 1879 | pi->enable_sclk_ds = true; | 1887 | pi->enable_sclk_ds = true; |
| 1880 | pi->enable_gfx_power_gating = true; | 1888 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 39b4cb48d738..6eba301ee03d 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
| @@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, | |||
| 427 | int ret; | 427 | int ret; |
| 428 | struct ad799x_state *st = iio_priv(indio_dev); | 428 | struct ad799x_state *st = iio_priv(indio_dev); |
| 429 | 429 | ||
| 430 | if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) | ||
| 431 | return -EINVAL; | ||
| 432 | |||
| 430 | mutex_lock(&indio_dev->mlock); | 433 | mutex_lock(&indio_dev->mlock); |
| 431 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), | 434 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), |
| 432 | val); | 435 | val << chan->scan_type.shift); |
| 433 | mutex_unlock(&indio_dev->mlock); | 436 | mutex_unlock(&indio_dev->mlock); |
| 434 | 437 | ||
| 435 | return ret; | 438 | return ret; |
| @@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, | |||
| 452 | mutex_unlock(&indio_dev->mlock); | 455 | mutex_unlock(&indio_dev->mlock); |
| 453 | if (ret < 0) | 456 | if (ret < 0) |
| 454 | return ret; | 457 | return ret; |
| 455 | *val = valin; | 458 | *val = (valin >> chan->scan_type.shift) & |
| 459 | RES_MASK(chan->scan_type.realbits); | ||
| 456 | 460 | ||
| 457 | return IIO_VAL_INT; | 461 | return IIO_VAL_INT; |
| 458 | } | 462 | } |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d833d55052ea..c7497009d60a 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
| @@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
| 183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
| 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
| 185 | np->full_name, name ? name : "", index); | 185 | np->full_name, name ? name : "", index); |
| 186 | return chan; | 186 | return NULL; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | /* | 189 | /* |
| @@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
| 193 | */ | 193 | */ |
| 194 | np = np->parent; | 194 | np = np->parent; |
| 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) | 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) |
| 196 | break; | 196 | return NULL; |
| 197 | } | 197 | } |
| 198 | |||
| 198 | return chan; | 199 | return chan; |
| 199 | } | 200 | } |
| 200 | 201 | ||
| @@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
| 317 | if (channel != NULL) | 318 | if (channel != NULL) |
| 318 | return channel; | 319 | return channel; |
| 319 | } | 320 | } |
| 321 | |||
| 320 | return iio_channel_get_sys(name, channel_name); | 322 | return iio_channel_get_sys(name, channel_name); |
| 321 | } | 323 | } |
| 322 | EXPORT_SYMBOL_GPL(iio_channel_get); | 324 | EXPORT_SYMBOL_GPL(iio_channel_get); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 34846856dbc6..32fc19c540d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -5599,7 +5599,7 @@ static int get_array_info(struct mddev * mddev, void __user * arg) | |||
| 5599 | if (mddev->in_sync) | 5599 | if (mddev->in_sync) |
| 5600 | info.state = (1<<MD_SB_CLEAN); | 5600 | info.state = (1<<MD_SB_CLEAN); |
| 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) | 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) |
| 5602 | info.state = (1<<MD_SB_BITMAP_PRESENT); | 5602 | info.state |= (1<<MD_SB_BITMAP_PRESENT); |
| 5603 | info.active_disks = insync; | 5603 | info.active_disks = insync; |
| 5604 | info.working_disks = working; | 5604 | info.working_disks = working; |
| 5605 | info.failed_disks = failed; | 5605 | info.failed_disks = failed; |
| @@ -7501,6 +7501,19 @@ void md_do_sync(struct md_thread *thread) | |||
| 7501 | rdev->recovery_offset < j) | 7501 | rdev->recovery_offset < j) |
| 7502 | j = rdev->recovery_offset; | 7502 | j = rdev->recovery_offset; |
| 7503 | rcu_read_unlock(); | 7503 | rcu_read_unlock(); |
| 7504 | |||
| 7505 | /* If there is a bitmap, we need to make sure all | ||
| 7506 | * writes that started before we added a spare | ||
| 7507 | * complete before we start doing a recovery. | ||
| 7508 | * Otherwise the write might complete and (via | ||
| 7509 | * bitmap_endwrite) set a bit in the bitmap after the | ||
| 7510 | * recovery has checked that bit and skipped that | ||
| 7511 | * region. | ||
| 7512 | */ | ||
| 7513 | if (mddev->bitmap) { | ||
| 7514 | mddev->pers->quiesce(mddev, 1); | ||
| 7515 | mddev->pers->quiesce(mddev, 0); | ||
| 7516 | } | ||
| 7504 | } | 7517 | } |
| 7505 | 7518 | ||
| 7506 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); | 7519 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e9689d57ccb6..6825eda1114a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2441,7 +2441,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
| 2441 | } | 2441 | } |
| 2442 | 2442 | ||
| 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; |
| 2444 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | 2444 | if (sdp->broken_fua) { |
| 2445 | sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); | ||
| 2446 | sdkp->DPOFUA = 0; | ||
| 2447 | } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
| 2445 | sd_first_printk(KERN_NOTICE, sdkp, | 2448 | sd_first_printk(KERN_NOTICE, sdkp, |
| 2446 | "Uses READ/WRITE(6), disabling FUA\n"); | 2449 | "Uses READ/WRITE(6), disabling FUA\n"); |
| 2447 | sdkp->DPOFUA = 0; | 2450 | sdkp->DPOFUA = 0; |
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 357cef2a6f4c..7194bd138762 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c | |||
| @@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
| 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; | 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; |
| 466 | struct ad7291_chip_info *chip; | 466 | struct ad7291_chip_info *chip; |
| 467 | struct iio_dev *indio_dev; | 467 | struct iio_dev *indio_dev; |
| 468 | int ret = 0; | 468 | int ret; |
| 469 | 469 | ||
| 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); | 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); |
| 471 | if (!indio_dev) | 471 | if (!indio_dev) |
| @@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
| 475 | if (pdata && pdata->use_external_ref) { | 475 | if (pdata && pdata->use_external_ref) { |
| 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); | 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); |
| 477 | if (IS_ERR(chip->reg)) | 477 | if (IS_ERR(chip->reg)) |
| 478 | return ret; | 478 | return PTR_ERR(chip->reg); |
| 479 | 479 | ||
| 480 | ret = regulator_enable(chip->reg); | 480 | ret = regulator_enable(chip->reg); |
| 481 | if (ret) | 481 | if (ret) |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 8945b4e3a2a6..cb50120ed7b5 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
| @@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt) | |||
| 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
| 281 | 281 | ||
| 282 | /* Wait until the state has moved to ON */ | 282 | /* Wait until the state has moved to ON */ |
| 283 | while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& | 283 | while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, |
| 284 | OMAP_INTRANSITION_MASK); | 284 | OMAP2_PM_PWSTST) & |
| 285 | OMAP_INTRANSITION_MASK) | ||
| 286 | ; | ||
| 285 | /* Disable Automatic transition */ | 287 | /* Disable Automatic transition */ |
| 286 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, | 288 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, |
| 287 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 289 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 69425b3cb6b7..9d2b673f90e3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
| @@ -1321,6 +1321,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
| 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
| 1323 | unsigned long flags; | 1323 | unsigned long flags; |
| 1324 | struct td_node *node, *tmpnode; | ||
| 1324 | 1325 | ||
| 1325 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || | 1326 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
| 1326 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || | 1327 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || |
| @@ -1331,6 +1332,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
| 1331 | 1332 | ||
| 1332 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1333 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
| 1333 | 1334 | ||
| 1335 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | ||
| 1336 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | ||
| 1337 | list_del(&node->td); | ||
| 1338 | kfree(node); | ||
| 1339 | } | ||
| 1340 | |||
| 1334 | /* pop request */ | 1341 | /* pop request */ |
| 1335 | list_del_init(&hwreq->queue); | 1342 | list_del_init(&hwreq->queue); |
| 1336 | 1343 | ||
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 8eb996e4f058..261c3b428220 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
| @@ -45,6 +45,7 @@ comment "Platform Glue Driver Support" | |||
| 45 | config USB_DWC3_OMAP | 45 | config USB_DWC3_OMAP |
| 46 | tristate "Texas Instruments OMAP5 and similar Platforms" | 46 | tristate "Texas Instruments OMAP5 and similar Platforms" |
| 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) | 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
| 48 | depends on OF | ||
| 48 | default USB_DWC3 | 49 | default USB_DWC3 |
| 49 | help | 50 | help |
| 50 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and | 51 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 4af4c3567656..07a736acd0f2 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
| @@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) | |||
| 322 | { | 322 | { |
| 323 | struct platform_device *pdev = to_platform_device(dev); | 323 | struct platform_device *pdev = to_platform_device(dev); |
| 324 | 324 | ||
| 325 | platform_device_unregister(pdev); | 325 | of_device_unregister(pdev); |
| 326 | 326 | ||
| 327 | return 0; | 327 | return 0; |
| 328 | } | 328 | } |
| @@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
| 599 | { | 599 | { |
| 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
| 601 | 601 | ||
| 602 | dwc3_omap_disable_irqs(omap); | 602 | dwc3_omap_write_irqmisc_set(omap, 0x00); |
| 603 | 603 | ||
| 604 | return 0; | 604 | return 0; |
| 605 | } | 605 | } |
| @@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev) | |||
| 607 | static void dwc3_omap_complete(struct device *dev) | 607 | static void dwc3_omap_complete(struct device *dev) |
| 608 | { | 608 | { |
| 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
| 610 | u32 reg; | ||
| 610 | 611 | ||
| 611 | dwc3_omap_enable_irqs(omap); | 612 | reg = (USBOTGSS_IRQMISC_OEVT | |
| 613 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
| 614 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
| 615 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
| 616 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
| 617 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
| 618 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
| 619 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
| 620 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
| 621 | |||
| 622 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
| 612 | } | 623 | } |
| 613 | 624 | ||
| 614 | static int dwc3_omap_suspend(struct device *dev) | 625 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9d64dd02c57e..dab7927d1009 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
| 828 | length, last ? " last" : "", | 828 | length, last ? " last" : "", |
| 829 | chain ? " chain" : ""); | 829 | chain ? " chain" : ""); |
| 830 | 830 | ||
| 831 | /* Skip the LINK-TRB on ISOC */ | ||
| 832 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
| 833 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
| 834 | dep->free_slot++; | ||
| 835 | 831 | ||
| 836 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; | 832 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
| 837 | 833 | ||
| @@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
| 843 | } | 839 | } |
| 844 | 840 | ||
| 845 | dep->free_slot++; | 841 | dep->free_slot++; |
| 842 | /* Skip the LINK-TRB on ISOC */ | ||
| 843 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
| 844 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
| 845 | dep->free_slot++; | ||
| 846 | 846 | ||
| 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); | 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
| 848 | trb->bpl = lower_32_bits(dma); | 848 | trb->bpl = lower_32_bits(dma); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 2ddcd635ca2a..97142146eead 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
| @@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = { | |||
| 1145 | .store_attribute = usb_os_desc_attr_store, | 1145 | .store_attribute = usb_os_desc_attr_store, |
| 1146 | }; | 1146 | }; |
| 1147 | 1147 | ||
| 1148 | static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc, | 1148 | static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc, |
| 1149 | char *page) | 1149 | char *page) |
| 1150 | { | 1150 | { |
| 1151 | memcpy(page, desc->ext_compat_id, 8); | 1151 | memcpy(page, desc->ext_compat_id, 8); |
| 1152 | return 8; | 1152 | return 8; |
| 1153 | } | 1153 | } |
| 1154 | 1154 | ||
| 1155 | static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | 1155 | static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc, |
| 1156 | const char *page, size_t len) | 1156 | const char *page, size_t len) |
| 1157 | { | 1157 | { |
| 1158 | int l; | 1158 | int l; |
| 1159 | 1159 | ||
| @@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | |||
| 1171 | return len; | 1171 | return len; |
| 1172 | } | 1172 | } |
| 1173 | 1173 | ||
| 1174 | static struct usb_os_desc_attribute rndis_grp_attr_compatible_id = | 1174 | static struct usb_os_desc_attribute interf_grp_attr_compatible_id = |
| 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, | 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, |
| 1176 | rndis_grp_compatible_id_show, | 1176 | interf_grp_compatible_id_show, |
| 1177 | rndis_grp_compatible_id_store); | 1177 | interf_grp_compatible_id_store); |
| 1178 | 1178 | ||
| 1179 | static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc, | 1179 | static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc, |
| 1180 | char *page) | 1180 | char *page) |
| 1181 | { | 1181 | { |
| 1182 | memcpy(page, desc->ext_compat_id + 8, 8); | 1182 | memcpy(page, desc->ext_compat_id + 8, 8); |
| 1183 | return 8; | 1183 | return 8; |
| 1184 | } | 1184 | } |
| 1185 | 1185 | ||
| 1186 | static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | 1186 | static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc, |
| 1187 | const char *page, size_t len) | 1187 | const char *page, size_t len) |
| 1188 | { | 1188 | { |
| 1189 | int l; | 1189 | int l; |
| 1190 | 1190 | ||
| @@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | |||
| 1202 | return len; | 1202 | return len; |
| 1203 | } | 1203 | } |
| 1204 | 1204 | ||
| 1205 | static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id = | 1205 | static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id = |
| 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, | 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, |
| 1207 | rndis_grp_sub_compatible_id_show, | 1207 | interf_grp_sub_compatible_id_show, |
| 1208 | rndis_grp_sub_compatible_id_store); | 1208 | interf_grp_sub_compatible_id_store); |
| 1209 | 1209 | ||
| 1210 | static struct configfs_attribute *interf_grp_attrs[] = { | 1210 | static struct configfs_attribute *interf_grp_attrs[] = { |
| 1211 | &rndis_grp_attr_compatible_id.attr, | 1211 | &interf_grp_attr_compatible_id.attr, |
| 1212 | &rndis_grp_attr_sub_compatible_id.attr, | 1212 | &interf_grp_attr_sub_compatible_id.attr, |
| 1213 | NULL | 1213 | NULL |
| 1214 | }; | 1214 | }; |
| 1215 | 1215 | ||
| 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
| 1217 | int n_interf, | 1217 | int n_interf, |
| 1218 | struct usb_os_desc **desc, | 1218 | struct usb_os_desc **desc, |
| 1219 | char **names, | ||
| 1219 | struct module *owner) | 1220 | struct module *owner) |
| 1220 | { | 1221 | { |
| 1221 | struct config_group **f_default_groups, *os_desc_group, | 1222 | struct config_group **f_default_groups, *os_desc_group, |
| @@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, | |||
| 1257 | d = desc[n_interf]; | 1258 | d = desc[n_interf]; |
| 1258 | d->owner = owner; | 1259 | d->owner = owner; |
| 1259 | config_group_init_type_name(&d->group, "", interface_type); | 1260 | config_group_init_type_name(&d->group, "", interface_type); |
| 1260 | config_item_set_name(&d->group.cg_item, "interface.%d", | 1261 | config_item_set_name(&d->group.cg_item, "interface.%s", |
| 1261 | n_interf); | 1262 | names[n_interf]); |
| 1262 | interface_groups[n_interf] = &d->group; | 1263 | interface_groups[n_interf] = &d->group; |
| 1263 | } | 1264 | } |
| 1264 | 1265 | ||
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h index a14ac792c698..36c468c4f5e9 100644 --- a/drivers/usb/gadget/configfs.h +++ b/drivers/usb/gadget/configfs.h | |||
| @@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item); | |||
| 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
| 9 | int n_interf, | 9 | int n_interf, |
| 10 | struct usb_os_desc **desc, | 10 | struct usb_os_desc **desc, |
| 11 | char **names, | ||
| 11 | struct module *owner); | 12 | struct module *owner); |
| 12 | 13 | ||
| 13 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) | 14 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 74202d67f911..8598c27c7d43 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
| @@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | |||
| 1483 | ffs->ep0req->context = ffs; | 1483 | ffs->ep0req->context = ffs; |
| 1484 | 1484 | ||
| 1485 | lang = ffs->stringtabs; | 1485 | lang = ffs->stringtabs; |
| 1486 | for (lang = ffs->stringtabs; *lang; ++lang) { | 1486 | if (lang) { |
| 1487 | struct usb_string *str = (*lang)->strings; | 1487 | for (; *lang; ++lang) { |
| 1488 | int id = first_id; | 1488 | struct usb_string *str = (*lang)->strings; |
| 1489 | for (; str->s; ++id, ++str) | 1489 | int id = first_id; |
| 1490 | str->id = id; | 1490 | for (; str->s; ++id, ++str) |
| 1491 | str->id = id; | ||
| 1492 | } | ||
| 1491 | } | 1493 | } |
| 1492 | 1494 | ||
| 1493 | ffs->gadget = cdev->gadget; | 1495 | ffs->gadget = cdev->gadget; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index eed3ad878047..9c41e9515b8e 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
| @@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
| 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), | 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), |
| 688 | GFP_KERNEL); | 688 | GFP_KERNEL); |
| 689 | if (!f->os_desc_table) | 689 | if (!f->os_desc_table) |
| 690 | return PTR_ERR(f->os_desc_table); | 690 | return -ENOMEM; |
| 691 | f->os_desc_n = 1; | 691 | f->os_desc_n = 1; |
| 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; | 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; |
| 693 | } | 693 | } |
| @@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
| 905 | { | 905 | { |
| 906 | struct f_rndis_opts *opts; | 906 | struct f_rndis_opts *opts; |
| 907 | struct usb_os_desc *descs[1]; | 907 | struct usb_os_desc *descs[1]; |
| 908 | char *names[1]; | ||
| 908 | 909 | ||
| 909 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); | 910 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); |
| 910 | if (!opts) | 911 | if (!opts) |
| @@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
| 922 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); | 923 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); |
| 923 | 924 | ||
| 924 | descs[0] = &opts->rndis_os_desc; | 925 | descs[0] = &opts->rndis_os_desc; |
| 926 | names[0] = "rndis"; | ||
| 925 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, | 927 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, |
| 926 | THIS_MODULE); | 928 | names, THIS_MODULE); |
| 927 | config_group_init_type_name(&opts->func_inst.group, "", | 929 | config_group_init_type_name(&opts->func_inst.group, "", |
| 928 | &rndis_func_type); | 930 | &rndis_func_type); |
| 929 | 931 | ||
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c index 99a37ed03e27..c7004ee89c90 100644 --- a/drivers/usb/gadget/gr_udc.c +++ b/drivers/usb/gadget/gr_udc.c | |||
| @@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep, | |||
| 1532 | "%s mode: multiple trans./microframe not valid\n", | 1532 | "%s mode: multiple trans./microframe not valid\n", |
| 1533 | (mode == 2 ? "Bulk" : "Control")); | 1533 | (mode == 2 ? "Bulk" : "Control")); |
| 1534 | return -EINVAL; | 1534 | return -EINVAL; |
| 1535 | } else if (nt == 0x11) { | 1535 | } else if (nt == 0x3) { |
| 1536 | dev_err(dev->dev, "Invalid value for trans./microframe\n"); | 1536 | dev_err(dev->dev, |
| 1537 | "Invalid value 0x3 for additional trans./microframe\n"); | ||
| 1537 | return -EINVAL; | 1538 | return -EINVAL; |
| 1538 | } else if ((nt + 1) * max > buffer_size) { | 1539 | } else if ((nt + 1) * max > buffer_size) { |
| 1539 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", | 1540 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index ee6c16416c30..2e4ce7704908 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
| @@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd) | |||
| 1264 | 1264 | ||
| 1265 | kfree (dev->buf); | 1265 | kfree (dev->buf); |
| 1266 | dev->buf = NULL; | 1266 | dev->buf = NULL; |
| 1267 | put_dev (dev); | ||
| 1268 | 1267 | ||
| 1268 | /* other endpoints were all decoupled from this device */ | ||
| 1269 | spin_lock_irq(&dev->lock); | ||
| 1270 | dev->state = STATE_DEV_DISABLED; | ||
| 1271 | spin_unlock_irq(&dev->lock); | ||
| 1272 | |||
| 1273 | put_dev (dev); | ||
| 1269 | return 0; | 1274 | return 0; |
| 1270 | } | 1275 | } |
| 1271 | 1276 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 3d78a8844e43..97b027724ee7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
| @@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link) | |||
| 1120 | 1120 | ||
| 1121 | DBG(dev, "%s\n", __func__); | 1121 | DBG(dev, "%s\n", __func__); |
| 1122 | 1122 | ||
| 1123 | netif_tx_lock(dev->net); | ||
| 1123 | netif_stop_queue(dev->net); | 1124 | netif_stop_queue(dev->net); |
| 1125 | netif_tx_unlock(dev->net); | ||
| 1126 | |||
| 1124 | netif_carrier_off(dev->net); | 1127 | netif_carrier_off(dev->net); |
| 1125 | 1128 | ||
| 1126 | /* disable endpoints, forcing (synchronous) completion | 1129 | /* disable endpoints, forcing (synchronous) completion |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 61b7817bd66b..03314f861bee 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
| @@ -176,7 +176,7 @@ config USB_EHCI_HCD_AT91 | |||
| 176 | 176 | ||
| 177 | config USB_EHCI_MSM | 177 | config USB_EHCI_MSM |
| 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" | 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" |
| 179 | depends on ARCH_MSM | 179 | depends on ARCH_MSM || ARCH_QCOM |
| 180 | select USB_EHCI_ROOT_HUB_TT | 180 | select USB_EHCI_ROOT_HUB_TT |
| 181 | ---help--- | 181 | ---help--- |
| 182 | Enables support for the USB Host controller present on the | 182 | Enables support for the USB Host controller present on the |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 2b998c60faf2..aa79e8749040 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/device.h> | ||
| 25 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
| 26 | 27 | ||
| 27 | #include "xhci.h" | 28 | #include "xhci.h" |
| @@ -1139,7 +1140,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
| 1139 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1140 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
| 1140 | * is enabled, so also enable remote wake here. | 1141 | * is enabled, so also enable remote wake here. |
| 1141 | */ | 1142 | */ |
| 1142 | if (hcd->self.root_hub->do_remote_wakeup) { | 1143 | if (hcd->self.root_hub->do_remote_wakeup |
| 1144 | && device_may_wakeup(hcd->self.controller)) { | ||
| 1145 | |||
| 1143 | if (t1 & PORT_CONNECT) { | 1146 | if (t1 & PORT_CONNECT) { |
| 1144 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1147 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
| 1145 | t2 &= ~PORT_WKCONN_E; | 1148 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d67ff71209f5..749fc68eb5c1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
| 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); | 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); |
| 1434 | break; | 1434 | break; |
| 1435 | case TRB_RESET_DEV: | 1435 | case TRB_RESET_DEV: |
| 1436 | WARN_ON(slot_id != TRB_TO_SLOT_ID( | 1436 | /* SLOT_ID field in reset device cmd completion event TRB is 0. |
| 1437 | le32_to_cpu(cmd_trb->generic.field[3]))); | 1437 | * Use the SLOT_ID from the command TRB instead (xhci 4.6.11) |
| 1438 | */ | ||
| 1439 | slot_id = TRB_TO_SLOT_ID( | ||
| 1440 | le32_to_cpu(cmd_trb->generic.field[3])); | ||
| 1438 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); | 1441 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); |
| 1439 | break; | 1442 | break; |
| 1440 | case TRB_NEC_GET_FW: | 1443 | case TRB_NEC_GET_FW: |
| @@ -3534,7 +3537,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci, | |||
| 3534 | return 0; | 3537 | return 0; |
| 3535 | 3538 | ||
| 3536 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; | 3539 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; |
| 3537 | return roundup(total_packet_count, max_burst + 1) - 1; | 3540 | return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1; |
| 3538 | } | 3541 | } |
| 3539 | 3542 | ||
| 3540 | /* | 3543 | /* |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2b8d9a24af09..7436d5f5e67a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -936,7 +936,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
| 936 | */ | 936 | */ |
| 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
| 938 | { | 938 | { |
| 939 | u32 command, temp = 0; | 939 | u32 command, temp = 0, status; |
| 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
| 941 | struct usb_hcd *secondary_hcd; | 941 | struct usb_hcd *secondary_hcd; |
| 942 | int retval = 0; | 942 | int retval = 0; |
| @@ -1054,8 +1054,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 1054 | 1054 | ||
| 1055 | done: | 1055 | done: |
| 1056 | if (retval == 0) { | 1056 | if (retval == 0) { |
| 1057 | usb_hcd_resume_root_hub(hcd); | 1057 | /* Resume root hubs only when have pending events. */ |
| 1058 | usb_hcd_resume_root_hub(xhci->shared_hcd); | 1058 | status = readl(&xhci->op_regs->status); |
| 1059 | if (status & STS_EINT) { | ||
| 1060 | usb_hcd_resume_root_hub(hcd); | ||
| 1061 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
| 1062 | } | ||
| 1059 | } | 1063 | } |
| 1060 | 1064 | ||
| 1061 | /* | 1065 | /* |
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c index d2353781bd2d..1e58ed2361cc 100644 --- a/drivers/usb/musb/musb_am335x.c +++ b/drivers/usb/musb/musb_am335x.c | |||
| @@ -19,21 +19,6 @@ err: | |||
| 19 | return ret; | 19 | return ret; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | static int of_remove_populated_child(struct device *dev, void *d) | ||
| 23 | { | ||
| 24 | struct platform_device *pdev = to_platform_device(dev); | ||
| 25 | |||
| 26 | of_device_unregister(pdev); | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static int am335x_child_remove(struct platform_device *pdev) | ||
| 31 | { | ||
| 32 | device_for_each_child(&pdev->dev, NULL, of_remove_populated_child); | ||
| 33 | pm_runtime_disable(&pdev->dev); | ||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | static const struct of_device_id am335x_child_of_match[] = { | 22 | static const struct of_device_id am335x_child_of_match[] = { |
| 38 | { .compatible = "ti,am33xx-usb" }, | 23 | { .compatible = "ti,am33xx-usb" }, |
| 39 | { }, | 24 | { }, |
| @@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match); | |||
| 42 | 27 | ||
| 43 | static struct platform_driver am335x_child_driver = { | 28 | static struct platform_driver am335x_child_driver = { |
| 44 | .probe = am335x_child_probe, | 29 | .probe = am335x_child_probe, |
| 45 | .remove = am335x_child_remove, | ||
| 46 | .driver = { | 30 | .driver = { |
| 47 | .name = "am335x-usb-childs", | 31 | .name = "am335x-usb-childs", |
| 48 | .of_match_table = am335x_child_of_match, | 32 | .of_match_table = am335x_child_of_match, |
| 49 | }, | 33 | }, |
| 50 | }; | 34 | }; |
| 51 | 35 | ||
| 52 | module_platform_driver(am335x_child_driver); | 36 | static int __init am335x_child_init(void) |
| 37 | { | ||
| 38 | return platform_driver_register(&am335x_child_driver); | ||
| 39 | } | ||
| 40 | module_init(am335x_child_init); | ||
| 41 | |||
| 53 | MODULE_DESCRIPTION("AM33xx child devices"); | 42 | MODULE_DESCRIPTION("AM33xx child devices"); |
| 54 | MODULE_LICENSE("GPL v2"); | 43 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471b7aed..eff3c5cf84f4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -849,7 +849,7 @@ b_host: | |||
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | /* handle babble condition */ | 851 | /* handle babble condition */ |
| 852 | if (int_usb & MUSB_INTR_BABBLE) | 852 | if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb)) |
| 853 | schedule_work(&musb->recover_work); | 853 | schedule_work(&musb->recover_work); |
| 854 | 854 | ||
| 855 | #if 0 | 855 | #if 0 |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 7b8bbf53127e..5341bb223b7c 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
| @@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data) | |||
| 318 | } | 318 | } |
| 319 | list_add_tail(&cppi41_channel->tx_check, | 319 | list_add_tail(&cppi41_channel->tx_check, |
| 320 | &controller->early_tx_list); | 320 | &controller->early_tx_list); |
| 321 | if (!hrtimer_active(&controller->early_tx)) { | 321 | if (!hrtimer_is_queued(&controller->early_tx)) { |
| 322 | hrtimer_start_range_ns(&controller->early_tx, | 322 | hrtimer_start_range_ns(&controller->early_tx, |
| 323 | ktime_set(0, 140 * NSEC_PER_USEC), | 323 | ktime_set(0, 140 * NSEC_PER_USEC), |
| 324 | 40 * NSEC_PER_USEC, | 324 | 40 * NSEC_PER_USEC, |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51beb13c7e1a..09529f94e72d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
| @@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
| 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
| 496 | void __iomem *ctrl_base = musb->ctrl_base; | 496 | void __iomem *ctrl_base = musb->ctrl_base; |
| 497 | void __iomem *base = musb->mregs; | ||
| 498 | u32 reg; | 497 | u32 reg; |
| 499 | 498 | ||
| 500 | reg = dsps_readl(base, wrp->mode); | 499 | reg = dsps_readl(ctrl_base, wrp->mode); |
| 501 | 500 | ||
| 502 | switch (mode) { | 501 | switch (mode) { |
| 503 | case MUSB_HOST: | 502 | case MUSB_HOST: |
| @@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 510 | */ | 509 | */ |
| 511 | reg |= (1 << wrp->iddig_mux); | 510 | reg |= (1 << wrp->iddig_mux); |
| 512 | 511 | ||
| 513 | dsps_writel(base, wrp->mode, reg); | 512 | dsps_writel(ctrl_base, wrp->mode, reg); |
| 514 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); | 513 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
| 515 | break; | 514 | break; |
| 516 | case MUSB_PERIPHERAL: | 515 | case MUSB_PERIPHERAL: |
| @@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
| 523 | */ | 522 | */ |
| 524 | reg |= (1 << wrp->iddig_mux); | 523 | reg |= (1 << wrp->iddig_mux); |
| 525 | 524 | ||
| 526 | dsps_writel(base, wrp->mode, reg); | 525 | dsps_writel(ctrl_base, wrp->mode, reg); |
| 527 | break; | 526 | break; |
| 528 | case MUSB_OTG: | 527 | case MUSB_OTG: |
| 529 | dsps_writel(base, wrp->phy_utmi, 0x02); | 528 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
| 530 | break; | 529 | break; |
| 531 | default: | 530 | default: |
| 532 | dev_err(glue->dev, "unsupported mode %d\n", mode); | 531 | dev_err(glue->dev, "unsupported mode %d\n", mode); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c2e45e632723..f202e5088461 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
| @@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev) | |||
| 274 | musb->dev.parent = &pdev->dev; | 274 | musb->dev.parent = &pdev->dev; |
| 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; | 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
| 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; |
| 277 | musb->dev.of_node = pdev->dev.of_node; | ||
| 278 | 277 | ||
| 279 | glue->dev = &pdev->dev; | 278 | glue->dev = &pdev->dev; |
| 280 | glue->musb = musb; | 279 | glue->musb = musb; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index ced34f39bdd4..c929370cdaa6 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
| @@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
| 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
| 1230 | motg->chg_type = USB_INVALID_CHARGER; | 1230 | motg->chg_type = USB_INVALID_CHARGER; |
| 1231 | } | 1231 | } |
| 1232 | pm_runtime_put_sync(otg->phy->dev); | 1232 | |
| 1233 | if (otg->phy->state == OTG_STATE_B_IDLE) | ||
| 1234 | pm_runtime_put_sync(otg->phy->dev); | ||
| 1233 | break; | 1235 | break; |
| 1234 | case OTG_STATE_B_PERIPHERAL: | 1236 | case OTG_STATE_B_PERIPHERAL: |
| 1235 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); | 1237 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d49f9c326035..4fd36530bfa3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
| @@ -681,6 +681,14 @@ usbhs_fifo_read_end: | |||
| 681 | usbhs_pipe_number(pipe), | 681 | usbhs_pipe_number(pipe), |
| 682 | pkt->length, pkt->actual, *is_done, pkt->zero); | 682 | pkt->length, pkt->actual, *is_done, pkt->zero); |
| 683 | 683 | ||
| 684 | /* | ||
| 685 | * Transmission end | ||
| 686 | */ | ||
| 687 | if (*is_done) { | ||
| 688 | if (usbhs_pipe_is_dcp(pipe)) | ||
| 689 | usbhs_dcp_control_transfer_done(pipe); | ||
| 690 | } | ||
| 691 | |||
| 684 | usbhs_fifo_read_busy: | 692 | usbhs_fifo_read_busy: |
| 685 | usbhsf_fifo_unselect(pipe, fifo); | 693 | usbhsf_fifo_unselect(pipe, fifo); |
| 686 | 694 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edf3b124583c..115662c16dcc 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -1566,14 +1566,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) | |||
| 1566 | struct usb_device *udev = serial->dev; | 1566 | struct usb_device *udev = serial->dev; |
| 1567 | 1567 | ||
| 1568 | struct usb_interface *interface = serial->interface; | 1568 | struct usb_interface *interface = serial->interface; |
| 1569 | struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; | 1569 | struct usb_endpoint_descriptor *ep_desc; |
| 1570 | 1570 | ||
| 1571 | unsigned num_endpoints; | 1571 | unsigned num_endpoints; |
| 1572 | int i; | 1572 | unsigned i; |
| 1573 | 1573 | ||
| 1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; | 1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; |
| 1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); | 1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); |
| 1576 | 1576 | ||
| 1577 | if (!num_endpoints) | ||
| 1578 | return; | ||
| 1579 | |||
| 1577 | /* NOTE: some customers have programmed FT232R/FT245R devices | 1580 | /* NOTE: some customers have programmed FT232R/FT245R devices |
| 1578 | * with an endpoint size of 0 - not good. In this case, we | 1581 | * with an endpoint size of 0 - not good. In this case, we |
| 1579 | * want to override the endpoint descriptor setting and use a | 1582 | * want to override the endpoint descriptor setting and use a |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 59c3108cc136..ac73f49cd9f0 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb); | |||
| 352 | /* Zoom */ | 352 | /* Zoom */ |
| 353 | #define ZOOM_PRODUCT_4597 0x9607 | 353 | #define ZOOM_PRODUCT_4597 0x9607 |
| 354 | 354 | ||
| 355 | /* SpeedUp SU9800 usb 3g modem */ | ||
| 356 | #define SPEEDUP_PRODUCT_SU9800 0x9800 | ||
| 357 | |||
| 355 | /* Haier products */ | 358 | /* Haier products */ |
| 356 | #define HAIER_VENDOR_ID 0x201e | 359 | #define HAIER_VENDOR_ID 0x201e |
| 357 | #define HAIER_PRODUCT_CE100 0x2009 | 360 | #define HAIER_PRODUCT_CE100 0x2009 |
| @@ -372,8 +375,12 @@ static void option_instat_callback(struct urb *urb); | |||
| 372 | /* Olivetti products */ | 375 | /* Olivetti products */ |
| 373 | #define OLIVETTI_VENDOR_ID 0x0b3c | 376 | #define OLIVETTI_VENDOR_ID 0x0b3c |
| 374 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 | 377 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 |
| 378 | #define OLIVETTI_PRODUCT_OLICARD120 0xc001 | ||
| 379 | #define OLIVETTI_PRODUCT_OLICARD140 0xc002 | ||
| 375 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 | 380 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 |
| 381 | #define OLIVETTI_PRODUCT_OLICARD155 0xc004 | ||
| 376 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 | 382 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 |
| 383 | #define OLIVETTI_PRODUCT_OLICARD160 0xc00a | ||
| 377 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b | 384 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b |
| 378 | 385 | ||
| 379 | /* Celot products */ | 386 | /* Celot products */ |
| @@ -1577,6 +1584,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 1577 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 1584 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
| 1578 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist | 1585 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
| 1579 | }, | 1586 | }, |
| 1587 | { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, | ||
| 1580 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1588 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
| 1581 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1589 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
| 1582 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1590 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
| @@ -1611,15 +1619,21 @@ static const struct usb_device_id option_ids[] = { | |||
| 1611 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | 1619 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, |
| 1612 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | 1620 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ |
| 1613 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1621 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
| 1614 | 1622 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), | |
| 1615 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 1623 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1624 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), | ||
| 1625 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1626 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140), | ||
| 1627 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1616 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, | 1628 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, |
| 1629 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155), | ||
| 1630 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
| 1617 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), | 1631 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), |
| 1618 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist | 1632 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
| 1619 | }, | 1633 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160), |
| 1634 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
| 1620 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), | 1635 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), |
| 1621 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist | 1636 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1622 | }, | ||
| 1623 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1637 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
| 1624 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1638 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
| 1625 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | 1639 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9d38ddc8da49..866b5df36ed1 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
| @@ -256,6 +256,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
| 256 | if (us->fflags & US_FL_WRITE_CACHE) | 256 | if (us->fflags & US_FL_WRITE_CACHE) |
| 257 | sdev->wce_default_on = 1; | 257 | sdev->wce_default_on = 1; |
| 258 | 258 | ||
| 259 | /* A few buggy USB-ATA bridges don't understand FUA */ | ||
| 260 | if (us->fflags & US_FL_BROKEN_FUA) | ||
| 261 | sdev->broken_fua = 1; | ||
| 262 | |||
| 259 | } else { | 263 | } else { |
| 260 | 264 | ||
| 261 | /* Non-disk-type devices don't need to blacklist any pages | 265 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 174a447868cd..80a5b366255f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | |||
| 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 1937 | US_FL_IGNORE_RESIDUE ), | 1937 | US_FL_IGNORE_RESIDUE ), |
| 1938 | 1938 | ||
| 1939 | /* Reported by Michael Büsch <m@bues.ch> */ | ||
| 1940 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, | ||
| 1941 | "JMicron", | ||
| 1942 | "USB to ATA/ATAPI Bridge", | ||
| 1943 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 1944 | US_FL_BROKEN_FUA ), | ||
| 1945 | |||
| 1939 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> | 1946 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
| 1940 | * JMicron responds to USN and several other SCSI ioctls with a | 1947 | * JMicron responds to USN and several other SCSI ioctls with a |
| 1941 | * residue that causes subsequent I/O requests to fail. */ | 1948 | * residue that causes subsequent I/O requests to fail. */ |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e683b6ef9594..d36e830d6fc6 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
| @@ -1057,6 +1057,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
| 1057 | goto put_display_node; | 1057 | goto put_display_node; |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | INIT_LIST_HEAD(&pdata->pwr_gpios); | ||
| 1060 | ret = -ENOMEM; | 1061 | ret = -ENOMEM; |
| 1061 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { | 1062 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { |
| 1062 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", | 1063 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", |
| @@ -1082,6 +1083,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
| 1082 | dev_err(dev, "set direction output gpio %d failed\n", gpio); | 1083 | dev_err(dev, "set direction output gpio %d failed\n", gpio); |
| 1083 | goto put_display_node; | 1084 | goto put_display_node; |
| 1084 | } | 1085 | } |
| 1086 | list_add(&og->list, &pdata->pwr_gpios); | ||
| 1085 | } | 1087 | } |
| 1086 | 1088 | ||
| 1087 | if (is_gpio_power) | 1089 | if (is_gpio_power) |
diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index a54f7f7d763b..8fe41caac38e 100644 --- a/drivers/video/fbdev/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c | |||
| @@ -408,7 +408,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, | |||
| 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ | 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ |
| 409 | if (ANOMALY_05000400) { | 409 | if (ANOMALY_05000400) { |
| 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, | 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, |
| 411 | "PPI0_FS3") | 411 | "PPI0_FS3"); |
| 412 | if (ret) { | 412 | if (ret) { |
| 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); | 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); |
| 414 | ret = -EBUSY; | 414 | ret = -EBUSY; |
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c index 99af9e88b2d8..2f0822ee3ff9 100644 --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | |||
| @@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root) | |||
| 121 | { | 121 | { |
| 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), | 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), |
| 123 | GFP_KERNEL); | 123 | GFP_KERNEL); |
| 124 | n->node = node; | 124 | if (n) { |
| 125 | n->root = root; | 125 | n->node = node; |
| 126 | list_add(&n->list, &dss_conv_list); | 126 | n->root = root; |
| 127 | list_add(&n->list, &dss_conv_list); | ||
| 128 | } | ||
| 127 | } | 129 | } |
| 128 | 130 | ||
| 129 | static bool __init omapdss_list_contains(const struct device_node *node) | 131 | static bool __init omapdss_list_contains(const struct device_node *node) |
diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index a8f2b280f796..a1134c3f6c11 100644 --- a/drivers/video/fbdev/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c | |||
| @@ -474,8 +474,6 @@ static int vt8500lcd_remove(struct platform_device *pdev) | |||
| 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 475 | release_mem_region(res->start, resource_size(res)); | 475 | release_mem_region(res->start, resource_size(res)); |
| 476 | 476 | ||
| 477 | kfree(fbi); | ||
| 478 | |||
| 479 | return 0; | 477 | return 0; |
| 480 | } | 478 | } |
| 481 | 479 | ||
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index d7bd395ab586..1c55388ae633 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
| @@ -210,7 +210,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
| 210 | int pipefd; | 210 | int pipefd; |
| 211 | struct autofs_sb_info *sbi; | 211 | struct autofs_sb_info *sbi; |
| 212 | struct autofs_info *ino; | 212 | struct autofs_info *ino; |
| 213 | int pgrp; | 213 | int pgrp = 0; |
| 214 | bool pgrp_set = false; | 214 | bool pgrp_set = false; |
| 215 | int ret = -EINVAL; | 215 | int ret = -EINVAL; |
| 216 | 216 | ||
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 92371c414228..1daea0b47187 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
| @@ -821,7 +821,7 @@ static void free_workspace(int type, struct list_head *workspace) | |||
| 821 | 821 | ||
| 822 | spin_lock(workspace_lock); | 822 | spin_lock(workspace_lock); |
| 823 | if (*num_workspace < num_online_cpus()) { | 823 | if (*num_workspace < num_online_cpus()) { |
| 824 | list_add_tail(workspace, idle_workspace); | 824 | list_add(workspace, idle_workspace); |
| 825 | (*num_workspace)++; | 825 | (*num_workspace)++; |
| 826 | spin_unlock(workspace_lock); | 826 | spin_unlock(workspace_lock); |
| 827 | goto wake; | 827 | goto wake; |
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 2af6e66fe788..eea26e1b2fda 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include "check-integrity.h" | 36 | #include "check-integrity.h" |
| 37 | #include "rcu-string.h" | 37 | #include "rcu-string.h" |
| 38 | #include "dev-replace.h" | 38 | #include "dev-replace.h" |
| 39 | #include "sysfs.h" | ||
| 39 | 40 | ||
| 40 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | 41 | static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, |
| 41 | int scrub_ret); | 42 | int scrub_ret); |
| @@ -562,6 +563,10 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
| 562 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; | 563 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; |
| 563 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); | 564 | list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list); |
| 564 | 565 | ||
| 566 | /* replace the sysfs entry */ | ||
| 567 | btrfs_kobj_rm_device(fs_info, src_device); | ||
| 568 | btrfs_kobj_add_device(fs_info, tgt_device); | ||
| 569 | |||
| 565 | btrfs_rm_dev_replace_blocked(fs_info); | 570 | btrfs_rm_dev_replace_blocked(fs_info); |
| 566 | 571 | ||
| 567 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); | 572 | btrfs_rm_dev_replace_srcdev(fs_info, src_device); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8bb4aa19898f..08e65e9cf2aa 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -369,7 +369,8 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
| 369 | out: | 369 | out: |
| 370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, | 370 | unlock_extent_cached(io_tree, eb->start, eb->start + eb->len - 1, |
| 371 | &cached_state, GFP_NOFS); | 371 | &cached_state, GFP_NOFS); |
| 372 | btrfs_tree_read_unlock_blocking(eb); | 372 | if (need_lock) |
| 373 | btrfs_tree_read_unlock_blocking(eb); | ||
| 373 | return ret; | 374 | return ret; |
| 374 | } | 375 | } |
| 375 | 376 | ||
| @@ -2904,7 +2905,9 @@ retry_root_backup: | |||
| 2904 | if (ret) | 2905 | if (ret) |
| 2905 | goto fail_qgroup; | 2906 | goto fail_qgroup; |
| 2906 | 2907 | ||
| 2908 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 2907 | ret = btrfs_recover_relocation(tree_root); | 2909 | ret = btrfs_recover_relocation(tree_root); |
| 2910 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 2908 | if (ret < 0) { | 2911 | if (ret < 0) { |
| 2909 | printk(KERN_WARNING | 2912 | printk(KERN_WARNING |
| 2910 | "BTRFS: failed to recover relocation\n"); | 2913 | "BTRFS: failed to recover relocation\n"); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 99c253918208..813537f362f9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -5678,7 +5678,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
| 5678 | struct btrfs_caching_control *next; | 5678 | struct btrfs_caching_control *next; |
| 5679 | struct btrfs_caching_control *caching_ctl; | 5679 | struct btrfs_caching_control *caching_ctl; |
| 5680 | struct btrfs_block_group_cache *cache; | 5680 | struct btrfs_block_group_cache *cache; |
| 5681 | struct btrfs_space_info *space_info; | ||
| 5682 | 5681 | ||
| 5683 | down_write(&fs_info->commit_root_sem); | 5682 | down_write(&fs_info->commit_root_sem); |
| 5684 | 5683 | ||
| @@ -5701,9 +5700,6 @@ void btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | |||
| 5701 | 5700 | ||
| 5702 | up_write(&fs_info->commit_root_sem); | 5701 | up_write(&fs_info->commit_root_sem); |
| 5703 | 5702 | ||
| 5704 | list_for_each_entry_rcu(space_info, &fs_info->space_info, list) | ||
| 5705 | percpu_counter_set(&space_info->total_bytes_pinned, 0); | ||
| 5706 | |||
| 5707 | update_global_block_rsv(fs_info); | 5703 | update_global_block_rsv(fs_info); |
| 5708 | } | 5704 | } |
| 5709 | 5705 | ||
| @@ -5741,6 +5737,7 @@ static int unpin_extent_range(struct btrfs_root *root, u64 start, u64 end) | |||
| 5741 | spin_lock(&cache->lock); | 5737 | spin_lock(&cache->lock); |
| 5742 | cache->pinned -= len; | 5738 | cache->pinned -= len; |
| 5743 | space_info->bytes_pinned -= len; | 5739 | space_info->bytes_pinned -= len; |
| 5740 | percpu_counter_add(&space_info->total_bytes_pinned, -len); | ||
| 5744 | if (cache->ro) { | 5741 | if (cache->ro) { |
| 5745 | space_info->bytes_readonly += len; | 5742 | space_info->bytes_readonly += len; |
| 5746 | readonly = true; | 5743 | readonly = true; |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 0d321c23069a..47aceb494d1d 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -136,19 +136,22 @@ static unsigned int btrfs_flags_to_ioctl(unsigned int flags) | |||
| 136 | void btrfs_update_iflags(struct inode *inode) | 136 | void btrfs_update_iflags(struct inode *inode) |
| 137 | { | 137 | { |
| 138 | struct btrfs_inode *ip = BTRFS_I(inode); | 138 | struct btrfs_inode *ip = BTRFS_I(inode); |
| 139 | 139 | unsigned int new_fl = 0; | |
| 140 | inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); | ||
| 141 | 140 | ||
| 142 | if (ip->flags & BTRFS_INODE_SYNC) | 141 | if (ip->flags & BTRFS_INODE_SYNC) |
| 143 | inode->i_flags |= S_SYNC; | 142 | new_fl |= S_SYNC; |
| 144 | if (ip->flags & BTRFS_INODE_IMMUTABLE) | 143 | if (ip->flags & BTRFS_INODE_IMMUTABLE) |
| 145 | inode->i_flags |= S_IMMUTABLE; | 144 | new_fl |= S_IMMUTABLE; |
| 146 | if (ip->flags & BTRFS_INODE_APPEND) | 145 | if (ip->flags & BTRFS_INODE_APPEND) |
| 147 | inode->i_flags |= S_APPEND; | 146 | new_fl |= S_APPEND; |
| 148 | if (ip->flags & BTRFS_INODE_NOATIME) | 147 | if (ip->flags & BTRFS_INODE_NOATIME) |
| 149 | inode->i_flags |= S_NOATIME; | 148 | new_fl |= S_NOATIME; |
| 150 | if (ip->flags & BTRFS_INODE_DIRSYNC) | 149 | if (ip->flags & BTRFS_INODE_DIRSYNC) |
| 151 | inode->i_flags |= S_DIRSYNC; | 150 | new_fl |= S_DIRSYNC; |
| 151 | |||
| 152 | set_mask_bits(&inode->i_flags, | ||
| 153 | S_SYNC | S_APPEND | S_IMMUTABLE | S_NOATIME | S_DIRSYNC, | ||
| 154 | new_fl); | ||
| 152 | } | 155 | } |
| 153 | 156 | ||
| 154 | /* | 157 | /* |
| @@ -3139,7 +3142,6 @@ out: | |||
| 3139 | static void clone_update_extent_map(struct inode *inode, | 3142 | static void clone_update_extent_map(struct inode *inode, |
| 3140 | const struct btrfs_trans_handle *trans, | 3143 | const struct btrfs_trans_handle *trans, |
| 3141 | const struct btrfs_path *path, | 3144 | const struct btrfs_path *path, |
| 3142 | struct btrfs_file_extent_item *fi, | ||
| 3143 | const u64 hole_offset, | 3145 | const u64 hole_offset, |
| 3144 | const u64 hole_len) | 3146 | const u64 hole_len) |
| 3145 | { | 3147 | { |
| @@ -3154,7 +3156,11 @@ static void clone_update_extent_map(struct inode *inode, | |||
| 3154 | return; | 3156 | return; |
| 3155 | } | 3157 | } |
| 3156 | 3158 | ||
| 3157 | if (fi) { | 3159 | if (path) { |
| 3160 | struct btrfs_file_extent_item *fi; | ||
| 3161 | |||
| 3162 | fi = btrfs_item_ptr(path->nodes[0], path->slots[0], | ||
| 3163 | struct btrfs_file_extent_item); | ||
| 3158 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); | 3164 | btrfs_extent_item_to_extent_map(inode, path, fi, false, em); |
| 3159 | em->generation = -1; | 3165 | em->generation = -1; |
| 3160 | if (btrfs_file_extent_type(path->nodes[0], fi) == | 3166 | if (btrfs_file_extent_type(path->nodes[0], fi) == |
| @@ -3508,18 +3514,15 @@ process_slot: | |||
| 3508 | btrfs_item_ptr_offset(leaf, slot), | 3514 | btrfs_item_ptr_offset(leaf, slot), |
| 3509 | size); | 3515 | size); |
| 3510 | inode_add_bytes(inode, datal); | 3516 | inode_add_bytes(inode, datal); |
| 3511 | extent = btrfs_item_ptr(leaf, slot, | ||
| 3512 | struct btrfs_file_extent_item); | ||
| 3513 | } | 3517 | } |
| 3514 | 3518 | ||
| 3515 | /* If we have an implicit hole (NO_HOLES feature). */ | 3519 | /* If we have an implicit hole (NO_HOLES feature). */ |
| 3516 | if (drop_start < new_key.offset) | 3520 | if (drop_start < new_key.offset) |
| 3517 | clone_update_extent_map(inode, trans, | 3521 | clone_update_extent_map(inode, trans, |
| 3518 | path, NULL, drop_start, | 3522 | NULL, drop_start, |
| 3519 | new_key.offset - drop_start); | 3523 | new_key.offset - drop_start); |
| 3520 | 3524 | ||
| 3521 | clone_update_extent_map(inode, trans, path, | 3525 | clone_update_extent_map(inode, trans, path, 0, 0); |
| 3522 | extent, 0, 0); | ||
| 3523 | 3526 | ||
| 3524 | btrfs_mark_buffer_dirty(leaf); | 3527 | btrfs_mark_buffer_dirty(leaf); |
| 3525 | btrfs_release_path(path); | 3528 | btrfs_release_path(path); |
| @@ -3562,12 +3565,10 @@ process_slot: | |||
| 3562 | btrfs_end_transaction(trans, root); | 3565 | btrfs_end_transaction(trans, root); |
| 3563 | goto out; | 3566 | goto out; |
| 3564 | } | 3567 | } |
| 3568 | clone_update_extent_map(inode, trans, NULL, last_dest_end, | ||
| 3569 | destoff + len - last_dest_end); | ||
| 3565 | ret = clone_finish_inode_update(trans, inode, destoff + len, | 3570 | ret = clone_finish_inode_update(trans, inode, destoff + len, |
| 3566 | destoff, olen); | 3571 | destoff, olen); |
| 3567 | if (ret) | ||
| 3568 | goto out; | ||
| 3569 | clone_update_extent_map(inode, trans, path, NULL, last_dest_end, | ||
| 3570 | destoff + len - last_dest_end); | ||
| 3571 | } | 3572 | } |
| 3572 | 3573 | ||
| 3573 | out: | 3574 | out: |
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c index 6efd70d3b64f..9626b4ad3b9a 100644 --- a/fs/btrfs/print-tree.c +++ b/fs/btrfs/print-tree.c | |||
| @@ -54,7 +54,7 @@ static void print_extent_data_ref(struct extent_buffer *eb, | |||
| 54 | btrfs_extent_data_ref_count(eb, ref)); | 54 | btrfs_extent_data_ref_count(eb, ref)); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void print_extent_item(struct extent_buffer *eb, int slot) | 57 | static void print_extent_item(struct extent_buffer *eb, int slot, int type) |
| 58 | { | 58 | { |
| 59 | struct btrfs_extent_item *ei; | 59 | struct btrfs_extent_item *ei; |
| 60 | struct btrfs_extent_inline_ref *iref; | 60 | struct btrfs_extent_inline_ref *iref; |
| @@ -63,7 +63,6 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
| 63 | struct btrfs_disk_key key; | 63 | struct btrfs_disk_key key; |
| 64 | unsigned long end; | 64 | unsigned long end; |
| 65 | unsigned long ptr; | 65 | unsigned long ptr; |
| 66 | int type; | ||
| 67 | u32 item_size = btrfs_item_size_nr(eb, slot); | 66 | u32 item_size = btrfs_item_size_nr(eb, slot); |
| 68 | u64 flags; | 67 | u64 flags; |
| 69 | u64 offset; | 68 | u64 offset; |
| @@ -88,7 +87,8 @@ static void print_extent_item(struct extent_buffer *eb, int slot) | |||
| 88 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), | 87 | btrfs_extent_refs(eb, ei), btrfs_extent_generation(eb, ei), |
| 89 | flags); | 88 | flags); |
| 90 | 89 | ||
| 91 | if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | 90 | if ((type == BTRFS_EXTENT_ITEM_KEY) && |
| 91 | flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | ||
| 92 | struct btrfs_tree_block_info *info; | 92 | struct btrfs_tree_block_info *info; |
| 93 | info = (struct btrfs_tree_block_info *)(ei + 1); | 93 | info = (struct btrfs_tree_block_info *)(ei + 1); |
| 94 | btrfs_tree_block_key(eb, info, &key); | 94 | btrfs_tree_block_key(eb, info, &key); |
| @@ -223,7 +223,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) | |||
| 223 | btrfs_disk_root_refs(l, ri)); | 223 | btrfs_disk_root_refs(l, ri)); |
| 224 | break; | 224 | break; |
| 225 | case BTRFS_EXTENT_ITEM_KEY: | 225 | case BTRFS_EXTENT_ITEM_KEY: |
| 226 | print_extent_item(l, i); | 226 | case BTRFS_METADATA_ITEM_KEY: |
| 227 | print_extent_item(l, i, type); | ||
| 227 | break; | 228 | break; |
| 228 | case BTRFS_TREE_BLOCK_REF_KEY: | 229 | case BTRFS_TREE_BLOCK_REF_KEY: |
| 229 | printk(KERN_INFO "\t\ttree block backref\n"); | 230 | printk(KERN_INFO "\t\ttree block backref\n"); |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 4055291a523e..4a88f073fdd7 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
| @@ -1956,9 +1956,10 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio) | |||
| 1956 | * pages are going to be uptodate. | 1956 | * pages are going to be uptodate. |
| 1957 | */ | 1957 | */ |
| 1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { | 1958 | for (stripe = 0; stripe < bbio->num_stripes; stripe++) { |
| 1959 | if (rbio->faila == stripe || | 1959 | if (rbio->faila == stripe || rbio->failb == stripe) { |
| 1960 | rbio->failb == stripe) | 1960 | atomic_inc(&rbio->bbio->error); |
| 1961 | continue; | 1961 | continue; |
| 1962 | } | ||
| 1962 | 1963 | ||
| 1963 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { | 1964 | for (pagenr = 0; pagenr < nr_pages; pagenr++) { |
| 1964 | struct page *p; | 1965 | struct page *p; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4662d92a4b73..8e16bca69c56 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -522,9 +522,10 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
| 522 | case Opt_ssd_spread: | 522 | case Opt_ssd_spread: |
| 523 | btrfs_set_and_info(root, SSD_SPREAD, | 523 | btrfs_set_and_info(root, SSD_SPREAD, |
| 524 | "use spread ssd allocation scheme"); | 524 | "use spread ssd allocation scheme"); |
| 525 | btrfs_set_opt(info->mount_opt, SSD); | ||
| 525 | break; | 526 | break; |
| 526 | case Opt_nossd: | 527 | case Opt_nossd: |
| 527 | btrfs_clear_and_info(root, NOSSD, | 528 | btrfs_set_and_info(root, NOSSD, |
| 528 | "not using ssd allocation scheme"); | 529 | "not using ssd allocation scheme"); |
| 529 | btrfs_clear_opt(info->mount_opt, SSD); | 530 | btrfs_clear_opt(info->mount_opt, SSD); |
| 530 | break; | 531 | break; |
| @@ -1467,7 +1468,9 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1467 | goto restore; | 1468 | goto restore; |
| 1468 | 1469 | ||
| 1469 | /* recover relocation */ | 1470 | /* recover relocation */ |
| 1471 | mutex_lock(&fs_info->cleaner_mutex); | ||
| 1470 | ret = btrfs_recover_relocation(root); | 1472 | ret = btrfs_recover_relocation(root); |
| 1473 | mutex_unlock(&fs_info->cleaner_mutex); | ||
| 1471 | if (ret) | 1474 | if (ret) |
| 1472 | goto restore; | 1475 | goto restore; |
| 1473 | 1476 | ||
| @@ -1808,6 +1811,8 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | |||
| 1808 | list_for_each_entry(dev, head, dev_list) { | 1811 | list_for_each_entry(dev, head, dev_list) { |
| 1809 | if (dev->missing) | 1812 | if (dev->missing) |
| 1810 | continue; | 1813 | continue; |
| 1814 | if (!dev->name) | ||
| 1815 | continue; | ||
| 1811 | if (!first_dev || dev->devid < first_dev->devid) | 1816 | if (!first_dev || dev->devid < first_dev->devid) |
| 1812 | first_dev = dev; | 1817 | first_dev = dev; |
| 1813 | } | 1818 | } |
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index df39458f1487..78699364f537 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c | |||
| @@ -605,14 +605,37 @@ static void init_feature_attrs(void) | |||
| 605 | } | 605 | } |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int add_device_membership(struct btrfs_fs_info *fs_info) | 608 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, |
| 609 | struct btrfs_device *one_device) | ||
| 610 | { | ||
| 611 | struct hd_struct *disk; | ||
| 612 | struct kobject *disk_kobj; | ||
| 613 | |||
| 614 | if (!fs_info->device_dir_kobj) | ||
| 615 | return -EINVAL; | ||
| 616 | |||
| 617 | if (one_device) { | ||
| 618 | disk = one_device->bdev->bd_part; | ||
| 619 | disk_kobj = &part_to_dev(disk)->kobj; | ||
| 620 | |||
| 621 | sysfs_remove_link(fs_info->device_dir_kobj, | ||
| 622 | disk_kobj->name); | ||
| 623 | } | ||
| 624 | |||
| 625 | return 0; | ||
| 626 | } | ||
| 627 | |||
| 628 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
| 629 | struct btrfs_device *one_device) | ||
| 609 | { | 630 | { |
| 610 | int error = 0; | 631 | int error = 0; |
| 611 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; | 632 | struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; |
| 612 | struct btrfs_device *dev; | 633 | struct btrfs_device *dev; |
| 613 | 634 | ||
| 614 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | 635 | if (!fs_info->device_dir_kobj) |
| 636 | fs_info->device_dir_kobj = kobject_create_and_add("devices", | ||
| 615 | &fs_info->super_kobj); | 637 | &fs_info->super_kobj); |
| 638 | |||
| 616 | if (!fs_info->device_dir_kobj) | 639 | if (!fs_info->device_dir_kobj) |
| 617 | return -ENOMEM; | 640 | return -ENOMEM; |
| 618 | 641 | ||
| @@ -623,6 +646,9 @@ static int add_device_membership(struct btrfs_fs_info *fs_info) | |||
| 623 | if (!dev->bdev) | 646 | if (!dev->bdev) |
| 624 | continue; | 647 | continue; |
| 625 | 648 | ||
| 649 | if (one_device && one_device != dev) | ||
| 650 | continue; | ||
| 651 | |||
| 626 | disk = dev->bdev->bd_part; | 652 | disk = dev->bdev->bd_part; |
| 627 | disk_kobj = &part_to_dev(disk)->kobj; | 653 | disk_kobj = &part_to_dev(disk)->kobj; |
| 628 | 654 | ||
| @@ -666,7 +692,7 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info) | |||
| 666 | if (error) | 692 | if (error) |
| 667 | goto failure; | 693 | goto failure; |
| 668 | 694 | ||
| 669 | error = add_device_membership(fs_info); | 695 | error = btrfs_kobj_add_device(fs_info, NULL); |
| 670 | if (error) | 696 | if (error) |
| 671 | goto failure; | 697 | goto failure; |
| 672 | 698 | ||
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h index 9ab576318a84..ac46df37504c 100644 --- a/fs/btrfs/sysfs.h +++ b/fs/btrfs/sysfs.h | |||
| @@ -66,4 +66,8 @@ char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); | |||
| 66 | extern const char * const btrfs_feature_set_names[3]; | 66 | extern const char * const btrfs_feature_set_names[3]; |
| 67 | extern struct kobj_type space_info_ktype; | 67 | extern struct kobj_type space_info_ktype; |
| 68 | extern struct kobj_type btrfs_raid_ktype; | 68 | extern struct kobj_type btrfs_raid_ktype; |
| 69 | int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info, | ||
| 70 | struct btrfs_device *one_device); | ||
| 71 | int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info, | ||
| 72 | struct btrfs_device *one_device); | ||
| 69 | #endif /* _BTRFS_SYSFS_H_ */ | 73 | #endif /* _BTRFS_SYSFS_H_ */ |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 511839c04f11..5f379affdf23 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -386,11 +386,13 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type, | |||
| 386 | bool reloc_reserved = false; | 386 | bool reloc_reserved = false; |
| 387 | int ret; | 387 | int ret; |
| 388 | 388 | ||
| 389 | /* Send isn't supposed to start transactions. */ | ||
| 390 | ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB); | ||
| 391 | |||
| 389 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) | 392 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) |
| 390 | return ERR_PTR(-EROFS); | 393 | return ERR_PTR(-EROFS); |
| 391 | 394 | ||
| 392 | if (current->journal_info && | 395 | if (current->journal_info) { |
| 393 | current->journal_info != (void *)BTRFS_SEND_TRANS_STUB) { | ||
| 394 | WARN_ON(type & TRANS_EXTWRITERS); | 396 | WARN_ON(type & TRANS_EXTWRITERS); |
| 395 | h = current->journal_info; | 397 | h = current->journal_info; |
| 396 | h->use_count++; | 398 | h->use_count++; |
| @@ -491,6 +493,7 @@ again: | |||
| 491 | smp_mb(); | 493 | smp_mb(); |
| 492 | if (cur_trans->state >= TRANS_STATE_BLOCKED && | 494 | if (cur_trans->state >= TRANS_STATE_BLOCKED && |
| 493 | may_wait_transaction(root, type)) { | 495 | may_wait_transaction(root, type)) { |
| 496 | current->journal_info = h; | ||
| 494 | btrfs_commit_transaction(h, root); | 497 | btrfs_commit_transaction(h, root); |
| 495 | goto again; | 498 | goto again; |
| 496 | } | 499 | } |
| @@ -1615,11 +1618,6 @@ static int btrfs_flush_all_pending_stuffs(struct btrfs_trans_handle *trans, | |||
| 1615 | int ret; | 1618 | int ret; |
| 1616 | 1619 | ||
| 1617 | ret = btrfs_run_delayed_items(trans, root); | 1620 | ret = btrfs_run_delayed_items(trans, root); |
| 1618 | /* | ||
| 1619 | * running the delayed items may have added new refs. account | ||
| 1620 | * them now so that they hinder processing of more delayed refs | ||
| 1621 | * as little as possible. | ||
| 1622 | */ | ||
| 1623 | if (ret) | 1621 | if (ret) |
| 1624 | return ret; | 1622 | return ret; |
| 1625 | 1623 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c83b24251e53..6104676857f5 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include "rcu-string.h" | 40 | #include "rcu-string.h" |
| 41 | #include "math.h" | 41 | #include "math.h" |
| 42 | #include "dev-replace.h" | 42 | #include "dev-replace.h" |
| 43 | #include "sysfs.h" | ||
| 43 | 44 | ||
| 44 | static int init_first_rw_device(struct btrfs_trans_handle *trans, | 45 | static int init_first_rw_device(struct btrfs_trans_handle *trans, |
| 45 | struct btrfs_root *root, | 46 | struct btrfs_root *root, |
| @@ -554,12 +555,14 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) | |||
| 554 | * This is ok to do without rcu read locked because we hold the | 555 | * This is ok to do without rcu read locked because we hold the |
| 555 | * uuid mutex so nothing we touch in here is going to disappear. | 556 | * uuid mutex so nothing we touch in here is going to disappear. |
| 556 | */ | 557 | */ |
| 557 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); | 558 | if (orig_dev->name) { |
| 558 | if (!name) { | 559 | name = rcu_string_strdup(orig_dev->name->str, GFP_NOFS); |
| 559 | kfree(device); | 560 | if (!name) { |
| 560 | goto error; | 561 | kfree(device); |
| 562 | goto error; | ||
| 563 | } | ||
| 564 | rcu_assign_pointer(device->name, name); | ||
| 561 | } | 565 | } |
| 562 | rcu_assign_pointer(device->name, name); | ||
| 563 | 566 | ||
| 564 | list_add(&device->dev_list, &fs_devices->devices); | 567 | list_add(&device->dev_list, &fs_devices->devices); |
| 565 | device->fs_devices = fs_devices; | 568 | device->fs_devices = fs_devices; |
| @@ -1680,6 +1683,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
| 1680 | if (device->bdev) | 1683 | if (device->bdev) |
| 1681 | device->fs_devices->open_devices--; | 1684 | device->fs_devices->open_devices--; |
| 1682 | 1685 | ||
| 1686 | /* remove sysfs entry */ | ||
| 1687 | btrfs_kobj_rm_device(root->fs_info, device); | ||
| 1688 | |||
| 1683 | call_rcu(&device->rcu, free_device); | 1689 | call_rcu(&device->rcu, free_device); |
| 1684 | 1690 | ||
| 1685 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; | 1691 | num_devices = btrfs_super_num_devices(root->fs_info->super_copy) - 1; |
| @@ -2143,9 +2149,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 2143 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); | 2149 | total_bytes = btrfs_super_num_devices(root->fs_info->super_copy); |
| 2144 | btrfs_set_super_num_devices(root->fs_info->super_copy, | 2150 | btrfs_set_super_num_devices(root->fs_info->super_copy, |
| 2145 | total_bytes + 1); | 2151 | total_bytes + 1); |
| 2152 | |||
| 2153 | /* add sysfs device entry */ | ||
| 2154 | btrfs_kobj_add_device(root->fs_info, device); | ||
| 2155 | |||
| 2146 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 2156 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
| 2147 | 2157 | ||
| 2148 | if (seeding_dev) { | 2158 | if (seeding_dev) { |
| 2159 | char fsid_buf[BTRFS_UUID_UNPARSED_SIZE]; | ||
| 2149 | ret = init_first_rw_device(trans, root, device); | 2160 | ret = init_first_rw_device(trans, root, device); |
| 2150 | if (ret) { | 2161 | if (ret) { |
| 2151 | btrfs_abort_transaction(trans, root, ret); | 2162 | btrfs_abort_transaction(trans, root, ret); |
| @@ -2156,6 +2167,14 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 2156 | btrfs_abort_transaction(trans, root, ret); | 2167 | btrfs_abort_transaction(trans, root, ret); |
| 2157 | goto error_trans; | 2168 | goto error_trans; |
| 2158 | } | 2169 | } |
| 2170 | |||
| 2171 | /* Sprouting would change fsid of the mounted root, | ||
| 2172 | * so rename the fsid on the sysfs | ||
| 2173 | */ | ||
| 2174 | snprintf(fsid_buf, BTRFS_UUID_UNPARSED_SIZE, "%pU", | ||
| 2175 | root->fs_info->fsid); | ||
| 2176 | if (kobject_rename(&root->fs_info->super_kobj, fsid_buf)) | ||
| 2177 | goto error_trans; | ||
| 2159 | } else { | 2178 | } else { |
| 2160 | ret = btrfs_add_device(trans, root, device); | 2179 | ret = btrfs_add_device(trans, root, device); |
| 2161 | if (ret) { | 2180 | if (ret) { |
| @@ -2205,6 +2224,7 @@ error_trans: | |||
| 2205 | unlock_chunks(root); | 2224 | unlock_chunks(root); |
| 2206 | btrfs_end_transaction(trans, root); | 2225 | btrfs_end_transaction(trans, root); |
| 2207 | rcu_string_free(device->name); | 2226 | rcu_string_free(device->name); |
| 2227 | btrfs_kobj_rm_device(root->fs_info, device); | ||
| 2208 | kfree(device); | 2228 | kfree(device); |
| 2209 | error: | 2229 | error: |
| 2210 | blkdev_put(bdev, FMODE_EXCL); | 2230 | blkdev_put(bdev, FMODE_EXCL); |
diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c index 4f196314c0c1..b67d8fc81277 100644 --- a/fs/btrfs/zlib.c +++ b/fs/btrfs/zlib.c | |||
| @@ -136,7 +136,7 @@ static int zlib_compress_pages(struct list_head *ws, | |||
| 136 | if (workspace->def_strm.total_in > 8192 && | 136 | if (workspace->def_strm.total_in > 8192 && |
| 137 | workspace->def_strm.total_in < | 137 | workspace->def_strm.total_in < |
| 138 | workspace->def_strm.total_out) { | 138 | workspace->def_strm.total_out) { |
| 139 | ret = -EIO; | 139 | ret = -E2BIG; |
| 140 | goto out; | 140 | goto out; |
| 141 | } | 141 | } |
| 142 | /* we need another page for writing out. Test this | 142 | /* we need another page for writing out. Test this |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 0762d143e252..fca382037ddd 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
| @@ -194,7 +194,16 @@ static void ext4_init_block_bitmap(struct super_block *sb, | |||
| 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
| 195 | ext4_error(sb, "Checksum bad for group %u", block_group); | 195 | ext4_error(sb, "Checksum bad for group %u", block_group); |
| 196 | grp = ext4_get_group_info(sb, block_group); | 196 | grp = ext4_get_group_info(sb, block_group); |
| 197 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 198 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 199 | grp->bb_free); | ||
| 197 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 200 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 201 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 202 | int count; | ||
| 203 | count = ext4_free_inodes_count(sb, gdp); | ||
| 204 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 205 | count); | ||
| 206 | } | ||
| 198 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 207 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 199 | return; | 208 | return; |
| 200 | } | 209 | } |
| @@ -359,6 +368,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 359 | { | 368 | { |
| 360 | ext4_fsblk_t blk; | 369 | ext4_fsblk_t blk; |
| 361 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); | 370 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); |
| 371 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 362 | 372 | ||
| 363 | if (buffer_verified(bh)) | 373 | if (buffer_verified(bh)) |
| 364 | return; | 374 | return; |
| @@ -369,6 +379,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 369 | ext4_unlock_group(sb, block_group); | 379 | ext4_unlock_group(sb, block_group); |
| 370 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", | 380 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", |
| 371 | block_group, blk); | 381 | block_group, blk); |
| 382 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 383 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 384 | grp->bb_free); | ||
| 372 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 385 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 373 | return; | 386 | return; |
| 374 | } | 387 | } |
| @@ -376,6 +389,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
| 376 | desc, bh))) { | 389 | desc, bh))) { |
| 377 | ext4_unlock_group(sb, block_group); | 390 | ext4_unlock_group(sb, block_group); |
| 378 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); | 391 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); |
| 392 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 393 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 394 | grp->bb_free); | ||
| 379 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 395 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 380 | return; | 396 | return; |
| 381 | } | 397 | } |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 0ee59a6644e2..a87455df38bc 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -71,6 +71,7 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
| 71 | struct ext4_group_desc *gdp) | 71 | struct ext4_group_desc *gdp) |
| 72 | { | 72 | { |
| 73 | struct ext4_group_info *grp; | 73 | struct ext4_group_info *grp; |
| 74 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 74 | J_ASSERT_BH(bh, buffer_locked(bh)); | 75 | J_ASSERT_BH(bh, buffer_locked(bh)); |
| 75 | 76 | ||
| 76 | /* If checksum is bad mark all blocks and inodes use to prevent | 77 | /* If checksum is bad mark all blocks and inodes use to prevent |
| @@ -78,7 +79,16 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
| 78 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 79 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
| 79 | ext4_error(sb, "Checksum bad for group %u", block_group); | 80 | ext4_error(sb, "Checksum bad for group %u", block_group); |
| 80 | grp = ext4_get_group_info(sb, block_group); | 81 | grp = ext4_get_group_info(sb, block_group); |
| 82 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 83 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 84 | grp->bb_free); | ||
| 81 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 85 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 86 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 87 | int count; | ||
| 88 | count = ext4_free_inodes_count(sb, gdp); | ||
| 89 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 90 | count); | ||
| 91 | } | ||
| 82 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 92 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 83 | return 0; | 93 | return 0; |
| 84 | } | 94 | } |
| @@ -116,6 +126,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
| 116 | struct buffer_head *bh = NULL; | 126 | struct buffer_head *bh = NULL; |
| 117 | ext4_fsblk_t bitmap_blk; | 127 | ext4_fsblk_t bitmap_blk; |
| 118 | struct ext4_group_info *grp; | 128 | struct ext4_group_info *grp; |
| 129 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 119 | 130 | ||
| 120 | desc = ext4_get_group_desc(sb, block_group, NULL); | 131 | desc = ext4_get_group_desc(sb, block_group, NULL); |
| 121 | if (!desc) | 132 | if (!desc) |
| @@ -185,6 +196,12 @@ verify: | |||
| 185 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " | 196 | ext4_error(sb, "Corrupt inode bitmap - block_group = %u, " |
| 186 | "inode_bitmap = %llu", block_group, bitmap_blk); | 197 | "inode_bitmap = %llu", block_group, bitmap_blk); |
| 187 | grp = ext4_get_group_info(sb, block_group); | 198 | grp = ext4_get_group_info(sb, block_group); |
| 199 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 200 | int count; | ||
| 201 | count = ext4_free_inodes_count(sb, desc); | ||
| 202 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 203 | count); | ||
| 204 | } | ||
| 188 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 205 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 189 | return NULL; | 206 | return NULL; |
| 190 | } | 207 | } |
| @@ -321,6 +338,12 @@ out: | |||
| 321 | fatal = err; | 338 | fatal = err; |
| 322 | } else { | 339 | } else { |
| 323 | ext4_error(sb, "bit already cleared for inode %lu", ino); | 340 | ext4_error(sb, "bit already cleared for inode %lu", ino); |
| 341 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
| 342 | int count; | ||
| 343 | count = ext4_free_inodes_count(sb, gdp); | ||
| 344 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
| 345 | count); | ||
| 346 | } | ||
| 324 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 347 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 325 | } | 348 | } |
| 326 | 349 | ||
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 8a57e9fcd1b9..fd69da194826 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
| @@ -389,7 +389,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode, | |||
| 389 | return 0; | 389 | return 0; |
| 390 | failed: | 390 | failed: |
| 391 | for (; i >= 0; i--) { | 391 | for (; i >= 0; i--) { |
| 392 | if (i != indirect_blks && branch[i].bh) | 392 | /* |
| 393 | * We want to ext4_forget() only freshly allocated indirect | ||
| 394 | * blocks. Buffer for new_blocks[i-1] is at branch[i].bh and | ||
| 395 | * buffer at branch[0].bh is indirect block / inode already | ||
| 396 | * existing before ext4_alloc_branch() was called. | ||
| 397 | */ | ||
| 398 | if (i > 0 && i != indirect_blks && branch[i].bh) | ||
| 393 | ext4_forget(handle, 1, inode, branch[i].bh, | 399 | ext4_forget(handle, 1, inode, branch[i].bh, |
| 394 | branch[i].bh->b_blocknr); | 400 | branch[i].bh->b_blocknr); |
| 395 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], | 401 | ext4_free_blocks(handle, inode, NULL, new_blocks[i], |
| @@ -1310,16 +1316,24 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
| 1310 | blk = *i_data; | 1316 | blk = *i_data; |
| 1311 | if (level > 0) { | 1317 | if (level > 0) { |
| 1312 | ext4_lblk_t first2; | 1318 | ext4_lblk_t first2; |
| 1319 | ext4_lblk_t count2; | ||
| 1320 | |||
| 1313 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); | 1321 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); |
| 1314 | if (!bh) { | 1322 | if (!bh) { |
| 1315 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), | 1323 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), |
| 1316 | "Read failure"); | 1324 | "Read failure"); |
| 1317 | return -EIO; | 1325 | return -EIO; |
| 1318 | } | 1326 | } |
| 1319 | first2 = (first > offset) ? first - offset : 0; | 1327 | if (first > offset) { |
| 1328 | first2 = first - offset; | ||
| 1329 | count2 = count; | ||
| 1330 | } else { | ||
| 1331 | first2 = 0; | ||
| 1332 | count2 = count - (offset - first); | ||
| 1333 | } | ||
| 1320 | ret = free_hole_blocks(handle, inode, bh, | 1334 | ret = free_hole_blocks(handle, inode, bh, |
| 1321 | (__le32 *)bh->b_data, level - 1, | 1335 | (__le32 *)bh->b_data, level - 1, |
| 1322 | first2, count - offset, | 1336 | first2, count2, |
| 1323 | inode->i_sb->s_blocksize >> 2); | 1337 | inode->i_sb->s_blocksize >> 2); |
| 1324 | if (ret) { | 1338 | if (ret) { |
| 1325 | brelse(bh); | 1339 | brelse(bh); |
| @@ -1329,8 +1343,8 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
| 1329 | if (level == 0 || | 1343 | if (level == 0 || |
| 1330 | (bh && all_zeroes((__le32 *)bh->b_data, | 1344 | (bh && all_zeroes((__le32 *)bh->b_data, |
| 1331 | (__le32 *)bh->b_data + addr_per_block))) { | 1345 | (__le32 *)bh->b_data + addr_per_block))) { |
| 1332 | ext4_free_data(handle, inode, parent_bh, &blk, &blk+1); | 1346 | ext4_free_data(handle, inode, parent_bh, |
| 1333 | *i_data = 0; | 1347 | i_data, i_data + 1); |
| 1334 | } | 1348 | } |
| 1335 | brelse(bh); | 1349 | brelse(bh); |
| 1336 | bh = NULL; | 1350 | bh = NULL; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 59e31622cc6e..7f72f50a8fa7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
| @@ -722,6 +722,7 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
| 722 | void *buddy, void *bitmap, ext4_group_t group) | 722 | void *buddy, void *bitmap, ext4_group_t group) |
| 723 | { | 723 | { |
| 724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); | 724 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); |
| 725 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 725 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); | 726 | ext4_grpblk_t max = EXT4_CLUSTERS_PER_GROUP(sb); |
| 726 | ext4_grpblk_t i = 0; | 727 | ext4_grpblk_t i = 0; |
| 727 | ext4_grpblk_t first; | 728 | ext4_grpblk_t first; |
| @@ -759,6 +760,9 @@ void ext4_mb_generate_buddy(struct super_block *sb, | |||
| 759 | * corrupt and update bb_free using bitmap value | 760 | * corrupt and update bb_free using bitmap value |
| 760 | */ | 761 | */ |
| 761 | grp->bb_free = free; | 762 | grp->bb_free = free; |
| 763 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
| 764 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 765 | grp->bb_free); | ||
| 762 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 766 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
| 763 | } | 767 | } |
| 764 | mb_set_largest_free_order(sb, grp); | 768 | mb_set_largest_free_order(sb, grp); |
| @@ -1431,6 +1435,7 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
| 1431 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); | 1435 | right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); |
| 1432 | 1436 | ||
| 1433 | if (unlikely(block != -1)) { | 1437 | if (unlikely(block != -1)) { |
| 1438 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 1434 | ext4_fsblk_t blocknr; | 1439 | ext4_fsblk_t blocknr; |
| 1435 | 1440 | ||
| 1436 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); | 1441 | blocknr = ext4_group_first_block_no(sb, e4b->bd_group); |
| @@ -1441,6 +1446,9 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
| 1441 | "freeing already freed block " | 1446 | "freeing already freed block " |
| 1442 | "(bit %u); block bitmap corrupt.", | 1447 | "(bit %u); block bitmap corrupt.", |
| 1443 | block); | 1448 | block); |
| 1449 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)) | ||
| 1450 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
| 1451 | e4b->bd_info->bb_free); | ||
| 1444 | /* Mark the block group as corrupt. */ | 1452 | /* Mark the block group as corrupt. */ |
| 1445 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, | 1453 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, |
| 1446 | &e4b->bd_info->bb_state); | 1454 | &e4b->bd_info->bb_state); |
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index e3d37f607f97..d895b4b7b661 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
| @@ -39,6 +39,19 @@ struct kernfs_open_node { | |||
| 39 | struct list_head files; /* goes through kernfs_open_file.list */ | 39 | struct list_head files; /* goes through kernfs_open_file.list */ |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /* | ||
| 43 | * kernfs_notify() may be called from any context and bounces notifications | ||
| 44 | * through a work item. To minimize space overhead in kernfs_node, the | ||
| 45 | * pending queue is implemented as a singly linked list of kernfs_nodes. | ||
| 46 | * The list is terminated with the self pointer so that whether a | ||
| 47 | * kernfs_node is on the list or not can be determined by testing the next | ||
| 48 | * pointer for NULL. | ||
| 49 | */ | ||
| 50 | #define KERNFS_NOTIFY_EOL ((void *)&kernfs_notify_list) | ||
| 51 | |||
| 52 | static DEFINE_SPINLOCK(kernfs_notify_lock); | ||
| 53 | static struct kernfs_node *kernfs_notify_list = KERNFS_NOTIFY_EOL; | ||
| 54 | |||
| 42 | static struct kernfs_open_file *kernfs_of(struct file *file) | 55 | static struct kernfs_open_file *kernfs_of(struct file *file) |
| 43 | { | 56 | { |
| 44 | return ((struct seq_file *)file->private_data)->private; | 57 | return ((struct seq_file *)file->private_data)->private; |
| @@ -783,24 +796,25 @@ static unsigned int kernfs_fop_poll(struct file *filp, poll_table *wait) | |||
| 783 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; | 796 | return DEFAULT_POLLMASK|POLLERR|POLLPRI; |
| 784 | } | 797 | } |
| 785 | 798 | ||
| 786 | /** | 799 | static void kernfs_notify_workfn(struct work_struct *work) |
| 787 | * kernfs_notify - notify a kernfs file | ||
| 788 | * @kn: file to notify | ||
| 789 | * | ||
| 790 | * Notify @kn such that poll(2) on @kn wakes up. | ||
| 791 | */ | ||
| 792 | void kernfs_notify(struct kernfs_node *kn) | ||
| 793 | { | 800 | { |
| 794 | struct kernfs_root *root = kernfs_root(kn); | 801 | struct kernfs_node *kn; |
| 795 | struct kernfs_open_node *on; | 802 | struct kernfs_open_node *on; |
| 796 | struct kernfs_super_info *info; | 803 | struct kernfs_super_info *info; |
| 797 | unsigned long flags; | 804 | repeat: |
| 798 | 805 | /* pop one off the notify_list */ | |
| 799 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | 806 | spin_lock_irq(&kernfs_notify_lock); |
| 807 | kn = kernfs_notify_list; | ||
| 808 | if (kn == KERNFS_NOTIFY_EOL) { | ||
| 809 | spin_unlock_irq(&kernfs_notify_lock); | ||
| 800 | return; | 810 | return; |
| 811 | } | ||
| 812 | kernfs_notify_list = kn->attr.notify_next; | ||
| 813 | kn->attr.notify_next = NULL; | ||
| 814 | spin_unlock_irq(&kernfs_notify_lock); | ||
| 801 | 815 | ||
| 802 | /* kick poll */ | 816 | /* kick poll */ |
| 803 | spin_lock_irqsave(&kernfs_open_node_lock, flags); | 817 | spin_lock_irq(&kernfs_open_node_lock); |
| 804 | 818 | ||
| 805 | on = kn->attr.open; | 819 | on = kn->attr.open; |
| 806 | if (on) { | 820 | if (on) { |
| @@ -808,12 +822,12 @@ void kernfs_notify(struct kernfs_node *kn) | |||
| 808 | wake_up_interruptible(&on->poll); | 822 | wake_up_interruptible(&on->poll); |
| 809 | } | 823 | } |
| 810 | 824 | ||
| 811 | spin_unlock_irqrestore(&kernfs_open_node_lock, flags); | 825 | spin_unlock_irq(&kernfs_open_node_lock); |
| 812 | 826 | ||
| 813 | /* kick fsnotify */ | 827 | /* kick fsnotify */ |
| 814 | mutex_lock(&kernfs_mutex); | 828 | mutex_lock(&kernfs_mutex); |
| 815 | 829 | ||
| 816 | list_for_each_entry(info, &root->supers, node) { | 830 | list_for_each_entry(info, &kernfs_root(kn)->supers, node) { |
| 817 | struct inode *inode; | 831 | struct inode *inode; |
| 818 | struct dentry *dentry; | 832 | struct dentry *dentry; |
| 819 | 833 | ||
| @@ -833,6 +847,33 @@ void kernfs_notify(struct kernfs_node *kn) | |||
| 833 | } | 847 | } |
| 834 | 848 | ||
| 835 | mutex_unlock(&kernfs_mutex); | 849 | mutex_unlock(&kernfs_mutex); |
| 850 | kernfs_put(kn); | ||
| 851 | goto repeat; | ||
| 852 | } | ||
| 853 | |||
| 854 | /** | ||
| 855 | * kernfs_notify - notify a kernfs file | ||
| 856 | * @kn: file to notify | ||
| 857 | * | ||
| 858 | * Notify @kn such that poll(2) on @kn wakes up. Maybe be called from any | ||
| 859 | * context. | ||
| 860 | */ | ||
| 861 | void kernfs_notify(struct kernfs_node *kn) | ||
| 862 | { | ||
| 863 | static DECLARE_WORK(kernfs_notify_work, kernfs_notify_workfn); | ||
| 864 | unsigned long flags; | ||
| 865 | |||
| 866 | if (WARN_ON(kernfs_type(kn) != KERNFS_FILE)) | ||
| 867 | return; | ||
| 868 | |||
| 869 | spin_lock_irqsave(&kernfs_notify_lock, flags); | ||
| 870 | if (!kn->attr.notify_next) { | ||
| 871 | kernfs_get(kn); | ||
| 872 | kn->attr.notify_next = kernfs_notify_list; | ||
| 873 | kernfs_notify_list = kn; | ||
| 874 | schedule_work(&kernfs_notify_work); | ||
| 875 | } | ||
| 876 | spin_unlock_irqrestore(&kernfs_notify_lock, flags); | ||
| 836 | } | 877 | } |
| 837 | EXPORT_SYMBOL_GPL(kernfs_notify); | 878 | EXPORT_SYMBOL_GPL(kernfs_notify); |
| 838 | 879 | ||
diff --git a/fs/mbcache.c b/fs/mbcache.c index bf166e388f0d..187477ded6b3 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c | |||
| @@ -73,6 +73,7 @@ | |||
| 73 | #include <linux/mbcache.h> | 73 | #include <linux/mbcache.h> |
| 74 | #include <linux/init.h> | 74 | #include <linux/init.h> |
| 75 | #include <linux/blockgroup_lock.h> | 75 | #include <linux/blockgroup_lock.h> |
| 76 | #include <linux/log2.h> | ||
| 76 | 77 | ||
| 77 | #ifdef MB_CACHE_DEBUG | 78 | #ifdef MB_CACHE_DEBUG |
| 78 | # define mb_debug(f...) do { \ | 79 | # define mb_debug(f...) do { \ |
| @@ -93,7 +94,7 @@ | |||
| 93 | 94 | ||
| 94 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) | 95 | #define MB_CACHE_WRITER ((unsigned short)~0U >> 1) |
| 95 | 96 | ||
| 96 | #define MB_CACHE_ENTRY_LOCK_BITS __builtin_log2(NR_BG_LOCKS) | 97 | #define MB_CACHE_ENTRY_LOCK_BITS ilog2(NR_BG_LOCKS) |
| 97 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ | 98 | #define MB_CACHE_ENTRY_LOCK_INDEX(ce) \ |
| 98 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) | 99 | (hash_long((unsigned long)ce, MB_CACHE_ENTRY_LOCK_BITS)) |
| 99 | 100 | ||
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 6851b003f2a4..8f029db5d271 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -617,15 +617,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 617 | 617 | ||
| 618 | switch (create->cr_type) { | 618 | switch (create->cr_type) { |
| 619 | case NF4LNK: | 619 | case NF4LNK: |
| 620 | /* ugh! we have to null-terminate the linktext, or | ||
| 621 | * vfs_symlink() will choke. it is always safe to | ||
| 622 | * null-terminate by brute force, since at worst we | ||
| 623 | * will overwrite the first byte of the create namelen | ||
| 624 | * in the XDR buffer, which has already been extracted | ||
| 625 | * during XDR decode. | ||
| 626 | */ | ||
| 627 | create->cr_linkname[create->cr_linklen] = 0; | ||
| 628 | |||
| 629 | status = nfsd_symlink(rqstp, &cstate->current_fh, | 620 | status = nfsd_symlink(rqstp, &cstate->current_fh, |
| 630 | create->cr_name, create->cr_namelen, | 621 | create->cr_name, create->cr_namelen, |
| 631 | create->cr_linkname, create->cr_linklen, | 622 | create->cr_linkname, create->cr_linklen, |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 83baf2bfe9e9..2fc7abebeb9b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -600,7 +600,18 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
| 600 | READ_BUF(4); | 600 | READ_BUF(4); |
| 601 | create->cr_linklen = be32_to_cpup(p++); | 601 | create->cr_linklen = be32_to_cpup(p++); |
| 602 | READ_BUF(create->cr_linklen); | 602 | READ_BUF(create->cr_linklen); |
| 603 | SAVEMEM(create->cr_linkname, create->cr_linklen); | 603 | /* |
| 604 | * The VFS will want a null-terminated string, and | ||
| 605 | * null-terminating in place isn't safe since this might | ||
| 606 | * end on a page boundary: | ||
| 607 | */ | ||
| 608 | create->cr_linkname = | ||
| 609 | kmalloc(create->cr_linklen + 1, GFP_KERNEL); | ||
| 610 | if (!create->cr_linkname) | ||
| 611 | return nfserr_jukebox; | ||
| 612 | memcpy(create->cr_linkname, p, create->cr_linklen); | ||
| 613 | create->cr_linkname[create->cr_linklen] = '\0'; | ||
| 614 | defer_free(argp, kfree, create->cr_linkname); | ||
| 604 | break; | 615 | break; |
| 605 | case NF4BLK: | 616 | case NF4BLK: |
| 606 | case NF4CHR: | 617 | case NF4CHR: |
| @@ -3267,7 +3278,7 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd | |||
| 3267 | 3278 | ||
| 3268 | wire_count = htonl(maxcount); | 3279 | wire_count = htonl(maxcount); |
| 3269 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); | 3280 | write_bytes_to_xdr_buf(xdr->buf, length_offset, &wire_count, 4); |
| 3270 | xdr_truncate_encode(xdr, length_offset + 4 + maxcount); | 3281 | xdr_truncate_encode(xdr, length_offset + 4 + ALIGN(maxcount, 4)); |
| 3271 | if (maxcount & 3) | 3282 | if (maxcount & 3) |
| 3272 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, | 3283 | write_bytes_to_xdr_buf(xdr->buf, length_offset + 4 + maxcount, |
| 3273 | &zero, 4 - (maxcount&3)); | 3284 | &zero, 4 - (maxcount&3)); |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 9d231e9e5f0e..bf2d03f8fd3e 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
| @@ -184,29 +184,11 @@ static int show_stat(struct seq_file *p, void *v) | |||
| 184 | 184 | ||
| 185 | static int stat_open(struct inode *inode, struct file *file) | 185 | static int stat_open(struct inode *inode, struct file *file) |
| 186 | { | 186 | { |
| 187 | size_t size = 1024 + 128 * num_possible_cpus(); | 187 | size_t size = 1024 + 128 * num_online_cpus(); |
| 188 | char *buf; | ||
| 189 | struct seq_file *m; | ||
| 190 | int res; | ||
| 191 | 188 | ||
| 192 | /* minimum size to display an interrupt count : 2 bytes */ | 189 | /* minimum size to display an interrupt count : 2 bytes */ |
| 193 | size += 2 * nr_irqs; | 190 | size += 2 * nr_irqs; |
| 194 | 191 | return single_open_size(file, show_stat, NULL, size); | |
| 195 | /* don't ask for more than the kmalloc() max size */ | ||
| 196 | if (size > KMALLOC_MAX_SIZE) | ||
| 197 | size = KMALLOC_MAX_SIZE; | ||
| 198 | buf = kmalloc(size, GFP_KERNEL); | ||
| 199 | if (!buf) | ||
| 200 | return -ENOMEM; | ||
| 201 | |||
| 202 | res = single_open(file, show_stat, NULL); | ||
| 203 | if (!res) { | ||
| 204 | m = file->private_data; | ||
| 205 | m->buf = buf; | ||
| 206 | m->size = ksize(buf); | ||
| 207 | } else | ||
| 208 | kfree(buf); | ||
| 209 | return res; | ||
| 210 | } | 192 | } |
| 211 | 193 | ||
| 212 | static const struct file_operations proc_stat_operations = { | 194 | static const struct file_operations proc_stat_operations = { |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 1d641bb108d2..3857b720cb1b 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
| @@ -8,8 +8,10 @@ | |||
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/vmalloc.h> | ||
| 11 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| 12 | #include <linux/cred.h> | 13 | #include <linux/cred.h> |
| 14 | #include <linux/mm.h> | ||
| 13 | 15 | ||
| 14 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
| 15 | #include <asm/page.h> | 17 | #include <asm/page.h> |
| @@ -30,6 +32,16 @@ static void seq_set_overflow(struct seq_file *m) | |||
| 30 | m->count = m->size; | 32 | m->count = m->size; |
| 31 | } | 33 | } |
| 32 | 34 | ||
| 35 | static void *seq_buf_alloc(unsigned long size) | ||
| 36 | { | ||
| 37 | void *buf; | ||
| 38 | |||
| 39 | buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); | ||
| 40 | if (!buf && size > PAGE_SIZE) | ||
| 41 | buf = vmalloc(size); | ||
| 42 | return buf; | ||
| 43 | } | ||
| 44 | |||
| 33 | /** | 45 | /** |
| 34 | * seq_open - initialize sequential file | 46 | * seq_open - initialize sequential file |
| 35 | * @file: file we initialize | 47 | * @file: file we initialize |
| @@ -96,7 +108,7 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
| 96 | return 0; | 108 | return 0; |
| 97 | } | 109 | } |
| 98 | if (!m->buf) { | 110 | if (!m->buf) { |
| 99 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 111 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
| 100 | if (!m->buf) | 112 | if (!m->buf) |
| 101 | return -ENOMEM; | 113 | return -ENOMEM; |
| 102 | } | 114 | } |
| @@ -135,9 +147,9 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
| 135 | 147 | ||
| 136 | Eoverflow: | 148 | Eoverflow: |
| 137 | m->op->stop(m, p); | 149 | m->op->stop(m, p); |
| 138 | kfree(m->buf); | 150 | kvfree(m->buf); |
| 139 | m->count = 0; | 151 | m->count = 0; |
| 140 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 152 | m->buf = seq_buf_alloc(m->size <<= 1); |
| 141 | return !m->buf ? -ENOMEM : -EAGAIN; | 153 | return !m->buf ? -ENOMEM : -EAGAIN; |
| 142 | } | 154 | } |
| 143 | 155 | ||
| @@ -192,7 +204,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
| 192 | 204 | ||
| 193 | /* grab buffer if we didn't have one */ | 205 | /* grab buffer if we didn't have one */ |
| 194 | if (!m->buf) { | 206 | if (!m->buf) { |
| 195 | m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); | 207 | m->buf = seq_buf_alloc(m->size = PAGE_SIZE); |
| 196 | if (!m->buf) | 208 | if (!m->buf) |
| 197 | goto Enomem; | 209 | goto Enomem; |
| 198 | } | 210 | } |
| @@ -232,9 +244,9 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
| 232 | if (m->count < m->size) | 244 | if (m->count < m->size) |
| 233 | goto Fill; | 245 | goto Fill; |
| 234 | m->op->stop(m, p); | 246 | m->op->stop(m, p); |
| 235 | kfree(m->buf); | 247 | kvfree(m->buf); |
| 236 | m->count = 0; | 248 | m->count = 0; |
| 237 | m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); | 249 | m->buf = seq_buf_alloc(m->size <<= 1); |
| 238 | if (!m->buf) | 250 | if (!m->buf) |
| 239 | goto Enomem; | 251 | goto Enomem; |
| 240 | m->version = 0; | 252 | m->version = 0; |
| @@ -350,7 +362,7 @@ EXPORT_SYMBOL(seq_lseek); | |||
| 350 | int seq_release(struct inode *inode, struct file *file) | 362 | int seq_release(struct inode *inode, struct file *file) |
| 351 | { | 363 | { |
| 352 | struct seq_file *m = file->private_data; | 364 | struct seq_file *m = file->private_data; |
| 353 | kfree(m->buf); | 365 | kvfree(m->buf); |
| 354 | kfree(m); | 366 | kfree(m); |
| 355 | return 0; | 367 | return 0; |
| 356 | } | 368 | } |
| @@ -605,13 +617,13 @@ EXPORT_SYMBOL(single_open); | |||
| 605 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), | 617 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), |
| 606 | void *data, size_t size) | 618 | void *data, size_t size) |
| 607 | { | 619 | { |
| 608 | char *buf = kmalloc(size, GFP_KERNEL); | 620 | char *buf = seq_buf_alloc(size); |
| 609 | int ret; | 621 | int ret; |
| 610 | if (!buf) | 622 | if (!buf) |
| 611 | return -ENOMEM; | 623 | return -ENOMEM; |
| 612 | ret = single_open(file, show, data); | 624 | ret = single_open(file, show, data); |
| 613 | if (ret) { | 625 | if (ret) { |
| 614 | kfree(buf); | 626 | kvfree(buf); |
| 615 | return ret; | 627 | return ret; |
| 616 | } | 628 | } |
| 617 | ((struct seq_file *)file->private_data)->buf = buf; | 629 | ((struct seq_file *)file->private_data)->buf = buf; |
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h index 2baba9996094..baa6f11b1837 100644 --- a/include/drm/i915_powerwell.h +++ b/include/drm/i915_powerwell.h | |||
| @@ -32,5 +32,6 @@ | |||
| 32 | /* For use by hda_i915 driver */ | 32 | /* For use by hda_i915 driver */ |
| 33 | extern int i915_request_power_well(void); | 33 | extern int i915_request_power_well(void); |
| 34 | extern int i915_release_power_well(void); | 34 | extern int i915_release_power_well(void); |
| 35 | extern int i915_get_cdclk_freq(void); | ||
| 35 | 36 | ||
| 36 | #endif /* _I915_POWERWELL_H_ */ | 37 | #endif /* _I915_POWERWELL_H_ */ |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 17aa1cce6f8e..145375ea0bd9 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
| @@ -91,6 +91,7 @@ struct kernfs_elem_attr { | |||
| 91 | const struct kernfs_ops *ops; | 91 | const struct kernfs_ops *ops; |
| 92 | struct kernfs_open_node *open; | 92 | struct kernfs_open_node *open; |
| 93 | loff_t size; | 93 | loff_t size; |
| 94 | struct kernfs_node *notify_next; /* for kernfs_notify() */ | ||
| 94 | }; | 95 | }; |
| 95 | 96 | ||
| 96 | /* | 97 | /* |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 077904c8b70d..cc79eff4a1ad 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
| 334 | * calling arch_ptrace_stop() when it would be superfluous. For example, | 334 | * calling arch_ptrace_stop() when it would be superfluous. For example, |
| 335 | * if the thread has not been back to user mode since the last stop, the | 335 | * if the thread has not been back to user mode since the last stop, the |
| 336 | * thread state might indicate that nothing needs to be done. | 336 | * thread state might indicate that nothing needs to be done. |
| 337 | * | ||
| 338 | * This is guaranteed to be invoked once before a task stops for ptrace and | ||
| 339 | * may include arch-specific operations necessary prior to a ptrace stop. | ||
| 337 | */ | 340 | */ |
| 338 | #define arch_ptrace_stop_needed(code, info) (0) | 341 | #define arch_ptrace_stop_needed(code, info) (0) |
| 339 | #endif | 342 | #endif |
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h index 1a64b26046ed..9b7de1b46437 100644 --- a/include/linux/usb_usual.h +++ b/include/linux/usb_usual.h | |||
| @@ -70,7 +70,9 @@ | |||
| 70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ | 70 | US_FLAG(NEEDS_CAP16, 0x00400000) \ |
| 71 | /* cannot handle READ_CAPACITY_10 */ \ | 71 | /* cannot handle READ_CAPACITY_10 */ \ |
| 72 | US_FLAG(IGNORE_UAS, 0x00800000) \ | 72 | US_FLAG(IGNORE_UAS, 0x00800000) \ |
| 73 | /* Device advertises UAS but it is broken */ | 73 | /* Device advertises UAS but it is broken */ \ |
| 74 | US_FLAG(BROKEN_FUA, 0x01000000) \ | ||
| 75 | /* Cannot handle FUA in WRITE or READ CDBs */ \ | ||
| 74 | 76 | ||
| 75 | #define US_FLAG(name, value) US_FL_##name = value , | 77 | #define US_FLAG(name, value) US_FL_##name = value , |
| 76 | enum { US_DO_ALL_FLAGS }; | 78 | enum { US_DO_ALL_FLAGS }; |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 5853c913d2b0..27ab31017f09 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -173,6 +173,7 @@ struct scsi_device { | |||
| 173 | unsigned is_visible:1; /* is the device visible in sysfs */ | 173 | unsigned is_visible:1; /* is the device visible in sysfs */ |
| 174 | unsigned wce_default_on:1; /* Cache is ON by default */ | 174 | unsigned wce_default_on:1; /* Cache is ON by default */ |
| 175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ | 175 | unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ |
| 176 | unsigned broken_fua:1; /* Don't set FUA bit */ | ||
| 176 | 177 | ||
| 177 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ | 178 | atomic_t disk_events_disable_depth; /* disable depth for disk events */ |
| 178 | 179 | ||
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h index 6f9c38ce45c7..2f47824e7a36 100644 --- a/include/uapi/linux/btrfs.h +++ b/include/uapi/linux/btrfs.h | |||
| @@ -38,6 +38,7 @@ struct btrfs_ioctl_vol_args { | |||
| 38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) | 38 | #define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) |
| 39 | #define BTRFS_FSID_SIZE 16 | 39 | #define BTRFS_FSID_SIZE 16 |
| 40 | #define BTRFS_UUID_SIZE 16 | 40 | #define BTRFS_UUID_SIZE 16 |
| 41 | #define BTRFS_UUID_UNPARSED_SIZE 37 | ||
| 41 | 42 | ||
| 42 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) | 43 | #define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) |
| 43 | 44 | ||
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h index 2a4b4a72a4f9..24b68c59dcf8 100644 --- a/include/uapi/linux/usb/functionfs.h +++ b/include/uapi/linux/usb/functionfs.h | |||
| @@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio { | |||
| 33 | __u8 bInterval; | 33 | __u8 bInterval; |
| 34 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
| 35 | 35 | ||
| 36 | /* Legacy format, deprecated as of 3.14. */ | ||
| 37 | struct usb_functionfs_descs_head { | ||
| 38 | __le32 magic; | ||
| 39 | __le32 length; | ||
| 40 | __le32 fs_count; | ||
| 41 | __le32 hs_count; | ||
| 42 | } __attribute__((packed, deprecated)); | ||
| 36 | 43 | ||
| 37 | /* | 44 | /* |
| 38 | * Descriptors format: | 45 | * Descriptors format: |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index c445e392e93f..6f3254e8c137 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
| @@ -846,7 +846,7 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u | |||
| 846 | { | 846 | { |
| 847 | int err; | 847 | int err; |
| 848 | 848 | ||
| 849 | if (!consumer_del(uprobe, uc)) /* WARN? */ | 849 | if (WARN_ON(!consumer_del(uprobe, uc))) |
| 850 | return; | 850 | return; |
| 851 | 851 | ||
| 852 | err = register_for_each_vma(uprobe, NULL); | 852 | err = register_for_each_vma(uprobe, NULL); |
| @@ -927,7 +927,7 @@ int uprobe_apply(struct inode *inode, loff_t offset, | |||
| 927 | int ret = -ENOENT; | 927 | int ret = -ENOENT; |
| 928 | 928 | ||
| 929 | uprobe = find_uprobe(inode, offset); | 929 | uprobe = find_uprobe(inode, offset); |
| 930 | if (!uprobe) | 930 | if (WARN_ON(!uprobe)) |
| 931 | return ret; | 931 | return ret; |
| 932 | 932 | ||
| 933 | down_write(&uprobe->register_rwsem); | 933 | down_write(&uprobe->register_rwsem); |
| @@ -952,7 +952,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume | |||
| 952 | struct uprobe *uprobe; | 952 | struct uprobe *uprobe; |
| 953 | 953 | ||
| 954 | uprobe = find_uprobe(inode, offset); | 954 | uprobe = find_uprobe(inode, offset); |
| 955 | if (!uprobe) | 955 | if (WARN_ON(!uprobe)) |
| 956 | return; | 956 | return; |
| 957 | 957 | ||
| 958 | down_write(&uprobe->register_rwsem); | 958 | down_write(&uprobe->register_rwsem); |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ea2d5f6962ed..13e839dbca07 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -1416,9 +1416,10 @@ static int have_callable_console(void) | |||
| 1416 | /* | 1416 | /* |
| 1417 | * Can we actually use the console at this time on this cpu? | 1417 | * Can we actually use the console at this time on this cpu? |
| 1418 | * | 1418 | * |
| 1419 | * Console drivers may assume that per-cpu resources have been allocated. So | 1419 | * Console drivers may assume that per-cpu resources have |
| 1420 | * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't | 1420 | * been allocated. So unless they're explicitly marked as |
| 1421 | * call them until this CPU is officially up. | 1421 | * being able to cope (CON_ANYTIME) don't call them until |
| 1422 | * this CPU is officially up. | ||
| 1422 | */ | 1423 | */ |
| 1423 | static inline int can_use_console(unsigned int cpu) | 1424 | static inline int can_use_console(unsigned int cpu) |
| 1424 | { | 1425 | { |
| @@ -1431,10 +1432,8 @@ static inline int can_use_console(unsigned int cpu) | |||
| 1431 | * console_lock held, and 'console_locked' set) if it | 1432 | * console_lock held, and 'console_locked' set) if it |
| 1432 | * is successful, false otherwise. | 1433 | * is successful, false otherwise. |
| 1433 | */ | 1434 | */ |
| 1434 | static int console_trylock_for_printk(void) | 1435 | static int console_trylock_for_printk(unsigned int cpu) |
| 1435 | { | 1436 | { |
| 1436 | unsigned int cpu = smp_processor_id(); | ||
| 1437 | |||
| 1438 | if (!console_trylock()) | 1437 | if (!console_trylock()) |
| 1439 | return 0; | 1438 | return 0; |
| 1440 | /* | 1439 | /* |
| @@ -1609,8 +1608,7 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1609 | */ | 1608 | */ |
| 1610 | if (!oops_in_progress && !lockdep_recursing(current)) { | 1609 | if (!oops_in_progress && !lockdep_recursing(current)) { |
| 1611 | recursion_bug = 1; | 1610 | recursion_bug = 1; |
| 1612 | local_irq_restore(flags); | 1611 | goto out_restore_irqs; |
| 1613 | return 0; | ||
| 1614 | } | 1612 | } |
| 1615 | zap_locks(); | 1613 | zap_locks(); |
| 1616 | } | 1614 | } |
| @@ -1718,27 +1716,21 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
| 1718 | 1716 | ||
| 1719 | logbuf_cpu = UINT_MAX; | 1717 | logbuf_cpu = UINT_MAX; |
| 1720 | raw_spin_unlock(&logbuf_lock); | 1718 | raw_spin_unlock(&logbuf_lock); |
| 1721 | lockdep_on(); | ||
| 1722 | local_irq_restore(flags); | ||
| 1723 | 1719 | ||
| 1724 | /* If called from the scheduler, we can not call up(). */ | 1720 | /* If called from the scheduler, we can not call up(). */ |
| 1725 | if (in_sched) | 1721 | if (!in_sched) { |
| 1726 | return printed_len; | 1722 | /* |
| 1727 | 1723 | * Try to acquire and then immediately release the console | |
| 1728 | /* | 1724 | * semaphore. The release will print out buffers and wake up |
| 1729 | * Disable preemption to avoid being preempted while holding | 1725 | * /dev/kmsg and syslog() users. |
| 1730 | * console_sem which would prevent anyone from printing to console | 1726 | */ |
| 1731 | */ | 1727 | if (console_trylock_for_printk(this_cpu)) |
| 1732 | preempt_disable(); | 1728 | console_unlock(); |
| 1733 | /* | 1729 | } |
| 1734 | * Try to acquire and then immediately release the console semaphore. | ||
| 1735 | * The release will print out buffers and wake up /dev/kmsg and syslog() | ||
| 1736 | * users. | ||
| 1737 | */ | ||
| 1738 | if (console_trylock_for_printk()) | ||
| 1739 | console_unlock(); | ||
| 1740 | preempt_enable(); | ||
| 1741 | 1730 | ||
| 1731 | lockdep_on(); | ||
| 1732 | out_restore_irqs: | ||
| 1733 | local_irq_restore(flags); | ||
| 1742 | return printed_len; | 1734 | return printed_len; |
| 1743 | } | 1735 | } |
| 1744 | EXPORT_SYMBOL(vprintk_emit); | 1736 | EXPORT_SYMBOL(vprintk_emit); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 384ede311717..f243444a3772 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -1396,7 +1396,6 @@ void tracing_start(void) | |||
| 1396 | 1396 | ||
| 1397 | arch_spin_unlock(&global_trace.max_lock); | 1397 | arch_spin_unlock(&global_trace.max_lock); |
| 1398 | 1398 | ||
| 1399 | ftrace_start(); | ||
| 1400 | out: | 1399 | out: |
| 1401 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); | 1400 | raw_spin_unlock_irqrestore(&global_trace.start_lock, flags); |
| 1402 | } | 1401 | } |
| @@ -1443,7 +1442,6 @@ void tracing_stop(void) | |||
| 1443 | struct ring_buffer *buffer; | 1442 | struct ring_buffer *buffer; |
| 1444 | unsigned long flags; | 1443 | unsigned long flags; |
| 1445 | 1444 | ||
| 1446 | ftrace_stop(); | ||
| 1447 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); | 1445 | raw_spin_lock_irqsave(&global_trace.start_lock, flags); |
| 1448 | if (global_trace.stop_count++) | 1446 | if (global_trace.stop_count++) |
| 1449 | goto out; | 1447 | goto out; |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 04fdb5de823c..3c9b97e6b1f4 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
| @@ -893,6 +893,9 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
| 893 | int ret; | 893 | int ret; |
| 894 | 894 | ||
| 895 | if (file) { | 895 | if (file) { |
| 896 | if (tu->tp.flags & TP_FLAG_PROFILE) | ||
| 897 | return -EINTR; | ||
| 898 | |||
| 896 | link = kmalloc(sizeof(*link), GFP_KERNEL); | 899 | link = kmalloc(sizeof(*link), GFP_KERNEL); |
| 897 | if (!link) | 900 | if (!link) |
| 898 | return -ENOMEM; | 901 | return -ENOMEM; |
| @@ -901,29 +904,40 @@ probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file, | |||
| 901 | list_add_tail_rcu(&link->list, &tu->tp.files); | 904 | list_add_tail_rcu(&link->list, &tu->tp.files); |
| 902 | 905 | ||
| 903 | tu->tp.flags |= TP_FLAG_TRACE; | 906 | tu->tp.flags |= TP_FLAG_TRACE; |
| 904 | } else | 907 | } else { |
| 905 | tu->tp.flags |= TP_FLAG_PROFILE; | 908 | if (tu->tp.flags & TP_FLAG_TRACE) |
| 909 | return -EINTR; | ||
| 906 | 910 | ||
| 907 | ret = uprobe_buffer_enable(); | 911 | tu->tp.flags |= TP_FLAG_PROFILE; |
| 908 | if (ret < 0) | 912 | } |
| 909 | return ret; | ||
| 910 | 913 | ||
| 911 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); | 914 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); |
| 912 | 915 | ||
| 913 | if (enabled) | 916 | if (enabled) |
| 914 | return 0; | 917 | return 0; |
| 915 | 918 | ||
| 919 | ret = uprobe_buffer_enable(); | ||
| 920 | if (ret) | ||
| 921 | goto err_flags; | ||
| 922 | |||
| 916 | tu->consumer.filter = filter; | 923 | tu->consumer.filter = filter; |
| 917 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); | 924 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); |
| 918 | if (ret) { | 925 | if (ret) |
| 919 | if (file) { | 926 | goto err_buffer; |
| 920 | list_del(&link->list); | ||
| 921 | kfree(link); | ||
| 922 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
| 923 | } else | ||
| 924 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
| 925 | } | ||
| 926 | 927 | ||
| 928 | return 0; | ||
| 929 | |||
| 930 | err_buffer: | ||
| 931 | uprobe_buffer_disable(); | ||
| 932 | |||
| 933 | err_flags: | ||
| 934 | if (file) { | ||
| 935 | list_del(&link->list); | ||
| 936 | kfree(link); | ||
| 937 | tu->tp.flags &= ~TP_FLAG_TRACE; | ||
| 938 | } else { | ||
| 939 | tu->tp.flags &= ~TP_FLAG_PROFILE; | ||
| 940 | } | ||
| 927 | return ret; | 941 | return ret; |
| 928 | } | 942 | } |
| 929 | 943 | ||
| @@ -1201,12 +1215,6 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) | |||
| 1201 | 1215 | ||
| 1202 | current->utask->vaddr = (unsigned long) &udd; | 1216 | current->utask->vaddr = (unsigned long) &udd; |
| 1203 | 1217 | ||
| 1204 | #ifdef CONFIG_PERF_EVENTS | ||
| 1205 | if ((tu->tp.flags & TP_FLAG_TRACE) == 0 && | ||
| 1206 | !uprobe_perf_filter(&tu->consumer, 0, current->mm)) | ||
| 1207 | return UPROBE_HANDLER_REMOVE; | ||
| 1208 | #endif | ||
| 1209 | |||
| 1210 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) | 1218 | if (WARN_ON_ONCE(!uprobe_cpu_buffer)) |
| 1211 | return 0; | 1219 | return 0; |
| 1212 | 1220 | ||
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index b74da447e81e..7a85967060a5 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
| @@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 192 | int s = 255; | 192 | int s = 255; |
| 193 | while ((ip < iend) && (s == 255)) { | 193 | while ((ip < iend) && (s == 255)) { |
| 194 | s = *ip++; | 194 | s = *ip++; |
| 195 | if (unlikely(length > (size_t)(length + s))) | ||
| 196 | goto _output_error; | ||
| 195 | length += s; | 197 | length += s; |
| 196 | } | 198 | } |
| 197 | } | 199 | } |
| @@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 232 | if (length == ML_MASK) { | 234 | if (length == ML_MASK) { |
| 233 | while (ip < iend) { | 235 | while (ip < iend) { |
| 234 | int s = *ip++; | 236 | int s = *ip++; |
| 237 | if (unlikely(length > (size_t)(length + s))) | ||
| 238 | goto _output_error; | ||
| 235 | length += s; | 239 | length += s; |
| 236 | if (s == 255) | 240 | if (s == 255) |
| 237 | continue; | 241 | continue; |
| @@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest, | |||
| 284 | 288 | ||
| 285 | /* write overflow error detected */ | 289 | /* write overflow error detected */ |
| 286 | _output_error: | 290 | _output_error: |
| 287 | return (int) (-(((char *) ip) - source)); | 291 | return -1; |
| 288 | } | 292 | } |
| 289 | 293 | ||
| 290 | int lz4_decompress(const unsigned char *src, size_t *src_len, | 294 | int lz4_decompress(const unsigned char *src, size_t *src_len, |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index cd8989c1027e..c6399e328931 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
| @@ -895,7 +895,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
| 895 | struct page *hpage = *hpagep; | 895 | struct page *hpage = *hpagep; |
| 896 | struct page *ppage; | 896 | struct page *ppage; |
| 897 | 897 | ||
| 898 | if (PageReserved(p) || PageSlab(p)) | 898 | if (PageReserved(p) || PageSlab(p) || !PageLRU(p)) |
| 899 | return SWAP_SUCCESS; | 899 | return SWAP_SUCCESS; |
| 900 | 900 | ||
| 901 | /* | 901 | /* |
| @@ -1159,9 +1159,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); | 1159 | action_result(pfn, "free buddy, 2nd try", DELAYED); |
| 1160 | return 0; | 1160 | return 0; |
| 1161 | } | 1161 | } |
| 1162 | action_result(pfn, "non LRU", IGNORED); | ||
| 1163 | put_page(p); | ||
| 1164 | return -EBUSY; | ||
| 1165 | } | 1162 | } |
| 1166 | } | 1163 | } |
| 1167 | 1164 | ||
| @@ -1194,6 +1191,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1194 | return 0; | 1191 | return 0; |
| 1195 | } | 1192 | } |
| 1196 | 1193 | ||
| 1194 | if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p)) | ||
| 1195 | goto identify_page_state; | ||
| 1196 | |||
| 1197 | /* | 1197 | /* |
| 1198 | * For error on the tail page, we should set PG_hwpoison | 1198 | * For error on the tail page, we should set PG_hwpoison |
| 1199 | * on the head page to show that the hugepage is hwpoisoned | 1199 | * on the head page to show that the hugepage is hwpoisoned |
| @@ -1243,6 +1243,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1243 | goto out; | 1243 | goto out; |
| 1244 | } | 1244 | } |
| 1245 | 1245 | ||
| 1246 | identify_page_state: | ||
| 1246 | res = -EBUSY; | 1247 | res = -EBUSY; |
| 1247 | /* | 1248 | /* |
| 1248 | * The first check uses the current page flags which may not have any | 1249 | * The first check uses the current page flags which may not have any |
diff --git a/mm/msync.c b/mm/msync.c index a5c673669ca6..992a1673d488 100644 --- a/mm/msync.c +++ b/mm/msync.c | |||
| @@ -78,7 +78,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) | |||
| 78 | goto out_unlock; | 78 | goto out_unlock; |
| 79 | } | 79 | } |
| 80 | file = vma->vm_file; | 80 | file = vma->vm_file; |
| 81 | fstart = start + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | 81 | fstart = (start - vma->vm_start) + |
| 82 | ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | ||
| 82 | fend = fstart + (min(end, vma->vm_end) - start) - 1; | 83 | fend = fstart + (min(end, vma->vm_end) - start) - 1; |
| 83 | start = vma->vm_end; | 84 | start = vma->vm_end; |
| 84 | if ((flags & MS_SYNC) && file && | 85 | if ((flags & MS_SYNC) && file && |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 20d17f8266fe..0ea758b898fd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -816,9 +816,21 @@ void __init init_cma_reserved_pageblock(struct page *page) | |||
| 816 | set_page_count(p, 0); | 816 | set_page_count(p, 0); |
| 817 | } while (++p, --i); | 817 | } while (++p, --i); |
| 818 | 818 | ||
| 819 | set_page_refcounted(page); | ||
| 820 | set_pageblock_migratetype(page, MIGRATE_CMA); | 819 | set_pageblock_migratetype(page, MIGRATE_CMA); |
| 821 | __free_pages(page, pageblock_order); | 820 | |
| 821 | if (pageblock_order >= MAX_ORDER) { | ||
| 822 | i = pageblock_nr_pages; | ||
| 823 | p = page; | ||
| 824 | do { | ||
| 825 | set_page_refcounted(p); | ||
| 826 | __free_pages(p, MAX_ORDER - 1); | ||
| 827 | p += MAX_ORDER_NR_PAGES; | ||
| 828 | } while (i -= MAX_ORDER_NR_PAGES); | ||
| 829 | } else { | ||
| 830 | set_page_refcounted(page); | ||
| 831 | __free_pages(page, pageblock_order); | ||
| 832 | } | ||
| 833 | |||
| 822 | adjust_managed_page_count(page, pageblock_nr_pages); | 834 | adjust_managed_page_count(page, pageblock_nr_pages); |
| 823 | } | 835 | } |
| 824 | #endif | 836 | #endif |
diff --git a/mm/shmem.c b/mm/shmem.c index 8f419cff9e34..1140f49b6ded 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
| @@ -1029,6 +1029,9 @@ repeat: | |||
| 1029 | goto failed; | 1029 | goto failed; |
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| 1032 | if (page && sgp == SGP_WRITE) | ||
| 1033 | mark_page_accessed(page); | ||
| 1034 | |||
| 1032 | /* fallocated page? */ | 1035 | /* fallocated page? */ |
| 1033 | if (page && !PageUptodate(page)) { | 1036 | if (page && !PageUptodate(page)) { |
| 1034 | if (sgp != SGP_READ) | 1037 | if (sgp != SGP_READ) |
| @@ -1110,6 +1113,9 @@ repeat: | |||
| 1110 | shmem_recalc_inode(inode); | 1113 | shmem_recalc_inode(inode); |
| 1111 | spin_unlock(&info->lock); | 1114 | spin_unlock(&info->lock); |
| 1112 | 1115 | ||
| 1116 | if (sgp == SGP_WRITE) | ||
| 1117 | mark_page_accessed(page); | ||
| 1118 | |||
| 1113 | delete_from_swap_cache(page); | 1119 | delete_from_swap_cache(page); |
| 1114 | set_page_dirty(page); | 1120 | set_page_dirty(page); |
| 1115 | swap_free(swap); | 1121 | swap_free(swap); |
| @@ -1136,6 +1142,9 @@ repeat: | |||
| 1136 | 1142 | ||
| 1137 | __SetPageSwapBacked(page); | 1143 | __SetPageSwapBacked(page); |
| 1138 | __set_page_locked(page); | 1144 | __set_page_locked(page); |
| 1145 | if (sgp == SGP_WRITE) | ||
| 1146 | init_page_accessed(page); | ||
| 1147 | |||
| 1139 | error = mem_cgroup_charge_file(page, current->mm, | 1148 | error = mem_cgroup_charge_file(page, current->mm, |
| 1140 | gfp & GFP_RECLAIM_MASK); | 1149 | gfp & GFP_RECLAIM_MASK); |
| 1141 | if (error) | 1150 | if (error) |
| @@ -1412,13 +1421,9 @@ shmem_write_begin(struct file *file, struct address_space *mapping, | |||
| 1412 | loff_t pos, unsigned len, unsigned flags, | 1421 | loff_t pos, unsigned len, unsigned flags, |
| 1413 | struct page **pagep, void **fsdata) | 1422 | struct page **pagep, void **fsdata) |
| 1414 | { | 1423 | { |
| 1415 | int ret; | ||
| 1416 | struct inode *inode = mapping->host; | 1424 | struct inode *inode = mapping->host; |
| 1417 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | 1425 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; |
| 1418 | ret = shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); | 1426 | return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); |
| 1419 | if (ret == 0 && *pagep) | ||
| 1420 | init_page_accessed(*pagep); | ||
| 1421 | return ret; | ||
| 1422 | } | 1427 | } |
| 1423 | 1428 | ||
| 1424 | static int | 1429 | static int |
| @@ -1881,7 +1881,7 @@ redo: | |||
| 1881 | 1881 | ||
| 1882 | new.frozen = 0; | 1882 | new.frozen = 0; |
| 1883 | 1883 | ||
| 1884 | if (!new.inuse && n->nr_partial > s->min_partial) | 1884 | if (!new.inuse && n->nr_partial >= s->min_partial) |
| 1885 | m = M_FREE; | 1885 | m = M_FREE; |
| 1886 | else if (new.freelist) { | 1886 | else if (new.freelist) { |
| 1887 | m = M_PARTIAL; | 1887 | m = M_PARTIAL; |
| @@ -1992,7 +1992,7 @@ static void unfreeze_partials(struct kmem_cache *s, | |||
| 1992 | new.freelist, new.counters, | 1992 | new.freelist, new.counters, |
| 1993 | "unfreezing slab")); | 1993 | "unfreezing slab")); |
| 1994 | 1994 | ||
| 1995 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) { | 1995 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) { |
| 1996 | page->next = discard_page; | 1996 | page->next = discard_page; |
| 1997 | discard_page = page; | 1997 | discard_page = page; |
| 1998 | } else { | 1998 | } else { |
| @@ -2620,7 +2620,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page, | |||
| 2620 | return; | 2620 | return; |
| 2621 | } | 2621 | } |
| 2622 | 2622 | ||
| 2623 | if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) | 2623 | if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) |
| 2624 | goto slab_empty; | 2624 | goto slab_empty; |
| 2625 | 2625 | ||
| 2626 | /* | 2626 | /* |
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index e9e8a4a4a9a1..8b4940ba33d6 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c | |||
| @@ -20,10 +20,20 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <sound/core.h> | 21 | #include <sound/core.h> |
| 22 | #include <drm/i915_powerwell.h> | 22 | #include <drm/i915_powerwell.h> |
| 23 | #include "hda_priv.h" | ||
| 23 | #include "hda_i915.h" | 24 | #include "hda_i915.h" |
| 24 | 25 | ||
| 26 | /* Intel HSW/BDW display HDA controller Extended Mode registers. | ||
| 27 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display | ||
| 28 | * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N | ||
| 29 | * The values will be lost when the display power well is disabled. | ||
| 30 | */ | ||
| 31 | #define ICH6_REG_EM4 0x100c | ||
| 32 | #define ICH6_REG_EM5 0x1010 | ||
| 33 | |||
| 25 | static int (*get_power)(void); | 34 | static int (*get_power)(void); |
| 26 | static int (*put_power)(void); | 35 | static int (*put_power)(void); |
| 36 | static int (*get_cdclk)(void); | ||
| 27 | 37 | ||
| 28 | int hda_display_power(bool enable) | 38 | int hda_display_power(bool enable) |
| 29 | { | 39 | { |
| @@ -38,6 +48,43 @@ int hda_display_power(bool enable) | |||
| 38 | return put_power(); | 48 | return put_power(); |
| 39 | } | 49 | } |
| 40 | 50 | ||
| 51 | void haswell_set_bclk(struct azx *chip) | ||
| 52 | { | ||
| 53 | int cdclk_freq; | ||
| 54 | unsigned int bclk_m, bclk_n; | ||
| 55 | |||
| 56 | if (!get_cdclk) | ||
| 57 | return; | ||
| 58 | |||
| 59 | cdclk_freq = get_cdclk(); | ||
| 60 | switch (cdclk_freq) { | ||
| 61 | case 337500: | ||
| 62 | bclk_m = 16; | ||
| 63 | bclk_n = 225; | ||
| 64 | break; | ||
| 65 | |||
| 66 | case 450000: | ||
| 67 | default: /* default CDCLK 450MHz */ | ||
| 68 | bclk_m = 4; | ||
| 69 | bclk_n = 75; | ||
| 70 | break; | ||
| 71 | |||
| 72 | case 540000: | ||
| 73 | bclk_m = 4; | ||
| 74 | bclk_n = 90; | ||
| 75 | break; | ||
| 76 | |||
| 77 | case 675000: | ||
| 78 | bclk_m = 8; | ||
| 79 | bclk_n = 225; | ||
| 80 | break; | ||
| 81 | } | ||
| 82 | |||
| 83 | azx_writew(chip, EM4, bclk_m); | ||
| 84 | azx_writew(chip, EM5, bclk_n); | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 41 | int hda_i915_init(void) | 88 | int hda_i915_init(void) |
| 42 | { | 89 | { |
| 43 | int err = 0; | 90 | int err = 0; |
| @@ -55,6 +102,10 @@ int hda_i915_init(void) | |||
| 55 | return -ENODEV; | 102 | return -ENODEV; |
| 56 | } | 103 | } |
| 57 | 104 | ||
| 105 | get_cdclk = symbol_request(i915_get_cdclk_freq); | ||
| 106 | if (!get_cdclk) /* may have abnormal BCLK and audio playback rate */ | ||
| 107 | pr_warn("hda-i915: get_cdclk symbol get fail\n"); | ||
| 108 | |||
| 58 | pr_debug("HDA driver get symbol successfully from i915 module\n"); | 109 | pr_debug("HDA driver get symbol successfully from i915 module\n"); |
| 59 | 110 | ||
| 60 | return err; | 111 | return err; |
| @@ -70,6 +121,10 @@ int hda_i915_exit(void) | |||
| 70 | symbol_put(i915_release_power_well); | 121 | symbol_put(i915_release_power_well); |
| 71 | put_power = NULL; | 122 | put_power = NULL; |
| 72 | } | 123 | } |
| 124 | if (get_cdclk) { | ||
| 125 | symbol_put(i915_get_cdclk_freq); | ||
| 126 | get_cdclk = NULL; | ||
| 127 | } | ||
| 73 | 128 | ||
| 74 | return 0; | 129 | return 0; |
| 75 | } | 130 | } |
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h index bfd835f8f1aa..e6072c627583 100644 --- a/sound/pci/hda/hda_i915.h +++ b/sound/pci/hda/hda_i915.h | |||
| @@ -18,10 +18,12 @@ | |||
| 18 | 18 | ||
| 19 | #ifdef CONFIG_SND_HDA_I915 | 19 | #ifdef CONFIG_SND_HDA_I915 |
| 20 | int hda_display_power(bool enable); | 20 | int hda_display_power(bool enable); |
| 21 | void haswell_set_bclk(struct azx *chip); | ||
| 21 | int hda_i915_init(void); | 22 | int hda_i915_init(void); |
| 22 | int hda_i915_exit(void); | 23 | int hda_i915_exit(void); |
| 23 | #else | 24 | #else |
| 24 | static inline int hda_display_power(bool enable) { return 0; } | 25 | static inline int hda_display_power(bool enable) { return 0; } |
| 26 | static inline void haswell_set_bclk(struct azx *chip) { return; } | ||
| 25 | static inline int hda_i915_init(void) | 27 | static inline int hda_i915_init(void) |
| 26 | { | 28 | { |
| 27 | return -ENODEV; | 29 | return -ENODEV; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 25753db97071..b6b4e71a0b0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -62,9 +62,9 @@ | |||
| 62 | #include <linux/vga_switcheroo.h> | 62 | #include <linux/vga_switcheroo.h> |
| 63 | #include <linux/firmware.h> | 63 | #include <linux/firmware.h> |
| 64 | #include "hda_codec.h" | 64 | #include "hda_codec.h" |
| 65 | #include "hda_i915.h" | ||
| 66 | #include "hda_controller.h" | 65 | #include "hda_controller.h" |
| 67 | #include "hda_priv.h" | 66 | #include "hda_priv.h" |
| 67 | #include "hda_i915.h" | ||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| @@ -288,21 +288,8 @@ static char *driver_short_names[] = { | |||
| 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | |||
| 292 | /* Intel HSW/BDW display HDA controller Extended Mode registers. | ||
| 293 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display | ||
| 294 | * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N | ||
| 295 | * The values will be lost when the display power well is disabled. | ||
| 296 | */ | ||
| 297 | #define ICH6_REG_EM4 0x100c | ||
| 298 | #define ICH6_REG_EM5 0x1010 | ||
| 299 | |||
| 300 | struct hda_intel { | 291 | struct hda_intel { |
| 301 | struct azx chip; | 292 | struct azx chip; |
| 302 | |||
| 303 | /* HSW/BDW display HDA controller to restore BCLK from CDCLK */ | ||
| 304 | unsigned int bclk_m; | ||
| 305 | unsigned int bclk_n; | ||
| 306 | }; | 293 | }; |
| 307 | 294 | ||
| 308 | 295 | ||
| @@ -598,22 +585,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) | |||
| 598 | #define azx_del_card_list(chip) /* NOP */ | 585 | #define azx_del_card_list(chip) /* NOP */ |
| 599 | #endif /* CONFIG_PM */ | 586 | #endif /* CONFIG_PM */ |
| 600 | 587 | ||
| 601 | static void haswell_save_bclk(struct azx *chip) | ||
| 602 | { | ||
| 603 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
| 604 | |||
| 605 | hda->bclk_m = azx_readw(chip, EM4); | ||
| 606 | hda->bclk_n = azx_readw(chip, EM5); | ||
| 607 | } | ||
| 608 | |||
| 609 | static void haswell_restore_bclk(struct azx *chip) | ||
| 610 | { | ||
| 611 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
| 612 | |||
| 613 | azx_writew(chip, EM4, hda->bclk_m); | ||
| 614 | azx_writew(chip, EM5, hda->bclk_n); | ||
| 615 | } | ||
| 616 | |||
| 617 | #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) | 588 | #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) |
| 618 | /* | 589 | /* |
| 619 | * power management | 590 | * power management |
| @@ -641,12 +612,6 @@ static int azx_suspend(struct device *dev) | |||
| 641 | chip->irq = -1; | 612 | chip->irq = -1; |
| 642 | } | 613 | } |
| 643 | 614 | ||
| 644 | /* Save BCLK M/N values before they become invalid in D3. | ||
| 645 | * Will test if display power well can be released now. | ||
| 646 | */ | ||
| 647 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | ||
| 648 | haswell_save_bclk(chip); | ||
| 649 | |||
| 650 | if (chip->msi) | 615 | if (chip->msi) |
| 651 | pci_disable_msi(chip->pci); | 616 | pci_disable_msi(chip->pci); |
| 652 | pci_disable_device(pci); | 617 | pci_disable_device(pci); |
| @@ -668,7 +633,7 @@ static int azx_resume(struct device *dev) | |||
| 668 | 633 | ||
| 669 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
| 670 | hda_display_power(true); | 635 | hda_display_power(true); |
| 671 | haswell_restore_bclk(chip); | 636 | haswell_set_bclk(chip); |
| 672 | } | 637 | } |
| 673 | pci_set_power_state(pci, PCI_D0); | 638 | pci_set_power_state(pci, PCI_D0); |
| 674 | pci_restore_state(pci); | 639 | pci_restore_state(pci); |
| @@ -713,10 +678,9 @@ static int azx_runtime_suspend(struct device *dev) | |||
| 713 | azx_stop_chip(chip); | 678 | azx_stop_chip(chip); |
| 714 | azx_enter_link_reset(chip); | 679 | azx_enter_link_reset(chip); |
| 715 | azx_clear_irq_pending(chip); | 680 | azx_clear_irq_pending(chip); |
| 716 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 681 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
| 717 | haswell_save_bclk(chip); | ||
| 718 | hda_display_power(false); | 682 | hda_display_power(false); |
| 719 | } | 683 | |
| 720 | return 0; | 684 | return 0; |
| 721 | } | 685 | } |
| 722 | 686 | ||
| @@ -736,7 +700,7 @@ static int azx_runtime_resume(struct device *dev) | |||
| 736 | 700 | ||
| 737 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 701 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
| 738 | hda_display_power(true); | 702 | hda_display_power(true); |
| 739 | haswell_restore_bclk(chip); | 703 | haswell_set_bclk(chip); |
| 740 | } | 704 | } |
| 741 | 705 | ||
| 742 | /* Read STATESTS before controller reset */ | 706 | /* Read STATESTS before controller reset */ |
| @@ -1426,6 +1390,10 @@ static int azx_first_init(struct azx *chip) | |||
| 1426 | 1390 | ||
| 1427 | /* initialize chip */ | 1391 | /* initialize chip */ |
| 1428 | azx_init_pci(chip); | 1392 | azx_init_pci(chip); |
| 1393 | |||
| 1394 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | ||
| 1395 | haswell_set_bclk(chip); | ||
| 1396 | |||
| 1429 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); | 1397 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); |
| 1430 | 1398 | ||
| 1431 | /* codec detection */ | 1399 | /* codec detection */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1c654effcd1a..b60824e90408 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -4880,6 +4880,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), | 4880 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
| 4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), | 4881 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), |
| 4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | 4882 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), |
| 4883 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), | ||
| 4883 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4884 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4884 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4885 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4885 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4886 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| @@ -5085,6 +5086,18 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
| 5085 | {0x1b, 0x411111f0}, | 5086 | {0x1b, 0x411111f0}, |
| 5086 | {0x1d, 0x40700001}, | 5087 | {0x1d, 0x40700001}, |
| 5087 | {0x1e, 0x411111f0}), | 5088 | {0x1e, 0x411111f0}), |
| 5089 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 5090 | {0x12, 0x40000000}, | ||
| 5091 | {0x13, 0x90a60140}, | ||
| 5092 | {0x14, 0x90170110}, | ||
| 5093 | {0x15, 0x0221401f}, | ||
| 5094 | {0x16, 0x411111f0}, | ||
| 5095 | {0x18, 0x411111f0}, | ||
| 5096 | {0x19, 0x411111f0}, | ||
| 5097 | {0x1a, 0x411111f0}, | ||
| 5098 | {0x1b, 0x411111f0}, | ||
| 5099 | {0x1d, 0x40700001}, | ||
| 5100 | {0x1e, 0x411111f0}), | ||
| 5088 | {} | 5101 | {} |
| 5089 | }; | 5102 | }; |
| 5090 | 5103 | ||
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index aa290c0de6f5..552f0810bffb 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
| @@ -193,6 +193,11 @@ int main(int argc, char **argv) | |||
| 193 | int msg, pid, err; | 193 | int msg, pid, err; |
| 194 | struct msgque_data msgque; | 194 | struct msgque_data msgque; |
| 195 | 195 | ||
| 196 | if (getuid() != 0) { | ||
| 197 | printf("Please run the test as root - Exiting.\n"); | ||
| 198 | exit(1); | ||
| 199 | } | ||
| 200 | |||
| 196 | msgque.key = ftok(argv[0], 822155650); | 201 | msgque.key = ftok(argv[0], 822155650); |
| 197 | if (msgque.key == -1) { | 202 | if (msgque.key == -1) { |
| 198 | printf("Can't make key\n"); | 203 | printf("Can't make key\n"); |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index fe1e66b6ef40..a87e99f37c52 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
| @@ -116,8 +116,8 @@ static const struct { | |||
| 116 | .header = { | 116 | .header = { |
| 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), | 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), |
| 118 | .length = cpu_to_le32(sizeof descriptors), | 118 | .length = cpu_to_le32(sizeof descriptors), |
| 119 | .fs_count = 3, | 119 | .fs_count = cpu_to_le32(3), |
| 120 | .hs_count = 3, | 120 | .hs_count = cpu_to_le32(3), |
| 121 | }, | 121 | }, |
| 122 | .fs_descs = { | 122 | .fs_descs = { |
| 123 | .intf = { | 123 | .intf = { |
