]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Jun 2010 22:45:59 +0000 (15:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Jun 2010 22:45:59 +0000 (15:45 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6:
  Staging: rtl8192u_usb: Add LG device ID 043e:7a01
  Staging: rtl8192s_usb: Remove duplicate device ID
  Staging: rt2870: add device id for Zyxel NWD-270N
  Staging: comedi: fix read past end of array in cb_pcidda_attach()
  Staging: rtl8192su: add device ids
  Staging: rtl8192su: remove device ids
  Staging: rtl8187se: Fix compile warnings in 2.6.35-rc2
  Staging: wlags49_h2: Fix build error when CONFIG_SYSFS is not set
  Staging: wlags49_h2: add missing <linux/string.h> for strlen
  Staging: hv: fix hv_utils module to properly autoload
  staging: hv: Fix race condition on vmbus channel initialization
  Staging: comedi: drivers: adl_pci9111: Fix AI commands in TRIG_FOLLOW case
  Staging: mrst-touchscreen: fix dereferencing free memory
  Staging: batman-adv: fix function prototype
  Staging: batman-adv: return -EFAULT on copy_to_user errors
  staging: usbip: usbip_common: kill rx thread on tx thread creation error.

101 files changed:
MAINTAINERS
arch/arm/mach-omap2/board-omap3stalker.c
arch/arm/mach-omap2/clock44xx_data.c
arch/arm/mach-omap2/omap_hwmod.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/usb-ehci.c
arch/arm/mach-vexpress/ct-ca9x4.c
arch/arm/plat-omap/dmtimer.c
arch/arm/plat-omap/gpio.c
arch/arm/plat-omap/iovmm.c
arch/um/include/asm/arch_hweight.h [new file with mode: 0644]
arch/um/os-Linux/mem.c
arch/x86/boot/video-vga.c
arch/x86/include/asm/io_apic.h
arch/x86/include/asm/percpu.h
arch/x86/include/asm/pgtable_32_types.h
arch/x86/include/asm/system.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/cpu/perf_event_intel.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/pci-calgary_64.c
arch/x86/kernel/reboot.c
arch/x86/kernel/sfi.c
arch/x86/mm/pat.c
arch/x86/mm/pat_rbtree.c
block/blk-core.c
block/cfq-iosched.c
block/cfq.h [new file with mode: 0644]
drivers/acpi/apei/apei-base.c
drivers/acpi/atomicio.c
drivers/block/cciss_scsi.c
drivers/block/cpqarray.c
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_nl.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/rtc/rtc-davinci.c
drivers/rtc/rtc-ds1307.c
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/staging/tm6000/tm6000-alsa.c
drivers/staging/tm6000/tm6000-cards.c
drivers/staging/tm6000/tm6000-core.c
drivers/staging/tm6000/tm6000-dvb.c
drivers/usb/core/driver.c
drivers/usb/core/message.c
drivers/usb/gadget/f_eem.c
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/g_ffs.c
drivers/usb/gadget/printer.c
drivers/usb/gadget/s3c2410_udc.c
drivers/usb/gadget/u_serial.c
drivers/usb/host/ehci-mxc.c
drivers/usb/host/isp1362-hcd.c
drivers/usb/host/r8a66597-hcd.c
drivers/usb/host/xhci-ring.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h
drivers/usb/musb/musbhsdma.c
drivers/usb/otg/ulpi.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio_ids.h
drivers/usb/serial/qcserial.c
drivers/video/geode/gxfb_core.c
drivers/video/geode/lxfb_core.c
drivers/video/nuc900fb.c
fs/binfmt_flat.c
fs/dcache.c
fs/fcntl.c
fs/fs-writeback.c
fs/ocfs2/reservations.c
fs/proc/task_nommu.c
fs/super.c
fs/sysv/ialloc.c
fs/ubifs/budget.c
include/linux/backing-dev.h
include/linux/cgroup.h
include/linux/compiler-gcc.h
include/linux/compiler-gcc4.h
include/linux/drbd.h
include/linux/list.h
include/linux/tracepoint.h
kernel/futex.c
kernel/irq/manage.c
kernel/kexec.c
kernel/sched.c
kernel/sched_fair.c
kernel/time/tick-sched.c
kernel/trace/trace_event_perf.c
lib/genalloc.c
lib/idr.c
mm/memcontrol.c
mm/mempolicy.c
mm/page-writeback.c
tools/perf/builtin-record.c
tools/perf/util/event.c
tools/perf/util/newt.c
tools/perf/util/session.c
tools/perf/util/session.h
tools/perf/util/thread.h

index 6c73b3bc7f34d09da97d8f45808b5b24c5ddd2ee..7642365ed6d263b7189eecd143c787a5058b6b9b 100644 (file)
@@ -896,11 +896,13 @@ S:        Maintained
 
 ARM/SAMSUNG ARM ARCHITECTURES
 M:     Ben Dooks <ben-linux@fluff.org>
+M:     Kukjin Kim <kgene.kim@samsung.com>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 W:     http://www.fluff.org/ben/linux/
 S:     Maintained
-F:     arch/arm/plat-s3c/
+F:     arch/arm/plat-samsung/
 F:     arch/arm/plat-s3c24xx/
+F:     arch/arm/plat-s5p/
 
 ARM/S3C2410 ARM ARCHITECTURE
 M:     Ben Dooks <ben-linux@fluff.org>
@@ -1148,7 +1150,7 @@ F:        drivers/mmc/host/atmel-mci.c
 F:     drivers/mmc/host/atmel-mci-regs.h
 
 ATMEL AT91 / AT32 SERIAL DRIVER
-M:     Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:     Nicolas Ferre <nicolas.ferre@atmel.com>
 S:     Supported
 F:     drivers/serial/atmel_serial.c
 
@@ -1160,18 +1162,18 @@ F:      drivers/video/atmel_lcdfb.c
 F:     include/video/atmel_lcdc.h
 
 ATMEL MACB ETHERNET DRIVER
-M:     Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:     Nicolas Ferre <nicolas.ferre@atmel.com>
 S:     Supported
 F:     drivers/net/macb.*
 
 ATMEL SPI DRIVER
-M:     Haavard Skinnemoen <hskinnemoen@atmel.com>
+M:     Nicolas Ferre <nicolas.ferre@atmel.com>
 S:     Supported
 F:     drivers/spi/atmel_spi.*
 
 ATMEL USBA UDC DRIVER
-M:     Haavard Skinnemoen <hskinnemoen@atmel.com>
-L:     kernel@avr32linux.org
+M:     Nicolas Ferre <nicolas.ferre@atmel.com>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 W:     http://avr32linux.org/twiki/bin/view/Main/AtmelUsbDeviceDriver
 S:     Supported
 F:     drivers/usb/gadget/atmel_usba_udc.*
@@ -3380,7 +3382,7 @@ KPROBES
 M:     Ananth N Mavinakayanahalli <ananth@in.ibm.com>
 M:     Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
 M:     "David S. Miller" <davem@davemloft.net>
-M:     Masami Hiramatsu <mhiramat@redhat.com>
+M:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
 S:     Maintained
 F:     Documentation/kprobes.txt
 F:     include/linux/kprobes.h
@@ -4628,6 +4630,12 @@ M:       Robert Jarzmik <robert.jarzmik@free.fr>
 L:     rtc-linux@googlegroups.com
 S:     Maintained
 
+QLOGIC QLA1280 SCSI DRIVER
+M:     Michael Reed <mdr@sgi.com>
+L:     linux-scsi@vger.kernel.org
+S:     Maintained
+F:     drivers/scsi/qla1280.[ch]
+
 QLOGIC QLA2XXX FC-SCSI DRIVER
 M:     Andrew Vasquez <andrew.vasquez@qlogic.com>
 M:     linux-driver@qlogic.com
index f848ba8dbc16916d82ec3c6cae2a436d7c849265..a04cffd691c55995812365aa78c373e7950d0b2c 100644 (file)
@@ -538,9 +538,7 @@ static void ads7846_dev_init(void)
                printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
        gpio_direction_input(OMAP3_STALKER_TS_GPIO);
-
-       omap_set_gpio_debounce(OMAP3_STALKER_TS_GPIO, 1);
-       omap_set_gpio_debounce_time(OMAP3_STALKER_TS_GPIO, 0xa);
+       gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310);
 }
 
 static int ads7846_get_pendown_state(void)
index 02804224517b26abb7460f1ebd98ff5c266e0dea..e10db7a90cb270f5f833cd1b9076bd7b6cb38356 100644 (file)
@@ -1369,6 +1369,7 @@ static struct clk emif1_ick = {
        .ops            = &clkops_omap2_dflt,
        .enable_reg     = OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
        .enable_bit     = OMAP4430_MODULEMODE_HWCTRL,
+       .flags          = ENABLE_ON_INIT,
        .clkdm_name     = "l3_emif_clkdm",
        .parent         = &ddrphy_ck,
        .recalc         = &followparent_recalc,
@@ -1379,6 +1380,7 @@ static struct clk emif2_ick = {
        .ops            = &clkops_omap2_dflt,
        .enable_reg     = OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
        .enable_bit     = OMAP4430_MODULEMODE_HWCTRL,
+       .flags          = ENABLE_ON_INIT,
        .clkdm_name     = "l3_emif_clkdm",
        .parent         = &ddrphy_ck,
        .recalc         = &followparent_recalc,
index 95c9a5f774e13f1d123bd2a0968dd418e92bafd4..b7a4133267d80b73cd0ff59fe8d339efae649839 100644 (file)
@@ -409,10 +409,11 @@ static int _init_main_clk(struct omap_hwmod *oh)
                return 0;
 
        oh->_clk = omap_clk_get_by_name(oh->main_clk);
-       if (!oh->_clk)
+       if (!oh->_clk) {
                pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n",
                           oh->name, oh->main_clk);
                return -EINVAL;
+       }
 
        if (!oh->_clk->clkdm)
                pr_warning("omap_hwmod: %s: missing clockdomain for %s.\n",
@@ -444,10 +445,11 @@ static int _init_interface_clks(struct omap_hwmod *oh)
                        continue;
 
                c = omap_clk_get_by_name(os->clk);
-               if (!c)
+               if (!c) {
                        pr_warning("omap_hwmod: %s: cannot clk_get interface_clk %s\n",
                                   oh->name, os->clk);
                        ret = -EINVAL;
+               }
                os->_clk = c;
        }
 
@@ -470,10 +472,11 @@ static int _init_opt_clks(struct omap_hwmod *oh)
 
        for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) {
                c = omap_clk_get_by_name(oc->clk);
-               if (!c)
+               if (!c) {
                        pr_warning("omap_hwmod: %s: cannot clk_get opt_clk %s\n",
                                   oh->name, oc->clk);
                        ret = -EINVAL;
+               }
                oc->_clk = c;
        }
 
index 2e967716cc3fd27bb368951b6ee0599897b2b490..b88737fd6cfe7a434f6254e81dad7f90d8e3cd1a 100644 (file)
@@ -99,7 +99,7 @@ static void omap3_enable_io_chain(void)
                /* Do a readback to assure write has been done */
                prm_read_mod_reg(WKUP_MOD, PM_WKEN);
 
-               while (!(prm_read_mod_reg(WKUP_MOD, PM_WKST) &
+               while (!(prm_read_mod_reg(WKUP_MOD, PM_WKEN) &
                         OMAP3430_ST_IO_CHAIN_MASK)) {
                        timeout++;
                        if (timeout > 1000) {
@@ -108,7 +108,7 @@ static void omap3_enable_io_chain(void)
                                return;
                        }
                        prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK,
-                                            WKUP_MOD, PM_WKST);
+                                            WKUP_MOD, PM_WKEN);
                }
        }
 }
index c68f799e83c57bb53fb20c10fb0610fdbc53e8fc..d72d1ac303338e23bed5abe38392e9aed6e0183b 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
+#include <linux/dma-mapping.h>
+
 #include <asm/io.h>
 #include <plat/mux.h>
 
index e6f73030d5f0109cf147b581fd4c0b0885d77cb1..9b11eedba65fc4163cb33929addc2bf4e6784cbf 100644 (file)
@@ -2,6 +2,7 @@
  * Versatile Express Core Tile Cortex A9x4 Support
  */
 #include <linux/init.h>
+#include <linux/gfp.h>
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
index c64875f11fac9d937f79d5805d682bc0f4cb9bbe..44bafdab2dceaa94d7d6facbcfd422b2f65b660c 100644 (file)
@@ -541,11 +541,11 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
                  * timer is stopped
                  */
                udelay(3500000 / clk_get_rate(timer->fclk) + 1);
-               /* Ack possibly pending interrupt */
-               omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
-                               OMAP_TIMER_INT_OVERFLOW);
 #endif
        }
+       /* Ack possibly pending interrupt */
+       omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
+                       OMAP_TIMER_INT_OVERFLOW);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
index 393e9219a5b68afe61f6416c3fac531cc188cefc..9b7e3545f32552e1cdb7d4bfc0b9cc6331de8b0f 100644 (file)
@@ -673,6 +673,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
                if (cpu_is_omap34xx() || cpu_is_omap44xx())
                        clk_disable(bank->dbck);
        }
+       bank->dbck_enable_mask = val;
 
        __raw_writel(val, reg);
 }
index e43983ba59c5eb77ac61caa3a2ebaca83b50416c..8ce0de247c71fc7b59863a6722036ef011238240 100644 (file)
@@ -140,8 +140,10 @@ static struct sg_table *sgtable_alloc(const size_t bytes, u32 flags)
                return ERR_PTR(-ENOMEM);
 
        err = sg_alloc_table(sgt, nr_entries, GFP_KERNEL);
-       if (err)
+       if (err) {
+               kfree(sgt);
                return ERR_PTR(err);
+       }
 
        pr_debug("%s: sgt:%p(%d entries)\n", __func__, sgt, nr_entries);
 
diff --git a/arch/um/include/asm/arch_hweight.h b/arch/um/include/asm/arch_hweight.h
new file mode 100644 (file)
index 0000000..c656cf4
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _ASM_UM_HWEIGHT_H
+#define _ASM_UM_HWEIGHT_H
+
+#include <asm-generic/bitops/arch_hweight.h>
+
+#endif
index 93a11d7edfa0505a7acfd9bd99a0266aec97f933..e696144d2be3ddb23ba952fdd17ea8fdf923036c 100644 (file)
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <sys/mman.h>
 #include <sys/param.h>
 #include "init.h"
index ed7aeff786b277d01b281a47c418eb5c988ea249..45bc9402aa497f7c7151a7ce3e0b419ab9454301 100644 (file)
@@ -41,13 +41,12 @@ static __videocard video_vga;
 static u8 vga_set_basic_mode(void)
 {
        struct biosregs ireg, oreg;
-       u16 ax;
        u8 mode;
 
        initregs(&ireg);
 
        /* Query current mode */
-       ax = 0x0f00;
+       ireg.ax = 0x0f00;
        intcall(0x10, &ireg, &oreg);
        mode = oreg.al;
 
index 63cb4096c3dc998efba7e160f6804c0b6d80c309..9cb2edb87c2f718780fb00cc61ebc1bfa5ad0228 100644 (file)
@@ -183,7 +183,7 @@ struct mp_ioapic_gsi{
        u32 gsi_end;
 };
 extern struct mp_ioapic_gsi  mp_gsi_routing[];
-extern u32 gsi_end;
+extern u32 gsi_top;
 int mp_find_ioapic(u32 gsi);
 int mp_find_ioapic_pin(int ioapic, u32 gsi);
 void __init mp_register_ioapic(int id, u32 address, u32 gsi_base);
@@ -197,7 +197,7 @@ static const int timer_through_8259 = 0;
 static inline void ioapic_init_mappings(void)  { }
 static inline void ioapic_insert_resources(void) { }
 static inline void probe_nr_irqs_gsi(void)     { }
-#define gsi_end (NR_IRQS_LEGACY - 1)
+#define gsi_top (NR_IRQS_LEGACY)
 static inline int mp_find_ioapic(u32 gsi) { return 0; }
 
 struct io_apic_irq_attr;
index 0797e748d2801839fecf63915a8d2d857347884c..cd28f9ad910d1a8bc83fa0c4c6d1f1ca907e042f 100644 (file)
@@ -77,6 +77,7 @@ do {                                                  \
        if (0) {                                        \
                pto_T__ pto_tmp__;                      \
                pto_tmp__ = (val);                      \
+               (void)pto_tmp__;                        \
        }                                               \
        switch (sizeof(var)) {                          \
        case 1:                                         \
@@ -115,6 +116,7 @@ do {                                                                        \
        if (0) {                                                        \
                pao_T__ pao_tmp__;                                      \
                pao_tmp__ = (val);                                      \
+               (void)pao_tmp__;                                        \
        }                                                               \
        switch (sizeof(var)) {                                          \
        case 1:                                                         \
index 5e67c15323145753d29894eb43c4c29f0343f38e..ed5903be26fe6a04b101a069ecbaeea497a757f6 100644 (file)
@@ -26,7 +26,7 @@
  */
 #define VMALLOC_OFFSET (8 * 1024 * 1024)
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 extern bool __vmalloc_start_set; /* set once high_memory is set */
 #endif
 
index b8fe48ee2ed971d648fa4ad940a210ddfc9fb90c..e7f4d33c55edbb80b8ec52d9793a45d3c8854519 100644 (file)
@@ -451,7 +451,7 @@ void stop_this_cpu(void *dummy);
  *
  * (Could use an alternative three way for this if there was one.)
  */
-static inline void rdtsc_barrier(void)
+static __always_inline void rdtsc_barrier(void)
 {
        alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
        alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
index 60cc4058ed5feb9c05dcf7917593c099d21df4df..c05872aa3ce08ed39648c0eb0b4bd2bde281b362 100644 (file)
@@ -118,7 +118,7 @@ static unsigned int gsi_to_irq(unsigned int gsi)
        if (gsi >= NR_IRQS_LEGACY)
                irq = gsi;
        else
-               irq = gsi_end + 1 + gsi;
+               irq = gsi_top + gsi;
 
        return irq;
 }
@@ -129,10 +129,10 @@ static u32 irq_to_gsi(int irq)
 
        if (irq < NR_IRQS_LEGACY)
                gsi = isa_irq_to_gsi[irq];
-       else if (irq <= gsi_end)
+       else if (irq < gsi_top)
                gsi = irq;
-       else if (irq <= (gsi_end + NR_IRQS_LEGACY))
-               gsi = irq - gsi_end;
+       else if (irq < (gsi_top + NR_IRQS_LEGACY))
+               gsi = irq - gsi_top;
        else
                gsi = 0xffffffff;
 
index 33f3563a2a52a8b40cc2a07d8a60a03a583457a7..e41ed24ab26d5b51490ffa8f9a7c58a653b829d8 100644 (file)
@@ -89,8 +89,8 @@ int nr_ioapics;
 /* IO APIC gsi routing info */
 struct mp_ioapic_gsi  mp_gsi_routing[MAX_IO_APICS];
 
-/* The last gsi number used */
-u32 gsi_end;
+/* The one past the highest gsi number used */
+u32 gsi_top;
 
 /* MP IRQ source entries */
 struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES];
@@ -1035,7 +1035,7 @@ static int pin_2_irq(int idx, int apic, int pin)
                if (gsi >= NR_IRQS_LEGACY)
                        irq = gsi;
                else
-                       irq = gsi_end + 1 + gsi;
+                       irq = gsi_top + gsi;
        }
 
 #ifdef CONFIG_X86_32
@@ -3853,7 +3853,7 @@ void __init probe_nr_irqs_gsi(void)
 {
        int nr;
 
-       nr = gsi_end + 1 + NR_IRQS_LEGACY;
+       nr = gsi_top + NR_IRQS_LEGACY;
        if (nr > nr_irqs_gsi)
                nr_irqs_gsi = nr;
 
@@ -4294,8 +4294,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
         */
        nr_ioapic_registers[idx] = entries;
 
-       if (mp_gsi_routing[idx].gsi_end > gsi_end)
-               gsi_end = mp_gsi_routing[idx].gsi_end;
+       if (mp_gsi_routing[idx].gsi_end >= gsi_top)
+               gsi_top = mp_gsi_routing[idx].gsi_end + 1;
 
        printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
               "GSI %d-%d\n", idx, mp_ioapics[idx].apicid,
index fdbc652d3febaa5b7da8a3b844d5a031a677d4a0..214ac860ebe0d26df806999f880633919d1ad816 100644 (file)
@@ -72,6 +72,7 @@ static struct event_constraint intel_westmere_event_constraints[] =
        INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
        INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
        INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
+       INTEL_EVENT_CONSTRAINT(0xb3, 0x1), /* SNOOPQ_REQUEST_OUTSTANDING */
        EVENT_CONSTRAINT_END
 };
 
index 5ae5d2426edfd0f74e3d9a4235bd143b5c9f5768..d86dbf7e54be4384aae5c2c886e3e690780f40f3 100644 (file)
@@ -123,7 +123,7 @@ static void __init MP_ioapic_info(struct mpc_ioapic *m)
        printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n",
               m->apicid, m->apicver, m->apicaddr);
 
-       mp_register_ioapic(m->apicid, m->apicaddr, gsi_end + 1);
+       mp_register_ioapic(m->apicid, m->apicaddr, gsi_top);
 }
 
 static void print_MP_intsrc_info(struct mpc_intsrc *m)
index fb99f7edb3418322653f6c97ce480083191860a8..0b96b5589f089b4aa60b4d5c51e1300efd07226e 100644 (file)
@@ -103,11 +103,16 @@ int use_calgary __read_mostly = 0;
 #define PMR_SOFTSTOPFAULT      0x40000000
 #define PMR_HARDSTOP           0x20000000
 
-#define MAX_NUM_OF_PHBS                8 /* how many PHBs in total? */
-#define MAX_NUM_CHASSIS                8 /* max number of chassis */
-/* MAX_PHB_BUS_NUM is the maximal possible dev->bus->number */
-#define MAX_PHB_BUS_NUM                (MAX_NUM_OF_PHBS * MAX_NUM_CHASSIS * 2)
-#define PHBS_PER_CALGARY       4
+/*
+ * The maximum PHB bus number.
+ * x3950M2 (rare): 8 chassis, 48 PHBs per chassis = 384
+ * x3950M2: 4 chassis, 48 PHBs per chassis        = 192
+ * x3950 (PCIE): 8 chassis, 32 PHBs per chassis   = 256
+ * x3950 (PCIX): 8 chassis, 16 PHBs per chassis   = 128
+ */
+#define MAX_PHB_BUS_NUM                384
+
+#define PHBS_PER_CALGARY         4
 
 /* register offsets in Calgary's internal register space */
 static const unsigned long tar_offsets[] = {
index 8e1aac86b50c6dcce26df41a1728ea21cf2a54e8..e3af342fe83ae7a57b8f6db6de4fb9541c4ab15e 100644 (file)
@@ -228,6 +228,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"),
                },
        },
+       {       /* Handle problems with rebooting on Dell T7400's */
+               .callback = set_bios_reboot,
+               .ident = "Dell Precision T7400",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T7400"),
+               },
+       },
        {       /* Handle problems with rebooting on HP laptops */
                .callback = set_bios_reboot,
                .ident = "HP Compaq Laptop",
index 7ded57896c0a1271f653ea14aaaf309e0dcb96c0..cb22acf3ed099de3a256f2f482ae1cdcd5338320 100644 (file)
@@ -93,7 +93,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)
        pentry = (struct sfi_apic_table_entry *)sb->pentry;
 
        for (i = 0; i < num; i++) {
-               mp_register_ioapic(i, pentry->phys_addr, gsi_end + 1);
+               mp_register_ioapic(i, pentry->phys_addr, gsi_top);
                pentry++;
        }
 
index acc15b23b74342df6188d0fd0e7b356e1530e8bb..64121a18b8cb33902b6161435136aa86b619a152 100644 (file)
@@ -302,7 +302,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
                return -EINVAL;
        }
 
-       new  = kmalloc(sizeof(struct memtype), GFP_KERNEL);
+       new  = kzalloc(sizeof(struct memtype), GFP_KERNEL);
        if (!new)
                return -ENOMEM;
 
index f537087bb740933d5d412c619bb3d5107b53c3b0..f20eeec85a862c7dd044e15993aac3cd8c13214c 100644 (file)
@@ -226,6 +226,7 @@ int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type)
                if (ret_type)
                        new->type = *ret_type;
 
+               new->subtree_max_end = new->end;
                memtype_rb_insert(&memtype_rbroot, new);
        }
        return err;
index f84cce42fc58da2dc0bc48186cbd9f6bd1d7dfc3..f0640d7f800f7164c5b04a59791410a029a48cc4 100644 (file)
@@ -1149,13 +1149,10 @@ void init_request_from_bio(struct request *req, struct bio *bio)
        else
                req->cmd_flags |= bio->bi_rw & REQ_FAILFAST_MASK;
 
-       if (unlikely(bio_rw_flagged(bio, BIO_RW_DISCARD))) {
+       if (bio_rw_flagged(bio, BIO_RW_DISCARD))
                req->cmd_flags |= REQ_DISCARD;
-               if (bio_rw_flagged(bio, BIO_RW_BARRIER))
-                       req->cmd_flags |= REQ_SOFTBARRIER;
-       } else if (unlikely(bio_rw_flagged(bio, BIO_RW_BARRIER)))
+       if (bio_rw_flagged(bio, BIO_RW_BARRIER))
                req->cmd_flags |= REQ_HARDBARRIER;
-
        if (bio_rw_flagged(bio, BIO_RW_SYNCIO))
                req->cmd_flags |= REQ_RW_SYNC;
        if (bio_rw_flagged(bio, BIO_RW_META))
@@ -1586,7 +1583,7 @@ void submit_bio(int rw, struct bio *bio)
         * If it's a regular read/write or a barrier with data attached,
         * go through the normal accounting stuff before submission.
         */
-       if (bio_has_data(bio)) {
+       if (bio_has_data(bio) && !(rw & (1 << BIO_RW_DISCARD))) {
                if (rw & WRITE) {
                        count_vm_events(PGPGOUT, count);
                } else {
index 5ff4f4850e717ddb319423e9678e0e44cd7f265c..7982b830db58df900fb679919c81edfc0ee34689 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/rbtree.h>
 #include <linux/ioprio.h>
 #include <linux/blktrace_api.h>
-#include "blk-cgroup.h"
+#include "cfq.h"
 
 /*
  * tunables
@@ -879,7 +879,7 @@ cfq_group_service_tree_del(struct cfq_data *cfqd, struct cfq_group *cfqg)
        if (!RB_EMPTY_NODE(&cfqg->rb_node))
                cfq_rb_erase(&cfqg->rb_node, st);
        cfqg->saved_workload_slice = 0;
-       blkiocg_update_dequeue_stats(&cfqg->blkg, 1);
+       cfq_blkiocg_update_dequeue_stats(&cfqg->blkg, 1);
 }
 
 static inline unsigned int cfq_cfqq_slice_usage(struct cfq_queue *cfqq)
@@ -939,8 +939,8 @@ static void cfq_group_served(struct cfq_data *cfqd, struct cfq_group *cfqg,
 
        cfq_log_cfqg(cfqd, cfqg, "served: vt=%llu min_vt=%llu", cfqg->vdisktime,
                                        st->min_vdisktime);
-       blkiocg_update_timeslice_used(&cfqg->blkg, used_sl);
-       blkiocg_set_start_empty_time(&cfqg->blkg);
+       cfq_blkiocg_update_timeslice_used(&cfqg->blkg, used_sl);
+       cfq_blkiocg_set_start_empty_time(&cfqg->blkg);
 }
 
 #ifdef CONFIG_CFQ_GROUP_IOSCHED
@@ -995,7 +995,7 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create)
 
        /* Add group onto cgroup list */
        sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor);
-       blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd,
+       cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd,
                                        MKDEV(major, minor));
        cfqg->weight = blkcg_get_weight(blkcg, cfqg->blkg.dev);
 
@@ -1079,7 +1079,7 @@ static void cfq_release_cfq_groups(struct cfq_data *cfqd)
                 * it from cgroup list, then it will take care of destroying
                 * cfqg also.
                 */
-               if (!blkiocg_del_blkio_group(&cfqg->blkg))
+               if (!cfq_blkiocg_del_blkio_group(&cfqg->blkg))
                        cfq_destroy_cfqg(cfqd, cfqg);
        }
 }
@@ -1421,10 +1421,10 @@ static void cfq_reposition_rq_rb(struct cfq_queue *cfqq, struct request *rq)
 {
        elv_rb_del(&cfqq->sort_list, rq);
        cfqq->queued[rq_is_sync(rq)]--;
-       blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg, rq_data_dir(rq),
-                                               rq_is_sync(rq));
+       cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
+                                       rq_data_dir(rq), rq_is_sync(rq));
        cfq_add_rq_rb(rq);
-       blkiocg_update_io_add_stats(&(RQ_CFQG(rq))->blkg,
+       cfq_blkiocg_update_io_add_stats(&(RQ_CFQG(rq))->blkg,
                        &cfqq->cfqd->serving_group->blkg, rq_data_dir(rq),
                        rq_is_sync(rq));
 }
@@ -1482,8 +1482,8 @@ static void cfq_remove_request(struct request *rq)
        cfq_del_rq_rb(rq);
 
        cfqq->cfqd->rq_queued--;
-       blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg, rq_data_dir(rq),
-                                               rq_is_sync(rq));
+       cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
+                                       rq_data_dir(rq), rq_is_sync(rq));
        if (rq_is_meta(rq)) {
                WARN_ON(!cfqq->meta_pending);
                cfqq->meta_pending--;
@@ -1518,8 +1518,8 @@ static void cfq_merged_request(struct request_queue *q, struct request *req,
 static void cfq_bio_merged(struct request_queue *q, struct request *req,
                                struct bio *bio)
 {
-       blkiocg_update_io_merged_stats(&(RQ_CFQG(req))->blkg, bio_data_dir(bio),
-                                       cfq_bio_sync(bio));
+       cfq_blkiocg_update_io_merged_stats(&(RQ_CFQG(req))->blkg,
+                                       bio_data_dir(bio), cfq_bio_sync(bio));
 }
 
 static void
@@ -1539,8 +1539,8 @@ cfq_merged_requests(struct request_queue *q, struct request *rq,
        if (cfqq->next_rq == next)
                cfqq->next_rq = rq;
        cfq_remove_request(next);
-       blkiocg_update_io_merged_stats(&(RQ_CFQG(rq))->blkg, rq_data_dir(next),
-                                       rq_is_sync(next));
+       cfq_blkiocg_update_io_merged_stats(&(RQ_CFQG(rq))->blkg,
+                                       rq_data_dir(next), rq_is_sync(next));
 }
 
 static int cfq_allow_merge(struct request_queue *q, struct request *rq,
@@ -1571,7 +1571,7 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
 static inline void cfq_del_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 {
        del_timer(&cfqd->idle_slice_timer);
-       blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg);
+       cfq_blkiocg_update_idle_time_stats(&cfqq->cfqg->blkg);
 }
 
 static void __cfq_set_active_queue(struct cfq_data *cfqd,
@@ -1580,7 +1580,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
        if (cfqq) {
                cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d",
                                cfqd->serving_prio, cfqd->serving_type);
-               blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg);
+               cfq_blkiocg_update_avg_queue_size_stats(&cfqq->cfqg->blkg);
                cfqq->slice_start = 0;
                cfqq->dispatch_start = jiffies;
                cfqq->allocated_slice = 0;
@@ -1911,7 +1911,7 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
        sl = cfqd->cfq_slice_idle;
 
        mod_timer(&cfqd->idle_slice_timer, jiffies + sl);
-       blkiocg_update_set_idle_time_stats(&cfqq->cfqg->blkg);
+       cfq_blkiocg_update_set_idle_time_stats(&cfqq->cfqg->blkg);
        cfq_log_cfqq(cfqd, cfqq, "arm_idle: %lu", sl);
 }
 
@@ -1931,7 +1931,7 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq)
        elv_dispatch_sort(q, rq);
 
        cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]++;
-       blkiocg_update_dispatch_stats(&cfqq->cfqg->blkg, blk_rq_bytes(rq),
+       cfq_blkiocg_update_dispatch_stats(&cfqq->cfqg->blkg, blk_rq_bytes(rq),
                                        rq_data_dir(rq), rq_is_sync(rq));
 }
 
@@ -1986,6 +1986,15 @@ static void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq)
        int process_refs, new_process_refs;
        struct cfq_queue *__cfqq;
 
+       /*
+        * If there are no process references on the new_cfqq, then it is
+        * unsafe to follow the ->new_cfqq chain as other cfqq's in the
+        * chain may have dropped their last reference (not just their
+        * last process reference).
+        */
+       if (!cfqq_process_refs(new_cfqq))
+               return;
+
        /* Avoid a circular list and skip interim queue merges */
        while ((__cfqq = new_cfqq->new_cfqq)) {
                if (__cfqq == cfqq)
@@ -1994,17 +2003,17 @@ static void cfq_setup_merge(struct cfq_queue *cfqq, struct cfq_queue *new_cfqq)
        }
 
        process_refs = cfqq_process_refs(cfqq);
+       new_process_refs = cfqq_process_refs(new_cfqq);
        /*
         * If the process for the cfqq has gone away, there is no
         * sense in merging the queues.
         */
-       if (process_refs == 0)
+       if (process_refs == 0 || new_process_refs == 0)
                return;
 
        /*
         * Merge in the direction of the lesser amount of work.
         */
-       new_process_refs = cfqq_process_refs(new_cfqq);
        if (new_process_refs >= process_refs) {
                cfqq->new_cfqq = new_cfqq;
                atomic_add(process_refs, &new_cfqq->ref);
@@ -3248,7 +3257,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
                                cfq_clear_cfqq_wait_request(cfqq);
                                __blk_run_queue(cfqd->queue);
                        } else {
-                               blkiocg_update_idle_time_stats(
+                               cfq_blkiocg_update_idle_time_stats(
                                                &cfqq->cfqg->blkg);
                                cfq_mark_cfqq_must_dispatch(cfqq);
                        }
@@ -3276,7 +3285,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
        rq_set_fifo_time(rq, jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]);
        list_add_tail(&rq->queuelist, &cfqq->fifo);
        cfq_add_rq_rb(rq);
-       blkiocg_update_io_add_stats(&(RQ_CFQG(rq))->blkg,
+       cfq_blkiocg_update_io_add_stats(&(RQ_CFQG(rq))->blkg,
                        &cfqd->serving_group->blkg, rq_data_dir(rq),
                        rq_is_sync(rq));
        cfq_rq_enqueued(cfqd, cfqq, rq);
@@ -3364,9 +3373,9 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
        WARN_ON(!cfqq->dispatched);
        cfqd->rq_in_driver--;
        cfqq->dispatched--;
-       blkiocg_update_completion_stats(&cfqq->cfqg->blkg, rq_start_time_ns(rq),
-                       rq_io_start_time_ns(rq), rq_data_dir(rq),
-                       rq_is_sync(rq));
+       cfq_blkiocg_update_completion_stats(&cfqq->cfqg->blkg,
+                       rq_start_time_ns(rq), rq_io_start_time_ns(rq),
+                       rq_data_dir(rq), rq_is_sync(rq));
 
        cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
 
@@ -3730,7 +3739,7 @@ static void cfq_exit_queue(struct elevator_queue *e)
 
        cfq_put_async_queues(cfqd);
        cfq_release_cfq_groups(cfqd);
-       blkiocg_del_blkio_group(&cfqd->root_group.blkg);
+       cfq_blkiocg_del_blkio_group(&cfqd->root_group.blkg);
 
        spin_unlock_irq(q->queue_lock);
 
@@ -3798,8 +3807,8 @@ static void *cfq_init_queue(struct request_queue *q)
         */
        atomic_set(&cfqg->ref, 1);
        rcu_read_lock();
-       blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg, (void *)cfqd,
-                                       0);
+       cfq_blkiocg_add_blkio_group(&blkio_root_cgroup, &cfqg->blkg,
+                                       (void *)cfqd, 0);
        rcu_read_unlock();
 #endif
        /*
diff --git a/block/cfq.h b/block/cfq.h
new file mode 100644 (file)
index 0000000..93448e5
--- /dev/null
@@ -0,0 +1,115 @@
+#ifndef _CFQ_H
+#define _CFQ_H
+#include "blk-cgroup.h"
+
+#ifdef CONFIG_CFQ_GROUP_IOSCHED
+static inline void cfq_blkiocg_update_io_add_stats(struct blkio_group *blkg,
+       struct blkio_group *curr_blkg, bool direction, bool sync)
+{
+       blkiocg_update_io_add_stats(blkg, curr_blkg, direction, sync);
+}
+
+static inline void cfq_blkiocg_update_dequeue_stats(struct blkio_group *blkg,
+                       unsigned long dequeue)
+{
+       blkiocg_update_dequeue_stats(blkg, dequeue);
+}
+
+static inline void cfq_blkiocg_update_timeslice_used(struct blkio_group *blkg,
+                       unsigned long time)
+{
+       blkiocg_update_timeslice_used(blkg, time);
+}
+
+static inline void cfq_blkiocg_set_start_empty_time(struct blkio_group *blkg)
+{
+       blkiocg_set_start_empty_time(blkg);
+}
+
+static inline void cfq_blkiocg_update_io_remove_stats(struct blkio_group *blkg,
+                               bool direction, bool sync)
+{
+       blkiocg_update_io_remove_stats(blkg, direction, sync);
+}
+
+static inline void cfq_blkiocg_update_io_merged_stats(struct blkio_group *blkg,
+               bool direction, bool sync)
+{
+       blkiocg_update_io_merged_stats(blkg, direction, sync);
+}
+
+static inline void cfq_blkiocg_update_idle_time_stats(struct blkio_group *blkg)
+{
+       blkiocg_update_idle_time_stats(blkg);
+}
+
+static inline void
+cfq_blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg)
+{
+       blkiocg_update_avg_queue_size_stats(blkg);
+}
+
+static inline void
+cfq_blkiocg_update_set_idle_time_stats(struct blkio_group *blkg)
+{
+       blkiocg_update_set_idle_time_stats(blkg);
+}
+
+static inline void cfq_blkiocg_update_dispatch_stats(struct blkio_group *blkg,
+                               uint64_t bytes, bool direction, bool sync)
+{
+       blkiocg_update_dispatch_stats(blkg, bytes, direction, sync);
+}
+
+static inline void cfq_blkiocg_update_completion_stats(struct blkio_group *blkg, uint64_t start_time, uint64_t io_start_time, bool direction, bool sync)
+{
+       blkiocg_update_completion_stats(blkg, start_time, io_start_time,
+                               direction, sync);
+}
+
+static inline void cfq_blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
+                       struct blkio_group *blkg, void *key, dev_t dev) {
+       blkiocg_add_blkio_group(blkcg, blkg, key, dev);
+}
+
+static inline int cfq_blkiocg_del_blkio_group(struct blkio_group *blkg)
+{
+       return blkiocg_del_blkio_group(blkg);
+}
+
+#else /* CFQ_GROUP_IOSCHED */
+static inline void cfq_blkiocg_update_io_add_stats(struct blkio_group *blkg,
+       struct blkio_group *curr_blkg, bool direction, bool sync) {}
+
+static inline void cfq_blkiocg_update_dequeue_stats(struct blkio_group *blkg,
+                       unsigned long dequeue) {}
+
+static inline void cfq_blkiocg_update_timeslice_used(struct blkio_group *blkg,
+                       unsigned long time) {}
+static inline void cfq_blkiocg_set_start_empty_time(struct blkio_group *blkg) {}
+static inline void cfq_blkiocg_update_io_remove_stats(struct blkio_group *blkg,
+                               bool direction, bool sync) {}
+static inline void cfq_blkiocg_update_io_merged_stats(struct blkio_group *blkg,
+               bool direction, bool sync) {}
+static inline void cfq_blkiocg_update_idle_time_stats(struct blkio_group *blkg)
+{
+}
+static inline void
+cfq_blkiocg_update_avg_queue_size_stats(struct blkio_group *blkg) {}
+
+static inline void
+cfq_blkiocg_update_set_idle_time_stats(struct blkio_group *blkg) {}
+
+static inline void cfq_blkiocg_update_dispatch_stats(struct blkio_group *blkg,
+                               uint64_t bytes, bool direction, bool sync) {}
+static inline void cfq_blkiocg_update_completion_stats(struct blkio_group *blkg, uint64_t start_time, uint64_t io_start_time, bool direction, bool sync) {}
+
+static inline void cfq_blkiocg_add_blkio_group(struct blkio_cgroup *blkcg,
+                       struct blkio_group *blkg, void *key, dev_t dev) {}
+static inline int cfq_blkiocg_del_blkio_group(struct blkio_group *blkg)
+{
+       return 0;
+}
+
+#endif /* CFQ_GROUP_IOSCHED */
+#endif
index db3946e9c66bbdcb6f215a316521ebe785b1d381..216e1e948ff6dcc5823289300453ab3516b48072 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
+#include <linux/slab.h>
 #include <linux/io.h>
 #include <linux/kref.h>
 #include <linux/rculist.h>
index 814b192496166297d44903a08bbf0ddf86a2e453..8f8bd736d4ff11919656e79d2ef9442b037fafff 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/kref.h>
 #include <linux/rculist.h>
 #include <linux/interrupt.h>
+#include <linux/slab.h>
 #include <acpi/atomicio.h>
 
 #define ACPI_PFX "ACPI: "
index 3381505c8a6c309c7838cb7d0a4daff7e3e162e7..72dae92f3cab89770e0c43abd6e7b01aa554b62c 100644 (file)
@@ -861,6 +861,7 @@ cciss_scsi_detect(int ctlr)
        sh->n_io_port = 0;      // I don't think we use these two...
        sh->this_id = SELF_SCSI_ID;  
        sh->sg_tablesize = hba[ctlr]->maxsgentries;
+       sh->max_cmd_len = MAX_COMMAND_SIZE;
 
        ((struct cciss_scsi_adapter_data_t *) 
                hba[ctlr]->scsi_ctlr)->scsi_host = sh;
index 91d11631cec96a523f8f7f9504ce6405edba920a..abb4ec6690fcc7b45f96bf8067d96c9e83999ebe 100644 (file)
@@ -386,7 +386,7 @@ static void __devexit cpqarray_remove_one_eisa (int i)
 }
 
 /* pdev is NULL for eisa */
-static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
+static int __devinit cpqarray_register_ctlr( int i, struct pci_dev *pdev)
 {
        struct request_queue *q;
        int j;
@@ -503,7 +503,7 @@ Enomem4:
        return -1;
 }
 
-static int __init cpqarray_init_one( struct pci_dev *pdev,
+static int __devinit cpqarray_init_one( struct pci_dev *pdev,
        const struct pci_device_id *ent)
 {
        int i;
@@ -740,7 +740,7 @@ __setup("smart2=", cpqarray_setup);
 /*
  * Find an EISA controller's signature.  Set up an hba if we find it.
  */
-static int __init cpqarray_eisa_detect(void)
+static int __devinit cpqarray_eisa_detect(void)
 {
        int i=0, j;
        __u32 board_id;
index 6b077f93acc620eaf40fa85599dbe83745779c28..7258c95e895e3c3ff7c91bdc3660154d55061413 100644 (file)
@@ -1236,8 +1236,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
        /* Last part of the attaching process ... */
        if (ns.conn >= C_CONNECTED &&
            os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) {
-               kfree(mdev->p_uuid); /* We expect to receive up-to-date UUIDs soon. */
-               mdev->p_uuid = NULL; /* ...to not use the old ones in the mean time */
                drbd_send_sizes(mdev, 0, 0);  /* to start sync... */
                drbd_send_uuids(mdev);
                drbd_send_state(mdev);
index 632e3245d1bb2a2f74d01394a4fb55862e30b226..2151f18b21deb27e0d5ecbd369180f12333b3479 100644 (file)
@@ -1114,6 +1114,12 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
                mdev->new_state_tmp.i = ns.i;
                ns.i = os.i;
                ns.disk = D_NEGOTIATING;
+
+               /* We expect to receive up-to-date UUIDs soon.
+                  To avoid a race in receive_state, free p_uuid while
+                  holding req_lock. I.e. atomic with the state change */
+               kfree(mdev->p_uuid);
+               mdev->p_uuid = NULL;
        }
 
        rv = _drbd_set_state(mdev, ns, CS_VERBOSE, NULL);
index 35603dd4e6c5276911dec0b3a11464a152beb8a5..094bdc355b1fe753c003d30277fbf9a038281444 100644 (file)
@@ -302,6 +302,12 @@ struct smi_info {
 
 static int force_kipmid[SI_MAX_PARMS];
 static int num_force_kipmid;
+#ifdef CONFIG_PCI
+static int pci_registered;
+#endif
+#ifdef CONFIG_PPC_OF
+static int of_registered;
+#endif
 
 static unsigned int kipmid_max_busy_us[SI_MAX_PARMS];
 static int num_max_busy_us;
@@ -1018,7 +1024,7 @@ static int ipmi_thread(void *data)
                else if (smi_result == SI_SM_IDLE)
                        schedule_timeout_interruptible(100);
                else
-                       schedule_timeout_interruptible(0);
+                       schedule_timeout_interruptible(1);
        }
        return 0;
 }
@@ -3314,6 +3320,8 @@ static __devinit int init_ipmi_si(void)
        rv = pci_register_driver(&ipmi_pci_driver);
        if (rv)
                printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv);
+       else
+               pci_registered = 1;
 #endif
 
 #ifdef CONFIG_ACPI
@@ -3330,6 +3338,7 @@ static __devinit int init_ipmi_si(void)
 
 #ifdef CONFIG_PPC_OF
        of_register_platform_driver(&ipmi_of_platform_driver);
+       of_registered = 1;
 #endif
 
        /* We prefer devices with interrupts, but in the case of a machine
@@ -3383,11 +3392,13 @@ static __devinit int init_ipmi_si(void)
        if (unload_when_empty && list_empty(&smi_infos)) {
                mutex_unlock(&smi_infos_lock);
 #ifdef CONFIG_PCI
-               pci_unregister_driver(&ipmi_pci_driver);
+               if (pci_registered)
+                       pci_unregister_driver(&ipmi_pci_driver);
 #endif
 
 #ifdef CONFIG_PPC_OF
-               of_unregister_platform_driver(&ipmi_of_platform_driver);
+               if (of_registered)
+                       of_unregister_platform_driver(&ipmi_of_platform_driver);
 #endif
                driver_unregister(&ipmi_driver.driver);
                printk(KERN_WARNING PFX
@@ -3478,14 +3489,16 @@ static __exit void cleanup_ipmi_si(void)
                return;
 
 #ifdef CONFIG_PCI
-       pci_unregister_driver(&ipmi_pci_driver);
+       if (pci_registered)
+               pci_unregister_driver(&ipmi_pci_driver);
 #endif
 #ifdef CONFIG_ACPI
        pnp_unregister_driver(&ipmi_pnp_driver);
 #endif
 
 #ifdef CONFIG_PPC_OF
-       of_unregister_platform_driver(&ipmi_of_platform_driver);
+       if (of_registered)
+               of_unregister_platform_driver(&ipmi_of_platform_driver);
 #endif
 
        mutex_lock(&smi_infos_lock);
index 724038dab4caa72db78309def86ec448f259407d..7face915b963fe62a6940beccde71058a23111c4 100644 (file)
@@ -1,5 +1,5 @@
 #
-# GPIO infrastructure and expanders
+# platform-neutral GPIO infrastructure and expanders
 #
 
 config ARCH_WANT_OPTIONAL_GPIOLIB
index 51c3cdd41b5aac95514b41e58c105208ba278e60..e53dcff49b4f650765c4f1f1017a45664feb3ccc 100644 (file)
@@ -1,4 +1,8 @@
-# gpio support: dedicated expander chips, etc
+# generic gpio support: dedicated expander chips, etc
+#
+# NOTE: platform-specific GPIO drivers don't belong in the
+# drivers/gpio directory; put them with other platform setup
+# code, IRQ controllers, board init, etc.
 
 ccflags-$(CONFIG_DEBUG_GPIO)   += -DDEBUG
 
index 92a8f6cacda978cfbe83a42f384bc96f7a899f63..34647fc1ee98231dc7444a2ec8d4514d2c07ded1 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/bcd.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 
 /*
  * The DaVinci RTC is a simple RTC with the following
index de033b7ac21f68e67b423d711d998c06604fd90f..d827ce570a8c8eba9fee216f66a3bb3e1e184232 100644 (file)
@@ -777,7 +777,7 @@ static int __devinit ds1307_probe(struct i2c_client *client,
 
 read_rtc:
        /* read RTC registers */
-       tmp = ds1307->read_block_data(ds1307->client, 0, 8, buf);
+       tmp = ds1307->read_block_data(ds1307->client, ds1307->offset, 8, buf);
        if (tmp != 8) {
                pr_debug("read error %d\n", tmp);
                err = -EIO;
@@ -862,7 +862,7 @@ read_rtc:
                if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM)
                        tmp += 12;
                i2c_smbus_write_byte_data(client,
-                               DS1307_REG_HOUR,
+                               ds1307->offset + DS1307_REG_HOUR,
                                bin2bcd(tmp));
        }
 
index 9eb62a256e9a675af529475d178c7925e6de5302..cd6cf575902e4aab43a2dc232c7358db93ff8a82 100644 (file)
@@ -930,6 +930,83 @@ static void cpm_uart_config_port(struct uart_port *port, int flags)
        }
 }
 
+#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_CPM_CONSOLE)
+/*
+ * Write a string to the serial port
+ * Note that this is called with interrupts already disabled
+ */
+static void cpm_uart_early_write(struct uart_cpm_port *pinfo,
+               const char *string, u_int count)
+{
+       unsigned int i;
+       cbd_t __iomem *bdp, *bdbase;
+       unsigned char *cpm_outp_addr;
+
+       /* Get the address of the host memory buffer.
+        */
+       bdp = pinfo->tx_cur;
+       bdbase = pinfo->tx_bd_base;
+
+       /*
+        * Now, do each character.  This is not as bad as it looks
+        * since this is a holding FIFO and not a transmitting FIFO.
+        * We could add the complexity of filling the entire transmit
+        * buffer, but we would just wait longer between accesses......
+        */
+       for (i = 0; i < count; i++, string++) {
+               /* Wait for transmitter fifo to empty.
+                * Ready indicates output is ready, and xmt is doing
+                * that, not that it is ready for us to send.
+                */
+               while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+                       ;
+
+               /* Send the character out.
+                * If the buffer address is in the CPM DPRAM, don't
+                * convert it.
+                */
+               cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
+                                       pinfo);
+               *cpm_outp_addr = *string;
+
+               out_be16(&bdp->cbd_datlen, 1);
+               setbits16(&bdp->cbd_sc, BD_SC_READY);
+
+               if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
+                       bdp = bdbase;
+               else
+                       bdp++;
+
+               /* if a LF, also do CR... */
+               if (*string == 10) {
+                       while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+                               ;
+
+                       cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
+                                               pinfo);
+                       *cpm_outp_addr = 13;
+
+                       out_be16(&bdp->cbd_datlen, 1);
+                       setbits16(&bdp->cbd_sc, BD_SC_READY);
+
+                       if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
+                               bdp = bdbase;
+                       else
+                               bdp++;
+               }
+       }
+
+       /*
+        * Finally, Wait for transmitter & holding register to empty
+        *  and restore the IER
+        */
+       while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+               ;
+
+       pinfo->tx_cur = bdp;
+}
+#endif
+
 #ifdef CONFIG_CONSOLE_POLL
 /* Serial polling routines for writing and reading from the uart while
  * in an interrupt or debug context.
@@ -999,7 +1076,7 @@ static void cpm_put_poll_char(struct uart_port *port,
        static char ch[2];
 
        ch[0] = (char)c;
-       cpm_uart_early_write(pinfo->port.line, ch, 1);
+       cpm_uart_early_write(pinfo, ch, 1);
 }
 #endif /* CONFIG_CONSOLE_POLL */
 
@@ -1130,9 +1207,6 @@ static void cpm_uart_console_write(struct console *co, const char *s,
                                   u_int count)
 {
        struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];
-       unsigned int i;
-       cbd_t __iomem *bdp, *bdbase;
-       unsigned char *cp;
        unsigned long flags;
        int nolock = oops_in_progress;
 
@@ -1142,66 +1216,7 @@ static void cpm_uart_console_write(struct console *co, const char *s,
                spin_lock_irqsave(&pinfo->port.lock, flags);
        }
 
-       /* Get the address of the host memory buffer.
-        */
-       bdp = pinfo->tx_cur;
-       bdbase = pinfo->tx_bd_base;
-
-       /*
-        * Now, do each character.  This is not as bad as it looks
-        * since this is a holding FIFO and not a transmitting FIFO.
-        * We could add the complexity of filling the entire transmit
-        * buffer, but we would just wait longer between accesses......
-        */
-       for (i = 0; i < count; i++, s++) {
-               /* Wait for transmitter fifo to empty.
-                * Ready indicates output is ready, and xmt is doing
-                * that, not that it is ready for us to send.
-                */
-               while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-                       ;
-
-               /* Send the character out.
-                * If the buffer address is in the CPM DPRAM, don't
-                * convert it.
-                */
-               cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
-               *cp = *s;
-
-               out_be16(&bdp->cbd_datlen, 1);
-               setbits16(&bdp->cbd_sc, BD_SC_READY);
-
-               if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
-                       bdp = bdbase;
-               else
-                       bdp++;
-
-               /* if a LF, also do CR... */
-               if (*s == 10) {
-                       while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-                               ;
-
-                       cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
-                       *cp = 13;
-
-                       out_be16(&bdp->cbd_datlen, 1);
-                       setbits16(&bdp->cbd_sc, BD_SC_READY);
-
-                       if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
-                               bdp = bdbase;
-                       else
-                               bdp++;
-               }
-       }
-
-       /*
-        * Finally, Wait for transmitter & holding register to empty
-        *  and restore the IER
-        */
-       while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-               ;
-
-       pinfo->tx_cur = bdp;
+       cpm_uart_early_write(pinfo, s, count);
 
        if (unlikely(nolock)) {
                local_irq_restore(flags);
index ce081cd44ad4a08e82cc9902ff8a1ecbd4f1724e..273e26ede650415f44f019c250cf8f003daab63c 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/usb.h>
+#include <linux/slab.h>
 
 #include <asm/delay.h>
 #include <sound/core.h>
index cedd9044022f9dc514f6d89489cf137dd7fca262..6a9ae40c7c6dac2a2b60c5afa06e05ab2f928986 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/i2c.h>
 #include <linux/usb.h>
 #include <linux/version.h>
+#include <linux/slab.h>
 #include <media/v4l2-common.h>
 #include <media/tuner.h>
 #include <media/tvaudio.h>
index 27f3f551b5457285575ef1bce5b4ddfb194d0636..c3690e3580da05a002ab272a042804dfda78886f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/usb.h>
 #include <linux/i2c.h>
 #include "tm6000.h"
index 261e66acbe46b7ea061d2c2be4bd3737b1f8cffa..86c1c8b5f25aad41cc1bd82f7f62959493147538 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/usb.h>
 
 #include "tm6000.h"
index de98a94d18537835fafad621fe213c78bba00a61..a6bd53ace03565a6a1131168b240c56f4974ecb4 100644 (file)
@@ -1272,8 +1272,7 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
 
 static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
 {
-       int                     w, i;
-       struct usb_interface    *intf;
+       int     w;
 
        /* Remote wakeup is needed only when we actually go to sleep.
         * For things like FREEZE and QUIESCE, if the device is already
@@ -1285,16 +1284,10 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
                return;
        }
 
-       /* If remote wakeup is permitted, see whether any interface drivers
+       /* Enable remote wakeup if it is allowed, even if no interface drivers
         * actually want it.
         */
-       w = 0;
-       if (device_may_wakeup(&udev->dev) && udev->actconfig) {
-               for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
-                       intf = udev->actconfig->interface[i];
-                       w |= intf->needs_remote_wakeup;
-               }
-       }
+       w = device_may_wakeup(&udev->dev);
 
        /* If the device is autosuspended with the wrong wakeup setting,
         * autoresume now so the setting can be changed.
index a73e08fdab36336fee6f14bacef1c7dd1ec58764..fd4c36ea5e4688971afc9c2f32e3668429d0ae63 100644 (file)
@@ -416,8 +416,11 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
                        /* A length of zero means transfer the whole sg list */
                        len = length;
                        if (len == 0) {
-                               for_each_sg(sg, sg, nents, i)
-                                       len += sg->length;
+                               struct scatterlist      *sg2;
+                               int                     j;
+
+                               for_each_sg(sg, sg2, nents, j)
+                                       len += sg2->length;
                        }
                } else {
                        /*
index 38226e9a371d2d39dcb932a64144372545e75542..95dd4662d6a83acb3153433713c3e48889500f69 100644 (file)
@@ -469,8 +469,7 @@ static int eem_unwrap(struct gether *port,
                                crc = get_unaligned_le32(skb->data + len
                                                        - ETH_FCS_LEN);
                                crc2 = ~crc32_le(~0,
-                                               skb->data,
-                                               skb->len - ETH_FCS_LEN);
+                                               skb->data, len - ETH_FCS_LEN);
                        } else {
                                crc = get_unaligned_be32(skb->data + len
                                                        - ETH_FCS_LEN);
index 7d05a0be5c600c0bc6e3b2beaae8e25298aa7ea2..4ce899c9b1653b2cfd747e65a17b919d0adeae2c 100644 (file)
@@ -321,8 +321,8 @@ struct fsg_dev;
 /* Data shared by all the FSG instances. */
 struct fsg_common {
        struct usb_gadget       *gadget;
-       struct fsg_dev          *fsg;
-       struct fsg_dev          *prev_fsg;
+       struct fsg_dev          *fsg, *new_fsg;
+       wait_queue_head_t       fsg_wait;
 
        /* filesem protects: backing files in use */
        struct rw_semaphore     filesem;
@@ -351,7 +351,6 @@ struct fsg_common {
        enum fsg_state          state;          /* For exception handling */
        unsigned int            exception_req_tag;
 
-       u8                      config, new_config;
        enum data_direction     data_dir;
        u32                     data_size;
        u32                     data_size_from_cmnd;
@@ -595,7 +594,7 @@ static int fsg_setup(struct usb_function *f,
        u16                     w_value = le16_to_cpu(ctrl->wValue);
        u16                     w_length = le16_to_cpu(ctrl->wLength);
 
-       if (!fsg->common->config)
+       if (!fsg_is_set(fsg->common))
                return -EOPNOTSUPP;
 
        switch (ctrl->bRequest) {
@@ -2303,24 +2302,20 @@ static int alloc_request(struct fsg_common *common, struct usb_ep *ep,
        return -ENOMEM;
 }
 
-/*
- * Reset interface setting and re-init endpoint state (toggle etc).
- * Call with altsetting < 0 to disable the interface.  The only other
- * available altsetting is 0, which enables the interface.
- */
-static int do_set_interface(struct fsg_common *common, int altsetting)
+/* Reset interface setting and re-init endpoint state (toggle etc). */
+static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg)
 {
-       int     rc = 0;
-       int     i;
-       const struct usb_endpoint_descriptor    *d;
+       const struct usb_endpoint_descriptor *d;
+       struct fsg_dev *fsg;
+       int i, rc = 0;
 
        if (common->running)
                DBG(common, "reset interface\n");
 
 reset:
        /* Deallocate the requests */
-       if (common->prev_fsg) {
-               struct fsg_dev *fsg = common->prev_fsg;
+       if (common->fsg) {
+               fsg = common->fsg;
 
                for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
                        struct fsg_buffhd *bh = &common->buffhds[i];
@@ -2345,88 +2340,53 @@ reset:
                        fsg->bulk_out_enabled = 0;
                }
 
-               common->prev_fsg = 0;
+               common->fsg = NULL;
+               wake_up(&common->fsg_wait);
        }
 
        common->running = 0;
-       if (altsetting < 0 || rc != 0)
+       if (!new_fsg || rc)
                return rc;
 
-       DBG(common, "set interface %d\n", altsetting);
+       common->fsg = new_fsg;
+       fsg = common->fsg;
 
-       if (fsg_is_set(common)) {
-               struct fsg_dev *fsg = common->fsg;
-               common->prev_fsg = common->fsg;
+       /* Enable the endpoints */
+       d = fsg_ep_desc(common->gadget,
+                       &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc);
+       rc = enable_endpoint(common, fsg->bulk_in, d);
+       if (rc)
+               goto reset;
+       fsg->bulk_in_enabled = 1;
+
+       d = fsg_ep_desc(common->gadget,
+                       &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc);
+       rc = enable_endpoint(common, fsg->bulk_out, d);
+       if (rc)
+               goto reset;
+       fsg->bulk_out_enabled = 1;
+       common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize);
+       clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
 
-               /* Enable the endpoints */
-               d = fsg_ep_desc(common->gadget,
-                               &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc);
-               rc = enable_endpoint(common, fsg->bulk_in, d);
+       /* Allocate the requests */
+       for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
+               struct fsg_buffhd       *bh = &common->buffhds[i];
+
+               rc = alloc_request(common, fsg->bulk_in, &bh->inreq);
                if (rc)
                        goto reset;
-               fsg->bulk_in_enabled = 1;
-
-               d = fsg_ep_desc(common->gadget,
-                               &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc);
-               rc = enable_endpoint(common, fsg->bulk_out, d);
+               rc = alloc_request(common, fsg->bulk_out, &bh->outreq);
                if (rc)
                        goto reset;
-               fsg->bulk_out_enabled = 1;
-               common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize);
-               clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
-
-               /* Allocate the requests */
-               for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
-                       struct fsg_buffhd       *bh = &common->buffhds[i];
-
-                       rc = alloc_request(common, fsg->bulk_in, &bh->inreq);
-                       if (rc)
-                               goto reset;
-                       rc = alloc_request(common, fsg->bulk_out, &bh->outreq);
-                       if (rc)
-                               goto reset;
-                       bh->inreq->buf = bh->outreq->buf = bh->buf;
-                       bh->inreq->context = bh->outreq->context = bh;
-                       bh->inreq->complete = bulk_in_complete;
-                       bh->outreq->complete = bulk_out_complete;
-               }
-
-               common->running = 1;
-               for (i = 0; i < common->nluns; ++i)
-                       common->luns[i].unit_attention_data = SS_RESET_OCCURRED;
-               return rc;
-       } else {
-               return -EIO;
-       }
-}
-
-
-/*
- * Change our operational configuration.  This code must agree with the code
- * that returns config descriptors, and with interface altsetting code.
- *
- * It's also responsible for power management interactions.  Some
- * configurations might not work with our current power sources.
- * For now we just assume the gadget is always self-powered.
- */
-static int do_set_config(struct fsg_common *common, u8 new_config)
-{
-       int     rc = 0;
-
-       /* Disable the single interface */
-       if (common->config != 0) {
-               DBG(common, "reset config\n");
-               common->config = 0;
-               rc = do_set_interface(common, -1);
+               bh->inreq->buf = bh->outreq->buf = bh->buf;
+               bh->inreq->context = bh->outreq->context = bh;
+               bh->inreq->complete = bulk_in_complete;
+               bh->outreq->complete = bulk_out_complete;
        }
 
-       /* Enable the interface */
-       if (new_config != 0) {
-               common->config = new_config;
-               rc = do_set_interface(common, 0);
-               if (rc != 0)
-                       common->config = 0;     /* Reset on errors */
-       }
+       common->running = 1;
+       for (i = 0; i < common->nluns; ++i)
+               common->luns[i].unit_attention_data = SS_RESET_OCCURRED;
        return rc;
 }
 
@@ -2437,9 +2397,7 @@ static int do_set_config(struct fsg_common *common, u8 new_config)
 static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 {
        struct fsg_dev *fsg = fsg_from_func(f);
-       fsg->common->prev_fsg = fsg->common->fsg;
-       fsg->common->fsg = fsg;
-       fsg->common->new_config = 1;
+       fsg->common->new_fsg = fsg;
        raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
        return 0;
 }
@@ -2447,9 +2405,7 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 static void fsg_disable(struct usb_function *f)
 {
        struct fsg_dev *fsg = fsg_from_func(f);
-       fsg->common->prev_fsg = fsg->common->fsg;
-       fsg->common->fsg = fsg;
-       fsg->common->new_config = 0;
+       fsg->common->new_fsg = NULL;
        raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
 }
 
@@ -2459,19 +2415,17 @@ static void fsg_disable(struct usb_function *f)
 static void handle_exception(struct fsg_common *common)
 {
        siginfo_t               info;
-       int                     sig;
        int                     i;
        struct fsg_buffhd       *bh;
        enum fsg_state          old_state;
-       u8                      new_config;
        struct fsg_lun          *curlun;
        unsigned int            exception_req_tag;
-       int                     rc;
 
        /* Clear the existing signals.  Anything but SIGUSR1 is converted
         * into a high-priority EXIT exception. */
        for (;;) {
-               sig = dequeue_signal_lock(current, &current->blocked, &info);
+               int sig =
+                       dequeue_signal_lock(current, &current->blocked, &info);
                if (!sig)
                        break;
                if (sig != SIGUSR1) {
@@ -2482,7 +2436,7 @@ static void handle_exception(struct fsg_common *common)
        }
 
        /* Cancel all the pending transfers */
-       if (fsg_is_set(common)) {
+       if (likely(common->fsg)) {
                for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
                        bh = &common->buffhds[i];
                        if (bh->inreq_busy)
@@ -2523,7 +2477,6 @@ static void handle_exception(struct fsg_common *common)
        common->next_buffhd_to_fill = &common->buffhds[0];
        common->next_buffhd_to_drain = &common->buffhds[0];
        exception_req_tag = common->exception_req_tag;
-       new_config = common->new_config;
        old_state = common->state;
 
        if (old_state == FSG_STATE_ABORT_BULK_OUT)
@@ -2573,12 +2526,12 @@ static void handle_exception(struct fsg_common *common)
                break;
 
        case FSG_STATE_CONFIG_CHANGE:
-               rc = do_set_config(common, new_config);
+               do_set_interface(common, common->new_fsg);
                break;
 
        case FSG_STATE_EXIT:
        case FSG_STATE_TERMINATED:
-               do_set_config(common, 0);               /* Free resources */
+               do_set_interface(common, NULL);         /* Free resources */
                spin_lock_irq(&common->lock);
                common->state = FSG_STATE_TERMINATED;   /* Stop the thread */
                spin_unlock_irq(&common->lock);
@@ -2863,6 +2816,7 @@ buffhds_first_it:
                goto error_release;
        }
        init_completion(&common->thread_notifier);
+       init_waitqueue_head(&common->fsg_wait);
 #undef OR
 
 
@@ -2957,9 +2911,17 @@ static void fsg_common_release(struct kref *ref)
 static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
 {
        struct fsg_dev          *fsg = fsg_from_func(f);
+       struct fsg_common       *common = fsg->common;
 
        DBG(fsg, "unbind\n");
-       fsg_common_put(fsg->common);
+       if (fsg->common->fsg == fsg) {
+               fsg->common->new_fsg = NULL;
+               raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
+               /* FIXME: make interruptible or killable somehow? */
+               wait_event(common->fsg_wait, common->fsg != fsg);
+       }
+
+       fsg_common_put(common);
        usb_free_descriptors(fsg->function.descriptors);
        usb_free_descriptors(fsg->function.hs_descriptors);
        kfree(fsg);
@@ -2970,7 +2932,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
 {
        struct fsg_dev          *fsg = fsg_from_func(f);
        struct usb_gadget       *gadget = c->cdev->gadget;
-       int                     rc;
        int                     i;
        struct usb_ep           *ep;
 
@@ -2996,6 +2957,11 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
        ep->driver_data = fsg->common;  /* claim the endpoint */
        fsg->bulk_out = ep;
 
+       /* Copy descriptors */
+       f->descriptors = usb_copy_descriptors(fsg_fs_function);
+       if (unlikely(!f->descriptors))
+               return -ENOMEM;
+
        if (gadget_is_dualspeed(gadget)) {
                /* Assume endpoint addresses are the same for both speeds */
                fsg_hs_bulk_in_desc.bEndpointAddress =
@@ -3003,16 +2969,17 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
                fsg_hs_bulk_out_desc.bEndpointAddress =
                        fsg_fs_bulk_out_desc.bEndpointAddress;
                f->hs_descriptors = usb_copy_descriptors(fsg_hs_function);
-               if (unlikely(!f->hs_descriptors))
+               if (unlikely(!f->hs_descriptors)) {
+                       usb_free_descriptors(f->descriptors);
                        return -ENOMEM;
+               }
        }
 
        return 0;
 
 autoconf_fail:
        ERROR(fsg, "unable to autoconfigure all endpoints\n");
-       rc = -ENOTSUPP;
-       return rc;
+       return -ENOTSUPP;
 }
 
 
@@ -3036,11 +3003,6 @@ static int fsg_add(struct usb_composite_dev *cdev,
 
        fsg->function.name        = FSG_DRIVER_DESC;
        fsg->function.strings     = fsg_strings_array;
-       fsg->function.descriptors = usb_copy_descriptors(fsg_fs_function);
-       if (unlikely(!fsg->function.descriptors)) {
-               rc = -ENOMEM;
-               goto error_free_fsg;
-       }
        fsg->function.bind        = fsg_bind;
        fsg->function.unbind      = fsg_unbind;
        fsg->function.setup       = fsg_setup;
@@ -3056,19 +3018,9 @@ static int fsg_add(struct usb_composite_dev *cdev,
 
        rc = usb_add_function(c, &fsg->function);
        if (unlikely(rc))
-               goto error_free_all;
-
-       fsg_common_get(fsg->common);
-       return 0;
-
-error_free_all:
-       usb_free_descriptors(fsg->function.descriptors);
-       /* fsg_bind() might have copied those; or maybe not? who cares
-        * -- free it just in case. */
-       usb_free_descriptors(fsg->function.hs_descriptors);
-error_free_fsg:
-       kfree(fsg);
-
+               kfree(fsg);
+       else
+               fsg_common_get(fsg->common);
        return rc;
 }
 
index 4b0e4a040d6f7a1c134404ef253c3756caf85388..d1af253a910591fabacf1669a66749b5dbc7e1f5 100644 (file)
@@ -392,6 +392,17 @@ static int __gfs_do_config(struct usb_configuration *c,
        if (unlikely(ret < 0))
                return ret;
 
+       /* After previous do_configs there may be some invalid
+        * pointers in c->interface array.  This happens every time
+        * a user space function with fewer interfaces than a user
+        * space function that was run before the new one is run.  The
+        * compasit's set_config() assumes that if there is no more
+        * then MAX_CONFIG_INTERFACES interfaces in a configuration
+        * then there is a NULL pointer after the last interface in
+        * c->interface array.  We need to make sure this is true. */
+       if (c->next_interface_id < ARRAY_SIZE(c->interface))
+               c->interface[c->next_interface_id] = NULL;
+
        return 0;
 }
 
index 43abf55d8c60fcbc7029d4a0d4545188b9ab4308..4c3ac5c422373e6494db8ff82c03cdb208d130ea 100644 (file)
@@ -82,7 +82,7 @@ static struct class *usb_gadget_class;
 struct printer_dev {
        spinlock_t              lock;           /* lock this structure */
        /* lock buffer lists during read/write calls */
-       spinlock_t              lock_printer_io;
+       struct mutex            lock_printer_io;
        struct usb_gadget       *gadget;
        struct usb_request      *req;           /* for control responses */
        u8                      config;
@@ -567,7 +567,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
 
        DBG(dev, "printer_read trying to read %d bytes\n", (int)len);
 
-       spin_lock(&dev->lock_printer_io);
+       mutex_lock(&dev->lock_printer_io);
        spin_lock_irqsave(&dev->lock, flags);
 
        /* We will use this flag later to check if a printer reset happened
@@ -601,7 +601,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
                 * call or not.
                 */
                if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) {
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return -EAGAIN;
                }
 
@@ -648,7 +648,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
                if (dev->reset_printer) {
                        list_add(&current_rx_req->list, &dev->rx_reqs);
                        spin_unlock_irqrestore(&dev->lock, flags);
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return -EAGAIN;
                }
 
@@ -673,7 +673,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
        dev->current_rx_buf = current_rx_buf;
 
        spin_unlock_irqrestore(&dev->lock, flags);
-       spin_unlock(&dev->lock_printer_io);
+       mutex_unlock(&dev->lock_printer_io);
 
        DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied);
 
@@ -697,7 +697,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        if (len == 0)
                return -EINVAL;
 
-       spin_lock(&dev->lock_printer_io);
+       mutex_lock(&dev->lock_printer_io);
        spin_lock_irqsave(&dev->lock, flags);
 
        /* Check if a printer reset happens while we have interrupts on */
@@ -713,7 +713,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
                 * a NON-Blocking call or not.
                 */
                if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) {
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return -EAGAIN;
                }
 
@@ -752,7 +752,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 
                if (copy_from_user(req->buf, buf, size)) {
                        list_add(&req->list, &dev->tx_reqs);
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return bytes_copied;
                }
 
@@ -766,14 +766,14 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
                if (dev->reset_printer) {
                        list_add(&req->list, &dev->tx_reqs);
                        spin_unlock_irqrestore(&dev->lock, flags);
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return -EAGAIN;
                }
 
                if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) {
                        list_add(&req->list, &dev->tx_reqs);
                        spin_unlock_irqrestore(&dev->lock, flags);
-                       spin_unlock(&dev->lock_printer_io);
+                       mutex_unlock(&dev->lock_printer_io);
                        return -EAGAIN;
                }
 
@@ -782,7 +782,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
        }
 
        spin_unlock_irqrestore(&dev->lock, flags);
-       spin_unlock(&dev->lock_printer_io);
+       mutex_unlock(&dev->lock_printer_io);
 
        DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied);
 
@@ -820,11 +820,11 @@ printer_poll(struct file *fd, poll_table *wait)
        unsigned long           flags;
        int                     status = 0;
 
-       spin_lock(&dev->lock_printer_io);
+       mutex_lock(&dev->lock_printer_io);
        spin_lock_irqsave(&dev->lock, flags);
        setup_rx_reqs(dev);
        spin_unlock_irqrestore(&dev->lock, flags);
-       spin_unlock(&dev->lock_printer_io);
+       mutex_unlock(&dev->lock_printer_io);
 
        poll_wait(fd, &dev->rx_wait, wait);
        poll_wait(fd, &dev->tx_wait, wait);
@@ -1461,7 +1461,7 @@ autoconf_fail:
        }
 
        spin_lock_init(&dev->lock);
-       spin_lock_init(&dev->lock_printer_io);
+       mutex_init(&dev->lock_printer_io);
        INIT_LIST_HEAD(&dev->tx_reqs);
        INIT_LIST_HEAD(&dev->tx_reqs_active);
        INIT_LIST_HEAD(&dev->rx_reqs);
@@ -1594,7 +1594,7 @@ cleanup(void)
 {
        int status;
 
-       spin_lock(&usb_printer_gadget.lock_printer_io);
+       mutex_lock(&usb_printer_gadget.lock_printer_io);
        class_destroy(usb_gadget_class);
        unregister_chrdev_region(g_printer_devno, 2);
 
@@ -1602,6 +1602,6 @@ cleanup(void)
        if (status)
                ERROR(dev, "usb_gadget_unregister_driver %x\n", status);
 
-       spin_unlock(&usb_printer_gadget.lock_printer_io);
+       mutex_unlock(&usb_printer_gadget.lock_printer_io);
 }
 module_exit(cleanup);
index d5f4c1d45c9703add01e29e582e5f705e87cc83f..e724a051bfdd11bcd520ae90ff0b0c448883d13f 100644 (file)
@@ -1700,9 +1700,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        if (!driver || driver != udc->driver || !driver->unbind)
                return -EINVAL;
 
-       dprintk(DEBUG_NORMAL,"usb_gadget_register_driver() '%s'\n",
+       dprintk(DEBUG_NORMAL, "usb_gadget_unregister_driver() '%s'\n",
                driver->driver.name);
 
+       /* report disconnect */
+       if (driver->disconnect)
+               driver->disconnect(&udc->gadget);
+
        driver->unbind(&udc->gadget);
 
        device_del(&udc->gadget.dev);
index 16bdf77f582a02526f2b60750e26dbfb2e425228..3e8dcb5455e3a4912f7bc0fc525b69c524cade7f 100644 (file)
@@ -536,17 +536,11 @@ recycle:
                list_move(&req->list, &port->read_pool);
        }
 
-       /* Push from tty to ldisc; this is immediate with low_latency, and
-        * may trigger callbacks to this driver ... so drop the spinlock.
+       /* Push from tty to ldisc; without low_latency set this is handled by
+        * a workqueue, so we won't get callbacks and can hold port_lock
         */
        if (tty && do_push) {
-               spin_unlock_irq(&port->port_lock);
                tty_flip_buffer_push(tty);
-               wake_up_interruptible(&tty->read_wait);
-               spin_lock_irq(&port->port_lock);
-
-               /* tty may have been closed */
-               tty = port->port_tty;
        }
 
 
@@ -784,11 +778,6 @@ static int gs_open(struct tty_struct *tty, struct file *file)
        port->open_count = 1;
        port->openclose = false;
 
-       /* low_latency means ldiscs work in tasklet context, without
-        * needing a workqueue schedule ... easier to keep up.
-        */
-       tty->low_latency = 1;
-
        /* if connected, start the I/O stream */
        if (port->port_usb) {
                struct gserial  *gser = port->port_usb;
@@ -1195,6 +1184,7 @@ void gserial_cleanup(void)
        n_ports = 0;
 
        tty_unregister_driver(gs_tty_driver);
+       put_tty_driver(gs_tty_driver);
        gs_tty_driver = NULL;
 
        pr_debug("%s: cleaned up ttyGS* support\n", __func__);
index 544ccfd7056ed5ff13d7a3daea6178d22e9efbd6..bd4027745aa7039e5cfcdd6b1bf4057ad8569d85 100644 (file)
@@ -207,10 +207,17 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
        /* Initialize the transceiver */
        if (pdata->otg) {
                pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET;
-               if (otg_init(pdata->otg) != 0)
-                       dev_err(dev, "unable to init transceiver\n");
-               else if (otg_set_vbus(pdata->otg, 1) != 0)
+               ret = otg_init(pdata->otg);
+               if (ret) {
+                       dev_err(dev, "unable to init transceiver, probably missing\n");
+                       ret = -ENODEV;
+                       goto err_add;
+               }
+               ret = otg_set_vbus(pdata->otg, 1);
+               if (ret) {
                        dev_err(dev, "unable to enable vbus on transceiver\n");
+                       goto err_add;
+               }
        }
 
        priv->hcd = hcd;
index 20a0dfe0fe368c7f6284f82df2080e19b69935a8..0587ad4ce5c2948500dbd339b5d03f322b905fb6 100644 (file)
@@ -2224,12 +2224,9 @@ static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
 
 /*-------------------------------------------------------------------------*/
 
-static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
+static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
 {
        int tmp = 20;
-       unsigned long flags;
-
-       spin_lock_irqsave(&isp1362_hcd->lock, flags);
 
        isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC);
        isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR);
@@ -2240,6 +2237,14 @@ static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
        }
        if (!tmp)
                pr_err("Software reset timeout\n");
+}
+
+static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&isp1362_hcd->lock, flags);
+       __isp1362_sw_reset(isp1362_hcd);
        spin_unlock_irqrestore(&isp1362_hcd->lock, flags);
 }
 
@@ -2418,7 +2423,7 @@ static void isp1362_hc_stop(struct usb_hcd *hcd)
        if (isp1362_hcd->board && isp1362_hcd->board->reset)
                isp1362_hcd->board->reset(hcd->self.controller, 1);
        else
-               isp1362_sw_reset(isp1362_hcd);
+               __isp1362_sw_reset(isp1362_hcd);
 
        if (isp1362_hcd->board && isp1362_hcd->board->clock)
                isp1362_hcd->board->clock(hcd->self.controller, 0);
index 1a2bb4ce638fefe0c1fa6ff2151c32f5fe685528..77be3c24a4279d0aca3cc268164cf20960e135f5 100644 (file)
@@ -1065,7 +1065,7 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port)
        else if (speed == LSMODE)
                rh->port |= USB_PORT_STAT_LOW_SPEED;
 
-       rh->port &= USB_PORT_STAT_RESET;
+       rh->port &= ~USB_PORT_STAT_RESET;
        rh->port |= USB_PORT_STAT_ENABLE;
 }
 
index 9012098add6baefada9cd6155d57be8f9708afd7..94e6934edb09c0e3a06dd696a96c3d825719ede6 100644 (file)
@@ -182,8 +182,12 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
  * set, but other sections talk about dealing with the chain bit set.  This was
  * fixed in the 0.96 specification errata, but we have to assume that all 0.95
  * xHCI hardware can't handle the chain bit being cleared on a link TRB.
+ *
+ * @more_trbs_coming:  Will you enqueue more TRBs before calling
+ *                     prepare_transfer()?
  */
-static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer)
+static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
+               bool consumer, bool more_trbs_coming)
 {
        u32 chain;
        union xhci_trb *next;
@@ -199,15 +203,28 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
        while (last_trb(xhci, ring, ring->enq_seg, next)) {
                if (!consumer) {
                        if (ring != xhci->event_ring) {
-                               if (chain) {
-                                       next->link.control |= TRB_CHAIN;
-
-                                       /* Give this link TRB to the hardware */
-                                       wmb();
-                                       next->link.control ^= TRB_CYCLE;
-                               } else {
+                               /*
+                                * If the caller doesn't plan on enqueueing more
+                                * TDs before ringing the doorbell, then we
+                                * don't want to give the link TRB to the
+                                * hardware just yet.  We'll give the link TRB
+                                * back in prepare_ring() just before we enqueue
+                                * the TD at the top of the ring.
+                                */
+                               if (!chain && !more_trbs_coming)
                                        break;
+
+                               /* If we're not dealing with 0.95 hardware,
+                                * carry over the chain bit of the previous TRB
+                                * (which may mean the chain bit is cleared).
+                                */
+                               if (!xhci_link_trb_quirk(xhci)) {
+                                       next->link.control &= ~TRB_CHAIN;
+                                       next->link.control |= chain;
                                }
+                               /* Give this link TRB to the hardware */
+                               wmb();
+                               next->link.control ^= TRB_CYCLE;
                        }
                        /* Toggle the cycle bit after the last ring segment. */
                        if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
@@ -1707,9 +1724,12 @@ void xhci_handle_event(struct xhci_hcd *xhci)
 /*
  * Generic function for queueing a TRB on a ring.
  * The caller must have checked to make sure there's room on the ring.
+ *
+ * @more_trbs_coming:  Will you enqueue more TRBs before calling
+ *                     prepare_transfer()?
  */
 static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
-               bool consumer,
+               bool consumer, bool more_trbs_coming,
                u32 field1, u32 field2, u32 field3, u32 field4)
 {
        struct xhci_generic_trb *trb;
@@ -1719,7 +1739,7 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
        trb->field[1] = field2;
        trb->field[2] = field3;
        trb->field[3] = field4;
-       inc_enq(xhci, ring, consumer);
+       inc_enq(xhci, ring, consumer, more_trbs_coming);
 }
 
 /*
@@ -1988,6 +2008,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
        int trb_buff_len, this_sg_len, running_total;
        bool first_trb;
        u64 addr;
+       bool more_trbs_coming;
 
        struct xhci_generic_trb *start_trb;
        int start_cycle;
@@ -2073,7 +2094,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-               queue_trb(xhci, ep_ring, false,
+               if (num_trbs > 1)
+                       more_trbs_coming = true;
+               else
+                       more_trbs_coming = false;
+               queue_trb(xhci, ep_ring, false, more_trbs_coming,
                                lower_32_bits(addr),
                                upper_32_bits(addr),
                                length_field,
@@ -2124,6 +2149,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
        int num_trbs;
        struct xhci_generic_trb *start_trb;
        bool first_trb;
+       bool more_trbs_coming;
        int start_cycle;
        u32 field, length_field;
 
@@ -2212,7 +2238,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
                length_field = TRB_LEN(trb_buff_len) |
                        remainder |
                        TRB_INTR_TARGET(0);
-               queue_trb(xhci, ep_ring, false,
+               if (num_trbs > 1)
+                       more_trbs_coming = true;
+               else
+                       more_trbs_coming = false;
+               queue_trb(xhci, ep_ring, false, more_trbs_coming,
                                lower_32_bits(addr),
                                upper_32_bits(addr),
                                length_field,
@@ -2291,7 +2321,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
        /* Queue setup TRB - see section 6.4.1.2.1 */
        /* FIXME better way to translate setup_packet into two u32 fields? */
        setup = (struct usb_ctrlrequest *) urb->setup_packet;
-       queue_trb(xhci, ep_ring, false,
+       queue_trb(xhci, ep_ring, false, true,
                        /* FIXME endianness is probably going to bite my ass here. */
                        setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16,
                        setup->wIndex | setup->wLength << 16,
@@ -2307,7 +2337,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
        if (urb->transfer_buffer_length > 0) {
                if (setup->bRequestType & USB_DIR_IN)
                        field |= TRB_DIR_IN;
-               queue_trb(xhci, ep_ring, false,
+               queue_trb(xhci, ep_ring, false, true,
                                lower_32_bits(urb->transfer_dma),
                                upper_32_bits(urb->transfer_dma),
                                length_field,
@@ -2324,7 +2354,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
                field = 0;
        else
                field = TRB_DIR_IN;
-       queue_trb(xhci, ep_ring, false,
+       queue_trb(xhci, ep_ring, false, false,
                        0,
                        0,
                        TRB_INTR_TARGET(0),
@@ -2361,7 +2391,7 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2,
                                        "unfailable commands failed.\n");
                return -ENOMEM;
        }
-       queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3,
+       queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3,
                        field4 | xhci->cmd_ring->cycle_state);
        return 0;
 }
index fad70bc835558a501e0f06a615237e07be4197e0..3b795c56221f8c30f757fe9420eea7424dc2d804 100644 (file)
@@ -219,8 +219,8 @@ static int musb_ulpi_write(struct otg_transceiver *otg,
        return 0;
 }
 #else
-#define musb_ulpi_read(a, b)           NULL
-#define musb_ulpi_write(a, b, c)       NULL
+#define musb_ulpi_read         NULL
+#define musb_ulpi_write                NULL
 #endif
 
 static struct otg_io_access_ops musb_ulpi_access = {
@@ -451,10 +451,6 @@ void musb_hnp_stop(struct musb *musb)
  * @param power
  */
 
-#define STAGE0_MASK (MUSB_INTR_RESUME | MUSB_INTR_SESSREQ \
-               | MUSB_INTR_VBUSERROR | MUSB_INTR_CONNECT \
-               | MUSB_INTR_RESET)
-
 static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
                                u8 devctl, u8 power)
 {
@@ -642,7 +638,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
                handled = IRQ_HANDLED;
        }
 
-
+#endif
        if (int_usb & MUSB_INTR_SUSPEND) {
                DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
                                otg_state_string(musb), devctl, power);
@@ -705,6 +701,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
                }
        }
 
+#ifdef CONFIG_USB_MUSB_HDRC_HCD
        if (int_usb & MUSB_INTR_CONNECT) {
                struct usb_hcd *hcd = musb_to_hcd(musb);
                void __iomem *mbase = musb->mregs;
@@ -1597,7 +1594,7 @@ irqreturn_t musb_interrupt(struct musb *musb)
        /* the core can interrupt us for multiple reasons; docs have
         * a generic interrupt flowchart to follow
         */
-       if (musb->int_usb & STAGE0_MASK)
+       if (musb->int_usb)
                retval |= musb_stage0_irq(musb, musb->int_usb,
                                devctl, power);
 
index b22d02dea7d361698e830efa3919df3802a5b3b4..91d67794e3503eeeb982c8c85e537e48c7d15394 100644 (file)
@@ -470,7 +470,8 @@ struct musb_csr_regs {
 
 struct musb_context_registers {
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
+    defined(CONFIG_ARCH_OMAP4)
        u32 otg_sysconfig, otg_forcestandby;
 #endif
        u8 power;
@@ -484,7 +485,8 @@ struct musb_context_registers {
        struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
 };
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
+    defined(CONFIG_ARCH_OMAP4)
 extern void musb_platform_save_context(struct musb *musb,
                struct musb_context_registers *musb_context);
 extern void musb_platform_restore_context(struct musb *musb,
index 1008044a3bbc38efc580ae72211fd7a33b29d4d3..dc66e4376d4906a4454b90a393851cd72631aefa 100644 (file)
@@ -132,18 +132,9 @@ static void configure_channel(struct dma_channel *channel,
        if (mode) {
                csr |= 1 << MUSB_HSDMA_MODE1_SHIFT;
                BUG_ON(len < packet_sz);
-
-               if (packet_sz >= 64) {
-                       csr |= MUSB_HSDMA_BURSTMODE_INCR16
-                                       << MUSB_HSDMA_BURSTMODE_SHIFT;
-               } else if (packet_sz >= 32) {
-                       csr |= MUSB_HSDMA_BURSTMODE_INCR8
-                                       << MUSB_HSDMA_BURSTMODE_SHIFT;
-               } else if (packet_sz >= 16) {
-                       csr |= MUSB_HSDMA_BURSTMODE_INCR4
-                                       << MUSB_HSDMA_BURSTMODE_SHIFT;
-               }
        }
+       csr |= MUSB_HSDMA_BURSTMODE_INCR16
+                               << MUSB_HSDMA_BURSTMODE_SHIFT;
 
        csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT)
                | (1 << MUSB_HSDMA_ENABLE_SHIFT)
index b1b346932946d447dcf11b1ddcb952edd49acaab..d331b222ad214cdd43e815761eb08a3c300e8196 100644 (file)
@@ -59,12 +59,17 @@ static int ulpi_set_flags(struct otg_transceiver *otg)
 
 static int ulpi_init(struct otg_transceiver *otg)
 {
-       int i, vid, pid;
-
-       vid = (otg_io_read(otg, ULPI_VENDOR_ID_HIGH) << 8) |
-              otg_io_read(otg, ULPI_VENDOR_ID_LOW);
-       pid = (otg_io_read(otg, ULPI_PRODUCT_ID_HIGH) << 8) |
-              otg_io_read(otg, ULPI_PRODUCT_ID_LOW);
+       int i, vid, pid, ret;
+       u32 ulpi_id = 0;
+
+       for (i = 0; i < 4; i++) {
+               ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i);
+               if (ret < 0)
+                       return ret;
+               ulpi_id = (ulpi_id << 8) | ret;
+       }
+       vid = ulpi_id & 0xffff;
+       pid = ulpi_id >> 16;
 
        pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid);
 
index 79dd1ae195e56263610c63c1d3da6e7bb71b1de5..da7e334b0407a3ef0e210a56dcc02ea3f2a14db8 100644 (file)
@@ -653,7 +653,6 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
        { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
        { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
-       { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
index 94d86c3febcb8e0ad67ba11b105822e8d25ba17a..bbc159a1df45d330f926a6e003dadece3c1b4daa 100644 (file)
 #define CONTEC_VID             0x06CE  /* Vendor ID */
 #define CONTEC_COM1USBH_PID    0x8311  /* COM-1(USB)H */
 
-/*
- * Contec products (http://www.contec.com)
- * Submitted by Daniel Sangorrin
- */
-#define CONTEC_VID             0x06CE  /* Vendor ID */
-#define CONTEC_COM1USBH_PID    0x8311  /* COM-1(USB)H */
-
 /*
  * Definitions for B&B Electronics products.
  */
index 04bb759536bb81f6e41ecc2b4537e5e2e0b2790f..93d72eb8cafc8deaa36a52e2632a6cee3429ce66 100644 (file)
@@ -139,6 +139,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
                                        "Could not set interface, error %d\n",
                                        retval);
                                retval = -ENODEV;
+                               kfree(data);
                        }
                        return retval;
                }
@@ -155,6 +156,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
                                        "Could not set interface, error %d\n",
                                        retval);
                                retval = -ENODEV;
+                               kfree(data);
                        }
                        return retval;
                }
@@ -163,6 +165,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
        default:
                dev_err(&serial->dev->dev,
                        "unknown number of interfaces: %d\n", nintf);
+               kfree(data);
                return -ENODEV;
        }
 
index 76e7dac6f25901843da1717d6fb55a3c721a8e16..70b1d9d51c9601e2c4c338f58d29f7d4f59214dd 100644 (file)
@@ -40,7 +40,7 @@ static int vram;
 static int vt_switch;
 
 /* Modes relevant to the GX (taken from modedb.c) */
-static struct fb_videomode gx_modedb[] __initdata = {
+static struct fb_videomode gx_modedb[] __devinitdata = {
        /* 640x480-60 VESA */
        { NULL, 60, 640, 480, 39682,  48, 16, 33, 10, 96, 2,
          0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -110,14 +110,15 @@ static struct fb_videomode gx_modedb[] __initdata = {
 #ifdef CONFIG_OLPC
 #include <asm/olpc.h>
 
-static struct fb_videomode gx_dcon_modedb[] __initdata = {
+static struct fb_videomode gx_dcon_modedb[] __devinitdata = {
        /* The only mode the DCON has is 1200x900 */
        { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
          FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
          FB_VMODE_NONINTERLACED, 0 }
 };
 
-static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+static void __devinit get_modedb(struct fb_videomode **modedb,
+               unsigned int *size)
 {
        if (olpc_has_dcon()) {
                *modedb = (struct fb_videomode *) gx_dcon_modedb;
@@ -129,7 +130,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
 }
 
 #else
-static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+static void __devinit get_modedb(struct fb_videomode **modedb,
+               unsigned int *size)
 {
        *modedb = (struct fb_videomode *) gx_modedb;
        *size = ARRAY_SIZE(gx_modedb);
@@ -226,7 +228,8 @@ static int gxfb_blank(int blank_mode, struct fb_info *info)
        return gx_blank_display(info, blank_mode);
 }
 
-static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
+static int __devinit gxfb_map_video_memory(struct fb_info *info,
+               struct pci_dev *dev)
 {
        struct gxfb_par *par = info->par;
        int ret;
@@ -290,7 +293,7 @@ static struct fb_ops gxfb_ops = {
        .fb_imageblit   = cfb_imageblit,
 };
 
-static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
+static struct fb_info *__devinit gxfb_init_fbinfo(struct device *dev)
 {
        struct gxfb_par *par;
        struct fb_info *info;
@@ -371,7 +374,8 @@ static int gxfb_resume(struct pci_dev *pdev)
 }
 #endif
 
-static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+static int __devinit gxfb_probe(struct pci_dev *pdev,
+               const struct pci_device_id *id)
 {
        struct gxfb_par *par;
        struct fb_info *info;
@@ -451,7 +455,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
        return ret;
 }
 
-static void gxfb_remove(struct pci_dev *pdev)
+static void __devexit gxfb_remove(struct pci_dev *pdev)
 {
        struct fb_info *info = pci_get_drvdata(pdev);
        struct gxfb_par *par = info->par;
index 1a18da86d3fa3cbde2b899831ec136a178527340..39bdbedf43b481253e7eb3586d15050c83abb94c 100644 (file)
@@ -35,7 +35,7 @@ static int vt_switch;
  * we try to make it something sane - 640x480-60 is sane
  */
 
-static struct fb_videomode geode_modedb[] __initdata = {
+static struct fb_videomode geode_modedb[] __devinitdata = {
        /* 640x480-60 */
        { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
          FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
@@ -219,14 +219,15 @@ static struct fb_videomode geode_modedb[] __initdata = {
 #ifdef CONFIG_OLPC
 #include <asm/olpc.h>
 
-static struct fb_videomode olpc_dcon_modedb[] __initdata = {
+static struct fb_videomode olpc_dcon_modedb[] __devinitdata = {
        /* The only mode the DCON has is 1200x900 */
        { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
          FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
          FB_VMODE_NONINTERLACED, 0 }
 };
 
-static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+static void __devinit get_modedb(struct fb_videomode **modedb,
+               unsigned int *size)
 {
        if (olpc_has_dcon()) {
                *modedb = (struct fb_videomode *) olpc_dcon_modedb;
@@ -238,7 +239,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
 }
 
 #else
-static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
+static void __devinit get_modedb(struct fb_videomode **modedb,
+               unsigned int *size)
 {
        *modedb = (struct fb_videomode *) geode_modedb;
        *size = ARRAY_SIZE(geode_modedb);
@@ -334,7 +336,7 @@ static int lxfb_blank(int blank_mode, struct fb_info *info)
 }
 
 
-static int __init lxfb_map_video_memory(struct fb_info *info,
+static int __devinit lxfb_map_video_memory(struct fb_info *info,
                                        struct pci_dev *dev)
 {
        struct lxfb_par *par = info->par;
@@ -412,7 +414,7 @@ static struct fb_ops lxfb_ops = {
        .fb_imageblit   = cfb_imageblit,
 };
 
-static struct fb_info * __init lxfb_init_fbinfo(struct device *dev)
+static struct fb_info * __devinit lxfb_init_fbinfo(struct device *dev)
 {
        struct lxfb_par *par;
        struct fb_info *info;
@@ -496,7 +498,7 @@ static int lxfb_resume(struct pci_dev *pdev)
 #define lxfb_resume NULL
 #endif
 
-static int __init lxfb_probe(struct pci_dev *pdev,
+static int __devinit lxfb_probe(struct pci_dev *pdev,
                             const struct pci_device_id *id)
 {
        struct lxfb_par *par;
@@ -588,7 +590,7 @@ err:
        return ret;
 }
 
-static void lxfb_remove(struct pci_dev *pdev)
+static void __devexit lxfb_remove(struct pci_dev *pdev)
 {
        struct fb_info *info = pci_get_drvdata(pdev);
        struct lxfb_par *par = info->par;
index d4cde79ea15e61362a34736179520053d68383bc..81687ed26ba9ed55d761b550d1df59b59ce371a9 100644 (file)
@@ -596,8 +596,6 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev)
                goto release_regs;
        }
 
-       nuc900_driver_clksrc_div(&pdev->dev, "ext", 0x2);
-
        fbi->clk = clk_get(&pdev->dev, NULL);
        if (!fbi->clk || IS_ERR(fbi->clk)) {
                printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n");
index b6ab27ccf214fc8c406a9ef70e91d7930af0eaec..811384bec8de8d486a9aa7355d49b0195995e97a 100644 (file)
  * Here we can be a bit looser than the data sections since this
  * needs to only meet arch ABI requirements.
  */
-#ifdef ARCH_SLAB_MINALIGN
-#define FLAT_STACK_ALIGN       (ARCH_SLAB_MINALIGN)
-#else
-#define FLAT_STACK_ALIGN       (sizeof(void *))
-#endif
+#define FLAT_STACK_ALIGN       max_t(unsigned long, sizeof(void *), ARCH_SLAB_MINALIGN)
 
 #define RELOC_FAILED 0xff00ff01                /* Relocation incorrect somewhere */
 #define UNLOADED_LIB 0x7ff000ff                /* Placeholder for unused library */
index d96047b4a633a86cb7ae711cb29362ac6cda061a..c8c78ba078271163f567c26045afff6cf0b5cd71 100644 (file)
@@ -590,6 +590,8 @@ static void prune_dcache(int count)
                        up_read(&sb->s_umount);
                }
                spin_lock(&sb_lock);
+               /* lock was dropped, must reset next */
+               list_safe_reset_next(sb, n, s_list);
                count -= pruned;
                __put_super(sb);
                /* more work left to do? */
index 51e11bf5708f2430cca213485d597ff070f228af..9d175d623aabc5e7c99a83e75e6c970a340465c6 100644 (file)
@@ -733,12 +733,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
 {
        while (fa) {
                struct fown_struct *fown;
+               unsigned long flags;
+
                if (fa->magic != FASYNC_MAGIC) {
                        printk(KERN_ERR "kill_fasync: bad magic number in "
                               "fasync_struct!\n");
                        return;
                }
-               spin_lock(&fa->fa_lock);
+               spin_lock_irqsave(&fa->fa_lock, flags);
                if (fa->fa_file) {
                        fown = &fa->fa_file->f_owner;
                        /* Don't send SIGURG to processes which have not set a
@@ -747,7 +749,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
                        if (!(sig == SIGURG && fown->signum == 0))
                                send_sigio(fown, fa->fa_fd, band);
                }
-               spin_unlock(&fa->fa_lock);
+               spin_unlock_irqrestore(&fa->fa_lock, flags);
                fa = rcu_dereference(fa->fa_next);
        }
 }
index 1d1088f48bc2dfe713d53a9af0fa4d51e1161428..0609607d395591ad5b23ee52283ad25c85e2bc10 100644 (file)
@@ -63,24 +63,16 @@ struct bdi_work {
 };
 
 enum {
-       WS_USED_B = 0,
-       WS_ONSTACK_B,
+       WS_INPROGRESS = 0,
+       WS_ONSTACK,
 };
 
-#define WS_USED (1 << WS_USED_B)
-#define WS_ONSTACK (1 << WS_ONSTACK_B)
-
-static inline bool bdi_work_on_stack(struct bdi_work *work)
-{
-       return test_bit(WS_ONSTACK_B, &work->state);
-}
-
 static inline void bdi_work_init(struct bdi_work *work,
                                 struct wb_writeback_args *args)
 {
        INIT_RCU_HEAD(&work->rcu_head);
        work->args = *args;
-       work->state = WS_USED;
+       __set_bit(WS_INPROGRESS, &work->state);
 }
 
 /**
@@ -95,43 +87,16 @@ int writeback_in_progress(struct backing_dev_info *bdi)
        return !list_empty(&bdi->work_list);
 }
 
-static void bdi_work_clear(struct bdi_work *work)
-{
-       clear_bit(WS_USED_B, &work->state);
-       smp_mb__after_clear_bit();
-       /*
-        * work can have disappeared at this point. bit waitq functions
-        * should be able to tolerate this, provided bdi_sched_wait does
-        * not dereference it's pointer argument.
-       */
-       wake_up_bit(&work->state, WS_USED_B);
-}
-
 static void bdi_work_free(struct rcu_head *head)
 {
        struct bdi_work *work = container_of(head, struct bdi_work, rcu_head);
 
-       if (!bdi_work_on_stack(work))
-               kfree(work);
-       else
-               bdi_work_clear(work);
-}
-
-static void wb_work_complete(struct bdi_work *work)
-{
-       const enum writeback_sync_modes sync_mode = work->args.sync_mode;
-       int onstack = bdi_work_on_stack(work);
+       clear_bit(WS_INPROGRESS, &work->state);
+       smp_mb__after_clear_bit();
+       wake_up_bit(&work->state, WS_INPROGRESS);
 
-       /*
-        * For allocated work, we can clear the done/seen bit right here.
-        * For on-stack work, we need to postpone both the clear and free
-        * to after the RCU grace period, since the stack could be invalidated
-        * as soon as bdi_work_clear() has done the wakeup.
-        */
-       if (!onstack)
-               bdi_work_clear(work);
-       if (sync_mode == WB_SYNC_NONE || onstack)
-               call_rcu(&work->rcu_head, bdi_work_free);
+       if (!test_bit(WS_ONSTACK, &work->state))
+               kfree(work);
 }
 
 static void wb_clear_pending(struct bdi_writeback *wb, struct bdi_work *work)
@@ -147,7 +112,7 @@ static void wb_clear_pending(struct bdi_writeback *wb, struct bdi_work *work)
                list_del_rcu(&work->list);
                spin_unlock(&bdi->wb_lock);
 
-               wb_work_complete(work);
+               call_rcu(&work->rcu_head, bdi_work_free);
        }
 }
 
@@ -185,9 +150,9 @@ static void bdi_queue_work(struct backing_dev_info *bdi, struct bdi_work *work)
  * Used for on-stack allocated work items. The caller needs to wait until
  * the wb threads have acked the work before it's safe to continue.
  */
-static void bdi_wait_on_work_clear(struct bdi_work *work)
+static void bdi_wait_on_work_done(struct bdi_work *work)
 {
-       wait_on_bit(&work->state, WS_USED_B, bdi_sched_wait,
+       wait_on_bit(&work->state, WS_INPROGRESS, bdi_sched_wait,
                    TASK_UNINTERRUPTIBLE);
 }
 
@@ -213,37 +178,28 @@ static void bdi_alloc_queue_work(struct backing_dev_info *bdi,
 }
 
 /**
- * bdi_sync_writeback - start and wait for writeback
- * @bdi: the backing device to write from
+ * bdi_queue_work_onstack - start and wait for writeback
  * @sb: write inodes from this super_block
  *
  * Description:
- *   This does WB_SYNC_ALL data integrity writeback and waits for the
- *   IO to complete. Callers must hold the sb s_umount semaphore for
+ *   This function initiates writeback and waits for the operation to
+ *   complete. Callers must hold the sb s_umount semaphore for
  *   reading, to avoid having the super disappear before we are done.
  */
-static void bdi_sync_writeback(struct backing_dev_info *bdi,
-                              struct super_block *sb)
+static void bdi_queue_work_onstack(struct wb_writeback_args *args)
 {
-       struct wb_writeback_args args = {
-               .sb             = sb,
-               .sync_mode      = WB_SYNC_ALL,
-               .nr_pages       = LONG_MAX,
-               .range_cyclic   = 0,
-       };
        struct bdi_work work;
 
-       bdi_work_init(&work, &args);
-       work.state |= WS_ONSTACK;
+       bdi_work_init(&work, args);
+       __set_bit(WS_ONSTACK, &work.state);
 
-       bdi_queue_work(bdi, &work);
-       bdi_wait_on_work_clear(&work);
+       bdi_queue_work(args->sb->s_bdi, &work);
+       bdi_wait_on_work_done(&work);
 }
 
 /**
  * bdi_start_writeback - start writeback
  * @bdi: the backing device to write from
- * @sb: write inodes from this super_block
  * @nr_pages: the number of pages to write
  *
  * Description:
@@ -252,25 +208,34 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
  *   completion. Caller need not hold sb s_umount semaphore.
  *
  */
-void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
-                        long nr_pages)
+void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages)
 {
        struct wb_writeback_args args = {
-               .sb             = sb,
                .sync_mode      = WB_SYNC_NONE,
                .nr_pages       = nr_pages,
                .range_cyclic   = 1,
        };
 
-       /*
-        * We treat @nr_pages=0 as the special case to do background writeback,
-        * ie. to sync pages until the background dirty threshold is reached.
-        */
-       if (!nr_pages) {
-               args.nr_pages = LONG_MAX;
-               args.for_background = 1;
-       }
+       bdi_alloc_queue_work(bdi, &args);
+}
 
+/**
+ * bdi_start_background_writeback - start background writeback
+ * @bdi: the backing device to write from
+ *
+ * Description:
+ *   This does WB_SYNC_NONE background writeback. The IO is only
+ *   started when this function returns, we make no guarentees on
+ *   completion. Caller need not hold sb s_umount semaphore.
+ */
+void bdi_start_background_writeback(struct backing_dev_info *bdi)
+{
+       struct wb_writeback_args args = {
+               .sync_mode      = WB_SYNC_NONE,
+               .nr_pages       = LONG_MAX,
+               .for_background = 1,
+               .range_cyclic   = 1,
+       };
        bdi_alloc_queue_work(bdi, &args);
 }
 
@@ -561,48 +526,30 @@ select_queue:
        return ret;
 }
 
-static void unpin_sb_for_writeback(struct super_block *sb)
-{
-       up_read(&sb->s_umount);
-       put_super(sb);
-}
-
-enum sb_pin_state {
-       SB_PINNED,
-       SB_NOT_PINNED,
-       SB_PIN_FAILED
-};
-
 /*
- * For WB_SYNC_NONE writeback, the caller does not have the sb pinned
+ * For background writeback the caller does not have the sb pinned
  * before calling writeback. So make sure that we do pin it, so it doesn't
  * go away while we are writing inodes from it.
  */
-static enum sb_pin_state pin_sb_for_writeback(struct writeback_control *wbc,
-                                             struct super_block *sb)
+static bool pin_sb_for_writeback(struct super_block *sb)
 {
-       /*
-        * Caller must already hold the ref for this
-        */
-       if (wbc->sync_mode == WB_SYNC_ALL) {
-               WARN_ON(!rwsem_is_locked(&sb->s_umount));
-               return SB_NOT_PINNED;
-       }
        spin_lock(&sb_lock);
+       if (list_empty(&sb->s_instances)) {
+               spin_unlock(&sb_lock);
+               return false;
+       }
+
        sb->s_count++;
+       spin_unlock(&sb_lock);
+
        if (down_read_trylock(&sb->s_umount)) {
-               if (sb->s_root) {
-                       spin_unlock(&sb_lock);
-                       return SB_PINNED;
-               }
-               /*
-                * umounted, drop rwsem again and fall through to failure
-                */
+               if (sb->s_root)
+                       return true;
                up_read(&sb->s_umount);
        }
-       sb->s_count--;
-       spin_unlock(&sb_lock);
-       return SB_PIN_FAILED;
+
+       put_super(sb);
+       return false;
 }
 
 /*
@@ -681,24 +628,31 @@ static void writeback_inodes_wb(struct bdi_writeback *wb,
                struct inode *inode = list_entry(wb->b_io.prev,
                                                 struct inode, i_list);
                struct super_block *sb = inode->i_sb;
-               enum sb_pin_state state;
 
-               if (wbc->sb && sb != wbc->sb) {
-                       /* super block given and doesn't
-                          match, skip this inode */
-                       redirty_tail(inode);
-                       continue;
-               }
-               state = pin_sb_for_writeback(wbc, sb);
+               if (wbc->sb) {
+                       /*
+                        * We are requested to write out inodes for a specific
+                        * superblock.  This means we already have s_umount
+                        * taken by the caller which also waits for us to
+                        * complete the writeout.
+                        */
+                       if (sb != wbc->sb) {
+                               redirty_tail(inode);
+                               continue;
+                       }
 
-               if (state == SB_PIN_FAILED) {
-                       requeue_io(inode);
-                       continue;
+                       WARN_ON(!rwsem_is_locked(&sb->s_umount));
+
+                       ret = writeback_sb_inodes(sb, wb, wbc);
+               } else {
+                       if (!pin_sb_for_writeback(sb)) {
+                               requeue_io(inode);
+                               continue;
+                       }
+                       ret = writeback_sb_inodes(sb, wb, wbc);
+                       drop_super(sb);
                }
-               ret = writeback_sb_inodes(sb, wb, wbc);
 
-               if (state == SB_PINNED)
-                       unpin_sb_for_writeback(sb);
                if (ret)
                        break;
        }
@@ -911,7 +865,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait)
                 * If this isn't a data integrity operation, just notify
                 * that we have seen this work and we are now starting it.
                 */
-               if (args.sync_mode == WB_SYNC_NONE)
+               if (!test_bit(WS_ONSTACK, &work->state))
                        wb_clear_pending(wb, work);
 
                wrote += wb_writeback(wb, &args);
@@ -920,7 +874,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait)
                 * This is a data integrity writeback, so only do the
                 * notification when we have completed the work.
                 */
-               if (args.sync_mode == WB_SYNC_ALL)
+               if (test_bit(WS_ONSTACK, &work->state))
                        wb_clear_pending(wb, work);
        }
 
@@ -978,42 +932,32 @@ int bdi_writeback_task(struct bdi_writeback *wb)
 }
 
 /*
- * Schedule writeback for all backing devices. This does WB_SYNC_NONE
- * writeback, for integrity writeback see bdi_sync_writeback().
+ * Start writeback of `nr_pages' pages.  If `nr_pages' is zero, write back
+ * the whole world.
  */
-static void bdi_writeback_all(struct super_block *sb, long nr_pages)
+void wakeup_flusher_threads(long nr_pages)
 {
+       struct backing_dev_info *bdi;
        struct wb_writeback_args args = {
-               .sb             = sb,
-               .nr_pages       = nr_pages,
                .sync_mode      = WB_SYNC_NONE,
        };
-       struct backing_dev_info *bdi;
 
-       rcu_read_lock();
+       if (nr_pages) {
+               args.nr_pages = nr_pages;
+       } else {
+               args.nr_pages = global_page_state(NR_FILE_DIRTY) +
+                               global_page_state(NR_UNSTABLE_NFS);
+       }
 
+       rcu_read_lock();
        list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {
                if (!bdi_has_dirty_io(bdi))
                        continue;
-
                bdi_alloc_queue_work(bdi, &args);
        }
-
        rcu_read_unlock();
 }
 
-/*
- * Start writeback of `nr_pages' pages.  If `nr_pages' is zero, write back
- * the whole world.
- */
-void wakeup_flusher_threads(long nr_pages)
-{
-       if (nr_pages == 0)
-               nr_pages = global_page_state(NR_FILE_DIRTY) +
-                               global_page_state(NR_UNSTABLE_NFS);
-       bdi_writeback_all(NULL, nr_pages);
-}
-
 static noinline void block_dump___mark_inode_dirty(struct inode *inode)
 {
        if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) {
@@ -1218,12 +1162,17 @@ void writeback_inodes_sb(struct super_block *sb)
 {
        unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY);
        unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS);
-       long nr_to_write;
+       struct wb_writeback_args args = {
+               .sb             = sb,
+               .sync_mode      = WB_SYNC_NONE,
+       };
+
+       WARN_ON(!rwsem_is_locked(&sb->s_umount));
 
-       nr_to_write = nr_dirty + nr_unstable +
+       args.nr_pages = nr_dirty + nr_unstable +
                        (inodes_stat.nr_inodes - inodes_stat.nr_unused);
 
-       bdi_start_writeback(sb->s_bdi, sb, nr_to_write);
+       bdi_queue_work_onstack(&args);
 }
 EXPORT_SYMBOL(writeback_inodes_sb);
 
@@ -1237,7 +1186,9 @@ EXPORT_SYMBOL(writeback_inodes_sb);
 int writeback_inodes_sb_if_idle(struct super_block *sb)
 {
        if (!writeback_in_progress(sb->s_bdi)) {
+               down_read(&sb->s_umount);
                writeback_inodes_sb(sb);
+               up_read(&sb->s_umount);
                return 1;
        } else
                return 0;
@@ -1253,7 +1204,16 @@ EXPORT_SYMBOL(writeback_inodes_sb_if_idle);
  */
 void sync_inodes_sb(struct super_block *sb)
 {
-       bdi_sync_writeback(sb->s_bdi, sb);
+       struct wb_writeback_args args = {
+               .sb             = sb,
+               .sync_mode      = WB_SYNC_ALL,
+               .nr_pages       = LONG_MAX,
+               .range_cyclic   = 0,
+       };
+
+       WARN_ON(!rwsem_is_locked(&sb->s_umount));
+
+       bdi_queue_work_onstack(&args);
        wait_sb_inodes(sb);
 }
 EXPORT_SYMBOL(sync_inodes_sb);
index 40650021fc24f633deb020ec10b26492315c27f9..d8b6e4259b80022cb824326f4ce2c665089b5818 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <linux/fs.h>
 #include <linux/types.h>
-#include <linux/slab.h>
 #include <linux/highmem.h>
 #include <linux/bitops.h>
 #include <linux/list.h>
index 46d4b5d72bd33d2e01b9c5e731e8842e616f70f9..cb6306e638435e27a3d883dd84e7fe172029b87f 100644 (file)
@@ -122,11 +122,20 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
        return size;
 }
 
+static void pad_len_spaces(struct seq_file *m, int len)
+{
+       len = 25 + sizeof(void*) * 6 - len;
+       if (len < 1)
+               len = 1;
+       seq_printf(m, "%*c", len, ' ');
+}
+
 /*
  * display a single VMA to a sequenced file
  */
 static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
 {
+       struct mm_struct *mm = vma->vm_mm;
        unsigned long ino = 0;
        struct file *file;
        dev_t dev = 0;
@@ -155,11 +164,14 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
                   MAJOR(dev), MINOR(dev), ino, &len);
 
        if (file) {
-               len = 25 + sizeof(void *) * 6 - len;
-               if (len < 1)
-                       len = 1;
-               seq_printf(m, "%*c", len, ' ');
+               pad_len_spaces(m, len);
                seq_path(m, &file->f_path, "");
+       } else if (mm) {
+               if (vma->vm_start <= mm->start_stack &&
+                       vma->vm_end >= mm->start_stack) {
+                       pad_len_spaces(m, len);
+                       seq_puts(m, "[stack]");
+               }
        }
 
        seq_putc(m, '\n');
index 5c35bc7a499e19c97b0f8eba3a91a8224a46ffe4..938119ab8dcbc28f3f9853bc0808d6d70cd51d55 100644 (file)
@@ -374,6 +374,8 @@ void sync_supers(void)
                        up_read(&sb->s_umount);
 
                        spin_lock(&sb_lock);
+                       /* lock was dropped, must reset next */
+                       list_safe_reset_next(sb, n, s_list);
                        __put_super(sb);
                }
        }
@@ -405,6 +407,8 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
                up_read(&sb->s_umount);
 
                spin_lock(&sb_lock);
+               /* lock was dropped, must reset next */
+               list_safe_reset_next(sb, n, s_list);
                __put_super(sb);
        }
        spin_unlock(&sb_lock);
@@ -585,6 +589,8 @@ static void do_emergency_remount(struct work_struct *work)
                }
                up_write(&sb->s_umount);
                spin_lock(&sb_lock);
+               /* lock was dropped, must reset next */
+               list_safe_reset_next(sb, n, s_list);
                __put_super(sb);
        }
        spin_unlock(&sb_lock);
index bbd69bdb0fa8cc9ccba41fec291fa13af43f796f..fcc498ec9b337afdcb96582fce07734c9a3cb46d 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/buffer_head.h>
+#include <linux/writeback.h>
 #include "sysv.h"
 
 /* We don't trust the value of
@@ -139,6 +140,9 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
        struct inode *inode;
        sysv_ino_t ino;
        unsigned count;
+       struct writeback_control wbc = {
+               .sync_mode = WB_SYNC_NONE
+       };
 
        inode = new_inode(sb);
        if (!inode)
@@ -168,7 +172,7 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
        insert_inode_hash(inode);
        mark_inode_dirty(inode);
 
-       sysv_write_inode(inode, 0);     /* ensure inode not allocated again */
+       sysv_write_inode(inode, &wbc);  /* ensure inode not allocated again */
        mark_inode_dirty(inode);        /* cleared by sysv_write_inode() */
        /* That's it. */
        unlock_super(sb);
index 076ca50e99336fad10e256ddc3d103ae93fd527a..c8ff0d1ae5d3e04f7f14d8a8b63df33a87b16a35 100644 (file)
@@ -62,7 +62,9 @@
  */
 static void shrink_liability(struct ubifs_info *c, int nr_to_write)
 {
+       down_read(&c->vfs_sb->s_umount);
        writeback_inodes_sb(c->vfs_sb);
+       up_read(&c->vfs_sb->s_umount);
 }
 
 /**
index aee5f6ce166e9cc1f186e5e76cab77bb536edfd5..9ae2889096b695cbeb7dfbc086ed4bb7484c1c40 100644 (file)
@@ -105,8 +105,8 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
 int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
 void bdi_unregister(struct backing_dev_info *bdi);
 int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
-void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb,
-                               long nr_pages);
+void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
+void bdi_start_background_writeback(struct backing_dev_info *bdi);
 int bdi_writeback_task(struct bdi_writeback *wb);
 int bdi_has_dirty_io(struct backing_dev_info *bdi);
 void bdi_arm_supers_timer(void);
index 0c621604baa1d7ff8185029d4eaade8ccad82d64..e3d00fdb858dc3cbf7e35b7d75a93b9c4b7321f3 100644 (file)
@@ -525,13 +525,21 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
        return cgrp->subsys[subsys_id];
 }
 
-static inline struct cgroup_subsys_state *task_subsys_state(
-       struct task_struct *task, int subsys_id)
+/*
+ * function to get the cgroup_subsys_state which allows for extra
+ * rcu_dereference_check() conditions, such as locks used during the
+ * cgroup_subsys::attach() methods.
+ */
+#define task_subsys_state_check(task, subsys_id, __c)                  \
+       rcu_dereference_check(task->cgroups->subsys[subsys_id],         \
+                             rcu_read_lock_held() ||                   \
+                             lockdep_is_held(&task->alloc_lock) ||     \
+                             cgroup_lock_is_held() || (__c))
+
+static inline struct cgroup_subsys_state *
+task_subsys_state(struct task_struct *task, int subsys_id)
 {
-       return rcu_dereference_check(task->cgroups->subsys[subsys_id],
-                                    rcu_read_lock_held() ||
-                                    lockdep_is_held(&task->alloc_lock) ||
-                                    cgroup_lock_is_held());
+       return task_subsys_state_check(task, subsys_id, false);
 }
 
 static inline struct cgroup* task_cgroup(struct task_struct *task,
index 73dcf804bc940e6738f5f0f553f3cf2045f78fd7..0da5b187f1245e8c33fd659420f5e4dca82b9ead 100644 (file)
  * naked functions because then mcount is called without stack and frame pointer
  * being set up and there is no chance to restore the lr register to the value
  * before mcount was called.
+ *
+ * The asm() bodies of naked functions often depend on standard calling conventions,
+ * therefore they must be noinline and noclone.  GCC 4.[56] currently fail to enforce
+ * this, so we must do so ourselves.  See GCC PR44290.
  */
-#define __naked                                __attribute__((naked)) notrace
+#define __naked                                __attribute__((naked)) noinline __noclone notrace
 
 #define __noreturn                     __attribute__((noreturn))
 
@@ -85,3 +89,7 @@
 #define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
 #define gcc_header(x) _gcc_header(x)
 #include gcc_header(__GNUC__)
+
+#if !defined(__noclone)
+#define __noclone      /* not needed */
+#endif
index 94dea3ffbfa19576e2cd8bb59b56658465101b49..fcfa5b9a4317af2b272d06073d7af51019ebf321 100644 (file)
  * unreleased.  Really, we need to have autoconf for the kernel.
  */
 #define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone      __attribute__((__noclone__))
+
 #endif
 
 #endif
index 30da4ae489724197a220a83a6e39d1cba0a264c4..b8d2516668aa067d43d7c6c6e5301f3688469658 100644 (file)
@@ -53,7 +53,7 @@
 
 
 extern const char *drbd_buildtag(void);
-#define REL_VERSION "8.3.8rc2"
+#define REL_VERSION "8.3.8"
 #define API_VERSION 88
 #define PRO_VERSION_MIN 86
 #define PRO_VERSION_MAX 94
index 8392884a2977cda6a5f004fed2511ad51a140aa5..5d57a3a1fa1b1b9143a5e80381ac7668b51bb677 100644 (file)
@@ -544,6 +544,21 @@ static inline void list_splice_tail_init(struct list_head *list,
             &pos->member != (head);                                    \
             pos = n, n = list_entry(n->member.prev, typeof(*n), member))
 
+/**
+ * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
+ * @pos:       the loop cursor used in the list_for_each_entry_safe loop
+ * @n:         temporary storage used in list_for_each_entry_safe
+ * @member:    the name of the list_struct within the struct.
+ *
+ * list_safe_reset_next is not safe to use in general if the list may be
+ * modified concurrently (eg. the lock is dropped in the loop body). An
+ * exception to this is if the cursor element (pos) is pinned in the list,
+ * and list_safe_reset_next is called after re-taking the lock and before
+ * completing the current iteration of the loop body.
+ */
+#define list_safe_reset_next(pos, n, member)                           \
+       n = list_entry(pos->member.next, typeof(*pos), member)
+
 /*
  * Double linked lists with a single pointer list head.
  * Mostly useful for hash tables where the two pointer list head is
index 9a59d1f98cd4114948129d8e9ad95b77da27ec6d..103d1b61aacba635bb7c81cef9e32b70fe220bb7 100644 (file)
@@ -14,6 +14,7 @@
  * See the file COPYING for more details.
  */
 
+#include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/rcupdate.h>
 
index e7a35f1039e785464b318d3713557e9d2db6a591..6a3a5fa1526d87d16b362e20d7d62e6809285c18 100644 (file)
@@ -429,20 +429,11 @@ static void free_pi_state(struct futex_pi_state *pi_state)
 static struct task_struct * futex_find_get_task(pid_t pid)
 {
        struct task_struct *p;
-       const struct cred *cred = current_cred(), *pcred;
 
        rcu_read_lock();
        p = find_task_by_vpid(pid);
-       if (!p) {
-               p = ERR_PTR(-ESRCH);
-       } else {
-               pcred = __task_cred(p);
-               if (cred->euid != pcred->euid &&
-                   cred->euid != pcred->uid)
-                       p = ERR_PTR(-ESRCH);
-               else
-                       get_task_struct(p);
-       }
+       if (p)
+               get_task_struct(p);
 
        rcu_read_unlock();
 
@@ -564,8 +555,8 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
        if (!pid)
                return -ESRCH;
        p = futex_find_get_task(pid);
-       if (IS_ERR(p))
-               return PTR_ERR(p);
+       if (!p)
+               return -ESRCH;
 
        /*
         * We need to look at the task state flags to figure out,
index 3164ba7ce151cf6c228613ddce2195450af30012..e1497481fe8a6feab3554173fb313ebbef59bb39 100644 (file)
@@ -456,6 +456,9 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
                /* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
                desc->status &= ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK);
                desc->status |= flags;
+
+               if (chip != desc->chip)
+                       irq_chip_set_defaults(desc->chip);
        }
 
        return ret;
index 474a84715eaca2936b51ad5a6c46fb4774751c5b..131b1703936f6dbe71cf84c2ff572efef6c47e70 100644 (file)
@@ -1089,9 +1089,10 @@ void crash_kexec(struct pt_regs *regs)
 
 size_t crash_get_memory_size(void)
 {
-       size_t size;
+       size_t size = 0;
        mutex_lock(&kexec_mutex);
-       size = crashk_res.end - crashk_res.start + 1;
+       if (crashk_res.end != crashk_res.start)
+               size = crashk_res.end - crashk_res.start + 1;
        mutex_unlock(&kexec_mutex);
        return size;
 }
@@ -1134,7 +1135,7 @@ int crash_shrink_memory(unsigned long new_size)
 
        free_reserved_phys_range(end, crashk_res.end);
 
-       if (start == end)
+       if ((start == end) && (crashk_res.parent != NULL))
                release_resource(&crashk_res);
        crashk_res.end = end - 1;
 
index f8b8996228dd7d8de9ee49a845a193921f1b8a5d..cb816e36cc8bb499f8d8645084b47efcb67c8014 100644 (file)
@@ -306,52 +306,6 @@ static int init_task_group_load = INIT_TASK_GROUP_LOAD;
  */
 struct task_group init_task_group;
 
-/* return group to which a task belongs */
-static inline struct task_group *task_group(struct task_struct *p)
-{
-       struct task_group *tg;
-
-#ifdef CONFIG_CGROUP_SCHED
-       tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
-                               struct task_group, css);
-#else
-       tg = &init_task_group;
-#endif
-       return tg;
-}
-
-/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
-static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
-{
-       /*
-        * Strictly speaking this rcu_read_lock() is not needed since the
-        * task_group is tied to the cgroup, which in turn can never go away
-        * as long as there are tasks attached to it.
-        *
-        * However since task_group() uses task_subsys_state() which is an
-        * rcu_dereference() user, this quiets CONFIG_PROVE_RCU.
-        */
-       rcu_read_lock();
-#ifdef CONFIG_FAIR_GROUP_SCHED
-       p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
-       p->se.parent = task_group(p)->se[cpu];
-#endif
-
-#ifdef CONFIG_RT_GROUP_SCHED
-       p->rt.rt_rq  = task_group(p)->rt_rq[cpu];
-       p->rt.parent = task_group(p)->rt_se[cpu];
-#endif
-       rcu_read_unlock();
-}
-
-#else
-
-static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
-static inline struct task_group *task_group(struct task_struct *p)
-{
-       return NULL;
-}
-
 #endif /* CONFIG_CGROUP_SCHED */
 
 /* CFS-related fields in a runqueue */
@@ -644,6 +598,49 @@ static inline int cpu_of(struct rq *rq)
 #define cpu_curr(cpu)          (cpu_rq(cpu)->curr)
 #define raw_rq()               (&__raw_get_cpu_var(runqueues))
 
+#ifdef CONFIG_CGROUP_SCHED
+
+/*
+ * Return the group to which this tasks belongs.
+ *
+ * We use task_subsys_state_check() and extend the RCU verification
+ * with lockdep_is_held(&task_rq(p)->lock) because cpu_cgroup_attach()
+ * holds that lock for each task it moves into the cgroup. Therefore
+ * by holding that lock, we pin the task to the current cgroup.
+ */
+static inline struct task_group *task_group(struct task_struct *p)
+{
+       struct cgroup_subsys_state *css;
+
+       css = task_subsys_state_check(p, cpu_cgroup_subsys_id,
+                       lockdep_is_held(&task_rq(p)->lock));
+       return container_of(css, struct task_group, css);
+}
+
+/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
+static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
+{
+#ifdef CONFIG_FAIR_GROUP_SCHED
+       p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
+       p->se.parent = task_group(p)->se[cpu];
+#endif
+
+#ifdef CONFIG_RT_GROUP_SCHED
+       p->rt.rt_rq  = task_group(p)->rt_rq[cpu];
+       p->rt.parent = task_group(p)->rt_se[cpu];
+#endif
+}
+
+#else /* CONFIG_CGROUP_SCHED */
+
+static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
+static inline struct task_group *task_group(struct task_struct *p)
+{
+       return NULL;
+}
+
+#endif /* CONFIG_CGROUP_SCHED */
+
 inline void update_rq_clock(struct rq *rq)
 {
        if (!rq->skip_clock_update)
@@ -1257,6 +1254,12 @@ static void sched_avg_update(struct rq *rq)
        s64 period = sched_avg_period();
 
        while ((s64)(rq->clock - rq->age_stamp) > period) {
+               /*
+                * Inline assembly required to prevent the compiler
+                * optimising this loop into a divmod call.
+                * See __iter_div_u64_rem() for another example of this.
+                */
+               asm("" : "+rm" (rq->age_stamp));
                rq->age_stamp += period;
                rq->rt_avg /= 2;
        }
@@ -1660,9 +1663,6 @@ static void update_shares(struct sched_domain *sd)
 
 static void update_h_load(long cpu)
 {
-       if (root_task_group_empty())
-               return;
-
        walk_tg_tree(tg_load_down, tg_nop, (void *)cpu);
 }
 
@@ -2494,7 +2494,16 @@ void sched_fork(struct task_struct *p, int clone_flags)
        if (p->sched_class->task_fork)
                p->sched_class->task_fork(p);
 
+       /*
+        * The child is not yet in the pid-hash so no cgroup attach races,
+        * and the cgroup is pinned to this child due to cgroup_fork()
+        * is ran before sched_fork().
+        *
+        * Silence PROVE_RCU.
+        */
+       rcu_read_lock();
        set_task_cpu(p, cpu);
+       rcu_read_unlock();
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
        if (likely(sched_info_on()))
@@ -4465,16 +4474,6 @@ recheck:
        }
 
        if (user) {
-#ifdef CONFIG_RT_GROUP_SCHED
-               /*
-                * Do not allow realtime tasks into groups that have no runtime
-                * assigned.
-                */
-               if (rt_bandwidth_enabled() && rt_policy(policy) &&
-                               task_group(p)->rt_bandwidth.rt_runtime == 0)
-                       return -EPERM;
-#endif
-
                retval = security_task_setscheduler(p, policy, param);
                if (retval)
                        return retval;
@@ -4490,6 +4489,22 @@ recheck:
         * runqueue lock must be held.
         */
        rq = __task_rq_lock(p);
+
+#ifdef CONFIG_RT_GROUP_SCHED
+       if (user) {
+               /*
+                * Do not allow realtime tasks into groups that have no runtime
+                * assigned.
+                */
+               if (rt_bandwidth_enabled() && rt_policy(policy) &&
+                               task_group(p)->rt_bandwidth.rt_runtime == 0) {
+                       __task_rq_unlock(rq);
+                       raw_spin_unlock_irqrestore(&p->pi_lock, flags);
+                       return -EPERM;
+               }
+       }
+#endif
+
        /* recheck policy now with rq lock held */
        if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
                policy = oldpolicy = -1;
index eed35eded6029c82d126ea24bbdfa2a5731ad8a9..a878b5332daad5d7db16625f298a4e963edac909 100644 (file)
@@ -1240,6 +1240,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
         * effect of the currently running task from the load
         * of the current CPU:
         */
+       rcu_read_lock();
        if (sync) {
                tg = task_group(current);
                weight = current->se.load.weight;
@@ -1275,6 +1276,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
                balanced = this_eff_load <= prev_eff_load;
        } else
                balanced = true;
+       rcu_read_unlock();
 
        /*
         * If the currently running task will sleep within
index 1d7b9bc1c0340e8deccbc5df1418fd71889d837d..783fbadf22029561bdee188968ab83d1023b6fa6 100644 (file)
@@ -315,9 +315,6 @@ void tick_nohz_stop_sched_tick(int inidle)
                goto end;
        }
 
-       if (nohz_ratelimit(cpu))
-               goto end;
-
        ts->idle_calls++;
        /* Read jiffies and the time when jiffies were updated last */
        do {
@@ -328,7 +325,7 @@ void tick_nohz_stop_sched_tick(int inidle)
        } while (read_seqretry(&xtime_lock, seq));
 
        if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
-           arch_needs_cpu(cpu)) {
+           arch_needs_cpu(cpu) || nohz_ratelimit(cpu)) {
                next_jiffies = last_jiffies + 1;
                delta_jiffies = 1;
        } else {
index e6f65887842c9a91649550daee07c593c818f9b5..8a2b73f7c0683358541272bd58ea32625f83aa65 100644 (file)
@@ -96,7 +96,9 @@ int perf_trace_init(struct perf_event *p_event)
        mutex_lock(&event_mutex);
        list_for_each_entry(tp_event, &ftrace_events, list) {
                if (tp_event->event.type == event_id &&
-                   tp_event->class && tp_event->class->perf_probe &&
+                   tp_event->class &&
+                   (tp_event->class->perf_probe ||
+                    tp_event->class->reg) &&
                    try_module_get(tp_event->mod)) {
                        ret = perf_trace_event_init(tp_event, p_event);
                        break;
index 736c3b06398e522a7ad3d0ee846d77163436a334..1923f1490e72618b36756b326bbd2e280d71bd49 100644 (file)
@@ -128,7 +128,6 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
                chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
 
                end_bit = (chunk->end_addr - chunk->start_addr) >> order;
-               end_bit -= nbits + 1;
 
                spin_lock_irqsave(&chunk->lock, flags);
                start_bit = bitmap_find_next_zero_area(chunk->bits, end_bit, 0,
index c1a2069017614e6f95a7c2a892fcca1c9c2a7ff1..7f1a4f0acf50e280f5505779bd90f2dda1b97960 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -602,7 +602,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
        /* find first ent */
        n = idp->layers * IDR_BITS;
        max = 1 << n;
-       p = rcu_dereference(idp->top);
+       p = rcu_dereference_raw(idp->top);
        if (!p)
                return NULL;
 
@@ -610,7 +610,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
                while (n > 0 && p) {
                        n -= IDR_BITS;
                        *paa++ = p;
-                       p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
+                       p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
                }
 
                if (p) {
index c6ece0a5759595bf1ddbbe4a95e4b76713ea4b06..20a8193a7af8ed275667e682fd22101a0e40bb93 100644 (file)
@@ -1370,7 +1370,7 @@ static void memcg_wakeup_oom(struct mem_cgroup *mem)
 
 static void memcg_oom_recover(struct mem_cgroup *mem)
 {
-       if (mem->oom_kill_disable && atomic_read(&mem->oom_lock))
+       if (atomic_read(&mem->oom_lock))
                memcg_wakeup_oom(mem);
 }
 
@@ -3781,6 +3781,8 @@ static int mem_cgroup_oom_control_write(struct cgroup *cgrp,
                return -EINVAL;
        }
        mem->oom_kill_disable = val;
+       if (!val)
+               memcg_oom_recover(mem);
        cgroup_unlock();
        return 0;
 }
index 5d6fb339de038945424733d5128846a1a1a7e352..5bc0a96beb51b550b69389998fc3e09053ee5a2f 100644 (file)
@@ -2094,7 +2094,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
                NODEMASK_SCRATCH(scratch);
 
                if (!scratch)
-                       return;
+                       goto put_mpol;
                /* contextualize the tmpfs mount point mempolicy */
                new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask);
                if (IS_ERR(new))
@@ -2103,19 +2103,20 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
                task_lock(current);
                ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch);
                task_unlock(current);
-               mpol_put(mpol); /* drop our ref on sb mpol */
                if (ret)
-                       goto put_free;
+                       goto put_new;
 
                /* Create pseudo-vma that contains just the policy */
                memset(&pvma, 0, sizeof(struct vm_area_struct));
                pvma.vm_end = TASK_SIZE;        /* policy covers entire file */
                mpol_set_shared_policy(sp, &pvma, new); /* adds ref */
 
-put_free:
+put_new:
                mpol_put(new);                  /* drop initial ref */
 free_scratch:
                NODEMASK_SCRATCH_FREE(scratch);
+put_mpol:
+               mpol_put(mpol); /* drop our incoming ref on sb mpol */
        }
 }
 
index bbd396ac9546f5b0625c34facbc0b6d33fe2163a..54f28bd493d3f6a04f437d6294d54a322daa4603 100644 (file)
@@ -597,7 +597,7 @@ static void balance_dirty_pages(struct address_space *mapping,
            (!laptop_mode && ((global_page_state(NR_FILE_DIRTY)
                               + global_page_state(NR_UNSTABLE_NFS))
                                          > background_thresh)))
-               bdi_start_writeback(bdi, NULL, 0);
+               bdi_start_background_writeback(bdi);
 }
 
 void set_page_dirty_balance(struct page *page, int page_mkwrite)
@@ -705,9 +705,8 @@ void laptop_mode_timer_fn(unsigned long data)
         * We want to write everything out, not just down to the dirty
         * threshold
         */
-
        if (bdi_has_dirty_io(&q->backing_dev_info))
-               bdi_start_writeback(&q->backing_dev_info, NULL, nr_pages);
+               bdi_start_writeback(&q->backing_dev_info, nr_pages);
 }
 
 /*
index dc3435e18bdeb18cfdcb8e2a08a21a98cc695a2d..711745f56bba32bbea9ffbb048aae3bf3ea52c5c 100644 (file)
@@ -193,7 +193,7 @@ static void sig_handler(int sig)
 
 static void sig_atexit(void)
 {
-       if (child_pid != -1)
+       if (child_pid > 0)
                kill(child_pid, SIGTERM);
 
        if (signr == -1)
index 1f08f008d289f841f7ae0089462129f97e313afc..2fbf6a463c8174e1fdf56e6714a2e402987c85f4 100644 (file)
@@ -538,8 +538,10 @@ int event__process_task(event_t *self, struct perf_session *session)
        dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid,
                    self->fork.ppid, self->fork.ptid);
 
-       if (self->header.type == PERF_RECORD_EXIT)
+       if (self->header.type == PERF_RECORD_EXIT) {
+               perf_session__remove_thread(session, thread);
                return 0;
+       }
 
        if (thread == NULL || parent == NULL ||
            thread__fork(thread, parent) < 0) {
index cf182ca132fef27e54e189cd5a49d9c0a29ab8e1..7537ca15900b121852cc19545fe45a2b266403f7 100644 (file)
@@ -43,6 +43,9 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
 
        if (self != NULL) {
                int cols;
+
+               if (use_browser <= 0)   
+                       return self;
                newtGetScreenSize(&cols, NULL);
                cols -= 4;
                newtCenteredWindow(cols, 1, title);
@@ -67,14 +70,22 @@ out_free_self:
 
 void ui_progress__update(struct ui_progress *self, u64 curr)
 {
+       /*
+        * FIXME: We should have a per UI backend way of showing progress,
+        * stdio will just show a percentage as NN%, etc.
+        */
+       if (use_browser <= 0)
+               return;
        newtScaleSet(self->scale, curr);
        newtRefresh();
 }
 
 void ui_progress__delete(struct ui_progress *self)
 {
-       newtFormDestroy(self->form);
-       newtPopWindow();
+       if (use_browser > 0) {
+               newtFormDestroy(self->form);
+               newtPopWindow();
+       }
        free(self);
 }
 
index 8f83a1835766e5d1a6e509547d14559529bbba23..c422cd6763135c10575f8621165262b48a1315a3 100644 (file)
@@ -90,6 +90,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
 
        memcpy(self->filename, filename, len);
        self->threads = RB_ROOT;
+       INIT_LIST_HEAD(&self->dead_threads);
        self->hists_tree = RB_ROOT;
        self->last_match = NULL;
        self->mmap_window = 32;
@@ -131,6 +132,16 @@ void perf_session__delete(struct perf_session *self)
        free(self);
 }
 
+void perf_session__remove_thread(struct perf_session *self, struct thread *th)
+{
+       rb_erase(&th->rb_node, &self->threads);
+       /*
+        * We may have references to this thread, for instance in some hist_entry
+        * instances, so just move them to a separate list.
+        */
+       list_add_tail(&th->node, &self->dead_threads);
+}
+
 static bool symbol__match_parent_regex(struct symbol *sym)
 {
        if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
index 55c6881b218d4ccee588877d54afb41120dba521..9fa0fc2a863f1259caf8caf7494f867d0737a297 100644 (file)
@@ -26,6 +26,7 @@ struct perf_session {
        unsigned long           size;
        unsigned long           mmap_window;
        struct rb_root          threads;
+       struct list_head        dead_threads;
        struct thread           *last_match;
        struct machine          host_machine;
        struct rb_root          machines;
@@ -99,6 +100,7 @@ int perf_session__create_kernel_maps(struct perf_session *self);
 
 int do_read(int fd, void *buf, size_t size);
 void perf_session__update_sample_type(struct perf_session *self);
+void perf_session__remove_thread(struct perf_session *self, struct thread *th);
 
 static inline
 struct machine *perf_session__find_host_machine(struct perf_session *self)
index 1dfd9ff8bdcdfc7d290c9e9f686875cd107dd4d7..ee6bbcf277cad88ea4143a8d7a6a9e21cc07a74c 100644 (file)
@@ -6,7 +6,10 @@
 #include "symbol.h"
 
 struct thread {
-       struct rb_node          rb_node;
+       union {
+               struct rb_node   rb_node;
+               struct list_head node;
+       };
        struct map_groups       mg;
        pid_t                   pid;
        char                    shortname[3];