[kernel] r11451 - in dists/trunk/linux-2.6/debian/patches: bugfix/all series
Maximilian Attems
maks at alioth.debian.org
Sun May 25 08:58:00 UTC 2008
Author: maks
Date: Sun May 25 08:57:59 2008
New Revision: 11451
Log:
update to 2.6.26-rc3-git7
new ip2 cleanups, no other conflicts
Added:
dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git7
- copied, changed from r11450, /dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git5
Removed:
dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git5
Modified:
dists/trunk/linux-2.6/debian/patches/series/1~experimental.1
Copied: dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git7 (from r11450, /dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git5)
==============================================================================
--- /dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git5 (original)
+++ dists/trunk/linux-2.6/debian/patches/bugfix/all/patch-2.6.26-rc3-git7 Sun May 25 08:57:59 2008
@@ -9,6 +9,119 @@
-*.rej
*~
\#*#
+diff --git a/Documentation/ABI/testing/sysfs-class-bdi b/Documentation/ABI/testing/sysfs-class-bdi
+index 5ac1e01..5f50097 100644
+--- a/Documentation/ABI/testing/sysfs-class-bdi
++++ b/Documentation/ABI/testing/sysfs-class-bdi
+@@ -14,6 +14,10 @@ MAJOR:MINOR
+ non-block filesystems which provide their own BDI, such as NFS
+ and FUSE.
+
++MAJOR:MINOR-fuseblk
++
++ Value of st_dev on fuseblk filesystems.
++
+ default
+
+ The default backing dev, used for non-block device backed
+diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl
+index 77c42f4..2510763 100644
+--- a/Documentation/DocBook/kernel-locking.tmpl
++++ b/Documentation/DocBook/kernel-locking.tmpl
+@@ -703,6 +703,31 @@
+ </sect1>
+ </chapter>
+
++<chapter id="trylock-functions">
++ <title>The trylock Functions</title>
++ <para>
++ There are functions that try to acquire a lock only once and immediately
++ return a value telling about success or failure to acquire the lock.
++ They can be used if you need no access to the data protected with the lock
++ when some other thread is holding the lock. You should acquire the lock
++ later if you then need access to the data protected with the lock.
++ </para>
++
++ <para>
++ <function>spin_trylock()</function> does not spin but returns non-zero if
++ it acquires the spinlock on the first try or 0 if not. This function can
++ be used in all contexts like <function>spin_lock</function>: you must have
++ disabled the contexts that might interrupt you and acquire the spin lock.
++ </para>
++
++ <para>
++ <function>mutex_trylock()</function> does not suspend your task
++ but returns non-zero if it could lock the mutex on the first try
++ or 0 if not. This function cannot be safely used in hardware or software
++ interrupt contexts despite not sleeping.
++ </para>
++</chapter>
++
+ <chapter id="Examples">
+ <title>Common Examples</title>
+ <para>
+diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
+index 6a9c55b..dcec056 100644
+--- a/Documentation/cpu-freq/governors.txt
++++ b/Documentation/cpu-freq/governors.txt
+@@ -129,14 +129,6 @@ to its default value of '80' it means that between the checking
+ intervals the CPU needs to be on average more than 80% in use to then
+ decide that the CPU frequency needs to be increased.
+
+-sampling_down_factor: this parameter controls the rate that the CPU
+-makes a decision on when to decrease the frequency. When set to its
+-default value of '5' it means that at 1/5 the sampling_rate the kernel
+-makes a decision to lower the frequency. Five "lower rate" decisions
+-have to be made in a row before the CPU frequency is actually lower.
+-If set to '1' then the frequency decreases as quickly as it increases,
+-if set to '2' it decreases at half the rate of the increase.
+-
+ ignore_nice_load: this parameter takes a value of '0' or '1'. When
+ set to '0' (its default), all processes are counted towards the
+ 'cpu utilisation' value. When set to '1', the processes that are
+diff --git a/Documentation/hwmon/ibmaem b/Documentation/hwmon/ibmaem
+new file mode 100644
+index 0000000..2fefaf5
+--- /dev/null
++++ b/Documentation/hwmon/ibmaem
+@@ -0,0 +1,37 @@
++Kernel driver ibmaem
++======================
++
++Supported systems:
++ * Any recent IBM System X server with Active Energy Manager support.
++ This includes the x3350, x3550, x3650, x3655, x3755, x3850 M2,
++ x3950 M2, and certain HS2x/LS2x/QS2x blades. The IPMI host interface
++ driver ("ipmi-si") needs to be loaded for this driver to do anything.
++ Prefix: 'ibmaem'
++ Datasheet: Not available
++
++Author: Darrick J. Wong
++
++Description
++-----------
++
++This driver implements sensor reading support for the energy and power
++meters available on various IBM System X hardware through the BMC. All
++sensor banks will be exported as platform devices; this driver can talk
++to both v1 and v2 interfaces. This driver is completely separate from the
++older ibmpex driver.
++
++The v1 AEM interface has a simple set of features to monitor energy use.
++There is a register that displays an estimate of raw energy consumption
++since the last BMC reset, and a power sensor that returns average power
++use over a configurable interval.
++
++The v2 AEM interface is a bit more sophisticated, being able to present
++a wider range of energy and power use registers, the power cap as
++set by the AEM software, and temperature sensors.
++
++Special Features
++----------------
++
++The "power_cap" value displays the current system power cap, as set by
++the Active Energy Manager software. Setting the power cap from the host
++is not currently supported.
diff --git a/Kbuild b/Kbuild
index 32f19c5..e750e9c 100644
--- a/Kbuild
@@ -21,7 +134,7 @@
-
+clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets)))
diff --git a/MAINTAINERS b/MAINTAINERS
-index c68a118..b42dcfc 100644
+index c68a118..0a6d2ca 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -982,13 +982,6 @@ L: bonding-devel at lists.sourceforge.net
@@ -53,7 +166,28 @@
CFAG12864B LCD DRIVER
P: Miguel Ojeda Sandonis
M: maxextreme at gmail.com
-@@ -1645,8 +1646,10 @@ W: http://linux-fbdev.sourceforge.net/
+@@ -1239,6 +1240,20 @@ L: video4linux-list at redhat.com
+ W: http://linuxtv.org
+ S: Maintained
+
++CXGB3 ETHERNET DRIVER (CXGB3)
++P: Divy Le Ray
++M: divy at chelsio.com
++L: netdev at vger.kernel.org
++W: http://www.chelsio.com
++S: Supported
++
++CXGB3 IWARP RNIC DRIVER (IW_CXGB3)
++P: Steve Wise
++M: swise at chelsio.com
++L: general at lists.openfabrics.org
++W: http://www.openfabrics.org
++S: Supported
++
+ CYBERPRO FB DRIVER
+ P: Russell King
+ M: rmk at arm.linux.org.uk
+@@ -1645,8 +1660,10 @@ W: http://linux-fbdev.sourceforge.net/
S: Maintained
FREESCALE DMA DRIVER
@@ -66,7 +200,7 @@
L: linuxppc-embedded at ozlabs.org
L: linux-kernel at vger.kernel.org
S: Maintained
-@@ -2329,7 +2332,8 @@ S: Maintained
+@@ -2329,7 +2346,8 @@ S: Maintained
KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*)
P: Sam Ravnborg
M: sam at ravnborg.org
@@ -76,7 +210,7 @@
L: linux-kbuild at vger.kernel.org
S: Maintained
-@@ -2351,24 +2355,24 @@ S: Supported
+@@ -2351,24 +2369,24 @@ S: Supported
KERNEL VIRTUAL MACHINE (KVM)
P: Avi Kivity
M: avi at qumranet.com
@@ -108,7 +242,7 @@
S: Supported
KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
-@@ -2819,6 +2823,15 @@ M: jirislaby at gmail.com
+@@ -2819,6 +2837,15 @@ M: jirislaby at gmail.com
L: linux-kernel at vger.kernel.org
S: Maintained
@@ -124,7 +258,7 @@
NATSEMI ETHERNET DRIVER (DP8381x)
P: Tim Hockin
M: thockin at hockin.org
-@@ -3132,7 +3145,7 @@ PCI ERROR RECOVERY
+@@ -3132,7 +3159,7 @@ PCI ERROR RECOVERY
P: Linas Vepstas
M: linas at austin.ibm.com
L: linux-kernel at vger.kernel.org
@@ -133,7 +267,7 @@
S: Supported
PCI SUBSYSTEM
-@@ -3766,6 +3779,14 @@ M: dbrownell at users.sourceforge.net
+@@ -3766,6 +3793,14 @@ M: dbrownell at users.sourceforge.net
L: spi-devel-general at lists.sourceforge.net
S: Maintained
@@ -148,7 +282,7 @@
STABLE BRANCH:
P: Greg Kroah-Hartman
M: greg at kroah.com
-@@ -4021,12 +4042,41 @@ M: ballabio_dario at emc.com
+@@ -4021,12 +4056,41 @@ M: ballabio_dario at emc.com
L: linux-scsi at vger.kernel.org
S: Maintained
@@ -190,7 +324,7 @@
UNIFORM CDROM DRIVER
P: Jens Axboe
M: axboe at kernel.dk
-@@ -4073,6 +4123,13 @@ L: netdev at vger.kernel.org
+@@ -4073,6 +4137,13 @@ L: netdev at vger.kernel.org
W: http://www.linux-usb.org/usbnet
S: Maintained
@@ -204,7 +338,22 @@
USB EHCI DRIVER
P: David Brownell
M: dbrownell at users.sourceforge.net
-@@ -4327,42 +4384,6 @@ M: romieu at fr.zoreil.com
+@@ -4304,6 +4375,14 @@ M: gregkh at suse.de
+ L: linux-kernel at vger.kernel.org
+ S: Maintained
+
++UTIL-LINUX-NG PACKAGE
++P: Karel Zak
++M: kzak at redhat.com
++L: util-linux-ng at vger.kernel.org
++W: http://kernel.org/~kzak/util-linux-ng/
++T: git://git.kernel.org/pub/scm/utils/util-linux-ng/util-linux-ng.git
++S: Maintained
++
+ VFAT/FAT/MSDOS FILESYSTEM:
+ P: OGAWA Hirofumi
+ M: hirofumi at mail.parknet.co.jp
+@@ -4327,42 +4406,6 @@ M: romieu at fr.zoreil.com
L: netdev at vger.kernel.org
S: Maintained
@@ -248,7 +397,7 @@
P: Mauro Carvalho Chehab
M: mchehab at infradead.org
diff --git a/Makefile b/Makefile
-index f638842..4dc8033 100644
+index f638842..d33f4eb 100644
--- a/Makefile
+++ b/Makefile
@@ -1114,6 +1114,7 @@ MRPROPER_DIRS += include/config include2 usr/include
@@ -292,6 +441,237 @@
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
+diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
+index 1de121f..f446477 100644
+--- a/arch/arm/mach-at91/at91x40.c
++++ b/arch/arm/mach-at91/at91x40.c
+@@ -16,16 +16,32 @@
+ #include <asm/mach/arch.h>
+ #include <asm/arch/at91x40.h>
+ #include <asm/arch/at91_st.h>
++#include <asm/arch/timex.h>
+ #include "generic.h"
+
+ /*
+- * This is used in the gpio code, stub locally.
++ * Export the clock functions for the AT91X40. Some external code common
++ * to all AT91 family parts relys on this, like the gpio and serial support.
+ */
+ int clk_enable(struct clk *clk)
+ {
+ return 0;
+ }
+
++void clk_disable(struct clk *clk)
++{
++}
++
++unsigned long clk_get_rate(struct clk *clk)
++{
++ return AT91X40_MASTER_CLOCK;
++}
++
++struct clk *clk_get(struct device *dev, const char *id)
++{
++ return NULL;
++}
++
+ void __init at91x40_initialize(unsigned long main_clock)
+ {
+ at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
+diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
+index 92d79fb..62e653a 100644
+--- a/arch/arm/mach-integrator/impd1.c
++++ b/arch/arm/mach-integrator/impd1.c
+@@ -369,7 +369,8 @@ static int impd1_probe(struct lm_device *dev)
+
+ lm_set_drvdata(dev, impd1);
+
+- printk("IM-PD1 found at 0x%08lx\n", dev->resource.start);
++ printk("IM-PD1 found at 0x%08lx\n",
++ (unsigned long)dev->resource.start);
+
+ for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
+ impd1->vcos[i].owner = THIS_MODULE,
+diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
+index d55fa4e..c07f497 100644
+--- a/arch/arm/mach-integrator/pci_v3.c
++++ b/arch/arm/mach-integrator/pci_v3.c
+@@ -405,7 +405,6 @@ v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+ addr, fsr, pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255,
+ v3_readb(V3_LB_ISTAT));
+ printk(KERN_DEBUG "%s", buf);
+- printascii(buf);
+ #endif
+
+ v3_writeb(V3_LB_ISTAT, 0);
+@@ -447,6 +446,7 @@ static irqreturn_t v3_irq(int dummy, void *devid)
+ unsigned long pc = instruction_pointer(regs);
+ unsigned long instr = *(unsigned long *)pc;
+ char buf[128];
++ extern void printascii(const char *);
+
+ sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x "
+ "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr,
+diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
+index a0b16a7..a4d2012 100644
+--- a/arch/arm/mach-omap1/board-palmte.c
++++ b/arch/arm/mach-omap1/board-palmte.c
+@@ -24,7 +24,6 @@
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/spi/spi.h>
+-#include <linux/spi/tsc2102.h>
+ #include <linux/interrupt.h>
+ #include <linux/apm-emulation.h>
+
+@@ -315,14 +314,6 @@ static void palmte_get_power_status(struct apm_power_info *info, int *battery)
+ #define palmte_get_power_status NULL
+ #endif
+
+-static struct tsc2102_config palmte_tsc2102_config = {
+- .use_internal = 0,
+- .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
+- .temp_at25c = { 2200, 2615 },
+- .apm_report = palmte_get_power_status,
+- .alsa_config = &palmte_alsa_config,
+-};
+-
+ static struct omap_board_config_kernel palmte_config[] __initdata = {
+ { OMAP_TAG_USB, &palmte_usb_config },
+ { OMAP_TAG_MMC, &palmte_mmc_config },
+@@ -336,7 +327,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
+ .bus_num = 2, /* uWire (officially) */
+ .chip_select = 0, /* As opposed to 3 */
+ .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
+- .platform_data = &palmte_tsc2102_config,
+ .max_speed_hz = 8000000,
+ },
+ };
+diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
+index dace382..e7d0fcd 100644
+--- a/arch/arm/mach-pxa/spitz.c
++++ b/arch/arm/mach-pxa/spitz.c
+@@ -38,7 +38,6 @@
+ #include <asm/arch/pxa-regs.h>
+ #include <asm/arch/pxa2xx-regs.h>
+ #include <asm/arch/pxa2xx-gpio.h>
+-#include <asm/arch/pxa27x-udc.h>
+ #include <asm/arch/irda.h>
+ #include <asm/arch/mmc.h>
+ #include <asm/arch/ohci.h>
+diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
+index 661a235..27f63d5 100644
+--- a/arch/arm/mach-s3c2410/mach-bast.c
++++ b/arch/arm/mach-s3c2410/mach-bast.c
+@@ -374,7 +374,7 @@ static struct resource bast_dm9k_resource[] = {
+ [2] = {
+ .start = IRQ_DM9000,
+ .end = IRQ_DM9000,
+- .flags = IORESOURCE_IRQ,
++ .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+ }
+
+ };
+diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
+index c564233..4c4b5c4 100644
+--- a/arch/arm/mach-s3c2410/mach-vr1000.c
++++ b/arch/arm/mach-s3c2410/mach-vr1000.c
+@@ -263,7 +263,7 @@ static struct resource vr1000_dm9k0_resource[] = {
+ [2] = {
+ .start = IRQ_VR1000_DM9000A,
+ .end = IRQ_VR1000_DM9000A,
+- .flags = IORESOURCE_IRQ
++ .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+ }
+
+ };
+@@ -282,7 +282,7 @@ static struct resource vr1000_dm9k1_resource[] = {
+ [2] = {
+ .start = IRQ_VR1000_DM9000N,
+ .end = IRQ_VR1000_DM9000N,
+- .flags = IORESOURCE_IRQ
++ .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+ }
+ };
+
+diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
+index 6496eb6..2f772a3 100644
+--- a/arch/arm/mach-sa1100/collie.c
++++ b/arch/arm/mach-sa1100/collie.c
+@@ -225,26 +225,28 @@ static void __init collie_init(void)
+ int ret = 0;
+
+ /* cpu initialize */
+- GAFR = ( GPIO_SSP_TXD | \
+- GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK | GPIO_TIC_ACK | \
+- GPIO_32_768kHz );
+-
+- GPDR = ( GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | \
+- GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | \
+- GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | \
+- GPIO_SDLC_AAF | GPIO_UART_SCLK1 | GPIO_32_768kHz );
+- GPLR = GPIO_GPIO18;
+-
+- // PPC pin setting
+- PPDR = ( PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | \
+- PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS | \
+- PPC_TXD1 | PPC_TXD2 | PPC_RXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM );
+-
+- PSDR = ( PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4 );
+-
+- GAFR |= GPIO_32_768kHz;
+- GPDR |= GPIO_32_768kHz;
+- TUCR = TUCR_32_768kHz;
++ GAFR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK |
++ GPIO_MCP_CLK | GPIO_32_768kHz;
++
++ GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 |
++ GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD |
++ GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK |
++ COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON |
++ COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;
++
++ PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 |
++ PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
++ PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
++
++ PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY |
++ COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
++
++ PGSR = COLLIE_GPIO_nREMOCON_ON;
++
++ PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4;
++
++ PCFR = PCFR_OPDE;
++
+
+ platform_scoop_config = &collie_pcmcia_config;
+
+diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
+index 2946c19..2db5580 100644
+--- a/arch/arm/plat-omap/clock.c
++++ b/arch/arm/plat-omap/clock.c
+@@ -21,6 +21,7 @@
+ #include <linux/clk.h>
+ #include <linux/mutex.h>
+ #include <linux/platform_device.h>
++#include <linux/cpufreq.h>
+
+ #include <asm/io.h>
+
+diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
+index f197bb3..2f01af5 100644
+--- a/arch/arm/plat-s3c24xx/s3c244x.c
++++ b/arch/arm/plat-s3c24xx/s3c244x.c
+@@ -65,6 +65,7 @@ void __init s3c244x_map_io(struct map_desc *mach_desc, int size)
+
+ /* rename any peripherals used differing from the s3c2410 */
+
++ s3c_device_sdi.name = "s3c2440-sdi";
+ s3c_device_i2c.name = "s3c2440-i2c";
+ s3c_device_nand.name = "s3c2440-nand";
+ s3c_device_usbgadget.name = "s3c2440-usbgadget";
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c
index effcacf..4405846 100644
--- a/arch/avr32/kernel/init_task.c
@@ -2486,6 +2866,28 @@
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
+diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
+index b841ecf..9af7740 100644
+--- a/arch/frv/mm/init.c
++++ b/arch/frv/mm/init.c
+@@ -26,6 +26,7 @@
+ #include <linux/types.h>
+ #include <linux/bootmem.h>
+ #include <linux/highmem.h>
++#include <linux/module.h>
+
+ #include <asm/setup.h>
+ #include <asm/segment.h>
+@@ -56,7 +57,9 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
+ */
+ static unsigned long empty_bad_page_table;
+ static unsigned long empty_bad_page;
++
+ unsigned long empty_zero_page;
++EXPORT_SYMBOL(empty_zero_page);
+
+ /*****************************************************************************/
+ /*
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c
index 19272c2..93a4899 100644
--- a/arch/h8300/kernel/init_task.c
@@ -5937,6 +6339,19 @@
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
+diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
+index 8e24fc1..31729a9 100644
+--- a/arch/powerpc/kernel/prom_init_check.sh
++++ b/arch/powerpc/kernel/prom_init_check.sh
+@@ -20,7 +20,7 @@ WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush
+ _end enter_prom memcpy memset reloc_offset __secondary_hold
+ __secondary_hold_acknowledge __secondary_hold_spinloop __start
+ strcmp strcpy strlcpy strlen strncmp strstr logo_linux_clut224
+-reloc_got2"
++reloc_got2 kernstart_addr"
+
+ NM="$1"
+ OBJ="$2"
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index ddeaf9e..b9ba7d9 100644
--- a/arch/powerpc/mm/hash_low_32.S
@@ -5948,6 +6363,71 @@
* PowerPC version
* Copyright (C) 1995-1996 Gary Thomas (gdt at linuxppc.org)
* Rewritten by Cort Dougan (cort at cs.nmt.edu) for PReP
+diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
+index 80d1bab..e0ff59f 100644
+--- a/arch/powerpc/mm/pgtable_32.c
++++ b/arch/powerpc/mm/pgtable_32.c
+@@ -402,7 +402,7 @@ void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
+ return;
+ }
+
+- map_page(address, phys, flags);
++ map_page(address, phys, pgprot_val(flags));
+ fixmaps++;
+ }
+
+diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
+index 5b3fb2b..3a58ffa 100644
+--- a/arch/powerpc/platforms/ps3/mm.c
++++ b/arch/powerpc/platforms/ps3/mm.c
+@@ -317,6 +317,9 @@ static int __init ps3_mm_add_memory(void)
+ return result;
+ }
+
++ lmb_add(start_addr, map.r1.size);
++ lmb_analyze();
++
+ result = online_pages(start_pfn, nr_pages);
+
+ if (result)
+diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
+index 8619f2a..7680001 100644
+--- a/arch/powerpc/sysdev/mpic.c
++++ b/arch/powerpc/sysdev/mpic.c
+@@ -1331,6 +1331,9 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
+ unsigned long flags;
+ u32 reg;
+
++ if (!mpic)
++ return;
++
+ spin_lock_irqsave(&mpic_lock, flags);
+ if (is_ipi) {
+ reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
+@@ -1346,23 +1349,6 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
+ spin_unlock_irqrestore(&mpic_lock, flags);
+ }
+
+-unsigned int mpic_irq_get_priority(unsigned int irq)
+-{
+- unsigned int is_ipi;
+- struct mpic *mpic = mpic_find(irq, &is_ipi);
+- unsigned int src = mpic_irq_to_hw(irq);
+- unsigned long flags;
+- u32 reg;
+-
+- spin_lock_irqsave(&mpic_lock, flags);
+- if (is_ipi)
+- reg = mpic_ipi_read(src = mpic->ipi_vecs[0]);
+- else
+- reg = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
+- spin_unlock_irqrestore(&mpic_lock, flags);
+- return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT;
+-}
+-
+ void mpic_setup_this_cpu(void)
+ {
+ #ifdef CONFIG_SMP
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
index d494161..7ad0039 100644
--- a/arch/s390/kernel/init_task.c
@@ -7596,6 +8076,75 @@
static struct signal_struct init_signals = INIT_SIGNALS (init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM (init_mm);
+diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c
+index c1d00c0..50e47cd 100644
+--- a/arch/x86/boot/printf.c
++++ b/arch/x86/boot/printf.c
+@@ -56,7 +56,7 @@ static char *number(char *str, long num, int base, int size, int precision,
+ if (type & LEFT)
+ type &= ~ZEROPAD;
+ if (base < 2 || base > 36)
+- return 0;
++ return NULL;
+ c = (type & ZEROPAD) ? '0' : ' ';
+ sign = 0;
+ if (type & SIGN) {
+diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
+index 5910020..0633cfd 100644
+--- a/arch/x86/kernel/apic_64.c
++++ b/arch/x86/kernel/apic_64.c
+@@ -534,7 +534,7 @@ int setup_profiling_timer(unsigned int multiplier)
+ */
+ void clear_local_APIC(void)
+ {
+- int maxlvt = lapic_get_maxlvt();
++ int maxlvt;
+ u32 v;
+
+ /* APIC hasn't been mapped yet */
+diff --git a/arch/x86/kernel/cpu/cpufreq/longrun.c b/arch/x86/kernel/cpu/cpufreq/longrun.c
+index af4a867..777a7ff 100644
+--- a/arch/x86/kernel/cpu/cpufreq/longrun.c
++++ b/arch/x86/kernel/cpu/cpufreq/longrun.c
+@@ -245,7 +245,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
+ if ((ecx > 95) || (ecx == 0) || (eax < ebx))
+ return -EIO;
+
+- edx = (eax - ebx) / (100 - ecx);
++ edx = ((eax - ebx) * 100) / (100 - ecx);
+ *low_freq = edx * 1000; /* back to kHz */
+
+ dprintk("low frequency is %u kHz\n", *low_freq);
+diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+index 46d4034..206791e 100644
+--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+@@ -1127,12 +1127,23 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
+ * an UP version, and is deprecated by AMD.
+ */
+ if (num_online_cpus() != 1) {
+- printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n");
++#ifndef CONFIG_ACPI_PROCESSOR
++ printk(KERN_ERR PFX "ACPI Processor support is required "
++ "for SMP systems but is absent. Please load the "
++ "ACPI Processor module before starting this "
++ "driver.\n");
++#else
++ printk(KERN_ERR PFX "Your BIOS does not provide ACPI "
++ "_PSS objects in a way that Linux understands. "
++ "Please report this to the Linux ACPI maintainers"
++ " and complain to your BIOS vendor.\n");
++#endif
+ kfree(data);
+ return -ENODEV;
+ }
+ if (pol->cpu != 0) {
+- printk(KERN_ERR PFX "No _PSS objects for CPU other than CPU0\n");
++ printk(KERN_ERR PFX "No ACPI _PSS objects for CPU other than "
++ "CPU0. Complain to your BIOS vendor.\n");
+ kfree(data);
+ return -ENODEV;
+ }
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
index 3d01e47..a4f93b4 100644
--- a/arch/x86/kernel/init_task.c
@@ -7608,6 +8157,141 @@
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
+diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
+index 4bc1be5..08a3098 100644
+--- a/arch/x86/kernel/kvmclock.c
++++ b/arch/x86/kernel/kvmclock.c
+@@ -53,7 +53,7 @@ static cycle_t kvm_clock_read(void);
+ * have elapsed since the hypervisor wrote the data. So we try to account for
+ * that with system time
+ */
+-unsigned long kvm_get_wallclock(void)
++static unsigned long kvm_get_wallclock(void)
+ {
+ u32 wc_sec, wc_nsec;
+ u64 delta;
+@@ -86,7 +86,7 @@ unsigned long kvm_get_wallclock(void)
+ return ts.tv_sec + 1;
+ }
+
+-int kvm_set_wallclock(unsigned long now)
++static int kvm_set_wallclock(unsigned long now)
+ {
+ return 0;
+ }
+diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
+index e479072..068759d 100644
+--- a/arch/x86/kernel/tsc_32.c
++++ b/arch/x86/kernel/tsc_32.c
+@@ -14,7 +14,7 @@
+
+ #include "mach_timer.h"
+
+-static int tsc_enabled;
++static int tsc_disabled;
+
+ /*
+ * On some systems the TSC frequency does not
+@@ -28,8 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
+ static int __init tsc_setup(char *str)
+ {
+ printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
+- "cannot disable TSC completely.\n");
+- mark_tsc_unstable("user disabled TSC");
++ "cannot disable TSC completely.\n");
++ tsc_disabled = 1;
+ return 1;
+ }
+ #else
+@@ -120,7 +120,7 @@ unsigned long long native_sched_clock(void)
+ * very important for it to be as fast as the platform
+ * can achive it. )
+ */
+- if (unlikely(!tsc_enabled && !tsc_unstable))
++ if (unlikely(tsc_disabled))
+ /* No locking but a rare wrong value is not a big deal: */
+ return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
+
+@@ -322,7 +322,6 @@ void mark_tsc_unstable(char *reason)
+ {
+ if (!tsc_unstable) {
+ tsc_unstable = 1;
+- tsc_enabled = 0;
+ printk("Marking TSC unstable due to: %s.\n", reason);
+ /* Can be called before registration */
+ if (clocksource_tsc.mult)
+@@ -336,7 +335,7 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
+ static int __init dmi_mark_tsc_unstable(const struct dmi_system_id *d)
+ {
+ printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
+- d->ident);
++ d->ident);
+ tsc_unstable = 1;
+ return 0;
+ }
+@@ -403,14 +402,22 @@ void __init tsc_init(void)
+ {
+ int cpu;
+
+- if (!cpu_has_tsc)
++ if (!cpu_has_tsc || tsc_disabled) {
++ /* Disable the TSC in case of !cpu_has_tsc */
++ tsc_disabled = 1;
+ return;
++ }
+
+ cpu_khz = calculate_cpu_khz();
+ tsc_khz = cpu_khz;
+
+ if (!cpu_khz) {
+ mark_tsc_unstable("could not calculate TSC khz");
++ /*
++ * We need to disable the TSC completely in this case
++ * to prevent sched_clock() from using it.
++ */
++ tsc_disabled = 1;
+ return;
+ }
+
+@@ -441,8 +448,6 @@ void __init tsc_init(void)
+ if (check_tsc_unstable()) {
+ clocksource_tsc.rating = 0;
+ clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
+- } else
+- tsc_enabled = 1;
+-
++ }
+ clocksource_register(&clocksource_tsc);
+ }
+diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
+index fcc16e5..1784b80 100644
+--- a/arch/x86/kernel/tsc_64.c
++++ b/arch/x86/kernel/tsc_64.c
+@@ -227,14 +227,14 @@ void __init tsc_calibrate(void)
+ /* hpet or pmtimer available ? */
+ if (!hpet && !pm1 && !pm2) {
+ printk(KERN_INFO "TSC calibrated against PIT\n");
+- return;
++ goto out;
+ }
+
+ /* Check, whether the sampling was disturbed by an SMI */
+ if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
+ printk(KERN_WARNING "TSC calibration disturbed by SMI, "
+ "using PIT calibration result\n");
+- return;
++ goto out;
+ }
+
+ tsc2 = (tsc2 - tsc1) * 1000000L;
+@@ -255,6 +255,7 @@ void __init tsc_calibrate(void)
+
+ tsc_khz = tsc2 / tsc1;
+
++out:
+ for_each_possible_cpu(cpu)
+ set_cyc2ns_scale(tsc_khz, cpu);
+ }
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 3324d90..7c077a9 100644
--- a/arch/x86/kvm/i8254.c
@@ -7634,6 +8318,19 @@
return atomic_read(&lapic->timer.pending);
return 0;
+diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
+index 36c5406..7246b60 100644
+--- a/arch/x86/kvm/mmu.c
++++ b/arch/x86/kvm/mmu.c
+@@ -1996,7 +1996,7 @@ static struct shrinker mmu_shrinker = {
+ .seeks = DEFAULT_SEEKS * 10,
+ };
+
+-void mmu_destroy_caches(void)
++static void mmu_destroy_caches(void)
+ {
+ if (pte_chain_cache)
+ kmem_cache_destroy(pte_chain_cache);
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index f2a696d..8a96320 100644
--- a/arch/x86/kvm/x86_emulate.c
@@ -7693,6 +8390,36 @@
},
},
#ifdef __i386__
+diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
+index 23476c2..efa2ba7 100644
+--- a/arch/x86/vdso/vclock_gettime.c
++++ b/arch/x86/vdso/vclock_gettime.c
+@@ -106,9 +106,9 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
+ do_realtime((struct timespec *)tv);
+ tv->tv_usec /= 1000;
+ if (unlikely(tz != NULL)) {
+- /* This relies on gcc inlining the memcpy. We'll notice
+- if it ever fails to do so. */
+- memcpy(tz, >od->sys_tz, sizeof(struct timezone));
++ /* Avoid memcpy. Some old compilers fail to inline it */
++ tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest;
++ tz->tz_dsttime = gtod->sys_tz.tz_dsttime;
+ }
+ return 0;
+ }
+diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
+index 126766d..3525ef5 100644
+--- a/arch/x86/xen/mmu.c
++++ b/arch/x86/xen/mmu.c
+@@ -60,7 +60,7 @@ xmaddr_t arbitrary_virt_to_machine(unsigned long address)
+ {
+ unsigned int level;
+ pte_t *pte = lookup_address(address, &level);
+- unsigned offset = address & PAGE_MASK;
++ unsigned offset = address & ~PAGE_MASK;
+
+ BUG_ON(pte == NULL);
+
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c
index 021b4f4..3df469d 100644
--- a/arch/xtensa/kernel/init_task.c
@@ -7705,6 +8432,41 @@
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
+diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
+index e48a3ea..2509809 100644
+--- a/drivers/acpi/dispatcher/dsmethod.c
++++ b/drivers/acpi/dispatcher/dsmethod.c
+@@ -565,7 +565,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
+
+ acpi_os_release_mutex(method_desc->method.
+ mutex->mutex.os_mutex);
+- method_desc->method.mutex->mutex.thread_id = 0;
++ method_desc->method.mutex->mutex.thread_id = NULL;
+ }
+ }
+
+diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c
+index c873ab4..a8bf3d7 100644
+--- a/drivers/acpi/executer/exmutex.c
++++ b/drivers/acpi/executer/exmutex.c
+@@ -326,7 +326,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc)
+
+ /* Clear mutex info */
+
+- obj_desc->mutex.thread_id = 0;
++ obj_desc->mutex.thread_id = NULL;
+ return_ACPI_STATUS(status);
+ }
+
+@@ -463,7 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
+ /* Mark mutex unowned */
+
+ obj_desc->mutex.owner_thread = NULL;
+- obj_desc->mutex.thread_id = 0;
++ obj_desc->mutex.thread_id = NULL;
+
+ /* Update Thread sync_level (Last mutex is the important one) */
+
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 70b77e0..dbf6ca7 100644
--- a/drivers/ata/libata-acpi.c
@@ -9788,6 +10550,44 @@
}
#endif
+diff --git a/drivers/block/brd.c b/drivers/block/brd.c
+index a196ef7..680cdfc 100644
+--- a/drivers/block/brd.c
++++ b/drivers/block/brd.c
+@@ -447,6 +447,7 @@ static struct brd_device *brd_alloc(int i)
+ disk->fops = &brd_fops;
+ disk->private_data = brd;
+ disk->queue = brd->brd_queue;
++ disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
+ sprintf(disk->disk_name, "ram%d", i);
+ set_capacity(disk, rd_size * 2);
+
+diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
+index ebfe038..f1c8feb 100644
+--- a/drivers/block/viodasd.c
++++ b/drivers/block/viodasd.c
+@@ -3,7 +3,7 @@
+ * Authors: Dave Boutcher <boutcher at us.ibm.com>
+ * Ryan Arnold <ryanarn at us.ibm.com>
+ * Colin Devilbiss <devilbis at us.ibm.com>
+- * Stephen Rothwell <sfr at au1.ibm.com>
++ * Stephen Rothwell
+ *
+ * (C) Copyright 2000-2004 IBM Corporation
+ *
+diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
+index 5245a4a..9d0dfe6 100644
+--- a/drivers/cdrom/viocd.c
++++ b/drivers/cdrom/viocd.c
+@@ -6,7 +6,7 @@
+ * Authors: Dave Boutcher <boutcher at us.ibm.com>
+ * Ryan Arnold <ryanarn at us.ibm.com>
+ * Colin Devilbiss <devilbis at us.ibm.com>
+- * Stephen Rothwell <sfr at au1.ibm.com>
++ * Stephen Rothwell
+ *
+ * (C) Copyright 2000-2004 IBM Corporation
+ *
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 6874f31..3a05c6d 100644
--- a/drivers/char/drm/drm.h
@@ -10618,6 +11418,19 @@
}
EXPORT_SYMBOL(drm_idlelock_release);
+diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c
+index 9a32169..af211a0 100644
+--- a/drivers/char/drm/drm_sysfs.c
++++ b/drivers/char/drm/drm_sysfs.c
+@@ -34,8 +34,6 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state)
+ struct drm_minor *drm_minor = to_drm_minor(dev);
+ struct drm_device *drm_dev = drm_minor->dev;
+
+- printk(KERN_ERR "%s\n", __func__);
+-
+ if (drm_dev->driver->suspend)
+ return drm_dev->driver->suspend(drm_dev, state);
+
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index f47e46e..8897434 100644
--- a/drivers/char/drm/i915_dma.c
@@ -12912,6 +13725,48 @@
NULL, /* y */
NULL /* z */
};
+diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
+index 3d3e1c2..65fb848 100644
+--- a/drivers/char/viocons.c
++++ b/drivers/char/viocons.c
+@@ -7,7 +7,7 @@
+ * Authors: Dave Boutcher <boutcher at us.ibm.com>
+ * Ryan Arnold <ryanarn at us.ibm.com>
+ * Colin Devilbiss <devilbis at us.ibm.com>
+- * Stephen Rothwell <sfr at au1.ibm.com>
++ * Stephen Rothwell
+ *
+ * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation
+ *
+diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
+index 58aad63..c39ddaf 100644
+--- a/drivers/char/viotape.c
++++ b/drivers/char/viotape.c
+@@ -6,7 +6,7 @@
+ * Authors: Dave Boutcher <boutcher at us.ibm.com>
+ * Ryan Arnold <ryanarn at us.ibm.com>
+ * Colin Devilbiss <devilbis at us.ibm.com>
+- * Stephen Rothwell <sfr at au1.ibm.com>
++ * Stephen Rothwell
+ *
+ * (C) Copyright 2000-2004 IBM Corporation
+ *
+diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
+index ae6cd60..b64c6bc 100644
+--- a/drivers/cpufreq/freq_table.c
++++ b/drivers/cpufreq/freq_table.c
+@@ -2,6 +2,11 @@
+ * linux/drivers/cpufreq/freq_table.c
+ *
+ * Copyright (C) 2002 - 2003 Dominik Brodowski
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
+ */
+
+ #include <linux/kernel.h>
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 762b729..0ec0f43 100644
--- a/drivers/dma/iop-adma.c
@@ -12938,6 +13793,27 @@
/* Start copy, using first DMA channel */
dma_chan = container_of(device->common.channels.next,
struct dma_chan,
+diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
+index 065732d..d49361b 100644
+--- a/drivers/edac/mpc85xx_edac.c
++++ b/drivers/edac/mpc85xx_edac.c
+@@ -20,7 +20,6 @@
+
+ #include <linux/of_platform.h>
+ #include <linux/of_device.h>
+-#include <asm/mpc85xx.h>
+ #include "edac_module.h"
+ #include "edac_core.h"
+ #include "mpc85xx_edac.h"
+@@ -43,8 +42,6 @@ static u32 orig_pci_err_en;
+ static u32 orig_l2_err_disable;
+ static u32 orig_hid1;
+
+-static const char *mpc85xx_ctl_name = "MPC85xx";
+-
+ /************************ MC SYSFS parts ***********************************/
+
+ static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci,
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 4a54192..dda1401 100644
--- a/drivers/firewire/fw-cdev.c
@@ -12984,6 +13860,62 @@
/* FIXME: We could support multiple buffers, but we don't. */
if (client->buffer.pages != NULL)
return -EBUSY;
+diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
+index 7f138c6..beaf6b3 100644
+--- a/drivers/gpio/gpiolib.c
++++ b/drivers/gpio/gpiolib.c
+@@ -127,7 +127,7 @@ int __init gpiochip_reserve(int start, int ngpio)
+ unsigned long flags;
+ int i;
+
+- if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio))
++ if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio - 1))
+ return -EINVAL;
+
+ spin_lock_irqsave(&gpio_lock, flags);
+@@ -170,7 +170,7 @@ int gpiochip_add(struct gpio_chip *chip)
+ unsigned id;
+ int base = chip->base;
+
+- if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio))
++ if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio - 1))
+ && base >= 0) {
+ status = -EINVAL;
+ goto fail;
+@@ -207,7 +207,7 @@ fail:
+ /* failures here can mean systems won't boot... */
+ if (status)
+ pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n",
+- chip->base, chip->base + chip->ngpio,
++ chip->base, chip->base + chip->ngpio - 1,
+ chip->label ? : "generic");
+ return status;
+ }
+diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
+index 7fb5b9d..7f92fdd 100644
+--- a/drivers/gpio/mcp23s08.c
++++ b/drivers/gpio/mcp23s08.c
+@@ -168,7 +168,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
+ {
+ struct mcp23s08 *mcp;
+ char bank;
+- unsigned t;
++ int t;
+ unsigned mask;
+
+ mcp = container_of(chip, struct mcp23s08, chip);
+diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
+index 93f9167..7e40e8a 100644
+--- a/drivers/gpio/pca953x.c
++++ b/drivers/gpio/pca953x.c
+@@ -30,6 +30,7 @@ static const struct i2c_device_id pca953x_id[] = {
+ { "pca9537", 4, },
+ { "pca9538", 8, },
+ { "pca9539", 16, },
++ { "pca9554", 8, },
+ { "pca9555", 16, },
+ { "pca9557", 8, },
+ /* REVISIT several pca955x parts should work here too */
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index f88714b..47ac1a7 100644
--- a/drivers/hid/hid-debug.c
@@ -13131,76 +14063,1341 @@
* Copyright (c) 1999-2001 Vojtech Pavlik
*
* USB HIDBP Mouse support
-diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
-index 34b0d4f..655ec7e 100644
---- a/drivers/ide/ide-probe.c
-+++ b/drivers/ide/ide-probe.c
-@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif)
+diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
+index 4dc76bc..00ff533 100644
+--- a/drivers/hwmon/Kconfig
++++ b/drivers/hwmon/Kconfig
+@@ -330,6 +330,20 @@ config SENSORS_CORETEMP
+ sensor inside your CPU. Supported all are all known variants
+ of Intel Core family.
+
++config SENSORS_IBMAEM
++ tristate "IBM Active Energy Manager temperature/power sensors and control"
++ select IPMI_SI
++ depends on IPMI_HANDLER
++ help
++ If you say yes here you get support for the temperature and
++ power sensors and capping hardware in various IBM System X
++ servers that support Active Energy Manager. This includes
++ the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2,
++ and certain HS2x/LS2x/QS2x blades.
++
++ This driver can also be built as a module. If so, the module
++ will be called ibmaem.
++
+ config SENSORS_IBMPEX
+ tristate "IBM PowerExecutive temperature/power sensors"
+ select IPMI_SI
+diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
+index 3bdb05a..d098677 100644
+--- a/drivers/hwmon/Makefile
++++ b/drivers/hwmon/Makefile
+@@ -41,6 +41,7 @@ obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
+ obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
+ obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o
+ obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
++obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
+ obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
+ obj-$(CONFIG_SENSORS_IT87) += it87.o
+ obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o
+diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
+index bab5fd2..88e8965 100644
+--- a/drivers/hwmon/hdaps.c
++++ b/drivers/hwmon/hdaps.c
+@@ -515,6 +515,7 @@ static struct dmi_system_id __initdata hdaps_whitelist[] = {
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"),
++ HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i"),
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"),
+ HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"),
+ HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"),
+diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
+index 6ac5c6f..f9e2ed6 100644
+--- a/drivers/hwmon/i5k_amb.c
++++ b/drivers/hwmon/i5k_amb.c
+@@ -111,6 +111,7 @@ struct i5k_amb_data {
+ void __iomem *amb_mmio;
+ struct i5k_device_attribute *attrs;
+ unsigned int num_attrs;
++ unsigned long chipset_id;
+ };
- get_device(&hwif->gendev);
+ static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
+@@ -382,7 +383,8 @@ err:
+ return res;
+ }
-- hwif->portdev = device_create(ide_port_class, &hwif->gendev,
-- MKDEV(0, 0), hwif->name);
-+ hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
-+ MKDEV(0, 0), hwif, hwif->name);
- if (IS_ERR(hwif->portdev)) {
- ret = PTR_ERR(hwif->portdev);
- device_unregister(&hwif->gendev);
+-static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
++static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
++ unsigned long devid)
+ {
+ struct pci_dev *pcidev;
+ u32 val32;
+@@ -390,7 +392,7 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
+
+ /* Find AMB register memory space */
+ pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
+- PCI_DEVICE_ID_INTEL_5000_ERR,
++ devid,
+ NULL);
+ if (!pcidev)
+ return -ENODEV;
+@@ -409,6 +411,8 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data)
+ goto out;
}
-- dev_set_drvdata(hwif->portdev, hwif);
+
++ data->chipset_id = devid;
++
+ res = 0;
out:
- return ret;
+ pci_dev_put(pcidev);
+@@ -441,10 +445,30 @@ out:
+ return res;
}
-diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
-index 16b9d0a..a5ceff2 100644
---- a/drivers/ieee1394/sbp2.c
-+++ b/drivers/ieee1394/sbp2.c
-@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
- static void sbp2_create_command_orb(struct sbp2_lu *lu,
- struct sbp2_command_info *cmd,
-- unchar *scsi_cmd,
-- unsigned int scsi_use_sg,
-- unsigned int scsi_request_bufflen,
-- struct scatterlist *sg,
-- enum dma_data_direction dma_dir)
-+ struct scsi_cmnd *SCpnt)
++static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data,
++ unsigned long channel)
++{
++ switch (data->chipset_id) {
++ case PCI_DEVICE_ID_INTEL_5000_ERR:
++ return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel;
++ case PCI_DEVICE_ID_INTEL_5400_ERR:
++ return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel;
++ default:
++ BUG();
++ }
++}
++
++static unsigned long chipset_ids[] = {
++ PCI_DEVICE_ID_INTEL_5000_ERR,
++ PCI_DEVICE_ID_INTEL_5400_ERR,
++ 0
++};
++
+ static int __devinit i5k_amb_probe(struct platform_device *pdev)
{
- struct sbp2_fwhost_info *hi = lu->hi;
- struct sbp2_command_orb *orb = &cmd->command_orb;
- u32 orb_direction;
-+ unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt);
-+ enum dma_data_direction dma_dir = SCpnt->sc_data_direction;
-
- /*
- * Set-up our command ORB.
-@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
- orb->data_descriptor_lo = 0x0;
- orb->misc |= ORB_SET_DIRECTION(1);
- } else
-- sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg,
-+ sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt),
-+ scsi_sglist(SCpnt),
- orb_direction, dma_dir);
-
- sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
+ struct i5k_amb_data *data;
+ struct resource *reso;
++ int i;
+ int res = -ENODEV;
-- memset(orb->cdb, 0, 12);
-- memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd));
-+ memset(orb->cdb, 0, sizeof(orb->cdb));
-+ memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len);
- }
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
+@@ -452,19 +476,24 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
+ return -ENOMEM;
- static void sbp2_link_orb_command(struct sbp2_lu *lu,
-@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
- static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
- void (*done)(struct scsi_cmnd *))
- {
-- unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
- struct sbp2_command_info *cmd;
+ /* Figure out where the AMB registers live */
+- res = i5k_find_amb_registers(data);
++ i = 0;
++ do {
++ res = i5k_find_amb_registers(data, chipset_ids[i]);
++ i++;
++ } while (res && chipset_ids[i]);
++
+ if (res)
+ goto err;
- cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
- if (!cmd)
+ /* Copy the DIMM presence map for the first two channels */
+ res = i5k_channel_probe(&data->amb_present[0],
+- PCI_DEVICE_ID_INTEL_5000_FBD0);
++ i5k_channel_pci_id(data, 0));
+ if (res)
+ goto err;
+
+ /* Copy the DIMM presence map for the optional second two channels */
+ i5k_channel_probe(&data->amb_present[2],
+- PCI_DEVICE_ID_INTEL_5000_FBD1);
++ i5k_channel_pci_id(data, 1));
+
+ /* Set up resource regions */
+ reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
+diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
+new file mode 100644
+index 0000000..5c006c9
+--- /dev/null
++++ b/drivers/hwmon/ibmaem.c
+@@ -0,0 +1,1111 @@
++/*
++ * A hwmon driver for the IBM Active Energy Manager temperature/power sensors
++ * and capping functionality.
++ * Copyright (C) 2008 IBM
++ *
++ * Author: Darrick J. Wong <djwong at us.ibm.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++#include <linux/ipmi.h>
++#include <linux/module.h>
++#include <linux/hwmon.h>
++#include <linux/hwmon-sysfs.h>
++#include <linux/jiffies.h>
++#include <linux/mutex.h>
++#include <linux/kdev_t.h>
++#include <linux/spinlock.h>
++#include <linux/idr.h>
++#include <linux/sched.h>
++#include <linux/platform_device.h>
++#include <linux/math64.h>
++#include <linux/time.h>
++
++#define REFRESH_INTERVAL (HZ)
++#define IPMI_TIMEOUT (30 * HZ)
++#define DRVNAME "aem"
++
++#define AEM_NETFN 0x2E
++
++#define AEM_FIND_FW_CMD 0x80
++#define AEM_ELEMENT_CMD 0x81
++#define AEM_FW_INSTANCE_CMD 0x82
++
++#define AEM_READ_ELEMENT_CFG 0x80
++#define AEM_READ_BUFFER 0x81
++#define AEM_READ_REGISTER 0x82
++#define AEM_WRITE_REGISTER 0x83
++#define AEM_SET_REG_MASK 0x84
++#define AEM_CLEAR_REG_MASK 0x85
++#define AEM_READ_ELEMENT_CFG2 0x86
++
++#define AEM_CONTROL_ELEMENT 0
++#define AEM_ENERGY_ELEMENT 1
++#define AEM_CLOCK_ELEMENT 4
++#define AEM_POWER_CAP_ELEMENT 7
++#define AEM_EXHAUST_ELEMENT 9
++#define AEM_POWER_ELEMENT 10
++
++#define AEM_MODULE_TYPE_ID 0x0001
++
++#define AEM2_NUM_ENERGY_REGS 2
++#define AEM2_NUM_PCAP_REGS 6
++#define AEM2_NUM_TEMP_REGS 2
++#define AEM2_NUM_SENSORS 14
++
++#define AEM1_NUM_ENERGY_REGS 1
++#define AEM1_NUM_SENSORS 3
++
++/* AEM 2.x has more energy registers */
++#define AEM_NUM_ENERGY_REGS AEM2_NUM_ENERGY_REGS
++/* AEM 2.x needs more sensor files */
++#define AEM_NUM_SENSORS AEM2_NUM_SENSORS
++
++#define POWER_CAP 0
++#define POWER_CAP_MAX_HOTPLUG 1
++#define POWER_CAP_MAX 2
++#define POWER_CAP_MIN_WARNING 3
++#define POWER_CAP_MIN 4
++#define POWER_AUX 5
++
++#define AEM_DEFAULT_POWER_INTERVAL 1000
++#define AEM_MIN_POWER_INTERVAL 200
++#define UJ_PER_MJ 1000L
++
++static DEFINE_IDR(aem_idr);
++static DEFINE_SPINLOCK(aem_idr_lock);
++
++static struct device_driver aem_driver = {
++ .name = DRVNAME,
++ .bus = &platform_bus_type,
++};
++
++struct aem_ipmi_data {
++ struct completion read_complete;
++ struct ipmi_addr address;
++ ipmi_user_t user;
++ int interface;
++
++ struct kernel_ipmi_msg tx_message;
++ long tx_msgid;
++
++ void *rx_msg_data;
++ unsigned short rx_msg_len;
++ unsigned char rx_result;
++ int rx_recv_type;
++
++ struct device *bmc_device;
++};
++
++struct aem_ro_sensor_template {
++ char *label;
++ ssize_t (*show)(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf);
++ int index;
++};
++
++struct aem_rw_sensor_template {
++ char *label;
++ ssize_t (*show)(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf);
++ ssize_t (*set)(struct device *dev,
++ struct device_attribute *devattr,
++ const char *buf, size_t count);
++ int index;
++};
++
++struct aem_data {
++ struct list_head list;
++
++ struct device *hwmon_dev;
++ struct platform_device *pdev;
++ struct mutex lock;
++ char valid;
++ unsigned long last_updated; /* In jiffies */
++ u8 ver_major;
++ u8 ver_minor;
++ u8 module_handle;
++ int id;
++ struct aem_ipmi_data ipmi;
++
++ /* Function to update sensors */
++ void (*update)(struct aem_data *data);
++
++ /*
++ * AEM 1.x sensors:
++ * Available sensors:
++ * Energy meter
++ * Power meter
++ *
++ * AEM 2.x sensors:
++ * Two energy meters
++ * Two power meters
++ * Two temperature sensors
++ * Six power cap registers
++ */
++
++ /* sysfs attrs */
++ struct sensor_device_attribute sensors[AEM_NUM_SENSORS];
++
++ /* energy use in mJ */
++ u64 energy[AEM_NUM_ENERGY_REGS];
++
++ /* power sampling interval in ms */
++ unsigned long power_period[AEM_NUM_ENERGY_REGS];
++
++ /* Everything past here is for AEM2 only */
++
++ /* power caps in dW */
++ u16 pcap[AEM2_NUM_PCAP_REGS];
++
++ /* exhaust temperature in C */
++ u8 temp[AEM2_NUM_TEMP_REGS];
++};
++
++/* Data structures returned by the AEM firmware */
++struct aem_iana_id {
++ u8 bytes[3];
++};
++static struct aem_iana_id system_x_id = {
++ .bytes = {0x4D, 0x4F, 0x00}
++};
++
++/* These are used to find AEM1 instances */
++struct aem_find_firmware_req {
++ struct aem_iana_id id;
++ u8 rsvd;
++ u16 index;
++ u16 module_type_id;
++} __packed;
++
++struct aem_find_firmware_resp {
++ struct aem_iana_id id;
++ u8 num_instances;
++} __packed;
++
++/* These are used to find AEM2 instances */
++struct aem_find_instance_req {
++ struct aem_iana_id id;
++ u8 instance_number;
++ u16 module_type_id;
++} __packed;
++
++struct aem_find_instance_resp {
++ struct aem_iana_id id;
++ u8 num_instances;
++ u8 major;
++ u8 minor;
++ u8 module_handle;
++ u16 record_id;
++} __packed;
++
++/* These are used to query sensors */
++struct aem_read_sensor_req {
++ struct aem_iana_id id;
++ u8 module_handle;
++ u8 element;
++ u8 subcommand;
++ u8 reg;
++ u8 rx_buf_size;
++} __packed;
++
++struct aem_read_sensor_resp {
++ struct aem_iana_id id;
++ u8 bytes[0];
++} __packed;
++
++/* Data structures to talk to the IPMI layer */
++struct aem_driver_data {
++ struct list_head aem_devices;
++ struct ipmi_smi_watcher bmc_events;
++ struct ipmi_user_hndl ipmi_hndlrs;
++};
++
++static void aem_register_bmc(int iface, struct device *dev);
++static void aem_bmc_gone(int iface);
++static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data);
++
++static void aem_remove_sensors(struct aem_data *data);
++static int aem_init_aem1(struct aem_ipmi_data *probe);
++static int aem_init_aem2(struct aem_ipmi_data *probe);
++static int aem1_find_sensors(struct aem_data *data);
++static int aem2_find_sensors(struct aem_data *data);
++static void update_aem1_sensors(struct aem_data *data);
++static void update_aem2_sensors(struct aem_data *data);
++
++static struct aem_driver_data driver_data = {
++ .aem_devices = LIST_HEAD_INIT(driver_data.aem_devices),
++ .bmc_events = {
++ .owner = THIS_MODULE,
++ .new_smi = aem_register_bmc,
++ .smi_gone = aem_bmc_gone,
++ },
++ .ipmi_hndlrs = {
++ .ipmi_recv_hndl = aem_msg_handler,
++ },
++};
++
++/* Functions to talk to the IPMI layer */
++
++/* Initialize IPMI address, message buffers and user data */
++static int aem_init_ipmi_data(struct aem_ipmi_data *data, int iface,
++ struct device *bmc)
++{
++ int err;
++
++ init_completion(&data->read_complete);
++ data->bmc_device = bmc;
++
++ /* Initialize IPMI address */
++ data->address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
++ data->address.channel = IPMI_BMC_CHANNEL;
++ data->address.data[0] = 0;
++ data->interface = iface;
++
++ /* Initialize message buffers */
++ data->tx_msgid = 0;
++ data->tx_message.netfn = AEM_NETFN;
++
++ /* Create IPMI messaging interface user */
++ err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs,
++ data, &data->user);
++ if (err < 0) {
++ dev_err(bmc, "Unable to register user with IPMI "
++ "interface %d\n", data->interface);
++ return -EACCES;
++ }
++
++ return 0;
++}
++
++/* Send an IPMI command */
++static int aem_send_message(struct aem_ipmi_data *data)
++{
++ int err;
++
++ err = ipmi_validate_addr(&data->address, sizeof(data->address));
++ if (err)
++ goto out;
++
++ data->tx_msgid++;
++ err = ipmi_request_settime(data->user, &data->address, data->tx_msgid,
++ &data->tx_message, data, 0, 0, 0);
++ if (err)
++ goto out1;
++
++ return 0;
++out1:
++ dev_err(data->bmc_device, "request_settime=%x\n", err);
++ return err;
++out:
++ dev_err(data->bmc_device, "validate_addr=%x\n", err);
++ return err;
++}
++
++/* Dispatch IPMI messages to callers */
++static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data)
++{
++ unsigned short rx_len;
++ struct aem_ipmi_data *data = user_msg_data;
++
++ if (msg->msgid != data->tx_msgid) {
++ dev_err(data->bmc_device, "Mismatch between received msgid "
++ "(%02x) and transmitted msgid (%02x)!\n",
++ (int)msg->msgid,
++ (int)data->tx_msgid);
++ ipmi_free_recv_msg(msg);
++ return;
++ }
++
++ data->rx_recv_type = msg->recv_type;
++ if (msg->msg.data_len > 0)
++ data->rx_result = msg->msg.data[0];
++ else
++ data->rx_result = IPMI_UNKNOWN_ERR_COMPLETION_CODE;
++
++ if (msg->msg.data_len > 1) {
++ rx_len = msg->msg.data_len - 1;
++ if (data->rx_msg_len < rx_len)
++ rx_len = data->rx_msg_len;
++ data->rx_msg_len = rx_len;
++ memcpy(data->rx_msg_data, msg->msg.data + 1, data->rx_msg_len);
++ } else
++ data->rx_msg_len = 0;
++
++ ipmi_free_recv_msg(msg);
++ complete(&data->read_complete);
++}
++
++/* ID functions */
++
++/* Obtain an id */
++static int aem_idr_get(int *id)
++{
++ int i, err;
++
++again:
++ if (unlikely(!idr_pre_get(&aem_idr, GFP_KERNEL)))
++ return -ENOMEM;
++
++ spin_lock(&aem_idr_lock);
++ err = idr_get_new(&aem_idr, NULL, &i);
++ spin_unlock(&aem_idr_lock);
++
++ if (unlikely(err == -EAGAIN))
++ goto again;
++ else if (unlikely(err))
++ return err;
++
++ *id = i & MAX_ID_MASK;
++ return 0;
++}
++
++/* Release an object ID */
++static void aem_idr_put(int id)
++{
++ spin_lock(&aem_idr_lock);
++ idr_remove(&aem_idr, id);
++ spin_unlock(&aem_idr_lock);
++}
++
++/* Sensor support functions */
++
++/* Read a sensor value */
++static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg,
++ void *buf, size_t size)
++{
++ int rs_size, res;
++ struct aem_read_sensor_req rs_req;
++ struct aem_read_sensor_resp *rs_resp;
++ struct aem_ipmi_data *ipmi = &data->ipmi;
++
++ /* AEM registers are 1, 2, 4 or 8 bytes */
++ switch (size) {
++ case 1:
++ case 2:
++ case 4:
++ case 8:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ rs_req.id = system_x_id;
++ rs_req.module_handle = data->module_handle;
++ rs_req.element = elt;
++ rs_req.subcommand = AEM_READ_REGISTER;
++ rs_req.reg = reg;
++ rs_req.rx_buf_size = size;
++
++ ipmi->tx_message.cmd = AEM_ELEMENT_CMD;
++ ipmi->tx_message.data = (char *)&rs_req;
++ ipmi->tx_message.data_len = sizeof(rs_req);
++
++ rs_size = sizeof(*rs_resp) + size;
++ rs_resp = kzalloc(rs_size, GFP_KERNEL);
++ if (!rs_resp)
++ return -ENOMEM;
++
++ ipmi->rx_msg_data = rs_resp;
++ ipmi->rx_msg_len = rs_size;
++
++ aem_send_message(ipmi);
++
++ res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT);
++ if (!res)
++ return -ETIMEDOUT;
++
++ if (ipmi->rx_result || ipmi->rx_msg_len != rs_size ||
++ memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) {
++ kfree(rs_resp);
++ return -ENOENT;
++ }
++
++ switch (size) {
++ case 1: {
++ u8 *x = buf;
++ *x = rs_resp->bytes[0];
++ break;
++ }
++ case 2: {
++ u16 *x = buf;
++ *x = be16_to_cpup((u16 *)rs_resp->bytes);
++ break;
++ }
++ case 4: {
++ u32 *x = buf;
++ *x = be32_to_cpup((u32 *)rs_resp->bytes);
++ break;
++ }
++ case 8: {
++ u64 *x = buf;
++ *x = be64_to_cpup((u64 *)rs_resp->bytes);
++ break;
++ }
++ }
++
++ return 0;
++}
++
++/* Update AEM energy registers */
++static void update_aem_energy(struct aem_data *data)
++{
++ aem_read_sensor(data, AEM_ENERGY_ELEMENT, 0, &data->energy[0], 8);
++ if (data->ver_major < 2)
++ return;
++ aem_read_sensor(data, AEM_ENERGY_ELEMENT, 1, &data->energy[1], 8);
++}
++
++/* Update all AEM1 sensors */
++static void update_aem1_sensors(struct aem_data *data)
++{
++ mutex_lock(&data->lock);
++ if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) &&
++ data->valid)
++ goto out;
++
++ update_aem_energy(data);
++out:
++ mutex_unlock(&data->lock);
++}
++
++/* Update all AEM2 sensors */
++static void update_aem2_sensors(struct aem_data *data)
++{
++ int i;
++
++ mutex_lock(&data->lock);
++ if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) &&
++ data->valid)
++ goto out;
++
++ update_aem_energy(data);
++ aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 0, &data->temp[0], 1);
++ aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 1, &data->temp[1], 1);
++
++ for (i = POWER_CAP; i <= POWER_AUX; i++)
++ aem_read_sensor(data, AEM_POWER_CAP_ELEMENT, i,
++ &data->pcap[i], 2);
++out:
++ mutex_unlock(&data->lock);
++}
++
++/* Delete an AEM instance */
++static void aem_delete(struct aem_data *data)
++{
++ list_del(&data->list);
++ aem_remove_sensors(data);
++ hwmon_device_unregister(data->hwmon_dev);
++ ipmi_destroy_user(data->ipmi.user);
++ dev_set_drvdata(&data->pdev->dev, NULL);
++ platform_device_unregister(data->pdev);
++ aem_idr_put(data->id);
++ kfree(data);
++}
++
++/* Probe functions for AEM1 devices */
++
++/* Retrieve version and module handle for an AEM1 instance */
++static int aem_find_aem1_count(struct aem_ipmi_data *data)
++{
++ int res;
++ struct aem_find_firmware_req ff_req;
++ struct aem_find_firmware_resp ff_resp;
++
++ ff_req.id = system_x_id;
++ ff_req.index = 0;
++ ff_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID);
++
++ data->tx_message.cmd = AEM_FIND_FW_CMD;
++ data->tx_message.data = (char *)&ff_req;
++ data->tx_message.data_len = sizeof(ff_req);
++
++ data->rx_msg_data = &ff_resp;
++ data->rx_msg_len = sizeof(ff_resp);
++
++ aem_send_message(data);
++
++ res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
++ if (!res)
++ return -ETIMEDOUT;
++
++ if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) ||
++ memcmp(&ff_resp.id, &system_x_id, sizeof(system_x_id)))
++ return -ENOENT;
++
++ return ff_resp.num_instances;
++}
++
++/* Find and initialize one AEM1 instance */
++static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
++{
++ struct aem_data *data;
++ int i;
++ int res = -ENOMEM;
++
++ data = kzalloc(sizeof(*data), GFP_KERNEL);
++ if (!data)
++ return res;
++ mutex_init(&data->lock);
++
++ /* Copy instance data */
++ data->ver_major = 1;
++ data->ver_minor = 0;
++ data->module_handle = module_handle;
++ for (i = 0; i < AEM1_NUM_ENERGY_REGS; i++)
++ data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
++
++ /* Create sub-device for this fw instance */
++ if (aem_idr_get(&data->id))
++ goto id_err;
++
++ data->pdev = platform_device_alloc(DRVNAME, data->id);
++ if (!data->pdev)
++ goto dev_err;
++ data->pdev->dev.driver = &aem_driver;
++
++ res = platform_device_add(data->pdev);
++ if (res)
++ goto ipmi_err;
++
++ dev_set_drvdata(&data->pdev->dev, data);
++
++ /* Set up IPMI interface */
++ if (aem_init_ipmi_data(&data->ipmi, probe->interface,
++ probe->bmc_device))
++ goto ipmi_err;
++
++ /* Register with hwmon */
++ data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
++
++ if (IS_ERR(data->hwmon_dev)) {
++ dev_err(&data->pdev->dev, "Unable to register hwmon "
++ "device for IPMI interface %d\n",
++ probe->interface);
++ goto hwmon_reg_err;
++ }
++
++ data->update = update_aem1_sensors;
++
++ /* Find sensors */
++ if (aem1_find_sensors(data))
++ goto sensor_err;
++
++ /* Add to our list of AEM devices */
++ list_add_tail(&data->list, &driver_data.aem_devices);
++
++ dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n",
++ data->ver_major, data->ver_minor,
++ data->module_handle);
++ return 0;
++
++sensor_err:
++ hwmon_device_unregister(data->hwmon_dev);
++hwmon_reg_err:
++ ipmi_destroy_user(data->ipmi.user);
++ipmi_err:
++ dev_set_drvdata(&data->pdev->dev, NULL);
++ platform_device_unregister(data->pdev);
++dev_err:
++ aem_idr_put(data->id);
++id_err:
++ kfree(data);
++
++ return res;
++}
++
++/* Find and initialize all AEM1 instances */
++static int aem_init_aem1(struct aem_ipmi_data *probe)
++{
++ int num, i, err;
++
++ num = aem_find_aem1_count(probe);
++ for (i = 0; i < num; i++) {
++ err = aem_init_aem1_inst(probe, i);
++ if (err) {
++ dev_err(probe->bmc_device,
++ "Error %d initializing AEM1 0x%X\n",
++ err, i);
++ return err;
++ }
++ }
++
++ return 0;
++}
++
++/* Probe functions for AEM2 devices */
++
++/* Retrieve version and module handle for an AEM2 instance */
++static int aem_find_aem2(struct aem_ipmi_data *data,
++ struct aem_find_instance_resp *fi_resp,
++ int instance_num)
++{
++ int res;
++ struct aem_find_instance_req fi_req;
++
++ fi_req.id = system_x_id;
++ fi_req.instance_number = instance_num;
++ fi_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID);
++
++ data->tx_message.cmd = AEM_FW_INSTANCE_CMD;
++ data->tx_message.data = (char *)&fi_req;
++ data->tx_message.data_len = sizeof(fi_req);
++
++ data->rx_msg_data = fi_resp;
++ data->rx_msg_len = sizeof(*fi_resp);
++
++ aem_send_message(data);
++
++ res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT);
++ if (!res)
++ return -ETIMEDOUT;
++
++ if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||
++ memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id)))
++ return -ENOENT;
++
++ return 0;
++}
++
++/* Find and initialize one AEM2 instance */
++static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
++ struct aem_find_instance_resp *fi_resp)
++{
++ struct aem_data *data;
++ int i;
++ int res = -ENOMEM;
++
++ data = kzalloc(sizeof(*data), GFP_KERNEL);
++ if (!data)
++ return res;
++ mutex_init(&data->lock);
++
++ /* Copy instance data */
++ data->ver_major = fi_resp->major;
++ data->ver_minor = fi_resp->minor;
++ data->module_handle = fi_resp->module_handle;
++ for (i = 0; i < AEM2_NUM_ENERGY_REGS; i++)
++ data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
++
++ /* Create sub-device for this fw instance */
++ if (aem_idr_get(&data->id))
++ goto id_err;
++
++ data->pdev = platform_device_alloc(DRVNAME, data->id);
++ if (!data->pdev)
++ goto dev_err;
++ data->pdev->dev.driver = &aem_driver;
++
++ res = platform_device_add(data->pdev);
++ if (res)
++ goto ipmi_err;
++
++ dev_set_drvdata(&data->pdev->dev, data);
++
++ /* Set up IPMI interface */
++ if (aem_init_ipmi_data(&data->ipmi, probe->interface,
++ probe->bmc_device))
++ goto ipmi_err;
++
++ /* Register with hwmon */
++ data->hwmon_dev = hwmon_device_register(&data->pdev->dev);
++
++ if (IS_ERR(data->hwmon_dev)) {
++ dev_err(&data->pdev->dev, "Unable to register hwmon "
++ "device for IPMI interface %d\n",
++ probe->interface);
++ goto hwmon_reg_err;
++ }
++
++ data->update = update_aem2_sensors;
++
++ /* Find sensors */
++ if (aem2_find_sensors(data))
++ goto sensor_err;
++
++ /* Add to our list of AEM devices */
++ list_add_tail(&data->list, &driver_data.aem_devices);
++
++ dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n",
++ data->ver_major, data->ver_minor,
++ data->module_handle);
++ return 0;
++
++sensor_err:
++ hwmon_device_unregister(data->hwmon_dev);
++hwmon_reg_err:
++ ipmi_destroy_user(data->ipmi.user);
++ipmi_err:
++ dev_set_drvdata(&data->pdev->dev, NULL);
++ platform_device_unregister(data->pdev);
++dev_err:
++ aem_idr_put(data->id);
++id_err:
++ kfree(data);
++
++ return res;
++}
++
++/* Find and initialize all AEM2 instances */
++static int aem_init_aem2(struct aem_ipmi_data *probe)
++{
++ struct aem_find_instance_resp fi_resp;
++ int err;
++ int i = 0;
++
++ while (!aem_find_aem2(probe, &fi_resp, i)) {
++ if (fi_resp.major != 2) {
++ dev_err(probe->bmc_device, "Unknown AEM v%d; please "
++ "report this to the maintainer.\n",
++ fi_resp.major);
++ i++;
++ continue;
++ }
++ err = aem_init_aem2_inst(probe, &fi_resp);
++ if (err) {
++ dev_err(probe->bmc_device,
++ "Error %d initializing AEM2 0x%X\n",
++ err, fi_resp.module_handle);
++ return err;
++ }
++ i++;
++ }
++
++ return 0;
++}
++
++/* Probe a BMC for AEM firmware instances */
++static void aem_register_bmc(int iface, struct device *dev)
++{
++ struct aem_ipmi_data probe;
++
++ if (aem_init_ipmi_data(&probe, iface, dev))
++ return;
++
++ /* Ignore probe errors; they won't cause problems */
++ aem_init_aem1(&probe);
++ aem_init_aem2(&probe);
++
++ ipmi_destroy_user(probe.user);
++}
++
++/* Handle BMC deletion */
++static void aem_bmc_gone(int iface)
++{
++ struct aem_data *p1, *next1;
++
++ list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
++ if (p1->ipmi.interface == iface)
++ aem_delete(p1);
++}
++
++/* sysfs support functions */
++
++/* AEM device name */
++static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
++ char *buf)
++{
++ struct aem_data *data = dev_get_drvdata(dev);
++
++ return sprintf(buf, "%s%d\n", DRVNAME, data->ver_major);
++}
++static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
++
++/* AEM device version */
++static ssize_t show_version(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct aem_data *data = dev_get_drvdata(dev);
++
++ return sprintf(buf, "%d.%d\n", data->ver_major, data->ver_minor);
++}
++static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, 0);
++
++/* Display power use */
++static ssize_t aem_show_power(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *data = dev_get_drvdata(dev);
++ u64 before, after, delta, time;
++ signed long leftover;
++ struct timespec b, a;
++
++ mutex_lock(&data->lock);
++ update_aem_energy(data);
++ getnstimeofday(&b);
++ before = data->energy[attr->index];
++
++ leftover = schedule_timeout_interruptible(
++ msecs_to_jiffies(data->power_period[attr->index])
++ );
++ if (leftover) {
++ mutex_unlock(&data->lock);
++ return 0;
++ }
++
++ update_aem_energy(data);
++ getnstimeofday(&a);
++ after = data->energy[attr->index];
++ mutex_unlock(&data->lock);
++
++ time = timespec_to_ns(&a) - timespec_to_ns(&b);
++ delta = (after - before) * UJ_PER_MJ;
++
++ return sprintf(buf, "%llu\n",
++ (unsigned long long)div64_u64(delta * NSEC_PER_SEC, time));
++}
++
++/* Display energy use */
++static ssize_t aem_show_energy(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *a = dev_get_drvdata(dev);
++ a->update(a);
++
++ return sprintf(buf, "%llu\n",
++ (unsigned long long)a->energy[attr->index] * 1000);
++}
++
++/* Display power interval registers */
++static ssize_t aem_show_power_period(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *a = dev_get_drvdata(dev);
++ a->update(a);
++
++ return sprintf(buf, "%lu\n", a->power_period[attr->index]);
++}
++
++/* Set power interval registers */
++static ssize_t aem_set_power_period(struct device *dev,
++ struct device_attribute *devattr,
++ const char *buf, size_t count)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *a = dev_get_drvdata(dev);
++ unsigned long temp;
++ int res;
++
++ res = strict_strtoul(buf, 10, &temp);
++ if (res)
++ return res;
++
++ if (temp < AEM_MIN_POWER_INTERVAL)
++ return -EINVAL;
++
++ mutex_lock(&a->lock);
++ a->power_period[attr->index] = temp;
++ mutex_unlock(&a->lock);
++
++ return count;
++}
++
++/* Discover sensors on an AEM device */
++static int aem_register_sensors(struct aem_data *data,
++ struct aem_ro_sensor_template *ro,
++ struct aem_rw_sensor_template *rw)
++{
++ struct device *dev = &data->pdev->dev;
++ struct sensor_device_attribute *sensors = data->sensors;
++ int err;
++
++ /* Set up read-only sensors */
++ while (ro->label) {
++ sensors->dev_attr.attr.name = ro->label;
++ sensors->dev_attr.attr.mode = S_IRUGO;
++ sensors->dev_attr.show = ro->show;
++ sensors->index = ro->index;
++
++ err = device_create_file(dev, &sensors->dev_attr);
++ if (err) {
++ sensors->dev_attr.attr.name = NULL;
++ goto error;
++ }
++ sensors++;
++ ro++;
++ }
++
++ /* Set up read-write sensors */
++ while (rw->label) {
++ sensors->dev_attr.attr.name = rw->label;
++ sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR;
++ sensors->dev_attr.show = rw->show;
++ sensors->dev_attr.store = rw->set;
++ sensors->index = rw->index;
++
++ err = device_create_file(dev, &sensors->dev_attr);
++ if (err) {
++ sensors->dev_attr.attr.name = NULL;
++ goto error;
++ }
++ sensors++;
++ rw++;
++ }
++
++ err = device_create_file(dev, &sensor_dev_attr_name.dev_attr);
++ if (err)
++ goto error;
++ err = device_create_file(dev, &sensor_dev_attr_version.dev_attr);
++ return err;
++
++error:
++ aem_remove_sensors(data);
++ return err;
++}
++
++/* sysfs support functions for AEM2 sensors */
++
++/* Display temperature use */
++static ssize_t aem2_show_temp(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *a = dev_get_drvdata(dev);
++ a->update(a);
++
++ return sprintf(buf, "%u\n", a->temp[attr->index] * 1000);
++}
++
++/* Display power-capping registers */
++static ssize_t aem2_show_pcap_value(struct device *dev,
++ struct device_attribute *devattr,
++ char *buf)
++{
++ struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
++ struct aem_data *a = dev_get_drvdata(dev);
++ a->update(a);
++
++ return sprintf(buf, "%u\n", a->pcap[attr->index] * 100000);
++}
++
++/* Remove sensors attached to an AEM device */
++static void aem_remove_sensors(struct aem_data *data)
++{
++ int i;
++
++ for (i = 0; i < AEM_NUM_SENSORS; i++) {
++ if (!data->sensors[i].dev_attr.attr.name)
++ continue;
++ device_remove_file(&data->pdev->dev,
++ &data->sensors[i].dev_attr);
++ }
++
++ device_remove_file(&data->pdev->dev,
++ &sensor_dev_attr_name.dev_attr);
++ device_remove_file(&data->pdev->dev,
++ &sensor_dev_attr_version.dev_attr);
++}
++
++/* Sensor probe functions */
++
++/* Description of AEM1 sensors */
++static struct aem_ro_sensor_template aem1_ro_sensors[] = {
++{"energy1_input", aem_show_energy, 0},
++{"power1_average", aem_show_power, 0},
++{NULL, NULL, 0},
++};
++
++static struct aem_rw_sensor_template aem1_rw_sensors[] = {
++{"power1_average_interval", aem_show_power_period, aem_set_power_period, 0},
++{NULL, NULL, NULL, 0},
++};
++
++/* Description of AEM2 sensors */
++static struct aem_ro_sensor_template aem2_ro_sensors[] = {
++{"energy1_input", aem_show_energy, 0},
++{"energy2_input", aem_show_energy, 1},
++{"power1_average", aem_show_power, 0},
++{"power2_average", aem_show_power, 1},
++{"temp1_input", aem2_show_temp, 0},
++{"temp2_input", aem2_show_temp, 1},
++
++{"power4_average", aem2_show_pcap_value, POWER_CAP_MAX_HOTPLUG},
++{"power5_average", aem2_show_pcap_value, POWER_CAP_MAX},
++{"power6_average", aem2_show_pcap_value, POWER_CAP_MIN_WARNING},
++{"power7_average", aem2_show_pcap_value, POWER_CAP_MIN},
++
++{"power3_average", aem2_show_pcap_value, POWER_AUX},
++{"power_cap", aem2_show_pcap_value, POWER_CAP},
++{NULL, NULL, 0},
++};
++
++static struct aem_rw_sensor_template aem2_rw_sensors[] = {
++{"power1_average_interval", aem_show_power_period, aem_set_power_period, 0},
++{"power2_average_interval", aem_show_power_period, aem_set_power_period, 1},
++{NULL, NULL, NULL, 0},
++};
++
++/* Set up AEM1 sensor attrs */
++static int aem1_find_sensors(struct aem_data *data)
++{
++ return aem_register_sensors(data, aem1_ro_sensors, aem1_rw_sensors);
++}
++
++/* Set up AEM2 sensor attrs */
++static int aem2_find_sensors(struct aem_data *data)
++{
++ return aem_register_sensors(data, aem2_ro_sensors, aem2_rw_sensors);
++}
++
++/* Module init/exit routines */
++
++static int __init aem_init(void)
++{
++ int res;
++
++ res = driver_register(&aem_driver);
++ if (res) {
++ printk(KERN_ERR "Can't register aem driver\n");
++ return res;
++ }
++
++ res = ipmi_smi_watcher_register(&driver_data.bmc_events);
++ if (res)
++ goto ipmi_reg_err;
++ return 0;
++
++ipmi_reg_err:
++ driver_unregister(&aem_driver);
++ return res;
++
++}
++
++static void __exit aem_exit(void)
++{
++ struct aem_data *p1, *next1;
++
++ ipmi_smi_watcher_unregister(&driver_data.bmc_events);
++ driver_unregister(&aem_driver);
++ list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
++ aem_delete(p1);
++}
++
++MODULE_AUTHOR("Darrick J. Wong <djwong at us.ibm.com>");
++MODULE_DESCRIPTION("IBM Active Energy Manager power/temp sensor driver");
++MODULE_LICENSE("GPL");
++
++module_init(aem_init);
++module_exit(aem_exit);
+diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
+index 34b0d4f..655ec7e 100644
+--- a/drivers/ide/ide-probe.c
++++ b/drivers/ide/ide-probe.c
+@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif)
+
+ get_device(&hwif->gendev);
+
+- hwif->portdev = device_create(ide_port_class, &hwif->gendev,
+- MKDEV(0, 0), hwif->name);
++ hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev,
++ MKDEV(0, 0), hwif, hwif->name);
+ if (IS_ERR(hwif->portdev)) {
+ ret = PTR_ERR(hwif->portdev);
+ device_unregister(&hwif->gendev);
+ }
+- dev_set_drvdata(hwif->portdev, hwif);
+ out:
+ return ret;
+ }
+diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
+index 16b9d0a..a5ceff2 100644
+--- a/drivers/ieee1394/sbp2.c
++++ b/drivers/ieee1394/sbp2.c
+@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
+
+ static void sbp2_create_command_orb(struct sbp2_lu *lu,
+ struct sbp2_command_info *cmd,
+- unchar *scsi_cmd,
+- unsigned int scsi_use_sg,
+- unsigned int scsi_request_bufflen,
+- struct scatterlist *sg,
+- enum dma_data_direction dma_dir)
++ struct scsi_cmnd *SCpnt)
+ {
+ struct sbp2_fwhost_info *hi = lu->hi;
+ struct sbp2_command_orb *orb = &cmd->command_orb;
+ u32 orb_direction;
++ unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt);
++ enum dma_data_direction dma_dir = SCpnt->sc_data_direction;
+
+ /*
+ * Set-up our command ORB.
+@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu,
+ orb->data_descriptor_lo = 0x0;
+ orb->misc |= ORB_SET_DIRECTION(1);
+ } else
+- sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg,
++ sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt),
++ scsi_sglist(SCpnt),
+ orb_direction, dma_dir);
+
+ sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb));
+
+- memset(orb->cdb, 0, 12);
+- memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd));
++ memset(orb->cdb, 0, sizeof(orb->cdb));
++ memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len);
+ }
+
+ static void sbp2_link_orb_command(struct sbp2_lu *lu,
+@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu,
+ static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt,
+ void (*done)(struct scsi_cmnd *))
+ {
+- unchar *scsi_cmd = (unchar *)SCpnt->cmnd;
+ struct sbp2_command_info *cmd;
+
+ cmd = sbp2util_allocate_command_orb(lu, SCpnt, done);
+ if (!cmd)
return -EIO;
- sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt),
@@ -13210,6 +15407,21 @@
sbp2_link_orb_command(lu, cmd);
return 0;
+diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
+index fbe16d5..1adf2ef 100644
+--- a/drivers/infiniband/core/mad.c
++++ b/drivers/infiniband/core/mad.c
+@@ -747,7 +747,9 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
+ break;
+ case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED:
+ kmem_cache_free(ib_mad_cache, mad_priv);
+- break;
++ kfree(local);
++ ret = 1;
++ goto out;
+ case IB_MAD_RESULT_SUCCESS:
+ /* Treat like an incoming receive MAD */
+ port_priv = ib_get_mad_port(mad_agent_priv->agent.device,
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 3aa2db5..840ede9 100644
--- a/drivers/infiniband/core/user_mad.c
@@ -13270,6 +15482,171 @@
if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev))
goto err_class;
if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version))
+diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c
+index 79dbe5b..9926137 100644
+--- a/drivers/infiniband/hw/cxgb3/iwch_qp.c
++++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
+@@ -229,7 +229,7 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+ struct ib_send_wr **bad_wr)
+ {
+ int err = 0;
+- u8 t3_wr_flit_cnt;
++ u8 uninitialized_var(t3_wr_flit_cnt);
+ enum t3_wr_opcode t3_wr_opcode = 0;
+ enum t3_wr_flags t3_wr_flags;
+ struct iwch_qp *qhp;
+diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c
+index 3697449..0a8c1b8 100644
+--- a/drivers/infiniband/hw/ipath/ipath_sdma.c
++++ b/drivers/infiniband/hw/ipath/ipath_sdma.c
+@@ -345,7 +345,7 @@ resched:
+ * state change
+ */
+ if (jiffies > dd->ipath_sdma_abort_jiffies) {
+- ipath_dbg("looping with status 0x%016llx\n",
++ ipath_dbg("looping with status 0x%08lx\n",
+ dd->ipath_sdma_status);
+ dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ;
+ }
+@@ -615,7 +615,7 @@ void ipath_restart_sdma(struct ipath_devdata *dd)
+ }
+ spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags);
+ if (!needed) {
+- ipath_dbg("invalid attempt to restart SDMA, status 0x%016llx\n",
++ ipath_dbg("invalid attempt to restart SDMA, status 0x%08lx\n",
+ dd->ipath_sdma_status);
+ goto bail;
+ }
+diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c
+index 7fd18e8..0596ec1 100644
+--- a/drivers/infiniband/hw/ipath/ipath_uc.c
++++ b/drivers/infiniband/hw/ipath/ipath_uc.c
+@@ -407,12 +407,11 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
+ dev->n_pkt_drops++;
+ goto done;
+ }
+- /* XXX Need to free SGEs */
++ wc.opcode = IB_WC_RECV;
+ last_imm:
+ ipath_copy_sge(&qp->r_sge, data, tlen);
+ wc.wr_id = qp->r_wr_id;
+ wc.status = IB_WC_SUCCESS;
+- wc.opcode = IB_WC_RECV;
+ wc.qp = &qp->ibqp;
+ wc.src_qp = qp->remote_qpn;
+ wc.slid = qp->remote_ah_attr.dlid;
+@@ -514,6 +513,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
+ goto done;
+ }
+ wc.byte_len = qp->r_len;
++ wc.opcode = IB_WC_RECV_RDMA_WITH_IMM;
+ goto last_imm;
+
+ case OP(RDMA_WRITE_LAST):
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
+index 8e02ecf..a80df22 100644
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -333,6 +333,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
+ cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) +
+ send_wqe_overhead(type, qp->flags);
+
++ if (s > dev->dev->caps.max_sq_desc_sz)
++ return -EINVAL;
++
+ /*
+ * Hermon supports shrinking WQEs, such that a single work
+ * request can include multiple units of 1 << wqe_shift. This
+@@ -372,9 +375,6 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
+ qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s));
+
+ for (;;) {
+- if (1 << qp->sq.wqe_shift > dev->dev->caps.max_sq_desc_sz)
+- return -EINVAL;
+-
+ qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift);
+
+ /*
+@@ -395,7 +395,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
+ ++qp->sq.wqe_shift;
+ }
+
+- qp->sq.max_gs = ((qp->sq_max_wqes_per_wr << qp->sq.wqe_shift) -
++ qp->sq.max_gs = (min(dev->dev->caps.max_sq_desc_sz,
++ (qp->sq_max_wqes_per_wr << qp->sq.wqe_shift)) -
+ send_wqe_overhead(type, qp->flags)) /
+ sizeof (struct mlx4_wqe_data_seg);
+
+@@ -411,7 +412,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
+
+ cap->max_send_wr = qp->sq.max_post =
+ (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr;
+- cap->max_send_sge = qp->sq.max_gs;
++ cap->max_send_sge = min(qp->sq.max_gs,
++ min(dev->dev->caps.max_sq_sg,
++ dev->dev->caps.max_rq_sg));
+ /* We don't support inline sends for kernel QPs (yet) */
+ cap->max_inline_data = 0;
+
+@@ -1457,7 +1460,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+ unsigned ind;
+ int uninitialized_var(stamp);
+ int uninitialized_var(size);
+- unsigned seglen;
++ unsigned uninitialized_var(seglen);
+ int i;
+
+ spin_lock_irqsave(&qp->sq.lock, flags);
+diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
+index 9ebadd6..200cf13 100644
+--- a/drivers/infiniband/hw/mthca/mthca_main.c
++++ b/drivers/infiniband/hw/mthca/mthca_main.c
+@@ -45,6 +45,7 @@
+ #include "mthca_cmd.h"
+ #include "mthca_profile.h"
+ #include "mthca_memfree.h"
++#include "mthca_wqe.h"
+
+ MODULE_AUTHOR("Roland Dreier");
+ MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver");
+@@ -200,7 +201,18 @@ static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim)
+ mdev->limits.gid_table_len = dev_lim->max_gids;
+ mdev->limits.pkey_table_len = dev_lim->max_pkeys;
+ mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay;
+- mdev->limits.max_sg = dev_lim->max_sg;
++ /*
++ * Need to allow for worst case send WQE overhead and check
++ * whether max_desc_sz imposes a lower limit than max_sg; UD
++ * send has the biggest overhead.
++ */
++ mdev->limits.max_sg = min_t(int, dev_lim->max_sg,
++ (dev_lim->max_desc_sz -
++ sizeof (struct mthca_next_seg) -
++ (mthca_is_memfree(mdev) ?
++ sizeof (struct mthca_arbel_ud_seg) :
++ sizeof (struct mthca_tavor_ud_seg))) /
++ sizeof (struct mthca_data_seg));
+ mdev->limits.max_wqes = dev_lim->max_qp_sz;
+ mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp;
+ mdev->limits.reserved_qps = dev_lim->reserved_qps;
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+index d00a2c1..3f663fb 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+@@ -194,7 +194,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
+ /* Set the cached Q_Key before we attach if it's the broadcast group */
+ if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
+ sizeof (union ib_gid))) {
++ spin_lock_irq(&priv->lock);
++ if (!priv->broadcast) {
++ spin_unlock_irq(&priv->lock);
++ return -EAGAIN;
++ }
+ priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey);
++ spin_unlock_irq(&priv->lock);
+ priv->tx_wr.wr.ud.remote_qkey = priv->qkey;
+ }
+
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c
index a293e8b..8a77bfc 100644
--- a/drivers/input/keyboard/aaed2000_kbd.c
@@ -13420,43 +15797,530 @@
- sti();
msleep_interruptible(20); /* Timeout 20ms */
- if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) {
-@@ -276,7 +274,6 @@ ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len)
- dst = sp->Data; /* point to data in spool structure */
- buflen = sp->Len; /* maximum len of spooled data */
- wr_mirror = sp->WrPtr; /* only once read */
-- sti();
+ if (((tDpramBootSpooler *) card->dpram)->Len != DPRAM_SPOOLER_DATA_SIZE) {
+@@ -276,7 +274,6 @@ ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len)
+ dst = sp->Data; /* point to data in spool structure */
+ buflen = sp->Len; /* maximum len of spooled data */
+ wr_mirror = sp->WrPtr; /* only once read */
+- sti();
+
+ /* try until all bytes written or error */
+ i = 0x1000; /* timeout value */
+@@ -380,7 +377,6 @@ ergo_waitpofready(struct HYSDN_CARD *card)
+ #endif /* CONFIG_HYSDN_CAPI */
+ return (0); /* success */
+ } /* data has arrived */
+- sti();
+ msleep_interruptible(50); /* Timeout 50ms */
+ } /* wait until timeout */
+
+diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c
+index d3999a8..53f6ad1 100644
+--- a/drivers/isdn/hysdn/hycapi.c
++++ b/drivers/isdn/hysdn/hycapi.c
+@@ -462,11 +462,11 @@ static int hycapi_read_proc(char *page, char **start, off_t off,
+ default: s = "???"; break;
+ }
+ len += sprintf(page+len, "%-16s %s\n", "type", s);
+- if ((s = cinfo->version[VER_DRIVER]) != 0)
++ if ((s = cinfo->version[VER_DRIVER]) != NULL)
+ len += sprintf(page+len, "%-16s %s\n", "ver_driver", s);
+- if ((s = cinfo->version[VER_CARDTYPE]) != 0)
++ if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
+ len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s);
+- if ((s = cinfo->version[VER_SERIAL]) != 0)
++ if ((s = cinfo->version[VER_SERIAL]) != NULL)
+ len += sprintf(page+len, "%-16s %s\n", "ver_serial", s);
+
+ len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname);
+diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
+index b3c54be..559a408 100644
+--- a/drivers/leds/led-class.c
++++ b/drivers/leds/led-class.c
+@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
+ {
+ int rc;
+
+- led_cdev->dev = device_create(leds_class, parent, 0, "%s",
+- led_cdev->name);
++ led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev,
++ "%s", led_cdev->name);
+ if (IS_ERR(led_cdev->dev))
+ return PTR_ERR(led_cdev->dev);
+
+- dev_set_drvdata(led_cdev->dev, led_cdev);
+-
+ /* register the attributes */
+ rc = device_create_file(led_cdev->dev, &dev_attr_brightness);
+ if (rc)
+diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
+index c14dacd..b26927c 100644
+--- a/drivers/md/bitmap.c
++++ b/drivers/md/bitmap.c
+@@ -203,17 +203,6 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
+ * bitmap file handling - read and write the bitmap file and its superblock
+ */
+
+-/* copy the pathname of a file to a buffer */
+-char *file_path(struct file *file, char *buf, int count)
+-{
+- if (!buf)
+- return NULL;
+-
+- buf = d_path(&file->f_path, buf, count);
+-
+- return IS_ERR(buf) ? NULL : buf;
+-}
+-
+ /*
+ * basic page I/O operations
+ */
+@@ -721,11 +710,13 @@ static void bitmap_file_kick(struct bitmap *bitmap)
+ if (bitmap->file) {
+ path = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (path)
+- ptr = file_path(bitmap->file, path, PAGE_SIZE);
++ ptr = d_path(&bitmap->file->f_path, path,
++ PAGE_SIZE);
++
+
+ printk(KERN_ALERT
+ "%s: kicking failed bitmap file %s from array!\n",
+- bmname(bitmap), ptr ? ptr : "");
++ bmname(bitmap), IS_ERR(ptr) ? "" : ptr);
+
+ kfree(path);
+ } else
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index 83eb78b..51c19f8 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(pers_lock);
+
+ static void md_print_devices(void);
+
++static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
++
+ #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
+
+ /*
+@@ -3013,6 +3015,36 @@ degraded_show(mddev_t *mddev, char *page)
+ static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded);
+
+ static ssize_t
++sync_force_parallel_show(mddev_t *mddev, char *page)
++{
++ return sprintf(page, "%d\n", mddev->parallel_resync);
++}
++
++static ssize_t
++sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len)
++{
++ long n;
++
++ if (strict_strtol(buf, 10, &n))
++ return -EINVAL;
++
++ if (n != 0 && n != 1)
++ return -EINVAL;
++
++ mddev->parallel_resync = n;
++
++ if (mddev->sync_thread)
++ wake_up(&resync_wait);
++
++ return len;
++}
++
++/* force parallel resync, even with shared block devices */
++static struct md_sysfs_entry md_sync_force_parallel =
++__ATTR(sync_force_parallel, S_IRUGO|S_IWUSR,
++ sync_force_parallel_show, sync_force_parallel_store);
++
++static ssize_t
+ sync_speed_show(mddev_t *mddev, char *page)
+ {
+ unsigned long resync, dt, db;
+@@ -3187,6 +3219,7 @@ static struct attribute *md_redundancy_attrs[] = {
+ &md_sync_min.attr,
+ &md_sync_max.attr,
+ &md_sync_speed.attr,
++ &md_sync_force_parallel.attr,
+ &md_sync_completed.attr,
+ &md_max_sync.attr,
+ &md_suspend_lo.attr,
+@@ -3691,6 +3724,8 @@ static int do_md_stop(mddev_t * mddev, int mode)
+
+ module_put(mddev->pers->owner);
+ mddev->pers = NULL;
++ /* tell userspace to handle 'inactive' */
++ sysfs_notify(&mddev->kobj, NULL, "array_state");
+
+ set_capacity(disk, 0);
+ mddev->changed = 1;
+@@ -3987,8 +4022,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg)
+ if (!buf)
+ goto out;
+
+- ptr = file_path(mddev->bitmap->file, buf, sizeof(file->pathname));
+- if (!ptr)
++ ptr = d_path(&mddev->bitmap->file->f_path, buf, sizeof(file->pathname));
++ if (IS_ERR(ptr))
+ goto out;
+
+ strcpy(file->pathname, ptr);
+@@ -5399,7 +5434,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok)
+ atomic_sub(blocks, &mddev->recovery_active);
+ wake_up(&mddev->recovery_wait);
+ if (!ok) {
+- set_bit(MD_RECOVERY_ERR, &mddev->recovery);
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ md_wakeup_thread(mddev->thread);
+ // stop recovery, signal do_sync ....
+ }
+@@ -5435,8 +5470,11 @@ void md_write_start(mddev_t *mddev, struct bio *bi)
+ md_wakeup_thread(mddev->thread);
+ }
+ spin_unlock_irq(&mddev->write_lock);
++ sysfs_notify(&mddev->kobj, NULL, "array_state");
+ }
+- wait_event(mddev->sb_wait, mddev->flags==0);
++ wait_event(mddev->sb_wait,
++ !test_bit(MD_CHANGE_CLEAN, &mddev->flags) &&
++ !test_bit(MD_CHANGE_PENDING, &mddev->flags));
+ }
+
+ void md_write_end(mddev_t *mddev)
+@@ -5471,13 +5509,17 @@ void md_allow_write(mddev_t *mddev)
+ mddev->safemode = 1;
+ spin_unlock_irq(&mddev->write_lock);
+ md_update_sb(mddev, 0);
++
++ sysfs_notify(&mddev->kobj, NULL, "array_state");
++ /* wait for the dirty state to be recorded in the metadata */
++ wait_event(mddev->sb_wait,
++ !test_bit(MD_CHANGE_CLEAN, &mddev->flags) &&
++ !test_bit(MD_CHANGE_PENDING, &mddev->flags));
+ } else
+ spin_unlock_irq(&mddev->write_lock);
+ }
+ EXPORT_SYMBOL_GPL(md_allow_write);
+
+-static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
+-
+ #define SYNC_MARKS 10
+ #define SYNC_MARK_STEP (3*HZ)
+ void md_do_sync(mddev_t *mddev)
+@@ -5541,8 +5583,9 @@ void md_do_sync(mddev_t *mddev)
+ for_each_mddev(mddev2, tmp) {
+ if (mddev2 == mddev)
+ continue;
+- if (mddev2->curr_resync &&
+- match_mddev_units(mddev,mddev2)) {
++ if (!mddev->parallel_resync
++ && mddev2->curr_resync
++ && match_mddev_units(mddev, mddev2)) {
+ DEFINE_WAIT(wq);
+ if (mddev < mddev2 && mddev->curr_resync == 2) {
+ /* arbitrarily yield */
+@@ -5647,7 +5690,7 @@ void md_do_sync(mddev_t *mddev)
+ sectors = mddev->pers->sync_request(mddev, j, &skipped,
+ currspeed < speed_min(mddev));
+ if (sectors == 0) {
+- set_bit(MD_RECOVERY_ERR, &mddev->recovery);
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ goto out;
+ }
+
+@@ -5670,8 +5713,7 @@ void md_do_sync(mddev_t *mddev)
+
+ last_check = io_sectors;
+
+- if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) ||
+- test_bit(MD_RECOVERY_ERR, &mddev->recovery))
++ if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
+ break;
+
+ repeat:
+@@ -5725,8 +5767,7 @@ void md_do_sync(mddev_t *mddev)
+ /* tell personality that we are finished */
+ mddev->pers->sync_request(mddev, max_sectors, &skipped, 1);
+
+- if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) &&
+- !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&
++ if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) &&
+ mddev->curr_resync > 2) {
+ if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
+ if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
+@@ -5795,7 +5836,10 @@ static int remove_and_add_spares(mddev_t *mddev)
+ }
+
+ if (mddev->degraded) {
+- rdev_for_each(rdev, rtmp, mddev)
++ rdev_for_each(rdev, rtmp, mddev) {
++ if (rdev->raid_disk >= 0 &&
++ !test_bit(In_sync, &rdev->flags))
++ spares++;
+ if (rdev->raid_disk < 0
+ && !test_bit(Faulty, &rdev->flags)) {
+ rdev->recovery_offset = 0;
+@@ -5813,6 +5857,7 @@ static int remove_and_add_spares(mddev_t *mddev)
+ } else
+ break;
+ }
++ }
+ }
+ return spares;
+ }
+@@ -5826,7 +5871,7 @@ static int remove_and_add_spares(mddev_t *mddev)
+ * to do that as needed.
+ * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in
+ * "->recovery" and create a thread at ->sync_thread.
+- * When the thread finishes it sets MD_RECOVERY_DONE (and might set MD_RECOVERY_ERR)
++ * When the thread finishes it sets MD_RECOVERY_DONE
+ * and wakeups up this thread which will reap the thread and finish up.
+ * This thread also removes any faulty devices (with nr_pending == 0).
+ *
+@@ -5901,8 +5946,7 @@ void md_check_recovery(mddev_t *mddev)
+ /* resync has finished, collect result */
+ md_unregister_thread(mddev->sync_thread);
+ mddev->sync_thread = NULL;
+- if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) &&
+- !test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
++ if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
+ /* success...*/
+ /* activate any spares */
+ mddev->pers->spare_active(mddev);
+@@ -5926,7 +5970,6 @@ void md_check_recovery(mddev_t *mddev)
+ * might be left set
+ */
+ clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+- clear_bit(MD_RECOVERY_ERR, &mddev->recovery);
+ clear_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
+
+diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
+index 4f4d1f3..e968116 100644
+--- a/drivers/md/multipath.c
++++ b/drivers/md/multipath.c
+@@ -327,7 +327,8 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
+ if (rdev) {
+ if (test_bit(In_sync, &rdev->flags) ||
+ atomic_read(&rdev->nr_pending)) {
+- printk(KERN_ERR "hot-remove-disk, slot %d is identified" " but is still operational!\n", number);
++ printk(KERN_ERR "hot-remove-disk, slot %d is identified"
++ " but is still operational!\n", number);
+ err = -EBUSY;
+ goto abort;
+ }
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
+index ac409b7..c610b94 100644
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -773,7 +773,7 @@ static int make_request(struct request_queue *q, struct bio * bio)
+ r1bio_t *r1_bio;
+ struct bio *read_bio;
+ int i, targets = 0, disks;
+- struct bitmap *bitmap = mddev->bitmap;
++ struct bitmap *bitmap;
+ unsigned long flags;
+ struct bio_list bl;
+ struct page **behind_pages = NULL;
+@@ -802,6 +802,8 @@ static int make_request(struct request_queue *q, struct bio * bio)
+
+ wait_barrier(conf);
- /* try until all bytes written or error */
- i = 0x1000; /* timeout value */
-@@ -380,7 +377,6 @@ ergo_waitpofready(struct HYSDN_CARD *card)
- #endif /* CONFIG_HYSDN_CAPI */
- return (0); /* success */
- } /* data has arrived */
-- sti();
- msleep_interruptible(50); /* Timeout 50ms */
- } /* wait until timeout */
++ bitmap = mddev->bitmap;
++
+ disk_stat_inc(mddev->gendisk, ios[rw]);
+ disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio));
-diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
-index b3c54be..559a408 100644
---- a/drivers/leds/led-class.c
-+++ b/drivers/leds/led-class.c
-@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
- {
- int rc;
+@@ -1025,7 +1027,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
+ /*
+ * if recovery is running, make sure it aborts.
+ */
+- set_bit(MD_RECOVERY_ERR, &mddev->recovery);
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ } else
+ set_bit(Faulty, &rdev->flags);
+ set_bit(MD_CHANGE_DEVS, &mddev->flags);
+@@ -1146,6 +1148,14 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
+ err = -EBUSY;
+ goto abort;
+ }
++ /* Only remove non-faulty devices is recovery
++ * is not possible.
++ */
++ if (!test_bit(Faulty, &rdev->flags) &&
++ mddev->degraded < conf->raid_disks) {
++ err = -EBUSY;
++ goto abort;
++ }
+ p->rdev = NULL;
+ synchronize_rcu();
+ if (atomic_read(&rdev->nr_pending)) {
+@@ -1282,6 +1292,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
+ rdev_dec_pending(conf->mirrors[i].rdev, mddev);
+ } else {
+ /* fixup the bio for reuse */
++ int size;
+ sbio->bi_vcnt = vcnt;
+ sbio->bi_size = r1_bio->sectors << 9;
+ sbio->bi_idx = 0;
+@@ -1295,10 +1306,20 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
+ sbio->bi_sector = r1_bio->sector +
+ conf->mirrors[i].rdev->data_offset;
+ sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+- for (j = 0; j < vcnt ; j++)
+- memcpy(page_address(sbio->bi_io_vec[j].bv_page),
++ size = sbio->bi_size;
++ for (j = 0; j < vcnt ; j++) {
++ struct bio_vec *bi;
++ bi = &sbio->bi_io_vec[j];
++ bi->bv_offset = 0;
++ if (size > PAGE_SIZE)
++ bi->bv_len = PAGE_SIZE;
++ else
++ bi->bv_len = size;
++ size -= PAGE_SIZE;
++ memcpy(page_address(bi->bv_page),
+ page_address(pbio->bi_io_vec[j].bv_page),
+ PAGE_SIZE);
++ }
-- led_cdev->dev = device_create(leds_class, parent, 0, "%s",
-- led_cdev->name);
-+ led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev,
-+ "%s", led_cdev->name);
- if (IS_ERR(led_cdev->dev))
- return PTR_ERR(led_cdev->dev);
+ }
+ }
+diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
+index 8536ede..1de17da 100644
+--- a/drivers/md/raid10.c
++++ b/drivers/md/raid10.c
+@@ -1020,7 +1020,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
+ /*
+ * if recovery is running, make sure it aborts.
+ */
+- set_bit(MD_RECOVERY_ERR, &mddev->recovery);
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ }
+ set_bit(Faulty, &rdev->flags);
+ set_bit(MD_CHANGE_DEVS, &mddev->flags);
+@@ -1171,6 +1171,14 @@ static int raid10_remove_disk(mddev_t *mddev, int number)
+ err = -EBUSY;
+ goto abort;
+ }
++ /* Only remove faulty devices in recovery
++ * is not possible.
++ */
++ if (!test_bit(Faulty, &rdev->flags) &&
++ enough(conf)) {
++ err = -EBUSY;
++ goto abort;
++ }
+ p->rdev = NULL;
+ synchronize_rcu();
+ if (atomic_read(&rdev->nr_pending)) {
+@@ -1237,6 +1245,7 @@ static void end_sync_write(struct bio *bio, int error)
+
+ if (!uptodate)
+ md_error(mddev, conf->mirrors[d].rdev);
++
+ update_head_pos(i, r10_bio);
+
+ while (atomic_dec_and_test(&r10_bio->remaining)) {
+@@ -1844,7 +1853,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
+ if (rb2)
+ atomic_dec(&rb2->remaining);
+ r10_bio = rb2;
+- if (!test_and_set_bit(MD_RECOVERY_ERR, &mddev->recovery))
++ if (!test_and_set_bit(MD_RECOVERY_INTR,
++ &mddev->recovery))
+ printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n",
+ mdname(mddev));
+ break;
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
+index 93fde48..425958a 100644
+--- a/drivers/md/raid5.c
++++ b/drivers/md/raid5.c
+@@ -94,6 +94,8 @@
+ #define __inline__
+ #endif
-- dev_set_drvdata(led_cdev->dev, led_cdev);
--
- /* register the attributes */
- rc = device_create_file(led_cdev->dev, &dev_attr_brightness);
- if (rc)
++#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
++
+ #if !RAID6_USE_EMPTY_ZERO_PAGE
+ /* In .bss so it's zeroed */
+ const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
+@@ -1143,10 +1145,12 @@ static void raid5_end_read_request(struct bio * bi, int error)
+ set_bit(R5_UPTODATE, &sh->dev[i].flags);
+ if (test_bit(R5_ReadError, &sh->dev[i].flags)) {
+ rdev = conf->disks[i].rdev;
+- printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n",
+- mdname(conf->mddev), STRIPE_SECTORS,
+- (unsigned long long)(sh->sector + rdev->data_offset),
+- bdevname(rdev->bdev, b));
++ printk_rl(KERN_INFO "raid5:%s: read error corrected"
++ " (%lu sectors at %llu on %s)\n",
++ mdname(conf->mddev), STRIPE_SECTORS,
++ (unsigned long long)(sh->sector
++ + rdev->data_offset),
++ bdevname(rdev->bdev, b));
+ clear_bit(R5_ReadError, &sh->dev[i].flags);
+ clear_bit(R5_ReWrite, &sh->dev[i].flags);
+ }
+@@ -1160,16 +1164,22 @@ static void raid5_end_read_request(struct bio * bi, int error)
+ clear_bit(R5_UPTODATE, &sh->dev[i].flags);
+ atomic_inc(&rdev->read_errors);
+ if (conf->mddev->degraded)
+- printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n",
+- mdname(conf->mddev),
+- (unsigned long long)(sh->sector + rdev->data_offset),
+- bdn);
++ printk_rl(KERN_WARNING
++ "raid5:%s: read error not correctable "
++ "(sector %llu on %s).\n",
++ mdname(conf->mddev),
++ (unsigned long long)(sh->sector
++ + rdev->data_offset),
++ bdn);
+ else if (test_bit(R5_ReWrite, &sh->dev[i].flags))
+ /* Oh, no!!! */
+- printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n",
+- mdname(conf->mddev),
+- (unsigned long long)(sh->sector + rdev->data_offset),
+- bdn);
++ printk_rl(KERN_WARNING
++ "raid5:%s: read error NOT corrected!! "
++ "(sector %llu on %s).\n",
++ mdname(conf->mddev),
++ (unsigned long long)(sh->sector
++ + rdev->data_offset),
++ bdn);
+ else if (atomic_read(&rdev->read_errors)
+ > conf->max_nr_stripes)
+ printk(KERN_WARNING
+@@ -1258,7 +1268,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev)
+ /*
+ * if recovery was running, make sure it aborts.
+ */
+- set_bit(MD_RECOVERY_ERR, &mddev->recovery);
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ }
+ set_bit(Faulty, &rdev->flags);
+ printk (KERN_ALERT
+@@ -4564,6 +4574,14 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
+ err = -EBUSY;
+ goto abort;
+ }
++ /* Only remove non-faulty devices if recovery
++ * isn't possible.
++ */
++ if (!test_bit(Faulty, &rdev->flags) &&
++ mddev->degraded <= conf->max_degraded) {
++ err = -EBUSY;
++ goto abort;
++ }
+ p->rdev = NULL;
+ synchronize_rcu();
+ if (atomic_read(&rdev->nr_pending)) {
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 89d8d37..3b26fbd 100644
--- a/drivers/media/video/Kconfig
@@ -15219,6 +18083,72 @@
for (idx = 0; idx < BPP_NO; idx++) {
if (instances[idx].present)
+diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
+index b31faec..867f6fd 100644
+--- a/drivers/scsi/3w-9xxx.c
++++ b/drivers/scsi/3w-9xxx.c
+@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
+ error = 0;
+ /* Check for command packet errors */
+ if (full_command_packet->command.newcommand.status != 0) {
+- if (tw_dev->srb[request_id] != 0) {
++ if (tw_dev->srb[request_id] != NULL) {
+ error = twa_fill_sense(tw_dev, request_id, 1, 1);
+ } else {
+ /* Skip ioctl error prints */
+@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
+
+ /* Check for correct state */
+ if (tw_dev->state[request_id] != TW_S_POSTED) {
+- if (tw_dev->srb[request_id] != 0) {
++ if (tw_dev->srb[request_id] != NULL) {
+ TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted");
+ TW_CLEAR_ALL_INTERRUPTS(tw_dev);
+ goto twa_interrupt_bail;
+@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
+ }
+
+ /* Check for internal command completion */
+- if (tw_dev->srb[request_id] == 0) {
++ if (tw_dev->srb[request_id] == NULL) {
+ if (request_id != tw_dev->chrdev_request_id) {
+ if (twa_aen_complete(tw_dev, request_id))
+ TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt");
+diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
+index 1dca177..0899cb6 100644
+--- a/drivers/scsi/aha152x.c
++++ b/drivers/scsi/aha152x.c
+@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup)
+ if (i == ARRAY_SIZE(ports))
+ return 0;
+
+- if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
++ if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
+ printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
+ return 0;
+ }
+@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void)
+ if ((setup_count == 1) && (setup[0].io_port == ports[i]))
+ continue;
+
+- if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) {
++ if (!request_region(ports[i], IO_RANGE, "aha152x")) {
+ printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
+ continue;
+ }
+diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
+index db6de5e..7d31154 100644
+--- a/drivers/scsi/atp870u.c
++++ b/drivers/scsi/atp870u.c
+@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
+ dev->quhd[c] = 0;
+ }
+ workreq = dev->quereq[c][dev->quhd[c]];
+- if (dev->id[c][scmd_id(workreq)].curr_req == 0) {
++ if (dev->id[c][scmd_id(workreq)].curr_req == NULL) {
+ dev->id[c][scmd_id(workreq)].curr_req = workreq;
+ dev->last_cmd[c] = scmd_id(workreq);
+ goto cmd_subp;
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 75c84d7..c4b938b 100644
--- a/drivers/scsi/ch.c
@@ -15244,6 +18174,53 @@
sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name);
return 0;
+diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
+index aaa48e0..da876d3 100644
+--- a/drivers/scsi/hptiop.c
++++ b/drivers/scsi/hptiop.c
+@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
+ if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) {
+ printk(KERN_ERR "scsi%d: pci resource invalid\n",
+ hba->host->host_no);
+- return 0;
++ return NULL;
+ }
+
+ mem_base_phy = pci_resource_start(pcidev, index);
+@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
+ if (!mem_base_virt) {
+ printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n",
+ hba->host->host_no);
+- return 0;
++ return NULL;
+ }
+ return mem_base_virt;
+ }
+@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba)
+ static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba)
+ {
+ hba->u.mv.regs = hptiop_map_pci_bar(hba, 0);
+- if (hba->u.mv.regs == 0)
++ if (hba->u.mv.regs == NULL)
+ return -1;
+
+ hba->u.mv.mu = hptiop_map_pci_bar(hba, 2);
+- if (hba->u.mv.mu == 0) {
++ if (hba->u.mv.mu == NULL) {
+ iounmap(hba->u.mv.regs);
+ return -1;
+ }
+@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev)
+
+ static struct hptiop_adapter_ops hptiop_itl_ops = {
+ .iop_wait_ready = iop_wait_ready_itl,
+- .internal_memalloc = 0,
+- .internal_memfree = 0,
++ .internal_memalloc = NULL,
++ .internal_memfree = NULL,
+ .map_pci_bar = hptiop_map_pci_bar_itl,
+ .unmap_pci_bar = hptiop_unmap_pci_bar_itl,
+ .enable_intr = hptiop_enable_intr_itl,
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index cd37bd6..887682a 100644
--- a/drivers/scsi/mac_esp.c
@@ -15276,6 +18253,19 @@
err = device_create_file(osst_member, &dev_attr_ADR_rev);
if (err)
goto err_out;
+diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
+index 51e2f29..3754ab8 100644
+--- a/drivers/scsi/qla1280.c
++++ b/drivers/scsi/qla1280.c
+@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
+
+ /* Check for room in outstanding command list. */
+ for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS &&
+- ha->outstanding_cmds[cnt] != 0; cnt++);
++ ha->outstanding_cmds[cnt] != NULL; cnt++);
+
+ if (cnt >= MAX_OUTSTANDING_COMMANDS) {
+ status = 1;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index c9d7f72..ea0edd1 100644
--- a/drivers/scsi/sg.c
@@ -15376,6 +18366,24 @@
+#define SERIAL_EXTRA_IRQ_FLAGS 0
+#endif
+
+diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
+index 53fa19c..788c355 100644
+--- a/drivers/serial/8250_pci.c
++++ b/drivers/serial/8250_pci.c
+@@ -2602,7 +2602,12 @@ static struct pci_device_id serial_pci_tbl[] = {
+ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
+ pbn_b2_2_115200 },
+-
++ /*
++ * IntaShield IS-400
++ */
++ { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
++ PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
++ pbn_b2_4_115200 },
+ /*
+ * Perle PCI-RAS cards
+ */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 62e6eb1..9bc4276 100644
--- a/drivers/serial/Kconfig
@@ -15389,6 +18397,29 @@
select SERIAL_CORE
help
Enble support SPORT emulate UART on Blackfin series.
+diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
+index eab0327..53b03c6 100644
+--- a/drivers/serial/serial_core.c
++++ b/drivers/serial/serial_core.c
+@@ -2054,6 +2054,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
+ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
+ {
+ struct uart_state *state = drv->state + port->line;
++ struct device *tty_dev;
++ struct uart_match match = {port, drv};
+
+ mutex_lock(&state->mutex);
+
+@@ -2063,7 +2065,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
+ return 0;
+ }
+
+- if (!port->suspended) {
++ tty_dev = device_find_child(port->dev, &match, serial_match_port);
++ if (!port->suspended && device_may_wakeup(tty_dev)) {
+ disable_irq_wake(port->irq);
+ mutex_unlock(&state->mutex);
+ return 0;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 8fdafc2..ce6ee92 100644
--- a/drivers/serial/sh-sci.c
@@ -15425,6 +18456,213 @@
for (i = 0; i < n; i++) {
if (*s == '\n')
sunhv_console_putchar(port, '\r');
+diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
+index b3518ca..41620c0 100644
+--- a/drivers/spi/spidev.c
++++ b/drivers/spi/spidev.c
+@@ -68,6 +68,7 @@ static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG];
+
+ struct spidev_data {
+ struct device dev;
++ spinlock_t spi_lock;
+ struct spi_device *spi;
+ struct list_head device_entry;
+
+@@ -85,12 +86,75 @@ MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");
+
+ /*-------------------------------------------------------------------------*/
+
++/*
++ * We can't use the standard synchronous wrappers for file I/O; we
++ * need to protect against async removal of the underlying spi_device.
++ */
++static void spidev_complete(void *arg)
++{
++ complete(arg);
++}
++
++static ssize_t
++spidev_sync(struct spidev_data *spidev, struct spi_message *message)
++{
++ DECLARE_COMPLETION_ONSTACK(done);
++ int status;
++
++ message->complete = spidev_complete;
++ message->context = &done;
++
++ spin_lock_irq(&spidev->spi_lock);
++ if (spidev->spi == NULL)
++ status = -ESHUTDOWN;
++ else
++ status = spi_async(spidev->spi, message);
++ spin_unlock_irq(&spidev->spi_lock);
++
++ if (status == 0) {
++ wait_for_completion(&done);
++ status = message->status;
++ if (status == 0)
++ status = message->actual_length;
++ }
++ return status;
++}
++
++static inline ssize_t
++spidev_sync_write(struct spidev_data *spidev, size_t len)
++{
++ struct spi_transfer t = {
++ .tx_buf = spidev->buffer,
++ .len = len,
++ };
++ struct spi_message m;
++
++ spi_message_init(&m);
++ spi_message_add_tail(&t, &m);
++ return spidev_sync(spidev, &m);
++}
++
++static inline ssize_t
++spidev_sync_read(struct spidev_data *spidev, size_t len)
++{
++ struct spi_transfer t = {
++ .rx_buf = spidev->buffer,
++ .len = len,
++ };
++ struct spi_message m;
++
++ spi_message_init(&m);
++ spi_message_add_tail(&t, &m);
++ return spidev_sync(spidev, &m);
++}
++
++/*-------------------------------------------------------------------------*/
++
+ /* Read-only message with current device setup */
+ static ssize_t
+ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
+ {
+ struct spidev_data *spidev;
+- struct spi_device *spi;
+ ssize_t status = 0;
+
+ /* chipselect only toggles at start or end of operation */
+@@ -98,10 +162,9 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
+ return -EMSGSIZE;
+
+ spidev = filp->private_data;
+- spi = spidev->spi;
+
+ mutex_lock(&spidev->buf_lock);
+- status = spi_read(spi, spidev->buffer, count);
++ status = spidev_sync_read(spidev, count);
+ if (status == 0) {
+ unsigned long missing;
+
+@@ -122,7 +185,6 @@ spidev_write(struct file *filp, const char __user *buf,
+ size_t count, loff_t *f_pos)
+ {
+ struct spidev_data *spidev;
+- struct spi_device *spi;
+ ssize_t status = 0;
+ unsigned long missing;
+
+@@ -131,12 +193,11 @@ spidev_write(struct file *filp, const char __user *buf,
+ return -EMSGSIZE;
+
+ spidev = filp->private_data;
+- spi = spidev->spi;
+
+ mutex_lock(&spidev->buf_lock);
+ missing = copy_from_user(spidev->buffer, buf, count);
+ if (missing == 0) {
+- status = spi_write(spi, spidev->buffer, count);
++ status = spidev_sync_write(spidev, count);
+ if (status == 0)
+ status = count;
+ } else
+@@ -153,7 +214,6 @@ static int spidev_message(struct spidev_data *spidev,
+ struct spi_transfer *k_xfers;
+ struct spi_transfer *k_tmp;
+ struct spi_ioc_transfer *u_tmp;
+- struct spi_device *spi = spidev->spi;
+ unsigned n, total;
+ u8 *buf;
+ int status = -EFAULT;
+@@ -215,7 +275,7 @@ static int spidev_message(struct spidev_data *spidev,
+ spi_message_add_tail(k_tmp, &msg);
+ }
+
+- status = spi_sync(spi, &msg);
++ status = spidev_sync(spidev, &msg);
+ if (status < 0)
+ goto done;
+
+@@ -269,8 +329,16 @@ spidev_ioctl(struct inode *inode, struct file *filp,
+ if (err)
+ return -EFAULT;
+
++ /* guard against device removal before, or while,
++ * we issue this ioctl.
++ */
+ spidev = filp->private_data;
+- spi = spidev->spi;
++ spin_lock_irq(&spidev->spi_lock);
++ spi = spi_dev_get(spidev->spi);
++ spin_unlock_irq(&spidev->spi_lock);
++
++ if (spi == NULL)
++ return -ESHUTDOWN;
+
+ switch (cmd) {
+ /* read requests */
+@@ -356,8 +424,10 @@ spidev_ioctl(struct inode *inode, struct file *filp,
+ default:
+ /* segmented and/or full-duplex I/O request */
+ if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0))
+- || _IOC_DIR(cmd) != _IOC_WRITE)
+- return -ENOTTY;
++ || _IOC_DIR(cmd) != _IOC_WRITE) {
++ retval = -ENOTTY;
++ break;
++ }
+
+ tmp = _IOC_SIZE(cmd);
+ if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) {
+@@ -385,6 +455,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
+ kfree(ioc);
+ break;
+ }
++ spi_dev_put(spi);
+ return retval;
+ }
+
+@@ -488,6 +559,7 @@ static int spidev_probe(struct spi_device *spi)
+
+ /* Initialize the driver data */
+ spidev->spi = spi;
++ spin_lock_init(&spidev->spi_lock);
+ mutex_init(&spidev->buf_lock);
+
+ INIT_LIST_HEAD(&spidev->device_entry);
+@@ -526,13 +598,17 @@ static int spidev_remove(struct spi_device *spi)
+ {
+ struct spidev_data *spidev = dev_get_drvdata(&spi->dev);
+
+- mutex_lock(&device_list_lock);
++ /* make sure ops on existing fds can abort cleanly */
++ spin_lock_irq(&spidev->spi_lock);
++ spidev->spi = NULL;
++ spin_unlock_irq(&spidev->spi_lock);
+
++ /* prevent new opens */
++ mutex_lock(&device_list_lock);
+ list_del(&spidev->device_entry);
+ dev_set_drvdata(&spi->dev, NULL);
+ clear_bit(MINOR(spidev->dev.devt), minors);
+ device_unregister(&spidev->dev);
+-
+ mutex_unlock(&device_list_lock);
+
+ return 0;
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 55cc7b8..0a12e90 100644
--- a/drivers/uio/uio.c
@@ -16434,41 +19672,376 @@
+++ b/drivers/usb/serial/pl2303.h
@@ -36,7 +36,6 @@
- #define RATOC_VENDOR_ID 0x0584
- #define RATOC_PRODUCT_ID 0xb000
--#define RATOC_PRODUCT_ID_USB60F 0xb020
+ #define RATOC_VENDOR_ID 0x0584
+ #define RATOC_PRODUCT_ID 0xb000
+-#define RATOC_PRODUCT_ID_USB60F 0xb020
+
+ #define TRIPP_VENDOR_ID 0x2478
+ #define TRIPP_PRODUCT_ID 0x2008
+diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
+index e4bcf53..bd4ac0b 100644
+--- a/drivers/video/aty/atyfb_base.c
++++ b/drivers/video/aty/atyfb_base.c
+@@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i
+
+ info->fix.mmio_start = raddr;
+ par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
+- if (par->ati_regbase == 0)
++ if (par->ati_regbase == NULL)
+ return -ENOMEM;
+
+ info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00;
+diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
+index 72cd0d2..400e926 100644
+--- a/drivers/video/aty/radeon_base.c
++++ b/drivers/video/aty/radeon_base.c
+@@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
+ do {
+ rinfo->fb_base = ioremap (rinfo->fb_base_phys,
+ rinfo->mapped_vram);
+- } while ( rinfo->fb_base == 0 &&
+- ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) );
++ } while (rinfo->fb_base == NULL &&
++ ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM));
+
+ if (rinfo->fb_base == NULL) {
+ printk (KERN_ERR "radeonfb (%s): cannot map FB\n",
+diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
+index 3547717..6ef800b 100644
+--- a/drivers/video/display/display-sysfs.c
++++ b/drivers/video/display/display-sysfs.c
+@@ -26,6 +26,7 @@
+ #include <linux/ctype.h>
+ #include <linux/idr.h>
+ #include <linux/err.h>
++#include <linux/kdev_t.h>
+
+ static ssize_t display_show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver,
+ mutex_unlock(&allocated_dsp_lock);
+
+ if (!ret) {
+- new_dev->dev = device_create(display_class, parent, 0,
+- "display%d", new_dev->idx);
++ new_dev->dev = device_create_drvdata(display_class,
++ parent,
++ MKDEV(0,0),
++ new_dev,
++ "display%d",
++ new_dev->idx);
+ if (!IS_ERR(new_dev->dev)) {
+- dev_set_drvdata(new_dev->dev, new_dev);
+ new_dev->parent = parent;
+ new_dev->driver = driver;
+ mutex_init(&new_dev->lock);
+diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
+index f3107ad..9588323 100644
+--- a/drivers/video/matrox/matroxfb_base.h
++++ b/drivers/video/matrox/matroxfb_base.h
+@@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags,
+ virt->vaddr = ioremap_nocache(phys, size);
+ else
+ virt->vaddr = ioremap(phys, size);
+- return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */
++ return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */
+ }
+
+ static inline void mga_iounmap(vaddr_t va) {
+diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
+index 3ee314b..274bc93 100644
+--- a/drivers/video/pxafb.c
++++ b/drivers/video/pxafb.c
+@@ -1351,7 +1351,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
+ struct pxafb_info *fbi;
+ void *addr;
+ struct pxafb_mach_info *inf = dev->platform_data;
+- struct pxafb_mode_info *mode = inf->modes;
+
+ /* Alloc the pxafb_info and pseudo_palette in one step */
+ fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL);
+diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
+index 13b38cb..f059896 100644
+--- a/drivers/video/s3c2410fb.c
++++ b/drivers/video/s3c2410fb.c
+@@ -1,75 +1,15 @@
+-/*
+- * linux/drivers/video/s3c2410fb.c
+- * Copyright (c) Arnaud Patard, Ben Dooks
++/* linux/drivers/video/s3c2410fb.c
++ * Copyright (c) 2004,2005 Arnaud Patard
++ * Copyright (c) 2004-2008 Ben Dooks
++ *
++ * S3C2410 LCD Framebuffer Driver
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ *
+- * S3C2410 LCD Controller Frame Buffer Driver
+- * based on skeletonfb.c, sa1100fb.c and others
+- *
+- * ChangeLog
+- * 2005-04-07: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - u32 state -> pm_message_t state
+- * - S3C2410_{VA,SZ}_LCD -> S3C24XX
+- *
+- * 2005-03-15: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Removed the ioctl
+- * - use readl/writel instead of __raw_writel/__raw_readl
+- *
+- * 2004-12-04: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Added the possibility to set on or off the
+- * debugging messages
+- * - Replaced 0 and 1 by on or off when reading the
+- * /sys files
+- *
+- * 2005-03-23: Ben Dooks <ben-linux at fluff.org>
+- * - added non 16bpp modes
+- * - updated platform information for range of x/y/bpp
+- * - add code to ensure palette is written correctly
+- * - add pixel clock divisor control
+- *
+- * 2004-11-11: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Removed the use of currcon as it no more exists
+- * - Added LCD power sysfs interface
+- *
+- * 2004-11-03: Ben Dooks <ben-linux at fluff.org>
+- * - minor cleanups
+- * - add suspend/resume support
+- * - s3c2410fb_setcolreg() not valid in >8bpp modes
+- * - removed last CONFIG_FB_S3C2410_FIXED
+- * - ensure lcd controller stopped before cleanup
+- * - added sysfs interface for backlight power
+- * - added mask for gpio configuration
+- * - ensured IRQs disabled during GPIO configuration
+- * - disable TPAL before enabling video
+- *
+- * 2004-09-20: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Suppress command line options
+- *
+- * 2004-09-15: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - code cleanup
+- *
+- * 2004-09-07: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Renamed from h1940fb.c to s3c2410fb.c
+- * - Add support for different devices
+- * - Backlight support
+- *
+- * 2004-09-05: Herbert Pötzl <herbert at 13thfloor.at>
+- * - added clock (de-)allocation code
+- * - added fixem fbmem option
+- *
+- * 2004-07-27: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - code cleanup
+- * - added a forgotten return in h1940fb_init
+- *
+- * 2004-07-19: Herbert Pötzl <herbert at 13thfloor.at>
+- * - code cleanup and extended debugging
+- *
+- * 2004-07-15: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - First version
+- */
++ * Driver based on skeletonfb.c, sa1100fb.c and others.
++*/
+
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno,
+ return 0;
+ }
+
++/* s3c2410fb_lcd_enable
++ *
++ * shutdown the lcd controller
++ */
++static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable)
++{
++ unsigned long flags;
++
++ local_irq_save(flags);
++
++ if (enable)
++ fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID;
++ else
++ fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
++
++ writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
++
++ local_irq_restore(flags);
++}
++
++
+ /*
+ * s3c2410fb_blank
+ * @blank_mode: the blank mode we want.
+@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno,
+ * blanking succeeded, != 0 if un-/blanking failed due to e.g. a
+ * video mode which doesn't support it. Implements VESA suspend
+ * and powerdown modes on hardware that supports disabling hsync/vsync:
+- * blank_mode == 2: suspend vsync
+- * blank_mode == 3: suspend hsync
+- * blank_mode == 4: powerdown
+ *
+ * Returns negative errno on error, or zero on success.
+ *
+@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info)
+
+ tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL;
+
++ if (blank_mode == FB_BLANK_POWERDOWN) {
++ s3c2410fb_lcd_enable(fbi, 0);
++ } else {
++ s3c2410fb_lcd_enable(fbi, 1);
++ }
++
+ if (blank_mode == FB_BLANK_UNBLANK)
+ writel(0x0, tpal_reg);
+ else {
+@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev,
+ }
+
+ /* create device files */
+- device_create_file(&pdev->dev, &dev_attr_debug);
++ ret = device_create_file(&pdev->dev, &dev_attr_debug);
++ if (ret) {
++ printk(KERN_ERR "failed to add debug attribute\n");
++ }
+
+ printk(KERN_INFO "fb%d: %s frame buffer device\n",
+ fbinfo->node, fbinfo->fix.id);
+@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev)
+ return s3c24xxfb_probe(pdev, DRV_S3C2412);
+ }
+
+-/* s3c2410fb_stop_lcd
+- *
+- * shutdown the lcd controller
+- */
+-static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
+-{
+- unsigned long flags;
+-
+- local_irq_save(flags);
+-
+- fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
+- writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
+-
+- local_irq_restore(flags);
+-}
+
+ /*
+ * Cleanup
+@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev)
- #define TRIPP_VENDOR_ID 0x2478
- #define TRIPP_PRODUCT_ID 0x2008
-diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
-index 3547717..6ef800b 100644
---- a/drivers/video/display/display-sysfs.c
-+++ b/drivers/video/display/display-sysfs.c
-@@ -26,6 +26,7 @@
- #include <linux/ctype.h>
- #include <linux/idr.h>
- #include <linux/err.h>
-+#include <linux/kdev_t.h>
+ unregister_framebuffer(fbinfo);
- static ssize_t display_show_name(struct device *dev,
- struct device_attribute *attr, char *buf)
-@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver,
- mutex_unlock(&allocated_dsp_lock);
+- s3c2410fb_stop_lcd(info);
++ s3c2410fb_lcd_enable(info, 0);
+ msleep(1);
+
+ s3c2410fb_unmap_video_memory(fbinfo);
+@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
+ struct fb_info *fbinfo = platform_get_drvdata(dev);
+ struct s3c2410fb_info *info = fbinfo->par;
+
+- s3c2410fb_stop_lcd(info);
++ s3c2410fb_lcd_enable(info, 0);
+
+ /* sleep before disabling the clock, we need to ensure
+ * the LCD DMA engine is not going to get back on the bus
+@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard at rtp-net.org>, "
+ "Ben Dooks <ben-linux at fluff.org>");
+ MODULE_DESCRIPTION("Framebuffer driver for the s3c2410");
+ MODULE_LICENSE("GPL");
++MODULE_ALIAS("platform:s3c2410-lcd");
++MODULE_ALIAS("platform:s3c2412-lcd");
+diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h
+index dbb73b9..9a6ba3e 100644
+--- a/drivers/video/s3c2410fb.h
++++ b/drivers/video/s3c2410fb.h
+@@ -1,26 +1,14 @@
+ /*
+ * linux/drivers/video/s3c2410fb.h
+- * Copyright (c) Arnaud Patard
++ * Copyright (c) 2004 Arnaud Patard
++ *
++ * S3C2410 LCD Framebuffer Driver
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ *
+- * S3C2410 LCD Controller Frame Buffer Driver
+- * based on skeletonfb.c, sa1100fb.h
+- *
+- * ChangeLog
+- *
+- * 2004-12-04: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Moved dprintk to s3c2410fb.c
+- *
+- * 2004-09-07: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - Renamed from h1940fb.h to s3c2410fb.h
+- * - Changed h1940 to s3c2410
+- *
+- * 2004-07-15: Arnaud Patard <arnaud.patard at rtp-net.org>
+- * - First version
+- */
++*/
- if (!ret) {
-- new_dev->dev = device_create(display_class, parent, 0,
-- "display%d", new_dev->idx);
-+ new_dev->dev = device_create_drvdata(display_class,
-+ parent,
-+ MKDEV(0,0),
-+ new_dev,
-+ "display%d",
-+ new_dev->idx);
- if (!IS_ERR(new_dev->dev)) {
-- dev_set_drvdata(new_dev->dev, new_dev);
- new_dev->parent = parent;
- new_dev->driver = driver;
- mutex_init(&new_dev->lock);
+ #ifndef __S3C2410FB_H
+ #define __S3C2410FB_H
+diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
+index 7380362..b934384 100644
+--- a/drivers/video/sis/sis_main.c
++++ b/drivers/video/sis/sis_main.c
+@@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+ } else {
+ struct sis_video_info *countvideo = card_list;
+ ivideo->cardnumber = 1;
+- while((countvideo = countvideo->next) != 0)
++ while((countvideo = countvideo->next) != NULL)
+ ivideo->cardnumber++;
+ }
+
+diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
+index 742b5c6..15d4a76 100644
+--- a/drivers/video/sm501fb.c
++++ b/drivers/video/sm501fb.c
+@@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
+ sm501fb_sync_regs(fbi);
+ mdelay(10);
+
+- if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
++ if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
+ control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */
+ writel(control, ctrl_reg);
+ sm501fb_sync_regs(fbi);
+ mdelay(10);
+ }
+
+- if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
++ if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
+ control |= SM501_DC_PANEL_CONTROL_FPEN;
+ writel(control, ctrl_reg);
+ sm501fb_sync_regs(fbi);
+@@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to)
+ }
+ } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) {
+ /* disable panel power */
+- if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) {
++ if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) {
+ control &= ~SM501_DC_PANEL_CONTROL_FPEN;
+ writel(control, ctrl_reg);
+ sm501fb_sync_regs(fbi);
+ mdelay(10);
+ }
+
+- if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) {
++ if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) {
+ control &= ~SM501_DC_PANEL_CONTROL_BIAS;
+ writel(control, ctrl_reg);
+ sm501fb_sync_regs(fbi);
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b25707f..0fa95b1 100644
--- a/fs/binfmt_elf.c
@@ -18650,6 +22223,21 @@
else
wake_up(&recv_wq);
} else
+diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
+index cd62d75..e2832bc 100644
+--- a/fs/ecryptfs/crypto.c
++++ b/fs/ecryptfs/crypto.c
+@@ -1906,9 +1906,9 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
+ goto out;
+ }
+ }
+- mutex_unlock(&key_tfm_list_mutex);
+ (*tfm) = key_tfm->key_tfm;
+ (*tfm_mutex) = &key_tfm->key_tfm_mutex;
+ out:
++ mutex_unlock(&key_tfm_list_mutex);
+ return rc;
+ }
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 6560da1..50c994a 100644
--- a/fs/ecryptfs/miscdev.c
@@ -18938,6 +22526,24 @@
+ },
+ .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
+};
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
+index fb77e09..43e9951 100644
+--- a/fs/fuse/inode.c
++++ b/fs/fuse/inode.c
+@@ -488,7 +488,12 @@ static struct fuse_conn *new_conn(struct super_block *sb)
+ err = bdi_init(&fc->bdi);
+ if (err)
+ goto error_kfree;
+- err = bdi_register_dev(&fc->bdi, fc->dev);
++ if (sb->s_bdev) {
++ err = bdi_register(&fc->bdi, NULL, "%u:%u-fuseblk",
++ MAJOR(fc->dev), MINOR(fc->dev));
++ } else {
++ err = bdi_register_dev(&fc->bdi, fc->dev);
++ }
+ if (err)
+ goto error_bdi_destroy;
+ /*
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index d31bada..07d84d1 100644
--- a/fs/gfs2/glops.c
@@ -20461,6 +24067,24 @@
return status;
}
+diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c
+index 9101807..e2f72ca 100644
+--- a/fs/ntfs/upcase.c
++++ b/fs/ntfs/upcase.c
+@@ -77,11 +77,10 @@ ntfschar *generate_default_upcase(void)
+ uc[i] = cpu_to_le16(i);
+ for (r = 0; uc_run_table[r][0]; r++)
+ for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
+- uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) +
+- uc_run_table[r][2]);
++ le16_add_cpu(&uc[i], uc_run_table[r][2]);
+ for (r = 0; uc_dup_table[r][0]; r++)
+ for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
+- uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1);
++ le16_add_cpu(&uc[i + 1], -1);
+ for (r = 0; uc_word_table[r][0]; r++)
+ uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]);
+ return uc;
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 41f84c9..10bfb46 100644
--- a/fs/ocfs2/alloc.c
@@ -20496,6 +24120,33 @@
#endif
#ifdef CONFIG_FAULT_INJECTION
REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
+diff --git a/fs/proc/inode.c b/fs/proc/inode.c
+index 6f4e8dc..b08d100 100644
+--- a/fs/proc/inode.c
++++ b/fs/proc/inode.c
+@@ -425,7 +425,8 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
+ }
+ }
+ unlock_new_inode(inode);
+- }
++ } else
++ module_put(de->owner);
+ return inode;
+
+ out_ino:
+diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
+index 74a323d..32dc14c 100644
+--- a/fs/proc/proc_misc.c
++++ b/fs/proc/proc_misc.c
+@@ -139,7 +139,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
+ #define K(x) ((x) << (PAGE_SHIFT - 10))
+ si_meminfo(&i);
+ si_swapinfo(&i);
+- committed = atomic_read(&vm_committed_space);
++ committed = atomic_long_read(&vm_committed_space);
+ allowed = ((totalram_pages - hugetlb_total_pages())
+ * sysctl_overcommit_ratio / 100) + total_swap_pages;
+
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index a1c3a1f..8c0e4b9 100644
--- a/fs/sysfs/dir.c
@@ -20514,6 +24165,548 @@
sd->s_parent = sysfs_get(acxt->parent_sd);
+diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
+index 5105015..98e0e86 100644
+--- a/fs/xfs/linux-2.6/xfs_buf.c
++++ b/fs/xfs/linux-2.6/xfs_buf.c
+@@ -387,6 +387,8 @@ _xfs_buf_lookup_pages(
+ if (unlikely(page == NULL)) {
+ if (flags & XBF_READ_AHEAD) {
+ bp->b_page_count = i;
++ for (i = 0; i < bp->b_page_count; i++)
++ unlock_page(bp->b_pages[i]);
+ return -ENOMEM;
+ }
+
+@@ -416,17 +418,24 @@ _xfs_buf_lookup_pages(
+ ASSERT(!PagePrivate(page));
+ if (!PageUptodate(page)) {
+ page_count--;
+- if (blocksize < PAGE_CACHE_SIZE && !PagePrivate(page)) {
++ if (blocksize >= PAGE_CACHE_SIZE) {
++ if (flags & XBF_READ)
++ bp->b_flags |= _XBF_PAGE_LOCKED;
++ } else if (!PagePrivate(page)) {
+ if (test_page_region(page, offset, nbytes))
+ page_count++;
+ }
+ }
+
+- unlock_page(page);
+ bp->b_pages[i] = page;
+ offset = 0;
+ }
+
++ if (!(bp->b_flags & _XBF_PAGE_LOCKED)) {
++ for (i = 0; i < bp->b_page_count; i++)
++ unlock_page(bp->b_pages[i]);
++ }
++
+ if (page_count == bp->b_page_count)
+ bp->b_flags |= XBF_DONE;
+
+@@ -746,6 +755,7 @@ xfs_buf_associate_memory(
+ bp->b_count_desired = len;
+ bp->b_buffer_length = buflen;
+ bp->b_flags |= XBF_MAPPED;
++ bp->b_flags &= ~_XBF_PAGE_LOCKED;
+
+ return 0;
+ }
+@@ -1093,8 +1103,10 @@ _xfs_buf_ioend(
+ xfs_buf_t *bp,
+ int schedule)
+ {
+- if (atomic_dec_and_test(&bp->b_io_remaining) == 1)
++ if (atomic_dec_and_test(&bp->b_io_remaining) == 1) {
++ bp->b_flags &= ~_XBF_PAGE_LOCKED;
+ xfs_buf_ioend(bp, schedule);
++ }
+ }
+
+ STATIC void
+@@ -1125,6 +1137,9 @@ xfs_buf_bio_end_io(
+
+ if (--bvec >= bio->bi_io_vec)
+ prefetchw(&bvec->bv_page->flags);
++
++ if (bp->b_flags & _XBF_PAGE_LOCKED)
++ unlock_page(page);
+ } while (bvec >= bio->bi_io_vec);
+
+ _xfs_buf_ioend(bp, 1);
+@@ -1163,7 +1178,8 @@ _xfs_buf_ioapply(
+ * filesystem block size is not smaller than the page size.
+ */
+ if ((bp->b_buffer_length < PAGE_CACHE_SIZE) &&
+- (bp->b_flags & XBF_READ) &&
++ ((bp->b_flags & (XBF_READ|_XBF_PAGE_LOCKED)) ==
++ (XBF_READ|_XBF_PAGE_LOCKED)) &&
+ (blocksize >= PAGE_CACHE_SIZE)) {
+ bio = bio_alloc(GFP_NOIO, 1);
+
+diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
+index 841d788..f948ec7 100644
+--- a/fs/xfs/linux-2.6/xfs_buf.h
++++ b/fs/xfs/linux-2.6/xfs_buf.h
+@@ -66,6 +66,25 @@ typedef enum {
+ _XBF_PAGES = (1 << 18), /* backed by refcounted pages */
+ _XBF_RUN_QUEUES = (1 << 19),/* run block device task queue */
+ _XBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */
++
++ /*
++ * Special flag for supporting metadata blocks smaller than a FSB.
++ *
++ * In this case we can have multiple xfs_buf_t on a single page and
++ * need to lock out concurrent xfs_buf_t readers as they only
++ * serialise access to the buffer.
++ *
++ * If the FSB size >= PAGE_CACHE_SIZE case, we have no serialisation
++ * between reads of the page. Hence we can have one thread read the
++ * page and modify it, but then race with another thread that thinks
++ * the page is not up-to-date and hence reads it again.
++ *
++ * The result is that the first modifcation to the page is lost.
++ * This sort of AGF/AGI reading race can happen when unlinking inodes
++ * that require truncation and results in the AGI unlinked list
++ * modifications being lost.
++ */
++ _XBF_PAGE_LOCKED = (1 << 22),
+ } xfs_buf_flags_t;
+
+ typedef enum {
+diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
+index 65e78c1..5f60363 100644
+--- a/fs/xfs/linux-2.6/xfs_file.c
++++ b/fs/xfs/linux-2.6/xfs_file.c
+@@ -184,19 +184,24 @@ xfs_file_release(
+ return -xfs_release(XFS_I(inode));
+ }
+
++/*
++ * We ignore the datasync flag here because a datasync is effectively
++ * identical to an fsync. That is, datasync implies that we need to write
++ * only the metadata needed to be able to access the data that is written
++ * if we crash after the call completes. Hence if we are writing beyond
++ * EOF we have to log the inode size change as well, which makes it a
++ * full fsync. If we don't write beyond EOF, the inode core will be
++ * clean in memory and so we don't need to log the inode, just like
++ * fsync.
++ */
+ STATIC int
+ xfs_file_fsync(
+ struct file *filp,
+ struct dentry *dentry,
+ int datasync)
+ {
+- int flags = FSYNC_WAIT;
+-
+- if (datasync)
+- flags |= FSYNC_DATA;
+ xfs_iflags_clear(XFS_I(dentry->d_inode), XFS_ITRUNCATED);
+- return -xfs_fsync(XFS_I(dentry->d_inode), flags,
+- (xfs_off_t)0, (xfs_off_t)-1);
++ return -xfs_fsync(XFS_I(dentry->d_inode));
+ }
+
+ /*
+diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
+index 9d73cb5..25eb2a9 100644
+--- a/fs/xfs/linux-2.6/xfs_vnode.h
++++ b/fs/xfs/linux-2.6/xfs_vnode.h
+@@ -230,14 +230,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
+ #define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */
+
+ /*
+- * Flags to vop_fsync/reclaim.
+- */
+-#define FSYNC_NOWAIT 0 /* asynchronous flush */
+-#define FSYNC_WAIT 0x1 /* synchronous fsync or forced reclaim */
+-#define FSYNC_INVAL 0x2 /* flush and invalidate cached data */
+-#define FSYNC_DATA 0x4 /* synchronous fsync of data only */
+-
+-/*
+ * Tracking vnode activity.
+ */
+ #if defined(XFS_INODE_TRACE)
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
+index cf0bb9c..e569bf5 100644
+--- a/fs/xfs/xfs_inode.c
++++ b/fs/xfs/xfs_inode.c
+@@ -2974,6 +2974,7 @@ xfs_iflush_cluster(
+ xfs_mount_t *mp = ip->i_mount;
+ xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino);
+ unsigned long first_index, mask;
++ unsigned long inodes_per_cluster;
+ int ilist_size;
+ xfs_inode_t **ilist;
+ xfs_inode_t *iq;
+@@ -2985,8 +2986,9 @@ xfs_iflush_cluster(
+ ASSERT(pag->pagi_inodeok);
+ ASSERT(pag->pag_ici_init);
+
+- ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *);
+- ilist = kmem_alloc(ilist_size, KM_MAYFAIL);
++ inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog;
++ ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *);
++ ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS);
+ if (!ilist)
+ return 0;
+
+@@ -2995,8 +2997,7 @@ xfs_iflush_cluster(
+ read_lock(&pag->pag_ici_lock);
+ /* really need a gang lookup range call here */
+ nr_found = radix_tree_gang_lookup(&pag->pag_ici_root, (void**)ilist,
+- first_index,
+- XFS_INODE_CLUSTER_SIZE(mp));
++ first_index, inodes_per_cluster);
+ if (nr_found == 0)
+ goto out_free;
+
+diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
+index 70702a6..e475e37 100644
+--- a/fs/xfs/xfs_vnodeops.c
++++ b/fs/xfs/xfs_vnodeops.c
+@@ -856,18 +856,14 @@ xfs_readlink(
+ /*
+ * xfs_fsync
+ *
+- * This is called to sync the inode and its data out to disk.
+- * We need to hold the I/O lock while flushing the data, and
+- * the inode lock while flushing the inode. The inode lock CANNOT
+- * be held while flushing the data, so acquire after we're done
+- * with that.
++ * This is called to sync the inode and its data out to disk. We need to hold
++ * the I/O lock while flushing the data, and the inode lock while flushing the
++ * inode. The inode lock CANNOT be held while flushing the data, so acquire
++ * after we're done with that.
+ */
+ int
+ xfs_fsync(
+- xfs_inode_t *ip,
+- int flag,
+- xfs_off_t start,
+- xfs_off_t stop)
++ xfs_inode_t *ip)
+ {
+ xfs_trans_t *tp;
+ int error;
+@@ -875,103 +871,79 @@ xfs_fsync(
+
+ xfs_itrace_entry(ip);
+
+- ASSERT(start >= 0 && stop >= -1);
+-
+ if (XFS_FORCED_SHUTDOWN(ip->i_mount))
+ return XFS_ERROR(EIO);
+
+- if (flag & FSYNC_DATA)
+- filemap_fdatawait(vn_to_inode(XFS_ITOV(ip))->i_mapping);
++ /* capture size updates in I/O completion before writing the inode. */
++ error = filemap_fdatawait(vn_to_inode(XFS_ITOV(ip))->i_mapping);
++ if (error)
++ return XFS_ERROR(error);
+
+ /*
+- * We always need to make sure that the required inode state
+- * is safe on disk. The vnode might be clean but because
+- * of committed transactions that haven't hit the disk yet.
+- * Likewise, there could be unflushed non-transactional
+- * changes to the inode core that have to go to disk.
++ * We always need to make sure that the required inode state is safe on
++ * disk. The vnode might be clean but we still might need to force the
++ * log because of committed transactions that haven't hit the disk yet.
++ * Likewise, there could be unflushed non-transactional changes to the
++ * inode core that have to go to disk and this requires us to issue
++ * a synchronous transaction to capture these changes correctly.
+ *
+- * The following code depends on one assumption: that
+- * any transaction that changes an inode logs the core
+- * because it has to change some field in the inode core
+- * (typically nextents or nblocks). That assumption
+- * implies that any transactions against an inode will
+- * catch any non-transactional updates. If inode-altering
+- * transactions exist that violate this assumption, the
+- * code breaks. Right now, it figures that if the involved
+- * update_* field is clear and the inode is unpinned, the
+- * inode is clean. Either it's been flushed or it's been
+- * committed and the commit has hit the disk unpinning the inode.
+- * (Note that xfs_inode_item_format() called at commit clears
+- * the update_* fields.)
++ * This code relies on the assumption that if the update_* fields
++ * of the inode are clear and the inode is unpinned then it is clean
++ * and no action is required.
+ */
+ xfs_ilock(ip, XFS_ILOCK_SHARED);
+
+- /* If we are flushing data then we care about update_size
+- * being set, otherwise we care about update_core
+- */
+- if ((flag & FSYNC_DATA) ?
+- (ip->i_update_size == 0) :
+- (ip->i_update_core == 0)) {
++ if (!(ip->i_update_size || ip->i_update_core)) {
+ /*
+- * Timestamps/size haven't changed since last inode
+- * flush or inode transaction commit. That means
+- * either nothing got written or a transaction
+- * committed which caught the updates. If the
+- * latter happened and the transaction hasn't
+- * hit the disk yet, the inode will be still
+- * be pinned. If it is, force the log.
++ * Timestamps/size haven't changed since last inode flush or
++ * inode transaction commit. That means either nothing got
++ * written or a transaction committed which caught the updates.
++ * If the latter happened and the transaction hasn't hit the
++ * disk yet, the inode will be still be pinned. If it is,
++ * force the log.
+ */
+
+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
+
+ if (xfs_ipincount(ip)) {
+- _xfs_log_force(ip->i_mount, (xfs_lsn_t)0,
+- XFS_LOG_FORCE |
+- ((flag & FSYNC_WAIT)
+- ? XFS_LOG_SYNC : 0),
++ error = _xfs_log_force(ip->i_mount, (xfs_lsn_t)0,
++ XFS_LOG_FORCE | XFS_LOG_SYNC,
+ &log_flushed);
+ } else {
+ /*
+- * If the inode is not pinned and nothing
+- * has changed we don't need to flush the
+- * cache.
++ * If the inode is not pinned and nothing has changed
++ * we don't need to flush the cache.
+ */
+ changed = 0;
+ }
+- error = 0;
+ } else {
+ /*
+- * Kick off a transaction to log the inode
+- * core to get the updates. Make it
+- * sync if FSYNC_WAIT is passed in (which
+- * is done by everybody but specfs). The
+- * sync transaction will also force the log.
++ * Kick off a transaction to log the inode core to get the
++ * updates. The sync transaction will also force the log.
+ */
+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
+ tp = xfs_trans_alloc(ip->i_mount, XFS_TRANS_FSYNC_TS);
+- if ((error = xfs_trans_reserve(tp, 0,
+- XFS_FSYNC_TS_LOG_RES(ip->i_mount),
+- 0, 0, 0))) {
++ error = xfs_trans_reserve(tp, 0,
++ XFS_FSYNC_TS_LOG_RES(ip->i_mount), 0, 0, 0);
++ if (error) {
+ xfs_trans_cancel(tp, 0);
+ return error;
+ }
+ xfs_ilock(ip, XFS_ILOCK_EXCL);
+
+ /*
+- * Note - it's possible that we might have pushed
+- * ourselves out of the way during trans_reserve
+- * which would flush the inode. But there's no
+- * guarantee that the inode buffer has actually
+- * gone out yet (it's delwri). Plus the buffer
+- * could be pinned anyway if it's part of an
+- * inode in another recent transaction. So we
+- * play it safe and fire off the transaction anyway.
++ * Note - it's possible that we might have pushed ourselves out
++ * of the way during trans_reserve which would flush the inode.
++ * But there's no guarantee that the inode buffer has actually
++ * gone out yet (it's delwri). Plus the buffer could be pinned
++ * anyway if it's part of an inode in another recent
++ * transaction. So we play it safe and fire off the
++ * transaction anyway.
+ */
+ xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
+ xfs_trans_ihold(tp, ip);
+ xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+- if (flag & FSYNC_WAIT)
+- xfs_trans_set_sync(tp);
++ xfs_trans_set_sync(tp);
+ error = _xfs_trans_commit(tp, 0, &log_flushed);
+
+ xfs_iunlock(ip, XFS_ILOCK_EXCL);
+diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
+index 8abe8f1..57335ba 100644
+--- a/fs/xfs/xfs_vnodeops.h
++++ b/fs/xfs/xfs_vnodeops.h
+@@ -18,8 +18,7 @@ int xfs_open(struct xfs_inode *ip);
+ int xfs_setattr(struct xfs_inode *ip, struct bhv_vattr *vap, int flags,
+ struct cred *credp);
+ int xfs_readlink(struct xfs_inode *ip, char *link);
+-int xfs_fsync(struct xfs_inode *ip, int flag, xfs_off_t start,
+- xfs_off_t stop);
++int xfs_fsync(struct xfs_inode *ip);
+ int xfs_release(struct xfs_inode *ip);
+ int xfs_inactive(struct xfs_inode *ip);
+ int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
+diff --git a/include/asm-arm/arch-omap/board-palmte.h b/include/asm-arm/arch-omap/board-palmte.h
+index cd22035..6fac2c8 100644
+--- a/include/asm-arm/arch-omap/board-palmte.h
++++ b/include/asm-arm/arch-omap/board-palmte.h
+@@ -14,8 +14,6 @@
+ #ifndef __OMAP_BOARD_PALMTE_H
+ #define __OMAP_BOARD_PALMTE_H
+
+-#include <asm/arch/gpio.h>
+-
+ #define PALMTE_USBDETECT_GPIO 0
+ #define PALMTE_USB_OR_DC_GPIO 1
+ #define PALMTE_TSC_GPIO 4
+diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
+index 57523bd..12a5e4d 100644
+--- a/include/asm-arm/arch-omap/clock.h
++++ b/include/asm-arm/arch-omap/clock.h
+@@ -73,6 +73,8 @@ struct clk {
+ #endif
+ };
+
++struct cpufreq_frequency_table;
++
+ struct clk_functions {
+ int (*clk_enable)(struct clk *clk);
+ void (*clk_disable)(struct clk *clk);
+@@ -83,6 +85,9 @@ struct clk_functions {
+ void (*clk_allow_idle)(struct clk *clk);
+ void (*clk_deny_idle)(struct clk *clk);
+ void (*clk_disable_unused)(struct clk *clk);
++#ifdef CONFIG_CPU_FREQ
++ void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
++#endif
+ };
+
+ extern unsigned int mpurate;
+diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
+index 74cd572..369093a 100644
+--- a/include/asm-arm/arch-omap/entry-macro.S
++++ b/include/asm-arm/arch-omap/entry-macro.S
+@@ -8,6 +8,7 @@
+ * warranty of any kind, whether express or implied.
+ */
+ #include <asm/hardware.h>
++#include <asm/arch/io.h>
+ #include <asm/arch/irqs.h>
+
+ #if defined(CONFIG_ARCH_OMAP1)
+diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
+index 86621a0..5ee6a49 100644
+--- a/include/asm-arm/arch-omap/gpio.h
++++ b/include/asm-arm/arch-omap/gpio.h
+@@ -26,7 +26,6 @@
+ #ifndef __ASM_ARCH_OMAP_GPIO_H
+ #define __ASM_ARCH_OMAP_GPIO_H
+
+-#include <asm/hardware.h>
+ #include <asm/arch/irqs.h>
+ #include <asm/io.h>
+
+diff --git a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
+index da57209..91d85b3 100644
+--- a/include/asm-arm/arch-omap/hardware.h
++++ b/include/asm-arm/arch-omap/hardware.h
+@@ -41,7 +41,6 @@
+ #include <asm/types.h>
+ #include <asm/arch/cpu.h>
+ #endif
+-#include <asm/arch/io.h>
+ #include <asm/arch/serial.h>
+
+ /*
+diff --git a/include/asm-arm/arch-sa1100/collie.h b/include/asm-arm/arch-sa1100/collie.h
+index 14a344a..762eba5 100644
+--- a/include/asm-arm/arch-sa1100/collie.h
++++ b/include/asm-arm/arch-sa1100/collie.h
+@@ -34,9 +34,12 @@
+
+ #define COLLIE_GPIO_ON_KEY GPIO_GPIO (0)
+ #define COLLIE_GPIO_AC_IN GPIO_GPIO (1)
++#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11)
+ #define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14)
+ #define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15)
+ #define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16)
++#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17)
++#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18)
+ #define COLLIE_GPIO_CO GPIO_GPIO (20)
+ #define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21)
+ #define COLLIE_GPIO_CF_CD GPIO_GPIO (22)
+@@ -49,6 +52,7 @@
+
+ #define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
+ #define COLLIE_IRQ_GPIO_AC_IN IRQ_GPIO1
++#define COLLIE_IRQ_GPIO_SDIO_IRQ IRQ_GPIO11
+ #define COLLIE_IRQ_GPIO_CF_IRQ IRQ_GPIO14
+ #define COLLIE_IRQ_GPIO_nREMOCON_INT IRQ_GPIO15
+ #define COLLIE_IRQ_GPIO_CO IRQ_GPIO20
+diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
+index 5c22b01..8e05bdb 100644
+--- a/include/asm-arm/page.h
++++ b/include/asm-arm/page.h
+@@ -179,10 +179,10 @@ typedef unsigned long pgprot_t;
+
+ #endif /* STRICT_MM_TYPECHECKS */
+
+-typedef struct page *pgtable_t;
+-
+ #endif /* CONFIG_MMU */
+
++typedef struct page *pgtable_t;
++
+ #include <asm/memory.h>
+
+ #endif /* !__ASSEMBLY__ */
+diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
+index 6335de9..514af79 100644
+--- a/include/asm-arm/system.h
++++ b/include/asm-arm/system.h
+@@ -48,20 +48,6 @@
+ #define CPUID_TCM 2
+ #define CPUID_TLBTYPE 3
+
+-#ifdef CONFIG_CPU_CP15
+-#define read_cpuid(reg) \
+- ({ \
+- unsigned int __val; \
+- asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \
+- : "=r" (__val) \
+- : \
+- : "cc"); \
+- __val; \
+- })
+-#else
+-#define read_cpuid(reg) (processor_id)
+-#endif
+-
+ /*
+ * This is used to ensure the compiler did actually allocate the register we
+ * asked it for some inline assembly sequences. Apparently we can't trust
+@@ -78,6 +64,21 @@
+ #include <linux/stringify.h>
+ #include <linux/irqflags.h>
+
++#ifdef CONFIG_CPU_CP15
++#define read_cpuid(reg) \
++ ({ \
++ unsigned int __val; \
++ asm("mrc p15, 0, %0, c0, c0, " __stringify(reg) \
++ : "=r" (__val) \
++ : \
++ : "cc"); \
++ __val; \
++ })
++#else
++extern unsigned int processor_id;
++#define read_cpuid(reg) (processor_id)
++#endif
++
+ /*
+ * The CPU ID never changes at run time, so we might as well tell the
+ * compiler that it's constant. Use this function to read the CPU ID
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 716df7c..a9248d8 100644
--- a/include/asm-blackfin/bfin-global.h
@@ -20703,6 +24896,32 @@
+ */
+
+#define SERIAL_EXTRA_IRQ_FLAGS IRQF_TRIGGER_HIGH
+diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
+index ecf675a..6be061d 100644
+--- a/include/asm-generic/gpio.h
++++ b/include/asm-generic/gpio.h
+@@ -1,8 +1,12 @@
+ #ifndef _ASM_GENERIC_GPIO_H
+ #define _ASM_GENERIC_GPIO_H
+
++#include <linux/types.h>
++
+ #ifdef CONFIG_HAVE_GPIO_LIB
+
++#include <linux/compiler.h>
++
+ /* Platforms may implement their GPIO interface with library code,
+ * at a small performance cost for non-inlined operations and some
+ * extra memory (for code and for per-GPIO table entries).
+@@ -74,7 +78,7 @@ struct gpio_chip {
+
+ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
+ unsigned offset);
+-extern int __init __must_check gpiochip_reserve(int start, int ngpio);
++extern int __must_check gpiochip_reserve(int start, int ngpio);
+
+ /* add/remove chips */
+ extern int gpiochip_add(struct gpio_chip *chip);
diff --git a/include/asm-ia64/kvm.h b/include/asm-ia64/kvm.h
index eb2d355..3f6a090 100644
--- a/include/asm-ia64/kvm.h
@@ -20746,6 +24965,50 @@
};
};
+diff --git a/include/asm-mips/gic.h b/include/asm-mips/gic.h
+index 01b2f92..3a492f2 100644
+--- a/include/asm-mips/gic.h
++++ b/include/asm-mips/gic.h
+@@ -330,7 +330,7 @@
+
+ #define GIC_SH_RMASK_OFS 0x0300
+ #define GIC_CLR_INTR_MASK(intr, val) \
+- GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32))
++ GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
+
+ /* Register Map for Local Section */
+ #define GIC_VPE_CTL_OFS 0x0000
+diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
+index 363a14e..1b5064d 100644
+--- a/include/asm-mips/mach-au1x00/au1000.h
++++ b/include/asm-mips/mach-au1x00/au1000.h
+@@ -1036,7 +1036,7 @@ enum soc_au1200_ints {
+ #define USBD_INTSTAT 0xB020001C
+ # define USBDEV_INT_SOF (1 << 12)
+ # define USBDEV_INT_HF_BIT 6
+-# define USBDEV_INT_HF_MASK 0x3f << USBDEV_INT_HF_BIT)
++# define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
+ # define USBDEV_INT_CMPLT_BIT 0
+ # define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
+ #define USBD_CONFIG 0xB0200020
+diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
+index 943c5a3..a4d0f87 100644
+--- a/include/asm-powerpc/mpic.h
++++ b/include/asm-powerpc/mpic.h
+@@ -428,12 +428,11 @@ extern void mpic_init(struct mpic *mpic);
+ */
+
+
+-/* Change/Read the priority of an interrupt. Default is 8 for irqs and
++/* Change the priority of an interrupt. Default is 8 for irqs and
+ * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the
+ * IPI number is then the offset'ed (linux irq number mapped to the IPI)
+ */
+ extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri);
+-extern unsigned int mpic_irq_get_priority(unsigned int irq);
+
+ /* Setup a non-boot CPU */
+ extern void mpic_setup_this_cpu(void);
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 4bc8cb1..24e4207 100644
--- a/include/asm-sh/kgdb.h
@@ -22190,6 +26453,35 @@
}
#define pte_none(x) (!pte_val((x)))
+diff --git a/include/asm-x86/tlbflush.h b/include/asm-x86/tlbflush.h
+index 0c0674d..35c76ce 100644
+--- a/include/asm-x86/tlbflush.h
++++ b/include/asm-x86/tlbflush.h
+@@ -22,12 +22,23 @@ static inline void __native_flush_tlb(void)
+
+ static inline void __native_flush_tlb_global(void)
+ {
+- unsigned long cr4 = read_cr4();
++ unsigned long flags;
++ unsigned long cr4;
+
++ /*
++ * Read-modify-write to CR4 - protect it from preemption and
++ * from interrupts. (Use the raw variant because this code can
++ * be called from deep inside debugging code.)
++ */
++ raw_local_irq_save(flags);
++
++ cr4 = read_cr4();
+ /* clear PGE */
+ write_cr4(cr4 & ~X86_CR4_PGE);
+ /* write old PGE again and flush TLBs */
+ write_cr4(cr4);
++
++ raw_local_irq_restore(flags);
+ }
+
+ static inline void __native_flush_tlb_single(unsigned long addr)
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
index 0179930..baf3a4d 100644
--- a/include/asm-x86/xen/page.h
@@ -22349,6 +26641,20 @@
extern struct kmem_cache *files_cachep;
+diff --git a/include/linux/gpio.h b/include/linux/gpio.h
+index 4987a84..98be6c5 100644
+--- a/include/linux/gpio.h
++++ b/include/linux/gpio.h
+@@ -8,6 +8,9 @@
+
+ #else
+
++#include <linux/types.h>
++#include <linux/errno.h>
++
+ /*
+ * Some platforms don't support the GPIO programming interface.
+ *
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 4ce3b7a..fe56b86 100644
--- a/include/linux/hid.h
@@ -22455,6 +26761,40 @@
/*
* Core layer - drivers/ata/libata-core.c
*/
+diff --git a/include/linux/mman.h b/include/linux/mman.h
+index 87920a0..dab8892 100644
+--- a/include/linux/mman.h
++++ b/include/linux/mman.h
+@@ -17,14 +17,14 @@
+
+ extern int sysctl_overcommit_memory;
+ extern int sysctl_overcommit_ratio;
+-extern atomic_t vm_committed_space;
++extern atomic_long_t vm_committed_space;
+
+ #ifdef CONFIG_SMP
+ extern void vm_acct_memory(long pages);
+ #else
+ static inline void vm_acct_memory(long pages)
+ {
+- atomic_add(pages, &vm_committed_space);
++ atomic_long_add(pages, &vm_committed_space);
+ }
+ #endif
+
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
+index c463cd8..443bc7c 100644
+--- a/include/linux/mmzone.h
++++ b/include/linux/mmzone.h
+@@ -703,7 +703,7 @@ extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
+ extern struct zone *next_zone(struct zone *zone);
+
+ /**
+- * for_each_pgdat - helper macro to iterate over all nodes
++ * for_each_online_pgdat - helper macro to iterate over all online nodes
+ * @pgdat - pointer to a pg_data_t variable
+ */
+ #define for_each_online_pgdat(pgdat) \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b11e6e1..2b02664 100644
--- a/include/linux/netdevice.h
@@ -22545,6 +26885,98 @@
#include <linux/compiler.h>
#include <linux/netfilter_ipv6.h>
+diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
+index cf6dbd7..9b940e6 100644
+--- a/include/linux/pci_ids.h
++++ b/include/linux/pci_ids.h
+@@ -1761,6 +1761,7 @@
+
+ #define PCI_VENDOR_ID_INTASHIELD 0x135a
+ #define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80
++#define PCI_DEVICE_ID_INTASHIELD_IS400 0x0dc0
+
+ #define PCI_VENDOR_ID_QUATECH 0x135C
+ #define PCI_DEVICE_ID_QUATECH_QSC100 0x0010
+@@ -2383,6 +2384,9 @@
+ #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
+ #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
+ #define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
++#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030
++#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035
++#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036
+ #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
+ #define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
+ #define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
+diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
+index 47fbcba..78bfdea 100644
+--- a/include/linux/raid/bitmap.h
++++ b/include/linux/raid/bitmap.h
+@@ -262,7 +262,6 @@ int bitmap_create(mddev_t *mddev);
+ void bitmap_flush(mddev_t *mddev);
+ void bitmap_destroy(mddev_t *mddev);
+
+-char *file_path(struct file *file, char *buf, int count);
+ void bitmap_print_sb(struct bitmap *bitmap);
+ void bitmap_update_sb(struct bitmap *bitmap);
+
+diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
+index 81a1a02..b7386ae 100644
+--- a/include/linux/raid/md.h
++++ b/include/linux/raid/md.h
+@@ -72,6 +72,8 @@
+ */
+ #define MD_PATCHLEVEL_VERSION 3
+
++extern int mdp_major;
++
+ extern int register_md_personality (struct mdk_personality *p);
+ extern int unregister_md_personality (struct mdk_personality *p);
+ extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
+diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
+index 812ffa5..3dea9f5 100644
+--- a/include/linux/raid/md_k.h
++++ b/include/linux/raid/md_k.h
+@@ -180,13 +180,15 @@ struct mddev_s
+ int sync_speed_min;
+ int sync_speed_max;
+
++ /* resync even though the same disks are shared among md-devices */
++ int parallel_resync;
++
+ int ok_start_degraded;
+ /* recovery/resync flags
+ * NEEDED: we might need to start a resync/recover
+ * RUNNING: a thread is running, or about to be started
+ * SYNC: actually doing a resync, not a recovery
+- * ERR: and IO error was detected - abort the resync/recovery
+- * INTR: someone requested a (clean) early abort.
++ * INTR: resync needs to be aborted for some reason
+ * DONE: thread is done and is waiting to be reaped
+ * REQUEST: user-space has requested a sync (used with SYNC)
+ * CHECK: user-space request for for check-only, no repair
+@@ -196,7 +198,6 @@ struct mddev_s
+ */
+ #define MD_RECOVERY_RUNNING 0
+ #define MD_RECOVERY_SYNC 1
+-#define MD_RECOVERY_ERR 2
+ #define MD_RECOVERY_INTR 3
+ #define MD_RECOVERY_DONE 4
+ #define MD_RECOVERY_NEEDED 5
+diff --git a/include/linux/sm501.h b/include/linux/sm501.h
+index bca1345..95c1c39 100644
+--- a/include/linux/sm501.h
++++ b/include/linux/sm501.h
+@@ -71,8 +71,8 @@ extern unsigned long sm501_gpio_get(struct device *dev,
+ #define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
+ #define SM501FB_FLAG_USE_HWCURSOR (1<<2)
+ #define SM501FB_FLAG_USE_HWACCEL (1<<3)
+-#define SM501FB_FLAG_PANEL_USE_FPEN (1<<4)
+-#define SM501FB_FLAG_PANEL_USE_VBIASEN (1<<5)
++#define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
++#define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
+
+ struct sm501_platdata_fbsub {
+ struct fb_videomode *def_mode;
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index c11bbcc..05eb466 100644
--- a/include/linux/sunrpc/svc_rdma.h
@@ -22609,6 +27041,26 @@
u32 lost_out; /* Lost packets */
u32 sacked_out; /* SACK'd packets */
u32 fackets_out; /* FACK'd packets */
+diff --git a/include/linux/types.h b/include/linux/types.h
+index 9dc2346..d4a9ce6 100644
+--- a/include/linux/types.h
++++ b/include/linux/types.h
+@@ -197,8 +197,6 @@ typedef u64 resource_size_t;
+ typedef u32 resource_size_t;
+ #endif
+
+-#endif /* __KERNEL__ */
+-
+ struct ustat {
+ __kernel_daddr_t f_tfree;
+ __kernel_ino_t f_tinode;
+@@ -206,4 +204,6 @@ struct ustat {
+ char f_fpack[6];
+ };
+
++#endif /* __KERNEL__ */
++
+ #endif /* _LINUX_TYPES_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 71e52f2..ca228bb 100644
--- a/include/linux/usb/cdc.h
@@ -22706,6 +27158,18 @@
#endif
extern void inet6_ifinfo_notify(int event,
+diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
+index 7473b0c..693d246 100644
+--- a/init/do_mounts_md.c
++++ b/init/do_mounts_md.c
+@@ -24,7 +24,6 @@ static struct {
+
+ static int md_setup_ents __initdata;
+
+-extern int mdp_major;
+ /*
+ * Parse the command-line parameters given our kernel, but do not
+ * actually try to invoke the MD device now; that is handled by
diff --git a/kernel/audit.c b/kernel/audit.c
index b7d3709..e8692a5 100644
--- a/kernel/audit.c
@@ -22750,6 +27214,44 @@
if (p->watch.inode == inode) {
get_inotify_watch(&p->watch);
return p;
+diff --git a/kernel/cgroup.c b/kernel/cgroup.c
+index fbc6fc8..15ac0e1 100644
+--- a/kernel/cgroup.c
++++ b/kernel/cgroup.c
+@@ -2903,7 +2903,7 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
+ cg = tsk->cgroups;
+ parent = task_cgroup(tsk, subsys->subsys_id);
+
+- snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "node_%d", tsk->pid);
++ snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "%d", tsk->pid);
+
+ /* Pin the hierarchy */
+ atomic_inc(&parent->root->sb->s_active);
+diff --git a/kernel/exit.c b/kernel/exit.c
+index 1510f78..8f6185e 100644
+--- a/kernel/exit.c
++++ b/kernel/exit.c
+@@ -126,6 +126,12 @@ static void __exit_signal(struct task_struct *tsk)
+
+ __unhash_process(tsk);
+
++ /*
++ * Do this under ->siglock, we can race with another thread
++ * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals.
++ */
++ flush_sigqueue(&tsk->pending);
++
+ tsk->signal = NULL;
+ tsk->sighand = NULL;
+ spin_unlock(&sighand->siglock);
+@@ -133,7 +139,6 @@ static void __exit_signal(struct task_struct *tsk)
+
+ __cleanup_sighand(sighand);
+ clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
+- flush_sigqueue(&tsk->pending);
+ if (sig) {
+ flush_sigqueue(&sig->shared_pending);
+ taskstats_tgid_free(sig);
diff --git a/kernel/fork.c b/kernel/fork.c
index 933e60e..19908b2 100644
--- a/kernel/fork.c
@@ -22891,6 +27393,113 @@
static int copy_files(unsigned long clone_flags, struct task_struct * tsk)
{
struct files_struct *oldf, *newf;
+diff --git a/kernel/module.c b/kernel/module.c
+index f5e9491..5f80478 100644
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -1337,7 +1337,19 @@ out_unreg:
+ kobject_put(&mod->mkobj.kobj);
+ return err;
+ }
+-#endif
++
++static void mod_sysfs_fini(struct module *mod)
++{
++ kobject_put(&mod->mkobj.kobj);
++}
++
++#else /* CONFIG_SYSFS */
++
++static void mod_sysfs_fini(struct module *mod)
++{
++}
++
++#endif /* CONFIG_SYSFS */
+
+ static void mod_kobject_remove(struct module *mod)
+ {
+@@ -1345,7 +1357,7 @@ static void mod_kobject_remove(struct module *mod)
+ module_param_sysfs_remove(mod);
+ kobject_put(mod->mkobj.drivers_dir);
+ kobject_put(mod->holders_dir);
+- kobject_put(&mod->mkobj.kobj);
++ mod_sysfs_fini(mod);
+ }
+
+ /*
+@@ -1780,7 +1792,7 @@ static struct module *load_module(void __user *umod,
+
+ /* Sanity checks against insmoding binaries or wrong arch,
+ weird elf version */
+- if (memcmp(hdr->e_ident, ELFMAG, 4) != 0
++ if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) != 0
+ || hdr->e_type != ET_REL
+ || !elf_check_arch(hdr)
+ || hdr->e_shentsize != sizeof(*sechdrs)) {
+diff --git a/kernel/signal.c b/kernel/signal.c
+index 72bb4f5..12ffea7 100644
+--- a/kernel/signal.c
++++ b/kernel/signal.c
+@@ -1242,7 +1242,8 @@ void sigqueue_free(struct sigqueue *q)
+ /*
+ * If the signal is still pending remove it from the
+ * pending queue. We must hold ->siglock while testing
+- * q->list to serialize with collect_signal().
++ * q->list to serialize with collect_signal() or with
++ * __exit_signal()->flush_sigqueue().
+ */
+ spin_lock_irqsave(lock, flags);
+ if (!list_empty(&q->list))
+diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
+index 0101aee..b7350bb 100644
+--- a/kernel/stop_machine.c
++++ b/kernel/stop_machine.c
+@@ -62,8 +62,7 @@ static int stopmachine(void *cpu)
+ * help our sisters onto their CPUs. */
+ if (!prepared && !irqs_disabled)
+ yield();
+- else
+- cpu_relax();
++ cpu_relax();
+ }
+
+ /* Ack: we are exiting. */
+@@ -106,8 +105,10 @@ static int stop_machine(void)
+ }
+
+ /* Wait for them all to come to life. */
+- while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)
++ while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads) {
+ yield();
++ cpu_relax();
++ }
+
+ /* If some failed, kill them all. */
+ if (ret < 0) {
+diff --git a/kernel/sys.c b/kernel/sys.c
+index 895d2d4..14e9728 100644
+--- a/kernel/sys.c
++++ b/kernel/sys.c
+@@ -1652,7 +1652,7 @@ asmlinkage long sys_umask(int mask)
+ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
+ unsigned long arg4, unsigned long arg5)
+ {
+- long uninitialized_var(error);
++ long error = 0;
+
+ if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error))
+ return error;
+@@ -1701,9 +1701,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
+ error = PR_TIMING_STATISTICAL;
+ break;
+ case PR_SET_TIMING:
+- if (arg2 == PR_TIMING_STATISTICAL)
+- error = 0;
+- else
++ if (arg2 != PR_TIMING_STATISTICAL)
+ error = -EINVAL;
+ break;
+
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d7ffdc5..2911665 100644
--- a/kernel/sysctl.c
@@ -22965,6 +27574,118 @@
return ret;
}
EXPORT_SYMBOL(bdi_register);
+diff --git a/mm/memory.c b/mm/memory.c
+index fb5608a..19e0ae9 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -2295,8 +2295,6 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
+ vmf.flags = flags;
+ vmf.page = NULL;
+
+- BUG_ON(vma->vm_flags & VM_PFNMAP);
+-
+ ret = vma->vm_ops->fault(vma, &vmf);
+ if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE)))
+ return ret;
+diff --git a/mm/mmap.c b/mm/mmap.c
+index fac6633..669499e 100644
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -80,7 +80,7 @@ EXPORT_SYMBOL(vm_get_page_prot);
+ int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
+ int sysctl_overcommit_ratio = 50; /* default is 50% */
+ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
+-atomic_t vm_committed_space = ATOMIC_INIT(0);
++atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0);
+
+ /*
+ * Check that a process has enough memory to allocate a new virtual
+@@ -177,7 +177,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
+ * cast `allowed' as a signed long because vm_committed_space
+ * sometimes has a negative value
+ */
+- if (atomic_read(&vm_committed_space) < (long)allowed)
++ if (atomic_long_read(&vm_committed_space) < (long)allowed)
+ return 0;
+ error:
+ vm_unacct_memory(pages);
+diff --git a/mm/nommu.c b/mm/nommu.c
+index ef8c62c..dca93fc 100644
+--- a/mm/nommu.c
++++ b/mm/nommu.c
+@@ -39,7 +39,7 @@ struct page *mem_map;
+ unsigned long max_mapnr;
+ unsigned long num_physpages;
+ unsigned long askedalloc, realalloc;
+-atomic_t vm_committed_space = ATOMIC_INIT(0);
++atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0);
+ int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
+ int sysctl_overcommit_ratio = 50; /* default is 50% */
+ int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
+@@ -1410,7 +1410,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
+ * cast `allowed' as a signed long because vm_committed_space
+ * sometimes has a negative value
+ */
+- if (atomic_read(&vm_committed_space) < (long)allowed)
++ if (atomic_long_read(&vm_committed_space) < (long)allowed)
+ return 0;
+ error:
+ vm_unacct_memory(pages);
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index 6383557..8e83f02 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -1396,6 +1396,9 @@ get_page_from_freelist(gfp_t gfp_mask, nodemask_t *nodemask, unsigned int order,
+
+ (void)first_zones_zonelist(zonelist, high_zoneidx, nodemask,
+ &preferred_zone);
++ if (!preferred_zone)
++ return NULL;
++
+ classzone_idx = zone_idx(preferred_zone);
+
+ zonelist_scan:
+@@ -2804,7 +2807,7 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
+ alloc_size = zone->wait_table_hash_nr_entries
+ * sizeof(wait_queue_head_t);
+
+- if (system_state == SYSTEM_BOOTING) {
++ if (!slab_is_available()) {
+ zone->wait_table = (wait_queue_head_t *)
+ alloc_bootmem_node(pgdat, alloc_size);
+ } else {
+@@ -3378,7 +3381,8 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
+ * is used by this zone for memmap. This affects the watermark
+ * and per-cpu initialisations
+ */
+- memmap_pages = (size * sizeof(struct page)) >> PAGE_SHIFT;
++ memmap_pages =
++ PAGE_ALIGN(size * sizeof(struct page)) >> PAGE_SHIFT;
+ if (realsize >= memmap_pages) {
+ realsize -= memmap_pages;
+ printk(KERN_DEBUG
+diff --git a/mm/swap.c b/mm/swap.c
+index 91e1944..45c9f25 100644
+--- a/mm/swap.c
++++ b/mm/swap.c
+@@ -503,7 +503,7 @@ void vm_acct_memory(long pages)
+ local = &__get_cpu_var(committed_space);
+ *local += pages;
+ if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) {
+- atomic_add(*local, &vm_committed_space);
++ atomic_long_add(*local, &vm_committed_space);
+ *local = 0;
+ }
+ preempt_enable();
+@@ -520,7 +520,7 @@ static int cpu_swap_callback(struct notifier_block *nfb,
+
+ committed = &per_cpu(committed_space, (long)hcpu);
+ if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
+- atomic_add(*committed, &vm_committed_space);
++ atomic_long_add(*committed, &vm_committed_space);
+ *committed = 0;
+ drain_cpu_pagevecs((long)hcpu);
+ }
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 2a739ad..5196130 100644
--- a/net/8021q/vlan.c
Modified: dists/trunk/linux-2.6/debian/patches/series/1~experimental.1
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 (original)
+++ dists/trunk/linux-2.6/debian/patches/series/1~experimental.1 Sun May 25 08:57:59 2008
@@ -1,4 +1,4 @@
-+ bugfix/all/patch-2.6.26-rc3-git5
++ bugfix/all/patch-2.6.26-rc3-git7
+ debian/version.patch
+ debian/kernelvariables.patch
+ debian/doc-build-parallel.patch
More information about the Kernel-svn-changes
mailing list