* [gentoo-commits] linux-patches r1498 - genpatches-2.6/trunk/2.6.27
@ 2009-02-20 19:20 Mike Pagano (mpagano)
0 siblings, 0 replies; only message in thread
From: Mike Pagano (mpagano) @ 2009-02-20 19:20 UTC (permalink / raw
To: gentoo-commits
Author: mpagano
Date: 2009-02-20 19:20:18 +0000 (Fri, 20 Feb 2009)
New Revision: 1498
Added:
genpatches-2.6/trunk/2.6.27/1014_linux-2.6.27.15.patch
genpatches-2.6/trunk/2.6.27/1015_linux-2.6.27.16.patch
genpatches-2.6/trunk/2.6.27/1016_linux-2.6.27.17.patch
genpatches-2.6/trunk/2.6.27/1017_linux-2.6.27.18.patch
Modified:
genpatches-2.6/trunk/2.6.27/0000_README
Log:
Adding linux patches 2.6.27.15 2.6.27.16 2.6.27.17 2.6.27.18
Modified: genpatches-2.6/trunk/2.6.27/0000_README
===================================================================
--- genpatches-2.6/trunk/2.6.27/0000_README 2009-02-19 22:56:50 UTC (rev 1497)
+++ genpatches-2.6/trunk/2.6.27/0000_README 2009-02-20 19:20:18 UTC (rev 1498)
@@ -95,6 +95,22 @@
From: http://www.kernel.org
Desc: Linux 2.6.27.14
+Patch: 1014_linux-2.6.27.15.patch
+From: http://www.kernel.org
+Desc: Linux 2.6.27.15
+
+Patch: 1015_linux-2.6.27.16.patch
+From: http://www.kernel.org
+Desc: Linux 2.6.27.16
+
+Patch: 1016_linux-2.6.27.17.patch
+From: http://www.kernel.org
+Desc: Linux 2.6.27.17
+
+Patch: 1017_linux-2.6.27.18.patch
+From: http://www.kernel.org
+Desc: Linux 2.6.27.18
+
Patch: 1700_sparc-poweroff-hang.patch
From: http://bugs.gentoo.org/229441
Desc: Fix shutdown hang on Sun Blade 100
Added: genpatches-2.6/trunk/2.6.27/1014_linux-2.6.27.15.patch
===================================================================
--- genpatches-2.6/trunk/2.6.27/1014_linux-2.6.27.15.patch (rev 0)
+++ genpatches-2.6/trunk/2.6.27/1014_linux-2.6.27.15.patch 2009-02-20 19:20:18 UTC (rev 1498)
@@ -0,0 +1,2375 @@
+diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
+index 6568942..a15baac 100644
+--- a/arch/ia64/sn/kernel/io_acpi_init.c
++++ b/arch/ia64/sn/kernel/io_acpi_init.c
+@@ -232,7 +232,7 @@ exit:
+ static unsigned int
+ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
+ {
+- unsigned long adr;
++ unsigned long long adr;
+ acpi_handle child;
+ unsigned int devfn;
+ int function;
+@@ -292,8 +292,8 @@ get_host_devfn(acpi_handle device_handle, acpi_handle rootbus_handle)
+ static acpi_status
+ find_matching_device(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+- unsigned long bbn = -1;
+- unsigned long adr;
++ unsigned long long bbn = -1;
++ unsigned long long adr;
+ acpi_handle parent = NULL;
+ acpi_status status;
+ unsigned int devfn;
+@@ -348,7 +348,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
+ unsigned int host_devfn;
+ struct sn_pcidev_match pcidev_match;
+ acpi_handle rootbus_handle;
+- unsigned long segment;
++ unsigned long long segment;
+ acpi_status status;
+
+ rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle;
+diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
+index 2e7515e..04aa00b 100644
+--- a/arch/m68knommu/Kconfig
++++ b/arch/m68knommu/Kconfig
+@@ -14,6 +14,10 @@ config MMU
+ bool
+ default n
+
++config NO_DMA
++ bool
++ default y
++
+ config FPU
+ bool
+ default n
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
+index 388bae2..d0561fe 100644
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -123,6 +123,9 @@ config GENERIC_TIME_VSYSCALL
+ config ARCH_HAS_CPU_RELAX
+ def_bool y
+
++config ARCH_HAS_DEFAULT_IDLE
++ def_bool y
++
+ config ARCH_HAS_CACHE_LINE_SIZE
+ def_bool y
+
+diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
+index c2502eb..a4805b3 100644
+--- a/arch/x86/kernel/acpi/cstate.c
++++ b/arch/x86/kernel/acpi/cstate.c
+@@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */
+ static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
+
+ #define MWAIT_SUBSTATE_MASK (0xf)
++#define MWAIT_CSTATE_MASK (0xf)
+ #define MWAIT_SUBSTATE_SIZE (4)
+
+ #define CPUID_MWAIT_LEAF (5)
+@@ -98,7 +99,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
+ cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
+
+ /* Check whether this particular cx_type (in CST) is supported or not */
+- cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1;
++ cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
++ MWAIT_CSTATE_MASK) + 1;
+ edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
+ num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
+
+diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
+index 24e6094..dbeab3c 100644
+--- a/arch/x86/lib/usercopy_32.c
++++ b/arch/x86/lib/usercopy_32.c
+@@ -49,7 +49,7 @@ do { \
+ " jmp 2b\n" \
+ ".previous\n" \
+ _ASM_EXTABLE(0b,3b) \
+- : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \
++ : "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \
+ "=&D" (__d2) \
+ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
+ : "memory"); \
+@@ -211,7 +211,7 @@ long strnlen_user(const char __user *s, long n)
+ " .align 4\n"
+ " .long 0b,2b\n"
+ ".previous"
+- :"=r" (n), "=D" (s), "=a" (res), "=c" (tmp)
++ :"=&r" (n), "=&D" (s), "=&a" (res), "=&c" (tmp)
+ :"0" (n), "1" (s), "2" (0), "3" (mask)
+ :"cc");
+ return res & mask;
+diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
+index f4df6e7..500b930 100644
+--- a/arch/x86/lib/usercopy_64.c
++++ b/arch/x86/lib/usercopy_64.c
+@@ -32,7 +32,7 @@ do { \
+ " jmp 2b\n" \
+ ".previous\n" \
+ _ASM_EXTABLE(0b,3b) \
+- : "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1), \
++ : "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \
+ "=&D" (__d2) \
+ : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
+ : "memory"); \
+@@ -86,7 +86,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
+ ".previous\n"
+ _ASM_EXTABLE(0b,3b)
+ _ASM_EXTABLE(1b,2b)
+- : [size8] "=c"(size), [dst] "=&D" (__d0)
++ : [size8] "=&c"(size), [dst] "=&D" (__d0)
+ : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr),
+ [zero] "r" (0UL), [eight] "r" (8UL));
+ return size;
+diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
+index 43e2f84..5b719a0 100644
+--- a/arch/x86/mm/pageattr.c
++++ b/arch/x86/mm/pageattr.c
+@@ -582,6 +582,36 @@ out_unlock:
+ return 0;
+ }
+
++static int __cpa_process_fault(struct cpa_data *cpa, unsigned long vaddr,
++ int primary)
++{
++ /*
++ * Ignore all non primary paths.
++ */
++ if (!primary)
++ return 0;
++
++ /*
++ * Ignore the NULL PTE for kernel identity mapping, as it is expected
++ * to have holes.
++ * Also set numpages to '1' indicating that we processed cpa req for
++ * one virtual address page and its pfn. TBD: numpages can be set based
++ * on the initial value and the level returned by lookup_address().
++ */
++ if (within(vaddr, PAGE_OFFSET,
++ PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))) {
++ cpa->numpages = 1;
++ cpa->pfn = __pa(vaddr) >> PAGE_SHIFT;
++ return 0;
++ } else {
++ WARN(1, KERN_WARNING "CPA: called for zero pte. "
++ "vaddr = %lx cpa->vaddr = %lx\n", vaddr,
++ cpa->vaddr);
++
++ return -EINVAL;
++ }
++}
++
+ static int __change_page_attr(struct cpa_data *cpa, int primary)
+ {
+ unsigned long address = cpa->vaddr;
+@@ -592,17 +622,11 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
+ repeat:
+ kpte = lookup_address(address, &level);
+ if (!kpte)
+- return 0;
++ return __cpa_process_fault(cpa, address, primary);
+
+ old_pte = *kpte;
+- if (!pte_val(old_pte)) {
+- if (!primary)
+- return 0;
+- WARN(1, KERN_WARNING "CPA: called for zero pte. "
+- "vaddr = %lx cpa->vaddr = %lx\n", address,
+- cpa->vaddr);
+- return -EINVAL;
+- }
++ if (!pte_val(old_pte))
++ return __cpa_process_fault(cpa, address, primary);
+
+ if (level == PG_LEVEL_4K) {
+ pte_t new_pte;
+@@ -676,12 +700,7 @@ static int cpa_process_alias(struct cpa_data *cpa)
+ * mapping already:
+ */
+ if (!(within(cpa->vaddr, PAGE_OFFSET,
+- PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT))
+-#ifdef CONFIG_X86_64
+- || within(cpa->vaddr, PAGE_OFFSET + (1UL<<32),
+- PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))
+-#endif
+- )) {
++ PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT)))) {
+
+ alias_cpa = *cpa;
+ alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
+diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
+index 8e07718..95e76ce 100644
+--- a/arch/x86/pci/irq.c
++++ b/arch/x86/pci/irq.c
+@@ -573,6 +573,7 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
+ case PCI_DEVICE_ID_INTEL_ICH7_1:
+ case PCI_DEVICE_ID_INTEL_ICH7_30:
+ case PCI_DEVICE_ID_INTEL_ICH7_31:
++ case PCI_DEVICE_ID_INTEL_TGP_LPC:
+ case PCI_DEVICE_ID_INTEL_ESB2_0:
+ case PCI_DEVICE_ID_INTEL_ICH8_0:
+ case PCI_DEVICE_ID_INTEL_ICH8_1:
+diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
+index 831883b..5e57a80 100644
+--- a/drivers/acpi/ac.c
++++ b/drivers/acpi/ac.c
+@@ -85,7 +85,7 @@ struct acpi_ac {
+ struct power_supply charger;
+ #endif
+ struct acpi_device * device;
+- unsigned long state;
++ unsigned long long state;
+ };
+
+ #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
+diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
+index 5f1127a..2b77316 100644
+--- a/drivers/acpi/acpi_memhotplug.c
++++ b/drivers/acpi/acpi_memhotplug.c
+@@ -194,8 +194,7 @@ acpi_memory_get_device(acpi_handle handle,
+
+ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
+ {
+- unsigned long current_status;
+-
++ unsigned long long current_status;
+
+ /* Get device present/absent information from the _STA */
+ if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
+@@ -264,7 +263,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
+ acpi_status status;
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
+- unsigned long current_status;
++ unsigned long long current_status;
+
+
+ /* Issue the _EJ0 command */
+diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
+index d3d0886..e2ab023 100644
+--- a/drivers/acpi/asus_acpi.c
++++ b/drivers/acpi/asus_acpi.c
+@@ -753,7 +753,7 @@ static int get_lcd_state(void)
+ /* That's what the AML code does */
+ lcd = out_obj.integer.value >> 8;
+ } else if (hotk->model == F3Sa) {
+- unsigned long tmp;
++ unsigned long long tmp;
+ union acpi_object param;
+ struct acpi_object_list input;
+ acpi_status status;
+@@ -1244,6 +1244,8 @@ static int asus_hotk_get_info(void)
+ "default values\n", string);
+ printk(KERN_NOTICE
+ " send /proc/acpi/dsdt to the developers\n");
++ kfree(model);
++ return -ENODEV;
+ }
+ hotk->methods = &model_conf[hotk->model];
+ return AE_OK;
+diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
+index b1c723f..e5ca3a0 100644
+--- a/drivers/acpi/battery.c
++++ b/drivers/acpi/battery.c
+@@ -472,7 +472,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
+
+ static int acpi_battery_update(struct acpi_battery *battery)
+ {
+- int result;
++ int result, old_present = acpi_battery_present(battery);
+ result = acpi_battery_get_status(battery);
+ if (result)
+ return result;
+@@ -483,7 +483,8 @@ static int acpi_battery_update(struct acpi_battery *battery)
+ return 0;
+ }
+ #endif
+- if (!battery->update_time) {
++ if (!battery->update_time ||
++ old_present != acpi_battery_present(battery)) {
+ result = acpi_battery_get_info(battery);
+ if (result)
+ return result;
+diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
+index 61b6c5b..23a51e4 100644
+--- a/drivers/acpi/bay.c
++++ b/drivers/acpi/bay.c
+@@ -90,7 +90,7 @@ static int is_ejectable(acpi_handle handle)
+ */
+ static int bay_present(struct bay *bay)
+ {
+- unsigned long sta;
++ unsigned long long sta;
+ acpi_status status;
+
+ if (bay) {
+diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
+index c54f38e..60c34ed 100644
+--- a/drivers/acpi/bus.c
++++ b/drivers/acpi/bus.c
+@@ -77,7 +77,7 @@ EXPORT_SYMBOL(acpi_bus_get_device);
+ int acpi_bus_get_status(struct acpi_device *device)
+ {
+ acpi_status status = AE_OK;
+- unsigned long sta = 0;
++ unsigned long long sta = 0;
+
+
+ if (!device)
+@@ -155,7 +155,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
+ int result = 0;
+ acpi_status status = 0;
+ struct acpi_device *device = NULL;
+- unsigned long psc = 0;
++ unsigned long long psc = 0;
+
+
+ result = acpi_bus_get_device(handle, &device);
+diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
+index 59352d9..9e8e8a6 100644
+--- a/drivers/acpi/button.c
++++ b/drivers/acpi/button.c
+@@ -145,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
+ {
+ struct acpi_button *button = seq->private;
+ acpi_status status;
+- unsigned long state;
++ unsigned long long state;
+
+ if (!button || !button->device)
+ return 0;
+@@ -253,7 +253,7 @@ static int acpi_button_remove_fs(struct acpi_device *device)
+ -------------------------------------------------------------------------- */
+ static int acpi_lid_send_state(struct acpi_button *button)
+ {
+- unsigned long state;
++ unsigned long long state;
+ acpi_status status;
+
+ status = acpi_evaluate_integer(button->device->handle, "_LID", NULL,
+diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
+index 3c25ec7..cfa5fd6 100644
+--- a/drivers/acpi/container.c
++++ b/drivers/acpi/container.c
+@@ -76,7 +76,7 @@ static int is_device_present(acpi_handle handle)
+ {
+ acpi_handle temp;
+ acpi_status status;
+- unsigned long sta;
++ unsigned long long sta;
+
+
+ status = acpi_get_handle(handle, "_STA", &temp);
+diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
+index 4613b9c..279a5a6 100644
+--- a/drivers/acpi/dispatcher/dsmethod.c
++++ b/drivers/acpi/dispatcher/dsmethod.c
+@@ -103,6 +103,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
+ NULL);
+ acpi_ex_enter_interpreter();
+ }
++
++ acpi_ds_clear_implicit_return(walk_state);
++
+ #ifdef ACPI_DISASSEMBLER
+ if (ACPI_FAILURE(status)) {
+
+diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
+index 25d2161..e28469e 100644
+--- a/drivers/acpi/dock.c
++++ b/drivers/acpi/dock.c
+@@ -229,7 +229,7 @@ EXPORT_SYMBOL_GPL(is_dock_device);
+ */
+ static int dock_present(struct dock_station *ds)
+ {
+- unsigned long sta;
++ unsigned long long sta;
+ acpi_status status;
+
+ if (ds) {
+@@ -730,13 +730,13 @@ static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock);
+ static ssize_t show_dock_uid(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+- unsigned long lbuf;
++ unsigned long long lbuf;
+ acpi_status status = acpi_evaluate_integer(dock_station->handle,
+ "_UID", NULL, &lbuf);
+ if (ACPI_FAILURE(status))
+ return 0;
+
+- return snprintf(buf, PAGE_SIZE, "%lx\n", lbuf);
++ return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
+ }
+ static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
+
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 9ab3fb9..566206a 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -769,6 +769,7 @@ static acpi_status
+ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
+ {
+ acpi_status status;
++ unsigned long long tmp = 0;
+
+ struct acpi_ec *ec = context;
+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+@@ -778,11 +779,14 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
+
+ /* Get GPE bit assignment (EC events). */
+ /* TODO: Add support for _GPE returning a package */
+- status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
++ status = acpi_evaluate_integer(handle, "_GPE", NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ return status;
++ ec->gpe = tmp;
+ /* Use the global lock for all EC transactions? */
+- acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
++ tmp = 0;
++ acpi_evaluate_integer(handle, "_GLK", NULL, &tmp);
++ ec->global_lock = tmp;
+ ec->handle = handle;
+ return AE_CTRL_TERMINATE;
+ }
+diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
+index b0817e1..337fb04 100644
+--- a/drivers/acpi/namespace/nsutils.c
++++ b/drivers/acpi/namespace/nsutils.c
+@@ -314,9 +314,15 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
+ *
+ * strlen() + 1 covers the first name_seg, which has no path separator
+ */
+- if (acpi_ns_valid_root_prefix(next_external_char[0])) {
++ if (acpi_ns_valid_root_prefix(*next_external_char)) {
+ info->fully_qualified = TRUE;
+ next_external_char++;
++
++ /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */
++
++ while (acpi_ns_valid_root_prefix(*next_external_char)) {
++ next_external_char++;
++ }
+ } else {
+ /*
+ * Handle Carat prefixes
+diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c
+index a287ed5..3cb910d 100644
+--- a/drivers/acpi/namespace/nsxfname.c
++++ b/drivers/acpi/namespace/nsxfname.c
+@@ -253,6 +253,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
+ node = acpi_ns_map_handle_to_node(handle);
+ if (!node) {
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
++ status = AE_BAD_PARAMETER;
+ goto cleanup;
+ }
+
+diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
+index cb9864e..25ceae9 100644
+--- a/drivers/acpi/numa.c
++++ b/drivers/acpi/numa.c
+@@ -258,7 +258,7 @@ int __init acpi_numa_init(void)
+
+ int acpi_get_pxm(acpi_handle h)
+ {
+- unsigned long pxm;
++ unsigned long long pxm;
+ acpi_status status;
+ acpi_handle handle;
+ acpi_handle phandle = h;
+diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
+index b0d40aa..f5beb8a 100644
+--- a/drivers/acpi/osl.c
++++ b/drivers/acpi/osl.c
+@@ -608,7 +608,7 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
+ acpi_handle handle;
+ struct acpi_pci_id *pci_id = *id;
+ acpi_status status;
+- unsigned long temp;
++ unsigned long long temp;
+ acpi_object_type type;
+
+ acpi_get_parent(chandle, &handle);
+@@ -620,8 +620,7 @@ static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
+ if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
+ return;
+
+- status =
+- acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
++ status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
+ &temp);
+ if (ACPI_SUCCESS(status)) {
+ u32 val;
+diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
+index 15e1702..a05e2a3 100644
+--- a/drivers/acpi/parser/psparse.c
++++ b/drivers/acpi/parser/psparse.c
+@@ -641,10 +641,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
+ ACPI_WALK_METHOD_RESTART;
+ }
+ } else {
+- /* On error, delete any return object */
++ /* On error, delete any return object or implicit return */
+
+ acpi_ut_remove_reference(previous_walk_state->
+ return_desc);
++ acpi_ds_clear_implicit_return
++ (previous_walk_state);
+ }
+ }
+
+diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
+index cf47805..0ea8a9f 100644
+--- a/drivers/acpi/pci_link.c
++++ b/drivers/acpi/pci_link.c
+@@ -796,10 +796,6 @@ static int irqrouter_resume(struct sys_device *dev)
+ struct list_head *node = NULL;
+ struct acpi_pci_link *link = NULL;
+
+-
+- /* Make sure SCI is enabled again (Apple firmware bug?) */
+- acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1);
+-
+ list_for_each(node, &acpi_link.entries) {
+ link = list_entry(node, struct acpi_pci_link, node);
+ if (!link) {
+diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
+index c3fed31..18ff4e5 100644
+--- a/drivers/acpi/pci_root.c
++++ b/drivers/acpi/pci_root.c
+@@ -190,7 +190,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
+ struct acpi_pci_root *root = NULL;
+ struct acpi_pci_root *tmp;
+ acpi_status status = AE_OK;
+- unsigned long value = 0;
++ unsigned long long value = 0;
+ acpi_handle handle = NULL;
+ struct acpi_device *child;
+
+diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
+index 8d4a568..cd1f446 100644
+--- a/drivers/acpi/pci_slot.c
++++ b/drivers/acpi/pci_slot.c
+@@ -76,10 +76,10 @@ static struct acpi_pci_driver acpi_pci_slot_driver = {
+ };
+
+ static int
+-check_slot(acpi_handle handle, unsigned long *sun)
++check_slot(acpi_handle handle, unsigned long long *sun)
+ {
+ int device = -1;
+- unsigned long adr, sta;
++ unsigned long long adr, sta;
+ acpi_status status;
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+
+@@ -132,7 +132,7 @@ static acpi_status
+ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+ int device;
+- unsigned long sun;
++ unsigned long long sun;
+ char name[SLOT_NAME_SIZE];
+ struct acpi_pci_slot *slot;
+ struct pci_slot *pci_slot;
+@@ -182,7 +182,7 @@ static acpi_status
+ walk_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+ int device, function;
+- unsigned long adr;
++ unsigned long long adr;
+ acpi_status status;
+ acpi_handle dummy_handle;
+ acpi_walk_callback user_function;
+@@ -239,7 +239,7 @@ static int
+ walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function)
+ {
+ int seg, bus;
+- unsigned long tmp;
++ unsigned long long tmp;
+ acpi_status status;
+ acpi_handle dummy_handle;
+ struct pci_bus *pci_bus;
+diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
+index 4ab21cb..89e5d2a 100644
+--- a/drivers/acpi/power.c
++++ b/drivers/acpi/power.c
+@@ -131,7 +131,7 @@ acpi_power_get_context(acpi_handle handle,
+ static int acpi_power_get_state(struct acpi_power_resource *resource, int *state)
+ {
+ acpi_status status = AE_OK;
+- unsigned long sta = 0;
++ unsigned long long sta = 0;
+
+
+ if (!resource || !state)
+diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
+index ee68ac5..8a27871 100644
+--- a/drivers/acpi/processor_core.c
++++ b/drivers/acpi/processor_core.c
+@@ -563,7 +563,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
+
+ /* Check if it is a Device with HID and UID */
+ if (has_uid) {
+- unsigned long value;
++ unsigned long long value;
+ status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
+ NULL, &value);
+ if (ACPI_FAILURE(status)) {
+@@ -875,7 +875,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
+ static int is_processor_present(acpi_handle handle)
+ {
+ acpi_status status;
+- unsigned long sta = 0;
++ unsigned long long sta = 0;
+
+
+ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
+index cf5b1b7..81b40ed 100644
+--- a/drivers/acpi/processor_idle.c
++++ b/drivers/acpi/processor_idle.c
+@@ -1587,6 +1587,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
+
+ if (acpi_idle_bm_check()) {
+ if (dev->safe_state) {
++ dev->last_state = dev->safe_state;
+ return dev->safe_state->enter(dev, dev->safe_state);
+ } else {
+ local_irq_disable();
+diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
+index 80c251e..f8129c7 100644
+--- a/drivers/acpi/processor_perflib.c
++++ b/drivers/acpi/processor_perflib.c
+@@ -126,7 +126,7 @@ static struct notifier_block acpi_ppc_notifier_block = {
+ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
+ {
+ acpi_status status = 0;
+- unsigned long ppc = 0;
++ unsigned long long ppc = 0;
+
+
+ if (!pr)
+diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
+index a56fc6c..3097b75 100644
+--- a/drivers/acpi/processor_throttling.c
++++ b/drivers/acpi/processor_throttling.c
+@@ -274,7 +274,7 @@ static int acpi_processor_throttling_notifier(unsigned long event, void *data)
+ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
+ {
+ acpi_status status = 0;
+- unsigned long tpc = 0;
++ unsigned long long tpc = 0;
+
+ if (!pr)
+ return -EINVAL;
+diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
+index a4e3767..81d23d3 100644
+--- a/drivers/acpi/sbshc.c
++++ b/drivers/acpi/sbshc.c
+@@ -258,7 +258,7 @@ extern int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
+ static int acpi_smbus_hc_add(struct acpi_device *device)
+ {
+ int status;
+- unsigned long val;
++ unsigned long long val;
+ struct acpi_smb_hc *hc;
+
+ if (!device)
+diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
+index 0450761..afa66f4 100644
+--- a/drivers/acpi/scan.c
++++ b/drivers/acpi/scan.c
+@@ -1262,6 +1262,16 @@ acpi_add_single_object(struct acpi_device **child,
+ acpi_device_set_id(device, parent, handle, type);
+
+ /*
++ * The ACPI device is attached to acpi handle before getting
++ * the power/wakeup/peformance flags. Otherwise OS can't get
++ * the corresponding ACPI device by the acpi handle in the course
++ * of getting the power/wakeup/performance flags.
++ */
++ result = acpi_device_set_context(device, type);
++ if (result)
++ goto end;
++
++ /*
+ * Power Management
+ * ----------------
+ */
+@@ -1291,8 +1301,6 @@ acpi_add_single_object(struct acpi_device **child,
+ goto end;
+ }
+
+- if ((result = acpi_device_set_context(device, type)))
+- goto end;
+
+ result = acpi_device_register(device, parent);
+
+diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
+index 3706469..e7e0aac 100644
+--- a/drivers/acpi/sleep/main.c
++++ b/drivers/acpi/sleep/main.c
+@@ -344,6 +344,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
+ },
+ },
++ {
++ .callback = init_old_suspend_ordering,
++ .ident = "HP xw4600 Workstation",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
++ },
++ },
+ {},
+ };
+ #endif /* CONFIG_SUSPEND */
+@@ -492,7 +500,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
+ acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
+ struct acpi_device *adev;
+ char acpi_method[] = "_SxD";
+- unsigned long d_min, d_max;
++ unsigned long long d_min, d_max;
+
+ if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
+ printk(KERN_DEBUG "ACPI handle has no context!\n");
+diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
+index 9127036..47abb94 100644
+--- a/drivers/acpi/thermal.c
++++ b/drivers/acpi/thermal.c
+@@ -246,18 +246,18 @@ static const struct file_operations acpi_thermal_polling_fops = {
+ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
+ {
+ acpi_status status = AE_OK;
+-
++ unsigned long long tmp;
+
+ if (!tz)
+ return -EINVAL;
+
+ tz->last_temperature = tz->temperature;
+
+- status =
+- acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature);
++ status = acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+
++ tz->temperature = tmp;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n",
+ tz->temperature));
+
+@@ -267,17 +267,16 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
+ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
+ {
+ acpi_status status = AE_OK;
+-
++ unsigned long long tmp;
+
+ if (!tz)
+ return -EINVAL;
+
+- status =
+- acpi_evaluate_integer(tz->device->handle, "_TZP", NULL,
+- &tz->polling_frequency);
++ status = acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+
++ tz->polling_frequency = tmp;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n",
+ tz->polling_frequency));
+
+@@ -356,6 +355,7 @@ do { \
+ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+ {
+ acpi_status status = AE_OK;
++ unsigned long long tmp;
+ struct acpi_handle_list devices;
+ int valid = 0;
+ int i;
+@@ -363,7 +363,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+ /* Critical Shutdown (required) */
+ if (flag & ACPI_TRIPS_CRITICAL) {
+ status = acpi_evaluate_integer(tz->device->handle,
+- "_CRT", NULL, &tz->trips.critical.temperature);
++ "_CRT", NULL, &tmp);
++ tz->trips.critical.temperature = tmp;
+ /*
+ * Treat freezing temperatures as invalid as well; some
+ * BIOSes return really low values and cause reboots at startup.
+@@ -399,12 +400,13 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+ /* Critical Sleep (optional) */
+ if (flag & ACPI_TRIPS_HOT) {
+ status = acpi_evaluate_integer(tz->device->handle,
+- "_HOT", NULL, &tz->trips.hot.temperature);
++ "_HOT", NULL, &tmp);
+ if (ACPI_FAILURE(status)) {
+ tz->trips.hot.flags.valid = 0;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "No hot threshold\n"));
+ } else {
++ tz->trips.hot.temperature = tmp;
+ tz->trips.hot.flags.valid = 1;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Found hot threshold [%lu]\n",
+@@ -418,33 +420,40 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+ if (psv == -1) {
+ status = AE_SUPPORT;
+ } else if (psv > 0) {
+- tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv);
++ tmp = CELSIUS_TO_KELVIN(psv);
+ status = AE_OK;
+ } else {
+ status = acpi_evaluate_integer(tz->device->handle,
+- "_PSV", NULL, &tz->trips.passive.temperature);
++ "_PSV", NULL, &tmp);
+ }
+
+ if (ACPI_FAILURE(status))
+ tz->trips.passive.flags.valid = 0;
+ else {
++ tz->trips.passive.temperature = tmp;
+ tz->trips.passive.flags.valid = 1;
+ if (flag == ACPI_TRIPS_INIT) {
+ status = acpi_evaluate_integer(
+ tz->device->handle, "_TC1",
+- NULL, &tz->trips.passive.tc1);
++ NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ tz->trips.passive.flags.valid = 0;
++ else
++ tz->trips.passive.tc1 = tmp;
+ status = acpi_evaluate_integer(
+ tz->device->handle, "_TC2",
+- NULL, &tz->trips.passive.tc2);
++ NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ tz->trips.passive.flags.valid = 0;
++ else
++ tz->trips.passive.tc2 = tmp;
+ status = acpi_evaluate_integer(
+ tz->device->handle, "_TSP",
+- NULL, &tz->trips.passive.tsp);
++ NULL, &tmp);
+ if (ACPI_FAILURE(status))
+ tz->trips.passive.flags.valid = 0;
++ else
++ tz->trips.passive.tsp = tmp;
+ }
+ }
+ }
+@@ -479,7 +488,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+
+ if (flag & ACPI_TRIPS_ACTIVE) {
+ status = acpi_evaluate_integer(tz->device->handle,
+- name, NULL, &tz->trips.active[i].temperature);
++ name, NULL, &tmp);
+ if (ACPI_FAILURE(status)) {
+ tz->trips.active[i].flags.valid = 0;
+ if (i == 0)
+@@ -500,8 +509,10 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
+ tz->trips.active[i - 2].temperature :
+ CELSIUS_TO_KELVIN(act));
+ break;
+- } else
++ } else {
++ tz->trips.active[i].temperature = tmp;
+ tz->trips.active[i].flags.valid = 1;
++ }
+ }
+
+ name[2] = 'L';
+diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
+index 1009261..e827be3 100644
+--- a/drivers/acpi/utils.c
++++ b/drivers/acpi/utils.c
+@@ -256,7 +256,7 @@ EXPORT_SYMBOL(acpi_extract_package);
+ acpi_status
+ acpi_evaluate_integer(acpi_handle handle,
+ acpi_string pathname,
+- struct acpi_object_list *arguments, unsigned long *data)
++ struct acpi_object_list *arguments, unsigned long long *data)
+ {
+ acpi_status status = AE_OK;
+ union acpi_object *element;
+@@ -288,7 +288,7 @@ acpi_evaluate_integer(acpi_handle handle,
+ *data = element->integer.value;
+ kfree(element);
+
+- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data));
++ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data));
+
+ return AE_OK;
+ }
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
+index e8a51a1..42e1e84 100644
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -291,20 +291,20 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device,
+ int level);
+ static int acpi_video_device_lcd_get_level_current(
+ struct acpi_video_device *device,
+- unsigned long *level);
++ unsigned long long *level);
+ static int acpi_video_get_next_level(struct acpi_video_device *device,
+ u32 level_current, u32 event);
+ static void acpi_video_switch_brightness(struct acpi_video_device *device,
+ int event);
+ static int acpi_video_device_get_state(struct acpi_video_device *device,
+- unsigned long *state);
++ unsigned long long *state);
+ static int acpi_video_output_get(struct output_device *od);
+ static int acpi_video_device_set_state(struct acpi_video_device *device, int state);
+
+ /*backlight device sysfs support*/
+ static int acpi_video_get_brightness(struct backlight_device *bd)
+ {
+- unsigned long cur_level;
++ unsigned long long cur_level;
+ int i;
+ struct acpi_video_device *vd =
+ (struct acpi_video_device *)bl_get_data(bd);
+@@ -336,7 +336,7 @@ static struct backlight_ops acpi_backlight_ops = {
+ /*video output device sysfs support*/
+ static int acpi_video_output_get(struct output_device *od)
+ {
+- unsigned long state;
++ unsigned long long state;
+ struct acpi_video_device *vd =
+ (struct acpi_video_device *)dev_get_drvdata(&od->dev);
+ acpi_video_device_get_state(vd, &state);
+@@ -370,7 +370,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cdev, char *buf)
+ {
+ struct acpi_device *device = cdev->devdata;
+ struct acpi_video_device *video = acpi_driver_data(device);
+- unsigned long level;
++ unsigned long long level;
+ int state;
+
+ acpi_video_device_lcd_get_level_current(video, &level);
+@@ -410,7 +410,7 @@ static struct thermal_cooling_device_ops video_cooling_ops = {
+ /* device */
+
+ static int
+-acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
++acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state)
+ {
+ int status;
+
+@@ -421,7 +421,7 @@ acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
+
+ static int
+ acpi_video_device_get_state(struct acpi_video_device *device,
+- unsigned long *state)
++ unsigned long long *state)
+ {
+ int status;
+
+@@ -436,7 +436,7 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state)
+ int status;
+ union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+ struct acpi_object_list args = { 1, &arg0 };
+- unsigned long ret;
++ unsigned long long ret;
+
+
+ arg0.integer.value = state;
+@@ -482,6 +482,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
+ int status = AE_OK;
+ union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+ struct acpi_object_list args = { 1, &arg0 };
++ int state;
+
+
+ arg0.integer.value = level;
+@@ -490,12 +491,16 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
+ status = acpi_evaluate_object(device->dev->handle, "_BCM",
+ &args, NULL);
+ device->brightness->curr = level;
++ for (state = 2; state < device->brightness->count; state++)
++ if (level == device->brightness->levels[state])
++ device->backlight->props.brightness = state - 2;
++
+ return status;
+ }
+
+ static int
+ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
+- unsigned long *level)
++ unsigned long long *level)
+ {
+ if (device->cap._BQC)
+ return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
+@@ -549,7 +554,7 @@ static int
+ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
+ {
+ int status;
+- unsigned long tmp;
++ unsigned long long tmp;
+ union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+ struct acpi_object_list args = { 1, &arg0 };
+
+@@ -564,7 +569,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
+ }
+
+ static int
+-acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
++acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id)
+ {
+ int status;
+
+@@ -575,7 +580,7 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
+
+ static int
+ acpi_video_bus_POST_options(struct acpi_video_bus *video,
+- unsigned long *options)
++ unsigned long long *options)
+ {
+ int status;
+
+@@ -918,7 +923,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
+ {
+ int status;
+ struct acpi_video_device *dev = seq->private;
+- unsigned long state;
++ unsigned long long state;
+
+
+ if (!dev)
+@@ -927,14 +932,14 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
+ status = acpi_video_device_get_state(dev, &state);
+ seq_printf(seq, "state: ");
+ if (ACPI_SUCCESS(status))
+- seq_printf(seq, "0x%02lx\n", state);
++ seq_printf(seq, "0x%02llx\n", state);
+ else
+ seq_printf(seq, "<not supported>\n");
+
+ status = acpi_video_device_query(dev, &state);
+ seq_printf(seq, "query: ");
+ if (ACPI_SUCCESS(status))
+- seq_printf(seq, "0x%02lx\n", state);
++ seq_printf(seq, "0x%02llx\n", state);
+ else
+ seq_printf(seq, "<not supported>\n");
+
+@@ -1217,7 +1222,7 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
+ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
+ {
+ struct acpi_video_bus *video = seq->private;
+- unsigned long options;
++ unsigned long long options;
+ int status;
+
+
+@@ -1232,7 +1237,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
+ printk(KERN_WARNING PREFIX
+ "This indicates a BIOS bug. Please contact the manufacturer.\n");
+ }
+- printk("%lx\n", options);
++ printk("%llx\n", options);
+ seq_printf(seq, "can POST: <integrated video>");
+ if (options & 2)
+ seq_printf(seq, " <PCI video>");
+@@ -1256,7 +1261,7 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
+ {
+ struct acpi_video_bus *video = seq->private;
+ int status;
+- unsigned long id;
++ unsigned long long id;
+
+
+ if (!video)
+@@ -1303,7 +1308,7 @@ acpi_video_bus_write_POST(struct file *file,
+ struct seq_file *m = file->private_data;
+ struct acpi_video_bus *video = m->private;
+ char str[12] = { 0 };
+- unsigned long opt, options;
++ unsigned long long opt, options;
+
+
+ if (!video || count + 1 > sizeof str)
+@@ -1473,7 +1478,7 @@ static int
+ acpi_video_bus_get_one_device(struct acpi_device *device,
+ struct acpi_video_bus *video)
+ {
+- unsigned long device_id;
++ unsigned long long device_id;
+ int status;
+ struct acpi_video_device *data;
+ struct acpi_video_device_attrib* attribute;
+@@ -1724,7 +1729,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
+ static void
+ acpi_video_switch_brightness(struct acpi_video_device *device, int event)
+ {
+- unsigned long level_current, level_next;
++ unsigned long long level_current, level_next;
+ if (!device->brightness)
+ return;
+ acpi_video_device_lcd_get_level_current(device, &level_current);
+diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
+index 9330b79..ae45187 100644
+--- a/drivers/ata/libata-acpi.c
++++ b/drivers/ata/libata-acpi.c
+@@ -180,7 +180,7 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
+ int wait = 0;
+ unsigned long flags;
+ acpi_handle handle, tmphandle;
+- unsigned long sta;
++ unsigned long long sta;
+ acpi_status status;
+
+ if (dev) {
+diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
+index c815f8e..394cb0c 100644
+--- a/drivers/ata/sata_mv.c
++++ b/drivers/ata/sata_mv.c
+@@ -669,8 +669,8 @@ static const struct pci_device_id mv_pci_tbl[] = {
+ { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
+ /* RocketRAID 1720/174x have different identifiers */
+ { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
+- { PCI_VDEVICE(TTI, 0x1740), chip_508x },
+- { PCI_VDEVICE(TTI, 0x1742), chip_508x },
++ { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
++ { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
+
+ { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
+ { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
+@@ -883,7 +883,7 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio,
+ struct mv_host_priv *hpriv = ap->host->private_data;
+ int hardport = mv_hardport_from_port(ap->port_no);
+ void __iomem *hc_mmio = mv_hc_base_from_port(
+- mv_host_base(ap->host), hardport);
++ mv_host_base(ap->host), ap->port_no);
+ u32 hc_irq_cause, ipending;
+
+ /* clear EDMA event indicators, if any */
+diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
+index 8714c36..89e3b7f 100644
+--- a/drivers/ata/sata_nv.c
++++ b/drivers/ata/sata_nv.c
+@@ -305,10 +305,10 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance);
+ static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
+ static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
+
++static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class,
++ unsigned long deadline);
+ static void nv_nf2_freeze(struct ata_port *ap);
+ static void nv_nf2_thaw(struct ata_port *ap);
+-static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
+- unsigned long deadline);
+ static void nv_ck804_freeze(struct ata_port *ap);
+ static void nv_ck804_thaw(struct ata_port *ap);
+ static int nv_adma_slave_config(struct scsi_device *sdev);
+@@ -352,6 +352,7 @@ enum nv_host_type
+ NFORCE3 = NFORCE2, /* NF2 == NF3 as far as sata_nv is concerned */
+ CK804,
+ ADMA,
++ MCP5x,
+ SWNCQ,
+ };
+
+@@ -363,10 +364,10 @@ static const struct pci_device_id nv_pci_tbl[] = {
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2), CK804 },
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA), CK804 },
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2), CK804 },
+- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), SWNCQ },
+- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), SWNCQ },
+- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), SWNCQ },
+- { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), SWNCQ },
++ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA), MCP5x },
++ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2), MCP5x },
++ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA), MCP5x },
++ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2), MCP5x },
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC },
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC },
+ { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC },
+@@ -432,14 +433,19 @@ static struct ata_port_operations nv_nf2_ops = {
+ .inherits = &nv_common_ops,
+ .freeze = nv_nf2_freeze,
+ .thaw = nv_nf2_thaw,
+- .hardreset = nv_nf2_hardreset,
++ .hardreset = nv_noclassify_hardreset,
+ };
+
+-/* CK804 finally gets hardreset right */
++/* For initial probing after boot and hot plugging, hardreset mostly
++ * works fine on CK804 but curiously, reprobing on the initial port by
++ * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS
++ * in somewhat undeterministic way. Use noclassify hardreset.
++ */
+ static struct ata_port_operations nv_ck804_ops = {
+ .inherits = &nv_common_ops,
+ .freeze = nv_ck804_freeze,
+ .thaw = nv_ck804_thaw,
++ .hardreset = nv_noclassify_hardreset,
+ .host_stop = nv_ck804_host_stop,
+ };
+
+@@ -467,8 +473,19 @@ static struct ata_port_operations nv_adma_ops = {
+ .host_stop = nv_adma_host_stop,
+ };
+
++/* Kernel bz#12351 reports that when SWNCQ is enabled, for hotplug to
++ * work, hardreset should be used and hardreset can't report proper
++ * signature, which suggests that mcp5x is closer to nf2 as long as
++ * reset quirkiness is concerned. Define separate ops for mcp5x with
++ * nv_noclassify_hardreset().
++ */
++static struct ata_port_operations nv_mcp5x_ops = {
++ .inherits = &nv_common_ops,
++ .hardreset = nv_noclassify_hardreset,
++};
++
+ static struct ata_port_operations nv_swncq_ops = {
+- .inherits = &nv_generic_ops,
++ .inherits = &nv_mcp5x_ops,
+
+ .qc_defer = ata_std_qc_defer,
+ .qc_prep = nv_swncq_qc_prep,
+@@ -531,6 +548,15 @@ static const struct ata_port_info nv_port_info[] = {
+ .port_ops = &nv_adma_ops,
+ .private_data = NV_PI_PRIV(nv_adma_interrupt, &nv_adma_sht),
+ },
++ /* MCP5x */
++ {
++ .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
++ .pio_mask = NV_PIO_MASK,
++ .mwdma_mask = NV_MWDMA_MASK,
++ .udma_mask = NV_UDMA_MASK,
++ .port_ops = &nv_mcp5x_ops,
++ .private_data = NV_PI_PRIV(nv_generic_interrupt, &nv_sht),
++ },
+ /* SWNCQ */
+ {
+ .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+@@ -1530,6 +1556,17 @@ static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
+ return 0;
+ }
+
++static int nv_noclassify_hardreset(struct ata_link *link, unsigned int *class,
++ unsigned long deadline)
++{
++ bool online;
++ int rc;
++
++ rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
++ &online, NULL);
++ return online ? -EAGAIN : rc;
++}
++
+ static void nv_nf2_freeze(struct ata_port *ap)
+ {
+ void __iomem *scr_addr = ap->host->ports[0]->ioaddr.scr_addr;
+@@ -1554,17 +1591,6 @@ static void nv_nf2_thaw(struct ata_port *ap)
+ iowrite8(mask, scr_addr + NV_INT_ENABLE);
+ }
+
+-static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class,
+- unsigned long deadline)
+-{
+- bool online;
+- int rc;
+-
+- rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline,
+- &online, NULL);
+- return online ? -EAGAIN : rc;
+-}
+-
+ static void nv_ck804_freeze(struct ata_port *ap)
+ {
+ void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR];
+@@ -2355,14 +2381,9 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
+ if (type == CK804 && adma_enabled) {
+ dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n");
+ type = ADMA;
+- }
+-
+- if (type == SWNCQ) {
+- if (swncq_enabled)
+- dev_printk(KERN_NOTICE, &pdev->dev,
+- "Using SWNCQ mode\n");
+- else
+- type = GENERIC;
++ } else if (type == MCP5x && swncq_enabled) {
++ dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n");
++ type = SWNCQ;
+ }
+
+ ppi[0] = &nv_port_info[type];
+diff --git a/drivers/char/selection.c b/drivers/char/selection.c
+index 2978a49..caf3fa2 100644
+--- a/drivers/char/selection.c
++++ b/drivers/char/selection.c
+@@ -268,7 +268,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
+
+ /* Allocate a new buffer before freeing the old one ... */
+ multiplier = use_unicode ? 3 : 1; /* chars can take up to 3 bytes */
+- bp = kmalloc((sel_end-sel_start)/2*multiplier+1, GFP_KERNEL);
++ bp = kmalloc(((sel_end-sel_start)/2+1)*multiplier, GFP_KERNEL);
+ if (!bp) {
+ printk(KERN_WARNING "selection: kmalloc() failed\n");
+ clear_selection();
+diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
+index 5ce07b5..bb6e3b3 100644
+--- a/drivers/cpuidle/cpuidle.c
++++ b/drivers/cpuidle/cpuidle.c
+@@ -56,7 +56,11 @@ static void cpuidle_idle_call(void)
+ if (pm_idle_old)
+ pm_idle_old();
+ else
++#if defined(CONFIG_ARCH_HAS_DEFAULT_IDLE)
++ default_idle();
++#else
+ local_irq_enable();
++#endif
+ return;
+ }
+
+@@ -67,8 +71,11 @@ static void cpuidle_idle_call(void)
+ target_state = &dev->states[next_state];
+
+ /* enter the state and update stats */
+- dev->last_residency = target_state->enter(dev, target_state);
+ dev->last_state = target_state;
++ dev->last_residency = target_state->enter(dev, target_state);
++ if (dev->last_state)
++ target_state = dev->last_state;
++
+ target_state->time += (unsigned long long)dev->last_residency;
+ target_state->usage++;
+
+diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
+index 8d7cf3f..f1df59f 100644
+--- a/drivers/cpuidle/governors/menu.c
++++ b/drivers/cpuidle/governors/menu.c
+@@ -15,12 +15,14 @@
+ #include <linux/tick.h>
+
+ #define BREAK_FUZZ 4 /* 4 us */
++#define PRED_HISTORY_PCT 50
+
+ struct menu_device {
+ int last_state_idx;
+
+ unsigned int expected_us;
+ unsigned int predicted_us;
++ unsigned int current_predicted_us;
+ unsigned int last_measured_us;
+ unsigned int elapsed_us;
+ };
+@@ -47,6 +49,12 @@ static int menu_select(struct cpuidle_device *dev)
+ data->expected_us =
+ (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000;
+
++ /* Recalculate predicted_us based on prediction_history_pct */
++ data->predicted_us *= PRED_HISTORY_PCT;
++ data->predicted_us += (100 - PRED_HISTORY_PCT) *
++ data->current_predicted_us;
++ data->predicted_us /= 100;
++
+ /* find the deepest idle state that satisfies our constraints */
+ for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) {
+ struct cpuidle_state *s = &dev->states[i];
+@@ -97,7 +105,7 @@ static void menu_reflect(struct cpuidle_device *dev)
+ measured_us = -1;
+
+ /* Predict time until next break event */
+- data->predicted_us = max(measured_us, data->last_measured_us);
++ data->current_predicted_us = max(measured_us, data->last_measured_us);
+
+ if (last_idle_us + BREAK_FUZZ <
+ data->expected_us - target->exit_latency) {
+diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
+index c694eaa..191f01b 100644
+--- a/drivers/input/keyboard/atkbd.c
++++ b/drivers/input/keyboard/atkbd.c
+@@ -884,6 +884,22 @@ static void atkbd_inventec_keymap_fixup(struct atkbd *atkbd)
+ }
+
+ /*
++ * Samsung NC10 with Fn+F? key release not working
++ */
++static void atkbd_samsung_keymap_fixup(struct atkbd *atkbd)
++{
++ const unsigned int forced_release_keys[] = {
++ 0x82, 0x83, 0x84, 0x86, 0x88, 0x89, 0xb3, 0xf7, 0xf9,
++ };
++ int i;
++
++ if (atkbd->set == 2)
++ for (i = 0; i < ARRAY_SIZE(forced_release_keys); i++)
++ __set_bit(forced_release_keys[i],
++ atkbd->force_release_mask);
++}
++
++/*
+ * atkbd_set_keycode_table() initializes keyboard's keycode table
+ * according to the selected scancode set
+ */
+@@ -1486,6 +1502,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
+ .driver_data = atkbd_dell_laptop_keymap_fixup,
+ },
+ {
++ .ident = "Dell Laptop",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
++ DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
++ },
++ .callback = atkbd_setup_fixup,
++ .driver_data = atkbd_dell_laptop_keymap_fixup,
++ },
++ {
+ .ident = "HP 2133",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+@@ -1503,6 +1528,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
+ .callback = atkbd_setup_fixup,
+ .driver_data = atkbd_inventec_keymap_fixup,
+ },
++ {
++ .ident = "Samsung NC10",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
++ DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
++ },
++ .callback = atkbd_setup_fixup,
++ .driver_data = atkbd_samsung_keymap_fixup,
++ },
+ { }
+ };
+
+diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
+index 7c6dfd0..95965a7 100644
+--- a/drivers/misc/asus-laptop.c
++++ b/drivers/misc/asus-laptop.c
+@@ -139,6 +139,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */
+ "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */
+ "\\_SB.PCI0.PX40.EC0.Q10", /* M1A */
+ "\\_SB.PCI0.LPCB.EC0._Q10", /* P30 */
++ "\\_SB.PCI0.LPCB.EC0._Q0E", /* P30/P35 */
+ "\\_SB.PCI0.PX40.Q10", /* S1x */
+ "\\Q10"); /* A2x, L2D, L3D, M2E */
+
+@@ -280,7 +281,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
+
+ static int read_wireless_status(int mask)
+ {
+- ulong status;
++ unsigned long long status;
+ acpi_status rv = AE_OK;
+
+ if (!wireless_status_handle)
+@@ -297,7 +298,7 @@ static int read_wireless_status(int mask)
+
+ static int read_gps_status(void)
+ {
+- ulong status;
++ unsigned long long status;
+ acpi_status rv = AE_OK;
+
+ rv = acpi_evaluate_integer(gps_status_handle, NULL, NULL, &status);
+@@ -350,7 +351,7 @@ static void write_status(acpi_handle handle, int out, int mask)
+ static void object##_led_set(struct led_classdev *led_cdev, \
+ enum led_brightness value) \
+ { \
+- object##_led_wk = value; \
++ object##_led_wk = (value > 0) ? 1 : 0; \
+ queue_work(led_workqueue, &object##_led_work); \
+ } \
+ static void object##_led_update(struct work_struct *ignored) \
+@@ -404,7 +405,7 @@ static void lcd_blank(int blank)
+
+ static int read_brightness(struct backlight_device *bd)
+ {
+- ulong value;
++ unsigned long long value;
+ acpi_status rv = AE_OK;
+
+ rv = acpi_evaluate_integer(brightness_get_handle, NULL, NULL, &value);
+@@ -455,7 +456,7 @@ static ssize_t show_infos(struct device *dev,
+ struct device_attribute *attr, char *page)
+ {
+ int len = 0;
+- ulong temp;
++ unsigned long long temp;
+ char buf[16]; //enough for all info
+ acpi_status rv = AE_OK;
+
+@@ -603,7 +604,7 @@ static void set_display(int value)
+
+ static int read_display(void)
+ {
+- ulong value = 0;
++ unsigned long long value = 0;
+ acpi_status rv = AE_OK;
+
+ /* In most of the case, we know how to set the display, but sometime
+@@ -849,7 +850,7 @@ static int asus_hotk_get_info(void)
+ {
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *model = NULL;
+- ulong bsts_result, hwrs_result;
++ unsigned long long bsts_result, hwrs_result;
+ char *string = NULL;
+ acpi_status status;
+
+diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
+index 1ee8501..616bcbd 100644
+--- a/drivers/misc/eeepc-laptop.c
++++ b/drivers/misc/eeepc-laptop.c
+@@ -204,7 +204,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
+ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
+ {
+ acpi_status status;
+- ulong result;
++ unsigned long long result;
+
+ status = acpi_evaluate_integer(handle, (char *)method, NULL, &result);
+ if (ACPI_FAILURE(status)) {
+diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c
+index 3e56203..efd395a 100644
+--- a/drivers/misc/fujitsu-laptop.c
++++ b/drivers/misc/fujitsu-laptop.c
+@@ -224,7 +224,7 @@ static int set_lcd_level_alt(int level)
+
+ static int get_lcd_level(void)
+ {
+- unsigned long state = 0;
++ unsigned long long state = 0;
+ acpi_status status = AE_OK;
+
+ vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n");
+@@ -246,7 +246,7 @@ static int get_lcd_level(void)
+
+ static int get_max_brightness(void)
+ {
+- unsigned long state = 0;
++ unsigned long long state = 0;
+ acpi_status status = AE_OK;
+
+ vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n");
+@@ -263,7 +263,7 @@ static int get_max_brightness(void)
+
+ static int get_lcd_level_alt(void)
+ {
+- unsigned long state = 0;
++ unsigned long long state = 0;
+ acpi_status status = AE_OK;
+
+ vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLS\n");
+@@ -384,7 +384,7 @@ static ssize_t store_lcd_level(struct device *dev,
+
+ static int get_irb(void)
+ {
+- unsigned long state = 0;
++ unsigned long long state = 0;
+ acpi_status status = AE_OK;
+
+ vdbg_printk(FUJLAPTOP_DBG_TRACE, "Get irb\n");
+diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
+index 80a1363..f2257a7 100644
+--- a/drivers/misc/intel_menlow.c
++++ b/drivers/misc/intel_menlow.c
+@@ -57,7 +57,7 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
+ {
+ struct acpi_device *device = cdev->devdata;
+ acpi_handle handle = device->handle;
+- unsigned long value;
++ unsigned long long value;
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
+ acpi_status status = AE_OK;
+@@ -90,7 +90,7 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev,
+ {
+ struct acpi_device *device = cdev->devdata;
+ acpi_handle handle = device->handle;
+- unsigned long value;
++ unsigned long long value;
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
+ acpi_status status = AE_OK;
+@@ -104,7 +104,7 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev,
+ if (ACPI_FAILURE(status))
+ return -EFAULT;
+
+- return sprintf(buf, "%ld\n", value);
++ return sprintf(buf, "%lld\n", value);
+ }
+
+ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
+@@ -115,7 +115,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
+ struct acpi_object_list arg_list;
+ union acpi_object arg;
+ acpi_status status;
+- int temp;
++ unsigned long long temp;
+ unsigned long max_state;
+
+ if (memory_get_int_max_bandwidth(cdev, &max_state))
+@@ -131,7 +131,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
+
+ status =
+ acpi_evaluate_integer(handle, MEMORY_SET_BANDWIDTH, &arg_list,
+- (unsigned long *)&temp);
++ &temp);
+
+ printk(KERN_INFO
+ "Bandwidth value was %d: status is %d\n", state, status);
+@@ -252,7 +252,8 @@ static DEFINE_MUTEX(intel_menlow_attr_lock);
+ * @auxtype : AUX0/AUX1
+ * @buf: syfs buffer
+ */
+-static int sensor_get_auxtrip(acpi_handle handle, int index, int *value)
++static int sensor_get_auxtrip(acpi_handle handle, int index,
++ unsigned long long *value)
+ {
+ acpi_status status;
+
+@@ -260,7 +261,7 @@ static int sensor_get_auxtrip(acpi_handle handle, int index, int *value)
+ return -EINVAL;
+
+ status = acpi_evaluate_integer(handle, index ? GET_AUX1 : GET_AUX0,
+- NULL, (unsigned long *)value);
++ NULL, value);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+@@ -282,13 +283,13 @@ static int sensor_set_auxtrip(acpi_handle handle, int index, int value)
+ struct acpi_object_list args = {
+ 1, &arg
+ };
+- int temp;
++ unsigned long long temp;
+
+ if (index != 0 && index != 1)
+ return -EINVAL;
+
+ status = acpi_evaluate_integer(handle, index ? GET_AUX0 : GET_AUX1,
+- NULL, (unsigned long *)&temp);
++ NULL, &temp);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+ if ((index && value < temp) || (!index && value > temp))
+@@ -296,7 +297,7 @@ static int sensor_set_auxtrip(acpi_handle handle, int index, int value)
+
+ arg.integer.value = value;
+ status = acpi_evaluate_integer(handle, index ? SET_AUX1 : SET_AUX0,
+- &args, (unsigned long *)&temp);
++ &args, &temp);
+ if (ACPI_FAILURE(status))
+ return -EIO;
+
+@@ -312,7 +313,7 @@ static ssize_t aux0_show(struct device *dev,
+ struct device_attribute *dev_attr, char *buf)
+ {
+ struct intel_menlow_attribute *attr = to_intel_menlow_attr(dev_attr);
+- int value;
++ unsigned long long value;
+ int result;
+
+ result = sensor_get_auxtrip(attr->handle, 0, &value);
+@@ -324,7 +325,7 @@ static ssize_t aux1_show(struct device *dev,
+ struct device_attribute *dev_attr, char *buf)
+ {
+ struct intel_menlow_attribute *attr = to_intel_menlow_attr(dev_attr);
+- int value;
++ unsigned long long value;
+ int result;
+
+ result = sensor_get_auxtrip(attr->handle, 1, &value);
+@@ -376,7 +377,7 @@ static ssize_t bios_enabled_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+ acpi_status status;
+- unsigned long bios_enabled;
++ unsigned long long bios_enabled;
+
+ status = acpi_evaluate_integer(NULL, BIOS_ENABLED, NULL, &bios_enabled);
+ if (ACPI_FAILURE(status))
+@@ -492,7 +493,7 @@ static int __init intel_menlow_module_init(void)
+ {
+ int result = -ENODEV;
+ acpi_status status;
+- unsigned long enable;
++ unsigned long long enable;
+
+ if (acpi_disabled)
+ return result;
+diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
+index aa75385..be3c7dc 100644
+--- a/drivers/net/ixgb/ixgb_main.c
++++ b/drivers/net/ixgb/ixgb_main.c
+@@ -977,15 +977,17 @@ ixgb_clean_rx_ring(struct ixgb_adapter *adapter)
+
+ for (i = 0; i < rx_ring->count; i++) {
+ buffer_info = &rx_ring->buffer_info[i];
+- if (buffer_info->skb) {
+-
++ if (buffer_info->dma) {
+ pci_unmap_single(pdev,
+ buffer_info->dma,
+ buffer_info->length,
+ PCI_DMA_FROMDEVICE);
++ buffer_info->dma = 0;
++ buffer_info->length = 0;
++ }
+
++ if (buffer_info->skb) {
+ dev_kfree_skb(buffer_info->skb);
+-
+ buffer_info->skb = NULL;
+ }
+ }
+diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
+index a3e4705..3baee56 100644
+--- a/drivers/pci/hotplug/acpiphp_glue.c
++++ b/drivers/pci/hotplug/acpiphp_glue.c
+@@ -180,7 +180,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
+ struct acpiphp_func *newfunc;
+ acpi_handle tmp;
+ acpi_status status = AE_OK;
+- unsigned long adr, sun;
++ unsigned long long adr, sun;
+ int device, function, retval;
+
+ status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
+@@ -528,7 +528,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+ acpi_status status;
+ acpi_handle dummy_handle;
+- unsigned long tmp;
++ unsigned long long tmp;
+ int device, function;
+ struct pci_dev *dev;
+ struct pci_bus *pci_bus = context;
+@@ -573,7 +573,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
+ static int add_bridge(acpi_handle handle)
+ {
+ acpi_status status;
+- unsigned long tmp;
++ unsigned long long tmp;
+ int seg, bus;
+ acpi_handle dummy_handle;
+ struct pci_bus *pci_bus;
+@@ -767,7 +767,7 @@ static int get_gsi_base(acpi_handle handle, u32 *gsi_base)
+ {
+ acpi_status status;
+ int result = -1;
+- unsigned long gsb;
++ unsigned long long gsb;
+ struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+ union acpi_object *obj;
+ void *table;
+@@ -808,7 +808,7 @@ static acpi_status
+ ioapic_add(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+ acpi_status status;
+- unsigned long sta;
++ unsigned long long sta;
+ acpi_handle tmp;
+ struct pci_dev *pdev;
+ u32 gsi_base;
+@@ -872,7 +872,7 @@ static acpi_status
+ ioapic_remove(acpi_handle handle, u32 lvl, void *context, void **rv)
+ {
+ acpi_status status;
+- unsigned long sta;
++ unsigned long long sta;
+ acpi_handle tmp;
+ u32 gsi_base;
+ struct acpiphp_ioapic *pos, *n, *ioapic = NULL;
+@@ -1264,7 +1264,7 @@ static int disable_device(struct acpiphp_slot *slot)
+ static unsigned int get_slot_status(struct acpiphp_slot *slot)
+ {
+ acpi_status status;
+- unsigned long sta = 0;
++ unsigned long long sta = 0;
+ u32 dvid;
+ struct list_head *l;
+ struct acpiphp_func *func;
+diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
+index 2b7c45e..881fdd2 100644
+--- a/drivers/pci/hotplug/acpiphp_ibm.c
++++ b/drivers/pci/hotplug/acpiphp_ibm.c
+@@ -183,7 +183,7 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
+ union acpi_object args[2];
+ struct acpi_object_list params = { .pointer = args, .count = 2 };
+ acpi_status stat;
+- unsigned long rc;
++ unsigned long long rc;
+ union apci_descriptor *ibm_slot;
+
+ ibm_slot = ibm_slot_from_id(hpslot_to_sun(slot));
+@@ -204,7 +204,7 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
+ err("APLS evaluation failed: 0x%08x\n", stat);
+ return -ENODEV;
+ } else if (!rc) {
+- err("APLS method failed: 0x%08lx\n", rc);
++ err("APLS method failed: 0x%08llx\n", rc);
+ return -ERANGE;
+ }
+ return 0;
+diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
+index d748698..3eee709 100644
+--- a/drivers/pci/hotplug/sgi_hotplug.c
++++ b/drivers/pci/hotplug/sgi_hotplug.c
+@@ -413,7 +413,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
+ /*
+ * Add the slot's devices to the ACPI infrastructure */
+ if (SN_ACPI_BASE_SUPPORT() && ssdt) {
+- unsigned long adr;
++ unsigned long long adr;
+ struct acpi_device *pdevice;
+ struct acpi_device *device;
+ acpi_handle phandle;
+@@ -505,7 +505,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
+ /* free the ACPI resources for the slot */
+ if (SN_ACPI_BASE_SUPPORT() &&
+ PCI_CONTROLLER(slot->pci_bus)->acpi_handle) {
+- unsigned long adr;
++ unsigned long long adr;
+ struct acpi_device *device;
+ acpi_handle phandle;
+ acpi_handle chandle = NULL;
+diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
+index a697914..3fc7e0f 100644
+--- a/drivers/serial/jsm/jsm_tty.c
++++ b/drivers/serial/jsm/jsm_tty.c
+@@ -161,6 +161,11 @@ static void jsm_tty_stop_rx(struct uart_port *port)
+ channel->ch_bd->bd_ops->disable_receiver(channel);
+ }
+
++static void jsm_tty_enable_ms(struct uart_port *port)
++{
++ /* Nothing needed */
++}
++
+ static void jsm_tty_break(struct uart_port *port, int break_state)
+ {
+ unsigned long lock_flags;
+@@ -345,6 +350,7 @@ static struct uart_ops jsm_ops = {
+ .start_tx = jsm_tty_start_tx,
+ .send_xchar = jsm_tty_send_xchar,
+ .stop_rx = jsm_tty_stop_rx,
++ .enable_ms = jsm_tty_enable_ms,
+ .break_ctl = jsm_tty_break,
+ .startup = jsm_tty_open,
+ .shutdown = jsm_tty_close,
+diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
+index d8b0ba5..9c4a76a 100644
+--- a/drivers/usb/host/isp1760-if.c
++++ b/drivers/usb/host/isp1760-if.c
+@@ -129,23 +129,23 @@ static struct of_platform_driver isp1760_of_driver = {
+ #endif
+
+ #ifdef CONFIG_PCI
+-static u32 nxp_pci_io_base;
+-static u32 iolength;
+-static u32 pci_mem_phy0;
+-static u32 length;
+-static u8 __iomem *chip_addr;
+-static u8 __iomem *iobase;
+-
+ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
+ const struct pci_device_id *id)
+ {
+ u8 latency, limit;
+ __u32 reg_data;
+ int retry_count;
+- int length;
+- int status = 1;
+ struct usb_hcd *hcd;
+ unsigned int devflags = 0;
++ int ret_status = 0;
++
++ resource_size_t pci_mem_phy0;
++ resource_size_t memlength;
++
++ u8 __iomem *chip_addr;
++ u8 __iomem *iobase;
++ resource_size_t nxp_pci_io_base;
++ resource_size_t iolength;
+
+ if (usb_disabled())
+ return -ENODEV;
+@@ -168,26 +168,30 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
+ iobase = ioremap_nocache(nxp_pci_io_base, iolength);
+ if (!iobase) {
+ printk(KERN_ERR "ioremap #1\n");
+- release_mem_region(nxp_pci_io_base, iolength);
+- return -ENOMEM;
++ ret_status = -ENOMEM;
++ goto cleanup1;
+ }
+ /* Grab the PLX PCI shared memory of the ISP 1761 we need */
+ pci_mem_phy0 = pci_resource_start(dev, 3);
+- length = pci_resource_len(dev, 3);
+-
+- if (length < 0xffff) {
+- printk(KERN_ERR "memory length for this resource is less than "
+- "required\n");
+- release_mem_region(nxp_pci_io_base, iolength);
+- iounmap(iobase);
+- return -ENOMEM;
++ memlength = pci_resource_len(dev, 3);
++ if (memlength < 0xffff) {
++ printk(KERN_ERR "memory length for this resource is wrong\n");
++ ret_status = -ENOMEM;
++ goto cleanup2;
+ }
+
+- if (!request_mem_region(pci_mem_phy0, length, "ISP-PCI")) {
++ if (!request_mem_region(pci_mem_phy0, memlength, "ISP-PCI")) {
+ printk(KERN_ERR "host controller already in use\n");
+- release_mem_region(nxp_pci_io_base, iolength);
+- iounmap(iobase);
+- return -EBUSY;
++ ret_status = -EBUSY;
++ goto cleanup2;
++ }
++
++ /* map available memory */
++ chip_addr = ioremap_nocache(pci_mem_phy0,memlength);
++ if (!chip_addr) {
++ printk(KERN_ERR "Error ioremap failed\n");
++ ret_status = -ENOMEM;
++ goto cleanup3;
+ }
+
+ /* bad pci latencies can contribute to overruns */
+@@ -210,38 +214,54 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
+ * */
+ writel(0xface, chip_addr + HC_SCRATCH_REG);
+ udelay(100);
+- reg_data = readl(chip_addr + HC_SCRATCH_REG);
++ reg_data = readl(chip_addr + HC_SCRATCH_REG) & 0x0000ffff;
+ retry_count--;
+ }
+
++ iounmap(chip_addr);
++
+ /* Host Controller presence is detected by writing to scratch register
+ * and reading back and checking the contents are same or not
+ */
+ if (reg_data != 0xFACE) {
+ err("scratch register mismatch %x", reg_data);
+- goto clean;
++ ret_status = -ENOMEM;
++ goto cleanup3;
+ }
+
+ pci_set_master(dev);
+
+- status = readl(iobase + 0x68);
+- status |= 0x900;
+- writel(status, iobase + 0x68);
++ /* configure PLX PCI chip to pass interrupts */
++#define PLX_INT_CSR_REG 0x68
++ reg_data = readl(iobase + PLX_INT_CSR_REG);
++ reg_data |= 0x900;
++ writel(reg_data, iobase + PLX_INT_CSR_REG);
+
+ dev->dev.dma_mask = NULL;
+- hcd = isp1760_register(pci_mem_phy0, length, dev->irq,
++ hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq,
+ IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev),
+ devflags);
++ if (IS_ERR(hcd)) {
++ ret_status = -ENODEV;
++ goto cleanup3;
++ }
++
++ /* done with PLX IO access */
++ iounmap(iobase);
++ release_mem_region(nxp_pci_io_base, iolength);
++
+ pci_set_drvdata(dev, hcd);
+- if (!hcd)
+- return 0;
+-clean:
+- status = -ENODEV;
++ return 0;
++
++cleanup3:
++ release_mem_region(pci_mem_phy0, memlength);
++cleanup2:
+ iounmap(iobase);
+- release_mem_region(pci_mem_phy0, length);
++cleanup1:
+ release_mem_region(nxp_pci_io_base, iolength);
+- return status;
++ return ret_status;
+ }
++
+ static void isp1761_pci_remove(struct pci_dev *dev)
+ {
+ struct usb_hcd *hcd;
+@@ -254,12 +274,6 @@ static void isp1761_pci_remove(struct pci_dev *dev)
+ usb_put_hcd(hcd);
+
+ pci_disable_device(dev);
+-
+- iounmap(iobase);
+- iounmap(chip_addr);
+-
+- release_mem_region(nxp_pci_io_base, iolength);
+- release_mem_region(pci_mem_phy0, length);
+ }
+
+ static void isp1761_pci_shutdown(struct pci_dev *dev)
+diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c
+index c50c7cf..2745b85 100644
+--- a/drivers/video/aty/mach64_ct.c
++++ b/drivers/video/aty/mach64_ct.c
+@@ -8,6 +8,9 @@
+ #include <asm/io.h>
+ #include <video/mach64.h>
+ #include "atyfb.h"
++#ifdef CONFIG_PPC
++#include <asm/machdep.h>
++#endif
+
+ #undef DEBUG
+
+@@ -536,6 +539,14 @@ static int __devinit aty_init_pll_ct(const struct fb_info *info,
+ pll->ct.xclk_post_div_real = postdividers[xpost_div];
+ pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8;
+
++#ifdef CONFIG_PPC
++ if (machine_is(powermac)) {
++ /* Override PLL_EXT_CNTL & 0x07. */
++ pll->ct.xclk_post_div = xpost_div;
++ pll->ct.xclk_ref_div = 1;
++ }
++#endif
++
+ #ifdef DEBUG
+ pllmclk = (1000000 * pll->ct.mclk_fb_mult * pll->ct.mclk_fb_div) /
+ (par->ref_clk_per * pll->ct.pll_ref_div);
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
+index 223647f..f254235 100644
+--- a/fs/cifs/connect.c
++++ b/fs/cifs/connect.c
+@@ -1349,7 +1349,7 @@ cifs_parse_mount_options(char *options, const char *devname,
+ }
+
+ static struct TCP_Server_Info *
+-cifs_find_tcp_session(struct sockaddr *addr)
++cifs_find_tcp_session(struct sockaddr_storage *addr)
+ {
+ struct list_head *tmp;
+ struct TCP_Server_Info *server;
+@@ -1369,11 +1369,11 @@ cifs_find_tcp_session(struct sockaddr *addr)
+ if (server->tcpStatus == CifsNew)
+ continue;
+
+- if (addr->sa_family == AF_INET &&
++ if (addr->ss_family == AF_INET &&
+ (addr4->sin_addr.s_addr !=
+ server->addr.sockAddr.sin_addr.s_addr))
+ continue;
+- else if (addr->sa_family == AF_INET6 &&
++ else if (addr->ss_family == AF_INET6 &&
+ memcmp(&server->addr.sockAddr6.sin6_addr,
+ &addr6->sin6_addr, sizeof(addr6->sin6_addr)))
+ continue;
+@@ -2027,7 +2027,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
+ int rc = 0;
+ int xid;
+ struct socket *csocket = NULL;
+- struct sockaddr addr;
++ struct sockaddr_storage addr;
+ struct sockaddr_in *sin_server = (struct sockaddr_in *) &addr;
+ struct sockaddr_in6 *sin_server6 = (struct sockaddr_in6 *) &addr;
+ struct smb_vol volume_info;
+@@ -2039,7 +2039,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
+
+ /* cFYI(1, ("Entering cifs_mount. Xid: %d with: %s", xid, mount_data)); */
+
+- memset(&addr, 0, sizeof(struct sockaddr));
++ memset(&addr, 0, sizeof(struct sockaddr_storage));
+ memset(&volume_info, 0, sizeof(struct smb_vol));
+ if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
+ rc = -EINVAL;
+@@ -2069,9 +2069,9 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
+ rc = cifs_inet_pton(AF_INET6, volume_info.UNCip,
+ &sin_server6->sin6_addr.in6_u);
+ if (rc > 0)
+- addr.sa_family = AF_INET6;
++ addr.ss_family = AF_INET6;
+ } else {
+- addr.sa_family = AF_INET;
++ addr.ss_family = AF_INET;
+ }
+
+ if (rc <= 0) {
+@@ -2113,7 +2113,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
+
+ srvTcp = cifs_find_tcp_session(&addr);
+ if (!srvTcp) { /* create socket */
+- if (addr.sa_family == AF_INET6) {
++ if (addr.ss_family == AF_INET6) {
+ cFYI(1, ("attempting ipv6 connect"));
+ /* BB should we allow ipv6 on port 139? */
+ /* other OS never observed in Wild doing 139 with v6 */
+@@ -2144,7 +2144,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
+ } else {
+ srvTcp->noblocksnd = volume_info.noblocksnd;
+ srvTcp->noautotune = volume_info.noautotune;
+- if (addr.sa_family == AF_INET6)
++ if (addr.ss_family == AF_INET6)
+ memcpy(&srvTcp->addr.sockAddr6, sin_server6,
+ sizeof(struct sockaddr_in6));
+ else
+diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
+index eba87ff..ca46f11 100644
+--- a/fs/dlm/plock.c
++++ b/fs/dlm/plock.c
+@@ -304,7 +304,9 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
+ if (rv == -ENOENT)
+ rv = 0;
+ else if (rv > 0) {
++ locks_init_lock(fl);
+ fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
++ fl->fl_flags = FL_POSIX;
+ fl->fl_pid = op->info.pid;
+ fl->fl_start = op->info.start;
+ fl->fl_end = op->info.end;
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index 1578d7a..ddcbed8 100644
+--- 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, struct nfsd4_compound_state *cstate,
+ struct nfsd4_lockt *lockt)
+ {
+ struct inode *inode;
+- struct file file;
+ struct file_lock file_lock;
+ int error;
+ __be32 status;
+@@ -2822,7 +2840,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+ file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner;
+ file_lock.fl_pid = current->tgid;
+ file_lock.fl_flags = FL_POSIX;
+- file_lock.fl_lmops = &nfsd_posix_mng_ops;
+
+ file_lock.fl_start = lockt->lt_offset;
+ if ((lockt->lt_length == ~(u64)0) || LOFF_OVERFLOW(lockt->lt_offset, lockt->lt_length))
+@@ -2832,16 +2849,8 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+
+ 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;
+diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
+index a5ac0bc..c52f10d 100644
+--- a/include/acpi/acpi_bus.h
++++ b/include/acpi/acpi_bus.h
+@@ -46,7 +46,7 @@ acpi_extract_package(union acpi_object *package,
+ acpi_status
+ acpi_evaluate_integer(acpi_handle handle,
+ acpi_string pathname,
+- struct acpi_object_list *arguments, unsigned long *data);
++ struct acpi_object_list *arguments, unsigned long long *data);
+ acpi_status
+ acpi_evaluate_reference(acpi_handle handle,
+ acpi_string pathname,
+diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
+index 4ea4f40..73d6b1c 100644
+--- a/include/acpi/actypes.h
++++ b/include/acpi/actypes.h
+@@ -1225,8 +1225,8 @@ struct acpi_resource {
+
+ #pragma pack()
+
+-#define ACPI_RS_SIZE_MIN 12
+ #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
++#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
+ #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
+
+ #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
+diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
+index 9e7b49b..a5cb0c3 100644
+--- a/include/linux/if_vlan.h
++++ b/include/linux/if_vlan.h
+@@ -114,6 +114,8 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
+
+ extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ u16 vlan_tci, int polling);
++extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
++
+ #else
+ static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
+ {
+@@ -133,6 +135,11 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ BUG();
+ return NET_XMIT_SUCCESS;
+ }
++
++static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
++{
++ return 0;
++}
+ #endif
+
+ /**
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
+index 391cbf3..26b59cb 100644
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -2384,6 +2384,7 @@
+ #define PCI_DEVICE_ID_INTEL_ICH7_0 0x27b8
+ #define PCI_DEVICE_ID_INTEL_ICH7_1 0x27b9
+ #define PCI_DEVICE_ID_INTEL_ICH7_30 0x27b0
++#define PCI_DEVICE_ID_INTEL_TGP_LPC 0x27bc
+ #define PCI_DEVICE_ID_INTEL_ICH7_31 0x27bd
+ #define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da
+ #define PCI_DEVICE_ID_INTEL_ICH7_19 0x27dd
+diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
+index 916061f..68ced4b 100644
+--- a/net/8021q/vlan_core.c
++++ b/net/8021q/vlan_core.c
+@@ -3,11 +3,20 @@
+ #include <linux/if_vlan.h>
+ #include "vlan.h"
+
++struct vlan_hwaccel_cb {
++ struct net_device *dev;
++};
++
++static inline struct vlan_hwaccel_cb *vlan_hwaccel_cb(struct sk_buff *skb)
++{
++ return (struct vlan_hwaccel_cb *)skb->cb;
++}
++
+ /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */
+ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ u16 vlan_tci, int polling)
+ {
+- struct net_device_stats *stats;
++ struct vlan_hwaccel_cb *cb = vlan_hwaccel_cb(skb);
+
+ if (skb_bond_should_drop(skb)) {
+ dev_kfree_skb_any(skb);
+@@ -15,23 +24,35 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ }
+
+ skb->vlan_tci = vlan_tci;
++ cb->dev = vlan_group_get_device(grp, vlan_tci & VLAN_VID_MASK);
++
++ return (polling ? netif_receive_skb(skb) : netif_rx(skb));
++}
++EXPORT_SYMBOL(__vlan_hwaccel_rx);
++
++int vlan_hwaccel_do_receive(struct sk_buff *skb)
++{
++ struct vlan_hwaccel_cb *cb = vlan_hwaccel_cb(skb);
++ struct net_device *dev = cb->dev;
++ struct net_device_stats *stats;
++
+ netif_nit_deliver(skb);
+
+- skb->dev = vlan_group_get_device(grp, vlan_tci & VLAN_VID_MASK);
+- if (skb->dev == NULL) {
+- dev_kfree_skb_any(skb);
+- /* Not NET_RX_DROP, this is not being dropped
+- * due to congestion. */
+- return NET_RX_SUCCESS;
++ if (dev == NULL) {
++ kfree_skb(skb);
++ return -1;
+ }
+- skb->dev->last_rx = jiffies;
++
++ skb->dev = dev;
++ skb->priority = vlan_get_ingress_priority(dev, skb->vlan_tci);
+ skb->vlan_tci = 0;
+
+- stats = &skb->dev->stats;
++ dev->last_rx = jiffies;
++
++ stats = &dev->stats;
+ stats->rx_packets++;
+ stats->rx_bytes += skb->len;
+
+- skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tci);
+ switch (skb->pkt_type) {
+ case PACKET_BROADCAST:
+ break;
+@@ -43,13 +64,12 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ * This allows the VLAN to have a different MAC than the
+ * underlying device, and still route correctly. */
+ if (!compare_ether_addr(eth_hdr(skb)->h_dest,
+- skb->dev->dev_addr))
++ dev->dev_addr))
+ skb->pkt_type = PACKET_HOST;
+ break;
+ };
+- return (polling ? netif_receive_skb(skb) : netif_rx(skb));
++ return 0;
+ }
+-EXPORT_SYMBOL(__vlan_hwaccel_rx);
+
+ struct net_device *vlan_dev_real_dev(const struct net_device *dev)
+ {
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 5a25896..f7a30f2 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -2187,6 +2187,9 @@ int netif_receive_skb(struct sk_buff *skb)
+ int ret = NET_RX_DROP;
+ __be16 type;
+
++ if (skb->vlan_tci && vlan_hwaccel_do_receive(skb))
++ return NET_RX_SUCCESS;
++
+ /* if we've gotten here through NAPI, check netpoll */
+ if (netpoll_receive_skb(skb))
+ return NET_RX_DROP;
Added: genpatches-2.6/trunk/2.6.27/1015_linux-2.6.27.16.patch
===================================================================
--- genpatches-2.6/trunk/2.6.27/1015_linux-2.6.27.16.patch (rev 0)
+++ genpatches-2.6/trunk/2.6.27/1015_linux-2.6.27.16.patch 2009-02-20 19:20:18 UTC (rev 1498)
@@ -0,0 +1,2186 @@
+diff --git a/Documentation/filesystems/sysfs-pci.txt b/Documentation/filesystems/sysfs-pci.txt
+index 68ef488..de99749 100644
+--- a/Documentation/filesystems/sysfs-pci.txt
++++ b/Documentation/filesystems/sysfs-pci.txt
+@@ -9,6 +9,7 @@ that support it. For example, a given bus might look like this:
+ | |-- class
+ | |-- config
+ | |-- device
++ | |-- enable
+ | |-- irq
+ | |-- local_cpus
+ | |-- resource
+@@ -32,6 +33,7 @@ files, each with their own function.
+ class PCI class (ascii, ro)
+ config PCI config space (binary, rw)
+ device PCI device (ascii, ro)
++ enable Whether the device is enabled (ascii, rw)
+ irq IRQ number (ascii, ro)
+ local_cpus nearby CPU mask (cpumask, ro)
+ resource PCI resource host addresses (ascii, ro)
+@@ -57,10 +59,19 @@ used to do actual device programming from userspace. Note that some platforms
+ don't support mmapping of certain resources, so be sure to check the return
+ value from any attempted mmap.
+
++The 'enable' file provides a counter that indicates how many times the device
++has been enabled. If the 'enable' file currently returns '4', and a '1' is
++echoed into it, it will then return '5'. Echoing a '0' into it will decrease
++the count. Even when it returns to 0, though, some of the initialisation
++may not be reversed.
++
+ The 'rom' file is special in that it provides read-only access to the device's
+ ROM file, if available. It's disabled by default, however, so applications
+ should write the string "1" to the file to enable it before attempting a read
+-call, and disable it following the access by writing "0" to the file.
++call, and disable it following the access by writing "0" to the file. Note
++that the device must be enabled for a rom read to return data succesfully.
++In the event a driver is not bound to the device, it can be enabled using the
++'enable' file, documented above.
+
+ Accessing legacy resources through sysfs
+ ----------------------------------------
+diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
+index a15baac..0c3f2a0 100644
+--- a/arch/ia64/sn/kernel/io_acpi_init.c
++++ b/arch/ia64/sn/kernel/io_acpi_init.c
+@@ -434,7 +434,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
+ size = pci_resource_len(dev, PCI_ROM_RESOURCE);
+ addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
+ size);
+- image_size = pci_get_rom_size(addr, size);
++ image_size = pci_get_rom_size(dev, addr, size);
+ dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
+ dev->resource[PCI_ROM_RESOURCE].end =
+ (unsigned long) addr + image_size - 1;
+diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
+index c3aa851..1a3ed90 100644
+--- a/arch/ia64/sn/kernel/io_init.c
++++ b/arch/ia64/sn/kernel/io_init.c
+@@ -269,7 +269,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
+
+ rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+ size + 1);
+- image_size = pci_get_rom_size(rom, size + 1);
++ image_size = pci_get_rom_size(dev, rom, size + 1);
+ dev->resource[PCI_ROM_RESOURCE].end =
+ dev->resource[PCI_ROM_RESOURCE].start +
+ image_size - 1;
+diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
+index f88bd0d..ffc633c 100644
+--- a/arch/x86/kernel/apic_32.c
++++ b/arch/x86/kernel/apic_32.c
+@@ -1115,7 +1115,7 @@ static int __init detect_init_APIC(void)
+ switch (boot_cpu_data.x86_vendor) {
+ case X86_VENDOR_AMD:
+ if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) ||
+- (boot_cpu_data.x86 == 15))
++ (boot_cpu_data.x86 >= 15))
+ break;
+ goto no_apic;
+ case X86_VENDOR_INTEL:
+diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+index dd097b8..9943b4c 100644
+--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
++++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+@@ -779,6 +779,9 @@ static int __init acpi_cpufreq_init(void)
+ {
+ int ret;
+
++ if (acpi_disabled)
++ return 0;
++
+ dprintk("acpi_cpufreq_init\n");
+
+ ret = acpi_cpufreq_early_init();
+diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
+index da1973b..3384255 100644
+--- a/arch/x86/mm/fault.c
++++ b/arch/x86/mm/fault.c
+@@ -607,8 +607,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
+
+ si_code = SEGV_MAPERR;
+
+- if (notify_page_fault(regs))
+- return;
+ if (unlikely(kmmio_fault(regs, address)))
+ return;
+
+@@ -638,6 +636,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
+ if (spurious_fault(address, error_code))
+ return;
+
++ /* kprobes don't want to hook the spurious faults. */
++ if (notify_page_fault(regs))
++ return;
+ /*
+ * Don't take the mm semaphore here. If we fixup a prefetch
+ * fault we could otherwise deadlock.
+@@ -645,6 +646,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
+ goto bad_area_nosemaphore;
+ }
+
++ /* kprobes don't want to hook the spurious faults. */
++ if (notify_page_fault(regs))
++ return;
+
+ #ifdef CONFIG_X86_32
+ /* It's safe to allow irq's after cr2 has been saved and the vmalloc
+diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
+index e28469e..eab790f 100644
+--- a/drivers/acpi/dock.c
++++ b/drivers/acpi/dock.c
+@@ -691,8 +691,14 @@ fdd_out:
+ static ssize_t show_docked(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+- return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
++ struct acpi_device *tmp;
++
++ struct dock_station *dock_station = *((struct dock_station **)
++ dev->platform_data);
+
++ if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
++ return snprintf(buf, PAGE_SIZE, "1\n");
++ return snprintf(buf, PAGE_SIZE, "0\n");
+ }
+ static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
+
+diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c
+index 8892b98..331a114 100644
+--- a/drivers/acpi/executer/exconfig.c
++++ b/drivers/acpi/executer/exconfig.c
+@@ -280,6 +280,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
+ struct acpi_walk_state *walk_state)
+ {
+ union acpi_operand_object *ddb_handle;
++ struct acpi_table_header *table;
+ struct acpi_table_desc table_desc;
+ u32 table_index;
+ acpi_status status;
+@@ -294,9 +295,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
+ switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
+ case ACPI_TYPE_REGION:
+
+- ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
+- obj_desc,
+- acpi_ut_get_object_type_name(obj_desc)));
++ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
++ "Load table from Region %p\n", obj_desc));
+
+ /* Region must be system_memory (from ACPI spec) */
+
+@@ -316,61 +316,112 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
+ }
+
+ /*
+- * We will simply map the memory region for the table. However, the
+- * memory region is technically not guaranteed to remain stable and
+- * we may eventually have to copy the table to a local buffer.
++ * Map the table header and get the actual table length. The region
++ * length is not guaranteed to be the same as the table length.
++ */
++ table = acpi_os_map_memory(obj_desc->region.address,
++ sizeof(struct acpi_table_header));
++ if (!table) {
++ return_ACPI_STATUS(AE_NO_MEMORY);
++ }
++
++ length = table->length;
++ acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
++
++ /* Must have at least an ACPI table header */
++
++ if (length < sizeof(struct acpi_table_header)) {
++ return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
++ }
++
++ /*
++ * The memory region is not guaranteed to remain stable and we must
++ * copy the table to a local buffer. For example, the memory region
++ * is corrupted after suspend on some machines. Dynamically loaded
++ * tables are usually small, so this overhead is minimal.
+ */
++
++ /* Allocate a buffer for the table */
++
++ table_desc.pointer = ACPI_ALLOCATE(length);
++ if (!table_desc.pointer) {
++ return_ACPI_STATUS(AE_NO_MEMORY);
++ }
++
++ /* Map the entire table and copy it */
++
++ table = acpi_os_map_memory(obj_desc->region.address, length);
++ if (!table) {
++ ACPI_FREE(table_desc.pointer);
++ return_ACPI_STATUS(AE_NO_MEMORY);
++ }
++
++ ACPI_MEMCPY(table_desc.pointer, table, length);
++ acpi_os_unmap_memory(table, length);
++
+ table_desc.address = obj_desc->region.address;
+- table_desc.length = obj_desc->region.length;
+- table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED;
+ break;
+
+ case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */
+
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+- "Load from Buffer or Field %p %s\n", obj_desc,
+- acpi_ut_get_object_type_name(obj_desc)));
+-
+- length = obj_desc->buffer.length;
++ "Load table from Buffer or Field %p\n",
++ obj_desc));
+
+ /* Must have at least an ACPI table header */
+
+- if (length < sizeof(struct acpi_table_header)) {
++ if (obj_desc->buffer.length < sizeof(struct acpi_table_header)) {
+ return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
+ }
+
+- /* Validate checksum here. It won't get validated in tb_add_table */
++ /* Get the actual table length from the table header */
+
+- status =
+- acpi_tb_verify_checksum(ACPI_CAST_PTR
+- (struct acpi_table_header,
+- obj_desc->buffer.pointer), length);
+- if (ACPI_FAILURE(status)) {
+- return_ACPI_STATUS(status);
++ table =
++ ACPI_CAST_PTR(struct acpi_table_header,
++ obj_desc->buffer.pointer);
++ length = table->length;
++
++ /* Table cannot extend beyond the buffer */
++
++ if (length > obj_desc->buffer.length) {
++ return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
++ }
++ if (length < sizeof(struct acpi_table_header)) {
++ return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
+ }
+
+ /*
+- * We need to copy the buffer since the original buffer could be
+- * changed or deleted in the future
++ * Copy the table from the buffer because the buffer could be modified
++ * or even deleted in the future
+ */
+ table_desc.pointer = ACPI_ALLOCATE(length);
+ if (!table_desc.pointer) {
+ return_ACPI_STATUS(AE_NO_MEMORY);
+ }
+
+- ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer,
+- length);
+- table_desc.length = length;
+- table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED;
++ ACPI_MEMCPY(table_desc.pointer, table, length);
++ table_desc.address = ACPI_TO_INTEGER(table_desc.pointer);
+ break;
+
+ default:
+ return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
+ }
+
+- /*
+- * Install the new table into the local data structures
+- */
++ /* Validate table checksum (will not get validated in tb_add_table) */
++
++ status = acpi_tb_verify_checksum(table_desc.pointer, length);
++ if (ACPI_FAILURE(status)) {
++ ACPI_FREE(table_desc.pointer);
++ return_ACPI_STATUS(status);
++ }
++
++ /* Complete the table descriptor */
++
++ table_desc.length = length;
++ table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED;
++
++ /* Install the new table into the local data structures */
++
+ status = acpi_tb_add_table(&table_desc, &table_index);
+ if (ACPI_FAILURE(status)) {
+ goto cleanup;
+@@ -379,7 +430,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
+ /*
+ * Add the table to the namespace.
+ *
+- * Note: We load the table objects relative to the root of the namespace.
++ * Note: Load the table objects relative to the root of the namespace.
+ * This appears to go against the ACPI specification, but we do it for
+ * compatibility with other ACPI implementations.
+ */
+@@ -415,7 +466,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
+ cleanup:
+ if (ACPI_FAILURE(status)) {
+
+- /* Delete allocated buffer or mapping */
++ /* Delete allocated table buffer */
+
+ acpi_tb_delete_table(&table_desc);
+ }
+diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
+index 38be586..f3cc376 100644
+--- a/drivers/acpi/namespace/nsxfeval.c
++++ b/drivers/acpi/namespace/nsxfeval.c
+@@ -45,9 +45,14 @@
+ #include <acpi/acpi.h>
+ #include <acpi/acnamesp.h>
+ #include <acpi/acinterp.h>
++#include <acpi/amlcode.h>
+
+ #define _COMPONENT ACPI_NAMESPACE
+ ACPI_MODULE_NAME("nsxfeval")
++
++/* Local prototypes */
++static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
++
+ #ifdef ACPI_FUTURE_USAGE
+ /*******************************************************************************
+ *
+@@ -69,6 +74,7 @@ ACPI_MODULE_NAME("nsxfeval")
+ * be valid (non-null)
+ *
+ ******************************************************************************/
++
+ acpi_status
+ acpi_evaluate_object_typed(acpi_handle handle,
+ acpi_string pathname,
+@@ -283,6 +289,10 @@ acpi_evaluate_object(acpi_handle handle,
+
+ if (ACPI_SUCCESS(status)) {
+
++ /* Dereference Index and ref_of references */
++
++ acpi_ns_resolve_references(info);
++
+ /* Get the size of the returned object */
+
+ status =
+@@ -352,6 +362,74 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
+
+ /*******************************************************************************
+ *
++ * FUNCTION: acpi_ns_resolve_references
++ *
++ * PARAMETERS: Info - Evaluation info block
++ *
++ * RETURN: Info->return_object is replaced with the dereferenced object
++ *
++ * DESCRIPTION: Dereference certain reference objects. Called before an
++ * internal return object is converted to an external union acpi_object.
++ *
++ * Performs an automatic dereference of Index and ref_of reference objects.
++ * These reference objects are not supported by the union acpi_object, so this is a
++ * last resort effort to return something useful. Also, provides compatibility
++ * with other ACPI implementations.
++ *
++ * NOTE: does not handle references within returned package objects or nested
++ * references, but this support could be added later if found to be necessary.
++ *
++ ******************************************************************************/
++static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
++{
++ union acpi_operand_object *obj_desc = NULL;
++ struct acpi_namespace_node *node;
++
++ /* We are interested in reference objects only */
++
++ if (ACPI_GET_OBJECT_TYPE(info->return_object) !=
++ ACPI_TYPE_LOCAL_REFERENCE) {
++ return;
++ }
++
++ /*
++ * Two types of references are supported - those created by Index and
++ * ref_of operators. A name reference (AML_NAMEPATH_OP) can be converted
++ * to an union acpi_object, so it is not dereferenced here. A ddb_handle
++ * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
++ * an union acpi_object.
++ */
++ switch (info->return_object->reference.opcode) {
++ case AML_INDEX_OP:
++
++ obj_desc = *(info->return_object->reference.where);
++ break;
++
++ case AML_REF_OF_OP:
++
++ node = info->return_object->reference.object;
++ if (node) {
++ obj_desc = node->object;
++ }
++ break;
++
++ default:
++ return;
++ }
++
++ /* Replace the existing reference object */
++
++ if (obj_desc) {
++ acpi_ut_add_reference(obj_desc);
++ acpi_ut_remove_reference(info->return_object);
++ info->return_object = obj_desc;
++ }
++
++ return;
++}
++
++/*******************************************************************************
++ *
+ * FUNCTION: acpi_walk_namespace
+ *
+ * PARAMETERS: Type - acpi_object_type to search for
+@@ -379,6 +457,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
+ * function, etc.
+ *
+ ******************************************************************************/
++
+ acpi_status
+ acpi_walk_namespace(acpi_object_type type,
+ acpi_handle start_object,
+diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
+index 775c97a..a885295 100644
+--- a/drivers/acpi/tables.c
++++ b/drivers/acpi/tables.c
+@@ -293,7 +293,12 @@ static void __init check_multiple_madt(void)
+
+ int __init acpi_table_init(void)
+ {
+- acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
++ acpi_status status;
++
++ status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
++ if (ACPI_FAILURE(status))
++ return 1;
++
+ check_multiple_madt();
+ return 0;
+ }
+diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
+index 0cc92ef..f5d7aec 100644
+--- a/drivers/acpi/tables/tbutils.c
++++ b/drivers/acpi/tables/tbutils.c
+@@ -512,10 +512,9 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
+ if (ACPI_FAILURE(status)) {
+ ACPI_WARNING((AE_INFO,
+ "Truncating %u table entries!",
+- (unsigned)
+- (acpi_gbl_root_table_list.size -
+- acpi_gbl_root_table_list.
+- count)));
++ (unsigned) (table_count -
++ (acpi_gbl_root_table_list.
++ count - 2))));
+ break;
+ }
+ }
+diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
+index 42e1e84..a953b5d 100644
+--- a/drivers/acpi/video.c
++++ b/drivers/acpi/video.c
+@@ -36,6 +36,7 @@
+ #include <linux/backlight.h>
+ #include <linux/thermal.h>
+ #include <linux/video_output.h>
++#include <linux/sort.h>
+ #include <asm/uaccess.h>
+
+ #include <acpi/acpi_bus.h>
+@@ -632,6 +633,16 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
+ }
+
+ /*
++ * Simple comparison function used to sort backlight levels.
++ */
++
++static int
++acpi_video_cmp_level(const void *a, const void *b)
++{
++ return *(int *)a - *(int *)b;
++}
++
++/*
+ * Arg:
+ * device : video output device (LCD, CRT, ..)
+ *
+@@ -682,6 +693,10 @@ acpi_video_init_brightness(struct acpi_video_device *device)
+ count++;
+ }
+
++ /* don't sort the first two brightness levels */
++ sort(&br->levels[2], count - 2, sizeof(br->levels[2]),
++ acpi_video_cmp_level, NULL);
++
+ if (count < 2)
+ goto out_free_levels;
+
+@@ -997,7 +1012,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
+ }
+
+ seq_printf(seq, "levels: ");
+- for (i = 0; i < dev->brightness->count; i++)
++ for (i = 2; i < dev->brightness->count; i++)
+ seq_printf(seq, " %d", dev->brightness->levels[i]);
+ seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
+
+@@ -1036,7 +1051,7 @@ acpi_video_device_write_brightness(struct file *file,
+ return -EFAULT;
+
+ /* validate through the list of available levels */
+- for (i = 0; i < dev->brightness->count; i++)
++ for (i = 2; i < dev->brightness->count; i++)
+ if (level == dev->brightness->levels[i]) {
+ if (ACPI_SUCCESS
+ (acpi_video_device_lcd_set_level(dev, level)))
+@@ -1689,7 +1704,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
+ max = max_below = 0;
+ min = min_above = 255;
+ /* Find closest level to level_current */
+- for (i = 0; i < device->brightness->count; i++) {
++ for (i = 2; i < device->brightness->count; i++) {
+ l = device->brightness->levels[i];
+ if (abs(l - level_current) < abs(delta)) {
+ delta = l - level_current;
+@@ -1699,7 +1714,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
+ }
+ /* Ajust level_current to closest available level */
+ level_current += delta;
+- for (i = 0; i < device->brightness->count; i++) {
++ for (i = 2; i < device->brightness->count; i++) {
+ l = device->brightness->levels[i];
+ if (l < min)
+ min = l;
+@@ -1983,6 +1998,12 @@ static int acpi_video_bus_add(struct acpi_device *device)
+ device->pnp.bus_id[3] = '0' + instance;
+ instance ++;
+ }
++ /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
++ if (!strcmp(device->pnp.bus_id, "VGA")) {
++ if (instance)
++ device->pnp.bus_id[3] = '0' + instance;
++ instance++;
++ }
+
+ video->device = device;
+ strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
+diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
+index f1fe749..5eb23fa 100644
+--- a/drivers/char/agp/intel-agp.c
++++ b/drivers/char/agp/intel-agp.c
+@@ -40,6 +40,8 @@
+ #define PCI_DEVICE_ID_INTEL_Q45_IG 0x2E12
+ #define PCI_DEVICE_ID_INTEL_G45_HB 0x2E20
+ #define PCI_DEVICE_ID_INTEL_G45_IG 0x2E22
++#define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30
++#define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32
+
+ /* cover 915 and 945 variants */
+ #define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \
+@@ -63,7 +65,8 @@
+ #define IS_G4X (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_E_HB || \
+ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q45_HB || \
+ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G45_HB || \
+- agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB)
++ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_GM45_HB || \
++ agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G41_HB)
+
+ extern int agp_memory_reserved;
+
+@@ -214,8 +217,8 @@ static int intel_i810_configure(void)
+ if (agp_bridge->driver->needs_scratch_page) {
+ for (i = 0; i < current_size->num_entries; i++) {
+ writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
+- readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI posting. */
+ }
++ readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI posting. */
+ }
+ global_cache_flush();
+ return 0;
+@@ -775,8 +778,8 @@ static int intel_i830_configure(void)
+ if (agp_bridge->driver->needs_scratch_page) {
+ for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
+ writel(agp_bridge->scratch_page, intel_private.registers+I810_PTE_BASE+(i*4));
+- readl(intel_private.registers+I810_PTE_BASE+(i*4)); /* PCI Posting. */
+ }
++ readl(intel_private.registers+I810_PTE_BASE+((i-1)*4)); /* PCI Posting. */
+ }
+
+ global_cache_flush();
+@@ -991,8 +994,8 @@ static int intel_i915_configure(void)
+ if (agp_bridge->driver->needs_scratch_page) {
+ for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
+ writel(agp_bridge->scratch_page, intel_private.gtt+i);
+- readl(intel_private.gtt+i); /* PCI Posting. */
+ }
++ readl(intel_private.gtt+i-1); /* PCI Posting. */
+ }
+
+ global_cache_flush();
+@@ -1196,6 +1199,7 @@ static void intel_i965_get_gtt_range(int *gtt_offset, int *gtt_size)
+ case PCI_DEVICE_ID_INTEL_IGD_E_HB:
+ case PCI_DEVICE_ID_INTEL_Q45_HB:
+ case PCI_DEVICE_ID_INTEL_G45_HB:
++ case PCI_DEVICE_ID_INTEL_G41_HB:
+ *gtt_offset = *gtt_size = MB(2);
+ break;
+ default:
+@@ -2128,13 +2132,15 @@ static const struct intel_driver_description {
+ { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33",
+ NULL, &intel_g33_driver },
+ { PCI_DEVICE_ID_INTEL_GM45_HB, PCI_DEVICE_ID_INTEL_GM45_IG, 0,
+- "Mobile Intel? GM45 Express", NULL, &intel_i965_driver },
++ "Mobile Intel® GM45 Express", NULL, &intel_i965_driver },
+ { PCI_DEVICE_ID_INTEL_IGD_E_HB, PCI_DEVICE_ID_INTEL_IGD_E_IG, 0,
+ "Intel Integrated Graphics Device", NULL, &intel_i965_driver },
+ { PCI_DEVICE_ID_INTEL_Q45_HB, PCI_DEVICE_ID_INTEL_Q45_IG, 0,
+ "Q45/Q43", NULL, &intel_i965_driver },
+ { PCI_DEVICE_ID_INTEL_G45_HB, PCI_DEVICE_ID_INTEL_G45_IG, 0,
+ "G45/G43", NULL, &intel_i965_driver },
++ { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, 0,
++ "G41", NULL, &intel_i965_driver },
+ { 0, 0, 0, NULL, NULL, NULL }
+ };
+
+@@ -2332,6 +2338,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
+ ID(PCI_DEVICE_ID_INTEL_IGD_E_HB),
+ ID(PCI_DEVICE_ID_INTEL_Q45_HB),
+ ID(PCI_DEVICE_ID_INTEL_G45_HB),
++ ID(PCI_DEVICE_ID_INTEL_G41_HB),
+ { }
+ };
+
+diff --git a/drivers/char/vt.c b/drivers/char/vt.c
+index d429499..372267d 100644
+--- a/drivers/char/vt.c
++++ b/drivers/char/vt.c
+@@ -301,7 +301,7 @@ static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+ d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
+ s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr));
+ scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
+- scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_scrl_erase_char,
++ scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char,
+ vc->vc_size_row * nr);
+ }
+
+@@ -319,7 +319,7 @@ static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
+ s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
+ step = vc->vc_cols * nr;
+ scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
+- scr_memsetw(s, vc->vc_scrl_erase_char, 2 * step);
++ scr_memsetw(s, vc->vc_video_erase_char, 2 * step);
+ }
+
+ static void do_update_region(struct vc_data *vc, unsigned long start, int count)
+@@ -434,7 +434,6 @@ static void update_attr(struct vc_data *vc)
+ vc->vc_blink, vc->vc_underline,
+ vc->vc_reverse ^ vc->vc_decscnm, vc->vc_italic);
+ vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm, 0) << 8) | ' ';
+- vc->vc_scrl_erase_char = (build_attr(vc, vc->vc_def_color, 1, false, false, vc->vc_decscnm, false) << 8) | ' ';
+ }
+
+ /* Note: inverting the screen twice should revert to the original state */
+diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
+index 595759c..cd589ca 100644
+--- a/drivers/firewire/fw-ohci.c
++++ b/drivers/firewire/fw-ohci.c
+@@ -226,7 +226,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card)
+ #define CONTEXT_DEAD 0x0800
+ #define CONTEXT_ACTIVE 0x0400
+
+-#define OHCI1394_MAX_AT_REQ_RETRIES 0x2
++#define OHCI1394_MAX_AT_REQ_RETRIES 0xf
+ #define OHCI1394_MAX_AT_RESP_RETRIES 0x2
+ #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
+
+diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
+index 64142c1..716370c 100644
+--- a/drivers/firewire/fw-sbp2.c
++++ b/drivers/firewire/fw-sbp2.c
+@@ -350,15 +350,17 @@ static const struct {
+ .model = ~0,
+ .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
+ },
+-
+ /*
+- * There are iPods (2nd gen, 3rd gen) with model_id == 0, but
+- * these iPods do not feature the read_capacity bug according
+- * to one report. Read_capacity behaviour as well as model_id
+- * could change due to Apple-supplied firmware updates though.
++ * iPod 2nd generation: needs 128k max transfer size workaround
++ * iPod 3rd generation: needs fix capacity workaround
+ */
+-
+- /* iPod 4th generation. */ {
++ {
++ .firmware_revision = 0x0a2700,
++ .model = 0x000000,
++ .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS |
++ SBP2_WORKAROUND_FIX_CAPACITY,
++ },
++ /* iPod 4th generation */ {
+ .firmware_revision = 0x0a2700,
+ .model = 0x000021,
+ .workarounds = SBP2_WORKAROUND_FIX_CAPACITY,
+@@ -1293,6 +1295,19 @@ static struct fw_driver sbp2_driver = {
+ .id_table = sbp2_id_table,
+ };
+
++static void sbp2_unmap_scatterlist(struct device *card_device,
++ struct sbp2_command_orb *orb)
++{
++ if (scsi_sg_count(orb->cmd))
++ dma_unmap_sg(card_device, scsi_sglist(orb->cmd),
++ scsi_sg_count(orb->cmd),
++ orb->cmd->sc_data_direction);
++
++ if (orb->request.misc & cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT))
++ dma_unmap_single(card_device, orb->page_table_bus,
++ sizeof(orb->page_table), DMA_TO_DEVICE);
++}
++
+ static unsigned int
+ sbp2_status_to_sense_data(u8 *sbp2_status, u8 *sense_data)
+ {
+@@ -1372,15 +1387,7 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
+
+ dma_unmap_single(device->card->device, orb->base.request_bus,
+ sizeof(orb->request), DMA_TO_DEVICE);
+-
+- if (scsi_sg_count(orb->cmd) > 0)
+- dma_unmap_sg(device->card->device, scsi_sglist(orb->cmd),
+- scsi_sg_count(orb->cmd),
+- orb->cmd->sc_data_direction);
+-
+- if (orb->page_table_bus != 0)
+- dma_unmap_single(device->card->device, orb->page_table_bus,
+- sizeof(orb->page_table), DMA_TO_DEVICE);
++ sbp2_unmap_scatterlist(device->card->device, orb);
+
+ orb->cmd->result = result;
+ orb->done(orb->cmd);
+@@ -1530,8 +1537,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
+ orb->base.request_bus =
+ dma_map_single(device->card->device, &orb->request,
+ sizeof(orb->request), DMA_TO_DEVICE);
+- if (dma_mapping_error(device->card->device, orb->base.request_bus))
++ if (dma_mapping_error(device->card->device, orb->base.request_bus)) {
++ sbp2_unmap_scatterlist(device->card->device, orb);
+ goto out;
++ }
+
+ sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, lu->generation,
+ lu->command_block_agent_address + SBP2_ORB_POINTER);
+diff --git a/drivers/ieee1394/ohci1394.h b/drivers/ieee1394/ohci1394.h
+index 4320bf0..7fb8ab9 100644
+--- a/drivers/ieee1394/ohci1394.h
++++ b/drivers/ieee1394/ohci1394.h
+@@ -26,7 +26,7 @@
+
+ #define OHCI1394_DRIVER_NAME "ohci1394"
+
+-#define OHCI1394_MAX_AT_REQ_RETRIES 0x2
++#define OHCI1394_MAX_AT_REQ_RETRIES 0xf
+ #define OHCI1394_MAX_AT_RESP_RETRIES 0x2
+ #define OHCI1394_MAX_PHYS_RESP_RETRIES 0x8
+ #define OHCI1394_MAX_SELF_ID_ERRORS 16
+diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
+index bad46ea..0c0fdbb 100644
+--- a/drivers/ieee1394/sbp2.c
++++ b/drivers/ieee1394/sbp2.c
+@@ -395,6 +395,16 @@ static const struct {
+ .model_id = SBP2_ROM_VALUE_WILDCARD,
+ .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
+ },
++ /*
++ * iPod 2nd generation: needs 128k max transfer size workaround
++ * iPod 3rd generation: needs fix capacity workaround
++ */
++ {
++ .firmware_revision = 0x0a2700,
++ .model_id = 0x000000,
++ .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS |
++ SBP2_WORKAROUND_FIX_CAPACITY,
++ },
+ /* iPod 4th generation */ {
+ .firmware_revision = 0x0a2700,
+ .model_id = 0x000021,
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
+index c2fcf28..61f5753 100644
+--- a/drivers/md/dm-mpath.c
++++ b/drivers/md/dm-mpath.c
+@@ -427,13 +427,13 @@ static void process_queued_ios(struct work_struct *work)
+ __choose_pgpath(m);
+
+ pgpath = m->current_pgpath;
+- m->pgpath_to_activate = m->current_pgpath;
+
+ if ((pgpath && !m->queue_io) ||
+ (!pgpath && !m->queue_if_no_path))
+ must_queue = 0;
+
+- if (m->pg_init_required && !m->pg_init_in_progress) {
++ if (m->pg_init_required && !m->pg_init_in_progress && pgpath) {
++ m->pgpath_to_activate = pgpath;
+ m->pg_init_count++;
+ m->pg_init_required = 0;
+ m->pg_init_in_progress = 1;
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index fe6eccd..60f3e59 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -1454,6 +1454,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
+ if (find_rdev_nr(mddev, rdev->desc_nr))
+ return -EBUSY;
+ }
++ if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
++ printk(KERN_WARNING "md: %s: array is limited to %d devices\n",
++ mdname(mddev), mddev->max_disks);
++ return -EBUSY;
++ }
+ bdevname(rdev->bdev,b);
+ while ( (s=strchr(b, '/')) != NULL)
+ *s = '!';
+@@ -2362,6 +2367,15 @@ static void analyze_sbs(mddev_t * mddev)
+
+ i = 0;
+ rdev_for_each(rdev, tmp, mddev) {
++ if (rdev->desc_nr >= mddev->max_disks ||
++ i > mddev->max_disks) {
++ printk(KERN_WARNING
++ "md: %s: %s: only %d devices permitted\n",
++ mdname(mddev), bdevname(rdev->bdev, b),
++ mddev->max_disks);
++ kick_rdev_from_array(rdev);
++ continue;
++ }
+ if (rdev != freshest)
+ if (super_types[mddev->major_version].
+ validate_super(mddev, rdev)) {
+@@ -2728,9 +2742,9 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len)
+ break;
+ case read_auto:
+ if (mddev->pers) {
+- if (mddev->ro != 1)
++ if (mddev->ro == 0)
+ err = do_md_stop(mddev, 1, 0);
+- else
++ else if (mddev->ro == 1)
+ err = restart_array(mddev);
+ if (err == 0) {
+ mddev->ro = 2;
+@@ -2946,7 +2960,13 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len)
+ {
+ int major, minor;
+ char *e;
+- if (!list_empty(&mddev->disks))
++ /* Changing the details of 'external' metadata is
++ * always permitted. Otherwise there must be
++ * no devices attached to the array.
++ */
++ if (mddev->external && strncmp(buf, "external:", 9) == 0)
++ ;
++ else if (!list_empty(&mddev->disks))
+ return -EBUSY;
+
+ if (cmd_match(buf, "none")) {
+@@ -4450,13 +4470,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
+ * noticed in interrupt contexts ...
+ */
+
+- if (rdev->desc_nr == mddev->max_disks) {
+- printk(KERN_WARNING "%s: can not hot-add to full array!\n",
+- mdname(mddev));
+- err = -EBUSY;
+- goto abort_unbind_export;
+- }
+-
+ rdev->raid_disk = -1;
+
+ md_update_sb(mddev, 1);
+@@ -4470,9 +4483,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
+ md_new_event(mddev);
+ return 0;
+
+-abort_unbind_export:
+- unbind_rdev_from_array(rdev);
+-
+ abort_export:
+ export_rdev(rdev);
+ return err;
+diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
+index 616bcbd..13a8996 100644
+--- a/drivers/misc/eeepc-laptop.c
++++ b/drivers/misc/eeepc-laptop.c
+@@ -381,7 +381,8 @@ static void notify_wlan(u32 *event)
+ static void notify_brn(void)
+ {
+ struct backlight_device *bd = eeepc_backlight_device;
+- bd->props.brightness = read_brightness(bd);
++ if (bd)
++ bd->props.brightness = read_brightness(bd);
+ }
+
+ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
+diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
+index 619208d..bcf3782 100644
+--- a/drivers/misc/sgi-xp/xpc.h
++++ b/drivers/misc/sgi-xp/xpc.h
+@@ -3,7 +3,7 @@
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+- * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
++ * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved.
+ */
+
+ /*
+@@ -502,7 +502,8 @@ struct xpc_channel_uv {
+ /* partition's notify mq */
+
+ struct xpc_send_msg_slot_uv *send_msg_slots;
+- struct xpc_notify_mq_msg_uv *recv_msg_slots;
++ void *recv_msg_slots; /* each slot will hold a xpc_notify_mq_msg_uv */
++ /* structure plus the user's payload */
+
+ struct xpc_fifo_head_uv msg_slot_free_list;
+ struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */
+diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
+index b8f8d50..1bb8bc5 100644
+--- a/drivers/misc/sgi-xp/xpc_uv.c
++++ b/drivers/misc/sgi-xp/xpc_uv.c
+@@ -3,7 +3,7 @@
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+- * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
++ * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved.
+ */
+
+ /*
+@@ -825,8 +825,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
+ continue;
+
+ for (entry = 0; entry < nentries; entry++) {
+- msg_slot = ch_uv->recv_msg_slots + entry *
+- ch->entry_size;
++ msg_slot = ch_uv->recv_msg_slots +
++ entry * ch->entry_size;
+
+ msg_slot->hdr.msg_slot_number = entry;
+ }
+@@ -1123,9 +1123,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
+ /* we're dealing with a normal message sent via the notify_mq */
+ ch_uv = &ch->sn.uv;
+
+- msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots +
+- (msg->hdr.msg_slot_number % ch->remote_nentries) *
+- ch->entry_size);
++ msg_slot = ch_uv->recv_msg_slots +
++ (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size;
+
+ BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
+ BUG_ON(msg_slot->hdr.size != 0);
+diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
+index 872ea58..6b96357 100644
+--- a/drivers/net/e1000/e1000_main.c
++++ b/drivers/net/e1000/e1000_main.c
+@@ -31,7 +31,7 @@
+
+ char e1000_driver_name[] = "e1000";
+ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
+-#define DRV_VERSION "7.3.20-k3-NAPI"
++#define DRV_VERSION "7.3.21-k3-NAPI"
+ const char e1000_driver_version[] = DRV_VERSION;
+ static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
+
+@@ -927,7 +927,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
+ err = pci_enable_device(pdev);
+ } else {
+ bars = pci_select_bars(pdev, IORESOURCE_MEM);
+- err = pci_enable_device(pdev);
++ err = pci_enable_device_mem(pdev);
+ }
+ if (err)
+ return err;
+@@ -3835,7 +3835,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
+ struct e1000_hw *hw = &adapter->hw;
+ u32 rctl, icr = er32(ICR);
+
+- if (unlikely(!icr))
++ if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags)))
+ return IRQ_NONE; /* Not our interrupt */
+
+ /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
+index 6e42b5a..5790194 100644
+--- a/drivers/net/usb/hso.c
++++ b/drivers/net/usb/hso.c
+@@ -2047,7 +2047,7 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
+ char *rfkn;
+
+ hso_net->rfkill = rfkill_allocate(&interface_to_usbdev(interface)->dev,
+- RFKILL_TYPE_WLAN);
++ RFKILL_TYPE_WWAN);
+ if (!hso_net->rfkill) {
+ dev_err(dev, "%s - Out of memory", __func__);
+ return;
+diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
+index dcce354..966c86c 100644
+--- a/drivers/net/wireless/ipw2200.c
++++ b/drivers/net/wireless/ipw2200.c
+@@ -4346,7 +4346,8 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
+ return;
+ }
+
+- if (priv->status & STATUS_SCANNING) {
++ if (priv->status & STATUS_SCANNING &&
++ missed_count > IPW_MB_SCAN_CANCEL_THRESHOLD) {
+ /* Stop scan to keep fw from getting
+ * stuck (only if we aren't roaming --
+ * otherwise we'll never scan more than 2 or 3
+@@ -6276,6 +6277,20 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
+ }
+ }
+
++static int ipw_passive_dwell_time(struct ipw_priv *priv)
++{
++ /* staying on passive channels longer than the DTIM interval during a
++ * scan, while associated, causes the firmware to cancel the scan
++ * without notification. Hence, don't stay on passive channels longer
++ * than the beacon interval.
++ */
++ if (priv->status & STATUS_ASSOCIATED
++ && priv->assoc_network->beacon_interval > 10)
++ return priv->assoc_network->beacon_interval - 10;
++ else
++ return 120;
++}
++
+ static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct)
+ {
+ struct ipw_scan_request_ext scan;
+@@ -6319,16 +6334,16 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct)
+ scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee));
+
+ if (type == IW_SCAN_TYPE_PASSIVE) {
+- IPW_DEBUG_WX("use passive scanning\n");
+- scan_type = IPW_SCAN_PASSIVE_FULL_DWELL_SCAN;
++ IPW_DEBUG_WX("use passive scanning\n");
++ scan_type = IPW_SCAN_PASSIVE_FULL_DWELL_SCAN;
+ scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] =
+- cpu_to_le16(120);
++ cpu_to_le16(ipw_passive_dwell_time(priv));
+ ipw_add_scan_channels(priv, &scan, scan_type);
+ goto send_request;
+ }
+
+ /* Use active scan by default. */
+- if (priv->config & CFG_SPEED_SCAN)
++ if (priv->config & CFG_SPEED_SCAN)
+ scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =
+ cpu_to_le16(30);
+ else
+@@ -6338,7 +6353,8 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct)
+ scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] =
+ cpu_to_le16(20);
+
+- scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120);
++ scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] =
++ cpu_to_le16(ipw_passive_dwell_time(priv));
+ scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20);
+
+ #ifdef CONFIG_IPW2200_MONITOR
+diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
+index d4ab28b..60b4e71 100644
+--- a/drivers/net/wireless/ipw2200.h
++++ b/drivers/net/wireless/ipw2200.h
+@@ -244,6 +244,7 @@ enum connection_manager_assoc_states {
+ #define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED 31
+
+ #define HOST_NOTIFICATION_STATUS_BEACON_MISSING 1
++#define IPW_MB_SCAN_CANCEL_THRESHOLD 3
+ #define IPW_MB_ROAMING_THRESHOLD_MIN 1
+ #define IPW_MB_ROAMING_THRESHOLD_DEFAULT 8
+ #define IPW_MB_ROAMING_THRESHOLD_MAX 30
+diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
+index 77baff0..3f2309f 100644
+--- a/drivers/pci/pci-sysfs.c
++++ b/drivers/pci/pci-sysfs.c
+@@ -694,8 +694,8 @@ pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
+ return -EINVAL;
+
+ rom = pci_map_rom(pdev, &size); /* size starts out as PCI window size */
+- if (!rom)
+- return 0;
++ if (!rom || !size)
++ return -EIO;
+
+ if (off >= size)
+ count = 0;
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
+index 8a82a62..e4df84b 100644
+--- a/drivers/pci/pcie/aspm.c
++++ b/drivers/pci/pcie/aspm.c
+@@ -713,9 +713,9 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
+
+ /*
+ * All PCIe functions are in one slot, remove one function will remove
+- * the the whole slot, so just wait
++ * the whole slot, so just wait until we are the last function left.
+ */
+- if (!list_empty(&parent->subordinate->devices))
++ if (!list_is_last(&pdev->bus_list, &parent->subordinate->devices))
+ goto out;
+
+ /* All functions are removed, so just disable ASPM for the link */
+diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
+index bd5c0e0..b2bac71 100644
+--- a/drivers/pci/rom.c
++++ b/drivers/pci/rom.c
+@@ -63,7 +63,7 @@ static void pci_disable_rom(struct pci_dev *pdev)
+ * The PCI window size could be much larger than the
+ * actual image size.
+ */
+-size_t pci_get_rom_size(void __iomem *rom, size_t size)
++size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
+ {
+ void __iomem *image;
+ int last_image;
+@@ -72,8 +72,10 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size)
+ do {
+ void __iomem *pds;
+ /* Standard PCI ROMs start out with these bytes 55 AA */
+- if (readb(image) != 0x55)
++ if (readb(image) != 0x55) {
++ dev_err(&pdev->dev, "Invalid ROM contents\n");
+ break;
++ }
+ if (readb(image + 1) != 0xAA)
+ break;
+ /* get the PCI data structure and check its signature */
+@@ -158,7 +160,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
+ * size is much larger than the actual size of the ROM.
+ * True size is important if the ROM is going to be copied.
+ */
+- *size = pci_get_rom_size(rom, *size);
++ *size = pci_get_rom_size(pdev, rom, *size);
+ return rom;
+ }
+
+diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
+index fd0695b..056071d 100644
+--- a/drivers/serial/8250_pci.c
++++ b/drivers/serial/8250_pci.c
+@@ -599,6 +599,10 @@ static int pci_netmos_init(struct pci_dev *dev)
+ /* subdevice 0x00PS means <P> parallel, <S> serial */
+ unsigned int num_serial = dev->subsystem_device & 0xf;
+
++ if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
++ dev->subsystem_device == 0x0299)
++ return 0;
++
+ if (num_serial == 0)
+ return -ENODEV;
+ return num_serial;
+@@ -766,6 +770,8 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
+ #define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
+ #define PCI_SUBDEVICE_ID_POCTAL232 0x0308
+ #define PCI_SUBDEVICE_ID_POCTAL422 0x0408
++#define PCI_VENDOR_ID_ADVANTECH 0x13fe
++#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620
+
+ /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
+ #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
+@@ -2051,6 +2057,10 @@ static int pciserial_resume_one(struct pci_dev *dev)
+ #endif
+
+ static struct pci_device_id serial_pci_tbl[] = {
++ /* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */
++ { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
++ PCI_DEVICE_ID_ADVANTECH_PCI3620, 0x0001, 0, 0,
++ pbn_b2_8_921600 },
+ { PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
+ PCI_SUBVENDOR_ID_CONNECT_TECH,
+ PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
+@@ -2294,6 +2304,9 @@ static struct pci_device_id serial_pci_tbl[] = {
+ * For now just used the hex ID 0x950a.
+ */
+ { PCI_VENDOR_ID_OXSEMI, 0x950a,
++ PCI_SUBVENDOR_ID_SIIG, PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL, 0, 0,
++ pbn_b0_2_115200 },
++ { PCI_VENDOR_ID_OXSEMI, 0x950a,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+ pbn_b0_2_1130000 },
+ { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI954,
+@@ -2846,6 +2859,10 @@ static struct pci_device_id serial_pci_tbl[] = {
+ 0,
+ pbn_b0_8_115200 },
+
++ { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
++ PCI_VENDOR_ID_IBM, 0x0299,
++ 0, 0, pbn_b0_bt_2_115200 },
++
+ /*
+ * These entries match devices with class COMMUNICATION_SERIAL,
+ * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
+index b205311..876bf36 100644
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -192,14 +192,15 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
+ #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400
+
+ /* FUTURE NOVATEL PRODUCTS */
+-#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000
+-#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000
+-#define NOVATELWIRELESS_PRODUCT_EMBEDDED_1 0x8000
+-#define NOVATELWIRELESS_PRODUCT_GLOBAL_1 0x9000
+-#define NOVATELWIRELESS_PRODUCT_EVDO_2 0x6001
+-#define NOVATELWIRELESS_PRODUCT_HSPA_2 0x7001
+-#define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001
+-#define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001
++#define NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED 0X6000
++#define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001
++#define NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED 0X7000
++#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED 0X7001
++#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED 0X8000
++#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0X8001
++#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0X9000
++#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0X9001
++#define NOVATELWIRELESS_PRODUCT_GLOBAL 0XA001
+
+ /* AMOI PRODUCTS */
+ #define AMOI_VENDOR_ID 0x1614
+@@ -209,6 +210,27 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
+
+ #define DELL_VENDOR_ID 0x413C
+
++/* Dell modems */
++#define DELL_PRODUCT_5700_MINICARD 0x8114
++#define DELL_PRODUCT_5500_MINICARD 0x8115
++#define DELL_PRODUCT_5505_MINICARD 0x8116
++#define DELL_PRODUCT_5700_EXPRESSCARD 0x8117
++#define DELL_PRODUCT_5510_EXPRESSCARD 0x8118
++
++#define DELL_PRODUCT_5700_MINICARD_SPRINT 0x8128
++#define DELL_PRODUCT_5700_MINICARD_TELUS 0x8129
++
++#define DELL_PRODUCT_5720_MINICARD_VZW 0x8133
++#define DELL_PRODUCT_5720_MINICARD_SPRINT 0x8134
++#define DELL_PRODUCT_5720_MINICARD_TELUS 0x8135
++#define DELL_PRODUCT_5520_MINICARD_CINGULAR 0x8136
++#define DELL_PRODUCT_5520_MINICARD_GENERIC_L 0x8137
++#define DELL_PRODUCT_5520_MINICARD_GENERIC_I 0x8138
++
++#define DELL_PRODUCT_5730_MINICARD_SPRINT 0x8180
++#define DELL_PRODUCT_5730_MINICARD_TELUS 0x8181
++#define DELL_PRODUCT_5730_MINICARD_VZW 0x8182
++
+ #define KYOCERA_VENDOR_ID 0x0c88
+ #define KYOCERA_PRODUCT_KPC650 0x17da
+ #define KYOCERA_PRODUCT_KPC680 0x180a
+@@ -267,12 +289,6 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
+ #define ERICSSON_VENDOR_ID 0x0bdb
+ #define ERICSSON_PRODUCT_F3507G 0x1900
+
+-/* Pantech products */
+-#define PANTECH_VENDOR_ID 0x106c
+-#define PANTECH_PRODUCT_PC5740 0x3701
+-#define PANTECH_PRODUCT_PC5750 0x3702 /* PX-500 */
+-#define PANTECH_PRODUCT_UM150 0x3711
+-
+ static struct usb_device_id option_ids[] = {
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
+ { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
+@@ -383,31 +399,37 @@ static struct usb_device_id option_ids[] = {
+ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
+ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
+ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_1) }, /* Novatel Global product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_2) }, /* Novatel EVDO product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_2) }, /* Novatel HSPA product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */
+- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED) }, /* Novatel EVDO product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, /* Novatel EVDO product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, /* Novatel HSPA product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) }, /* Novatel EVDO Embedded product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) }, /* Novatel HSPA Embedded product */
++ { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL) }, /* Novatel Global product */
+
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) },
+
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8129) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
+- { USB_DEVICE(DELL_VENDOR_ID, 0x8147) }, /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5505_MINICARD) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_EXPRESSCARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5510_EXPRESSCARD) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD_SPRINT) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD_TELUS) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_VZW) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_SPRINT) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_TELUS) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_CINGULAR) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_GENERIC_L) }, /* Dell Wireless HSDPA 5520 */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_GENERIC_I) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
++ { USB_DEVICE(DELL_VENDOR_ID, 0x8147) }, /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
+@@ -476,9 +498,6 @@ static struct usb_device_id option_ids[] = {
+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
+ { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
+- { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5740) },
+- { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5750) },
+- { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_UM150) },
+ { } /* Terminating entry */
+ };
+ MODULE_DEVICE_TABLE(usb, option_ids);
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
+index 9a3e495..d8c41ae 100644
+--- a/drivers/usb/serial/ti_usb_3410_5052.c
++++ b/drivers/usb/serial/ti_usb_3410_5052.c
+@@ -227,25 +227,32 @@ static unsigned int product_5052_count;
+ /* the array dimension is the number of default entries plus */
+ /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
+ /* null entry */
+-static struct usb_device_id ti_id_table_3410[1+TI_EXTRA_VID_PID_COUNT+1] = {
++static struct usb_device_id ti_id_table_3410[10+TI_EXTRA_VID_PID_COUNT+1] = {
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
+ };
+
+-static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = {
++static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
+ };
+
+-static struct usb_device_id ti_id_table_combined[] = {
++static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = {
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
+ { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
++ { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
+ { }
+ };
+
+diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
+index b5541bf..d4e4d7e 100644
+--- a/drivers/usb/serial/ti_usb_3410_5052.h
++++ b/drivers/usb/serial/ti_usb_3410_5052.h
+@@ -27,7 +27,11 @@
+
+ /* Vendor and product ids */
+ #define TI_VENDOR_ID 0x0451
++#define IBM_VENDOR_ID 0x04b3
+ #define TI_3410_PRODUCT_ID 0x3410
++#define IBM_4543_PRODUCT_ID 0x4543
++#define IBM_454B_PRODUCT_ID 0x454b
++#define IBM_454C_PRODUCT_ID 0x454c
+ #define TI_3410_EZ430_ID 0xF430 /* TI ez430 development tool */
+ #define TI_5052_BOOT_PRODUCT_ID 0x5052 /* no EEPROM, no firmware */
+ #define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
+diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
+index 620c2b5..8daaace 100644
+--- a/drivers/usb/storage/scsiglue.c
++++ b/drivers/usb/storage/scsiglue.c
+@@ -64,6 +64,7 @@
+ */
+ #define VENDOR_ID_NOKIA 0x0421
+ #define VENDOR_ID_NIKON 0x04b0
++#define VENDOR_ID_PENTAX 0x0a17
+ #define VENDOR_ID_MOTOROLA 0x22b8
+
+ /***********************************************************************
+@@ -150,6 +151,7 @@ static int slave_configure(struct scsi_device *sdev)
+ switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
+ case VENDOR_ID_NOKIA:
+ case VENDOR_ID_NIKON:
++ case VENDOR_ID_PENTAX:
+ case VENDOR_ID_MOTOROLA:
+ if (!(us->fflags & (US_FL_FIX_CAPACITY |
+ US_FL_CAPACITY_OK)))
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
+index aae786c..d775cfe 100644
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1381,21 +1381,6 @@ UNUSUAL_DEV( 0x0a17, 0x0004, 0x1000, 0x1000,
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_INQUIRY ),
+
+-
+-/* Submitted by Per Winkvist <per.winkvist@uk.com> */
+-UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
+- "Pentax",
+- "Optio S/S4",
+- US_SC_DEVICE, US_PR_DEVICE, NULL,
+- US_FL_FIX_INQUIRY ),
+-
+-/* Reported by Jaak Ristioja <Ristioja@gmail.com> */
+-UNUSUAL_DEV( 0x0a17, 0x006e, 0x0100, 0x0100,
+- "Pentax",
+- "K10D",
+- US_SC_DEVICE, US_PR_DEVICE, NULL,
+- US_FL_FIX_CAPACITY ),
+-
+ /* These are virtual windows driver CDs, which the zd1211rw driver
+ * automatically converts into WLAN devices. */
+ UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
+diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
+index 038ea62..93a080e 100644
+--- a/drivers/video/console/fbcon.c
++++ b/drivers/video/console/fbcon.c
+@@ -1855,8 +1855,6 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+ struct display *p = &fb_display[vc->vc_num];
+ int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
+- unsigned short saved_ec;
+- int ret;
+
+ if (fbcon_is_inactive(vc, info))
+ return -EINVAL;
+@@ -1869,11 +1867,6 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ * whole screen (prevents flicker).
+ */
+
+- saved_ec = vc->vc_video_erase_char;
+- vc->vc_video_erase_char = vc->vc_scrl_erase_char;
+-
+- ret = 0;
+-
+ switch (dir) {
+ case SM_UP:
+ if (count > vc->vc_rows) /* Maximum realistic size */
+@@ -1890,9 +1883,9 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ scr_memsetw((unsigned short *) (vc->vc_origin +
+ vc->vc_size_row *
+ (b - count)),
+- vc->vc_scrl_erase_char,
++ vc->vc_video_erase_char,
+ vc->vc_size_row * count);
+- ret = 1;
++ return 1;
+ break;
+
+ case SCROLL_WRAP_MOVE:
+@@ -1962,10 +1955,9 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ scr_memsetw((unsigned short *) (vc->vc_origin +
+ vc->vc_size_row *
+ (b - count)),
+- vc->vc_scrl_erase_char,
++ vc->vc_video_erase_char,
+ vc->vc_size_row * count);
+- ret = 1;
+- break;
++ return 1;
+ }
+ break;
+
+@@ -1982,9 +1974,9 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ scr_memsetw((unsigned short *) (vc->vc_origin +
+ vc->vc_size_row *
+ t),
+- vc->vc_scrl_erase_char,
++ vc->vc_video_erase_char,
+ vc->vc_size_row * count);
+- ret = 1;
++ return 1;
+ break;
+
+ case SCROLL_WRAP_MOVE:
+@@ -2052,15 +2044,12 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
+ scr_memsetw((unsigned short *) (vc->vc_origin +
+ vc->vc_size_row *
+ t),
+- vc->vc_scrl_erase_char,
++ vc->vc_video_erase_char,
+ vc->vc_size_row * count);
+- ret = 1;
+- break;
++ return 1;
+ }
+- break;
+ }
+- vc->vc_video_erase_char = saved_ec;
+- return ret;
++ return 0;
+ }
+
+
+@@ -2522,9 +2511,6 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
+ c = vc->vc_video_erase_char;
+ vc->vc_video_erase_char =
+ ((c & 0xfe00) >> 1) | (c & 0xff);
+- c = vc->vc_scrl_erase_char;
+- vc->vc_scrl_erase_char =
+- ((c & 0xFE00) >> 1) | (c & 0xFF);
+ vc->vc_attr >>= 1;
+ }
+ } else if (!vc->vc_hi_font_mask && cnt == 512) {
+@@ -2555,14 +2541,9 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
+ if (vc->vc_can_do_color) {
+ vc->vc_video_erase_char =
+ ((c & 0xff00) << 1) | (c & 0xff);
+- c = vc->vc_scrl_erase_char;
+- vc->vc_scrl_erase_char =
+- ((c & 0xFF00) << 1) | (c & 0xFF);
+ vc->vc_attr <<= 1;
+- } else {
++ } else
+ vc->vc_video_erase_char = c & ~0x100;
+- vc->vc_scrl_erase_char = c & ~0x100;
+- }
+ }
+
+ }
+diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
+index 9901064..dd3eaaa 100644
+--- a/drivers/video/console/mdacon.c
++++ b/drivers/video/console/mdacon.c
+@@ -533,7 +533,7 @@ static void mdacon_cursor(struct vc_data *c, int mode)
+
+ static int mdacon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
+ {
+- u16 eattr = mda_convert_attr(c->vc_scrl_erase_char);
++ u16 eattr = mda_convert_attr(c->vc_video_erase_char);
+
+ if (!lines)
+ return 0;
+diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
+index 4055dbd..491c1c1 100644
+--- a/drivers/video/console/sticon.c
++++ b/drivers/video/console/sticon.c
+@@ -170,12 +170,12 @@ static int sticon_scroll(struct vc_data *conp, int t, int b, int dir, int count)
+ switch (dir) {
+ case SM_UP:
+ sti_bmove(sti, t + count, 0, t, 0, b - t - count, conp->vc_cols);
+- sti_clear(sti, b - count, 0, count, conp->vc_cols, conp->vc_scrl_erase_char);
++ sti_clear(sti, b - count, 0, count, conp->vc_cols, conp->vc_video_erase_char);
+ break;
+
+ case SM_DOWN:
+ sti_bmove(sti, t, 0, t + count, 0, b - t - count, conp->vc_cols);
+- sti_clear(sti, t, 0, count, conp->vc_cols, conp->vc_scrl_erase_char);
++ sti_clear(sti, t, 0, count, conp->vc_cols, conp->vc_video_erase_char);
+ break;
+ }
+
+diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
+index bd1f57b..6df29a6 100644
+--- a/drivers/video/console/vgacon.c
++++ b/drivers/video/console/vgacon.c
+@@ -1350,7 +1350,7 @@ static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,
+ } else
+ c->vc_origin += delta;
+ scr_memsetw((u16 *) (c->vc_origin + c->vc_screenbuf_size -
+- delta), c->vc_scrl_erase_char,
++ delta), c->vc_video_erase_char,
+ delta);
+ } else {
+ if (oldo - delta < vga_vram_base) {
+@@ -1363,7 +1363,7 @@ static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,
+ } else
+ c->vc_origin -= delta;
+ c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size;
+- scr_memsetw((u16 *) (c->vc_origin), c->vc_scrl_erase_char,
++ scr_memsetw((u16 *) (c->vc_origin), c->vc_video_erase_char,
+ delta);
+ }
+ c->vc_scr_end = c->vc_origin + c->vc_screenbuf_size;
+diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
+index 655ed8d..e57df48 100644
+--- a/fs/binfmt_elf.c
++++ b/fs/binfmt_elf.c
+@@ -1188,9 +1188,11 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
+ * check for an ELF header. If we find one, dump the first page to
+ * aid in determining what was mapped here.
+ */
+- if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) {
++ if (FILTER(ELF_HEADERS) &&
++ vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) {
+ u32 __user *header = (u32 __user *) vma->vm_start;
+ u32 word;
++ mm_segment_t fs = get_fs();
+ /*
+ * Doing it this way gets the constant folded by GCC.
+ */
+@@ -1203,7 +1205,15 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
+ magic.elfmag[EI_MAG1] = ELFMAG1;
+ magic.elfmag[EI_MAG2] = ELFMAG2;
+ magic.elfmag[EI_MAG3] = ELFMAG3;
+- if (get_user(word, header) == 0 && word == magic.cmp)
++ /*
++ * Switch to the user "segment" for get_user(),
++ * then put back what elf_core_dump() had in place.
++ */
++ set_fs(USER_DS);
++ if (unlikely(get_user(word, header)))
++ word = 0;
++ set_fs(fs);
++ if (word == magic.cmp)
+ return PAGE_SIZE;
+ }
+
+diff --git a/fs/seq_file.c b/fs/seq_file.c
+index bd20f7f..ef4d497 100644
+--- a/fs/seq_file.c
++++ b/fs/seq_file.c
+@@ -54,6 +54,64 @@ int seq_open(struct file *file, const struct seq_operations *op)
+ }
+ EXPORT_SYMBOL(seq_open);
+
++static int traverse(struct seq_file *m, loff_t offset)
++{
++ loff_t pos = 0, index;
++ int error = 0;
++ void *p;
++
++ m->version = 0;
++ index = 0;
++ m->count = m->from = 0;
++ if (!offset) {
++ m->index = index;
++ return 0;
++ }
++ if (!m->buf) {
++ m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
++ if (!m->buf)
++ return -ENOMEM;
++ }
++ p = m->op->start(m, &index);
++ while (p) {
++ error = PTR_ERR(p);
++ if (IS_ERR(p))
++ break;
++ error = m->op->show(m, p);
++ if (error < 0)
++ break;
++ if (unlikely(error)) {
++ error = 0;
++ m->count = 0;
++ }
++ if (m->count == m->size)
++ goto Eoverflow;
++ if (pos + m->count > offset) {
++ m->from = offset - pos;
++ m->count -= m->from;
++ m->index = index;
++ break;
++ }
++ pos += m->count;
++ m->count = 0;
++ if (pos == offset) {
++ index++;
++ m->index = index;
++ break;
++ }
++ p = m->op->next(m, p, &index);
++ }
++ m->op->stop(m, p);
++ m->index = index;
++ return error;
++
++Eoverflow:
++ m->op->stop(m, p);
++ kfree(m->buf);
++ m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
++ return !m->buf ? -ENOMEM : -EAGAIN;
++}
++
+ /**
+ * seq_read - ->read() method for sequential files.
+ * @file: the file to read from
+@@ -186,63 +244,6 @@ Efault:
+ }
+ EXPORT_SYMBOL(seq_read);
+
+-static int traverse(struct seq_file *m, loff_t offset)
+-{
+- loff_t pos = 0, index;
+- int error = 0;
+- void *p;
+-
+- m->version = 0;
+- index = 0;
+- m->count = m->from = 0;
+- if (!offset) {
+- m->index = index;
+- return 0;
+- }
+- if (!m->buf) {
+- m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
+- if (!m->buf)
+- return -ENOMEM;
+- }
+- p = m->op->start(m, &index);
+- while (p) {
+- error = PTR_ERR(p);
+- if (IS_ERR(p))
+- break;
+- error = m->op->show(m, p);
+- if (error < 0)
+- break;
+- if (unlikely(error)) {
+- error = 0;
+- m->count = 0;
+- }
+- if (m->count == m->size)
+- goto Eoverflow;
+- if (pos + m->count > offset) {
+- m->from = offset - pos;
+- m->count -= m->from;
+- m->index = index;
+- break;
+- }
+- pos += m->count;
+- m->count = 0;
+- if (pos == offset) {
+- index++;
+- m->index = index;
+- break;
+- }
+- p = m->op->next(m, p, &index);
+- }
+- m->op->stop(m, p);
+- return error;
+-
+-Eoverflow:
+- m->op->stop(m, p);
+- kfree(m->buf);
+- m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
+- return !m->buf ? -ENOMEM : -EAGAIN;
+-}
+-
+ /**
+ * seq_lseek - ->llseek() method for sequential files.
+ * @file: the file in question
+diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
+index 36d5fcd..8454dee 100644
+--- a/fs/xfs/linux-2.6/xfs_buf.c
++++ b/fs/xfs/linux-2.6/xfs_buf.c
+@@ -1114,8 +1114,7 @@ xfs_buf_bio_end_io(
+ unsigned int blocksize = bp->b_target->bt_bsize;
+ struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
+
+- if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+- bp->b_error = EIO;
++ xfs_buf_ioerror(bp, -error);
+
+ do {
+ struct page *page = bvec->bv_page;
+diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
+index e72bfdd..552637b 100644
+--- a/include/acpi/pdc_intel.h
++++ b/include/acpi/pdc_intel.h
+@@ -14,6 +14,7 @@
+ #define ACPI_PDC_SMP_T_SWCOORD (0x0080)
+ #define ACPI_PDC_C_C1_FFH (0x0100)
+ #define ACPI_PDC_C_C2C3_FFH (0x0200)
++#define ACPI_PDC_SMP_P_HWCOORD (0x0800)
+
+ #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \
+ ACPI_PDC_C_C1_HALT | \
+@@ -22,6 +23,7 @@
+ #define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \
+ ACPI_PDC_C_C1_HALT | \
+ ACPI_PDC_SMP_P_SWCOORD | \
++ ACPI_PDC_SMP_P_HWCOORD | \
+ ACPI_PDC_P_FFH)
+
+ #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
+diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
+index b03f80a..d71f7c0 100644
+--- a/include/linux/console_struct.h
++++ b/include/linux/console_struct.h
+@@ -53,7 +53,6 @@ struct vc_data {
+ unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
+ struct console_font vc_font; /* Current VC font set */
+ unsigned short vc_video_erase_char; /* Background erase character */
+- unsigned short vc_scrl_erase_char; /* Erase character for scroll */
+ /* VT terminal data */
+ unsigned int vc_state; /* Escape sequence parser state */
+ unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
+diff --git a/include/linux/module.h b/include/linux/module.h
+index 68e0955..760a41b 100644
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -387,7 +387,6 @@ void symbol_put_addr(void *addr);
+ static inline void __module_get(struct module *module)
+ {
+ if (module) {
+- BUG_ON(module_refcount(module) == 0);
+ local_inc(&module->ref[get_cpu()].count);
+ put_cpu();
+ }
+diff --git a/include/linux/pci.h b/include/linux/pci.h
+index 426e029..911b99d 100644
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -639,7 +639,7 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags);
+ /* ROM control related routines */
+ void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
+ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
+-size_t pci_get_rom_size(void __iomem *rom, size_t size);
++size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
+
+ /* Power management related routines */
+ int pci_save_state(struct pci_dev *dev);
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
+index 26b59cb..794e546 100644
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -1755,6 +1755,7 @@
+ #define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081
+ #define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082
+ #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050
++#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530
+
+ #define PCI_VENDOR_ID_RADISYS 0x1331
+
+diff --git a/include/linux/wait.h b/include/linux/wait.h
+index 0081147..3c2f411 100644
+--- a/include/linux/wait.h
++++ b/include/linux/wait.h
+@@ -141,6 +141,8 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
+ list_del(&old->task_list);
+ }
+
++void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
++ int nr_exclusive, int sync, void *key);
+ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
+ extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
+ extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
+@@ -342,16 +344,19 @@ do { \
+ for (;;) { \
+ prepare_to_wait_exclusive(&wq, &__wait, \
+ TASK_INTERRUPTIBLE); \
+- if (condition) \
++ if (condition) { \
++ finish_wait(&wq, &__wait); \
+ break; \
++ } \
+ if (!signal_pending(current)) { \
+ schedule(); \
+ continue; \
+ } \
+ ret = -ERESTARTSYS; \
++ abort_exclusive_wait(&wq, &__wait, \
++ TASK_INTERRUPTIBLE, NULL); \
+ break; \
+ } \
+- finish_wait(&wq, &__wait); \
+ } while (0)
+
+ #define wait_event_interruptible_exclusive(wq, condition) \
+@@ -440,6 +445,8 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,
+ void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
+ void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
+ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
++void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
++ unsigned int mode, void *key);
+ int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
+ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
+
+diff --git a/ipc/shm.c b/ipc/shm.c
+index f00c897..35a65be 100644
+--- a/ipc/shm.c
++++ b/ipc/shm.c
+@@ -565,11 +565,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
+ struct hstate *h = hstate_file(shp->shm_file);
+ *rss += pages_per_huge_page(h) * mapping->nrpages;
+ } else {
++#ifdef CONFIG_SHMEM
+ struct shmem_inode_info *info = SHMEM_I(inode);
+ spin_lock(&info->lock);
+ *rss += inode->i_mapping->nrpages;
+ *swp += info->swapped;
+ spin_unlock(&info->lock);
++#else
++ *rss += inode->i_mapping->nrpages;
++#endif
+ }
+
+ total++;
+diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
+index 3cd441e..48c58fe 100644
+--- a/kernel/irq/chip.c
++++ b/kernel/irq/chip.c
+@@ -78,6 +78,7 @@ void dynamic_irq_cleanup(unsigned int irq)
+ desc->chip_data = NULL;
+ desc->handle_irq = handle_bad_irq;
+ desc->chip = &no_irq_chip;
++ desc->name = NULL;
+ spin_unlock_irqrestore(&desc->lock, flags);
+ }
+
+diff --git a/kernel/sched.c b/kernel/sched.c
+index 2a09e44..98c0cdc 100644
+--- a/kernel/sched.c
++++ b/kernel/sched.c
+@@ -4556,8 +4556,8 @@ EXPORT_SYMBOL(default_wake_function);
+ * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
+ * zero in this (rare) case, and we handle it by continuing to scan the queue.
+ */
+-static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
+- int nr_exclusive, int sync, void *key)
++void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
++ int nr_exclusive, int sync, void *key)
+ {
+ wait_queue_t *curr, *next;
+
+diff --git a/kernel/wait.c b/kernel/wait.c
+index c275c56..24688c7 100644
+--- a/kernel/wait.c
++++ b/kernel/wait.c
+@@ -101,6 +101,15 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
+ }
+ EXPORT_SYMBOL(prepare_to_wait_exclusive);
+
++/*
++ * finish_wait - clean up after waiting in a queue
++ * @q: waitqueue waited on
++ * @wait: wait descriptor
++ *
++ * Sets current thread back to running state and removes
++ * the wait descriptor from the given waitqueue if still
++ * queued.
++ */
+ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
+ {
+ unsigned long flags;
+@@ -127,6 +136,39 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
+ }
+ EXPORT_SYMBOL(finish_wait);
+
++/*
++ * abort_exclusive_wait - abort exclusive waiting in a queue
++ * @q: waitqueue waited on
++ * @wait: wait descriptor
++ * @state: runstate of the waiter to be woken
++ * @key: key to identify a wait bit queue or %NULL
++ *
++ * Sets current thread back to running state and removes
++ * the wait descriptor from the given waitqueue if still
++ * queued.
++ *
++ * Wakes up the next waiter if the caller is concurrently
++ * woken up through the queue.
++ *
++ * This prevents waiter starvation where an exclusive waiter
++ * aborts and is woken up concurrently and noone wakes up
++ * the next waiter.
++ */
++void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
++ unsigned int mode, void *key)
++{
++ unsigned long flags;
++
++ __set_current_state(TASK_RUNNING);
++ spin_lock_irqsave(&q->lock, flags);
++ if (!list_empty(&wait->task_list))
++ list_del_init(&wait->task_list);
++ else if (waitqueue_active(q))
++ __wake_up_common(q, mode, 1, 0, key);
++ spin_unlock_irqrestore(&q->lock, flags);
++}
++EXPORT_SYMBOL(abort_exclusive_wait);
++
+ int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
+ {
+ int ret = default_wake_function(wait, mode, sync, key);
+@@ -187,17 +229,20 @@ int __sched
+ __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,
+ int (*action)(void *), unsigned mode)
+ {
+- int ret = 0;
+-
+ do {
++ int ret;
++
+ prepare_to_wait_exclusive(wq, &q->wait, mode);
+- if (test_bit(q->key.bit_nr, q->key.flags)) {
+- if ((ret = (*action)(q->key.flags)))
+- break;
+- }
++ if (!test_bit(q->key.bit_nr, q->key.flags))
++ continue;
++ ret = action(q->key.flags);
++ if (!ret)
++ continue;
++ abort_exclusive_wait(wq, &q->wait, mode, &q->key);
++ return ret;
+ } while (test_and_set_bit(q->key.bit_nr, q->key.flags));
+ finish_wait(wq, &q->wait);
+- return ret;
++ return 0;
+ }
+ EXPORT_SYMBOL(__wait_on_bit_lock);
+
+diff --git a/mm/swap.c b/mm/swap.c
+index 9e0cb31..65e6825 100644
+--- a/mm/swap.c
++++ b/mm/swap.c
+@@ -244,7 +244,6 @@ void lru_add_drain(void)
+ put_cpu();
+ }
+
+-#ifdef CONFIG_NUMA
+ static void lru_add_drain_per_cpu(struct work_struct *dummy)
+ {
+ lru_add_drain();
+@@ -258,18 +257,6 @@ int lru_add_drain_all(void)
+ return schedule_on_each_cpu(lru_add_drain_per_cpu);
+ }
+
+-#else
+-
+-/*
+- * Returns 0 for success
+- */
+-int lru_add_drain_all(void)
+-{
+- lru_add_drain();
+- return 0;
+-}
+-#endif
+-
+ /*
+ * Batched page_cache_release(). Decrement the reference count on all the
+ * passed pages. If it fell to zero then remove the page from the LRU and
+diff --git a/net/sctp/input.c b/net/sctp/input.c
+index a49fa80..be736af 100644
+--- a/net/sctp/input.c
++++ b/net/sctp/input.c
+@@ -249,6 +249,19 @@ int sctp_rcv(struct sk_buff *skb)
+ */
+ sctp_bh_lock_sock(sk);
+
++ if (sk != rcvr->sk) {
++ /* Our cached sk is different from the rcvr->sk. This is
++ * because migrate()/accept() may have moved the association
++ * to a new socket and released all the sockets. So now we
++ * are holding a lock on the old socket while the user may
++ * be doing something with the new socket. Switch our veiw
++ * of the current sk.
++ */
++ sctp_bh_unlock_sock(sk);
++ sk = rcvr->sk;
++ sctp_bh_lock_sock(sk);
++ }
++
+ if (sock_owned_by_user(sk)) {
+ SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG);
+ sctp_add_backlog(sk, skb);
+diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
+index 3e65719..e4c27c1 100644
+--- a/net/sunrpc/svcsock.c
++++ b/net/sunrpc/svcsock.c
+@@ -1171,7 +1171,11 @@ int svc_addsock(struct svc_serv *serv,
+ else if (so->state > SS_UNCONNECTED)
+ err = -EISCONN;
+ else {
+- svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS);
++ if (!try_module_get(THIS_MODULE))
++ err = -ENOENT;
++ else
++ svsk = svc_setup_socket(serv, so, &err,
++ SVC_SOCK_DEFAULTS);
+ if (svsk) {
+ struct sockaddr_storage addr;
+ struct sockaddr *sin = (struct sockaddr *)&addr;
+@@ -1184,7 +1188,8 @@ int svc_addsock(struct svc_serv *serv,
+ spin_unlock_bh(&serv->sv_lock);
+ svc_xprt_received(&svsk->sk_xprt);
+ err = 0;
+- }
++ } else
++ module_put(THIS_MODULE);
+ }
+ if (err) {
+ sockfd_put(so);
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index aa7dc03..db9c702 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -920,6 +920,7 @@ do_sku:
+ case 0x10ec0267:
+ case 0x10ec0268:
+ case 0x10ec0269:
++ case 0x10ec0272:
+ case 0x10ec0660:
+ case 0x10ec0662:
+ case 0x10ec0663:
+@@ -948,6 +949,7 @@ do_sku:
+ case 0x10ec0882:
+ case 0x10ec0883:
+ case 0x10ec0885:
++ case 0x10ec0887:
+ case 0x10ec0889:
+ snd_hda_codec_write(codec, 0x20, 0,
+ AC_VERB_SET_COEF_INDEX, 7);
+@@ -8059,6 +8061,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
+ SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
+ SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
+ SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
++ SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
++ ALC883_FUJITSU_PI2515),
+ SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
+ SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
+ SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
+diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
+index b8cfb7c..7a1a8c8 100644
+--- a/sound/usb/usbaudio.c
++++ b/sound/usb/usbaudio.c
+@@ -2958,6 +2958,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
+ return -EINVAL;
+ }
+ alts = &iface->altsetting[fp->altset_idx];
++ fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
+ usb_set_interface(chip->dev, fp->iface, 0);
+ init_usb_pitch(chip->dev, fp->iface, alts, fp);
+ init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max);
Added: genpatches-2.6/trunk/2.6.27/1016_linux-2.6.27.17.patch
===================================================================
--- genpatches-2.6/trunk/2.6.27/1016_linux-2.6.27.17.patch (rev 0)
+++ genpatches-2.6/trunk/2.6.27/1016_linux-2.6.27.17.patch 2009-02-20 19:20:18 UTC (rev 1498)
@@ -0,0 +1,20 @@
+diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
+index eab790f..e28469e 100644
+--- a/drivers/acpi/dock.c
++++ b/drivers/acpi/dock.c
+@@ -691,14 +691,8 @@ fdd_out:
+ static ssize_t show_docked(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+- struct acpi_device *tmp;
+-
+- struct dock_station *dock_station = *((struct dock_station **)
+- dev->platform_data);
++ return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
+
+- if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
+- return snprintf(buf, PAGE_SIZE, "1\n");
+- return snprintf(buf, PAGE_SIZE, "0\n");
+ }
+ static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
+
Added: genpatches-2.6/trunk/2.6.27/1017_linux-2.6.27.18.patch
===================================================================
--- genpatches-2.6/trunk/2.6.27/1017_linux-2.6.27.18.patch (rev 0)
+++ genpatches-2.6/trunk/2.6.27/1017_linux-2.6.27.18.patch 2009-02-20 19:20:18 UTC (rev 1498)
@@ -0,0 +1,1672 @@
+diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
+index 3e80aa3..a6a4310 100644
+--- a/arch/powerpc/kernel/signal_32.c
++++ b/arch/powerpc/kernel/signal_32.c
+@@ -410,7 +410,7 @@ inline unsigned long copy_fpr_from_user(struct task_struct *task,
+ * altivec/spe instructions at some point.
+ */
+ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
+- int sigret)
++ int sigret, int ctx_has_vsx_region)
+ {
+ unsigned long msr = regs->msr;
+
+@@ -451,7 +451,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
+ * the saved MSR value to indicate that frame->mc_vregs
+ * contains valid data
+ */
+- if (current->thread.used_vsr) {
++ if (current->thread.used_vsr && ctx_has_vsx_region) {
+ __giveup_vsx(current);
+ if (copy_vsx_to_user(&frame->mc_vsregs, current))
+ return 1;
+@@ -858,11 +858,11 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
+ frame = &rt_sf->uc.uc_mcontext;
+ addr = frame;
+ if (vdso32_rt_sigtramp && current->mm->context.vdso_base) {
+- if (save_user_regs(regs, frame, 0))
++ if (save_user_regs(regs, frame, 0, 1))
+ goto badframe;
+ regs->link = current->mm->context.vdso_base + vdso32_rt_sigtramp;
+ } else {
+- if (save_user_regs(regs, frame, __NR_rt_sigreturn))
++ if (save_user_regs(regs, frame, __NR_rt_sigreturn, 1))
+ goto badframe;
+ regs->link = (unsigned long) frame->tramp;
+ }
+@@ -936,12 +936,13 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
+ int ctx_size, int r6, int r7, int r8, struct pt_regs *regs)
+ {
+ unsigned char tmp;
++ int ctx_has_vsx_region = 0;
+
+ #ifdef CONFIG_PPC64
+ unsigned long new_msr = 0;
+
+ if (new_ctx &&
+- __get_user(new_msr, &new_ctx->uc_mcontext.mc_gregs[PT_MSR]))
++ get_user(new_msr, &new_ctx->uc_mcontext.mc_gregs[PT_MSR]))
+ return -EFAULT;
+ /*
+ * Check that the context is not smaller than the original
+@@ -956,16 +957,9 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
+ if ((ctx_size < sizeof(struct ucontext)) &&
+ (new_msr & MSR_VSX))
+ return -EINVAL;
+-#ifdef CONFIG_VSX
+- /*
+- * If userspace doesn't provide enough room for VSX data,
+- * but current thread has used VSX, we don't have anywhere
+- * to store the full context back into.
+- */
+- if ((ctx_size < sizeof(struct ucontext)) &&
+- (current->thread.used_vsr && old_ctx))
+- return -EINVAL;
+-#endif
++ /* Does the context have enough room to store VSX data? */
++ if (ctx_size >= sizeof(struct ucontext))
++ ctx_has_vsx_region = 1;
+ #else
+ /* Context size is for future use. Right now, we only make sure
+ * we are passed something we understand
+@@ -985,17 +979,17 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
+ */
+ mctx = (struct mcontext __user *)
+ ((unsigned long) &old_ctx->uc_mcontext & ~0xfUL);
+- if (!access_ok(VERIFY_WRITE, old_ctx, sizeof(*old_ctx))
+- || save_user_regs(regs, mctx, 0)
++ if (!access_ok(VERIFY_WRITE, old_ctx, ctx_size)
++ || save_user_regs(regs, mctx, 0, ctx_has_vsx_region)
+ || put_sigset_t(&old_ctx->uc_sigmask, ¤t->blocked)
+ || __put_user(to_user_ptr(mctx), &old_ctx->uc_regs))
+ return -EFAULT;
+ }
+ if (new_ctx == NULL)
+ return 0;
+- if (!access_ok(VERIFY_READ, new_ctx, sizeof(*new_ctx))
++ if (!access_ok(VERIFY_READ, new_ctx, ctx_size)
+ || __get_user(tmp, (u8 __user *) new_ctx)
+- || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
++ || __get_user(tmp, (u8 __user *) new_ctx + ctx_size - 1))
+ return -EFAULT;
+
+ /*
+@@ -1196,11 +1190,11 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
+ goto badframe;
+
+ if (vdso32_sigtramp && current->mm->context.vdso_base) {
+- if (save_user_regs(regs, &frame->mctx, 0))
++ if (save_user_regs(regs, &frame->mctx, 0, 1))
+ goto badframe;
+ regs->link = current->mm->context.vdso_base + vdso32_sigtramp;
+ } else {
+- if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
++ if (save_user_regs(regs, &frame->mctx, __NR_sigreturn, 1))
+ goto badframe;
+ regs->link = (unsigned long) frame->mctx.tramp;
+ }
+diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
+index 65ad925..e4acdbd 100644
+--- a/arch/powerpc/kernel/signal_64.c
++++ b/arch/powerpc/kernel/signal_64.c
+@@ -74,7 +74,8 @@ static const char fmt64[] = KERN_INFO \
+ */
+
+ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
+- int signr, sigset_t *set, unsigned long handler)
++ int signr, sigset_t *set, unsigned long handler,
++ int ctx_has_vsx_region)
+ {
+ /* When CONFIG_ALTIVEC is set, we _always_ setup v_regs even if the
+ * process never used altivec yet (MSR_VEC is zero in pt_regs of
+@@ -121,7 +122,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
+ * then out to userspace. Update v_regs to point after the
+ * VMX data.
+ */
+- if (current->thread.used_vsr) {
++ if (current->thread.used_vsr && ctx_has_vsx_region) {
+ __giveup_vsx(current);
+ v_regs += ELF_NVRREG;
+ err |= copy_vsx_to_user(v_regs, current);
+@@ -284,9 +285,10 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
+ unsigned char tmp;
+ sigset_t set;
+ unsigned long new_msr = 0;
++ int ctx_has_vsx_region = 0;
+
+ if (new_ctx &&
+- __get_user(new_msr, &new_ctx->uc_mcontext.gp_regs[PT_MSR]))
++ get_user(new_msr, &new_ctx->uc_mcontext.gp_regs[PT_MSR]))
+ return -EFAULT;
+ /*
+ * Check that the context is not smaller than the original
+@@ -301,28 +303,23 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
+ if ((ctx_size < sizeof(struct ucontext)) &&
+ (new_msr & MSR_VSX))
+ return -EINVAL;
+-#ifdef CONFIG_VSX
+- /*
+- * If userspace doesn't provide enough room for VSX data,
+- * but current thread has used VSX, we don't have anywhere
+- * to store the full context back into.
+- */
+- if ((ctx_size < sizeof(struct ucontext)) &&
+- (current->thread.used_vsr && old_ctx))
+- return -EINVAL;
+-#endif
++ /* Does the context have enough room to store VSX data? */
++ if (ctx_size >= sizeof(struct ucontext))
++ ctx_has_vsx_region = 1;
++
+ if (old_ctx != NULL) {
+- if (!access_ok(VERIFY_WRITE, old_ctx, sizeof(*old_ctx))
+- || setup_sigcontext(&old_ctx->uc_mcontext, regs, 0, NULL, 0)
++ if (!access_ok(VERIFY_WRITE, old_ctx, ctx_size)
++ || setup_sigcontext(&old_ctx->uc_mcontext, regs, 0, NULL, 0,
++ ctx_has_vsx_region)
+ || __copy_to_user(&old_ctx->uc_sigmask,
+ ¤t->blocked, sizeof(sigset_t)))
+ return -EFAULT;
+ }
+ if (new_ctx == NULL)
+ return 0;
+- if (!access_ok(VERIFY_READ, new_ctx, sizeof(*new_ctx))
++ if (!access_ok(VERIFY_READ, new_ctx, ctx_size)
+ || __get_user(tmp, (u8 __user *) new_ctx)
+- || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
++ || __get_user(tmp, (u8 __user *) new_ctx + ctx_size - 1))
+ return -EFAULT;
+
+ /*
+@@ -425,7 +422,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
+ &frame->uc.uc_stack.ss_flags);
+ err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
+ err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, signr, NULL,
+- (unsigned long)ka->sa.sa_handler);
++ (unsigned long)ka->sa.sa_handler, 1);
+ err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+ if (err)
+ goto badframe;
+diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
+index ce10e2b..131d729 100644
+--- a/arch/powerpc/mm/fsl_booke_mmu.c
++++ b/arch/powerpc/mm/fsl_booke_mmu.c
+@@ -80,7 +80,7 @@ extern unsigned int tlbcam_index;
+ /*
+ * Return PA for this VA if it is mapped by a CAM, or 0
+ */
+-unsigned long v_mapped_by_tlbcam(unsigned long va)
++phys_addr_t v_mapped_by_tlbcam(unsigned long va)
+ {
+ int b;
+ for (b = 0; b < tlbcam_index; ++b)
+@@ -92,7 +92,7 @@ unsigned long v_mapped_by_tlbcam(unsigned long va)
+ /*
+ * Return VA for a given PA or 0 if not mapped
+ */
+-unsigned long p_mapped_by_tlbcam(unsigned long pa)
++unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
+ {
+ int b;
+ for (b = 0; b < tlbcam_index; ++b)
+diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
+index 2001abd..05922b2 100644
+--- a/arch/powerpc/mm/pgtable_32.c
++++ b/arch/powerpc/mm/pgtable_32.c
+@@ -65,8 +65,8 @@ void setbat(int index, unsigned long virt, phys_addr_t phys,
+
+ #ifdef HAVE_TLBCAM
+ extern unsigned int tlbcam_index;
+-extern unsigned long v_mapped_by_tlbcam(unsigned long va);
+-extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
++extern phys_addr_t v_mapped_by_tlbcam(unsigned long va);
++extern unsigned long p_mapped_by_tlbcam(phys_addr_t pa);
+ #else /* !HAVE_TLBCAM */
+ #define v_mapped_by_tlbcam(x) (0UL)
+ #define p_mapped_by_tlbcam(x) (0UL)
+diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
+index 36b4b7a..b376667 100644
+--- a/arch/sparc64/Kconfig
++++ b/arch/sparc64/Kconfig
+@@ -15,6 +15,7 @@ config SPARC64
+ select HAVE_FTRACE
+ select HAVE_IDE
+ select HAVE_LMB
++ select HAVE_SYSCALL_WRAPPERS
+ select HAVE_ARCH_KGDB
+ select USE_GENERIC_SMP_HELPERS if SMP
+ select HAVE_ARCH_TRACEHOOK
+diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
+index 39749e3..73b287e 100644
+--- a/arch/sparc64/kernel/sys_sparc.c
++++ b/arch/sparc64/kernel/sys_sparc.c
+@@ -397,7 +397,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+ }
+ }
+
+-asmlinkage unsigned long sparc_brk(unsigned long brk)
++SYSCALL_DEFINE1(sparc_brk, unsigned long, brk)
+ {
+ /* People could try to be nasty and use ta 0x6d in 32bit programs */
+ if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
+@@ -413,7 +413,7 @@ asmlinkage unsigned long sparc_brk(unsigned long brk)
+ * sys_pipe() is the normal C calling standard for creating
+ * a pipe. It's not the way unix traditionally does this, though.
+ */
+-asmlinkage long sparc_pipe(struct pt_regs *regs)
++SYSCALL_DEFINE1(sparc_pipe_real, struct pt_regs *, regs)
+ {
+ int fd[2];
+ int error;
+@@ -433,8 +433,8 @@ out:
+ * This is really horribly ugly.
+ */
+
+-asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
+- unsigned long third, void __user *ptr, long fifth)
++SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
++ unsigned long, third, void __user *, ptr, long, fifth)
+ {
+ long err;
+
+@@ -517,7 +517,7 @@ out:
+ return err;
+ }
+
+-asmlinkage long sparc64_newuname(struct new_utsname __user *name)
++SYSCALL_DEFINE1(sparc64_newuname, struct new_utsname __user *, name)
+ {
+ int ret = sys_newuname(name);
+
+@@ -528,7 +528,7 @@ asmlinkage long sparc64_newuname(struct new_utsname __user *name)
+ return ret;
+ }
+
+-asmlinkage long sparc64_personality(unsigned long personality)
++SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
+ {
+ int ret;
+
+@@ -562,9 +562,9 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
+ }
+
+ /* Linux version of mmap */
+-asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
+- unsigned long prot, unsigned long flags, unsigned long fd,
+- unsigned long off)
++SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
++ unsigned long, prot, unsigned long, flags, unsigned long, fd,
++ unsigned long, off)
+ {
+ struct file * file = NULL;
+ unsigned long retval = -EBADF;
+@@ -587,7 +587,7 @@ out:
+ return retval;
+ }
+
+-asmlinkage long sys64_munmap(unsigned long addr, size_t len)
++SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
+ {
+ long ret;
+
+@@ -604,9 +604,9 @@ extern unsigned long do_mremap(unsigned long addr,
+ unsigned long old_len, unsigned long new_len,
+ unsigned long flags, unsigned long new_addr);
+
+-asmlinkage unsigned long sys64_mremap(unsigned long addr,
+- unsigned long old_len, unsigned long new_len,
+- unsigned long flags, unsigned long new_addr)
++SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
++ unsigned long, new_len, unsigned long, flags,
++ unsigned long, new_addr)
+ {
+ unsigned long ret = -EINVAL;
+
+@@ -669,7 +669,7 @@ asmlinkage void sparc_breakpoint(struct pt_regs *regs)
+
+ extern void check_pending(int signum);
+
+-asmlinkage long sys_getdomainname(char __user *name, int len)
++SYSCALL_DEFINE2(getdomainname, char __user *, name, int, len)
+ {
+ int nlen, err;
+
+@@ -692,11 +692,10 @@ out:
+ return err;
+ }
+
+-asmlinkage long sys_utrap_install(utrap_entry_t type,
+- utrap_handler_t new_p,
+- utrap_handler_t new_d,
+- utrap_handler_t __user *old_p,
+- utrap_handler_t __user *old_d)
++SYSCALL_DEFINE5(utrap_install, utrap_entry_t, type,
++ utrap_handler_t, new_p, utrap_handler_t, new_d,
++ utrap_handler_t __user *, old_p,
++ utrap_handler_t __user *, old_d)
+ {
+ if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31)
+ return -EINVAL;
+@@ -762,11 +761,9 @@ asmlinkage long sparc_memory_ordering(unsigned long model,
+ return 0;
+ }
+
+-asmlinkage long sys_rt_sigaction(int sig,
+- const struct sigaction __user *act,
+- struct sigaction __user *oact,
+- void __user *restorer,
+- size_t sigsetsize)
++SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act,
++ struct sigaction __user *, oact, void __user *, restorer,
++ size_t, sigsetsize)
+ {
+ struct k_sigaction new_ka, old_ka;
+ int ret;
+@@ -806,7 +803,8 @@ asmlinkage void update_perfctrs(void)
+ reset_pic();
+ }
+
+-asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
++SYSCALL_DEFINE4(perfctr, int, opcode, unsigned long, arg0,
++ unsigned long, arg1, unsigned long, arg2)
+ {
+ int err = 0;
+
+diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc64/kernel/syscalls.S
+index cd2d333..5a0b52e 100644
+--- a/arch/sparc64/kernel/syscalls.S
++++ b/arch/sparc64/kernel/syscalls.S
+@@ -21,7 +21,7 @@ execve_merge:
+
+ .align 32
+ sys_sparc_pipe:
+- ba,pt %xcc, sparc_pipe
++ ba,pt %xcc, sys_sparc_pipe_real
+ add %sp, PTREGS_OFF, %o0
+ sys_nis_syscall:
+ ba,pt %xcc, c_sys_nis_syscall
+diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
+index 26b39de..8fafe0b 100644
+--- a/arch/sparc64/kernel/systbls.S
++++ b/arch/sparc64/kernel/systbls.S
+@@ -21,7 +21,7 @@ sys_call_table32:
+ /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
+ /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
+ /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod
+-/*15*/ .word sys_chmod, sys_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
++/*15*/ .word sys_chmod, sys_lchown16, sys_sparc_brk, sys32_perfctr, sys32_lseek
+ /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
+ /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
+ /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
+@@ -55,8 +55,8 @@ sys_call_table32:
+ /*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
+ .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
+ /*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
+- .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
+-/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
++ .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sys_sparc64_newuname
++/*190*/ .word sys32_init_module, sys_sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
+ .word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask
+ /*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
+ .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
+@@ -95,7 +95,7 @@ sys_call_table:
+ /*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
+ /*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link
+ /*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
+-/*15*/ .word sys_chmod, sys_lchown, sparc_brk, sys_perfctr, sys_lseek
++/*15*/ .word sys_chmod, sys_lchown, sys_sparc_brk, sys_perfctr, sys_lseek
+ /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
+ /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
+ /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
+@@ -106,7 +106,7 @@ sys_call_table:
+ .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
+ /*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
+ .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall
+-/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys64_munmap, sys_mprotect
++/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys_64_munmap, sys_mprotect
+ .word sys_madvise, sys_vhangup, sys_nis_syscall, sys_mincore, sys_getgroups
+ /*80*/ .word sys_setgroups, sys_getpgrp, sys_nis_syscall, sys_setitimer, sys_nis_syscall
+ .word sys_swapon, sys_getitimer, sys_nis_syscall, sys_sethostname, sys_nis_syscall
+@@ -129,8 +129,8 @@ sys_call_table:
+ /*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
+ .word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
+ /*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall
+- .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname
+-/*190*/ .word sys_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
++ .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_sparc64_newuname
++/*190*/ .word sys_init_module, sys_sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
+ .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask
+ /*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
+ .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
+@@ -142,7 +142,7 @@ sys_call_table:
+ .word sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
+ /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
+ .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
+-/*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
++/*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
+ .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
+ /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
+ .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
+diff --git a/arch/sparc64/kernel/systbls.h b/arch/sparc64/kernel/systbls.h
+index bc9f5da..15c2d75 100644
+--- a/arch/sparc64/kernel/systbls.h
++++ b/arch/sparc64/kernel/systbls.h
+@@ -16,9 +16,6 @@ extern asmlinkage long sys_ipc(unsigned int call, int first,
+ void __user *ptr, long fifth);
+ extern asmlinkage long sparc64_newuname(struct new_utsname __user *name);
+ extern asmlinkage long sparc64_personality(unsigned long personality);
+-extern asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
+- unsigned long prot, unsigned long flags,
+- unsigned long fd, unsigned long off);
+ extern asmlinkage long sys64_munmap(unsigned long addr, size_t len);
+ extern asmlinkage unsigned long sys64_mremap(unsigned long addr,
+ unsigned long old_len,
+diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
+index f370d38..c4e6cc9 100644
+--- a/arch/x86/kernel/vmi_32.c
++++ b/arch/x86/kernel/vmi_32.c
+@@ -430,6 +430,16 @@ static void vmi_release_pmd(u32 pfn)
+ }
+
+ /*
++ * We use the pgd_free hook for releasing the pgd page:
++ */
++static void vmi_pgd_free(struct mm_struct *mm, pgd_t *pgd)
++{
++ unsigned long pfn = __pa(pgd) >> PAGE_SHIFT;
++
++ vmi_ops.release_page(pfn, VMI_PAGE_L2);
++}
++
++/*
+ * Helper macros for MMU update flags. We can defer updates until a flush
+ * or page invalidation only if the update is to the current address space
+ * (otherwise, there is no flush). We must check against init_mm, since
+@@ -881,6 +891,7 @@ static inline int __init activate_vmi(void)
+ if (vmi_ops.release_page) {
+ pv_mmu_ops.release_pte = vmi_release_pte;
+ pv_mmu_ops.release_pmd = vmi_release_pmd;
++ pv_mmu_ops.pgd_free = vmi_pgd_free;
+ }
+
+ /* Set linear is needed in all cases */
+diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
+index 4bdaa59..315b071 100644
+--- a/arch/x86/pci/fixup.c
++++ b/arch/x86/pci/fixup.c
+@@ -496,18 +496,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
+ pci_siemens_interrupt_controller);
+
+ /*
+- * Regular PCI devices have 256 bytes, but AMD Family 10h Opteron ext config
+- * have 4096 bytes. Even if the device is capable, that doesn't mean we can
+- * access it. Maybe we don't have a way to generate extended config space
+- * accesses. So check it
++ * Regular PCI devices have 256 bytes, but AMD Family 10h/11h CPUs have
++ * 4096 bytes configuration space for each function of their processor
++ * configuration space.
+ */
+-static void fam10h_pci_cfg_space_size(struct pci_dev *dev)
++static void amd_cpu_pci_cfg_space_size(struct pci_dev *dev)
+ {
+ dev->cfg_size = pci_cfg_space_size_ext(dev);
+ }
+-
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, fam10h_pci_cfg_space_size);
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1201, fam10h_pci_cfg_space_size);
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1202, fam10h_pci_cfg_space_size);
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1203, fam10h_pci_cfg_space_size);
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1204, fam10h_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1200, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1201, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1202, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1203, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1204, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1300, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1301, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1302, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1303, amd_cpu_pci_cfg_space_size);
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1304, amd_cpu_pci_cfg_space_size);
+diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
+index 2c4ccec..154e7d6 100644
+--- a/drivers/ata/libata-eh.c
++++ b/drivers/ata/libata-eh.c
+@@ -2694,12 +2694,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
+ /* give it just one more chance */
+ ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
+ case -EIO:
+- if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
++ if (ehc->tries[dev->devno] == 1) {
+ /* This is the last chance, better to slow
+ * down than lose it.
+ */
+ sata_down_spd_limit(dev->link);
+- ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
++ if (dev->pio_mode > XFER_PIO_0)
++ ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+ }
+ }
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index 1778e4a..814ffd9 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -547,6 +547,15 @@ static void do_nbd_request(struct request_queue * q)
+
+ BUG_ON(lo->magic != LO_MAGIC);
+
++ if (unlikely(!lo->sock)) {
++ printk(KERN_ERR "%s: Attempted send on closed socket\n",
++ lo->disk->disk_name);
++ req->errors++;
++ nbd_end_request(req);
++ spin_lock_irq(q->queue_lock);
++ continue;
++ }
++
+ spin_lock_irq(&lo->queue_lock);
+ list_add_tail(&req->queuelist, &lo->waiting_queue);
+ spin_unlock_irq(&lo->queue_lock);
+diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
+index e87956a..1371184 100644
+--- a/drivers/hid/usbhid/hid-quirks.c
++++ b/drivers/hid/usbhid/hid-quirks.c
+@@ -1130,24 +1130,16 @@ static void usbhid_fixup_button_consumer_descriptor(unsigned char *rdesc, int rs
+ }
+
+ /*
+- * Microsoft Wireless Desktop Receiver (Model 1028) has several
++ * Microsoft Wireless Desktop Receiver (Model 1028) has
+ * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
+ */
+ static void usbhid_fixup_microsoft_descriptor(unsigned char *rdesc, int rsize)
+ {
+- if (rsize == 571 && rdesc[284] == 0x19
+- && rdesc[286] == 0x2a
+- && rdesc[304] == 0x19
+- && rdesc[306] == 0x29
+- && rdesc[352] == 0x1a
+- && rdesc[355] == 0x2a
+- && rdesc[557] == 0x19
++ if (rsize == 571 && rdesc[557] == 0x19
+ && rdesc[559] == 0x29) {
+ printk(KERN_INFO "Fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
+- rdesc[284] = rdesc[304] = rdesc[557] = 0x35;
+- rdesc[352] = 0x36;
+- rdesc[286] = rdesc[355] = 0x46;
+- rdesc[306] = rdesc[559] = 0x45;
++ rdesc[557] = 0x35;
++ rdesc[559] = 0x45;
+ }
+ }
+
+diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
+index a2b092b..b7d829f 100644
+--- a/drivers/net/skfp/skfddi.c
++++ b/drivers/net/skfp/skfddi.c
+@@ -998,9 +998,9 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+ break;
+ case SKFP_CLR_STATS: /* Zero out the driver statistics */
+ if (!capable(CAP_NET_ADMIN)) {
+- memset(&lp->MacStat, 0, sizeof(lp->MacStat));
+- } else {
+ status = -EPERM;
++ } else {
++ memset(&lp->MacStat, 0, sizeof(lp->MacStat));
+ }
+ break;
+ default:
+diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
+index b4be33a..b68bc39 100644
+--- a/drivers/net/sky2.c
++++ b/drivers/net/sky2.c
+@@ -1403,9 +1403,6 @@ static int sky2_up(struct net_device *dev)
+
+ }
+
+- if (netif_msg_ifup(sky2))
+- printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
+-
+ netif_carrier_off(dev);
+
+ /* must be power of 2 */
+@@ -1484,6 +1481,9 @@ static int sky2_up(struct net_device *dev)
+ sky2_write32(hw, B0_IMSK, imask);
+
+ sky2_set_multicast(dev);
++
++ if (netif_msg_ifup(sky2))
++ printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
+ return 0;
+
+ err_out:
+diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
+index 4291458..88f9fd5 100644
+--- a/drivers/net/sungem.c
++++ b/drivers/net/sungem.c
+@@ -2205,6 +2205,8 @@ static int gem_do_start(struct net_device *dev)
+
+ gp->running = 1;
+
++ napi_enable(&gp->napi);
++
+ if (gp->lstate == link_up) {
+ netif_carrier_on(gp->dev);
+ gem_set_link_modes(gp);
+@@ -2222,6 +2224,8 @@ static int gem_do_start(struct net_device *dev)
+ spin_lock_irqsave(&gp->lock, flags);
+ spin_lock(&gp->tx_lock);
+
++ napi_disable(&gp->napi);
++
+ gp->running = 0;
+ gem_reset(gp);
+ gem_clean_rings(gp);
+@@ -2322,8 +2326,6 @@ static int gem_open(struct net_device *dev)
+ if (!gp->asleep)
+ rc = gem_do_start(dev);
+ gp->opened = (rc == 0);
+- if (gp->opened)
+- napi_enable(&gp->napi);
+
+ mutex_unlock(&gp->pm_mutex);
+
+@@ -2460,8 +2462,6 @@ static int gem_resume(struct pci_dev *pdev)
+
+ /* Re-attach net device */
+ netif_device_attach(dev);
+-
+- napi_enable(&gp->napi);
+ }
+
+ spin_lock_irqsave(&gp->lock, flags);
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c
+index 6daea0c..f00fcb5 100644
+--- a/drivers/net/tun.c
++++ b/drivers/net/tun.c
+@@ -157,10 +157,16 @@ static int update_filter(struct tap_filter *filter, void __user *arg)
+
+ nexact = n;
+
+- /* The rest is hashed */
++ /* Remaining multicast addresses are hashed,
++ * unicast will leave the filter disabled. */
+ memset(filter->mask, 0, sizeof(filter->mask));
+- for (; n < uf.count; n++)
++ for (; n < uf.count; n++) {
++ if (!is_multicast_ether_addr(addr[n].u)) {
++ err = 0; /* no filter */
++ goto done;
++ }
+ addr_hash_set(filter->mask, addr[n].u);
++ }
+
+ /* For ALLMULTI just set the mask to all ones.
+ * This overrides the mask populated above. */
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
+index 0196a0d..ce743ec 100644
+--- a/drivers/net/virtio_net.c
++++ b/drivers/net/virtio_net.c
+@@ -24,6 +24,7 @@
+ #include <linux/virtio.h>
+ #include <linux/virtio_net.h>
+ #include <linux/scatterlist.h>
++#include <linux/if_vlan.h>
+
+ static int napi_weight = 128;
+ module_param(napi_weight, int, 0444);
+@@ -33,7 +34,7 @@ module_param(csum, bool, 0444);
+ module_param(gso, bool, 0444);
+
+ /* FIXME: MTU in config. */
+-#define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN)
++#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
+
+ struct virtnet_info
+ {
+diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
+index 3a90a67..87d020c 100644
+--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
++++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
+@@ -704,7 +704,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
+ u16 cmd_len;
+ enum ieee80211_band band;
+ u8 n_probes = 2;
+- u8 rx_chain = 0x7; /* bitmap: ABC chains */
++ u8 rx_chain = priv->hw_params.valid_rx_ant;
+
+ conf = ieee80211_get_hw_conf(priv->hw);
+
+diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
+index ec41293..ead3073 100644
+--- a/drivers/net/wireless/zd1211rw/zd_rf.c
++++ b/drivers/net/wireless/zd1211rw/zd_rf.c
+@@ -86,6 +86,7 @@ int zd_rf_init_hw(struct zd_rf *rf, u8 type)
+ case AL7230B_RF:
+ r = zd_rf_init_al7230b(rf);
+ break;
++ case MAXIM_NEW_RF:
+ case UW2453_RF:
+ r = zd_rf_init_uw2453(rf);
+ break;
+diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
+index a3ccd8c..5d740b5 100644
+--- a/drivers/net/wireless/zd1211rw/zd_usb.c
++++ b/drivers/net/wireless/zd1211rw/zd_usb.c
+@@ -37,6 +37,7 @@
+ static struct usb_device_id usb_ids[] = {
+ /* ZD1211 */
+ { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 },
++ { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 },
+ { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 },
+ { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 },
+ { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 },
+diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
+index 101ed49..032db81 100644
+--- a/drivers/parport/parport_serial.c
++++ b/drivers/parport/parport_serial.c
+@@ -64,6 +64,11 @@ struct parport_pc_pci {
+
+ static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *card, int autoirq, int autodma)
+ {
++ /* the rule described below doesn't hold for this device */
++ if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
++ dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
++ dev->subsystem_device == 0x0299)
++ return -ENODEV;
+ /*
+ * Netmos uses the subdevice ID to indicate the number of parallel
+ * and serial ports. The form is 0x00PS, where <P> is the number of
+diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
+index fb28aca..521a2db 100644
+--- a/drivers/w1/slaves/w1_therm.c
++++ b/drivers/w1/slaves/w1_therm.c
+@@ -113,7 +113,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
+
+ static inline int w1_DS18B20_convert_temp(u8 rom[9])
+ {
+- s16 t = (rom[1] << 8) | rom[0];
++ int t = ((s16)rom[1] << 8) | rom[0];
+ t = t*1000/16;
+ return t;
+ }
+diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
+index 5235c67..c8f8d59 100644
+--- a/fs/compat_ioctl.c
++++ b/fs/compat_ioctl.c
+@@ -538,6 +538,7 @@ static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
+ * cannot be fixed without breaking all existing apps.
+ */
+ case TUNSETIFF:
++ case TUNGETIFF:
+ case SIOCGIFFLAGS:
+ case SIOCGIFMETRIC:
+ case SIOCGIFMTU:
+@@ -1982,6 +1983,11 @@ COMPATIBLE_IOCTL(TUNSETNOCSUM)
+ COMPATIBLE_IOCTL(TUNSETDEBUG)
+ COMPATIBLE_IOCTL(TUNSETPERSIST)
+ COMPATIBLE_IOCTL(TUNSETOWNER)
++COMPATIBLE_IOCTL(TUNSETLINK)
++COMPATIBLE_IOCTL(TUNSETGROUP)
++COMPATIBLE_IOCTL(TUNGETFEATURES)
++COMPATIBLE_IOCTL(TUNSETOFFLOAD)
++COMPATIBLE_IOCTL(TUNSETTXFILTER)
+ /* Big V */
+ COMPATIBLE_IOCTL(VT_SETMODE)
+ COMPATIBLE_IOCTL(VT_GETMODE)
+@@ -2573,6 +2579,7 @@ HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc)
+ HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
+ HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
+ HANDLE_IOCTL(TUNSETIFF, dev_ifsioc)
++HANDLE_IOCTL(TUNGETIFF, dev_ifsioc)
+ HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
+ HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl)
+ HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
+diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
+index cf0d5c2..dc934da 100644
+--- a/fs/lockd/svclock.c
++++ b/fs/lockd/svclock.c
+@@ -418,7 +418,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
+ goto out;
+ case -EAGAIN:
+ ret = nlm_lck_denied;
+- goto out;
++ break;
+ case FILE_LOCK_DEFERRED:
+ if (wait)
+ break;
+@@ -434,6 +434,10 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
+ goto out;
+ }
+
++ ret = nlm_lck_denied;
++ if (!wait)
++ goto out;
++
+ ret = nlm_lck_blocked;
+
+ /* Append to list of blocked */
+diff --git a/include/linux/ata.h b/include/linux/ata.h
+index 8a12d71..8297a3c 100644
+--- a/include/linux/ata.h
++++ b/include/linux/ata.h
+@@ -681,12 +681,17 @@ static inline int ata_id_current_chs_valid(const u16 *id)
+
+ static inline int ata_id_is_cfa(const u16 *id)
+ {
+- if (id[ATA_ID_CONFIG] == 0x848A) /* Standard CF */
++ if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */
+ return 1;
+- /* Could be CF hiding as standard ATA */
+- if (ata_id_major_version(id) >= 3 &&
+- id[ATA_ID_COMMAND_SET_1] != 0xFFFF &&
+- (id[ATA_ID_COMMAND_SET_1] & (1 << 2)))
++ /*
++ * CF specs don't require specific value in the word 0 anymore and yet
++ * they forbid to report the ATA version in the word 80 and require the
++ * CFA feature set support to be indicated in the word 83 in this case.
++ * Unfortunately, some cards only follow either of this requirements,
++ * and while those that don't indicate CFA feature support need some
++ * sort of quirk list, it seems impractical for the ones that do...
++ */
++ if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004)
+ return 1;
+ return 0;
+ }
+diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
+index f54aa38..258a17b 100644
+--- a/include/linux/syscalls.h
++++ b/include/linux/syscalls.h
+@@ -95,13 +95,13 @@ struct old_linux_dirent;
+ #define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
+ #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
+
+-#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
+-#define SYSCALL_DEFINE1(...) SYSCALL_DEFINEx(1, __VA_ARGS__)
+-#define SYSCALL_DEFINE2(...) SYSCALL_DEFINEx(2, __VA_ARGS__)
+-#define SYSCALL_DEFINE3(...) SYSCALL_DEFINEx(3, __VA_ARGS__)
+-#define SYSCALL_DEFINE4(...) SYSCALL_DEFINEx(4, __VA_ARGS__)
+-#define SYSCALL_DEFINE5(...) SYSCALL_DEFINEx(5, __VA_ARGS__)
+-#define SYSCALL_DEFINE6(...) SYSCALL_DEFINEx(6, __VA_ARGS__)
++#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
++#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
++#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
++#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
++#define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
++#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
++#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
+
+ #ifdef CONFIG_PPC64
+ #define SYSCALL_ALIAS(alias, name) \
+@@ -116,21 +116,21 @@ struct old_linux_dirent;
+
+ #define SYSCALL_DEFINE(name) static inline long SYSC_##name
+ #define SYSCALL_DEFINEx(x, name, ...) \
+- asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__)); \
+- static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__)); \
+- asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__)) \
++ asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \
++ static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
++ asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \
+ { \
+ __SC_TEST##x(__VA_ARGS__); \
+- return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__)); \
++ return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__)); \
+ } \
+- SYSCALL_ALIAS(sys_##name, SyS_##name); \
+- static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
++ SYSCALL_ALIAS(sys##name, SyS##name); \
++ static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__))
+
+ #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
+
+ #define SYSCALL_DEFINE(name) asmlinkage long sys_##name
+ #define SYSCALL_DEFINEx(x, name, ...) \
+- asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
++ asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
+
+ #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
+
+diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
+index b799fb2..2fec3c3 100644
+--- a/include/net/sctp/checksum.h
++++ b/include/net/sctp/checksum.h
+@@ -79,5 +79,5 @@ static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32)
+
+ static inline __be32 sctp_end_cksum(__be32 crc32)
+ {
+- return ~crc32;
++ return (__force __be32)~cpu_to_le32((__force u32)crc32);
+ }
+diff --git a/mm/page-writeback.c b/mm/page-writeback.c
+index 8875822..5f7cdc2 100644
+--- a/mm/page-writeback.c
++++ b/mm/page-writeback.c
+@@ -985,13 +985,25 @@ continue_unlock:
+ }
+ }
+
+- if (wbc->sync_mode == WB_SYNC_NONE) {
++ if (wbc->nr_to_write > 0) {
+ wbc->nr_to_write--;
+- if (wbc->nr_to_write <= 0) {
++ if (wbc->nr_to_write == 0 &&
++ wbc->sync_mode == WB_SYNC_NONE) {
++ /*
++ * We stop writing back only if we are
++ * not doing integrity sync. In case of
++ * integrity sync we have to keep going
++ * because someone may be concurrently
++ * dirtying pages, and we might have
++ * synced a lot of newly appeared dirty
++ * pages, but have not synced all of the
++ * old dirty pages.
++ */
+ done = 1;
+ break;
+ }
+ }
++
+ if (wbc->nonblocking && bdi_write_congested(bdi)) {
+ wbc->encountered_congestion = 1;
+ done = 1;
+@@ -1001,7 +1013,7 @@ continue_unlock:
+ pagevec_release(&pvec);
+ cond_resched();
+ }
+- if (!cycled) {
++ if (!cycled && !done) {
+ /*
+ * range_cyclic:
+ * We hit the last page and there is more work to be done: wrap
+diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
+index 96434d7..0abd0ef 100644
+--- a/net/bluetooth/hidp/core.c
++++ b/net/bluetooth/hidp/core.c
+@@ -684,6 +684,10 @@ static const struct {
+ } hidp_blacklist[] = {
+ /* Apple wireless Mighty Mouse */
+ { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
++ /* Apple Wireless Keyboard */
++ { 0x05ac, 0x022c, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
++ { 0x05ac, 0x022d, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
++ { 0x05ac, 0x022e, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN },
+
+ { } /* Terminating entry */
+ };
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c
+index ca1ccdf..53425fa 100644
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -73,17 +73,13 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
+ static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
+ struct pipe_buffer *buf)
+ {
+- struct sk_buff *skb = (struct sk_buff *) buf->private;
+-
+- kfree_skb(skb);
++ put_page(buf->page);
+ }
+
+ static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
+ struct pipe_buffer *buf)
+ {
+- struct sk_buff *skb = (struct sk_buff *) buf->private;
+-
+- skb_get(skb);
++ get_page(buf->page);
+ }
+
+ static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
+@@ -1262,9 +1258,19 @@ fault:
+ */
+ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
+ {
+- struct sk_buff *skb = (struct sk_buff *) spd->partial[i].private;
++ put_page(spd->pages[i]);
++}
+
+- kfree_skb(skb);
++static inline struct page *linear_to_page(struct page *page, unsigned int len,
++ unsigned int offset)
++{
++ struct page *p = alloc_pages(GFP_KERNEL, 0);
++
++ if (!p)
++ return NULL;
++ memcpy(page_address(p) + offset, page_address(page) + offset, len);
++
++ return p;
+ }
+
+ /*
+@@ -1272,16 +1278,23 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
+ */
+ static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
+ unsigned int len, unsigned int offset,
+- struct sk_buff *skb)
++ struct sk_buff *skb, int linear)
+ {
+ if (unlikely(spd->nr_pages == PIPE_BUFFERS))
+ return 1;
+
++ if (linear) {
++ page = linear_to_page(page, len, offset);
++ if (!page)
++ return 1;
++ } else
++ get_page(page);
++
+ spd->pages[spd->nr_pages] = page;
+ spd->partial[spd->nr_pages].len = len;
+ spd->partial[spd->nr_pages].offset = offset;
+- spd->partial[spd->nr_pages].private = (unsigned long) skb_get(skb);
+ spd->nr_pages++;
++
+ return 0;
+ }
+
+@@ -1297,7 +1310,7 @@ static inline void __segment_seek(struct page **page, unsigned int *poff,
+ static inline int __splice_segment(struct page *page, unsigned int poff,
+ unsigned int plen, unsigned int *off,
+ unsigned int *len, struct sk_buff *skb,
+- struct splice_pipe_desc *spd)
++ struct splice_pipe_desc *spd, int linear)
+ {
+ if (!*len)
+ return 1;
+@@ -1320,7 +1333,7 @@ static inline int __splice_segment(struct page *page, unsigned int poff,
+ /* the linear region may spread across several pages */
+ flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
+
+- if (spd_fill_page(spd, page, flen, poff, skb))
++ if (spd_fill_page(spd, page, flen, poff, skb, linear))
+ return 1;
+
+ __segment_seek(&page, &poff, &plen, flen);
+@@ -1347,7 +1360,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
+ if (__splice_segment(virt_to_page(skb->data),
+ (unsigned long) skb->data & (PAGE_SIZE - 1),
+ skb_headlen(skb),
+- offset, len, skb, spd))
++ offset, len, skb, spd, 1))
+ return 1;
+
+ /*
+@@ -1357,7 +1370,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
+ const skb_frag_t *f = &skb_shinfo(skb)->frags[seg];
+
+ if (__splice_segment(f->page, f->page_offset, f->size,
+- offset, len, skb, spd))
++ offset, len, skb, spd, 0))
+ return 1;
+ }
+
+@@ -1370,7 +1383,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
+ * the frag list, if such a thing exists. We'd probably need to recurse to
+ * handle that cleanly.
+ */
+-int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
++int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
+ struct pipe_inode_info *pipe, unsigned int tlen,
+ unsigned int flags)
+ {
+@@ -1383,16 +1396,6 @@ int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
+ .ops = &sock_pipe_buf_ops,
+ .spd_release = sock_spd_release,
+ };
+- struct sk_buff *skb;
+-
+- /*
+- * I'd love to avoid the clone here, but tcp_read_sock()
+- * ignores reference counts and unconditonally kills the sk_buff
+- * on return from the actor.
+- */
+- skb = skb_clone(__skb, GFP_KERNEL);
+- if (unlikely(!skb))
+- return -ENOMEM;
+
+ /*
+ * __skb_splice_bits() only fails if the output has no room left,
+@@ -1416,15 +1419,9 @@ int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
+ }
+
+ done:
+- /*
+- * drop our reference to the clone, the pipe consumption will
+- * drop the rest.
+- */
+- kfree_skb(skb);
+-
+ if (spd.nr_pages) {
++ struct sock *sk = skb->sk;
+ int ret;
+- struct sock *sk = __skb->sk;
+
+ /*
+ * Drop the socket lock, otherwise we have reverse
+@@ -2001,10 +1998,10 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
+ return 0;
+
+ next_skb:
+- block_limit = skb_headlen(st->cur_skb);
++ block_limit = skb_headlen(st->cur_skb) + st->stepped_offset;
+
+ if (abs_offset < block_limit) {
+- *data = st->cur_skb->data + abs_offset;
++ *data = st->cur_skb->data + (abs_offset - st->stepped_offset);
+ return block_limit - abs_offset;
+ }
+
+@@ -2039,13 +2036,14 @@ next_skb:
+ st->frag_data = NULL;
+ }
+
+- if (st->cur_skb->next) {
+- st->cur_skb = st->cur_skb->next;
++ if (st->root_skb == st->cur_skb &&
++ skb_shinfo(st->root_skb)->frag_list) {
++ st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
+ st->frag_idx = 0;
+ goto next_skb;
+- } else if (st->root_skb == st->cur_skb &&
+- skb_shinfo(st->root_skb)->frag_list) {
+- st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
++ } else if (st->cur_skb->next) {
++ st->cur_skb = st->cur_skb->next;
++ st->frag_idx = 0;
+ goto next_skb;
+ }
+
+diff --git a/net/core/sock.c b/net/core/sock.c
+index 91f8bbc..b1b2f22 100644
+--- a/net/core/sock.c
++++ b/net/core/sock.c
+@@ -695,6 +695,8 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
+ if (len < 0)
+ return -EINVAL;
+
++ v.val = 0;
++
+ switch(optname) {
+ case SO_DEBUG:
+ v.val = sock_flag(sk, SOCK_DBG);
+diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
+index 42065ff..ff75000 100644
+--- a/net/ipv4/ipconfig.c
++++ b/net/ipv4/ipconfig.c
+@@ -1272,6 +1272,9 @@ __be32 __init root_nfs_parse_addr(char *name)
+ static int __init ip_auto_config(void)
+ {
+ __be32 addr;
++#ifdef IPCONFIG_DYNAMIC
++ int retries = CONF_OPEN_RETRIES;
++#endif
+
+ #ifdef CONFIG_PROC_FS
+ proc_net_fops_create(&init_net, "pnp", S_IRUGO, &pnp_seq_fops);
+@@ -1308,9 +1311,6 @@ static int __init ip_auto_config(void)
+ #endif
+ ic_first_dev->next) {
+ #ifdef IPCONFIG_DYNAMIC
+-
+- int retries = CONF_OPEN_RETRIES;
+-
+ if (ic_dynamic() < 0) {
+ ic_close_devs();
+
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
+index f57d576..9440ba6 100644
+--- a/net/ipv4/tcp.c
++++ b/net/ipv4/tcp.c
+@@ -518,8 +518,13 @@ static int tcp_splice_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
+ unsigned int offset, size_t len)
+ {
+ struct tcp_splice_state *tss = rd_desc->arg.data;
++ int ret;
+
+- return skb_splice_bits(skb, offset, tss->pipe, tss->len, tss->flags);
++ ret = skb_splice_bits(skb, offset, tss->pipe, min(rd_desc->count, len),
++ tss->flags);
++ if (ret > 0)
++ rd_desc->count -= ret;
++ return ret;
+ }
+
+ static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss)
+@@ -527,6 +532,7 @@ static int __tcp_splice_read(struct sock *sk, struct tcp_splice_state *tss)
+ /* Store TCP splice context information in read_descriptor_t. */
+ read_descriptor_t rd_desc = {
+ .arg.data = tss,
++ .count = tss->len,
+ };
+
+ return tcp_read_sock(sk, &rd_desc, tcp_splice_data_recv);
+@@ -611,11 +617,13 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
+ tss.len -= ret;
+ spliced += ret;
+
++ if (!timeo)
++ break;
+ release_sock(sk);
+ lock_sock(sk);
+
+ if (sk->sk_err || sk->sk_state == TCP_CLOSE ||
+- (sk->sk_shutdown & RCV_SHUTDOWN) || !timeo ||
++ (sk->sk_shutdown & RCV_SHUTDOWN) ||
+ signal_pending(current))
+ break;
+ }
+diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
+index 915e6b7..a9b62ee 100644
+--- a/net/ipv4/udp.c
++++ b/net/ipv4/udp.c
+@@ -959,9 +959,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
+
+ if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
+ /* Note that an ENOMEM error is charged twice */
+- if (rc == -ENOMEM)
++ if (rc == -ENOMEM) {
+ UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
+ is_udplite);
++ atomic_inc(&sk->sk_drops);
++ }
+ goto drop;
+ }
+
+@@ -1172,7 +1174,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
+ int proto)
+ {
+ struct sock *sk;
+- struct udphdr *uh = udp_hdr(skb);
++ struct udphdr *uh;
+ unsigned short ulen;
+ struct rtable *rt = (struct rtable*)skb->dst;
+ __be32 saddr = ip_hdr(skb)->saddr;
+@@ -1185,6 +1187,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
+ if (!pskb_may_pull(skb, sizeof(struct udphdr)))
+ goto drop; /* No space for header. */
+
++ uh = udp_hdr(skb);
+ ulen = ntohs(uh->len);
+ if (ulen > skb->len)
+ goto short_packet;
+diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
+index 37a4e77..489a7fd 100644
+--- a/net/ipv6/ip6_flowlabel.c
++++ b/net/ipv6/ip6_flowlabel.c
+@@ -323,17 +323,21 @@ static struct ip6_flowlabel *
+ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
+ int optlen, int *err_p)
+ {
+- struct ip6_flowlabel *fl;
++ struct ip6_flowlabel *fl = NULL;
+ int olen;
+ int addr_type;
+ int err;
+
++ olen = optlen - CMSG_ALIGN(sizeof(*freq));
++ err = -EINVAL;
++ if (olen > 64 * 1024)
++ goto done;
++
+ err = -ENOMEM;
+ fl = kzalloc(sizeof(*fl), GFP_KERNEL);
+ if (fl == NULL)
+ goto done;
+
+- olen = optlen - CMSG_ALIGN(sizeof(*freq));
+ if (olen > 0) {
+ struct msghdr msg;
+ struct flowi flowi;
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
+index 3df2c44..a423200 100644
+--- a/net/ipv6/ip6_output.c
++++ b/net/ipv6/ip6_output.c
+@@ -1091,6 +1091,18 @@ static inline int ip6_ufo_append_data(struct sock *sk,
+ return err;
+ }
+
++static inline struct ipv6_opt_hdr *ip6_opt_dup(struct ipv6_opt_hdr *src,
++ gfp_t gfp)
++{
++ return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
++}
++
++static inline struct ipv6_rt_hdr *ip6_rthdr_dup(struct ipv6_rt_hdr *src,
++ gfp_t gfp)
++{
++ return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
++}
++
+ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
+ int offset, int len, int odd, struct sk_buff *skb),
+ void *from, int length, int transhdrlen,
+@@ -1116,17 +1128,37 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
+ * setup for corking
+ */
+ if (opt) {
+- if (np->cork.opt == NULL) {
+- np->cork.opt = kmalloc(opt->tot_len,
+- sk->sk_allocation);
+- if (unlikely(np->cork.opt == NULL))
+- return -ENOBUFS;
+- } else if (np->cork.opt->tot_len < opt->tot_len) {
+- printk(KERN_DEBUG "ip6_append_data: invalid option length\n");
++ if (WARN_ON(np->cork.opt))
+ return -EINVAL;
+- }
+- memcpy(np->cork.opt, opt, opt->tot_len);
+- inet->cork.flags |= IPCORK_OPT;
++
++ np->cork.opt = kmalloc(opt->tot_len, sk->sk_allocation);
++ if (unlikely(np->cork.opt == NULL))
++ return -ENOBUFS;
++
++ np->cork.opt->tot_len = opt->tot_len;
++ np->cork.opt->opt_flen = opt->opt_flen;
++ np->cork.opt->opt_nflen = opt->opt_nflen;
++
++ np->cork.opt->dst0opt = ip6_opt_dup(opt->dst0opt,
++ sk->sk_allocation);
++ if (opt->dst0opt && !np->cork.opt->dst0opt)
++ return -ENOBUFS;
++
++ np->cork.opt->dst1opt = ip6_opt_dup(opt->dst1opt,
++ sk->sk_allocation);
++ if (opt->dst1opt && !np->cork.opt->dst1opt)
++ return -ENOBUFS;
++
++ np->cork.opt->hopopt = ip6_opt_dup(opt->hopopt,
++ sk->sk_allocation);
++ if (opt->hopopt && !np->cork.opt->hopopt)
++ return -ENOBUFS;
++
++ np->cork.opt->srcrt = ip6_rthdr_dup(opt->srcrt,
++ sk->sk_allocation);
++ if (opt->srcrt && !np->cork.opt->srcrt)
++ return -ENOBUFS;
++
+ /* need source address above miyazawa*/
+ }
+ dst_hold(&rt->u.dst);
+@@ -1153,8 +1185,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
+ } else {
+ rt = (struct rt6_info *)inet->cork.dst;
+ fl = &inet->cork.fl;
+- if (inet->cork.flags & IPCORK_OPT)
+- opt = np->cork.opt;
++ opt = np->cork.opt;
+ transhdrlen = 0;
+ exthdrlen = 0;
+ mtu = inet->cork.fragsize;
+@@ -1393,9 +1424,15 @@ error:
+
+ static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np)
+ {
+- inet->cork.flags &= ~IPCORK_OPT;
+- kfree(np->cork.opt);
+- np->cork.opt = NULL;
++ if (np->cork.opt) {
++ kfree(np->cork.opt->dst0opt);
++ kfree(np->cork.opt->dst1opt);
++ kfree(np->cork.opt->hopopt);
++ kfree(np->cork.opt->srcrt);
++ kfree(np->cork.opt);
++ np->cork.opt = NULL;
++ }
++
+ if (inet->cork.dst) {
+ dst_release(inet->cork.dst);
+ inet->cork.dst = NULL;
+diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+index 14d47d8..0610123 100644
+--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
++++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+@@ -49,8 +49,8 @@ static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
+ static const u_int8_t invmap[] = {
+ [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1,
+ [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1,
+- [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_QUERY + 1,
+- [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1
++ [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_REPLY + 1,
++ [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_QUERY +1
+ };
+
+ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple,
+diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
+index 79a0627..27bd353 100644
+--- a/net/mac80211/debugfs_sta.c
++++ b/net/mac80211/debugfs_sta.c
+@@ -200,7 +200,7 @@ static ssize_t sta_agg_status_write(struct file *file,
+ /* toggle Rx aggregation command */
+ tid_num = tid_num - 100;
+ if (tid_static_rx[tid_num] == 1) {
+- strcpy(state, "off ");
++ strcpy(state, "off");
+ ieee80211_sta_stop_rx_ba_session(dev, da, tid_num, 0,
+ WLAN_REASON_QSTA_REQUIRE_SETUP);
+ sta->ampdu_mlme.tid_state_rx[tid_num] |=
+diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
+index e6e4681..aa7aec0 100644
+--- a/net/netfilter/xt_sctp.c
++++ b/net/netfilter/xt_sctp.c
+@@ -105,7 +105,7 @@ match_packet(const struct sk_buff *skb,
+
+ switch (chunk_match_type) {
+ case SCTP_CHUNK_MATCH_ALL:
+- return SCTP_CHUNKMAP_IS_CLEAR(info->chunkmap);
++ return SCTP_CHUNKMAP_IS_CLEAR(chunkmapcopy);
+ case SCTP_CHUNK_MATCH_ANY:
+ return false;
+ case SCTP_CHUNK_MATCH_ONLY:
+diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
+index c718e7e..4b50878 100644
+--- a/net/packet/af_packet.c
++++ b/net/packet/af_packet.c
+@@ -77,6 +77,7 @@
+ #include <linux/poll.h>
+ #include <linux/module.h>
+ #include <linux/init.h>
++#include <linux/mutex.h>
+
+ #ifdef CONFIG_INET
+ #include <net/inet_common.h>
+@@ -175,6 +176,7 @@ struct packet_sock {
+ #endif
+ struct packet_type prot_hook;
+ spinlock_t bind_lock;
++ struct mutex pg_vec_lock;
+ unsigned int running:1, /* prot_hook is attached*/
+ auxdata:1,
+ origdev:1;
+@@ -220,13 +222,13 @@ static void *packet_lookup_frame(struct packet_sock *po, unsigned int position,
+ h.raw = po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size);
+ switch (po->tp_version) {
+ case TPACKET_V1:
+- if (status != h.h1->tp_status ? TP_STATUS_USER :
+- TP_STATUS_KERNEL)
++ if (status != (h.h1->tp_status ? TP_STATUS_USER :
++ TP_STATUS_KERNEL))
+ return NULL;
+ break;
+ case TPACKET_V2:
+- if (status != h.h2->tp_status ? TP_STATUS_USER :
+- TP_STATUS_KERNEL)
++ if (status != (h.h2->tp_status ? TP_STATUS_USER :
++ TP_STATUS_KERNEL))
+ return NULL;
+ break;
+ }
+@@ -1068,6 +1070,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
+ */
+
+ spin_lock_init(&po->bind_lock);
++ mutex_init(&po->pg_vec_lock);
+ po->prot_hook.func = packet_rcv;
+
+ if (sock->type == SOCK_PACKET)
+@@ -1863,6 +1866,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing
+ synchronize_net();
+
+ err = -EBUSY;
++ mutex_lock(&po->pg_vec_lock);
+ if (closing || atomic_read(&po->mapped) == 0) {
+ err = 0;
+ #define XC(a, b) ({ __typeof__ ((a)) __t; __t = (a); (a) = (b); __t; })
+@@ -1884,6 +1888,7 @@ static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing
+ if (atomic_read(&po->mapped))
+ printk(KERN_DEBUG "packet_mmap: vma is busy: %d\n", atomic_read(&po->mapped));
+ }
++ mutex_unlock(&po->pg_vec_lock);
+
+ spin_lock(&po->bind_lock);
+ if (was_running && !po->running) {
+@@ -1916,7 +1921,7 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st
+
+ size = vma->vm_end - vma->vm_start;
+
+- lock_sock(sk);
++ mutex_lock(&po->pg_vec_lock);
+ if (po->pg_vec == NULL)
+ goto out;
+ if (size != po->pg_vec_len*po->pg_vec_pages*PAGE_SIZE)
+@@ -1939,7 +1944,7 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st
+ err = 0;
+
+ out:
+- release_sock(sk);
++ mutex_unlock(&po->pg_vec_lock);
+ return err;
+ }
+ #endif
+diff --git a/net/sctp/output.c b/net/sctp/output.c
+index 225c712..e4746fd 100644
+--- a/net/sctp/output.c
++++ b/net/sctp/output.c
+@@ -324,14 +324,16 @@ append:
+ switch (chunk->chunk_hdr->type) {
+ case SCTP_CID_DATA:
+ retval = sctp_packet_append_data(packet, chunk);
++ if (SCTP_XMIT_OK != retval)
++ goto finish;
+ /* Disallow SACK bundling after DATA. */
+ packet->has_sack = 1;
+ /* Disallow AUTH bundling after DATA */
+ packet->has_auth = 1;
+ /* Let it be knows that packet has DATA in it */
+ packet->has_data = 1;
+- if (SCTP_XMIT_OK != retval)
+- goto finish;
++ /* timestamp the chunk for rtx purposes */
++ chunk->sent_at = jiffies;
+ break;
+ case SCTP_CID_COOKIE_ECHO:
+ packet->has_cookie_echo = 1;
+@@ -470,7 +472,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
+ } else
+ chunk->resent = 1;
+
+- chunk->sent_at = jiffies;
+ has_data = 1;
+ }
+
+diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
+index 4328ad5..fe11686 100644
+--- a/net/sctp/outqueue.c
++++ b/net/sctp/outqueue.c
+@@ -929,7 +929,6 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
+ }
+
+ /* Finally, transmit new packets. */
+- start_timer = 0;
+ while ((chunk = sctp_outq_dequeue_data(q)) != NULL) {
+ /* RFC 2960 6.5 Every DATA chunk MUST carry a valid
+ * stream identifier.
+@@ -1028,7 +1027,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
+ list_add_tail(&chunk->transmitted_list,
+ &transport->transmitted);
+
+- sctp_transport_reset_timers(transport, start_timer-1);
++ sctp_transport_reset_timers(transport, 0);
+
+ q->empty = 0;
+
+diff --git a/scripts/kernel-doc b/scripts/kernel-doc
+index 44ee94d..0865a89 100755
+--- a/scripts/kernel-doc
++++ b/scripts/kernel-doc
+@@ -1758,6 +1758,40 @@ sub reset_state {
+ $state = 0;
+ }
+
++sub syscall_munge() {
++ my $void = 0;
++
++ $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs
++## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
++ if ($prototype =~ m/SYSCALL_DEFINE0/) {
++ $void = 1;
++## $prototype = "long sys_$1(void)";
++ }
++
++ $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name
++ if ($prototype =~ m/long (sys_.*?),/) {
++ $prototype =~ s/,/\(/;
++ } elsif ($void) {
++ $prototype =~ s/\)/\(void\)/;
++ }
++
++ # now delete all of the odd-number commas in $prototype
++ # so that arg types & arg names don't have a comma between them
++ my $count = 0;
++ my $len = length($prototype);
++ if ($void) {
++ $len = 0; # skip the for-loop
++ }
++ for (my $ix = 0; $ix < $len; $ix++) {
++ if (substr($prototype, $ix, 1) eq ',') {
++ $count++;
++ if ($count % 2 == 1) {
++ substr($prototype, $ix, 1) = ' ';
++ }
++ }
++ }
++}
++
+ sub process_state3_function($$) {
+ my $x = shift;
+ my $file = shift;
+@@ -1774,7 +1808,10 @@ sub process_state3_function($$) {
+ $prototype =~ s@/\*.*?\*/@@gos; # strip comments.
+ $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
+ $prototype =~ s@^\s+@@gos; # strip leading spaces
+- dump_function($prototype,$file);
++ if ($prototype =~ /SYSCALL_DEFINE/) {
++ syscall_munge();
++ }
++ dump_function($prototype, $file);
+ reset_state();
+ }
+ }
+diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
+index b5e1a71..04d50aa 100644
+--- a/sound/drivers/mtpav.c
++++ b/sound/drivers/mtpav.c
+@@ -706,7 +706,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
+ mtp_card->card = card;
+ mtp_card->irq = -1;
+ mtp_card->share_irq = 0;
+- mtp_card->inmidiport = 0xffffffff;
+ mtp_card->inmidistate = 0;
+ mtp_card->outmidihwport = 0xffffffff;
+ init_timer(&mtp_card->timer);
+@@ -715,6 +714,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
+
+ card->private_free = snd_mtpav_free;
+
++ mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST;
++
+ err = snd_mtpav_get_ISA(mtp_card);
+ if (err < 0)
+ goto __error;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-02-20 19:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-20 19:20 [gentoo-commits] linux-patches r1498 - genpatches-2.6/trunk/2.6.27 Mike Pagano (mpagano)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox