Merge branch 'irq' into release
authorLen Brown <len.brown@intel.com>
Fri, 24 Apr 2009 05:34:59 +0000 (01:34 -0400)
committerLen Brown <len.brown@intel.com>
Fri, 24 Apr 2009 05:34:59 +0000 (01:34 -0400)
160 files changed:
Documentation/filesystems/vfs.txt
Documentation/laptops/thinkpad-acpi.txt
Documentation/spi/spi-summary
MAINTAINERS
Makefile
arch/alpha/include/asm/percpu.h
arch/arm/kernel/sys_oabi-compat.c
arch/arm/mach-at91/at91rm9200_time.c
arch/arm/mach-at91/at91sam926x_time.c
arch/arm/mach-davinci/time.c
arch/arm/mach-imx/time.c
arch/arm/mach-ixp4xx/common.c
arch/arm/mach-msm/timer.c
arch/arm/mach-netx/time.c
arch/arm/mach-ns9xxx/time-ns9360.c
arch/arm/mach-omap1/time.c
arch/arm/mach-omap2/timer-gp.c
arch/arm/mach-pxa/time.c
arch/arm/mach-realview/core.c
arch/arm/mach-versatile/core.c
arch/arm/plat-mxc/time.c
arch/arm/plat-omap/common.c
arch/arm/plat-orion/time.c
arch/avr32/kernel/time.c
arch/blackfin/kernel/time-ts.c
arch/frv/mb93090-mb00/pci-vdk.c
arch/ia64/include/asm/paravirt_privop.h
arch/ia64/include/asm/smp.h
arch/ia64/kernel/cyclone.c
arch/ia64/kernel/smp.c
arch/ia64/kernel/time.c
arch/ia64/sn/kernel/sn2/timer.c
arch/m68knommu/platform/68328/timers.c
arch/m68knommu/platform/coldfire/dma_timer.c
arch/m68knommu/platform/coldfire/pit.c
arch/m68knommu/platform/coldfire/timers.c
arch/mips/kernel/cevt-txx9.c
arch/mips/kernel/csrc-bcm1480.c
arch/mips/kernel/csrc-ioasic.c
arch/mips/kernel/csrc-r4k.c
arch/mips/kernel/csrc-sb1250.c
arch/mips/kernel/i8253.c
arch/mips/nxp/pnx8550/common/time.c
arch/mips/sgi-ip27/ip27-timer.c
arch/powerpc/kernel/time.c
arch/s390/kernel/compat_linux.c
arch/s390/kernel/time.c
arch/sh/kernel/cpu/sh4a/setup-sh7722.c
arch/sh/kernel/cpu/sh4a/setup-sh7723.c
arch/sh/kernel/sys_sh.c
arch/sh/kernel/time_32.c
arch/sh/kernel/timers/timer-tmu.c
arch/sparc/kernel/sys_sparc32.c
arch/sparc/kernel/time_64.c
arch/um/Kconfig.rest
arch/um/kernel/time.c
arch/x86/ia32/sys_ia32.c
arch/x86/include/asm/desc.h
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/tlbflush.h
arch/x86/kernel/hpet.c
arch/x86/kernel/i8253.c
arch/x86/kernel/kvmclock.c
arch/x86/kernel/tsc.c
arch/x86/kernel/vmiclock_32.c
arch/x86/lguest/boot.c
arch/x86/xen/time.c
drivers/acpi/ec.c
drivers/acpi/thermal.c
drivers/acpi/video.c
drivers/base/dd.c
drivers/char/hpet.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/clocksource/acpi_pm.c
drivers/clocksource/cyclone.c
drivers/clocksource/scx200_hrt.c
drivers/clocksource/tcb_clksrc.c
drivers/edac/mpc85xx_edac.c
drivers/input/serio/hp_sdc.c
drivers/message/fusion/mptbase.c
drivers/misc/sgi-gru/grufile.c
drivers/misc/sgi-xp/xp_main.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/rtc/Kconfig
drivers/rtc/rtc-cmos.c
drivers/rtc/rtc-sh.c
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_wait_scan.c
drivers/serial/bfin_5xx.c
drivers/spi/pxa2xx_spi.c
drivers/staging/go7007/go7007-driver.c
drivers/staging/go7007/go7007-i2c.c
drivers/staging/go7007/go7007-priv.h
drivers/staging/go7007/go7007-usb.c
drivers/staging/go7007/s2250-board.c
drivers/staging/go7007/wis-i2c.h
drivers/staging/go7007/wis-ov7640.c
drivers/staging/go7007/wis-saa7113.c
drivers/staging/go7007/wis-saa7115.c
drivers/staging/go7007/wis-sony-tuner.c
drivers/staging/go7007/wis-tw2804.c
drivers/staging/go7007/wis-tw9903.c
drivers/staging/go7007/wis-uda1342.c
drivers/video/asiliantfb.c
drivers/video/pxafb.c
fs/autofs/dirhash.c
fs/autofs4/dev-ioctl.c
fs/btrfs/async-thread.c
fs/btrfs/async-thread.h
fs/btrfs/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/ordered-data.c
fs/btrfs/super.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/compat.c
fs/compat_ioctl.c
fs/dcache.c
fs/ecryptfs/miscdev.c
fs/filesystems.c
fs/gfs2/glops.c
fs/gfs2/ops_file.c
fs/hugetlbfs/inode.c
fs/namei.c
fs/namespace.c
fs/ncpfs/ioctl.c
fs/nfs/nfs3xdr.c
fs/nfsd/nfs4recover.c
fs/nfsd/vfs.c
fs/stat.c
fs/sysfs/bin.c
fs/xattr.c
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/linux-2.6/xfs_ioctl32.c
include/asm-generic/percpu.h
include/linux/clocksource.h
include/linux/device.h
include/linux/fs.h
include/linux/ipmi.h
include/linux/ipmi_msgdefs.h
include/linux/memcontrol.h
include/linux/percpu-defs.h [new file with mode: 0644]
include/linux/percpu.h
include/linux/reiserfs_fs_sb.h
include/linux/slow-work.h
include/linux/spi/spi.h
include/linux/syscalls.h
kernel/audit_tree.c
kernel/time/clocksource.c
kernel/time/jiffies.c
kernel/time/timekeeping.c
mm/vmscan.c
net/rds/rds.h

index deeeed0..f49eecf 100644 (file)
@@ -277,8 +277,7 @@ or bottom half).
   unfreeze_fs: called when VFS is unlocking a filesystem and making it writable
        again.
 
-  statfs: called when the VFS needs to get filesystem statistics. This
-       is called with the kernel lock held
+  statfs: called when the VFS needs to get filesystem statistics.
 
   remount_fs: called when the filesystem is remounted. This is called
        with the kernel lock held
index 3d76507..e7e9a69 100644 (file)
@@ -1,7 +1,7 @@
                     ThinkPad ACPI Extras Driver
 
-                            Version 0.22
-                        November 23rd,  2008
+                            Version 0.23
+                          April 10th, 2009
 
                Borislav Deianov <borislav@users.sf.net>
              Henrique de Moraes Holschuh <hmh@hmh.eng.br>
index 0f5122e..4a02d25 100644 (file)
@@ -511,10 +511,16 @@ SPI MASTER METHODS
        This sets up the device clock rate, SPI mode, and word sizes.
        Drivers may change the defaults provided by board_info, and then
        call spi_setup(spi) to invoke this routine.  It may sleep.
+
        Unless each SPI slave has its own configuration registers, don't
        change them right away ... otherwise drivers could corrupt I/O
        that's in progress for other SPI devices.
 
+               ** BUG ALERT:  for some reason the first version of
+               ** many spi_master drivers seems to get this wrong.
+               ** When you code setup(), ASSUME that the controller
+               ** is actively processing transfers for another device.
+
     master->transfer(struct spi_device *spi, struct spi_message *message)
        This must not sleep.  Its responsibility is arrange that the
        transfer happens and its complete() callback is issued.  The two
index 6baace3..cb95710 100644 (file)
@@ -2065,6 +2065,8 @@ F:        drivers/infiniband/hw/ehca/
 EMBEDDED LINUX
 P:     Paul Gortmaker
 M:     paul.gortmaker@windriver.com
+P:     Matt Mackall
+M:     mpm@selenic.com
 P:     David Woodhouse
 M:     dwmw2@infradead.org
 L:     linux-embedded@vger.kernel.org
@@ -2562,7 +2564,6 @@ F:        kernel/power/
 F:     include/linux/suspend.h
 F:     include/linux/freezer.h
 F:     include/linux/pm.h
-F:     include/asm-*/suspend*.h
 F:     arch/*/include/asm/suspend*.h
 
 HID CORE LAYER
@@ -3340,7 +3341,7 @@ P:        Eduard - Gabriel Munteanu
 M:     eduard.munteanu@linux360.ro
 L:     linux-kernel@vger.kernel.org
 S:     Maintained
-F:     Documentation/vm/kmemtrace.txt
+F:     Documentation/trace/kmemtrace.txt
 F:     include/trace/kmemtrace.h
 F:     kernel/trace/kmemtrace.c
 
@@ -5404,7 +5405,6 @@ F:        kernel/power/
 F:     include/linux/suspend.h
 F:     include/linux/freezer.h
 F:     include/linux/pm.h
-F:     include/asm-*/suspend.h
 
 SVGA HANDLING
 P:     Martin Mares
@@ -5638,7 +5638,7 @@ L:        uclinux-dev@uclinux.org  (subscribers-only)
 S:     Maintained
 F:     arch/m68knommu/
 
-UCLINUX FOR RENESAS H8/300
+UCLINUX FOR RENESAS H8/300 (H8300)
 P:     Yoshinori Sato
 M:     ysato@users.sourceforge.jp
 W:     http://uclinux-h8.sourceforge.jp/
index 6f4208f..9e5dc8f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 30
-EXTRAVERSION = -rc2
+EXTRAVERSION = -rc3
 NAME = Temporary Tasmanian Devil
 
 # *DOCUMENTATION*
index 3495e8e..e9e0bb5 100644 (file)
@@ -73,6 +73,6 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
 
 #endif /* SMP */
 
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)
+#include <asm-generic/percpu.h>
 
 #endif /* __ALPHA_PERCPU_H */
index e04173c..d59a0cd 100644 (file)
@@ -177,21 +177,12 @@ asmlinkage long sys_oabi_fstatat64(int dfd,
                                   int flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
+       int error;
 
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-       error = cp_oldabi_stat64(&stat, statbuf);
-
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_oldabi_stat64(&stat, statbuf);
 }
 
 struct oabi_flock64 {
index 1ff1bda..309f351 100644 (file)
@@ -85,7 +85,7 @@ static struct irqaction at91rm9200_timer_irq = {
        .handler        = at91rm9200_timer_interrupt
 };
 
-static cycle_t read_clk32k(void)
+static cycle_t read_clk32k(struct clocksource *cs)
 {
        return read_CRTR();
 }
index b63e1d5..4bd56ae 100644 (file)
@@ -31,7 +31,7 @@ static u32 pit_cnt;           /* access only w/system irq blocked */
  * Clocksource:  just a monotonic counter of MCK/16 cycles.
  * We don't care whether or not PIT irqs are enabled.
  */
-static cycle_t read_pit_clk(void)
+static cycle_t read_pit_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 elapsed;
index f8bcd29..6c227d4 100644 (file)
@@ -238,7 +238,7 @@ static void __init timer_init(void)
 /*
  * clocksource
  */
-static cycle_t read_cycles(void)
+static cycle_t read_cycles(struct clocksource *cs)
 {
        struct timer_s *t = &timers[TID_CLOCKSOURCE];
 
index aff0ebc..5aef18b 100644 (file)
@@ -73,7 +73,7 @@ static void __init imx_timer_hardware_init(void)
        IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN;
 }
 
-cycle_t imx_get_cycles(void)
+cycle_t imx_get_cycles(struct clocksource *cs)
 {
        return IMX_TCN(TIMER_BASE);
 }
index f4656d2..1e93dfe 100644 (file)
@@ -401,7 +401,7 @@ void __init ixp4xx_sys_init(void)
 /*
  * clocksource
  */
-cycle_t ixp4xx_get_cycles(void)
+cycle_t ixp4xx_get_cycles(struct clocksource *cs)
 {
        return *IXP4XX_OSTS;
 }
index 444d9c0..4855b8c 100644 (file)
@@ -57,12 +57,12 @@ static irqreturn_t msm_timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static cycle_t msm_gpt_read(void)
+static cycle_t msm_gpt_read(struct clocksource *cs)
 {
        return readl(MSM_GPT_BASE + TIMER_COUNT_VAL);
 }
 
-static cycle_t msm_dgt_read(void)
+static cycle_t msm_dgt_read(struct clocksource *cs)
 {
        return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT;
 }
index f201fdd..82801db 100644 (file)
@@ -104,7 +104,7 @@ static struct irqaction netx_timer_irq = {
        .handler        = netx_timer_interrupt,
 };
 
-cycle_t netx_get_cycles(void)
+cycle_t netx_get_cycles(struct clocksource *cs)
 {
        return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
 }
index 41df697..7728126 100644 (file)
@@ -25,7 +25,7 @@
 #define TIMER_CLOCKEVENT 1
 static u32 latch;
 
-static cycle_t ns9360_clocksource_read(void)
+static cycle_t ns9360_clocksource_read(struct clocksource *cs)
 {
        return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE));
 }
index 495a32c..4d56408 100644 (file)
@@ -198,7 +198,7 @@ static struct irqaction omap_mpu_timer2_irq = {
        .handler        = omap_mpu_timer2_interrupt,
 };
 
-static cycle_t mpu_read(void)
+static cycle_t mpu_read(struct clocksource *cs)
 {
        return ~omap_mpu_timer_read(1);
 }
index 9fc13a2..1cb2c09 100644 (file)
@@ -138,7 +138,7 @@ static inline void __init omap2_gp_clocksource_init(void) {}
  * clocksource
  */
 static struct omap_dm_timer *gpt_clocksource;
-static cycle_t clocksource_read_cycles(void)
+static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
        return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
 }
index 8eb3830..750c448 100644 (file)
@@ -125,7 +125,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = {
        .set_mode       = pxa_osmr0_set_mode,
 };
 
-static cycle_t pxa_read_oscr(void)
+static cycle_t pxa_read_oscr(struct clocksource *cs)
 {
        return OSCR;
 }
index 9ab947c..942e1a7 100644 (file)
@@ -715,7 +715,7 @@ static struct irqaction realview_timer_irq = {
        .handler        = realview_timer_interrupt,
 };
 
-static cycle_t realview_get_cycles(void)
+static cycle_t realview_get_cycles(struct clocksource *cs)
 {
        return ~readl(timer3_va_base + TIMER_VALUE);
 }
index 5657766..1f929c3 100644 (file)
@@ -948,7 +948,7 @@ static struct irqaction versatile_timer_irq = {
        .handler        = versatile_timer_interrupt,
 };
 
-static cycle_t versatile_get_cycles(void)
+static cycle_t versatile_get_cycles(struct clocksource *cs)
 {
        return ~readl(TIMER3_VA_BASE + TIMER_VALUE);
 }
index ef1b3cd..dab3357 100644 (file)
@@ -36,7 +36,7 @@ static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
 
 /* clock source */
 
-static cycle_t mxc_get_cycles(void)
+static cycle_t mxc_get_cycles(struct clocksource *cs)
 {
        return __raw_readl(TIMER_BASE + MXC_TCN);
 }
index d179714..433021f 100644 (file)
@@ -185,7 +185,7 @@ console_initcall(omap_add_serial_console);
 
 #include <linux/clocksource.h>
 
-static cycle_t omap_32k_read(void)
+static cycle_t omap_32k_read(struct clocksource *cs)
 {
        return omap_readl(TIMER_32K_SYNCHRONIZED);
 }
@@ -207,7 +207,7 @@ unsigned long long sched_clock(void)
 {
        unsigned long long ret;
 
-       ret = (unsigned long long)omap_32k_read();
+       ret = (unsigned long long)omap_32k_read(&clocksource_32k);
        ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift;
        return ret;
 }
index 6fa2923..2faf9db 100644 (file)
@@ -41,7 +41,7 @@ static u32 ticks_per_jiffy;
 /*
  * Clocksource handling.
  */
-static cycle_t orion_clksrc_read(void)
+static cycle_t orion_clksrc_read(struct clocksource *cs)
 {
        return 0xffffffff - readl(TIMER0_VAL);
 }
index 0ff46bf..f27aa3b 100644 (file)
@@ -18,7 +18,7 @@
 #include <mach/pm.h>
 
 
-static cycle_t read_cycle_count(void)
+static cycle_t read_cycle_count(struct clocksource *cs)
 {
        return (cycle_t)sysreg_read(COUNT);
 }
index 0ed2bad..2764612 100644 (file)
@@ -58,16 +58,11 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc)
        return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
 }
 
-static cycle_t read_cycles(void)
+static cycle_t read_cycles(struct clocksource *cs)
 {
        return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod);
 }
 
-unsigned long long sched_clock(void)
-{
-       return cycles_2_ns(read_cycles());
-}
-
 static struct clocksource clocksource_bfin = {
        .name           = "bfin_cycles",
        .rating         = 350,
@@ -77,6 +72,11 @@ static struct clocksource clocksource_bfin = {
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+unsigned long long sched_clock(void)
+{
+       return cycles_2_ns(read_cycles(&clocksource_bfin));
+}
+
 static int __init bfin_clocksource_init(void)
 {
        set_cyc2ns_scale(get_cclk() / 1000);
index 0f41c3a..c0dcec6 100644 (file)
@@ -31,6 +31,29 @@ struct pci_bus *__nongpreldata pci_root_bus;
 struct pci_ops *__nongpreldata pci_root_ops;
 
 /*
+ * The accessible PCI window does not cover the entire CPU address space, but
+ * there are devices we want to access outside of that window, so we need to
+ * insert specific PCI bus resources instead of using the platform-level bus
+ * resources directly for the PCI root bus.
+ *
+ * These are configured and inserted by pcibios_init() and are attached to the
+ * root bus by pcibios_fixup_bus().
+ */
+static struct resource pci_ioport_resource = {
+       .name   = "PCI IO",
+       .start  = 0,
+       .end    = IO_SPACE_LIMIT,
+       .flags  = IORESOURCE_IO,
+};
+
+static struct resource pci_iomem_resource = {
+       .name   = "PCI mem",
+       .start  = 0,
+       .end    = -1,
+       .flags  = IORESOURCE_MEM,
+};
+
+/*
  * Functions for accessing PCI configuration space
  */
 
@@ -304,6 +327,12 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
 #if 0
        printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
 #endif
+
+       if (bus->number == 0) {
+               bus->resource[0] = &pci_ioport_resource;
+               bus->resource[1] = &pci_iomem_resource;
+       }
+
        pci_read_bridge_bases(bus);
 
        if (bus->number == 0) {
@@ -350,28 +379,36 @@ int __init pcibios_init(void)
        /* enable PCI arbitration */
        __reg_MB86943_pci_arbiter       = MB86943_PCIARB_EN;
 
-       ioport_resource.start   = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00;
-       ioport_resource.end     = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff;
-       ioport_resource.end     += ioport_resource.start;
+       pci_ioport_resource.start       = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00;
+       pci_ioport_resource.end         = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff;
+       pci_ioport_resource.end         += pci_ioport_resource.start;
 
        printk("PCI IO window:  %08llx-%08llx\n",
-              (unsigned long long) ioport_resource.start,
-              (unsigned long long) ioport_resource.end);
+              (unsigned long long) pci_ioport_resource.start,
+              (unsigned long long) pci_ioport_resource.end);
 
-       iomem_resource.start    = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00;
+       pci_iomem_resource.start        = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00;
+       pci_iomem_resource.end          = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff;
+       pci_iomem_resource.end          += pci_iomem_resource.start;
 
-       /* Reserve somewhere to write to flush posted writes. */
-       iomem_resource.start += 0x400;
-
-       iomem_resource.end      = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff;
-       iomem_resource.end      += iomem_resource.start;
+       /* Reserve somewhere to write to flush posted writes.  This is used by
+        * __flush_PCI_writes() from asm/io.h to force the write FIFO in the
+        * CPU-PCI bridge to flush as this doesn't happen automatically when a
+        * read is performed on the MB93090 development kit motherboard.
+        */
+       pci_iomem_resource.start        += 0x400;
 
        printk("PCI MEM window: %08llx-%08llx\n",
-              (unsigned long long) iomem_resource.start,
-              (unsigned long long) iomem_resource.end);
+              (unsigned long long) pci_iomem_resource.start,
+              (unsigned long long) pci_iomem_resource.end);
        printk("PCI DMA memory: %08lx-%08lx\n",
               dma_coherent_mem_start, dma_coherent_mem_end);
 
+       if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0)
+               panic("Unable to insert PCI IOMEM resource\n");
+       if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0)
+               panic("Unable to insert PCI IOPORT resource\n");
+
        if (!pci_probe)
                return -ENXIO;
 
index 3d29511..8f6cb11 100644 (file)
@@ -445,7 +445,6 @@ paravirt_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
                register unsigned long ia64_intri_res asm ("r8");       \
                register unsigned long __reg asm ("r8") = (reg);        \
                                                                        \
-               BUILD_BUG_ON(!__builtin_constant_p(reg));               \
                asm volatile (paravirt_alt_bundle(__PARAVIRT_BR,        \
                                                  PARAVIRT_TYPE(GETREG) \
                                                  + (reg))              \
@@ -464,7 +463,6 @@ paravirt_set_rr0_to_rr4(unsigned long val0, unsigned long val1,
                register unsigned long ia64_clobber1 asm ("r8");        \
                register unsigned long ia64_clobber2 asm ("r9");        \
                                                                        \
-               BUILD_BUG_ON(!__builtin_constant_p(reg));               \
                asm volatile (paravirt_alt_bundle(__PARAVIRT_BR,        \
                                                  PARAVIRT_TYPE(SETREG) \
                                                  + (reg))              \
index 5984083..d217d1d 100644 (file)
@@ -58,7 +58,7 @@ extern struct smp_boot_data {
 extern char no_int_routing __devinitdata;
 
 extern cpumask_t cpu_core_map[NR_CPUS];
-DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
+DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
 extern int smp_num_siblings;
 extern void __iomem *ipi_base_addr;
 extern unsigned char smp_int_redirect;
index 790ef0d..71e3586 100644 (file)
@@ -21,7 +21,7 @@ void __init cyclone_setup(void)
 
 static void __iomem *cyclone_mc;
 
-static cycle_t read_cyclone(void)
+static cycle_t read_cyclone(struct clocksource *cs)
 {
        return (cycle_t)readq((void __iomem *)cyclone_mc);
 }
index 2ea4199..5230eaa 100644 (file)
@@ -225,6 +225,7 @@ smp_send_reschedule (int cpu)
 {
        platform_send_ipi(cpu, IA64_IPI_RESCHEDULE, IA64_IPI_DM_INT, 0);
 }
+EXPORT_SYMBOL_GPL(smp_send_reschedule);
 
 /*
  * Called with preemption disabled.
@@ -300,15 +301,12 @@ smp_flush_tlb_mm (struct mm_struct *mm)
                return;
        }
 
+       smp_call_function_mask(mm->cpu_vm_mask,
+               (void (*)(void *))local_finish_flush_tlb_mm, mm, 1);
+       local_irq_disable();
+       local_finish_flush_tlb_mm(mm);
+       local_irq_enable();
        preempt_enable();
-       /*
-        * We could optimize this further by using mm->cpu_vm_mask to track which CPUs
-        * have been running in the address space.  It's not clear that this is worth the
-        * trouble though: to avoid races, we have to raise the IPI on the target CPU
-        * anyhow, and once a CPU is interrupted, the cost of local_flush_tlb_all() is
-        * rather trivial.
-        */
-       on_each_cpu((void (*)(void *))local_finish_flush_tlb_mm, mm, 1);
 }
 
 void arch_send_call_function_single_ipi(int cpu)
index 641c8b6..604c1a3 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "fsyscall_gtod_data.h"
 
-static cycle_t itc_get_cycles(void);
+static cycle_t itc_get_cycles(struct clocksource *cs);
 
 struct fsyscall_gtod_data_t fsyscall_gtod_data = {
        .lock = SEQLOCK_UNLOCKED,
@@ -383,7 +383,7 @@ ia64_init_itm (void)
        }
 }
 
-static cycle_t itc_get_cycles(void)
+static cycle_t itc_get_cycles(struct clocksource *cs)
 {
        u64 lcycle, now, ret;
 
index cf67fc5..21d6f09 100644 (file)
@@ -23,7 +23,7 @@
 
 extern unsigned long sn_rtc_cycles_per_second;
 
-static cycle_t read_sn2(void)
+static cycle_t read_sn2(struct clocksource *cs)
 {
        return (cycle_t)readq(RTC_COUNTER_ADDR);
 }
index 6bafefa..309f725 100644 (file)
@@ -75,7 +75,7 @@ static struct irqaction m68328_timer_irq = {
 
 /***************************************************************************/
 
-static cycle_t m68328_read_clk(void)
+static cycle_t m68328_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index 772578b..a5f5628 100644 (file)
@@ -34,7 +34,7 @@
 #define DMA_DTMR_CLK_DIV_16    (2 << 1)
 #define DMA_DTMR_ENABLE                (1 << 0)
 
-static cycle_t cf_dt_get_cycles(void)
+static cycle_t cf_dt_get_cycles(struct clocksource *cs)
 {
        return __raw_readl(DTCN0);
 }
index 2a12e7f..61b9621 100644 (file)
@@ -125,7 +125,7 @@ static struct irqaction pit_irq = {
 
 /***************************************************************************/
 
-static cycle_t pit_read_clk(void)
+static cycle_t pit_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index 454f254..1ba8a37 100644 (file)
@@ -78,7 +78,7 @@ static struct irqaction mcftmr_timer_irq = {
 
 /***************************************************************************/
 
-static cycle_t mcftmr_read_clk(void)
+static cycle_t mcftmr_read_clk(struct clocksource *cs)
 {
        unsigned long flags;
        u32 cycles;
index eccf7d6..2e911e3 100644 (file)
@@ -22,7 +22,7 @@
 
 static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr;
 
-static cycle_t txx9_cs_read(void)
+static cycle_t txx9_cs_read(struct clocksource *cs)
 {
        return __raw_readl(&txx9_cs_tmrptr->trr);
 }
index 868745e..51489f8 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <asm/sibyte/sb1250.h>
 
-static cycle_t bcm1480_hpt_read(void)
+static cycle_t bcm1480_hpt_read(struct clocksource *cs)
 {
        return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT));
 }
index 1d5f63c..b551f48 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/dec/ioasic.h>
 #include <asm/dec/ioasic_addrs.h>
 
-static cycle_t dec_ioasic_hpt_read(void)
+static cycle_t dec_ioasic_hpt_read(struct clocksource *cs)
 {
        return ioasic_read(IO_REG_FCTR);
 }
@@ -47,13 +47,13 @@ void __init dec_ioasic_clocksource_init(void)
        while (!ds1287_timer_state())
                ;
 
-       start = dec_ioasic_hpt_read();
+       start = dec_ioasic_hpt_read(&clocksource_dec);
 
        while (i--)
                while (!ds1287_timer_state())
                        ;
 
-       end = dec_ioasic_hpt_read();
+       end = dec_ioasic_hpt_read(&clocksource_dec);
 
        freq = (end - start) * 10;
        printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq);
index f1a2893..e95a3cd 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <asm/time.h>
 
-static cycle_t c0_hpt_read(void)
+static cycle_t c0_hpt_read(struct clocksource *cs)
 {
        return read_c0_count();
 }
index 92212bb..d14d3d1 100644 (file)
@@ -33,7 +33,7 @@
  * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
  * again.
  */
-static cycle_t sb1250_hpt_read(void)
+static cycle_t sb1250_hpt_read(struct clocksource *cs)
 {
        unsigned int count;
 
index 689719e..ed20e7f 100644 (file)
@@ -128,7 +128,7 @@ void __init setup_pit_timer(void)
  * to just read by itself. So use jiffies to emulate a free
  * running counter:
  */
-static cycle_t pit_read(void)
+static cycle_t pit_read(struct clocksource *cs)
 {
        unsigned long flags;
        int count;
index cf293b2..8df43e9 100644 (file)
@@ -35,7 +35,7 @@
 
 static unsigned long cpj;
 
-static cycle_t hpt_read(void)
+static cycle_t hpt_read(struct clocksource *cs)
 {
        return read_c0_count2();
 }
index f024057..f10a7cd 100644 (file)
@@ -159,7 +159,7 @@ static void __init hub_rt_clock_event_global_init(void)
        setup_irq(irq, &hub_rt_irqaction);
 }
 
-static cycle_t hub_rt_read(void)
+static cycle_t hub_rt_read(struct clocksource *cs)
 {
        return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT);
 }
index 926ea86..48571ac 100644 (file)
@@ -77,7 +77,7 @@
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
 
-static cycle_t rtc_read(void);
+static cycle_t rtc_read(struct clocksource *);
 static struct clocksource clocksource_rtc = {
        .name         = "rtc",
        .rating       = 400,
@@ -88,7 +88,7 @@ static struct clocksource clocksource_rtc = {
        .read         = rtc_read,
 };
 
-static cycle_t timebase_read(void);
+static cycle_t timebase_read(struct clocksource *);
 static struct clocksource clocksource_timebase = {
        .name         = "timebase",
        .rating       = 400,
@@ -766,12 +766,12 @@ unsigned long read_persistent_clock(void)
 }
 
 /* clocksource code */
-static cycle_t rtc_read(void)
+static cycle_t rtc_read(struct clocksource *cs)
 {
        return (cycle_t)get_rtc();
 }
 
-static cycle_t timebase_read(void)
+static cycle_t timebase_read(struct clocksource *cs)
 {
        return (cycle_t)get_tb();
 }
index 6cc87d8..002c70d 100644 (file)
@@ -702,20 +702,12 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
                                struct stat64_emu31 __user* statbuf, int flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
-
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_stat64(statbuf, &stat);
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_stat64(statbuf, &stat);
 }
 
 /*
index 6ded50d..ef596d0 100644 (file)
@@ -201,7 +201,7 @@ unsigned long read_persistent_clock(void)
        return ts.tv_sec;
 }
 
-static cycle_t read_tod_clock(void)
+static cycle_t read_tod_clock(struct clocksource *cs)
 {
        return get_clock();
 }
index 0e5d204..406747f 100644 (file)
@@ -256,7 +256,6 @@ static int __init sh7722_devices_setup(void)
 {
        clk_always_enable("uram0"); /* URAM */
        clk_always_enable("xymem0"); /* XYMEM */
-       clk_always_enable("rtc0"); /* RTC */
        clk_always_enable("veu0"); /* VEU */
        clk_always_enable("vpu0"); /* VPU */
        clk_always_enable("jpu0"); /* JPU */
index 5338dac..a800466 100644 (file)
@@ -267,7 +267,6 @@ static struct platform_device *sh7723_devices[] __initdata = {
 static int __init sh7723_devices_setup(void)
 {
        clk_always_enable("meram0"); /* MERAM */
-       clk_always_enable("rtc0"); /* RTC */
        clk_always_enable("veu1"); /* VEU2H1 */
        clk_always_enable("veu0"); /* VEU2H0 */
        clk_always_enable("vpu0"); /* VPU */
index 58dfc02..e3a7e36 100644 (file)
@@ -63,6 +63,15 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
        unsigned long prot, unsigned long flags,
        unsigned long fd, unsigned long pgoff)
 {
+       /*
+        * The shift for mmap2 is constant, regardless of PAGE_SIZE
+        * setting.
+        */
+       if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
+               return -EINVAL;
+
+       pgoff >>= PAGE_SHIFT - 12;
+
        return do_mmap2(addr, len, prot, flags, fd, pgoff);
 }
 
index c34e1e0..1700d24 100644 (file)
@@ -208,7 +208,7 @@ unsigned long long sched_clock(void)
        if (!clocksource_sh.rating)
                return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ);
 
-       cycles = clocksource_sh.read();
+       cycles = clocksource_sh.read(&clocksource_sh);
        return cyc2ns(&clocksource_sh, cycles);
 }
 #endif
index c5d3396..fe8d893 100644 (file)
@@ -81,7 +81,7 @@ static int tmu_timer_stop(void)
  */
 static int tmus_are_scaled;
 
-static cycle_t tmu_timer_read(void)
+static cycle_t tmu_timer_read(struct clocksource *cs)
 {
        return ((cycle_t)(~_tmu_read(TMU1)))<<tmus_are_scaled;
 }
index e800503..f5000a4 100644 (file)
@@ -206,21 +206,12 @@ asmlinkage long compat_sys_fstatat64(unsigned int dfd, char __user *filename,
                struct compat_stat64 __user * statbuf, int flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
-
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-               error = cp_compat_stat64(&stat, statbuf);
+       int error;
 
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_compat_stat64(&stat, statbuf);
 }
 
 asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
index db310aa..5c12e79 100644 (file)
@@ -814,6 +814,11 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
+static cycle_t clocksource_tick_read(struct clocksource *cs)
+{
+       return tick_ops->get_tick();
+}
+
 void __init time_init(void)
 {
        unsigned long freq = sparc64_init_timers();
@@ -827,7 +832,7 @@ void __init time_init(void)
        clocksource_tick.mult =
                clocksource_hz2mult(freq,
                                    clocksource_tick.shift);
-       clocksource_tick.read = tick_ops->get_tick;
+       clocksource_tick.read = clocksource_tick_read;
 
        printk("clocksource: mult[%x] shift[%d]\n",
               clocksource_tick.mult, clocksource_tick.shift);
index 7b5cea7..0ccad0f 100644 (file)
@@ -36,7 +36,7 @@ source "drivers/leds/Kconfig"
 
 #This is just to shut up some Kconfig warnings, so no prompt.
 config INPUT
-       bool
+       tristate
        default n
 
 source "arch/um/Kconfig.debug"
index b13a87a..c8b9c46 100644 (file)
@@ -65,7 +65,7 @@ static irqreturn_t um_timer(int irq, void *dev)
        return IRQ_HANDLED;
 }
 
-static cycle_t itimer_read(void)
+static cycle_t itimer_read(struct clocksource *cs)
 {
        return os_nsecs() / 1000;
 }
index efac92f..085a8c3 100644 (file)
@@ -129,21 +129,12 @@ asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename,
                              struct stat64 __user *statbuf, int flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
+       int error;
 
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-               error = cp_stat64(statbuf, &stat);
-
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_stat64(statbuf, &stat);
 }
 
 /*
index 5623c50..c45f415 100644 (file)
@@ -37,7 +37,7 @@ extern gate_desc idt_table[];
 struct gdt_page {
        struct desc_struct gdt[GDT_ENTRIES];
 } __attribute__((aligned(PAGE_SIZE)));
-DECLARE_PER_CPU(struct gdt_page, gdt_page);
+DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
 
 static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
 {
index 039db6a..37555e5 100644 (file)
@@ -26,7 +26,7 @@ typedef struct {
 #endif
 } ____cacheline_aligned irq_cpustat_t;
 
-DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
+DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 /* We can have at most NR_VECTORS irqs routed to a cpu at a time */
 #define MAX_HARDIRQS_PER_CPU NR_VECTORS
index fcf4d92..c2cceae 100644 (file)
@@ -138,7 +138,7 @@ extern struct tss_struct    doublefault_tss;
 extern __u32                   cleared_cpu_caps[NCAPINTS];
 
 #ifdef CONFIG_SMP
-DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
+DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
 #define cpu_data(cpu)          per_cpu(cpu_info, cpu)
 #define current_cpu_data       __get_cpu_var(cpu_info)
 #else
@@ -270,7 +270,7 @@ struct tss_struct {
 
 } ____cacheline_aligned;
 
-DECLARE_PER_CPU(struct tss_struct, init_tss);
+DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss);
 
 /*
  * Save the original ist values for checking stack pointers during debugging
@@ -393,7 +393,7 @@ union irq_stack_union {
        };
 };
 
-DECLARE_PER_CPU(union irq_stack_union, irq_stack_union);
+DECLARE_PER_CPU_FIRST(union irq_stack_union, irq_stack_union);
 DECLARE_INIT_PER_CPU(irq_stack_union);
 
 DECLARE_PER_CPU(char *, irq_stack_ptr);
index d3539f9..16a5c84 100644 (file)
@@ -152,7 +152,7 @@ struct tlb_state {
        struct mm_struct *active_mm;
        int state;
 };
-DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
+DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate);
 
 static inline void reset_lazy_tlbstate(void)
 {
index 648b3a2..3f0019e 100644 (file)
@@ -722,7 +722,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n,
 /*
  * Clock source related code
  */
-static cycle_t read_hpet(void)
+static cycle_t read_hpet(struct clocksource *cs)
 {
        return (cycle_t)hpet_readl(HPET_COUNTER);
 }
@@ -756,7 +756,7 @@ static int hpet_clocksource_register(void)
        hpet_restart_counter();
 
        /* Verify whether hpet counter works */
-       t1 = read_hpet();
+       t1 = hpet_readl(HPET_COUNTER);
        rdtscll(start);
 
        /*
@@ -770,7 +770,7 @@ static int hpet_clocksource_register(void)
                rdtscll(now);
        } while ((now - start) < 200000UL);
 
-       if (t1 == read_hpet()) {
+       if (t1 == hpet_readl(HPET_COUNTER)) {
                printk(KERN_WARNING
                       "HPET counter not counting. HPET disabled\n");
                return -ENODEV;
index 3475440..c2e0bb0 100644 (file)
@@ -129,7 +129,7 @@ void __init setup_pit_timer(void)
  * to just read by itself. So use jiffies to emulate a free
  * running counter:
  */
-static cycle_t pit_read(void)
+static cycle_t pit_read(struct clocksource *cs)
 {
        static int old_count;
        static u32 old_jifs;
index 137f2e8..223af43 100644 (file)
@@ -77,6 +77,11 @@ static cycle_t kvm_clock_read(void)
        return ret;
 }
 
+static cycle_t kvm_clock_get_cycles(struct clocksource *cs)
+{
+       return kvm_clock_read();
+}
+
 /*
  * If we don't do that, there is the possibility that the guest
  * will calibrate under heavy load - thus, getting a lower lpj -
@@ -107,7 +112,7 @@ static void kvm_get_preset_lpj(void)
 
 static struct clocksource kvm_clock = {
        .name = "kvm-clock",
-       .read = kvm_clock_read,
+       .read = kvm_clock_get_cycles,
        .rating = 400,
        .mask = CLOCKSOURCE_MASK(64),
        .mult = 1 << KVM_SCALE,
index 7a567eb..d57de05 100644 (file)
@@ -699,7 +699,7 @@ static struct clocksource clocksource_tsc;
  * code, which is necessary to support wrapping clocksources like pm
  * timer.
  */
-static cycle_t read_tsc(void)
+static cycle_t read_tsc(struct clocksource *cs)
 {
        cycle_t ret = (cycle_t)get_cycles();
 
index d303369..2b3eb82 100644 (file)
@@ -283,7 +283,7 @@ void __devinit vmi_time_ap_init(void)
 /** vmi clocksource */
 static struct clocksource clocksource_vmi;
 
-static cycle_t read_real_cycles(void)
+static cycle_t read_real_cycles(struct clocksource *cs)
 {
        cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
        return max(ret, clocksource_vmi.cycle_last);
index a208536..ca7ec44 100644 (file)
@@ -663,7 +663,7 @@ static unsigned long lguest_tsc_khz(void)
 
 /* If we can't use the TSC, the kernel falls back to our lower-priority
  * "lguest_clock", where we read the time value given to us by the Host. */
-static cycle_t lguest_clock_read(void)
+static cycle_t lguest_clock_read(struct clocksource *cs)
 {
        unsigned long sec, nsec;
 
index 14f2406..0a5aa44 100644 (file)
@@ -213,6 +213,11 @@ cycle_t xen_clocksource_read(void)
        return ret;
 }
 
+static cycle_t xen_clocksource_get_cycles(struct clocksource *cs)
+{
+       return xen_clocksource_read();
+}
+
 static void xen_read_wallclock(struct timespec *ts)
 {
        struct shared_info *s = HYPERVISOR_shared_info;
@@ -241,7 +246,7 @@ int xen_set_wallclock(unsigned long now)
 static struct clocksource xen_clocksource __read_mostly = {
        .name = "xen",
        .rating = 400,
-       .read = xen_clocksource_read,
+       .read = xen_clocksource_get_cycles,
        .mask = ~0,
        .mult = 1<<XEN_SHIFT,           /* time directly in nanoseconds */
        .shift = XEN_SHIFT,
index 04e9044..391f331 100644 (file)
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device)
        struct acpi_ec *ec = acpi_driver_data(device);
        /* Enable use of GPE back */
        clear_bit(EC_FLAGS_NO_GPE, &ec->flags);
+       set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
        acpi_enable_gpe(NULL, ec->gpe);
        return 0;
 }
index 9cd15e8..564ea14 100644 (file)
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
                        thermal_zone_device_register("acpitz", trips, tz,
                                                     &acpi_thermal_zone_ops,
                                                     0, 0, 0,
-                                                    tz->polling_frequency);
+                                                    tz->polling_frequency*100);
        if (IS_ERR(tz->thermal_zone))
                return -ENODEV;
 
index cd4fb75..21968ae 100644 (file)
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device)
         * In this case, the first two elements in _BCL packages
         * are also supported brightness levels that OS should take care of.
         */
-       for (i = 2; i < count; i++)
-               if (br->levels[i] == br->levels[0] ||
-                   br->levels[i] == br->levels[1])
+       for (i = 2; i < count; i++) {
+               if (br->levels[i] == br->levels[0])
                        level_ac_battery++;
+               if (br->levels[i] == br->levels[1])
+                       level_ac_battery++;
+       }
 
        if (level_ac_battery < 2) {
                level_ac_battery = 2 - level_ac_battery;
index f17c326..742cbe6 100644 (file)
@@ -179,6 +179,7 @@ void wait_for_device_probe(void)
        wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
        async_synchronize_full();
 }
+EXPORT_SYMBOL_GPL(wait_for_device_probe);
 
 /**
  * driver_probe_device - attempt to bind device & driver together
index 50dfa3b..340ba4f 100644 (file)
@@ -72,7 +72,7 @@ static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ;
 #ifdef CONFIG_IA64
 static void __iomem *hpet_mctr;
 
-static cycle_t read_hpet(void)
+static cycle_t read_hpet(struct clocksource *cs)
 {
        return (cycle_t)read_counter((void __iomem *)hpet_mctr);
 }
index e93fc8d..aa83a08 100644 (file)
@@ -285,6 +285,11 @@ enum ipmi_stat_indexes {
        /* Events that were received with the proper format. */
        IPMI_STAT_events,
 
+       /* Retransmissions on IPMB that failed. */
+       IPMI_STAT_dropped_rexmit_ipmb_commands,
+
+       /* Retransmissions on LAN that failed. */
+       IPMI_STAT_dropped_rexmit_lan_commands,
 
        /* This *must* remain last, add new values above this. */
        IPMI_NUM_STATS
@@ -445,6 +450,20 @@ static DEFINE_MUTEX(smi_watchers_mutex);
 #define ipmi_get_stat(intf, stat) \
        ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat]))
 
+static int is_lan_addr(struct ipmi_addr *addr)
+{
+       return addr->addr_type == IPMI_LAN_ADDR_TYPE;
+}
+
+static int is_ipmb_addr(struct ipmi_addr *addr)
+{
+       return addr->addr_type == IPMI_IPMB_ADDR_TYPE;
+}
+
+static int is_ipmb_bcast_addr(struct ipmi_addr *addr)
+{
+       return addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE;
+}
 
 static void free_recv_msg_list(struct list_head *q)
 {
@@ -601,8 +620,7 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2)
                return (smi_addr1->lun == smi_addr2->lun);
        }
 
-       if ((addr1->addr_type == IPMI_IPMB_ADDR_TYPE)
-           || (addr1->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) {
+       if (is_ipmb_addr(addr1) || is_ipmb_bcast_addr(addr1)) {
                struct ipmi_ipmb_addr *ipmb_addr1
                    = (struct ipmi_ipmb_addr *) addr1;
                struct ipmi_ipmb_addr *ipmb_addr2
@@ -612,7 +630,7 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2)
                        && (ipmb_addr1->lun == ipmb_addr2->lun));
        }
 
-       if (addr1->addr_type == IPMI_LAN_ADDR_TYPE) {
+       if (is_lan_addr(addr1)) {
                struct ipmi_lan_addr *lan_addr1
                        = (struct ipmi_lan_addr *) addr1;
                struct ipmi_lan_addr *lan_addr2
@@ -644,14 +662,13 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len)
            || (addr->channel < 0))
                return -EINVAL;
 
-       if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE)
-           || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) {
+       if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) {
                if (len < sizeof(struct ipmi_ipmb_addr))
                        return -EINVAL;
                return 0;
        }
 
-       if (addr->addr_type == IPMI_LAN_ADDR_TYPE) {
+       if (is_lan_addr(addr)) {
                if (len < sizeof(struct ipmi_lan_addr))
                        return -EINVAL;
                return 0;
@@ -1503,8 +1520,7 @@ static int i_ipmi_request(ipmi_user_t          user,
                        memcpy(&(smi_msg->data[2]), msg->data, msg->data_len);
                smi_msg->data_size = msg->data_len + 2;
                ipmi_inc_stat(intf, sent_local_commands);
-       } else if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE)
-                  || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) {
+       } else if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) {
                struct ipmi_ipmb_addr *ipmb_addr;
                unsigned char         ipmb_seq;
                long                  seqid;
@@ -1583,8 +1599,6 @@ static int i_ipmi_request(ipmi_user_t          user,
 
                        spin_lock_irqsave(&(intf->seq_lock), flags);
 
-                       ipmi_inc_stat(intf, sent_ipmb_commands);
-
                        /*
                         * Create a sequence number with a 1 second
                         * timeout and 4 retries.
@@ -1606,6 +1620,8 @@ static int i_ipmi_request(ipmi_user_t          user,
                                goto out_err;
                        }
 
+                       ipmi_inc_stat(intf, sent_ipmb_commands);
+
                        /*
                         * Store the sequence number in the message,
                         * so that when the send message response
@@ -1635,7 +1651,7 @@ static int i_ipmi_request(ipmi_user_t          user,
                         */
                        spin_unlock_irqrestore(&(intf->seq_lock), flags);
                }
-       } else if (addr->addr_type == IPMI_LAN_ADDR_TYPE) {
+       } else if (is_lan_addr(addr)) {
                struct ipmi_lan_addr  *lan_addr;
                unsigned char         ipmb_seq;
                long                  seqid;
@@ -1696,8 +1712,6 @@ static int i_ipmi_request(ipmi_user_t          user,
 
                        spin_lock_irqsave(&(intf->seq_lock), flags);
 
-                       ipmi_inc_stat(intf, sent_lan_commands);
-
                        /*
                         * Create a sequence number with a 1 second
                         * timeout and 4 retries.
@@ -1719,6 +1733,8 @@ static int i_ipmi_request(ipmi_user_t          user,
                                goto out_err;
                        }
 
+                       ipmi_inc_stat(intf, sent_lan_commands);
+
                        /*
                         * Store the sequence number in the message,
                         * so that when the send message response
@@ -1937,6 +1953,10 @@ static int stat_file_read_proc(char *page, char **start, off_t off,
                       ipmi_get_stat(intf, invalid_events));
        out += sprintf(out, "events:                      %u\n",
                       ipmi_get_stat(intf, events));
+       out += sprintf(out, "failed rexmit LAN msgs:      %u\n",
+                      ipmi_get_stat(intf, dropped_rexmit_lan_commands));
+       out += sprintf(out, "failed rexmit IPMB msgs:     %u\n",
+                      ipmi_get_stat(intf, dropped_rexmit_ipmb_commands));
 
        return (out - ((char *) page));
 }
@@ -3264,6 +3284,114 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t          intf,
        return rv;
 }
 
+/*
+ * This routine will handle "Get Message" command responses with
+ * channels that use an OEM Medium. The message format belongs to
+ * the OEM.  See IPMI 2.0 specification, Chapter 6 and
+ * Chapter 22, sections 22.6 and 22.24 for more details.
+ */
+static int handle_oem_get_msg_cmd(ipmi_smi_t          intf,
+                                 struct ipmi_smi_msg *msg)
+{
+       struct cmd_rcvr       *rcvr;
+       int                   rv = 0;
+       unsigned char         netfn;
+       unsigned char         cmd;
+       unsigned char         chan;
+       ipmi_user_t           user = NULL;
+       struct ipmi_system_interface_addr *smi_addr;
+       struct ipmi_recv_msg  *recv_msg;
+
+       /*
+        * We expect the OEM SW to perform error checking
+        * so we just do some basic sanity checks
+        */
+       if (msg->rsp_size < 4) {
+               /* Message not big enough, just ignore it. */
+               ipmi_inc_stat(intf, invalid_commands);
+               return 0;
+       }
+
+       if (msg->rsp[2] != 0) {
+               /* An error getting the response, just ignore it. */
+               return 0;
+       }
+
+       /*
+        * This is an OEM Message so the OEM needs to know how
+        * handle the message. We do no interpretation.
+        */
+       netfn = msg->rsp[0] >> 2;
+       cmd = msg->rsp[1];
+       chan = msg->rsp[3] & 0xf;
+
+       rcu_read_lock();
+       rcvr = find_cmd_rcvr(intf, netfn, cmd, chan);
+       if (rcvr) {
+               user = rcvr->user;
+               kref_get(&user->refcount);
+       } else
+               user = NULL;
+       rcu_read_unlock();
+
+       if (user == NULL) {
+               /* We didn't find a user, just give up. */
+               ipmi_inc_stat(intf, unhandled_commands);
+
+               /*
+                * Don't do anything with these messages, just allow
+                * them to be freed.
+                */
+
+               rv = 0;
+       } else {
+               /* Deliver the message to the user. */
+               ipmi_inc_stat(intf, handled_commands);
+
+               recv_msg = ipmi_alloc_recv_msg();
+               if (!recv_msg) {
+                       /*
+                        * We couldn't allocate memory for the
+                        * message, so requeue it for handling
+                        * later.
+                        */
+                       rv = 1;
+                       kref_put(&user->refcount, free_user);
+               } else {
+                       /*
+                        * OEM Messages are expected to be delivered via
+                        * the system interface to SMS software.  We might
+                        * need to visit this again depending on OEM
+                        * requirements
+                        */
+                       smi_addr = ((struct ipmi_system_interface_addr *)
+                                   &(recv_msg->addr));
+                       smi_addr->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
+                       smi_addr->channel = IPMI_BMC_CHANNEL;
+                       smi_addr->lun = msg->rsp[0] & 3;
+
+                       recv_msg->user = user;
+                       recv_msg->user_msg_data = NULL;
+                       recv_msg->recv_type = IPMI_OEM_RECV_TYPE;
+                       recv_msg->msg.netfn = msg->rsp[0] >> 2;
+                       recv_msg->msg.cmd = msg->rsp[1];
+                       recv_msg->msg.data = recv_msg->msg_data;
+
+                       /*
+                        * The message starts at byte 4 which follows the
+                        * the Channel Byte in the "GET MESSAGE" command
+                        */
+                       recv_msg->msg.data_len = msg->rsp_size - 4;
+                       memcpy(recv_msg->msg_data,
+                              &(msg->rsp[4]),
+                              msg->rsp_size - 4);
+                       deliver_response(recv_msg);
+               }
+       }
+
+       return rv;
+}
+
 static void copy_event_into_recv_msg(struct ipmi_recv_msg *recv_msg,
                                     struct ipmi_smi_msg  *msg)
 {
@@ -3519,6 +3647,17 @@ static int handle_new_recv_msg(ipmi_smi_t          intf,
                        goto out;
                }
 
+               /*
+               ** We need to make sure the channels have been initialized.
+               ** The channel_handler routine will set the "curr_channel"
+               ** equal to or greater than IPMI_MAX_CHANNELS when all the
+               ** channels for this interface have been initialized.
+               */
+               if (intf->curr_channel < IPMI_MAX_CHANNELS) {
+                       requeue = 1;     /* Just put the message back for now */
+                       goto out;
+               }
+
                switch (intf->channels[chan].medium) {
                case IPMI_CHANNEL_MEDIUM_IPMB:
                        if (msg->rsp[4] & 0x04) {
@@ -3554,11 +3693,20 @@ static int handle_new_recv_msg(ipmi_smi_t          intf,
                        break;
 
                default:
-                       /*
-                        * We don't handle the channel type, so just
-                        * free the message.
-                        */
-                       requeue = 0;
+                       /* Check for OEM Channels.  Clients had better
+                          register for these commands. */
+                       if ((intf->channels[chan].medium
+                            >= IPMI_CHANNEL_MEDIUM_OEM_MIN)
+                           && (intf->channels[chan].medium
+                               <= IPMI_CHANNEL_MEDIUM_OEM_MAX)) {
+                               requeue = handle_oem_get_msg_cmd(intf, msg);
+                       } else {
+                               /*
+                                * We don't handle the channel type, so just
+                                * free the message.
+                                */
+                               requeue = 0;
+                       }
                }
 
        } else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2))
@@ -3730,7 +3878,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
                list_add_tail(&msg->link, timeouts);
                if (ent->broadcast)
                        ipmi_inc_stat(intf, timed_out_ipmb_broadcasts);
-               else if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE)
+               else if (is_lan_addr(&ent->recv_msg->addr))
                        ipmi_inc_stat(intf, timed_out_lan_commands);
                else
                        ipmi_inc_stat(intf, timed_out_ipmb_commands);
@@ -3744,15 +3892,17 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
                 */
                ent->timeout = MAX_MSG_TIMEOUT;
                ent->retries_left--;
-               if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE)
-                       ipmi_inc_stat(intf, retransmitted_lan_commands);
-               else
-                       ipmi_inc_stat(intf, retransmitted_ipmb_commands);
-
                smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot,
                                            ent->seqid);
-               if (!smi_msg)
+               if (!smi_msg) {
+                       if (is_lan_addr(&ent->recv_msg->addr))
+                               ipmi_inc_stat(intf,
+                                             dropped_rexmit_lan_commands);
+                       else
+                               ipmi_inc_stat(intf,
+                                             dropped_rexmit_ipmb_commands);
                        return;
+               }
 
                spin_unlock_irqrestore(&intf->seq_lock, *flags);
 
@@ -3764,10 +3914,17 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
                 * resent.
                 */
                handlers = intf->handlers;
-               if (handlers)
+               if (handlers) {
+                       if (is_lan_addr(&ent->recv_msg->addr))
+                               ipmi_inc_stat(intf,
+                                             retransmitted_lan_commands);
+                       else
+                               ipmi_inc_stat(intf,
+                                             retransmitted_ipmb_commands);
+
                        intf->handlers->sender(intf->send_info,
                                               smi_msg, 0);
-               else
+               else
                        ipmi_free_smi_msg(smi_msg);
 
                spin_lock_irqsave(&intf->seq_lock, *flags);
index e58ea4c..2596446 100644 (file)
 #define SI_SHORT_TIMEOUT_USEC  250 /* .25ms when the SM request a
                                      short timeout */
 
-/* Bit for BMC global enables. */
-#define IPMI_BMC_RCV_MSG_INTR     0x01
-#define IPMI_BMC_EVT_MSG_INTR     0x02
-#define IPMI_BMC_EVT_MSG_BUFF     0x04
-#define IPMI_BMC_SYS_LOG          0x08
-
 enum si_intf_state {
        SI_NORMAL,
        SI_GETTING_FLAGS,
@@ -220,6 +214,9 @@ struct smi_info {
                             OEM2_DATA_AVAIL)
        unsigned char       msg_flags;
 
+       /* Does the BMC have an event buffer? */
+       char                has_event_buffer;
+
        /*
         * If set to true, this will request events the next time the
         * state machine is idle.
@@ -968,7 +965,8 @@ static void request_events(void *send_info)
 {
        struct smi_info *smi_info = send_info;
 
-       if (atomic_read(&smi_info->stop_operation))
+       if (atomic_read(&smi_info->stop_operation) ||
+                               !smi_info->has_event_buffer)
                return;
 
        atomic_set(&smi_info->req_events, 1);
@@ -2407,26 +2405,9 @@ static struct of_platform_driver ipmi_of_platform_driver = {
 };
 #endif /* CONFIG_PPC_OF */
 
-
-static int try_get_dev_id(struct smi_info *smi_info)
+static int wait_for_msg_done(struct smi_info *smi_info)
 {
-       unsigned char         msg[2];
-       unsigned char         *resp;
-       unsigned long         resp_len;
        enum si_sm_result     smi_result;
-       int                   rv = 0;
-
-       resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
-       if (!resp)
-               return -ENOMEM;
-
-       /*
-        * Do a Get Device ID command, since it comes back with some
-        * useful info.
-        */
-       msg[0] = IPMI_NETFN_APP_REQUEST << 2;
-       msg[1] = IPMI_GET_DEVICE_ID_CMD;
-       smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
 
        smi_result = smi_info->handlers->event(smi_info->si_sm, 0);
        for (;;) {
@@ -2441,16 +2422,39 @@ static int try_get_dev_id(struct smi_info *smi_info)
                } else
                        break;
        }
-       if (smi_result == SI_SM_HOSED) {
+       if (smi_result == SI_SM_HOSED)
                /*
                 * We couldn't get the state machine to run, so whatever's at
                 * the port is probably not an IPMI SMI interface.
                 */
-               rv = -ENODEV;
+               return -ENODEV;
+
+       return 0;
+}
+
+static int try_get_dev_id(struct smi_info *smi_info)
+{
+       unsigned char         msg[2];
+       unsigned char         *resp;
+       unsigned long         resp_len;
+       int                   rv = 0;
+
+       resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
+       if (!resp)
+               return -ENOMEM;
+
+       /*
+        * Do a Get Device ID command, since it comes back with some
+        * useful info.
+        */
+       msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+       msg[1] = IPMI_GET_DEVICE_ID_CMD;
+       smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
+
+       rv = wait_for_msg_done(smi_info);
+       if (rv)
                goto out;
-       }
 
-       /* Otherwise, we got some data. */
        resp_len = smi_info->handlers->get_result(smi_info->si_sm,
                                                  resp, IPMI_MAX_MSG_LENGTH);
 
@@ -2462,6 +2466,88 @@ static int try_get_dev_id(struct smi_info *smi_info)
        return rv;
 }
 
+static int try_enable_event_buffer(struct smi_info *smi_info)
+{
+       unsigned char         msg[3];
+       unsigned char         *resp;
+       unsigned long         resp_len;
+       int                   rv = 0;
+
+       resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
+       if (!resp)
+               return -ENOMEM;
+
+       msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+       msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD;
+       smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
+
+       rv = wait_for_msg_done(smi_info);
+       if (rv) {
+               printk(KERN_WARNING
+                      "ipmi_si: Error getting response from get global,"
+                      " enables command, the event buffer is not"
+                      " enabled.\n");
+               goto out;
+       }
+
+       resp_len = smi_info->handlers->get_result(smi_info->si_sm,
+                                                 resp, IPMI_MAX_MSG_LENGTH);
+
+       if (resp_len < 4 ||
+                       resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
+                       resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD   ||
+                       resp[2] != 0) {
+               printk(KERN_WARNING
+                      "ipmi_si: Invalid return from get global"
+                      " enables command, cannot enable the event"
+                      " buffer.\n");
+               rv = -EINVAL;
+               goto out;
+       }
+
+       if (resp[3] & IPMI_BMC_EVT_MSG_BUFF)
+               /* buffer is already enabled, nothing to do. */
+               goto out;
+
+       msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+       msg[1] = IPMI_SET_BMC_GLOBAL_ENABLES_CMD;
+       msg[2] = resp[3] | IPMI_BMC_EVT_MSG_BUFF;
+       smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3);
+
+       rv = wait_for_msg_done(smi_info);
+       if (rv) {
+               printk(KERN_WARNING
+                      "ipmi_si: Error getting response from set global,"
+                      " enables command, the event buffer is not"
+                      " enabled.\n");
+               goto out;
+       }
+
+       resp_len = smi_info->handlers->get_result(smi_info->si_sm,
+                                                 resp, IPMI_MAX_MSG_LENGTH);
+
+       if (resp_len < 3 ||
+                       resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
+                       resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) {
+               printk(KERN_WARNING
+                      "ipmi_si: Invalid return from get global,"
+                      "enables command, not enable the event"
+                      " buffer.\n");
+               rv = -EINVAL;
+               goto out;
+       }
+
+       if (resp[2] != 0)
+               /*
+                * An error when setting the event buffer bit means
+                * that the event buffer is not supported.
+                */
+               rv = -ENOENT;
+ out:
+       kfree(resp);
+       return rv;
+}
+
 static int type_file_read_proc(char *page, char **start, off_t off,
                               int count, int *eof, void *data)
 {
@@ -2847,6 +2933,10 @@ static int try_smi_init(struct smi_info *new_smi)
        new_smi->intf_num = smi_num;
        smi_num++;
 
+       rv = try_enable_event_buffer(new_smi);
+       if (rv == 0)
+               new_smi->has_event_buffer = 1;
+
        /*
         * Start clearing the flags before we enable interrupts or the
         * timer to avoid racing with the timer.
@@ -2863,7 +2953,7 @@ static int try_smi_init(struct smi_info *new_smi)
                 */
                new_smi->pdev = platform_device_alloc("ipmi_si",
                                                      new_smi->intf_num);
-               if (rv) {
+               if (!new_smi->pdev) {
                        printk(KERN_ERR
                               "ipmi_si_intf:"
                               " Unable to allocate platform device\n");
index ee19b6e..40bd8c6 100644 (file)
@@ -57,7 +57,7 @@ u32 acpi_pm_read_verified(void)
        return v2;
 }
 
-static cycle_t acpi_pm_read(void)
+static cycle_t acpi_pm_read(struct clocksource *cs)
 {
        return (cycle_t)read_pmtmr();
 }
@@ -83,7 +83,7 @@ static int __init acpi_pm_good_setup(char *__str)
 }
 __setup("acpi_pm_good", acpi_pm_good_setup);
 
-static cycle_t acpi_pm_read_slow(void)
+static cycle_t acpi_pm_read_slow(struct clocksource *cs)
 {
        return (cycle_t)acpi_pm_read_verified();
 }
@@ -156,9 +156,9 @@ static int verify_pmtmr_rate(void)
        unsigned long count, delta;
 
        mach_prepare_counter();
-       value1 = clocksource_acpi_pm.read();
+       value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
        mach_countup(&count);
-       value2 = clocksource_acpi_pm.read();
+       value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
        delta = (value2 - value1) & ACPI_PM_MASK;
 
        /* Check that the PMTMR delta is within 5% of what we expect */
@@ -195,9 +195,9 @@ static int __init init_acpi_pm_clocksource(void)
        /* "verify" this timing source: */
        for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
                udelay(100 * j);
-               value1 = clocksource_acpi_pm.read();
+               value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
                for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
-                       value2 = clocksource_acpi_pm.read();
+                       value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
                        if (value2 == value1)
                                continue;
                        if (value2 > value1)
index 8615059..64e528e 100644 (file)
@@ -19,7 +19,7 @@
 int use_cyclone = 0;
 static void __iomem *cyclone_ptr;
 
-static cycle_t read_cyclone(void)
+static cycle_t read_cyclone(struct clocksource *cs)
 {
        return (cycle_t)readl(cyclone_ptr);
 }
index b92da67..27f4d96 100644 (file)
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(ppm, "+-adjust to actual XO freq (ppm)");
 /* The base timer frequency, * 27 if selected */
 #define HRT_FREQ   1000000
 
-static cycle_t read_hrt(void)
+static cycle_t read_hrt(struct clocksource *cs)
 {
        /* Read the timer value */
        return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
index 254f106..01b886e 100644 (file)
@@ -39,7 +39,7 @@
 
 static void __iomem *tcaddr;
 
-static cycle_t tc_get_cycles(void)
+static cycle_t tc_get_cycles(struct clocksource *cs)
 {
        unsigned long   flags;
        u32             lower, upper;
index 4637a4a..7c8c2d7 100644 (file)
@@ -674,7 +674,7 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci)
        int row_index;
 
        err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT);
-       if (err_detect)
+       if (!err_detect)
                return;
 
        mpc85xx_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n",
index bfe4924..1c9410d 100644 (file)
@@ -819,6 +819,7 @@ static const struct parisc_device_id hp_sdc_tbl[] = {
 MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl);
 
 static int __init hp_sdc_init_hppa(struct parisc_device *d);
+static struct delayed_work moduleloader_work;
 
 static struct parisc_driver hp_sdc_driver = {
        .name =         "hp_sdc",
@@ -930,8 +931,15 @@ static int __init hp_sdc_init(void)
 
 #if defined(__hppa__)
 
+static void request_module_delayed(struct work_struct *work)
+{
+       request_module("hp_sdc_mlc");
+}
+
 static int __init hp_sdc_init_hppa(struct parisc_device *d)
 {
+       int ret;
+
        if (!d)
                return 1;
        if (hp_sdc.dev != NULL)
@@ -944,13 +952,26 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
        hp_sdc.data_io          = d->hpa.start + 0x800;
        hp_sdc.status_io        = d->hpa.start + 0x801;
 
-       return hp_sdc_init();
+       INIT_DELAYED_WORK(&moduleloader_work, request_module_delayed);
+
+       ret = hp_sdc_init();
+       /* after sucessfull initialization give SDC some time to settle
+        * and then load the hp_sdc_mlc upper layer driver */
+       if (!ret)
+               schedule_delayed_work(&moduleloader_work,
+                       msecs_to_jiffies(2000));
+
+       return ret;
 }
 
 #endif /* __hppa__ */
 
 static void hp_sdc_exit(void)
 {
+       /* do nothing if we don't have a SDC */
+       if (!hp_sdc.dev)
+               return;
+
        write_lock_irq(&hp_sdc.lock);
 
        /* Turn off all maskable "sub-function" irq's. */
@@ -969,6 +990,7 @@ static void hp_sdc_exit(void)
        tasklet_kill(&hp_sdc.task);
 
 #if defined(__hppa__)
+       cancel_delayed_work_sync(&moduleloader_work);
        if (unregister_parisc_driver(&hp_sdc_driver))
                printk(KERN_WARNING PREFIX "Error unregistering HP SDC");
 #endif
index d0d126c..5d496a9 100644 (file)
@@ -5934,7 +5934,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
 
        /* Initalize the timer
         */
-       init_timer(&pCfg->timer);
+       init_timer_on_stack(&pCfg->timer);
        pCfg->timer.data = (unsigned long) ioc;
        pCfg->timer.function = mpt_timer_expired;
        pCfg->wait_done = 0;
index 3e6e42d..bbefe77 100644 (file)
@@ -375,7 +375,7 @@ static int __init gru_init(void)
        void *gru_start_vaddr;
 
        if (!is_uv_system())
-               return -ENODEV;
+               return 0;
 
 #if defined CONFIG_IA64
        gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */
index 16f8dca..7896849 100644 (file)
@@ -248,19 +248,19 @@ xp_init(void)
        enum xp_retval ret;
        int ch_number;
 
+       /* initialize the connection registration mutex */
+       for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
+               mutex_init(&xpc_registrations[ch_number].mutex);
+
        if (is_shub())
                ret = xp_init_sn2();
        else if (is_uv())
                ret = xp_init_uv();
        else
-               ret = xpUnsupported;
+               ret = 0;
 
        if (ret != xpSuccess)
-               return -ENODEV;
-
-       /* initialize the connection registration mutex */
-       for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
-               mutex_init(&xpc_registrations[ch_number].mutex);
+               return ret;
 
        return 0;
 }
index d3c92d7..5529585 100644 (file)
@@ -317,7 +317,8 @@ static void sony_laptop_report_input_event(u8 event)
        struct input_dev *key_dev = sony_laptop_input.key_dev;
        struct sony_laptop_keypress kp = { NULL };
 
-       if (event == SONYPI_EVENT_FNKEY_RELEASED) {
+       if (event == SONYPI_EVENT_FNKEY_RELEASED ||
+                       event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
                /* Nothing, not all VAIOs generate this event */
                return;
        }
@@ -905,7 +906,6 @@ static struct sony_nc_event sony_127_events[] = {
        { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED },
        { 0x86, SONYPI_EVENT_PKEY_P5 },
        { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
-       { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
        { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED },
        { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED },
        { 0, 0 },
@@ -1004,6 +1004,7 @@ static int sony_nc_function_setup(struct acpi_device *device)
        sony_call_snc_handle(0x0100, 0, &result);
        sony_call_snc_handle(0x0101, 0, &result);
        sony_call_snc_handle(0x0102, 0x100, &result);
+       sony_call_snc_handle(0x0127, 0, &result);
 
        return 0;
 }
@@ -1040,7 +1041,7 @@ static int sony_nc_resume(struct acpi_device *device)
 
        /* set the last requested brightness level */
        if (sony_backlight_device &&
-                       !sony_backlight_update_status(sony_backlight_device))
+                       sony_backlight_update_status(sony_backlight_device) < 0)
                printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n");
 
        return 0;
@@ -1102,8 +1103,11 @@ static int sony_nc_setup_wifi_rfkill(struct acpi_device *device)
        err = rfkill_register(sony_wifi_rfkill);
        if (err)
                rfkill_free(sony_wifi_rfkill);
-       else
+       else {
                sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill;
+               sony_nc_rfkill_set(sony_wifi_rfkill->data,
+                               RFKILL_STATE_UNBLOCKED);
+       }
        return err;
 }
 
@@ -1124,8 +1128,11 @@ static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device)
        err = rfkill_register(sony_bluetooth_rfkill);
        if (err)
                rfkill_free(sony_bluetooth_rfkill);
-       else
+       else {
                sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill;
+               sony_nc_rfkill_set(sony_bluetooth_rfkill->data,
+                               RFKILL_STATE_UNBLOCKED);
+       }
        return err;
 }
 
@@ -1145,8 +1152,11 @@ static int sony_nc_setup_wwan_rfkill(struct acpi_device *device)
        err = rfkill_register(sony_wwan_rfkill);
        if (err)
                rfkill_free(sony_wwan_rfkill);
-       else
+       else {
                sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill;
+               sony_nc_rfkill_set(sony_wwan_rfkill->data,
+                               RFKILL_STATE_UNBLOCKED);
+       }
        return err;
 }
 
@@ -1166,8 +1176,11 @@ static int sony_nc_setup_wimax_rfkill(struct acpi_device *device)
        err = rfkill_register(sony_wimax_rfkill);
        if (err)
                rfkill_free(sony_wimax_rfkill);
-       else
+       else {
                sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill;
+               sony_nc_rfkill_set(sony_wimax_rfkill->data,
+                               RFKILL_STATE_UNBLOCKED);
+       }
        return err;
 }
 
index a40b075..912be65 100644 (file)
@@ -21,7 +21,7 @@
  *  02110-1301, USA.
  */
 
-#define TPACPI_VERSION "0.22"
+#define TPACPI_VERSION "0.23"
 #define TPACPI_SYSFS_VERSION 0x020300
 
 /*
@@ -303,11 +303,17 @@ static u32 dbg_level;
 
 static struct workqueue_struct *tpacpi_wq;
 
+enum led_status_t {
+       TPACPI_LED_OFF = 0,
+       TPACPI_LED_ON,
+       TPACPI_LED_BLINK,
+};
+
 /* Special LED class that can defer work */
 struct tpacpi_led_classdev {
        struct led_classdev led_classdev;
        struct work_struct work;
-       enum led_brightness new_brightness;
+       enum led_status_t new_state;
        unsigned int led;
 };
 
@@ -2946,12 +2952,18 @@ static int hotkey_read(char *p)
        return len;
 }
 
-static void hotkey_enabledisable_warn(void)
+static void hotkey_enabledisable_warn(bool enable)
 {
        tpacpi_log_usertask("procfs hotkey enable/disable");
-       WARN(1, TPACPI_WARN
-            "hotkey enable/disable functionality has been "
-            "removed from the driver. Hotkeys are always enabled.\n");
+       if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable),
+                       TPACPI_WARN
+                       "hotkey enable/disable functionality has been "
+                       "removed from the driver.  Hotkeys are always "
+                       "enabled\n"))
+               printk(TPACPI_ERR
+                       "Please remove the hotkey=enable module "
+                       "parameter, it is deprecated.  Hotkeys are always "
+                       "enabled\n");
 }
 
 static int hotkey_write(char *buf)
@@ -2971,9 +2983,9 @@ static int hotkey_write(char *buf)
        res = 0;
        while ((cmd = next_cmd(&buf))) {
                if (strlencmp(cmd, "enable") == 0) {
-                       hotkey_enabledisable_warn();
+                       hotkey_enabledisable_warn(1);
                } else if (strlencmp(cmd, "disable") == 0) {
-                       hotkey_enabledisable_warn();
+                       hotkey_enabledisable_warn(0);
                        res = -EPERM;
                } else if (strlencmp(cmd, "reset") == 0) {
                        mask = hotkey_orig_mask;
@@ -4207,7 +4219,7 @@ static void light_set_status_worker(struct work_struct *work)
                        container_of(work, struct tpacpi_led_classdev, work);
 
        if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING))
-               light_set_status((data->new_brightness != LED_OFF));
+               light_set_status((data->new_state != TPACPI_LED_OFF));
 }
 
 static void light_sysfs_set(struct led_classdev *led_cdev,
@@ -4217,7 +4229,8 @@ static void light_sysfs_set(struct led_classdev *led_cdev,
                container_of(led_cdev,
                             struct tpacpi_led_classdev,
                             led_classdev);
-       data->new_brightness = brightness;
+       data->new_state = (brightness != LED_OFF) ?
+                               TPACPI_LED_ON : TPACPI_LED_OFF;
        queue_work(tpacpi_wq, &data->work);
 }
 
@@ -4724,12 +4737,6 @@ enum {   /* For TPACPI_LED_OLD */
        TPACPI_LED_EC_HLMS = 0x0e,      /* EC reg to select led to command */
 };
 
-enum led_status_t {
-       TPACPI_LED_OFF = 0,
-       TPACPI_LED_ON,
-       TPACPI_LED_BLINK,
-};
-
 static enum led_access_mode led_supported;
 
 TPACPI_HANDLE(led, ec, "SLED", /* 570 */
@@ -4841,23 +4848,13 @@ static int led_set_status(const unsigned int led,
        return rc;
 }
 
-static void led_sysfs_set_status(unsigned int led,
-                                enum led_brightness brightness)
-{
-       led_set_status(led,
-                       (brightness == LED_OFF) ?
-                       TPACPI_LED_OFF :
-                       (tpacpi_led_state_cache[led] == TPACPI_LED_BLINK) ?
-                               TPACPI_LED_BLINK : TPACPI_LED_ON);
-}
-
 static void led_set_status_worker(struct work_struct *work)
 {
        struct tpacpi_led_classdev *data =
                container_of(work, struct tpacpi_led_classdev, work);
 
        if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING))
-               led_sysfs_set_status(data->led, data->new_brightness);
+               led_set_status(data->led, data->new_state);
 }
 
 static void led_sysfs_set(struct led_classdev *led_cdev,
@@ -4866,7 +4863,13 @@ static void led_sysfs_set(struct led_classdev *led_cdev,
        struct tpacpi_led_classdev *data = container_of(led_cdev,
                             struct tpacpi_led_classdev, led_classdev);
 
-       data->new_brightness = brightness;
+       if (brightness == LED_OFF)
+               data->new_state = TPACPI_LED_OFF;
+       else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK)
+               data->new_state = TPACPI_LED_ON;
+       else
+               data->new_state = TPACPI_LED_BLINK;
+
        queue_work(tpacpi_wq, &data->work);
 }
 
@@ -4884,7 +4887,7 @@ static int led_sysfs_blink_set(struct led_classdev *led_cdev,
        } else if ((*delay_on != 500) || (*delay_off != 500))
                return -EINVAL;
 
-       data->new_brightness = TPACPI_LED_BLINK;
+       data->new_state = TPACPI_LED_BLINK;
        queue_work(tpacpi_wq, &data->work);
 
        return 0;
@@ -7858,6 +7861,15 @@ static int __init thinkpad_acpi_module_init(void)
 MODULE_ALIAS(TPACPI_DRVR_SHORTNAME);
 
 /*
+ * This will autoload the driver in almost every ThinkPad
+ * in widespread use.
+ *
+ * Only _VERY_ old models, like the 240, 240x and 570 lack
+ * the HKEY event interface.
+ */
+MODULE_DEVICE_TABLE(acpi, ibm_htk_device_ids);
+
+/*
  * DMI matching for module autoloading
  *
  * See http://thinkwiki.org/wiki/List_of_DMI_IDs
@@ -7869,18 +7881,13 @@ MODULE_ALIAS(TPACPI_DRVR_SHORTNAME);
 #define IBM_BIOS_MODULE_ALIAS(__type) \
        MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*")
 
-/* Non-ancient thinkpads */
-MODULE_ALIAS("dmi:bvnIBM:*:svnIBM:*:pvrThinkPad*:rvnIBM:*");
-MODULE_ALIAS("dmi:bvnLENOVO:*:svnLENOVO:*:pvrThinkPad*:rvnLENOVO:*");
-
 /* Ancient thinkpad BIOSes have to be identified by
  * BIOS type or model number, and there are far less
  * BIOS types than model numbers... */
-IBM_BIOS_MODULE_ALIAS("I[BDHIMNOTWVYZ]");
-IBM_BIOS_MODULE_ALIAS("1[0368A-GIKM-PST]");
-IBM_BIOS_MODULE_ALIAS("K[UX-Z]");
+IBM_BIOS_MODULE_ALIAS("I[MU]");                /* 570, 570e */
 
-MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh");
+MODULE_AUTHOR("Borislav Deianov <borislav@users.sf.net>");
+MODULE_AUTHOR("Henrique de Moraes Holschuh <hmh@hmh.eng.br>");
 MODULE_DESCRIPTION(TPACPI_DESC);
 MODULE_VERSION(TPACPI_VERSION);
 MODULE_LICENSE("GPL");
index ffe34a1..4e9851f 100644 (file)
@@ -573,7 +573,7 @@ config RTC_DRV_SA1100
 
 config RTC_DRV_SH
        tristate "SuperH On-Chip RTC"
-       depends on RTC_CLASS && SUPERH
+       depends on RTC_CLASS && SUPERH && HAVE_CLK
        help
          Say Y here to enable support for the on-chip RTC found in
          most SuperH processors.
index b6d35f5..23e10b6 100644 (file)
@@ -797,17 +797,15 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
                goto cleanup2;
        }
 
-       pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n",
-                       dev_name(&cmos_rtc.rtc->dev),
-                       is_valid_irq(rtc_irq)
-                               ?  (cmos_rtc.mon_alrm
-                                       ? "year"
-                                       : (cmos_rtc.day_alrm
-                                               ? "month" : "day"))
-                               : "no",
-                       cmos_rtc.century ? ", y3k" : "",
-                       nvram.size,
-                       is_hpet_enabled() ? ", hpet irqs" : "");
+       pr_info("%s: %s%s, %zd bytes nvram%s\n",
+               dev_name(&cmos_rtc.rtc->dev),
+               !is_valid_irq(rtc_irq) ? "no alarms" :
+                       cmos_rtc.mon_alrm ? "alarms up to one year" :
+                       cmos_rtc.day_alrm ? "alarms up to one month" :
+                       "alarms up to one day",
+               cmos_rtc.century ? ", y3k" : "",
+               nvram.size,
+               is_hpet_enabled() ? ", hpet irqs" : "");
 
        return 0;
 
index 9b1ff12..d7310ad 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SuperH On-Chip RTC Support
  *
- * Copyright (C) 2006, 2007, 2008  Paul Mundt
+ * Copyright (C) 2006 - 2009  Paul Mundt
  * Copyright (C) 2006  Jamie Lenehan
  * Copyright (C) 2008  Angelo Castello
  *
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/log2.h>
+#include <linux/clk.h>
 #include <asm/rtc.h>
 
 #define DRV_NAME       "sh-rtc"
-#define DRV_VERSION    "0.2.1"
+#define DRV_VERSION    "0.2.2"
 
 #define RTC_REG(r)     ((r) * rtc_reg_size)
 
 #define RCR2_START     0x01    /* Start bit               */
 
 struct sh_rtc {
-       void __iomem *regbase;
-       unsigned long regsize;
-       struct resource *res;
-       int alarm_irq;
-       int periodic_irq;
-       int carry_irq;
-       struct rtc_device *rtc_dev;
-       spinlock_t lock;
-       unsigned long capabilities;     /* See asm-sh/rtc.h for cap bits */
-       unsigned short periodic_freq;
+       void __iomem            *regbase;
+       unsigned long           regsize;
+       struct resource         *res;
+       int                     alarm_irq;
+       int                     periodic_irq;
+       int                     carry_irq;
+       struct clk              *clk;
+       struct rtc_device       *rtc_dev;
+       spinlock_t              lock;
+       unsigned long           capabilities;   /* See asm/rtc.h for cap bits */
+       unsigned short          periodic_freq;
 };
 
 static int __sh_rtc_interrupt(struct sh_rtc *rtc)
@@ -294,10 +296,10 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable)
 
        tmp = readb(rtc->regbase + RCR1);
 
-       if (!enable)
-               tmp &= ~RCR1_AIE;
-       else
+       if (enable)
                tmp |= RCR1_AIE;
+       else
+               tmp &= ~RCR1_AIE;
 
        writeb(tmp, rtc->regbase + RCR1);
 
@@ -618,6 +620,7 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq)
 {
        if (!is_power_of_2(freq))
                return -EINVAL;
+
        return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq);
 }
 
@@ -637,7 +640,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
        struct sh_rtc *rtc;
        struct resource *res;
        struct rtc_time r;
-       int ret;
+       char clk_name[6];
+       int clk_id, ret;
 
        rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL);
        if (unlikely(!rtc))
@@ -652,6 +656,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
                dev_err(&pdev->dev, "No IRQ resource\n");
                goto err_badres;
        }
+
        rtc->periodic_irq = ret;
        rtc->carry_irq = platform_get_irq(pdev, 1);
        rtc->alarm_irq = platform_get_irq(pdev, 2);
@@ -663,7 +668,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
                goto err_badres;
        }
 
-       rtc->regsize = res->end - res->start + 1;
+       rtc->regsize = resource_size(res);
 
        rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name);
        if (unlikely(!rtc->res)) {
@@ -677,6 +682,26 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
                goto err_badmap;
        }
 
+       clk_id = pdev->id;
+       /* With a single device, the clock id is still "rtc0" */
+       if (clk_id < 0)
+               clk_id = 0;
+
+       snprintf(clk_name, sizeof(clk_name), "rtc%d", clk_id);
+
+       rtc->clk = clk_get(&pdev->dev, clk_name);
+       if (IS_ERR(rtc->clk)) {
+               /*
+                * No error handling for rtc->clk intentionally, not all
+                * platforms will have a unique clock for the RTC, and
+                * the clk API can handle the struct clk pointer being
+                * NULL.
+                */
+               rtc->clk = NULL;
+       }
+
+       clk_enable(rtc->clk);
+
        rtc->rtc_dev = rtc_device_register("sh", &pdev->dev,
                                           &sh_rtc_ops, THIS_MODULE);
        if (IS_ERR(rtc->rtc_dev)) {
@@ -759,6 +784,8 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev)
        return 0;
 
 err_unmap:
+       clk_disable(rtc->clk);
+       clk_put(rtc->clk);
        iounmap(rtc->regbase);
 err_badmap:
        release_resource(rtc->res);
@@ -780,6 +807,7 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev)
        sh_rtc_setcie(&pdev->dev, 0);
 
        free_irq(rtc->periodic_irq, rtc);
+
        if (rtc->carry_irq > 0) {
                free_irq(rtc->carry_irq, rtc);
                free_irq(rtc->alarm_irq, rtc);
@@ -789,6 +817,9 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev)
 
        iounmap(rtc->regbase);
 
+       clk_disable(rtc->clk);
+       clk_put(rtc->clk);
+
        platform_set_drvdata(pdev, NULL);
 
        kfree(rtc);
@@ -802,11 +833,11 @@ static void sh_rtc_set_irq_wake(struct device *dev, int enabled)
        struct sh_rtc *rtc = platform_get_drvdata(pdev);
 
        set_irq_wake(rtc->periodic_irq, enabled);
+
        if (rtc->carry_irq > 0) {
                set_irq_wake(rtc->carry_irq, enabled);
                set_irq_wake(rtc->alarm_irq, enabled);
        }
-
 }
 
 static int sh_rtc_suspend(struct device *dev)
index a14d245..6f51ca4 100644 (file)
@@ -180,8 +180,6 @@ int scsi_complete_async_scans(void)
        spin_unlock(&async_scan_lock);
 
        kfree(data);
-       /* Synchronize async operations globally */
-       async_synchronize_full();
        return 0;
 }
 
index 2f21af2..74708fc 100644 (file)
  */
 
 #include <linux/module.h>
+#include <linux/device.h>
 #include <scsi/scsi_scan.h>
 
 static int __init wait_scan_init(void)
 {
+       /*
+        * First we need to wait for device probing to finish;
+        * the drivers we just loaded might just still be probing
+        * and might not yet have reached the scsi async scanning
+        */
+       wait_for_device_probe();
+       /*
+        * and then we wait for the actual asynchronous scsi scan
+        * to finish.
+        */
        scsi_complete_async_scans();
        return 0;
 }
index 18ba812..d86123e 100644 (file)
@@ -166,7 +166,7 @@ static void bfin_serial_start_tx(struct uart_port *port)
        struct tty_struct *tty = uart->port.info->port.tty;
 
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
-       if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
+       if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) {
                uart->scts = 0;
                uart_handle_cts_change(&uart->port, uart->scts);
        }
@@ -368,7 +368,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
        struct bfin_serial_port *uart = dev_id;
 
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
-       if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
+       if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) {
                uart->scts = 0;
                uart_handle_cts_change(&uart->port, uart->scts);
        }
@@ -504,7 +504,7 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
        struct circ_buf *xmit = &uart->port.info->xmit;
 
 #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS
-       if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
+       if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) {
                uart->scts = 0;
                uart_handle_cts_change(&uart->port, uart->scts);
        }
index c76feea..885194a 100644 (file)
@@ -213,7 +213,7 @@ static int flush(struct driver_data *drv_data)
                while (read_SSSR(reg) & SSSR_RNE) {
                        read_SSDR(reg);
                }
-       } while ((read_SSSR(reg) & SSSR_BSY) && limit--);
+       } while ((read_SSSR(reg) & SSSR_BSY) && --limit);
        write_SSSR(SSSR_ROR, reg);
 
        return limit;
@@ -484,7 +484,7 @@ static int wait_ssp_rx_stall(void const __iomem *ioaddr)
 {
        unsigned long limit = loops_per_jiffy << 1;
 
-       while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--)
+       while ((read_SSSR(ioaddr) & SSSR_BSY) && --limit)
                cpu_relax();
 
        return limit;
@@ -494,7 +494,7 @@ static int wait_dma_channel_stop(int channel)
 {
        unsigned long limit = loops_per_jiffy << 1;
 
-       while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--)
+       while (!(DCSR(channel) & DCSR_STOPSTATE) && --limit)
                cpu_relax();
 
        return limit;
@@ -1700,6 +1700,13 @@ static int pxa2xx_spi_resume(struct platform_device *pdev)
        struct ssp_device *ssp = drv_data->ssp;
        int status = 0;
 
+       if (drv_data->rx_channel != -1)
+               DRCMR(drv_data->ssp->drcmr_rx) =
+                       DRCMR_MAPVLD | drv_data->rx_channel;
+       if (drv_data->tx_channel != -1)
+               DRCMR(drv_data->ssp->drcmr_tx) =
+                       DRCMR_MAPVLD | drv_data->tx_channel;
+
        /* Enable the SSP clock */
        clk_enable(ssp->clk);
 
index f47c0ce..77b1e76 100644 (file)
@@ -191,8 +191,10 @@ int go7007_reset_encoder(struct go7007 *go)
 /*
  * Attempt to instantiate an I2C client by ID, probably loading a module.
  */
-static int init_i2c_module(struct i2c_adapter *adapter, int id, int addr)
+static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
+                          int id, int addr)
 {
+       struct i2c_board_info info;
        char *modname;
 
        switch (id) {
@@ -226,7 +228,11 @@ static int init_i2c_module(struct i2c_adapter *adapter, int id, int addr)
        }
        if (modname != NULL)
                request_module(modname);
-       if (wis_i2c_probe_device(adapter, id, addr) == 1)
+
+       memset(&info, 0, sizeof(struct i2c_board_info));
+       info.addr = addr;
+       strlcpy(info.type, type, I2C_NAME_SIZE);
+       if (!i2c_new_device(adapter, &info))
                return 0;
        if (modname != NULL)
                printk(KERN_INFO
@@ -266,6 +272,7 @@ int go7007_register_encoder(struct go7007 *go)
        if (go->i2c_adapter_online) {
                for (i = 0; i < go->board_info->num_i2c_devs; ++i)
                        init_i2c_module(&go->i2c_adapter,
+                                       go->board_info->i2c_devs[i].type,
                                        go->board_info->i2c_devs[i].id,
                                        go->board_info->i2c_devs[i].addr);
                if (go->board_id == GO7007_BOARDID_ADLINK_MPG24)
index cd55b76..c82867f 100644 (file)
 #include "go7007-priv.h"
 #include "wis-i2c.h"
 
-/************** Registration interface for I2C client drivers **************/
-
-/* Since there's no way to auto-probe the I2C devices connected to the I2C
- * bus on the go7007, we have this silly little registration system that
- * client drivers can use to register their I2C driver ID and their
- * detect_client function (the one that's normally passed to i2c_probe).
- *
- * When a new go7007 device is connected, we can look up in a board info
- * table by the USB or PCI vendor/product/revision ID to determine
- * which I2C client module to load.  The client driver module will register
- * itself here, and then we can call the registered detect_client function
- * to force-load a new client at the address listed in the board info table.
- *
- * Really the I2C subsystem should have a way to force-load I2C client
- * drivers when we have a priori knowledge of what's on the bus, especially
- * since the existing I2C auto-probe mechanism is so hokey, but we'll use
- * our own mechanism for the time being. */
-
-struct wis_i2c_client_driver {
-       unsigned int id;
-       found_proc found_proc;
-       struct list_head list;
-};
-
-static LIST_HEAD(i2c_client_drivers);
-static DECLARE_MUTEX(i2c_client_driver_list_lock);
-
-/* Client drivers register here by their I2C driver ID */
-int wis_i2c_add_driver(unsigned int id, found_proc found_proc)
-{
-       struct wis_i2c_client_driver *driver;
-
-       driver = kmalloc(sizeof(struct wis_i2c_client_driver), GFP_KERNEL);
-       if (driver == NULL)
-               return -ENOMEM;
-       driver->id = id;
-       driver->found_proc = found_proc;
-
-       down(&i2c_client_driver_list_lock);
-       list_add_tail(&driver->list, &i2c_client_drivers);
-       up(&i2c_client_driver_list_lock);
-
-       return 0;
-}
-EXPORT_SYMBOL(wis_i2c_add_driver);
-
-void wis_i2c_del_driver(found_proc found_proc)
-{
-       struct wis_i2c_client_driver *driver, *next;
-
-       down(&i2c_client_driver_list_lock);
-       list_for_each_entry_safe(driver, next, &i2c_client_drivers, list)
-               if (driver->found_proc == found_proc) {
-                       list_del(&driver->list);
-                       kfree(driver);
-               }
-       up(&i2c_client_driver_list_lock);
-}
-EXPORT_SYMBOL(wis_i2c_del_driver);
-
-/* The main go7007 driver calls this to instantiate a client by driver
- * ID and bus address, which are both stored in the board info table */
-int wis_i2c_probe_device(struct i2c_adapter *adapter,
-                               unsigned int id, int addr)
-{
-       struct wis_i2c_client_driver *driver;
-       int found = 0;
-
-       if (addr < 0 || addr > 0x7f)
-               return -1;
-       down(&i2c_client_driver_list_lock);
-       list_for_each_entry(driver, &i2c_client_drivers, list)
-               if (driver->id == id) {
-                       if (driver->found_proc(adapter, addr, 0) == 0)
-                               found = 1;
-                       break;
-               }
-       up(&i2c_client_driver_list_lock);
-       return found;
-}
-
 /********************* Driver for on-board I2C adapter *********************/
 
 /* #define GO7007_I2C_DEBUG */
@@ -287,9 +206,7 @@ static struct i2c_algorithm go7007_algo = {
 
 static struct i2c_adapter go7007_adap_templ = {
        .owner                  = THIS_MODULE,
-       .class                  = I2C_CLASS_TV_ANALOG,
        .name                   = "WIS GO7007SB",
-       .id                     = I2C_ALGO_GO7007,
        .algo                   = &go7007_algo,
 };
 
index 372f1f1..178d181 100644 (file)
@@ -87,6 +87,7 @@ struct go7007_board_info {
        int audio_main_div;
        int num_i2c_devs;
        struct {
+               const char *type;
                int id;
                int addr;
        } i2c_devs[4];
index 83eec92..aa4a9e0 100644 (file)
@@ -91,6 +91,7 @@ static struct go7007_usb_board board_matrix_ii = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "wis_saa7115",
                                .id     = I2C_DRIVERID_WIS_SAA7115,
                                .addr   = 0x20,
                        },
@@ -127,6 +128,7 @@ static struct go7007_usb_board board_matrix_reload = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "wis_saa7113",
                                .id     = I2C_DRIVERID_WIS_SAA7113,
                                .addr   = 0x25,
                        },
@@ -164,6 +166,7 @@ static struct go7007_usb_board board_star_trek = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "wis_saa7115",
                                .id     = I2C_DRIVERID_WIS_SAA7115,
                                .addr   = 0x20,
                        },
@@ -209,14 +212,17 @@ static struct go7007_usb_board board_px_tv402u = {
                .num_i2c_devs    = 3,
                .i2c_devs        = {
                        {
+                               .type   = "wis_saa7115",
                                .id     = I2C_DRIVERID_WIS_SAA7115,
                                .addr   = 0x20,
                        },
                        {
+                               .type   = "wis_uda1342",
                                .id     = I2C_DRIVERID_WIS_UDA1342,
                                .addr   = 0x1a,
                        },
                        {
+                               .type   = "wis_sony_tuner",
                                .id     = I2C_DRIVERID_WIS_SONY_TUNER,
                                .addr   = 0x60,
                        },
@@ -264,6 +270,7 @@ static struct go7007_usb_board board_xmen = {
                .num_i2c_devs     = 1,
                .i2c_devs         = {
                        {
+                               .type   = "wis_ov7640",
                                .id     = I2C_DRIVERID_WIS_OV7640,
                                .addr   = 0x21,
                        },
@@ -296,6 +303,7 @@ static struct go7007_usb_board board_matrix_revolution = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "wis_tw9903",
                                .id     = I2C_DRIVERID_WIS_TW9903,
                                .addr   = 0x44,
                        },
@@ -385,6 +393,7 @@ static struct go7007_usb_board board_adlink_mpg24 = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "wis_twTW2804",
                                .id     = I2C_DRIVERID_WIS_TW2804,
                                .addr   = 0x00, /* yes, really */
                        },
@@ -415,8 +424,9 @@ static struct go7007_usb_board board_sensoray_2250 = {
                .num_i2c_devs    = 1,
                .i2c_devs        = {
                        {
+                               .type   = "s2250_board",
                                .id     = I2C_DRIVERID_S2250,
-                               .addr   = 0x34,
+                               .addr   = 0x43,
                        },
                },
                .num_inputs      = 2,
@@ -943,9 +953,7 @@ static struct i2c_algorithm go7007_usb_algo = {
 
 static struct i2c_adapter go7007_usb_adap_templ = {
        .owner                  = THIS_MODULE,
-       .class                  = I2C_CLASS_TV_ANALOG,
        .name                   = "WIS GO7007SB EZ-USB",
-       .id                     = I2C_ALGO_GO7007_USB,
        .algo                   = &go7007_usb_algo,
 };
 
index d333ea2..1706fbf 100644 (file)
@@ -28,7 +28,6 @@ extern int s2250loader_init(void);
 extern void s2250loader_cleanup(void);
 
 #define TLV320_ADDRESS      0x34
-#define S2250_VIDDEC        0x86
 #define VPX322_ADDR_ANALOGCONTROL1     0x02
 #define VPX322_ADDR_BRIGHTNESS0                0x0127
 #define VPX322_ADDR_BRIGHTNESS1                0x0131
@@ -123,6 +122,7 @@ struct s2250 {
        int hue;
        int reg12b_val;
        int audio_input;
+       struct i2c_client *audio;
 };
 
 /* from go7007-usb.c which is Copyright (C) 2005-2006 Micronas USA Inc.*/
@@ -452,16 +452,15 @@ static int s2250_command(struct i2c_client *client,
        {
                struct v4l2_audio *audio = arg;
 
-               client->addr = TLV320_ADDRESS;
                switch (audio->index) {
                case 0:
-                       write_reg(client, 0x08, 0x02); /* Line In */
+                       write_reg(dec->audio, 0x08, 0x02); /* Line In */
                        break;
                case 1:
-                       write_reg(client, 0x08, 0x04); /* Mic */
+                       write_reg(dec->audio, 0x08, 0x04); /* Mic */
                        break;
                case 2:
-                       write_reg(client, 0x08, 0x05); /* Mic Boost */
+                       write_reg(dec->audio, 0x08, 0x05); /* Mic Boost */
                        break;
                default:
                        return -EINVAL;
@@ -477,31 +476,23 @@ static int s2250_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver s2250_driver;
-
-static struct i2c_client s2250_client_templ = {
-       .name           = "Sensoray 2250",
-       .driver         = &s2250_driver,
-};
-
-static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int s2250_probe(struct i2c_client *client,
+                      const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_client *audio;
+       struct i2c_adapter *adapter = client->adapter;
        struct s2250 *dec;
        u8 *data;
        struct go7007 *go = i2c_get_adapdata(adapter);
        struct go7007_usb *usb = go->hpi_context;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
+       audio = i2c_new_dummy(adapter, TLV320_ADDRESS >> 1);
+       if (audio == NULL)
                return -ENOMEM;
-       memcpy(client, &s2250_client_templ,
-              sizeof(s2250_client_templ));
-       client->adapter = adapter;
 
        dec = kmalloc(sizeof(struct s2250), GFP_KERNEL);
        if (dec == NULL) {
-               kfree(client);
+               i2c_unregister_device(audio);
                return -ENOMEM;
        }
 
@@ -510,7 +501,7 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind)
        dec->contrast = 50;
        dec->saturation = 50;
        dec->hue = 0;
-       client->addr = TLV320_ADDRESS;
+       dec->audio = audio;
        i2c_set_clientdata(client, dec);
 
        printk(KERN_DEBUG
@@ -518,28 +509,25 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind)
               adapter->name);
 
        /* initialize the audio */
-       client->addr = TLV320_ADDRESS;
-       if (write_regs(client, aud_regs) < 0) {
+       if (write_regs(audio, aud_regs) < 0) {
                printk(KERN_ERR
                       "s2250: error initializing audio\n");
-               kfree(client);
+               i2c_unregister_device(audio);
                kfree(dec);
                return 0;
        }
-       client->addr = S2250_VIDDEC;
-       i2c_set_clientdata(client, dec);
 
        if (write_regs(client, vid_regs) < 0) {
                printk(KERN_ERR
                       "s2250: error initializing decoder\n");
-               kfree(client);
+               i2c_unregister_device(audio);
                kfree(dec);
                return 0;
        }
        if (write_regs_fp(client, vid_regs_fp) < 0) {
                printk(KERN_ERR
                       "s2250: error initializing decoder\n");
-               kfree(client);
+               i2c_unregister_device(audio);
                kfree(dec);
                return 0;
        }
@@ -575,32 +563,33 @@ static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind)
                up(&usb->i2c_lock);
        }
 
-       i2c_attach_client(client);
        printk("s2250: initialized successfully\n");
        return 0;
 }
 
-static int s2250_detach(struct i2c_client *client)
+static int s2250_remove(struct i2c_client *client)
 {
        struct s2250 *dec = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
-       kfree(client);
+       i2c_set_clientdata(client, NULL);
+       i2c_unregister_device(dec->audio);
        kfree(dec);
        return 0;
 }
 
+static struct i2c_device_id s2250_id[] = {
+       { "s2250_board", 0 },
+       { }
+};
+
 static struct i2c_driver s2250_driver = {
        .driver = {
                .name   = "Sensoray 2250 board driver",
        },
-       .id             = I2C_DRIVERID_S2250,
-       .detach_client  = s2250_detach,
+       .probe          = s2250_probe,
+       .remove         = s2250_remove,
        .command        = s2250_command,
+       .id_table       = s2250_id,
 };
 
 static int __init s2250_init(void)
@@ -613,13 +602,13 @@ static int __init s2250_init(void)
 
        r = i2c_add_driver(&s2250_driver);
        if (r < 0)
-               return r;
-       return wis_i2c_add_driver(s2250_driver.id, s2250_detect);
+               s2250loader_cleanup();
+
+       return r;
 }
 
 static void __exit s2250_cleanup(void)
 {
-       wis_i2c_del_driver(s2250_detect);
        i2c_del_driver(&s2250_driver);
 
        s2250loader_cleanup();
index 431f41d..3c2b9be 100644 (file)
 #define        I2C_DRIVERID_WIS_OV7640         0xf0f5
 #define        I2C_DRIVERID_WIS_TW2804         0xf0f6
 #define        I2C_DRIVERID_S2250              0xf0f7
-#define        I2C_ALGO_GO7007                 0xf00000
-#define        I2C_ALGO_GO7007_USB             0xf10000
 
 /* Flag to indicate that the client needs to be accessed with SCCB semantics */
 /* We re-use the I2C_M_TEN value so the flag passes through the masks in the
  * core I2C code.  Major kludge, but the I2C layer ain't exactly flexible. */
 #define        I2C_CLIENT_SCCB                 0x10
 
-typedef int (*found_proc) (struct i2c_adapter *, int, int);
-int wis_i2c_add_driver(unsigned int id, found_proc found_proc);
-void wis_i2c_del_driver(found_proc found_proc);
-
-int wis_i2c_probe_device(struct i2c_adapter *adapter,
-                               unsigned int id, int addr);
-
 /* Definitions for new video decoder commands */
 
 struct video_decoder_resolution {
index 2f9efca..04d6d3a 100644 (file)
@@ -50,76 +50,54 @@ static int write_regs(struct i2c_client *client, u8 *regs)
        return 0;
 }
 
-static struct i2c_driver wis_ov7640_driver;
-
-static struct i2c_client wis_ov7640_client_templ = {
-       .name           = "OV7640 (WIS)",
-       .driver         = &wis_ov7640_driver,
-};
-
-static int wis_ov7640_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_ov7640_probe(struct i2c_client *client,
+                           const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_ov7640_client_templ,
-                       sizeof(wis_ov7640_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
+
        client->flags = I2C_CLIENT_SCCB;
 
        printk(KERN_DEBUG
                "wis-ov7640: initializing OV7640 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
        if (write_regs(client, initial_registers) < 0) {
                printk(KERN_ERR "wis-ov7640: error initializing OV7640\n");
-               kfree(client);
-               return 0;
+               return -ENODEV;
        }
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_ov7640_detach(struct i2c_client *client)
+static int wis_ov7640_remove(struct i2c_client *client)
 {
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
-
-       kfree(client);
        return 0;
 }
 
+static struct i2c_device_id wis_ov7640_id[] = {
+       { "wis_ov7640", 0 },
+       { }
+};
+
 static struct i2c_driver wis_ov7640_driver = {
        .driver = {
                .name   = "WIS OV7640 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_OV7640,
-       .detach_client  = wis_ov7640_detach,
+       .probe          = wis_ov7640_probe,
+       .remove         = wis_ov7640_remove,
+       .id_table       = wis_ov7640_id,
 };
 
 static int __init wis_ov7640_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_ov7640_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_ov7640_driver.id, wis_ov7640_detect);
+       return i2c_add_driver(&wis_ov7640_driver);
 }
 
 static void __exit wis_ov7640_cleanup(void)
 {
-       wis_i2c_del_driver(wis_ov7640_detect);
        i2c_del_driver(&wis_ov7640_driver);
 }
 
index 1168972..9ab893b 100644 (file)
@@ -261,34 +261,19 @@ static int wis_saa7113_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver wis_saa7113_driver;
-
-static struct i2c_client wis_saa7113_client_templ = {
-       .name           = "SAA7113 (WIS)",
-       .driver         = &wis_saa7113_driver,
-};
-
-static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_saa7113_probe(struct i2c_client *client,
+                            const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
        struct wis_saa7113 *dec;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_saa7113_client_templ,
-                       sizeof(wis_saa7113_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        dec = kmalloc(sizeof(struct wis_saa7113), GFP_KERNEL);
-       if (dec == NULL) {
-               kfree(client);
+       if (dec == NULL)
                return -ENOMEM;
-       }
+
        dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
        dec->contrast = 71;
@@ -298,56 +283,49 @@ static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind)
 
        printk(KERN_DEBUG
                "wis-saa7113: initializing SAA7113 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
        if (write_regs(client, initial_registers) < 0) {
                printk(KERN_ERR
                        "wis-saa7113: error initializing SAA7113\n");
-               kfree(client);
                kfree(dec);
-               return 0;
+               return -ENODEV;
        }
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_saa7113_detach(struct i2c_client *client)
+static int wis_saa7113_remove(struct i2c_client *client)
 {
        struct wis_saa7113 *dec = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
-       kfree(client);
+       i2c_set_clientdata(client, NULL);
        kfree(dec);
        return 0;
 }
 
+static struct i2c_device_id wis_saa7113_id[] = {
+       { "wis_saa7113", 0 },
+       { }
+};
+
 static struct i2c_driver wis_saa7113_driver = {
        .driver = {
                .name   = "WIS SAA7113 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_SAA7113,
-       .detach_client  = wis_saa7113_detach,
+       .probe          = wis_saa7113_probe,
+       .remove         = wis_saa7113_remove,
        .command        = wis_saa7113_command,
+       .id_table       = wis_saa7113_id,
 };
 
 static int __init wis_saa7113_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_saa7113_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_saa7113_driver.id, wis_saa7113_detect);
+       return i2c_add_driver(&wis_saa7113_driver);
 }
 
 static void __exit wis_saa7113_cleanup(void)
 {
-       wis_i2c_del_driver(wis_saa7113_detect);
        i2c_del_driver(&wis_saa7113_driver);
 }
 
index 59417a7..8687ad2 100644 (file)
@@ -394,34 +394,19 @@ static int wis_saa7115_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver wis_saa7115_driver;
-
-static struct i2c_client wis_saa7115_client_templ = {
-       .name           = "SAA7115 (WIS)",
-       .driver         = &wis_saa7115_driver,
-};
-
-static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_saa7115_probe(struct i2c_client *client,
+                            const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
        struct wis_saa7115 *dec;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_saa7115_client_templ,
-                       sizeof(wis_saa7115_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        dec = kmalloc(sizeof(struct wis_saa7115), GFP_KERNEL);
-       if (dec == NULL) {
-               kfree(client);
+       if (dec == NULL)
                return -ENOMEM;
-       }
+
        dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
        dec->contrast = 64;
@@ -431,56 +416,49 @@ static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind)
 
        printk(KERN_DEBUG
                "wis-saa7115: initializing SAA7115 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
        if (write_regs(client, initial_registers) < 0) {
                printk(KERN_ERR
                        "wis-saa7115: error initializing SAA7115\n");
-               kfree(client);
                kfree(dec);
-               return 0;
+               return -ENODEV;
        }
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_saa7115_detach(struct i2c_client *client)
+static int wis_saa7115_remove(struct i2c_client *client)
 {
        struct wis_saa7115 *dec = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
-       kfree(client);
+       i2c_set_clientdata(client, NULL);
        kfree(dec);
        return 0;
 }
 
+static struct i2c_device_id wis_saa7115_id[] = {
+       { "wis_saa7115", 0 },
+       { }
+};
+
 static struct i2c_driver wis_saa7115_driver = {
        .driver = {
                .name   = "WIS SAA7115 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_SAA7115,
-       .detach_client  = wis_saa7115_detach,
+       .probe          = wis_saa7115_probe,
+       .remove         = wis_saa7115_remove,
        .command        = wis_saa7115_command,
+       .id_table       = wis_saa7115_id,
 };
 
 static int __init wis_saa7115_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_saa7115_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_saa7115_driver.id, wis_saa7115_detect);
+       return i2c_add_driver(&wis_saa7115_driver);
 }
 
 static void __exit wis_saa7115_cleanup(void)
 {
-       wis_i2c_del_driver(wis_saa7115_detect);
        i2c_del_driver(&wis_saa7115_driver);
 }
 
index 0a7eeef..c965c60 100644 (file)
@@ -653,35 +653,19 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
        return 0;
 }
 
-static struct i2c_driver wis_sony_tuner_driver;
-
-static struct i2c_client wis_sony_tuner_client_templ = {
-       .name           = "Sony TV Tuner (WIS)",
-       .driver         = &wis_sony_tuner_driver,
-};
-
-static int wis_sony_tuner_detect(struct i2c_adapter *adapter,
-                                       int addr, int kind)
+static int wis_sony_tuner_probe(struct i2c_client *client,
+                               const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
        struct wis_sony_tuner *t;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_sony_tuner_client_templ,
-                       sizeof(wis_sony_tuner_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        t = kmalloc(sizeof(struct wis_sony_tuner), GFP_KERNEL);
-       if (t == NULL) {
-               kfree(client);
+       if (t == NULL)
                return -ENOMEM;
-       }
+
        t->type = -1;
        t->freq = 0;
        t->mpxmode = 0;
@@ -690,50 +674,42 @@ static int wis_sony_tuner_detect(struct i2c_adapter *adapter,
 
        printk(KERN_DEBUG
                "wis-sony-tuner: initializing tuner at address %d on %s\n",
-               addr, adapter->name);
-
-       i2c_attach_client(client);
+               client->addr, adapter->name);
 
        return 0;
 }
 
-static int wis_sony_tuner_detach(struct i2c_client *client)
+static int wis_sony_tuner_remove(struct i2c_client *client)
 {
        struct wis_sony_tuner *t = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
+       i2c_set_clientdata(client, NULL);
        kfree(t);
-       kfree(client);
        return 0;
 }
 
+static struct i2c_device_id wis_sony_tuner_id[] = {
+       { "wis_sony_tuner", 0 },
+       { }
+};
+
 static struct i2c_driver wis_sony_tuner_driver = {
        .driver = {
                .name   = "WIS Sony TV Tuner I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_SONY_TUNER,
-       .detach_client  = wis_sony_tuner_detach,
+       .probe          = wis_sony_tuner_probe,
+       .remove         = wis_sony_tuner_remove,
        .command        = tuner_command,
+       .id_table       = wis_sony_tuner_id,
 };
 
 static int __init wis_sony_tuner_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_sony_tuner_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_sony_tuner_driver.id,
-                                       wis_sony_tuner_detect);
+       return i2c_add_driver(&wis_sony_tuner_driver);
 }
 
 static void __exit wis_sony_tuner_cleanup(void)
 {
-       wis_i2c_del_driver(wis_sony_tuner_detect);
        i2c_del_driver(&wis_sony_tuner_driver);
 }
 
index 57b8f2b..e15794a 100644 (file)
@@ -291,34 +291,19 @@ static int wis_tw2804_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver wis_tw2804_driver;
-
-static struct i2c_client wis_tw2804_client_templ = {
-       .name           = "TW2804 (WIS)",
-       .driver         = &wis_tw2804_driver,
-};
-
-static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_tw2804_probe(struct i2c_client *client,
+                           const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
        struct wis_tw2804 *dec;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_tw2804_client_templ,
-                       sizeof(wis_tw2804_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        dec = kmalloc(sizeof(struct wis_tw2804), GFP_KERNEL);
-       if (dec == NULL) {
-               kfree(client);
+       if (dec == NULL)
                return -ENOMEM;
-       }
+
        dec->channel = -1;
        dec->norm = V4L2_STD_NTSC;
        dec->brightness = 128;
@@ -328,48 +313,42 @@ static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind)
        i2c_set_clientdata(client, dec);
 
        printk(KERN_DEBUG "wis-tw2804: creating TW2804 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_tw2804_detach(struct i2c_client *client)
+static int wis_tw2804_remove(struct i2c_client *client)
 {
        struct wis_tw2804 *dec = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
-       kfree(client);
+       i2c_set_clientdata(client, NULL);
        kfree(dec);
        return 0;
 }
 
+static struct i2c_device_id wis_tw2804_id[] = {
+       { "wis_tw2804", 0 },
+       { }
+};
+
 static struct i2c_driver wis_tw2804_driver = {
        .driver = {
                .name   = "WIS TW2804 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_TW2804,
-       .detach_client  = wis_tw2804_detach,
+       .probe          = wis_tw2804_probe,
+       .remove         = wis_tw2804_remove,
        .command        = wis_tw2804_command,
+       .id_table       = wis_tw2804_id,
 };
 
 static int __init wis_tw2804_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_tw2804_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_tw2804_driver.id, wis_tw2804_detect);
+       return i2c_add_driver(&wis_tw2804_driver);
 }
 
 static void __exit wis_tw2804_cleanup(void)
 {
-       wis_i2c_del_driver(wis_tw2804_detect);
        i2c_del_driver(&wis_tw2804_driver);
 }
 
index 40627b2..6c3427b 100644 (file)
@@ -267,34 +267,19 @@ static int wis_tw9903_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver wis_tw9903_driver;
-
-static struct i2c_client wis_tw9903_client_templ = {
-       .name           = "TW9903 (WIS)",
-       .driver         = &wis_tw9903_driver,
-};
-
-static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_tw9903_probe(struct i2c_client *client,
+                           const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
        struct wis_tw9903 *dec;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_tw9903_client_templ,
-                       sizeof(wis_tw9903_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        dec = kmalloc(sizeof(struct wis_tw9903), GFP_KERNEL);
-       if (dec == NULL) {
-               kfree(client);
+       if (dec == NULL)
                return -ENOMEM;
-       }
+
        dec->norm = V4L2_STD_NTSC;
        dec->brightness = 0;
        dec->contrast = 0x60;
@@ -303,55 +288,48 @@ static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind)
 
        printk(KERN_DEBUG
                "wis-tw9903: initializing TW9903 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
        if (write_regs(client, initial_registers) < 0) {
                printk(KERN_ERR "wis-tw9903: error initializing TW9903\n");
-               kfree(client);
                kfree(dec);
-               return 0;
+               return -ENODEV;
        }
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_tw9903_detach(struct i2c_client *client)
+static int wis_tw9903_remove(struct i2c_client *client)
 {
        struct wis_tw9903 *dec = i2c_get_clientdata(client);
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
 
-       kfree(client);
+       i2c_set_clientdata(client, NULL);
        kfree(dec);
        return 0;
 }
 
+static struct i2c_device_id wis_tw9903_id[] = {
+       { "wis_tw9903", 0 },
+       { }
+};
+
 static struct i2c_driver wis_tw9903_driver = {
        .driver = {
                .name   = "WIS TW9903 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_TW9903,
-       .detach_client  = wis_tw9903_detach,
+       .probe          = wis_tw9903_probe,
+       .remove         = wis_tw9903_remove,
        .command        = wis_tw9903_command,
+       .id_table       = wis_tw9903_id,
 };
 
 static int __init wis_tw9903_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_tw9903_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_tw9903_driver.id, wis_tw9903_detect);
+       return i2c_add_driver(&wis_tw9903_driver);
 }
 
 static void __exit wis_tw9903_cleanup(void)
 {
-       wis_i2c_del_driver(wis_tw9903_detect);
        i2c_del_driver(&wis_tw9903_driver);
 }
 
index 555645c..739c7ae 100644 (file)
@@ -59,73 +59,51 @@ static int wis_uda1342_command(struct i2c_client *client,
        return 0;
 }
 
-static struct i2c_driver wis_uda1342_driver;
-
-static struct i2c_client wis_uda1342_client_templ = {
-       .name           = "UDA1342 (WIS)",
-       .driver         = &wis_uda1342_driver,
-};
-
-static int wis_uda1342_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int wis_uda1342_probe(struct i2c_client *client,
+                            const struct i2c_device_id *id)
 {
-       struct i2c_client *client;
+       struct i2c_adapter *adapter = client->adapter;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA))
-               return 0;
-
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == NULL)
-               return -ENOMEM;
-       memcpy(client, &wis_uda1342_client_templ,
-                       sizeof(wis_uda1342_client_templ));
-       client->adapter = adapter;
-       client->addr = addr;
+               return -ENODEV;
 
        printk(KERN_DEBUG
                "wis-uda1342: initializing UDA1342 at address %d on %s\n",
-               addr, adapter->name);
+               client->addr, adapter->name);
 
        write_reg(client, 0x00, 0x8000); /* reset registers */
        write_reg(client, 0x00, 0x1241); /* select input 1 */
 
-       i2c_attach_client(client);
        return 0;
 }
 
-static int wis_uda1342_detach(struct i2c_client *client)
+static int wis_uda1342_remove(struct i2c_client *client)
 {
-       int r;
-
-       r = i2c_detach_client(client);
-       if (r < 0)
-               return r;
-
-       kfree(client);
        return 0;
 }
 
+static struct i2c_device_id wis_uda1342_id[] = {
+       { "wis_uda1342", 0 },
+       { }
+};
+
 static struct i2c_driver wis_uda1342_driver = {
        .driver = {
                .name   = "WIS UDA1342 I2C driver",
        },
-       .id             = I2C_DRIVERID_WIS_UDA1342,
-       .detach_client  = wis_uda1342_detach,
+       .probe          = wis_uda1342_probe,
+       .remove         = wis_uda1342_remove,
        .command        = wis_uda1342_command,
+       .id_table       = wis_uda1342_id,
 };
 
 static int __init wis_uda1342_init(void)
 {
-       int r;
-
-       r = i2c_add_driver(&wis_uda1342_driver);
-       if (r < 0)
-               return r;
-       return wis_i2c_add_driver(wis_uda1342_driver.id, wis_uda1342_detect);
+       return i2c_add_driver(&wis_uda1342_driver);
 }
 
 static void __exit wis_uda1342_cleanup(void)
 {
-       wis_i2c_del_driver(wis_uda1342_detect);
        i2c_del_driver(&wis_uda1342_driver);
 }
 
index 1a1f946..9fe90ce 100644 (file)
@@ -533,6 +533,7 @@ static int __devinit init_asiliant(struct fb_info *p, unsigned long addr)
 
        writeb(0xff, mmio_base + 0x78c);
        chips_hw_init(p);
+       return 0;
 }
 
 static int __devinit
index 84f6320..0889d50 100644 (file)
@@ -1439,7 +1439,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi)
 static irqreturn_t pxafb_handle_irq(int irq, void *dev_id)
 {
        struct pxafb_info *fbi = dev_id;
-       unsigned int lccr0, lcsr, lcsr1;
+       unsigned int lccr0, lcsr;
 
        lcsr = lcd_readl(fbi, LCSR);
        if (lcsr & LCSR_LDD) {
@@ -1455,14 +1455,16 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id)
        lcd_writel(fbi, LCSR, lcsr);
 
 #ifdef CONFIG_FB_PXA_OVERLAY
-       lcsr1 = lcd_readl(fbi, LCSR1);
-       if (lcsr1 & LCSR1_BS(1))
-               complete(&fbi->overlay[0].branch_done);
+       {
+               unsigned int lcsr1 = lcd_readl(fbi, LCSR1);
+               if (lcsr1 & LCSR1_BS(1))
+                       complete(&fbi->overlay[0].branch_done);
 
-       if (lcsr1 & LCSR1_BS(2))
-               complete(&fbi->overlay[1].branch_done);
+               if (lcsr1 & LCSR1_BS(2))
+                       complete(&fbi->overlay[1].branch_done);
 
-       lcd_writel(fbi, LCSR1, lcsr1);
+               lcd_writel(fbi, LCSR1, lcsr1);
+       }
 #endif
        return IRQ_HANDLED;
 }
index bf8c8af..4eb4d8d 100644 (file)
@@ -39,10 +39,12 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
 {
        struct autofs_dirhash *dh = &sbi->dirhash;
        struct autofs_dir_ent *ent;
-       struct dentry *dentry;
        unsigned long timeout = sbi->exp_timeout;
 
        while (1) {
+               struct path path;
+               int umount_ok;
+
                if ( list_empty(&dh->expiry_head) || sbi->catatonic )
                        return NULL;    /* No entries */
                /* We keep the list sorted by last_usage and want old stuff */
@@ -57,17 +59,17 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
                        return ent; /* Symlinks are always expirable */
 
                /* Get the dentry for the autofs subdirectory */
-               dentry = ent->dentry;
+               path.dentry = ent->dentry;
 
-               if ( !dentry ) {
+               if (!path.dentry) {
                        /* Should only happen in catatonic mode */
                        printk("autofs: dentry == NULL but inode range is directory, entry %s\n", ent->name);
                        autofs_delete_usage(ent);
                        continue;
                }
 
-               if ( !dentry->d_inode ) {
-                       dput(dentry);
+               if (!path.dentry->d_inode) {
+                       dput(path.dentry);
                        printk("autofs: negative dentry on expiry queue: %s\n",
                               ent->name);
                        autofs_delete_usage(ent);
@@ -76,29 +78,29 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb,
 
                /* Make sure entry is mounted and unused; note that dentry will
                   point to the mounted-on-top root. */
-               if (!S_ISDIR(dentry->d_inode->i_mode)||!d_mountpoint(dentry)) {
+               if (!S_ISDIR(path.dentry->d_inode->i_mode) ||
+                   !d_mountpoint(path.dentry)) {
                        DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
                        continue;
                }
-               mntget(mnt);
-               dget(dentry);
-               if (!follow_down(&mnt, &dentry)) {
-                       dput(dentry);
-                       mntput(mnt);
+               path.mnt = mnt;
+               path_get(&path);
+               if (!follow_down(&path.mnt, &path.dentry)) {
+                       path_put(&path);
                        DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name));
                        continue;
                }
-               while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
+               while (d_mountpoint(path.dentry) &&
+                      follow_down(&path.mnt, &path.dentry))
                        ;
-               dput(dentry);
+               umount_ok = may_umount(path.mnt);
+               path_put(&path);
 
-               if ( may_umount(mnt) ) {
-                       mntput(mnt);
+               if (umount_ok) {
                        DPRINTK(("autofs: signaling expire on %s\n", ent->name));
                        return ent; /* Expirable! */
                }
                DPRINTK(("autofs: didn't expire due to may_umount: %s\n", ent->name));
-               mntput(mnt);
        }
        return NULL;            /* No expirable entries */
 }
index 9e5ae8a..84168c0 100644 (file)
@@ -54,11 +54,10 @@ static int check_name(const char *name)
  * Check a string doesn't overrun the chunk of
  * memory we copied from user land.
  */
-static int invalid_str(char *str, void *end)
+static int invalid_str(char *str, size_t size)
 {
-       while ((void *) str <= end)
-               if (!*str++)
-                       return 0;
+       if (memchr(str, 0, size))
+               return 0;
        return -EINVAL;
 }
 
@@ -138,8 +137,7 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param)
        }
 
        if (param->size > sizeof(*param)) {
-               err = invalid_str(param->path,
-                                (void *) ((size_t) param + param->size));
+               err = invalid_str(param->path, param->size - sizeof(*param));
                if (err) {
                        AUTOFS_WARN(
                          "path string terminator missing for cmd(0x%08x)",
@@ -488,7 +486,7 @@ static int autofs_dev_ioctl_requester(struct file *fp,
        }
 
        path = param->path;
-       devid = sbi->sb->s_dev;
+       devid = new_encode_dev(sbi->sb->s_dev);
 
        param->requester.uid = param->requester.gid = -1;
 
index 51bfdfc..502c3d6 100644 (file)
@@ -25,6 +25,7 @@
 #define WORK_QUEUED_BIT 0
 #define WORK_DONE_BIT 1
 #define WORK_ORDER_DONE_BIT 2
+#define WORK_HIGH_PRIO_BIT 3
 
 /*
  * container for the kthread task pointer and the list of pending work
@@ -36,6 +37,7 @@ struct btrfs_worker_thread {
 
        /* list of struct btrfs_work that are waiting for service */
        struct list_head pending;
+       struct list_head prio_pending;
 
        /* list of worker threads from struct btrfs_workers */
        struct list_head worker_list;
@@ -103,10 +105,16 @@ static noinline int run_ordered_completions(struct btrfs_workers *workers,
 
        spin_lock_irqsave(&workers->lock, flags);
 
-       while (!list_empty(&workers->order_list)) {
-               work = list_entry(workers->order_list.next,
-                                 struct btrfs_work, order_list);
-
+       while (1) {
+               if (!list_empty(&workers->prio_order_list)) {
+                       work = list_entry(workers->prio_order_list.next,
+                                         struct btrfs_work, order_list);
+               } else if (!list_empty(&workers->order_list)) {
+                       work = list_entry(workers->order_list.next,
+                                         struct btrfs_work, order_list);
+               } else {
+                       break;
+               }
                if (!test_bit(WORK_DONE_BIT, &work->flags))
                        break;
 
@@ -143,8 +151,14 @@ static int worker_loop(void *arg)
        do {
                spin_lock_irq(&worker->lock);
 again_locked:
-               while (!list_empty(&worker->pending)) {
-                       cur = worker->pending.next;
+               while (1) {
+                       if (!list_empty(&worker->prio_pending))
+                               cur = worker->prio_pending.next;
+                       else if (!list_empty(&worker->pending))
+                               cur = worker->pending.next;
+                       else
+                               break;
+
                        work = list_entry(cur, struct btrfs_work, list);
                        list_del(&work->list);
                        clear_bit(WORK_QUEUED_BIT, &work->flags);
@@ -163,7 +177,6 @@ again_locked:
 
                        spin_lock_irq(&worker->lock);
                        check_idle_worker(worker);
-
                }
                if (freezing(current)) {
                        worker->working = 0;
@@ -178,7 +191,8 @@ again_locked:
                                 * jump_in?
                                 */
                                smp_mb();
-                               if (!list_empty(&worker->pending))
+                               if (!list_empty(&worker->pending) ||
+                                   !list_empty(&worker->prio_pending))
                                        continue;
 
                                /*
@@ -191,7 +205,8 @@ again_locked:
                                 */
                                schedule_timeout(1);
                                smp_mb();
-                               if (!list_empty(&worker->pending))
+                               if (!list_empty(&worker->pending) ||
+                                   !list_empty(&worker->prio_pending))
                                        continue;
 
                                if (kthread_should_stop())
@@ -200,7 +215,8 @@ again_locked:
                                /* still no more work?, sleep for real */
                                spin_lock_irq(&worker->lock);
                                set_current_state(TASK_INTERRUPTIBLE);
-                               if (!list_empty(&worker->pending))
+                               if (!list_empty(&worker->pending) ||
+                                   !list_empty(&worker->prio_pending))
                                        goto again_locked;
 
                                /*
@@ -248,6 +264,7 @@ void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max)
        INIT_LIST_HEAD(&workers->worker_list);
        INIT_LIST_HEAD(&workers->idle_list);
        INIT_LIST_HEAD(&workers->order_list);
+       INIT_LIST_HEAD(&workers->prio_order_list);
        spin_lock_init(&workers->lock);
        workers->max_workers = max;
        workers->idle_thresh = 32;
@@ -273,6 +290,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
                }
 
                INIT_LIST_HEAD(&worker->pending);
+               INIT_LIST_HEAD(&worker->prio_pending);
                INIT_LIST_HEAD(&worker->worker_list);
                spin_lock_init(&worker->lock);
                atomic_set(&worker->num_pending, 0);
@@ -396,7 +414,10 @@ int btrfs_requeue_work(struct btrfs_work *work)
                goto out;
 
        spin_lock_irqsave(&worker->lock, flags);
-       list_add_tail(&work->list, &worker->pending);
+       if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags))
+               list_add_tail(&work->list, &worker->prio_pending);
+       else
+               list_add_tail(&work->list, &worker->pending);
        atomic_inc(&worker->num_pending);
 
        /* by definition we're busy, take ourselves off the idle
@@ -422,6 +443,11 @@ out:
        return 0;
 }
 
+void btrfs_set_work_high_prio(struct btrfs_work *work)
+{
+       set_bit(WORK_HIGH_PRIO_BIT, &work->flags);
+}
+
 /*
  * places a struct btrfs_work into the pending queue of one of the kthreads
  */
@@ -438,7 +464,12 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
        worker = find_worker(workers);
        if (workers->ordered) {
                spin_lock_irqsave(&workers->lock, flags);
-               list_add_tail(&work->order_list, &workers->order_list);
+               if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags)) {
+                       list_add_tail(&work->order_list,
+                                     &workers->prio_order_list);
+               } else {
+                       list_add_tail(&work->order_list, &workers->order_list);
+               }
                spin_unlock_irqrestore(&workers->lock, flags);
        } else {
                INIT_LIST_HEAD(&work->order_list);
@@ -446,7 +477,10 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
 
        spin_lock_irqsave(&worker->lock, flags);
 
-       list_add_tail(&work->list, &worker->pending);
+       if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags))
+               list_add_tail(&work->list, &worker->prio_pending);
+       else
+               list_add_tail(&work->list, &worker->pending);
        atomic_inc(&worker->num_pending);
        check_busy_worker(worker);
 
index 31be4ed..1b511c1 100644 (file)
@@ -85,6 +85,7 @@ struct btrfs_workers {
         * of work items waiting for completion
         */
        struct list_head order_list;
+       struct list_head prio_order_list;
 
        /* lock for finding the next worker thread to queue on */
        spinlock_t lock;
@@ -98,4 +99,5 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers);
 int btrfs_stop_workers(struct btrfs_workers *workers);
 void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max);
 int btrfs_requeue_work(struct btrfs_work *work);
+void btrfs_set_work_high_prio(struct btrfs_work *work);
 #endif
index e5b2533..a99f1c2 100644 (file)
@@ -1325,12 +1325,12 @@ static noinline int reada_for_balance(struct btrfs_root *root,
        int ret = 0;
        int blocksize;
 
-       parent = path->nodes[level - 1];
+       parent = path->nodes[level + 1];
        if (!parent)
                return 0;
 
        nritems = btrfs_header_nritems(parent);
-       slot = path->slots[level];
+       slot = path->slots[level + 1];
        blocksize = btrfs_level_size(root, level);
 
        if (slot > 0) {
@@ -1341,7 +1341,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
                        block1 = 0;
                free_extent_buffer(eb);
        }
-       if (slot < nritems) {
+       if (slot + 1 < nritems) {
                block2 = btrfs_node_blockptr(parent, slot + 1);
                gen = btrfs_node_ptr_generation(parent, slot + 1);
                eb = btrfs_find_tree_block(root, block2, blocksize);
@@ -1351,7 +1351,11 @@ static noinline int reada_for_balance(struct btrfs_root *root,
        }
        if (block1 || block2) {
                ret = -EAGAIN;
+
+               /* release the whole path */
                btrfs_release_path(root, path);
+
+               /* read the blocks */
                if (block1)
                        readahead_tree_block(root, block1, blocksize, 0);
                if (block2)
@@ -1361,7 +1365,7 @@ static noinline int reada_for_balance(struct btrfs_root *root,
                        eb = read_tree_block(root, block1, blocksize, 0);
                        free_extent_buffer(eb);
                }
-               if (block1) {
+               if (block2) {
                        eb = read_tree_block(root, block2, blocksize, 0);
                        free_extent_buffer(eb);
                }
@@ -1481,12 +1485,15 @@ read_block_for_search(struct btrfs_trans_handle *trans,
         * of the btree by dropping locks before
         * we read.
         */
-       btrfs_release_path(NULL, p);
+       btrfs_unlock_up_safe(p, level + 1);
+       btrfs_set_path_blocking(p);
+
        if (tmp)
                free_extent_buffer(tmp);
        if (p->reada)
                reada_for_search(root, p, level, slot, key->objectid);
 
+       btrfs_release_path(NULL, p);
        tmp = read_tree_block(root, blocknr, blocksize, gen);
        if (tmp)
                free_extent_buffer(tmp);
index 92caa80..a6b8374 100644 (file)
@@ -579,6 +579,10 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
        async->bio_flags = bio_flags;
 
        atomic_inc(&fs_info->nr_async_submits);
+
+       if (rw & (1 << BIO_RW_SYNCIO))
+               btrfs_set_work_high_prio(&async->work);
+
        btrfs_queue_worker(&fs_info->workers, &async->work);
 #if 0
        int limit = btrfs_async_submit_limit(fs_info);
@@ -656,6 +660,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
                return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio,
                                     mirror_num, 0);
        }
+
        /*
         * kthread helpers are used to submit writes so that checksumming
         * can happen in parallel across all CPUs
@@ -2095,10 +2100,10 @@ static int write_dev_supers(struct btrfs_device *device,
                                device->barriers = 0;
                                get_bh(bh);
                                lock_buffer(bh);
-                               ret = submit_bh(WRITE, bh);
+                               ret = submit_bh(WRITE_SYNC, bh);
                        }
                } else {
-                       ret = submit_bh(WRITE, bh);
+                       ret = submit_bh(WRITE_SYNC, bh);
                }
 
                if (!ret && wait) {
index eb2bee8..05a1c42 100644 (file)
@@ -50,7 +50,10 @@ struct extent_page_data {
        /* tells writepage not to lock the state bits for this range
         * it still does the unlocking
         */
-       int extent_locked;
+       unsigned int extent_locked:1;
+
+       /* tells the submit_bio code to use a WRITE_SYNC */
+       unsigned int sync_io:1;
 };
 
 int __init extent_io_init(void)
@@ -2101,6 +2104,16 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
        return ret;
 }
 
+static noinline void update_nr_written(struct page *page,
+                                     struct writeback_control *wbc,
+                                     unsigned long nr_written)
+{
+       wbc->nr_to_write -= nr_written;
+       if (wbc->range_cyclic || (wbc->nr_to_write > 0 &&
+           wbc->range_start == 0 && wbc->range_end == LLONG_MAX))
+               page->mapping->writeback_index = page->index + nr_written;
+}
+
 /*
  * the writepage semantics are similar to regular writepage.  extent
  * records are inserted to lock ranges in the tree, and as dirty areas
@@ -2136,8 +2149,14 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
        u64 delalloc_end;
        int page_started;
        int compressed;
+       int write_flags;
        unsigned long nr_written = 0;
 
+       if (wbc->sync_mode == WB_SYNC_ALL)
+               write_flags = WRITE_SYNC_PLUG;
+       else
+               write_flags = WRITE;
+
        WARN_ON(!PageLocked(page));
        pg_offset = i_size & (PAGE_CACHE_SIZE - 1);
        if (page->index > end_index ||
@@ -2164,6 +2183,12 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
        delalloc_end = 0;
        page_started = 0;
        if (!epd->extent_locked) {
+               /*
+                * make sure the wbc mapping index is at least updated
+                * to this page.
+                */
+               update_nr_written(page, wbc, 0);
+
                while (delalloc_end < page_end) {
                        nr_delalloc = find_lock_delalloc_range(inode, tree,
                                                       page,
@@ -2185,7 +2210,13 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
                 */
                if (page_started) {
                        ret = 0;
-                       goto update_nr_written;
+                       /*
+                        * we've unlocked the page, so we can't update
+                        * the mapping's writeback index, just update
+                        * nr_to_write.
+                        */
+                       wbc->nr_to_write -= nr_written;
+                       goto done_unlocked;
                }
        }
        lock_extent(tree, start, page_end, GFP_NOFS);
@@ -2198,13 +2229,18 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
                if (ret == -EAGAIN) {
                        unlock_extent(tree, start, page_end, GFP_NOFS);
                        redirty_page_for_writepage(wbc, page);
+                       update_nr_written(page, wbc, nr_written);
                        unlock_page(page);
                        ret = 0;
-                       goto update_nr_written;
+                       goto done_unlocked;
                }
        }
 
-       nr_written++;
+       /*
+        * we don't want to touch the inode after unlocking the page,
+        * so we update the mapping writeback index now
+        */
+       update_nr_written(page, wbc, nr_written + 1);
 
        end = page_end;
        if (test_range_bit(tree, start, page_end, EXTENT_DELALLOC, 0))
@@ -2314,9 +2350,9 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
                                       (unsigned long long)end);
                        }
 
-                       ret = submit_extent_page(WRITE, tree, page, sector,
-                                                iosize, pg_offset, bdev,
-                                                &epd->bio, max_nr,
+                       ret = submit_extent_page(write_flags, tree, page,
+                                                sector, iosize, pg_offset,
+                                                bdev, &epd->bio, max_nr,
                                                 end_bio_extent_writepage,
                                                 0, 0, 0);
                        if (ret)
@@ -2336,11 +2372,8 @@ done:
                unlock_extent(tree, unlock_start, page_end, GFP_NOFS);
        unlock_page(page);
 
-update_nr_written:
-       wbc->nr_to_write -= nr_written;
-       if (wbc->range_cyclic || (wbc->nr_to_write > 0 &&
-           wbc->range_start == 0 && wbc->range_end == LLONG_MAX))
-               page->mapping->writeback_index = page->index + nr_written;
+done_unlocked:
+
        return 0;
 }
 
@@ -2460,15 +2493,23 @@ retry:
        return ret;
 }
 
-static noinline void flush_write_bio(void *data)
+static void flush_epd_write_bio(struct extent_page_data *epd)
 {
-       struct extent_page_data *epd = data;
        if (epd->bio) {
-               submit_one_bio(WRITE, epd->bio, 0, 0);
+               if (epd->sync_io)
+                       submit_one_bio(WRITE_SYNC, epd->bio, 0, 0);
+               else
+                       submit_one_bio(WRITE, epd->bio, 0, 0);
                epd->bio = NULL;
        }
 }
 
+static noinline void flush_write_bio(void *data)
+{
+       struct extent_page_data *epd = data;
+       flush_epd_write_bio(epd);
+}
+
 int extent_write_full_page(struct extent_io_tree *tree, struct page *page,
                          get_extent_t *get_extent,
                          struct writeback_control *wbc)
@@ -2480,23 +2521,22 @@ int extent_write_full_page(struct extent_io_tree *tree, struct page *page,
                .tree = tree,
                .get_extent = get_extent,
                .extent_locked = 0,
+               .sync_io = wbc->sync_mode == WB_SYNC_ALL,
        };
        struct writeback_control wbc_writepages = {
                .bdi            = wbc->bdi,
-               .sync_mode      = WB_SYNC_NONE,
+               .sync_mode      = wbc->sync_mode,
                .older_than_this = NULL,
                .nr_to_write    = 64,
                .range_start    = page_offset(page) + PAGE_CACHE_SIZE,
                .range_end      = (loff_t)-1,
        };
 
-
        ret = __extent_writepage(page, wbc, &epd);
 
        extent_write_cache_pages(tree, mapping, &wbc_writepages,
                                 __extent_writepage, &epd, flush_write_bio);
-       if (epd.bio)
-               submit_one_bio(WRITE, epd.bio, 0, 0);
+       flush_epd_write_bio(&epd);
        return ret;
 }
 
@@ -2515,6 +2555,7 @@ int extent_write_locked_range(struct extent_io_tree *tree, struct inode *inode,
                .tree = tree,
                .get_extent = get_extent,
                .extent_locked = 1,
+               .sync_io = mode == WB_SYNC_ALL,
        };
        struct writeback_control wbc_writepages = {
                .bdi            = inode->i_mapping->backing_dev_info,
@@ -2540,8 +2581,7 @@ int extent_write_locked_range(struct extent_io_tree *tree, struct inode *inode,
                start += PAGE_CACHE_SIZE;
        }
 
-       if (epd.bio)
-               submit_one_bio(WRITE, epd.bio, 0, 0);
+       flush_epd_write_bio(&epd);
        return ret;
 }
 
@@ -2556,13 +2596,13 @@ int extent_writepages(struct extent_io_tree *tree,
                .tree = tree,
                .get_extent = get_extent,
                .extent_locked = 0,
+               .sync_io = wbc->sync_mode == WB_SYNC_ALL,
        };
 
        ret = extent_write_cache_pages(tree, mapping, wbc,
                                       __extent_writepage, &epd,
                                       flush_write_bio);
-       if (epd.bio)
-               submit_one_bio(WRITE, epd.bio, 0, 0);
+       flush_epd_write_bio(&epd);
        return ret;
 }
 
index 9c9fb46..482f8db 100644 (file)
@@ -830,7 +830,7 @@ again:
 
                ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
                BUG_ON(ret);
-               goto done;
+               goto release;
        } else if (split == start) {
                if (locked_end < extent_end) {
                        ret = try_lock_extent(&BTRFS_I(inode)->io_tree,
@@ -926,6 +926,8 @@ again:
        }
 done:
        btrfs_mark_buffer_dirty(leaf);
+
+release:
        btrfs_release_path(root, path);
        if (split_end && split == start) {
                split = end;
@@ -1131,7 +1133,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
                if (will_write) {
                        btrfs_fdatawrite_range(inode->i_mapping, pos,
                                               pos + write_bytes - 1,
-                                              WB_SYNC_NONE);
+                                              WB_SYNC_ALL);
                } else {
                        balance_dirty_pages_ratelimited_nr(inode->i_mapping,
                                                           num_pages);
index a0d1dd4..65219f6 100644 (file)
@@ -4970,10 +4970,10 @@ out_fail:
        return err;
 }
 
-static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
+static int prealloc_file_range(struct btrfs_trans_handle *trans,
+                              struct inode *inode, u64 start, u64 end,
                               u64 alloc_hint, int mode)
 {
-       struct btrfs_trans_handle *trans;
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_key ins;
        u64 alloc_size;
@@ -4981,10 +4981,6 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end,
        u64 num_bytes = end - start;
        int ret = 0;
 
-       trans = btrfs_join_transaction(root, 1);
-       BUG_ON(!trans);
-       btrfs_set_trans_block_group(trans, inode);
-
        while (num_bytes > 0) {
                alloc_size = min(num_bytes, root->fs_info->max_extent);
                ret = btrfs_reserve_extent(trans, root, alloc_size,
@@ -5015,7 +5011,6 @@ out:
                BUG_ON(ret);
        }
 
-       btrfs_end_transaction(trans, root);
        return ret;
 }
 
@@ -5029,11 +5024,18 @@ static long btrfs_fallocate(struct inode *inode, int mode,
        u64 alloc_hint = 0;
        u64 mask = BTRFS_I(inode)->root->sectorsize - 1;
        struct extent_map *em;
+       struct btrfs_trans_handle *trans;
        int ret;
 
        alloc_start = offset & ~mask;
        alloc_end =  (offset + len + mask) & ~mask;
 
+       /*
+        * wait for ordered IO before we have any locks.  We'll loop again
+        * below with the locks held.
+        */
+       btrfs_wait_ordered_range(inode, alloc_start, alloc_end - alloc_start);
+
        mutex_lock(&inode->i_mutex);
        if (alloc_start > inode->i_size) {
                ret = btrfs_cont_expand(inode, alloc_start);
@@ -5043,6 +5045,16 @@ static long btrfs_fallocate(struct inode *inode, int mode,
 
        while (1) {
                struct btrfs_ordered_extent *ordered;
+
+               trans = btrfs_start_transaction(BTRFS_I(inode)->root, 1);
+               if (!trans) {
+                       ret = -EIO;
+                       goto out;
+               }
+
+               /* the extent lock is ordered inside the running
+                * transaction
+                */
                lock_extent(&BTRFS_I(inode)->io_tree, alloc_start,
                            alloc_end - 1, GFP_NOFS);
                ordered = btrfs_lookup_first_ordered_extent(inode,
@@ -5053,6 +5065,12 @@ static long btrfs_fallocate(struct inode *inode, int mode,
                        btrfs_put_ordered_extent(ordered);
                        unlock_extent(&BTRFS_I(inode)->io_tree,
                                      alloc_start, alloc_end - 1, GFP_NOFS);
+                       btrfs_end_transaction(trans, BTRFS_I(inode)->root);
+
+                       /*
+                        * we can't wait on the range with the transaction
+                        * running or with the extent lock held
+                        */
                        btrfs_wait_ordered_range(inode, alloc_start,
                                                 alloc_end - alloc_start);
                } else {
@@ -5070,7 +5088,7 @@ static long btrfs_fallocate(struct inode *inode, int mode,
                last_byte = min(extent_map_end(em), alloc_end);
                last_byte = (last_byte + mask) & ~mask;
                if (em->block_start == EXTENT_MAP_HOLE) {
-                       ret = prealloc_file_range(inode, cur_offset,
+                       ret = prealloc_file_range(trans, inode, cur_offset,
                                        last_byte, alloc_hint, mode);
                        if (ret < 0) {
                                free_extent_map(em);
@@ -5089,6 +5107,8 @@ static long btrfs_fallocate(struct inode *inode, int mode,
        }
        unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, alloc_end - 1,
                      GFP_NOFS);
+
+       btrfs_end_transaction(trans, BTRFS_I(inode)->root);
 out:
        mutex_unlock(&inode->i_mutex);
        return ret;
index 7594bec..9f135e8 100644 (file)
@@ -461,15 +461,9 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
-
-       if (!vol_args)
-               return -ENOMEM;
-
-       if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
-               ret = -EFAULT;
-               goto out;
-       }
+       vol_args = memdup_user(arg, sizeof(*vol_args));
+       if (IS_ERR(vol_args))
+               return PTR_ERR(vol_args);
 
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
@@ -545,7 +539,6 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg)
 
 out_unlock:
        mutex_unlock(&root->fs_info->volume_mutex);
-out:
        kfree(vol_args);
        return ret;
 }
@@ -565,15 +558,9 @@ static noinline int btrfs_ioctl_snap_create(struct file *file,
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
 
-       vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
-
-       if (!vol_args)
-               return -ENOMEM;
-
-       if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
-               ret = -EFAULT;
-               goto out;
-       }
+       vol_args = memdup_user(arg, sizeof(*vol_args));
+       if (IS_ERR(vol_args))
+               return PTR_ERR(vol_args);
 
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
@@ -675,19 +662,13 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
+       vol_args = memdup_user(arg, sizeof(*vol_args));
+       if (IS_ERR(vol_args))
+               return PTR_ERR(vol_args);
 
-       if (!vol_args)
-               return -ENOMEM;
-
-       if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
-               ret = -EFAULT;
-               goto out;
-       }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_init_new_device(root, vol_args->name);
 
-out:
        kfree(vol_args);
        return ret;
 }
@@ -703,19 +684,13 @@ static long btrfs_ioctl_rm_dev(struct btrfs_root *root, void __user *arg)
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
 
-       vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
+       vol_args = memdup_user(arg, sizeof(*vol_args));
+       if (IS_ERR(vol_args))
+               return PTR_ERR(vol_args);
 
-       if (!vol_args)
-               return -ENOMEM;
-
-       if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
-               ret = -EFAULT;
-               goto out;
-       }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_rm_device(root, vol_args->name);
 
-out:
        kfree(vol_args);
        return ret;
 }
index 53c87b1..d6f0806 100644 (file)
@@ -489,7 +489,7 @@ again:
        /* start IO across the range first to instantiate any delalloc
         * extents
         */
-       btrfs_fdatawrite_range(inode->i_mapping, start, orig_end, WB_SYNC_NONE);
+       btrfs_fdatawrite_range(inode->i_mapping, start, orig_end, WB_SYNC_ALL);
 
        /* The compression code will leave pages locked but return from
         * writepage without setting the page writeback.  Starting again
index 9744af9..a7acfe6 100644 (file)
@@ -635,14 +635,9 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       vol = kmalloc(sizeof(*vol), GFP_KERNEL);
-       if (!vol)
-               return -ENOMEM;
-
-       if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
-               ret = -EFAULT;
-               goto out;
-       }
+       vol = memdup_user((void __user *)arg, sizeof(*vol));
+       if (IS_ERR(vol))
+               return PTR_ERR(vol);
 
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
@@ -650,7 +645,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
                                            &btrfs_fs_type, &fs_devices);
                break;
        }
-out:
+
        kfree(vol);
        return ret;
 }
index e0913e4..e53835b 100644 (file)
@@ -125,6 +125,20 @@ static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
        return NULL;
 }
 
+static void requeue_list(struct btrfs_pending_bios *pending_bios,
+                       struct bio *head, struct bio *tail)
+{
+
+       struct bio *old_head;
+
+       old_head = pending_bios->head;
+       pending_bios->head = head;
+       if (pending_bios->tail)
+               tail->bi_next = old_head;
+       else
+               pending_bios->tail = tail;
+}
+
 /*
  * we try to collect pending bios for a device so we don't get a large
  * number of procs sending bios down to the same device.  This greatly
@@ -141,10 +155,12 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
        struct bio *pending;
        struct backing_dev_info *bdi;
        struct btrfs_fs_info *fs_info;
+       struct btrfs_pending_bios *pending_bios;
        struct bio *tail;
        struct bio *cur;
        int again = 0;
-       unsigned long num_run = 0;
+       unsigned long num_run;
+       unsigned long num_sync_run;
        unsigned long limit;
        unsigned long last_waited = 0;
 
@@ -153,20 +169,30 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
        limit = btrfs_async_submit_limit(fs_info);
        limit = limit * 2 / 3;
 
+       /* we want to make sure that every time we switch from the sync
+        * list to the normal list, we unplug
+        */
+       num_sync_run = 0;
+
 loop:
        spin_lock(&device->io_lock);
+       num_run = 0;
 
 loop_lock:
+
        /* take all the bios off the list at once and process them
         * later on (without the lock held).  But, remember the
         * tail and other pointers so the bios can be properly reinserted
         * into the list if we hit congestion
         */
-       pending = device->pending_bios;
-       tail = device->pending_bio_tail;
+       if (device->pending_sync_bios.head)
+               pending_bios = &device->pending_sync_bios;
+       else
+               pending_bios = &device->pending_bios;
+
+       pending = pending_bios->head;
+       tail = pending_bios->tail;
        WARN_ON(pending && !tail);
-       device->pending_bios = NULL;
-       device->pending_bio_tail = NULL;
 
        /*
         * if pending was null this time around, no bios need processing
@@ -176,16 +202,41 @@ loop_lock:
         * device->running_pending is used to synchronize with the
         * schedule_bio code.
         */
-       if (pending) {
-               again = 1;
-               device->running_pending = 1;
-       } else {
+       if (device->pending_sync_bios.head == NULL &&
+           device->pending_bios.head == NULL) {
                again = 0;
                device->running_pending = 0;
+       } else {
+               again = 1;
+               device->running_pending = 1;
        }
+
+       pending_bios->head = NULL;
+       pending_bios->tail = NULL;
+
        spin_unlock(&device->io_lock);
 
+       /*
+        * if we're doing the regular priority list, make sure we unplug
+        * for any high prio bios we've sent down
+        */
+       if (pending_bios == &device->pending_bios && num_sync_run > 0) {
+               num_sync_run = 0;
+               blk_run_backing_dev(bdi, NULL);
+       }
+
        while (pending) {
+
+               rmb();
+               if (pending_bios != &device->pending_sync_bios &&
+                   device->pending_sync_bios.head &&
+                   num_run > 16) {
+                       cond_resched();
+                       spin_lock(&device->io_lock);
+                       requeue_list(pending_bios, pending, tail);
+                       goto loop_lock;
+               }
+
                cur = pending;
                pending = pending->bi_next;
                cur->bi_next = NULL;
@@ -196,10 +247,18 @@ loop_lock:
                        wake_up(&fs_info->async_submit_wait);
 
                BUG_ON(atomic_read(&cur->bi_cnt) == 0);
-               bio_get(cur);
                submit_bio(cur->bi_rw, cur);
-               bio_put(cur);
                num_run++;
+               if (bio_sync(cur))
+                       num_sync_run++;
+
+               if (need_resched()) {
+                       if (num_sync_run) {
+                               blk_run_backing_dev(bdi, NULL);
+                               num_sync_run = 0;
+                       }
+                       cond_resched();
+               }
 
                /*
                 * we made progress, there is more work to do and the bdi
@@ -208,7 +267,6 @@ loop_lock:
                 */
                if (pending && bdi_write_congested(bdi) && num_run > 16 &&
                    fs_info->fs_devices->open_devices > 1) {
-                       struct bio *old_head;
                        struct io_context *ioc;
 
                        ioc = current->io_context;
@@ -233,17 +291,17 @@ loop_lock:
                                 * against it before looping
                                 */
                                last_waited = ioc->last_waited;
+                               if (need_resched()) {
+                                       if (num_sync_run) {
+                                               blk_run_backing_dev(bdi, NULL);
+                                               num_sync_run = 0;
+                                       }
+                                       cond_resched();
+                               }
                                continue;
                        }
                        spin_lock(&device->io_lock);
-
-                       old_head = device->pending_bios;
-                       device->pending_bios = pending;
-                       if (device->pending_bio_tail)
-                               tail->bi_next = old_head;
-                       else
-                               device->pending_bio_tail = tail;
-
+                       requeue_list(pending_bios, pending, tail);
                        device->running_pending = 1;
 
                        spin_unlock(&device->io_lock);
@@ -251,11 +309,18 @@ loop_lock:
                        goto done;
                }
        }
+
+       if (num_sync_run) {
+               num_sync_run = 0;
+               blk_run_backing_dev(bdi, NULL);
+       }
+
+       cond_resched();
        if (again)
                goto loop;
 
        spin_lock(&device->io_lock);
-       if (device->pending_bios)
+       if (device->pending_bios.head || device->pending_sync_bios.head)
                goto loop_lock;
        spin_unlock(&device->io_lock);
 
@@ -2497,7 +2562,7 @@ again:
                        max_errors = 1;
                }
        }
-       if (multi_ret && rw == WRITE &&
+       if (multi_ret && (rw & (1 << BIO_RW)) &&
            stripes_allocated < stripes_required) {
                stripes_allocated = map->num_stripes;
                free_extent_map(em);
@@ -2762,6 +2827,7 @@ static noinline int schedule_bio(struct btrfs_root *root,
                                 int rw, struct bio *bio)
 {
        int should_queue = 1;
+       struct btrfs_pending_bios *pending_bios;
 
        /* don't bother with additional async steps for reads, right now */
        if (!(rw & (1 << BIO_RW))) {
@@ -2783,13 +2849,17 @@ static noinline int schedule_bio(struct btrfs_root *root,
        bio->bi_rw |= rw;
 
        spin_lock(&device->io_lock);
+       if (bio_sync(bio))
+               pending_bios = &device->pending_sync_bios;
+       else
+               pending_bios = &device->pending_bios;
 
-       if (device->pending_bio_tail)
-               device->pending_bio_tail->bi_next = bio;
+       if (pending_bios->tail)
+               pending_bios->tail->bi_next = bio;
 
-       device->pending_bio_tail = bio;
-       if (!device->pending_bios)
-               device->pending_bios = bio;
+       pending_bios->tail = bio;
+       if (!pending_bios->head)
+               pending_bios->head = bio;
        if (device->running_pending)
                should_queue = 0;
 
index 2185de7..5836327 100644 (file)
 #include "async-thread.h"
 
 struct buffer_head;
+struct btrfs_pending_bios {
+       struct bio *head;
+       struct bio *tail;
+};
+
 struct btrfs_device {
        struct list_head dev_list;
        struct list_head dev_alloc_list;
        struct btrfs_fs_devices *fs_devices;
        struct btrfs_root *dev_root;
-       struct bio *pending_bios;
-       struct bio *pending_bio_tail;
+
+       /* regular prio bios */
+       struct btrfs_pending_bios pending_bios;
+       /* WRITE_SYNC bios */
+       struct btrfs_pending_bios pending_sync_bios;
+
        int running_pending;
        u64 generation;
 
index 3f84d5f..379a399 100644 (file)
@@ -181,22 +181,24 @@ asmlinkage long compat_sys_newstat(char __user * filename,
                struct compat_stat __user *statbuf)
 {
        struct kstat stat;
-       int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_compat_stat(&stat, statbuf);
-       return error;
+       error = vfs_stat(filename, &stat);
+       if (error)
+               return error;
+       return cp_compat_stat(&stat, statbuf);
 }
 
 asmlinkage long compat_sys_newlstat(char __user * filename,
                struct compat_stat __user *statbuf)
 {
        struct kstat stat;
-       int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_compat_stat(&stat, statbuf);
-       return error;
+       error = vfs_lstat(filename, &stat);
+       if (error)
+               return error;
+       return cp_compat_stat(&stat, statbuf);
 }
 
 #ifndef __ARCH_WANT_STAT64
@@ -204,21 +206,12 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename,
                struct compat_stat __user *statbuf, int flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
-
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-               error = cp_compat_stat(&stat, statbuf);
+       int error;
 
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_compat_stat(&stat, statbuf);
 }
 #endif
 
index 3e87ce4..b83f6bc 100644 (file)
@@ -58,7 +58,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-dev.h>
 #include <linux/atalk.h>
-#include <linux/loop.h>
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci.h>
@@ -68,6 +67,7 @@
 #include <linux/gigaset_dev.h>
 
 #ifdef CONFIG_BLOCK
+#include <linux/loop.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_ioctl.h>
 #include <scsi/sg.h>
@@ -2660,6 +2660,8 @@ HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl)
 HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl)
 /* block stuff */
 #ifdef CONFIG_BLOCK
+/* loop */
+IGNORE_IOCTL(LOOP_CLR_FD)
 /* Raw devices */
 HANDLE_IOCTL(RAW_SETBIND, raw_ioctl)
 HANDLE_IOCTL(RAW_GETBIND, raw_ioctl)
@@ -2728,9 +2730,6 @@ HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans)
 IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32)
 IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
 
-/* loop */
-IGNORE_IOCTL(LOOP_CLR_FD)
-
 #ifdef CONFIG_SPARC
 /* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
 IGNORE_IOCTL(FBIOGTYPE)
index 761d30b..1fcffeb 100644 (file)
@@ -2149,7 +2149,6 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
        int result;
        unsigned long seq;
 
-       /* FIXME: This is old behavior, needed? Please check callers. */
        if (new_dentry == old_dentry)
                return 1;
 
index a67fea6..dda3c58 100644 (file)
@@ -418,18 +418,13 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
 
        if (count == 0)
                goto out;
-       data = kmalloc(count, GFP_KERNEL);
-       if (!data) {
-               printk(KERN_ERR "%s: Out of memory whilst attempting to "
-                      "kmalloc([%zd], GFP_KERNEL)\n", __func__, count);
+
+       data = memdup_user(buf, count);
+       if (IS_ERR(data)) {
+               printk(KERN_ERR "%s: memdup_user returned error [%ld]\n",
+                      __func__, PTR_ERR(data));
                goto out;
        }
-       rc = copy_from_user(data, buf, count);
-       if (rc) {
-               printk(KERN_ERR "%s: copy_from_user returned error [%d]\n",
-                      __func__, rc);
-               goto out_free;
-       }
        sz = count;
        i = 0;
        switch (data[i++]) {
index 1aa7026..a24c58e 100644 (file)
@@ -199,7 +199,7 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
        return retval;
 }
 
-int get_filesystem_list(char * buf)
+int __init get_filesystem_list(char *buf)
 {
        int len = 0;
        struct file_system_type * tmp;
index bf23a62..70f87f4 100644 (file)
@@ -156,6 +156,12 @@ static void inode_go_sync(struct gfs2_glock *gl)
        error = filemap_fdatawait(metamapping);
        mapping_set_error(metamapping, error);
        gfs2_ail_empty_gl(gl);
+       /*
+        * Writeback of the data mapping may cause the dirty flag to be set
+        * so we have to clear it again here.
+        */
+       smp_mb__before_clear_bit();
+       clear_bit(GLF_DIRTY, &gl->gl_flags);
 }
 
 /**
index 101caf3..5d82e91 100644 (file)
@@ -413,7 +413,9 @@ out_unlock:
        gfs2_glock_dq(&gh);
 out:
        gfs2_holder_uninit(&gh);
-       if (ret)
+       if (ret == -ENOMEM)
+               ret = VM_FAULT_OOM;
+       else if (ret)
                ret = VM_FAULT_SIGBUS;
        return ret;
 }
index 23a3c76..153d968 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/pagevec.h>
 #include <linux/parser.h>
 #include <linux/mman.h>
-#include <linux/quotaops.h>
 #include <linux/slab.h>
 #include <linux/dnotify.h>
 #include <linux/statfs.h>
@@ -842,7 +841,7 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
 bad_val:
        printk(KERN_ERR "hugetlbfs: Bad value '%s' for mount option '%s'\n",
               args[0].from, p);
-       return 1;
+       return -EINVAL;
 }
 
 static int
index b8433eb..78f253c 100644 (file)
@@ -1248,6 +1248,8 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
        int err;
        struct qstr this;
 
+       WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));
+
        err = __lookup_one_len(name, &this, base, len);
        if (err)
                return ERR_PTR(err);
index d9138f8..4119620 100644 (file)
@@ -1377,7 +1377,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt,
        if (parent_path) {
                detach_mnt(source_mnt, parent_path);
                attach_mnt(source_mnt, path);
-               touch_mnt_namespace(current->nsproxy->mnt_ns);
+               touch_mnt_namespace(parent_path->mnt->mnt_ns);
        } else {
                mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt);
                commit_tree(source_mnt);
index f54360f..fa038df 100644 (file)
@@ -660,13 +660,10 @@ outrel:
                        if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN)
                                return -ENOMEM;
                        if (user.object_name_len) {
-                               newname = kmalloc(user.object_name_len, GFP_USER);
-                               if (!newname)
-                                       return -ENOMEM;
-                               if (copy_from_user(newname, user.object_name, user.object_name_len)) {
-                                       kfree(newname);
-                                       return -EFAULT;
-                               }
+                               newname = memdup_user(user.object_name,
+                                                     user.object_name_len);
+                               if (IS_ERR(newname))
+                                       return PTR_ERR(newname);
                        } else {
                                newname = NULL;
                        }
@@ -760,13 +757,9 @@ outrel:
                        if (user.len > NCP_PRIVATE_DATA_MAX_LEN)
                                return -ENOMEM;
                        if (user.len) {
-                               new = kmalloc(user.len, GFP_USER);
-                               if (!new)
-                                       return -ENOMEM;
-                               if (copy_from_user(new, user.data, user.len)) {
-                                       kfree(new);
-                                       return -EFAULT;
-                               }
+                               new = memdup_user(user.data, user.len);
+                               if (IS_ERR(new))
+                                       return PTR_ERR(new);
                        } else {
                                new = NULL;
                        }
index e6a1932..35869a4 100644 (file)
@@ -713,7 +713,8 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
        if (args->npages != 0)
                xdr_encode_pages(buf, args->pages, 0, args->len);
        else
-               req->rq_slen += args->len;
+               req->rq_slen = xdr_adjust_iovec(req->rq_svec,
+                               p + XDR_QUADLEN(args->len));
 
        err = nfsacl_encode(buf, base, args->inode,
                            (args->mask & NFS_ACL) ?
index 3444c00..5275097 100644 (file)
@@ -229,21 +229,23 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
                goto out;
        status = vfs_readdir(filp, nfsd4_build_namelist, &names);
        fput(filp);
+       mutex_lock(&dir->d_inode->i_mutex);
        while (!list_empty(&names)) {
                entry = list_entry(names.next, struct name_list, list);
 
                dentry = lookup_one_len(entry->name, dir, HEXDIR_LEN-1);
                if (IS_ERR(dentry)) {
                        status = PTR_ERR(dentry);
-                       goto out;
+                       break;
                }
                status = f(dir, dentry);
                dput(dentry);
                if (status)
-                       goto out;
+                       break;
                list_del(&entry->list);
                kfree(entry);
        }
+       mutex_unlock(&dir->d_inode->i_mutex);
 out:
        while (!list_empty(&names)) {
                entry = list_entry(names.next, struct name_list, list);
@@ -255,36 +257,6 @@ out:
 }
 
 static int
-nfsd4_remove_clid_file(struct dentry *dir, struct dentry *dentry)
-{
-       int status;
-
-       if (!S_ISREG(dir->d_inode->i_mode)) {
-               printk("nfsd4: non-file found in client recovery directory\n");
-               return -EINVAL;
-       }
-       mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
-       status = vfs_unlink(dir->d_inode, dentry);
-       mutex_unlock(&dir->d_inode->i_mutex);
-       return status;
-}
-
-static int
-nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry)
-{
-       int status;
-
-       /* For now this directory should already be empty, but we empty it of
-        * any regular files anyway, just in case the directory was created by
-        * a kernel from the future.... */
-       nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
-       mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
-       status = vfs_rmdir(dir->d_inode, dentry);
-       mutex_unlock(&dir->d_inode->i_mutex);
-       return status;
-}
-
-static int
 nfsd4_unlink_clid_dir(char *name, int namlen)
 {
        struct dentry *dentry;
@@ -294,18 +266,18 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
 
        mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
        dentry = lookup_one_len(name, rec_dir.dentry, namlen);
-       mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
        if (IS_ERR(dentry)) {
                status = PTR_ERR(dentry);
-               return status;
+               goto out_unlock;
        }
        status = -ENOENT;
        if (!dentry->d_inode)
                goto out;
-
-       status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry);
+       status = vfs_rmdir(rec_dir.dentry->d_inode, dentry);
 out:
        dput(dentry);
+out_unlock:
+       mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
        return status;
 }
 
@@ -348,7 +320,7 @@ purge_old(struct dentry *parent, struct dentry *child)
        if (nfs4_has_reclaimed_state(child->d_name.name, false))
                return 0;
 
-       status = nfsd4_clear_clid_dir(parent, child);
+       status = vfs_rmdir(parent->d_inode, child);
        if (status)
                printk("failed to remove client recovery directory %s\n",
                                child->d_name.name);
index ab93fcf..6c68ffd 100644 (file)
@@ -116,10 +116,15 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
        }
        if ((exp->ex_flags & NFSEXP_CROSSMOUNT) || EX_NOHIDE(exp2)) {
                /* successfully crossed mount point */
-               exp_put(exp);
-               *expp = exp2;
+               /*
+                * This is subtle: dentry is *not* under mnt at this point.
+                * The only reason we are safe is that original mnt is pinned
+                * down by exp, so we should dput before putting exp.
+                */
                dput(dentry);
                *dpp = mounts;
+               exp_put(exp);
+               *expp = exp2;
        } else {
                exp_put(exp2);
                dput(mounts);
@@ -1885,8 +1890,8 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen,
        return 0;
 }
 
-static int nfsd_buffered_readdir(struct file *file, filldir_t func,
-                                struct readdir_cd *cdp, loff_t *offsetp)
+static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
+                                   struct readdir_cd *cdp, loff_t *offsetp)
 {
        struct readdir_data buf;
        struct buffered_dirent *de;
@@ -1896,11 +1901,12 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
 
        buf.dirent = (void *)__get_free_page(GFP_KERNEL);
        if (!buf.dirent)
-               return -ENOMEM;
+               return nfserrno(-ENOMEM);
 
        offset = *offsetp;
 
        while (1) {
+               struct inode *dir_inode = file->f_path.dentry->d_inode;
                unsigned int reclen;
 
                cdp->err = nfserr_eof; /* will be cleared on successful read */
@@ -1919,26 +1925,38 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func,
                if (!size)
                        break;
 
+               /*
+                * Various filldir functions may end up calling back into
+                * lookup_one_len() and the file system's ->lookup() method.
+                * These expect i_mutex to be held, as it would within readdir.
+                */
+               host_err = mutex_lock_killable(&dir_inode->i_mutex);
+               if (host_err)
+                       break;
+
                de = (struct buffered_dirent *)buf.dirent;
                while (size > 0) {
                        offset = de->offset;
 
                        if (func(cdp, de->name, de->namlen, de->offset,
                                 de->ino, de->d_type))
-                               goto done;
+                               break;
 
                        if (cdp->err != nfs_ok)
-                               goto done;
+                               break;
 
                        reclen = ALIGN(sizeof(*de) + de->namlen,
                                       sizeof(u64));
                        size -= reclen;
                        de = (struct buffered_dirent *)((char *)de + reclen);
                }
+               mutex_unlock(&dir_inode->i_mutex);
+               if (size > 0) /* We bailed out early */
+                       break;
+
                offset = vfs_llseek(file, 0, SEEK_CUR);
        }
 
- done:
        free_page((unsigned long)(buf.dirent));
 
        if (host_err)
index 2db740a..075694e 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -55,59 +55,54 @@ int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
 
 EXPORT_SYMBOL(vfs_getattr);
 
-int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
+int vfs_fstat(unsigned int fd, struct kstat *stat)
 {
-       struct path path;
-       int error;
+       struct file *f = fget(fd);
+       int error = -EBADF;
 
-       error = user_path_at(dfd, name, LOOKUP_FOLLOW, &path);
-       if (!error) {
-               error = vfs_getattr(path.mnt, path.dentry, stat);
-               path_put(&path);
+       if (f) {
+               error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
+               fput(f);
        }
        return error;
 }
+EXPORT_SYMBOL(vfs_fstat);
 
-int vfs_stat(char __user *name, struct kstat *stat)
+int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag)
 {
-       return vfs_stat_fd(AT_FDCWD, name, stat);
-}
+       struct path path;
+       int error = -EINVAL;
+       int lookup_flags = 0;
 
-EXPORT_SYMBOL(vfs_stat);
+       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+               goto out;
 
-int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat)
-{
-       struct path path;
-       int error;
+       if (!(flag & AT_SYMLINK_NOFOLLOW))
+               lookup_flags |= LOOKUP_FOLLOW;
 
-       error = user_path_at(dfd, name, 0, &path);
-       if (!error) {
-               error = vfs_getattr(path.mnt, path.dentry, stat);
-               path_put(&path);
-       }
+       error = user_path_at(dfd, filename, lookup_flags, &path);
+       if (error)
+               goto out;
+
+       error = vfs_getattr(path.mnt, path.dentry, stat);
+       path_put(&path);
+out:
        return error;
 }
+EXPORT_SYMBOL(vfs_fstatat);
 
-int vfs_lstat(char __user *name, struct kstat *stat)
+int vfs_stat(char __user *name, struct kstat *stat)
 {
-       return vfs_lstat_fd(AT_FDCWD, name, stat);
+       return vfs_fstatat(AT_FDCWD, name, stat, 0);
 }
+EXPORT_SYMBOL(vfs_stat);
 
-EXPORT_SYMBOL(vfs_lstat);
-
-int vfs_fstat(unsigned int fd, struct kstat *stat)
+int vfs_lstat(char __user *name, struct kstat *stat)
 {
-       struct file *f = fget(fd);
-       int error = -EBADF;
-
-       if (f) {
-               error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
-               fput(f);
-       }
-       return error;
+       return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW);
 }
+EXPORT_SYMBOL(vfs_lstat);
 
-EXPORT_SYMBOL(vfs_fstat);
 
 #ifdef __ARCH_WANT_OLD_STAT
 
@@ -155,23 +150,25 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
 SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
 {
        struct kstat stat;
-       int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_old_stat(&stat, statbuf);
+       error = vfs_stat(filename, &stat);
+       if (error)
+               return error;
 
-       return error;
+       return cp_old_stat(&stat, statbuf);
 }
 
 SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
 {
        struct kstat stat;
-       int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_old_stat(&stat, statbuf);
+       error = vfs_lstat(filename, &stat);
+       if (error)
+               return error;
 
-       return error;
+       return cp_old_stat(&stat, statbuf);
 }
 
 SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
@@ -240,23 +237,23 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
 {
        struct kstat stat;
-       int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
-
-       if (!error)
-               error = cp_new_stat(&stat, statbuf);
+       int error = vfs_stat(filename, &stat);
 
-       return error;
+       if (error)
+               return error;
+       return cp_new_stat(&stat, statbuf);
 }
 
 SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
 {
        struct kstat stat;
-       int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
+       int error;
 
-       if (!error)
-               error = cp_new_stat(&stat, statbuf);
+       error = vfs_lstat(filename, &stat);
+       if (error)
+               return error;
 
-       return error;
+       return cp_new_stat(&stat, statbuf);
 }
 
 #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
@@ -264,21 +261,12 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
                struct stat __user *, statbuf, int, flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
-
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-               error = cp_new_stat(&stat, statbuf);
+       int error;
 
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_new_stat(&stat, statbuf);
 }
 #endif
 
@@ -404,21 +392,12 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
                struct stat64 __user *, statbuf, int, flag)
 {
        struct kstat stat;
-       int error = -EINVAL;
-
-       if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
-               goto out;
-
-       if (flag & AT_SYMLINK_NOFOLLOW)
-               error = vfs_lstat_fd(dfd, filename, &stat);
-       else
-               error = vfs_stat_fd(dfd, filename, &stat);
-
-       if (!error)
-               error = cp_new_stat64(&stat, statbuf);
+       int error;
 
-out:
-       return error;
+       error = vfs_fstatat(dfd, filename, &stat, flag);
+       if (error)
+               return error;
+       return cp_new_stat64(&stat, statbuf);
 }
 #endif /* __ARCH_WANT_STAT64 */
 
index 93e0c02..9345806 100644 (file)
@@ -157,14 +157,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
                        count = size - offs;
        }
 
-       temp = kmalloc(count, GFP_KERNEL);
-       if (!temp)
-               return -ENOMEM;
-
-       if (copy_from_user(temp, userbuf, count)) {
-               count = -EFAULT;
-               goto out_free;
-       }
+       temp = memdup_user(userbuf, count);
+       if (IS_ERR(temp))
+               return PTR_ERR(temp);
 
        mutex_lock(&bb->mutex);
 
@@ -176,8 +171,6 @@ static ssize_t write(struct file *file, const char __user *userbuf,
        if (count > 0)
                *off = offs + count;
 
-out_free:
-       kfree(temp);
        return count;
 }
 
index 197c4fc..d51b8f9 100644 (file)
@@ -237,13 +237,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
        if (size) {
                if (size > XATTR_SIZE_MAX)
                        return -E2BIG;
-               kvalue = kmalloc(size, GFP_KERNEL);
-               if (!kvalue)
-                       return -ENOMEM;
-               if (copy_from_user(kvalue, value, size)) {
-                       kfree(kvalue);
-                       return -EFAULT;
-               }
+               kvalue = memdup_user(value, size);
+               if (IS_ERR(kvalue))
+                       return PTR_ERR(kvalue);
        }
 
        error = vfs_setxattr(d, kname, kvalue, size, flags);
index d0b4994..34eaab6 100644 (file)
@@ -489,17 +489,12 @@ xfs_attrmulti_attr_set(
        if (len > XATTR_SIZE_MAX)
                return EINVAL;
 
-       kbuf = kmalloc(len, GFP_KERNEL);
-       if (!kbuf)
-               return ENOMEM;
-
-       if (copy_from_user(kbuf, ubuf, len))
-               goto out_kfree;
+       kbuf = memdup_user(ubuf, len);
+       if (IS_ERR(kbuf))
+               return PTR_ERR(kbuf);
 
        error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
 
- out_kfree:
-       kfree(kbuf);
        return error;
 }
 
@@ -540,20 +535,16 @@ xfs_attrmulti_by_handle(
        if (!size || size > 16 * PAGE_SIZE)
                goto out_dput;
 
-       error = ENOMEM;
-       ops = kmalloc(size, GFP_KERNEL);
-       if (!ops)
+       ops = memdup_user(am_hreq.ops, size);
+       if (IS_ERR(ops)) {
+               error = PTR_ERR(ops);
                goto out_dput;
-
-       error = EFAULT;
-       if (copy_from_user(ops, am_hreq.ops, size))
-               goto out_kfree_ops;
+       }
 
        attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL);
        if (!attr_name)
                goto out_kfree_ops;
 
-
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
                ops[i].am_error = strncpy_from_user(attr_name,
index c70c4e3..0882d16 100644 (file)
@@ -427,20 +427,16 @@ xfs_compat_attrmulti_by_handle(
        if (!size || size > 16 * PAGE_SIZE)
                goto out_dput;
 
-       error = ENOMEM;
-       ops = kmalloc(size, GFP_KERNEL);
-       if (!ops)
+       ops = memdup_user(compat_ptr(am_hreq.ops), size);
+       if (IS_ERR(ops)) {
+               error = PTR_ERR(ops);
                goto out_dput;
-
-       error = EFAULT;
-       if (copy_from_user(ops, compat_ptr(am_hreq.ops), size))
-               goto out_kfree_ops;
+       }
 
        attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL);
        if (!attr_name)
                goto out_kfree_ops;
 
-
        error = 0;
        for (i = 0; i < am_hreq.opcount; i++) {
                ops[i].am_error = strncpy_from_user(attr_name,
index b0e63c6..d7d50d7 100644 (file)
@@ -1,13 +1,9 @@
 #ifndef _ASM_GENERIC_PERCPU_H_
 #define _ASM_GENERIC_PERCPU_H_
+
 #include <linux/compiler.h>
 #include <linux/threads.h>
-
-/*
- * Determine the real variable name from the name visible in the
- * kernel sources.
- */
-#define per_cpu_var(var) per_cpu__##var
+#include <linux/percpu-defs.h>
 
 #ifdef CONFIG_SMP
 
@@ -73,11 +69,32 @@ extern void setup_per_cpu_areas(void);
 
 #endif /* SMP */
 
+#ifndef PER_CPU_BASE_SECTION
+#ifdef CONFIG_SMP
+#define PER_CPU_BASE_SECTION ".data.percpu"
+#else
+#define PER_CPU_BASE_SECTION ".data"
+#endif
+#endif
+
+#ifdef CONFIG_SMP
+
+#ifdef MODULE
+#define PER_CPU_SHARED_ALIGNED_SECTION ""
+#else
+#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
+#endif
+#define PER_CPU_FIRST_SECTION ".first"
+
+#else
+
+#define PER_CPU_SHARED_ALIGNED_SECTION ""
+#define PER_CPU_FIRST_SECTION ""
+
+#endif
+
 #ifndef PER_CPU_ATTRIBUTES
 #define PER_CPU_ATTRIBUTES
 #endif
 
-#define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \
-                                       __typeof__(type) per_cpu_var(name)
-
 #endif /* _ASM_GENERIC_PERCPU_H_ */
index 573819e..5a40d14 100644 (file)
@@ -143,7 +143,9 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
  *                     400-499: Perfect
  *                             The ideal clocksource. A must-use where
  *                             available.
- * @read:              returns a cycle value
+ * @read:              returns a cycle value, passes clocksource as argument
+ * @enable:            optional function to enable the clocksource
+ * @disable:           optional function to disable the clocksource
  * @mask:              bitmask for two's complement
  *                     subtraction of non 64 bit counters
  * @mult:              cycle to nanosecond multiplier (adjusted by NTP)
@@ -162,7 +164,9 @@ struct clocksource {
        char *name;
        struct list_head list;
        int rating;
-       cycle_t (*read)(void);
+       cycle_t (*read)(struct clocksource *cs);
+       int (*enable)(struct clocksource *cs);
+       void (*disable)(struct clocksource *cs);
        cycle_t mask;
        u32 mult;
        u32 mult_orig;
@@ -271,7 +275,34 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
  */
 static inline cycle_t clocksource_read(struct clocksource *cs)
 {
-       return cs->read();
+       return cs->read(cs);
+}
+
+/**
+ * clocksource_enable: - enable clocksource
+ * @cs:                pointer to clocksource
+ *
+ * Enables the specified clocksource. The clocksource callback
+ * function should start up the hardware and setup mult and field
+ * members of struct clocksource to reflect hardware capabilities.
+ */
+static inline int clocksource_enable(struct clocksource *cs)
+{
+       return cs->enable ? cs->enable(cs) : 0;
+}
+
+/**
+ * clocksource_disable: - disable clocksource
+ * @cs:                pointer to clocksource
+ *
+ * Disables the specified clocksource. The clocksource callback
+ * function should power down the now unused hardware block to
+ * save power.
+ */
+static inline void clocksource_disable(struct clocksource *cs)
+{
+       if (cs->disable)
+               cs->disable(cs);
 }
 
 /**
index 2918c0e..6a69caa 100644 (file)
@@ -551,6 +551,7 @@ extern int (*platform_notify_remove)(struct device *dev);
 extern struct device *get_device(struct device *dev);
 extern void put_device(struct device *dev);
 
+extern void wait_for_device_probe(void);
 
 /* drivers/base/power/shutdown.c */
 extern void device_shutdown(void);
index e766be0..5bed436 100644 (file)
@@ -2299,9 +2299,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *);
 
 extern int vfs_stat(char __user *, struct kstat *);
 extern int vfs_lstat(char __user *, struct kstat *);
-extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
-extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
 extern int vfs_fstat(unsigned int, struct kstat *);
+extern int vfs_fstatat(int , char __user *, struct kstat *, int);
 
 extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
                    unsigned long arg);
@@ -2449,7 +2448,7 @@ struct ctl_table;
 int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
                  void __user *buffer, size_t *lenp, loff_t *ppos);
 
-int get_filesystem_list(char * buf);
+int __init get_filesystem_list(char *buf);
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_FS_H */
index 7ebdb4f..65aae34 100644 (file)
@@ -198,6 +198,8 @@ struct kernel_ipmi_msg {
                                              response.  When you send a
                                              response message, this will
                                              be returned. */
+#define IPMI_OEM_RECV_TYPE             5 /* The response for OEM Channels */
+
 /* Note that async events and received commands do not have a completion
    code as the first byte of the incoming data, unlike a response. */
 
index b56a158..df97e6e 100644 (file)
 #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35
 #define IPMI_GET_CHANNEL_INFO_CMD      0x42
 
+/* Bit for BMC global enables. */
+#define IPMI_BMC_RCV_MSG_INTR     0x01
+#define IPMI_BMC_EVT_MSG_INTR     0x02
+#define IPMI_BMC_EVT_MSG_BUFF     0x04
+#define IPMI_BMC_SYS_LOG          0x08
+
 #define IPMI_NETFN_STORAGE_REQUEST             0x0a
 #define IPMI_NETFN_STORAGE_RESPONSE            0x0b
 #define IPMI_ADD_SEL_ENTRY_CMD         0x44
 #define IPMI_CHANNEL_MEDIUM_USB1       10
 #define IPMI_CHANNEL_MEDIUM_USB2       11
 #define IPMI_CHANNEL_MEDIUM_SYSINTF    12
+#define IPMI_CHANNEL_MEDIUM_OEM_MIN    0x60
+#define IPMI_CHANNEL_MEDIUM_OEM_MAX    0x7f
 
 #endif /* __LINUX_IPMI_MSGDEFS_H */
index 18146c9..a9e3b76 100644 (file)
@@ -75,7 +75,7 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
 {
        struct mem_cgroup *mem;
        rcu_read_lock();
-       mem = mem_cgroup_from_task((mm)->owner);
+       mem = mem_cgroup_from_task(rcu_dereference((mm)->owner));
        rcu_read_unlock();
        return cgroup == mem;
 }
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
new file mode 100644 (file)
index 0000000..8f921d7
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef _LINUX_PERCPU_DEFS_H
+#define _LINUX_PERCPU_DEFS_H
+
+/*
+ * Determine the real variable name from the name visible in the
+ * kernel sources.
+ */
+#define per_cpu_var(var) per_cpu__##var
+
+/*
+ * Base implementations of per-CPU variable declarations and definitions, where
+ * the section in which the variable is to be placed is provided by the
+ * 'section' argument.  This may be used to affect the parameters governing the
+ * variable's storage.
+ *
+ * NOTE!  The sections for the DECLARE and for the DEFINE must match, lest
+ * linkage errors occur due the compiler generating the wrong code to access
+ * that section.
+ */
+#define DECLARE_PER_CPU_SECTION(type, name, section)                   \
+       extern                                                          \
+       __attribute__((__section__(PER_CPU_BASE_SECTION section)))      \
+       PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
+
+#define DEFINE_PER_CPU_SECTION(type, name, section)                    \
+       __attribute__((__section__(PER_CPU_BASE_SECTION section)))      \
+       PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
+
+/*
+ * Variant on the per-CPU variable declaration/definition theme used for
+ * ordinary per-CPU variables.
+ */
+#define DECLARE_PER_CPU(type, name)                                    \
+       DECLARE_PER_CPU_SECTION(type, name, "")
+
+#define DEFINE_PER_CPU(type, name)                                     \
+       DEFINE_PER_CPU_SECTION(type, name, "")
+
+/*
+ * Declaration/definition used for per-CPU variables that must come first in
+ * the set of variables.
+ */
+#define DECLARE_PER_CPU_FIRST(type, name)                              \
+       DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
+
+#define DEFINE_PER_CPU_FIRST(type, name)                               \
+       DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
+
+/*
+ * Declaration/definition used for per-CPU variables that must be cacheline
+ * aligned under SMP conditions so that, whilst a particular instance of the
+ * data corresponds to a particular CPU, inefficiencies due to direct access by
+ * other CPUs are reduced by preventing the data from unnecessarily spanning
+ * cachelines.
+ *
+ * An example of this would be statistical data, where each CPU's set of data
+ * is updated by that CPU alone, but the data from across all CPUs is collated
+ * by a CPU processing a read from a proc file.
+ */
+#define DECLARE_PER_CPU_SHARED_ALIGNED(type, name)                     \
+       DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
+       ____cacheline_aligned_in_smp
+
+#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name)                      \
+       DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
+       ____cacheline_aligned_in_smp
+
+/*
+ * Declaration/definition used for per-CPU variables that must be page aligned.
+ */
+#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name)                               \
+       DECLARE_PER_CPU_SECTION(type, name, ".page_aligned")
+
+#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name)                                \
+       DEFINE_PER_CPU_SECTION(type, name, ".page_aligned")
+
+/*
+ * Intermodule exports for per-CPU variables.
+ */
+#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
+#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+
+
+#endif /* _LINUX_PERCPU_DEFS_H */
index cfda2d5..1581ff2 100644 (file)
@@ -9,50 +9,6 @@
 
 #include <asm/percpu.h>
 
-#ifndef PER_CPU_BASE_SECTION
-#ifdef CONFIG_SMP
-#define PER_CPU_BASE_SECTION ".data.percpu"
-#else
-#define PER_CPU_BASE_SECTION ".data"
-#endif
-#endif
-
-#ifdef CONFIG_SMP
-
-#ifdef MODULE
-#define PER_CPU_SHARED_ALIGNED_SECTION ""
-#else
-#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
-#endif
-#define PER_CPU_FIRST_SECTION ".first"
-
-#else
-
-#define PER_CPU_SHARED_ALIGNED_SECTION ""
-#define PER_CPU_FIRST_SECTION ""
-
-#endif
-
-#define DEFINE_PER_CPU_SECTION(type, name, section)                    \
-       __attribute__((__section__(PER_CPU_BASE_SECTION section)))      \
-       PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
-
-#define DEFINE_PER_CPU(type, name)                                     \
-       DEFINE_PER_CPU_SECTION(type, name, "")
-
-#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name)                      \
-       DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
-       ____cacheline_aligned_in_smp
-
-#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name)                                \
-       DEFINE_PER_CPU_SECTION(type, name, ".page_aligned")
-
-#define DEFINE_PER_CPU_FIRST(type, name)                               \
-       DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
-
-#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
-#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
-
 /* enough to cover all DEFINE_PER_CPUs in modules */
 #ifdef CONFIG_MODULES
 #define PERCPU_MODULE_RESERVE          (8 << 10)
index 5621d87..6b361d2 100644 (file)
@@ -193,7 +193,7 @@ struct reiserfs_journal {
        atomic_t j_wcount;      /* count of writers for current commit */
        unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
        unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
-       unsigned long j_last_flush_trans_id;    /* last fully flushed journal timestamp */
+       unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */
        struct buffer_head *j_header_bh;
 
        time_t j_trans_start_time;      /* time this transaction started */
index 8595827..b65c888 100644 (file)
@@ -67,7 +67,7 @@ static inline void slow_work_init(struct slow_work *work,
 }
 
 /**
- * slow_work_init - Initialise a very slow work item
+ * vslow_work_init - Initialise a very slow work item
  * @work: The work item to initialise
  * @ops: The operations to use to handle the slow work item
  *
index 2cc43fa..a0faa18 100644 (file)
@@ -245,7 +245,12 @@ struct spi_master {
         */
        u16                     dma_alignment;
 
-       /* setup mode and clock, etc (spi driver may call many times) */
+       /* Setup mode and clock, etc (spi driver may call many times).
+        *
+        * IMPORTANT:  this may be called when transfers to another
+        * device are active.  DO NOT UPDATE SHARED REGISTERS in ways
+        * which could break those transfers.
+        */
        int                     (*setup)(struct spi_device *spi);
 
        /* bidirectional bulk transfers
index dabe4ad..40617c1 100644 (file)
@@ -148,7 +148,7 @@ struct old_linux_dirent;
        asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"      \
             "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
 #else
-#ifdef CONFIG_ALPHA
+#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS)
 #define SYSCALL_ALIAS(alias, name)                                     \
        asm ( #alias " = " #name "\n\t.globl " #alias)
 #else
index 917ab95..6e73517 100644 (file)
@@ -734,9 +734,6 @@ int audit_tag_tree(char *old, char *new)
        dentry = dget(path.dentry);
        path_put(&path);
 
-       if (dentry == tagged->mnt_root && dentry == mnt->mnt_root)
-               follow_up(&mnt, &dentry);
-
        list_add_tail(&list, &tagged->mnt_list);
 
        mutex_lock(&audit_filter_mutex);
index c46c931..ecfd7b5 100644 (file)
@@ -181,12 +181,12 @@ static void clocksource_watchdog(unsigned long data)
 
        resumed = test_and_clear_bit(0, &watchdog_resumed);
 
-       wdnow = watchdog->read();
+       wdnow = watchdog->read(watchdog);
        wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask);
        watchdog_last = wdnow;
 
        list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
-               csnow = cs->read();
+               csnow = cs->read(cs);
 
                if (unlikely(resumed)) {
                        cs->wd_last = csnow;
@@ -247,7 +247,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
 
                list_add(&cs->wd_list, &watchdog_list);
                if (!started && watchdog) {
-                       watchdog_last = watchdog->read();
+                       watchdog_last = watchdog->read(watchdog);
                        watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
                        add_timer_on(&watchdog_timer,
                                     cpumask_first(cpu_online_mask));
@@ -268,7 +268,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                                cse->flags &= ~CLOCK_SOURCE_WATCHDOG;
                        /* Start if list is not empty */
                        if (!list_empty(&watchdog_list)) {
-                               watchdog_last = watchdog->read();
+                               watchdog_last = watchdog->read(watchdog);
                                watchdog_timer.expires =
                                        jiffies + WATCHDOG_INTERVAL;
                                add_timer_on(&watchdog_timer,
index 06f1975..c3f6c30 100644 (file)
@@ -50,7 +50,7 @@
  */
 #define JIFFIES_SHIFT  8
 
-static cycle_t jiffies_read(void)
+static cycle_t jiffies_read(struct clocksource *cs)
 {
        return (cycle_t) jiffies;
 }
index 900f1b6..687dff4 100644 (file)
@@ -182,7 +182,7 @@ EXPORT_SYMBOL(do_settimeofday);
  */
 static void change_clocksource(void)
 {
-       struct clocksource *new;
+       struct clocksource *new, *old;
 
        new = clocksource_get_next();
 
@@ -191,11 +191,16 @@ static void change_clocksource(void)
 
        clocksource_forward_now();
 
-       new->raw_time = clock->raw_time;
+       if (clocksource_enable(new))
+               return;
 
+       new->raw_time = clock->raw_time;
+       old = clock;
        clock = new;
+       clocksource_disable(old);
+
        clock->cycle_last = 0;
-       clock->cycle_last = clocksource_read(new);
+       clock->cycle_last = clocksource_read(clock);
        clock->error = 0;
        clock->xtime_nsec = 0;
        clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH);
@@ -292,6 +297,7 @@ void __init timekeeping_init(void)
        ntp_init();
 
        clock = clocksource_get_next();
+       clocksource_enable(clock);
        clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH);
        clock->cycle_last = clocksource_read(clock);
 
index 99155b7..eac9577 100644 (file)
@@ -63,6 +63,9 @@ struct scan_control {
        /* Can mapped pages be reclaimed? */
        int may_unmap;
 
+       /* Can pages be swapped as part of reclaim? */
+       int may_swap;
+
        /* This context's SWAP_CLUSTER_MAX. If freeing memory for
         * suspend, we effectively ignore SWAP_CLUSTER_MAX.
         * In this context, it doesn't matter that we scan the
@@ -1380,7 +1383,7 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
        struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
 
        /* If we have no swap space, do not bother scanning anon pages. */
-       if (nr_swap_pages <= 0) {
+       if (!sc->may_swap || (nr_swap_pages <= 0)) {
                percent[0] = 0;
                percent[1] = 100;
                return;
@@ -1697,6 +1700,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
                .may_writepage = !laptop_mode,
                .swap_cluster_max = SWAP_CLUSTER_MAX,
                .may_unmap = 1,
+               .may_swap = 1,
                .swappiness = vm_swappiness,
                .order = order,
                .mem_cgroup = NULL,
@@ -1717,6 +1721,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
        struct scan_control sc = {
                .may_writepage = !laptop_mode,
                .may_unmap = 1,
+               .may_swap = !noswap,
                .swap_cluster_max = SWAP_CLUSTER_MAX,
                .swappiness = swappiness,
                .order = 0,
@@ -1726,9 +1731,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
        };
        struct zonelist *zonelist;
 
-       if (noswap)
-               sc.may_unmap = 0;
-
        sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
                        (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
        zonelist = NODE_DATA(numa_node_id())->node_zonelists;
@@ -1767,6 +1769,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
        struct scan_control sc = {
                .gfp_mask = GFP_KERNEL,
                .may_unmap = 1,
+               .may_swap = 1,
                .swap_cluster_max = SWAP_CLUSTER_MAX,
                .swappiness = vm_swappiness,
                .order = order,
@@ -2298,6 +2301,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
        struct scan_control sc = {
                .may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
                .may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
+               .may_swap = 1,
                .swap_cluster_max = max_t(unsigned long, nr_pages,
                                        SWAP_CLUSTER_MAX),
                .gfp_mask = gfp_mask,
index 619f0a3..7179444 100644 (file)
@@ -638,7 +638,7 @@ struct rds_message *rds_send_get_message(struct rds_connection *,
 void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force);
 
 /* stats.c */
-DECLARE_PER_CPU(struct rds_statistics, rds_stats);
+DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_statistics, rds_stats);
 #define rds_stats_inc_which(which, member) do {                \
        per_cpu(which, get_cpu()).member++;             \
        put_cpu();                                      \