--- /dev/null
+From 3e420e78ece6f9d2accc1568e80dfd0501e13df1 Mon Sep 17 00:00:00 2001
+From: Luke Yelavich <themuso@ubuntu.com>
+Date: Tue, 16 Dec 2008 12:37:47 +1100
+Subject: ALSA: hda - Add automatic model setting for Samsung Q45
+
+From: Luke Yelavich <themuso@ubuntu.com>
+
+commit 3e420e78ece6f9d2accc1568e80dfd0501e13df1 upstream.
+
+Have the Samsung Q45 (144d:c510) select ALC262_HIPPO by default
+
+Reference: Ubuntu bug 200210
+ http://launchpad.net/bugs/200210
+
+Signed-off-by: Luke Yelavich <themuso@ubuntu.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -9882,6 +9882,7 @@ static struct snd_pci_quirk alc262_cfg_t
+ SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
+ SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
+ SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
++ SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
+ SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
+ SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
+ SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
--- /dev/null
+From 1725b82a6e2721612a3572d0336f51f1f1c3cf54 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 21 Nov 2008 02:25:48 +0100
+Subject: ALSA: hda - make laptop-eapd model back for AD1986A
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 1725b82a6e2721612a3572d0336f51f1f1c3cf54 upstream.
+
+The changes specific for Samsung laptops seem unapplicable to other
+hardware models like ASUS. The mic inputs are lost on such hardware
+by the change 5d5d5f43f1b835c375de9bd270cce030d16e2871.
+
+This patch adds back the old laptop-eapd model, and create a new
+model "samsung" for the new one specific to Samsung laptops with
+automatic mic selection feature.
+
+Reference: kernel bugzilla #12070
+ http://bugzilla.kernel.org/show_bug.cgi?id=12070
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Cc: Daniel Drake <dsd@gentoo.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ Documentation/sound/alsa/ALSA-Configuration.txt | 3 -
+ sound/pci/hda/patch_analog.c | 49 ++++++++++++++++++++++--
+ 2 files changed, 48 insertions(+), 4 deletions(-)
+
+--- a/Documentation/sound/alsa/ALSA-Configuration.txt
++++ b/Documentation/sound/alsa/ALSA-Configuration.txt
+@@ -960,9 +960,10 @@ Prior to version 0.9.0rc4 options had a
+ 6stack 6-jack, separate surrounds (default)
+ 3stack 3-stack, shared surrounds
+ laptop 2-channel only (FSC V2060, Samsung M50)
+- laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J)
++ laptop-eapd 2-channel with EAPD (ASUS A6J)
+ laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
+ ultra 2-channel with EAPD (Samsung Ultra tablet PC)
++ samsung 2-channel with EAPD (Samsung R65)
+
+ AD1988/AD1988B/AD1989A/AD1989B
+ 6stack 6-jack
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -629,6 +629,36 @@ static struct snd_kcontrol_new ad1986a_l
+ HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
+ HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
+ HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
++ HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
++ HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
++ HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
++ HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
++ HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
++ HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
++ HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
++ {
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = "Capture Source",
++ .info = ad198x_mux_enum_info,
++ .get = ad198x_mux_enum_get,
++ .put = ad198x_mux_enum_put,
++ },
++ {
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = "External Amplifier",
++ .info = ad198x_eapd_info,
++ .get = ad198x_eapd_get,
++ .put = ad198x_eapd_put,
++ .private_value = 0x1b | (1 << 8), /* port-D, inversed */
++ },
++ { } /* end */
++};
++
++static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
++ HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
++ HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
++ HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
++ HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
+ HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
+ HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
+ HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
+@@ -917,6 +947,7 @@ enum {
+ AD1986A_LAPTOP_EAPD,
+ AD1986A_LAPTOP_AUTOMUTE,
+ AD1986A_ULTRA,
++ AD1986A_SAMSUNG,
+ AD1986A_MODELS
+ };
+
+@@ -927,6 +958,7 @@ static const char *ad1986a_models[AD1986
+ [AD1986A_LAPTOP_EAPD] = "laptop-eapd",
+ [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute",
+ [AD1986A_ULTRA] = "ultra",
++ [AD1986A_SAMSUNG] = "samsung",
+ };
+
+ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
+@@ -949,9 +981,9 @@ static struct snd_pci_quirk ad1986a_cfg_
+ SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD),
+ SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
+ SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
+- SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD),
+- SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD),
+- SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD),
++ SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG),
++ SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG),
++ SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG),
+ SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
+ SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
+ SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP),
+@@ -1033,6 +1065,17 @@ static int patch_ad1986a(struct hda_code
+ break;
+ case AD1986A_LAPTOP_EAPD:
+ spec->mixers[0] = ad1986a_laptop_eapd_mixers;
++ spec->num_init_verbs = 2;
++ spec->init_verbs[1] = ad1986a_eapd_init_verbs;
++ spec->multiout.max_channels = 2;
++ spec->multiout.num_dacs = 1;
++ spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
++ if (!is_jack_available(codec, 0x25))
++ spec->multiout.dig_out_nid = 0;
++ spec->input_mux = &ad1986a_laptop_eapd_capture_source;
++ break;
++ case AD1986A_SAMSUNG:
++ spec->mixers[0] = ad1986a_samsung_mixers;
+ spec->num_init_verbs = 3;
+ spec->init_verbs[1] = ad1986a_eapd_init_verbs;
+ spec->init_verbs[2] = ad1986a_automic_verbs;
--- /dev/null
+From 2950e952920811be465ec95c6b56f03dc66a05c0 Mon Sep 17 00:00:00 2001
+From: Jos-Vicente Gilabert <josevteg@gmail.com>
+Date: Wed, 14 Jan 2009 20:55:00 -0800
+Subject: drivers/net/irda/irda-usb.c: fix buffer overflow
+
+From: Jos-Vicente Gilabert <josevteg@gmail.com>
+
+commit 2950e952920811be465ec95c6b56f03dc66a05c0 upstream.
+
+Taken from http://bugzilla.kernel.org/show_bug.cgi?id=12397
+
+We're doing an sprintf of an 11-char string into an 11-char buffer.
+Whoops. It breaks firmware uploading.
+
+Reported-by: Jos-Vicente Gilabert <josevteg@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/irda/irda-usb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/irda/irda-usb.c
++++ b/drivers/net/irda/irda-usb.c
+@@ -1075,7 +1075,7 @@ static int stir421x_patch_device(struct
+ {
+ unsigned int i;
+ int ret;
+- char stir421x_fw_name[11];
++ char stir421x_fw_name[12];
+ const struct firmware *fw;
+ const unsigned char *fw_version_ptr; /* pointer to version string */
+ unsigned long fw_version = 0;
--- /dev/null
+From 0773a6cf673316440999752e23f8c3d4f85e48b9 Mon Sep 17 00:00:00 2001
+From: Tony Luck <tony.luck@intel.com>
+Date: Thu, 15 Jan 2009 10:29:17 -0800
+Subject: IA64: Turn on CONFIG_HAVE_UNSTABLE_CLOCK
+
+From: Tony Luck <tony.luck@intel.com>
+
+commit 0773a6cf673316440999752e23f8c3d4f85e48b9 upstream.
+
+sched_clock() on ia64 is based on ar.itc, so is never
+completely synchronized between cpus. On some platforms
+(e.g. certain models of SGI Altix) it may be running at
+radically different frequencies.
+
+Based on a patch from Dimitri Sivanich which set this
+just for SN2 && GENERIC kernels ... it is needed for
+all ia64 machines.
+
+Signed-off-by: Tony Luck <tony.luck@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/ia64/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/ia64/Kconfig
++++ b/arch/ia64/Kconfig
+@@ -15,6 +15,7 @@ config IA64
+ select ACPI if (!IA64_HP_SIM)
+ select PM if (!IA64_HP_SIM)
+ select ARCH_SUPPORTS_MSI
++ select HAVE_UNSTABLE_SCHED_CLOCK
+ select HAVE_IDE
+ select HAVE_OPROFILE
+ select HAVE_KPROBES
--- /dev/null
+From d25141a818383b3c3b09f065698c544a7a0ec6e7 Mon Sep 17 00:00:00 2001
+From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
+Date: Wed, 29 Oct 2008 14:01:11 -0700
+Subject: 'kill sig -1' must only apply to caller's namespace
+
+From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
+
+commit d25141a818383b3c3b09f065698c544a7a0ec6e7 upstream.
+
+Currently "kill <sig> -1" kills processes in all namespaces and breaks the
+isolation of namespaces. Earlier attempt to fix this was discussed at:
+
+ http://lkml.org/lkml/2008/7/23/148
+
+As suggested by Oleg Nesterov in that thread, use "task_pid_vnr() > 1"
+check since task_pid_vnr() returns 0 if process is outside the caller's
+namespace.
+
+Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
+Acked-by: Eric W. Biederman <ebiederm@xmission.com>
+Tested-by: Daniel Hokka Zakrisson <daniel@hozac.com>
+Signed-off-by: Oleg Nesterov <oleg@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ kernel/signal.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -1141,7 +1141,8 @@ static int kill_something_info(int sig,
+ struct task_struct * p;
+
+ for_each_process(p) {
+- if (p->pid > 1 && !same_thread_group(p, current)) {
++ if (task_pid_vnr(p) > 1 &&
++ !same_thread_group(p, current)) {
+ int err = group_send_sig_info(sig, info, p);
+ ++count;
+ if (err != -EPERM)
--- /dev/null
+From 5b019e99016f3a692ba45bf68fba73a402d7c01a Mon Sep 17 00:00:00 2001
+From: Andrew Morton <akpm@linux-foundation.org>
+Date: Thu, 15 Jan 2009 13:51:21 -0800
+Subject: lib/idr.c: use kmem_cache_zalloc() for the idr_layer cache
+
+From: Andrew Morton <akpm@linux-foundation.org>
+
+commit 5b019e99016f3a692ba45bf68fba73a402d7c01a upstream.
+
+David points out that the idr_remove_all() function returns unused slabs
+to the kmem cache, but needs to zero them first or else they will be
+uninitialized upon next use. This causes crashes which have been observed
+in the firewire subsystem.
+
+He fixed this by zeroing the object before freeing it in idr_remove_all().
+
+But we agree that simply removing the constructor and zeroing the object
+at allocation time is simpler than relying upon slab constructor machinery
+and might even be faster.
+
+This problem was introduced by "idr: make idr_remove rcu-safe" (commit
+cf481c20c476ad2c0febdace9ce23f5a4db19582), which was first released in
+2.6.27.
+
+There are no known codesites which trigger this bug in 2.6.27 or 2.6.28.
+The post-2.6.28 firewire changes are the only known triggerer.
+
+There might of course be not-yet-discovered triggerers in 2.6.27 and
+2.6.28, and there might be out-of-tree triggerers which are added to those
+kernel versions. I'll let the -stable guys decide whether they want to
+backport this fix.
+
+Reported-by: David Moore <dcm@acm.org>
+Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
+Cc: Nadia Derbey <Nadia.Derbey@bull.net>
+Cc: Paul E. McKenney <paulmck@us.ibm.com>
+Cc: Manfred Spraul <manfred@colorfullife.com>
+Cc: Kristian Hgsberg <krh@redhat.com>
+Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ lib/idr.c | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+--- a/lib/idr.c
++++ b/lib/idr.c
+@@ -121,7 +121,7 @@ int idr_pre_get(struct idr *idp, gfp_t g
+ {
+ while (idp->id_free_cnt < IDR_FREE_MAX) {
+ struct idr_layer *new;
+- new = kmem_cache_alloc(idr_layer_cache, gfp_mask);
++ new = kmem_cache_zalloc(idr_layer_cache, gfp_mask);
+ if (new == NULL)
+ return (0);
+ move_to_free_list(idp, new);
+@@ -623,16 +623,10 @@ void *idr_replace(struct idr *idp, void
+ }
+ EXPORT_SYMBOL(idr_replace);
+
+-static void idr_cache_ctor(void *idr_layer)
+-{
+- memset(idr_layer, 0, sizeof(struct idr_layer));
+-}
+-
+ void __init idr_init_cache(void)
+ {
+ idr_layer_cache = kmem_cache_create("idr_layer_cache",
+- sizeof(struct idr_layer), 0, SLAB_PANIC,
+- idr_cache_ctor);
++ sizeof(struct idr_layer), 0, SLAB_PANIC, NULL);
+ }
+
+ /**
--- /dev/null
+From 55ef1274dddd4de387c54d110e354ffbb6cdc706 Mon Sep 17 00:00:00 2001
+From: J. Bruce Fields <bfields@citi.umich.edu>
+Date: Sat, 20 Dec 2008 11:58:38 -0800
+Subject: nfsd: Ensure nfsv4 calls the underlying filesystem on LOCKT
+
+From: J. Bruce Fields <bfields@citi.umich.edu>
+
+commit 55ef1274dddd4de387c54d110e354ffbb6cdc706 upstream.
+
+Since nfsv4 allows LOCKT without an open, but the ->lock() method is a
+file method, we fake up a struct file in the nfsv4 code with just the
+fields we need initialized. But we forgot to initialize the file
+operations, with the result that LOCKT never results in a call to the
+filesystem's ->lock() method (if it exists).
+
+We could just add that one more initialization. But this hack of faking
+up a struct file with only some fields initialized seems the kind of
+thing that might cause more problems in the future. We should either do
+an open and get a real struct file, or make lock-testing an inode (not a
+file) method.
+
+This patch does the former.
+
+Reported-by: Marc Eshel <eshel@almaden.ibm.com>
+Tested-by: Marc Eshel <eshel@almaden.ibm.com>
+Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
+
+---
+ fs/nfsd/nfs4state.c | 30 ++++++++++++++++++++----------
+ 1 file changed, 20 insertions(+), 10 deletions(-)
+
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -2767,6 +2767,25 @@ out:
+ }
+
+ /*
++ * The NFSv4 spec allows a client to do a LOCKT without holding an OPEN,
++ * so we do a temporary open here just to get an open file to pass to
++ * vfs_test_lock. (Arguably perhaps test_lock should be done with an
++ * inode operation.)
++ */
++static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
++{
++ struct file *file;
++ int err;
++
++ err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
++ if (err)
++ return err;
++ err = vfs_test_lock(file, lock);
++ nfsd_close(file);
++ return err;
++}
++
++/*
+ * LOCKT operation
+ */
+ __be32
+@@ -2774,7 +2793,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
+ struct nfsd4_lockt *lockt)
+ {
+ struct inode *inode;
+- struct file file;
+ struct file_lock file_lock;
+ int error;
+ __be32 status;
+@@ -2832,16 +2850,8 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
+
+ nfs4_transform_lock_offset(&file_lock);
+
+- /* vfs_test_lock uses the struct file _only_ to resolve the inode.
+- * since LOCKT doesn't require an OPEN, and therefore a struct
+- * file may not exist, pass vfs_test_lock a struct file with
+- * only the dentry:inode set.
+- */
+- memset(&file, 0, sizeof (struct file));
+- file.f_path.dentry = cstate->current_fh.fh_dentry;
+-
+ status = nfs_ok;
+- error = vfs_test_lock(&file, &file_lock);
++ error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
+ if (error) {
+ status = nfserrno(error);
+ goto out;
--- /dev/null
+From 878e6a432f85690a2c0d88d96f177e54ff1d4a57 Mon Sep 17 00:00:00 2001
+From: Michiel <michiel@ettema.net>
+Date: Sun, 4 Jan 2009 17:22:28 -0600
+Subject: p54usb: Add USB ID for Thomson Speedtouch 121g
+
+From: Michiel <michiel@ettema.net>
+
+commit 878e6a432f85690a2c0d88d96f177e54ff1d4a57 upstream.
+
+Add the USB ID for Thomson Speedtouch 121g to p54usb.
+
+Signed-off-by: Michiel <michiel@ettema.net>
+Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/wireless/p54/p54usb.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/wireless/p54/p54usb.c
++++ b/drivers/net/wireless/p54/p54usb.c
+@@ -53,6 +53,7 @@ static struct usb_device_id p54u_table[]
+ {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */
+ {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */
+ {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */
++ {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(0x0846, 0x4240)}, /* Netgear WG111 (v2) */
--- /dev/null
+From 46bbdfa44cfc0d352148a0dc33ba9f6db02ccdf0 Mon Sep 17 00:00:00 2001
+From: Shaohua Li <shaohua.li@intel.com>
+Date: Fri, 19 Dec 2008 09:27:42 +0800
+Subject: PCI: keep ASPM link state consistent throughout PCIe hierarchy
+
+From: Shaohua Li <shaohua.li@intel.com>
+
+commit 46bbdfa44cfc0d352148a0dc33ba9f6db02ccdf0 upstream.
+
+In a PCIe hierarchy with a switch present, if the link state of an
+endpoint device is changed, we must check the whole hierarchy from the
+endpoint device to root port, and for each link in the hierarchy, the new
+link state should be configured. Previously, the implementation checked
+the state but forgot to configure the links between root port to switch.
+Fixes Novell bz #448987.
+
+Signed-off-by: Shaohua Li <shaohua.li@intel.com>
+Tested-by: Andrew Patterson <andrew.patterson@hp.com>
+Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/pcie/aspm.c | 127 ++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 107 insertions(+), 20 deletions(-)
+
+--- a/drivers/pci/pcie/aspm.c
++++ b/drivers/pci/pcie/aspm.c
+@@ -33,6 +33,11 @@ struct endpoint_state {
+ struct pcie_link_state {
+ struct list_head sibiling;
+ struct pci_dev *pdev;
++ bool downstream_has_switch;
++
++ struct pcie_link_state *parent;
++ struct list_head children;
++ struct list_head link;
+
+ /* ASPM state */
+ unsigned int support_state;
+@@ -125,7 +130,7 @@ static void pcie_set_clock_pm(struct pci
+ link_state->clk_pm_enabled = !!enable;
+ }
+
+-static void pcie_check_clock_pm(struct pci_dev *pdev)
++static void pcie_check_clock_pm(struct pci_dev *pdev, int blacklist)
+ {
+ int pos;
+ u32 reg32;
+@@ -149,10 +154,26 @@ static void pcie_check_clock_pm(struct p
+ if (!(reg16 & PCI_EXP_LNKCTL_CLKREQ_EN))
+ enabled = 0;
+ }
+- link_state->clk_pm_capable = capable;
+ link_state->clk_pm_enabled = enabled;
+ link_state->bios_clk_state = enabled;
+- pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
++ if (!blacklist) {
++ link_state->clk_pm_capable = capable;
++ pcie_set_clock_pm(pdev, policy_to_clkpm_state(pdev));
++ } else {
++ link_state->clk_pm_capable = 0;
++ pcie_set_clock_pm(pdev, 0);
++ }
++}
++
++static bool pcie_aspm_downstream_has_switch(struct pci_dev *pdev)
++{
++ struct pci_dev *child_dev;
++
++ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
++ if (child_dev->pcie_type == PCI_EXP_TYPE_UPSTREAM)
++ return true;
++ }
++ return false;
+ }
+
+ /*
+@@ -419,9 +440,9 @@ static unsigned int pcie_aspm_check_stat
+ {
+ struct pci_dev *child_dev;
+
+- /* If no child, disable the link */
++ /* If no child, ignore the link */
+ if (list_empty(&pdev->subordinate->devices))
+- return 0;
++ return state;
+ list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) {
+ if (child_dev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) {
+ /*
+@@ -462,6 +483,9 @@ static void __pcie_aspm_config_link(stru
+ int valid = 1;
+ struct pcie_link_state *link_state = pdev->link_state;
+
++ /* If no child, disable the link */
++ if (list_empty(&pdev->subordinate->devices))
++ state = 0;
+ /*
+ * if the downstream component has pci bridge function, don't do ASPM
+ * now
+@@ -493,20 +517,52 @@ static void __pcie_aspm_config_link(stru
+ link_state->enabled_state = state;
+ }
+
++static struct pcie_link_state *get_root_port_link(struct pcie_link_state *link)
++{
++ struct pcie_link_state *root_port_link = link;
++ while (root_port_link->parent)
++ root_port_link = root_port_link->parent;
++ return root_port_link;
++}
++
++/* check the whole hierarchy, and configure each link in the hierarchy */
+ static void __pcie_aspm_configure_link_state(struct pci_dev *pdev,
+ unsigned int state)
+ {
+ struct pcie_link_state *link_state = pdev->link_state;
++ struct pcie_link_state *root_port_link = get_root_port_link(link_state);
++ struct pcie_link_state *leaf;
+
+- if (link_state->support_state == 0)
+- return;
+ state &= PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
+
+- /* state 0 means disabling aspm */
+- state = pcie_aspm_check_state(pdev, state);
++ /* check all links who have specific root port link */
++ list_for_each_entry(leaf, &link_list, sibiling) {
++ if (!list_empty(&leaf->children) ||
++ get_root_port_link(leaf) != root_port_link)
++ continue;
++ state = pcie_aspm_check_state(leaf->pdev, state);
++ }
++ /* check root port link too in case it hasn't children */
++ state = pcie_aspm_check_state(root_port_link->pdev, state);
++
+ if (link_state->enabled_state == state)
+ return;
+- __pcie_aspm_config_link(pdev, state);
++
++ /*
++ * we must change the hierarchy. See comments in
++ * __pcie_aspm_config_link for the order
++ **/
++ if (state & PCIE_LINK_STATE_L1) {
++ list_for_each_entry(leaf, &link_list, sibiling) {
++ if (get_root_port_link(leaf) == root_port_link)
++ __pcie_aspm_config_link(leaf->pdev, state);
++ }
++ } else {
++ list_for_each_entry_reverse(leaf, &link_list, sibiling) {
++ if (get_root_port_link(leaf) == root_port_link)
++ __pcie_aspm_config_link(leaf->pdev, state);
++ }
++ }
+ }
+
+ /*
+@@ -570,6 +626,7 @@ void pcie_aspm_init_link_state(struct pc
+ unsigned int state;
+ struct pcie_link_state *link_state;
+ int error = 0;
++ int blacklist;
+
+ if (aspm_disabled || !pdev->is_pcie || pdev->link_state)
+ return;
+@@ -580,29 +637,58 @@ void pcie_aspm_init_link_state(struct pc
+ if (list_empty(&pdev->subordinate->devices))
+ goto out;
+
+- if (pcie_aspm_sanity_check(pdev))
+- goto out;
++ blacklist = !!pcie_aspm_sanity_check(pdev);
+
+ mutex_lock(&aspm_lock);
+
+ link_state = kzalloc(sizeof(*link_state), GFP_KERNEL);
+ if (!link_state)
+ goto unlock_out;
+- pdev->link_state = link_state;
+
+- pcie_aspm_configure_common_clock(pdev);
+-
+- pcie_aspm_cap_init(pdev);
++ link_state->downstream_has_switch = pcie_aspm_downstream_has_switch(pdev);
++ INIT_LIST_HEAD(&link_state->children);
++ INIT_LIST_HEAD(&link_state->link);
++ if (pdev->bus->self) {/* this is a switch */
++ struct pcie_link_state *parent_link_state;
++
++ parent_link_state = pdev->bus->parent->self->link_state;
++ if (!parent_link_state) {
++ kfree(link_state);
++ goto unlock_out;
++ }
++ list_add(&link_state->link, &parent_link_state->children);
++ link_state->parent = parent_link_state;
++ }
+
+- /* config link state to avoid BIOS error */
+- state = pcie_aspm_check_state(pdev, policy_to_aspm_state(pdev));
+- __pcie_aspm_config_link(pdev, state);
++ pdev->link_state = link_state;
+
+- pcie_check_clock_pm(pdev);
++ if (!blacklist) {
++ pcie_aspm_configure_common_clock(pdev);
++ pcie_aspm_cap_init(pdev);
++ } else {
++ link_state->enabled_state = PCIE_LINK_STATE_L0S|PCIE_LINK_STATE_L1;
++ link_state->bios_aspm_state = 0;
++ /* Set support state to 0, so we will disable ASPM later */
++ link_state->support_state = 0;
++ }
+
+ link_state->pdev = pdev;
+ list_add(&link_state->sibiling, &link_list);
+
++ if (link_state->downstream_has_switch) {
++ /*
++ * If link has switch, delay the link config. The leaf link
++ * initialization will config the whole hierarchy. but we must
++ * make sure BIOS doesn't set unsupported link state
++ **/
++ state = pcie_aspm_check_state(pdev, link_state->bios_aspm_state);
++ __pcie_aspm_config_link(pdev, state);
++ } else
++ __pcie_aspm_configure_link_state(pdev,
++ policy_to_aspm_state(pdev));
++
++ pcie_check_clock_pm(pdev, blacklist);
++
+ unlock_out:
+ if (error)
+ free_link_state(pdev);
+@@ -635,6 +721,7 @@ void pcie_aspm_exit_link_state(struct pc
+ /* All functions are removed, so just disable ASPM for the link */
+ __pcie_aspm_config_one_dev(parent, 0);
+ list_del(&link_state->sibiling);
++ list_del(&link_state->link);
+ /* Clock PM is for endpoint device */
+
+ free_link_state(parent);
--- /dev/null
+From 3be36ae223271f9c2cfbe7406846c8fdcd2f50c3 Mon Sep 17 00:00:00 2001
+From: Stefan Lippers-Hollmann <s.L-H@gmx.de>
+Date: Sun, 4 Jan 2009 01:10:49 +0100
+Subject: rt2x00: add USB ID for the Linksys WUSB200.
+
+From: Stefan Lippers-Hollmann <s.L-H@gmx.de>
+
+commit 3be36ae223271f9c2cfbe7406846c8fdcd2f50c3 upstream.
+
+add USB ID for the Linksys WUSB200 Wireless-G Business USB Adapter to
+rt73usb.
+
+Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/wireless/rt2x00/rt73usb.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/wireless/rt2x00/rt73usb.c
++++ b/drivers/net/wireless/rt2x00/rt73usb.c
+@@ -2113,6 +2113,7 @@ static struct usb_device_id rt73usb_devi
+ /* Linksys */
+ { USB_DEVICE(0x13b1, 0x0020), USB_DEVICE_DATA(&rt73usb_ops) },
+ { USB_DEVICE(0x13b1, 0x0023), USB_DEVICE_DATA(&rt73usb_ops) },
++ { USB_DEVICE(0x13b1, 0x0028), USB_DEVICE_DATA(&rt73usb_ops) },
+ /* MSI */
+ { USB_DEVICE(0x0db0, 0x6877), USB_DEVICE_DATA(&rt73usb_ops) },
+ { USB_DEVICE(0x0db0, 0x6874), USB_DEVICE_DATA(&rt73usb_ops) },
--- /dev/null
+From 0d54ee1c7850a954026deec4cd4885f331da35cc Mon Sep 17 00:00:00 2001
+From: Vegard Nossum <vegard.nossum@gmail.com>
+Date: Sat, 17 Jan 2009 17:45:45 +0100
+Subject: security: introduce missing kfree
+
+From: Vegard Nossum <vegard.nossum@gmail.com>
+
+commit 0d54ee1c7850a954026deec4cd4885f331da35cc upstream.
+
+Plug this leak.
+
+Acked-by: David Howells <dhowells@redhat.com>
+Cc: James Morris <jmorris@namei.org>
+Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ security/keys/keyctl.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/security/keys/keyctl.c
++++ b/security/keys/keyctl.c
+@@ -270,6 +270,7 @@ long keyctl_join_session_keyring(const c
+
+ /* join the session */
+ ret = join_session_keyring(name);
++ kfree(name);
+
+ error:
+ return ret;
tcp-don-t-mask-eof-and-socket-errors-on-nonblocking-splice-receive.patch
usb-storage-add-last-sector-hacks.patch
usb-storage-set-capacity_heuristics-flag-for-bad-vendors.patch
+alsa-hda-add-automatic-model-setting-for-samsung-q45.patch
+alsa-hda-make-laptop-eapd-model-back-for-ad1986a.patch
+drivers-net-irda-irda-usb.c-fix-buffer-overflow.patch
+ia64-turn-on-config_have_unstable_clock.patch
+kill-sig-1-must-only-apply-to-caller-s-namespace.patch
+lib-idr.c-use-kmem_cache_zalloc-for-the-idr_layer-cache.patch
+nfsd-ensure-nfsv4-calls-the-underlying-filesystem-on-lockt.patch
+p54usb-add-usb-id-for-thomson-speedtouch-121g.patch
+pci-keep-aspm-link-state-consistent-throughout-pcie-hierarchy.patch
+rt2x00-add-usb-id-for-the-linksys-wusb200.patch
+security-introduce-missing-kfree.patch
+sgi-xp-eliminate-false-detection-of-no-heartbeat.patch
--- /dev/null
+From 158bc69effbf96f59c01cdeb20f8d4c184e59f8e Mon Sep 17 00:00:00 2001
+From: Dean Nelson <dcn@sgi.com>
+Date: Thu, 15 Jan 2009 13:50:57 -0800
+Subject: sgi-xp: eliminate false detection of no heartbeat
+
+From: Dean Nelson <dcn@sgi.com>
+
+commit 158bc69effbf96f59c01cdeb20f8d4c184e59f8e upstream.
+
+After XPC has been up and running on multiple partitions for any length of
+time, if XPC on one of the partitions is stopped and restarted (either by
+a rmmod/insmod or a system restart), it is possible for the XPCs running
+on the other partitions to falsely detect a lack of heartbeat from the XPC
+that was just restarted. This false detection will occur if the restarted
+XPC comes up within the five-seconds preceding one of the other XPC's
+heartbeat check (which occurs once every twenty seconds).
+
+The detection of no heartbeat results in the detecting XPC deactivating
+from the just restarted XPC. The only remedy is to restart one of the
+XPCs and hope that one doesn't hit this five-second window on any of the
+other partitions.
+
+Signed-off-by: Dean Nelson <dcn@sgi.com>
+Signed-off-by: Robin Holt <holt@sgi.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/misc/sgi-xp/xpc_sn2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/misc/sgi-xp/xpc_sn2.c
++++ b/drivers/misc/sgi-xp/xpc_sn2.c
+@@ -904,7 +904,7 @@ xpc_update_partition_info_sn2(struct xpc
+ dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
+ part_sn2->remote_vars_pa);
+
+- part->last_heartbeat = remote_vars->heartbeat;
++ part->last_heartbeat = remote_vars->heartbeat - 1;
+ dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
+ part->last_heartbeat);
+