From fb6c5eb07daaf5dd0ab029da603fd70db7a37e1b Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Tue, 16 Mar 2010 02:56:48 +0000 Subject: [PATCH 01/19] =?UTF-8?q?README.Debian=20nuke=20=C2=A7=20about=20m?= =?UTF-8?q?issbehaving=20PS2=20mices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit input gets auloaded these days. svn path=/dists/trunk/linux-2.6/; revision=15392 --- debian/README.Debian | 5 ----- 1 file changed, 5 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index 03783c070..7fdc7c782 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -40,11 +40,6 @@ do so you need to set AIC7XXX_BUILD_FIRMWARE/AIC79XX_BUILD_FIRMWARE config options. Note that this requires to have the development packages for berkelydb (libdb4.2-dev) installed. -PS/2 Mice ---------- -If your PS/2 mouse does not work, make sure that the modules psmouse and -mousedev are loaded. - Non-free bits removed --------------------- See the patches under debian/patches/debian/dfsg. From c29f0664cbbeb377856113fa1fda661c26c7914c Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Tue, 16 Mar 2010 03:34:34 +0000 Subject: [PATCH 02/19] mirror removal of kvm patch from sid svn path=/dists/trunk/linux-2.6/; revision=15393 --- ...ring-privilege-instruction-emulation.patch | 256 ------------------ debian/patches/series/base | 1 - 2 files changed, 257 deletions(-) delete mode 100644 debian/patches/bugfix/x86/kvm-Check-CPL-level-during-privilege-instruction-emulation.patch diff --git a/debian/patches/bugfix/x86/kvm-Check-CPL-level-during-privilege-instruction-emulation.patch b/debian/patches/bugfix/x86/kvm-Check-CPL-level-during-privilege-instruction-emulation.patch deleted file mode 100644 index c5f31e1e7..000000000 --- a/debian/patches/bugfix/x86/kvm-Check-CPL-level-during-privilege-instruction-emulation.patch +++ /dev/null @@ -1,256 +0,0 @@ -From 0a65a79a86558a413a417baddbb11062d10e69a6 Mon Sep 17 00:00:00 2001 -From: Gleb Natapov -Date: Wed, 10 Feb 2010 05:31:12 +0000 -Subject: [PATCH 4/4] Check CPL level during privilege instruction emulation. - -Add CPL checking in case emulator is tricked into emulating -privilege instruction. - -[forward-ported by Ben Hutchings ] -Signed-off-by: Gleb Natapov ---- - arch/x86/kvm/emulate.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++ - 1 files changed, 136 insertions(+), 0 deletions(-) - -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 4a6526f..836d3bc 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -2133,6 +2133,14 @@ special_insn: - } - break; - case 0xf4: /* hlt */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } - ctxt->vcpu->arch.halt_request = 1; - break; - case 0xf5: /* cmc */ -@@ -2208,6 +2216,11 @@ twobyte_insn: - if (c->modrm_mod != 3 || c->modrm_rm != 1) - goto cannot_emulate; - -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - rc = kvm_fix_hypercall(ctxt->vcpu); - if (rc) - goto done; -@@ -2218,6 +2231,16 @@ twobyte_insn: - c->dst.type = OP_NONE; - break; - case 2: /* lgdt */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - rc = read_descriptor(ctxt, ops, c->src.ptr, - &size, &address, c->op_bytes); - if (rc) -@@ -2230,6 +2253,10 @@ twobyte_insn: - if (c->modrm_mod == 3) { - switch (c->modrm_rm) { - case 1: -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } - rc = kvm_fix_hypercall(ctxt->vcpu); - if (rc) - goto done; -@@ -2238,6 +2265,16 @@ twobyte_insn: - goto cannot_emulate; - } - } else { -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - rc = read_descriptor(ctxt, ops, c->src.ptr, - &size, &address, - c->op_bytes); -@@ -2253,11 +2290,26 @@ twobyte_insn: - c->dst.val = realmode_get_cr(ctxt->vcpu, 0); - break; - case 6: /* lmsw */ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - realmode_lmsw(ctxt->vcpu, (u16)c->src.val, - &ctxt->eflags); - c->dst.type = OP_NONE; - break; - case 7: /* invlpg*/ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - emulate_invlpg(ctxt->vcpu, memop); - /* Disable writeback. */ - c->dst.type = OP_NONE; -@@ -2273,23 +2325,67 @@ twobyte_insn: - goto writeback; - break; - case 0x06: -+ if (c->lock_prefix) { -+ if (ctxt->mode == X86EMUL_MODE_REAL || -+ !(ctxt->vcpu->arch.cr0 & X86_CR0_PE)) -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ else -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - emulate_clts(ctxt->vcpu); - c->dst.type = OP_NONE; - break; - case 0x08: /* invd */ - case 0x09: /* wbinvd */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } - case 0x0d: /* GrpP (prefetch) */ - case 0x18: /* Grp16 (prefetch/nop) */ - c->dst.type = OP_NONE; - break; - case 0x20: /* mov cr, reg */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - if (c->modrm_mod != 3) - goto cannot_emulate; -+ - c->regs[c->modrm_rm] = - realmode_get_cr(ctxt->vcpu, c->modrm_reg); - c->dst.type = OP_NONE; /* no writeback */ - break; - case 0x21: /* mov from dr to reg */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - if (c->modrm_mod != 3) - goto cannot_emulate; - rc = emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]); -@@ -2298,6 +2394,16 @@ twobyte_insn: - c->dst.type = OP_NONE; /* no writeback */ - break; - case 0x22: /* mov reg, cr */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - if (c->modrm_mod != 3) - goto cannot_emulate; - realmode_set_cr(ctxt->vcpu, -@@ -2305,6 +2411,16 @@ twobyte_insn: - c->dst.type = OP_NONE; - break; - case 0x23: /* mov from reg to dr */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - if (c->modrm_mod != 3) - goto cannot_emulate; - rc = emulator_set_dr(ctxt, c->modrm_reg, -@@ -2315,6 +2431,16 @@ twobyte_insn: - break; - case 0x30: - /* wrmsr */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - msr_data = (u32)c->regs[VCPU_REGS_RAX] - | ((u64)c->regs[VCPU_REGS_RDX] << 32); - rc = kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data); -@@ -2327,6 +2453,16 @@ twobyte_insn: - break; - case 0x32: - /* rdmsr */ -+ if (c->lock_prefix) { -+ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); -+ goto done; -+ } -+ -+ if (kvm_x86_ops->get_cpl(ctxt->vcpu)) { -+ kvm_inject_gp(ctxt->vcpu, 0); -+ goto done; -+ } -+ - rc = kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data); - if (rc) { - kvm_inject_gp(ctxt->vcpu, 0); --- -1.6.6 - diff --git a/debian/patches/series/base b/debian/patches/series/base index da97d58fb..666dc7fd2 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -53,7 +53,6 @@ + bugfix/x86/kvm-fix-memory-access-during-x86-emulation.patch + bugfix/x86/kvm-Check-IOPL-level-during-io-instruction-emulation.patch + bugfix/x86/kvm-Fix-popf-emulation.patch -+ bugfix/x86/kvm-Check-CPL-level-during-privilege-instruction-emulation.patch + debian/sysrq-mask.patch From 100388fdd03292e159a16d933e00602a2ec63b1a Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Tue, 16 Mar 2010 03:34:40 +0000 Subject: [PATCH 03/19] add stable 2.6.33.1 less work on this side ;) svn path=/dists/trunk/linux-2.6/; revision=15394 --- debian/changelog | 3 ++ ...si-qla1280-request-firmware-unlocked.patch | 35 ------------------- .../sparc/video-sunxvr500-intergraph.patch | 11 ------ debian/patches/series/base | 2 ++ 4 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 debian/patches/bugfix/all/drivers-scsi-qla1280-request-firmware-unlocked.patch delete mode 100644 debian/patches/features/sparc/video-sunxvr500-intergraph.patch diff --git a/debian/changelog b/debian/changelog index 0f8e3f12d..64e258350 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ linux-2.6 (2.6.33-1~experimental.4) UNRELEASED; urgency=low again (Closes: #572067) * [x86] Enable rtl8192su driver using external firmware + [ maximilian attems] + * Add stable 2.6.33.1. + -- Ben Hutchings Sat, 13 Mar 2010 23:06:49 +0000 linux-2.6 (2.6.33-1~experimental.3) experimental; urgency=low diff --git a/debian/patches/bugfix/all/drivers-scsi-qla1280-request-firmware-unlocked.patch b/debian/patches/bugfix/all/drivers-scsi-qla1280-request-firmware-unlocked.patch deleted file mode 100644 index 85d9bed27..000000000 --- a/debian/patches/bugfix/all/drivers-scsi-qla1280-request-firmware-unlocked.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit 480c1e36532fc2783834d9582a11fbf1d493af42 -Author: Ben Hutchings -Date: Sun Aug 16 03:42:24 2009 +0100 - - qla1280: Drop host_lock while requesting firmware - - request_firmware() may sleep and it appears to be safe to release the - spinlock here. - -diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c -index 5defe5e..97cbf12 100644 ---- a/drivers/scsi/qla1280.c -+++ b/drivers/scsi/qla1280.c -@@ -1642,8 +1642,10 @@ qla1280_load_firmware_pio(struct scsi_qla_host *ha) - uint16_t mb[MAILBOX_REGISTER_COUNT], i; - int err; - -+ spin_unlock_irq(ha->host->host_lock); - err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, - &ha->pdev->dev); -+ spin_lock_irq(ha->host->host_lock); - if (err) { - printk(KERN_ERR "Failed to load image \"%s\" err %d\n", - ql1280_board_tbl[ha->devnum].fwname, err); -@@ -1701,8 +1703,10 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha) - return -ENOMEM; - #endif - -+ spin_unlock_irq(ha->host->host_lock); - err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, - &ha->pdev->dev); -+ spin_lock_irq(ha->host->host_lock); - if (err) { - printk(KERN_ERR "Failed to load image \"%s\" err %d\n", - ql1280_board_tbl[ha->devnum].fwname, err); diff --git a/debian/patches/features/sparc/video-sunxvr500-intergraph.patch b/debian/patches/features/sparc/video-sunxvr500-intergraph.patch deleted file mode 100644 index dc03e6058..000000000 --- a/debian/patches/features/sparc/video-sunxvr500-intergraph.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -aur a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c ---- a/drivers/video/sunxvr500.c 2008-11-20 18:02:37.000000000 -0500 -+++ b/drivers/video/sunxvr500.c 2008-12-01 15:43:04.000000000 -0500 -@@ -396,6 +396,7 @@ - - static struct pci_device_id e3d_pci_table[] = { - { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), }, -+ { PCI_DEVICE(0x1091, 0x7a0), }, - { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), }, - { .vendor = PCI_VENDOR_ID_3DLABS, - .device = PCI_ANY_ID, diff --git a/debian/patches/series/base b/debian/patches/series/base index 666dc7fd2..e9c137bab 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -60,3 +60,5 @@ + features/arm/openrd-base-uart.patch #+ features/all/ath9k-add-support-for-802.11n-bonded-out-AR2427.patch + features/all/rtl8192su-always-use-request_firmware.patch + ++ bugfix/all/stable/2.6.33.1.patch From 995c0d70b07caf5a0d6fa91efa41e7277cbd6fb0 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Wed, 17 Mar 2010 16:11:40 +0000 Subject: [PATCH 04/19] port over linux-base changes of sid branch svn path=/dists/trunk/linux-2.6/; revision=15414 --- debian/linux-base.postinst | 295 +------------------ debian/templates/control.image.type-plain.in | 2 +- 2 files changed, 6 insertions(+), 291 deletions(-) diff --git a/debian/linux-base.postinst b/debian/linux-base.postinst index bd0d234e1..fcdb0938e 100644 --- a/debian/linux-base.postinst +++ b/debian/linux-base.postinst @@ -522,225 +522,12 @@ sub lilo_post { system('lilo'); } -### SILO - -sub silo_post { - system('silo'); -} - ### ELILO sub elilo_post { system('elilo'); } -### PALO - -sub palo_next { - my ($file, $expect_opt) = @_; - my $text = <$file>; - - if (!defined($text) || $text eq '') { - return (); - } - - my $arg = $text; - $arg =~ s/^\s*(?:#.*)?//s; - $arg =~ s/\s*$//; - - # I would like to use Getopt::Long but it would make it - # impossible to determine which source text to replace. - if ($expect_opt && $arg =~ /^-(?!-)[?v]*(.)(.+)?$/) { - return ($text, "-$1", $2, defined($2)); - } elsif ($expect_opt && $arg =~ /^(--[^=]+)(?:=(.*))?$/) { - return ($text, $1, $2, defined($2)); - } elsif ($arg ne '') { - return ($text, undef, $arg, 1); - } else { - return ($text, undef, undef, $expect_opt); - } -} - -sub palo_list { - my ($file) = @_; - my $optopt; - my @bdevs; - - while (1) { - my ($text, $optarg, $complete); - if (defined($optopt)) { - ($text, undef, $optarg, $complete) = palo_next($file, 0); - } else { - ($text, $optopt, $optarg, $complete) = palo_next($file, 1); - } - last unless defined($text); - - if ($complete && defined($optopt)) { - if ($optopt eq '-c' || $optopt eq '--commandline') { - # If PALO is not configured to use the generic sym-link, - # ignore it - if ($optarg !~ m|^\d+/vmlinux\b|) { - return (); - } - push @bdevs, kernel_list($optarg); - } elsif ($optopt eq '-I' || $optopt eq '--init-partitioned') { - push @bdevs, $optarg; - } - $optopt = undef; - } - - if (!defined($optopt) && defined($optarg) && $optarg eq '--') { - last; - } - } - - return @bdevs; -} - -sub palo_update { - my ($old, $new, $map) = @_; - my $optopt; - my $allow_opts = 1; - - while (1) { - my ($text, $optarg, $complete); - if (defined($optopt)) { - ($text, undef, $optarg, $complete) = palo_next($old, 0); - } else { - ($text, $optopt, $optarg, $complete) = palo_next($old, $allow_opts); - } - last unless defined($text); - - if (defined($optopt)) { - if ($optopt eq '-c' || $optopt eq '--commandline') { - $text = "# $text"; - if ($complete) { - my $new_cmdline = kernel_update($optarg, $map); - if (!defined($new_cmdline)) { - $new_cmdline = $optarg; - } - $text .= "--commandline=$new_cmdline\n"; - } - } - $optopt = undef; - } - - $new->print($text); - - if (!defined($optopt) && defined($optarg) && $optarg eq '--') { - $allow_opts = 0; - } - } -} - -sub palo_post { - system('palo'); -} - -### delo - -sub delo_next { - # Based on getconfig() in config.c - - my ($file) = @_; - my $text = <$file>; - - if (!defined($text) || $text eq '') { - return (); - } - - local $_ = $text; - s/[ \t]*(?:#.*)?\n//; - s/^[ \t]*//; - - if (/^([a-z]+)=(.*)$/) { - return ($text, $1, $2); - } else { - return ($text); - } -} - -sub delo_sections { - my ($file) = @_; - my @sections; - my $section = {}; - - while (1) { - my ($text, $name, $value) = delo_next($file); - - # If this is EOF or a new section, finish the current section - if (!defined($text) || (defined($name) && $name eq 'label')) { - $section->{is_generic} = - (exists($section->{image}) && - exists($section->{append}) && - $section->{image} =~ m|^/vmlinux(?:\.old)?$|); - push @sections, $section; - $section = {}; - } - - last unless defined($text); - - if (defined($name)) { - if ($name eq 'append') { - $value =~ s/^"([^"]*).*/$1/; - } - $section->{$name} = $value; - } - } - - return @sections; -} - -sub delo_list { - my ($file) = @_; - my ($globals, @entries) = delo_sections($file); - my @bdevs; - - if (exists($globals->{boot})) { - push @bdevs, $globals->{boot}; - } - - for my $entry (@entries) { - if ($entry->{is_generic}) { - push @bdevs, kernel_list($entry->{append}); - } - } - - return @bdevs; -} - -sub delo_update { - my ($old, $new, $map) = @_; - my ($globals, @entries) = delo_sections($old); - my $i = -1; - - $old->seek(0, 0); - - while (1) { - my ($text, $name, $value) = delo_next($old); - last unless defined($text); - - if (defined($name)) { - if ($name eq 'label') { - ++$i; # next entry - } elsif ($name eq 'boot' && $i < 0) { - my $new_value = $map->{$value} && id_to_path($map->{$value}); - if (defined($new_value)) { - $text = "# $text" . "boot=$new_value\n"; - } - } elsif ($name eq 'append' && - $i >= 0 && $entries[$i]->{is_generic}) { - my $new_cmdline = kernel_update($value, $map); - if (defined($new_cmdline)) { - $text = "# $text" . "append=\"$new_cmdline\"\n"; - } - } - } - - $new->print($text); - } -} - ### extlinux sub extlinux_old_path { @@ -804,51 +591,6 @@ sub extlinux_post { system('update-extlinux'); } -### aboot - -sub aboot_next { - my ($file) = @_; - my $text = <$file>; - - if (!defined($text) || $text eq '') { - return (); - } - - if ($text =~ /^([0-9]):([^ ]*) (.*)/) { - return ($text, $1, $2, $3); - } else { - return ($text); - } -} - -sub aboot_list { - my ($file) = @_; - my @bdevs; - while (1) { - my ($text, $preset, $kernel, $params) = aboot_next($file); - last unless defined($text); - if (defined($params) && $kernel =~ m|^\d+/vmlinux(?:\.old)?$|) { - push @bdevs, kernel_list($params); - } - } - return @bdevs; -} - -sub aboot_update { - my ($old, $new, $map) = @_; - while (1) { - my ($text, $preset, $kernel, $params) = aboot_next($old); - last unless defined($text); - if (defined($params) && $kernel =~ m|^\d+/vmlinux(?:\.old)?$|) { - my $new_params = kernel_update($params, $map); - if (defined($new_params)) { - $text = "# $text" . "$preset:$kernel $new_params\n"; - } - } - $new->print($text); - } -} - # udev persistent-cd sub udev_next { @@ -1087,37 +829,11 @@ my @config_files = ({packages => 'mount', list => \&lilo_list, update => \&lilo_update, post_update => \&lilo_post}, - {packages => 'silo', - path => '/etc/silo.conf', - list => \&lilo_list, - update => \&lilo_update, - post_update => \&silo_post}, - {packages => 'quik', - path => '/etc/quik.conf', - list => \&lilo_list, - update => \&lilo_update}, - {packages => 'yaboot', - path => '/etc/yaboot.conf', - list => \&lilo_list, - update => \&lilo_update}, {packages => 'elilo', path => '/etc/elilo.conf', list => \&lilo_list, update => \&lilo_update, post_update => \&elilo_post}, - {packages => 'palo', - path => '/etc/palo.conf', - list => \&palo_list, - update => \&palo_update, - post_update => \&palo_post}, - {packages => 'delo', - path => '/etc/delo.conf', - list => \&delo_list, - update => \&delo_update}, - {packages => 'arcboot', - path => '/etc/arcboot.conf', - list => \&delo_list, - update => \&delo_update}, {packages => 'extlinux', path => extlinux_old_path(), list => \&extlinux_old_list, @@ -1128,10 +844,6 @@ my @config_files = ({packages => 'mount', list => \&extlinux_new_list, update => \&extlinux_new_update, post_update => \&extlinux_post}, - {packages => 'aboot', - path => '/etc/aboot.conf', - list => \&aboot_list, - update => \&aboot_update}, {packages => 'udev', path => '/etc/udev/rules.d/70-persistent-cd.rules', needs_update => \&udev_cd_needs_update, @@ -1622,8 +1334,11 @@ sub compare_versions { return $AptPkg::Config::_config->system->versioning->compare(@_); } -if ($ARGV[0] eq 'reconfigure' || - compare_versions($ARGV[1], '2.6.32-8a~test') < 0) { +my $deb_arch = `dpkg --print-architecture`; +chomp $deb_arch; + +if (($deb_arch eq 'i386' || $deb_arch eq 'amd64') && + ($ARGV[0] eq 'reconfigure' || compare_versions($ARGV[1], '2.6.32-10') < 0)) { DebianKernel::DiskId::transition(); } diff --git a/debian/templates/control.image.type-plain.in b/debian/templates/control.image.type-plain.in index 852f6591f..27a5ada81 100644 --- a/debian/templates/control.image.type-plain.in +++ b/debian/templates/control.image.type-plain.in @@ -1,7 +1,7 @@ Package: linux-image-@upstreamversion@@abiname@@localversion@ Provides: linux-image, linux-image-@major@, linux-modules-@upstreamversion@@abiname@@localversion@ Pre-Depends: debconf | debconf-2.0 -Depends: module-init-tools, linux-base (>= @source_upstream@), ${shlibs:Depends} +Depends: module-init-tools, linux-base (>= ${source:Version}), ${shlibs:Depends} Recommends: firmware-linux-free (>= @source_upstream@) Suggests: linux-doc-@version@ Description: Linux @upstreamversion@ for @class@ From e2eaccaa9d70572c7160f7ca2d615aef782c42fc Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Wed, 17 Mar 2010 16:13:26 +0000 Subject: [PATCH 05/19] really add stable 2.6.33.1 svn path=/dists/trunk/linux-2.6/; revision=15415 --- .../patches/bugfix/all/stable/2.6.33.1.patch | 5513 +++++++++++++++++ 1 file changed, 5513 insertions(+) create mode 100644 debian/patches/bugfix/all/stable/2.6.33.1.patch diff --git a/debian/patches/bugfix/all/stable/2.6.33.1.patch b/debian/patches/bugfix/all/stable/2.6.33.1.patch new file mode 100644 index 000000000..88543cbda --- /dev/null +++ b/debian/patches/bugfix/all/stable/2.6.33.1.patch @@ -0,0 +1,5513 @@ +diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt +index e7848a0..e2c7487 100644 +--- a/Documentation/kernel-parameters.txt ++++ b/Documentation/kernel-parameters.txt +@@ -2703,6 +2703,13 @@ and is between 256 and 4096 characters. It is defined in the file + medium is write-protected). + Example: quirks=0419:aaf5:rl,0421:0433:rc + ++ userpte= ++ [X86] Flags controlling user PTE allocations. ++ ++ nohigh = do not allocate PTE pages in ++ HIGHMEM regardless of setting ++ of CONFIG_HIGHPTE. ++ + vdso= [X86,SH] + vdso=2: enable compat VDSO (default with COMPAT_VDSO) + vdso=1: enable VDSO (default) +diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt +index 75afa12..39c0a09 100644 +--- a/Documentation/laptops/thinkpad-acpi.txt ++++ b/Documentation/laptops/thinkpad-acpi.txt +@@ -650,6 +650,10 @@ LCD, CRT or DVI (if available). The following commands are available: + echo expand_toggle > /proc/acpi/ibm/video + echo video_switch > /proc/acpi/ibm/video + ++NOTE: Access to this feature is restricted to processes owning the ++CAP_SYS_ADMIN capability for safety reasons, as it can interact badly ++enough with some versions of X.org to crash it. ++ + Each video output device can be enabled or disabled individually. + Reading /proc/acpi/ibm/video shows the status of each device. + +diff --git a/arch/Kconfig b/arch/Kconfig +index 9d055b4..25e69f7 100644 +--- a/arch/Kconfig ++++ b/arch/Kconfig +@@ -6,8 +6,6 @@ config OPROFILE + tristate "OProfile system profiling (EXPERIMENTAL)" + depends on PROFILING + depends on HAVE_OPROFILE +- depends on TRACING_SUPPORT +- select TRACING + select RING_BUFFER + select RING_BUFFER_ALLOW_SWAP + help +diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c +index f9f4724..14531ab 100644 +--- a/arch/x86/ia32/ia32_aout.c ++++ b/arch/x86/ia32/ia32_aout.c +@@ -327,7 +327,6 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) + current->mm->free_area_cache = TASK_UNMAPPED_BASE; + current->mm->cached_hole_size = 0; + +- current->mm->mmap = NULL; + install_exec_creds(bprm); + current->flags &= ~PF_FORKNOEXEC; + +diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h +index 7c7c16c..5f61f6e 100644 +--- a/arch/x86/include/asm/io_apic.h ++++ b/arch/x86/include/asm/io_apic.h +@@ -160,6 +160,7 @@ extern int io_apic_get_redir_entries(int ioapic); + struct io_apic_irq_attr; + extern int io_apic_set_pci_routing(struct device *dev, int irq, + struct io_apic_irq_attr *irq_attr); ++void setup_IO_APIC_irq_extra(u32 gsi); + extern int (*ioapic_renumber_irq)(int ioapic, int irq); + extern void ioapic_init_mappings(void); + extern void ioapic_insert_resources(void); +diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h +index 0e8c2a0..271de94 100644 +--- a/arch/x86/include/asm/pgalloc.h ++++ b/arch/x86/include/asm/pgalloc.h +@@ -23,6 +23,11 @@ static inline void paravirt_release_pud(unsigned long pfn) {} + #endif + + /* ++ * Flags to use when allocating a user page table page. ++ */ ++extern gfp_t __userpte_alloc_gfp; ++ ++/* + * Allocate and free page tables. + */ + extern pgd_t *pgd_alloc(struct mm_struct *); +diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h +index 40be813..14cc74b 100644 +--- a/arch/x86/include/asm/uv/uv_hub.h ++++ b/arch/x86/include/asm/uv/uv_hub.h +@@ -329,7 +329,8 @@ static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset + */ + static inline unsigned long uv_global_gru_mmr_address(int pnode, unsigned long offset) + { +- return UV_GLOBAL_GRU_MMR_BASE | offset | (pnode << uv_hub_info->m_val); ++ return UV_GLOBAL_GRU_MMR_BASE | offset | ++ ((unsigned long)pnode << uv_hub_info->m_val); + } + + static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val) +diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h +index 2b49454..8f6b011 100644 +--- a/arch/x86/include/asm/vmx.h ++++ b/arch/x86/include/asm/vmx.h +@@ -251,6 +251,7 @@ enum vmcs_field { + #define EXIT_REASON_MSR_READ 31 + #define EXIT_REASON_MSR_WRITE 32 + #define EXIT_REASON_MWAIT_INSTRUCTION 36 ++#define EXIT_REASON_MONITOR_INSTRUCTION 39 + #define EXIT_REASON_PAUSE_INSTRUCTION 40 + #define EXIT_REASON_MCE_DURING_VMENTRY 41 + #define EXIT_REASON_TPR_BELOW_THRESHOLD 43 +diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c +index af1c583..0a2b21a 100644 +--- a/arch/x86/kernel/acpi/boot.c ++++ b/arch/x86/kernel/acpi/boot.c +@@ -446,6 +446,12 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) + int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) + { + *irq = gsi; ++ ++#ifdef CONFIG_X86_IO_APIC ++ if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) ++ setup_IO_APIC_irq_extra(gsi); ++#endif ++ + return 0; + } + +@@ -473,7 +479,8 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) + plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity); + } + #endif +- acpi_gsi_to_irq(plat_gsi, &irq); ++ irq = plat_gsi; ++ + return irq; + } + +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c +index 53243ca..be37059 100644 +--- a/arch/x86/kernel/apic/io_apic.c ++++ b/arch/x86/kernel/apic/io_apic.c +@@ -1539,6 +1539,56 @@ static void __init setup_IO_APIC_irqs(void) + } + + /* ++ * for the gsit that is not in first ioapic ++ * but could not use acpi_register_gsi() ++ * like some special sci in IBM x3330 ++ */ ++void setup_IO_APIC_irq_extra(u32 gsi) ++{ ++ int apic_id = 0, pin, idx, irq; ++ int node = cpu_to_node(boot_cpu_id); ++ struct irq_desc *desc; ++ struct irq_cfg *cfg; ++ ++ /* ++ * Convert 'gsi' to 'ioapic.pin'. ++ */ ++ apic_id = mp_find_ioapic(gsi); ++ if (apic_id < 0) ++ return; ++ ++ pin = mp_find_ioapic_pin(apic_id, gsi); ++ idx = find_irq_entry(apic_id, pin, mp_INT); ++ if (idx == -1) ++ return; ++ ++ irq = pin_2_irq(idx, apic_id, pin); ++#ifdef CONFIG_SPARSE_IRQ ++ desc = irq_to_desc(irq); ++ if (desc) ++ return; ++#endif ++ desc = irq_to_desc_alloc_node(irq, node); ++ if (!desc) { ++ printk(KERN_INFO "can not get irq_desc for %d\n", irq); ++ return; ++ } ++ ++ cfg = desc->chip_data; ++ add_pin_to_irq_node(cfg, node, apic_id, pin); ++ ++ if (test_bit(pin, mp_ioapic_routing[apic_id].pin_programmed)) { ++ pr_debug("Pin %d-%d already programmed\n", ++ mp_ioapics[apic_id].apicid, pin); ++ return; ++ } ++ set_bit(pin, mp_ioapic_routing[apic_id].pin_programmed); ++ ++ setup_IO_APIC_irq(apic_id, pin, irq, desc, ++ irq_trigger(idx), irq_polarity(idx)); ++} ++ ++/* + * Set up the timer pin, possibly with the 8259A-master behind. + */ + static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, +@@ -3228,12 +3278,9 @@ unsigned int create_irq_nr(unsigned int irq_want, int node) + } + spin_unlock_irqrestore(&vector_lock, flags); + +- if (irq > 0) { +- dynamic_irq_init(irq); +- /* restore it, in case dynamic_irq_init clear it */ +- if (desc_new) +- desc_new->chip_data = cfg_new; +- } ++ if (irq > 0) ++ dynamic_irq_init_keep_chip_data(irq); ++ + return irq; + } + +@@ -3256,17 +3303,12 @@ void destroy_irq(unsigned int irq) + { + unsigned long flags; + struct irq_cfg *cfg; +- struct irq_desc *desc; + +- /* store it, in case dynamic_irq_cleanup clear it */ +- desc = irq_to_desc(irq); +- cfg = desc->chip_data; +- dynamic_irq_cleanup(irq); +- /* connect back irq_cfg */ +- desc->chip_data = cfg; ++ dynamic_irq_cleanup_keep_chip_data(irq); + + free_irte(irq); + spin_lock_irqsave(&vector_lock, flags); ++ cfg = irq_to_desc(irq)->chip_data; + __clear_irq_vector(irq, cfg); + spin_unlock_irqrestore(&vector_lock, flags); + } +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c +index 704bddc..8e1aac8 100644 +--- a/arch/x86/kernel/reboot.c ++++ b/arch/x86/kernel/reboot.c +@@ -461,6 +461,14 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Macmini3,1"), + }, + }, ++ { /* Handle problems with rebooting on the iMac9,1. */ ++ .callback = set_pci_reboot, ++ .ident = "Apple iMac9,1", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"), ++ }, ++ }, + { } + }; + +diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c +index 7e8faea..c998d27 100644 +--- a/arch/x86/kvm/emulate.c ++++ b/arch/x86/kvm/emulate.c +@@ -76,6 +76,7 @@ + #define GroupDual (1<<15) /* Alternate decoding of mod == 3 */ + #define GroupMask 0xff /* Group number stored in bits 0:7 */ + /* Misc flags */ ++#define Priv (1<<27) /* instruction generates #GP if current CPL != 0 */ + #define No64 (1<<28) + /* Source 2 operand type */ + #define Src2None (0<<29) +@@ -88,6 +89,7 @@ + enum { + Group1_80, Group1_81, Group1_82, Group1_83, + Group1A, Group3_Byte, Group3, Group4, Group5, Group7, ++ Group8, Group9, + }; + + static u32 opcode_table[256] = { +@@ -210,7 +212,7 @@ static u32 opcode_table[256] = { + SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, + /* 0xF0 - 0xF7 */ + 0, 0, 0, 0, +- ImplicitOps, ImplicitOps, Group | Group3_Byte, Group | Group3, ++ ImplicitOps | Priv, ImplicitOps, Group | Group3_Byte, Group | Group3, + /* 0xF8 - 0xFF */ + ImplicitOps, 0, ImplicitOps, ImplicitOps, + ImplicitOps, ImplicitOps, Group | Group4, Group | Group5, +@@ -218,16 +220,20 @@ static u32 opcode_table[256] = { + + static u32 twobyte_table[256] = { + /* 0x00 - 0x0F */ +- 0, Group | GroupDual | Group7, 0, 0, 0, ImplicitOps, ImplicitOps, 0, +- ImplicitOps, ImplicitOps, 0, 0, 0, ImplicitOps | ModRM, 0, 0, ++ 0, Group | GroupDual | Group7, 0, 0, ++ 0, ImplicitOps, ImplicitOps | Priv, 0, ++ ImplicitOps | Priv, ImplicitOps | Priv, 0, 0, ++ 0, ImplicitOps | ModRM, 0, 0, + /* 0x10 - 0x1F */ + 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, 0, + /* 0x20 - 0x2F */ +- ModRM | ImplicitOps, ModRM, ModRM | ImplicitOps, ModRM, 0, 0, 0, 0, ++ ModRM | ImplicitOps | Priv, ModRM | Priv, ++ ModRM | ImplicitOps | Priv, ModRM | Priv, ++ 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x30 - 0x3F */ +- ImplicitOps, 0, ImplicitOps, 0, +- ImplicitOps, ImplicitOps, 0, 0, ++ ImplicitOps | Priv, 0, ImplicitOps | Priv, 0, ++ ImplicitOps, ImplicitOps | Priv, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0x40 - 0x47 */ + DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, +@@ -267,11 +273,12 @@ static u32 twobyte_table[256] = { + 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, + DstReg | SrcMem16 | ModRM | Mov, + /* 0xB8 - 0xBF */ +- 0, 0, DstMem | SrcImmByte | ModRM, DstMem | SrcReg | ModRM | BitOp, ++ 0, 0, Group | Group8, DstMem | SrcReg | ModRM | BitOp, + 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, + DstReg | SrcMem16 | ModRM | Mov, + /* 0xC0 - 0xCF */ +- 0, 0, 0, DstMem | SrcReg | ModRM | Mov, 0, 0, 0, ImplicitOps | ModRM, ++ 0, 0, 0, DstMem | SrcReg | ModRM | Mov, ++ 0, 0, 0, Group | GroupDual | Group9, + 0, 0, 0, 0, 0, 0, 0, 0, + /* 0xD0 - 0xDF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +@@ -320,16 +327,24 @@ static u32 group_table[] = { + SrcMem | ModRM | Stack, 0, + SrcMem | ModRM | Stack, 0, SrcMem | ModRM | Stack, 0, + [Group7*8] = +- 0, 0, ModRM | SrcMem, ModRM | SrcMem, ++ 0, 0, ModRM | SrcMem | Priv, ModRM | SrcMem | Priv, + SrcNone | ModRM | DstMem | Mov, 0, +- SrcMem16 | ModRM | Mov, SrcMem | ModRM | ByteOp, ++ SrcMem16 | ModRM | Mov | Priv, SrcMem | ModRM | ByteOp | Priv, ++ [Group8*8] = ++ 0, 0, 0, 0, ++ DstMem | SrcImmByte | ModRM, DstMem | SrcImmByte | ModRM, ++ DstMem | SrcImmByte | ModRM, DstMem | SrcImmByte | ModRM, ++ [Group9*8] = ++ 0, ImplicitOps | ModRM, 0, 0, 0, 0, 0, 0, + }; + + static u32 group2_table[] = { + [Group7*8] = +- SrcNone | ModRM, 0, 0, SrcNone | ModRM, ++ SrcNone | ModRM | Priv, 0, 0, SrcNone | ModRM, + SrcNone | ModRM | DstMem | Mov, 0, + SrcMem16 | ModRM | Mov, 0, ++ [Group9*8] = ++ 0, 0, 0, 0, 0, 0, 0, 0, + }; + + /* EFLAGS bit definitions. */ +@@ -1640,12 +1655,6 @@ emulate_sysexit(struct x86_emulate_ctxt *ctxt) + return -1; + } + +- /* sysexit must be called from CPL 0 */ +- if (kvm_x86_ops->get_cpl(ctxt->vcpu) != 0) { +- kvm_inject_gp(ctxt->vcpu, 0); +- return -1; +- } +- + setup_syscalls_segments(ctxt, &cs, &ss); + + if ((c->rex_prefix & 0x8) != 0x0) +@@ -1709,6 +1718,12 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) + memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs); + saved_eip = c->eip; + ++ /* Privileged instruction can be executed only in CPL=0 */ ++ if ((c->d & Priv) && kvm_x86_ops->get_cpl(ctxt->vcpu)) { ++ kvm_inject_gp(ctxt->vcpu, 0); ++ goto done; ++ } ++ + if (((c->d & ModRM) && (c->modrm_mod != 3)) || (c->d & MemAbs)) + memop = c->modrm_ea; + +@@ -1982,6 +1997,12 @@ special_insn: + int err; + + sel = c->src.val; ++ ++ if (c->modrm_reg == VCPU_SREG_CS) { ++ kvm_queue_exception(ctxt->vcpu, UD_VECTOR); ++ goto done; ++ } ++ + if (c->modrm_reg == VCPU_SREG_SS) + toggle_interruptibility(ctxt, X86_SHADOW_INT_MOV_SS); + +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c +index d4918d6..8a8e139 100644 +--- a/arch/x86/kvm/vmx.c ++++ b/arch/x86/kvm/vmx.c +@@ -1224,6 +1224,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) + CPU_BASED_USE_IO_BITMAPS | + CPU_BASED_MOV_DR_EXITING | + CPU_BASED_USE_TSC_OFFSETING | ++ CPU_BASED_MWAIT_EXITING | ++ CPU_BASED_MONITOR_EXITING | + CPU_BASED_INVLPG_EXITING; + opt = CPU_BASED_TPR_SHADOW | + CPU_BASED_USE_MSR_BITMAPS | +@@ -3416,6 +3418,12 @@ static int handle_pause(struct kvm_vcpu *vcpu) + return 1; + } + ++static int handle_invalid_op(struct kvm_vcpu *vcpu) ++{ ++ kvm_queue_exception(vcpu, UD_VECTOR); ++ return 1; ++} ++ + /* + * The exit handlers return 1 if the exit was handled fully and guest execution + * may resume. Otherwise they set the kvm_run parameter to indicate what needs +@@ -3453,6 +3461,8 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { + [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation, + [EXIT_REASON_EPT_MISCONFIG] = handle_ept_misconfig, + [EXIT_REASON_PAUSE_INSTRUCTION] = handle_pause, ++ [EXIT_REASON_MWAIT_INSTRUCTION] = handle_invalid_op, ++ [EXIT_REASON_MONITOR_INSTRUCTION] = handle_invalid_op, + }; + + static const int kvm_vmx_max_exit_handlers = +diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c +index ed34f5e..c9ba9de 100644 +--- a/arch/x86/mm/pgtable.c ++++ b/arch/x86/mm/pgtable.c +@@ -6,6 +6,14 @@ + + #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO + ++#ifdef CONFIG_HIGHPTE ++#define PGALLOC_USER_GFP __GFP_HIGHMEM ++#else ++#define PGALLOC_USER_GFP 0 ++#endif ++ ++gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP; ++ + pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) + { + return (pte_t *)__get_free_page(PGALLOC_GFP); +@@ -15,16 +23,29 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) + { + struct page *pte; + +-#ifdef CONFIG_HIGHPTE +- pte = alloc_pages(PGALLOC_GFP | __GFP_HIGHMEM, 0); +-#else +- pte = alloc_pages(PGALLOC_GFP, 0); +-#endif ++ pte = alloc_pages(__userpte_alloc_gfp, 0); + if (pte) + pgtable_page_ctor(pte); + return pte; + } + ++static int __init setup_userpte(char *arg) ++{ ++ if (!arg) ++ return -EINVAL; ++ ++ /* ++ * "userpte=nohigh" disables allocation of user pagetables in ++ * high memory. ++ */ ++ if (strcmp(arg, "nohigh") == 0) ++ __userpte_alloc_gfp &= ~__GFP_HIGHMEM; ++ else ++ return -EINVAL; ++ return 0; ++} ++early_param("userpte", setup_userpte); ++ + void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) + { + pgtable_page_dtor(pte); +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c +index 3347f69..2c505ee 100644 +--- a/arch/x86/oprofile/nmi_int.c ++++ b/arch/x86/oprofile/nmi_int.c +@@ -159,7 +159,7 @@ static int nmi_setup_mux(void) + + for_each_possible_cpu(i) { + per_cpu(cpu_msrs, i).multiplex = +- kmalloc(multiplex_size, GFP_KERNEL); ++ kzalloc(multiplex_size, GFP_KERNEL); + if (!per_cpu(cpu_msrs, i).multiplex) + return 0; + } +@@ -179,7 +179,6 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) + if (counter_config[i].enabled) { + multiplex[i].saved = -(u64)counter_config[i].count; + } else { +- multiplex[i].addr = 0; + multiplex[i].saved = 0; + } + } +@@ -189,25 +188,27 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs) + + static void nmi_cpu_save_mpx_registers(struct op_msrs *msrs) + { ++ struct op_msr *counters = msrs->counters; + struct op_msr *multiplex = msrs->multiplex; + int i; + + for (i = 0; i < model->num_counters; ++i) { + int virt = op_x86_phys_to_virt(i); +- if (multiplex[virt].addr) +- rdmsrl(multiplex[virt].addr, multiplex[virt].saved); ++ if (counters[i].addr) ++ rdmsrl(counters[i].addr, multiplex[virt].saved); + } + } + + static void nmi_cpu_restore_mpx_registers(struct op_msrs *msrs) + { ++ struct op_msr *counters = msrs->counters; + struct op_msr *multiplex = msrs->multiplex; + int i; + + for (i = 0; i < model->num_counters; ++i) { + int virt = op_x86_phys_to_virt(i); +- if (multiplex[virt].addr) +- wrmsrl(multiplex[virt].addr, multiplex[virt].saved); ++ if (counters[i].addr) ++ wrmsrl(counters[i].addr, multiplex[virt].saved); + } + } + +@@ -303,11 +304,11 @@ static int allocate_msrs(void) + + int i; + for_each_possible_cpu(i) { +- per_cpu(cpu_msrs, i).counters = kmalloc(counters_size, ++ per_cpu(cpu_msrs, i).counters = kzalloc(counters_size, + GFP_KERNEL); + if (!per_cpu(cpu_msrs, i).counters) + return 0; +- per_cpu(cpu_msrs, i).controls = kmalloc(controls_size, ++ per_cpu(cpu_msrs, i).controls = kzalloc(controls_size, + GFP_KERNEL); + if (!per_cpu(cpu_msrs, i).controls) + return 0; +diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c +index 39686c2..1ed963d 100644 +--- a/arch/x86/oprofile/op_model_amd.c ++++ b/arch/x86/oprofile/op_model_amd.c +@@ -76,19 +76,6 @@ static struct op_ibs_config ibs_config; + + #ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX + +-static void op_mux_fill_in_addresses(struct op_msrs * const msrs) +-{ +- int i; +- +- for (i = 0; i < NUM_VIRT_COUNTERS; i++) { +- int hw_counter = op_x86_virt_to_phys(i); +- if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) +- msrs->multiplex[i].addr = MSR_K7_PERFCTR0 + hw_counter; +- else +- msrs->multiplex[i].addr = 0; +- } +-} +- + static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, + struct op_msrs const * const msrs) + { +@@ -98,7 +85,7 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, + /* enable active counters */ + for (i = 0; i < NUM_COUNTERS; ++i) { + int virt = op_x86_phys_to_virt(i); +- if (!counter_config[virt].enabled) ++ if (!reset_value[virt]) + continue; + rdmsrl(msrs->controls[i].addr, val); + val &= model->reserved; +@@ -107,10 +94,6 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, + } + } + +-#else +- +-static inline void op_mux_fill_in_addresses(struct op_msrs * const msrs) { } +- + #endif + + /* functions for op_amd_spec */ +@@ -122,18 +105,12 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs) + for (i = 0; i < NUM_COUNTERS; i++) { + if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) + msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; +- else +- msrs->counters[i].addr = 0; + } + + for (i = 0; i < NUM_CONTROLS; i++) { + if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) + msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; +- else +- msrs->controls[i].addr = 0; + } +- +- op_mux_fill_in_addresses(msrs); + } + + static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, +@@ -144,7 +121,8 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, + + /* setup reset_value */ + for (i = 0; i < NUM_VIRT_COUNTERS; ++i) { +- if (counter_config[i].enabled) ++ if (counter_config[i].enabled ++ && msrs->counters[op_x86_virt_to_phys(i)].addr) + reset_value[i] = counter_config[i].count; + else + reset_value[i] = 0; +@@ -169,9 +147,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, + /* enable active counters */ + for (i = 0; i < NUM_COUNTERS; ++i) { + int virt = op_x86_phys_to_virt(i); +- if (!counter_config[virt].enabled) +- continue; +- if (!msrs->counters[i].addr) ++ if (!reset_value[virt]) + continue; + + /* setup counter registers */ +@@ -405,16 +381,6 @@ static int init_ibs_nmi(void) + return 1; + } + +-#ifdef CONFIG_NUMA +- /* Sanity check */ +- /* Works only for 64bit with proper numa implementation. */ +- if (nodes != num_possible_nodes()) { +- printk(KERN_DEBUG "Failed to setup CPU node(s) for IBS, " +- "found: %d, expected %d", +- nodes, num_possible_nodes()); +- return 1; +- } +-#endif + return 0; + } + +diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c +index ac6b354..e6a160a 100644 +--- a/arch/x86/oprofile/op_model_p4.c ++++ b/arch/x86/oprofile/op_model_p4.c +@@ -394,12 +394,6 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs) + setup_num_counters(); + stag = get_stagger(); + +- /* initialize some registers */ +- for (i = 0; i < num_counters; ++i) +- msrs->counters[i].addr = 0; +- for (i = 0; i < num_controls; ++i) +- msrs->controls[i].addr = 0; +- + /* the counter & cccr registers we pay attention to */ + for (i = 0; i < num_counters; ++i) { + addr = p4_counters[VIRT_CTR(stag, i)].counter_address; +diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c +index 8eb0587..2873c00 100644 +--- a/arch/x86/oprofile/op_model_ppro.c ++++ b/arch/x86/oprofile/op_model_ppro.c +@@ -37,15 +37,11 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs) + for (i = 0; i < num_counters; i++) { + if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) + msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; +- else +- msrs->counters[i].addr = 0; + } + + for (i = 0; i < num_counters; i++) { + if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) + msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; +- else +- msrs->controls[i].addr = 0; + } + } + +@@ -57,7 +53,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model, + int i; + + if (!reset_value) { +- reset_value = kmalloc(sizeof(reset_value[0]) * num_counters, ++ reset_value = kzalloc(sizeof(reset_value[0]) * num_counters, + GFP_ATOMIC); + if (!reset_value) + return; +diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c +index b19d1e5..8f3f9a5 100644 +--- a/arch/x86/pci/mmconfig-shared.c ++++ b/arch/x86/pci/mmconfig-shared.c +@@ -303,22 +303,17 @@ static void __init pci_mmcfg_check_end_bus_number(void) + { + struct pci_mmcfg_region *cfg, *cfgx; + +- /* last one*/ +- cfg = list_entry(pci_mmcfg_list.prev, typeof(*cfg), list); +- if (cfg) +- if (cfg->end_bus < cfg->start_bus) +- cfg->end_bus = 255; +- +- if (list_is_singular(&pci_mmcfg_list)) +- return; +- +- /* don't overlap please */ ++ /* Fixup overlaps */ + list_for_each_entry(cfg, &pci_mmcfg_list, list) { + if (cfg->end_bus < cfg->start_bus) + cfg->end_bus = 255; + ++ /* Don't access the list head ! */ ++ if (cfg->list.next == &pci_mmcfg_list) ++ break; ++ + cfgx = list_entry(cfg->list.next, typeof(*cfg), list); +- if (cfg != cfgx && cfg->end_bus >= cfgx->start_bus) ++ if (cfg->end_bus >= cfgx->start_bus) + cfg->end_bus = cfgx->start_bus - 1; + } + } +diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c +index 36daccb..b607239 100644 +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1094,6 +1095,12 @@ asmlinkage void __init xen_start_kernel(void) + + __supported_pte_mask |= _PAGE_IOMAP; + ++ /* ++ * Prevent page tables from being allocated in highmem, even ++ * if CONFIG_HIGHPTE is enabled. ++ */ ++ __userpte_alloc_gfp &= ~__GFP_HIGHMEM; ++ + /* Work out if we support NX */ + x86_configure_nx(); + +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c +index bf4cd6b..350a3de 100644 +--- a/arch/x86/xen/mmu.c ++++ b/arch/x86/xen/mmu.c +@@ -1432,14 +1432,15 @@ static void *xen_kmap_atomic_pte(struct page *page, enum km_type type) + { + pgprot_t prot = PAGE_KERNEL; + ++ /* ++ * We disable highmem allocations for page tables so we should never ++ * see any calls to kmap_atomic_pte on a highmem page. ++ */ ++ BUG_ON(PageHighMem(page)); ++ + if (PagePinned(page)) + prot = PAGE_KERNEL_RO; + +- if (0 && PageHighMem(page)) +- printk("mapping highpte %lx type %d prot %s\n", +- page_to_pfn(page), type, +- (unsigned long)pgprot_val(prot) & _PAGE_RW ? "WRITE" : "READ"); +- + return kmap_atomic_prot(page, type, prot); + } + #endif +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c +index b343903..a6a736a 100644 +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -3082,8 +3082,16 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + ahci_save_initial_config(pdev, hpriv); + + /* prepare host */ +- if (hpriv->cap & HOST_CAP_NCQ) +- pi.flags |= ATA_FLAG_NCQ | ATA_FLAG_FPDMA_AA; ++ if (hpriv->cap & HOST_CAP_NCQ) { ++ pi.flags |= ATA_FLAG_NCQ; ++ /* Auto-activate optimization is supposed to be supported on ++ all AHCI controllers indicating NCQ support, but it seems ++ to be broken at least on some NVIDIA MCP79 chipsets. ++ Until we get info on which NVIDIA chipsets don't have this ++ issue, if any, disable AA on all NVIDIA AHCIs. */ ++ if (pdev->vendor != PCI_VENDOR_ID_NVIDIA) ++ pi.flags |= ATA_FLAG_FPDMA_AA; ++ } + + if (hpriv->cap & HOST_CAP_PMP) + pi.flags |= ATA_FLAG_PMP; +diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c +index dd26bc7..269b5db 100644 +--- a/drivers/ata/pata_hpt3x2n.c ++++ b/drivers/ata/pata_hpt3x2n.c +@@ -25,7 +25,7 @@ + #include + + #define DRV_NAME "pata_hpt3x2n" +-#define DRV_VERSION "0.3.8" ++#define DRV_VERSION "0.3.9" + + enum { + HPT_PCI_FAST = (1 << 31), +@@ -544,16 +544,16 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) + pci_mhz); + /* Set our private data up. We only need a few flags so we use + it directly */ +- if (pci_mhz > 60) { ++ if (pci_mhz > 60) + hpriv = (void *)(PCI66 | USE_DPLL); +- /* +- * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in +- * the MISC. register to stretch the UltraDMA Tss timing. +- * NOTE: This register is only writeable via I/O space. +- */ +- if (dev->device == PCI_DEVICE_ID_TTI_HPT371) +- outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); +- } ++ ++ /* ++ * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in ++ * the MISC. register to stretch the UltraDMA Tss timing. ++ * NOTE: This register is only writeable via I/O space. ++ */ ++ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) ++ outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); + + /* Now kick off ATA set up */ + return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv); +diff --git a/drivers/base/core.c b/drivers/base/core.c +index 2820257..fb4bc4f 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -607,6 +607,7 @@ static struct kobject *get_device_parent(struct device *dev, + int retval; + + if (dev->class) { ++ static DEFINE_MUTEX(gdp_mutex); + struct kobject *kobj = NULL; + struct kobject *parent_kobj; + struct kobject *k; +@@ -623,6 +624,8 @@ static struct kobject *get_device_parent(struct device *dev, + else + parent_kobj = &parent->kobj; + ++ mutex_lock(&gdp_mutex); ++ + /* find our class-directory at the parent and reference it */ + spin_lock(&dev->class->p->class_dirs.list_lock); + list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) +@@ -631,20 +634,26 @@ static struct kobject *get_device_parent(struct device *dev, + break; + } + spin_unlock(&dev->class->p->class_dirs.list_lock); +- if (kobj) ++ if (kobj) { ++ mutex_unlock(&gdp_mutex); + return kobj; ++ } + + /* or create a new class-directory at the parent device */ + k = kobject_create(); +- if (!k) ++ if (!k) { ++ mutex_unlock(&gdp_mutex); + return NULL; ++ } + k->kset = &dev->class->p->class_dirs; + retval = kobject_add(k, parent_kobj, "%s", dev->class->name); + if (retval < 0) { ++ mutex_unlock(&gdp_mutex); + kobject_put(k); + return NULL; + } + /* do not emit an uevent for this simple "glue" directory */ ++ mutex_unlock(&gdp_mutex); + return k; + } + +diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c +index 42ae452..dac478c 100644 +--- a/drivers/base/devtmpfs.c ++++ b/drivers/base/devtmpfs.c +@@ -301,6 +301,19 @@ int devtmpfs_delete_node(struct device *dev) + if (dentry->d_inode) { + err = vfs_getattr(nd.path.mnt, dentry, &stat); + if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { ++ struct iattr newattrs; ++ /* ++ * before unlinking this node, reset permissions ++ * of possible references like hardlinks ++ */ ++ newattrs.ia_uid = 0; ++ newattrs.ia_gid = 0; ++ newattrs.ia_mode = stat.mode & ~0777; ++ newattrs.ia_valid = ++ ATTR_UID|ATTR_GID|ATTR_MODE; ++ mutex_lock(&dentry->d_inode->i_mutex); ++ notify_change(dentry, &newattrs); ++ mutex_unlock(&dentry->d_inode->i_mutex); + err = vfs_unlink(nd.path.dentry->d_inode, + dentry); + if (!err || err == -ENOENT) +diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c +index 3f653f7..500e740 100644 +--- a/drivers/char/tty_ldisc.c ++++ b/drivers/char/tty_ldisc.c +@@ -706,12 +706,13 @@ static void tty_reset_termios(struct tty_struct *tty) + /** + * tty_ldisc_reinit - reinitialise the tty ldisc + * @tty: tty to reinit ++ * @ldisc: line discipline to reinitialize + * +- * Switch the tty back to N_TTY line discipline and leave the +- * ldisc state closed ++ * Switch the tty to a line discipline and leave the ldisc ++ * state closed + */ + +-static void tty_ldisc_reinit(struct tty_struct *tty) ++static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) + { + struct tty_ldisc *ld; + +@@ -721,10 +722,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty) + /* + * Switch the line discipline back + */ +- ld = tty_ldisc_get(N_TTY); ++ ld = tty_ldisc_get(ldisc); + BUG_ON(IS_ERR(ld)); + tty_ldisc_assign(tty, ld); +- tty_set_termios_ldisc(tty, N_TTY); ++ tty_set_termios_ldisc(tty, ldisc); + } + + /** +@@ -745,6 +746,8 @@ static void tty_ldisc_reinit(struct tty_struct *tty) + void tty_ldisc_hangup(struct tty_struct *tty) + { + struct tty_ldisc *ld; ++ int reset = tty->driver->flags & TTY_DRIVER_RESET_TERMIOS; ++ int err = 0; + + /* + * FIXME! What are the locking issues here? This may me overdoing +@@ -772,25 +775,32 @@ void tty_ldisc_hangup(struct tty_struct *tty) + wake_up_interruptible_poll(&tty->read_wait, POLLIN); + /* + * Shutdown the current line discipline, and reset it to +- * N_TTY. ++ * N_TTY if need be. ++ * ++ * Avoid racing set_ldisc or tty_ldisc_release + */ +- if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { +- /* Avoid racing set_ldisc or tty_ldisc_release */ +- mutex_lock(&tty->ldisc_mutex); +- tty_ldisc_halt(tty); +- if (tty->ldisc) { /* Not yet closed */ +- /* Switch back to N_TTY */ +- tty_ldisc_reinit(tty); +- /* At this point we have a closed ldisc and we want to +- reopen it. We could defer this to the next open but +- it means auditing a lot of other paths so this is +- a FIXME */ ++ mutex_lock(&tty->ldisc_mutex); ++ tty_ldisc_halt(tty); ++ /* At this point we have a closed ldisc and we want to ++ reopen it. We could defer this to the next open but ++ it means auditing a lot of other paths so this is ++ a FIXME */ ++ if (tty->ldisc) { /* Not yet closed */ ++ if (reset == 0) { ++ tty_ldisc_reinit(tty, tty->termios->c_line); ++ err = tty_ldisc_open(tty, tty->ldisc); ++ } ++ /* If the re-open fails or we reset then go to N_TTY. The ++ N_TTY open cannot fail */ ++ if (reset || err) { ++ tty_ldisc_reinit(tty, N_TTY); + WARN_ON(tty_ldisc_open(tty, tty->ldisc)); +- tty_ldisc_enable(tty); + } +- mutex_unlock(&tty->ldisc_mutex); +- tty_reset_termios(tty); ++ tty_ldisc_enable(tty); + } ++ mutex_unlock(&tty->ldisc_mutex); ++ if (reset) ++ tty_reset_termios(tty); + } + + /** +diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c +index 6b3e0c2..6fe4f77 100644 +--- a/drivers/clocksource/sh_cmt.c ++++ b/drivers/clocksource/sh_cmt.c +@@ -603,18 +603,13 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) + p->irqaction.handler = sh_cmt_interrupt; + p->irqaction.dev_id = p; + p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; +- ret = setup_irq(irq, &p->irqaction); +- if (ret) { +- pr_err("sh_cmt: failed to request irq %d\n", irq); +- goto err1; +- } + + /* get hold of clock */ + p->clk = clk_get(&p->pdev->dev, cfg->clk); + if (IS_ERR(p->clk)) { + pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk); + ret = PTR_ERR(p->clk); +- goto err2; ++ goto err1; + } + + if (resource_size(res) == 6) { +@@ -627,14 +622,25 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) + p->clear_bits = ~0xc000; + } + +- return sh_cmt_register(p, cfg->name, +- cfg->clockevent_rating, +- cfg->clocksource_rating); +- err2: +- remove_irq(irq, &p->irqaction); +- err1: ++ ret = sh_cmt_register(p, cfg->name, ++ cfg->clockevent_rating, ++ cfg->clocksource_rating); ++ if (ret) { ++ pr_err("sh_cmt: registration failed\n"); ++ goto err1; ++ } ++ ++ ret = setup_irq(irq, &p->irqaction); ++ if (ret) { ++ pr_err("sh_cmt: failed to request irq %d\n", irq); ++ goto err1; ++ } ++ ++ return 0; ++ ++err1: + iounmap(p->mapbase); +- err0: ++err0: + return ret; + } + +diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c +index 973e714..4c8a759 100644 +--- a/drivers/clocksource/sh_mtu2.c ++++ b/drivers/clocksource/sh_mtu2.c +@@ -221,15 +221,15 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, + ced->cpumask = cpumask_of(0); + ced->set_mode = sh_mtu2_clock_event_mode; + ++ pr_info("sh_mtu2: %s used for clock events\n", ced->name); ++ clockevents_register_device(ced); ++ + ret = setup_irq(p->irqaction.irq, &p->irqaction); + if (ret) { + pr_err("sh_mtu2: failed to request irq %d\n", + p->irqaction.irq); + return; + } +- +- pr_info("sh_mtu2: %s used for clock events\n", ced->name); +- clockevents_register_device(ced); + } + + static int sh_mtu2_register(struct sh_mtu2_priv *p, char *name, +diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c +index 93c2322..961f5b5 100644 +--- a/drivers/clocksource/sh_tmu.c ++++ b/drivers/clocksource/sh_tmu.c +@@ -323,15 +323,15 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, + ced->set_next_event = sh_tmu_clock_event_next; + ced->set_mode = sh_tmu_clock_event_mode; + ++ pr_info("sh_tmu: %s used for clock events\n", ced->name); ++ clockevents_register_device(ced); ++ + ret = setup_irq(p->irqaction.irq, &p->irqaction); + if (ret) { + pr_err("sh_tmu: failed to request irq %d\n", + p->irqaction.irq); + return; + } +- +- pr_info("sh_tmu: %s used for clock events\n", ced->name); +- clockevents_register_device(ced); + } + + static int sh_tmu_register(struct sh_tmu_priv *p, char *name, +diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c +index 0fdbe94..0c3c498 100644 +--- a/drivers/gpio/cs5535-gpio.c ++++ b/drivers/gpio/cs5535-gpio.c +@@ -154,7 +154,7 @@ static int chip_gpio_request(struct gpio_chip *c, unsigned offset) + + static int chip_gpio_get(struct gpio_chip *chip, unsigned offset) + { +- return cs5535_gpio_isset(offset, GPIO_OUTPUT_VAL); ++ return cs5535_gpio_isset(offset, GPIO_READ_BACK); + } + + static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val) +@@ -172,6 +172,7 @@ static int chip_direction_input(struct gpio_chip *c, unsigned offset) + + spin_lock_irqsave(&chip->lock, flags); + __cs5535_gpio_set(chip, offset, GPIO_INPUT_ENABLE); ++ __cs5535_gpio_clear(chip, offset, GPIO_OUTPUT_ENABLE); + spin_unlock_irqrestore(&chip->lock, flags); + + return 0; +@@ -184,6 +185,7 @@ static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) + + spin_lock_irqsave(&chip->lock, flags); + ++ __cs5535_gpio_set(chip, offset, GPIO_INPUT_ENABLE); + __cs5535_gpio_set(chip, offset, GPIO_OUTPUT_ENABLE); + if (val) + __cs5535_gpio_set(chip, offset, GPIO_OUTPUT_VAL); +diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c +index b4468b6..c5a00f7 100644 +--- a/drivers/gpio/wm831x-gpio.c ++++ b/drivers/gpio/wm831x-gpio.c +@@ -60,23 +60,31 @@ static int wm831x_gpio_get(struct gpio_chip *chip, unsigned offset) + return 0; + } + +-static int wm831x_gpio_direction_out(struct gpio_chip *chip, +- unsigned offset, int value) ++static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) + { + struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); + struct wm831x *wm831x = wm831x_gpio->wm831x; + +- return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset, +- WM831X_GPN_DIR | WM831X_GPN_TRI, 0); ++ wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset, ++ value << offset); + } + +-static void wm831x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ++static int wm831x_gpio_direction_out(struct gpio_chip *chip, ++ unsigned offset, int value) + { + struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); + struct wm831x *wm831x = wm831x_gpio->wm831x; ++ int ret; + +- wm831x_set_bits(wm831x, WM831X_GPIO_LEVEL, 1 << offset, +- value << offset); ++ ret = wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + offset, ++ WM831X_GPN_DIR | WM831X_GPN_TRI, 0); ++ if (ret < 0) ++ return ret; ++ ++ /* Can only set GPIO state once it's in output mode */ ++ wm831x_gpio_set(chip, offset, value); ++ ++ return 0; + } + + static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) +diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c +index c2e8a45..93031a7 100644 +--- a/drivers/gpu/drm/i915/intel_lvds.c ++++ b/drivers/gpu/drm/i915/intel_lvds.c +@@ -655,8 +655,15 @@ static const struct dmi_system_id bad_lid_status[] = { + */ + static enum drm_connector_status intel_lvds_detect(struct drm_connector *connector) + { ++ struct drm_device *dev = connector->dev; + enum drm_connector_status status = connector_status_connected; + ++ /* ACPI lid methods were generally unreliable in this generation, so ++ * don't even bother. ++ */ ++ if (IS_I8XX(dev)) ++ return connector_status_connected; ++ + if (!dmi_check_system(bad_lid_status) && !acpi_lid_open()) + status = connector_status_disconnected; + +diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c +index 82678d3..48daee5 100644 +--- a/drivers/gpu/drm/i915/intel_sdvo.c ++++ b/drivers/gpu/drm/i915/intel_sdvo.c +@@ -35,6 +35,7 @@ + #include "i915_drm.h" + #include "i915_drv.h" + #include "intel_sdvo_regs.h" ++#include + + static char *tv_format_names[] = { + "NTSC_M" , "NTSC_J" , "NTSC_443", +@@ -2283,6 +2284,25 @@ intel_sdvo_get_slave_addr(struct drm_device *dev, int output_device) + return 0x72; + } + ++static int intel_sdvo_bad_tv_callback(const struct dmi_system_id *id) ++{ ++ DRM_DEBUG_KMS("Ignoring bad SDVO TV connector for %s\n", id->ident); ++ return 1; ++} ++ ++static struct dmi_system_id intel_sdvo_bad_tv[] = { ++ { ++ .callback = intel_sdvo_bad_tv_callback, ++ .ident = "IntelG45/ICH10R/DME1737", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "IBM CORPORATION"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "4800784"), ++ }, ++ }, ++ ++ { } /* terminating entry */ ++}; ++ + static bool + intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) + { +@@ -2323,7 +2343,8 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) + (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | + (1 << INTEL_ANALOG_CLONE_BIT); + } +- } else if (flags & SDVO_OUTPUT_SVID0) { ++ } else if ((flags & SDVO_OUTPUT_SVID0) && ++ !dmi_check_system(intel_sdvo_bad_tv)) { + + sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; + encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; +diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c +index 7f152f6..d75788f 100644 +--- a/drivers/gpu/drm/radeon/atom.c ++++ b/drivers/gpu/drm/radeon/atom.c +@@ -881,8 +881,6 @@ static void atom_op_shl(atom_exec_context *ctx, int *ptr, int arg) + uint8_t attr = U8((*ptr)++), shift; + uint32_t saved, dst; + int dptr = *ptr; +- attr &= 0x38; +- attr |= atom_def_dst[attr >> 3] << 6; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = atom_get_src(ctx, attr, ptr); +@@ -897,8 +895,6 @@ static void atom_op_shr(atom_exec_context *ctx, int *ptr, int arg) + uint8_t attr = U8((*ptr)++), shift; + uint32_t saved, dst; + int dptr = *ptr; +- attr &= 0x38; +- attr |= atom_def_dst[attr >> 3] << 6; + SDEBUG(" dst: "); + dst = atom_get_dst(ctx, arg, attr, ptr, &saved, 1); + shift = atom_get_src(ctx, attr, ptr); +diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c +index 3d47a2c..a759170 100644 +--- a/drivers/gpu/drm/ttm/ttm_tt.c ++++ b/drivers/gpu/drm/ttm/ttm_tt.c +@@ -480,7 +480,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm) + void *from_virtual; + void *to_virtual; + int i; +- int ret; ++ int ret = -ENOMEM; + + if (ttm->page_flags & TTM_PAGE_FLAG_USER) { + ret = ttm_tt_set_user(ttm, ttm->tsk, ttm->start, +@@ -499,8 +499,10 @@ static int ttm_tt_swapin(struct ttm_tt *ttm) + + for (i = 0; i < ttm->num_pages; ++i) { + from_page = read_mapping_page(swap_space, i, NULL); +- if (IS_ERR(from_page)) ++ if (IS_ERR(from_page)) { ++ ret = PTR_ERR(from_page); + goto out_err; ++ } + to_page = __ttm_tt_get_page(ttm, i); + if (unlikely(to_page == NULL)) + goto out_err; +@@ -523,7 +525,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm) + return 0; + out_err: + ttm_tt_free_alloced_pages(ttm); +- return -ENOMEM; ++ return ret; + } + + int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) +@@ -535,6 +537,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) + void *from_virtual; + void *to_virtual; + int i; ++ int ret = -ENOMEM; + + BUG_ON(ttm->state != tt_unbound && ttm->state != tt_unpopulated); + BUG_ON(ttm->caching_state != tt_cached); +@@ -557,7 +560,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) + 0); + if (unlikely(IS_ERR(swap_storage))) { + printk(KERN_ERR "Failed allocating swap storage.\n"); +- return -ENOMEM; ++ return PTR_ERR(swap_storage); + } + } else + swap_storage = persistant_swap_storage; +@@ -569,9 +572,10 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) + if (unlikely(from_page == NULL)) + continue; + to_page = read_mapping_page(swap_space, i, NULL); +- if (unlikely(to_page == NULL)) ++ if (unlikely(IS_ERR(to_page))) { ++ ret = PTR_ERR(to_page); + goto out_err; +- ++ } + preempt_disable(); + from_virtual = kmap_atomic(from_page, KM_USER0); + to_virtual = kmap_atomic(to_page, KM_USER1); +@@ -595,5 +599,5 @@ out_err: + if (!persistant_swap_storage) + fput(swap_storage); + +- return -ENOMEM; ++ return ret; + } +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c +index eabe5f8..8455f3d 100644 +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -1661,8 +1661,6 @@ static const struct hid_device_id hid_ignore_list[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) }, + { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) }, +- { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) }, +- { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) }, + { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 010368e..793691f 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -402,10 +402,6 @@ + #define USB_VENDOR_ID_SUNPLUS 0x04fc + #define USB_DEVICE_ID_SUNPLUS_WDESKTOP 0x05d8 + +-#define USB_VENDOR_ID_TENX 0x1130 +-#define USB_DEVICE_ID_TENX_IBUDDY1 0x0001 +-#define USB_DEVICE_ID_TENX_IBUDDY2 0x0002 +- + #define USB_VENDOR_ID_THRUSTMASTER 0x044f + + #define USB_VENDOR_ID_TOPMAX 0x0663 +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index e2997a8..2f84237 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -316,6 +316,7 @@ static int hid_submit_out(struct hid_device *hid) + err_hid("usb_submit_urb(out) failed"); + return -1; + } ++ usbhid->last_out = jiffies; + } else { + /* + * queue work to wake up the device. +@@ -377,6 +378,7 @@ static int hid_submit_ctrl(struct hid_device *hid) + err_hid("usb_submit_urb(ctrl) failed"); + return -1; + } ++ usbhid->last_ctrl = jiffies; + } else { + /* + * queue work to wake up the device. +@@ -512,9 +514,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re + usbhid->out[usbhid->outhead].report = report; + usbhid->outhead = head; + +- if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) ++ if (!test_and_set_bit(HID_OUT_RUNNING, &usbhid->iofl)) { + if (hid_submit_out(hid)) + clear_bit(HID_OUT_RUNNING, &usbhid->iofl); ++ } else { ++ /* ++ * the queue is known to run ++ * but an earlier request may be stuck ++ * we may need to time out ++ * no race because this is called under ++ * spinlock ++ */ ++ if (time_after(jiffies, usbhid->last_out + HZ * 5)) ++ usb_unlink_urb(usbhid->urbout); ++ } + return; + } + +@@ -535,9 +548,20 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re + usbhid->ctrl[usbhid->ctrlhead].dir = dir; + usbhid->ctrlhead = head; + +- if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) ++ if (!test_and_set_bit(HID_CTRL_RUNNING, &usbhid->iofl)) { + if (hid_submit_ctrl(hid)) + clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); ++ } else { ++ /* ++ * the queue is known to run ++ * but an earlier request may be stuck ++ * we may need to time out ++ * no race because this is called under ++ * spinlock ++ */ ++ if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) ++ usb_unlink_urb(usbhid->urbctrl); ++ } + } + + void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir) +diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h +index 08f505c..ec20400 100644 +--- a/drivers/hid/usbhid/usbhid.h ++++ b/drivers/hid/usbhid/usbhid.h +@@ -80,12 +80,14 @@ struct usbhid_device { + unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */ + char *ctrlbuf; /* Control buffer */ + dma_addr_t ctrlbuf_dma; /* Control buffer dma */ ++ unsigned long last_ctrl; /* record of last output for timeouts */ + + struct urb *urbout; /* Output URB */ + struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */ + unsigned char outhead, outtail; /* Output pipe fifo head & tail */ + char *outbuf; /* Output buffer */ + dma_addr_t outbuf_dma; /* Output buffer dma */ ++ unsigned long last_out; /* record of last output for timeouts */ + + spinlock_t lock; /* fifo spinlock */ + unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ +diff --git a/drivers/hwmon/ams/ams-core.c b/drivers/hwmon/ams/ams-core.c +index 6c9ace1..2ad62c3 100644 +--- a/drivers/hwmon/ams/ams-core.c ++++ b/drivers/hwmon/ams/ams-core.c +@@ -213,7 +213,7 @@ int __init ams_init(void) + return -ENODEV; + } + +-void ams_exit(void) ++void ams_sensor_detach(void) + { + /* Remove input device */ + ams_input_exit(); +@@ -221,9 +221,6 @@ void ams_exit(void) + /* Remove attributes */ + device_remove_file(&ams_info.of_dev->dev, &dev_attr_current); + +- /* Shut down implementation */ +- ams_info.exit(); +- + /* Flush interrupt worker + * + * We do this after ams_info.exit(), because an interrupt might +@@ -239,6 +236,12 @@ void ams_exit(void) + pmf_unregister_irq_client(&ams_freefall_client); + } + ++static void __exit ams_exit(void) ++{ ++ /* Shut down implementation */ ++ ams_info.exit(); ++} ++ + MODULE_AUTHOR("Stelian Pop, Michael Hanselmann"); + MODULE_DESCRIPTION("Apple Motion Sensor driver"); + MODULE_LICENSE("GPL"); +diff --git a/drivers/hwmon/ams/ams-i2c.c b/drivers/hwmon/ams/ams-i2c.c +index 2cbf8a6..abeecd2 100644 +--- a/drivers/hwmon/ams/ams-i2c.c ++++ b/drivers/hwmon/ams/ams-i2c.c +@@ -238,6 +238,8 @@ static int ams_i2c_probe(struct i2c_client *client, + static int ams_i2c_remove(struct i2c_client *client) + { + if (ams_info.has_device) { ++ ams_sensor_detach(); ++ + /* Disable interrupts */ + ams_i2c_set_irq(AMS_IRQ_ALL, 0); + +diff --git a/drivers/hwmon/ams/ams-pmu.c b/drivers/hwmon/ams/ams-pmu.c +index fb18b3d..4f61b3e 100644 +--- a/drivers/hwmon/ams/ams-pmu.c ++++ b/drivers/hwmon/ams/ams-pmu.c +@@ -133,6 +133,8 @@ static void ams_pmu_get_xyz(s8 *x, s8 *y, s8 *z) + + static void ams_pmu_exit(void) + { ++ ams_sensor_detach(); ++ + /* Disable interrupts */ + ams_pmu_set_irq(AMS_IRQ_ALL, 0); + +diff --git a/drivers/hwmon/ams/ams.h b/drivers/hwmon/ams/ams.h +index 5ed387b..b28d7e2 100644 +--- a/drivers/hwmon/ams/ams.h ++++ b/drivers/hwmon/ams/ams.h +@@ -61,6 +61,7 @@ extern struct ams ams_info; + + extern void ams_sensors(s8 *x, s8 *y, s8 *z); + extern int ams_sensor_attach(void); ++extern void ams_sensor_detach(void); + + extern int ams_pmu_init(struct device_node *np); + extern int ams_i2c_init(struct device_node *np); +diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c +index fa07282..0627f7a 100644 +--- a/drivers/hwmon/fschmd.c ++++ b/drivers/hwmon/fschmd.c +@@ -267,7 +267,7 @@ struct fschmd_data { + struct list_head list; /* member of the watchdog_data_list */ + struct kref kref; + struct miscdevice watchdog_miscdev; +- int kind; ++ enum chips kind; + unsigned long watchdog_is_open; + char watchdog_expect_close; + char watchdog_name[10]; /* must be unique to avoid sysfs conflict */ +@@ -325,8 +325,7 @@ static ssize_t show_in_value(struct device *dev, + int index = to_sensor_dev_attr(devattr)->index; + struct fschmd_data *data = fschmd_update_device(dev); + +- /* fscher / fschrc - 1 as data->kind is an array index, not a chips */ +- if (data->kind == (fscher - 1) || data->kind >= (fschrc - 1)) ++ if (data->kind == fscher || data->kind >= fschrc) + return sprintf(buf, "%d\n", (data->volt[index] * dmi_vref * + dmi_mult[index]) / 255 + dmi_offset[index]); + else +@@ -492,7 +491,7 @@ static ssize_t show_pwm_auto_point1_pwm(struct device *dev, + int val = data->fan_min[index]; + + /* 0 = allow turning off (except on the syl), 1-255 = 50-100% */ +- if (val || data->kind == fscsyl - 1) ++ if (val || data->kind == fscsyl) + val = val / 2 + 128; + + return sprintf(buf, "%d\n", val); +@@ -506,7 +505,7 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev, + unsigned long v = simple_strtoul(buf, NULL, 10); + + /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */ +- if (v || data->kind == fscsyl - 1) { ++ if (v || data->kind == fscsyl) { + v = SENSORS_LIMIT(v, 128, 255); + v = (v - 128) * 2 + 1; + } +@@ -1037,7 +1036,7 @@ static int fschmd_detect(struct i2c_client *client, + else + return -ENODEV; + +- strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE); ++ strlcpy(info->type, fschmd_id[kind].name, I2C_NAME_SIZE); + + return 0; + } +@@ -1065,6 +1064,7 @@ static int fschmd_probe(struct i2c_client *client, + (where the client is found through a data ptr instead of the + otherway around) */ + data->client = client; ++ data->kind = kind; + + if (kind == fscpos) { + /* The Poseidon has hardwired temp limits, fill these +@@ -1085,9 +1085,6 @@ static int fschmd_probe(struct i2c_client *client, + } + } + +- /* i2c kind goes from 1-6, we want from 0-5 to address arrays */ +- data->kind = kind - 1; +- + /* Read in some never changing registers */ + data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); + data->global_control = i2c_smbus_read_byte_data(client, +diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c +index a13b30e..d14a1af 100644 +--- a/drivers/hwmon/tmp401.c ++++ b/drivers/hwmon/tmp401.c +@@ -134,7 +134,7 @@ struct tmp401_data { + struct mutex update_lock; + char valid; /* zero until following fields are valid */ + unsigned long last_updated; /* in jiffies */ +- int kind; ++ enum chips kind; + + /* register values */ + u8 status; +@@ -524,7 +524,7 @@ static int tmp401_detect(struct i2c_client *client, + if (reg > 15) + return -ENODEV; + +- strlcpy(info->type, tmp401_id[kind - 1].name, I2C_NAME_SIZE); ++ strlcpy(info->type, tmp401_id[kind].name, I2C_NAME_SIZE); + + return 0; + } +@@ -572,8 +572,7 @@ static int tmp401_probe(struct i2c_client *client, + goto exit_remove; + } + +- dev_info(&client->dev, "Detected TI %s chip\n", +- names[data->kind - 1]); ++ dev_info(&client->dev, "Detected TI %s chip\n", names[data->kind]); + + return 0; + +diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c +index 4f7c051..738c472 100644 +--- a/drivers/hwmon/tmp421.c ++++ b/drivers/hwmon/tmp421.c +@@ -61,9 +61,9 @@ static const u8 TMP421_TEMP_LSB[4] = { 0x10, 0x11, 0x12, 0x13 }; + #define TMP423_DEVICE_ID 0x23 + + static const struct i2c_device_id tmp421_id[] = { +- { "tmp421", tmp421 }, +- { "tmp422", tmp422 }, +- { "tmp423", tmp423 }, ++ { "tmp421", 2 }, ++ { "tmp422", 3 }, ++ { "tmp423", 4 }, + { } + }; + MODULE_DEVICE_TABLE(i2c, tmp421_id); +@@ -73,21 +73,23 @@ struct tmp421_data { + struct mutex update_lock; + char valid; + unsigned long last_updated; +- int kind; ++ int channels; + u8 config; + s16 temp[4]; + }; + + static int temp_from_s16(s16 reg) + { +- int temp = reg; ++ /* Mask out status bits */ ++ int temp = reg & ~0xf; + + return (temp * 1000 + 128) / 256; + } + + static int temp_from_u16(u16 reg) + { +- int temp = reg; ++ /* Mask out status bits */ ++ int temp = reg & ~0xf; + + /* Add offset for extended temperature range. */ + temp -= 64 * 256; +@@ -107,7 +109,7 @@ static struct tmp421_data *tmp421_update_device(struct device *dev) + data->config = i2c_smbus_read_byte_data(client, + TMP421_CONFIG_REG_1); + +- for (i = 0; i <= data->kind; i++) { ++ for (i = 0; i < data->channels; i++) { + data->temp[i] = i2c_smbus_read_byte_data(client, + TMP421_TEMP_MSB[i]) << 8; + data->temp[i] |= i2c_smbus_read_byte_data(client, +@@ -166,7 +168,7 @@ static mode_t tmp421_is_visible(struct kobject *kobj, struct attribute *a, + devattr = container_of(a, struct device_attribute, attr); + index = to_sensor_dev_attr(devattr)->index; + +- if (data->kind > index) ++ if (index < data->channels) + return a->mode; + + return 0; +@@ -252,9 +254,9 @@ static int tmp421_detect(struct i2c_client *client, + return -ENODEV; + } + +- strlcpy(info->type, tmp421_id[kind - 1].name, I2C_NAME_SIZE); ++ strlcpy(info->type, tmp421_id[kind].name, I2C_NAME_SIZE); + dev_info(&adapter->dev, "Detected TI %s chip at 0x%02x\n", +- names[kind - 1], client->addr); ++ names[kind], client->addr); + + return 0; + } +@@ -271,7 +273,7 @@ static int tmp421_probe(struct i2c_client *client, + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); +- data->kind = id->driver_data; ++ data->channels = id->driver_data; + + err = tmp421_init_client(client); + if (err) +diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c +index 5ff47ba..58809b0 100644 +--- a/drivers/macintosh/therm_adt746x.c ++++ b/drivers/macintosh/therm_adt746x.c +@@ -90,6 +90,8 @@ static struct task_struct *thread_therm = NULL; + + static void write_both_fan_speed(struct thermostat *th, int speed); + static void write_fan_speed(struct thermostat *th, int speed, int fan); ++static void thermostat_create_files(void); ++static void thermostat_remove_files(void); + + static int + write_reg(struct thermostat* th, int reg, u8 data) +@@ -161,6 +163,8 @@ remove_thermostat(struct i2c_client *client) + struct thermostat *th = i2c_get_clientdata(client); + int i; + ++ thermostat_remove_files(); ++ + if (thread_therm != NULL) { + kthread_stop(thread_therm); + } +@@ -449,6 +453,8 @@ static int probe_thermostat(struct i2c_client *client, + return -ENOMEM; + } + ++ thermostat_create_files(); ++ + return 0; + } + +@@ -566,7 +572,6 @@ thermostat_init(void) + struct device_node* np; + const u32 *prop; + int i = 0, offset = 0; +- int err; + + np = of_find_node_by_name(NULL, "fan"); + if (!np) +@@ -633,6 +638,17 @@ thermostat_init(void) + return -ENODEV; + } + ++#ifndef CONFIG_I2C_POWERMAC ++ request_module("i2c-powermac"); ++#endif ++ ++ return i2c_add_driver(&thermostat_driver); ++} ++ ++static void thermostat_create_files(void) ++{ ++ int err; ++ + err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); + err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); +@@ -647,16 +663,9 @@ thermostat_init(void) + if (err) + printk(KERN_WARNING + "Failed to create tempertaure attribute file(s).\n"); +- +-#ifndef CONFIG_I2C_POWERMAC +- request_module("i2c-powermac"); +-#endif +- +- return i2c_add_driver(&thermostat_driver); + } + +-static void __exit +-thermostat_exit(void) ++static void thermostat_remove_files(void) + { + if (of_dev) { + device_remove_file(&of_dev->dev, &dev_attr_sensor1_temperature); +@@ -673,9 +682,14 @@ thermostat_exit(void) + device_remove_file(&of_dev->dev, + &dev_attr_sensor2_fan_speed); + +- of_device_unregister(of_dev); + } ++} ++ ++static void __exit ++thermostat_exit(void) ++{ + i2c_del_driver(&thermostat_driver); ++ of_device_unregister(of_dev); + } + + module_init(thermostat_init); +diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c +index 1d66932..e3cf568 100644 +--- a/drivers/md/dm-ioctl.c ++++ b/drivers/md/dm-ioctl.c +@@ -897,16 +897,17 @@ static int do_resume(struct dm_ioctl *param) + set_disk_ro(dm_disk(md), 1); + } + +- if (dm_suspended_md(md)) ++ if (dm_suspended_md(md)) { + r = dm_resume(md); ++ if (!r) ++ dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr); ++ } + + if (old_map) + dm_table_destroy(old_map); + +- if (!r) { +- dm_kobject_uevent(md, KOBJ_CHANGE, param->event_nr); ++ if (!r) + r = __dev_status(md, param); +- } + + dm_put(md); + return r; +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index aa4e2aa..fa786b9 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -635,8 +635,10 @@ static void dec_pending(struct dm_io *io, int error) + if (!md->barrier_error && io_error != -EOPNOTSUPP) + md->barrier_error = io_error; + end_io_acct(io); ++ free_io(md, io); + } else { + end_io_acct(io); ++ free_io(md, io); + + if (io_error != DM_ENDIO_REQUEUE) { + trace_block_bio_complete(md->queue, bio); +@@ -644,8 +646,6 @@ static void dec_pending(struct dm_io *io, int error) + bio_endio(bio, io_error); + } + } +- +- free_io(md, io); + } + } + +diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c +index 8b8558f..b11533f 100644 +--- a/drivers/media/dvb/dvb-core/dvb_net.c ++++ b/drivers/media/dvb/dvb-core/dvb_net.c +@@ -504,6 +504,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) + "bytes left in TS. Resyncing.\n", ts_remain); + priv->ule_sndu_len = 0; + priv->need_pusi = 1; ++ ts += TS_SZ; + continue; + } + +diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c +index 9154870..0493e40 100644 +--- a/drivers/media/video/gspca/mr97310a.c ++++ b/drivers/media/video/gspca/mr97310a.c +@@ -697,6 +697,12 @@ static int start_cif_cam(struct gspca_dev *gspca_dev) + {0x13, 0x00, {0x01}, 1}, + {0, 0, {0}, 0} + }; ++ /* Without this command the cam won't work with USB-UHCI */ ++ gspca_dev->usb_buf[0] = 0x0a; ++ gspca_dev->usb_buf[1] = 0x00; ++ err_code = mr_write(gspca_dev, 2); ++ if (err_code < 0) ++ return err_code; + err_code = sensor_write_regs(gspca_dev, cif_sensor1_init_data, + ARRAY_SIZE(cif_sensor1_init_data)); + } +diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c +index f8d5c87..a4c0ef4 100644 +--- a/drivers/media/video/soc_mediabus.c ++++ b/drivers/media/video/soc_mediabus.c +@@ -134,7 +134,8 @@ EXPORT_SYMBOL(soc_mbus_bytes_per_line); + const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( + enum v4l2_mbus_pixelcode code) + { +- if ((unsigned int)(code - V4L2_MBUS_FMT_FIXED) > ARRAY_SIZE(mbus_fmt)) ++ if (code - V4L2_MBUS_FMT_FIXED > ARRAY_SIZE(mbus_fmt) || ++ code <= V4L2_MBUS_FMT_FIXED) + return NULL; + return mbus_fmt + code - V4L2_MBUS_FMT_FIXED - 1; + } +diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c +index d96e1ab..2fdf768 100644 +--- a/drivers/mmc/host/s3cmci.c ++++ b/drivers/mmc/host/s3cmci.c +@@ -1179,7 +1179,7 @@ static int s3cmci_card_present(struct mmc_host *mmc) + struct s3c24xx_mci_pdata *pdata = host->pdata; + int ret; + +- if (pdata->gpio_detect == 0) ++ if (pdata->no_detect) + return -ENOSYS; + + ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; +@@ -1360,6 +1360,8 @@ static struct mmc_host_ops s3cmci_ops = { + static struct s3c24xx_mci_pdata s3cmci_def_pdata = { + /* This is currently here to avoid a number of if (host->pdata) + * checks. Any zero fields to ensure reasonable defaults are picked. */ ++ .no_wprotect = 1, ++ .no_detect = 1, + }; + + #ifdef CONFIG_CPU_FREQ +diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c +index 4331d67..2a9f029 100644 +--- a/drivers/net/wireless/airo.c ++++ b/drivers/net/wireless/airo.c +@@ -5254,11 +5254,7 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key, + WepKeyRid wkr; + int rc; + +- if (keylen == 0) { +- airo_print_err(ai->dev->name, "%s: key length to set was zero", +- __func__); +- return -1; +- } ++ WARN_ON(keylen == 0); + + memset(&wkr, 0, sizeof(wkr)); + wkr.len = cpu_to_le16(sizeof(wkr)); +@@ -6405,11 +6401,7 @@ static int airo_set_encode(struct net_device *dev, + if (dwrq->length > MIN_KEY_SIZE) + key.len = MAX_KEY_SIZE; + else +- if (dwrq->length > 0) +- key.len = MIN_KEY_SIZE; +- else +- /* Disable the key */ +- key.len = 0; ++ key.len = MIN_KEY_SIZE; + /* Check if the key is not marked as invalid */ + if(!(dwrq->flags & IW_ENCODE_NOKEY)) { + /* Cleanup */ +@@ -6590,12 +6582,22 @@ static int airo_set_encodeext(struct net_device *dev, + default: + return -EINVAL; + } +- /* Send the key to the card */ +- rc = set_wep_key(local, idx, key.key, key.len, perm, 1); +- if (rc < 0) { +- airo_print_err(local->dev->name, "failed to set WEP key" +- " at index %d: %d.", idx, rc); +- return rc; ++ if (key.len == 0) { ++ rc = set_wep_tx_idx(local, idx, perm, 1); ++ if (rc < 0) { ++ airo_print_err(local->dev->name, ++ "failed to set WEP transmit index to %d: %d.", ++ idx, rc); ++ return rc; ++ } ++ } else { ++ rc = set_wep_key(local, idx, key.key, key.len, perm, 1); ++ if (rc < 0) { ++ airo_print_err(local->dev->name, ++ "failed to set WEP key at index %d: %d.", ++ idx, rc); ++ return rc; ++ } + } + } + +diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h +index 6a2a967..bbd2f31 100644 +--- a/drivers/net/wireless/ath/ath5k/ath5k.h ++++ b/drivers/net/wireless/ath/ath5k/ath5k.h +@@ -541,7 +541,6 @@ struct ath5k_txq_info { + /* + * Transmit packet types. + * used on tx control descriptor +- * TODO: Use them inside base.c corectly + */ + enum ath5k_pkt_type { + AR5K_PKT_TYPE_NORMAL = 0, +diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c +index e63b7c4..d6ee8ac 100644 +--- a/drivers/net/wireless/ath/ath5k/base.c ++++ b/drivers/net/wireless/ath/ath5k/base.c +@@ -1246,6 +1246,29 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf) + return 0; + } + ++static enum ath5k_pkt_type get_hw_packet_type(struct sk_buff *skb) ++{ ++ struct ieee80211_hdr *hdr; ++ enum ath5k_pkt_type htype; ++ __le16 fc; ++ ++ hdr = (struct ieee80211_hdr *)skb->data; ++ fc = hdr->frame_control; ++ ++ if (ieee80211_is_beacon(fc)) ++ htype = AR5K_PKT_TYPE_BEACON; ++ else if (ieee80211_is_probe_resp(fc)) ++ htype = AR5K_PKT_TYPE_PROBE_RESP; ++ else if (ieee80211_is_atim(fc)) ++ htype = AR5K_PKT_TYPE_ATIM; ++ else if (ieee80211_is_pspoll(fc)) ++ htype = AR5K_PKT_TYPE_PSPOLL; ++ else ++ htype = AR5K_PKT_TYPE_NORMAL; ++ ++ return htype; ++} ++ + static int + ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, + struct ath5k_txq *txq) +@@ -1300,7 +1323,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, + sc->vif, pktlen, info)); + } + ret = ah->ah_setup_tx_desc(ah, ds, pktlen, +- ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, ++ ieee80211_get_hdrlen_from_skb(skb), ++ get_hw_packet_type(skb), + (sc->power_level * 2), + hw_rate, + info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags, +diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c +index 1660ef1..06eaaa9 100644 +--- a/drivers/net/wireless/ath/ath9k/beacon.c ++++ b/drivers/net/wireless/ath/ath9k/beacon.c +@@ -525,16 +525,13 @@ static void ath_beacon_config_ap(struct ath_softc *sc, + { + u32 nexttbtt, intval; + +- /* Configure the timers only when the TSF has to be reset */ +- +- if (!(sc->sc_flags & SC_OP_TSF_RESET)) +- return; +- + /* NB: the beacon interval is kept internally in TU's */ + intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; + intval /= ATH_BCBUF; /* for staggered beacons */ + nexttbtt = intval; +- intval |= ATH9K_BEACON_RESET_TSF; ++ ++ if (sc->sc_flags & SC_OP_TSF_RESET) ++ intval |= ATH9K_BEACON_RESET_TSF; + + /* + * In AP mode we enable the beacon timers and SWBA interrupts to +diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c +index ae37144..7c64aa5 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1345,6 +1345,16 @@ static void ath9k_hw_override_ini(struct ath_hw *ah, + * Necessary to avoid issues on AR5416 2.0 + */ + REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); ++ ++ /* ++ * Disable RIFS search on some chips to avoid baseband ++ * hang issues. ++ */ ++ if (AR_SREV_9100(ah) || AR_SREV_9160(ah)) { ++ val = REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); ++ val &= ~AR_PHY_RIFS_INIT_DELAY; ++ REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); ++ } + } + + static u32 ath9k_hw_def_ini_fixup(struct ath_hw *ah, +diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c +index 643bea3..4faafbd 100644 +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -928,6 +928,7 @@ static void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf + + clear_bit(key->hw_key_idx + 64, common->keymap); + if (common->splitmic) { ++ ath9k_hw_keyreset(ah, key->hw_key_idx + 32); + clear_bit(key->hw_key_idx + 32, common->keymap); + clear_bit(key->hw_key_idx + 64 + 32, common->keymap); + } +@@ -1848,6 +1849,8 @@ bad_free_hw: + + void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) + { ++ struct ath_hw *ah = sc->sc_ah; ++ + hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | + IEEE80211_HW_SIGNAL_DBM | +@@ -1865,7 +1868,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) + BIT(NL80211_IFTYPE_ADHOC) | + BIT(NL80211_IFTYPE_MESH_POINT); + +- hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; ++ if (AR_SREV_5416(ah)) ++ hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; + + hw->queues = 4; + hw->max_rates = 4; +diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h +index 31de27d..0999a49 100644 +--- a/drivers/net/wireless/ath/ath9k/phy.h ++++ b/drivers/net/wireless/ath/ath9k/phy.h +@@ -384,6 +384,9 @@ bool ath9k_hw_set_rf_regs(struct ath_hw *ah, + + #define AR_PHY_HEAVY_CLIP_ENABLE 0x99E0 + ++#define AR_PHY_HEAVY_CLIP_FACTOR_RIFS 0x99EC ++#define AR_PHY_RIFS_INIT_DELAY 0x03ff0000 ++ + #define AR_PHY_M_SLEEP 0x99f0 + #define AR_PHY_REFCLKDLY 0x99f4 + #define AR_PHY_REFCLKPD 0x99f8 +diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c +index 70fdb9d..1d6cf7d 100644 +--- a/drivers/net/wireless/ath/ath9k/rc.c ++++ b/drivers/net/wireless/ath/ath9k/rc.c +@@ -668,7 +668,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, + struct ieee80211_tx_rate *rates = tx_info->control.rates; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + __le16 fc = hdr->frame_control; +- u8 try_per_rate, i = 0, rix, nrix; ++ u8 try_per_rate, i = 0, rix; + int is_probe = 0; + + if (rate_control_send_low(sta, priv_sta, txrc)) +@@ -688,26 +688,25 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, + + rate_table = sc->cur_rate_table; + rix = ath_rc_get_highest_rix(sc, ath_rc_priv, rate_table, &is_probe); +- nrix = rix; + + if (is_probe) { + /* set one try for probe rates. For the + * probes don't enable rts */ + ath_rc_rate_set_series(rate_table, &rates[i++], txrc, +- 1, nrix, 0); ++ 1, rix, 0); + + /* Get the next tried/allowed rate. No RTS for the next series + * after the probe rate + */ +- ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); ++ ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); + ath_rc_rate_set_series(rate_table, &rates[i++], txrc, +- try_per_rate, nrix, 0); ++ try_per_rate, rix, 0); + + tx_info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; + } else { + /* Set the choosen rate. No RTS for first series entry. */ + ath_rc_rate_set_series(rate_table, &rates[i++], txrc, +- try_per_rate, nrix, 0); ++ try_per_rate, rix, 0); + } + + /* Fill in the other rates for multirate retry */ +@@ -716,10 +715,10 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, + if (i + 1 == 4) + try_per_rate = 4; + +- ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &nrix); ++ ath_rc_get_lower_rix(rate_table, ath_rc_priv, rix, &rix); + /* All other rates in the series have RTS enabled */ + ath_rc_rate_set_series(rate_table, &rates[i], txrc, +- try_per_rate, nrix, 1); ++ try_per_rate, rix, 1); + } + + /* +diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c +index 490fb45..b59166c 100644 +--- a/drivers/net/wireless/b43/main.c ++++ b/drivers/net/wireless/b43/main.c +@@ -3970,6 +3970,7 @@ static int b43_wireless_core_start(struct b43_wldev *dev) + } + + /* We are ready to run. */ ++ ieee80211_wake_queues(dev->wl->hw); + b43_set_status(dev, B43_STAT_STARTED); + + /* Start data flow (TX/RX). */ +@@ -4379,8 +4380,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev) + + ieee80211_wake_queues(dev->wl->hw); + +- ieee80211_wake_queues(dev->wl->hw); +- + b43_set_status(dev, B43_STAT_INITIALIZED); + + out: +diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c +index 4a905b6..6d21b49 100644 +--- a/drivers/net/wireless/b43legacy/main.c ++++ b/drivers/net/wireless/b43legacy/main.c +@@ -2921,6 +2921,7 @@ static int b43legacy_wireless_core_start(struct b43legacy_wldev *dev) + goto out; + } + /* We are ready to run. */ ++ ieee80211_wake_queues(dev->wl->hw); + b43legacy_set_status(dev, B43legacy_STAT_STARTED); + + /* Start data flow (TX/RX) */ +@@ -3341,6 +3342,7 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) + b43legacy_security_init(dev); + b43legacy_rng_init(wl); + ++ ieee80211_wake_queues(dev->wl->hw); + b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); + + b43legacy_leds_init(dev); +diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c +index a72f7c2..4bf4c21 100644 +--- a/drivers/net/wireless/p54/p54pci.c ++++ b/drivers/net/wireless/p54/p54pci.c +@@ -157,6 +157,14 @@ static void p54p_refill_rx_ring(struct ieee80211_hw *dev, + skb_tail_pointer(skb), + priv->common.rx_mtu + 32, + PCI_DMA_FROMDEVICE); ++ ++ if (pci_dma_mapping_error(priv->pdev, mapping)) { ++ dev_kfree_skb_any(skb); ++ dev_err(&priv->pdev->dev, ++ "RX DMA Mapping error\n"); ++ break; ++ } ++ + desc->host_addr = cpu_to_le32(mapping); + desc->device_addr = 0; // FIXME: necessary? + desc->len = cpu_to_le16(priv->common.rx_mtu + 32); +@@ -325,14 +333,20 @@ static void p54p_tx(struct ieee80211_hw *dev, struct sk_buff *skb) + u32 device_idx, idx, i; + + spin_lock_irqsave(&priv->lock, flags); +- + device_idx = le32_to_cpu(ring_control->device_idx[1]); + idx = le32_to_cpu(ring_control->host_idx[1]); + i = idx % ARRAY_SIZE(ring_control->tx_data); + +- priv->tx_buf_data[i] = skb; + mapping = pci_map_single(priv->pdev, skb->data, skb->len, + PCI_DMA_TODEVICE); ++ if (pci_dma_mapping_error(priv->pdev, mapping)) { ++ spin_unlock_irqrestore(&priv->lock, flags); ++ p54_free_skb(dev, skb); ++ dev_err(&priv->pdev->dev, "TX DMA mapping error\n"); ++ return ; ++ } ++ priv->tx_buf_data[i] = skb; ++ + desc = &ring_control->tx_data[i]; + desc->host_addr = cpu_to_le32(mapping); + desc->device_addr = ((struct p54_hdr *)skb->data)->req_id; +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c +index 92af9b9..8742640 100644 +--- a/drivers/net/wireless/p54/p54usb.c ++++ b/drivers/net/wireless/p54/p54usb.c +@@ -60,6 +60,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { + {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ + {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ + {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ ++ {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ + {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ + {USB_DEVICE(0x0915, 0x2000)}, /* Cohiba Proto board */ + {USB_DEVICE(0x0915, 0x2002)}, /* Cohiba Proto board */ +diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c +index c1abac8..5becbde 100644 +--- a/drivers/pci/hotplug/ibmphp_ebda.c ++++ b/drivers/pci/hotplug/ibmphp_ebda.c +@@ -245,7 +245,7 @@ static void __init print_ebda_hpc (void) + + int __init ibmphp_access_ebda (void) + { +- u8 format, num_ctlrs, rio_complete, hs_complete; ++ u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz; + u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base; + int rc = 0; + +@@ -260,7 +260,16 @@ int __init ibmphp_access_ebda (void) + iounmap (io_mem); + debug ("returned ebda segment: %x\n", ebda_seg); + +- io_mem = ioremap(ebda_seg<<4, 1024); ++ io_mem = ioremap(ebda_seg<<4, 1); ++ if (!io_mem) ++ return -ENOMEM; ++ ebda_sz = readb(io_mem); ++ iounmap(io_mem); ++ debug("ebda size: %d(KiB)\n", ebda_sz); ++ if (ebda_sz == 0) ++ return -ENOMEM; ++ ++ io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024)); + if (!io_mem ) + return -ENOMEM; + next_offset = 0x180; +diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig +index f526e73..11fce79 100644 +--- a/drivers/platform/x86/Kconfig ++++ b/drivers/platform/x86/Kconfig +@@ -319,9 +319,15 @@ config THINKPAD_ACPI_VIDEO + server running, phase of the moon, and the current mood of + Schroedinger's cat. If you can use X.org's RandR to control + your ThinkPad's video output ports instead of this feature, +- don't think twice: do it and say N here to save some memory. ++ don't think twice: do it and say N here to save memory and avoid ++ bad interactions with X.org. + +- If you are not sure, say Y here. ++ NOTE: access to this feature is limited to processes with the ++ CAP_SYS_ADMIN capability, to avoid local DoS issues in platforms ++ where it interacts badly with X.org. ++ ++ If you are not sure, say Y here but do try to check if you could ++ be using X.org RandR instead. + + config THINKPAD_ACPI_HOTKEY_POLL + bool "Support NVRAM polling for hot keys" +diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c +index e2be6bb..6a47bb7 100644 +--- a/drivers/platform/x86/eeepc-laptop.c ++++ b/drivers/platform/x86/eeepc-laptop.c +@@ -1277,7 +1277,8 @@ static void eeepc_dmi_check(struct eeepc_laptop *eeepc) + * hotplug code. In fact, current hotplug code seems to unplug another + * device... + */ +- if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) { ++ if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0 || ++ strcmp(model, "1005PE") == 0) { + eeepc->hotplug_disabled = true; + pr_info("wlan hotplug disabled\n"); + } +diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c +index eb603f1..e7b0c3b 100644 +--- a/drivers/platform/x86/thinkpad_acpi.c ++++ b/drivers/platform/x86/thinkpad_acpi.c +@@ -286,6 +286,7 @@ struct ibm_init_struct { + char param[32]; + + int (*init) (struct ibm_init_struct *); ++ mode_t base_procfs_mode; + struct ibm_struct *data; + }; + +@@ -2082,6 +2083,7 @@ static struct attribute_set *hotkey_dev_attributes; + + static void tpacpi_driver_event(const unsigned int hkey_event); + static void hotkey_driver_event(const unsigned int scancode); ++static void hotkey_poll_setup(const bool may_warn); + + /* HKEY.MHKG() return bits */ + #define TP_HOTKEY_TABLET_MASK (1 << 3) +@@ -2264,6 +2266,8 @@ static int tpacpi_hotkey_driver_mask_set(const u32 mask) + + rc = hotkey_mask_set((hotkey_acpi_mask | hotkey_driver_mask) & + ~hotkey_source_mask); ++ hotkey_poll_setup(true); ++ + mutex_unlock(&hotkey_mutex); + + return rc; +@@ -2548,7 +2552,7 @@ static void hotkey_poll_stop_sync(void) + } + + /* call with hotkey_mutex held */ +-static void hotkey_poll_setup(bool may_warn) ++static void hotkey_poll_setup(const bool may_warn) + { + const u32 poll_driver_mask = hotkey_driver_mask & hotkey_source_mask; + const u32 poll_user_mask = hotkey_user_mask & hotkey_source_mask; +@@ -2579,7 +2583,7 @@ static void hotkey_poll_setup(bool may_warn) + } + } + +-static void hotkey_poll_setup_safe(bool may_warn) ++static void hotkey_poll_setup_safe(const bool may_warn) + { + mutex_lock(&hotkey_mutex); + hotkey_poll_setup(may_warn); +@@ -2597,7 +2601,11 @@ static void hotkey_poll_set_freq(unsigned int freq) + + #else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ + +-static void hotkey_poll_setup_safe(bool __unused) ++static void hotkey_poll_setup(const bool __unused) ++{ ++} ++ ++static void hotkey_poll_setup_safe(const bool __unused) + { + } + +@@ -2607,16 +2615,11 @@ static int hotkey_inputdev_open(struct input_dev *dev) + { + switch (tpacpi_lifecycle) { + case TPACPI_LIFE_INIT: +- /* +- * hotkey_init will call hotkey_poll_setup_safe +- * at the appropriate moment +- */ +- return 0; +- case TPACPI_LIFE_EXITING: +- return -EBUSY; + case TPACPI_LIFE_RUNNING: + hotkey_poll_setup_safe(false); + return 0; ++ case TPACPI_LIFE_EXITING: ++ return -EBUSY; + } + + /* Should only happen if tpacpi_lifecycle is corrupt */ +@@ -2627,7 +2630,7 @@ static int hotkey_inputdev_open(struct input_dev *dev) + static void hotkey_inputdev_close(struct input_dev *dev) + { + /* disable hotkey polling when possible */ +- if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING && ++ if (tpacpi_lifecycle != TPACPI_LIFE_EXITING && + !(hotkey_source_mask & hotkey_driver_mask)) + hotkey_poll_setup_safe(false); + } +@@ -3655,13 +3658,19 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) + break; + case 3: + /* 0x3000-0x3FFF: bay-related wakeups */ +- if (hkey == TP_HKEY_EV_BAYEJ_ACK) { ++ switch (hkey) { ++ case TP_HKEY_EV_BAYEJ_ACK: + hotkey_autosleep_ack = 1; + printk(TPACPI_INFO + "bay ejected\n"); + hotkey_wakeup_hotunplug_complete_notify_change(); + known_ev = true; +- } else { ++ break; ++ case TP_HKEY_EV_OPTDRV_EJ: ++ /* FIXME: kick libata if SATA link offline */ ++ known_ev = true; ++ break; ++ default: + known_ev = false; + } + break; +@@ -3870,7 +3879,7 @@ enum { + TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ + TP_ACPI_BLUETOOTH_RADIOSSW = 0x02, /* Bluetooth radio enabled */ + TP_ACPI_BLUETOOTH_RESUMECTRL = 0x04, /* Bluetooth state at resume: +- off / last state */ ++ 0 = disable, 1 = enable */ + }; + + enum { +@@ -3916,10 +3925,11 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state) + } + #endif + +- /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */ +- status = TP_ACPI_BLUETOOTH_RESUMECTRL; + if (state == TPACPI_RFK_RADIO_ON) +- status |= TP_ACPI_BLUETOOTH_RADIOSSW; ++ status = TP_ACPI_BLUETOOTH_RADIOSSW ++ | TP_ACPI_BLUETOOTH_RESUMECTRL; ++ else ++ status = 0; + + if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) + return -EIO; +@@ -4070,7 +4080,7 @@ enum { + TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ + TP_ACPI_WANCARD_RADIOSSW = 0x02, /* Wan radio enabled */ + TP_ACPI_WANCARD_RESUMECTRL = 0x04, /* Wan state at resume: +- off / last state */ ++ 0 = disable, 1 = enable */ + }; + + #define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw" +@@ -4107,10 +4117,11 @@ static int wan_set_status(enum tpacpi_rfkill_state state) + } + #endif + +- /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */ +- status = TP_ACPI_WANCARD_RESUMECTRL; + if (state == TPACPI_RFK_RADIO_ON) +- status |= TP_ACPI_WANCARD_RADIOSSW; ++ status = TP_ACPI_WANCARD_RADIOSSW ++ | TP_ACPI_WANCARD_RESUMECTRL; ++ else ++ status = 0; + + if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) + return -EIO; +@@ -4619,6 +4630,10 @@ static int video_read(struct seq_file *m) + return 0; + } + ++ /* Even reads can crash X.org, so... */ ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ + status = video_outputsw_get(); + if (status < 0) + return status; +@@ -4652,6 +4667,10 @@ static int video_write(char *buf) + if (video_supported == TPACPI_VIDEO_NONE) + return -ENODEV; + ++ /* Even reads can crash X.org, let alone writes... */ ++ if (!capable(CAP_SYS_ADMIN)) ++ return -EPERM; ++ + enable = 0; + disable = 0; + +@@ -6133,13 +6152,13 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = { + TPACPI_Q_IBM('1', 'Y', TPACPI_BRGHT_Q_EC), /* T43/p ATI */ + + /* Models with ATI GPUs that can use ECNVRAM */ +- TPACPI_Q_IBM('1', 'R', TPACPI_BRGHT_Q_EC), ++ TPACPI_Q_IBM('1', 'R', TPACPI_BRGHT_Q_EC), /* R50,51 T40-42 */ + TPACPI_Q_IBM('1', 'Q', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), +- TPACPI_Q_IBM('7', '6', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), ++ TPACPI_Q_IBM('7', '6', TPACPI_BRGHT_Q_EC), /* R52 */ + TPACPI_Q_IBM('7', '8', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), + + /* Models with Intel Extreme Graphics 2 */ +- TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC), ++ TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC), /* X40 */ + TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), + TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), + +@@ -6522,7 +6541,8 @@ static int volume_set_status(const u8 status) + return volume_set_status_ec(status); + } + +-static int volume_set_mute_ec(const bool mute) ++/* returns < 0 on error, 0 on no change, 1 on change */ ++static int __volume_set_mute_ec(const bool mute) + { + int rc; + u8 s, n; +@@ -6537,22 +6557,37 @@ static int volume_set_mute_ec(const bool mute) + n = (mute) ? s | TP_EC_AUDIO_MUTESW_MSK : + s & ~TP_EC_AUDIO_MUTESW_MSK; + +- if (n != s) ++ if (n != s) { + rc = volume_set_status_ec(n); ++ if (!rc) ++ rc = 1; ++ } + + unlock: + mutex_unlock(&volume_mutex); + return rc; + } + ++static int volume_alsa_set_mute(const bool mute) ++{ ++ dbg_printk(TPACPI_DBG_MIXER, "ALSA: trying to %smute\n", ++ (mute) ? "" : "un"); ++ return __volume_set_mute_ec(mute); ++} ++ + static int volume_set_mute(const bool mute) + { ++ int rc; ++ + dbg_printk(TPACPI_DBG_MIXER, "trying to %smute\n", + (mute) ? "" : "un"); +- return volume_set_mute_ec(mute); ++ ++ rc = __volume_set_mute_ec(mute); ++ return (rc < 0) ? rc : 0; + } + +-static int volume_set_volume_ec(const u8 vol) ++/* returns < 0 on error, 0 on no change, 1 on change */ ++static int __volume_set_volume_ec(const u8 vol) + { + int rc; + u8 s, n; +@@ -6569,19 +6604,22 @@ static int volume_set_volume_ec(const u8 vol) + + n = (s & ~TP_EC_AUDIO_LVL_MSK) | vol; + +- if (n != s) ++ if (n != s) { + rc = volume_set_status_ec(n); ++ if (!rc) ++ rc = 1; ++ } + + unlock: + mutex_unlock(&volume_mutex); + return rc; + } + +-static int volume_set_volume(const u8 vol) ++static int volume_alsa_set_volume(const u8 vol) + { + dbg_printk(TPACPI_DBG_MIXER, +- "trying to set volume level to %hu\n", vol); +- return volume_set_volume_ec(vol); ++ "ALSA: trying to set volume level to %hu\n", vol); ++ return __volume_set_volume_ec(vol); + } + + static void volume_alsa_notify_change(void) +@@ -6628,7 +6666,7 @@ static int volume_alsa_vol_get(struct snd_kcontrol *kcontrol, + static int volume_alsa_vol_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- return volume_set_volume(ucontrol->value.integer.value[0]); ++ return volume_alsa_set_volume(ucontrol->value.integer.value[0]); + } + + #define volume_alsa_mute_info snd_ctl_boolean_mono_info +@@ -6651,7 +6689,7 @@ static int volume_alsa_mute_get(struct snd_kcontrol *kcontrol, + static int volume_alsa_mute_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) + { +- return volume_set_mute(!ucontrol->value.integer.value[0]); ++ return volume_alsa_set_mute(!ucontrol->value.integer.value[0]); + } + + static struct snd_kcontrol_new volume_alsa_control_vol __devinitdata = { +@@ -8477,9 +8515,10 @@ static int __init ibm_init(struct ibm_init_struct *iibm) + "%s installed\n", ibm->name); + + if (ibm->read) { +- mode_t mode; ++ mode_t mode = iibm->base_procfs_mode; + +- mode = S_IRUGO; ++ if (!mode) ++ mode = S_IRUGO; + if (ibm->write) + mode |= S_IWUSR; + entry = proc_create_data(ibm->name, mode, proc_dir, +@@ -8670,6 +8709,7 @@ static struct ibm_init_struct ibms_init[] __initdata = { + #ifdef CONFIG_THINKPAD_ACPI_VIDEO + { + .init = video_init, ++ .base_procfs_mode = S_IRUSR, + .data = &video_driver_data, + }, + #endif +@@ -9032,6 +9072,9 @@ static int __init thinkpad_acpi_module_init(void) + return ret; + } + } ++ ++ tpacpi_lifecycle = TPACPI_LIFE_RUNNING; ++ + ret = input_register_device(tpacpi_inputdev); + if (ret < 0) { + printk(TPACPI_ERR "unable to register input device\n"); +@@ -9041,7 +9084,6 @@ static int __init thinkpad_acpi_module_init(void) + tp_features.input_device_registered = 1; + } + +- tpacpi_lifecycle = TPACPI_LIFE_RUNNING; + return 0; + } + +diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c +index be5a6b7..40845c7 100644 +--- a/drivers/rtc/class.c ++++ b/drivers/rtc/class.c +@@ -226,6 +226,7 @@ static void __exit rtc_exit(void) + { + rtc_dev_exit(); + class_destroy(rtc_class); ++ idr_destroy(&rtc_idr); + } + + subsys_initcall(rtc_init); +diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c +index 03ea530..44c4399 100644 +--- a/drivers/rtc/rtc-coh901331.c ++++ b/drivers/rtc/rtc-coh901331.c +@@ -271,12 +271,13 @@ static int coh901331_resume(struct platform_device *pdev) + { + struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); + +- if (device_may_wakeup(&pdev->dev)) ++ if (device_may_wakeup(&pdev->dev)) { + disable_irq_wake(rtap->irq); +- else ++ } else { + clk_enable(rtap->clk); + writel(rtap->irqmaskstore, rtap->virtbase + COH901331_IRQ_MASK); + clk_disable(rtap->clk); ++ } + return 0; + } + #else +diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c +index efabea1..cd55176 100644 +--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c ++++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c +@@ -5998,6 +5998,8 @@ _scsih_remove(struct pci_dev *pdev) + struct _sas_port *mpt2sas_port; + struct _sas_device *sas_device; + struct _sas_node *expander_sibling; ++ struct _raid_device *raid_device, *next; ++ struct MPT2SAS_TARGET *sas_target_priv_data; + struct workqueue_struct *wq; + unsigned long flags; + +@@ -6011,6 +6013,21 @@ _scsih_remove(struct pci_dev *pdev) + if (wq) + destroy_workqueue(wq); + ++ /* release all the volumes */ ++ list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list, ++ list) { ++ if (raid_device->starget) { ++ sas_target_priv_data = ++ raid_device->starget->hostdata; ++ sas_target_priv_data->deleted = 1; ++ scsi_remove_target(&raid_device->starget->dev); ++ } ++ printk(MPT2SAS_INFO_FMT "removing handle(0x%04x), wwid" ++ "(0x%016llx)\n", ioc->name, raid_device->handle, ++ (unsigned long long) raid_device->wwid); ++ _scsih_raid_device_remove(ioc, raid_device); ++ } ++ + /* free ports attached to the sas_host */ + retry_again: + list_for_each_entry(mpt2sas_port, +diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c +index 8371d91..49ac414 100644 +--- a/drivers/scsi/qla1280.c ++++ b/drivers/scsi/qla1280.c +@@ -1640,8 +1640,10 @@ qla1280_load_firmware_pio(struct scsi_qla_host *ha) + uint16_t mb[MAILBOX_REGISTER_COUNT], i; + int err; + ++ spin_unlock_irq(ha->host->host_lock); + err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, + &ha->pdev->dev); ++ spin_lock_irq(ha->host->host_lock); + if (err) { + printk(KERN_ERR "Failed to load image \"%s\" err %d\n", + ql1280_board_tbl[ha->devnum].fwname, err); +@@ -1699,8 +1701,10 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha) + return -ENOMEM; + #endif + ++ spin_unlock_irq(ha->host->host_lock); + err = request_firmware(&fw, ql1280_board_tbl[ha->devnum].fwname, + &ha->pdev->dev); ++ spin_lock_irq(ha->host->host_lock); + if (err) { + printk(KERN_ERR "Failed to load image \"%s\" err %d\n", + ql1280_board_tbl[ha->devnum].fwname, err); +diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c +index 60d665a..d00fcf8 100644 +--- a/drivers/serial/imx.c ++++ b/drivers/serial/imx.c +@@ -1279,7 +1279,7 @@ static int serial_imx_probe(struct platform_device *pdev) + sport->use_irda = 1; + #endif + +- if (pdata->init) { ++ if (pdata && pdata->init) { + ret = pdata->init(pdev); + if (ret) + goto clkput; +@@ -1292,7 +1292,7 @@ static int serial_imx_probe(struct platform_device *pdev) + + return 0; + deinit: +- if (pdata->exit) ++ if (pdata && pdata->exit) + pdata->exit(pdev); + clkput: + clk_put(sport->clk); +@@ -1321,7 +1321,7 @@ static int serial_imx_remove(struct platform_device *pdev) + + clk_disable(sport->clk); + +- if (pdata->exit) ++ if (pdata && pdata->exit) + pdata->exit(pdev); + + iounmap(sport->port.membase); +diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig +index fc2e963..ed77d88 100644 +--- a/drivers/staging/Kconfig ++++ b/drivers/staging/Kconfig +@@ -81,8 +81,6 @@ source "drivers/staging/rtl8192u/Kconfig" + + source "drivers/staging/rtl8192e/Kconfig" + +-source "drivers/staging/mimio/Kconfig" +- + source "drivers/staging/frontier/Kconfig" + + source "drivers/staging/dream/Kconfig" +diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile +index b5e67b8..6035bff 100644 +--- a/drivers/staging/Makefile ++++ b/drivers/staging/Makefile +@@ -23,7 +23,6 @@ obj-$(CONFIG_R8187SE) += rtl8187se/ + obj-$(CONFIG_RTL8192SU) += rtl8192su/ + obj-$(CONFIG_RTL8192U) += rtl8192u/ + obj-$(CONFIG_RTL8192E) += rtl8192e/ +-obj-$(CONFIG_INPUT_MIMIO) += mimio/ + obj-$(CONFIG_TRANZPORT) += frontier/ + obj-$(CONFIG_DREAM) += dream/ + obj-$(CONFIG_POHMELFS) += pohmelfs/ +diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c +index 894eecf..6acc49a 100644 +--- a/drivers/staging/hv/vmbus_drv.c ++++ b/drivers/staging/hv/vmbus_drv.c +@@ -24,6 +24,8 @@ + #include + #include + #include ++#include ++#include + #include "osd.h" + #include "logging.h" + #include "vmbus.h" +@@ -946,6 +948,19 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id) + } + } + ++static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = { ++ { ++ .ident = "Hyper-V", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), ++ DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"), ++ }, ++ }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table); ++ + static int __init vmbus_init(void) + { + int ret = 0; +@@ -957,6 +972,9 @@ static int __init vmbus_init(void) + vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel)); + /* Todo: it is used for loglevel, to be ported to new kernel. */ + ++ if (!dmi_check_system(microsoft_hv_dmi_table)) ++ return -ENODEV; ++ + ret = vmbus_bus_init(VmbusInitialize); + + DPRINT_EXIT(VMBUS_DRV); +@@ -973,6 +991,18 @@ static void __exit vmbus_exit(void) + return; + } + ++/* ++ * We use a PCI table to determine if we should autoload this driver This is ++ * needed by distro tools to determine if the hyperv drivers should be ++ * installed and/or configured. We don't do anything else with the table, but ++ * it needs to be present. ++ */ ++const static struct pci_device_id microsoft_hv_pci_table[] = { ++ { PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */ ++ { 0 } ++}; ++MODULE_DEVICE_TABLE(pci, microsoft_hv_pci_table); ++ + MODULE_LICENSE("GPL"); + module_param(vmbus_irq, int, S_IRUGO); + module_param(vmbus_loglevel, int, S_IRUGO); +diff --git a/drivers/staging/mimio/Kconfig b/drivers/staging/mimio/Kconfig +deleted file mode 100644 +index 505dcb2..0000000 +--- a/drivers/staging/mimio/Kconfig ++++ /dev/null +@@ -1,10 +0,0 @@ +-config INPUT_MIMIO +- tristate "Mimio Xi interactive whiteboard support" +- depends on USB && INPUT +- default N +- help +- Say Y here if you want to use a Mimio Xi interactive +- whiteboard device. +- +- To compile this driver as a module, choose M here: the +- module will be called mimio. +diff --git a/drivers/staging/mimio/Makefile b/drivers/staging/mimio/Makefile +deleted file mode 100644 +index 77807ee..0000000 +--- a/drivers/staging/mimio/Makefile ++++ /dev/null +@@ -1 +0,0 @@ +-obj-$(CONFIG_INPUT_MIMIO) += mimio.o +diff --git a/drivers/staging/mimio/mimio.c b/drivers/staging/mimio/mimio.c +deleted file mode 100644 +index 1ba8103..0000000 +--- a/drivers/staging/mimio/mimio.c ++++ /dev/null +@@ -1,914 +0,0 @@ +-/* +- * Hardware event => input event mapping: +- * +- * +- * +- input.h:#define BTN_TOOL_PEN 0x140 black +- input.h:#define BTN_TOOL_RUBBER 0x141 blue +- input.h:#define BTN_TOOL_BRUSH 0x142 green +- input.h:#define BTN_TOOL_PENCIL 0x143 red +- input.h:#define BTN_TOOL_AIRBRUSH 0x144 eraser +- input.h:#define BTN_TOOL_FINGER 0x145 small eraser +- input.h:#define BTN_TOOL_MOUSE 0x146 mimio interactive +- input.h:#define BTN_TOOL_LENS 0x147 mimio interactive but1 +- input.h:#define LOCALBTN_TOOL_EXTRA1 0x14a mimio interactive but2 == BTN_TOUCH +- input.h:#define LOCALBTN_TOOL_EXTRA2 0x14b mimio extra pens (orange, brown, yellow, purple) == BTN_STYLUS +- input.h:#define LOCALBTN_TOOL_EXTRA3 0x14c unused == BTN_STYLUS2 +- input.h:#define BTN_TOOL_DOUBLETAP 0x14d unused +- input.h:#define BTN_TOOL_TRIPLETAP 0x14e unused +- * +- * MIMIO_EV_PENDOWN(MIMIO_PEN_K) => EV_KEY BIT(BTN_TOOL_PEN) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_B) => EV_KEY BIT(BTN_TOOL_RUBBER) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_G) => EV_KEY BIT(BTN_TOOL_BRUSH) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_R) => EV_KEY BIT(BTN_TOOL_PENCIL) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_E) => EV_KEY BIT(BTN_TOOL_AIRBRUSH) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_ES) => EV_KEY BIT(BTN_TOOL_FINGER) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_I) => EV_KEY BIT(BTN_TOOL_MOUSE) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_IL) => EV_KEY BIT(BTN_TOOL_LENS) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_IR) => EV_KEY BIT(BTN_TOOL_DOUBLETAP) +- * MIMIO_EV_PENDOWN(MIMIO_PEN_EX) => EV_KEY BIT(BTN_TOOL_TRIPLETAP) +- * MIMIO_EV_PENDATA => EV_ABS BIT(ABS_X), BIT(ABS_Y) +- * MIMIO_EV_MEMRESET => EV_KEY BIT(BTN_0) +- * MIMIO_EV_ACC(ACC_NEWPAGE) => EV_KEY BIT(BTN_1) +- * MIMIO_EV_ACC(ACC_TAGPAGE) => EV_KEY BIT(BTN_2) +- * MIMIO_EV_ACC(ACC_PRINTPAGE) => EV_KEY BIT(BTN_3) +- * MIMIO_EV_ACC(ACC_MAXIMIZE) => EV_KEY BIT(BTN_4) +- * MIMIO_EV_ACC(ACC_FINDCTLPNL) => EV_KEY BIT(BTN_5) +- * +- * +- * open issues: +- * - cold-load of data captured when mimio in standalone mode not yet +- * supported; need to snoop Win32 box to see datastream for this. +- * - mimio mouse not yet supported; need to snoop Win32 box to see the +- * datastream for this. +- */ +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_VERSION "v0.031" +-#define DRIVER_AUTHOR "mwilder@cs.nmsu.edu" +-#define DRIVER_DESC "USB mimio-xi driver" +- +-enum {UPVALUE, DOWNVALUE, MOVEVALUE}; +- +-#define MIMIO_XRANGE_MAX 9600 +-#define MIMIO_YRANGE_MAX 4800 +- +-#define LOCALBTN_TOOL_EXTRA1 BTN_TOUCH +-#define LOCALBTN_TOOL_EXTRA2 BTN_STYLUS +-#define LOCALBTN_TOOL_EXTRA3 BTN_STYLUS2 +- +-#define MIMIO_VENDOR_ID 0x08d3 +-#define MIMIO_PRODUCT_ID 0x0001 +-#define MIMIO_MAXPAYLOAD (8) +-#define MIMIO_MAXNAMELEN (64) +-#define MIMIO_TXWAIT (1) +-#define MIMIO_TXDONE (2) +- +-#define MIMIO_EV_PENDOWN (0x22) +-#define MIMIO_EV_PENDATA (0x24) +-#define MIMIO_EV_PENUP (0x51) +-#define MIMIO_EV_MEMRESET (0x45) +-#define MIMIO_EV_ACC (0xb2) +- +-#define MIMIO_PEN_K (1) /* black pen */ +-#define MIMIO_PEN_B (2) /* blue pen */ +-#define MIMIO_PEN_G (3) /* green pen */ +-#define MIMIO_PEN_R (4) /* red pen */ +-/* 5, 6, 7, 8 are extra pens */ +-#define MIMIO_PEN_E (9) /* big eraser */ +-#define MIMIO_PEN_ES (10) /* lil eraser */ +-#define MIMIO_PENJUMP_START (10) +-#define MIMIO_PENJUMP (6) +-#define MIMIO_PEN_I (17) /* mimio interactive */ +-#define MIMIO_PEN_IL (18) /* mimio interactive button 1 */ +-#define MIMIO_PEN_IR (19) /* mimio interactive button 2 */ +- +-#define MIMIO_PEN_MAX (MIMIO_PEN_IR) +- +-#define ACC_DONE (0) +-#define ACC_NEWPAGE (1) +-#define ACC_TAGPAGE (2) +-#define ACC_PRINTPAGE (4) +-#define ACC_MAXIMIZE (8) +-#define ACC_FINDCTLPNL (16) +- +-#define isvalidtxsize(n) ((n) > 0 && (n) <= MIMIO_MAXPAYLOAD) +- +- +-struct pktbuf { +- unsigned char instr; +- unsigned char buf[16]; +- unsigned char *p; +- unsigned char *q; +-}; +- +-struct usbintendpt { +- dma_addr_t dma; +- struct urb *urb; +- unsigned char *buf; +- struct usb_endpoint_descriptor *desc; +-}; +- +-struct mimio { +- struct input_dev *idev; +- struct usb_device *udev; +- struct usb_interface *uifc; +- int open; +- int present; +- int greeted; +- int txflags; +- char phys[MIMIO_MAXNAMELEN]; +- struct usbintendpt in; +- struct usbintendpt out; +- struct pktbuf pktbuf; +- unsigned char minor; +- wait_queue_head_t waitq; +- spinlock_t txlock; +- void (*rxhandler)(struct mimio *, unsigned char *, unsigned int); +- int last_pen_down; +-}; +- +-static void mimio_close(struct input_dev *); +-static void mimio_dealloc(struct mimio *); +-static void mimio_disconnect(struct usb_interface *); +-static int mimio_greet(struct mimio *); +-static void mimio_irq_in(struct urb *); +-static void mimio_irq_out(struct urb *); +-static int mimio_open(struct input_dev *); +-static int mimio_probe(struct usb_interface *, const struct usb_device_id *); +-static void mimio_rx_handler(struct mimio *, unsigned char *, unsigned int); +-static int mimio_tx(struct mimio *, const char *, int); +- +-static char mimio_name[] = "VirtualInk mimio-Xi"; +-static struct usb_device_id mimio_table [] = { +- { USB_DEVICE(MIMIO_VENDOR_ID, MIMIO_PRODUCT_ID) }, +- { USB_DEVICE(0x0525, 0xa4a0) }, /* gadget zero firmware */ +- { } +-}; +- +-MODULE_DEVICE_TABLE(usb, mimio_table); +- +-static struct usb_driver mimio_driver = { +- .name = "mimio", +- .probe = mimio_probe, +- .disconnect = mimio_disconnect, +- .id_table = mimio_table, +-}; +- +-static DECLARE_MUTEX(disconnect_sem); +- +-static void mimio_close(struct input_dev *idev) +-{ +- struct mimio *mimio; +- +- mimio = input_get_drvdata(idev); +- if (!mimio) { +- dev_err(&idev->dev, "null mimio attached to input device\n"); +- return; +- } +- +- if (mimio->open <= 0) +- dev_err(&idev->dev, "mimio not open.\n"); +- else +- mimio->open--; +- +- if (mimio->present == 0 && mimio->open == 0) +- mimio_dealloc(mimio); +-} +- +-static void mimio_dealloc(struct mimio *mimio) +-{ +- if (mimio == NULL) +- return; +- +- usb_kill_urb(mimio->in.urb); +- +- usb_kill_urb(mimio->out.urb); +- +- if (mimio->idev) { +- input_unregister_device(mimio->idev); +- if (mimio->idev->grab) +- input_close_device(mimio->idev->grab); +- else +- dev_dbg(&mimio->idev->dev, "mimio->idev->grab == NULL" +- " -- didn't call input_close_device\n"); +- } +- +- usb_free_urb(mimio->in.urb); +- +- usb_free_urb(mimio->out.urb); +- +- if (mimio->in.buf) { +- usb_buffer_free(mimio->udev, MIMIO_MAXPAYLOAD, mimio->in.buf, +- mimio->in.dma); +- } +- +- if (mimio->out.buf) +- usb_buffer_free(mimio->udev, MIMIO_MAXPAYLOAD, mimio->out.buf, +- mimio->out.dma); +- +- if (mimio->idev) +- input_free_device(mimio->idev); +- +- kfree(mimio); +-} +- +-static void mimio_disconnect(struct usb_interface *ifc) +-{ +- struct mimio *mimio; +- +- down(&disconnect_sem); +- +- mimio = usb_get_intfdata(ifc); +- usb_set_intfdata(ifc, NULL); +- dev_dbg(&mimio->idev->dev, "disconnect\n"); +- +- if (mimio) { +- mimio->present = 0; +- +- if (mimio->open <= 0) +- mimio_dealloc(mimio); +- } +- +- up(&disconnect_sem); +-} +- +-static int mimio_greet(struct mimio *mimio) +-{ +- const struct grtpkt { +- int nbytes; +- unsigned delay; +- char data[8]; +- } grtpkts[] = { +- { 3, 0, { 0x11, 0x55, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x53, 0x55, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x43, 0x55, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x33, 0x55, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x13, 0x00, 0x5e, 0x02, 0x4f, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x13, 0x00, 0x04, 0x03, 0x14, 0x00, 0x00, 0x00 } }, +- { 5, 2, { 0x13, 0x00, 0x00, 0x04, 0x17, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x13, 0x00, 0x0d, 0x08, 0x16, 0x00, 0x00, 0x00 } }, +- { 5, 0, { 0x13, 0x00, 0x4d, 0x01, 0x5f, 0x00, 0x00, 0x00 } }, +- { 3, 0, { 0xf1, 0x55, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00 } }, +- { 7, 2, { 0x52, 0x55, 0x00, 0x07, 0x31, 0x55, 0x64, 0x00 } }, +- { 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, +- }; +- int rslt; +- const struct grtpkt *pkt; +- +- for (pkt = grtpkts; pkt->nbytes; pkt++) { +- rslt = mimio_tx(mimio, pkt->data, pkt->nbytes); +- if (rslt) +- return rslt; +- if (pkt->delay) +- msleep(pkt->delay); +- } +- +- return 0; +-} +- +-static void mimio_irq_in(struct urb *urb) +-{ +- int rslt; +- char *data; +- const char *reason = "going down"; +- struct mimio *mimio; +- +- mimio = urb->context; +- +- if (mimio == NULL) +- /* paranoia */ +- return; +- +- switch (urb->status) { +- case 0: +- /* success */ +- break; +- case -ETIMEDOUT: +- reason = "timeout -- unplugged?"; +- case -ECONNRESET: +- case -ENOENT: +- case -ESHUTDOWN: +- dev_dbg(&mimio->idev->dev, "%s.\n", reason); +- return; +- default: +- dev_dbg(&mimio->idev->dev, "unknown urb-status: %d.\n", +- urb->status); +- goto exit; +- } +- data = mimio->in.buf; +- +- if (mimio->rxhandler) +- mimio->rxhandler(mimio, data, urb->actual_length); +-exit: +- /* +- * Keep listening to device on same urb. +- */ +- rslt = usb_submit_urb(urb, GFP_ATOMIC); +- if (rslt) +- dev_err(&mimio->idev->dev, "usb_submit_urb failure: %d.\n", +- rslt); +-} +- +-static void mimio_irq_out(struct urb *urb) +-{ +- unsigned long flags; +- struct mimio *mimio; +- +- mimio = urb->context; +- +- if (urb->status) +- dev_dbg(&mimio->idev->dev, "urb-status: %d.\n", urb->status); +- +- spin_lock_irqsave(&mimio->txlock, flags); +- mimio->txflags |= MIMIO_TXDONE; +- spin_unlock_irqrestore(&mimio->txlock, flags); +- wmb(); +- wake_up(&mimio->waitq); +-} +- +-static int mimio_open(struct input_dev *idev) +-{ +- int rslt; +- struct mimio *mimio; +- +- rslt = 0; +- down(&disconnect_sem); +- mimio = input_get_drvdata(idev); +- dev_dbg(&idev->dev, "mimio_open\n"); +- +- if (mimio == NULL) { +- dev_err(&idev->dev, "null mimio.\n"); +- rslt = -ENODEV; +- goto exit; +- } +- +- if (mimio->open++) +- goto exit; +- +- if (mimio->present && !mimio->greeted) { +- struct urb *urb = mimio->in.urb; +- mimio->in.urb->dev = mimio->udev; +- rslt = usb_submit_urb(mimio->in.urb, GFP_KERNEL); +- if (rslt) { +- dev_err(&idev->dev, "usb_submit_urb failure " +- "(res = %d: %s). Not greeting.\n", +- rslt, +- (!urb ? "urb is NULL" : +- (urb->hcpriv ? "urb->hcpriv is non-NULL" : +- (!urb->complete ? "urb is not complete" : +- (urb->number_of_packets <= 0 ? "urb has no packets" : +- (urb->interval <= 0 ? "urb interval too small" : +- "urb interval too large or some other error")))))); +- rslt = -EIO; +- goto exit; +- } +- rslt = mimio_greet(mimio); +- if (rslt == 0) { +- dev_dbg(&idev->dev, "Mimio greeted OK.\n"); +- mimio->greeted = 1; +- } else { +- dev_dbg(&idev->dev, "Mimio greet Failure (%d)\n", +- rslt); +- } +- } +- +-exit: +- up(&disconnect_sem); +- return rslt; +-} +- +-static int mimio_probe(struct usb_interface *ifc, +- const struct usb_device_id *id) +-{ +- char path[64]; +- int pipe, maxp; +- struct mimio *mimio; +- struct usb_device *udev; +- struct usb_host_interface *hostifc; +- struct input_dev *input_dev; +- int res = 0; +- int i; +- +- udev = interface_to_usbdev(ifc); +- +- mimio = kzalloc(sizeof(struct mimio), GFP_KERNEL); +- if (!mimio) +- return -ENOMEM; +- +- input_dev = input_allocate_device(); +- if (!input_dev) { +- mimio_dealloc(mimio); +- return -ENOMEM; +- } +- +- mimio->uifc = ifc; +- mimio->udev = udev; +- mimio->pktbuf.p = mimio->pktbuf.buf; +- mimio->pktbuf.q = mimio->pktbuf.buf; +- /* init_input_dev(mimio->idev); */ +- mimio->idev = input_dev; +- init_waitqueue_head(&mimio->waitq); +- spin_lock_init(&mimio->txlock); +- hostifc = ifc->cur_altsetting; +- +- if (hostifc->desc.bNumEndpoints != 2) { +- dev_err(&udev->dev, "Unexpected endpoint count: %d.\n", +- hostifc->desc.bNumEndpoints); +- mimio_dealloc(mimio); +- return -ENODEV; +- } +- +- mimio->in.desc = &(hostifc->endpoint[0].desc); +- mimio->out.desc = &(hostifc->endpoint[1].desc); +- +- mimio->in.buf = usb_buffer_alloc(udev, MIMIO_MAXPAYLOAD, GFP_KERNEL, +- &mimio->in.dma); +- mimio->out.buf = usb_buffer_alloc(udev, MIMIO_MAXPAYLOAD, GFP_KERNEL, +- &mimio->out.dma); +- +- if (mimio->in.buf == NULL || mimio->out.buf == NULL) { +- dev_err(&udev->dev, "usb_buffer_alloc failure.\n"); +- mimio_dealloc(mimio); +- return -ENOMEM; +- } +- +- mimio->in.urb = usb_alloc_urb(0, GFP_KERNEL); +- mimio->out.urb = usb_alloc_urb(0, GFP_KERNEL); +- +- if (mimio->in.urb == NULL || mimio->out.urb == NULL) { +- dev_err(&udev->dev, "usb_alloc_urb failure.\n"); +- mimio_dealloc(mimio); +- return -ENOMEM; +- } +- +- /* +- * Build the input urb. +- */ +- pipe = usb_rcvintpipe(udev, mimio->in.desc->bEndpointAddress); +- maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); +- if (maxp > MIMIO_MAXPAYLOAD) +- maxp = MIMIO_MAXPAYLOAD; +- usb_fill_int_urb(mimio->in.urb, udev, pipe, mimio->in.buf, maxp, +- mimio_irq_in, mimio, mimio->in.desc->bInterval); +- mimio->in.urb->transfer_dma = mimio->in.dma; +- mimio->in.urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; +- +- /* +- * Build the output urb. +- */ +- pipe = usb_sndintpipe(udev, mimio->out.desc->bEndpointAddress); +- maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); +- if (maxp > MIMIO_MAXPAYLOAD) +- maxp = MIMIO_MAXPAYLOAD; +- usb_fill_int_urb(mimio->out.urb, udev, pipe, mimio->out.buf, maxp, +- mimio_irq_out, mimio, mimio->out.desc->bInterval); +- mimio->out.urb->transfer_dma = mimio->out.dma; +- mimio->out.urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; +- +- /* +- * Build input device info +- */ +- usb_make_path(udev, path, 64); +- snprintf(mimio->phys, MIMIO_MAXNAMELEN, "%s/input0", path); +- input_set_drvdata(input_dev, mimio); +- /* input_dev->dev = &ifc->dev; */ +- input_dev->open = mimio_open; +- input_dev->close = mimio_close; +- input_dev->name = mimio_name; +- input_dev->phys = mimio->phys; +- input_dev->dev.parent = &ifc->dev; +- +- input_dev->id.bustype = BUS_USB; +- input_dev->id.vendor = le16_to_cpu(udev->descriptor.idVendor); +- input_dev->id.product = le16_to_cpu(udev->descriptor.idProduct); +- input_dev->id.version = le16_to_cpu(udev->descriptor.bcdDevice); +- +- input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS); +- for (i = BTN_TOOL_PEN; i <= LOCALBTN_TOOL_EXTRA2; ++i) +- set_bit(i, input_dev->keybit); +- +- input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | +- BIT_MASK(BTN_1) | +- BIT_MASK(BTN_2) | +- BIT_MASK(BTN_3) | +- BIT_MASK(BTN_4) | +- BIT_MASK(BTN_5); +- /* input_dev->keybit[BTN_MOUSE] |= BIT(BTN_LEFT); */ +- input_dev->absbit[0] |= BIT_MASK(ABS_X) | BIT_MASK(ABS_Y); +- input_set_abs_params(input_dev, ABS_X, 0, MIMIO_XRANGE_MAX, 0, 0); +- input_set_abs_params(input_dev, ABS_Y, 0, MIMIO_YRANGE_MAX, 0, 0); +- input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); +- +-#if 0 +- input_dev->absmin[ABS_X] = 0; +- input_dev->absmin[ABS_Y] = 0; +- input_dev->absmax[ABS_X] = 9600; +- input_dev->absmax[ABS_Y] = 4800; +- input_dev->absfuzz[ABS_X] = 0; +- input_dev->absfuzz[ABS_Y] = 0; +- input_dev->absflat[ABS_X] = 0; +- input_dev->absflat[ABS_Y] = 0; +-#endif +- +-#if 0 +- /* this will just reduce the precision */ +- input_dev->absfuzz[ABS_X] = 8; /* experimental; may need to change */ +- input_dev->absfuzz[ABS_Y] = 8; /* experimental; may need to change */ +-#endif +- +- /* +- * Register the input device. +- */ +- res = input_register_device(mimio->idev); +- if (res) { +- dev_err(&udev->dev, "input_register_device failure (%d)\n", +- res); +- mimio_dealloc(mimio); +- return -EIO; +- } +- dev_dbg(&mimio->idev->dev, "input: %s on %s (res = %d).\n", +- input_dev->name, input_dev->phys, res); +- +- usb_set_intfdata(ifc, mimio); +- mimio->present = 1; +- +- /* +- * Submit the input urb to the usb subsystem. +- */ +- mimio->in.urb->dev = mimio->udev; +- res = usb_submit_urb(mimio->in.urb, GFP_KERNEL); +- if (res) { +- dev_err(&mimio->idev->dev, "usb_submit_urb failure (%d)\n", +- res); +- mimio_dealloc(mimio); +- return -EIO; +- } +- +- /* +- * Attempt to greet the mimio after giving +- * it some post-init settling time. +- * +- * note: sometimes this sleep interval isn't +- * long enough to permit the device to re-init +- * after a hot-swap; maybe need to bump it up. +- * +- * As it is, this probably breaks module unloading support! +- */ +- msleep(1024); +- +- res = mimio_greet(mimio); +- if (res == 0) { +- dev_dbg(&mimio->idev->dev, "Mimio greeted OK.\n"); +- mimio->greeted = 1; +- mimio->rxhandler = mimio_rx_handler; +- } else { +- dev_dbg(&mimio->idev->dev, "Mimio greet Failure (%d)\n", res); +- } +- +- return 0; +-} +- +-static int handle_mimio_rx_penupdown(struct mimio *mimio, +- int down, +- const char *const instr[], +- const int instr_ofst[]) +-{ +- int penid, x; +- if (mimio->pktbuf.q - mimio->pktbuf.p < (down ? 4 : 3)) +- return 1; /* partial pkt */ +- +- if (down) { +- x = *mimio->pktbuf.p ^ *(mimio->pktbuf.p + 1) ^ +- *(mimio->pktbuf.p + 2); +- if (x != *(mimio->pktbuf.p + 3)) { +- dev_dbg(&mimio->idev->dev, "EV_PEN%s: bad xsum.\n", +- down ? "DOWN":"UP"); +- /* skip this event data */ +- mimio->pktbuf.p += 4; +- /* decode any remaining events */ +- return 0; +- } +- penid = mimio->pktbuf.instr = *(mimio->pktbuf.p + 2); +- if (penid > MIMIO_PEN_MAX) { +- dev_dbg(&mimio->idev->dev, +- "Unmapped penID (not in [0, %d]): %d\n", +- MIMIO_PEN_MAX, (int)mimio->pktbuf.instr); +- penid = mimio->pktbuf.instr = 0; +- } +- mimio->last_pen_down = penid; +- } else { +- penid = mimio->last_pen_down; +- } +- dev_dbg(&mimio->idev->dev, "%s (id %d, code %d) %s.\n", instr[penid], +- instr_ofst[penid], penid, down ? "down" : "up"); +- +- if (instr_ofst[penid] >= 0) { +- int code = BTN_TOOL_PEN + instr_ofst[penid]; +- int value = down ? DOWNVALUE : UPVALUE; +- if (code > KEY_MAX) +- dev_dbg(&mimio->idev->dev, "input_event will ignore " +- "-- code (%d) > KEY_MAX\n", code); +- if (!test_bit(code, mimio->idev->keybit)) +- dev_dbg(&mimio->idev->dev, "input_event will ignore " +- "-- bit for code (%d) not enabled\n", code); +- if (!!test_bit(code, mimio->idev->key) == value) +- dev_dbg(&mimio->idev->dev, "input_event will ignore " +- "-- bit for code (%d) already set to %d\n", +- code, value); +- if (value != DOWNVALUE) { +- /* input_regs(mimio->idev, regs); */ +- input_report_key(mimio->idev, code, value); +- input_sync(mimio->idev); +- } else { +- /* wait until we get some coordinates */ +- } +- } else { +- dev_dbg(&mimio->idev->dev, "penID offset[%d] == %d is < 0 " +- "- not sending\n", penid, instr_ofst[penid]); +- } +- mimio->pktbuf.p += down ? 4 : 3; /* 3 for up, 4 for down */ +- return 0; +-} +- +-/* +- * Stay tuned for partial-packet excitement. +- * +- * This routine buffers data packets received from the mimio device +- * in the mimio's data space. This buffering is necessary because +- * the mimio's in endpoint can serve us partial packets of data, and +- * we want the driver to support the servicing of multiple mimios. +- * Empirical evidence gathered so far suggests that the method of +- * buffering packet data in the mimio's data space works. Previous +- * versions of this driver did not buffer packet data in each mimio's +- * data-space, and were therefore not able to service multiple mimios. +- * Note that since the caller of this routine is running in interrupt +- * context, care needs to be taken to ensure that this routine does not +- * become bloated, and it may be that another spinlock is needed in each +- * mimio to guard the buffered packet data properly. +- */ +-static void mimio_rx_handler(struct mimio *mimio, +- unsigned char *data, +- unsigned int nbytes) +-{ +- struct device *dev = &mimio->idev->dev; +- unsigned int x; +- unsigned int y; +- static const char * const instr[] = { +- "?0", +- "black pen", "blue pen", "green pen", "red pen", +- "brown pen", "orange pen", "purple pen", "yellow pen", +- "big eraser", "lil eraser", +- "?11", "?12", "?13", "?14", "?15", "?16", +- "mimio interactive", "interactive button1", +- "interactive button2" +- }; +- +- /* Mimio Interactive gives: +- * down: [0x22 0x01 0x11 0x32 0x24] +- * b1 : [0x22 0x01 0x12 0x31 0x24] +- * b2 : [0x22 0x01 0x13 0x30 0x24] +- */ +- static const int instr_ofst[] = { +- -1, +- 0, 1, 2, 3, +- 9, 9, 9, 9, +- 4, 5, +- -1, -1, -1, -1, -1, -1, +- 6, 7, 8, +- }; +- +- memcpy(mimio->pktbuf.q, data, nbytes); +- mimio->pktbuf.q += nbytes; +- +- while (mimio->pktbuf.p < mimio->pktbuf.q) { +- int t = *mimio->pktbuf.p; +- switch (t) { +- case MIMIO_EV_PENUP: +- case MIMIO_EV_PENDOWN: +- if (handle_mimio_rx_penupdown(mimio, +- t == MIMIO_EV_PENDOWN, +- instr, instr_ofst)) +- return; /* partial packet */ +- break; +- +- case MIMIO_EV_PENDATA: +- if (mimio->pktbuf.q - mimio->pktbuf.p < 6) +- /* partial pkt */ +- return; +- x = *mimio->pktbuf.p ^ *(mimio->pktbuf.p + 1) ^ +- *(mimio->pktbuf.p + 2) ^ +- *(mimio->pktbuf.p + 3) ^ +- *(mimio->pktbuf.p + 4); +- if (x != *(mimio->pktbuf.p + 5)) { +- dev_dbg(dev, "EV_PENDATA: bad xsum.\n"); +- mimio->pktbuf.p += 6; /* skip this event data */ +- break; /* decode any remaining events */ +- } +- x = *(mimio->pktbuf.p + 1); +- x <<= 8; +- x |= *(mimio->pktbuf.p + 2); +- y = *(mimio->pktbuf.p + 3); +- y <<= 8; +- y |= *(mimio->pktbuf.p + 4); +- dev_dbg(dev, "coord: (%d, %d)\n", x, y); +- if (instr_ofst[mimio->pktbuf.instr] >= 0) { +- int code = BTN_TOOL_PEN + +- instr_ofst[mimio->last_pen_down]; +-#if 0 +- /* Utter hack to ensure we get forwarded _AND_ +- * so we can identify when a complete signal is +- * received */ +- mimio->idev->abs[ABS_Y] = -1; +- mimio->idev->abs[ABS_X] = -1; +-#endif +- /* input_regs(mimio->idev, regs); */ +- input_report_abs(mimio->idev, ABS_X, x); +- input_report_abs(mimio->idev, ABS_Y, y); +- /* fake a penup */ +- change_bit(code, mimio->idev->key); +- input_report_key(mimio->idev, +- code, +- DOWNVALUE); +- /* always sync here */ +- mimio->idev->sync = 0; +- input_sync(mimio->idev); +- } +- mimio->pktbuf.p += 6; +- break; +- case MIMIO_EV_MEMRESET: +- if (mimio->pktbuf.q - mimio->pktbuf.p < 7) +- /* partial pkt */ +- return; +- dev_dbg(dev, "mem-reset.\n"); +- /* input_regs(mimio->idev, regs); */ +- input_event(mimio->idev, EV_KEY, BTN_0, 1); +- input_event(mimio->idev, EV_KEY, BTN_0, 0); +- input_sync(mimio->idev); +- mimio->pktbuf.p += 7; +- break; +- case MIMIO_EV_ACC: +- if (mimio->pktbuf.q - mimio->pktbuf.p < 4) +- /* partial pkt */ +- return; +- x = *mimio->pktbuf.p ^ *(mimio->pktbuf.p + 1) ^ +- *(mimio->pktbuf.p + 2); +- if (x != *(mimio->pktbuf.p + 3)) { +- dev_dbg(dev, "EV_ACC: bad xsum.\n"); +- mimio->pktbuf.p += 4; /* skip this event data */ +- break; /* decode any remaining events */ +- } +- switch (*(mimio->pktbuf.p + 2)) { +- case ACC_NEWPAGE: +- dev_dbg(&mimio->idev->dev, "new-page.\n"); +- /* input_regs(mimio->idev, regs); */ +- input_event(mimio->idev, EV_KEY, BTN_1, 1); +- input_event(mimio->idev, EV_KEY, BTN_1, 0); +- input_sync(mimio->idev); +- break; +- case ACC_TAGPAGE: +- dev_dbg(&mimio->idev->dev, "tag-page.\n"); +- /* input_regs(mimio->idev, regs); */ +- input_event(mimio->idev, EV_KEY, BTN_2, 1); +- input_event(mimio->idev, EV_KEY, BTN_2, 0); +- input_sync(mimio->idev); +- break; +- case ACC_PRINTPAGE: +- dev_dbg(&mimio->idev->dev, "print-page.\n"); +- /* input_regs(mimio->idev, regs);*/ +- input_event(mimio->idev, EV_KEY, BTN_3, 1); +- input_event(mimio->idev, EV_KEY, BTN_3, 0); +- input_sync(mimio->idev); +- break; +- case ACC_MAXIMIZE: +- dev_dbg(&mimio->idev->dev, +- "maximize-window.\n"); +- /* input_regs(mimio->idev, regs); */ +- input_event(mimio->idev, EV_KEY, BTN_4, 1); +- input_event(mimio->idev, EV_KEY, BTN_4, 0); +- input_sync(mimio->idev); +- break; +- case ACC_FINDCTLPNL: +- dev_dbg(&mimio->idev->dev, "find-ctl-panel.\n"); +- /* input_regs(mimio->idev, regs); */ +- input_event(mimio->idev, EV_KEY, BTN_5, 1); +- input_event(mimio->idev, EV_KEY, BTN_5, 0); +- input_sync(mimio->idev); +- break; +- case ACC_DONE: +- dev_dbg(&mimio->idev->dev, "acc-done.\n"); +- /* no event is dispatched to the input +- * subsystem for this device event. +- */ +- break; +- default: +- dev_dbg(dev, "unknown acc event.\n"); +- break; +- } +- mimio->pktbuf.p += 4; +- break; +- default: +- mimio->pktbuf.p++; +- break; +- } +- } +- +- /* +- * No partial event was received, so reset mimio's pktbuf ptrs. +- */ +- mimio->pktbuf.p = mimio->pktbuf.q = mimio->pktbuf.buf; +-} +- +-static int mimio_tx(struct mimio *mimio, const char *buf, int nbytes) +-{ +- int rslt; +- int timeout; +- unsigned long flags; +- DECLARE_WAITQUEUE(wait, current); +- +- if (!(isvalidtxsize(nbytes))) { +- dev_err(&mimio->idev->dev, "invalid arg: nbytes: %d.\n", +- nbytes); +- return -EINVAL; +- } +- +- /* +- * Init the out urb and copy the data to send. +- */ +- mimio->out.urb->dev = mimio->udev; +- mimio->out.urb->transfer_buffer_length = nbytes; +- memcpy(mimio->out.urb->transfer_buffer, buf, nbytes); +- +- /* +- * Send the data. +- */ +- spin_lock_irqsave(&mimio->txlock, flags); +- mimio->txflags = MIMIO_TXWAIT; +- rslt = usb_submit_urb(mimio->out.urb, GFP_ATOMIC); +- spin_unlock_irqrestore(&mimio->txlock, flags); +- dev_dbg(&mimio->idev->dev, "rslt: %d.\n", rslt); +- +- if (rslt) { +- dev_err(&mimio->idev->dev, "usb_submit_urb failure: %d.\n", +- rslt); +- return rslt; +- } +- +- /* +- * Wait for completion to be signalled (the mimio_irq_out +- * completion routine will or MIMIO_TXDONE in with txflags). +- */ +- timeout = HZ; +- set_current_state(TASK_INTERRUPTIBLE); +- add_wait_queue(&mimio->waitq, &wait); +- +- while (timeout && ((mimio->txflags & MIMIO_TXDONE) == 0)) { +- timeout = schedule_timeout(timeout); +- rmb(); +- } +- +- if ((mimio->txflags & MIMIO_TXDONE) == 0) +- dev_dbg(&mimio->idev->dev, "tx timed out.\n"); +- +- /* +- * Now that completion has been signalled, +- * unlink the urb so that it can be recycled. +- */ +- set_current_state(TASK_RUNNING); +- remove_wait_queue(&mimio->waitq, &wait); +- usb_unlink_urb(mimio->out.urb); +- +- return rslt; +-} +- +-static int __init mimio_init(void) +-{ +- int rslt; +- +- rslt = usb_register(&mimio_driver); +- if (rslt != 0) { +- err("%s: usb_register failure: %d", __func__, rslt); +- return rslt; +- } +- +- printk(KERN_INFO KBUILD_MODNAME ":" +- DRIVER_DESC " " DRIVER_VERSION "\n"); +- return rslt; +-} +- +-static void __exit mimio_exit(void) +-{ +- usb_deregister(&mimio_driver); +-} +- +-module_init(mimio_init); +-module_exit(mimio_exit); +- +-MODULE_AUTHOR(DRIVER_AUTHOR); +-MODULE_DESCRIPTION(DRIVER_DESC); +-MODULE_LICENSE("GPL"); +diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c +index f69b778..cd25811 100644 +--- a/drivers/staging/pohmelfs/inode.c ++++ b/drivers/staging/pohmelfs/inode.c +@@ -36,6 +36,7 @@ + #define POHMELFS_MAGIC_NUM 0x504f482e + + static struct kmem_cache *pohmelfs_inode_cache; ++static atomic_t psb_bdi_num = ATOMIC_INIT(0); + + /* + * Removes inode from all trees, drops local name cache and removes all queued +@@ -1331,6 +1332,8 @@ static void pohmelfs_put_super(struct super_block *sb) + pohmelfs_crypto_exit(psb); + pohmelfs_state_exit(psb); + ++ bdi_destroy(&psb->bdi); ++ + kfree(psb); + sb->s_fs_info = NULL; + } +@@ -1815,11 +1818,22 @@ static int pohmelfs_fill_super(struct super_block *sb, void *data, int silent) + if (!psb) + goto err_out_exit; + ++ err = bdi_init(&psb->bdi); ++ if (err) ++ goto err_out_free_sb; ++ ++ err = bdi_register(&psb->bdi, NULL, "pfs-%d", atomic_inc_return(&psb_bdi_num)); ++ if (err) { ++ bdi_destroy(&psb->bdi); ++ goto err_out_free_sb; ++ } ++ + sb->s_fs_info = psb; + sb->s_op = &pohmelfs_sb_ops; + sb->s_magic = POHMELFS_MAGIC_NUM; + sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_blocksize = PAGE_SIZE; ++ sb->s_bdi = &psb->bdi; + + psb->sb = sb; + +@@ -1863,11 +1877,11 @@ static int pohmelfs_fill_super(struct super_block *sb, void *data, int silent) + + err = pohmelfs_parse_options((char *) data, psb, 0); + if (err) +- goto err_out_free_sb; ++ goto err_out_free_bdi; + + err = pohmelfs_copy_crypto(psb); + if (err) +- goto err_out_free_sb; ++ goto err_out_free_bdi; + + err = pohmelfs_state_init(psb); + if (err) +@@ -1916,6 +1930,8 @@ err_out_state_exit: + err_out_free_strings: + kfree(psb->cipher_string); + kfree(psb->hash_string); ++err_out_free_bdi: ++ bdi_destroy(&psb->bdi); + err_out_free_sb: + kfree(psb); + err_out_exit: +diff --git a/drivers/staging/pohmelfs/netfs.h b/drivers/staging/pohmelfs/netfs.h +index 623a07d..01cba00 100644 +--- a/drivers/staging/pohmelfs/netfs.h ++++ b/drivers/staging/pohmelfs/netfs.h +@@ -18,6 +18,7 @@ + + #include + #include ++#include + + #define POHMELFS_CN_IDX 5 + #define POHMELFS_CN_VAL 0 +@@ -624,6 +625,8 @@ struct pohmelfs_sb { + + struct super_block *sb; + ++ struct backing_dev_info bdi; ++ + /* + * Algorithm strings. + */ +diff --git a/drivers/staging/wlan-ng/Kconfig b/drivers/staging/wlan-ng/Kconfig +index f44294b..f1af507 100644 +--- a/drivers/staging/wlan-ng/Kconfig ++++ b/drivers/staging/wlan-ng/Kconfig +@@ -1,6 +1,7 @@ + config PRISM2_USB + tristate "Prism2.5/3 USB driver" + depends on WLAN && USB && WIRELESS_EXT ++ select WEXT_PRIV + default n + ---help--- + This is the wlan-ng prism 2.5/3 USB driver for a wide range of +diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c +index 60a45f1..ca479a7 100644 +--- a/drivers/usb/core/driver.c ++++ b/drivers/usb/core/driver.c +@@ -691,9 +691,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) + { + struct usb_device *usb_dev; + +- /* driver is often null here; dev_dbg() would oops */ +- pr_debug("usb %s: uevent\n", dev_name(dev)); +- + if (is_usb_device(dev)) { + usb_dev = to_usb_device(dev); + } else if (is_usb_interface(dev)) { +@@ -705,6 +702,7 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) + } + + if (usb_dev->devnum < 0) { ++ /* driver is often null here; dev_dbg() would oops */ + pr_debug("usb %s: already deleted?\n", dev_name(dev)); + return -ENODEV; + } +diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c +index 80995ef..0477616 100644 +--- a/drivers/usb/core/hcd.c ++++ b/drivers/usb/core/hcd.c +@@ -141,7 +141,7 @@ static const u8 usb3_rh_dev_descriptor[18] = { + 0x09, /* __u8 bMaxPacketSize0; 2^9 = 512 Bytes */ + + 0x6b, 0x1d, /* __le16 idVendor; Linux Foundation */ +- 0x02, 0x00, /* __le16 idProduct; device 0x0002 */ ++ 0x03, 0x00, /* __le16 idProduct; device 0x0003 */ + KERNEL_VER, KERNEL_REL, /* __le16 bcdDevice */ + + 0x03, /* __u8 iManufacturer; */ +diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h +index bbe2b92..89613a7 100644 +--- a/drivers/usb/core/hcd.h ++++ b/drivers/usb/core/hcd.h +@@ -248,7 +248,7 @@ struct hc_driver { + /* xHCI specific functions */ + /* Called by usb_alloc_dev to alloc HC device structures */ + int (*alloc_dev)(struct usb_hcd *, struct usb_device *); +- /* Called by usb_release_dev to free HC device structures */ ++ /* Called by usb_disconnect to free HC device structures */ + void (*free_dev)(struct usb_hcd *, struct usb_device *); + + /* Bandwidth computation functions */ +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 35cc8b9..9cc0aba 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1554,6 +1554,15 @@ static inline void usb_stop_pm(struct usb_device *udev) + + #endif + ++static void hub_free_dev(struct usb_device *udev) ++{ ++ struct usb_hcd *hcd = bus_to_hcd(udev->bus); ++ ++ /* Root hubs aren't real devices, so don't free HCD resources */ ++ if (hcd->driver->free_dev && udev->parent) ++ hcd->driver->free_dev(hcd, udev); ++} ++ + /** + * usb_disconnect - disconnect a device (usbcore-internal) + * @pdev: pointer to device being disconnected +@@ -1624,6 +1633,8 @@ void usb_disconnect(struct usb_device **pdev) + + usb_stop_pm(udev); + ++ hub_free_dev(udev); ++ + put_device(&udev->dev); + } + +@@ -3191,6 +3202,7 @@ loop_disable: + loop: + usb_ep0_reinit(udev); + release_address(udev); ++ hub_free_dev(udev); + usb_put_dev(udev); + if ((status == -ENOTCONN) || (status == -ENOTSUPP)) + break; +diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c +index 0daff0d..ced0776 100644 +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -228,9 +228,6 @@ static void usb_release_dev(struct device *dev) + hcd = bus_to_hcd(udev->bus); + + usb_destroy_configuration(udev); +- /* Root hubs aren't real devices, so don't free HCD resources */ +- if (hcd->driver->free_dev && udev->parent) +- hcd->driver->free_dev(hcd, udev); + usb_put_hcd(hcd); + kfree(udev->product); + kfree(udev->manufacturer); +diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c +index a37640e..73f9bbd 100644 +--- a/drivers/usb/gadget/f_mass_storage.c ++++ b/drivers/usb/gadget/f_mass_storage.c +@@ -2852,7 +2852,6 @@ error_release: + /* Call fsg_common_release() directly, ref might be not + * initialised */ + fsg_common_release(&common->ref); +- complete(&common->thread_notifier); + return ERR_PTR(rc); + } + +diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c +index 2769326..cd74bbd 100644 +--- a/drivers/usb/host/ohci-pnx4008.c ++++ b/drivers/usb/host/ohci-pnx4008.c +@@ -327,7 +327,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev) + } + i2c_adap = i2c_get_adapter(2); + memset(&i2c_info, 0, sizeof(struct i2c_board_info)); +- strlcpy(i2c_info.name, "isp1301_pnx", I2C_NAME_SIZE); ++ strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE); + isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info, + normal_i2c); + i2c_put_adapter(i2c_adap); +@@ -411,7 +411,7 @@ out3: + out2: + clk_put(usb_clk); + out1: +- i2c_unregister_client(isp1301_i2c_client); ++ i2c_unregister_device(isp1301_i2c_client); + isp1301_i2c_client = NULL; + out_i2c_driver: + i2c_del_driver(&isp1301_driver); +@@ -430,7 +430,7 @@ static int usb_hcd_pnx4008_remove(struct platform_device *pdev) + pnx4008_unset_usb_bits(); + clk_disable(usb_clk); + clk_put(usb_clk); +- i2c_unregister_client(isp1301_i2c_client); ++ i2c_unregister_device(isp1301_i2c_client); + isp1301_i2c_client = NULL; + i2c_del_driver(&isp1301_driver); + +diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c +index 99cd00f..0919706 100644 +--- a/drivers/usb/host/uhci-hcd.c ++++ b/drivers/usb/host/uhci-hcd.c +@@ -735,6 +735,7 @@ static void uhci_stop(struct usb_hcd *hcd) + uhci_hc_died(uhci); + uhci_scan_schedule(uhci); + spin_unlock_irq(&uhci->lock); ++ synchronize_irq(hcd->irq); + + del_timer_sync(&uhci->fsbr_timer); + release_uhci(uhci); +diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h +index ecc131c..78c4eda 100644 +--- a/drivers/usb/host/xhci-ext-caps.h ++++ b/drivers/usb/host/xhci-ext-caps.h +@@ -101,12 +101,15 @@ static inline int xhci_find_next_cap_offset(void __iomem *base, int ext_offset) + + next = readl(base + ext_offset); + +- if (ext_offset == XHCI_HCC_PARAMS_OFFSET) ++ if (ext_offset == XHCI_HCC_PARAMS_OFFSET) { + /* Find the first extended capability */ + next = XHCI_HCC_EXT_CAPS(next); +- else ++ ext_offset = 0; ++ } else { + /* Find the next extended capability */ + next = XHCI_EXT_CAPS_NEXT(next); ++ } ++ + if (!next) + return 0; + /* +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c +index bd254ec..7d920f2 100644 +--- a/drivers/usb/serial/cp210x.c ++++ b/drivers/usb/serial/cp210x.c +@@ -91,11 +91,12 @@ static struct usb_device_id id_table [] = { + { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ + { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ + { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ ++ { USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */ + { USB_DEVICE(0x10C4, 0x81F2) }, /* C1007 HF band RFID controller */ + { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ + { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ + { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demostration module */ +- { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */ ++ { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesys ETRX2USB */ + { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ + { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ + { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c +index 7638828..34acf6c 100644 +--- a/drivers/usb/serial/ftdi_sio.c ++++ b/drivers/usb/serial/ftdi_sio.c +@@ -614,6 +614,7 @@ static struct usb_device_id id_table_combined [] = { + { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) }, + { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, ++ { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, + { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, + { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, + { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, +@@ -737,6 +738,10 @@ static struct usb_device_id id_table_combined [] = { + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, + { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, ++ { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, ++ { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, ++ { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, ++ { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, + { }, /* Optional parameter entry */ + { } /* Terminating entry */ + }; +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h +index c8951ae..d10b5a8 100644 +--- a/drivers/usb/serial/ftdi_sio_ids.h ++++ b/drivers/usb/serial/ftdi_sio_ids.h +@@ -494,6 +494,13 @@ + #define RATOC_PRODUCT_ID_USB60F 0xb020 + + /* ++ * Contec products (http://www.contec.com) ++ * Submitted by Daniel Sangorrin ++ */ ++#define CONTEC_VID 0x06CE /* Vendor ID */ ++#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ ++ ++/* + * Definitions for B&B Electronics products. + */ + #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ +@@ -1002,3 +1009,11 @@ + #define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/ + #define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/ + #define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */ ++ ++/* ++ * MJS Gadgets HD Radio / XM Radio / Sirius Radio interfaces (using VID 0x0403) ++ */ ++#define MJSG_GENERIC_PID 0x9378 ++#define MJSG_SR_RADIO_PID 0x9379 ++#define MJSG_XM_RADIO_PID 0x937A ++#define MJSG_HD_RADIO_PID 0x937C +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c +index 3eb6143..0cfd621 100644 +--- a/drivers/usb/serial/sierra.c ++++ b/drivers/usb/serial/sierra.c +@@ -604,14 +604,17 @@ static void sierra_indat_callback(struct urb *urb) + } else { + if (urb->actual_length) { + tty = tty_port_tty_get(&port->port); +- +- tty_buffer_request_room(tty, urb->actual_length); +- tty_insert_flip_string(tty, data, urb->actual_length); +- tty_flip_buffer_push(tty); +- +- tty_kref_put(tty); +- usb_serial_debug_data(debug, &port->dev, __func__, +- urb->actual_length, data); ++ if (tty) { ++ tty_buffer_request_room(tty, ++ urb->actual_length); ++ tty_insert_flip_string(tty, data, ++ urb->actual_length); ++ tty_flip_buffer_push(tty); ++ ++ tty_kref_put(tty); ++ usb_serial_debug_data(debug, &port->dev, ++ __func__, urb->actual_length, data); ++ } + } else { + dev_dbg(&port->dev, "%s: empty read urb" + " received\n", __func__); +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h +index 49575fb..98b549b 100644 +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1147,8 +1147,8 @@ UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000, + 0 ), + + /* Reported by Jan Dumon +- * This device (wrongly) has a vendor-specific device descriptor. +- * The entry is needed so usb-storage can bind to it's mass-storage ++ * These devices (wrongly) have a vendor-specific device descriptor. ++ * These entries are needed so usb-storage can bind to their mass-storage + * interface as an interface driver */ + UNUSUAL_DEV( 0x0af0, 0x7501, 0x0000, 0x0000, + "Option", +@@ -1156,6 +1156,90 @@ UNUSUAL_DEV( 0x0af0, 0x7501, 0x0000, 0x0000, + US_SC_DEVICE, US_PR_DEVICE, NULL, + 0 ), + ++UNUSUAL_DEV( 0x0af0, 0x7701, 0x0000, 0x0000, ++ "Option", ++ "GI 0451 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x7706, 0x0000, 0x0000, ++ "Option", ++ "GI 0451 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x7901, 0x0000, 0x0000, ++ "Option", ++ "GI 0452 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x7A01, 0x0000, 0x0000, ++ "Option", ++ "GI 0461 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x7A05, 0x0000, 0x0000, ++ "Option", ++ "GI 0461 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x8300, 0x0000, 0x0000, ++ "Option", ++ "GI 033x SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x8302, 0x0000, 0x0000, ++ "Option", ++ "GI 033x SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0x8304, 0x0000, 0x0000, ++ "Option", ++ "GI 033x SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xc100, 0x0000, 0x0000, ++ "Option", ++ "GI 070x SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xd057, 0x0000, 0x0000, ++ "Option", ++ "GI 1505 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xd058, 0x0000, 0x0000, ++ "Option", ++ "GI 1509 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xd157, 0x0000, 0x0000, ++ "Option", ++ "GI 1515 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xd257, 0x0000, 0x0000, ++ "Option", ++ "GI 1215 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ ++UNUSUAL_DEV( 0x0af0, 0xd357, 0x0000, 0x0000, ++ "Option", ++ "GI 1505 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ + /* Reported by Ben Efros */ + UNUSUAL_DEV( 0x0bc2, 0x3010, 0x0000, 0x0000, + "Seagate", +diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c +index 18b9507..4cd5049 100644 +--- a/drivers/video/sunxvr500.c ++++ b/drivers/video/sunxvr500.c +@@ -400,6 +400,7 @@ static void __devexit e3d_pci_unregister(struct pci_dev *pdev) + + static struct pci_device_id e3d_pci_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), }, ++ { PCI_DEVICE(0x1091, 0x7a0), }, + { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), }, + { .vendor = PCI_VENDOR_ID_3DLABS, + .device = PCI_ANY_ID, +diff --git a/fs/file_table.c b/fs/file_table.c +index b98404b..32d12b7 100644 +--- a/fs/file_table.c ++++ b/fs/file_table.c +@@ -393,7 +393,9 @@ retry: + continue; + if (!(f->f_mode & FMODE_WRITE)) + continue; ++ spin_lock(&f->f_lock); + f->f_mode &= ~FMODE_WRITE; ++ spin_unlock(&f->f_lock); + if (file_check_writeable(f) != 0) + continue; + file_release_write(f); +diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c +index 95e1ca7..3f0cd4d 100644 +--- a/fs/nfs/dns_resolve.c ++++ b/fs/nfs/dns_resolve.c +@@ -36,6 +36,19 @@ struct nfs_dns_ent { + }; + + ++static void nfs_dns_ent_update(struct cache_head *cnew, ++ struct cache_head *ckey) ++{ ++ struct nfs_dns_ent *new; ++ struct nfs_dns_ent *key; ++ ++ new = container_of(cnew, struct nfs_dns_ent, h); ++ key = container_of(ckey, struct nfs_dns_ent, h); ++ ++ memcpy(&new->addr, &key->addr, key->addrlen); ++ new->addrlen = key->addrlen; ++} ++ + static void nfs_dns_ent_init(struct cache_head *cnew, + struct cache_head *ckey) + { +@@ -49,8 +62,7 @@ static void nfs_dns_ent_init(struct cache_head *cnew, + new->hostname = kstrndup(key->hostname, key->namelen, GFP_KERNEL); + if (new->hostname) { + new->namelen = key->namelen; +- memcpy(&new->addr, &key->addr, key->addrlen); +- new->addrlen = key->addrlen; ++ nfs_dns_ent_update(cnew, ckey); + } else { + new->namelen = 0; + new->addrlen = 0; +@@ -234,7 +246,7 @@ static struct cache_detail nfs_dns_resolve = { + .cache_show = nfs_dns_show, + .match = nfs_dns_match, + .init = nfs_dns_ent_init, +- .update = nfs_dns_ent_init, ++ .update = nfs_dns_ent_update, + .alloc = nfs_dns_ent_alloc, + }; + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index f19ed86..fcafe60 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -1998,7 +1998,9 @@ nfs4_file_downgrade(struct file *filp, unsigned int share_access) + { + if (share_access & NFS4_SHARE_ACCESS_WRITE) { + drop_file_write_access(filp); ++ spin_lock(&filp->f_lock); + filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE; ++ spin_unlock(&filp->f_lock); + } + } + +diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c +index 7e9df11..4c2a6d2 100644 +--- a/fs/ocfs2/aops.c ++++ b/fs/ocfs2/aops.c +@@ -577,8 +577,9 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock, + goto bail; + } + +- /* We should already CoW the refcounted extent. */ +- BUG_ON(ext_flags & OCFS2_EXT_REFCOUNTED); ++ /* We should already CoW the refcounted extent in case of create. */ ++ BUG_ON(create && (ext_flags & OCFS2_EXT_REFCOUNTED)); ++ + /* + * get_more_blocks() expects us to describe a hole by clearing + * the mapped bit on bh_result(). +diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c +index 699f371..5c4703d 100644 +--- a/fs/sysfs/dir.c ++++ b/fs/sysfs/dir.c +@@ -837,11 +837,46 @@ static inline unsigned char dt_type(struct sysfs_dirent *sd) + return (sd->s_mode >> 12) & 15; + } + ++static int sysfs_dir_release(struct inode *inode, struct file *filp) ++{ ++ sysfs_put(filp->private_data); ++ return 0; ++} ++ ++static struct sysfs_dirent *sysfs_dir_pos(struct sysfs_dirent *parent_sd, ++ ino_t ino, struct sysfs_dirent *pos) ++{ ++ if (pos) { ++ int valid = !(pos->s_flags & SYSFS_FLAG_REMOVED) && ++ pos->s_parent == parent_sd && ++ ino == pos->s_ino; ++ sysfs_put(pos); ++ if (valid) ++ return pos; ++ } ++ pos = NULL; ++ if ((ino > 1) && (ino < INT_MAX)) { ++ pos = parent_sd->s_dir.children; ++ while (pos && (ino > pos->s_ino)) ++ pos = pos->s_sibling; ++ } ++ return pos; ++} ++ ++static struct sysfs_dirent *sysfs_dir_next_pos(struct sysfs_dirent *parent_sd, ++ ino_t ino, struct sysfs_dirent *pos) ++{ ++ pos = sysfs_dir_pos(parent_sd, ino, pos); ++ if (pos) ++ pos = pos->s_sibling; ++ return pos; ++} ++ + static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) + { + struct dentry *dentry = filp->f_path.dentry; + struct sysfs_dirent * parent_sd = dentry->d_fsdata; +- struct sysfs_dirent *pos; ++ struct sysfs_dirent *pos = filp->private_data; + ino_t ino; + + if (filp->f_pos == 0) { +@@ -857,29 +892,31 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) + if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0) + filp->f_pos++; + } +- if ((filp->f_pos > 1) && (filp->f_pos < INT_MAX)) { +- mutex_lock(&sysfs_mutex); +- +- /* Skip the dentries we have already reported */ +- pos = parent_sd->s_dir.children; +- while (pos && (filp->f_pos > pos->s_ino)) +- pos = pos->s_sibling; +- +- for ( ; pos; pos = pos->s_sibling) { +- const char * name; +- int len; +- +- name = pos->s_name; +- len = strlen(name); +- filp->f_pos = ino = pos->s_ino; ++ mutex_lock(&sysfs_mutex); ++ for (pos = sysfs_dir_pos(parent_sd, filp->f_pos, pos); ++ pos; ++ pos = sysfs_dir_next_pos(parent_sd, filp->f_pos, pos)) { ++ const char * name; ++ unsigned int type; ++ int len, ret; ++ ++ name = pos->s_name; ++ len = strlen(name); ++ ino = pos->s_ino; ++ type = dt_type(pos); ++ filp->f_pos = ino; ++ filp->private_data = sysfs_get(pos); + +- if (filldir(dirent, name, len, filp->f_pos, ino, +- dt_type(pos)) < 0) +- break; +- } +- if (!pos) +- filp->f_pos = INT_MAX; + mutex_unlock(&sysfs_mutex); ++ ret = filldir(dirent, name, len, filp->f_pos, ino, type); ++ mutex_lock(&sysfs_mutex); ++ if (ret < 0) ++ break; ++ } ++ mutex_unlock(&sysfs_mutex); ++ if ((filp->f_pos > 1) && !pos) { /* EOF */ ++ filp->f_pos = INT_MAX; ++ filp->private_data = NULL; + } + return 0; + } +@@ -888,5 +925,6 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir) + const struct file_operations sysfs_dir_operations = { + .read = generic_read_dir, + .readdir = sysfs_readdir, ++ .release = sysfs_dir_release, + .llseek = generic_file_llseek, + }; +diff --git a/include/linux/fs.h b/include/linux/fs.h +index ebb1cd5..f2f68ce 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -87,6 +87,9 @@ struct inodes_stat_t { + */ + #define FMODE_NOCMTIME ((__force fmode_t)2048) + ++/* Expect random access pattern */ ++#define FMODE_RANDOM ((__force fmode_t)4096) ++ + /* + * The below are the various read and write types that we support. Some of + * them include behavioral modifiers that send information down to the +diff --git a/include/linux/irq.h b/include/linux/irq.h +index 451481c..4d9b26e 100644 +--- a/include/linux/irq.h ++++ b/include/linux/irq.h +@@ -400,7 +400,9 @@ static inline int irq_has_action(unsigned int irq) + + /* Dynamic irq helper functions */ + extern void dynamic_irq_init(unsigned int irq); ++void dynamic_irq_init_keep_chip_data(unsigned int irq); + extern void dynamic_irq_cleanup(unsigned int irq); ++void dynamic_irq_cleanup_keep_chip_data(unsigned int irq); + + /* Set/get chip/data for an IRQ: */ + extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index a3fccc8..99914e6 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -136,7 +136,7 @@ static inline bool dev_xmit_complete(int rc) + * used. + */ + +-#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) ++#if defined(CONFIG_WLAN) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) + # if defined(CONFIG_MAC80211_MESH) + # define LL_MAX_HEADER 128 + # else +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index a177698..c8ea0c7 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -496,9 +496,8 @@ struct hw_perf_event { + atomic64_t period_left; + u64 interrupts; + +- u64 freq_count; +- u64 freq_interrupts; +- u64 freq_stamp; ++ u64 freq_time_stamp; ++ u64 freq_count_stamp; + #endif + }; + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 78efe7c..1f5fa53 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -878,7 +878,10 @@ static inline int sd_balance_for_mc_power(void) + if (sched_smt_power_savings) + return SD_POWERSAVINGS_BALANCE; + +- return SD_PREFER_SIBLING; ++ if (!sched_mc_power_savings) ++ return SD_PREFER_SIBLING; ++ ++ return 0; + } + + static inline int sd_balance_for_package_power(void) +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h +index ae836fd..ec226a2 100644 +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -315,22 +315,23 @@ struct sk_buff { + struct sk_buff *next; + struct sk_buff *prev; + +- struct sock *sk; + ktime_t tstamp; ++ ++ struct sock *sk; + struct net_device *dev; + +- unsigned long _skb_dst; +-#ifdef CONFIG_XFRM +- struct sec_path *sp; +-#endif + /* + * This is the control buffer. It is free to use for every + * layer. Please put your private variables there. If you + * want to keep them across layers you have to do a skb_clone() + * first. This is owned by whoever has the skb queued ATM. + */ +- char cb[48]; ++ char cb[48] __aligned(8); + ++ unsigned long _skb_dst; ++#ifdef CONFIG_XFRM ++ struct sec_path *sp; ++#endif + unsigned int len, + data_len; + __u16 mac_len, +diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h +index 207466a..2540770 100644 +--- a/include/linux/syscalls.h ++++ b/include/linux/syscalls.h +@@ -132,7 +132,8 @@ struct perf_event_attr; + + #define SYSCALL_TRACE_ENTER_EVENT(sname) \ + static const struct syscall_metadata __syscall_meta_##sname; \ +- static struct ftrace_event_call event_enter_##sname; \ ++ static struct ftrace_event_call \ ++ __attribute__((__aligned__(4))) event_enter_##sname; \ + static struct trace_event enter_syscall_print_##sname = { \ + .trace = print_syscall_enter, \ + }; \ +@@ -154,7 +155,8 @@ struct perf_event_attr; + + #define SYSCALL_TRACE_EXIT_EVENT(sname) \ + static const struct syscall_metadata __syscall_meta_##sname; \ +- static struct ftrace_event_call event_exit_##sname; \ ++ static struct ftrace_event_call \ ++ __attribute__((__aligned__(4))) event_exit_##sname; \ + static struct trace_event exit_syscall_print_##sname = { \ + .trace = print_syscall_exit, \ + }; \ +diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h +index c6fe03e..1ca4990 100644 +--- a/include/trace/ftrace.h ++++ b/include/trace/ftrace.h +@@ -65,7 +65,8 @@ + }; + #undef DEFINE_EVENT + #define DEFINE_EVENT(template, name, proto, args) \ +- static struct ftrace_event_call event_##name ++ static struct ftrace_event_call \ ++ __attribute__((__aligned__(4))) event_##name + + #undef DEFINE_EVENT_PRINT + #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ +diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c +index ecc3fa2..d70394f 100644 +--- a/kernel/irq/chip.c ++++ b/kernel/irq/chip.c +@@ -18,11 +18,7 @@ + + #include "internals.h" + +-/** +- * dynamic_irq_init - initialize a dynamically allocated irq +- * @irq: irq number to initialize +- */ +-void dynamic_irq_init(unsigned int irq) ++static void dynamic_irq_init_x(unsigned int irq, bool keep_chip_data) + { + struct irq_desc *desc; + unsigned long flags; +@@ -41,7 +37,8 @@ void dynamic_irq_init(unsigned int irq) + desc->depth = 1; + desc->msi_desc = NULL; + desc->handler_data = NULL; +- desc->chip_data = NULL; ++ if (!keep_chip_data) ++ desc->chip_data = NULL; + desc->action = NULL; + desc->irq_count = 0; + desc->irqs_unhandled = 0; +@@ -55,10 +52,26 @@ void dynamic_irq_init(unsigned int irq) + } + + /** +- * dynamic_irq_cleanup - cleanup a dynamically allocated irq ++ * dynamic_irq_init - initialize a dynamically allocated irq + * @irq: irq number to initialize + */ +-void dynamic_irq_cleanup(unsigned int irq) ++void dynamic_irq_init(unsigned int irq) ++{ ++ dynamic_irq_init_x(irq, false); ++} ++ ++/** ++ * dynamic_irq_init_keep_chip_data - initialize a dynamically allocated irq ++ * @irq: irq number to initialize ++ * ++ * does not set irq_to_desc(irq)->chip_data to NULL ++ */ ++void dynamic_irq_init_keep_chip_data(unsigned int irq) ++{ ++ dynamic_irq_init_x(irq, true); ++} ++ ++static void dynamic_irq_cleanup_x(unsigned int irq, bool keep_chip_data) + { + struct irq_desc *desc = irq_to_desc(irq); + unsigned long flags; +@@ -77,7 +90,8 @@ void dynamic_irq_cleanup(unsigned int irq) + } + desc->msi_desc = NULL; + desc->handler_data = NULL; +- desc->chip_data = NULL; ++ if (!keep_chip_data) ++ desc->chip_data = NULL; + desc->handle_irq = handle_bad_irq; + desc->chip = &no_irq_chip; + desc->name = NULL; +@@ -85,6 +99,26 @@ void dynamic_irq_cleanup(unsigned int irq) + raw_spin_unlock_irqrestore(&desc->lock, flags); + } + ++/** ++ * dynamic_irq_cleanup - cleanup a dynamically allocated irq ++ * @irq: irq number to initialize ++ */ ++void dynamic_irq_cleanup(unsigned int irq) ++{ ++ dynamic_irq_cleanup_x(irq, false); ++} ++ ++/** ++ * dynamic_irq_cleanup_keep_chip_data - cleanup a dynamically allocated irq ++ * @irq: irq number to initialize ++ * ++ * does not set irq_to_desc(irq)->chip_data to NULL ++ */ ++void dynamic_irq_cleanup_keep_chip_data(unsigned int irq) ++{ ++ dynamic_irq_cleanup_x(irq, true); ++} ++ + + /** + * set_irq_chip - set the irq chip for an irq +diff --git a/kernel/perf_event.c b/kernel/perf_event.c +index 2ae7409..b707465 100644 +--- a/kernel/perf_event.c ++++ b/kernel/perf_event.c +@@ -248,7 +248,7 @@ static void perf_unpin_context(struct perf_event_context *ctx) + + static inline u64 perf_clock(void) + { +- return cpu_clock(smp_processor_id()); ++ return cpu_clock(raw_smp_processor_id()); + } + + /* +@@ -1350,14 +1350,83 @@ static void perf_event_cpu_sched_in(struct perf_cpu_context *cpuctx, int cpu) + + static void perf_log_throttle(struct perf_event *event, int enable); + +-static void perf_adjust_period(struct perf_event *event, u64 events) ++static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) ++{ ++ u64 frequency = event->attr.sample_freq; ++ u64 sec = NSEC_PER_SEC; ++ u64 divisor, dividend; ++ ++ int count_fls, nsec_fls, frequency_fls, sec_fls; ++ ++ count_fls = fls64(count); ++ nsec_fls = fls64(nsec); ++ frequency_fls = fls64(frequency); ++ sec_fls = 30; ++ ++ /* ++ * We got @count in @nsec, with a target of sample_freq HZ ++ * the target period becomes: ++ * ++ * @count * 10^9 ++ * period = ------------------- ++ * @nsec * sample_freq ++ * ++ */ ++ ++ /* ++ * Reduce accuracy by one bit such that @a and @b converge ++ * to a similar magnitude. ++ */ ++#define REDUCE_FLS(a, b) \ ++do { \ ++ if (a##_fls > b##_fls) { \ ++ a >>= 1; \ ++ a##_fls--; \ ++ } else { \ ++ b >>= 1; \ ++ b##_fls--; \ ++ } \ ++} while (0) ++ ++ /* ++ * Reduce accuracy until either term fits in a u64, then proceed with ++ * the other, so that finally we can do a u64/u64 division. ++ */ ++ while (count_fls + sec_fls > 64 && nsec_fls + frequency_fls > 64) { ++ REDUCE_FLS(nsec, frequency); ++ REDUCE_FLS(sec, count); ++ } ++ ++ if (count_fls + sec_fls > 64) { ++ divisor = nsec * frequency; ++ ++ while (count_fls + sec_fls > 64) { ++ REDUCE_FLS(count, sec); ++ divisor >>= 1; ++ } ++ ++ dividend = count * sec; ++ } else { ++ dividend = count * sec; ++ ++ while (nsec_fls + frequency_fls > 64) { ++ REDUCE_FLS(nsec, frequency); ++ dividend >>= 1; ++ } ++ ++ divisor = nsec * frequency; ++ } ++ ++ return div64_u64(dividend, divisor); ++} ++ ++static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count) + { + struct hw_perf_event *hwc = &event->hw; + u64 period, sample_period; + s64 delta; + +- events *= hwc->sample_period; +- period = div64_u64(events, event->attr.sample_freq); ++ period = perf_calculate_period(event, nsec, count); + + delta = (s64)(period - hwc->sample_period); + delta = (delta + 7) / 8; /* low pass filter */ +@@ -1368,13 +1437,22 @@ static void perf_adjust_period(struct perf_event *event, u64 events) + sample_period = 1; + + hwc->sample_period = sample_period; ++ ++ if (atomic64_read(&hwc->period_left) > 8*sample_period) { ++ perf_disable(); ++ event->pmu->disable(event); ++ atomic64_set(&hwc->period_left, 0); ++ event->pmu->enable(event); ++ perf_enable(); ++ } + } + + static void perf_ctx_adjust_freq(struct perf_event_context *ctx) + { + struct perf_event *event; + struct hw_perf_event *hwc; +- u64 interrupts, freq; ++ u64 interrupts, now; ++ s64 delta; + + raw_spin_lock(&ctx->lock); + list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { +@@ -1395,44 +1473,18 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx) + if (interrupts == MAX_INTERRUPTS) { + perf_log_throttle(event, 1); + event->pmu->unthrottle(event); +- interrupts = 2*sysctl_perf_event_sample_rate/HZ; + } + + if (!event->attr.freq || !event->attr.sample_freq) + continue; + +- /* +- * if the specified freq < HZ then we need to skip ticks +- */ +- if (event->attr.sample_freq < HZ) { +- freq = event->attr.sample_freq; +- +- hwc->freq_count += freq; +- hwc->freq_interrupts += interrupts; +- +- if (hwc->freq_count < HZ) +- continue; +- +- interrupts = hwc->freq_interrupts; +- hwc->freq_interrupts = 0; +- hwc->freq_count -= HZ; +- } else +- freq = HZ; +- +- perf_adjust_period(event, freq * interrupts); ++ event->pmu->read(event); ++ now = atomic64_read(&event->count); ++ delta = now - hwc->freq_count_stamp; ++ hwc->freq_count_stamp = now; + +- /* +- * In order to avoid being stalled by an (accidental) huge +- * sample period, force reset the sample period if we didn't +- * get any events in this freq period. +- */ +- if (!interrupts) { +- perf_disable(); +- event->pmu->disable(event); +- atomic64_set(&hwc->period_left, 0); +- event->pmu->enable(event); +- perf_enable(); +- } ++ if (delta > 0) ++ perf_adjust_period(event, TICK_NSEC, delta); + } + raw_spin_unlock(&ctx->lock); + } +@@ -3688,12 +3740,12 @@ static int __perf_event_overflow(struct perf_event *event, int nmi, + + if (event->attr.freq) { + u64 now = perf_clock(); +- s64 delta = now - hwc->freq_stamp; ++ s64 delta = now - hwc->freq_time_stamp; + +- hwc->freq_stamp = now; ++ hwc->freq_time_stamp = now; + +- if (delta > 0 && delta < TICK_NSEC) +- perf_adjust_period(event, NSEC_PER_SEC / (int)delta); ++ if (delta > 0 && delta < 2*TICK_NSEC) ++ perf_adjust_period(event, delta, hwc->last_period); + } + + /* +diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c +index 36cb168..fc9ed15 100644 +--- a/kernel/power/snapshot.c ++++ b/kernel/power/snapshot.c +@@ -1181,7 +1181,7 @@ static void free_unnecessary_pages(void) + + memory_bm_position_reset(©_bm); + +- while (to_free_normal > 0 && to_free_highmem > 0) { ++ while (to_free_normal > 0 || to_free_highmem > 0) { + unsigned long pfn = memory_bm_next_pfn(©_bm); + struct page *page = pfn_to_page(pfn); + +diff --git a/kernel/sched.c b/kernel/sched.c +index 3a8fb30..00a59b0 100644 +--- a/kernel/sched.c ++++ b/kernel/sched.c +@@ -4119,12 +4119,23 @@ find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle, + continue; + + rq = cpu_rq(i); +- wl = weighted_cpuload(i) * SCHED_LOAD_SCALE; +- wl /= power; ++ wl = weighted_cpuload(i); + ++ /* ++ * When comparing with imbalance, use weighted_cpuload() ++ * which is not scaled with the cpu power. ++ */ + if (capacity && rq->nr_running == 1 && wl > imbalance) + continue; + ++ /* ++ * For the load comparisons with the other cpu's, consider ++ * the weighted_cpuload() scaled with the cpu power, so that ++ * the load can be moved away from the cpu that is potentially ++ * running at a lower capacity. ++ */ ++ wl = (wl * SCHED_LOAD_SCALE) / power; ++ + if (wl > max_load) { + max_load = wl; + busiest = rq; +@@ -6054,7 +6065,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio) + unsigned long flags; + int oldprio, on_rq, running; + struct rq *rq; +- const struct sched_class *prev_class = p->sched_class; ++ const struct sched_class *prev_class; + + BUG_ON(prio < 0 || prio > MAX_PRIO); + +@@ -6062,6 +6073,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio) + update_rq_clock(rq); + + oldprio = p->prio; ++ prev_class = p->sched_class; + on_rq = p->se.on_rq; + running = task_current(rq, p); + if (on_rq) +@@ -6281,7 +6293,7 @@ static int __sched_setscheduler(struct task_struct *p, int policy, + { + int retval, oldprio, oldpolicy = -1, on_rq, running; + unsigned long flags; +- const struct sched_class *prev_class = p->sched_class; ++ const struct sched_class *prev_class; + struct rq *rq; + int reset_on_fork; + +@@ -6395,6 +6407,7 @@ recheck: + p->sched_reset_on_fork = reset_on_fork; + + oldprio = p->prio; ++ prev_class = p->sched_class; + __setscheduler(rq, p, policy, param->sched_priority); + + if (running) +diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h +index 4df6a77..a1edaa8 100644 +--- a/kernel/trace/trace.h ++++ b/kernel/trace/trace.h +@@ -791,7 +791,8 @@ extern const char *__stop___trace_bprintk_fmt[]; + + #undef FTRACE_ENTRY + #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ +- extern struct ftrace_event_call event_##call; ++ extern struct ftrace_event_call \ ++ __attribute__((__aligned__(4))) event_##call; + #undef FTRACE_ENTRY_DUP + #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \ + FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) +diff --git a/mm/fadvise.c b/mm/fadvise.c +index e433592..8d723c9 100644 +--- a/mm/fadvise.c ++++ b/mm/fadvise.c +@@ -77,12 +77,20 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) + switch (advice) { + case POSIX_FADV_NORMAL: + file->f_ra.ra_pages = bdi->ra_pages; ++ spin_lock(&file->f_lock); ++ file->f_mode &= ~FMODE_RANDOM; ++ spin_unlock(&file->f_lock); + break; + case POSIX_FADV_RANDOM: +- file->f_ra.ra_pages = 0; ++ spin_lock(&file->f_lock); ++ file->f_mode |= FMODE_RANDOM; ++ spin_unlock(&file->f_lock); + break; + case POSIX_FADV_SEQUENTIAL: + file->f_ra.ra_pages = bdi->ra_pages * 2; ++ spin_lock(&file->f_lock); ++ file->f_mode &= ~FMODE_RANDOM; ++ spin_unlock(&file->f_lock); + break; + case POSIX_FADV_WILLNEED: + if (!mapping->a_ops->readpage) { +diff --git a/mm/readahead.c b/mm/readahead.c +index 033bc13..337b20e 100644 +--- a/mm/readahead.c ++++ b/mm/readahead.c +@@ -501,6 +501,12 @@ void page_cache_sync_readahead(struct address_space *mapping, + if (!ra->ra_pages) + return; + ++ /* be dumb */ ++ if (filp->f_mode & FMODE_RANDOM) { ++ force_page_cache_readahead(mapping, filp, offset, req_size); ++ return; ++ } ++ + /* do read-ahead */ + ondemand_readahead(mapping, ra, filp, false, offset, req_size); + } +diff --git a/mm/slab.c b/mm/slab.c +index 7451bda..ff44eb2 100644 +--- a/mm/slab.c ++++ b/mm/slab.c +@@ -983,13 +983,11 @@ static struct array_cache **alloc_alien_cache(int node, int limit, gfp_t gfp) + + if (limit > 1) + limit = 12; +- ac_ptr = kmalloc_node(memsize, gfp, node); ++ ac_ptr = kzalloc_node(memsize, gfp, node); + if (ac_ptr) { + for_each_node(i) { +- if (i == node || !node_online(i)) { +- ac_ptr[i] = NULL; ++ if (i == node || !node_online(i)) + continue; +- } + ac_ptr[i] = alloc_arraycache(node, limit, 0xbaadf00d, gfp); + if (!ac_ptr[i]) { + for (i--; i >= 0; i--) +diff --git a/net/core/scm.c b/net/core/scm.c +index b7ba91b..9b26463 100644 +--- a/net/core/scm.c ++++ b/net/core/scm.c +@@ -156,6 +156,8 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p) + switch (cmsg->cmsg_type) + { + case SCM_RIGHTS: ++ if (!sock->ops || sock->ops->family != PF_UNIX) ++ goto error; + err=scm_fp_copy(cmsg, &p->fp); + if (err<0) + goto error; +diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c +index 5e3a7ec..304b0b6 100644 +--- a/net/mac80211/agg-tx.c ++++ b/net/mac80211/agg-tx.c +@@ -179,7 +179,8 @@ static void sta_addba_resp_timer_expired(unsigned long data) + + /* check if the TID waits for addBA response */ + spin_lock_bh(&sta->lock); +- if ((*state & (HT_ADDBA_REQUESTED_MSK | HT_ADDBA_RECEIVED_MSK)) != ++ if ((*state & (HT_ADDBA_REQUESTED_MSK | HT_ADDBA_RECEIVED_MSK | ++ HT_AGG_STATE_REQ_STOP_BA_MSK)) != + HT_ADDBA_REQUESTED_MSK) { + spin_unlock_bh(&sta->lock); + *state = HT_AGG_STATE_IDLE; +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 82a30c1..da92cde 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1788,6 +1788,7 @@ static ieee80211_rx_result debug_noinline + ieee80211_rx_h_data(struct ieee80211_rx_data *rx) + { + struct ieee80211_sub_if_data *sdata = rx->sdata; ++ struct ieee80211_local *local = rx->local; + struct net_device *dev = sdata->dev; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; + __le16 fc = hdr->frame_control; +@@ -1819,6 +1820,13 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx) + dev->stats.rx_packets++; + dev->stats.rx_bytes += rx->skb->len; + ++ if (ieee80211_is_data(hdr->frame_control) && ++ !is_multicast_ether_addr(hdr->addr1) && ++ local->hw.conf.dynamic_ps_timeout > 0 && local->ps_sdata) { ++ mod_timer(&local->dynamic_ps_timer, jiffies + ++ msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); ++ } ++ + ieee80211_deliver_skb(rx); + + return RX_QUEUED; +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index ac210b5..70c79c3 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -1052,8 +1052,11 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, + + hdr = (struct ieee80211_hdr *) skb->data; + +- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) ++ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { + tx->sta = rcu_dereference(sdata->u.vlan.sta); ++ if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) ++ return TX_DROP; ++ } + if (!tx->sta) + tx->sta = sta_info_get(local, hdr->addr1); + +diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c +index fc70a49..43e83a4 100644 +--- a/net/netfilter/xt_recent.c ++++ b/net/netfilter/xt_recent.c +@@ -173,10 +173,10 @@ recent_entry_init(struct recent_table *t, const union nf_inet_addr *addr, + + static void recent_entry_update(struct recent_table *t, struct recent_entry *e) + { ++ e->index %= ip_pkt_list_tot; + e->stamps[e->index++] = jiffies; + if (e->index > e->nstamps) + e->nstamps = e->index; +- e->index %= ip_pkt_list_tot; + list_move_tail(&e->lru_list, &t->lru_list); + } + +@@ -260,7 +260,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par) + for (i = 0; i < e->nstamps; i++) { + if (info->seconds && time_after(time, e->stamps[i])) + continue; +- if (++hits >= info->hit_count) { ++ if (info->hit_count && ++hits >= info->hit_count) { + ret = !ret; + break; + } +diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c +index 7d1f9e9..4f30336 100644 +--- a/net/sunrpc/svc_xprt.c ++++ b/net/sunrpc/svc_xprt.c +@@ -889,11 +889,8 @@ void svc_delete_xprt(struct svc_xprt *xprt) + if (test_bit(XPT_TEMP, &xprt->xpt_flags)) + serv->sv_tmpcnt--; + +- for (dr = svc_deferred_dequeue(xprt); dr; +- dr = svc_deferred_dequeue(xprt)) { +- svc_xprt_put(xprt); ++ while ((dr = svc_deferred_dequeue(xprt)) != NULL) + kfree(dr); +- } + + svc_xprt_put(xprt); + spin_unlock_bh(&serv->sv_lock); +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c +index 3d739e5..4df801d 100644 +--- a/net/sunrpc/xprtsock.c ++++ b/net/sunrpc/xprtsock.c +@@ -1912,6 +1912,11 @@ static void xs_tcp_setup_socket(struct rpc_xprt *xprt, + case -EALREADY: + xprt_clear_connecting(xprt); + return; ++ case -EINVAL: ++ /* Happens, for instance, if the user specified a link ++ * local IPv6 address without a scope-id. ++ */ ++ goto out; + } + out_eagain: + status = -EAGAIN; +diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl +index 2f3230d..049c419 100755 +--- a/scripts/get_maintainer.pl ++++ b/scripts/get_maintainer.pl +@@ -314,6 +314,7 @@ foreach my $file (@files) { + if ($type eq 'X') { + if (file_match_pattern($file, $value)) { + $exclude = 1; ++ last; + } + } + } +@@ -340,8 +341,7 @@ foreach my $file (@files) { + } + } + +- $tvi += ($end - $start); +- ++ $tvi = $end + 1; + } + + foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { +diff --git a/security/integrity/ima/ima_iint.c b/security/integrity/ima/ima_iint.c +index 0d83edc..2d4d05d 100644 +--- a/security/integrity/ima/ima_iint.c ++++ b/security/integrity/ima/ima_iint.c +@@ -63,12 +63,11 @@ int ima_inode_alloc(struct inode *inode) + spin_lock(&ima_iint_lock); + rc = radix_tree_insert(&ima_iint_store, (unsigned long)inode, iint); + spin_unlock(&ima_iint_lock); ++ radix_tree_preload_end(); + out: + if (rc < 0) + kmem_cache_free(iint_cache, iint); + +- radix_tree_preload_end(); +- + return rc; + } + +diff --git a/security/selinux/ss/ebitmap.c b/security/selinux/ss/ebitmap.c +index 68c7348..04b6145 100644 +--- a/security/selinux/ss/ebitmap.c ++++ b/security/selinux/ss/ebitmap.c +@@ -128,7 +128,7 @@ int ebitmap_netlbl_export(struct ebitmap *ebmap, + cmap_idx = delta / NETLBL_CATMAP_MAPSIZE; + cmap_sft = delta % NETLBL_CATMAP_MAPSIZE; + c_iter->bitmap[cmap_idx] +- |= e_iter->maps[cmap_idx] << cmap_sft; ++ |= e_iter->maps[i] << cmap_sft; + } + e_iter = e_iter->next; + } +diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c +index 25b0641..f7e1c9f 100644 +--- a/sound/core/pcm_native.c ++++ b/sound/core/pcm_native.c +@@ -315,10 +315,10 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream, + if (!params->info) + params->info = hw->info & ~SNDRV_PCM_INFO_FIFO_IN_FRAMES; + if (!params->fifo_size) { +- if (snd_mask_min(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT]) == +- snd_mask_max(¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT]) && +- snd_mask_min(¶ms->masks[SNDRV_PCM_HW_PARAM_CHANNELS]) == +- snd_mask_max(¶ms->masks[SNDRV_PCM_HW_PARAM_CHANNELS])) { ++ m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); ++ i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); ++ if (snd_mask_min(m) == snd_mask_max(m) && ++ snd_interval_min(i) == snd_interval_max(i)) { + changed = substream->ops->ioctl(substream, + SNDRV_PCM_IOCTL1_FIFO_SIZE, params); + if (changed < 0) +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index ff6da6f..6d6e307 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2261,9 +2261,12 @@ static int azx_dev_free(struct snd_device *device) + static struct snd_pci_quirk position_fix_list[] __devinitdata = { + SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), ++ SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), + SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), ++ SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), ++ SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), + {} + }; + +diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c +index 69a941c..7069441 100644 +--- a/sound/pci/hda/patch_analog.c ++++ b/sound/pci/hda/patch_analog.c +@@ -1008,7 +1008,7 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), + SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), + SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_3STACK), +- SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), ++ SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40-10Q", AD1986A_3STACK), + SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), + SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), + SND_PCI_QUIRK(0x144d, 0xc024, "Samsung P50", AD1986A_SAMSUNG_P50), +diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c +index 8a332d2..03d6aea 100644 +--- a/sound/pci/via82xx.c ++++ b/sound/pci/via82xx.c +@@ -1791,6 +1791,12 @@ static struct ac97_quirk ac97_quirks[] = { + .type = AC97_TUNE_HP_ONLY + }, + { ++ .subvendor = 0x110a, ++ .subdevice = 0x0079, ++ .name = "Fujitsu Siemens D1289", ++ .type = AC97_TUNE_HP_ONLY ++ }, ++ { + .subvendor = 0x1019, + .subdevice = 0x0a81, + .name = "ECS K7VTA3", +diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c +index 3a14c6f..0f439ab 100644 +--- a/sound/soc/codecs/ak4104.c ++++ b/sound/soc/codecs/ak4104.c +@@ -90,12 +90,10 @@ static int ak4104_spi_write(struct snd_soc_codec *codec, unsigned int reg, + if (reg >= codec->reg_cache_size) + return -EINVAL; + +- reg &= AK4104_REG_MASK; +- reg |= AK4104_WRITE; +- + /* only write to the hardware if value has changed */ + if (cache[reg] != value) { +- u8 tmp[2] = { reg, value }; ++ u8 tmp[2] = { (reg & AK4104_REG_MASK) | AK4104_WRITE, value }; ++ + if (spi_write(spi, tmp, sizeof(tmp))) { + dev_err(&spi->dev, "SPI write failed\n"); + return -EIO; +diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c +index 9edef46..3c81add 100644 +--- a/sound/usb/usbaudio.c ++++ b/sound/usb/usbaudio.c +@@ -3327,6 +3327,32 @@ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev) + } + + /* ++ * This call will put the synth in "USB send" mode, i.e it will send MIDI ++ * messages through USB (this is disabled at startup). The synth will ++ * acknowledge by sending a sysex on endpoint 0x85 and by displaying a USB ++ * sign on its LCD. Values here are chosen based on sniffing USB traffic ++ * under Windows. ++ */ ++static int snd_usb_accessmusic_boot_quirk(struct usb_device *dev) ++{ ++ int err, actual_length; ++ ++ /* "midi send" enable */ ++ static const u8 seq[] = { 0x4e, 0x73, 0x52, 0x01 }; ++ ++ void *buf = kmemdup(seq, ARRAY_SIZE(seq), GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ err = usb_interrupt_msg(dev, usb_sndintpipe(dev, 0x05), buf, ++ ARRAY_SIZE(seq), &actual_length, 1000); ++ kfree(buf); ++ if (err < 0) ++ return err; ++ ++ return 0; ++} ++ ++/* + * Setup quirks + */ + #define AUDIOPHILE_SET 0x01 /* if set, parse device_setup */ +@@ -3624,6 +3650,12 @@ static void *snd_usb_audio_probe(struct usb_device *dev, + goto __err_val; + } + ++ /* Access Music VirusTI Desktop */ ++ if (id == USB_ID(0x133e, 0x0815)) { ++ if (snd_usb_accessmusic_boot_quirk(dev) < 0) ++ goto __err_val; ++ } ++ + /* + * found a config. now register to ALSA + */ +diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c +index 6e89b83..b2da478 100644 +--- a/sound/usb/usbmidi.c ++++ b/sound/usb/usbmidi.c +@@ -1162,10 +1162,22 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, + pipe = usb_sndintpipe(umidi->dev, ep_info->out_ep); + else + pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep); +- if (umidi->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ +- ep->max_transfer = 4; +- else ++ switch (umidi->usb_id) { ++ default: + ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1); ++ break; ++ /* ++ * Various chips declare a packet size larger than 4 bytes, but ++ * do not actually work with larger packets: ++ */ ++ case USB_ID(0x0a92, 0x1020): /* ESI M4U */ ++ case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */ ++ case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ ++ case USB_ID(0x15ca, 0x1806): /* Textech USB Midi Cable */ ++ case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */ ++ ep->max_transfer = 4; ++ break; ++ } + for (i = 0; i < OUTPUT_URBS; ++i) { + buffer = usb_buffer_alloc(umidi->dev, + ep->max_transfer, GFP_KERNEL, +@@ -1407,6 +1419,12 @@ static struct port_info { + EXTERNAL_PORT(0x086a, 0x0001, 8, "%s Broadcast"), + EXTERNAL_PORT(0x086a, 0x0002, 8, "%s Broadcast"), + EXTERNAL_PORT(0x086a, 0x0003, 4, "%s Broadcast"), ++ /* Access Music Virus TI */ ++ EXTERNAL_PORT(0x133e, 0x0815, 0, "%s MIDI"), ++ PORT_INFO(0x133e, 0x0815, 1, "%s Synth", 0, ++ SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | ++ SNDRV_SEQ_PORT_TYPE_HARDWARE | ++ SNDRV_SEQ_PORT_TYPE_SYNTHESIZER), + }; + + static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number) +diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h +index a892bda..406b74b 100644 +--- a/sound/usb/usbquirks.h ++++ b/sound/usb/usbquirks.h +@@ -2073,6 +2073,33 @@ YAMAHA_DEVICE(0x7010, "UB99"), + } + }, + ++/* Access Music devices */ ++{ ++ /* VirusTI Desktop */ ++ USB_DEVICE_VENDOR_SPEC(0x133e, 0x0815), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 3, ++ .type = QUIRK_MIDI_FIXED_ENDPOINT, ++ .data = &(const struct snd_usb_midi_endpoint_info) { ++ .out_cables = 0x0003, ++ .in_cables = 0x0003 ++ } ++ }, ++ { ++ .ifnum = 4, ++ .type = QUIRK_IGNORE_INTERFACE ++ }, ++ { ++ .ifnum = -1 ++ } ++ } ++ } ++}, ++ + /* */ + { + /* aka. Serato Scratch Live DJ Box */ +diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c +index ab92763..72547b9 100644 +--- a/tools/perf/util/symbol.c ++++ b/tools/perf/util/symbol.c +@@ -503,7 +503,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, + return -1; + + curr_map = map__new2(pos->start, dso, map->type); +- if (map == NULL) { ++ if (curr_map == NULL) { + dso__delete(dso); + return -1; + } From aa4f0f0b726056c8ec16c7861a420077fc4acbf7 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Wed, 17 Mar 2010 16:15:04 +0000 Subject: [PATCH 06/19] add NEWS file from sid branch svn path=/dists/trunk/linux-2.6/; revision=15416 --- debian/NEWS | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 debian/NEWS diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 000000000..d2c9aeeb4 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,23 @@ +linux-2.6 (2.6.32-10) unstable; urgency=low + + * The old IDE (PATA) drivers are no longer developed. Most PATA + controllers used in PCs (i386 and amd64 architectures) can be handled + by new drivers using 'libata', which is already used for SATA + controllers. This release enables all the new drivers that are + considered stable and disables the old drivers that they replace. + Other architectures should not be affected. + + While the old drivers presented device names beginning with 'hd', + libata makes PATA drives appear as SCSI devices and presents device + names beginning with 'sd' (hard drive), 'sr' (optical) or 'st' (tape). + In a system that already has other SCSI or SCSI-like devices, names + may change unpredictably. + + During the upgrade from earlier versions, you will be prompted to + update configuration files which refer to device names that may + change. You can choose to do this yourself or to follow an automatic + upgrade process. Unfortunately the automatic upgrade process does not + cover tape drives. All changed configuration files are backed up with + a suffix of '.old' (or '^old' in one case). + + -- Ben Hutchings Tue, 16 Mar 2010 04:15:37 +0000 From 096e5ba1e3dbbc8be7d52cf357d289114db286a0 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Wed, 17 Mar 2010 16:48:20 +0000 Subject: [PATCH 07/19] prepare to release 2.6.33-1~experimental.4 svn path=/dists/trunk/linux-2.6/; revision=15417 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 64e258350..e98a908c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -linux-2.6 (2.6.33-1~experimental.4) UNRELEASED; urgency=low +linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low [ Ben Hutchings ] * Include aufs2, marked as staging (Closes: #573189) @@ -9,7 +9,7 @@ linux-2.6 (2.6.33-1~experimental.4) UNRELEASED; urgency=low [ maximilian attems] * Add stable 2.6.33.1. - -- Ben Hutchings Sat, 13 Mar 2010 23:06:49 +0000 + -- maximilian attems Wed, 17 Mar 2010 17:47:28 +0100 linux-2.6 (2.6.33-1~experimental.3) experimental; urgency=low From ff395ad88aa438c6379a1280583e8cec50091b91 Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Wed, 17 Mar 2010 17:14:50 +0000 Subject: [PATCH 08/19] fix series file for gone patches renew changelog date stamp svn path=/dists/trunk/linux-2.6/; revision=15418 --- debian/changelog | 2 +- debian/patches/series/base | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index e98a908c4..f08a6333f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,7 +9,7 @@ linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low [ maximilian attems] * Add stable 2.6.33.1. - -- maximilian attems Wed, 17 Mar 2010 17:47:28 +0100 + -- maximilian attems Wed, 17 Mar 2010 18:13:53 +0100 linux-2.6 (2.6.33-1~experimental.3) experimental; urgency=low diff --git a/debian/patches/series/base b/debian/patches/series/base index e9c137bab..b079e8efd 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -40,8 +40,6 @@ + bugfix/mips/disable-werror.patch + bugfix/powerpc/lpar-console.patch #+ bugfix/all/wireless-regulatory-default-EU.patch -+ features/sparc/video-sunxvr500-intergraph.patch -+ bugfix/all/drivers-scsi-qla1280-request-firmware-unlocked.patch + debian/dfsg/radeon-add-clarifying-comment-to-r600-blit.patch + features/arm/compression-add-lzma.patch + features/arm/openrd-client.patch From 0f9ad99ba7b38f6e667e1a800cfd40f0b6f9f527 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Sat, 27 Mar 2010 08:11:33 +0000 Subject: [PATCH 09/19] Include Xen hypervisor in reportbug "related to" list. svn path=/dists/trunk/linux-2.6/; revision=15452 --- debian/changelog | 7 +++++++ debian/templates/image.plain.bug/control | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f08a6333f..5c1b6a168 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low + + [ Ian Campbell ] + * Include Xen hypervisor in reportbug "related to" list. + + -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 + linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low [ Ben Hutchings ] diff --git a/debian/templates/image.plain.bug/control b/debian/templates/image.plain.bug/control index d49f83d60..424185be1 100644 --- a/debian/templates/image.plain.bug/control +++ b/debian/templates/image.plain.bug/control @@ -1,2 +1,2 @@ Submit-As: linux-2.6 -Package-Status: firmware-bnx2 firmware-bnx2x firmware-ipw2x00 firmware-ivtv firmware-iwlwifi firmware-linux firmware-linux-nonfree firmware-qlogic firmware-ralink +Package-Status: firmware-bnx2 firmware-bnx2x firmware-ipw2x00 firmware-ivtv firmware-iwlwifi firmware-linux firmware-linux-nonfree firmware-qlogic firmware-ralink xen-hypervisor From 10205cf4e1d7c61eb943df98fe9036633bf8f88c Mon Sep 17 00:00:00 2001 From: Maximilian Attems Date: Sat, 3 Apr 2010 19:20:20 +0000 Subject: [PATCH 10/19] add stable 2.6.33.2 easy, no rejects.. :) svn path=/dists/trunk/linux-2.6/; revision=15477 --- debian/changelog | 3 + .../patches/bugfix/all/stable/2.6.33.2.patch | 6335 +++++++++++++++++ debian/patches/series/base | 1 + 3 files changed, 6339 insertions(+) create mode 100644 debian/patches/bugfix/all/stable/2.6.33.2.patch diff --git a/debian/changelog b/debian/changelog index 5c1b6a168..3adb5eeec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low [ Ian Campbell ] * Include Xen hypervisor in reportbug "related to" list. + [ maximilian attems] + * Add stable 2.6.33.2. + -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low diff --git a/debian/patches/bugfix/all/stable/2.6.33.2.patch b/debian/patches/bugfix/all/stable/2.6.33.2.patch new file mode 100644 index 000000000..abc2b1808 --- /dev/null +++ b/debian/patches/bugfix/all/stable/2.6.33.2.patch @@ -0,0 +1,6335 @@ +diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt +index 3015da0..fe09a2c 100644 +--- a/Documentation/filesystems/tmpfs.txt ++++ b/Documentation/filesystems/tmpfs.txt +@@ -82,11 +82,13 @@ tmpfs has a mount option to set the NUMA memory allocation policy for + all files in that instance (if CONFIG_NUMA is enabled) - which can be + adjusted on the fly via 'mount -o remount ...' + +-mpol=default prefers to allocate memory from the local node ++mpol=default use the process allocation policy ++ (see set_mempolicy(2)) + mpol=prefer:Node prefers to allocate memory from the given Node + mpol=bind:NodeList allocates memory only from nodes in NodeList + mpol=interleave prefers to allocate from each node in turn + mpol=interleave:NodeList allocates from each node of NodeList in turn ++mpol=local prefers to allocate memory from the local node + + NodeList format is a comma-separated list of decimal numbers and ranges, + a range being two hyphen-separated decimal numbers, the smallest and +@@ -134,3 +136,5 @@ Author: + Christoph Rohland , 1.12.01 + Updated: + Hugh Dickins, 4 June 2007 ++Updated: ++ KOSAKI Motohiro, 16 Mar 2010 +diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S +index 4fddc50..6b84a04 100644 +--- a/arch/arm/boot/compressed/head.S ++++ b/arch/arm/boot/compressed/head.S +@@ -170,8 +170,8 @@ not_angel: + + .text + adr r0, LC0 +- ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, ip, sp} ) +- THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, ip} ) ++ ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip, sp}) ++ THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip} ) + THUMB( ldr sp, [r0, #28] ) + subs r0, r0, r1 @ calculate the delta offset + +@@ -182,12 +182,13 @@ not_angel: + /* + * We're running at a different address. We need to fix + * up various pointers: +- * r5 - zImage base address +- * r6 - GOT start ++ * r5 - zImage base address (_start) ++ * r6 - size of decompressed image ++ * r11 - GOT start + * ip - GOT end + */ + add r5, r5, r0 +- add r6, r6, r0 ++ add r11, r11, r0 + add ip, ip, r0 + + #ifndef CONFIG_ZBOOT_ROM +@@ -205,10 +206,10 @@ not_angel: + /* + * Relocate all entries in the GOT table. + */ +-1: ldr r1, [r6, #0] @ relocate entries in the GOT ++1: ldr r1, [r11, #0] @ relocate entries in the GOT + add r1, r1, r0 @ table. This fixes up the +- str r1, [r6], #4 @ C references. +- cmp r6, ip ++ str r1, [r11], #4 @ C references. ++ cmp r11, ip + blo 1b + #else + +@@ -216,12 +217,12 @@ not_angel: + * Relocate entries in the GOT table. We only relocate + * the entries that are outside the (relocated) BSS region. + */ +-1: ldr r1, [r6, #0] @ relocate entries in the GOT ++1: ldr r1, [r11, #0] @ relocate entries in the GOT + cmp r1, r2 @ entry < bss_start || + cmphs r3, r1 @ _end < entry + addlo r1, r1, r0 @ table. This fixes up the +- str r1, [r6], #4 @ C references. +- cmp r6, ip ++ str r1, [r11], #4 @ C references. ++ cmp r11, ip + blo 1b + #endif + +@@ -247,6 +248,7 @@ not_relocated: mov r0, #0 + * Check to see if we will overwrite ourselves. + * r4 = final kernel address + * r5 = start of this image ++ * r6 = size of decompressed image + * r2 = end of malloc space (and therefore this image) + * We basically want: + * r4 >= r2 -> OK +@@ -254,8 +256,7 @@ not_relocated: mov r0, #0 + */ + cmp r4, r2 + bhs wont_overwrite +- sub r3, sp, r5 @ > compressed kernel size +- add r0, r4, r3, lsl #2 @ allow for 4x expansion ++ add r0, r4, r6 + cmp r0, r5 + bls wont_overwrite + +@@ -271,7 +272,6 @@ not_relocated: mov r0, #0 + * r1-r3 = unused + * r4 = kernel execution address + * r5 = decompressed kernel start +- * r6 = processor ID + * r7 = architecture ID + * r8 = atags pointer + * r9-r12,r14 = corrupted +@@ -312,7 +312,8 @@ LC0: .word LC0 @ r1 + .word _end @ r3 + .word zreladdr @ r4 + .word _start @ r5 +- .word _got_start @ r6 ++ .word _image_size @ r6 ++ .word _got_start @ r11 + .word _got_end @ ip + .word user_stack+4096 @ sp + LC1: .word reloc_end - reloc_start +@@ -336,7 +337,6 @@ params: ldr r0, =params_phys + * + * On entry, + * r4 = kernel execution address +- * r6 = processor ID + * r7 = architecture number + * r8 = atags pointer + * r9 = run-time address of "start" (???) +@@ -542,7 +542,6 @@ __common_mmu_cache_on: + * r1-r3 = unused + * r4 = kernel execution address + * r5 = decompressed kernel start +- * r6 = processor ID + * r7 = architecture ID + * r8 = atags pointer + * r9-r12,r14 = corrupted +@@ -581,19 +580,19 @@ call_kernel: bl cache_clean_flush + * r1 = corrupted + * r2 = corrupted + * r3 = block offset +- * r6 = corrupted ++ * r9 = corrupted + * r12 = corrupted + */ + + call_cache_fn: adr r12, proc_types + #ifdef CONFIG_CPU_CP15 +- mrc p15, 0, r6, c0, c0 @ get processor ID ++ mrc p15, 0, r9, c0, c0 @ get processor ID + #else +- ldr r6, =CONFIG_PROCESSOR_ID ++ ldr r9, =CONFIG_PROCESSOR_ID + #endif + 1: ldr r1, [r12, #0] @ get value + ldr r2, [r12, #4] @ get mask +- eor r1, r1, r6 @ (real ^ match) ++ eor r1, r1, r9 @ (real ^ match) + tst r1, r2 @ & mask + ARM( addeq pc, r12, r3 ) @ call cache function + THUMB( addeq r12, r3 ) +@@ -778,8 +777,7 @@ proc_types: + * Turn off the Cache and MMU. ARMv3 does not support + * reading the control register, but ARMv4 does. + * +- * On entry, r6 = processor ID +- * On exit, r0, r1, r2, r3, r12 corrupted ++ * On exit, r0, r1, r2, r3, r9, r12 corrupted + * This routine must preserve: r4, r6, r7 + */ + .align 5 +@@ -852,10 +850,8 @@ __armv3_mmu_cache_off: + /* + * Clean and flush the cache to maintain consistency. + * +- * On entry, +- * r6 = processor ID + * On exit, +- * r1, r2, r3, r11, r12 corrupted ++ * r1, r2, r3, r9, r11, r12 corrupted + * This routine must preserve: + * r0, r4, r5, r6, r7 + */ +@@ -967,7 +963,7 @@ __armv4_mmu_cache_flush: + mov r2, #64*1024 @ default: 32K dcache size (*2) + mov r11, #32 @ default: 32 byte line size + mrc p15, 0, r3, c0, c0, 1 @ read cache type +- teq r3, r6 @ cache ID register present? ++ teq r3, r9 @ cache ID register present? + beq no_cache_id + mov r1, r3, lsr #18 + and r1, r1, #7 +diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in +index a5924b9..cbed030 100644 +--- a/arch/arm/boot/compressed/vmlinux.lds.in ++++ b/arch/arm/boot/compressed/vmlinux.lds.in +@@ -36,6 +36,9 @@ SECTIONS + + _etext = .; + ++ /* Assume size of decompressed image is 4x the compressed image */ ++ _image_size = (_etext - _text) * 4; ++ + _got_start = .; + .got : { *(.got) } + _got_end = .; +diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c +index 1eb85fb..a3c0a32 100644 +--- a/arch/powerpc/kernel/perf_event.c ++++ b/arch/powerpc/kernel/perf_event.c +@@ -1164,10 +1164,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val, + * Finally record data if requested. + */ + if (record) { +- struct perf_sample_data data = { +- .addr = ~0ULL, +- .period = event->hw.last_period, +- }; ++ struct perf_sample_data data; ++ ++ perf_sample_data_init(&data, ~0ULL); ++ data.period = event->hw.last_period; + + if (event->attr.sample_type & PERF_SAMPLE_ADDR) + perf_get_data_addr(regs, &data.addr); +diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c +index b51b1fc..d3cc94f 100644 +--- a/arch/sh/boot/compressed/misc.c ++++ b/arch/sh/boot/compressed/misc.c +@@ -132,7 +132,7 @@ void decompress_kernel(void) + output_addr = (CONFIG_MEMORY_START + 0x2000); + #else + output_addr = __pa((unsigned long)&_text+PAGE_SIZE); +-#ifdef CONFIG_29BIT ++#if defined(CONFIG_29BIT) || defined(CONFIG_PMB_LEGACY) + output_addr |= P2SEG; + #endif + #endif +diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c +index e856456..8c70d3e 100644 +--- a/arch/sparc/kernel/perf_event.c ++++ b/arch/sparc/kernel/perf_event.c +@@ -1189,7 +1189,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self, + + regs = args->regs; + +- data.addr = 0; ++ perf_sample_data_init(&data, 0); + + cpuc = &__get_cpu_var(cpu_hw_events); + +@@ -1337,7 +1337,7 @@ static void perf_callchain_user_32(struct pt_regs *regs, + callchain_store(entry, PERF_CONTEXT_USER); + callchain_store(entry, regs->tpc); + +- ufp = regs->u_regs[UREG_I6]; ++ ufp = regs->u_regs[UREG_I6] & 0xffffffffUL; + do { + struct sparc_stackf32 *usf, sf; + unsigned long pc; +diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c +index 4b7c937..2d8b70d 100644 +--- a/arch/sparc/prom/p1275.c ++++ b/arch/sparc/prom/p1275.c +@@ -32,10 +32,9 @@ extern void prom_cif_interface(void); + extern void prom_cif_callback(void); + + /* +- * This provides SMP safety on the p1275buf. prom_callback() drops this lock +- * to allow recursuve acquisition. ++ * This provides SMP safety on the p1275buf. + */ +-DEFINE_SPINLOCK(prom_entry_lock); ++DEFINE_RAW_SPINLOCK(prom_entry_lock); + + long p1275_cmd(const char *service, long fmt, ...) + { +@@ -47,7 +46,9 @@ long p1275_cmd(const char *service, long fmt, ...) + + p = p1275buf.prom_buffer; + +- spin_lock_irqsave(&prom_entry_lock, flags); ++ raw_local_save_flags(flags); ++ raw_local_irq_restore(PIL_NMI); ++ raw_spin_lock(&prom_entry_lock); + + p1275buf.prom_args[0] = (unsigned long)p; /* service */ + strcpy (p, service); +@@ -139,7 +140,8 @@ long p1275_cmd(const char *service, long fmt, ...) + va_end(list); + x = p1275buf.prom_args [nargs + 3]; + +- spin_unlock_irqrestore(&prom_entry_lock, flags); ++ raw_spin_unlock(&prom_entry_lock); ++ raw_local_irq_restore(flags); + + return x; + } +diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h +index 14f9890..c22a164 100644 +--- a/arch/x86/include/asm/fixmap.h ++++ b/arch/x86/include/asm/fixmap.h +@@ -82,6 +82,9 @@ enum fixed_addresses { + #endif + FIX_DBGP_BASE, + FIX_EARLYCON_MEM_BASE, ++#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT ++ FIX_OHCI1394_BASE, ++#endif + #ifdef CONFIG_X86_LOCAL_APIC + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ + #endif +@@ -126,9 +129,6 @@ enum fixed_addresses { + FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 - + (__end_of_permanent_fixed_addresses & 255), + FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1, +-#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT +- FIX_OHCI1394_BASE, +-#endif + #ifdef CONFIG_X86_32 + FIX_WP_TEST, + #endif +diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h +index 1cd58cd..4604e6a 100644 +--- a/arch/x86/include/asm/msr-index.h ++++ b/arch/x86/include/asm/msr-index.h +@@ -105,6 +105,8 @@ + #define MSR_AMD64_PATCH_LEVEL 0x0000008b + #define MSR_AMD64_NB_CFG 0xc001001f + #define MSR_AMD64_PATCH_LOADER 0xc0010020 ++#define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140 ++#define MSR_AMD64_OSVW_STATUS 0xc0010141 + #define MSR_AMD64_IBSFETCHCTL 0xc0011030 + #define MSR_AMD64_IBSFETCHLINAD 0xc0011031 + #define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 +diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c +index 879666f..7e1cca1 100644 +--- a/arch/x86/kernel/cpu/intel.c ++++ b/arch/x86/kernel/cpu/intel.c +@@ -70,7 +70,8 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) + if (c->x86_power & (1 << 8)) { + set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); + set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); +- sched_clock_stable = 1; ++ if (!check_tsc_unstable()) ++ sched_clock_stable = 1; + } + + /* +diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c +index 8c1c070..98819b3 100644 +--- a/arch/x86/kernel/cpu/perf_event.c ++++ b/arch/x86/kernel/cpu/perf_event.c +@@ -1636,10 +1636,9 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc) + + ds->bts_index = ds->bts_buffer_base; + ++ perf_sample_data_init(&data, 0); + + data.period = event->hw.last_period; +- data.addr = 0; +- data.raw = NULL; + regs.ip = 0; + + /* +@@ -1756,8 +1755,7 @@ static int p6_pmu_handle_irq(struct pt_regs *regs) + int idx, handled = 0; + u64 val; + +- data.addr = 0; +- data.raw = NULL; ++ perf_sample_data_init(&data, 0); + + cpuc = &__get_cpu_var(cpu_hw_events); + +@@ -1802,8 +1800,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) + int bit, loops; + u64 ack, status; + +- data.addr = 0; +- data.raw = NULL; ++ perf_sample_data_init(&data, 0); + + cpuc = &__get_cpu_var(cpu_hw_events); + +diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c +index 0ad9597..a6c906c 100644 +--- a/arch/x86/kernel/dumpstack_64.c ++++ b/arch/x86/kernel/dumpstack_64.c +@@ -125,9 +125,15 @@ fixup_bp_irq_link(unsigned long bp, unsigned long *stack, + { + #ifdef CONFIG_FRAME_POINTER + struct stack_frame *frame = (struct stack_frame *)bp; ++ unsigned long next; + +- if (!in_irq_stack(stack, irq_stack, irq_stack_end)) +- return (unsigned long)frame->next_frame; ++ if (!in_irq_stack(stack, irq_stack, irq_stack_end)) { ++ if (!probe_kernel_address(&frame->next_frame, next)) ++ return next; ++ else ++ WARN_ONCE(1, "Perf: bad frame pointer = %p in " ++ "callchain\n", &frame->next_frame); ++ } + #endif + return bp; + } +diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c +index bb6006e..1e8cead 100644 +--- a/arch/x86/kernel/hw_breakpoint.c ++++ b/arch/x86/kernel/hw_breakpoint.c +@@ -531,8 +531,3 @@ void hw_breakpoint_pmu_read(struct perf_event *bp) + { + /* TODO */ + } +- +-void hw_breakpoint_pmu_unthrottle(struct perf_event *bp) +-{ +- /* TODO */ +-} +diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c +index c9b3522..999c8a6 100644 +--- a/arch/x86/kernel/process.c ++++ b/arch/x86/kernel/process.c +@@ -519,21 +519,37 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) + } + + /* +- * Check for AMD CPUs, which have potentially C1E support ++ * Check for AMD CPUs, where APIC timer interrupt does not wake up CPU from C1e. ++ * For more information see ++ * - Erratum #400 for NPT family 0xf and family 0x10 CPUs ++ * - Erratum #365 for family 0x11 (not affected because C1e not in use) + */ + static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c) + { ++ u64 val; + if (c->x86_vendor != X86_VENDOR_AMD) +- return 0; +- +- if (c->x86 < 0x0F) +- return 0; ++ goto no_c1e_idle; + + /* Family 0x0f models < rev F do not have C1E */ +- if (c->x86 == 0x0f && c->x86_model < 0x40) +- return 0; ++ if (c->x86 == 0x0F && c->x86_model >= 0x40) ++ return 1; + +- return 1; ++ if (c->x86 == 0x10) { ++ /* ++ * check OSVW bit for CPUs that are not affected ++ * by erratum #400 ++ */ ++ rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val); ++ if (val >= 2) { ++ rdmsrl(MSR_AMD64_OSVW_STATUS, val); ++ if (!(val & BIT(1))) ++ goto no_c1e_idle; ++ } ++ return 1; ++ } ++ ++no_c1e_idle: ++ return 0; + } + + static cpumask_var_t c1e_mask; +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c +index a1e1bc9..e900908 100644 +--- a/arch/x86/kvm/x86.c ++++ b/arch/x86/kvm/x86.c +@@ -1351,6 +1351,7 @@ int kvm_dev_ioctl_check_extension(long ext) + case KVM_CAP_XEN_HVM: + case KVM_CAP_ADJUST_CLOCK: + case KVM_CAP_VCPU_EVENTS: ++ case KVM_CAP_X86_ROBUST_SINGLESTEP: + r = 1; + break; + case KVM_CAP_COALESCED_MMIO: +diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c +index 1d4eb93..cf07c26 100644 +--- a/arch/x86/mm/pageattr.c ++++ b/arch/x86/mm/pageattr.c +@@ -291,8 +291,29 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, + */ + if (kernel_set_to_readonly && + within(address, (unsigned long)_text, +- (unsigned long)__end_rodata_hpage_align)) +- pgprot_val(forbidden) |= _PAGE_RW; ++ (unsigned long)__end_rodata_hpage_align)) { ++ unsigned int level; ++ ++ /* ++ * Don't enforce the !RW mapping for the kernel text mapping, ++ * if the current mapping is already using small page mapping. ++ * No need to work hard to preserve large page mappings in this ++ * case. ++ * ++ * This also fixes the Linux Xen paravirt guest boot failure ++ * (because of unexpected read-only mappings for kernel identity ++ * mappings). In this paravirt guest case, the kernel text ++ * mapping and the kernel identity mapping share the same ++ * page-table pages. Thus we can't really use different ++ * protections for the kernel text and identity mappings. Also, ++ * these shared mappings are made of small page mappings. ++ * Thus this don't enforce !RW mapping for small page kernel ++ * text mapping logic will help Linux Xen parvirt guest boot ++ * aswell. ++ */ ++ if (lookup_address(address, &level) && (level != PG_LEVEL_4K)) ++ pgprot_val(forbidden) |= _PAGE_RW; ++ } + #endif + + prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c +index a6a736a..9e2feb6 100644 +--- a/drivers/ata/ahci.c ++++ b/drivers/ata/ahci.c +@@ -2831,6 +2831,14 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + * On HP dv[4-6] and HDX18 with earlier BIOSen, link + * to the harddisk doesn't become online after + * resuming from STR. Warn and fail suspend. ++ * ++ * http://bugzilla.kernel.org/show_bug.cgi?id=12276 ++ * ++ * Use dates instead of versions to match as HP is ++ * apparently recycling both product and version ++ * strings. ++ * ++ * http://bugzilla.kernel.org/show_bug.cgi?id=15462 + */ + { + .ident = "dv4", +@@ -2839,7 +2847,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + DMI_MATCH(DMI_PRODUCT_NAME, + "HP Pavilion dv4 Notebook PC"), + }, +- .driver_data = "F.30", /* cutoff BIOS version */ ++ .driver_data = "20090105", /* F.30 */ + }, + { + .ident = "dv5", +@@ -2848,7 +2856,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + DMI_MATCH(DMI_PRODUCT_NAME, + "HP Pavilion dv5 Notebook PC"), + }, +- .driver_data = "F.16", /* cutoff BIOS version */ ++ .driver_data = "20090506", /* F.16 */ + }, + { + .ident = "dv6", +@@ -2857,7 +2865,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + DMI_MATCH(DMI_PRODUCT_NAME, + "HP Pavilion dv6 Notebook PC"), + }, +- .driver_data = "F.21", /* cutoff BIOS version */ ++ .driver_data = "20090423", /* F.21 */ + }, + { + .ident = "HDX18", +@@ -2866,7 +2874,7 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + DMI_MATCH(DMI_PRODUCT_NAME, + "HP HDX18 Notebook PC"), + }, +- .driver_data = "F.23", /* cutoff BIOS version */ ++ .driver_data = "20090430", /* F.23 */ + }, + /* + * Acer eMachines G725 has the same problem. BIOS +@@ -2874,6 +2882,8 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + * work. Inbetween, there are V1.06, V2.06 and V3.03 + * that we don't have much idea about. For now, + * blacklist anything older than V3.04. ++ * ++ * http://bugzilla.kernel.org/show_bug.cgi?id=15104 + */ + { + .ident = "G725", +@@ -2881,19 +2891,21 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) + DMI_MATCH(DMI_SYS_VENDOR, "eMachines"), + DMI_MATCH(DMI_PRODUCT_NAME, "eMachines G725"), + }, +- .driver_data = "V3.04", /* cutoff BIOS version */ ++ .driver_data = "20091216", /* V3.04 */ + }, + { } /* terminate list */ + }; + const struct dmi_system_id *dmi = dmi_first_match(sysids); +- const char *ver; ++ int year, month, date; ++ char buf[9]; + + if (!dmi || pdev->bus->number || pdev->devfn != PCI_DEVFN(0x1f, 2)) + return false; + +- ver = dmi_get_system_info(DMI_BIOS_VERSION); ++ dmi_get_date(DMI_BIOS_DATE, &year, &month, &date); ++ snprintf(buf, sizeof(buf), "%04d%02d%02d", year, month, date); + +- return !ver || strcmp(ver, dmi->driver_data) < 0; ++ return strcmp(buf, dmi->driver_data) < 0; + } + + static bool ahci_broken_online(struct pci_dev *pdev) +diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c +index 0d97890..be7c395 100644 +--- a/drivers/ata/pata_via.c ++++ b/drivers/ata/pata_via.c +@@ -588,6 +588,10 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) + u8 rev = isa->revision; + pci_dev_put(isa); + ++ if ((id->device == 0x0415 || id->device == 0x3164) && ++ (config->id != id->device)) ++ continue; ++ + if (rev >= config->rev_min && rev <= config->rev_max) + break; + } +diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c +index 66fa4e1..f27c4d6 100644 +--- a/drivers/char/tty_buffer.c ++++ b/drivers/char/tty_buffer.c +@@ -247,7 +247,8 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, + { + int copied = 0; + do { +- int space = tty_buffer_request_room(tty, size - copied); ++ int goal = min(size - copied, TTY_BUFFER_PAGE); ++ int space = tty_buffer_request_room(tty, goal); + struct tty_buffer *tb = tty->buf.tail; + /* If there is no space then tb may be NULL */ + if (unlikely(space == 0)) +@@ -283,7 +284,8 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, + { + int copied = 0; + do { +- int space = tty_buffer_request_room(tty, size - copied); ++ int goal = min(size - copied, TTY_BUFFER_PAGE); ++ int space = tty_buffer_request_room(tty, goal); + struct tty_buffer *tb = tty->buf.tail; + /* If there is no space then tb may be NULL */ + if (unlikely(space == 0)) +diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c +index 8fc91a0..f5b6d9f 100644 +--- a/drivers/edac/edac_mce_amd.c ++++ b/drivers/edac/edac_mce_amd.c +@@ -316,7 +316,12 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors) + if (regs->nbsh & K8_NBSH_ERR_CPU_VAL) + pr_cont(", core: %u\n", (u8)(regs->nbsh & 0xf)); + } else { +- pr_cont(", core: %d\n", fls((regs->nbsh & 0xf) - 1)); ++ u8 assoc_cpus = regs->nbsh & 0xf; ++ ++ if (assoc_cpus > 0) ++ pr_cont(", core: %d", fls(assoc_cpus) - 1); ++ ++ pr_cont("\n"); + } + + pr_emerg("%s.\n", EXT_ERR_MSG(xec)); +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c +index ec8a0d7..fd099a1 100644 +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -1470,9 +1470,6 @@ i915_gem_object_put_pages(struct drm_gem_object *obj) + obj_priv->dirty = 0; + + for (i = 0; i < page_count; i++) { +- if (obj_priv->pages[i] == NULL) +- break; +- + if (obj_priv->dirty) + set_page_dirty(obj_priv->pages[i]); + +@@ -2228,7 +2225,6 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, + struct address_space *mapping; + struct inode *inode; + struct page *page; +- int ret; + + if (obj_priv->pages_refcount++ != 0) + return 0; +@@ -2251,11 +2247,9 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, + mapping_gfp_mask (mapping) | + __GFP_COLD | + gfpmask); +- if (IS_ERR(page)) { +- ret = PTR_ERR(page); +- i915_gem_object_put_pages(obj); +- return ret; +- } ++ if (IS_ERR(page)) ++ goto err_pages; ++ + obj_priv->pages[i] = page; + } + +@@ -2263,6 +2257,15 @@ i915_gem_object_get_pages(struct drm_gem_object *obj, + i915_gem_object_do_bit_17_swizzle(obj); + + return 0; ++ ++err_pages: ++ while (i--) ++ page_cache_release(obj_priv->pages[i]); ++ ++ drm_free_large(obj_priv->pages); ++ obj_priv->pages = NULL; ++ obj_priv->pages_refcount--; ++ return PTR_ERR(page); + } + + static void i965_write_fence_reg(struct drm_i915_fence_reg *reg) +diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c +index 2639591..63f569b 100644 +--- a/drivers/gpu/drm/i915/intel_overlay.c ++++ b/drivers/gpu/drm/i915/intel_overlay.c +@@ -1083,14 +1083,18 @@ int intel_overlay_put_image(struct drm_device *dev, void *data, + + drmmode_obj = drm_mode_object_find(dev, put_image_rec->crtc_id, + DRM_MODE_OBJECT_CRTC); +- if (!drmmode_obj) +- return -ENOENT; ++ if (!drmmode_obj) { ++ ret = -ENOENT; ++ goto out_free; ++ } + crtc = to_intel_crtc(obj_to_crtc(drmmode_obj)); + + new_bo = drm_gem_object_lookup(dev, file_priv, + put_image_rec->bo_handle); +- if (!new_bo) +- return -ENOENT; ++ if (!new_bo) { ++ ret = -ENOENT; ++ goto out_free; ++ } + + mutex_lock(&dev->mode_config.mutex); + mutex_lock(&dev->struct_mutex); +@@ -1180,6 +1184,7 @@ out_unlock: + mutex_unlock(&dev->struct_mutex); + mutex_unlock(&dev->mode_config.mutex); + drm_gem_object_unreference(new_bo); ++out_free: + kfree(params); + + return ret; +diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c +index d2f6335..a378bc3 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_connector.c ++++ b/drivers/gpu/drm/nouveau/nouveau_connector.c +@@ -239,12 +239,14 @@ nouveau_connector_detect(struct drm_connector *connector) + if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) + nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS); + if (nv_encoder && nv_connector->native_mode) { ++ unsigned status = connector_status_connected; ++ + #ifdef CONFIG_ACPI + if (!nouveau_ignorelid && !acpi_lid_open()) +- return connector_status_disconnected; ++ status = connector_status_unknown; + #endif + nouveau_connector_set_encoder(connector, nv_encoder); +- return connector_status_connected; ++ return status; + } + + /* Cleanup the previous EDID block. */ +diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c +index 2d7bcee..cb4290a 100644 +--- a/drivers/hwmon/coretemp.c ++++ b/drivers/hwmon/coretemp.c +@@ -228,7 +228,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device * + if (err) { + dev_warn(dev, + "Unable to access MSR 0xEE, for Tjmax, left" +- " at default"); ++ " at default\n"); + } else if (eax & 0x40000000) { + tjmax = tjmax_ee; + } +diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c +index df6ab55..5574be2 100644 +--- a/drivers/i2c/busses/i2c-i801.c ++++ b/drivers/i2c/busses/i2c-i801.c +@@ -415,9 +415,11 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, + data->block[0] = 32; /* max for SMBus block reads */ + } + ++ /* Experience has shown that the block buffer can only be used for ++ SMBus (not I2C) block transactions, even though the datasheet ++ doesn't mention this limitation. */ + if ((i801_features & FEATURE_BLOCK_BUFFER) +- && !(command == I2C_SMBUS_I2C_BLOCK_DATA +- && read_write == I2C_SMBUS_READ) ++ && command != I2C_SMBUS_I2C_BLOCK_DATA + && i801_set_block_buffer_mode() == 0) + result = i801_block_transaction_by_block(data, read_write, + hwpec); +diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c +index 1c440a7..b289ec9 100644 +--- a/drivers/i2c/busses/i2c-powermac.c ++++ b/drivers/i2c/busses/i2c-powermac.c +@@ -122,9 +122,14 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap, + + rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); + if (rc) { +- dev_err(&adap->dev, +- "I2C transfer at 0x%02x failed, size %d, err %d\n", +- addrdir >> 1, size, rc); ++ if (rc == -ENXIO) ++ dev_dbg(&adap->dev, ++ "I2C transfer at 0x%02x failed, size %d, " ++ "err %d\n", addrdir >> 1, size, rc); ++ else ++ dev_err(&adap->dev, ++ "I2C transfer at 0x%02x failed, size %d, " ++ "err %d\n", addrdir >> 1, size, rc); + goto bail; + } + +@@ -175,10 +180,16 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, + goto bail; + } + rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); +- if (rc < 0) +- dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", +- addrdir & 1 ? "read from" : "write to", addrdir >> 1, +- rc); ++ if (rc < 0) { ++ if (rc == -ENXIO) ++ dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n", ++ addrdir & 1 ? "read from" : "write to", ++ addrdir >> 1, rc); ++ else ++ dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", ++ addrdir & 1 ? "read from" : "write to", ++ addrdir >> 1, rc); ++ } + bail: + pmac_i2c_close(bus); + return rc < 0 ? rc : 1; +diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c +index 0f67f1a..d7e6f09 100644 +--- a/drivers/ide/icside.c ++++ b/drivers/ide/icside.c +@@ -65,6 +65,8 @@ static struct cardinfo icside_cardinfo_v6_2 = { + }; + + struct icside_state { ++ unsigned int channel; ++ unsigned int enabled; + void __iomem *irq_port; + void __iomem *ioc_base; + unsigned int sel; +@@ -114,11 +116,18 @@ static void icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr) + struct icside_state *state = ec->irq_data; + void __iomem *base = state->irq_port; + +- writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1); +- readb(base + ICS_ARCIN_V6_INTROFFSET_2); ++ state->enabled = 1; + +- writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2); +- readb(base + ICS_ARCIN_V6_INTROFFSET_1); ++ switch (state->channel) { ++ case 0: ++ writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1); ++ readb(base + ICS_ARCIN_V6_INTROFFSET_2); ++ break; ++ case 1: ++ writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2); ++ readb(base + ICS_ARCIN_V6_INTROFFSET_1); ++ break; ++ } + } + + /* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) +@@ -128,6 +137,8 @@ static void icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr) + { + struct icside_state *state = ec->irq_data; + ++ state->enabled = 0; ++ + readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); + readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); + } +@@ -149,6 +160,44 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = { + .irqpending = icside_irqpending_arcin_v6, + }; + ++/* ++ * Handle routing of interrupts. This is called before ++ * we write the command to the drive. ++ */ ++static void icside_maskproc(ide_drive_t *drive, int mask) ++{ ++ ide_hwif_t *hwif = drive->hwif; ++ struct expansion_card *ec = ECARD_DEV(hwif->dev); ++ struct icside_state *state = ecard_get_drvdata(ec); ++ unsigned long flags; ++ ++ local_irq_save(flags); ++ ++ state->channel = hwif->channel; ++ ++ if (state->enabled && !mask) { ++ switch (hwif->channel) { ++ case 0: ++ writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); ++ readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); ++ break; ++ case 1: ++ writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); ++ readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); ++ break; ++ } ++ } else { ++ readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2); ++ readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1); ++ } ++ ++ local_irq_restore(flags); ++} ++ ++static const struct ide_port_ops icside_v6_no_dma_port_ops = { ++ .maskproc = icside_maskproc, ++}; ++ + #ifdef CONFIG_BLK_DEV_IDEDMA_ICS + /* + * SG-DMA support. +@@ -228,6 +277,7 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) + + static const struct ide_port_ops icside_v6_port_ops = { + .set_dma_mode = icside_set_dma_mode, ++ .maskproc = icside_maskproc, + }; + + static void icside_dma_host_set(ide_drive_t *drive, int on) +@@ -272,6 +322,11 @@ static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) + BUG_ON(dma_channel_active(ec->dma)); + + /* ++ * Ensure that we have the right interrupt routed. ++ */ ++ icside_maskproc(drive, 0); ++ ++ /* + * Route the DMA signals to the correct interface. + */ + writeb(state->sel | hwif->channel, state->ioc_base); +@@ -399,6 +454,7 @@ err_free: + + static const struct ide_port_info icside_v6_port_info __initdata = { + .init_dma = icside_dma_off_init, ++ .port_ops = &icside_v6_no_dma_port_ops, + .dma_ops = &icside_v6_dma_ops, + .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, + .mwdma_mask = ATA_MWDMA2, +diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c +index 4d76ba4..0c11237 100644 +--- a/drivers/ide/ide-probe.c ++++ b/drivers/ide/ide-probe.c +@@ -695,14 +695,8 @@ static int ide_probe_port(ide_hwif_t *hwif) + if (irqd) + disable_irq(hwif->irq); + +- rc = ide_port_wait_ready(hwif); +- if (rc == -ENODEV) { +- printk(KERN_INFO "%s: no devices on the port\n", hwif->name); +- goto out; +- } else if (rc == -EBUSY) +- printk(KERN_ERR "%s: not ready before the probe\n", hwif->name); +- else +- rc = -ENODEV; ++ if (ide_port_wait_ready(hwif) == -EBUSY) ++ printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name); + + /* + * Second drive should only exist if first drive was found, +@@ -713,7 +707,7 @@ static int ide_probe_port(ide_hwif_t *hwif) + if (drive->dev_flags & IDE_DFLAG_PRESENT) + rc = 0; + } +-out: ++ + /* + * Use cached IRQ number. It might be (and is...) changed by probe + * code above +diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c +index 35161dd..e3bca38 100644 +--- a/drivers/ide/pdc202xx_old.c ++++ b/drivers/ide/pdc202xx_old.c +@@ -100,13 +100,13 @@ static int pdc202xx_test_irq(ide_hwif_t *hwif) + * bit 7: error, bit 6: interrupting, + * bit 5: FIFO full, bit 4: FIFO empty + */ +- return ((sc1d & 0x50) == 0x40) ? 1 : 0; ++ return ((sc1d & 0x50) == 0x50) ? 1 : 0; + } else { + /* + * bit 3: error, bit 2: interrupting, + * bit 1: FIFO full, bit 0: FIFO empty + */ +- return ((sc1d & 0x05) == 0x04) ? 1 : 0; ++ return ((sc1d & 0x05) == 0x05) ? 1 : 0; + } + } + +diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c +index f93c2c0..f6dad83 100644 +--- a/drivers/input/mouse/alps.c ++++ b/drivers/input/mouse/alps.c +@@ -63,6 +63,8 @@ static const struct alps_model_info alps_model_data[] = { + { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, + ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, + { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ ++ { { 0x52, 0x01, 0x14 }, 0xff, 0xff, ++ ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ + }; + + /* +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h +index 2a5982e..525b9b9 100644 +--- a/drivers/input/serio/i8042-x86ia64io.h ++++ b/drivers/input/serio/i8042-x86ia64io.h +@@ -442,6 +442,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { + }, + }, + { ++ /* Medion Akoya E1222 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "E122X"), ++ }, ++ }, ++ { + /* Mivvy M310 */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), +diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c +index 3f5cd06..6b6c25d 100644 +--- a/drivers/isdn/gigaset/capi.c ++++ b/drivers/isdn/gigaset/capi.c +@@ -1313,7 +1313,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, + } + + /* check parameter: CIP Value */ +- if (cmsg->CIPValue > ARRAY_SIZE(cip2bchlc) || ++ if (cmsg->CIPValue >= ARRAY_SIZE(cip2bchlc) || + (cmsg->CIPValue > 0 && cip2bchlc[cmsg->CIPValue].bc == NULL)) { + dev_notice(cs->dev, "%s: unknown CIP value %d\n", + "CONNECT_REQ", cmsg->CIPValue); +@@ -2215,36 +2215,24 @@ static int gigaset_ctr_read_proc(char *page, char **start, off_t off, + } + + +-static struct capi_driver capi_driver_gigaset = { +- .name = "gigaset", +- .revision = "1.0", +-}; +- + /** +- * gigaset_isdn_register() - register to LL ++ * gigaset_isdn_regdev() - register device to LL + * @cs: device descriptor structure. + * @isdnid: device name. + * +- * Called by main module to register the device with the LL. +- * + * Return value: 1 for success, 0 for failure + */ +-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) ++int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) + { + struct gigaset_capi_ctr *iif; + int rc; + +- pr_info("Kernel CAPI interface\n"); +- + iif = kmalloc(sizeof(*iif), GFP_KERNEL); + if (!iif) { + pr_err("%s: out of memory\n", __func__); + return 0; + } + +- /* register driver with CAPI (ToDo: what for?) */ +- register_capi_driver(&capi_driver_gigaset); +- + /* prepare controller structure */ + iif->ctr.owner = THIS_MODULE; + iif->ctr.driverdata = cs; +@@ -2265,7 +2253,6 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) + rc = attach_capi_ctr(&iif->ctr); + if (rc) { + pr_err("attach_capi_ctr failed (%d)\n", rc); +- unregister_capi_driver(&capi_driver_gigaset); + kfree(iif); + return 0; + } +@@ -2276,17 +2263,36 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) + } + + /** +- * gigaset_isdn_unregister() - unregister from LL ++ * gigaset_isdn_unregdev() - unregister device from LL + * @cs: device descriptor structure. +- * +- * Called by main module to unregister the device from the LL. + */ +-void gigaset_isdn_unregister(struct cardstate *cs) ++void gigaset_isdn_unregdev(struct cardstate *cs) + { + struct gigaset_capi_ctr *iif = cs->iif; + + detach_capi_ctr(&iif->ctr); + kfree(iif); + cs->iif = NULL; ++} ++ ++static struct capi_driver capi_driver_gigaset = { ++ .name = "gigaset", ++ .revision = "1.0", ++}; ++ ++/** ++ * gigaset_isdn_regdrv() - register driver to LL ++ */ ++void gigaset_isdn_regdrv(void) ++{ ++ pr_info("Kernel CAPI interface\n"); ++ register_capi_driver(&capi_driver_gigaset); ++} ++ ++/** ++ * gigaset_isdn_unregdrv() - unregister driver from LL ++ */ ++void gigaset_isdn_unregdrv(void) ++{ + unregister_capi_driver(&capi_driver_gigaset); + } +diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c +index 664b0c5..0427fac 100644 +--- a/drivers/isdn/gigaset/common.c ++++ b/drivers/isdn/gigaset/common.c +@@ -505,7 +505,7 @@ void gigaset_freecs(struct cardstate *cs) + case 2: /* error in initcshw */ + /* Deregister from LL */ + make_invalid(cs, VALID_ID); +- gigaset_isdn_unregister(cs); ++ gigaset_isdn_unregdev(cs); + + /* fall through */ + case 1: /* error when registering to LL */ +@@ -767,7 +767,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, + cs->cmdbytes = 0; + + gig_dbg(DEBUG_INIT, "setting up iif"); +- if (!gigaset_isdn_register(cs, modulename)) { ++ if (!gigaset_isdn_regdev(cs, modulename)) { + pr_err("error registering ISDN device\n"); + goto error; + } +@@ -1214,11 +1214,13 @@ static int __init gigaset_init_module(void) + gigaset_debuglevel = DEBUG_DEFAULT; + + pr_info(DRIVER_DESC DRIVER_DESC_DEBUG "\n"); ++ gigaset_isdn_regdrv(); + return 0; + } + + static void __exit gigaset_exit_module(void) + { ++ gigaset_isdn_unregdrv(); + } + + module_init(gigaset_init_module); +diff --git a/drivers/isdn/gigaset/dummyll.c b/drivers/isdn/gigaset/dummyll.c +index 5b27c99..bd0b1ea 100644 +--- a/drivers/isdn/gigaset/dummyll.c ++++ b/drivers/isdn/gigaset/dummyll.c +@@ -57,12 +57,20 @@ void gigaset_isdn_stop(struct cardstate *cs) + { + } + +-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) ++int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) + { +- pr_info("no ISDN subsystem interface\n"); + return 1; + } + +-void gigaset_isdn_unregister(struct cardstate *cs) ++void gigaset_isdn_unregdev(struct cardstate *cs) ++{ ++} ++ ++void gigaset_isdn_regdrv(void) ++{ ++ pr_info("no ISDN subsystem interface\n"); ++} ++ ++void gigaset_isdn_unregdrv(void) + { + } +diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c +index ddeb045..0304d02 100644 +--- a/drivers/isdn/gigaset/ev-layer.c ++++ b/drivers/isdn/gigaset/ev-layer.c +@@ -1259,14 +1259,10 @@ static void do_action(int action, struct cardstate *cs, + * note that bcs may be NULL if no B channel is free + */ + at_state2->ConState = 700; +- kfree(at_state2->str_var[STR_NMBR]); +- at_state2->str_var[STR_NMBR] = NULL; +- kfree(at_state2->str_var[STR_ZCPN]); +- at_state2->str_var[STR_ZCPN] = NULL; +- kfree(at_state2->str_var[STR_ZBC]); +- at_state2->str_var[STR_ZBC] = NULL; +- kfree(at_state2->str_var[STR_ZHLC]); +- at_state2->str_var[STR_ZHLC] = NULL; ++ for (i = 0; i < STR_NUM; ++i) { ++ kfree(at_state2->str_var[i]); ++ at_state2->str_var[i] = NULL; ++ } + at_state2->int_var[VAR_ZCTP] = -1; + + spin_lock_irqsave(&cs->lock, flags); +diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h +index e963a6c..62909b2 100644 +--- a/drivers/isdn/gigaset/gigaset.h ++++ b/drivers/isdn/gigaset/gigaset.h +@@ -674,8 +674,10 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size); + */ + + /* Called from common.c for setting up/shutting down with the ISDN subsystem */ +-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid); +-void gigaset_isdn_unregister(struct cardstate *cs); ++void gigaset_isdn_regdrv(void); ++void gigaset_isdn_unregdrv(void); ++int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid); ++void gigaset_isdn_unregdev(struct cardstate *cs); + + /* Called from hardware module to indicate completion of an skb */ + void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb); +diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c +index c129ee4..6429a6b 100644 +--- a/drivers/isdn/gigaset/i4l.c ++++ b/drivers/isdn/gigaset/i4l.c +@@ -632,15 +632,13 @@ void gigaset_isdn_stop(struct cardstate *cs) + } + + /** +- * gigaset_isdn_register() - register to LL ++ * gigaset_isdn_regdev() - register to LL + * @cs: device descriptor structure. + * @isdnid: device name. + * +- * Called by main module to register the device with the LL. +- * + * Return value: 1 for success, 0 for failure + */ +-int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) ++int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid) + { + isdn_if *iif; + +@@ -690,15 +688,29 @@ int gigaset_isdn_register(struct cardstate *cs, const char *isdnid) + } + + /** +- * gigaset_isdn_unregister() - unregister from LL ++ * gigaset_isdn_unregdev() - unregister device from LL + * @cs: device descriptor structure. +- * +- * Called by main module to unregister the device from the LL. + */ +-void gigaset_isdn_unregister(struct cardstate *cs) ++void gigaset_isdn_unregdev(struct cardstate *cs) + { + gig_dbg(DEBUG_CMD, "sending UNLOAD"); + gigaset_i4l_cmd(cs, ISDN_STAT_UNLOAD); + kfree(cs->iif); + cs->iif = NULL; + } ++ ++/** ++ * gigaset_isdn_regdrv() - register driver to LL ++ */ ++void gigaset_isdn_regdrv(void) ++{ ++ /* nothing to do */ ++} ++ ++/** ++ * gigaset_isdn_unregdrv() - unregister driver from LL ++ */ ++void gigaset_isdn_unregdrv(void) ++{ ++ /* nothing to do */ ++} +diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c +index d2260b0..07bb299 100644 +--- a/drivers/isdn/gigaset/interface.c ++++ b/drivers/isdn/gigaset/interface.c +@@ -632,7 +632,6 @@ void gigaset_if_receive(struct cardstate *cs, + if (tty == NULL) + gig_dbg(DEBUG_ANY, "receive on closed device"); + else { +- tty_buffer_request_room(tty, len); + tty_insert_flip_string(tty, buffer, len); + tty_flip_buffer_push(tty); + } +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index e5225d2..0823e26 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -211,7 +211,6 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev, + const struct of_device_id *match) + { + struct device_node *np = ofdev->node, *child; +- struct gpio_led led; + struct gpio_led_of_platform_data *pdata; + int count = 0, ret; + +@@ -226,8 +225,8 @@ static int __devinit of_gpio_leds_probe(struct of_device *ofdev, + if (!pdata) + return -ENOMEM; + +- memset(&led, 0, sizeof(led)); + for_each_child_of_node(np, child) { ++ struct gpio_led led = {}; + enum of_gpio_flags flags; + const char *state; + +diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c +index cc0505e..6b0a495 100644 +--- a/drivers/media/video/em28xx/em28xx-dvb.c ++++ b/drivers/media/video/em28xx/em28xx-dvb.c +@@ -606,6 +606,7 @@ static int dvb_fini(struct em28xx *dev) + + if (dev->dvb) { + unregister_dvb(dev->dvb); ++ kfree(dev->dvb); + dev->dvb = NULL; + } + +diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c +index efa0e41..1f800ae 100644 +--- a/drivers/net/bonding/bond_main.c ++++ b/drivers/net/bonding/bond_main.c +@@ -4935,6 +4935,8 @@ int bond_create(struct net *net, const char *name) + } + + res = register_netdevice(bond_dev); ++ if (res < 0) ++ goto out_netdev; + + out: + rtnl_unlock(); +diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c +index 0ec1524..fe5e320 100644 +--- a/drivers/net/can/bfin_can.c ++++ b/drivers/net/can/bfin_can.c +@@ -26,6 +26,7 @@ + + #define DRV_NAME "bfin_can" + #define BFIN_CAN_TIMEOUT 100 ++#define TX_ECHO_SKB_MAX 1 + + /* + * transmit and receive channels +@@ -590,7 +591,7 @@ struct net_device *alloc_bfin_candev(void) + struct net_device *dev; + struct bfin_can_priv *priv; + +- dev = alloc_candev(sizeof(*priv)); ++ dev = alloc_candev(sizeof(*priv), TX_ECHO_SKB_MAX); + if (!dev) + return NULL; + +diff --git a/drivers/net/e100.c b/drivers/net/e100.c +index 839fb2b..a565ea1 100644 +--- a/drivers/net/e100.c ++++ b/drivers/net/e100.c +@@ -2854,7 +2854,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, + } + nic->cbs_pool = pci_pool_create(netdev->name, + nic->pdev, +- nic->params.cbs.count * sizeof(struct cb), ++ nic->params.cbs.max * sizeof(struct cb), + sizeof(u32), + 0); + DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", +diff --git a/drivers/net/jme.c b/drivers/net/jme.c +index 792b88f..981c9fb 100644 +--- a/drivers/net/jme.c ++++ b/drivers/net/jme.c +@@ -946,6 +946,8 @@ jme_alloc_and_feed_skb(struct jme_adapter *jme, int idx) + jme->jme_vlan_rx(skb, jme->vlgrp, + le16_to_cpu(rxdesc->descwb.vlan)); + NET_STAT(jme).rx_bytes += 4; ++ } else { ++ dev_kfree_skb(skb); + } + } else { + jme->jme_rx(skb); +@@ -2085,12 +2087,45 @@ jme_tx_timeout(struct net_device *netdev) + jme_reset_link(jme); + } + ++static inline void jme_pause_rx(struct jme_adapter *jme) ++{ ++ atomic_dec(&jme->link_changing); ++ ++ jme_set_rx_pcc(jme, PCC_OFF); ++ if (test_bit(JME_FLAG_POLL, &jme->flags)) { ++ JME_NAPI_DISABLE(jme); ++ } else { ++ tasklet_disable(&jme->rxclean_task); ++ tasklet_disable(&jme->rxempty_task); ++ } ++} ++ ++static inline void jme_resume_rx(struct jme_adapter *jme) ++{ ++ struct dynpcc_info *dpi = &(jme->dpi); ++ ++ if (test_bit(JME_FLAG_POLL, &jme->flags)) { ++ JME_NAPI_ENABLE(jme); ++ } else { ++ tasklet_hi_enable(&jme->rxclean_task); ++ tasklet_hi_enable(&jme->rxempty_task); ++ } ++ dpi->cur = PCC_P1; ++ dpi->attempt = PCC_P1; ++ dpi->cnt = 0; ++ jme_set_rx_pcc(jme, PCC_P1); ++ ++ atomic_inc(&jme->link_changing); ++} ++ + static void + jme_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) + { + struct jme_adapter *jme = netdev_priv(netdev); + ++ jme_pause_rx(jme); + jme->vlgrp = grp; ++ jme_resume_rx(jme); + } + + static void +diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c +index 9fbb2eb..449a982 100644 +--- a/drivers/net/pppol2tp.c ++++ b/drivers/net/pppol2tp.c +@@ -756,6 +756,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb) + + /* Try to dequeue as many skbs from reorder_q as we can. */ + pppol2tp_recv_dequeue(session); ++ sock_put(sock); + + return 0; + +@@ -772,6 +773,7 @@ discard_bad_csum: + UDP_INC_STATS_USER(&init_net, UDP_MIB_INERRORS, 0); + tunnel->stats.rx_errors++; + kfree_skb(skb); ++ sock_put(sock); + + return 0; + +@@ -1180,7 +1182,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) + /* Calculate UDP checksum if configured to do so */ + if (sk_tun->sk_no_check == UDP_CSUM_NOXMIT) + skb->ip_summed = CHECKSUM_NONE; +- else if (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM)) { ++ else if ((skb_dst(skb) && skb_dst(skb)->dev) && ++ (!(skb_dst(skb)->dev->features & NETIF_F_V4_CSUM))) { + skb->ip_summed = CHECKSUM_COMPLETE; + csum = skb_checksum(skb, 0, udp_len, 0); + uh->check = csum_tcpudp_magic(inet->inet_saddr, +@@ -1661,6 +1664,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, + if (tunnel_sock == NULL) + goto end; + ++ sock_hold(tunnel_sock); + tunnel = tunnel_sock->sk_user_data; + } else { + tunnel = pppol2tp_tunnel_find(sock_net(sk), sp->pppol2tp.s_tunnel); +diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c +index 60f96c4..67d414b 100644 +--- a/drivers/net/r8169.c ++++ b/drivers/net/r8169.c +@@ -186,7 +186,12 @@ static struct pci_device_id rtl8169_pci_tbl[] = { + + MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); + +-static int rx_copybreak = 200; ++/* ++ * we set our copybreak very high so that we don't have ++ * to allocate 16k frames all the time (see note in ++ * rtl8169_open() ++ */ ++static int rx_copybreak = 16383; + static int use_dac; + static struct { + u32 msg_enable; +@@ -3245,9 +3250,13 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) + } + + static void rtl8169_set_rxbufsize(struct rtl8169_private *tp, +- struct net_device *dev) ++ unsigned int mtu) + { +- unsigned int max_frame = dev->mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; ++ unsigned int max_frame = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; ++ ++ if (max_frame != 16383) ++ printk(KERN_WARNING "WARNING! Changing of MTU on this NIC" ++ "May lead to frame reception errors!\n"); + + tp->rx_buf_sz = (max_frame > RX_BUF_SIZE) ? max_frame : RX_BUF_SIZE; + } +@@ -3259,7 +3268,17 @@ static int rtl8169_open(struct net_device *dev) + int retval = -ENOMEM; + + +- rtl8169_set_rxbufsize(tp, dev); ++ /* ++ * Note that we use a magic value here, its wierd I know ++ * its done because, some subset of rtl8169 hardware suffers from ++ * a problem in which frames received that are longer than ++ * the size set in RxMaxSize register return garbage sizes ++ * when received. To avoid this we need to turn off filtering, ++ * which is done by setting a value of 16383 in the RxMaxSize register ++ * and allocating 16k frames to handle the largest possible rx value ++ * thats what the magic math below does. ++ */ ++ rtl8169_set_rxbufsize(tp, 16383 - VLAN_ETH_HLEN - ETH_FCS_LEN); + + /* + * Rx and Tx desscriptors needs 256 bytes alignment. +@@ -3912,7 +3931,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) + + rtl8169_down(dev); + +- rtl8169_set_rxbufsize(tp, dev); ++ rtl8169_set_rxbufsize(tp, dev->mtu); + + ret = rtl8169_init_ring(dev); + if (ret < 0) +diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c +index 7f82b02..17d1493 100644 +--- a/drivers/net/tg3.c ++++ b/drivers/net/tg3.c +@@ -5223,7 +5223,7 @@ static void tg3_poll_controller(struct net_device *dev) + struct tg3 *tp = netdev_priv(dev); + + for (i = 0; i < tp->irq_cnt; i++) +- tg3_interrupt(tp->napi[i].irq_vec, dev); ++ tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); + } + #endif + +diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h +index bbd2f31..8b43089 100644 +--- a/drivers/net/wireless/ath/ath5k/ath5k.h ++++ b/drivers/net/wireless/ath/ath5k/ath5k.h +@@ -535,7 +535,7 @@ struct ath5k_txq_info { + u32 tqi_cbr_period; /* Constant bit rate period */ + u32 tqi_cbr_overflow_limit; + u32 tqi_burst_time; +- u32 tqi_ready_time; /* Not used */ ++ u32 tqi_ready_time; /* Time queue waits after an event */ + }; + + /* +diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c +index d6ee8ac..ced648b 100644 +--- a/drivers/net/wireless/ath/ath5k/base.c ++++ b/drivers/net/wireless/ath/ath5k/base.c +@@ -1537,7 +1537,8 @@ ath5k_beaconq_config(struct ath5k_softc *sc) + + ret = ath5k_hw_get_tx_queueprops(ah, sc->bhalq, &qi); + if (ret) +- return ret; ++ goto err; ++ + if (sc->opmode == NL80211_IFTYPE_AP || + sc->opmode == NL80211_IFTYPE_MESH_POINT) { + /* +@@ -1564,10 +1565,25 @@ ath5k_beaconq_config(struct ath5k_softc *sc) + if (ret) { + ATH5K_ERR(sc, "%s: unable to update parameters for beacon " + "hardware queue!\n", __func__); +- return ret; ++ goto err; + } ++ ret = ath5k_hw_reset_tx_queue(ah, sc->bhalq); /* push to h/w */ ++ if (ret) ++ goto err; + +- return ath5k_hw_reset_tx_queue(ah, sc->bhalq); /* push to h/w */; ++ /* reconfigure cabq with ready time to 80% of beacon_interval */ ++ ret = ath5k_hw_get_tx_queueprops(ah, AR5K_TX_QUEUE_ID_CAB, &qi); ++ if (ret) ++ goto err; ++ ++ qi.tqi_ready_time = (sc->bintval * 80) / 100; ++ ret = ath5k_hw_set_tx_queueprops(ah, AR5K_TX_QUEUE_ID_CAB, &qi); ++ if (ret) ++ goto err; ++ ++ ret = ath5k_hw_reset_tx_queue(ah, AR5K_TX_QUEUE_ID_CAB); ++err: ++ return ret; + } + + static void +diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c +index 72474c0..97df0d9 100644 +--- a/drivers/net/wireless/ath/ath5k/phy.c ++++ b/drivers/net/wireless/ath/ath5k/phy.c +@@ -1386,38 +1386,39 @@ static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah, + goto done; + + /* Calibration has finished, get the results and re-run */ ++ ++ /* work around empty results which can apparently happen on 5212 */ + for (i = 0; i <= 10; i++) { + iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); + i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); + q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); ++ ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ++ "iq_corr:%x i_pwr:%x q_pwr:%x", iq_corr, i_pwr, q_pwr); ++ if (i_pwr && q_pwr) ++ break; + } + + i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7; + q_coffd = q_pwr >> 7; + +- /* No correction */ +- if (i_coffd == 0 || q_coffd == 0) ++ /* protect against divide by 0 and loss of sign bits */ ++ if (i_coffd == 0 || q_coffd < 2) + goto done; + +- i_coff = ((-iq_corr) / i_coffd); ++ i_coff = (-iq_corr) / i_coffd; ++ i_coff = clamp(i_coff, -32, 31); /* signed 6 bit */ + +- /* Boundary check */ +- if (i_coff > 31) +- i_coff = 31; +- if (i_coff < -32) +- i_coff = -32; ++ q_coff = (i_pwr / q_coffd) - 128; ++ q_coff = clamp(q_coff, -16, 15); /* signed 5 bit */ + +- q_coff = (((s32)i_pwr / q_coffd) - 128); ++ ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE, ++ "new I:%d Q:%d (i_coffd:%x q_coffd:%x)", ++ i_coff, q_coff, i_coffd, q_coffd); + +- /* Boundary check */ +- if (q_coff > 15) +- q_coff = 15; +- if (q_coff < -16) +- q_coff = -16; +- +- /* Commit new I/Q value */ +- AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE | +- ((u32)q_coff) | ((u32)i_coff << AR5K_PHY_IQ_CORR_Q_I_COFF_S)); ++ /* Commit new I/Q values (set enable bit last to match HAL sources) */ ++ AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF, i_coff); ++ AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF, q_coff); ++ AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE); + + /* Re-enable calibration -if we don't we'll commit + * the same values again and again */ +diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c +index eeebb9a..b7c5725 100644 +--- a/drivers/net/wireless/ath/ath5k/qcu.c ++++ b/drivers/net/wireless/ath/ath5k/qcu.c +@@ -408,12 +408,13 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) + break; + + case AR5K_TX_QUEUE_CAB: ++ /* XXX: use BCN_SENT_GT, if we can figure out how */ + AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), +- AR5K_QCU_MISC_FRSHED_BCN_SENT_GT | ++ AR5K_QCU_MISC_FRSHED_DBA_GT | + AR5K_QCU_MISC_CBREXP_DIS | + AR5K_QCU_MISC_CBREXP_BCN_DIS); + +- ath5k_hw_reg_write(ah, ((AR5K_TUNE_BEACON_INTERVAL - ++ ath5k_hw_reg_write(ah, ((tq->tqi_ready_time - + (AR5K_TUNE_SW_BEACON_RESP - + AR5K_TUNE_DMA_BEACON_RESP) - + AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) | +diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h +index 4cb9c5d..1464f89 100644 +--- a/drivers/net/wireless/ath/ath5k/reg.h ++++ b/drivers/net/wireless/ath/ath5k/reg.h +@@ -2187,6 +2187,7 @@ + */ + #define AR5K_PHY_IQ 0x9920 /* Register Address */ + #define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */ ++#define AR5K_PHY_IQ_CORR_Q_Q_COFF_S 0 + #define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */ + #define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5 + #define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */ +diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c +index 62954fc..dbc52ee 100644 +--- a/drivers/net/wireless/ath/ath5k/reset.c ++++ b/drivers/net/wireless/ath/ath5k/reset.c +@@ -1371,8 +1371,9 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, + * Set clocks to 32KHz operation and use an + * external 32KHz crystal when sleeping if one + * exists */ +- if (ah->ah_version == AR5K_AR5212) +- ath5k_hw_set_sleep_clock(ah, true); ++ if (ah->ah_version == AR5K_AR5212 && ++ ah->ah_op_mode != NL80211_IFTYPE_AP) ++ ath5k_hw_set_sleep_clock(ah, true); + + /* + * Disable beacons and reset the register +diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h +index 1597a42..2bad712 100644 +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -267,6 +267,7 @@ void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, + u16 tid, u16 *ssn); + void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); + void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); ++void ath9k_enable_ps(struct ath_softc *sc); + + /********/ + /* VIFs */ +diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c +index 06eaaa9..20b1fd3 100644 +--- a/drivers/net/wireless/ath/ath9k/beacon.c ++++ b/drivers/net/wireless/ath/ath9k/beacon.c +@@ -573,6 +573,13 @@ static void ath_beacon_config_sta(struct ath_softc *sc, + u64 tsf; + int num_beacons, offset, dtim_dec_count, cfp_dec_count; + ++ /* No need to configure beacon if we are not associated */ ++ if (!common->curaid) { ++ ath_print(common, ATH_DBG_BEACON, ++ "STA is not yet associated..skipping beacon config\n"); ++ return; ++ } ++ + memset(&bs, 0, sizeof(bs)); + intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; + +diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c +index 7c64aa5..6661178 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -380,7 +380,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah) + ah->config.pcie_clock_req = 0; + ah->config.pcie_waen = 0; + ah->config.analog_shiftreg = 1; +- ah->config.ht_enable = 1; + ah->config.ofdm_trig_low = 200; + ah->config.ofdm_trig_high = 500; + ah->config.cck_trig_high = 200; +@@ -392,6 +391,11 @@ static void ath9k_hw_init_config(struct ath_hw *ah) + ah->config.spurchans[i][1] = AR_NO_SPUR; + } + ++ if (ah->hw_version.devid != AR2427_DEVID_PCIE) ++ ah->config.ht_enable = 1; ++ else ++ ah->config.ht_enable = 0; ++ + ah->config.intr_mitigation = true; + + /* +@@ -590,6 +594,7 @@ static bool ath9k_hw_devid_supported(u16 devid) + case AR5416_DEVID_AR9287_PCI: + case AR5416_DEVID_AR9287_PCIE: + case AR9271_USB: ++ case AR2427_DEVID_PCIE: + return true; + default: + break; +diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h +index e2b0c73..33a28ec 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -40,6 +40,7 @@ + #define AR9280_DEVID_PCI 0x0029 + #define AR9280_DEVID_PCIE 0x002a + #define AR9285_DEVID_PCIE 0x002b ++#define AR2427_DEVID_PCIE 0x002c + + #define AR5416_AR9100_DEVID 0x000b + +diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c +index 4faafbd..33a1071 100644 +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1854,11 +1854,14 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) + hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | + IEEE80211_HW_SIGNAL_DBM | +- IEEE80211_HW_AMPDU_AGGREGATION | + IEEE80211_HW_SUPPORTS_PS | + IEEE80211_HW_PS_NULLFUNC_STACK | ++ IEEE80211_HW_REPORTS_TX_ACK_STATUS | + IEEE80211_HW_SPECTRUM_MGMT; + ++ if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) ++ hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; ++ + if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || modparam_nohwcrypt) + hw->flags |= IEEE80211_HW_MFP_CAPABLE; + +@@ -2679,6 +2682,19 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, + mutex_unlock(&sc->mutex); + } + ++void ath9k_enable_ps(struct ath_softc *sc) ++{ ++ sc->ps_enabled = true; ++ if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) { ++ if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) { ++ sc->imask |= ATH9K_INT_TIM_TIMER; ++ ath9k_hw_set_interrupts(sc->sc_ah, ++ sc->imask); ++ } ++ } ++ ath9k_hw_setrxabort(sc->sc_ah, 1); ++} ++ + static int ath9k_config(struct ieee80211_hw *hw, u32 changed) + { + struct ath_wiphy *aphy = hw->priv; +@@ -2732,22 +2748,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) + if (changed & IEEE80211_CONF_CHANGE_PS) { + if (conf->flags & IEEE80211_CONF_PS) { + sc->sc_flags |= SC_OP_PS_ENABLED; +- if (!(ah->caps.hw_caps & +- ATH9K_HW_CAP_AUTOSLEEP)) { +- if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) { +- sc->imask |= ATH9K_INT_TIM_TIMER; +- ath9k_hw_set_interrupts(sc->sc_ah, +- sc->imask); +- } +- } + /* + * At this point we know hardware has received an ACK + * of a previously sent null data frame. + */ + if ((sc->sc_flags & SC_OP_NULLFUNC_COMPLETED)) { + sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED; +- sc->ps_enabled = true; +- ath9k_hw_setrxabort(sc->sc_ah, 1); ++ ath9k_enable_ps(sc); + } + } else { + sc->ps_enabled = false; +diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c +index f7af5ea..199c54a 100644 +--- a/drivers/net/wireless/ath/ath9k/pci.c ++++ b/drivers/net/wireless/ath/ath9k/pci.c +@@ -25,6 +25,7 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = { + { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */ + { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */ + { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */ ++ { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */ + { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */ + { PCI_VDEVICE(ATHEROS, 0x002E) }, /* PCI-E */ + { 0 } +diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c +index 1d6cf7d..171ce2b 100644 +--- a/drivers/net/wireless/ath/ath9k/rc.c ++++ b/drivers/net/wireless/ath/ath9k/rc.c +@@ -1323,7 +1323,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, + + static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, + struct ieee80211_sta *sta, void *priv_sta, +- u32 changed) ++ u32 changed, enum nl80211_channel_type oper_chan_type) + { + struct ath_softc *sc = priv; + struct ath_rate_priv *ath_rc_priv = priv_sta; +@@ -1340,8 +1340,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, + if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION) + return; + +- if (sc->hw->conf.channel_type == NL80211_CHAN_HT40MINUS || +- sc->hw->conf.channel_type == NL80211_CHAN_HT40PLUS) ++ if (oper_chan_type == NL80211_CHAN_HT40MINUS || ++ oper_chan_type == NL80211_CHAN_HT40PLUS) + oper_cw40 = true; + + oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? +diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c +index 29bf336..c3ce920 100644 +--- a/drivers/net/wireless/ath/ath9k/xmit.c ++++ b/drivers/net/wireless/ath/ath9k/xmit.c +@@ -1353,25 +1353,6 @@ static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb) + return htype; + } + +-static bool is_pae(struct sk_buff *skb) +-{ +- struct ieee80211_hdr *hdr; +- __le16 fc; +- +- hdr = (struct ieee80211_hdr *)skb->data; +- fc = hdr->frame_control; +- +- if (ieee80211_is_data(fc)) { +- if (ieee80211_is_nullfunc(fc) || +- /* Port Access Entity (IEEE 802.1X) */ +- (skb->protocol == cpu_to_be16(ETH_P_PAE))) { +- return true; +- } +- } +- +- return false; +-} +- + static int get_hw_crypto_keytype(struct sk_buff *skb) + { + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); +@@ -1701,7 +1682,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, + goto tx_done; + } + +- if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && !is_pae(skb)) { ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { + /* + * Try aggregation if it's a unicast data frame + * and the destination is HT capable. +@@ -2053,10 +2034,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) + */ + if (bf->bf_isnullfunc && + (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) { +- if ((sc->sc_flags & SC_OP_PS_ENABLED)) { +- sc->ps_enabled = true; +- ath9k_hw_setrxabort(sc->sc_ah, 1); +- } else ++ if ((sc->sc_flags & SC_OP_PS_ENABLED)) ++ ath9k_enable_ps(sc); ++ else + sc->sc_flags |= SC_OP_NULLFUNC_COMPLETED; + } + +@@ -2264,7 +2244,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) + if (ATH_TXQ_SETUP(sc, i)) { + txq = &sc->tx.txq[i]; + +- spin_lock(&txq->axq_lock); ++ spin_lock_bh(&txq->axq_lock); + + list_for_each_entry_safe(ac, + ac_tmp, &txq->axq_acq, list) { +@@ -2285,7 +2265,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) + } + } + +- spin_unlock(&txq->axq_lock); ++ spin_unlock_bh(&txq->axq_lock); + } + } + } +diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c +index b59166c..629c166 100644 +--- a/drivers/net/wireless/b43/main.c ++++ b/drivers/net/wireless/b43/main.c +@@ -852,19 +852,16 @@ static void b43_op_update_tkip_key(struct ieee80211_hw *hw, + if (B43_WARN_ON(!modparam_hwtkip)) + return; + +- mutex_lock(&wl->mutex); +- ++ /* This is only called from the RX path through mac80211, where ++ * our mutex is already locked. */ ++ B43_WARN_ON(!mutex_is_locked(&wl->mutex)); + dev = wl->current_dev; +- if (!dev || b43_status(dev) < B43_STAT_INITIALIZED) +- goto out_unlock; ++ B43_WARN_ON(!dev || b43_status(dev) < B43_STAT_INITIALIZED); + + keymac_write(dev, index, NULL); /* First zero out mac to avoid race */ + + rx_tkip_phase1_write(dev, index, iv32, phase1key); + keymac_write(dev, index, addr); +- +-out_unlock: +- mutex_unlock(&wl->mutex); + } + + static void do_key_write(struct b43_wldev *dev, +diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c +index 234891d..e955515 100644 +--- a/drivers/net/wireless/iwlwifi/iwl-3945.c ++++ b/drivers/net/wireless/iwlwifi/iwl-3945.c +@@ -2474,11 +2474,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) + memset((void *)&priv->hw_params, 0, + sizeof(struct iwl_hw_params)); + +- priv->shared_virt = +- pci_alloc_consistent(priv->pci_dev, +- sizeof(struct iwl3945_shared), +- &priv->shared_phys); +- ++ priv->shared_virt = dma_alloc_coherent(&priv->pci_dev->dev, ++ sizeof(struct iwl3945_shared), ++ &priv->shared_phys, GFP_KERNEL); + if (!priv->shared_virt) { + IWL_ERR(priv, "failed to allocate pci memory\n"); + mutex_unlock(&priv->mutex); +diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c +index f36f804..6e9e156 100644 +--- a/drivers/net/wireless/iwlwifi/iwl-core.c ++++ b/drivers/net/wireless/iwlwifi/iwl-core.c +@@ -1658,9 +1658,9 @@ EXPORT_SYMBOL(iwl_set_tx_power); + void iwl_free_isr_ict(struct iwl_priv *priv) + { + if (priv->ict_tbl_vir) { +- pci_free_consistent(priv->pci_dev, (sizeof(u32) * ICT_COUNT) + +- PAGE_SIZE, priv->ict_tbl_vir, +- priv->ict_tbl_dma); ++ dma_free_coherent(&priv->pci_dev->dev, ++ (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, ++ priv->ict_tbl_vir, priv->ict_tbl_dma); + priv->ict_tbl_vir = NULL; + } + } +@@ -1676,9 +1676,9 @@ int iwl_alloc_isr_ict(struct iwl_priv *priv) + if (priv->cfg->use_isr_legacy) + return 0; + /* allocate shrared data table */ +- priv->ict_tbl_vir = pci_alloc_consistent(priv->pci_dev, (sizeof(u32) * +- ICT_COUNT) + PAGE_SIZE, +- &priv->ict_tbl_dma); ++ priv->ict_tbl_vir = dma_alloc_coherent(&priv->pci_dev->dev, ++ (sizeof(u32) * ICT_COUNT) + PAGE_SIZE, ++ &priv->ict_tbl_dma, GFP_KERNEL); + if (!priv->ict_tbl_vir) + return -ENOMEM; + +diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h +index bd0b12e..f8481e8 100644 +--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h ++++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h +@@ -80,8 +80,8 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev, + struct fw_desc *desc) + { + if (desc->v_addr) +- pci_free_consistent(pci_dev, desc->len, +- desc->v_addr, desc->p_addr); ++ dma_free_coherent(&pci_dev->dev, desc->len, ++ desc->v_addr, desc->p_addr); + desc->v_addr = NULL; + desc->len = 0; + } +@@ -89,7 +89,8 @@ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev, + static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev, + struct fw_desc *desc) + { +- desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr); ++ desc->v_addr = dma_alloc_coherent(&pci_dev->dev, desc->len, ++ &desc->p_addr, GFP_KERNEL); + return (desc->v_addr != NULL) ? 0 : -ENOMEM; + } + +diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c +index 2dbce85..4ac16d9 100644 +--- a/drivers/net/wireless/iwlwifi/iwl-rx.c ++++ b/drivers/net/wireless/iwlwifi/iwl-rx.c +@@ -350,10 +350,10 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) + } + } + +- pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, +- rxq->dma_addr); +- pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), +- rxq->rb_stts, rxq->rb_stts_dma); ++ dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, ++ rxq->dma_addr); ++ dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), ++ rxq->rb_stts, rxq->rb_stts_dma); + rxq->bd = NULL; + rxq->rb_stts = NULL; + } +@@ -362,7 +362,7 @@ EXPORT_SYMBOL(iwl_rx_queue_free); + int iwl_rx_queue_alloc(struct iwl_priv *priv) + { + struct iwl_rx_queue *rxq = &priv->rxq; +- struct pci_dev *dev = priv->pci_dev; ++ struct device *dev = &priv->pci_dev->dev; + int i; + + spin_lock_init(&rxq->lock); +@@ -370,12 +370,13 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) + INIT_LIST_HEAD(&rxq->rx_used); + + /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ +- rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); ++ rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr, ++ GFP_KERNEL); + if (!rxq->bd) + goto err_bd; + +- rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status), +- &rxq->rb_stts_dma); ++ rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status), ++ &rxq->rb_stts_dma, GFP_KERNEL); + if (!rxq->rb_stts) + goto err_rb; + +@@ -392,8 +393,8 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv) + return 0; + + err_rb: +- pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, +- rxq->dma_addr); ++ dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, ++ rxq->dma_addr); + err_bd: + return -ENOMEM; + } +diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c +index 8f40715..88470fb 100644 +--- a/drivers/net/wireless/iwlwifi/iwl-tx.c ++++ b/drivers/net/wireless/iwlwifi/iwl-tx.c +@@ -60,7 +60,8 @@ static const u16 default_tid_to_tx_fifo[] = { + static inline int iwl_alloc_dma_ptr(struct iwl_priv *priv, + struct iwl_dma_ptr *ptr, size_t size) + { +- ptr->addr = pci_alloc_consistent(priv->pci_dev, size, &ptr->dma); ++ ptr->addr = dma_alloc_coherent(&priv->pci_dev->dev, size, &ptr->dma, ++ GFP_KERNEL); + if (!ptr->addr) + return -ENOMEM; + ptr->size = size; +@@ -73,7 +74,7 @@ static inline void iwl_free_dma_ptr(struct iwl_priv *priv, + if (unlikely(!ptr->addr)) + return; + +- pci_free_consistent(priv->pci_dev, ptr->size, ptr->addr, ptr->dma); ++ dma_free_coherent(&priv->pci_dev->dev, ptr->size, ptr->addr, ptr->dma); + memset(ptr, 0, sizeof(*ptr)); + } + +@@ -126,7 +127,7 @@ void iwl_free_tfds_in_queue(struct iwl_priv *priv, + if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed) + priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; + else { +- IWL_ERR(priv, "free more than tfds_in_queue (%u:%d)\n", ++ IWL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n", + priv->stations[sta_id].tid[tid].tfds_in_queue, + freed); + priv->stations[sta_id].tid[tid].tfds_in_queue = 0; +@@ -146,7 +147,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) + { + struct iwl_tx_queue *txq = &priv->txq[txq_id]; + struct iwl_queue *q = &txq->q; +- struct pci_dev *dev = priv->pci_dev; ++ struct device *dev = &priv->pci_dev->dev; + int i; + + if (q->n_bd == 0) +@@ -163,8 +164,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) + + /* De-alloc circular buffer of TFDs */ + if (txq->q.n_bd) +- pci_free_consistent(dev, priv->hw_params.tfd_size * +- txq->q.n_bd, txq->tfds, txq->q.dma_addr); ++ dma_free_coherent(dev, priv->hw_params.tfd_size * ++ txq->q.n_bd, txq->tfds, txq->q.dma_addr); + + /* De-alloc array of per-TFD driver data */ + kfree(txq->txb); +@@ -193,7 +194,7 @@ void iwl_cmd_queue_free(struct iwl_priv *priv) + { + struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM]; + struct iwl_queue *q = &txq->q; +- struct pci_dev *dev = priv->pci_dev; ++ struct device *dev = &priv->pci_dev->dev; + int i; + + if (q->n_bd == 0) +@@ -205,8 +206,8 @@ void iwl_cmd_queue_free(struct iwl_priv *priv) + + /* De-alloc circular buffer of TFDs */ + if (txq->q.n_bd) +- pci_free_consistent(dev, priv->hw_params.tfd_size * +- txq->q.n_bd, txq->tfds, txq->q.dma_addr); ++ dma_free_coherent(dev, priv->hw_params.tfd_size * txq->q.n_bd, ++ txq->tfds, txq->q.dma_addr); + + /* deallocate arrays */ + kfree(txq->cmd); +@@ -297,7 +298,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, + static int iwl_tx_queue_alloc(struct iwl_priv *priv, + struct iwl_tx_queue *txq, u32 id) + { +- struct pci_dev *dev = priv->pci_dev; ++ struct device *dev = &priv->pci_dev->dev; + size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX; + + /* Driver private data, only for Tx (not command) queues, +@@ -316,8 +317,8 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv, + + /* Circular buffer of transmit frame descriptors (TFDs), + * shared with device */ +- txq->tfds = pci_alloc_consistent(dev, tfd_sz, &txq->q.dma_addr); +- ++ txq->tfds = dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, ++ GFP_KERNEL); + if (!txq->tfds) { + IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz); + goto error; +diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c +index f8e4e4b..f297865 100644 +--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c ++++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c +@@ -352,10 +352,10 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) + static void iwl3945_unset_hw_params(struct iwl_priv *priv) + { + if (priv->shared_virt) +- pci_free_consistent(priv->pci_dev, +- sizeof(struct iwl3945_shared), +- priv->shared_virt, +- priv->shared_phys); ++ dma_free_coherent(&priv->pci_dev->dev, ++ sizeof(struct iwl3945_shared), ++ priv->shared_virt, ++ priv->shared_phys); + } + + static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, +@@ -1253,10 +1253,10 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx + } + } + +- pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, +- rxq->dma_addr); +- pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status), +- rxq->rb_stts, rxq->rb_stts_dma); ++ dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, ++ rxq->dma_addr); ++ dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status), ++ rxq->rb_stts, rxq->rb_stts_dma); + rxq->bd = NULL; + rxq->rb_stts = NULL; + } +diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c +index a007230..1685c09 100644 +--- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c ++++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c +@@ -443,7 +443,8 @@ out: + + void wl1251_debugfs_reset(struct wl1251 *wl) + { +- memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); ++ if (wl->stats.fw_stats != NULL) ++ memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); + wl->stats.retry_count = 0; + wl->stats.excessive_retries = 0; + } +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c +index 315fea4..3245d33 100644 +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -2421,18 +2421,17 @@ EXPORT_SYMBOL_GPL(pci_reset_function); + */ + int pcix_get_max_mmrbc(struct pci_dev *dev) + { +- int err, cap; ++ int cap; + u32 stat; + + cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); + if (!cap) + return -EINVAL; + +- err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); +- if (err) ++ if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) + return -EINVAL; + +- return (stat & PCI_X_STATUS_MAX_READ) >> 12; ++ return 512 << ((stat & PCI_X_STATUS_MAX_READ) >> 21); + } + EXPORT_SYMBOL(pcix_get_max_mmrbc); + +@@ -2445,18 +2444,17 @@ EXPORT_SYMBOL(pcix_get_max_mmrbc); + */ + int pcix_get_mmrbc(struct pci_dev *dev) + { +- int ret, cap; +- u32 cmd; ++ int cap; ++ u16 cmd; + + cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); + if (!cap) + return -EINVAL; + +- ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); +- if (!ret) +- ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); ++ if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) ++ return -EINVAL; + +- return ret; ++ return 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); + } + EXPORT_SYMBOL(pcix_get_mmrbc); + +@@ -2471,28 +2469,27 @@ EXPORT_SYMBOL(pcix_get_mmrbc); + */ + int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) + { +- int cap, err = -EINVAL; +- u32 stat, cmd, v, o; ++ int cap; ++ u32 stat, v, o; ++ u16 cmd; + + if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) +- goto out; ++ return -EINVAL; + + v = ffs(mmrbc) - 10; + + cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); + if (!cap) +- goto out; ++ return -EINVAL; + +- err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); +- if (err) +- goto out; ++ if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) ++ return -EINVAL; + + if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) + return -E2BIG; + +- err = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); +- if (err) +- goto out; ++ if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) ++ return -EINVAL; + + o = (cmd & PCI_X_CMD_MAX_READ) >> 2; + if (o != v) { +@@ -2502,10 +2499,10 @@ int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) + + cmd &= ~PCI_X_CMD_MAX_READ; + cmd |= v << 2; +- err = pci_write_config_dword(dev, cap + PCI_X_CMD, cmd); ++ if (pci_write_config_word(dev, cap + PCI_X_CMD, cmd)) ++ return -EIO; + } +-out: +- return err; ++ return 0; + } + EXPORT_SYMBOL(pcix_set_mmrbc); + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index d58b940..456c265 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -2534,6 +2534,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, quirk_i82576_sriov); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e8, quirk_i82576_sriov); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150a, quirk_i82576_sriov); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x150d, quirk_i82576_sriov); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1518, quirk_i82576_sriov); + + #endif /* CONFIG_PCI_IOV */ + +diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c +index ed90082..8cb20e4 100644 +--- a/drivers/platform/x86/classmate-laptop.c ++++ b/drivers/platform/x86/classmate-laptop.c +@@ -34,6 +34,11 @@ struct cmpc_accel { + #define CMPC_ACCEL_SENSITIVITY_DEFAULT 5 + + ++#define CMPC_ACCEL_HID "ACCE0000" ++#define CMPC_TABLET_HID "TBLT0000" ++#define CMPC_BL_HID "IPML200" ++#define CMPC_KEYS_HID "FnBT0000" ++ + /* + * Generic input device code. + */ +@@ -282,10 +287,9 @@ static int cmpc_accel_remove(struct acpi_device *acpi, int type) + } + + static const struct acpi_device_id cmpc_accel_device_ids[] = { +- {"ACCE0000", 0}, ++ {CMPC_ACCEL_HID, 0}, + {"", 0} + }; +-MODULE_DEVICE_TABLE(acpi, cmpc_accel_device_ids); + + static struct acpi_driver cmpc_accel_acpi_driver = { + .owner = THIS_MODULE, +@@ -366,10 +370,9 @@ static int cmpc_tablet_resume(struct acpi_device *acpi) + } + + static const struct acpi_device_id cmpc_tablet_device_ids[] = { +- {"TBLT0000", 0}, ++ {CMPC_TABLET_HID, 0}, + {"", 0} + }; +-MODULE_DEVICE_TABLE(acpi, cmpc_tablet_device_ids); + + static struct acpi_driver cmpc_tablet_acpi_driver = { + .owner = THIS_MODULE, +@@ -477,17 +480,16 @@ static int cmpc_bl_remove(struct acpi_device *acpi, int type) + return 0; + } + +-static const struct acpi_device_id cmpc_device_ids[] = { +- {"IPML200", 0}, ++static const struct acpi_device_id cmpc_bl_device_ids[] = { ++ {CMPC_BL_HID, 0}, + {"", 0} + }; +-MODULE_DEVICE_TABLE(acpi, cmpc_device_ids); + + static struct acpi_driver cmpc_bl_acpi_driver = { + .owner = THIS_MODULE, + .name = "cmpc", + .class = "cmpc", +- .ids = cmpc_device_ids, ++ .ids = cmpc_bl_device_ids, + .ops = { + .add = cmpc_bl_add, + .remove = cmpc_bl_remove +@@ -540,10 +542,9 @@ static int cmpc_keys_remove(struct acpi_device *acpi, int type) + } + + static const struct acpi_device_id cmpc_keys_device_ids[] = { +- {"FnBT0000", 0}, ++ {CMPC_KEYS_HID, 0}, + {"", 0} + }; +-MODULE_DEVICE_TABLE(acpi, cmpc_keys_device_ids); + + static struct acpi_driver cmpc_keys_acpi_driver = { + .owner = THIS_MODULE, +@@ -607,3 +608,13 @@ static void cmpc_exit(void) + + module_init(cmpc_init); + module_exit(cmpc_exit); ++ ++static const struct acpi_device_id cmpc_device_ids[] = { ++ {CMPC_ACCEL_HID, 0}, ++ {CMPC_TABLET_HID, 0}, ++ {CMPC_BL_HID, 0}, ++ {CMPC_KEYS_HID, 0}, ++ {"", 0} ++}; ++ ++MODULE_DEVICE_TABLE(acpi, cmpc_device_ids); +diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c +index fa34b92..1b82170 100644 +--- a/drivers/scsi/qlogicpti.c ++++ b/drivers/scsi/qlogicpti.c +@@ -738,7 +738,7 @@ static int __devinit qpti_register_irq(struct qlogicpti *qpti) + * sanely maintain. + */ + if (request_irq(qpti->irq, qpti_intr, +- IRQF_SHARED, "Qlogic/PTI", qpti)) ++ IRQF_SHARED, "QlogicPTI", qpti)) + goto fail; + + printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); +diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c +index 653f22a..bb8fd5b 100644 +--- a/drivers/scsi/scsi_transport_fc.c ++++ b/drivers/scsi/scsi_transport_fc.c +@@ -1216,6 +1216,15 @@ store_fc_vport_delete(struct device *dev, struct device_attribute *attr, + { + struct fc_vport *vport = transport_class_to_vport(dev); + struct Scsi_Host *shost = vport_to_shost(vport); ++ unsigned long flags; ++ ++ spin_lock_irqsave(shost->host_lock, flags); ++ if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) { ++ spin_unlock_irqrestore(shost->host_lock, flags); ++ return -EBUSY; ++ } ++ vport->flags |= FC_VPORT_DELETING; ++ spin_unlock_irqrestore(shost->host_lock, flags); + + fc_queue_work(shost, &vport->vport_delete_work); + return count; +@@ -1805,6 +1814,9 @@ store_fc_host_vport_delete(struct device *dev, struct device_attribute *attr, + list_for_each_entry(vport, &fc_host->vports, peers) { + if ((vport->channel == 0) && + (vport->port_name == wwpn) && (vport->node_name == wwnn)) { ++ if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) ++ break; ++ vport->flags |= FC_VPORT_DELETING; + match = 1; + break; + } +@@ -3354,18 +3366,6 @@ fc_vport_terminate(struct fc_vport *vport) + unsigned long flags; + int stat; + +- spin_lock_irqsave(shost->host_lock, flags); +- if (vport->flags & FC_VPORT_CREATING) { +- spin_unlock_irqrestore(shost->host_lock, flags); +- return -EBUSY; +- } +- if (vport->flags & (FC_VPORT_DEL)) { +- spin_unlock_irqrestore(shost->host_lock, flags); +- return -EALREADY; +- } +- vport->flags |= FC_VPORT_DELETING; +- spin_unlock_irqrestore(shost->host_lock, flags); +- + if (i->f->vport_delete) + stat = i->f->vport_delete(vport); + else +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c +index 55b034b..3c8a024 100644 +--- a/drivers/scsi/ses.c ++++ b/drivers/scsi/ses.c +@@ -591,8 +591,6 @@ static int ses_intf_add(struct device *cdev, + ses_dev->page10_len = len; + buf = NULL; + } +- kfree(hdr_buf); +- + scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); + if (!scomp) + goto err_free; +@@ -604,6 +602,8 @@ static int ses_intf_add(struct device *cdev, + goto err_free; + } + ++ kfree(hdr_buf); ++ + edev->scratch = ses_dev; + for (i = 0; i < components; i++) + edev->component[i].scratch = scomp + i; +diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c +index a678186..4fd67d6 100644 +--- a/drivers/usb/core/devio.c ++++ b/drivers/usb/core/devio.c +@@ -1176,6 +1176,13 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, + free_async(as); + return -ENOMEM; + } ++ /* Isochronous input data may end up being discontiguous ++ * if some of the packets are short. Clear the buffer so ++ * that the gaps don't leak kernel data to userspace. ++ */ ++ if (is_in && uurb->type == USBDEVFS_URB_TYPE_ISO) ++ memset(as->urb->transfer_buffer, 0, ++ uurb->buffer_length); + } + as->urb->dev = ps->dev; + as->urb->pipe = (uurb->type << 30) | +@@ -1312,10 +1319,14 @@ static int processcompl(struct async *as, void __user * __user *arg) + void __user *addr = as->userurb; + unsigned int i; + +- if (as->userbuffer && urb->actual_length) +- if (copy_to_user(as->userbuffer, urb->transfer_buffer, +- urb->actual_length)) ++ if (as->userbuffer && urb->actual_length) { ++ if (urb->number_of_packets > 0) /* Isochronous */ ++ i = urb->transfer_buffer_length; ++ else /* Non-Isoc */ ++ i = urb->actual_length; ++ if (copy_to_user(as->userbuffer, urb->transfer_buffer, i)) + goto err_out; ++ } + if (put_user(as->status, &userurb->status)) + goto err_out; + if (put_user(urb->actual_length, &userurb->actual_length)) +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c +index 1ec3857..9c90b67 100644 +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -995,7 +995,7 @@ rescan: + /* endpoints can be iso streams. for now, we don't + * accelerate iso completions ... so spin a while. + */ +- if (qh->hw->hw_info1 == 0) { ++ if (qh->hw == NULL) { + ehci_vdbg (ehci, "iso delay\n"); + goto idle_timeout; + } +diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c +index 1e391e6..df533ce 100644 +--- a/drivers/usb/host/ehci-sched.c ++++ b/drivers/usb/host/ehci-sched.c +@@ -1121,8 +1121,8 @@ iso_stream_find (struct ehci_hcd *ehci, struct urb *urb) + urb->interval); + } + +- /* if dev->ep [epnum] is a QH, info1.maxpacket is nonzero */ +- } else if (unlikely (stream->hw_info1 != 0)) { ++ /* if dev->ep [epnum] is a QH, hw is set */ ++ } else if (unlikely (stream->hw != NULL)) { + ehci_dbg (ehci, "dev %s ep%d%s, not iso??\n", + urb->dev->devpath, epnum, + usb_pipein(urb->pipe) ? "in" : "out"); +@@ -1563,13 +1563,27 @@ itd_patch( + static inline void + itd_link (struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd) + { +- /* always prepend ITD/SITD ... only QH tree is order-sensitive */ +- itd->itd_next = ehci->pshadow [frame]; +- itd->hw_next = ehci->periodic [frame]; +- ehci->pshadow [frame].itd = itd; ++ union ehci_shadow *prev = &ehci->pshadow[frame]; ++ __hc32 *hw_p = &ehci->periodic[frame]; ++ union ehci_shadow here = *prev; ++ __hc32 type = 0; ++ ++ /* skip any iso nodes which might belong to previous microframes */ ++ while (here.ptr) { ++ type = Q_NEXT_TYPE(ehci, *hw_p); ++ if (type == cpu_to_hc32(ehci, Q_TYPE_QH)) ++ break; ++ prev = periodic_next_shadow(ehci, prev, type); ++ hw_p = shadow_next_periodic(ehci, &here, type); ++ here = *prev; ++ } ++ ++ itd->itd_next = here; ++ itd->hw_next = *hw_p; ++ prev->itd = itd; + itd->frame = frame; + wmb (); +- ehci->periodic[frame] = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); ++ *hw_p = cpu_to_hc32(ehci, itd->itd_dma | Q_TYPE_ITD); + } + + /* fit urb's itds into the selected schedule slot; activate as needed */ +diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h +index 2d85e21..b1dce96 100644 +--- a/drivers/usb/host/ehci.h ++++ b/drivers/usb/host/ehci.h +@@ -394,9 +394,8 @@ struct ehci_iso_sched { + * acts like a qh would, if EHCI had them for ISO. + */ + struct ehci_iso_stream { +- /* first two fields match QH, but info1 == 0 */ +- __hc32 hw_next; +- __hc32 hw_info1; ++ /* first field matches ehci_hq, but is NULL */ ++ struct ehci_qh_hw *hw; + + u32 refcount; + u8 bEndpointAddress; +diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c +index bee558a..f71a73a 100644 +--- a/drivers/usb/host/r8a66597-hcd.c ++++ b/drivers/usb/host/r8a66597-hcd.c +@@ -418,7 +418,7 @@ static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb) + + /* this function must be called with interrupt disabled */ + static void free_usb_address(struct r8a66597 *r8a66597, +- struct r8a66597_device *dev) ++ struct r8a66597_device *dev, int reset) + { + int port; + +@@ -430,7 +430,13 @@ static void free_usb_address(struct r8a66597 *r8a66597, + dev->state = USB_STATE_DEFAULT; + r8a66597->address_map &= ~(1 << dev->address); + dev->address = 0; +- dev_set_drvdata(&dev->udev->dev, NULL); ++ /* ++ * Only when resetting USB, it is necessary to erase drvdata. When ++ * a usb device with usb hub is disconnect, "dev->udev" is already ++ * freed on usb_desconnect(). So we cannot access the data. ++ */ ++ if (reset) ++ dev_set_drvdata(&dev->udev->dev, NULL); + list_del(&dev->device_list); + kfree(dev); + +@@ -1069,7 +1075,7 @@ static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port) + struct r8a66597_device *dev = r8a66597->root_hub[port].dev; + + disable_r8a66597_pipe_all(r8a66597, dev); +- free_usb_address(r8a66597, dev); ++ free_usb_address(r8a66597, dev, 0); + + start_root_hub_sampling(r8a66597, port, 0); + } +@@ -2085,7 +2091,7 @@ static void update_usb_address_map(struct r8a66597 *r8a66597, + spin_lock_irqsave(&r8a66597->lock, flags); + dev = get_r8a66597_device(r8a66597, addr); + disable_r8a66597_pipe_all(r8a66597, dev); +- free_usb_address(r8a66597, dev); ++ free_usb_address(r8a66597, dev, 0); + put_child_connect_map(r8a66597, addr); + spin_unlock_irqrestore(&r8a66597->lock, flags); + } +@@ -2228,7 +2234,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + rh->port |= (1 << USB_PORT_FEAT_RESET); + + disable_r8a66597_pipe_all(r8a66597, dev); +- free_usb_address(r8a66597, dev); ++ free_usb_address(r8a66597, dev, 1); + + r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT, + get_dvstctr_reg(port)); +diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c +index 5e92c72..fa920c7 100644 +--- a/drivers/usb/host/xhci-hcd.c ++++ b/drivers/usb/host/xhci-hcd.c +@@ -1173,6 +1173,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, + cmd_completion = &virt_dev->cmd_completion; + cmd_status = &virt_dev->cmd_status; + } ++ init_completion(cmd_completion); + + if (!ctx_change) + ret = xhci_queue_configure_endpoint(xhci, in_ctx->dma, +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c +index 34acf6c..ca9e3ba 100644 +--- a/drivers/usb/serial/ftdi_sio.c ++++ b/drivers/usb/serial/ftdi_sio.c +@@ -658,6 +658,7 @@ static struct usb_device_id id_table_combined [] = { + { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, + { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, + { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, ++ { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, +diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h +index d10b5a8..8f9e805 100644 +--- a/drivers/usb/serial/ftdi_sio_ids.h ++++ b/drivers/usb/serial/ftdi_sio_ids.h +@@ -501,6 +501,13 @@ + #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ + + /* ++ * Contec products (http://www.contec.com) ++ * Submitted by Daniel Sangorrin ++ */ ++#define CONTEC_VID 0x06CE /* Vendor ID */ ++#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ ++ ++/* + * Definitions for B&B Electronics products. + */ + #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 6e94a67..d93283d 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -288,7 +288,9 @@ static int option_resume(struct usb_serial *serial); + + #define QUALCOMM_VENDOR_ID 0x05C6 + +-#define MAXON_VENDOR_ID 0x16d8 ++#define CMOTECH_VENDOR_ID 0x16d8 ++#define CMOTECH_PRODUCT_6008 0x6008 ++#define CMOTECH_PRODUCT_6280 0x6280 + + #define TELIT_VENDOR_ID 0x1bc7 + #define TELIT_PRODUCT_UC864E 0x1003 +@@ -520,7 +522,8 @@ static struct usb_device_id option_ids[] = { + { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ +- { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ ++ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index 7528b8d..8ab4ab2 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -47,6 +47,35 @@ static struct usb_device_id id_table[] = { + {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ + {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ + {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ ++ {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ ++ {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ ++ {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ ++ {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ ++ {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ ++ {USB_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ ++ {USB_DEVICE(0x03f0, 0x241d)}, /* HP Gobi 2000 QDL device (VP412) */ ++ {USB_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ ++ {USB_DEVICE(0x05c6, 0x9214)}, /* Acer Gobi 2000 QDL device (VP413) */ ++ {USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ ++ {USB_DEVICE(0x05c6, 0x9264)}, /* Asus Gobi 2000 QDL device (VR305) */ ++ {USB_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ ++ {USB_DEVICE(0x05c6, 0x9234)}, /* Top Global Gobi 2000 QDL device (VR306) */ ++ {USB_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ ++ {USB_DEVICE(0x05c6, 0x9274)}, /* iRex Technologies Gobi 2000 QDL device (VR307) */ ++ {USB_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ ++ {USB_DEVICE(0x1199, 0x9000)}, /* Sierra Wireless Gobi 2000 QDL device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ ++ {USB_DEVICE(0x16d8, 0x8001)}, /* CMDTech Gobi 2000 QDL device (VU922) */ ++ {USB_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ + { } /* Terminating entry */ + }; + MODULE_DEVICE_TABLE(usb, id_table); +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index 5a5c303..f15fb02 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -909,6 +909,18 @@ config FB_XVR2500 + mostly initialized the card already. It is treated as a + completely dumb framebuffer device. + ++config FB_XVR1000 ++ bool "Sun XVR-1000 support" ++ depends on (FB = y) && SPARC64 ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This is the framebuffer device for the Sun XVR-1000 and similar ++ graphics cards. The driver only works on sparc64 systems where ++ the system firmware has mostly initialized the card already. It ++ is treated as a completely dumb framebuffer device. ++ + config FB_PVR2 + tristate "NEC PowerVR 2 display support" + depends on FB && SH_DREAMCAST +diff --git a/drivers/video/Makefile b/drivers/video/Makefile +index 4ecb30c..8c9a357 100644 +--- a/drivers/video/Makefile ++++ b/drivers/video/Makefile +@@ -79,6 +79,7 @@ obj-$(CONFIG_FB_N411) += n411.o + obj-$(CONFIG_FB_HGA) += hgafb.o + obj-$(CONFIG_FB_XVR500) += sunxvr500.o + obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o ++obj-$(CONFIG_FB_XVR1000) += sunxvr1000.o + obj-$(CONFIG_FB_IGA) += igafb.o + obj-$(CONFIG_FB_APOLLO) += dnfb.o + obj-$(CONFIG_FB_Q40) += q40fb.o +diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c +new file mode 100644 +index 0000000..a8248c0 +--- /dev/null ++++ b/drivers/video/sunxvr1000.c +@@ -0,0 +1,228 @@ ++/* sunxvr1000.c: Sun XVR-1000 driver for sparc64 systems ++ * ++ * Copyright (C) 2010 David S. Miller (davem@davemloft.net) ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct gfb_info { ++ struct fb_info *info; ++ ++ char __iomem *fb_base; ++ unsigned long fb_base_phys; ++ ++ struct device_node *of_node; ++ ++ unsigned int width; ++ unsigned int height; ++ unsigned int depth; ++ unsigned int fb_size; ++ ++ u32 pseudo_palette[16]; ++}; ++ ++static int __devinit gfb_get_props(struct gfb_info *gp) ++{ ++ gp->width = of_getintprop_default(gp->of_node, "width", 0); ++ gp->height = of_getintprop_default(gp->of_node, "height", 0); ++ gp->depth = of_getintprop_default(gp->of_node, "depth", 32); ++ ++ if (!gp->width || !gp->height) { ++ printk(KERN_ERR "gfb: Critical properties missing for %s\n", ++ gp->of_node->full_name); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int gfb_setcolreg(unsigned regno, ++ unsigned red, unsigned green, unsigned blue, ++ unsigned transp, struct fb_info *info) ++{ ++ u32 value; ++ ++ if (regno < 16) { ++ red >>= 8; ++ green >>= 8; ++ blue >>= 8; ++ ++ value = (blue << 16) | (green << 8) | red; ++ ((u32 *)info->pseudo_palette)[regno] = value; ++ } ++ ++ return 0; ++} ++ ++static struct fb_ops gfb_ops = { ++ .owner = THIS_MODULE, ++ .fb_setcolreg = gfb_setcolreg, ++ .fb_fillrect = cfb_fillrect, ++ .fb_copyarea = cfb_copyarea, ++ .fb_imageblit = cfb_imageblit, ++}; ++ ++static int __devinit gfb_set_fbinfo(struct gfb_info *gp) ++{ ++ struct fb_info *info = gp->info; ++ struct fb_var_screeninfo *var = &info->var; ++ ++ info->flags = FBINFO_DEFAULT; ++ info->fbops = &gfb_ops; ++ info->screen_base = gp->fb_base; ++ info->screen_size = gp->fb_size; ++ ++ info->pseudo_palette = gp->pseudo_palette; ++ ++ /* Fill fix common fields */ ++ strlcpy(info->fix.id, "gfb", sizeof(info->fix.id)); ++ info->fix.smem_start = gp->fb_base_phys; ++ info->fix.smem_len = gp->fb_size; ++ info->fix.type = FB_TYPE_PACKED_PIXELS; ++ if (gp->depth == 32 || gp->depth == 24) ++ info->fix.visual = FB_VISUAL_TRUECOLOR; ++ else ++ info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ++ ++ var->xres = gp->width; ++ var->yres = gp->height; ++ var->xres_virtual = var->xres; ++ var->yres_virtual = var->yres; ++ var->bits_per_pixel = gp->depth; ++ ++ var->red.offset = 0; ++ var->red.length = 8; ++ var->green.offset = 8; ++ var->green.length = 8; ++ var->blue.offset = 16; ++ var->blue.length = 8; ++ var->transp.offset = 0; ++ var->transp.length = 0; ++ ++ if (fb_alloc_cmap(&info->cmap, 256, 0)) { ++ printk(KERN_ERR "gfb: Cannot allocate color map.\n"); ++ return -ENOMEM; ++ } ++ ++ return 0; ++} ++ ++static int __devinit gfb_probe(struct of_device *op, ++ const struct of_device_id *match) ++{ ++ struct device_node *dp = op->node; ++ struct fb_info *info; ++ struct gfb_info *gp; ++ int err; ++ ++ info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev); ++ if (!info) { ++ printk(KERN_ERR "gfb: Cannot allocate fb_info\n"); ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ gp = info->par; ++ gp->info = info; ++ gp->of_node = dp; ++ ++ gp->fb_base_phys = op->resource[6].start; ++ ++ err = gfb_get_props(gp); ++ if (err) ++ goto err_release_fb; ++ ++ /* Framebuffer length is the same regardless of resolution. */ ++ info->fix.line_length = 16384; ++ gp->fb_size = info->fix.line_length * gp->height; ++ ++ gp->fb_base = of_ioremap(&op->resource[6], 0, ++ gp->fb_size, "gfb fb"); ++ if (!gp->fb_base) ++ goto err_release_fb; ++ ++ err = gfb_set_fbinfo(gp); ++ if (err) ++ goto err_unmap_fb; ++ ++ printk("gfb: Found device at %s\n", dp->full_name); ++ ++ err = register_framebuffer(info); ++ if (err < 0) { ++ printk(KERN_ERR "gfb: Could not register framebuffer %s\n", ++ dp->full_name); ++ goto err_unmap_fb; ++ } ++ ++ dev_set_drvdata(&op->dev, info); ++ ++ return 0; ++ ++err_unmap_fb: ++ of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size); ++ ++err_release_fb: ++ framebuffer_release(info); ++ ++err_out: ++ return err; ++} ++ ++static int __devexit gfb_remove(struct of_device *op) ++{ ++ struct fb_info *info = dev_get_drvdata(&op->dev); ++ struct gfb_info *gp = info->par; ++ ++ unregister_framebuffer(info); ++ ++ iounmap(gp->fb_base); ++ ++ of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size); ++ ++ framebuffer_release(info); ++ ++ dev_set_drvdata(&op->dev, NULL); ++ ++ return 0; ++} ++ ++static const struct of_device_id gfb_match[] = { ++ { ++ .name = "SUNW,gfb", ++ }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ffb_match); ++ ++static struct of_platform_driver gfb_driver = { ++ .name = "gfb", ++ .match_table = gfb_match, ++ .probe = gfb_probe, ++ .remove = __devexit_p(gfb_remove), ++}; ++ ++static int __init gfb_init(void) ++{ ++ if (fb_get_options("gfb", NULL)) ++ return -ENODEV; ++ ++ return of_register_driver(&gfb_driver, &of_bus_type); ++} ++ ++static void __exit gfb_exit(void) ++{ ++ of_unregister_driver(&gfb_driver); ++} ++ ++module_init(gfb_init); ++module_exit(gfb_exit); ++ ++MODULE_DESCRIPTION("framebuffer driver for Sun XVR-1000 graphics"); ++MODULE_AUTHOR("David S. Miller "); ++MODULE_VERSION("1.0"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c +index 28d9cf7..7127bfe 100644 +--- a/drivers/virtio/virtio_pci.c ++++ b/drivers/virtio/virtio_pci.c +@@ -473,7 +473,8 @@ static void vp_del_vqs(struct virtio_device *vdev) + + list_for_each_entry_safe(vq, n, &vdev->vqs, list) { + info = vq->priv; +- if (vp_dev->per_vq_vectors) ++ if (vp_dev->per_vq_vectors && ++ info->msix_vector != VIRTIO_MSI_NO_VECTOR) + free_irq(vp_dev->msix_entries[info->msix_vector].vector, + vq); + vp_del_vq(vq); +diff --git a/fs/exec.c b/fs/exec.c +index cce6bbd..9071360 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1923,8 +1923,9 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs) + /* + * Dont allow local users get cute and trick others to coredump + * into their pre-created files: ++ * Note, this is not relevant for pipes + */ +- if (inode->i_uid != current_fsuid()) ++ if (!ispipe && (inode->i_uid != current_fsuid())) + goto close_fail; + if (!cprm.file->f_op) + goto close_fail; +diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c +index a6abbae..e6dd2ae 100644 +--- a/fs/gfs2/file.c ++++ b/fs/gfs2/file.c +@@ -640,7 +640,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) + + if (!(fl->fl_flags & FL_POSIX)) + return -ENOLCK; +- if (__mandatory_lock(&ip->i_inode)) ++ if (__mandatory_lock(&ip->i_inode) && fl->fl_type != F_UNLCK) + return -ENOLCK; + + if (cmd == F_CANCELLK) { +diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h +index 944b627..69e7b81 100644 +--- a/fs/nfs/delegation.h ++++ b/fs/nfs/delegation.h +@@ -71,4 +71,10 @@ static inline int nfs_inode_return_delegation(struct inode *inode) + } + #endif + ++static inline int nfs_have_delegated_attributes(struct inode *inode) ++{ ++ return nfs_have_delegation(inode, FMODE_READ) && ++ !(NFS_I(inode)->cache_validity & NFS_INO_REVAL_FORCED); ++} ++ + #endif +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c +index 3c7f03b..8b5382e 100644 +--- a/fs/nfs/dir.c ++++ b/fs/nfs/dir.c +@@ -1789,7 +1789,7 @@ static int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, str + cache = nfs_access_search_rbtree(inode, cred); + if (cache == NULL) + goto out; +- if (!nfs_have_delegation(inode, FMODE_READ) && ++ if (!nfs_have_delegated_attributes(inode) && + !time_in_range_open(jiffies, cache->jiffies, cache->jiffies + nfsi->attrtimeo)) + goto out_stale; + res->jiffies = cache->jiffies; +diff --git a/fs/nfs/file.c b/fs/nfs/file.c +index 63f2071..bdd2142 100644 +--- a/fs/nfs/file.c ++++ b/fs/nfs/file.c +@@ -486,7 +486,8 @@ static int nfs_release_page(struct page *page, gfp_t gfp) + { + dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page); + +- if (gfp & __GFP_WAIT) ++ /* Only do I/O if gfp is a superset of GFP_KERNEL */ ++ if ((gfp & GFP_KERNEL) == GFP_KERNEL) + nfs_wb_page(page->mapping->host, page); + /* If PagePrivate() is set, then the page is not freeable */ + if (PagePrivate(page)) +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c +index f141bde..5f59a2d 100644 +--- a/fs/nfs/inode.c ++++ b/fs/nfs/inode.c +@@ -759,7 +759,7 @@ int nfs_attribute_timeout(struct inode *inode) + { + struct nfs_inode *nfsi = NFS_I(inode); + +- if (nfs_have_delegation(inode, FMODE_READ)) ++ if (nfs_have_delegated_attributes(inode)) + return 0; + return !time_in_range_open(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo); + } +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c +index a12c45b..29d9d36 100644 +--- a/fs/nfs/pagelist.c ++++ b/fs/nfs/pagelist.c +@@ -112,12 +112,10 @@ void nfs_unlock_request(struct nfs_page *req) + */ + int nfs_set_page_tag_locked(struct nfs_page *req) + { +- struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode); +- + if (!nfs_lock_request_dontget(req)) + return 0; + if (req->wb_page != NULL) +- radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); ++ radix_tree_tag_set(&NFS_I(req->wb_context->path.dentry->d_inode)->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); + return 1; + } + +@@ -126,10 +124,10 @@ int nfs_set_page_tag_locked(struct nfs_page *req) + */ + void nfs_clear_page_tag_locked(struct nfs_page *req) + { +- struct inode *inode = req->wb_context->path.dentry->d_inode; +- struct nfs_inode *nfsi = NFS_I(inode); +- + if (req->wb_page != NULL) { ++ struct inode *inode = req->wb_context->path.dentry->d_inode; ++ struct nfs_inode *nfsi = NFS_I(inode); ++ + spin_lock(&inode->i_lock); + radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); + nfs_unlock_request(req); +@@ -142,16 +140,22 @@ void nfs_clear_page_tag_locked(struct nfs_page *req) + * nfs_clear_request - Free up all resources allocated to the request + * @req: + * +- * Release page resources associated with a write request after it +- * has completed. ++ * Release page and open context resources associated with a read/write ++ * request after it has completed. + */ + void nfs_clear_request(struct nfs_page *req) + { + struct page *page = req->wb_page; ++ struct nfs_open_context *ctx = req->wb_context; ++ + if (page != NULL) { + page_cache_release(page); + req->wb_page = NULL; + } ++ if (ctx != NULL) { ++ put_nfs_open_context(ctx); ++ req->wb_context = NULL; ++ } + } + + +@@ -165,9 +169,8 @@ static void nfs_free_request(struct kref *kref) + { + struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); + +- /* Release struct file or cached credential */ ++ /* Release struct file and open context */ + nfs_clear_request(req); +- put_nfs_open_context(req->wb_context); + nfs_page_free(req); + } + +diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c +index 105b508..ddce17b 100644 +--- a/fs/nilfs2/segment.c ++++ b/fs/nilfs2/segment.c +@@ -1902,8 +1902,7 @@ static void nilfs_segctor_abort_construction(struct nilfs_sc_info *sci, + + list_splice_tail_init(&sci->sc_write_logs, &logs); + ret = nilfs_wait_on_logs(&logs); +- if (ret) +- nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret); ++ nilfs_abort_logs(&logs, NULL, sci->sc_super_root, ret ? : err); + + list_splice_tail_init(&sci->sc_segbufs, &logs); + nilfs_cancel_segusage(&logs, nilfs->ns_sufile); +diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c +index 0028d2e..90be97f 100644 +--- a/fs/partitions/msdos.c ++++ b/fs/partitions/msdos.c +@@ -31,14 +31,17 @@ + */ + #include + +-#define SYS_IND(p) (get_unaligned(&p->sys_ind)) +-#define NR_SECTS(p) ({ __le32 __a = get_unaligned(&p->nr_sects); \ +- le32_to_cpu(__a); \ +- }) ++#define SYS_IND(p) get_unaligned(&p->sys_ind) + +-#define START_SECT(p) ({ __le32 __a = get_unaligned(&p->start_sect); \ +- le32_to_cpu(__a); \ +- }) ++static inline sector_t nr_sects(struct partition *p) ++{ ++ return (sector_t)get_unaligned_le32(&p->nr_sects); ++} ++ ++static inline sector_t start_sect(struct partition *p) ++{ ++ return (sector_t)get_unaligned_le32(&p->start_sect); ++} + + static inline int is_extended_partition(struct partition *p) + { +@@ -104,13 +107,13 @@ static int aix_magic_present(unsigned char *p, struct block_device *bdev) + + static void + parse_extended(struct parsed_partitions *state, struct block_device *bdev, +- u32 first_sector, u32 first_size) ++ sector_t first_sector, sector_t first_size) + { + struct partition *p; + Sector sect; + unsigned char *data; +- u32 this_sector, this_size; +- int sector_size = bdev_logical_block_size(bdev) / 512; ++ sector_t this_sector, this_size; ++ sector_t sector_size = bdev_logical_block_size(bdev) / 512; + int loopct = 0; /* number of links followed + without finding a data partition */ + int i; +@@ -145,14 +148,14 @@ parse_extended(struct parsed_partitions *state, struct block_device *bdev, + * First process the data partition(s) + */ + for (i=0; i<4; i++, p++) { +- u32 offs, size, next; +- if (!NR_SECTS(p) || is_extended_partition(p)) ++ sector_t offs, size, next; ++ if (!nr_sects(p) || is_extended_partition(p)) + continue; + + /* Check the 3rd and 4th entries - + these sometimes contain random garbage */ +- offs = START_SECT(p)*sector_size; +- size = NR_SECTS(p)*sector_size; ++ offs = start_sect(p)*sector_size; ++ size = nr_sects(p)*sector_size; + next = this_sector + offs; + if (i >= 2) { + if (offs + size > this_size) +@@ -179,13 +182,13 @@ parse_extended(struct parsed_partitions *state, struct block_device *bdev, + */ + p -= 4; + for (i=0; i<4; i++, p++) +- if (NR_SECTS(p) && is_extended_partition(p)) ++ if (nr_sects(p) && is_extended_partition(p)) + break; + if (i == 4) + goto done; /* nothing left to do */ + +- this_sector = first_sector + START_SECT(p) * sector_size; +- this_size = NR_SECTS(p) * sector_size; ++ this_sector = first_sector + start_sect(p) * sector_size; ++ this_size = nr_sects(p) * sector_size; + put_dev_sector(sect); + } + done: +@@ -197,7 +200,7 @@ done: + + static void + parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_SOLARIS_X86_PARTITION + Sector sect; +@@ -244,7 +247,7 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev, + */ + static void + parse_bsd(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin, char *flavour, ++ sector_t offset, sector_t size, int origin, char *flavour, + int max_partitions) + { + Sector sect; +@@ -263,7 +266,7 @@ parse_bsd(struct parsed_partitions *state, struct block_device *bdev, + if (le16_to_cpu(l->d_npartitions) < max_partitions) + max_partitions = le16_to_cpu(l->d_npartitions); + for (p = l->d_partitions; p - l->d_partitions < max_partitions; p++) { +- u32 bsd_start, bsd_size; ++ sector_t bsd_start, bsd_size; + + if (state->next == state->limit) + break; +@@ -290,7 +293,7 @@ parse_bsd(struct parsed_partitions *state, struct block_device *bdev, + + static void + parse_freebsd(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_BSD_DISKLABEL + parse_bsd(state, bdev, offset, size, origin, +@@ -300,7 +303,7 @@ parse_freebsd(struct parsed_partitions *state, struct block_device *bdev, + + static void + parse_netbsd(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_BSD_DISKLABEL + parse_bsd(state, bdev, offset, size, origin, +@@ -310,7 +313,7 @@ parse_netbsd(struct parsed_partitions *state, struct block_device *bdev, + + static void + parse_openbsd(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_BSD_DISKLABEL + parse_bsd(state, bdev, offset, size, origin, +@@ -324,7 +327,7 @@ parse_openbsd(struct parsed_partitions *state, struct block_device *bdev, + */ + static void + parse_unixware(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_UNIXWARE_DISKLABEL + Sector sect; +@@ -348,7 +351,8 @@ parse_unixware(struct parsed_partitions *state, struct block_device *bdev, + + if (p->s_label != UNIXWARE_FS_UNUSED) + put_partition(state, state->next++, +- START_SECT(p), NR_SECTS(p)); ++ le32_to_cpu(p->start_sect), ++ le32_to_cpu(p->nr_sects)); + p++; + } + put_dev_sector(sect); +@@ -363,7 +367,7 @@ parse_unixware(struct parsed_partitions *state, struct block_device *bdev, + */ + static void + parse_minix(struct parsed_partitions *state, struct block_device *bdev, +- u32 offset, u32 size, int origin) ++ sector_t offset, sector_t size, int origin) + { + #ifdef CONFIG_MINIX_SUBPARTITION + Sector sect; +@@ -390,7 +394,7 @@ parse_minix(struct parsed_partitions *state, struct block_device *bdev, + /* add each partition in use */ + if (SYS_IND(p) == MINIX_PARTITION) + put_partition(state, state->next++, +- START_SECT(p), NR_SECTS(p)); ++ start_sect(p), nr_sects(p)); + } + printk(" >\n"); + } +@@ -401,7 +405,7 @@ parse_minix(struct parsed_partitions *state, struct block_device *bdev, + static struct { + unsigned char id; + void (*parse)(struct parsed_partitions *, struct block_device *, +- u32, u32, int); ++ sector_t, sector_t, int); + } subtypes[] = { + {FREEBSD_PARTITION, parse_freebsd}, + {NETBSD_PARTITION, parse_netbsd}, +@@ -415,7 +419,7 @@ static struct { + + int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) + { +- int sector_size = bdev_logical_block_size(bdev) / 512; ++ sector_t sector_size = bdev_logical_block_size(bdev) / 512; + Sector sect; + unsigned char *data; + struct partition *p; +@@ -483,14 +487,21 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) + + state->next = 5; + for (slot = 1 ; slot <= 4 ; slot++, p++) { +- u32 start = START_SECT(p)*sector_size; +- u32 size = NR_SECTS(p)*sector_size; ++ sector_t start = start_sect(p)*sector_size; ++ sector_t size = nr_sects(p)*sector_size; + if (!size) + continue; + if (is_extended_partition(p)) { +- /* prevent someone doing mkfs or mkswap on an +- extended partition, but leave room for LILO */ +- put_partition(state, slot, start, size == 1 ? 1 : 2); ++ /* ++ * prevent someone doing mkfs or mkswap on an ++ * extended partition, but leave room for LILO ++ * FIXME: this uses one logical sector for > 512b ++ * sector, although it may not be enough/proper. ++ */ ++ sector_t n = 2; ++ n = min(size, max(sector_size, n)); ++ put_partition(state, slot, start, n); ++ + printk(" <"); + parse_extended(state, bdev, start, size); + printk(" >"); +@@ -513,7 +524,7 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) + unsigned char id = SYS_IND(p); + int n; + +- if (!NR_SECTS(p)) ++ if (!nr_sects(p)) + continue; + + for (n = 0; subtypes[n].parse && id != subtypes[n].id; n++) +@@ -521,8 +532,8 @@ int msdos_partition(struct parsed_partitions *state, struct block_device *bdev) + + if (!subtypes[n].parse) + continue; +- subtypes[n].parse(state, bdev, START_SECT(p)*sector_size, +- NR_SECTS(p)*sector_size, slot); ++ subtypes[n].parse(state, bdev, start_sect(p)*sector_size, ++ nr_sects(p)*sector_size, slot); + } + put_dev_sector(sect); + return 1; +diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c +index 3fc62b0..6e722c1 100644 +--- a/fs/quota/dquot.c ++++ b/fs/quota/dquot.c +@@ -225,6 +225,8 @@ static struct hlist_head *dquot_hash; + struct dqstats dqstats; + EXPORT_SYMBOL(dqstats); + ++static qsize_t inode_get_rsv_space(struct inode *inode); ++ + static inline unsigned int + hashfn(const struct super_block *sb, unsigned int id, int type) + { +@@ -840,11 +842,14 @@ static int dqinit_needed(struct inode *inode, int type) + static void add_dquot_ref(struct super_block *sb, int type) + { + struct inode *inode, *old_inode = NULL; ++ int reserved = 0; + + spin_lock(&inode_lock); + list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { + if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) + continue; ++ if (unlikely(inode_get_rsv_space(inode) > 0)) ++ reserved = 1; + if (!atomic_read(&inode->i_writecount)) + continue; + if (!dqinit_needed(inode, type)) +@@ -865,6 +870,12 @@ static void add_dquot_ref(struct super_block *sb, int type) + } + spin_unlock(&inode_lock); + iput(old_inode); ++ ++ if (reserved) { ++ printk(KERN_WARNING "VFS (%s): Writes happened before quota" ++ " was turned on thus quota information is probably " ++ "inconsistent. Please run quotacheck(8).\n", sb->s_id); ++ } + } + + /* +@@ -978,10 +989,12 @@ static inline void dquot_resv_space(struct dquot *dquot, qsize_t number) + /* + * Claim reserved quota space + */ +-static void dquot_claim_reserved_space(struct dquot *dquot, +- qsize_t number) ++static void dquot_claim_reserved_space(struct dquot *dquot, qsize_t number) + { +- WARN_ON(dquot->dq_dqb.dqb_rsvspace < number); ++ if (dquot->dq_dqb.dqb_rsvspace < number) { ++ WARN_ON_ONCE(1); ++ number = dquot->dq_dqb.dqb_rsvspace; ++ } + dquot->dq_dqb.dqb_curspace += number; + dquot->dq_dqb.dqb_rsvspace -= number; + } +@@ -989,7 +1002,12 @@ static void dquot_claim_reserved_space(struct dquot *dquot, + static inline + void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) + { +- dquot->dq_dqb.dqb_rsvspace -= number; ++ if (dquot->dq_dqb.dqb_rsvspace >= number) ++ dquot->dq_dqb.dqb_rsvspace -= number; ++ else { ++ WARN_ON_ONCE(1); ++ dquot->dq_dqb.dqb_rsvspace = 0; ++ } + } + + static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) +@@ -1242,6 +1260,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space) + return QUOTA_NL_BHARDBELOW; + return QUOTA_NL_NOWARN; + } ++ + /* + * Initialize quota pointers in inode + * We do things in a bit complicated way but by that we avoid calling +@@ -1253,6 +1272,7 @@ int dquot_initialize(struct inode *inode, int type) + int cnt, ret = 0; + struct dquot *got[MAXQUOTAS] = { NULL, NULL }; + struct super_block *sb = inode->i_sb; ++ qsize_t rsv; + + /* First test before acquiring mutex - solves deadlocks when we + * re-enter the quota code and are already holding the mutex */ +@@ -1287,6 +1307,13 @@ int dquot_initialize(struct inode *inode, int type) + if (!inode->i_dquot[cnt]) { + inode->i_dquot[cnt] = got[cnt]; + got[cnt] = NULL; ++ /* ++ * Make quota reservation system happy if someone ++ * did a write before quota was turned on ++ */ ++ rsv = inode_get_rsv_space(inode); ++ if (unlikely(rsv)) ++ dquot_resv_space(inode->i_dquot[cnt], rsv); + } + } + out_err: +@@ -1351,28 +1378,30 @@ static qsize_t *inode_reserved_space(struct inode * inode) + return inode->i_sb->dq_op->get_reserved_space(inode); + } + +-static void inode_add_rsv_space(struct inode *inode, qsize_t number) ++void inode_add_rsv_space(struct inode *inode, qsize_t number) + { + spin_lock(&inode->i_lock); + *inode_reserved_space(inode) += number; + spin_unlock(&inode->i_lock); + } ++EXPORT_SYMBOL(inode_add_rsv_space); + +- +-static void inode_claim_rsv_space(struct inode *inode, qsize_t number) ++void inode_claim_rsv_space(struct inode *inode, qsize_t number) + { + spin_lock(&inode->i_lock); + *inode_reserved_space(inode) -= number; + __inode_add_bytes(inode, number); + spin_unlock(&inode->i_lock); + } ++EXPORT_SYMBOL(inode_claim_rsv_space); + +-static void inode_sub_rsv_space(struct inode *inode, qsize_t number) ++void inode_sub_rsv_space(struct inode *inode, qsize_t number) + { + spin_lock(&inode->i_lock); + *inode_reserved_space(inode) -= number; + spin_unlock(&inode->i_lock); + } ++EXPORT_SYMBOL(inode_sub_rsv_space); + + static qsize_t inode_get_rsv_space(struct inode *inode) + { +diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h +index 5032b9a..ad5ec1d 100644 +--- a/include/linux/decompress/mm.h ++++ b/include/linux/decompress/mm.h +@@ -14,11 +14,21 @@ + + /* Code active when included from pre-boot environment: */ + ++/* ++ * Some architectures want to ensure there is no local data in their ++ * pre-boot environment, so that data can arbitarily relocated (via ++ * GOT references). This is achieved by defining STATIC_RW_DATA to ++ * be null. ++ */ ++#ifndef STATIC_RW_DATA ++#define STATIC_RW_DATA static ++#endif ++ + /* A trivial malloc implementation, adapted from + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + */ +-static unsigned long malloc_ptr; +-static int malloc_count; ++STATIC_RW_DATA unsigned long malloc_ptr; ++STATIC_RW_DATA int malloc_count; + + static void *malloc(int size) + { +diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h +index 1822d63..16b92d0 100644 +--- a/include/linux/if_tunnel.h ++++ b/include/linux/if_tunnel.h +@@ -2,6 +2,7 @@ + #define _IF_TUNNEL_H_ + + #include ++#include + + #ifdef __KERNEL__ + #include +diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h +index bc0fc79..ece0b1c 100644 +--- a/include/linux/kfifo.h ++++ b/include/linux/kfifo.h +@@ -102,8 +102,6 @@ union { \ + unsigned char name##kfifo_buffer[size]; \ + struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) + +-#undef __kfifo_initializer +- + extern void kfifo_init(struct kfifo *fifo, void *buffer, + unsigned int size); + extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, +diff --git a/include/linux/kvm.h b/include/linux/kvm.h +index a24de0b..553a388 100644 +--- a/include/linux/kvm.h ++++ b/include/linux/kvm.h +@@ -497,6 +497,7 @@ struct kvm_ioeventfd { + #endif + #define KVM_CAP_S390_PSW 42 + #define KVM_CAP_PPC_SEGSTATE 43 ++#define KVM_CAP_X86_ROBUST_SINGLESTEP 51 + + #ifdef KVM_CAP_IRQ_ROUTING + +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index 99914e6..03e8d81 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -2023,12 +2023,12 @@ static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, + * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and + * ARP on active-backup slaves with arp_validate enabled. + */ +-static inline int skb_bond_should_drop(struct sk_buff *skb) ++static inline int skb_bond_should_drop(struct sk_buff *skb, ++ struct net_device *master) + { +- struct net_device *dev = skb->dev; +- struct net_device *master = dev->master; +- + if (master) { ++ struct net_device *dev = skb->dev; ++ + if (master->priv_flags & IFF_MASTER_ARPMON) + dev->last_rx = jiffies; + +diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h +index 49d321f..264d83d 100644 +--- a/include/linux/netfilter/nfnetlink.h ++++ b/include/linux/netfilter/nfnetlink.h +@@ -76,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); + extern int nfnetlink_has_listeners(unsigned int group); + extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, + int echo, gfp_t flags); +-extern void nfnetlink_set_err(u32 pid, u32 group, int error); ++extern int nfnetlink_set_err(u32 pid, u32 group, int error); + extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); + + extern void nfnl_lock(void); +diff --git a/include/linux/netlink.h b/include/linux/netlink.h +index fde27c0..6eaca5e 100644 +--- a/include/linux/netlink.h ++++ b/include/linux/netlink.h +@@ -188,7 +188,7 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group); + extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); + extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, + __u32 group, gfp_t allocation); +-extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); ++extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); + extern int netlink_register_notifier(struct notifier_block *nb); + extern int netlink_unregister_notifier(struct notifier_block *nb); + +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index c8ea0c7..41f977b 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -793,6 +793,13 @@ struct perf_sample_data { + struct perf_raw_record *raw; + }; + ++static inline ++void perf_sample_data_init(struct perf_sample_data *data, u64 addr) ++{ ++ data->addr = addr; ++ data->raw = NULL; ++} ++ + extern void perf_output_sample(struct perf_output_handle *handle, + struct perf_event_header *header, + struct perf_sample_data *data, +diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h +index 3ebb231..a529d86 100644 +--- a/include/linux/quotaops.h ++++ b/include/linux/quotaops.h +@@ -26,6 +26,10 @@ static inline void writeout_quota_sb(struct super_block *sb, int type) + sb->s_qcop->quota_sync(sb, type); + } + ++void inode_add_rsv_space(struct inode *inode, qsize_t number); ++void inode_claim_rsv_space(struct inode *inode, qsize_t number); ++void inode_sub_rsv_space(struct inode *inode, qsize_t number); ++ + int dquot_initialize(struct inode *inode, int type); + int dquot_drop(struct inode *inode); + struct dquot *dqget(struct super_block *sb, unsigned int id, int type); +@@ -42,7 +46,6 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number); + int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc); + int dquot_claim_space(struct inode *inode, qsize_t number); + void dquot_release_reserved_space(struct inode *inode, qsize_t number); +-qsize_t dquot_get_reserved_space(struct inode *inode); + + int dquot_free_space(struct inode *inode, qsize_t number); + int dquot_free_inode(const struct inode *inode, qsize_t number); +@@ -199,6 +202,8 @@ static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr) + if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA) + return 1; + } ++ else ++ inode_add_rsv_space(inode, nr); + return 0; + } + +@@ -221,7 +226,7 @@ static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr) + if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) + return 1; + } else +- inode_add_bytes(inode, nr); ++ inode_claim_rsv_space(inode, nr); + + mark_inode_dirty(inode); + return 0; +@@ -235,6 +240,8 @@ void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr) + { + if (sb_any_quota_active(inode->i_sb)) + inode->i_sb->dq_op->release_rsv(inode, nr); ++ else ++ inode_sub_rsv_space(inode, nr); + } + + static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h +index ec226a2..28a9617 100644 +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -190,9 +190,6 @@ struct skb_shared_info { + atomic_t dataref; + unsigned short nr_frags; + unsigned short gso_size; +-#ifdef CONFIG_HAS_DMA +- dma_addr_t dma_head; +-#endif + /* Warning: this field is not always filled in (UFO)! */ + unsigned short gso_segs; + unsigned short gso_type; +@@ -201,9 +198,6 @@ struct skb_shared_info { + struct sk_buff *frag_list; + struct skb_shared_hwtstamps hwtstamps; + skb_frag_t frags[MAX_SKB_FRAGS]; +-#ifdef CONFIG_HAS_DMA +- dma_addr_t dma_maps[MAX_SKB_FRAGS]; +-#endif + /* Intermediate layers must ensure that destructor_arg + * remains valid until skb destructor */ + void * destructor_arg; +diff --git a/include/linux/tty.h b/include/linux/tty.h +index 6abfcf5..42f2076 100644 +--- a/include/linux/tty.h ++++ b/include/linux/tty.h +@@ -68,6 +68,17 @@ struct tty_buffer { + unsigned long data[0]; + }; + ++/* ++ * We default to dicing tty buffer allocations to this many characters ++ * in order to avoid multiple page allocations. We know the size of ++ * tty_buffer itself but it must also be taken into account that the ++ * the buffer is 256 byte aligned. See tty_buffer_find for the allocation ++ * logic this must match ++ */ ++ ++#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) ++ ++ + struct tty_bufhead { + struct delayed_work work; + spinlock_t lock; +diff --git a/include/net/mac80211.h b/include/net/mac80211.h +index 0bf3697..f39b303 100644 +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -926,6 +926,9 @@ enum ieee80211_tkip_key_type { + * @IEEE80211_HW_BEACON_FILTER: + * Hardware supports dropping of irrelevant beacon frames to + * avoid waking up cpu. ++ * @IEEE80211_HW_REPORTS_TX_ACK_STATUS: ++ * Hardware can provide ack status reports of Tx frames to ++ * the stack. + */ + enum ieee80211_hw_flags { + IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, +@@ -943,6 +946,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, + IEEE80211_HW_MFP_CAPABLE = 1<<13, + IEEE80211_HW_BEACON_FILTER = 1<<14, ++ IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<15, + }; + + /** +@@ -2258,7 +2262,8 @@ struct rate_control_ops { + struct ieee80211_sta *sta, void *priv_sta); + void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, + struct ieee80211_sta *sta, +- void *priv_sta, u32 changed); ++ void *priv_sta, u32 changed, ++ enum nl80211_channel_type oper_chan_type); + void (*free_sta)(void *priv, struct ieee80211_sta *sta, + void *priv_sta); + +diff --git a/include/net/netlink.h b/include/net/netlink.h +index a63b219..668ad04 100644 +--- a/include/net/netlink.h ++++ b/include/net/netlink.h +@@ -945,7 +945,11 @@ static inline u64 nla_get_u64(const struct nlattr *nla) + */ + static inline __be64 nla_get_be64(const struct nlattr *nla) + { +- return *(__be64 *) nla_data(nla); ++ __be64 tmp; ++ ++ nla_memcpy(&tmp, nla, sizeof(tmp)); ++ ++ return tmp; + } + + /** +diff --git a/include/net/sock.h b/include/net/sock.h +index 3f1a480..86f2da1 100644 +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -253,6 +253,8 @@ struct sock { + struct { + struct sk_buff *head; + struct sk_buff *tail; ++ int len; ++ int limit; + } sk_backlog; + wait_queue_head_t *sk_sleep; + struct dst_entry *sk_dst_cache; +@@ -574,8 +576,8 @@ static inline int sk_stream_memory_free(struct sock *sk) + return sk->sk_wmem_queued < sk->sk_sndbuf; + } + +-/* The per-socket spinlock must be held here. */ +-static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) ++/* OOB backlog add */ ++static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) + { + if (!sk->sk_backlog.tail) { + sk->sk_backlog.head = sk->sk_backlog.tail = skb; +@@ -586,6 +588,17 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) + skb->next = NULL; + } + ++/* The per-socket spinlock must be held here. */ ++static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) ++{ ++ if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) ++ return -ENOBUFS; ++ ++ __sk_add_backlog(sk, skb); ++ sk->sk_backlog.len += skb->truesize; ++ return 0; ++} ++ + static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) + { + return sk->sk_backlog_rcv(sk, skb); +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index 60c2770..1e355d8 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -274,7 +274,8 @@ struct xfrm_policy_afinfo { + struct dst_entry *dst, + int nfheader_len); + int (*fill_dst)(struct xfrm_dst *xdst, +- struct net_device *dev); ++ struct net_device *dev, ++ struct flowi *fl); + }; + + extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); +diff --git a/init/main.c b/init/main.c +index 4cb47a1..512ba15 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -846,7 +846,7 @@ static int __init kernel_init(void * unused) + /* + * init can allocate pages on any node + */ +- set_mems_allowed(node_possible_map); ++ set_mems_allowed(node_states[N_HIGH_MEMORY]); + /* + * init can run on any cpu. + */ +diff --git a/ipc/mqueue.c b/ipc/mqueue.c +index c79bd57..04985a7 100644 +--- a/ipc/mqueue.c ++++ b/ipc/mqueue.c +@@ -705,7 +705,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, mode_t, mode, + dentry = lookup_one_len(name, ipc_ns->mq_mnt->mnt_root, strlen(name)); + if (IS_ERR(dentry)) { + error = PTR_ERR(dentry); +- goto out_err; ++ goto out_putfd; + } + mntget(ipc_ns->mq_mnt); + +@@ -742,7 +742,6 @@ out: + mntput(ipc_ns->mq_mnt); + out_putfd: + put_unused_fd(fd); +-out_err: + fd = error; + out_upsem: + mutex_unlock(&ipc_ns->mq_mnt->mnt_root->d_inode->i_mutex); +diff --git a/kernel/cpuset.c b/kernel/cpuset.c +index ba401fa..5d38bd7 100644 +--- a/kernel/cpuset.c ++++ b/kernel/cpuset.c +@@ -920,9 +920,6 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, + * call to guarantee_online_mems(), as we know no one is changing + * our task's cpuset. + * +- * Hold callback_mutex around the two modifications of our tasks +- * mems_allowed to synchronize with cpuset_mems_allowed(). +- * + * While the mm_struct we are migrating is typically from some + * other task, the task_struct mems_allowed that we are hacking + * is for our current task, which must allocate new pages for that +@@ -1391,11 +1388,10 @@ static void cpuset_attach(struct cgroup_subsys *ss, struct cgroup *cont, + + if (cs == &top_cpuset) { + cpumask_copy(cpus_attach, cpu_possible_mask); +- to = node_possible_map; + } else { + guarantee_online_cpus(cs, cpus_attach); +- guarantee_online_mems(cs, &to); + } ++ guarantee_online_mems(cs, &to); + + /* do per-task migration stuff possibly for each in the threadgroup */ + cpuset_attach_task(tsk, &to, cs); +@@ -2090,15 +2086,23 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb, + static int cpuset_track_online_nodes(struct notifier_block *self, + unsigned long action, void *arg) + { ++ nodemask_t oldmems; ++ + cgroup_lock(); + switch (action) { + case MEM_ONLINE: +- case MEM_OFFLINE: ++ oldmems = top_cpuset.mems_allowed; + mutex_lock(&callback_mutex); + top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; + mutex_unlock(&callback_mutex); +- if (action == MEM_OFFLINE) +- scan_for_empty_cpusets(&top_cpuset); ++ update_tasks_nodemask(&top_cpuset, &oldmems, NULL); ++ break; ++ case MEM_OFFLINE: ++ /* ++ * needn't update top_cpuset.mems_allowed explicitly because ++ * scan_for_empty_cpusets() will update it. ++ */ ++ scan_for_empty_cpusets(&top_cpuset); + break; + default: + break; +diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c +index 967e661..4d99512 100644 +--- a/kernel/hw_breakpoint.c ++++ b/kernel/hw_breakpoint.c +@@ -489,5 +489,4 @@ struct pmu perf_ops_bp = { + .enable = arch_install_hw_breakpoint, + .disable = arch_uninstall_hw_breakpoint, + .read = hw_breakpoint_pmu_read, +- .unthrottle = hw_breakpoint_pmu_unthrottle + }; +diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c +index d70394f..71eba24 100644 +--- a/kernel/irq/chip.c ++++ b/kernel/irq/chip.c +@@ -359,6 +359,23 @@ static inline void mask_ack_irq(struct irq_desc *desc, int irq) + if (desc->chip->ack) + desc->chip->ack(irq); + } ++ desc->status |= IRQ_MASKED; ++} ++ ++static inline void mask_irq(struct irq_desc *desc, int irq) ++{ ++ if (desc->chip->mask) { ++ desc->chip->mask(irq); ++ desc->status |= IRQ_MASKED; ++ } ++} ++ ++static inline void unmask_irq(struct irq_desc *desc, int irq) ++{ ++ if (desc->chip->unmask) { ++ desc->chip->unmask(irq); ++ desc->status &= ~IRQ_MASKED; ++ } + } + + /* +@@ -484,10 +501,8 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc) + raw_spin_lock(&desc->lock); + desc->status &= ~IRQ_INPROGRESS; + +- if (unlikely(desc->status & IRQ_ONESHOT)) +- desc->status |= IRQ_MASKED; +- else if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask) +- desc->chip->unmask(irq); ++ if (!(desc->status & (IRQ_DISABLED | IRQ_ONESHOT))) ++ unmask_irq(desc, irq); + out_unlock: + raw_spin_unlock(&desc->lock); + } +@@ -524,8 +539,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) + action = desc->action; + if (unlikely(!action || (desc->status & IRQ_DISABLED))) { + desc->status |= IRQ_PENDING; +- if (desc->chip->mask) +- desc->chip->mask(irq); ++ mask_irq(desc, irq); + goto out; + } + +@@ -593,7 +607,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) + irqreturn_t action_ret; + + if (unlikely(!action)) { +- desc->chip->mask(irq); ++ mask_irq(desc, irq); + goto out_unlock; + } + +@@ -605,8 +619,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) + if (unlikely((desc->status & + (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) == + (IRQ_PENDING | IRQ_MASKED))) { +- desc->chip->unmask(irq); +- desc->status &= ~IRQ_MASKED; ++ unmask_irq(desc, irq); + } + + desc->status &= ~IRQ_PENDING; +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index eb6078c..69a3d7b 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -483,8 +483,26 @@ static int irq_wait_for_interrupt(struct irqaction *action) + */ + static void irq_finalize_oneshot(unsigned int irq, struct irq_desc *desc) + { ++again: + chip_bus_lock(irq, desc); + raw_spin_lock_irq(&desc->lock); ++ ++ /* ++ * Implausible though it may be we need to protect us against ++ * the following scenario: ++ * ++ * The thread is faster done than the hard interrupt handler ++ * on the other CPU. If we unmask the irq line then the ++ * interrupt can come in again and masks the line, leaves due ++ * to IRQ_INPROGRESS and the irq line is masked forever. ++ */ ++ if (unlikely(desc->status & IRQ_INPROGRESS)) { ++ raw_spin_unlock_irq(&desc->lock); ++ chip_bus_sync_unlock(irq, desc); ++ cpu_relax(); ++ goto again; ++ } ++ + if (!(desc->status & IRQ_DISABLED) && (desc->status & IRQ_MASKED)) { + desc->status &= ~IRQ_MASKED; + desc->chip->unmask(irq); +diff --git a/kernel/kthread.c b/kernel/kthread.c +index fbb6222..84c7f99 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -219,7 +219,7 @@ int kthreadd(void *unused) + set_task_comm(tsk, "kthreadd"); + ignore_signals(tsk); + set_cpus_allowed_ptr(tsk, cpu_all_mask); +- set_mems_allowed(node_possible_map); ++ set_mems_allowed(node_states[N_HIGH_MEMORY]); + + current->flags |= PF_NOFREEZE | PF_FREEZER_NOSIG; + +diff --git a/kernel/perf_event.c b/kernel/perf_event.c +index b707465..32d0ae2 100644 +--- a/kernel/perf_event.c ++++ b/kernel/perf_event.c +@@ -4027,8 +4027,7 @@ void __perf_sw_event(u32 event_id, u64 nr, int nmi, + if (rctx < 0) + return; + +- data.addr = addr; +- data.raw = NULL; ++ perf_sample_data_init(&data, addr); + + do_perf_sw_event(PERF_TYPE_SOFTWARE, event_id, nr, nmi, &data, regs); + +@@ -4073,11 +4072,10 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) + struct perf_event *event; + u64 period; + +- event = container_of(hrtimer, struct perf_event, hw.hrtimer); ++ event = container_of(hrtimer, struct perf_event, hw.hrtimer); + event->pmu->read(event); + +- data.addr = 0; +- data.raw = NULL; ++ perf_sample_data_init(&data, 0); + data.period = event->hw.last_period; + regs = get_irq_regs(); + /* +@@ -4241,17 +4239,15 @@ static const struct pmu perf_ops_task_clock = { + void perf_tp_event(int event_id, u64 addr, u64 count, void *record, + int entry_size) + { ++ struct pt_regs *regs = get_irq_regs(); ++ struct perf_sample_data data; + struct perf_raw_record raw = { + .size = entry_size, + .data = record, + }; + +- struct perf_sample_data data = { +- .addr = addr, +- .raw = &raw, +- }; +- +- struct pt_regs *regs = get_irq_regs(); ++ perf_sample_data_init(&data, addr); ++ data.raw = &raw; + + if (!regs) + regs = task_pt_regs(current); +@@ -4367,8 +4363,7 @@ void perf_bp_event(struct perf_event *bp, void *data) + struct perf_sample_data sample; + struct pt_regs *regs = data; + +- sample.raw = NULL; +- sample.addr = bp->attr.bp_addr; ++ perf_sample_data_init(&sample, bp->attr.bp_addr); + + if (!perf_exclude_event(bp, regs)) + perf_swevent_add(bp, 1, 1, &sample, regs); +@@ -5251,12 +5246,22 @@ int perf_event_init_task(struct task_struct *child) + return ret; + } + ++static void __init perf_event_init_all_cpus(void) ++{ ++ int cpu; ++ struct perf_cpu_context *cpuctx; ++ ++ for_each_possible_cpu(cpu) { ++ cpuctx = &per_cpu(perf_cpu_context, cpu); ++ __perf_event_init_context(&cpuctx->ctx, NULL); ++ } ++} ++ + static void __cpuinit perf_event_init_cpu(int cpu) + { + struct perf_cpu_context *cpuctx; + + cpuctx = &per_cpu(perf_cpu_context, cpu); +- __perf_event_init_context(&cpuctx->ctx, NULL); + + spin_lock(&perf_resource_lock); + cpuctx->max_pertask = perf_max_events - perf_reserved_percpu; +@@ -5327,6 +5332,7 @@ static struct notifier_block __cpuinitdata perf_cpu_nb = { + + void __init perf_event_init(void) + { ++ perf_event_init_all_cpus(); + perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, + (void *)(long)smp_processor_id()); + perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, +diff --git a/kernel/sched.c b/kernel/sched.c +index 00a59b0..7ca9345 100644 +--- a/kernel/sched.c ++++ b/kernel/sched.c +@@ -3423,6 +3423,7 @@ struct sd_lb_stats { + unsigned long max_load; + unsigned long busiest_load_per_task; + unsigned long busiest_nr_running; ++ unsigned long busiest_group_capacity; + + int group_imb; /* Is there imbalance in this sd */ + #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) +@@ -3742,8 +3743,7 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, + unsigned long load, max_cpu_load, min_cpu_load; + int i; + unsigned int balance_cpu = -1, first_idle_cpu = 0; +- unsigned long sum_avg_load_per_task; +- unsigned long avg_load_per_task; ++ unsigned long avg_load_per_task = 0; + + if (local_group) { + balance_cpu = group_first_cpu(group); +@@ -3752,7 +3752,6 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, + } + + /* Tally up the load of all CPUs in the group */ +- sum_avg_load_per_task = avg_load_per_task = 0; + max_cpu_load = 0; + min_cpu_load = ~0UL; + +@@ -3782,7 +3781,6 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, + sgs->sum_nr_running += rq->nr_running; + sgs->sum_weighted_load += weighted_cpuload(i); + +- sum_avg_load_per_task += cpu_avg_load_per_task(i); + } + + /* +@@ -3800,7 +3798,6 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, + /* Adjust by relative CPU power of the group */ + sgs->avg_load = (sgs->group_load * SCHED_LOAD_SCALE) / group->cpu_power; + +- + /* + * Consider the group unbalanced when the imbalance is larger + * than the average weight of two tasks. +@@ -3810,8 +3807,8 @@ static inline void update_sg_lb_stats(struct sched_domain *sd, + * normalized nr_running number somewhere that negates + * the hierarchy? + */ +- avg_load_per_task = (sum_avg_load_per_task * SCHED_LOAD_SCALE) / +- group->cpu_power; ++ if (sgs->sum_nr_running) ++ avg_load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; + + if ((max_cpu_load - min_cpu_load) > 2*avg_load_per_task) + sgs->group_imb = 1; +@@ -3880,6 +3877,7 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu, + sds->max_load = sgs.avg_load; + sds->busiest = group; + sds->busiest_nr_running = sgs.sum_nr_running; ++ sds->busiest_group_capacity = sgs.group_capacity; + sds->busiest_load_per_task = sgs.sum_weighted_load; + sds->group_imb = sgs.group_imb; + } +@@ -3902,6 +3900,7 @@ static inline void fix_small_imbalance(struct sd_lb_stats *sds, + { + unsigned long tmp, pwr_now = 0, pwr_move = 0; + unsigned int imbn = 2; ++ unsigned long scaled_busy_load_per_task; + + if (sds->this_nr_running) { + sds->this_load_per_task /= sds->this_nr_running; +@@ -3912,8 +3911,12 @@ static inline void fix_small_imbalance(struct sd_lb_stats *sds, + sds->this_load_per_task = + cpu_avg_load_per_task(this_cpu); + +- if (sds->max_load - sds->this_load + sds->busiest_load_per_task >= +- sds->busiest_load_per_task * imbn) { ++ scaled_busy_load_per_task = sds->busiest_load_per_task ++ * SCHED_LOAD_SCALE; ++ scaled_busy_load_per_task /= sds->busiest->cpu_power; ++ ++ if (sds->max_load - sds->this_load + scaled_busy_load_per_task >= ++ (scaled_busy_load_per_task * imbn)) { + *imbalance = sds->busiest_load_per_task; + return; + } +@@ -3964,7 +3967,14 @@ static inline void fix_small_imbalance(struct sd_lb_stats *sds, + static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu, + unsigned long *imbalance) + { +- unsigned long max_pull; ++ unsigned long max_pull, load_above_capacity = ~0UL; ++ ++ sds->busiest_load_per_task /= sds->busiest_nr_running; ++ if (sds->group_imb) { ++ sds->busiest_load_per_task = ++ min(sds->busiest_load_per_task, sds->avg_load); ++ } ++ + /* + * In the presence of smp nice balancing, certain scenarios can have + * max load less than avg load(as we skip the groups at or below +@@ -3975,9 +3985,29 @@ static inline void calculate_imbalance(struct sd_lb_stats *sds, int this_cpu, + return fix_small_imbalance(sds, this_cpu, imbalance); + } + +- /* Don't want to pull so many tasks that a group would go idle */ +- max_pull = min(sds->max_load - sds->avg_load, +- sds->max_load - sds->busiest_load_per_task); ++ if (!sds->group_imb) { ++ /* ++ * Don't want to pull so many tasks that a group would go idle. ++ */ ++ load_above_capacity = (sds->busiest_nr_running - ++ sds->busiest_group_capacity); ++ ++ load_above_capacity *= (SCHED_LOAD_SCALE * SCHED_LOAD_SCALE); ++ ++ load_above_capacity /= sds->busiest->cpu_power; ++ } ++ ++ /* ++ * We're trying to get all the cpus to the average_load, so we don't ++ * want to push ourselves above the average load, nor do we wish to ++ * reduce the max loaded cpu below the average load. At the same time, ++ * we also don't want to reduce the group load below the group capacity ++ * (so that we can implement power-savings policies etc). Thus we look ++ * for the minimum possible imbalance. ++ * Be careful of negative numbers as they'll appear as very large values ++ * with unsigned longs. ++ */ ++ max_pull = min(sds->max_load - sds->avg_load, load_above_capacity); + + /* How much load to actually move to equalise the imbalance */ + *imbalance = min(max_pull * sds->busiest->cpu_power, +@@ -4045,7 +4075,6 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, + * 4) This group is more busy than the avg busieness at this + * sched_domain. + * 5) The imbalance is within the specified limit. +- * 6) Any rebalance would lead to ping-pong + */ + if (balance && !(*balance)) + goto ret; +@@ -4064,25 +4093,6 @@ find_busiest_group(struct sched_domain *sd, int this_cpu, + if (100 * sds.max_load <= sd->imbalance_pct * sds.this_load) + goto out_balanced; + +- sds.busiest_load_per_task /= sds.busiest_nr_running; +- if (sds.group_imb) +- sds.busiest_load_per_task = +- min(sds.busiest_load_per_task, sds.avg_load); +- +- /* +- * We're trying to get all the cpus to the average_load, so we don't +- * want to push ourselves above the average load, nor do we wish to +- * reduce the max loaded cpu below the average load, as either of these +- * actions would just result in more rebalancing later, and ping-pong +- * tasks around. Thus we look for the minimum possible imbalance. +- * Negative imbalances (*we* are more loaded than anyone else) will +- * be counted as no imbalance for these purposes -- we can't fix that +- * by pulling tasks to us. Be careful of negative numbers as they'll +- * appear as very large values with unsigned longs. +- */ +- if (sds.max_load <= sds.busiest_load_per_task) +- goto out_balanced; +- + /* Looks like there is an imbalance. Compute it */ + calculate_imbalance(&sds, this_cpu, imbalance); + return sds.busiest; +diff --git a/kernel/softlockup.c b/kernel/softlockup.c +index 0d4c789..4b493f6 100644 +--- a/kernel/softlockup.c ++++ b/kernel/softlockup.c +@@ -155,11 +155,11 @@ void softlockup_tick(void) + * Wake up the high-prio watchdog task twice per + * threshold timespan. + */ +- if (now > touch_ts + softlockup_thresh/2) ++ if (time_after(now - softlockup_thresh/2, touch_ts)) + wake_up_process(per_cpu(softlockup_watchdog, this_cpu)); + + /* Warn about unreasonable delays: */ +- if (now <= (touch_ts + softlockup_thresh)) ++ if (time_before_eq(now - softlockup_thresh, touch_ts)) + return; + + per_cpu(softlockup_print_ts, this_cpu) = touch_ts; +diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c +index 1370083..0e98497 100644 +--- a/kernel/time/clocksource.c ++++ b/kernel/time/clocksource.c +@@ -580,6 +580,10 @@ static inline void clocksource_select(void) { } + */ + static int __init clocksource_done_booting(void) + { ++ mutex_lock(&clocksource_mutex); ++ curr_clocksource = clocksource_default_clock(); ++ mutex_unlock(&clocksource_mutex); ++ + finished_booting = 1; + + /* +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c +index 1e6640f..404c9ba 100644 +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -3364,6 +3364,7 @@ void ftrace_graph_init_task(struct task_struct *t) + { + /* Make sure we do not use the parent ret_stack */ + t->ret_stack = NULL; ++ t->curr_ret_stack = -1; + + if (ftrace_graph_active) { + struct ftrace_ret_stack *ret_stack; +@@ -3373,7 +3374,6 @@ void ftrace_graph_init_task(struct task_struct *t) + GFP_KERNEL); + if (!ret_stack) + return; +- t->curr_ret_stack = -1; + atomic_set(&t->tracing_graph_pause, 0); + atomic_set(&t->trace_overrun, 0); + t->ftrace_timestamp = 0; +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c +index 8c1b2d2..54191d6 100644 +--- a/kernel/trace/ring_buffer.c ++++ b/kernel/trace/ring_buffer.c +@@ -2232,12 +2232,12 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length) + if (ring_buffer_flags != RB_BUFFERS_ON) + return NULL; + +- if (atomic_read(&buffer->record_disabled)) +- return NULL; +- + /* If we are tracing schedule, we don't want to recurse */ + resched = ftrace_preempt_disable(); + ++ if (atomic_read(&buffer->record_disabled)) ++ goto out_nocheck; ++ + if (trace_recursive_lock()) + goto out_nocheck; + +@@ -2469,11 +2469,11 @@ int ring_buffer_write(struct ring_buffer *buffer, + if (ring_buffer_flags != RB_BUFFERS_ON) + return -EBUSY; + +- if (atomic_read(&buffer->record_disabled)) +- return -EBUSY; +- + resched = ftrace_preempt_disable(); + ++ if (atomic_read(&buffer->record_disabled)) ++ goto out; ++ + cpu = raw_smp_processor_id(); + + if (!cpumask_test_cpu(cpu, buffer->cpumask)) +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index eac6875..45cfb6d 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -747,10 +747,10 @@ out: + mutex_unlock(&trace_types_lock); + } + +-static void __tracing_reset(struct trace_array *tr, int cpu) ++static void __tracing_reset(struct ring_buffer *buffer, int cpu) + { + ftrace_disable_cpu(); +- ring_buffer_reset_cpu(tr->buffer, cpu); ++ ring_buffer_reset_cpu(buffer, cpu); + ftrace_enable_cpu(); + } + +@@ -762,7 +762,7 @@ void tracing_reset(struct trace_array *tr, int cpu) + + /* Make sure all commits have finished */ + synchronize_sched(); +- __tracing_reset(tr, cpu); ++ __tracing_reset(buffer, cpu); + + ring_buffer_record_enable(buffer); + } +@@ -780,7 +780,7 @@ void tracing_reset_online_cpus(struct trace_array *tr) + tr->time_start = ftrace_now(tr->cpu); + + for_each_online_cpu(cpu) +- __tracing_reset(tr, cpu); ++ __tracing_reset(buffer, cpu); + + ring_buffer_record_enable(buffer); + } +@@ -857,6 +857,8 @@ void tracing_start(void) + goto out; + } + ++ /* Prevent the buffers from switching */ ++ arch_spin_lock(&ftrace_max_lock); + + buffer = global_trace.buffer; + if (buffer) +@@ -866,6 +868,8 @@ void tracing_start(void) + if (buffer) + ring_buffer_record_enable(buffer); + ++ arch_spin_unlock(&ftrace_max_lock); ++ + ftrace_start(); + out: + spin_unlock_irqrestore(&tracing_start_lock, flags); +@@ -887,6 +891,9 @@ void tracing_stop(void) + if (trace_stop_count++) + goto out; + ++ /* Prevent the buffers from switching */ ++ arch_spin_lock(&ftrace_max_lock); ++ + buffer = global_trace.buffer; + if (buffer) + ring_buffer_record_disable(buffer); +@@ -895,6 +902,8 @@ void tracing_stop(void) + if (buffer) + ring_buffer_record_disable(buffer); + ++ arch_spin_unlock(&ftrace_max_lock); ++ + out: + spin_unlock_irqrestore(&tracing_start_lock, flags); + } +@@ -1182,6 +1191,13 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) + if (!(trace_flags & TRACE_ITER_USERSTACKTRACE)) + return; + ++ /* ++ * NMIs can not handle page faults, even with fix ups. ++ * The save user stack can (and often does) fault. ++ */ ++ if (unlikely(in_nmi())) ++ return; ++ + event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK, + sizeof(*entry), flags, pc); + if (!event) +@@ -1628,6 +1644,7 @@ static void *s_start(struct seq_file *m, loff_t *pos) + + ftrace_enable_cpu(); + ++ iter->leftover = 0; + for (p = iter; p && l < *pos; p = s_next(m, p, &l)) + ; + +diff --git a/mm/mempolicy.c b/mm/mempolicy.c +index 290fb5b..0beac93 100644 +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2167,8 +2167,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + char *rest = nodelist; + while (isdigit(*rest)) + rest++; +- if (!*rest) +- err = 0; ++ if (*rest) ++ goto out; + } + break; + case MPOL_INTERLEAVE: +@@ -2177,7 +2177,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + */ + if (!nodelist) + nodes = node_states[N_HIGH_MEMORY]; +- err = 0; + break; + case MPOL_LOCAL: + /* +@@ -2187,11 +2186,19 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + goto out; + mode = MPOL_PREFERRED; + break; +- +- /* +- * case MPOL_BIND: mpol_new() enforces non-empty nodemask. +- * case MPOL_DEFAULT: mpol_new() enforces empty nodemask, ignores flags. +- */ ++ case MPOL_DEFAULT: ++ /* ++ * Insist on a empty nodelist ++ */ ++ if (!nodelist) ++ err = 0; ++ goto out; ++ case MPOL_BIND: ++ /* ++ * Insist on a nodelist ++ */ ++ if (!nodelist) ++ goto out; + } + + mode_flags = 0; +@@ -2205,13 +2212,14 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + else if (!strcmp(flags, "relative")) + mode_flags |= MPOL_F_RELATIVE_NODES; + else +- err = 1; ++ goto out; + } + + new = mpol_new(mode, mode_flags, &nodes); + if (IS_ERR(new)) +- err = 1; +- else { ++ goto out; ++ ++ { + int ret; + NODEMASK_SCRATCH(scratch); + if (scratch) { +@@ -2222,13 +2230,15 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + ret = -ENOMEM; + NODEMASK_SCRATCH_FREE(scratch); + if (ret) { +- err = 1; + mpol_put(new); +- } else if (no_context) { +- /* save for contextualization */ +- new->w.user_nodemask = nodes; ++ goto out; + } + } ++ err = 0; ++ if (no_context) { ++ /* save for contextualization */ ++ new->w.user_nodemask = nodes; ++ } + + out: + /* Restore string for error message */ +diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c +index e75a2f3..152760a 100644 +--- a/net/8021q/vlan_core.c ++++ b/net/8021q/vlan_core.c +@@ -11,7 +11,7 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, + if (netpoll_rx(skb)) + return NET_RX_DROP; + +- if (skb_bond_should_drop(skb)) ++ if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) + goto drop; + + __vlan_hwaccel_put_tag(skb, vlan_tci); +@@ -82,7 +82,7 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp, + { + struct sk_buff *p; + +- if (skb_bond_should_drop(skb)) ++ if (skb_bond_should_drop(skb, ACCESS_ONCE(skb->dev->master))) + goto drop; + + __vlan_hwaccel_put_tag(skb, vlan_tci); +diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c +index 400efa2..615fecc 100644 +--- a/net/bluetooth/l2cap.c ++++ b/net/bluetooth/l2cap.c +@@ -2830,6 +2830,11 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr + int len = cmd->len - sizeof(*rsp); + char req[64]; + ++ if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) { ++ l2cap_send_disconn_req(conn, sk); ++ goto done; ++ } ++ + /* throw out any old stored conf requests */ + result = L2CAP_CONF_SUCCESS; + len = l2cap_parse_conf_rsp(sk, rsp->data, +@@ -3942,16 +3947,24 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) + struct sock *sk; + struct hlist_node *node; + char *str = buf; ++ int size = PAGE_SIZE; + + read_lock_bh(&l2cap_sk_list.lock); + + sk_for_each(sk, node, &l2cap_sk_list.head) { + struct l2cap_pinfo *pi = l2cap_pi(sk); ++ int len; + +- str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", ++ len = snprintf(str, size, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state, __le16_to_cpu(pi->psm), pi->scid, + pi->dcid, pi->imtu, pi->omtu, pi->sec_level); ++ ++ size -= len; ++ if (size <= 0) ++ break; ++ ++ str += len; + } + + read_unlock_bh(&l2cap_sk_list.lock); +diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c +index 89f4a59..3fe9c7c 100644 +--- a/net/bluetooth/rfcomm/core.c ++++ b/net/bluetooth/rfcomm/core.c +@@ -2103,6 +2103,7 @@ static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) + struct rfcomm_session *s; + struct list_head *pp, *p; + char *str = buf; ++ int size = PAGE_SIZE; + + rfcomm_lock(); + +@@ -2111,11 +2112,21 @@ static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, char *buf) + list_for_each(pp, &s->dlcs) { + struct sock *sk = s->sock->sk; + struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); ++ int len; + +- str += sprintf(str, "%s %s %ld %d %d %d %d\n", ++ len = snprintf(str, size, "%s %s %ld %d %d %d %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); ++ ++ size -= len; ++ if (size <= 0) ++ break; ++ ++ str += len; + } ++ ++ if (size <= 0) ++ break; + } + + rfcomm_unlock(); +diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c +index 4b5968d..bc03b50 100644 +--- a/net/bluetooth/rfcomm/sock.c ++++ b/net/bluetooth/rfcomm/sock.c +@@ -1066,13 +1066,22 @@ static ssize_t rfcomm_sock_sysfs_show(struct class *dev, char *buf) + struct sock *sk; + struct hlist_node *node; + char *str = buf; ++ int size = PAGE_SIZE; + + read_lock_bh(&rfcomm_sk_list.lock); + + sk_for_each(sk, node, &rfcomm_sk_list.head) { +- str += sprintf(str, "%s %s %d %d\n", ++ int len; ++ ++ len = snprintf(str, size, "%s %s %d %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state, rfcomm_pi(sk)->channel); ++ ++ size -= len; ++ if (size <= 0) ++ break; ++ ++ str += len; + } + + read_unlock_bh(&rfcomm_sk_list.lock); +diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c +index dd8f6ec..66cab63 100644 +--- a/net/bluetooth/sco.c ++++ b/net/bluetooth/sco.c +@@ -958,13 +958,22 @@ static ssize_t sco_sysfs_show(struct class *dev, char *buf) + struct sock *sk; + struct hlist_node *node; + char *str = buf; ++ int size = PAGE_SIZE; + + read_lock_bh(&sco_sk_list.lock); + + sk_for_each(sk, node, &sco_sk_list.head) { +- str += sprintf(str, "%s %s %d\n", ++ int len; ++ ++ len = snprintf(str, size, "%s %s %d\n", + batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), + sk->sk_state); ++ ++ size -= len; ++ if (size <= 0) ++ break; ++ ++ str += len; + } + + read_unlock_bh(&sco_sk_list.lock); +diff --git a/net/core/dev.c b/net/core/dev.c +index ec87421..f51f940 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -2421,6 +2421,7 @@ int netif_receive_skb(struct sk_buff *skb) + { + struct packet_type *ptype, *pt_prev; + struct net_device *orig_dev; ++ struct net_device *master; + struct net_device *null_or_orig; + int ret = NET_RX_DROP; + __be16 type; +@@ -2440,11 +2441,12 @@ int netif_receive_skb(struct sk_buff *skb) + + null_or_orig = NULL; + orig_dev = skb->dev; +- if (orig_dev->master) { +- if (skb_bond_should_drop(skb)) ++ master = ACCESS_ONCE(orig_dev->master); ++ if (master) { ++ if (skb_bond_should_drop(skb, master)) + null_or_orig = orig_dev; /* deliver only exact match */ + else +- skb->dev = orig_dev->master; ++ skb->dev = master; + } + + __get_cpu_var(netdev_rx_stat).total++; +diff --git a/net/core/sock.c b/net/core/sock.c +index e1f6f22..5779f31 100644 +--- a/net/core/sock.c ++++ b/net/core/sock.c +@@ -340,8 +340,12 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested) + rc = sk_backlog_rcv(sk, skb); + + mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); +- } else +- sk_add_backlog(sk, skb); ++ } else if (sk_add_backlog(sk, skb)) { ++ bh_unlock_sock(sk); ++ atomic_inc(&sk->sk_drops); ++ goto discard_and_relse; ++ } ++ + bh_unlock_sock(sk); + out: + sock_put(sk); +@@ -1138,6 +1142,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) + sock_lock_init(newsk); + bh_lock_sock(newsk); + newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; ++ newsk->sk_backlog.len = 0; + + atomic_set(&newsk->sk_rmem_alloc, 0); + /* +@@ -1541,6 +1546,12 @@ static void __release_sock(struct sock *sk) + + bh_lock_sock(sk); + } while ((skb = sk->sk_backlog.head) != NULL); ++ ++ /* ++ * Doing the zeroing here guarantee we can not loop forever ++ * while a wild producer attempts to flood us. ++ */ ++ sk->sk_backlog.len = 0; + } + + /** +@@ -1873,6 +1884,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) + sk->sk_allocation = GFP_KERNEL; + sk->sk_rcvbuf = sysctl_rmem_default; + sk->sk_sndbuf = sysctl_wmem_default; ++ sk->sk_backlog.limit = sk->sk_rcvbuf << 1; + sk->sk_state = TCP_CLOSE; + sk_set_socket(sk, sock); + +diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c +index af226a0..0d508c3 100644 +--- a/net/dccp/minisocks.c ++++ b/net/dccp/minisocks.c +@@ -254,7 +254,7 @@ int dccp_child_process(struct sock *parent, struct sock *child, + * in main socket hash table and lock on listening + * socket does not protect us more. + */ +- sk_add_backlog(child, skb); ++ __sk_add_backlog(child, skb); + } + + bh_unlock_sock(child); +diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c +index f36ce15..68c1454 100644 +--- a/net/ipv4/ip_gre.c ++++ b/net/ipv4/ip_gre.c +@@ -810,11 +810,13 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev + tunnel->err_count = 0; + } + +- max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen; ++ max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->u.dst.header_len; + + if (skb_headroom(skb) < max_headroom || skb_shared(skb)|| + (skb_cloned(skb) && !skb_clone_writable(skb, 0))) { + struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); ++ if (max_headroom > dev->needed_headroom) ++ dev->needed_headroom = max_headroom; + if (!new_skb) { + ip_rt_put(rt); + txq->tx_dropped++; +diff --git a/net/ipv4/route.c b/net/ipv4/route.c +index d62b05d..af86e41 100644 +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -922,10 +922,8 @@ static void rt_secret_rebuild_oneshot(struct net *net) + { + del_timer_sync(&net->ipv4.rt_secret_timer); + rt_cache_invalidate(net); +- if (ip_rt_secret_interval) { +- net->ipv4.rt_secret_timer.expires += ip_rt_secret_interval; +- add_timer(&net->ipv4.rt_secret_timer); +- } ++ if (ip_rt_secret_interval) ++ mod_timer(&net->ipv4.rt_secret_timer, jiffies + ip_rt_secret_interval); + } + + static void rt_emergency_hash_rebuild(struct net *net) +@@ -1417,7 +1415,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, + dev_hold(rt->u.dst.dev); + if (rt->idev) + in_dev_hold(rt->idev); +- rt->u.dst.obsolete = 0; ++ rt->u.dst.obsolete = -1; + rt->u.dst.lastuse = jiffies; + rt->u.dst.path = &rt->u.dst; + rt->u.dst.neighbour = NULL; +@@ -1482,11 +1480,12 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst) + struct dst_entry *ret = dst; + + if (rt) { +- if (dst->obsolete) { ++ if (dst->obsolete > 0) { + ip_rt_put(rt); + ret = NULL; + } else if ((rt->rt_flags & RTCF_REDIRECTED) || +- rt->u.dst.expires) { ++ (rt->u.dst.expires && ++ time_after_eq(jiffies, rt->u.dst.expires))) { + unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, + rt->fl.oif, + rt_genid(dev_net(dst->dev))); +@@ -1702,7 +1701,9 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) + + static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) + { +- return NULL; ++ if (rt_is_expired((struct rtable *)dst)) ++ return NULL; ++ return dst; + } + + static void ipv4_dst_destroy(struct dst_entry *dst) +@@ -1864,7 +1865,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, + if (!rth) + goto e_nobufs; + +- rth->u.dst.output= ip_rt_bug; ++ rth->u.dst.output = ip_rt_bug; ++ rth->u.dst.obsolete = -1; + + atomic_set(&rth->u.dst.__refcnt, 1); + rth->u.dst.flags= DST_HOST; +@@ -2025,6 +2027,7 @@ static int __mkroute_input(struct sk_buff *skb, + rth->fl.oif = 0; + rth->rt_spec_dst= spec_dst; + ++ rth->u.dst.obsolete = -1; + rth->u.dst.input = ip_forward; + rth->u.dst.output = ip_output; + rth->rt_genid = rt_genid(dev_net(rth->u.dst.dev)); +@@ -2189,6 +2192,7 @@ local_input: + goto e_nobufs; + + rth->u.dst.output= ip_rt_bug; ++ rth->u.dst.obsolete = -1; + rth->rt_genid = rt_genid(net); + + atomic_set(&rth->u.dst.__refcnt, 1); +@@ -2415,6 +2419,7 @@ static int __mkroute_output(struct rtable **result, + rth->rt_spec_dst= fl->fl4_src; + + rth->u.dst.output=ip_output; ++ rth->u.dst.obsolete = -1; + rth->rt_genid = rt_genid(dev_net(dev_out)); + + RT_CACHE_STAT_INC(out_slow_tot); +@@ -3072,22 +3077,20 @@ static void rt_secret_reschedule(int old) + rtnl_lock(); + for_each_net(net) { + int deleted = del_timer_sync(&net->ipv4.rt_secret_timer); ++ long time; + + if (!new) + continue; + + if (deleted) { +- long time = net->ipv4.rt_secret_timer.expires - jiffies; ++ time = net->ipv4.rt_secret_timer.expires - jiffies; + + if (time <= 0 || (time += diff) <= 0) + time = 0; +- +- net->ipv4.rt_secret_timer.expires = time; + } else +- net->ipv4.rt_secret_timer.expires = new; ++ time = new; + +- net->ipv4.rt_secret_timer.expires += jiffies; +- add_timer(&net->ipv4.rt_secret_timer); ++ mod_timer(&net->ipv4.rt_secret_timer, jiffies + time); + } + rtnl_unlock(); + } +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index b0a26bb..564a0f8 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -429,7 +429,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) + if (tp->urg_seq == tp->copied_seq && + !sock_flag(sk, SOCK_URGINLINE) && + tp->urg_data) +- target--; ++ target++; + + /* Potential race condition. If read of tp below will + * escape above sk->sk_state, we can be illegally awaken +@@ -1254,6 +1254,39 @@ static void tcp_prequeue_process(struct sock *sk) + tp->ucopy.memory = 0; + } + ++#ifdef CONFIG_NET_DMA ++static void tcp_service_net_dma(struct sock *sk, bool wait) ++{ ++ dma_cookie_t done, used; ++ dma_cookie_t last_issued; ++ struct tcp_sock *tp = tcp_sk(sk); ++ ++ if (!tp->ucopy.dma_chan) ++ return; ++ ++ last_issued = tp->ucopy.dma_cookie; ++ dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); ++ ++ do { ++ if (dma_async_memcpy_complete(tp->ucopy.dma_chan, ++ last_issued, &done, ++ &used) == DMA_SUCCESS) { ++ /* Safe to free early-copied skbs now */ ++ __skb_queue_purge(&sk->sk_async_wait_queue); ++ break; ++ } else { ++ struct sk_buff *skb; ++ while ((skb = skb_peek(&sk->sk_async_wait_queue)) && ++ (dma_async_is_complete(skb->dma_cookie, done, ++ used) == DMA_SUCCESS)) { ++ __skb_dequeue(&sk->sk_async_wait_queue); ++ kfree_skb(skb); ++ } ++ } ++ } while (wait); ++} ++#endif ++ + static inline struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) + { + struct sk_buff *skb; +@@ -1546,6 +1579,10 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, + /* __ Set realtime policy in scheduler __ */ + } + ++#ifdef CONFIG_NET_DMA ++ if (tp->ucopy.dma_chan) ++ dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); ++#endif + if (copied >= target) { + /* Do not sleep, just process backlog. */ + release_sock(sk); +@@ -1554,6 +1591,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, + sk_wait_data(sk, &timeo); + + #ifdef CONFIG_NET_DMA ++ tcp_service_net_dma(sk, false); /* Don't block */ + tp->ucopy.wakeup = 0; + #endif + +@@ -1633,6 +1671,9 @@ do_prequeue: + copied = -EFAULT; + break; + } ++ ++ dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); ++ + if ((offset + used) == skb->len) + copied_early = 1; + +@@ -1702,27 +1743,9 @@ skip_copy: + } + + #ifdef CONFIG_NET_DMA +- if (tp->ucopy.dma_chan) { +- dma_cookie_t done, used; +- +- dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); +- +- while (dma_async_memcpy_complete(tp->ucopy.dma_chan, +- tp->ucopy.dma_cookie, &done, +- &used) == DMA_IN_PROGRESS) { +- /* do partial cleanup of sk_async_wait_queue */ +- while ((skb = skb_peek(&sk->sk_async_wait_queue)) && +- (dma_async_is_complete(skb->dma_cookie, done, +- used) == DMA_SUCCESS)) { +- __skb_dequeue(&sk->sk_async_wait_queue); +- kfree_skb(skb); +- } +- } ++ tcp_service_net_dma(sk, true); /* Wait for queue to drain */ ++ tp->ucopy.dma_chan = NULL; + +- /* Safe to free early-copied skbs now */ +- __skb_queue_purge(&sk->sk_async_wait_queue); +- tp->ucopy.dma_chan = NULL; +- } + if (tp->ucopy.pinned_list) { + dma_unpin_iovec_pages(tp->ucopy.pinned_list); + tp->ucopy.pinned_list = NULL; +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 3fddc69..b347d3c 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -2499,6 +2499,9 @@ static void tcp_mark_head_lost(struct sock *sk, int packets) + int err; + unsigned int mss; + ++ if (packets == 0) ++ return; ++ + WARN_ON(packets > tp->packets_out); + if (tp->lost_skb_hint) { + skb = tp->lost_skb_hint; +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 65b8ebf..de935e3 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -1677,8 +1677,10 @@ process: + if (!tcp_prequeue(sk, skb)) + ret = tcp_v4_do_rcv(sk, skb); + } +- } else +- sk_add_backlog(sk, skb); ++ } else if (sk_add_backlog(sk, skb)) { ++ bh_unlock_sock(sk); ++ goto discard_and_relse; ++ } + bh_unlock_sock(sk); + + sock_put(sk); +diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c +index f206ee5..4199bc6 100644 +--- a/net/ipv4/tcp_minisocks.c ++++ b/net/ipv4/tcp_minisocks.c +@@ -728,7 +728,7 @@ int tcp_child_process(struct sock *parent, struct sock *child, + * in main socket hash table and lock on listening + * socket does not protect us more. + */ +- sk_add_backlog(child, skb); ++ __sk_add_backlog(child, skb); + } + + bh_unlock_sock(child); +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 383ce23..dc26654 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -2393,13 +2393,17 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, + struct tcp_extend_values *xvp = tcp_xv(rvp); + struct inet_request_sock *ireq = inet_rsk(req); + struct tcp_sock *tp = tcp_sk(sk); ++ const struct tcp_cookie_values *cvp = tp->cookie_values; + struct tcphdr *th; + struct sk_buff *skb; + struct tcp_md5sig_key *md5; + int tcp_header_size; + int mss; ++ int s_data_desired = 0; + +- skb = sock_wmalloc(sk, MAX_TCP_HEADER + 15, 1, GFP_ATOMIC); ++ if (cvp != NULL && cvp->s_data_constant && cvp->s_data_desired) ++ s_data_desired = cvp->s_data_desired; ++ skb = sock_wmalloc(sk, MAX_TCP_HEADER + 15 + s_data_desired, 1, GFP_ATOMIC); + if (skb == NULL) + return NULL; + +@@ -2454,16 +2458,12 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, + TCPCB_FLAG_SYN | TCPCB_FLAG_ACK); + + if (OPTION_COOKIE_EXTENSION & opts.options) { +- const struct tcp_cookie_values *cvp = tp->cookie_values; +- +- if (cvp != NULL && +- cvp->s_data_constant && +- cvp->s_data_desired > 0) { +- u8 *buf = skb_put(skb, cvp->s_data_desired); ++ if (s_data_desired) { ++ u8 *buf = skb_put(skb, s_data_desired); + + /* copy data directly from the listening socket. */ +- memcpy(buf, cvp->s_data_payload, cvp->s_data_desired); +- TCP_SKB_CB(skb)->end_seq += cvp->s_data_desired; ++ memcpy(buf, cvp->s_data_payload, s_data_desired); ++ TCP_SKB_CB(skb)->end_seq += s_data_desired; + } + + if (opts.hash_size > 0) { +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index f0126fd..112c611 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -1372,8 +1372,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) + bh_lock_sock(sk); + if (!sock_owned_by_user(sk)) + rc = __udp_queue_rcv_skb(sk, skb); +- else +- sk_add_backlog(sk, skb); ++ else if (sk_add_backlog(sk, skb)) { ++ bh_unlock_sock(sk); ++ goto drop; ++ } + bh_unlock_sock(sk); + + return rc; +diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c +index 67107d6..e4a1483 100644 +--- a/net/ipv4/xfrm4_policy.c ++++ b/net/ipv4/xfrm4_policy.c +@@ -91,11 +91,12 @@ static int xfrm4_init_path(struct xfrm_dst *path, struct dst_entry *dst, + return 0; + } + +-static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) ++static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, ++ struct flowi *fl) + { + struct rtable *rt = (struct rtable *)xdst->route; + +- xdst->u.rt.fl = rt->fl; ++ xdst->u.rt.fl = *fl; + + xdst->u.dst.dev = dev; + dev_hold(dev); +diff --git a/net/ipv6/route.c b/net/ipv6/route.c +index c2bd74c..6232284 100644 +--- a/net/ipv6/route.c ++++ b/net/ipv6/route.c +@@ -897,12 +897,17 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst) + struct rt6_info *rt = (struct rt6_info *) dst; + + if (rt) { +- if (rt->rt6i_flags & RTF_CACHE) +- ip6_del_rt(rt); +- else ++ if (rt->rt6i_flags & RTF_CACHE) { ++ if (rt6_check_expired(rt)) { ++ ip6_del_rt(rt); ++ dst = NULL; ++ } ++ } else { + dst_release(dst); ++ dst = NULL; ++ } + } +- return NULL; ++ return dst; + } + + static void ip6_link_failure(struct sk_buff *skb) +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c +index febfd59..548a06e 100644 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -1732,8 +1732,10 @@ process: + if (!tcp_prequeue(sk, skb)) + ret = tcp_v6_do_rcv(sk, skb); + } +- } else +- sk_add_backlog(sk, skb); ++ } else if (sk_add_backlog(sk, skb)) { ++ bh_unlock_sock(sk); ++ goto discard_and_relse; ++ } + bh_unlock_sock(sk); + + sock_put(sk); +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c +index 69ebdbe..d9714d2 100644 +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -584,16 +584,20 @@ static void flush_stack(struct sock **stack, unsigned int count, + bh_lock_sock(sk); + if (!sock_owned_by_user(sk)) + udpv6_queue_rcv_skb(sk, skb1); +- else +- sk_add_backlog(sk, skb1); ++ else if (sk_add_backlog(sk, skb1)) { ++ kfree_skb(skb1); ++ bh_unlock_sock(sk); ++ goto drop; ++ } + bh_unlock_sock(sk); +- } else { +- atomic_inc(&sk->sk_drops); +- UDP6_INC_STATS_BH(sock_net(sk), +- UDP_MIB_RCVBUFERRORS, IS_UDPLITE(sk)); +- UDP6_INC_STATS_BH(sock_net(sk), +- UDP_MIB_INERRORS, IS_UDPLITE(sk)); ++ continue; + } ++drop: ++ atomic_inc(&sk->sk_drops); ++ UDP6_INC_STATS_BH(sock_net(sk), ++ UDP_MIB_RCVBUFERRORS, IS_UDPLITE(sk)); ++ UDP6_INC_STATS_BH(sock_net(sk), ++ UDP_MIB_INERRORS, IS_UDPLITE(sk)); + } + } + /* +@@ -756,8 +760,12 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, + bh_lock_sock(sk); + if (!sock_owned_by_user(sk)) + udpv6_queue_rcv_skb(sk, skb); +- else +- sk_add_backlog(sk, skb); ++ else if (sk_add_backlog(sk, skb)) { ++ atomic_inc(&sk->sk_drops); ++ bh_unlock_sock(sk); ++ sock_put(sk); ++ goto discard; ++ } + bh_unlock_sock(sk); + sock_put(sk); + return 0; +diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c +index dbdc696..ae18165 100644 +--- a/net/ipv6/xfrm6_policy.c ++++ b/net/ipv6/xfrm6_policy.c +@@ -116,7 +116,8 @@ static int xfrm6_init_path(struct xfrm_dst *path, struct dst_entry *dst, + return 0; + } + +-static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) ++static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, ++ struct flowi *fl) + { + struct rt6_info *rt = (struct rt6_info*)xdst->route; + +diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c +index 019c780..86d6985 100644 +--- a/net/llc/llc_c_ac.c ++++ b/net/llc/llc_c_ac.c +@@ -1437,7 +1437,7 @@ static void llc_process_tmr_ev(struct sock *sk, struct sk_buff *skb) + llc_conn_state_process(sk, skb); + else { + llc_set_backlog_type(skb, LLC_EVENT); +- sk_add_backlog(sk, skb); ++ __sk_add_backlog(sk, skb); + } + } + } +diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c +index c6bab39..c61ca88 100644 +--- a/net/llc/llc_conn.c ++++ b/net/llc/llc_conn.c +@@ -756,7 +756,8 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) + else { + dprintk("%s: adding to backlog...\n", __func__); + llc_set_backlog_type(skb, LLC_PACKET); +- sk_add_backlog(sk, skb); ++ if (sk_add_backlog(sk, skb)) ++ goto drop_unlock; + } + out: + bh_unlock_sock(sk); +diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h +index 91dc863..3521c17 100644 +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -264,6 +264,7 @@ enum ieee80211_sta_flags { + IEEE80211_STA_DISABLE_11N = BIT(4), + IEEE80211_STA_CSA_RECEIVED = BIT(5), + IEEE80211_STA_MFP_ENABLED = BIT(6), ++ IEEE80211_STA_NULLFUNC_ACKED = BIT(7), + }; + + /* flags for MLME request */ +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c +index 05a18f4..1a209ac 100644 +--- a/net/mac80211/mlme.c ++++ b/net/mac80211/mlme.c +@@ -205,7 +205,8 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, + sta = sta_info_get(local, bssid); + if (sta) + rate_control_rate_update(local, sband, sta, +- IEEE80211_RC_HT_CHANGED); ++ IEEE80211_RC_HT_CHANGED, ++ local->oper_channel_type); + rcu_read_unlock(); + } + +@@ -661,8 +662,11 @@ static void ieee80211_enable_ps(struct ieee80211_local *local, + } else { + if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) + ieee80211_send_nullfunc(local, sdata, 1); +- conf->flags |= IEEE80211_CONF_PS; +- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); ++ ++ if (!(local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) { ++ conf->flags |= IEEE80211_CONF_PS; ++ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); ++ } + } + } + +@@ -753,6 +757,7 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work) + container_of(work, struct ieee80211_local, + dynamic_ps_enable_work); + struct ieee80211_sub_if_data *sdata = local->ps_sdata; ++ struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; + + /* can only happen when PS was just disabled anyway */ + if (!sdata) +@@ -761,11 +766,16 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work) + if (local->hw.conf.flags & IEEE80211_CONF_PS) + return; + +- if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) ++ if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && ++ (!(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED))) + ieee80211_send_nullfunc(local, sdata, 1); + +- local->hw.conf.flags |= IEEE80211_CONF_PS; +- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); ++ if (!(local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) || ++ (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { ++ ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; ++ local->hw.conf.flags |= IEEE80211_CONF_PS; ++ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); ++ } + } + + void ieee80211_dynamic_ps_timer(unsigned long data) +@@ -2467,6 +2477,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, + list_add(&wk->list, &ifmgd->work_list); + + ifmgd->flags &= ~IEEE80211_STA_DISABLE_11N; ++ ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; + + for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) + if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || +diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h +index cb9bd1f..3e02ea4 100644 +--- a/net/mac80211/rate.h ++++ b/net/mac80211/rate.h +@@ -69,7 +69,8 @@ static inline void rate_control_rate_init(struct sta_info *sta) + + static inline void rate_control_rate_update(struct ieee80211_local *local, + struct ieee80211_supported_band *sband, +- struct sta_info *sta, u32 changed) ++ struct sta_info *sta, u32 changed, ++ enum nl80211_channel_type oper_chan_type) + { + struct rate_control_ref *ref = local->rate_ctrl; + struct ieee80211_sta *ista = &sta->sta; +@@ -77,7 +78,7 @@ static inline void rate_control_rate_update(struct ieee80211_local *local, + + if (ref && ref->ops->rate_update) + ref->ops->rate_update(ref->priv, sband, ista, +- priv_sta, changed); ++ priv_sta, changed, oper_chan_type); + } + + static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, +diff --git a/net/mac80211/status.c b/net/mac80211/status.c +index d78f36c..f5abeec 100644 +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -165,6 +165,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) + rcu_read_lock(); + + sband = local->hw.wiphy->bands[info->band]; ++ fc = hdr->frame_control; + + sta = sta_info_get(local, hdr->addr1); + +@@ -180,8 +181,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) + return; + } + +- fc = hdr->frame_control; +- + if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && + (ieee80211_is_data_qos(fc))) { + u16 tid, ssn; +@@ -246,6 +245,20 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) + local->dot11FailedCount++; + } + ++ if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && ++ (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && ++ !(info->flags & IEEE80211_TX_CTL_INJECTED) && ++ local->ps_sdata && !(local->scanning)) { ++ if (info->flags & IEEE80211_TX_STAT_ACK) { ++ local->ps_sdata->u.mgd.flags |= ++ IEEE80211_STA_NULLFUNC_ACKED; ++ ieee80211_queue_work(&local->hw, ++ &local->dynamic_ps_enable_work); ++ } else ++ mod_timer(&local->dynamic_ps_timer, jiffies + ++ msecs_to_jiffies(10)); ++ } ++ + /* this was a transmitted frame, but now we want to reuse it */ + skb_orphan(skb); + +diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c +index 0ffe689..eeac97f 100644 +--- a/net/netfilter/nf_conntrack_netlink.c ++++ b/net/netfilter/nf_conntrack_netlink.c +@@ -571,7 +571,8 @@ nla_put_failure: + nlmsg_failure: + kfree_skb(skb); + errout: +- nfnetlink_set_err(0, group, -ENOBUFS); ++ if (nfnetlink_set_err(0, group, -ENOBUFS) > 0) ++ return -ENOBUFS; + return 0; + } + #endif /* CONFIG_NF_CONNTRACK_EVENTS */ +diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c +index eedc0c1..35fe185 100644 +--- a/net/netfilter/nfnetlink.c ++++ b/net/netfilter/nfnetlink.c +@@ -114,9 +114,9 @@ int nfnetlink_send(struct sk_buff *skb, u32 pid, + } + EXPORT_SYMBOL_GPL(nfnetlink_send); + +-void nfnetlink_set_err(u32 pid, u32 group, int error) ++int nfnetlink_set_err(u32 pid, u32 group, int error) + { +- netlink_set_err(nfnl, pid, group, error); ++ return netlink_set_err(nfnl, pid, group, error); + } + EXPORT_SYMBOL_GPL(nfnetlink_set_err); + +diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c +index 43e83a4..e460bf9 100644 +--- a/net/netfilter/xt_recent.c ++++ b/net/netfilter/xt_recent.c +@@ -260,7 +260,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par) + for (i = 0; i < e->nstamps; i++) { + if (info->seconds && time_after(time, e->stamps[i])) + continue; +- if (info->hit_count && ++hits >= info->hit_count) { ++ if (!info->hit_count || ++hits >= info->hit_count) { + ret = !ret; + break; + } +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c +index 4c5972b..0052d3c 100644 +--- a/net/netlink/af_netlink.c ++++ b/net/netlink/af_netlink.c +@@ -1093,6 +1093,7 @@ static inline int do_one_set_err(struct sock *sk, + struct netlink_set_err_data *p) + { + struct netlink_sock *nlk = nlk_sk(sk); ++ int ret = 0; + + if (sk == p->exclude_sk) + goto out; +@@ -1104,10 +1105,15 @@ static inline int do_one_set_err(struct sock *sk, + !test_bit(p->group - 1, nlk->groups)) + goto out; + ++ if (p->code == ENOBUFS && nlk->flags & NETLINK_RECV_NO_ENOBUFS) { ++ ret = 1; ++ goto out; ++ } ++ + sk->sk_err = p->code; + sk->sk_error_report(sk); + out: +- return 0; ++ return ret; + } + + /** +@@ -1116,12 +1122,16 @@ out: + * @pid: the PID of a process that we want to skip (if any) + * @groups: the broadcast group that will notice the error + * @code: error code, must be negative (as usual in kernelspace) ++ * ++ * This function returns the number of broadcast listeners that have set the ++ * NETLINK_RECV_NO_ENOBUFS socket option. + */ +-void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) ++int netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) + { + struct netlink_set_err_data info; + struct hlist_node *node; + struct sock *sk; ++ int ret = 0; + + info.exclude_sk = ssk; + info.pid = pid; +@@ -1132,9 +1142,10 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) + read_lock(&nl_table_lock); + + sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list) +- do_one_set_err(sk, &info); ++ ret += do_one_set_err(sk, &info); + + read_unlock(&nl_table_lock); ++ return ret; + } + EXPORT_SYMBOL(netlink_set_err); + +diff --git a/net/sctp/input.c b/net/sctp/input.c +index c0c973e..3d74b26 100644 +--- a/net/sctp/input.c ++++ b/net/sctp/input.c +@@ -75,7 +75,7 @@ static struct sctp_association *__sctp_lookup_association( + const union sctp_addr *peer, + struct sctp_transport **pt); + +-static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb); ++static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb); + + + /* Calculate the SCTP checksum of an SCTP packet. */ +@@ -265,8 +265,13 @@ int sctp_rcv(struct sk_buff *skb) + } + + if (sock_owned_by_user(sk)) { ++ if (sctp_add_backlog(sk, skb)) { ++ sctp_bh_unlock_sock(sk); ++ sctp_chunk_free(chunk); ++ skb = NULL; /* sctp_chunk_free already freed the skb */ ++ goto discard_release; ++ } + SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG); +- sctp_add_backlog(sk, skb); + } else { + SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_SOFTIRQ); + sctp_inq_push(&chunk->rcvr->inqueue, chunk); +@@ -336,8 +341,10 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) + sctp_bh_lock_sock(sk); + + if (sock_owned_by_user(sk)) { +- sk_add_backlog(sk, skb); +- backloged = 1; ++ if (sk_add_backlog(sk, skb)) ++ sctp_chunk_free(chunk); ++ else ++ backloged = 1; + } else + sctp_inq_push(inqueue, chunk); + +@@ -362,22 +369,27 @@ done: + return 0; + } + +-static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb) ++static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb) + { + struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk; + struct sctp_ep_common *rcvr = chunk->rcvr; ++ int ret; + +- /* Hold the assoc/ep while hanging on the backlog queue. +- * This way, we know structures we need will not disappear from us +- */ +- if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) +- sctp_association_hold(sctp_assoc(rcvr)); +- else if (SCTP_EP_TYPE_SOCKET == rcvr->type) +- sctp_endpoint_hold(sctp_ep(rcvr)); +- else +- BUG(); ++ ret = sk_add_backlog(sk, skb); ++ if (!ret) { ++ /* Hold the assoc/ep while hanging on the backlog queue. ++ * This way, we know structures we need will not disappear ++ * from us ++ */ ++ if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type) ++ sctp_association_hold(sctp_assoc(rcvr)); ++ else if (SCTP_EP_TYPE_SOCKET == rcvr->type) ++ sctp_endpoint_hold(sctp_ep(rcvr)); ++ else ++ BUG(); ++ } ++ return ret; + +- sk_add_backlog(sk, skb); + } + + /* Handle icmp frag needed error. */ +diff --git a/net/sctp/socket.c b/net/sctp/socket.c +index 67fdac9..9bd9d82 100644 +--- a/net/sctp/socket.c ++++ b/net/sctp/socket.c +@@ -3720,6 +3720,9 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) + SCTP_DBG_OBJCNT_INC(sock); + percpu_counter_inc(&sctp_sockets_allocated); + ++ /* Set socket backlog limit. */ ++ sk->sk_backlog.limit = sysctl_sctp_rmem[1]; ++ + local_bh_disable(); + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); + local_bh_enable(); +diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c +index f7a7f83..50346a6 100644 +--- a/net/sunrpc/auth_gss/auth_gss.c ++++ b/net/sunrpc/auth_gss/auth_gss.c +@@ -1273,9 +1273,8 @@ alloc_enc_pages(struct rpc_rqst *rqstp) + rqstp->rq_release_snd_buf = priv_release_snd_buf; + return 0; + out_free: +- for (i--; i >= 0; i--) { +- __free_page(rqstp->rq_enc_pages[i]); +- } ++ rqstp->rq_enc_pages_num = i; ++ priv_release_snd_buf(rqstp); + out: + return -EAGAIN; + } +diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c +index 49278f8..27a2378 100644 +--- a/net/sunrpc/rpc_pipe.c ++++ b/net/sunrpc/rpc_pipe.c +@@ -587,6 +587,8 @@ static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, + struct dentry *dentry; + + dentry = __rpc_lookup_create(parent, name); ++ if (IS_ERR(dentry)) ++ return dentry; + if (dentry->d_inode == NULL) + return dentry; + dput(dentry); +diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c +index 4f30336..6bd41a9 100644 +--- a/net/sunrpc/svc_xprt.c ++++ b/net/sunrpc/svc_xprt.c +@@ -699,8 +699,10 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) + spin_unlock_bh(&pool->sp_lock); + + len = 0; +- if (test_bit(XPT_LISTENER, &xprt->xpt_flags) && +- !test_bit(XPT_CLOSE, &xprt->xpt_flags)) { ++ if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { ++ dprintk("svc_recv: found XPT_CLOSE\n"); ++ svc_delete_xprt(xprt); ++ } else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { + struct svc_xprt *newxpt; + newxpt = xprt->xpt_ops->xpo_accept(xprt); + if (newxpt) { +@@ -726,7 +728,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) + svc_xprt_received(newxpt); + } + svc_xprt_received(xprt); +- } else if (!test_bit(XPT_CLOSE, &xprt->xpt_flags)) { ++ } else { + dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", + rqstp, pool->sp_id, xprt, + atomic_read(&xprt->xpt_ref.refcount)); +@@ -739,11 +741,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) + dprintk("svc: got len=%d\n", len); + } + +- if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { +- dprintk("svc_recv: found XPT_CLOSE\n"); +- svc_delete_xprt(xprt); +- } +- + /* No data, incomplete (TCP) read, or accept() */ + if (len == 0 || len == -EAGAIN) { + rqstp->rq_res.len = 0; +diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c +index 870929e..528efef 100644 +--- a/net/sunrpc/svcsock.c ++++ b/net/sunrpc/svcsock.c +@@ -968,6 +968,7 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) + return len; + err_delete: + set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); ++ svc_xprt_received(&svsk->sk_xprt); + err_again: + return -EAGAIN; + } +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index 1ea64f0..4b235fc 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -1322,8 +1322,10 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) + if (!sock_owned_by_user(sk)) { + res = filter_rcv(sk, buf); + } else { +- sk_add_backlog(sk, buf); +- res = TIPC_OK; ++ if (sk_add_backlog(sk, buf)) ++ res = TIPC_ERR_OVERLOAD; ++ else ++ res = TIPC_OK; + } + bh_unlock_sock(sk); + +diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c +index 3e1efe5..52e3042 100644 +--- a/net/x25/x25_dev.c ++++ b/net/x25/x25_dev.c +@@ -53,7 +53,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) + if (!sock_owned_by_user(sk)) { + queued = x25_process_rx_frame(sk, skb); + } else { +- sk_add_backlog(sk, skb); ++ queued = !sk_add_backlog(sk, skb); + } + bh_unlock_sock(sk); + sock_put(sk); +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c +index 0ecb16a..f12dd3d 100644 +--- a/net/xfrm/xfrm_policy.c ++++ b/net/xfrm/xfrm_policy.c +@@ -1354,7 +1354,8 @@ static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, + return err; + } + +-static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) ++static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, ++ struct flowi *fl) + { + struct xfrm_policy_afinfo *afinfo = + xfrm_policy_get_afinfo(xdst->u.dst.ops->family); +@@ -1363,7 +1364,7 @@ static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev) + if (!afinfo) + return -EINVAL; + +- err = afinfo->fill_dst(xdst, dev); ++ err = afinfo->fill_dst(xdst, dev, fl); + + xfrm_policy_put_afinfo(afinfo); + +@@ -1468,7 +1469,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, + for (dst_prev = dst0; dst_prev != dst; dst_prev = dst_prev->child) { + struct xfrm_dst *xdst = (struct xfrm_dst *)dst_prev; + +- err = xfrm_fill_dst(xdst, dev); ++ err = xfrm_fill_dst(xdst, dev, fl); + if (err) + goto free_dst; + +diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c +index d9266ba..4e5f2f7 100644 +--- a/sound/pci/ac97/ac97_patch.c ++++ b/sound/pci/ac97/ac97_patch.c +@@ -1867,12 +1867,14 @@ static unsigned int ad1981_jacks_blacklist[] = { + 0x10140523, /* Thinkpad R40 */ + 0x10140534, /* Thinkpad X31 */ + 0x10140537, /* Thinkpad T41p */ ++ 0x1014053e, /* Thinkpad R40e */ + 0x10140554, /* Thinkpad T42p/R50p */ + 0x10140567, /* Thinkpad T43p 2668-G7U */ + 0x10140581, /* Thinkpad X41-2527 */ + 0x10280160, /* Dell Dimension 2400 */ + 0x104380b0, /* Asus A7V8X-MX */ + 0x11790241, /* Toshiba Satellite A-15 S127 */ ++ 0x1179ff10, /* Toshiba P500 */ + 0x144dc01a, /* Samsung NP-X20C004/SEG */ + 0 /* end */ + }; +diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c +index a312bae..bbaec22 100644 +--- a/sound/pci/cmipci.c ++++ b/sound/pci/cmipci.c +@@ -941,13 +941,21 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(struct cmipci *cm, struct cmipci + struct snd_pcm_substream *substream) + { + size_t ptr; +- unsigned int reg; ++ unsigned int reg, rem, tries; ++ + if (!rec->running) + return 0; + #if 1 // this seems better.. + reg = rec->ch ? CM_REG_CH1_FRAME2 : CM_REG_CH0_FRAME2; +- ptr = rec->dma_size - (snd_cmipci_read_w(cm, reg) + 1); +- ptr >>= rec->shift; ++ for (tries = 0; tries < 3; tries++) { ++ rem = snd_cmipci_read_w(cm, reg); ++ if (rem < rec->dma_size) ++ goto ok; ++ } ++ printk(KERN_ERR "cmipci: invalid PCM pointer: %#x\n", rem); ++ return SNDRV_PCM_POS_XRUN; ++ok: ++ ptr = (rec->dma_size - (rem + 1)) >> rec->shift; + #else + reg = rec->ch ? CM_REG_CH1_FRAME1 : CM_REG_CH0_FRAME1; + ptr = snd_cmipci_read(cm, reg) - rec->offset; +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index 6d6e307..9ace8eb 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2265,8 +2265,10 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { + SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), ++ SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), + SND_PCI_QUIRK(0x1565, 0x820f, "Biostar Microtech", POS_FIX_LPIB), ++ SND_PCI_QUIRK(0x8086, 0xd601, "eMachines T5212", POS_FIX_LPIB), + {} + }; + +@@ -2354,6 +2356,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) + static struct snd_pci_quirk msi_black_list[] __devinitdata = { + SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ + SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ ++ SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ + {} + }; + +@@ -2372,6 +2375,13 @@ static void __devinit check_msi(struct azx *chip) + "hda_intel: msi for device %04x:%04x set to %d\n", + q->subvendor, q->subdevice, q->value); + chip->msi = q->value; ++ return; ++ } ++ ++ /* NVidia chipsets seem to cause troubles with MSI */ ++ if (chip->driver_type == AZX_DRIVER_NVIDIA) { ++ printk(KERN_INFO "hda_intel: Disable MSI for Nvidia chipset\n"); ++ chip->msi = 0; + } + } + +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c +index c578c28..71b7a96 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -1570,6 +1570,21 @@ static int patch_cxt5047(struct hda_codec *codec) + #endif + } + spec->vmaster_nid = 0x13; ++ ++ switch (codec->subsystem_id >> 16) { ++ case 0x103c: ++ /* HP laptops have really bad sound over 0 dB on NID 0x10. ++ * Fix max PCM level to 0 dB (originally it has 0x1e steps ++ * with 0 dB offset 0x17) ++ */ ++ snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, ++ (0x17 << AC_AMPCAP_OFFSET_SHIFT) | ++ (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | ++ (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | ++ (1 << AC_AMPCAP_MUTE_SHIFT)); ++ break; ++ } ++ + return 0; + } + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index da34095..a79f841 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -407,6 +407,8 @@ static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, + unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); + if (mux_idx >= spec->num_mux_defs) + mux_idx = 0; ++ if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) ++ mux_idx = 0; + return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); + } + +@@ -435,6 +437,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, + + mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; + imux = &spec->input_mux[mux_idx]; ++ if (!imux->num_items && mux_idx > 0) ++ imux = &spec->input_mux[0]; + + type = get_wcaps_type(get_wcaps(codec, nid)); + if (type == AC_WID_AUD_MIX) { +@@ -6380,7 +6384,7 @@ static struct alc_config_preset alc260_presets[] = { + .num_dacs = ARRAY_SIZE(alc260_dac_nids), + .dac_nids = alc260_dac_nids, + .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), +- .adc_nids = alc260_adc_nids, ++ .adc_nids = alc260_dual_adc_nids, + .num_channel_mode = ARRAY_SIZE(alc260_modes), + .channel_mode = alc260_modes, + .input_mux = &alc260_capture_source, +@@ -9097,7 +9101,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { + SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), + SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), + SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), +- SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), ++ SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), + + {} + }; +@@ -9941,6 +9945,8 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) + continue; + mux_idx = c >= spec->num_mux_defs ? 0 : c; + imux = &spec->input_mux[mux_idx]; ++ if (!imux->num_items && mux_idx > 0) ++ imux = &spec->input_mux[0]; + for (idx = 0; idx < conns; idx++) { + /* if the current connection is the selected one, + * unmute it as default - otherwise mute it +diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile +index bdd3b7e..bd498d4 100644 +--- a/tools/perf/Documentation/Makefile ++++ b/tools/perf/Documentation/Makefile +@@ -24,7 +24,10 @@ DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) + DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT)) + DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) + ++# Make the path relative to DESTDIR, not prefix ++ifndef DESTDIR + prefix?=$(HOME) ++endif + bindir?=$(prefix)/bin + htmldir?=$(prefix)/share/doc/perf-doc + pdfdir?=$(prefix)/share/doc/perf-doc +@@ -32,7 +35,6 @@ mandir?=$(prefix)/share/man + man1dir=$(mandir)/man1 + man5dir=$(mandir)/man5 + man7dir=$(mandir)/man7 +-# DESTDIR= + + ASCIIDOC=asciidoc + ASCIIDOC_EXTRA = --unsafe +diff --git a/tools/perf/Makefile b/tools/perf/Makefile +index 2e7fa3a..03eb7c9 100644 +--- a/tools/perf/Makefile ++++ b/tools/perf/Makefile +@@ -216,7 +216,10 @@ STRIP ?= strip + # runtime figures out where they are based on the path to the executable. + # This can help installing the suite in a relocatable way. + ++# Make the path relative to DESTDIR, not to prefix ++ifndef DESTDIR + prefix = $(HOME) ++endif + bindir_relative = bin + bindir = $(prefix)/$(bindir_relative) + mandir = share/man +@@ -233,7 +236,6 @@ sysconfdir = $(prefix)/etc + ETC_PERFCONFIG = etc/perfconfig + endif + lib = lib +-# DESTDIR= + + export prefix bindir sharedir sysconfdir + +diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c +index 593ff25..0b1ba36 100644 +--- a/tools/perf/builtin-annotate.c ++++ b/tools/perf/builtin-annotate.c +@@ -53,32 +53,20 @@ struct sym_priv { + + static const char *sym_hist_filter; + +-static int symbol_filter(struct map *map __used, struct symbol *sym) ++static int sym__alloc_hist(struct symbol *self) + { +- if (sym_hist_filter == NULL || +- strcmp(sym->name, sym_hist_filter) == 0) { +- struct sym_priv *priv = symbol__priv(sym); +- const int size = (sizeof(*priv->hist) + +- (sym->end - sym->start) * sizeof(u64)); ++ struct sym_priv *priv = symbol__priv(self); ++ const int size = (sizeof(*priv->hist) + ++ (self->end - self->start) * sizeof(u64)); + +- priv->hist = malloc(size); +- if (priv->hist) +- memset(priv->hist, 0, size); +- return 0; +- } +- /* +- * FIXME: We should really filter it out, as we don't want to go thru symbols +- * we're not interested, and if a DSO ends up with no symbols, delete it too, +- * but right now the kernel loading routines in symbol.c bail out if no symbols +- * are found, fix it later. +- */ +- return 0; ++ priv->hist = zalloc(size); ++ return priv->hist == NULL ? -1 : 0; + } + + /* + * collect histogram counts + */ +-static void hist_hit(struct hist_entry *he, u64 ip) ++static int annotate__hist_hit(struct hist_entry *he, u64 ip) + { + unsigned int sym_size, offset; + struct symbol *sym = he->sym; +@@ -88,11 +76,11 @@ static void hist_hit(struct hist_entry *he, u64 ip) + he->count++; + + if (!sym || !he->map) +- return; ++ return 0; + + priv = symbol__priv(sym); +- if (!priv->hist) +- return; ++ if (priv->hist == NULL && sym__alloc_hist(sym) < 0) ++ return -ENOMEM; + + sym_size = sym->end - sym->start; + offset = ip - sym->start; +@@ -102,7 +90,7 @@ static void hist_hit(struct hist_entry *he, u64 ip) + he->map->unmap_ip(he->map, ip)); + + if (offset >= sym_size) +- return; ++ return 0; + + h = priv->hist; + h->sum++; +@@ -114,18 +102,31 @@ static void hist_hit(struct hist_entry *he, u64 ip) + he->sym->name, + (void *)(unsigned long)ip, ip - he->sym->start, + h->ip[offset]); ++ return 0; + } + + static int perf_session__add_hist_entry(struct perf_session *self, + struct addr_location *al, u64 count) + { +- bool hit; +- struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL, +- count, &hit); +- if (he == NULL) +- return -ENOMEM; +- hist_hit(he, al->addr); +- return 0; ++ bool hit; ++ struct hist_entry *he; ++ ++ if (sym_hist_filter != NULL && ++ (al->sym == NULL || strcmp(sym_hist_filter, al->sym->name) != 0)) { ++ /* We're only interested in a symbol named sym_hist_filter */ ++ if (al->sym != NULL) { ++ rb_erase(&al->sym->rb_node, ++ &al->map->dso->symbols[al->map->type]); ++ symbol__delete(al->sym); ++ } ++ return 0; ++ } ++ ++ he = __perf_session__add_hist_entry(self, al, NULL, count, &hit); ++ if (he == NULL) ++ return -ENOMEM; ++ ++ return annotate__hist_hit(he, al->addr); + } + + static int process_sample_event(event_t *event, struct perf_session *session) +@@ -135,7 +136,7 @@ static int process_sample_event(event_t *event, struct perf_session *session) + dump_printf("(IP, %d): %d: %p\n", event->header.misc, + event->ip.pid, (void *)(long)event->ip.ip); + +- if (event__preprocess_sample(event, session, &al, symbol_filter) < 0) { ++ if (event__preprocess_sample(event, session, &al, NULL) < 0) { + fprintf(stderr, "problem processing %d event, skipping it.\n", + event->header.type); + return -1; +diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c +index c1e6774..fa626eb 100644 +--- a/tools/perf/builtin-probe.c ++++ b/tools/perf/builtin-probe.c +@@ -48,7 +48,6 @@ + #include "util/probe-event.h" + + #define MAX_PATH_LEN 256 +-#define MAX_PROBES 128 + + /* Session management structure */ + static struct { +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 4b852c0..7f81ded 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -544,6 +544,9 @@ static void show_probepoint(Dwarf_Die sp_die, Dwarf_Signed offs, + } + free_current_frame_base(pf); + ++ if (pp->found == MAX_PROBES) ++ die("Too many( > %d) probe point found.\n", MAX_PROBES); ++ + pp->probes[pp->found] = strdup(tmp); + pp->found++; + } +diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c +index 72547b9..fcb8919 100644 +--- a/tools/perf/util/symbol.c ++++ b/tools/perf/util/symbol.c +@@ -149,7 +149,7 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name) + return self; + } + +-static void symbol__delete(struct symbol *self) ++void symbol__delete(struct symbol *self) + { + free(((void *)self) - symbol_conf.priv_size); + } +diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h +index 8aded23..400227a 100644 +--- a/tools/perf/util/symbol.h ++++ b/tools/perf/util/symbol.h +@@ -49,6 +49,8 @@ struct symbol { + char name[0]; + }; + ++void symbol__delete(struct symbol *self); ++ + struct strlist; + + struct symbol_conf { diff --git a/debian/patches/series/base b/debian/patches/series/base index b079e8efd..bd3304607 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -60,3 +60,4 @@ + features/all/rtl8192su-always-use-request_firmware.patch + bugfix/all/stable/2.6.33.1.patch ++ bugfix/all/stable/2.6.33.2.patch From 36d833447464f83ee0de2c84bad092286ffd1940 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 4 Apr 2010 06:20:04 +0000 Subject: [PATCH 11/19] [x86] Enable ramzswap driver (Closes: #573912) svn path=/dists/trunk/linux-2.6/; revision=15480 --- debian/changelog | 3 +++ debian/config/kernelarch-x86/config | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3adb5eeec..23db742cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,9 @@ linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low [ maximilian attems] * Add stable 2.6.33.2. + [ Ben Hutchings ] + * [x86] Enable ramzswap driver (Closes: #573912) + -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low diff --git a/debian/config/kernelarch-x86/config b/debian/config/kernelarch-x86/config index f3a28a05b..1b1de6340 100644 --- a/debian/config/kernelarch-x86/config +++ b/debian/config/kernelarch-x86/config @@ -1097,6 +1097,12 @@ CONFIG_POHMELFS=m # CONFIG_POHMELFS_DEBUG is not set CONFIG_POHMELFS_CRYPTO=y +## +## file: drivers/staging/ramzswap/Kconfig +## +CONFIG_RAMZSWAP=m +CONFIG_RAMZSWAP_STATS=y + ## ## file: drivers/staging/rt2860/Kconfig ## From c9dc94dae38e024f00f565bce2a89ce5ea64fafc Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 7 Apr 2010 03:08:14 +0000 Subject: [PATCH 12/19] [x86] Re-enable rt2860sta and rt2870sta drivers (Closes: #576723) The firmware-loading patch needs to remove 'depends on BROKEN'. I forgot to include this when I updated it for 2.6.33 based on the patch accepted upstream. svn path=/dists/trunk/linux-2.6/; revision=15496 --- debian/changelog | 2 ++ .../features/all/rt28x0sta-use-request_firmware.patch | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 23db742cd..830baa82c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low [ Ben Hutchings ] * [x86] Enable ramzswap driver (Closes: #573912) + * [x86] Re-enable rt2860sta and rt2870sta drivers which were accidentally + disabled when moving to Linux 2.6.33 (Closes: #576723) -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 diff --git a/debian/patches/features/all/rt28x0sta-use-request_firmware.patch b/debian/patches/features/all/rt28x0sta-use-request_firmware.patch index 6c7ef5c4e..f8220335c 100644 --- a/debian/patches/features/all/rt28x0sta-use-request_firmware.patch +++ b/debian/patches/features/all/rt28x0sta-use-request_firmware.patch @@ -13,8 +13,11 @@ Based on work by Darren Salt . --- a/drivers/staging/rt2860/Kconfig +++ b/drivers/staging/rt2860/Kconfig -@@ -3,6 +3,8 @@ config RT2860 +@@ -1,9 +1,10 @@ config RT2860 + config RT2860 + tristate "Ralink 2860/3090 wireless support" depends on PCI && X86 && WLAN +- depends on BROKEN select WIRELESS_EXT select WEXT_PRIV + select CRC_CCITT @@ -250,8 +253,11 @@ Based on work by Darren Salt . u16 ThisTbttNumToNextWakeUp; --- a/drivers/staging/rt2870/Kconfig +++ b/drivers/staging/rt2870/Kconfig -@@ -3,5 +3,7 @@ config RT2870 +@@ -1,8 +1,9 @@ config RT2870 + config RT2870 + tristate "Ralink 2870/3070 wireless support" depends on USB && X86 && WLAN +- depends on BROKEN select WIRELESS_EXT select WEXT_PRIV + select CRC_CCITT From ef5bc98e4db822404d751022461f2557e939dabb Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 9 Apr 2010 15:53:34 +0000 Subject: [PATCH 13/19] Add sh4 architecture, ported from the sid branch svn path=/dists/trunk/linux-2.6/; revision=15502 --- debian/changelog | 4 + debian/config/defines | 1 + debian/config/sh4/config | 49 +++ debian/config/sh4/config.sh7785lcr | 324 ++++++++++++++++++ debian/config/sh4/defines | 20 ++ .../debian/arch-sh4-fix-uimage-build.patch | 10 + debian/patches/series/base | 2 + debian/rules.real | 3 +- .../templates/image.plain.bug/include-model | 3 + 9 files changed, 415 insertions(+), 1 deletion(-) create mode 100644 debian/config/sh4/config create mode 100644 debian/config/sh4/config.sh7785lcr create mode 100644 debian/config/sh4/defines create mode 100644 debian/patches/debian/arch-sh4-fix-uimage-build.patch diff --git a/debian/changelog b/debian/changelog index 830baa82c..6bdfb147a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,10 @@ linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low * [x86] Re-enable rt2860sta and rt2870sta drivers which were accidentally disabled when moving to Linux 2.6.33 (Closes: #576723) + [ Aurelien Jarno ] + * Add support for sh4 architecture, patch by Nobuhiro Iwamatsu + (Closes: #569034) + -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 linux-2.6 (2.6.33-1~experimental.4) experimental; urgency=low diff --git a/debian/config/defines b/debian/config/defines index 7381abbc5..ed1d62c4a 100644 --- a/debian/config/defines +++ b/debian/config/defines @@ -14,6 +14,7 @@ arches: mipsel powerpc s390 + sh4 sparc sparc64 compiler: gcc-4.3 diff --git a/debian/config/sh4/config b/debian/config/sh4/config new file mode 100644 index 000000000..39b6ceef9 --- /dev/null +++ b/debian/config/sh4/config @@ -0,0 +1,49 @@ +CONFIG_SUPERH=y +CONFIG_SUPERH32=y + +# +# System type +# +CONFIG_CPU_SH4=y + +# +# Cache configuration +# +CONFIG_CACHE_WRITEBACK=y + +# +# Processor features +# +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_SH_FPU=y +CONFIG_SH_STORE_QUEUES=y +CONFIG_CPU_HAS_INTEVT=y +CONFIG_CPU_HAS_SR_RB=y +CONFIG_CPU_HAS_FPU=y + +# +# CPU Frequency scaling +# +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_SH_CPU_FREQ=y + +# +# Additional SuperH Device Drivers +# +CONFIG_HEARTBEAT=y + +# +# Kernel features +# +CONFIG_HZ_250=y +CONFIG_HZ=250 +CONFIG_SCHED_HRTICK=y +CONFIG_KEXEC=y +CONFIG_SECCOMP=y +CONFIG_PREEMPT_NONE=y +CONFIG_GUSA=y +CONFIG_SPARSE_IRQ=y diff --git a/debian/config/sh4/config.sh7785lcr b/debian/config/sh4/config.sh7785lcr new file mode 100644 index 000000000..66d3453b3 --- /dev/null +++ b/debian/config/sh4/config.sh7785lcr @@ -0,0 +1,324 @@ +# +# System type +# +CONFIG_CPU_SH4A=y +CONFIG_CPU_SHX2=y +CONFIG_CPU_SUBTYPE_SH7785=y + +# +# Memory management options +# +CONFIG_QUICKLIST=y +CONFIG_MMU=y +CONFIG_PAGE_OFFSET=0x80000000 +CONFIG_FORCE_MAX_ZONEORDER=11 +CONFIG_MEMORY_START=0x48000000 +CONFIG_MEMORY_SIZE=0x18000000 +CONFIG_32BIT=y +CONFIG_PMB_ENABLE=y +CONFIG_PMB_FIXED=y +CONFIG_VSYSCALL=y +CONFIG_ARCH_FLATMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_MAX_ACTIVE_REGIONS=2 +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y +CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y +CONFIG_PAGE_SIZE_4KB=y +CONFIG_HUGETLB_PAGE_SIZE_64K=y +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_STATIC=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_MIGRATION=y +CONFIG_ZONE_DMA_FLAG=0 +CONFIG_NR_QUICK=2 +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MLOCKED_PAGE_BIT=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 + +# +# Processor features +# +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_SH_FPU=y +CONFIG_SH_STORE_QUEUES=y +CONFIG_CPU_HAS_INTEVT=y +CONFIG_CPU_HAS_SR_RB=y +CONFIG_CPU_HAS_FPU=y + +# +# Board support +# +CONFIG_SH_SH7785LCR=y + +# +# Timer and clock configuration +# +CONFIG_SH_TIMER_TMU=y +CONFIG_SH_PCLK_FREQ=50000000 +CONFIG_SH_CLK_CPG=y +CONFIG_TICK_ONESHOT=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y + +# +# Boot options +# +CONFIG_ZERO_PAGE_OFFSET=0x00001000 +CONFIG_BOOT_LINK_OFFSET=0x00800000 +CONFIG_ENTRY_OFFSET=0x00001000 + +# +# Bus options +# +CONFIG_PCI=y +CONFIG_SH_PCIDMA_NONCOHERENT=y + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_MTD=y +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y + +# +# User Modules And Translation Layers +# +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLKDEVS=y +CONFIG_MTD_BLOCK=y + +# +# RAM/ROM/Flash chip drivers +# +CONFIG_MTD_CFI=y +CONFIG_MTD_GEN_PROBE=y +CONFIG_MTD_MAP_BANK_WIDTH_1=y +CONFIG_MTD_MAP_BANK_WIDTH_2=y +CONFIG_MTD_MAP_BANK_WIDTH_4=y +CONFIG_MTD_CFI_I1=y +CONFIG_MTD_CFI_I2=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CFI_UTIL=y + +# +# Mapping drivers for chip access +# +CONFIG_MTD_PHYSMAP=y + +# +# UBI - Unsorted block images +# +CONFIG_HAVE_IDE=y + +# +# SCSI device support +# +CONFIG_SCSI=y +CONFIG_SCSI_DMA=y + +# +# SCSI support type (disk, tape, CD-ROM) +# +CONFIG_BLK_DEV_SD=y + +# +# SCSI Transports +# +CONFIG_ATA=y +CONFIG_ATA_VERBOSE_ERROR=y +CONFIG_SATA_PMP=y +CONFIG_ATA_SFF=y +CONFIG_SATA_SIL=y + +# net device + +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_NETDEV_1000=y +CONFIG_R8169=y + +# +# Input device support +# +CONFIG_INPUT=y + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +CONFIG_INPUT_EVDEV=y + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ATKBD=y +CONFIG_INPUT_MOUSE=y +CONFIG_MOUSE_PS2=y +CONFIG_MOUSE_PS2_ALPS=y +CONFIG_MOUSE_PS2_LOGIPS2PP=y +CONFIG_MOUSE_PS2_SYNAPTICS=y +CONFIG_MOUSE_PS2_TRACKPOINT=y + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_I8042=y +CONFIG_SERIO_SERPORT=y +CONFIG_SERIO_LIBPS2=y + +# +# Character devices +# +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +CONFIG_VT_HW_CONSOLE_BINDING=y + +# +# Non-8250 serial port support +# +CONFIG_SERIAL_SH_SCI=y +CONFIG_SERIAL_SH_SCI_NR_UARTS=6 +CONFIG_SERIAL_SH_SCI_CONSOLE=y +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y +CONFIG_UNIX98_PTYS=y +CONFIG_DEVPTS_MULTIPLE_INSTANCES=y +CONFIG_DEVPORT=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_ALGOPCA=y + +# +# Other I2C/SMBus bus drivers +# +CONFIG_I2C_PCA_PLATFORM=y + +# +# PPS support +# +CONFIG_WATCHDOG=y + +# +# Watchdog Device Drivers +# +CONFIG_SH_WDT=y + +# +# USB-based Watchdog Cards +# +# CONFIG_USBPCWATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Multifunction device drivers +# +CONFIG_MFD_SM501=y + +# +# Graphics support +# +CONFIG_FB=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y + +# +# Frame buffer hardware drivers +# +CONFIG_FB_SM501=y + +# +# Console display driver support +# +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_LOGO=y +CONFIG_LOGO_SUPERH_MONO=y +CONFIG_LOGO_SUPERH_VGA16=y +CONFIG_LOGO_SUPERH_CLUT224=y +CONFIG_HID_SUPPORT=y +CONFIG_HID=y + +# +# USB Input Devices +# +CONFIG_USB_HID=y + +# +# USB Host +# +CONFIG_USB_SUPPORT=y +CONFIG_USB_ARCH_HAS_HCD=y +CONFIG_USB_ARCH_HAS_OHCI=y +CONFIG_USB_ARCH_HAS_EHCI=y +CONFIG_USB=y + +# +# Miscellaneous USB options +# +CONFIG_USB_DEVICE_CLASS=y + +# +# USB Host Controller Drivers +# +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_R8A66597_HCD=y + +# +# also be needed; see USB_STORAGE Help for more info +# +CONFIG_USB_STORAGE=y + +# +# RTC +# +CONFIG_RTC_LIB=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc0" + +# +# RTC interfaces +# +CONFIG_RTC_INTF_SYSFS=y +CONFIG_RTC_INTF_PROC=y +CONFIG_RTC_INTF_DEV=y + +# +# I2C RTC drivers +# +CONFIG_RTC_DRV_RS5C372=y + +# +# on-CPU RTC drivers +# +# CONFIG_RTC_DRV_SH is not set +# CONFIG_RTC_DRV_GENERIC is not set +CONFIG_DMADEVICES=y + +# +# File systems +# +CONFIG_EXT3_FS=y diff --git a/debian/config/sh4/defines b/debian/config/sh4/defines new file mode 100644 index 000000000..ab45a8db8 --- /dev/null +++ b/debian/config/sh4/defines @@ -0,0 +1,20 @@ +[base] +flavours: + sh7785lcr +kernel-arch: sh + +[image] +suggests: fdutils + +[sh7785lcr_build] +image-file: arch/sh/boot/zImage + +[sh7785lcr_description] +hardware: sh7785lcr +hardware-long: Renesas SH7785 reference board + +[sh7785lcr_image] +recommends: uboot-mkimage +# Kernel partition size: 4MB +check-size: 4194304 + diff --git a/debian/patches/debian/arch-sh4-fix-uimage-build.patch b/debian/patches/debian/arch-sh4-fix-uimage-build.patch new file mode 100644 index 000000000..1ddc00c9e --- /dev/null +++ b/debian/patches/debian/arch-sh4-fix-uimage-build.patch @@ -0,0 +1,10 @@ +--- a/arch/sh/Makefile 2009-12-03 12:51:21.000000000 +0900 ++++ b/arch/sh/Makefile 2010-02-04 15:47:57.000000000 +0900 +@@ -75,7 +75,6 @@ + + # Give the various platforms the opportunity to set default image types + defaultimage-$(CONFIG_SUPERH32) := zImage +-defaultimage-$(CONFIG_SH_SH7785LCR) := uImage + defaultimage-$(CONFIG_SH_RSK) := uImage + defaultimage-$(CONFIG_SH_URQUELL) := uImage + defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE) := vmlinux diff --git a/debian/patches/series/base b/debian/patches/series/base index bd3304607..192f5ecf7 100644 --- a/debian/patches/series/base +++ b/debian/patches/series/base @@ -61,3 +61,5 @@ + bugfix/all/stable/2.6.33.1.patch + bugfix/all/stable/2.6.33.2.patch + ++ debian/arch-sh4-fix-uimage-build.patch diff --git a/debian/rules.real b/debian/rules.real index 78b300053..e39d09aed 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -330,7 +330,8 @@ endif install-image_arm_$(FEATURESET)_$(FLAVOUR)_plain_image \ install-image_armel_$(FEATURESET)_$(FLAVOUR)_plain_image \ install-image_sparc_$(FEATURESET)_$(FLAVOUR)_plain_image \ -install-image_sparc64_$(FEATURESET)_$(FLAVOUR)_plain_image: +install-image_sparc64_$(FEATURESET)_$(FLAVOUR)_plain_image \ +install-image_sh4_$(FEATURESET)_$(FLAVOUR)_plain_image: install -m644 '$(DIR)/arch/$(KERNEL_ARCH)/boot/zImage' $(INSTALL_DIR)/vmlinuz-$(REAL_VERSION) install-image_amd64_$(FEATURESET)_$(FLAVOUR)_plain_image \ diff --git a/debian/templates/image.plain.bug/include-model b/debian/templates/image.plain.bug/include-model index 542efc8ce..40f802133 100644 --- a/debian/templates/image.plain.bug/include-model +++ b/debian/templates/image.plain.bug/include-model @@ -32,6 +32,9 @@ grep_model() { sparc|sparc64) egrep '^(cpu|fpu|pmu|prom|type)\b' /proc/cpuinfo ;; + sh4|sh4a) + egrep '^(machine|cpu)\b' /proc/cpuinfo + ;; *) false ;; From e6e6cc878a9055463ac4b175b8bacfac9cf700c6 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 20 Apr 2010 19:18:56 +0000 Subject: [PATCH 14/19] debian/bin/gencontrol.py: Split out makeflags setup. svn path=/dists/trunk/linux-2.6/; revision=15526 --- debian/bin/gencontrol.py | 59 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 2cbb47671..4c972d10f 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -14,6 +14,11 @@ class Gencontrol(Base): self.process_changelog() self.config_dirs = config_dirs + def _setup_makeflags(self, names, makeflags, data): + for src, dst, optional in names: + if src in data or not optional: + makeflags[dst] = data[src] + def do_main_setup(self, vars, makeflags, extra): super(Gencontrol, self).do_main_setup(vars, makeflags, extra) makeflags.update({ @@ -27,16 +32,13 @@ class Gencontrol(Base): def do_main_packages(self, packages, vars, makeflags, extra): packages.extend(self.process_packages(self.templates["control.main"], self.vars)) + arch_makeflags = ( + ('kernel-arch', 'KERNEL_ARCH', False), + ) + def do_arch_setup(self, vars, makeflags, arch, extra): config_base = self.config.merge('base', arch) - - data = vars.copy() - data.update(config_base) - - for i in ( - ('kernel-arch', 'KERNEL_ARCH'), - ): - makeflags[i[1]] = data[i[0]] + self._setup_makeflags(self.arch_makeflags, makeflags, config_base) def do_arch_packages(self, packages, makefile, arch, vars, makeflags, extra): headers_arch = self.templates["control.headers.arch"] @@ -69,6 +71,23 @@ class Gencontrol(Base): makefile.add('binary-arch_%s_%s_real' % (arch, featureset), cmds = cmds_binary_arch) makefile.add('source_%s_%s_real' % (arch, featureset), cmds = cmds_source) + flavour_makeflags_base = ( + ('compiler', 'COMPILER', False), + ('kernel-arch', 'KERNEL_ARCH', False), + ('cflags', 'CFLAGS_KERNEL', True), + ('override-host-type', 'OVERRIDE_HOST_TYPE', True), + ) + + flavour_makeflags_image = ( + ('type', 'TYPE', False), + ('initramfs', 'INITRAMFS', True), + ) + + flavour_makeflags_other = ( + ('localversion', 'LOCALVERSION', False), + ('localversion-image', 'LOCALVERSION_IMAGE', True), + ) + def do_flavour_setup(self, vars, makeflags, arch, featureset, flavour, extra): config_base = self.config.merge('base', arch, featureset, flavour) config_description = self.config.merge('description', arch, featureset, flavour) @@ -82,27 +101,9 @@ class Gencontrol(Base): if override_localversion is not None: vars['localversion-image'] = vars['localversion_headers'] + '-' + override_localversion - data = vars.copy() - data.update(config_base) - data.update(config_image) - - for i in ( - ('compiler', 'COMPILER'), - ('kernel-arch', 'KERNEL_ARCH'), - ('localversion', 'LOCALVERSION'), - ('type', 'TYPE'), - ): - makeflags[i[1]] = data[i[0]] - for i in ( - ('cflags', 'CFLAGS_KERNEL'), - ('initramfs', 'INITRAMFS'), - ('kpkg-arch', 'KPKG_ARCH'), - ('kpkg-subarch', 'KPKG_SUBARCH'), - ('localversion-image', 'LOCALVERSION_IMAGE'), - ('override-host-type', 'OVERRIDE_HOST_TYPE'), - ): - if data.has_key(i[0]): - makeflags[i[1]] = data[i[0]] + self._setup_makeflags(self.flavour_makeflags_base, makeflags, config_base) + self._setup_makeflags(self.flavour_makeflags_image, makeflags, config_image) + self._setup_makeflags(self.flavour_makeflags_other, makeflags, vars) def do_flavour_packages(self, packages, makefile, arch, featureset, flavour, vars, makeflags, extra): headers = self.templates["control.headers"] From 2adc7b9fdf08964f92463a27cc608019f1245350 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 20 Apr 2010 19:22:08 +0000 Subject: [PATCH 15/19] debian/lib/python/debian_linux/gencontrol.py: Sort makeflags. svn path=/dists/trunk/linux-2.6/; revision=15527 --- debian/lib/python/debian_linux/gencontrol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/lib/python/debian_linux/gencontrol.py b/debian/lib/python/debian_linux/gencontrol.py index 90e9db65e..b474ad814 100644 --- a/debian/lib/python/debian_linux/gencontrol.py +++ b/debian/lib/python/debian_linux/gencontrol.py @@ -65,7 +65,7 @@ class MakeFlags(dict): return "%s(%s)" % (self.__class__.__name__, repr) def __str__(self): - return ' '.join(["%s='%s'" % i for i in self.iteritems()]) + return ' '.join(["%s='%s'" % i for i in sorted(self.iteritems())]) def copy(self): return self.__class__(super(MakeFlags, self).copy()) From 0d4f98db65c1902c6a4f14a016d5a7be791ac613 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 20 Apr 2010 19:27:18 +0000 Subject: [PATCH 16/19] debian/lib/python/debian_linux/gencontrol.py: Don't need subst variables. svn path=/dists/trunk/linux-2.6/; revision=15528 --- debian/lib/python/debian_linux/gencontrol.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/lib/python/debian_linux/gencontrol.py b/debian/lib/python/debian_linux/gencontrol.py index b474ad814..b6c5ca88c 100644 --- a/debian/lib/python/debian_linux/gencontrol.py +++ b/debian/lib/python/debian_linux/gencontrol.py @@ -90,7 +90,7 @@ class Gencontrol(object): def do_source(self, packages): source = self.templates["control.source"][0] source['Source'] = self.changelog[0].source - packages['source'] = self.process_package(source, self.vars) + packages['source'] = self.process_package(source) def do_main(self, packages, makefile): config_entry = self.config['base',] @@ -251,7 +251,7 @@ class Gencontrol(object): desc.append(self.substitute(i, vars)) return desc - def process_package(self, in_entry, vars): + def process_package(self, in_entry, vars={}): entry = in_entry.__class__() for key, value in in_entry.iteritems(): if isinstance(value, PackageRelation): From d2fac94fbfaba2be9a12da88ed0be0bd4446913e Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Sun, 25 Apr 2010 01:35:39 +0000 Subject: [PATCH 17/19] * [mips*/*malta] Remove options that are present in topconfig. svn path=/dists/trunk/linux-2.6/; revision=15553 --- debian/changelog | 1 + debian/config/mips/config.4kc-malta | 167 ------------- debian/config/mips/config.5kc-malta | 371 ---------------------------- 3 files changed, 1 insertion(+), 538 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6bdfb147a..5a5845999 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,7 @@ linux-2.6 (2.6.33-1~experimental.5) UNRELEASED; urgency=low [ Aurelien Jarno ] * Add support for sh4 architecture, patch by Nobuhiro Iwamatsu (Closes: #569034) + * [mips*/*malta] Remove options that are present in topconfig. -- Ian Campbell Sat, 27 Mar 2010 08:09:28 +0000 diff --git a/debian/config/mips/config.4kc-malta b/debian/config/mips/config.4kc-malta index b8e1b8b51..9de968ea3 100644 --- a/debian/config/mips/config.4kc-malta +++ b/debian/config/mips/config.4kc-malta @@ -536,141 +536,6 @@ CONFIG_ISDN_DIVERSION=m ## # CONFIG_NEW_LEDS is not set -## -## file: drivers/media/Kconfig -## -CONFIG_DVB_CORE=m - -## -## file: drivers/media/dvb/frontends/Kconfig -## -# CONFIG_DVB_FE_CUSTOMISE is not set -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_PLL=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_ISL6421=m - -## -## file: drivers/media/radio/Kconfig -## -CONFIG_RADIO_GEMTEK_PCI=m -CONFIG_RADIO_MAXIRADIO=m -CONFIG_RADIO_MAESTRO=m -CONFIG_USB_DSBR=m - -## -## file: drivers/media/video/Kconfig -## -# CONFIG_VIDEO_ADV_DEBUG is not set -CONFIG_VIDEO_HELPER_CHIPS_AUTO=y -CONFIG_VIDEO_TVAUDIO=m -CONFIG_VIDEO_TDA7432=m -CONFIG_VIDEO_TDA9840=m -CONFIG_VIDEO_TDA9875=m -CONFIG_VIDEO_TEA6415C=m -CONFIG_VIDEO_TEA6420=m -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_WM8775=m -CONFIG_VIDEO_SAA6588=m -CONFIG_VIDEO_BT819=m -CONFIG_VIDEO_BT856=m -CONFIG_VIDEO_KS0127=m -CONFIG_VIDEO_OV7670=m -CONFIG_VIDEO_SAA7110=m -CONFIG_VIDEO_SAA711X=m -CONFIG_VIDEO_TVP5150=m -CONFIG_VIDEO_VPX3220=m -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_SAA7185=m -CONFIG_VIDEO_ADV7170=m -CONFIG_VIDEO_ADV7175=m -CONFIG_VIDEO_VIVI=m -CONFIG_VIDEO_BWQCAM=m -CONFIG_VIDEO_CQCAM=m -CONFIG_VIDEO_W9966=m -CONFIG_VIDEO_CPIA=m -CONFIG_VIDEO_CPIA_PP=m -CONFIG_VIDEO_CPIA_USB=m -CONFIG_VIDEO_SAA5246A=m -CONFIG_VIDEO_SAA5249=m -CONFIG_VIDEO_STRADIS=m -CONFIG_VIDEO_MXB=m -CONFIG_VIDEO_HEXIUM_ORION=m -CONFIG_VIDEO_HEXIUM_GEMINI=m -CONFIG_VIDEO_CAFE_CCIC=m -CONFIG_VIDEO_OVCAMCHIP=m - -## -## file: drivers/media/video/bt8xx/Kconfig -## -CONFIG_VIDEO_BT848=m -CONFIG_VIDEO_BT848_DVB=y - -## -## file: drivers/media/video/cpia2/Kconfig -## -CONFIG_VIDEO_CPIA2=m - -## -## file: drivers/media/video/cx25840/Kconfig -## -CONFIG_VIDEO_CX25840=m - -## -## file: drivers/media/video/cx88/Kconfig -## -CONFIG_VIDEO_CX88=m -CONFIG_VIDEO_CX88_ALSA=m -CONFIG_VIDEO_CX88_BLACKBIRD=m -CONFIG_VIDEO_CX88_DVB=m -CONFIG_VIDEO_CX88_VP3054=m - -## -## file: drivers/media/video/em28xx/Kconfig -## -CONFIG_VIDEO_EM28XX=m - -## -## file: drivers/media/video/et61x251/Kconfig -## -CONFIG_USB_ET61X251=m - -## -## file: drivers/media/video/pvrusb2/Kconfig -## -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set - -## -## file: drivers/media/video/saa7134/Kconfig -## -CONFIG_VIDEO_SAA7134=m -CONFIG_VIDEO_SAA7134_ALSA=m -CONFIG_VIDEO_SAA7134_DVB=m - -## -## file: drivers/media/video/usbvision/Kconfig -## -CONFIG_VIDEO_USBVISION=m - -## -## file: drivers/media/video/zc0301/Kconfig -## -CONFIG_USB_ZC0301=m - -## -## file: drivers/media/video/zoran/Kconfig -## -CONFIG_VIDEO_ZORAN=m -CONFIG_VIDEO_ZORAN_DC30=m -CONFIG_VIDEO_ZORAN_BUZ=m -CONFIG_VIDEO_ZORAN_DC10=m -CONFIG_VIDEO_ZORAN_LML33=m -CONFIG_VIDEO_ZORAN_LML33R10=m -CONFIG_VIDEO_ZORAN_AVS6EYES=m - ## ## file: drivers/message/i2o/Kconfig ## @@ -1260,30 +1125,6 @@ CONFIG_AX25=m CONFIG_NETROM=m CONFIG_ROSE=m -## -## file: net/bridge/netfilter/Kconfig -## -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_BRIDGE_EBT_ULOG=m - ## ## file: net/decnet/Kconfig ## @@ -1433,11 +1274,3 @@ CONFIG_SND_YMFPCI=m ## file: sound/pci/hda/Kconfig ## CONFIG_SND_HDA_INTEL=m - -## -## file: unknown -## -# CONFIG_MARKEINS is not set -# CONFIG_MIPS_ATLAS is not set -# CONFIG_MIPS_SEAD is not set - diff --git a/debian/config/mips/config.5kc-malta b/debian/config/mips/config.5kc-malta index 1643f323b..41e591cdd 100644 --- a/debian/config/mips/config.5kc-malta +++ b/debian/config/mips/config.5kc-malta @@ -233,13 +233,6 @@ CONFIG_IPMI_POWEROFF=m ## # CONFIG_TCG_TPM is not set -## -## file: drivers/firewire/Kconfig -## -CONFIG_FIREWIRE=m -CONFIG_FIREWIRE_OHCI=m -CONFIG_FIREWIRE_SBP2=m - ## ## file: drivers/gpu/drm/Kconfig ## @@ -379,54 +372,6 @@ CONFIG_BLK_DEV_SIIMAGE=y ## # CONFIG_IEEE1394 is not set -## -## file: drivers/infiniband/Kconfig -## -CONFIG_INFINIBAND=m -CONFIG_INFINIBAND_USER_MAD=m -CONFIG_INFINIBAND_USER_ACCESS=m - -## -## file: drivers/infiniband/hw/amso1100/Kconfig -## -CONFIG_INFINIBAND_AMSO1100=m -# CONFIG_INFINIBAND_AMSO1100_DEBUG is not set - -## -## file: drivers/infiniband/hw/cxgb3/Kconfig -## -CONFIG_INFINIBAND_CXGB3=m -# CONFIG_INFINIBAND_CXGB3_DEBUG is not set - -## -## file: drivers/infiniband/hw/mlx4/Kconfig -## -CONFIG_MLX4_INFINIBAND=m - -## -## file: drivers/infiniband/hw/mthca/Kconfig -## -CONFIG_INFINIBAND_MTHCA=m -CONFIG_INFINIBAND_MTHCA_DEBUG=y - -## -## file: drivers/infiniband/ulp/ipoib/Kconfig -## -CONFIG_INFINIBAND_IPOIB=m -# CONFIG_INFINIBAND_IPOIB_CM is not set -CONFIG_INFINIBAND_IPOIB_DEBUG=y -# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set - -## -## file: drivers/infiniband/ulp/iser/Kconfig -## -CONFIG_INFINIBAND_ISER=m - -## -## file: drivers/infiniband/ulp/srp/Kconfig -## -CONFIG_INFINIBAND_SRP=m - ## ## file: drivers/input/gameport/Kconfig ## @@ -593,262 +538,6 @@ CONFIG_ISDN_DIVERSION=m ## # CONFIG_NEW_LEDS is not set -## -## file: drivers/media/Kconfig -## -CONFIG_DVB_CORE=m - -## -## file: drivers/media/dvb/Kconfig -## -CONFIG_DVB_CAPTURE_DRIVERS=y - -## -## file: drivers/media/dvb/b2c2/Kconfig -## -CONFIG_DVB_B2C2_FLEXCOP=m -CONFIG_DVB_B2C2_FLEXCOP_PCI=m -CONFIG_DVB_B2C2_FLEXCOP_USB=m -# CONFIG_DVB_B2C2_FLEXCOP_DEBUG is not set - -## -## file: drivers/media/dvb/bt8xx/Kconfig -## -CONFIG_DVB_BT8XX=m - -## -## file: drivers/media/dvb/dvb-usb/Kconfig -## -CONFIG_DVB_USB=m -# CONFIG_DVB_USB_DEBUG is not set -CONFIG_DVB_USB_A800=m -CONFIG_DVB_USB_DIBUSB_MB=m -CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y -CONFIG_DVB_USB_DIBUSB_MC=m -CONFIG_DVB_USB_DIB0700=m -CONFIG_DVB_USB_UMT_010=m -CONFIG_DVB_USB_CXUSB=m -CONFIG_DVB_USB_M920X=m -CONFIG_DVB_USB_GL861=m -CONFIG_DVB_USB_AU6610=m -CONFIG_DVB_USB_DIGITV=m -CONFIG_DVB_USB_VP7045=m -CONFIG_DVB_USB_VP702X=m -CONFIG_DVB_USB_GP8PSK=m -CONFIG_DVB_USB_NOVA_T_USB2=m -CONFIG_DVB_USB_TTUSB2=m -CONFIG_DVB_USB_DTT200U=m -CONFIG_DVB_USB_OPERA1=m - -## -## file: drivers/media/dvb/frontends/Kconfig -## -# CONFIG_DVB_FE_CUSTOMISE is not set -CONFIG_DVB_CX24110=m -CONFIG_DVB_CX24123=m -CONFIG_DVB_MT312=m -CONFIG_DVB_S5H1420=m -CONFIG_DVB_STV0299=m -CONFIG_DVB_TDA8083=m -CONFIG_DVB_TDA10086=m -CONFIG_DVB_VES1X93=m -CONFIG_DVB_TDA826X=m -CONFIG_DVB_TUA6100=m -CONFIG_DVB_SP8870=m -CONFIG_DVB_SP887X=m -CONFIG_DVB_CX22700=m -CONFIG_DVB_CX22702=m -CONFIG_DVB_L64781=m -CONFIG_DVB_TDA1004X=m -CONFIG_DVB_NXT6000=m -CONFIG_DVB_MT352=m -CONFIG_DVB_ZL10353=m -CONFIG_DVB_DIB3000MB=m -CONFIG_DVB_DIB3000MC=m -CONFIG_DVB_DIB7000M=m -CONFIG_DVB_DIB7000P=m -CONFIG_DVB_VES1820=m -CONFIG_DVB_TDA10021=m -CONFIG_DVB_TDA10023=m -CONFIG_DVB_STV0297=m -CONFIG_DVB_NXT200X=m -CONFIG_DVB_OR51211=m -CONFIG_DVB_OR51132=m -CONFIG_DVB_BCM3510=m -CONFIG_DVB_LGDT330X=m -CONFIG_DVB_PLL=m -CONFIG_DVB_LNBP21=m -CONFIG_DVB_ISL6421=m - -## -## file: drivers/media/dvb/pluto2/Kconfig -## -CONFIG_DVB_PLUTO2=m - -## -## file: drivers/media/dvb/ttpci/Kconfig -## -CONFIG_DVB_AV7110=m -CONFIG_DVB_AV7110_OSD=y -CONFIG_DVB_BUDGET=m -CONFIG_DVB_BUDGET_CI=m -CONFIG_DVB_BUDGET_AV=m -CONFIG_DVB_BUDGET_PATCH=m - -## -## file: drivers/media/dvb/ttusb-budget/Kconfig -## -CONFIG_DVB_TTUSB_BUDGET=m - -## -## file: drivers/media/dvb/ttusb-dec/Kconfig -## -CONFIG_DVB_TTUSB_DEC=m - -## -## file: drivers/media/radio/Kconfig -## -CONFIG_RADIO_ADAPTERS=y -CONFIG_RADIO_GEMTEK_PCI=m -CONFIG_RADIO_MAXIRADIO=m -CONFIG_RADIO_MAESTRO=m -CONFIG_USB_DSBR=m - -## -## file: drivers/media/video/Kconfig -## -CONFIG_VIDEO_CAPTURE_DRIVERS=y -# CONFIG_VIDEO_ADV_DEBUG is not set -CONFIG_VIDEO_HELPER_CHIPS_AUTO=y -CONFIG_VIDEO_TVAUDIO=m -CONFIG_VIDEO_TDA7432=m -CONFIG_VIDEO_TDA9840=m -CONFIG_VIDEO_TDA9875=m -CONFIG_VIDEO_TEA6415C=m -CONFIG_VIDEO_TEA6420=m -CONFIG_VIDEO_MSP3400=m -CONFIG_VIDEO_CS53L32A=m -CONFIG_VIDEO_WM8775=m -CONFIG_VIDEO_WM8739=m -CONFIG_VIDEO_SAA6588=m -CONFIG_VIDEO_BT819=m -CONFIG_VIDEO_BT856=m -CONFIG_VIDEO_KS0127=m -CONFIG_VIDEO_OV7670=m -CONFIG_VIDEO_SAA7110=m -CONFIG_VIDEO_SAA711X=m -CONFIG_VIDEO_TVP5150=m -CONFIG_VIDEO_VPX3220=m -CONFIG_VIDEO_CX2341X=m -CONFIG_VIDEO_SAA7127=m -CONFIG_VIDEO_SAA7185=m -CONFIG_VIDEO_ADV7170=m -CONFIG_VIDEO_ADV7175=m -CONFIG_VIDEO_UPD64031A=m -CONFIG_VIDEO_UPD64083=m -CONFIG_VIDEO_VIVI=m -CONFIG_VIDEO_BWQCAM=m -CONFIG_VIDEO_CQCAM=m -CONFIG_VIDEO_W9966=m -CONFIG_VIDEO_CPIA=m -CONFIG_VIDEO_CPIA_PP=m -CONFIG_VIDEO_CPIA_USB=m -CONFIG_VIDEO_SAA5246A=m -CONFIG_VIDEO_SAA5249=m -CONFIG_VIDEO_STRADIS=m -CONFIG_VIDEO_MXB=m -CONFIG_VIDEO_HEXIUM_ORION=m -CONFIG_VIDEO_HEXIUM_GEMINI=m -CONFIG_VIDEO_CAFE_CCIC=m -CONFIG_V4L_USB_DRIVERS=y -CONFIG_VIDEO_OVCAMCHIP=m - -## -## file: drivers/media/video/bt8xx/Kconfig -## -CONFIG_VIDEO_BT848=m -CONFIG_VIDEO_BT848_DVB=y - -## -## file: drivers/media/video/cpia2/Kconfig -## -CONFIG_VIDEO_CPIA2=m - -## -## file: drivers/media/video/cx25840/Kconfig -## -CONFIG_VIDEO_CX25840=m - -## -## file: drivers/media/video/cx88/Kconfig -## -CONFIG_VIDEO_CX88=m -CONFIG_VIDEO_CX88_ALSA=m -CONFIG_VIDEO_CX88_BLACKBIRD=m -CONFIG_VIDEO_CX88_DVB=m -CONFIG_VIDEO_CX88_VP3054=m - -## -## file: drivers/media/video/em28xx/Kconfig -## -CONFIG_VIDEO_EM28XX=m - -## -## file: drivers/media/video/et61x251/Kconfig -## -CONFIG_USB_ET61X251=m - -## -## file: drivers/media/video/ivtv/Kconfig -## -CONFIG_VIDEO_IVTV=m - -## -## file: drivers/media/video/pvrusb2/Kconfig -## -CONFIG_VIDEO_PVRUSB2=m -CONFIG_VIDEO_PVRUSB2_SYSFS=y -# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set - -## -## file: drivers/media/video/saa7134/Kconfig -## -CONFIG_VIDEO_SAA7134=m -CONFIG_VIDEO_SAA7134_ALSA=m -CONFIG_VIDEO_SAA7134_DVB=m - -## -## file: drivers/media/video/usbvision/Kconfig -## -CONFIG_VIDEO_USBVISION=m - -## -## file: drivers/media/video/zc0301/Kconfig -## -CONFIG_USB_ZC0301=m - -## -## file: drivers/media/video/zoran/Kconfig -## -CONFIG_VIDEO_ZORAN=m -CONFIG_VIDEO_ZORAN_DC30=m -CONFIG_VIDEO_ZORAN_BUZ=m -CONFIG_VIDEO_ZORAN_DC10=m -CONFIG_VIDEO_ZORAN_LML33=m -CONFIG_VIDEO_ZORAN_LML33R10=m -CONFIG_VIDEO_ZORAN_AVS6EYES=m - -## -## file: drivers/message/fusion/Kconfig -## -CONFIG_FUSION=y -CONFIG_FUSION_SPI=m -CONFIG_FUSION_FC=m -CONFIG_FUSION_SAS=m -CONFIG_FUSION_MAX_SGE=40 -CONFIG_FUSION_CTL=m -CONFIG_FUSION_LAN=m - ## ## file: drivers/message/i2o/Kconfig ## @@ -1416,27 +1105,6 @@ CONFIG_DISPLAY_SUPPORT=m ## CONFIG_LOGO=y -## -## file: drivers/w1/Kconfig -## -CONFIG_W1=m -CONFIG_W1_CON=y - -## -## file: drivers/w1/masters/Kconfig -## -CONFIG_W1_MASTER_MATROX=m -CONFIG_W1_MASTER_DS2490=m -CONFIG_W1_MASTER_DS2482=m - -## -## file: drivers/w1/slaves/Kconfig -## -CONFIG_W1_SLAVE_THERM=m -CONFIG_W1_SLAVE_SMEM=m -CONFIG_W1_SLAVE_DS2433=m -# CONFIG_W1_SLAVE_DS2433_CRC is not set - ## ## file: drivers/watchdog/Kconfig ## @@ -1522,30 +1190,6 @@ CONFIG_AX25=m CONFIG_NETROM=m CONFIG_ROSE=m -## -## file: net/bridge/netfilter/Kconfig -## -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_BRIDGE_EBT_ULOG=m - ## ## file: net/decnet/Kconfig ## @@ -1604,12 +1248,6 @@ CONFIG_LAPB=m ## # CONFIG_NETLABEL is not set -## -## file: net/rfkill/Kconfig -## -CONFIG_RFKILL=m -CONFIG_RFKILL_INPUT=m - ## ## file: net/wanrouter/Kconfig ## @@ -1618,7 +1256,6 @@ CONFIG_WAN_ROUTER=m ## ## file: net/wireless/Kconfig ## -CONFIG_CFG80211=m CONFIG_WIRELESS_EXT=y ## @@ -1703,11 +1340,3 @@ CONFIG_SND_YMFPCI=m ## file: sound/pci/hda/Kconfig ## CONFIG_SND_HDA_INTEL=m - -## -## file: unknown -## -# CONFIG_MARKEINS is not set -# CONFIG_MIPS_ATLAS is not set -# CONFIG_MIPS_SEAD is not set - From 8adf3a084f47fa4b728a1a96f5959cad016433d3 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 27 Apr 2010 08:43:41 +0000 Subject: [PATCH 18/19] * debian/bin/kconfig.py: Add option overrides. * debian/lib/python/debian_linux/kconfig.py: Add set method for externaly parsed options. svn path=/dists/trunk/linux-2.6/; revision=15565 --- debian/bin/kconfig.py | 32 ++++++++++++++++++++--- debian/lib/python/debian_linux/kconfig.py | 15 ++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/debian/bin/kconfig.py b/debian/bin/kconfig.py index a8fee4946..d5df64f18 100755 --- a/debian/bin/kconfig.py +++ b/debian/bin/kconfig.py @@ -1,13 +1,37 @@ #!/usr/bin/env python -import optparse, os.path, sys +import optparse +import os.path +import re +import sys + from debian_linux.kconfig import * -def merge(output, *config): +def merge(output, configs, overrides): kconfig = KconfigFile() - for c in config: + for c in configs: kconfig.read(file(c)) + for key, value in overrides.iteritems(): + kconfig.set(key, value) file(output, "w").write(str(kconfig)) +def opt_callback_dict(option, opt, value, parser): + match = re.match('^\s*(\S+)=(\S+)\s*$', value) + if not match: + raise optparse.OptionValueError('not key=value') + dest = option.dest + data = getattr(parser.values, dest) + data[match.group(1)] = match.group(2) + if __name__ == '__main__': - sys.exit(merge(*sys.argv[1:])) + parser = optparse.OptionParser(usage = "%prog [OPTION]... FILE...") + parser.add_option('-o', '--override', + action='callback', + callback=opt_callback_dict, + default={}, + dest='overrides', + help="Override option", + type='string') + options, args = parser.parse_args() + + merge(args[0], args[1:], options.overrides) diff --git a/debian/lib/python/debian_linux/kconfig.py b/debian/lib/python/debian_linux/kconfig.py index c5192d10d..e655e5e24 100644 --- a/debian/lib/python/debian_linux/kconfig.py +++ b/debian/lib/python/debian_linux/kconfig.py @@ -55,19 +55,22 @@ class KconfigFile(SortedDict): i = line.find('=') option = line[7:i] value = line[i+1:] - if value in ('y', 'm'): - entry = EntryTristate(option, value) - else: - entry = EntryString(option, value) - self[option] = entry + self.set(option, value) elif line.startswith("# CONFIG_"): option = line[9:-11] - self[option] = EntryTristate(option) + self.set(option, 'n') elif line.startswith("#") or not line: pass else: raise RuntimeError, "Can't recognize %s" % line + def set(self, key, value): + if value in ('y', 'm', 'n'): + entry = EntryTristate(key, value) + else: + entry = EntryString(key, value) + self[key] = entry + def str_iter(self): for key, value in self.iteritems(): yield str(value) From ab3c0154f7a2fc432dda13c8f6c3eaff174dc767 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Tue, 27 Apr 2010 08:50:30 +0000 Subject: [PATCH 19/19] * debian/bin/gencontrol.py: Add support for debug packages. * debian/lib/python/debian_linux/config.py: Add image-dbg section. * debian/templates/control.image-dbg.in: Add. svn path=/dists/trunk/linux-2.6/; revision=15566 --- debian/bin/gencontrol.py | 8 ++++++++ debian/lib/python/debian_linux/config.py | 3 +++ debian/templates/control.image-dbg.in | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 debian/templates/control.image-dbg.in diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 4c972d10f..d968c2f45 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -111,6 +111,7 @@ class Gencontrol(Base): config_entry_base = self.config.merge('base', arch, featureset, flavour) config_entry_description = self.config.merge('description', arch, featureset, flavour) config_entry_image = self.config.merge('image', arch, featureset, flavour) + config_entry_image_dbg = self.config.merge('image-dbg', arch, featureset, flavour) config_entry_relations = self.config.merge('relations', arch, featureset, flavour) compiler = config_entry_base.get('compiler', 'gcc') @@ -185,6 +186,11 @@ class Gencontrol(Base): packages_own.append(package_headers) extra['headers_arch_depends'].append('%s (= ${binary:Version})' % packages_own[-1]['Package']) + build_debug = config_entry_image_dbg.get('enabled') + if build_debug: + makeflags['DEBUG'] = True + packages_own.extend(self.process_packages(self.templates['control.image-dbg'], vars)) + self.merge_packages(packages, packages_own + packages_dummy, arch) if config_entry_image['type'] == 'plain-xen': @@ -233,6 +239,8 @@ class Gencontrol(Base): kconfig.extend(check_config("%s/%s/config" % (arch, featureset), False, arch, featureset)) kconfig.extend(check_config("%s/%s/config.%s" % (arch, featureset, flavour), False, arch, featureset, flavour)) makeflags['KCONFIG'] = ' '.join(kconfig) + if build_debug: + makeflags['KCONFIG_OPTIONS'] = '-o DEBUG_INFO=y' cmds_binary_arch = ["$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags] if packages_dummy: diff --git a/debian/lib/python/debian_linux/config.py b/debian/lib/python/debian_linux/config.py index 478c310db..0090032a8 100644 --- a/debian/lib/python/debian_linux/config.py +++ b/debian/lib/python/debian_linux/config.py @@ -121,6 +121,9 @@ class ConfigCoreHierarchy(ConfigCore): 'initramfs': SchemaItemBoolean(), 'initramfs-generators': SchemaItemList(), }, + 'image-dbg': { + 'enabled': SchemaItemBoolean(), + }, 'relations': { }, 'xen': { diff --git a/debian/templates/control.image-dbg.in b/debian/templates/control.image-dbg.in new file mode 100644 index 000000000..781e2dd2c --- /dev/null +++ b/debian/templates/control.image-dbg.in @@ -0,0 +1,3 @@ +Package: linux-image-@upstreamversion@@abiname@@localversion@-dbg +Description: Debugging infos for Linux @upstreamversion@@abiname@@localversion@ + TODO