diff --git a/[refs] b/[refs] index 58eeeb6ceb65..afd150e97a85 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f752a091abd1f9d38f926823bfd5c8480dd1132b +refs/heads/master: 093f13e23137b9e5f7629dd5932ceea1419e2b61 diff --git a/trunk/Documentation/ABI/testing/sysfs-firmware-acpi b/trunk/Documentation/ABI/testing/sysfs-firmware-acpi index 4f9ba3c2fca7..e8ffc70ffe12 100644 --- a/trunk/Documentation/ABI/testing/sysfs-firmware-acpi +++ b/trunk/Documentation/ABI/testing/sysfs-firmware-acpi @@ -69,13 +69,9 @@ Description: gpe1F: 0 invalid gpe_all: 1192 sci: 1194 - sci_not: 0 - sci - The number of times the ACPI SCI - has been called and claimed an interrupt. - - sci_not - The number of times the ACPI SCI - has been called and NOT claimed an interrupt. + sci - The total number of times the ACPI SCI + has claimed an interrupt. gpe_all - count of SCI caused by GPEs. diff --git a/trunk/Documentation/filesystems/vfs.txt b/trunk/Documentation/filesystems/vfs.txt index f49eecf2e573..deeeed0faa8f 100644 --- a/trunk/Documentation/filesystems/vfs.txt +++ b/trunk/Documentation/filesystems/vfs.txt @@ -277,7 +277,8 @@ or bottom half). unfreeze_fs: called when VFS is unlocking a filesystem and making it writable again. - statfs: called when the VFS needs to get filesystem statistics. + statfs: called when the VFS needs to get filesystem statistics. This + is called with the kernel lock held remount_fs: called when the filesystem is remounted. This is called with the kernel lock held diff --git a/trunk/Documentation/laptops/thinkpad-acpi.txt b/trunk/Documentation/laptops/thinkpad-acpi.txt index e7e9a69069e1..3d7650768bb5 100644 --- a/trunk/Documentation/laptops/thinkpad-acpi.txt +++ b/trunk/Documentation/laptops/thinkpad-acpi.txt @@ -1,7 +1,7 @@ ThinkPad ACPI Extras Driver - Version 0.23 - April 10th, 2009 + Version 0.22 + November 23rd, 2008 Borislav Deianov Henrique de Moraes Holschuh diff --git a/trunk/Documentation/spi/spi-summary b/trunk/Documentation/spi/spi-summary index 4a02d2508bc8..0f5122eb282b 100644 --- a/trunk/Documentation/spi/spi-summary +++ b/trunk/Documentation/spi/spi-summary @@ -511,16 +511,10 @@ SPI MASTER METHODS This sets up the device clock rate, SPI mode, and word sizes. Drivers may change the defaults provided by board_info, and then call spi_setup(spi) to invoke this routine. It may sleep. - Unless each SPI slave has its own configuration registers, don't change them right away ... otherwise drivers could corrupt I/O that's in progress for other SPI devices. - ** BUG ALERT: for some reason the first version of - ** many spi_master drivers seems to get this wrong. - ** When you code setup(), ASSUME that the controller - ** is actively processing transfers for another device. - master->transfer(struct spi_device *spi, struct spi_message *message) This must not sleep. Its responsibility is arrange that the transfer happens and its complete() callback is issued. The two diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index cb9571042f21..1e067a675e53 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1287,14 +1287,6 @@ S: Maintained F: Documentation/video4linux/bttv/ F: drivers/media/video/bt8xx/bttv* -CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS -P: David Howells -M: dhowells@redhat.com -L: linux-cachefs@redhat.com -S: Supported -F: Documentation/filesystems/caching/cachefiles.txt -F: fs/cachefiles/ - CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER P: Jonathan Corbet M: corbet@lwn.net @@ -2065,8 +2057,6 @@ F: drivers/infiniband/hw/ehca/ EMBEDDED LINUX P: Paul Gortmaker M: paul.gortmaker@windriver.com -P: Matt Mackall -M: mpm@selenic.com P: David Woodhouse M: dwmw2@infradead.org L: linux-embedded@vger.kernel.org @@ -2335,15 +2325,6 @@ F: Documentation/power/freezing-of-tasks.txt F: include/linux/freezer.h F: kernel/freezer.c -FS-CACHE: LOCAL CACHING FOR NETWORK FILESYSTEMS -P: David Howells -M: dhowells@redhat.com -L: linux-cachefs@redhat.com -S: Supported -F: Documentation/filesystems/caching/ -F: fs/fscache/ -F: include/linux/fscache*.h - FTRACE P: Steven Rostedt M: rostedt@goodmis.org @@ -2564,6 +2545,7 @@ F: kernel/power/ F: include/linux/suspend.h F: include/linux/freezer.h F: include/linux/pm.h +F: include/asm-*/suspend*.h F: arch/*/include/asm/suspend*.h HID CORE LAYER @@ -3341,7 +3323,7 @@ P: Eduard - Gabriel Munteanu M: eduard.munteanu@linux360.ro L: linux-kernel@vger.kernel.org S: Maintained -F: Documentation/trace/kmemtrace.txt +F: Documentation/vm/kmemtrace.txt F: include/trace/kmemtrace.h F: kernel/trace/kmemtrace.c @@ -5405,6 +5387,7 @@ F: kernel/power/ F: include/linux/suspend.h F: include/linux/freezer.h F: include/linux/pm.h +F: include/asm-*/suspend.h SVGA HANDLING P: Martin Mares @@ -5638,7 +5621,7 @@ L: uclinux-dev@uclinux.org (subscribers-only) S: Maintained F: arch/m68knommu/ -UCLINUX FOR RENESAS H8/300 (H8300) +UCLINUX FOR RENESAS H8/300 P: Yoshinori Sato M: ysato@users.sourceforge.jp W: http://uclinux-h8.sourceforge.jp/ diff --git a/trunk/Makefile b/trunk/Makefile index 9e5dc8f0ef47..6f4208ff2d10 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 30 -EXTRAVERSION = -rc3 +EXTRAVERSION = -rc2 NAME = Temporary Tasmanian Devil # *DOCUMENTATION* diff --git a/trunk/arch/alpha/include/asm/percpu.h b/trunk/arch/alpha/include/asm/percpu.h index e9e0bb5a23bf..3495e8e00d70 100644 --- a/trunk/arch/alpha/include/asm/percpu.h +++ b/trunk/arch/alpha/include/asm/percpu.h @@ -73,6 +73,6 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; #endif /* SMP */ -#include +#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name) #endif /* __ALPHA_PERCPU_H */ diff --git a/trunk/arch/arm/kernel/sys_oabi-compat.c b/trunk/arch/arm/kernel/sys_oabi-compat.c index d59a0cd537f0..e04173c7e621 100644 --- a/trunk/arch/arm/kernel/sys_oabi-compat.c +++ b/trunk/arch/arm/kernel/sys_oabi-compat.c @@ -177,12 +177,21 @@ asmlinkage long sys_oabi_fstatat64(int dfd, int flag) { struct kstat stat; - int error; + int error = -EINVAL; - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_oldabi_stat64(&stat, statbuf); + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; + + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); + + if (!error) + error = cp_oldabi_stat64(&stat, statbuf); + +out: + return error; } struct oabi_flock64 { diff --git a/trunk/arch/arm/mach-at91/at91rm9200_time.c b/trunk/arch/arm/mach-at91/at91rm9200_time.c index 309f3511aa20..1ff1bda0a894 100644 --- a/trunk/arch/arm/mach-at91/at91rm9200_time.c +++ b/trunk/arch/arm/mach-at91/at91rm9200_time.c @@ -85,7 +85,7 @@ static struct irqaction at91rm9200_timer_irq = { .handler = at91rm9200_timer_interrupt }; -static cycle_t read_clk32k(struct clocksource *cs) +static cycle_t read_clk32k(void) { return read_CRTR(); } diff --git a/trunk/arch/arm/mach-at91/at91sam926x_time.c b/trunk/arch/arm/mach-at91/at91sam926x_time.c index 4bd56aee4370..b63e1d5f1bad 100644 --- a/trunk/arch/arm/mach-at91/at91sam926x_time.c +++ b/trunk/arch/arm/mach-at91/at91sam926x_time.c @@ -31,7 +31,7 @@ static u32 pit_cnt; /* access only w/system irq blocked */ * Clocksource: just a monotonic counter of MCK/16 cycles. * We don't care whether or not PIT irqs are enabled. */ -static cycle_t read_pit_clk(struct clocksource *cs) +static cycle_t read_pit_clk(void) { unsigned long flags; u32 elapsed; diff --git a/trunk/arch/arm/mach-davinci/time.c b/trunk/arch/arm/mach-davinci/time.c index 6c227d4ba998..f8bcd29d17a6 100644 --- a/trunk/arch/arm/mach-davinci/time.c +++ b/trunk/arch/arm/mach-davinci/time.c @@ -238,7 +238,7 @@ static void __init timer_init(void) /* * clocksource */ -static cycle_t read_cycles(struct clocksource *cs) +static cycle_t read_cycles(void) { struct timer_s *t = &timers[TID_CLOCKSOURCE]; diff --git a/trunk/arch/arm/mach-imx/time.c b/trunk/arch/arm/mach-imx/time.c index 5aef18b599e5..aff0ebcfa847 100644 --- a/trunk/arch/arm/mach-imx/time.c +++ b/trunk/arch/arm/mach-imx/time.c @@ -73,7 +73,7 @@ static void __init imx_timer_hardware_init(void) IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN; } -cycle_t imx_get_cycles(struct clocksource *cs) +cycle_t imx_get_cycles(void) { return IMX_TCN(TIMER_BASE); } diff --git a/trunk/arch/arm/mach-ixp4xx/common.c b/trunk/arch/arm/mach-ixp4xx/common.c index 1e93dfee7543..f4656d2ac8a8 100644 --- a/trunk/arch/arm/mach-ixp4xx/common.c +++ b/trunk/arch/arm/mach-ixp4xx/common.c @@ -401,7 +401,7 @@ void __init ixp4xx_sys_init(void) /* * clocksource */ -cycle_t ixp4xx_get_cycles(struct clocksource *cs) +cycle_t ixp4xx_get_cycles(void) { return *IXP4XX_OSTS; } diff --git a/trunk/arch/arm/mach-msm/timer.c b/trunk/arch/arm/mach-msm/timer.c index 4855b8ca5101..444d9c0f5ca6 100644 --- a/trunk/arch/arm/mach-msm/timer.c +++ b/trunk/arch/arm/mach-msm/timer.c @@ -57,12 +57,12 @@ static irqreturn_t msm_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static cycle_t msm_gpt_read(struct clocksource *cs) +static cycle_t msm_gpt_read(void) { return readl(MSM_GPT_BASE + TIMER_COUNT_VAL); } -static cycle_t msm_dgt_read(struct clocksource *cs) +static cycle_t msm_dgt_read(void) { return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT; } diff --git a/trunk/arch/arm/mach-netx/time.c b/trunk/arch/arm/mach-netx/time.c index 82801dbf0579..f201fddb594f 100644 --- a/trunk/arch/arm/mach-netx/time.c +++ b/trunk/arch/arm/mach-netx/time.c @@ -104,7 +104,7 @@ static struct irqaction netx_timer_irq = { .handler = netx_timer_interrupt, }; -cycle_t netx_get_cycles(struct clocksource *cs) +cycle_t netx_get_cycles(void) { return readl(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE)); } diff --git a/trunk/arch/arm/mach-ns9xxx/time-ns9360.c b/trunk/arch/arm/mach-ns9xxx/time-ns9360.c index 77281260358a..41df69721769 100644 --- a/trunk/arch/arm/mach-ns9xxx/time-ns9360.c +++ b/trunk/arch/arm/mach-ns9xxx/time-ns9360.c @@ -25,7 +25,7 @@ #define TIMER_CLOCKEVENT 1 static u32 latch; -static cycle_t ns9360_clocksource_read(struct clocksource *cs) +static cycle_t ns9360_clocksource_read(void) { return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); } diff --git a/trunk/arch/arm/mach-omap1/time.c b/trunk/arch/arm/mach-omap1/time.c index 4d56408d3cff..495a32c287b4 100644 --- a/trunk/arch/arm/mach-omap1/time.c +++ b/trunk/arch/arm/mach-omap1/time.c @@ -198,7 +198,7 @@ static struct irqaction omap_mpu_timer2_irq = { .handler = omap_mpu_timer2_interrupt, }; -static cycle_t mpu_read(struct clocksource *cs) +static cycle_t mpu_read(void) { return ~omap_mpu_timer_read(1); } diff --git a/trunk/arch/arm/mach-omap2/timer-gp.c b/trunk/arch/arm/mach-omap2/timer-gp.c index 1cb2c0909c2b..9fc13a2cc3f4 100644 --- a/trunk/arch/arm/mach-omap2/timer-gp.c +++ b/trunk/arch/arm/mach-omap2/timer-gp.c @@ -138,7 +138,7 @@ static inline void __init omap2_gp_clocksource_init(void) {} * clocksource */ static struct omap_dm_timer *gpt_clocksource; -static cycle_t clocksource_read_cycles(struct clocksource *cs) +static cycle_t clocksource_read_cycles(void) { return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource); } diff --git a/trunk/arch/arm/mach-pxa/time.c b/trunk/arch/arm/mach-pxa/time.c index 750c448db672..8eb3830fbb0b 100644 --- a/trunk/arch/arm/mach-pxa/time.c +++ b/trunk/arch/arm/mach-pxa/time.c @@ -125,7 +125,7 @@ static struct clock_event_device ckevt_pxa_osmr0 = { .set_mode = pxa_osmr0_set_mode, }; -static cycle_t pxa_read_oscr(struct clocksource *cs) +static cycle_t pxa_read_oscr(void) { return OSCR; } diff --git a/trunk/arch/arm/mach-realview/core.c b/trunk/arch/arm/mach-realview/core.c index 942e1a7eb9b2..9ab947c14f26 100644 --- a/trunk/arch/arm/mach-realview/core.c +++ b/trunk/arch/arm/mach-realview/core.c @@ -715,7 +715,7 @@ static struct irqaction realview_timer_irq = { .handler = realview_timer_interrupt, }; -static cycle_t realview_get_cycles(struct clocksource *cs) +static cycle_t realview_get_cycles(void) { return ~readl(timer3_va_base + TIMER_VALUE); } diff --git a/trunk/arch/arm/mach-versatile/core.c b/trunk/arch/arm/mach-versatile/core.c index 1f929c391af7..565776680d8c 100644 --- a/trunk/arch/arm/mach-versatile/core.c +++ b/trunk/arch/arm/mach-versatile/core.c @@ -948,7 +948,7 @@ static struct irqaction versatile_timer_irq = { .handler = versatile_timer_interrupt, }; -static cycle_t versatile_get_cycles(struct clocksource *cs) +static cycle_t versatile_get_cycles(void) { return ~readl(TIMER3_VA_BASE + TIMER_VALUE); } diff --git a/trunk/arch/arm/plat-mxc/time.c b/trunk/arch/arm/plat-mxc/time.c index dab3357196fb..ef1b3cd85bd3 100644 --- a/trunk/arch/arm/plat-mxc/time.c +++ b/trunk/arch/arm/plat-mxc/time.c @@ -36,7 +36,7 @@ static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; /* clock source */ -static cycle_t mxc_get_cycles(struct clocksource *cs) +static cycle_t mxc_get_cycles(void) { return __raw_readl(TIMER_BASE + MXC_TCN); } diff --git a/trunk/arch/arm/plat-omap/common.c b/trunk/arch/arm/plat-omap/common.c index 433021f3d7cc..d1797147732f 100644 --- a/trunk/arch/arm/plat-omap/common.c +++ b/trunk/arch/arm/plat-omap/common.c @@ -185,7 +185,7 @@ console_initcall(omap_add_serial_console); #include -static cycle_t omap_32k_read(struct clocksource *cs) +static cycle_t omap_32k_read(void) { return omap_readl(TIMER_32K_SYNCHRONIZED); } @@ -207,7 +207,7 @@ unsigned long long sched_clock(void) { unsigned long long ret; - ret = (unsigned long long)omap_32k_read(&clocksource_32k); + ret = (unsigned long long)omap_32k_read(); ret = (ret * clocksource_32k.mult_orig) >> clocksource_32k.shift; return ret; } diff --git a/trunk/arch/arm/plat-orion/time.c b/trunk/arch/arm/plat-orion/time.c index 2faf9dba4ef7..6fa2923e6dca 100644 --- a/trunk/arch/arm/plat-orion/time.c +++ b/trunk/arch/arm/plat-orion/time.c @@ -41,7 +41,7 @@ static u32 ticks_per_jiffy; /* * Clocksource handling. */ -static cycle_t orion_clksrc_read(struct clocksource *cs) +static cycle_t orion_clksrc_read(void) { return 0xffffffff - readl(TIMER0_VAL); } diff --git a/trunk/arch/avr32/kernel/time.c b/trunk/arch/avr32/kernel/time.c index f27aa3b259fa..0ff46bf873b0 100644 --- a/trunk/arch/avr32/kernel/time.c +++ b/trunk/arch/avr32/kernel/time.c @@ -18,7 +18,7 @@ #include -static cycle_t read_cycle_count(struct clocksource *cs) +static cycle_t read_cycle_count(void) { return (cycle_t)sysreg_read(COUNT); } diff --git a/trunk/arch/blackfin/kernel/time-ts.c b/trunk/arch/blackfin/kernel/time-ts.c index 27646121280a..0ed2badfd746 100644 --- a/trunk/arch/blackfin/kernel/time-ts.c +++ b/trunk/arch/blackfin/kernel/time-ts.c @@ -58,11 +58,16 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc) return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR; } -static cycle_t read_cycles(struct clocksource *cs) +static cycle_t read_cycles(void) { return __bfin_cycles_off + (get_cycles() << __bfin_cycles_mod); } +unsigned long long sched_clock(void) +{ + return cycles_2_ns(read_cycles()); +} + static struct clocksource clocksource_bfin = { .name = "bfin_cycles", .rating = 350, @@ -72,11 +77,6 @@ static struct clocksource clocksource_bfin = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; -unsigned long long sched_clock(void) -{ - return cycles_2_ns(read_cycles(&clocksource_bfin)); -} - static int __init bfin_clocksource_init(void) { set_cyc2ns_scale(get_cclk() / 1000); diff --git a/trunk/arch/frv/kernel/setup.c b/trunk/arch/frv/kernel/setup.c index 55e4fab7c0bc..0669e1382383 100644 --- a/trunk/arch/frv/kernel/setup.c +++ b/trunk/arch/frv/kernel/setup.c @@ -46,6 +46,7 @@ #include #ifdef CONFIG_BLK_DEV_INITRD +#include #include #endif diff --git a/trunk/arch/frv/mb93090-mb00/pci-vdk.c b/trunk/arch/frv/mb93090-mb00/pci-vdk.c index c0dcec65c6b7..0f41c3a72da5 100644 --- a/trunk/arch/frv/mb93090-mb00/pci-vdk.c +++ b/trunk/arch/frv/mb93090-mb00/pci-vdk.c @@ -30,29 +30,6 @@ int __nongpreldata pcibios_last_bus = -1; struct pci_bus *__nongpreldata pci_root_bus; struct pci_ops *__nongpreldata pci_root_ops; -/* - * The accessible PCI window does not cover the entire CPU address space, but - * there are devices we want to access outside of that window, so we need to - * insert specific PCI bus resources instead of using the platform-level bus - * resources directly for the PCI root bus. - * - * These are configured and inserted by pcibios_init() and are attached to the - * root bus by pcibios_fixup_bus(). - */ -static struct resource pci_ioport_resource = { - .name = "PCI IO", - .start = 0, - .end = IO_SPACE_LIMIT, - .flags = IORESOURCE_IO, -}; - -static struct resource pci_iomem_resource = { - .name = "PCI mem", - .start = 0, - .end = -1, - .flags = IORESOURCE_MEM, -}; - /* * Functions for accessing PCI configuration space */ @@ -327,12 +304,6 @@ void __init pcibios_fixup_bus(struct pci_bus *bus) #if 0 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); #endif - - if (bus->number == 0) { - bus->resource[0] = &pci_ioport_resource; - bus->resource[1] = &pci_iomem_resource; - } - pci_read_bridge_bases(bus); if (bus->number == 0) { @@ -379,36 +350,28 @@ int __init pcibios_init(void) /* enable PCI arbitration */ __reg_MB86943_pci_arbiter = MB86943_PCIARB_EN; - pci_ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; - pci_ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; - pci_ioport_resource.end += pci_ioport_resource.start; + ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; + ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; + ioport_resource.end += ioport_resource.start; printk("PCI IO window: %08llx-%08llx\n", - (unsigned long long) pci_ioport_resource.start, - (unsigned long long) pci_ioport_resource.end); + (unsigned long long) ioport_resource.start, + (unsigned long long) ioport_resource.end); - pci_iomem_resource.start = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00; - pci_iomem_resource.end = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff; - pci_iomem_resource.end += pci_iomem_resource.start; + iomem_resource.start = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00; - /* Reserve somewhere to write to flush posted writes. This is used by - * __flush_PCI_writes() from asm/io.h to force the write FIFO in the - * CPU-PCI bridge to flush as this doesn't happen automatically when a - * read is performed on the MB93090 development kit motherboard. - */ - pci_iomem_resource.start += 0x400; + /* Reserve somewhere to write to flush posted writes. */ + iomem_resource.start += 0x400; + + iomem_resource.end = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff; + iomem_resource.end += iomem_resource.start; printk("PCI MEM window: %08llx-%08llx\n", - (unsigned long long) pci_iomem_resource.start, - (unsigned long long) pci_iomem_resource.end); + (unsigned long long) iomem_resource.start, + (unsigned long long) iomem_resource.end); printk("PCI DMA memory: %08lx-%08lx\n", dma_coherent_mem_start, dma_coherent_mem_end); - if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) - panic("Unable to insert PCI IOMEM resource\n"); - if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) - panic("Unable to insert PCI IOPORT resource\n"); - if (!pci_probe) return -ENXIO; diff --git a/trunk/arch/ia64/include/asm/paravirt_privop.h b/trunk/arch/ia64/include/asm/paravirt_privop.h index 8f6cb11c9fae..3d2951130b5f 100644 --- a/trunk/arch/ia64/include/asm/paravirt_privop.h +++ b/trunk/arch/ia64/include/asm/paravirt_privop.h @@ -445,6 +445,7 @@ paravirt_set_rr0_to_rr4(unsigned long val0, unsigned long val1, register unsigned long ia64_intri_res asm ("r8"); \ register unsigned long __reg asm ("r8") = (reg); \ \ + BUILD_BUG_ON(!__builtin_constant_p(reg)); \ asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \ PARAVIRT_TYPE(GETREG) \ + (reg)) \ @@ -463,6 +464,7 @@ paravirt_set_rr0_to_rr4(unsigned long val0, unsigned long val1, register unsigned long ia64_clobber1 asm ("r8"); \ register unsigned long ia64_clobber2 asm ("r9"); \ \ + BUILD_BUG_ON(!__builtin_constant_p(reg)); \ asm volatile (paravirt_alt_bundle(__PARAVIRT_BR, \ PARAVIRT_TYPE(SETREG) \ + (reg)) \ diff --git a/trunk/arch/ia64/include/asm/smp.h b/trunk/arch/ia64/include/asm/smp.h index d217d1d4e051..598408336251 100644 --- a/trunk/arch/ia64/include/asm/smp.h +++ b/trunk/arch/ia64/include/asm/smp.h @@ -58,7 +58,7 @@ extern struct smp_boot_data { extern char no_int_routing __devinitdata; extern cpumask_t cpu_core_map[NR_CPUS]; -DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); +DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); extern int smp_num_siblings; extern void __iomem *ipi_base_addr; extern unsigned char smp_int_redirect; diff --git a/trunk/arch/ia64/kernel/cyclone.c b/trunk/arch/ia64/kernel/cyclone.c index 71e35864d2e2..790ef0d87e12 100644 --- a/trunk/arch/ia64/kernel/cyclone.c +++ b/trunk/arch/ia64/kernel/cyclone.c @@ -21,7 +21,7 @@ void __init cyclone_setup(void) static void __iomem *cyclone_mc; -static cycle_t read_cyclone(struct clocksource *cs) +static cycle_t read_cyclone(void) { return (cycle_t)readq((void __iomem *)cyclone_mc); } diff --git a/trunk/arch/ia64/kernel/smp.c b/trunk/arch/ia64/kernel/smp.c index 5230eaafd83f..2ea4199d9c57 100644 --- a/trunk/arch/ia64/kernel/smp.c +++ b/trunk/arch/ia64/kernel/smp.c @@ -225,7 +225,6 @@ smp_send_reschedule (int cpu) { platform_send_ipi(cpu, IA64_IPI_RESCHEDULE, IA64_IPI_DM_INT, 0); } -EXPORT_SYMBOL_GPL(smp_send_reschedule); /* * Called with preemption disabled. @@ -301,12 +300,15 @@ smp_flush_tlb_mm (struct mm_struct *mm) return; } - smp_call_function_mask(mm->cpu_vm_mask, - (void (*)(void *))local_finish_flush_tlb_mm, mm, 1); - local_irq_disable(); - local_finish_flush_tlb_mm(mm); - local_irq_enable(); preempt_enable(); + /* + * We could optimize this further by using mm->cpu_vm_mask to track which CPUs + * have been running in the address space. It's not clear that this is worth the + * trouble though: to avoid races, we have to raise the IPI on the target CPU + * anyhow, and once a CPU is interrupted, the cost of local_flush_tlb_all() is + * rather trivial. + */ + on_each_cpu((void (*)(void *))local_finish_flush_tlb_mm, mm, 1); } void arch_send_call_function_single_ipi(int cpu) diff --git a/trunk/arch/ia64/kernel/time.c b/trunk/arch/ia64/kernel/time.c index 604c1a35db33..641c8b61c4f1 100644 --- a/trunk/arch/ia64/kernel/time.c +++ b/trunk/arch/ia64/kernel/time.c @@ -33,7 +33,7 @@ #include "fsyscall_gtod_data.h" -static cycle_t itc_get_cycles(struct clocksource *cs); +static cycle_t itc_get_cycles(void); struct fsyscall_gtod_data_t fsyscall_gtod_data = { .lock = SEQLOCK_UNLOCKED, @@ -383,7 +383,7 @@ ia64_init_itm (void) } } -static cycle_t itc_get_cycles(struct clocksource *cs) +static cycle_t itc_get_cycles(void) { u64 lcycle, now, ret; diff --git a/trunk/arch/ia64/sn/kernel/sn2/timer.c b/trunk/arch/ia64/sn/kernel/sn2/timer.c index 21d6f09e3447..cf67fc562054 100644 --- a/trunk/arch/ia64/sn/kernel/sn2/timer.c +++ b/trunk/arch/ia64/sn/kernel/sn2/timer.c @@ -23,7 +23,7 @@ extern unsigned long sn_rtc_cycles_per_second; -static cycle_t read_sn2(struct clocksource *cs) +static cycle_t read_sn2(void) { return (cycle_t)readq(RTC_COUNTER_ADDR); } diff --git a/trunk/arch/m68knommu/platform/68328/timers.c b/trunk/arch/m68knommu/platform/68328/timers.c index 309f725995bf..6bafefa546e5 100644 --- a/trunk/arch/m68knommu/platform/68328/timers.c +++ b/trunk/arch/m68knommu/platform/68328/timers.c @@ -75,7 +75,7 @@ static struct irqaction m68328_timer_irq = { /***************************************************************************/ -static cycle_t m68328_read_clk(struct clocksource *cs) +static cycle_t m68328_read_clk(void) { unsigned long flags; u32 cycles; diff --git a/trunk/arch/m68knommu/platform/coldfire/dma_timer.c b/trunk/arch/m68knommu/platform/coldfire/dma_timer.c index a5f562823d7a..772578b1084f 100644 --- a/trunk/arch/m68knommu/platform/coldfire/dma_timer.c +++ b/trunk/arch/m68knommu/platform/coldfire/dma_timer.c @@ -34,7 +34,7 @@ #define DMA_DTMR_CLK_DIV_16 (2 << 1) #define DMA_DTMR_ENABLE (1 << 0) -static cycle_t cf_dt_get_cycles(struct clocksource *cs) +static cycle_t cf_dt_get_cycles(void) { return __raw_readl(DTCN0); } diff --git a/trunk/arch/m68knommu/platform/coldfire/pit.c b/trunk/arch/m68knommu/platform/coldfire/pit.c index 61b96211f8ff..2a12e7fa9748 100644 --- a/trunk/arch/m68knommu/platform/coldfire/pit.c +++ b/trunk/arch/m68knommu/platform/coldfire/pit.c @@ -125,7 +125,7 @@ static struct irqaction pit_irq = { /***************************************************************************/ -static cycle_t pit_read_clk(struct clocksource *cs) +static cycle_t pit_read_clk(void) { unsigned long flags; u32 cycles; diff --git a/trunk/arch/m68knommu/platform/coldfire/timers.c b/trunk/arch/m68knommu/platform/coldfire/timers.c index 1ba8a3731653..454f25493491 100644 --- a/trunk/arch/m68knommu/platform/coldfire/timers.c +++ b/trunk/arch/m68knommu/platform/coldfire/timers.c @@ -78,7 +78,7 @@ static struct irqaction mcftmr_timer_irq = { /***************************************************************************/ -static cycle_t mcftmr_read_clk(struct clocksource *cs) +static cycle_t mcftmr_read_clk(void) { unsigned long flags; u32 cycles; diff --git a/trunk/arch/mips/kernel/cevt-txx9.c b/trunk/arch/mips/kernel/cevt-txx9.c index 2e911e3da8d3..eccf7d6096bd 100644 --- a/trunk/arch/mips/kernel/cevt-txx9.c +++ b/trunk/arch/mips/kernel/cevt-txx9.c @@ -22,7 +22,7 @@ static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr; -static cycle_t txx9_cs_read(struct clocksource *cs) +static cycle_t txx9_cs_read(void) { return __raw_readl(&txx9_cs_tmrptr->trr); } diff --git a/trunk/arch/mips/kernel/csrc-bcm1480.c b/trunk/arch/mips/kernel/csrc-bcm1480.c index 51489f8a825e..868745e7184b 100644 --- a/trunk/arch/mips/kernel/csrc-bcm1480.c +++ b/trunk/arch/mips/kernel/csrc-bcm1480.c @@ -28,7 +28,7 @@ #include -static cycle_t bcm1480_hpt_read(struct clocksource *cs) +static cycle_t bcm1480_hpt_read(void) { return (cycle_t) __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT)); } diff --git a/trunk/arch/mips/kernel/csrc-ioasic.c b/trunk/arch/mips/kernel/csrc-ioasic.c index b551f48d3a07..1d5f63cf8997 100644 --- a/trunk/arch/mips/kernel/csrc-ioasic.c +++ b/trunk/arch/mips/kernel/csrc-ioasic.c @@ -25,7 +25,7 @@ #include #include -static cycle_t dec_ioasic_hpt_read(struct clocksource *cs) +static cycle_t dec_ioasic_hpt_read(void) { return ioasic_read(IO_REG_FCTR); } @@ -47,13 +47,13 @@ void __init dec_ioasic_clocksource_init(void) while (!ds1287_timer_state()) ; - start = dec_ioasic_hpt_read(&clocksource_dec); + start = dec_ioasic_hpt_read(); while (i--) while (!ds1287_timer_state()) ; - end = dec_ioasic_hpt_read(&clocksource_dec); + end = dec_ioasic_hpt_read(); freq = (end - start) * 10; printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq); diff --git a/trunk/arch/mips/kernel/csrc-r4k.c b/trunk/arch/mips/kernel/csrc-r4k.c index e95a3cd48eea..f1a2893931ed 100644 --- a/trunk/arch/mips/kernel/csrc-r4k.c +++ b/trunk/arch/mips/kernel/csrc-r4k.c @@ -10,7 +10,7 @@ #include -static cycle_t c0_hpt_read(struct clocksource *cs) +static cycle_t c0_hpt_read(void) { return read_c0_count(); } diff --git a/trunk/arch/mips/kernel/csrc-sb1250.c b/trunk/arch/mips/kernel/csrc-sb1250.c index d14d3d1907fa..92212bbb8e45 100644 --- a/trunk/arch/mips/kernel/csrc-sb1250.c +++ b/trunk/arch/mips/kernel/csrc-sb1250.c @@ -33,7 +33,7 @@ * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over * again. */ -static cycle_t sb1250_hpt_read(struct clocksource *cs) +static cycle_t sb1250_hpt_read(void) { unsigned int count; diff --git a/trunk/arch/mips/kernel/i8253.c b/trunk/arch/mips/kernel/i8253.c index ed20e7fe65e3..689719e34f08 100644 --- a/trunk/arch/mips/kernel/i8253.c +++ b/trunk/arch/mips/kernel/i8253.c @@ -128,7 +128,7 @@ void __init setup_pit_timer(void) * to just read by itself. So use jiffies to emulate a free * running counter: */ -static cycle_t pit_read(struct clocksource *cs) +static cycle_t pit_read(void) { unsigned long flags; int count; diff --git a/trunk/arch/mips/nxp/pnx8550/common/time.c b/trunk/arch/mips/nxp/pnx8550/common/time.c index 8df43e9e4d90..cf293b279098 100644 --- a/trunk/arch/mips/nxp/pnx8550/common/time.c +++ b/trunk/arch/mips/nxp/pnx8550/common/time.c @@ -35,7 +35,7 @@ static unsigned long cpj; -static cycle_t hpt_read(struct clocksource *cs) +static cycle_t hpt_read(void) { return read_c0_count2(); } diff --git a/trunk/arch/mips/sgi-ip27/ip27-timer.c b/trunk/arch/mips/sgi-ip27/ip27-timer.c index f10a7cd64f7e..f024057a35f8 100644 --- a/trunk/arch/mips/sgi-ip27/ip27-timer.c +++ b/trunk/arch/mips/sgi-ip27/ip27-timer.c @@ -159,7 +159,7 @@ static void __init hub_rt_clock_event_global_init(void) setup_irq(irq, &hub_rt_irqaction); } -static cycle_t hub_rt_read(struct clocksource *cs) +static cycle_t hub_rt_read(void) { return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT); } diff --git a/trunk/arch/powerpc/kernel/time.c b/trunk/arch/powerpc/kernel/time.c index 48571ac56fb7..926ea864e34f 100644 --- a/trunk/arch/powerpc/kernel/time.c +++ b/trunk/arch/powerpc/kernel/time.c @@ -77,7 +77,7 @@ #include #include -static cycle_t rtc_read(struct clocksource *); +static cycle_t rtc_read(void); static struct clocksource clocksource_rtc = { .name = "rtc", .rating = 400, @@ -88,7 +88,7 @@ static struct clocksource clocksource_rtc = { .read = rtc_read, }; -static cycle_t timebase_read(struct clocksource *); +static cycle_t timebase_read(void); static struct clocksource clocksource_timebase = { .name = "timebase", .rating = 400, @@ -766,12 +766,12 @@ unsigned long read_persistent_clock(void) } /* clocksource code */ -static cycle_t rtc_read(struct clocksource *cs) +static cycle_t rtc_read(void) { return (cycle_t)get_rtc(); } -static cycle_t timebase_read(struct clocksource *cs) +static cycle_t timebase_read(void) { return (cycle_t)get_tb(); } diff --git a/trunk/arch/s390/kernel/compat_linux.c b/trunk/arch/s390/kernel/compat_linux.c index 002c70d3cb75..6cc87d8c8682 100644 --- a/trunk/arch/s390/kernel/compat_linux.c +++ b/trunk/arch/s390/kernel/compat_linux.c @@ -702,12 +702,20 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename, struct stat64_emu31 __user* statbuf, int flag) { struct kstat stat; - int error; + int error = -EINVAL; + + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_stat64(statbuf, &stat); + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); + + if (!error) + error = cp_stat64(statbuf, &stat); +out: + return error; } /* diff --git a/trunk/arch/s390/kernel/time.c b/trunk/arch/s390/kernel/time.c index ef596d020573..6ded50dfa75a 100644 --- a/trunk/arch/s390/kernel/time.c +++ b/trunk/arch/s390/kernel/time.c @@ -201,7 +201,7 @@ unsigned long read_persistent_clock(void) return ts.tv_sec; } -static cycle_t read_tod_clock(struct clocksource *cs) +static cycle_t read_tod_clock(void) { return get_clock(); } diff --git a/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index 406747f07dc0..0e5d204bc792 100644 --- a/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c @@ -256,6 +256,7 @@ static int __init sh7722_devices_setup(void) { clk_always_enable("uram0"); /* URAM */ clk_always_enable("xymem0"); /* XYMEM */ + clk_always_enable("rtc0"); /* RTC */ clk_always_enable("veu0"); /* VEU */ clk_always_enable("vpu0"); /* VPU */ clk_always_enable("jpu0"); /* JPU */ diff --git a/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index a800466b938c..5338dacbcfba 100644 --- a/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/trunk/arch/sh/kernel/cpu/sh4a/setup-sh7723.c @@ -267,6 +267,7 @@ static struct platform_device *sh7723_devices[] __initdata = { static int __init sh7723_devices_setup(void) { clk_always_enable("meram0"); /* MERAM */ + clk_always_enable("rtc0"); /* RTC */ clk_always_enable("veu1"); /* VEU2H1 */ clk_always_enable("veu0"); /* VEU2H0 */ clk_always_enable("vpu0"); /* VPU */ diff --git a/trunk/arch/sh/kernel/sys_sh.c b/trunk/arch/sh/kernel/sys_sh.c index e3a7e36639ef..58dfc02c7af1 100644 --- a/trunk/arch/sh/kernel/sys_sh.c +++ b/trunk/arch/sh/kernel/sys_sh.c @@ -63,15 +63,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { - /* - * The shift for mmap2 is constant, regardless of PAGE_SIZE - * setting. - */ - if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) - return -EINVAL; - - pgoff >>= PAGE_SHIFT - 12; - return do_mmap2(addr, len, prot, flags, fd, pgoff); } diff --git a/trunk/arch/sh/kernel/time_32.c b/trunk/arch/sh/kernel/time_32.c index 1700d2465f6c..c34e1e0f9b02 100644 --- a/trunk/arch/sh/kernel/time_32.c +++ b/trunk/arch/sh/kernel/time_32.c @@ -208,7 +208,7 @@ unsigned long long sched_clock(void) if (!clocksource_sh.rating) return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ); - cycles = clocksource_sh.read(&clocksource_sh); + cycles = clocksource_sh.read(); return cyc2ns(&clocksource_sh, cycles); } #endif diff --git a/trunk/arch/sh/kernel/timers/timer-tmu.c b/trunk/arch/sh/kernel/timers/timer-tmu.c index fe8d8930ccb6..c5d3396f5960 100644 --- a/trunk/arch/sh/kernel/timers/timer-tmu.c +++ b/trunk/arch/sh/kernel/timers/timer-tmu.c @@ -81,7 +81,7 @@ static int tmu_timer_stop(void) */ static int tmus_are_scaled; -static cycle_t tmu_timer_read(struct clocksource *cs) +static cycle_t tmu_timer_read(void) { return ((cycle_t)(~_tmu_read(TMU1)))<get_tick(); -} - void __init time_init(void) { unsigned long freq = sparc64_init_timers(); @@ -832,7 +827,7 @@ void __init time_init(void) clocksource_tick.mult = clocksource_hz2mult(freq, clocksource_tick.shift); - clocksource_tick.read = clocksource_tick_read; + clocksource_tick.read = tick_ops->get_tick; printk("clocksource: mult[%x] shift[%d]\n", clocksource_tick.mult, clocksource_tick.shift); diff --git a/trunk/arch/um/Kconfig.rest b/trunk/arch/um/Kconfig.rest index 0ccad0ff6d6e..7b5cea75a6c4 100644 --- a/trunk/arch/um/Kconfig.rest +++ b/trunk/arch/um/Kconfig.rest @@ -36,7 +36,7 @@ source "drivers/leds/Kconfig" #This is just to shut up some Kconfig warnings, so no prompt. config INPUT - tristate + bool default n source "arch/um/Kconfig.debug" diff --git a/trunk/arch/um/kernel/time.c b/trunk/arch/um/kernel/time.c index c8b9c469fcd7..b13a87a3ec95 100644 --- a/trunk/arch/um/kernel/time.c +++ b/trunk/arch/um/kernel/time.c @@ -65,7 +65,7 @@ static irqreturn_t um_timer(int irq, void *dev) return IRQ_HANDLED; } -static cycle_t itimer_read(struct clocksource *cs) +static cycle_t itimer_read(void) { return os_nsecs() / 1000; } diff --git a/trunk/arch/x86/ia32/sys_ia32.c b/trunk/arch/x86/ia32/sys_ia32.c index 085a8c35f149..efac92fd1efb 100644 --- a/trunk/arch/x86/ia32/sys_ia32.c +++ b/trunk/arch/x86/ia32/sys_ia32.c @@ -129,12 +129,21 @@ asmlinkage long sys32_fstatat(unsigned int dfd, char __user *filename, struct stat64 __user *statbuf, int flag) { struct kstat stat; - int error; + int error = -EINVAL; - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_stat64(statbuf, &stat); + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; + + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); + + if (!error) + error = cp_stat64(statbuf, &stat); + +out: + return error; } /* diff --git a/trunk/arch/x86/include/asm/desc.h b/trunk/arch/x86/include/asm/desc.h index c45f415ce315..5623c50d67b2 100644 --- a/trunk/arch/x86/include/asm/desc.h +++ b/trunk/arch/x86/include/asm/desc.h @@ -37,7 +37,7 @@ extern gate_desc idt_table[]; struct gdt_page { struct desc_struct gdt[GDT_ENTRIES]; } __attribute__((aligned(PAGE_SIZE))); -DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page); +DECLARE_PER_CPU(struct gdt_page, gdt_page); static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) { diff --git a/trunk/arch/x86/include/asm/hardirq.h b/trunk/arch/x86/include/asm/hardirq.h index 37555e52f980..039db6aa8e02 100644 --- a/trunk/arch/x86/include/asm/hardirq.h +++ b/trunk/arch/x86/include/asm/hardirq.h @@ -26,7 +26,7 @@ typedef struct { #endif } ____cacheline_aligned irq_cpustat_t; -DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); +DECLARE_PER_CPU(irq_cpustat_t, irq_stat); /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ #define MAX_HARDIRQS_PER_CPU NR_VECTORS diff --git a/trunk/arch/x86/include/asm/processor.h b/trunk/arch/x86/include/asm/processor.h index c2cceae709c8..fcf4d92e7e04 100644 --- a/trunk/arch/x86/include/asm/processor.h +++ b/trunk/arch/x86/include/asm/processor.h @@ -138,7 +138,7 @@ extern struct tss_struct doublefault_tss; extern __u32 cleared_cpu_caps[NCAPINTS]; #ifdef CONFIG_SMP -DECLARE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); +DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info); #define cpu_data(cpu) per_cpu(cpu_info, cpu) #define current_cpu_data __get_cpu_var(cpu_info) #else @@ -270,7 +270,7 @@ struct tss_struct { } ____cacheline_aligned; -DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss); +DECLARE_PER_CPU(struct tss_struct, init_tss); /* * Save the original ist values for checking stack pointers during debugging @@ -393,7 +393,7 @@ union irq_stack_union { }; }; -DECLARE_PER_CPU_FIRST(union irq_stack_union, irq_stack_union); +DECLARE_PER_CPU(union irq_stack_union, irq_stack_union); DECLARE_INIT_PER_CPU(irq_stack_union); DECLARE_PER_CPU(char *, irq_stack_ptr); diff --git a/trunk/arch/x86/include/asm/tlbflush.h b/trunk/arch/x86/include/asm/tlbflush.h index 16a5c84b0329..d3539f998f88 100644 --- a/trunk/arch/x86/include/asm/tlbflush.h +++ b/trunk/arch/x86/include/asm/tlbflush.h @@ -152,7 +152,7 @@ struct tlb_state { struct mm_struct *active_mm; int state; }; -DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate); +DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); static inline void reset_lazy_tlbstate(void) { diff --git a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index ecdb682ab516..dd0bd76d14c0 100644 --- a/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -68,11 +68,16 @@ struct acpi_cpufreq_data { unsigned int max_freq; unsigned int resume; unsigned int cpu_feature; - u64 saved_aperf, saved_mperf; }; static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); +struct acpi_msr_data { + u64 saved_aperf, saved_mperf; +}; + +static DEFINE_PER_CPU(struct acpi_msr_data, msr_data); + DEFINE_TRACE(power_mark); /* acpi_perf_data is a pointer to percpu data. */ @@ -287,11 +292,11 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy, return 0; cur.aperf.whole = readin.aperf.whole - - per_cpu(drv_data, cpu)->saved_aperf; + per_cpu(msr_data, cpu).saved_aperf; cur.mperf.whole = readin.mperf.whole - - per_cpu(drv_data, cpu)->saved_mperf; - per_cpu(drv_data, cpu)->saved_aperf = readin.aperf.whole; - per_cpu(drv_data, cpu)->saved_mperf = readin.mperf.whole; + per_cpu(msr_data, cpu).saved_mperf; + per_cpu(msr_data, cpu).saved_aperf = readin.aperf.whole; + per_cpu(msr_data, cpu).saved_mperf = readin.mperf.whole; #ifdef __i386__ /* diff --git a/trunk/arch/x86/kernel/hpet.c b/trunk/arch/x86/kernel/hpet.c index 3f0019e0a229..648b3a2a3a44 100644 --- a/trunk/arch/x86/kernel/hpet.c +++ b/trunk/arch/x86/kernel/hpet.c @@ -722,7 +722,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n, /* * Clock source related code */ -static cycle_t read_hpet(struct clocksource *cs) +static cycle_t read_hpet(void) { return (cycle_t)hpet_readl(HPET_COUNTER); } @@ -756,7 +756,7 @@ static int hpet_clocksource_register(void) hpet_restart_counter(); /* Verify whether hpet counter works */ - t1 = hpet_readl(HPET_COUNTER); + t1 = read_hpet(); rdtscll(start); /* @@ -770,7 +770,7 @@ static int hpet_clocksource_register(void) rdtscll(now); } while ((now - start) < 200000UL); - if (t1 == hpet_readl(HPET_COUNTER)) { + if (t1 == read_hpet()) { printk(KERN_WARNING "HPET counter not counting. HPET disabled\n"); return -ENODEV; diff --git a/trunk/arch/x86/kernel/i8253.c b/trunk/arch/x86/kernel/i8253.c index c2e0bb0890d4..3475440baa54 100644 --- a/trunk/arch/x86/kernel/i8253.c +++ b/trunk/arch/x86/kernel/i8253.c @@ -129,7 +129,7 @@ void __init setup_pit_timer(void) * to just read by itself. So use jiffies to emulate a free * running counter: */ -static cycle_t pit_read(struct clocksource *cs) +static cycle_t pit_read(void) { static int old_count; static u32 old_jifs; diff --git a/trunk/arch/x86/kernel/kvmclock.c b/trunk/arch/x86/kernel/kvmclock.c index 223af43f1526..137f2e8132df 100644 --- a/trunk/arch/x86/kernel/kvmclock.c +++ b/trunk/arch/x86/kernel/kvmclock.c @@ -77,11 +77,6 @@ static cycle_t kvm_clock_read(void) return ret; } -static cycle_t kvm_clock_get_cycles(struct clocksource *cs) -{ - return kvm_clock_read(); -} - /* * If we don't do that, there is the possibility that the guest * will calibrate under heavy load - thus, getting a lower lpj - @@ -112,7 +107,7 @@ static void kvm_get_preset_lpj(void) static struct clocksource kvm_clock = { .name = "kvm-clock", - .read = kvm_clock_get_cycles, + .read = kvm_clock_read, .rating = 400, .mask = CLOCKSOURCE_MASK(64), .mult = 1 << KVM_SCALE, diff --git a/trunk/arch/x86/kernel/tsc.c b/trunk/arch/x86/kernel/tsc.c index d57de05dc430..7a567ebe6361 100644 --- a/trunk/arch/x86/kernel/tsc.c +++ b/trunk/arch/x86/kernel/tsc.c @@ -699,7 +699,7 @@ static struct clocksource clocksource_tsc; * code, which is necessary to support wrapping clocksources like pm * timer. */ -static cycle_t read_tsc(struct clocksource *cs) +static cycle_t read_tsc(void) { cycle_t ret = (cycle_t)get_cycles(); diff --git a/trunk/arch/x86/kernel/vmiclock_32.c b/trunk/arch/x86/kernel/vmiclock_32.c index 2b3eb82efeeb..d303369a7bad 100644 --- a/trunk/arch/x86/kernel/vmiclock_32.c +++ b/trunk/arch/x86/kernel/vmiclock_32.c @@ -283,7 +283,7 @@ void __devinit vmi_time_ap_init(void) /** vmi clocksource */ static struct clocksource clocksource_vmi; -static cycle_t read_real_cycles(struct clocksource *cs) +static cycle_t read_real_cycles(void) { cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL); return max(ret, clocksource_vmi.cycle_last); diff --git a/trunk/arch/x86/lguest/boot.c b/trunk/arch/x86/lguest/boot.c index ca7ec44bafc3..a2085368a3dc 100644 --- a/trunk/arch/x86/lguest/boot.c +++ b/trunk/arch/x86/lguest/boot.c @@ -663,7 +663,7 @@ static unsigned long lguest_tsc_khz(void) /* If we can't use the TSC, the kernel falls back to our lower-priority * "lguest_clock", where we read the time value given to us by the Host. */ -static cycle_t lguest_clock_read(struct clocksource *cs) +static cycle_t lguest_clock_read(void) { unsigned long sec, nsec; diff --git a/trunk/arch/x86/xen/time.c b/trunk/arch/x86/xen/time.c index 0a5aa44299a5..14f240623497 100644 --- a/trunk/arch/x86/xen/time.c +++ b/trunk/arch/x86/xen/time.c @@ -213,11 +213,6 @@ cycle_t xen_clocksource_read(void) return ret; } -static cycle_t xen_clocksource_get_cycles(struct clocksource *cs) -{ - return xen_clocksource_read(); -} - static void xen_read_wallclock(struct timespec *ts) { struct shared_info *s = HYPERVISOR_shared_info; @@ -246,7 +241,7 @@ int xen_set_wallclock(unsigned long now) static struct clocksource xen_clocksource __read_mostly = { .name = "xen", .rating = 400, - .read = xen_clocksource_get_cycles, + .read = xen_clocksource_read, .mask = ~0, .mult = 1<flags); - set_bit(EC_FLAGS_GPE_MODE, &ec->flags); acpi_enable_gpe(NULL, ec->gpe); return 0; } diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index d916bea729f1..d59f08ecaf16 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -353,10 +353,8 @@ static irqreturn_t acpi_irq(int irq, void *dev_id) if (handled) { acpi_irq_handled++; return IRQ_HANDLED; - } else { - acpi_irq_not_handled++; + } else return IRQ_NONE; - } } acpi_status diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index eed3b458ebac..6fe121434ffb 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -581,11 +581,6 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { struct acpi_processor_cx *cx = &pr->power.states[i]; -#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) - /* TSC could halt in idle, so notify users */ - if (tsc_halts_in_c(cx->type)) - mark_tsc_unstable("TSC halts in idle");; -#endif switch (cx->type) { case ACPI_STATE_C1: cx->valid = 1; @@ -662,9 +657,11 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "active state: C%zd\n" "max_cstate: C%d\n" + "bus master activity: %08x\n" "maximum allowed latency: %d usec\n", pr->power.state ? pr->power.state - pr->power.states : 0, - max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); + max_cstate, (unsigned)pr->power.bm_activity, + pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); seq_puts(seq, "states:\n"); @@ -874,6 +871,11 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, kt2 = ktime_get_real(); idle_time = ktime_to_us(ktime_sub(kt2, kt1)); +#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) + /* TSC could halt in idle, so notify users */ + if (tsc_halts_in_c(cx->type)) + mark_tsc_unstable("TSC halts in idle");; +#endif sleep_ticks = us_to_pm_timer_ticks(idle_time); /* Tell the scheduler how much we idled: */ @@ -987,6 +989,11 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, spin_unlock(&c3_lock); } +#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) + /* TSC could halt in idle, so notify users */ + if (tsc_halts_in_c(ACPI_STATE_C3)) + mark_tsc_unstable("TSC halts in idle"); +#endif sleep_ticks = us_to_pm_timer_ticks(idle_time); /* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); diff --git a/trunk/drivers/acpi/sleep.c b/trunk/drivers/acpi/sleep.c index d060e6fd7fd5..779e4e500df4 100644 --- a/trunk/drivers/acpi/sleep.c +++ b/trunk/drivers/acpi/sleep.c @@ -300,9 +300,9 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) static struct platform_suspend_ops acpi_suspend_ops = { .valid = acpi_suspend_state_valid, .begin = acpi_suspend_begin, - .prepare_late = acpi_pm_prepare, + .prepare = acpi_pm_prepare, .enter = acpi_suspend_enter, - .wake = acpi_pm_finish, + .finish = acpi_pm_finish, .end = acpi_pm_end, }; @@ -328,9 +328,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state) static struct platform_suspend_ops acpi_suspend_ops_old = { .valid = acpi_suspend_state_valid, .begin = acpi_suspend_begin_old, - .prepare_late = acpi_pm_disable_gpes, + .prepare = acpi_pm_disable_gpes, .enter = acpi_suspend_enter, - .wake = acpi_pm_finish, + .finish = acpi_pm_finish, .end = acpi_pm_end, .recover = acpi_pm_finish, }; diff --git a/trunk/drivers/acpi/system.c b/trunk/drivers/acpi/system.c index 0944daec064f..da51f05ef8d8 100644 --- a/trunk/drivers/acpi/system.c +++ b/trunk/drivers/acpi/system.c @@ -38,7 +38,6 @@ ACPI_MODULE_NAME("system"); #define ACPI_SYSTEM_DEVICE_NAME "System" u32 acpi_irq_handled; -u32 acpi_irq_not_handled; /* * Make ACPICA version work as module param @@ -215,9 +214,8 @@ static int acpi_system_sysfs_init(void) #define COUNT_GPE 0 #define COUNT_SCI 1 /* acpi_irq_handled */ -#define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ -#define COUNT_ERROR 3 /* other */ -#define NUM_COUNTERS_EXTRA 4 +#define COUNT_ERROR 2 /* other */ +#define NUM_COUNTERS_EXTRA 3 struct event_counter { u32 count; @@ -319,8 +317,6 @@ static ssize_t counter_show(struct kobject *kobj, all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = acpi_irq_handled; - all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count = - acpi_irq_not_handled; all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = acpi_gpe_count; @@ -367,7 +363,6 @@ static ssize_t counter_set(struct kobject *kobj, all_counters[i].count = 0; acpi_gpe_count = 0; acpi_irq_handled = 0; - acpi_irq_not_handled = 0; goto end; } @@ -461,8 +456,6 @@ void acpi_irq_stats_init(void) sprintf(buffer, "gpe_all"); else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) sprintf(buffer, "sci"); - else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT) - sprintf(buffer, "sci_not"); else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) sprintf(buffer, "error"); else diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index 564ea1424288..9cd15e8c8932 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) thermal_zone_device_register("acpitz", trips, tz, &acpi_thermal_zone_ops, 0, 0, 0, - tz->polling_frequency*100); + tz->polling_frequency); if (IS_ERR(tz->thermal_zone)) return -ENODEV; diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 21968ae6ed91..cd4fb7543a90 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -770,12 +770,10 @@ acpi_video_init_brightness(struct acpi_video_device *device) * In this case, the first two elements in _BCL packages * are also supported brightness levels that OS should take care of. */ - for (i = 2; i < count; i++) { - if (br->levels[i] == br->levels[0]) + for (i = 2; i < count; i++) + if (br->levels[i] == br->levels[0] || + br->levels[i] == br->levels[1]) level_ac_battery++; - if (br->levels[i] == br->levels[1]) - level_ac_battery++; - } if (level_ac_battery < 2) { level_ac_battery = 2 - level_ac_battery; diff --git a/trunk/drivers/base/core.c b/trunk/drivers/base/core.c index 4aa527b8a913..d230ff4b3eec 100644 --- a/trunk/drivers/base/core.c +++ b/trunk/drivers/base/core.c @@ -891,8 +891,7 @@ int device_add(struct device *dev) set_dev_node(dev, dev_to_node(parent)); /* first, register with generic layer. */ - /* we require the name to be set before, and pass NULL */ - error = kobject_add(&dev->kobj, dev->kobj.parent, NULL); + error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev)); if (error) goto Error; diff --git a/trunk/drivers/base/dd.c b/trunk/drivers/base/dd.c index 742cbe6b042b..f17c3266a0e0 100644 --- a/trunk/drivers/base/dd.c +++ b/trunk/drivers/base/dd.c @@ -179,7 +179,6 @@ void wait_for_device_probe(void) wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); async_synchronize_full(); } -EXPORT_SYMBOL_GPL(wait_for_device_probe); /** * driver_probe_device - attempt to bind device & driver together diff --git a/trunk/drivers/char/agp/generic.c b/trunk/drivers/char/agp/generic.c index 2224b762b7fb..10d6cbd7c05e 100644 --- a/trunk/drivers/char/agp/generic.c +++ b/trunk/drivers/char/agp/generic.c @@ -1226,7 +1226,7 @@ int agp_generic_alloc_pages(struct agp_bridge_data *bridge, struct agp_memory *m int i, ret = -ENOMEM; for (i = 0; i < num_pages; i++) { - page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); + page = alloc_page(GFP_KERNEL | GFP_DMA32); /* agp_free_memory() needs gart address */ if (page == NULL) goto out; @@ -1257,7 +1257,7 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge) { struct page * page; - page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); + page = alloc_page(GFP_KERNEL | GFP_DMA32); if (page == NULL) return NULL; diff --git a/trunk/drivers/char/hpet.c b/trunk/drivers/char/hpet.c index 340ba4f9dc54..50dfa3bc71ce 100644 --- a/trunk/drivers/char/hpet.c +++ b/trunk/drivers/char/hpet.c @@ -72,7 +72,7 @@ static u32 hpet_nhpet, hpet_max_freq = HPET_USER_FREQ; #ifdef CONFIG_IA64 static void __iomem *hpet_mctr; -static cycle_t read_hpet(struct clocksource *cs) +static cycle_t read_hpet(void) { return (cycle_t)read_counter((void __iomem *)hpet_mctr); } diff --git a/trunk/drivers/char/ipmi/ipmi_msghandler.c b/trunk/drivers/char/ipmi/ipmi_msghandler.c index aa83a0865ec1..e93fc8d22fb2 100644 --- a/trunk/drivers/char/ipmi/ipmi_msghandler.c +++ b/trunk/drivers/char/ipmi/ipmi_msghandler.c @@ -285,11 +285,6 @@ enum ipmi_stat_indexes { /* Events that were received with the proper format. */ IPMI_STAT_events, - /* Retransmissions on IPMB that failed. */ - IPMI_STAT_dropped_rexmit_ipmb_commands, - - /* Retransmissions on LAN that failed. */ - IPMI_STAT_dropped_rexmit_lan_commands, /* This *must* remain last, add new values above this. */ IPMI_NUM_STATS @@ -450,20 +445,6 @@ static DEFINE_MUTEX(smi_watchers_mutex); #define ipmi_get_stat(intf, stat) \ ((unsigned int) atomic_read(&(intf)->stats[IPMI_STAT_ ## stat])) -static int is_lan_addr(struct ipmi_addr *addr) -{ - return addr->addr_type == IPMI_LAN_ADDR_TYPE; -} - -static int is_ipmb_addr(struct ipmi_addr *addr) -{ - return addr->addr_type == IPMI_IPMB_ADDR_TYPE; -} - -static int is_ipmb_bcast_addr(struct ipmi_addr *addr) -{ - return addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE; -} static void free_recv_msg_list(struct list_head *q) { @@ -620,7 +601,8 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2) return (smi_addr1->lun == smi_addr2->lun); } - if (is_ipmb_addr(addr1) || is_ipmb_bcast_addr(addr1)) { + if ((addr1->addr_type == IPMI_IPMB_ADDR_TYPE) + || (addr1->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { struct ipmi_ipmb_addr *ipmb_addr1 = (struct ipmi_ipmb_addr *) addr1; struct ipmi_ipmb_addr *ipmb_addr2 @@ -630,7 +612,7 @@ ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2) && (ipmb_addr1->lun == ipmb_addr2->lun)); } - if (is_lan_addr(addr1)) { + if (addr1->addr_type == IPMI_LAN_ADDR_TYPE) { struct ipmi_lan_addr *lan_addr1 = (struct ipmi_lan_addr *) addr1; struct ipmi_lan_addr *lan_addr2 @@ -662,13 +644,14 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len) || (addr->channel < 0)) return -EINVAL; - if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) { + if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE) + || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { if (len < sizeof(struct ipmi_ipmb_addr)) return -EINVAL; return 0; } - if (is_lan_addr(addr)) { + if (addr->addr_type == IPMI_LAN_ADDR_TYPE) { if (len < sizeof(struct ipmi_lan_addr)) return -EINVAL; return 0; @@ -1520,7 +1503,8 @@ static int i_ipmi_request(ipmi_user_t user, memcpy(&(smi_msg->data[2]), msg->data, msg->data_len); smi_msg->data_size = msg->data_len + 2; ipmi_inc_stat(intf, sent_local_commands); - } else if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) { + } else if ((addr->addr_type == IPMI_IPMB_ADDR_TYPE) + || (addr->addr_type == IPMI_IPMB_BROADCAST_ADDR_TYPE)) { struct ipmi_ipmb_addr *ipmb_addr; unsigned char ipmb_seq; long seqid; @@ -1599,6 +1583,8 @@ static int i_ipmi_request(ipmi_user_t user, spin_lock_irqsave(&(intf->seq_lock), flags); + ipmi_inc_stat(intf, sent_ipmb_commands); + /* * Create a sequence number with a 1 second * timeout and 4 retries. @@ -1620,8 +1606,6 @@ static int i_ipmi_request(ipmi_user_t user, goto out_err; } - ipmi_inc_stat(intf, sent_ipmb_commands); - /* * Store the sequence number in the message, * so that when the send message response @@ -1651,7 +1635,7 @@ static int i_ipmi_request(ipmi_user_t user, */ spin_unlock_irqrestore(&(intf->seq_lock), flags); } - } else if (is_lan_addr(addr)) { + } else if (addr->addr_type == IPMI_LAN_ADDR_TYPE) { struct ipmi_lan_addr *lan_addr; unsigned char ipmb_seq; long seqid; @@ -1712,6 +1696,8 @@ static int i_ipmi_request(ipmi_user_t user, spin_lock_irqsave(&(intf->seq_lock), flags); + ipmi_inc_stat(intf, sent_lan_commands); + /* * Create a sequence number with a 1 second * timeout and 4 retries. @@ -1733,8 +1719,6 @@ static int i_ipmi_request(ipmi_user_t user, goto out_err; } - ipmi_inc_stat(intf, sent_lan_commands); - /* * Store the sequence number in the message, * so that when the send message response @@ -1953,10 +1937,6 @@ static int stat_file_read_proc(char *page, char **start, off_t off, ipmi_get_stat(intf, invalid_events)); out += sprintf(out, "events: %u\n", ipmi_get_stat(intf, events)); - out += sprintf(out, "failed rexmit LAN msgs: %u\n", - ipmi_get_stat(intf, dropped_rexmit_lan_commands)); - out += sprintf(out, "failed rexmit IPMB msgs: %u\n", - ipmi_get_stat(intf, dropped_rexmit_ipmb_commands)); return (out - ((char *) page)); } @@ -3284,114 +3264,6 @@ static int handle_lan_get_msg_cmd(ipmi_smi_t intf, return rv; } -/* - * This routine will handle "Get Message" command responses with - * channels that use an OEM Medium. The message format belongs to - * the OEM. See IPMI 2.0 specification, Chapter 6 and - * Chapter 22, sections 22.6 and 22.24 for more details. - */ -static int handle_oem_get_msg_cmd(ipmi_smi_t intf, - struct ipmi_smi_msg *msg) -{ - struct cmd_rcvr *rcvr; - int rv = 0; - unsigned char netfn; - unsigned char cmd; - unsigned char chan; - ipmi_user_t user = NULL; - struct ipmi_system_interface_addr *smi_addr; - struct ipmi_recv_msg *recv_msg; - - /* - * We expect the OEM SW to perform error checking - * so we just do some basic sanity checks - */ - if (msg->rsp_size < 4) { - /* Message not big enough, just ignore it. */ - ipmi_inc_stat(intf, invalid_commands); - return 0; - } - - if (msg->rsp[2] != 0) { - /* An error getting the response, just ignore it. */ - return 0; - } - - /* - * This is an OEM Message so the OEM needs to know how - * handle the message. We do no interpretation. - */ - netfn = msg->rsp[0] >> 2; - cmd = msg->rsp[1]; - chan = msg->rsp[3] & 0xf; - - rcu_read_lock(); - rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); - if (rcvr) { - user = rcvr->user; - kref_get(&user->refcount); - } else - user = NULL; - rcu_read_unlock(); - - if (user == NULL) { - /* We didn't find a user, just give up. */ - ipmi_inc_stat(intf, unhandled_commands); - - /* - * Don't do anything with these messages, just allow - * them to be freed. - */ - - rv = 0; - } else { - /* Deliver the message to the user. */ - ipmi_inc_stat(intf, handled_commands); - - recv_msg = ipmi_alloc_recv_msg(); - if (!recv_msg) { - /* - * We couldn't allocate memory for the - * message, so requeue it for handling - * later. - */ - rv = 1; - kref_put(&user->refcount, free_user); - } else { - /* - * OEM Messages are expected to be delivered via - * the system interface to SMS software. We might - * need to visit this again depending on OEM - * requirements - */ - smi_addr = ((struct ipmi_system_interface_addr *) - &(recv_msg->addr)); - smi_addr->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; - smi_addr->channel = IPMI_BMC_CHANNEL; - smi_addr->lun = msg->rsp[0] & 3; - - recv_msg->user = user; - recv_msg->user_msg_data = NULL; - recv_msg->recv_type = IPMI_OEM_RECV_TYPE; - recv_msg->msg.netfn = msg->rsp[0] >> 2; - recv_msg->msg.cmd = msg->rsp[1]; - recv_msg->msg.data = recv_msg->msg_data; - - /* - * The message starts at byte 4 which follows the - * the Channel Byte in the "GET MESSAGE" command - */ - recv_msg->msg.data_len = msg->rsp_size - 4; - memcpy(recv_msg->msg_data, - &(msg->rsp[4]), - msg->rsp_size - 4); - deliver_response(recv_msg); - } - } - - return rv; -} - static void copy_event_into_recv_msg(struct ipmi_recv_msg *recv_msg, struct ipmi_smi_msg *msg) { @@ -3647,17 +3519,6 @@ static int handle_new_recv_msg(ipmi_smi_t intf, goto out; } - /* - ** We need to make sure the channels have been initialized. - ** The channel_handler routine will set the "curr_channel" - ** equal to or greater than IPMI_MAX_CHANNELS when all the - ** channels for this interface have been initialized. - */ - if (intf->curr_channel < IPMI_MAX_CHANNELS) { - requeue = 1; /* Just put the message back for now */ - goto out; - } - switch (intf->channels[chan].medium) { case IPMI_CHANNEL_MEDIUM_IPMB: if (msg->rsp[4] & 0x04) { @@ -3693,20 +3554,11 @@ static int handle_new_recv_msg(ipmi_smi_t intf, break; default: - /* Check for OEM Channels. Clients had better - register for these commands. */ - if ((intf->channels[chan].medium - >= IPMI_CHANNEL_MEDIUM_OEM_MIN) - && (intf->channels[chan].medium - <= IPMI_CHANNEL_MEDIUM_OEM_MAX)) { - requeue = handle_oem_get_msg_cmd(intf, msg); - } else { - /* - * We don't handle the channel type, so just - * free the message. - */ - requeue = 0; - } + /* + * We don't handle the channel type, so just + * free the message. + */ + requeue = 0; } } else if ((msg->rsp[0] == ((IPMI_NETFN_APP_REQUEST|1) << 2)) @@ -3878,7 +3730,7 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, list_add_tail(&msg->link, timeouts); if (ent->broadcast) ipmi_inc_stat(intf, timed_out_ipmb_broadcasts); - else if (is_lan_addr(&ent->recv_msg->addr)) + else if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE) ipmi_inc_stat(intf, timed_out_lan_commands); else ipmi_inc_stat(intf, timed_out_ipmb_commands); @@ -3892,17 +3744,15 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, */ ent->timeout = MAX_MSG_TIMEOUT; ent->retries_left--; + if (ent->recv_msg->addr.addr_type == IPMI_LAN_ADDR_TYPE) + ipmi_inc_stat(intf, retransmitted_lan_commands); + else + ipmi_inc_stat(intf, retransmitted_ipmb_commands); + smi_msg = smi_from_recv_msg(intf, ent->recv_msg, slot, ent->seqid); - if (!smi_msg) { - if (is_lan_addr(&ent->recv_msg->addr)) - ipmi_inc_stat(intf, - dropped_rexmit_lan_commands); - else - ipmi_inc_stat(intf, - dropped_rexmit_ipmb_commands); + if (!smi_msg) return; - } spin_unlock_irqrestore(&intf->seq_lock, *flags); @@ -3914,17 +3764,10 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent, * resent. */ handlers = intf->handlers; - if (handlers) { - if (is_lan_addr(&ent->recv_msg->addr)) - ipmi_inc_stat(intf, - retransmitted_lan_commands); - else - ipmi_inc_stat(intf, - retransmitted_ipmb_commands); - + if (handlers) intf->handlers->sender(intf->send_info, smi_msg, 0); - } else + else ipmi_free_smi_msg(smi_msg); spin_lock_irqsave(&intf->seq_lock, *flags); diff --git a/trunk/drivers/char/ipmi/ipmi_si_intf.c b/trunk/drivers/char/ipmi/ipmi_si_intf.c index 259644646b82..e58ea4cd55ce 100644 --- a/trunk/drivers/char/ipmi/ipmi_si_intf.c +++ b/trunk/drivers/char/ipmi/ipmi_si_intf.c @@ -82,6 +82,12 @@ #define SI_SHORT_TIMEOUT_USEC 250 /* .25ms when the SM request a short timeout */ +/* Bit for BMC global enables. */ +#define IPMI_BMC_RCV_MSG_INTR 0x01 +#define IPMI_BMC_EVT_MSG_INTR 0x02 +#define IPMI_BMC_EVT_MSG_BUFF 0x04 +#define IPMI_BMC_SYS_LOG 0x08 + enum si_intf_state { SI_NORMAL, SI_GETTING_FLAGS, @@ -214,9 +220,6 @@ struct smi_info { OEM2_DATA_AVAIL) unsigned char msg_flags; - /* Does the BMC have an event buffer? */ - char has_event_buffer; - /* * If set to true, this will request events the next time the * state machine is idle. @@ -965,8 +968,7 @@ static void request_events(void *send_info) { struct smi_info *smi_info = send_info; - if (atomic_read(&smi_info->stop_operation) || - !smi_info->has_event_buffer) + if (atomic_read(&smi_info->stop_operation)) return; atomic_set(&smi_info->req_events, 1); @@ -2405,38 +2407,13 @@ static struct of_platform_driver ipmi_of_platform_driver = { }; #endif /* CONFIG_PPC_OF */ -static int wait_for_msg_done(struct smi_info *smi_info) -{ - enum si_sm_result smi_result; - - smi_result = smi_info->handlers->event(smi_info->si_sm, 0); - for (;;) { - if (smi_result == SI_SM_CALL_WITH_DELAY || - smi_result == SI_SM_CALL_WITH_TICK_DELAY) { - schedule_timeout_uninterruptible(1); - smi_result = smi_info->handlers->event( - smi_info->si_sm, 100); - } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { - smi_result = smi_info->handlers->event( - smi_info->si_sm, 0); - } else - break; - } - if (smi_result == SI_SM_HOSED) - /* - * We couldn't get the state machine to run, so whatever's at - * the port is probably not an IPMI SMI interface. - */ - return -ENODEV; - - return 0; -} static int try_get_dev_id(struct smi_info *smi_info) { unsigned char msg[2]; unsigned char *resp; unsigned long resp_len; + enum si_sm_result smi_result; int rv = 0; resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); @@ -2451,98 +2428,35 @@ static int try_get_dev_id(struct smi_info *smi_info) msg[1] = IPMI_GET_DEVICE_ID_CMD; smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); - rv = wait_for_msg_done(smi_info); - if (rv) - goto out; - - resp_len = smi_info->handlers->get_result(smi_info->si_sm, - resp, IPMI_MAX_MSG_LENGTH); - - /* Check and record info from the get device id, in case we need it. */ - rv = ipmi_demangle_device_id(resp, resp_len, &smi_info->device_id); - - out: - kfree(resp); - return rv; -} - -static int try_enable_event_buffer(struct smi_info *smi_info) -{ - unsigned char msg[3]; - unsigned char *resp; - unsigned long resp_len; - int rv = 0; - - resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL); - if (!resp) - return -ENOMEM; - - msg[0] = IPMI_NETFN_APP_REQUEST << 2; - msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD; - smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); - - rv = wait_for_msg_done(smi_info); - if (rv) { - printk(KERN_WARNING - "ipmi_si: Error getting response from get global," - " enables command, the event buffer is not" - " enabled.\n"); - goto out; - } - - resp_len = smi_info->handlers->get_result(smi_info->si_sm, - resp, IPMI_MAX_MSG_LENGTH); - - if (resp_len < 4 || - resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || - resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || - resp[2] != 0) { - printk(KERN_WARNING - "ipmi_si: Invalid return from get global" - " enables command, cannot enable the event" - " buffer.\n"); - rv = -EINVAL; - goto out; + smi_result = smi_info->handlers->event(smi_info->si_sm, 0); + for (;;) { + if (smi_result == SI_SM_CALL_WITH_DELAY || + smi_result == SI_SM_CALL_WITH_TICK_DELAY) { + schedule_timeout_uninterruptible(1); + smi_result = smi_info->handlers->event( + smi_info->si_sm, 100); + } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { + smi_result = smi_info->handlers->event( + smi_info->si_sm, 0); + } else + break; } - - if (resp[3] & IPMI_BMC_EVT_MSG_BUFF) - /* buffer is already enabled, nothing to do. */ - goto out; - - msg[0] = IPMI_NETFN_APP_REQUEST << 2; - msg[1] = IPMI_SET_BMC_GLOBAL_ENABLES_CMD; - msg[2] = resp[3] | IPMI_BMC_EVT_MSG_BUFF; - smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); - - rv = wait_for_msg_done(smi_info); - if (rv) { - printk(KERN_WARNING - "ipmi_si: Error getting response from set global," - " enables command, the event buffer is not" - " enabled.\n"); + if (smi_result == SI_SM_HOSED) { + /* + * We couldn't get the state machine to run, so whatever's at + * the port is probably not an IPMI SMI interface. + */ + rv = -ENODEV; goto out; } + /* Otherwise, we got some data. */ resp_len = smi_info->handlers->get_result(smi_info->si_sm, resp, IPMI_MAX_MSG_LENGTH); - if (resp_len < 3 || - resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || - resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { - printk(KERN_WARNING - "ipmi_si: Invalid return from get global," - "enables command, not enable the event" - " buffer.\n"); - rv = -EINVAL; - goto out; - } + /* Check and record info from the get device id, in case we need it. */ + rv = ipmi_demangle_device_id(resp, resp_len, &smi_info->device_id); - if (resp[2] != 0) - /* - * An error when setting the event buffer bit means - * that the event buffer is not supported. - */ - rv = -ENOENT; out: kfree(resp); return rv; @@ -2933,10 +2847,6 @@ static int try_smi_init(struct smi_info *new_smi) new_smi->intf_num = smi_num; smi_num++; - rv = try_enable_event_buffer(new_smi); - if (rv == 0) - new_smi->has_event_buffer = 1; - /* * Start clearing the flags before we enable interrupts or the * timer to avoid racing with the timer. @@ -2953,7 +2863,7 @@ static int try_smi_init(struct smi_info *new_smi) */ new_smi->pdev = platform_device_alloc("ipmi_si", new_smi->intf_num); - if (!new_smi->pdev) { + if (rv) { printk(KERN_ERR "ipmi_si_intf:" " Unable to allocate platform device\n"); diff --git a/trunk/drivers/clocksource/acpi_pm.c b/trunk/drivers/clocksource/acpi_pm.c index 40bd8c61c7d7..ee19b6e8fcb4 100644 --- a/trunk/drivers/clocksource/acpi_pm.c +++ b/trunk/drivers/clocksource/acpi_pm.c @@ -57,7 +57,7 @@ u32 acpi_pm_read_verified(void) return v2; } -static cycle_t acpi_pm_read(struct clocksource *cs) +static cycle_t acpi_pm_read(void) { return (cycle_t)read_pmtmr(); } @@ -83,7 +83,7 @@ static int __init acpi_pm_good_setup(char *__str) } __setup("acpi_pm_good", acpi_pm_good_setup); -static cycle_t acpi_pm_read_slow(struct clocksource *cs) +static cycle_t acpi_pm_read_slow(void) { return (cycle_t)acpi_pm_read_verified(); } @@ -156,9 +156,9 @@ static int verify_pmtmr_rate(void) unsigned long count, delta; mach_prepare_counter(); - value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); + value1 = clocksource_acpi_pm.read(); mach_countup(&count); - value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); + value2 = clocksource_acpi_pm.read(); delta = (value2 - value1) & ACPI_PM_MASK; /* Check that the PMTMR delta is within 5% of what we expect */ @@ -195,9 +195,9 @@ static int __init init_acpi_pm_clocksource(void) /* "verify" this timing source: */ for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { udelay(100 * j); - value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); + value1 = clocksource_acpi_pm.read(); for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { - value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); + value2 = clocksource_acpi_pm.read(); if (value2 == value1) continue; if (value2 > value1) diff --git a/trunk/drivers/clocksource/cyclone.c b/trunk/drivers/clocksource/cyclone.c index 64e528e8bfa6..8615059a8729 100644 --- a/trunk/drivers/clocksource/cyclone.c +++ b/trunk/drivers/clocksource/cyclone.c @@ -19,7 +19,7 @@ int use_cyclone = 0; static void __iomem *cyclone_ptr; -static cycle_t read_cyclone(struct clocksource *cs) +static cycle_t read_cyclone(void) { return (cycle_t)readl(cyclone_ptr); } diff --git a/trunk/drivers/clocksource/scx200_hrt.c b/trunk/drivers/clocksource/scx200_hrt.c index 27f4d9637b62..b92da677aa5d 100644 --- a/trunk/drivers/clocksource/scx200_hrt.c +++ b/trunk/drivers/clocksource/scx200_hrt.c @@ -43,7 +43,7 @@ MODULE_PARM_DESC(ppm, "+-adjust to actual XO freq (ppm)"); /* The base timer frequency, * 27 if selected */ #define HRT_FREQ 1000000 -static cycle_t read_hrt(struct clocksource *cs) +static cycle_t read_hrt(void) { /* Read the timer value */ return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET); diff --git a/trunk/drivers/clocksource/tcb_clksrc.c b/trunk/drivers/clocksource/tcb_clksrc.c index 01b886e68822..254f1064d973 100644 --- a/trunk/drivers/clocksource/tcb_clksrc.c +++ b/trunk/drivers/clocksource/tcb_clksrc.c @@ -39,7 +39,7 @@ static void __iomem *tcaddr; -static cycle_t tc_get_cycles(struct clocksource *cs) +static cycle_t tc_get_cycles(void) { unsigned long flags; u32 lower, upper; diff --git a/trunk/drivers/edac/mpc85xx_edac.c b/trunk/drivers/edac/mpc85xx_edac.c index 7c8c2d72916f..4637a4a757df 100644 --- a/trunk/drivers/edac/mpc85xx_edac.c +++ b/trunk/drivers/edac/mpc85xx_edac.c @@ -674,7 +674,7 @@ static void mpc85xx_mc_check(struct mem_ctl_info *mci) int row_index; err_detect = in_be32(pdata->mc_vbase + MPC85XX_MC_ERR_DETECT); - if (!err_detect) + if (err_detect) return; mpc85xx_mc_printk(mci, KERN_ERR, "Err Detect Register: %#8.8x\n", diff --git a/trunk/drivers/gpu/drm/drm_stub.c b/trunk/drivers/gpu/drm/drm_stub.c index ef878615c49f..d009661781bc 100644 --- a/trunk/drivers/gpu/drm/drm_stub.c +++ b/trunk/drivers/gpu/drm/drm_stub.c @@ -159,9 +159,6 @@ void drm_master_put(struct drm_master **master) int drm_setmaster_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { - if (file_priv->is_master) - return 0; - if (file_priv->minor->master && file_priv->minor->master != file_priv->master) return -EINVAL; @@ -172,7 +169,6 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, file_priv->minor->master != file_priv->master) { mutex_lock(&dev->struct_mutex); file_priv->minor->master = drm_master_get(file_priv->master); - file_priv->is_master = 1; mutex_unlock(&dev->struct_mutex); } @@ -182,15 +178,10 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, int drm_dropmaster_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { - if (!file_priv->is_master) - return -EINVAL; - - if (!file_priv->minor->master) + if (!file_priv->master) return -EINVAL; - mutex_lock(&dev->struct_mutex); drm_master_put(&file_priv->minor->master); - file_priv->is_master = 0; mutex_unlock(&dev->struct_mutex); return 0; } diff --git a/trunk/drivers/gpu/drm/drm_sysfs.c b/trunk/drivers/gpu/drm/drm_sysfs.c index 022876ae34f0..bc0c6849360c 100644 --- a/trunk/drivers/gpu/drm/drm_sysfs.c +++ b/trunk/drivers/gpu/drm/drm_sysfs.c @@ -132,7 +132,6 @@ void drm_sysfs_destroy(void) */ static void drm_sysfs_device_release(struct device *dev) { - memset(dev, 0, sizeof(struct device)); return; } diff --git a/trunk/drivers/gpu/drm/via/via_dma.c b/trunk/drivers/gpu/drm/via/via_dma.c index bfb92d283260..7a339dba6a69 100644 --- a/trunk/drivers/gpu/drm/via/via_dma.c +++ b/trunk/drivers/gpu/drm/via/via_dma.c @@ -481,13 +481,11 @@ static int via_wait_idle(drm_via_private_t * dev_priv) { int count = 10000000; - while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && --count) - ; + while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && count--); - while (count && (VIA_READ(VIA_REG_STATUS) & + while (count-- && (VIA_READ(VIA_REG_STATUS) & (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | - VIA_3D_ENG_BUSY))) - --count; + VIA_3D_ENG_BUSY))) ; return count; } @@ -707,7 +705,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * switch (d_siz->func) { case VIA_CMDBUF_SPACE: while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size) - && --count) { + && count--) { if (!d_siz->wait) { break; } @@ -719,7 +717,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * break; case VIA_CMDBUF_LAG: while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size) - && --count) { + && count--) { if (!d_siz->wait) { break; } diff --git a/trunk/drivers/input/serio/hp_sdc.c b/trunk/drivers/input/serio/hp_sdc.c index 1c9410d1822c..bfe49243f38b 100644 --- a/trunk/drivers/input/serio/hp_sdc.c +++ b/trunk/drivers/input/serio/hp_sdc.c @@ -819,7 +819,6 @@ static const struct parisc_device_id hp_sdc_tbl[] = { MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); static int __init hp_sdc_init_hppa(struct parisc_device *d); -static struct delayed_work moduleloader_work; static struct parisc_driver hp_sdc_driver = { .name = "hp_sdc", @@ -931,15 +930,8 @@ static int __init hp_sdc_init(void) #if defined(__hppa__) -static void request_module_delayed(struct work_struct *work) -{ - request_module("hp_sdc_mlc"); -} - static int __init hp_sdc_init_hppa(struct parisc_device *d) { - int ret; - if (!d) return 1; if (hp_sdc.dev != NULL) @@ -952,26 +944,13 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d) hp_sdc.data_io = d->hpa.start + 0x800; hp_sdc.status_io = d->hpa.start + 0x801; - INIT_DELAYED_WORK(&moduleloader_work, request_module_delayed); - - ret = hp_sdc_init(); - /* after sucessfull initialization give SDC some time to settle - * and then load the hp_sdc_mlc upper layer driver */ - if (!ret) - schedule_delayed_work(&moduleloader_work, - msecs_to_jiffies(2000)); - - return ret; + return hp_sdc_init(); } #endif /* __hppa__ */ static void hp_sdc_exit(void) { - /* do nothing if we don't have a SDC */ - if (!hp_sdc.dev) - return; - write_lock_irq(&hp_sdc.lock); /* Turn off all maskable "sub-function" irq's. */ @@ -990,7 +969,6 @@ static void hp_sdc_exit(void) tasklet_kill(&hp_sdc.task); #if defined(__hppa__) - cancel_delayed_work_sync(&moduleloader_work); if (unregister_parisc_driver(&hp_sdc_driver)) printk(KERN_WARNING PREFIX "Error unregistering HP SDC"); #endif diff --git a/trunk/drivers/md/bitmap.c b/trunk/drivers/md/bitmap.c index 1fb91edc7de2..f8a9f7ab2cb8 100644 --- a/trunk/drivers/md/bitmap.c +++ b/trunk/drivers/md/bitmap.c @@ -1479,7 +1479,6 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector) s += blocks; } bitmap->last_end_sync = jiffies; - sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed"); } static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int needed) @@ -1590,7 +1589,7 @@ void bitmap_destroy(mddev_t *mddev) int bitmap_create(mddev_t *mddev) { struct bitmap *bitmap; - sector_t blocks = mddev->resync_max_sectors; + unsigned long blocks = mddev->resync_max_sectors; unsigned long chunks; unsigned long pages; struct file *file = mddev->bitmap_file; @@ -1632,8 +1631,8 @@ int bitmap_create(mddev_t *mddev) bitmap->chunkshift = ffz(~bitmap->chunksize); /* now that chunksize and chunkshift are set, we can use these macros */ - chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >> - CHUNK_BLOCK_SHIFT(bitmap); + chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) / + CHUNK_BLOCK_RATIO(bitmap); pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; BUG_ON(!pages); diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index 612343fdde94..ed5727c089a9 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -2017,8 +2017,6 @@ static void md_update_sb(mddev_t * mddev, int force_change) clear_bit(MD_CHANGE_PENDING, &mddev->flags); spin_unlock_irq(&mddev->write_lock); wake_up(&mddev->sb_wait); - if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) - sysfs_notify(&mddev->kobj, NULL, "sync_completed"); } @@ -2088,7 +2086,6 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) * -writemostly - clears write_mostly * blocked - sets the Blocked flag * -blocked - clears the Blocked flag - * insync - sets Insync providing device isn't active */ int err = -EINVAL; if (cmd_match(buf, "faulty") && rdev->mddev->pers) { @@ -2120,9 +2117,6 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) set_bit(MD_RECOVERY_NEEDED, &rdev->mddev->recovery); md_wakeup_thread(rdev->mddev->thread); - err = 0; - } else if (cmd_match(buf, "insync") && rdev->raid_disk == -1) { - set_bit(In_sync, &rdev->flags); err = 0; } if (!err && rdev->sysfs_state) @@ -2196,7 +2190,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) } else if (rdev->mddev->pers) { mdk_rdev_t *rdev2; /* Activating a spare .. or possibly reactivating - * if we ever get bitmaps working here. + * if we every get bitmaps working here. */ if (rdev->raid_disk != -1) @@ -3488,15 +3482,12 @@ sync_completed_show(mddev_t *mddev, char *page) { unsigned long max_sectors, resync; - if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) - return sprintf(page, "none\n"); - if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) max_sectors = mddev->resync_max_sectors; else max_sectors = mddev->dev_sectors; - resync = mddev->curr_resync_completed; + resync = (mddev->curr_resync - atomic_read(&mddev->recovery_active)); return sprintf(page, "%lu / %lu\n", resync, max_sectors); } @@ -6343,13 +6334,18 @@ void md_do_sync(mddev_t *mddev) sector_t sectors; skipped = 0; + if (j >= mddev->resync_max) { + sysfs_notify(&mddev->kobj, NULL, "sync_completed"); + wait_event(mddev->recovery_wait, + mddev->resync_max > j + || kthread_should_stop()); + } + if (kthread_should_stop()) + goto interrupted; - if ((mddev->curr_resync > mddev->curr_resync_completed && - (mddev->curr_resync - mddev->curr_resync_completed) - > (max_sectors >> 4)) || - (j - mddev->curr_resync_completed)*2 - >= mddev->resync_max - mddev->curr_resync_completed - ) { + if (mddev->curr_resync > mddev->curr_resync_completed && + (mddev->curr_resync - mddev->curr_resync_completed) + > (max_sectors >> 4)) { /* time to update curr_resync_completed */ blk_unplug(mddev->queue); wait_event(mddev->recovery_wait, @@ -6357,17 +6353,7 @@ void md_do_sync(mddev_t *mddev) mddev->curr_resync_completed = mddev->curr_resync; set_bit(MD_CHANGE_CLEAN, &mddev->flags); - sysfs_notify(&mddev->kobj, NULL, "sync_completed"); } - - if (j >= mddev->resync_max) - wait_event(mddev->recovery_wait, - mddev->resync_max > j - || kthread_should_stop()); - - if (kthread_should_stop()) - goto interrupted; - sectors = mddev->pers->sync_request(mddev, j, &skipped, currspeed < speed_min(mddev)); if (sectors == 0) { @@ -6475,7 +6461,6 @@ void md_do_sync(mddev_t *mddev) skip: mddev->curr_resync = 0; - mddev->curr_resync_completed = 0; mddev->resync_min = 0; mddev->resync_max = MaxSector; sysfs_notify(&mddev->kobj, NULL, "sync_completed"); diff --git a/trunk/drivers/md/md.h b/trunk/drivers/md/md.h index 8227ab909d44..e9b7f54c24d6 100644 --- a/trunk/drivers/md/md.h +++ b/trunk/drivers/md/md.h @@ -12,17 +12,10 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _MD_MD_H -#define _MD_MD_H - -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef _MD_K_H +#define _MD_K_H + +#ifdef CONFIG_BLOCK #define MaxSector (~(sector_t)0) @@ -415,6 +408,10 @@ static inline void safe_put_page(struct page *p) if (p) put_page(p); } +#endif /* CONFIG_BLOCK */ +#endif + + extern int register_md_personality(struct mdk_personality *p); extern int unregister_md_personality(struct mdk_personality *p); extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev), @@ -437,5 +434,3 @@ extern void md_new_event(mddev_t *mddev); extern int md_allow_write(mddev_t *mddev); extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev); extern void md_set_array_sectors(mddev_t *mddev, sector_t array_sectors); - -#endif /* _MD_MD_H */ diff --git a/trunk/drivers/md/raid5.c b/trunk/drivers/md/raid5.c index 4616bc3a6e71..3bbc6d647044 100644 --- a/trunk/drivers/md/raid5.c +++ b/trunk/drivers/md/raid5.c @@ -3845,7 +3845,6 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped wait_event(conf->wait_for_overlap, atomic_read(&conf->reshape_stripes)==0); mddev->reshape_position = conf->reshape_progress; - mddev->curr_resync_completed = mddev->curr_resync; conf->reshape_checkpoint = jiffies; set_bit(MD_CHANGE_DEVS, &mddev->flags); md_wakeup_thread(mddev->thread); @@ -3855,7 +3854,6 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped conf->reshape_safe = mddev->reshape_position; spin_unlock_irq(&conf->device_lock); wake_up(&conf->wait_for_overlap); - sysfs_notify(&mddev->kobj, NULL, "sync_completed"); } if (mddev->delta_disks < 0) { @@ -3940,13 +3938,11 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped * then we need to write out the superblock. */ sector_nr += reshape_sectors; - if ((sector_nr - mddev->curr_resync_completed) * 2 - >= mddev->resync_max - mddev->curr_resync_completed) { + if (sector_nr >= mddev->resync_max) { /* Cannot proceed until we've updated the superblock... */ wait_event(conf->wait_for_overlap, atomic_read(&conf->reshape_stripes) == 0); mddev->reshape_position = conf->reshape_progress; - mddev->curr_resync_completed = mddev->curr_resync; conf->reshape_checkpoint = jiffies; set_bit(MD_CHANGE_DEVS, &mddev->flags); md_wakeup_thread(mddev->thread); @@ -3957,7 +3953,6 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped conf->reshape_safe = mddev->reshape_position; spin_unlock_irq(&conf->device_lock); wake_up(&conf->wait_for_overlap); - sysfs_notify(&mddev->kobj, NULL, "sync_completed"); } return reshape_sectors; } diff --git a/trunk/drivers/message/fusion/mptbase.c b/trunk/drivers/message/fusion/mptbase.c index 5d496a99e034..d0d126c69354 100644 --- a/trunk/drivers/message/fusion/mptbase.c +++ b/trunk/drivers/message/fusion/mptbase.c @@ -5934,7 +5934,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) /* Initalize the timer */ - init_timer_on_stack(&pCfg->timer); + init_timer(&pCfg->timer); pCfg->timer.data = (unsigned long) ioc; pCfg->timer.function = mpt_timer_expired; pCfg->wait_done = 0; diff --git a/trunk/drivers/misc/sgi-gru/grufile.c b/trunk/drivers/misc/sgi-gru/grufile.c index bbefe77c67a9..3e6e42d2f01b 100644 --- a/trunk/drivers/misc/sgi-gru/grufile.c +++ b/trunk/drivers/misc/sgi-gru/grufile.c @@ -375,7 +375,7 @@ static int __init gru_init(void) void *gru_start_vaddr; if (!is_uv_system()) - return 0; + return -ENODEV; #if defined CONFIG_IA64 gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */ diff --git a/trunk/drivers/misc/sgi-xp/xp_main.c b/trunk/drivers/misc/sgi-xp/xp_main.c index 7896849b16dc..16f8dcab2da4 100644 --- a/trunk/drivers/misc/sgi-xp/xp_main.c +++ b/trunk/drivers/misc/sgi-xp/xp_main.c @@ -248,19 +248,19 @@ xp_init(void) enum xp_retval ret; int ch_number; - /* initialize the connection registration mutex */ - for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) - mutex_init(&xpc_registrations[ch_number].mutex); - if (is_shub()) ret = xp_init_sn2(); else if (is_uv()) ret = xp_init_uv(); else - ret = 0; + ret = xpUnsupported; if (ret != xpSuccess) - return ret; + return -ENODEV; + + /* initialize the connection registration mutex */ + for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) + mutex_init(&xpc_registrations[ch_number].mutex); return 0; } diff --git a/trunk/drivers/platform/x86/sony-laptop.c b/trunk/drivers/platform/x86/sony-laptop.c index 552958545f94..d3c92d777bde 100644 --- a/trunk/drivers/platform/x86/sony-laptop.c +++ b/trunk/drivers/platform/x86/sony-laptop.c @@ -317,8 +317,7 @@ static void sony_laptop_report_input_event(u8 event) struct input_dev *key_dev = sony_laptop_input.key_dev; struct sony_laptop_keypress kp = { NULL }; - if (event == SONYPI_EVENT_FNKEY_RELEASED || - event == SONYPI_EVENT_ANYBUTTON_RELEASED) { + if (event == SONYPI_EVENT_FNKEY_RELEASED) { /* Nothing, not all VAIOs generate this event */ return; } @@ -906,6 +905,7 @@ static struct sony_nc_event sony_127_events[] = { { 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0x86, SONYPI_EVENT_PKEY_P5 }, { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, + { 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED }, { 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED }, { 0, 0 }, @@ -1004,7 +1004,6 @@ static int sony_nc_function_setup(struct acpi_device *device) sony_call_snc_handle(0x0100, 0, &result); sony_call_snc_handle(0x0101, 0, &result); sony_call_snc_handle(0x0102, 0x100, &result); - sony_call_snc_handle(0x0127, 0, &result); return 0; } @@ -1041,7 +1040,7 @@ static int sony_nc_resume(struct acpi_device *device) /* set the last requested brightness level */ if (sony_backlight_device && - sony_backlight_update_status(sony_backlight_device) < 0) + !sony_backlight_update_status(sony_backlight_device)) printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n"); return 0; @@ -1103,11 +1102,8 @@ static int sony_nc_setup_wifi_rfkill(struct acpi_device *device) err = rfkill_register(sony_wifi_rfkill); if (err) rfkill_free(sony_wifi_rfkill); - else { + else sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill; - sony_nc_rfkill_set(sony_wifi_rfkill->data, - RFKILL_STATE_UNBLOCKED); - } return err; } @@ -1128,11 +1124,8 @@ static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device) err = rfkill_register(sony_bluetooth_rfkill); if (err) rfkill_free(sony_bluetooth_rfkill); - else { + else sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill; - sony_nc_rfkill_set(sony_bluetooth_rfkill->data, - RFKILL_STATE_UNBLOCKED); - } return err; } @@ -1152,11 +1145,8 @@ static int sony_nc_setup_wwan_rfkill(struct acpi_device *device) err = rfkill_register(sony_wwan_rfkill); if (err) rfkill_free(sony_wwan_rfkill); - else { + else sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill; - sony_nc_rfkill_set(sony_wwan_rfkill->data, - RFKILL_STATE_UNBLOCKED); - } return err; } @@ -1176,11 +1166,8 @@ static int sony_nc_setup_wimax_rfkill(struct acpi_device *device) err = rfkill_register(sony_wimax_rfkill); if (err) rfkill_free(sony_wimax_rfkill); - else { + else sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill; - sony_nc_rfkill_set(sony_wimax_rfkill->data, - RFKILL_STATE_UNBLOCKED); - } return err; } diff --git a/trunk/drivers/platform/x86/thinkpad_acpi.c b/trunk/drivers/platform/x86/thinkpad_acpi.c index 912be65b6261..a40b075743d9 100644 --- a/trunk/drivers/platform/x86/thinkpad_acpi.c +++ b/trunk/drivers/platform/x86/thinkpad_acpi.c @@ -21,7 +21,7 @@ * 02110-1301, USA. */ -#define TPACPI_VERSION "0.23" +#define TPACPI_VERSION "0.22" #define TPACPI_SYSFS_VERSION 0x020300 /* @@ -303,17 +303,11 @@ static u32 dbg_level; static struct workqueue_struct *tpacpi_wq; -enum led_status_t { - TPACPI_LED_OFF = 0, - TPACPI_LED_ON, - TPACPI_LED_BLINK, -}; - /* Special LED class that can defer work */ struct tpacpi_led_classdev { struct led_classdev led_classdev; struct work_struct work; - enum led_status_t new_state; + enum led_brightness new_brightness; unsigned int led; }; @@ -2952,18 +2946,12 @@ static int hotkey_read(char *p) return len; } -static void hotkey_enabledisable_warn(bool enable) +static void hotkey_enabledisable_warn(void) { tpacpi_log_usertask("procfs hotkey enable/disable"); - if (!WARN((tpacpi_lifecycle == TPACPI_LIFE_RUNNING || !enable), - TPACPI_WARN - "hotkey enable/disable functionality has been " - "removed from the driver. Hotkeys are always " - "enabled\n")) - printk(TPACPI_ERR - "Please remove the hotkey=enable module " - "parameter, it is deprecated. Hotkeys are always " - "enabled\n"); + WARN(1, TPACPI_WARN + "hotkey enable/disable functionality has been " + "removed from the driver. Hotkeys are always enabled.\n"); } static int hotkey_write(char *buf) @@ -2983,9 +2971,9 @@ static int hotkey_write(char *buf) res = 0; while ((cmd = next_cmd(&buf))) { if (strlencmp(cmd, "enable") == 0) { - hotkey_enabledisable_warn(1); + hotkey_enabledisable_warn(); } else if (strlencmp(cmd, "disable") == 0) { - hotkey_enabledisable_warn(0); + hotkey_enabledisable_warn(); res = -EPERM; } else if (strlencmp(cmd, "reset") == 0) { mask = hotkey_orig_mask; @@ -4219,7 +4207,7 @@ static void light_set_status_worker(struct work_struct *work) container_of(work, struct tpacpi_led_classdev, work); if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) - light_set_status((data->new_state != TPACPI_LED_OFF)); + light_set_status((data->new_brightness != LED_OFF)); } static void light_sysfs_set(struct led_classdev *led_cdev, @@ -4229,8 +4217,7 @@ static void light_sysfs_set(struct led_classdev *led_cdev, container_of(led_cdev, struct tpacpi_led_classdev, led_classdev); - data->new_state = (brightness != LED_OFF) ? - TPACPI_LED_ON : TPACPI_LED_OFF; + data->new_brightness = brightness; queue_work(tpacpi_wq, &data->work); } @@ -4737,6 +4724,12 @@ enum { /* For TPACPI_LED_OLD */ TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ }; +enum led_status_t { + TPACPI_LED_OFF = 0, + TPACPI_LED_ON, + TPACPI_LED_BLINK, +}; + static enum led_access_mode led_supported; TPACPI_HANDLE(led, ec, "SLED", /* 570 */ @@ -4848,13 +4841,23 @@ static int led_set_status(const unsigned int led, return rc; } +static void led_sysfs_set_status(unsigned int led, + enum led_brightness brightness) +{ + led_set_status(led, + (brightness == LED_OFF) ? + TPACPI_LED_OFF : + (tpacpi_led_state_cache[led] == TPACPI_LED_BLINK) ? + TPACPI_LED_BLINK : TPACPI_LED_ON); +} + static void led_set_status_worker(struct work_struct *work) { struct tpacpi_led_classdev *data = container_of(work, struct tpacpi_led_classdev, work); if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) - led_set_status(data->led, data->new_state); + led_sysfs_set_status(data->led, data->new_brightness); } static void led_sysfs_set(struct led_classdev *led_cdev, @@ -4863,13 +4866,7 @@ static void led_sysfs_set(struct led_classdev *led_cdev, struct tpacpi_led_classdev *data = container_of(led_cdev, struct tpacpi_led_classdev, led_classdev); - if (brightness == LED_OFF) - data->new_state = TPACPI_LED_OFF; - else if (tpacpi_led_state_cache[data->led] != TPACPI_LED_BLINK) - data->new_state = TPACPI_LED_ON; - else - data->new_state = TPACPI_LED_BLINK; - + data->new_brightness = brightness; queue_work(tpacpi_wq, &data->work); } @@ -4887,7 +4884,7 @@ static int led_sysfs_blink_set(struct led_classdev *led_cdev, } else if ((*delay_on != 500) || (*delay_off != 500)) return -EINVAL; - data->new_state = TPACPI_LED_BLINK; + data->new_brightness = TPACPI_LED_BLINK; queue_work(tpacpi_wq, &data->work); return 0; @@ -7860,15 +7857,6 @@ static int __init thinkpad_acpi_module_init(void) MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); -/* - * This will autoload the driver in almost every ThinkPad - * in widespread use. - * - * Only _VERY_ old models, like the 240, 240x and 570 lack - * the HKEY event interface. - */ -MODULE_DEVICE_TABLE(acpi, ibm_htk_device_ids); - /* * DMI matching for module autoloading * @@ -7881,13 +7869,18 @@ MODULE_DEVICE_TABLE(acpi, ibm_htk_device_ids); #define IBM_BIOS_MODULE_ALIAS(__type) \ MODULE_ALIAS("dmi:bvnIBM:bvr" __type "ET??WW*") +/* Non-ancient thinkpads */ +MODULE_ALIAS("dmi:bvnIBM:*:svnIBM:*:pvrThinkPad*:rvnIBM:*"); +MODULE_ALIAS("dmi:bvnLENOVO:*:svnLENOVO:*:pvrThinkPad*:rvnLENOVO:*"); + /* Ancient thinkpad BIOSes have to be identified by * BIOS type or model number, and there are far less * BIOS types than model numbers... */ -IBM_BIOS_MODULE_ALIAS("I[MU]"); /* 570, 570e */ +IBM_BIOS_MODULE_ALIAS("I[BDHIMNOTWVYZ]"); +IBM_BIOS_MODULE_ALIAS("1[0368A-GIKM-PST]"); +IBM_BIOS_MODULE_ALIAS("K[UX-Z]"); -MODULE_AUTHOR("Borislav Deianov "); -MODULE_AUTHOR("Henrique de Moraes Holschuh "); +MODULE_AUTHOR("Borislav Deianov, Henrique de Moraes Holschuh"); MODULE_DESCRIPTION(TPACPI_DESC); MODULE_VERSION(TPACPI_VERSION); MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/rtc/Kconfig b/trunk/drivers/rtc/Kconfig index 4e9851fc1746..ffe34a12f446 100644 --- a/trunk/drivers/rtc/Kconfig +++ b/trunk/drivers/rtc/Kconfig @@ -573,7 +573,7 @@ config RTC_DRV_SA1100 config RTC_DRV_SH tristate "SuperH On-Chip RTC" - depends on RTC_CLASS && SUPERH && HAVE_CLK + depends on RTC_CLASS && SUPERH help Say Y here to enable support for the on-chip RTC found in most SuperH processors. diff --git a/trunk/drivers/rtc/rtc-cmos.c b/trunk/drivers/rtc/rtc-cmos.c index 23e10b6263d6..b6d35f50e404 100644 --- a/trunk/drivers/rtc/rtc-cmos.c +++ b/trunk/drivers/rtc/rtc-cmos.c @@ -797,15 +797,17 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) goto cleanup2; } - pr_info("%s: %s%s, %zd bytes nvram%s\n", - dev_name(&cmos_rtc.rtc->dev), - !is_valid_irq(rtc_irq) ? "no alarms" : - cmos_rtc.mon_alrm ? "alarms up to one year" : - cmos_rtc.day_alrm ? "alarms up to one month" : - "alarms up to one day", - cmos_rtc.century ? ", y3k" : "", - nvram.size, - is_hpet_enabled() ? ", hpet irqs" : ""); + pr_info("%s: alarms up to one %s%s, %zd bytes nvram%s\n", + dev_name(&cmos_rtc.rtc->dev), + is_valid_irq(rtc_irq) + ? (cmos_rtc.mon_alrm + ? "year" + : (cmos_rtc.day_alrm + ? "month" : "day")) + : "no", + cmos_rtc.century ? ", y3k" : "", + nvram.size, + is_hpet_enabled() ? ", hpet irqs" : ""); return 0; diff --git a/trunk/drivers/rtc/rtc-sh.c b/trunk/drivers/rtc/rtc-sh.c index d7310adb7152..9b1ff12bf947 100644 --- a/trunk/drivers/rtc/rtc-sh.c +++ b/trunk/drivers/rtc/rtc-sh.c @@ -1,7 +1,7 @@ /* * SuperH On-Chip RTC Support * - * Copyright (C) 2006 - 2009 Paul Mundt + * Copyright (C) 2006, 2007, 2008 Paul Mundt * Copyright (C) 2006 Jamie Lenehan * Copyright (C) 2008 Angelo Castello * @@ -25,11 +25,10 @@ #include #include #include -#include #include #define DRV_NAME "sh-rtc" -#define DRV_VERSION "0.2.2" +#define DRV_VERSION "0.2.1" #define RTC_REG(r) ((r) * rtc_reg_size) @@ -88,17 +87,16 @@ #define RCR2_START 0x01 /* Start bit */ struct sh_rtc { - void __iomem *regbase; - unsigned long regsize; - struct resource *res; - int alarm_irq; - int periodic_irq; - int carry_irq; - struct clk *clk; - struct rtc_device *rtc_dev; - spinlock_t lock; - unsigned long capabilities; /* See asm/rtc.h for cap bits */ - unsigned short periodic_freq; + void __iomem *regbase; + unsigned long regsize; + struct resource *res; + int alarm_irq; + int periodic_irq; + int carry_irq; + struct rtc_device *rtc_dev; + spinlock_t lock; + unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */ + unsigned short periodic_freq; }; static int __sh_rtc_interrupt(struct sh_rtc *rtc) @@ -296,10 +294,10 @@ static inline void sh_rtc_setaie(struct device *dev, unsigned int enable) tmp = readb(rtc->regbase + RCR1); - if (enable) - tmp |= RCR1_AIE; - else + if (!enable) tmp &= ~RCR1_AIE; + else + tmp |= RCR1_AIE; writeb(tmp, rtc->regbase + RCR1); @@ -620,7 +618,6 @@ static int sh_rtc_irq_set_freq(struct device *dev, int freq) { if (!is_power_of_2(freq)) return -EINVAL; - return sh_rtc_ioctl(dev, RTC_IRQP_SET, freq); } @@ -640,8 +637,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) struct sh_rtc *rtc; struct resource *res; struct rtc_time r; - char clk_name[6]; - int clk_id, ret; + int ret; rtc = kzalloc(sizeof(struct sh_rtc), GFP_KERNEL); if (unlikely(!rtc)) @@ -656,7 +652,6 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "No IRQ resource\n"); goto err_badres; } - rtc->periodic_irq = ret; rtc->carry_irq = platform_get_irq(pdev, 1); rtc->alarm_irq = platform_get_irq(pdev, 2); @@ -668,7 +663,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) goto err_badres; } - rtc->regsize = resource_size(res); + rtc->regsize = res->end - res->start + 1; rtc->res = request_mem_region(res->start, rtc->regsize, pdev->name); if (unlikely(!rtc->res)) { @@ -682,26 +677,6 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) goto err_badmap; } - clk_id = pdev->id; - /* With a single device, the clock id is still "rtc0" */ - if (clk_id < 0) - clk_id = 0; - - snprintf(clk_name, sizeof(clk_name), "rtc%d", clk_id); - - rtc->clk = clk_get(&pdev->dev, clk_name); - if (IS_ERR(rtc->clk)) { - /* - * No error handling for rtc->clk intentionally, not all - * platforms will have a unique clock for the RTC, and - * the clk API can handle the struct clk pointer being - * NULL. - */ - rtc->clk = NULL; - } - - clk_enable(rtc->clk); - rtc->rtc_dev = rtc_device_register("sh", &pdev->dev, &sh_rtc_ops, THIS_MODULE); if (IS_ERR(rtc->rtc_dev)) { @@ -784,8 +759,6 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) return 0; err_unmap: - clk_disable(rtc->clk); - clk_put(rtc->clk); iounmap(rtc->regbase); err_badmap: release_resource(rtc->res); @@ -807,7 +780,6 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) sh_rtc_setcie(&pdev->dev, 0); free_irq(rtc->periodic_irq, rtc); - if (rtc->carry_irq > 0) { free_irq(rtc->carry_irq, rtc); free_irq(rtc->alarm_irq, rtc); @@ -817,9 +789,6 @@ static int __devexit sh_rtc_remove(struct platform_device *pdev) iounmap(rtc->regbase); - clk_disable(rtc->clk); - clk_put(rtc->clk); - platform_set_drvdata(pdev, NULL); kfree(rtc); @@ -833,11 +802,11 @@ static void sh_rtc_set_irq_wake(struct device *dev, int enabled) struct sh_rtc *rtc = platform_get_drvdata(pdev); set_irq_wake(rtc->periodic_irq, enabled); - if (rtc->carry_irq > 0) { set_irq_wake(rtc->carry_irq, enabled); set_irq_wake(rtc->alarm_irq, enabled); } + } static int sh_rtc_suspend(struct device *dev) diff --git a/trunk/drivers/scsi/scsi_scan.c b/trunk/drivers/scsi/scsi_scan.c index 6f51ca485f35..a14d245a66b8 100644 --- a/trunk/drivers/scsi/scsi_scan.c +++ b/trunk/drivers/scsi/scsi_scan.c @@ -180,6 +180,8 @@ int scsi_complete_async_scans(void) spin_unlock(&async_scan_lock); kfree(data); + /* Synchronize async operations globally */ + async_synchronize_full(); return 0; } diff --git a/trunk/drivers/scsi/scsi_wait_scan.c b/trunk/drivers/scsi/scsi_wait_scan.c index 74708fcaf82f..2f21af21269a 100644 --- a/trunk/drivers/scsi/scsi_wait_scan.c +++ b/trunk/drivers/scsi/scsi_wait_scan.c @@ -11,21 +11,10 @@ */ #include -#include #include static int __init wait_scan_init(void) { - /* - * First we need to wait for device probing to finish; - * the drivers we just loaded might just still be probing - * and might not yet have reached the scsi async scanning - */ - wait_for_device_probe(); - /* - * and then we wait for the actual asynchronous scsi scan - * to finish. - */ scsi_complete_async_scans(); return 0; } diff --git a/trunk/drivers/serial/bfin_5xx.c b/trunk/drivers/serial/bfin_5xx.c index d86123e03391..18ba812a4f84 100644 --- a/trunk/drivers/serial/bfin_5xx.c +++ b/trunk/drivers/serial/bfin_5xx.c @@ -166,7 +166,7 @@ static void bfin_serial_start_tx(struct uart_port *port) struct tty_struct *tty = uart->port.info->port.tty; #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS - if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { + if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { uart->scts = 0; uart_handle_cts_change(&uart->port, uart->scts); } @@ -368,7 +368,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id) struct bfin_serial_port *uart = dev_id; #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS - if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { + if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { uart->scts = 0; uart_handle_cts_change(&uart->port, uart->scts); } @@ -504,7 +504,7 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) struct circ_buf *xmit = &uart->port.info->xmit; #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS - if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { + if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { uart->scts = 0; uart_handle_cts_change(&uart->port, uart->scts); } diff --git a/trunk/drivers/spi/pxa2xx_spi.c b/trunk/drivers/spi/pxa2xx_spi.c index 885194a07418..c76feea5fe25 100644 --- a/trunk/drivers/spi/pxa2xx_spi.c +++ b/trunk/drivers/spi/pxa2xx_spi.c @@ -213,7 +213,7 @@ static int flush(struct driver_data *drv_data) while (read_SSSR(reg) & SSSR_RNE) { read_SSDR(reg); } - } while ((read_SSSR(reg) & SSSR_BSY) && --limit); + } while ((read_SSSR(reg) & SSSR_BSY) && limit--); write_SSSR(SSSR_ROR, reg); return limit; @@ -484,7 +484,7 @@ static int wait_ssp_rx_stall(void const __iomem *ioaddr) { unsigned long limit = loops_per_jiffy << 1; - while ((read_SSSR(ioaddr) & SSSR_BSY) && --limit) + while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--) cpu_relax(); return limit; @@ -494,7 +494,7 @@ static int wait_dma_channel_stop(int channel) { unsigned long limit = loops_per_jiffy << 1; - while (!(DCSR(channel) & DCSR_STOPSTATE) && --limit) + while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--) cpu_relax(); return limit; @@ -1700,13 +1700,6 @@ static int pxa2xx_spi_resume(struct platform_device *pdev) struct ssp_device *ssp = drv_data->ssp; int status = 0; - if (drv_data->rx_channel != -1) - DRCMR(drv_data->ssp->drcmr_rx) = - DRCMR_MAPVLD | drv_data->rx_channel; - if (drv_data->tx_channel != -1) - DRCMR(drv_data->ssp->drcmr_tx) = - DRCMR_MAPVLD | drv_data->tx_channel; - /* Enable the SSP clock */ clk_enable(ssp->clk); diff --git a/trunk/drivers/staging/go7007/go7007-driver.c b/trunk/drivers/staging/go7007/go7007-driver.c index 77b1e769ac92..f47c0ce2849a 100644 --- a/trunk/drivers/staging/go7007/go7007-driver.c +++ b/trunk/drivers/staging/go7007/go7007-driver.c @@ -191,10 +191,8 @@ int go7007_reset_encoder(struct go7007 *go) /* * Attempt to instantiate an I2C client by ID, probably loading a module. */ -static int init_i2c_module(struct i2c_adapter *adapter, const char *type, - int id, int addr) +static int init_i2c_module(struct i2c_adapter *adapter, int id, int addr) { - struct i2c_board_info info; char *modname; switch (id) { @@ -228,11 +226,7 @@ static int init_i2c_module(struct i2c_adapter *adapter, const char *type, } if (modname != NULL) request_module(modname); - - memset(&info, 0, sizeof(struct i2c_board_info)); - info.addr = addr; - strlcpy(info.type, type, I2C_NAME_SIZE); - if (!i2c_new_device(adapter, &info)) + if (wis_i2c_probe_device(adapter, id, addr) == 1) return 0; if (modname != NULL) printk(KERN_INFO @@ -272,7 +266,6 @@ int go7007_register_encoder(struct go7007 *go) if (go->i2c_adapter_online) { for (i = 0; i < go->board_info->num_i2c_devs; ++i) init_i2c_module(&go->i2c_adapter, - go->board_info->i2c_devs[i].type, go->board_info->i2c_devs[i].id, go->board_info->i2c_devs[i].addr); if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) diff --git a/trunk/drivers/staging/go7007/go7007-i2c.c b/trunk/drivers/staging/go7007/go7007-i2c.c index c82867fdd28d..cd55b76eabc7 100644 --- a/trunk/drivers/staging/go7007/go7007-i2c.c +++ b/trunk/drivers/staging/go7007/go7007-i2c.c @@ -31,6 +31,87 @@ #include "go7007-priv.h" #include "wis-i2c.h" +/************** Registration interface for I2C client drivers **************/ + +/* Since there's no way to auto-probe the I2C devices connected to the I2C + * bus on the go7007, we have this silly little registration system that + * client drivers can use to register their I2C driver ID and their + * detect_client function (the one that's normally passed to i2c_probe). + * + * When a new go7007 device is connected, we can look up in a board info + * table by the USB or PCI vendor/product/revision ID to determine + * which I2C client module to load. The client driver module will register + * itself here, and then we can call the registered detect_client function + * to force-load a new client at the address listed in the board info table. + * + * Really the I2C subsystem should have a way to force-load I2C client + * drivers when we have a priori knowledge of what's on the bus, especially + * since the existing I2C auto-probe mechanism is so hokey, but we'll use + * our own mechanism for the time being. */ + +struct wis_i2c_client_driver { + unsigned int id; + found_proc found_proc; + struct list_head list; +}; + +static LIST_HEAD(i2c_client_drivers); +static DECLARE_MUTEX(i2c_client_driver_list_lock); + +/* Client drivers register here by their I2C driver ID */ +int wis_i2c_add_driver(unsigned int id, found_proc found_proc) +{ + struct wis_i2c_client_driver *driver; + + driver = kmalloc(sizeof(struct wis_i2c_client_driver), GFP_KERNEL); + if (driver == NULL) + return -ENOMEM; + driver->id = id; + driver->found_proc = found_proc; + + down(&i2c_client_driver_list_lock); + list_add_tail(&driver->list, &i2c_client_drivers); + up(&i2c_client_driver_list_lock); + + return 0; +} +EXPORT_SYMBOL(wis_i2c_add_driver); + +void wis_i2c_del_driver(found_proc found_proc) +{ + struct wis_i2c_client_driver *driver, *next; + + down(&i2c_client_driver_list_lock); + list_for_each_entry_safe(driver, next, &i2c_client_drivers, list) + if (driver->found_proc == found_proc) { + list_del(&driver->list); + kfree(driver); + } + up(&i2c_client_driver_list_lock); +} +EXPORT_SYMBOL(wis_i2c_del_driver); + +/* The main go7007 driver calls this to instantiate a client by driver + * ID and bus address, which are both stored in the board info table */ +int wis_i2c_probe_device(struct i2c_adapter *adapter, + unsigned int id, int addr) +{ + struct wis_i2c_client_driver *driver; + int found = 0; + + if (addr < 0 || addr > 0x7f) + return -1; + down(&i2c_client_driver_list_lock); + list_for_each_entry(driver, &i2c_client_drivers, list) + if (driver->id == id) { + if (driver->found_proc(adapter, addr, 0) == 0) + found = 1; + break; + } + up(&i2c_client_driver_list_lock); + return found; +} + /********************* Driver for on-board I2C adapter *********************/ /* #define GO7007_I2C_DEBUG */ @@ -206,7 +287,9 @@ static struct i2c_algorithm go7007_algo = { static struct i2c_adapter go7007_adap_templ = { .owner = THIS_MODULE, + .class = I2C_CLASS_TV_ANALOG, .name = "WIS GO7007SB", + .id = I2C_ALGO_GO7007, .algo = &go7007_algo, }; diff --git a/trunk/drivers/staging/go7007/go7007-priv.h b/trunk/drivers/staging/go7007/go7007-priv.h index 178d18119faa..372f1f1c09b2 100644 --- a/trunk/drivers/staging/go7007/go7007-priv.h +++ b/trunk/drivers/staging/go7007/go7007-priv.h @@ -87,7 +87,6 @@ struct go7007_board_info { int audio_main_div; int num_i2c_devs; struct { - const char *type; int id; int addr; } i2c_devs[4]; diff --git a/trunk/drivers/staging/go7007/go7007-usb.c b/trunk/drivers/staging/go7007/go7007-usb.c index aa4a9e0b9954..83eec920c7d3 100644 --- a/trunk/drivers/staging/go7007/go7007-usb.c +++ b/trunk/drivers/staging/go7007/go7007-usb.c @@ -91,7 +91,6 @@ static struct go7007_usb_board board_matrix_ii = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, }, @@ -128,7 +127,6 @@ static struct go7007_usb_board board_matrix_reload = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_saa7113", .id = I2C_DRIVERID_WIS_SAA7113, .addr = 0x25, }, @@ -166,7 +164,6 @@ static struct go7007_usb_board board_star_trek = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, }, @@ -212,17 +209,14 @@ static struct go7007_usb_board board_px_tv402u = { .num_i2c_devs = 3, .i2c_devs = { { - .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, }, { - .type = "wis_uda1342", .id = I2C_DRIVERID_WIS_UDA1342, .addr = 0x1a, }, { - .type = "wis_sony_tuner", .id = I2C_DRIVERID_WIS_SONY_TUNER, .addr = 0x60, }, @@ -270,7 +264,6 @@ static struct go7007_usb_board board_xmen = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_ov7640", .id = I2C_DRIVERID_WIS_OV7640, .addr = 0x21, }, @@ -303,7 +296,6 @@ static struct go7007_usb_board board_matrix_revolution = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_tw9903", .id = I2C_DRIVERID_WIS_TW9903, .addr = 0x44, }, @@ -393,7 +385,6 @@ static struct go7007_usb_board board_adlink_mpg24 = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "wis_twTW2804", .id = I2C_DRIVERID_WIS_TW2804, .addr = 0x00, /* yes, really */ }, @@ -424,9 +415,8 @@ static struct go7007_usb_board board_sensoray_2250 = { .num_i2c_devs = 1, .i2c_devs = { { - .type = "s2250_board", .id = I2C_DRIVERID_S2250, - .addr = 0x43, + .addr = 0x34, }, }, .num_inputs = 2, @@ -953,7 +943,9 @@ static struct i2c_algorithm go7007_usb_algo = { static struct i2c_adapter go7007_usb_adap_templ = { .owner = THIS_MODULE, + .class = I2C_CLASS_TV_ANALOG, .name = "WIS GO7007SB EZ-USB", + .id = I2C_ALGO_GO7007_USB, .algo = &go7007_usb_algo, }; diff --git a/trunk/drivers/staging/go7007/s2250-board.c b/trunk/drivers/staging/go7007/s2250-board.c index 1706fbf06847..d333ea2cd774 100644 --- a/trunk/drivers/staging/go7007/s2250-board.c +++ b/trunk/drivers/staging/go7007/s2250-board.c @@ -28,6 +28,7 @@ extern int s2250loader_init(void); extern void s2250loader_cleanup(void); #define TLV320_ADDRESS 0x34 +#define S2250_VIDDEC 0x86 #define VPX322_ADDR_ANALOGCONTROL1 0x02 #define VPX322_ADDR_BRIGHTNESS0 0x0127 #define VPX322_ADDR_BRIGHTNESS1 0x0131 @@ -122,7 +123,6 @@ struct s2250 { int hue; int reg12b_val; int audio_input; - struct i2c_client *audio; }; /* from go7007-usb.c which is Copyright (C) 2005-2006 Micronas USA Inc.*/ @@ -452,15 +452,16 @@ static int s2250_command(struct i2c_client *client, { struct v4l2_audio *audio = arg; + client->addr = TLV320_ADDRESS; switch (audio->index) { case 0: - write_reg(dec->audio, 0x08, 0x02); /* Line In */ + write_reg(client, 0x08, 0x02); /* Line In */ break; case 1: - write_reg(dec->audio, 0x08, 0x04); /* Mic */ + write_reg(client, 0x08, 0x04); /* Mic */ break; case 2: - write_reg(dec->audio, 0x08, 0x05); /* Mic Boost */ + write_reg(client, 0x08, 0x05); /* Mic Boost */ break; default: return -EINVAL; @@ -476,23 +477,31 @@ static int s2250_command(struct i2c_client *client, return 0; } -static int s2250_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver s2250_driver; + +static struct i2c_client s2250_client_templ = { + .name = "Sensoray 2250", + .driver = &s2250_driver, +}; + +static int s2250_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_client *audio; - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct s2250 *dec; u8 *data; struct go7007 *go = i2c_get_adapdata(adapter); struct go7007_usb *usb = go->hpi_context; - audio = i2c_new_dummy(adapter, TLV320_ADDRESS >> 1); - if (audio == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &s2250_client_templ, + sizeof(s2250_client_templ)); + client->adapter = adapter; dec = kmalloc(sizeof(struct s2250), GFP_KERNEL); if (dec == NULL) { - i2c_unregister_device(audio); + kfree(client); return -ENOMEM; } @@ -501,7 +510,7 @@ static int s2250_probe(struct i2c_client *client, dec->contrast = 50; dec->saturation = 50; dec->hue = 0; - dec->audio = audio; + client->addr = TLV320_ADDRESS; i2c_set_clientdata(client, dec); printk(KERN_DEBUG @@ -509,25 +518,28 @@ static int s2250_probe(struct i2c_client *client, adapter->name); /* initialize the audio */ - if (write_regs(audio, aud_regs) < 0) { + client->addr = TLV320_ADDRESS; + if (write_regs(client, aud_regs) < 0) { printk(KERN_ERR "s2250: error initializing audio\n"); - i2c_unregister_device(audio); + kfree(client); kfree(dec); return 0; } + client->addr = S2250_VIDDEC; + i2c_set_clientdata(client, dec); if (write_regs(client, vid_regs) < 0) { printk(KERN_ERR "s2250: error initializing decoder\n"); - i2c_unregister_device(audio); + kfree(client); kfree(dec); return 0; } if (write_regs_fp(client, vid_regs_fp) < 0) { printk(KERN_ERR "s2250: error initializing decoder\n"); - i2c_unregister_device(audio); + kfree(client); kfree(dec); return 0; } @@ -563,33 +575,32 @@ static int s2250_probe(struct i2c_client *client, up(&usb->i2c_lock); } + i2c_attach_client(client); printk("s2250: initialized successfully\n"); return 0; } -static int s2250_remove(struct i2c_client *client) +static int s2250_detach(struct i2c_client *client) { struct s2250 *dec = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); - i2c_unregister_device(dec->audio); + kfree(client); kfree(dec); return 0; } -static struct i2c_device_id s2250_id[] = { - { "s2250_board", 0 }, - { } -}; - static struct i2c_driver s2250_driver = { .driver = { .name = "Sensoray 2250 board driver", }, - .probe = s2250_probe, - .remove = s2250_remove, + .id = I2C_DRIVERID_S2250, + .detach_client = s2250_detach, .command = s2250_command, - .id_table = s2250_id, }; static int __init s2250_init(void) @@ -602,13 +613,13 @@ static int __init s2250_init(void) r = i2c_add_driver(&s2250_driver); if (r < 0) - s2250loader_cleanup(); - - return r; + return r; + return wis_i2c_add_driver(s2250_driver.id, s2250_detect); } static void __exit s2250_cleanup(void) { + wis_i2c_del_driver(s2250_detect); i2c_del_driver(&s2250_driver); s2250loader_cleanup(); diff --git a/trunk/drivers/staging/go7007/wis-i2c.h b/trunk/drivers/staging/go7007/wis-i2c.h index 3c2b9be455df..431f41dd3966 100644 --- a/trunk/drivers/staging/go7007/wis-i2c.h +++ b/trunk/drivers/staging/go7007/wis-i2c.h @@ -24,12 +24,21 @@ #define I2C_DRIVERID_WIS_OV7640 0xf0f5 #define I2C_DRIVERID_WIS_TW2804 0xf0f6 #define I2C_DRIVERID_S2250 0xf0f7 +#define I2C_ALGO_GO7007 0xf00000 +#define I2C_ALGO_GO7007_USB 0xf10000 /* Flag to indicate that the client needs to be accessed with SCCB semantics */ /* We re-use the I2C_M_TEN value so the flag passes through the masks in the * core I2C code. Major kludge, but the I2C layer ain't exactly flexible. */ #define I2C_CLIENT_SCCB 0x10 +typedef int (*found_proc) (struct i2c_adapter *, int, int); +int wis_i2c_add_driver(unsigned int id, found_proc found_proc); +void wis_i2c_del_driver(found_proc found_proc); + +int wis_i2c_probe_device(struct i2c_adapter *adapter, + unsigned int id, int addr); + /* Definitions for new video decoder commands */ struct video_decoder_resolution { diff --git a/trunk/drivers/staging/go7007/wis-ov7640.c b/trunk/drivers/staging/go7007/wis-ov7640.c index 04d6d3a498a3..2f9efca04606 100644 --- a/trunk/drivers/staging/go7007/wis-ov7640.c +++ b/trunk/drivers/staging/go7007/wis-ov7640.c @@ -50,54 +50,76 @@ static int write_regs(struct i2c_client *client, u8 *regs) return 0; } -static int wis_ov7640_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_ov7640_driver; + +static struct i2c_client wis_ov7640_client_templ = { + .name = "OV7640 (WIS)", + .driver = &wis_ov7640_driver, +}; + +static int wis_ov7640_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; - + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) + return -ENOMEM; + memcpy(client, &wis_ov7640_client_templ, + sizeof(wis_ov7640_client_templ)); + client->adapter = adapter; + client->addr = addr; client->flags = I2C_CLIENT_SCCB; printk(KERN_DEBUG "wis-ov7640: initializing OV7640 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); if (write_regs(client, initial_registers) < 0) { printk(KERN_ERR "wis-ov7640: error initializing OV7640\n"); - return -ENODEV; + kfree(client); + return 0; } + i2c_attach_client(client); return 0; } -static int wis_ov7640_remove(struct i2c_client *client) +static int wis_ov7640_detach(struct i2c_client *client) { + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; + + kfree(client); return 0; } -static struct i2c_device_id wis_ov7640_id[] = { - { "wis_ov7640", 0 }, - { } -}; - static struct i2c_driver wis_ov7640_driver = { .driver = { .name = "WIS OV7640 I2C driver", }, - .probe = wis_ov7640_probe, - .remove = wis_ov7640_remove, - .id_table = wis_ov7640_id, + .id = I2C_DRIVERID_WIS_OV7640, + .detach_client = wis_ov7640_detach, }; static int __init wis_ov7640_init(void) { - return i2c_add_driver(&wis_ov7640_driver); + int r; + + r = i2c_add_driver(&wis_ov7640_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_ov7640_driver.id, wis_ov7640_detect); } static void __exit wis_ov7640_cleanup(void) { + wis_i2c_del_driver(wis_ov7640_detect); i2c_del_driver(&wis_ov7640_driver); } diff --git a/trunk/drivers/staging/go7007/wis-saa7113.c b/trunk/drivers/staging/go7007/wis-saa7113.c index 9ab893bd204e..11689723945e 100644 --- a/trunk/drivers/staging/go7007/wis-saa7113.c +++ b/trunk/drivers/staging/go7007/wis-saa7113.c @@ -261,19 +261,34 @@ static int wis_saa7113_command(struct i2c_client *client, return 0; } -static int wis_saa7113_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_saa7113_driver; + +static struct i2c_client wis_saa7113_client_templ = { + .name = "SAA7113 (WIS)", + .driver = &wis_saa7113_driver, +}; + +static int wis_saa7113_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct wis_saa7113 *dec; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; + return 0; - dec = kmalloc(sizeof(struct wis_saa7113), GFP_KERNEL); - if (dec == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &wis_saa7113_client_templ, + sizeof(wis_saa7113_client_templ)); + client->adapter = adapter; + client->addr = addr; + dec = kmalloc(sizeof(struct wis_saa7113), GFP_KERNEL); + if (dec == NULL) { + kfree(client); + return -ENOMEM; + } dec->norm = V4L2_STD_NTSC; dec->brightness = 128; dec->contrast = 71; @@ -283,49 +298,56 @@ static int wis_saa7113_probe(struct i2c_client *client, printk(KERN_DEBUG "wis-saa7113: initializing SAA7113 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); if (write_regs(client, initial_registers) < 0) { printk(KERN_ERR "wis-saa7113: error initializing SAA7113\n"); + kfree(client); kfree(dec); - return -ENODEV; + return 0; } + i2c_attach_client(client); return 0; } -static int wis_saa7113_remove(struct i2c_client *client) +static int wis_saa7113_detach(struct i2c_client *client) { struct wis_saa7113 *dec = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); + kfree(client); kfree(dec); return 0; } -static struct i2c_device_id wis_saa7113_id[] = { - { "wis_saa7113", 0 }, - { } -}; - static struct i2c_driver wis_saa7113_driver = { .driver = { .name = "WIS SAA7113 I2C driver", }, - .probe = wis_saa7113_probe, - .remove = wis_saa7113_remove, + .id = I2C_DRIVERID_WIS_SAA7113, + .detach_client = wis_saa7113_detach, .command = wis_saa7113_command, - .id_table = wis_saa7113_id, }; static int __init wis_saa7113_init(void) { - return i2c_add_driver(&wis_saa7113_driver); + int r; + + r = i2c_add_driver(&wis_saa7113_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_saa7113_driver.id, wis_saa7113_detect); } static void __exit wis_saa7113_cleanup(void) { + wis_i2c_del_driver(wis_saa7113_detect); i2c_del_driver(&wis_saa7113_driver); } diff --git a/trunk/drivers/staging/go7007/wis-saa7115.c b/trunk/drivers/staging/go7007/wis-saa7115.c index 8687ad2de761..59417a7174d7 100644 --- a/trunk/drivers/staging/go7007/wis-saa7115.c +++ b/trunk/drivers/staging/go7007/wis-saa7115.c @@ -394,19 +394,34 @@ static int wis_saa7115_command(struct i2c_client *client, return 0; } -static int wis_saa7115_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_saa7115_driver; + +static struct i2c_client wis_saa7115_client_templ = { + .name = "SAA7115 (WIS)", + .driver = &wis_saa7115_driver, +}; + +static int wis_saa7115_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct wis_saa7115 *dec; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; + return 0; - dec = kmalloc(sizeof(struct wis_saa7115), GFP_KERNEL); - if (dec == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &wis_saa7115_client_templ, + sizeof(wis_saa7115_client_templ)); + client->adapter = adapter; + client->addr = addr; + dec = kmalloc(sizeof(struct wis_saa7115), GFP_KERNEL); + if (dec == NULL) { + kfree(client); + return -ENOMEM; + } dec->norm = V4L2_STD_NTSC; dec->brightness = 128; dec->contrast = 64; @@ -416,49 +431,56 @@ static int wis_saa7115_probe(struct i2c_client *client, printk(KERN_DEBUG "wis-saa7115: initializing SAA7115 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); if (write_regs(client, initial_registers) < 0) { printk(KERN_ERR "wis-saa7115: error initializing SAA7115\n"); + kfree(client); kfree(dec); - return -ENODEV; + return 0; } + i2c_attach_client(client); return 0; } -static int wis_saa7115_remove(struct i2c_client *client) +static int wis_saa7115_detach(struct i2c_client *client) { struct wis_saa7115 *dec = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); + kfree(client); kfree(dec); return 0; } -static struct i2c_device_id wis_saa7115_id[] = { - { "wis_saa7115", 0 }, - { } -}; - static struct i2c_driver wis_saa7115_driver = { .driver = { .name = "WIS SAA7115 I2C driver", }, - .probe = wis_saa7115_probe, - .remove = wis_saa7115_remove, + .id = I2C_DRIVERID_WIS_SAA7115, + .detach_client = wis_saa7115_detach, .command = wis_saa7115_command, - .id_table = wis_saa7115_id, }; static int __init wis_saa7115_init(void) { - return i2c_add_driver(&wis_saa7115_driver); + int r; + + r = i2c_add_driver(&wis_saa7115_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_saa7115_driver.id, wis_saa7115_detect); } static void __exit wis_saa7115_cleanup(void) { + wis_i2c_del_driver(wis_saa7115_detect); i2c_del_driver(&wis_saa7115_driver); } diff --git a/trunk/drivers/staging/go7007/wis-sony-tuner.c b/trunk/drivers/staging/go7007/wis-sony-tuner.c index c965c601ac90..0a7eeef7c008 100644 --- a/trunk/drivers/staging/go7007/wis-sony-tuner.c +++ b/trunk/drivers/staging/go7007/wis-sony-tuner.c @@ -653,19 +653,35 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } -static int wis_sony_tuner_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_sony_tuner_driver; + +static struct i2c_client wis_sony_tuner_client_templ = { + .name = "Sony TV Tuner (WIS)", + .driver = &wis_sony_tuner_driver, +}; + +static int wis_sony_tuner_detect(struct i2c_adapter *adapter, + int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct wis_sony_tuner *t; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) - return -ENODEV; + return 0; - t = kmalloc(sizeof(struct wis_sony_tuner), GFP_KERNEL); - if (t == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &wis_sony_tuner_client_templ, + sizeof(wis_sony_tuner_client_templ)); + client->adapter = adapter; + client->addr = addr; + t = kmalloc(sizeof(struct wis_sony_tuner), GFP_KERNEL); + if (t == NULL) { + kfree(client); + return -ENOMEM; + } t->type = -1; t->freq = 0; t->mpxmode = 0; @@ -674,42 +690,50 @@ static int wis_sony_tuner_probe(struct i2c_client *client, printk(KERN_DEBUG "wis-sony-tuner: initializing tuner at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); + + i2c_attach_client(client); return 0; } -static int wis_sony_tuner_remove(struct i2c_client *client) +static int wis_sony_tuner_detach(struct i2c_client *client) { struct wis_sony_tuner *t = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); kfree(t); + kfree(client); return 0; } -static struct i2c_device_id wis_sony_tuner_id[] = { - { "wis_sony_tuner", 0 }, - { } -}; - static struct i2c_driver wis_sony_tuner_driver = { .driver = { .name = "WIS Sony TV Tuner I2C driver", }, - .probe = wis_sony_tuner_probe, - .remove = wis_sony_tuner_remove, + .id = I2C_DRIVERID_WIS_SONY_TUNER, + .detach_client = wis_sony_tuner_detach, .command = tuner_command, - .id_table = wis_sony_tuner_id, }; static int __init wis_sony_tuner_init(void) { - return i2c_add_driver(&wis_sony_tuner_driver); + int r; + + r = i2c_add_driver(&wis_sony_tuner_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_sony_tuner_driver.id, + wis_sony_tuner_detect); } static void __exit wis_sony_tuner_cleanup(void) { + wis_i2c_del_driver(wis_sony_tuner_detect); i2c_del_driver(&wis_sony_tuner_driver); } diff --git a/trunk/drivers/staging/go7007/wis-tw2804.c b/trunk/drivers/staging/go7007/wis-tw2804.c index e15794a2a0ae..57b8f2b1caa3 100644 --- a/trunk/drivers/staging/go7007/wis-tw2804.c +++ b/trunk/drivers/staging/go7007/wis-tw2804.c @@ -291,19 +291,34 @@ static int wis_tw2804_command(struct i2c_client *client, return 0; } -static int wis_tw2804_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_tw2804_driver; + +static struct i2c_client wis_tw2804_client_templ = { + .name = "TW2804 (WIS)", + .driver = &wis_tw2804_driver, +}; + +static int wis_tw2804_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct wis_tw2804 *dec; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; + return 0; - dec = kmalloc(sizeof(struct wis_tw2804), GFP_KERNEL); - if (dec == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &wis_tw2804_client_templ, + sizeof(wis_tw2804_client_templ)); + client->adapter = adapter; + client->addr = addr; + dec = kmalloc(sizeof(struct wis_tw2804), GFP_KERNEL); + if (dec == NULL) { + kfree(client); + return -ENOMEM; + } dec->channel = -1; dec->norm = V4L2_STD_NTSC; dec->brightness = 128; @@ -313,42 +328,48 @@ static int wis_tw2804_probe(struct i2c_client *client, i2c_set_clientdata(client, dec); printk(KERN_DEBUG "wis-tw2804: creating TW2804 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); + i2c_attach_client(client); return 0; } -static int wis_tw2804_remove(struct i2c_client *client) +static int wis_tw2804_detach(struct i2c_client *client) { struct wis_tw2804 *dec = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); + kfree(client); kfree(dec); return 0; } -static struct i2c_device_id wis_tw2804_id[] = { - { "wis_tw2804", 0 }, - { } -}; - static struct i2c_driver wis_tw2804_driver = { .driver = { .name = "WIS TW2804 I2C driver", }, - .probe = wis_tw2804_probe, - .remove = wis_tw2804_remove, + .id = I2C_DRIVERID_WIS_TW2804, + .detach_client = wis_tw2804_detach, .command = wis_tw2804_command, - .id_table = wis_tw2804_id, }; static int __init wis_tw2804_init(void) { - return i2c_add_driver(&wis_tw2804_driver); + int r; + + r = i2c_add_driver(&wis_tw2804_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_tw2804_driver.id, wis_tw2804_detect); } static void __exit wis_tw2804_cleanup(void) { + wis_i2c_del_driver(wis_tw2804_detect); i2c_del_driver(&wis_tw2804_driver); } diff --git a/trunk/drivers/staging/go7007/wis-tw9903.c b/trunk/drivers/staging/go7007/wis-tw9903.c index 6c3427bb6f4c..40627b282cb4 100644 --- a/trunk/drivers/staging/go7007/wis-tw9903.c +++ b/trunk/drivers/staging/go7007/wis-tw9903.c @@ -267,19 +267,34 @@ static int wis_tw9903_command(struct i2c_client *client, return 0; } -static int wis_tw9903_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_tw9903_driver; + +static struct i2c_client wis_tw9903_client_templ = { + .name = "TW9903 (WIS)", + .driver = &wis_tw9903_driver, +}; + +static int wis_tw9903_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; struct wis_tw9903 *dec; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) - return -ENODEV; + return 0; - dec = kmalloc(sizeof(struct wis_tw9903), GFP_KERNEL); - if (dec == NULL) + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) return -ENOMEM; + memcpy(client, &wis_tw9903_client_templ, + sizeof(wis_tw9903_client_templ)); + client->adapter = adapter; + client->addr = addr; + dec = kmalloc(sizeof(struct wis_tw9903), GFP_KERNEL); + if (dec == NULL) { + kfree(client); + return -ENOMEM; + } dec->norm = V4L2_STD_NTSC; dec->brightness = 0; dec->contrast = 0x60; @@ -288,48 +303,55 @@ static int wis_tw9903_probe(struct i2c_client *client, printk(KERN_DEBUG "wis-tw9903: initializing TW9903 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); if (write_regs(client, initial_registers) < 0) { printk(KERN_ERR "wis-tw9903: error initializing TW9903\n"); + kfree(client); kfree(dec); - return -ENODEV; + return 0; } + i2c_attach_client(client); return 0; } -static int wis_tw9903_remove(struct i2c_client *client) +static int wis_tw9903_detach(struct i2c_client *client) { struct wis_tw9903 *dec = i2c_get_clientdata(client); + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; - i2c_set_clientdata(client, NULL); + kfree(client); kfree(dec); return 0; } -static struct i2c_device_id wis_tw9903_id[] = { - { "wis_tw9903", 0 }, - { } -}; - static struct i2c_driver wis_tw9903_driver = { .driver = { .name = "WIS TW9903 I2C driver", }, - .probe = wis_tw9903_probe, - .remove = wis_tw9903_remove, + .id = I2C_DRIVERID_WIS_TW9903, + .detach_client = wis_tw9903_detach, .command = wis_tw9903_command, - .id_table = wis_tw9903_id, }; static int __init wis_tw9903_init(void) { - return i2c_add_driver(&wis_tw9903_driver); + int r; + + r = i2c_add_driver(&wis_tw9903_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_tw9903_driver.id, wis_tw9903_detect); } static void __exit wis_tw9903_cleanup(void) { + wis_i2c_del_driver(wis_tw9903_detect); i2c_del_driver(&wis_tw9903_driver); } diff --git a/trunk/drivers/staging/go7007/wis-uda1342.c b/trunk/drivers/staging/go7007/wis-uda1342.c index 739c7ae8913f..555645c0cc1a 100644 --- a/trunk/drivers/staging/go7007/wis-uda1342.c +++ b/trunk/drivers/staging/go7007/wis-uda1342.c @@ -59,51 +59,73 @@ static int wis_uda1342_command(struct i2c_client *client, return 0; } -static int wis_uda1342_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static struct i2c_driver wis_uda1342_driver; + +static struct i2c_client wis_uda1342_client_templ = { + .name = "UDA1342 (WIS)", + .driver = &wis_uda1342_driver, +}; + +static int wis_uda1342_detect(struct i2c_adapter *adapter, int addr, int kind) { - struct i2c_adapter *adapter = client->adapter; + struct i2c_client *client; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) - return -ENODEV; + return 0; + + client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + if (client == NULL) + return -ENOMEM; + memcpy(client, &wis_uda1342_client_templ, + sizeof(wis_uda1342_client_templ)); + client->adapter = adapter; + client->addr = addr; printk(KERN_DEBUG "wis-uda1342: initializing UDA1342 at address %d on %s\n", - client->addr, adapter->name); + addr, adapter->name); write_reg(client, 0x00, 0x8000); /* reset registers */ write_reg(client, 0x00, 0x1241); /* select input 1 */ + i2c_attach_client(client); return 0; } -static int wis_uda1342_remove(struct i2c_client *client) +static int wis_uda1342_detach(struct i2c_client *client) { + int r; + + r = i2c_detach_client(client); + if (r < 0) + return r; + + kfree(client); return 0; } -static struct i2c_device_id wis_uda1342_id[] = { - { "wis_uda1342", 0 }, - { } -}; - static struct i2c_driver wis_uda1342_driver = { .driver = { .name = "WIS UDA1342 I2C driver", }, - .probe = wis_uda1342_probe, - .remove = wis_uda1342_remove, + .id = I2C_DRIVERID_WIS_UDA1342, + .detach_client = wis_uda1342_detach, .command = wis_uda1342_command, - .id_table = wis_uda1342_id, }; static int __init wis_uda1342_init(void) { - return i2c_add_driver(&wis_uda1342_driver); + int r; + + r = i2c_add_driver(&wis_uda1342_driver); + if (r < 0) + return r; + return wis_i2c_add_driver(wis_uda1342_driver.id, wis_uda1342_detect); } static void __exit wis_uda1342_cleanup(void) { + wis_i2c_del_driver(wis_uda1342_detect); i2c_del_driver(&wis_uda1342_driver); } diff --git a/trunk/drivers/video/asiliantfb.c b/trunk/drivers/video/asiliantfb.c index 9fe90ce928fb..1a1f946d8fef 100644 --- a/trunk/drivers/video/asiliantfb.c +++ b/trunk/drivers/video/asiliantfb.c @@ -533,7 +533,6 @@ static int __devinit init_asiliant(struct fb_info *p, unsigned long addr) writeb(0xff, mmio_base + 0x78c); chips_hw_init(p); - return 0; } static int __devinit diff --git a/trunk/drivers/video/pxafb.c b/trunk/drivers/video/pxafb.c index 0889d50c3288..84f63205c46d 100644 --- a/trunk/drivers/video/pxafb.c +++ b/trunk/drivers/video/pxafb.c @@ -1439,7 +1439,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) { struct pxafb_info *fbi = dev_id; - unsigned int lccr0, lcsr; + unsigned int lccr0, lcsr, lcsr1; lcsr = lcd_readl(fbi, LCSR); if (lcsr & LCSR_LDD) { @@ -1455,16 +1455,14 @@ static irqreturn_t pxafb_handle_irq(int irq, void *dev_id) lcd_writel(fbi, LCSR, lcsr); #ifdef CONFIG_FB_PXA_OVERLAY - { - unsigned int lcsr1 = lcd_readl(fbi, LCSR1); - if (lcsr1 & LCSR1_BS(1)) - complete(&fbi->overlay[0].branch_done); + lcsr1 = lcd_readl(fbi, LCSR1); + if (lcsr1 & LCSR1_BS(1)) + complete(&fbi->overlay[0].branch_done); - if (lcsr1 & LCSR1_BS(2)) - complete(&fbi->overlay[1].branch_done); + if (lcsr1 & LCSR1_BS(2)) + complete(&fbi->overlay[1].branch_done); - lcd_writel(fbi, LCSR1, lcsr1); - } + lcd_writel(fbi, LCSR1, lcsr1); #endif return IRQ_HANDLED; } diff --git a/trunk/fs/autofs/dirhash.c b/trunk/fs/autofs/dirhash.c index 4eb4d8dfb2f1..bf8c8af98004 100644 --- a/trunk/fs/autofs/dirhash.c +++ b/trunk/fs/autofs/dirhash.c @@ -39,12 +39,10 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb, { struct autofs_dirhash *dh = &sbi->dirhash; struct autofs_dir_ent *ent; + struct dentry *dentry; unsigned long timeout = sbi->exp_timeout; while (1) { - struct path path; - int umount_ok; - if ( list_empty(&dh->expiry_head) || sbi->catatonic ) return NULL; /* No entries */ /* We keep the list sorted by last_usage and want old stuff */ @@ -59,17 +57,17 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb, return ent; /* Symlinks are always expirable */ /* Get the dentry for the autofs subdirectory */ - path.dentry = ent->dentry; + dentry = ent->dentry; - if (!path.dentry) { + if ( !dentry ) { /* Should only happen in catatonic mode */ printk("autofs: dentry == NULL but inode range is directory, entry %s\n", ent->name); autofs_delete_usage(ent); continue; } - if (!path.dentry->d_inode) { - dput(path.dentry); + if ( !dentry->d_inode ) { + dput(dentry); printk("autofs: negative dentry on expiry queue: %s\n", ent->name); autofs_delete_usage(ent); @@ -78,29 +76,29 @@ struct autofs_dir_ent *autofs_expire(struct super_block *sb, /* Make sure entry is mounted and unused; note that dentry will point to the mounted-on-top root. */ - if (!S_ISDIR(path.dentry->d_inode->i_mode) || - !d_mountpoint(path.dentry)) { + if (!S_ISDIR(dentry->d_inode->i_mode)||!d_mountpoint(dentry)) { DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name)); continue; } - path.mnt = mnt; - path_get(&path); - if (!follow_down(&path.mnt, &path.dentry)) { - path_put(&path); + mntget(mnt); + dget(dentry); + if (!follow_down(&mnt, &dentry)) { + dput(dentry); + mntput(mnt); DPRINTK(("autofs: not expirable (not a mounted directory): %s\n", ent->name)); continue; } - while (d_mountpoint(path.dentry) && - follow_down(&path.mnt, &path.dentry)) + while (d_mountpoint(dentry) && follow_down(&mnt, &dentry)) ; - umount_ok = may_umount(path.mnt); - path_put(&path); + dput(dentry); - if (umount_ok) { + if ( may_umount(mnt) ) { + mntput(mnt); DPRINTK(("autofs: signaling expire on %s\n", ent->name)); return ent; /* Expirable! */ } DPRINTK(("autofs: didn't expire due to may_umount: %s\n", ent->name)); + mntput(mnt); } return NULL; /* No expirable entries */ } diff --git a/trunk/fs/autofs4/dev-ioctl.c b/trunk/fs/autofs4/dev-ioctl.c index 84168c0dcc2d..9e5ae8a4f5c8 100644 --- a/trunk/fs/autofs4/dev-ioctl.c +++ b/trunk/fs/autofs4/dev-ioctl.c @@ -54,10 +54,11 @@ static int check_name(const char *name) * Check a string doesn't overrun the chunk of * memory we copied from user land. */ -static int invalid_str(char *str, size_t size) +static int invalid_str(char *str, void *end) { - if (memchr(str, 0, size)) - return 0; + while ((void *) str <= end) + if (!*str++) + return 0; return -EINVAL; } @@ -137,7 +138,8 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param) } if (param->size > sizeof(*param)) { - err = invalid_str(param->path, param->size - sizeof(*param)); + err = invalid_str(param->path, + (void *) ((size_t) param + param->size)); if (err) { AUTOFS_WARN( "path string terminator missing for cmd(0x%08x)", @@ -486,7 +488,7 @@ static int autofs_dev_ioctl_requester(struct file *fp, } path = param->path; - devid = new_encode_dev(sbi->sb->s_dev); + devid = sbi->sb->s_dev; param->requester.uid = param->requester.gid = -1; diff --git a/trunk/fs/btrfs/async-thread.c b/trunk/fs/btrfs/async-thread.c index 502c3d61de62..51bfdfc8fcda 100644 --- a/trunk/fs/btrfs/async-thread.c +++ b/trunk/fs/btrfs/async-thread.c @@ -25,7 +25,6 @@ #define WORK_QUEUED_BIT 0 #define WORK_DONE_BIT 1 #define WORK_ORDER_DONE_BIT 2 -#define WORK_HIGH_PRIO_BIT 3 /* * container for the kthread task pointer and the list of pending work @@ -37,7 +36,6 @@ struct btrfs_worker_thread { /* list of struct btrfs_work that are waiting for service */ struct list_head pending; - struct list_head prio_pending; /* list of worker threads from struct btrfs_workers */ struct list_head worker_list; @@ -105,16 +103,10 @@ static noinline int run_ordered_completions(struct btrfs_workers *workers, spin_lock_irqsave(&workers->lock, flags); - while (1) { - if (!list_empty(&workers->prio_order_list)) { - work = list_entry(workers->prio_order_list.next, - struct btrfs_work, order_list); - } else if (!list_empty(&workers->order_list)) { - work = list_entry(workers->order_list.next, - struct btrfs_work, order_list); - } else { - break; - } + while (!list_empty(&workers->order_list)) { + work = list_entry(workers->order_list.next, + struct btrfs_work, order_list); + if (!test_bit(WORK_DONE_BIT, &work->flags)) break; @@ -151,14 +143,8 @@ static int worker_loop(void *arg) do { spin_lock_irq(&worker->lock); again_locked: - while (1) { - if (!list_empty(&worker->prio_pending)) - cur = worker->prio_pending.next; - else if (!list_empty(&worker->pending)) - cur = worker->pending.next; - else - break; - + while (!list_empty(&worker->pending)) { + cur = worker->pending.next; work = list_entry(cur, struct btrfs_work, list); list_del(&work->list); clear_bit(WORK_QUEUED_BIT, &work->flags); @@ -177,6 +163,7 @@ static int worker_loop(void *arg) spin_lock_irq(&worker->lock); check_idle_worker(worker); + } if (freezing(current)) { worker->working = 0; @@ -191,8 +178,7 @@ static int worker_loop(void *arg) * jump_in? */ smp_mb(); - if (!list_empty(&worker->pending) || - !list_empty(&worker->prio_pending)) + if (!list_empty(&worker->pending)) continue; /* @@ -205,8 +191,7 @@ static int worker_loop(void *arg) */ schedule_timeout(1); smp_mb(); - if (!list_empty(&worker->pending) || - !list_empty(&worker->prio_pending)) + if (!list_empty(&worker->pending)) continue; if (kthread_should_stop()) @@ -215,8 +200,7 @@ static int worker_loop(void *arg) /* still no more work?, sleep for real */ spin_lock_irq(&worker->lock); set_current_state(TASK_INTERRUPTIBLE); - if (!list_empty(&worker->pending) || - !list_empty(&worker->prio_pending)) + if (!list_empty(&worker->pending)) goto again_locked; /* @@ -264,7 +248,6 @@ void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max) INIT_LIST_HEAD(&workers->worker_list); INIT_LIST_HEAD(&workers->idle_list); INIT_LIST_HEAD(&workers->order_list); - INIT_LIST_HEAD(&workers->prio_order_list); spin_lock_init(&workers->lock); workers->max_workers = max; workers->idle_thresh = 32; @@ -290,7 +273,6 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers) } INIT_LIST_HEAD(&worker->pending); - INIT_LIST_HEAD(&worker->prio_pending); INIT_LIST_HEAD(&worker->worker_list); spin_lock_init(&worker->lock); atomic_set(&worker->num_pending, 0); @@ -414,10 +396,7 @@ int btrfs_requeue_work(struct btrfs_work *work) goto out; spin_lock_irqsave(&worker->lock, flags); - if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags)) - list_add_tail(&work->list, &worker->prio_pending); - else - list_add_tail(&work->list, &worker->pending); + list_add_tail(&work->list, &worker->pending); atomic_inc(&worker->num_pending); /* by definition we're busy, take ourselves off the idle @@ -443,11 +422,6 @@ int btrfs_requeue_work(struct btrfs_work *work) return 0; } -void btrfs_set_work_high_prio(struct btrfs_work *work) -{ - set_bit(WORK_HIGH_PRIO_BIT, &work->flags); -} - /* * places a struct btrfs_work into the pending queue of one of the kthreads */ @@ -464,12 +438,7 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) worker = find_worker(workers); if (workers->ordered) { spin_lock_irqsave(&workers->lock, flags); - if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags)) { - list_add_tail(&work->order_list, - &workers->prio_order_list); - } else { - list_add_tail(&work->order_list, &workers->order_list); - } + list_add_tail(&work->order_list, &workers->order_list); spin_unlock_irqrestore(&workers->lock, flags); } else { INIT_LIST_HEAD(&work->order_list); @@ -477,10 +446,7 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) spin_lock_irqsave(&worker->lock, flags); - if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags)) - list_add_tail(&work->list, &worker->prio_pending); - else - list_add_tail(&work->list, &worker->pending); + list_add_tail(&work->list, &worker->pending); atomic_inc(&worker->num_pending); check_busy_worker(worker); diff --git a/trunk/fs/btrfs/async-thread.h b/trunk/fs/btrfs/async-thread.h index 1b511c109db6..31be4ed8b63e 100644 --- a/trunk/fs/btrfs/async-thread.h +++ b/trunk/fs/btrfs/async-thread.h @@ -85,7 +85,6 @@ struct btrfs_workers { * of work items waiting for completion */ struct list_head order_list; - struct list_head prio_order_list; /* lock for finding the next worker thread to queue on */ spinlock_t lock; @@ -99,5 +98,4 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers); int btrfs_stop_workers(struct btrfs_workers *workers); void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max); int btrfs_requeue_work(struct btrfs_work *work); -void btrfs_set_work_high_prio(struct btrfs_work *work); #endif diff --git a/trunk/fs/btrfs/ctree.c b/trunk/fs/btrfs/ctree.c index a99f1c2a710d..e5b2533b691a 100644 --- a/trunk/fs/btrfs/ctree.c +++ b/trunk/fs/btrfs/ctree.c @@ -1325,12 +1325,12 @@ static noinline int reada_for_balance(struct btrfs_root *root, int ret = 0; int blocksize; - parent = path->nodes[level + 1]; + parent = path->nodes[level - 1]; if (!parent) return 0; nritems = btrfs_header_nritems(parent); - slot = path->slots[level + 1]; + slot = path->slots[level]; blocksize = btrfs_level_size(root, level); if (slot > 0) { @@ -1341,7 +1341,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, block1 = 0; free_extent_buffer(eb); } - if (slot + 1 < nritems) { + if (slot < nritems) { block2 = btrfs_node_blockptr(parent, slot + 1); gen = btrfs_node_ptr_generation(parent, slot + 1); eb = btrfs_find_tree_block(root, block2, blocksize); @@ -1351,11 +1351,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, } if (block1 || block2) { ret = -EAGAIN; - - /* release the whole path */ btrfs_release_path(root, path); - - /* read the blocks */ if (block1) readahead_tree_block(root, block1, blocksize, 0); if (block2) @@ -1365,7 +1361,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, eb = read_tree_block(root, block1, blocksize, 0); free_extent_buffer(eb); } - if (block2) { + if (block1) { eb = read_tree_block(root, block2, blocksize, 0); free_extent_buffer(eb); } @@ -1485,15 +1481,12 @@ read_block_for_search(struct btrfs_trans_handle *trans, * of the btree by dropping locks before * we read. */ - btrfs_unlock_up_safe(p, level + 1); - btrfs_set_path_blocking(p); - + btrfs_release_path(NULL, p); if (tmp) free_extent_buffer(tmp); if (p->reada) reada_for_search(root, p, level, slot, key->objectid); - btrfs_release_path(NULL, p); tmp = read_tree_block(root, blocknr, blocksize, gen); if (tmp) free_extent_buffer(tmp); diff --git a/trunk/fs/btrfs/disk-io.c b/trunk/fs/btrfs/disk-io.c index a6b83744b05d..92caa8035f36 100644 --- a/trunk/fs/btrfs/disk-io.c +++ b/trunk/fs/btrfs/disk-io.c @@ -579,10 +579,6 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, async->bio_flags = bio_flags; atomic_inc(&fs_info->nr_async_submits); - - if (rw & (1 << BIO_RW_SYNCIO)) - btrfs_set_work_high_prio(&async->work); - btrfs_queue_worker(&fs_info->workers, &async->work); #if 0 int limit = btrfs_async_submit_limit(fs_info); @@ -660,7 +656,6 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, mirror_num, 0); } - /* * kthread helpers are used to submit writes so that checksumming * can happen in parallel across all CPUs @@ -2100,10 +2095,10 @@ static int write_dev_supers(struct btrfs_device *device, device->barriers = 0; get_bh(bh); lock_buffer(bh); - ret = submit_bh(WRITE_SYNC, bh); + ret = submit_bh(WRITE, bh); } } else { - ret = submit_bh(WRITE_SYNC, bh); + ret = submit_bh(WRITE, bh); } if (!ret && wait) { diff --git a/trunk/fs/btrfs/extent_io.c b/trunk/fs/btrfs/extent_io.c index 05a1c42e25bf..eb2bee8b7fbf 100644 --- a/trunk/fs/btrfs/extent_io.c +++ b/trunk/fs/btrfs/extent_io.c @@ -50,10 +50,7 @@ struct extent_page_data { /* tells writepage not to lock the state bits for this range * it still does the unlocking */ - unsigned int extent_locked:1; - - /* tells the submit_bio code to use a WRITE_SYNC */ - unsigned int sync_io:1; + int extent_locked; }; int __init extent_io_init(void) @@ -2104,16 +2101,6 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page, return ret; } -static noinline void update_nr_written(struct page *page, - struct writeback_control *wbc, - unsigned long nr_written) -{ - wbc->nr_to_write -= nr_written; - if (wbc->range_cyclic || (wbc->nr_to_write > 0 && - wbc->range_start == 0 && wbc->range_end == LLONG_MAX)) - page->mapping->writeback_index = page->index + nr_written; -} - /* * the writepage semantics are similar to regular writepage. extent * records are inserted to lock ranges in the tree, and as dirty areas @@ -2149,14 +2136,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, u64 delalloc_end; int page_started; int compressed; - int write_flags; unsigned long nr_written = 0; - if (wbc->sync_mode == WB_SYNC_ALL) - write_flags = WRITE_SYNC_PLUG; - else - write_flags = WRITE; - WARN_ON(!PageLocked(page)); pg_offset = i_size & (PAGE_CACHE_SIZE - 1); if (page->index > end_index || @@ -2183,12 +2164,6 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, delalloc_end = 0; page_started = 0; if (!epd->extent_locked) { - /* - * make sure the wbc mapping index is at least updated - * to this page. - */ - update_nr_written(page, wbc, 0); - while (delalloc_end < page_end) { nr_delalloc = find_lock_delalloc_range(inode, tree, page, @@ -2210,13 +2185,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, */ if (page_started) { ret = 0; - /* - * we've unlocked the page, so we can't update - * the mapping's writeback index, just update - * nr_to_write. - */ - wbc->nr_to_write -= nr_written; - goto done_unlocked; + goto update_nr_written; } } lock_extent(tree, start, page_end, GFP_NOFS); @@ -2229,18 +2198,13 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, if (ret == -EAGAIN) { unlock_extent(tree, start, page_end, GFP_NOFS); redirty_page_for_writepage(wbc, page); - update_nr_written(page, wbc, nr_written); unlock_page(page); ret = 0; - goto done_unlocked; + goto update_nr_written; } } - /* - * we don't want to touch the inode after unlocking the page, - * so we update the mapping writeback index now - */ - update_nr_written(page, wbc, nr_written + 1); + nr_written++; end = page_end; if (test_range_bit(tree, start, page_end, EXTENT_DELALLOC, 0)) @@ -2350,9 +2314,9 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, (unsigned long long)end); } - ret = submit_extent_page(write_flags, tree, page, - sector, iosize, pg_offset, - bdev, &epd->bio, max_nr, + ret = submit_extent_page(WRITE, tree, page, sector, + iosize, pg_offset, bdev, + &epd->bio, max_nr, end_bio_extent_writepage, 0, 0, 0); if (ret) @@ -2372,8 +2336,11 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, unlock_extent(tree, unlock_start, page_end, GFP_NOFS); unlock_page(page); -done_unlocked: - +update_nr_written: + wbc->nr_to_write -= nr_written; + if (wbc->range_cyclic || (wbc->nr_to_write > 0 && + wbc->range_start == 0 && wbc->range_end == LLONG_MAX)) + page->mapping->writeback_index = page->index + nr_written; return 0; } @@ -2493,23 +2460,15 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, return ret; } -static void flush_epd_write_bio(struct extent_page_data *epd) +static noinline void flush_write_bio(void *data) { + struct extent_page_data *epd = data; if (epd->bio) { - if (epd->sync_io) - submit_one_bio(WRITE_SYNC, epd->bio, 0, 0); - else - submit_one_bio(WRITE, epd->bio, 0, 0); + submit_one_bio(WRITE, epd->bio, 0, 0); epd->bio = NULL; } } -static noinline void flush_write_bio(void *data) -{ - struct extent_page_data *epd = data; - flush_epd_write_bio(epd); -} - int extent_write_full_page(struct extent_io_tree *tree, struct page *page, get_extent_t *get_extent, struct writeback_control *wbc) @@ -2521,22 +2480,23 @@ int extent_write_full_page(struct extent_io_tree *tree, struct page *page, .tree = tree, .get_extent = get_extent, .extent_locked = 0, - .sync_io = wbc->sync_mode == WB_SYNC_ALL, }; struct writeback_control wbc_writepages = { .bdi = wbc->bdi, - .sync_mode = wbc->sync_mode, + .sync_mode = WB_SYNC_NONE, .older_than_this = NULL, .nr_to_write = 64, .range_start = page_offset(page) + PAGE_CACHE_SIZE, .range_end = (loff_t)-1, }; + ret = __extent_writepage(page, wbc, &epd); extent_write_cache_pages(tree, mapping, &wbc_writepages, __extent_writepage, &epd, flush_write_bio); - flush_epd_write_bio(&epd); + if (epd.bio) + submit_one_bio(WRITE, epd.bio, 0, 0); return ret; } @@ -2555,7 +2515,6 @@ int extent_write_locked_range(struct extent_io_tree *tree, struct inode *inode, .tree = tree, .get_extent = get_extent, .extent_locked = 1, - .sync_io = mode == WB_SYNC_ALL, }; struct writeback_control wbc_writepages = { .bdi = inode->i_mapping->backing_dev_info, @@ -2581,7 +2540,8 @@ int extent_write_locked_range(struct extent_io_tree *tree, struct inode *inode, start += PAGE_CACHE_SIZE; } - flush_epd_write_bio(&epd); + if (epd.bio) + submit_one_bio(WRITE, epd.bio, 0, 0); return ret; } @@ -2596,13 +2556,13 @@ int extent_writepages(struct extent_io_tree *tree, .tree = tree, .get_extent = get_extent, .extent_locked = 0, - .sync_io = wbc->sync_mode == WB_SYNC_ALL, }; ret = extent_write_cache_pages(tree, mapping, wbc, __extent_writepage, &epd, flush_write_bio); - flush_epd_write_bio(&epd); + if (epd.bio) + submit_one_bio(WRITE, epd.bio, 0, 0); return ret; } diff --git a/trunk/fs/btrfs/file.c b/trunk/fs/btrfs/file.c index 482f8db2cfd0..9c9fb46ccd08 100644 --- a/trunk/fs/btrfs/file.c +++ b/trunk/fs/btrfs/file.c @@ -830,7 +830,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, ret = btrfs_del_items(trans, root, path, del_slot, del_nr); BUG_ON(ret); - goto release; + goto done; } else if (split == start) { if (locked_end < extent_end) { ret = try_lock_extent(&BTRFS_I(inode)->io_tree, @@ -926,8 +926,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, } done: btrfs_mark_buffer_dirty(leaf); - -release: btrfs_release_path(root, path); if (split_end && split == start) { split = end; @@ -1133,7 +1131,7 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, if (will_write) { btrfs_fdatawrite_range(inode->i_mapping, pos, pos + write_bytes - 1, - WB_SYNC_ALL); + WB_SYNC_NONE); } else { balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages); diff --git a/trunk/fs/btrfs/inode.c b/trunk/fs/btrfs/inode.c index 65219f6a16a1..a0d1dd492a58 100644 --- a/trunk/fs/btrfs/inode.c +++ b/trunk/fs/btrfs/inode.c @@ -4970,10 +4970,10 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, return err; } -static int prealloc_file_range(struct btrfs_trans_handle *trans, - struct inode *inode, u64 start, u64 end, +static int prealloc_file_range(struct inode *inode, u64 start, u64 end, u64 alloc_hint, int mode) { + struct btrfs_trans_handle *trans; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_key ins; u64 alloc_size; @@ -4981,6 +4981,10 @@ static int prealloc_file_range(struct btrfs_trans_handle *trans, u64 num_bytes = end - start; int ret = 0; + trans = btrfs_join_transaction(root, 1); + BUG_ON(!trans); + btrfs_set_trans_block_group(trans, inode); + while (num_bytes > 0) { alloc_size = min(num_bytes, root->fs_info->max_extent); ret = btrfs_reserve_extent(trans, root, alloc_size, @@ -5011,6 +5015,7 @@ static int prealloc_file_range(struct btrfs_trans_handle *trans, BUG_ON(ret); } + btrfs_end_transaction(trans, root); return ret; } @@ -5024,18 +5029,11 @@ static long btrfs_fallocate(struct inode *inode, int mode, u64 alloc_hint = 0; u64 mask = BTRFS_I(inode)->root->sectorsize - 1; struct extent_map *em; - struct btrfs_trans_handle *trans; int ret; alloc_start = offset & ~mask; alloc_end = (offset + len + mask) & ~mask; - /* - * wait for ordered IO before we have any locks. We'll loop again - * below with the locks held. - */ - btrfs_wait_ordered_range(inode, alloc_start, alloc_end - alloc_start); - mutex_lock(&inode->i_mutex); if (alloc_start > inode->i_size) { ret = btrfs_cont_expand(inode, alloc_start); @@ -5045,16 +5043,6 @@ static long btrfs_fallocate(struct inode *inode, int mode, while (1) { struct btrfs_ordered_extent *ordered; - - trans = btrfs_start_transaction(BTRFS_I(inode)->root, 1); - if (!trans) { - ret = -EIO; - goto out; - } - - /* the extent lock is ordered inside the running - * transaction - */ lock_extent(&BTRFS_I(inode)->io_tree, alloc_start, alloc_end - 1, GFP_NOFS); ordered = btrfs_lookup_first_ordered_extent(inode, @@ -5065,12 +5053,6 @@ static long btrfs_fallocate(struct inode *inode, int mode, btrfs_put_ordered_extent(ordered); unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, alloc_end - 1, GFP_NOFS); - btrfs_end_transaction(trans, BTRFS_I(inode)->root); - - /* - * we can't wait on the range with the transaction - * running or with the extent lock held - */ btrfs_wait_ordered_range(inode, alloc_start, alloc_end - alloc_start); } else { @@ -5088,7 +5070,7 @@ static long btrfs_fallocate(struct inode *inode, int mode, last_byte = min(extent_map_end(em), alloc_end); last_byte = (last_byte + mask) & ~mask; if (em->block_start == EXTENT_MAP_HOLE) { - ret = prealloc_file_range(trans, inode, cur_offset, + ret = prealloc_file_range(inode, cur_offset, last_byte, alloc_hint, mode); if (ret < 0) { free_extent_map(em); @@ -5107,8 +5089,6 @@ static long btrfs_fallocate(struct inode *inode, int mode, } unlock_extent(&BTRFS_I(inode)->io_tree, alloc_start, alloc_end - 1, GFP_NOFS); - - btrfs_end_transaction(trans, BTRFS_I(inode)->root); out: mutex_unlock(&inode->i_mutex); return ret; diff --git a/trunk/fs/btrfs/ioctl.c b/trunk/fs/btrfs/ioctl.c index 9f135e878507..7594bec1be10 100644 --- a/trunk/fs/btrfs/ioctl.c +++ b/trunk/fs/btrfs/ioctl.c @@ -461,9 +461,15 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) - return PTR_ERR(vol_args); + vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS); + + if (!vol_args) + return -ENOMEM; + + if (copy_from_user(vol_args, arg, sizeof(*vol_args))) { + ret = -EFAULT; + goto out; + } vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; namelen = strlen(vol_args->name); @@ -539,6 +545,7 @@ static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg) out_unlock: mutex_unlock(&root->fs_info->volume_mutex); +out: kfree(vol_args); return ret; } @@ -558,9 +565,15 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, if (root->fs_info->sb->s_flags & MS_RDONLY) return -EROFS; - vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) - return PTR_ERR(vol_args); + vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS); + + if (!vol_args) + return -ENOMEM; + + if (copy_from_user(vol_args, arg, sizeof(*vol_args))) { + ret = -EFAULT; + goto out; + } vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; namelen = strlen(vol_args->name); @@ -662,13 +675,19 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) - return PTR_ERR(vol_args); + vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS); + if (!vol_args) + return -ENOMEM; + + if (copy_from_user(vol_args, arg, sizeof(*vol_args))) { + ret = -EFAULT; + goto out; + } vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; ret = btrfs_init_new_device(root, vol_args->name); +out: kfree(vol_args); return ret; } @@ -684,13 +703,19 @@ static long btrfs_ioctl_rm_dev(struct btrfs_root *root, void __user *arg) if (root->fs_info->sb->s_flags & MS_RDONLY) return -EROFS; - vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) - return PTR_ERR(vol_args); + vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS); + if (!vol_args) + return -ENOMEM; + + if (copy_from_user(vol_args, arg, sizeof(*vol_args))) { + ret = -EFAULT; + goto out; + } vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; ret = btrfs_rm_device(root, vol_args->name); +out: kfree(vol_args); return ret; } diff --git a/trunk/fs/btrfs/ordered-data.c b/trunk/fs/btrfs/ordered-data.c index d6f0806c682f..53c87b197d70 100644 --- a/trunk/fs/btrfs/ordered-data.c +++ b/trunk/fs/btrfs/ordered-data.c @@ -489,7 +489,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) /* start IO across the range first to instantiate any delalloc * extents */ - btrfs_fdatawrite_range(inode->i_mapping, start, orig_end, WB_SYNC_ALL); + btrfs_fdatawrite_range(inode->i_mapping, start, orig_end, WB_SYNC_NONE); /* The compression code will leave pages locked but return from * writepage without setting the page writeback. Starting again diff --git a/trunk/fs/btrfs/super.c b/trunk/fs/btrfs/super.c index a7acfe639a44..9744af9d71e9 100644 --- a/trunk/fs/btrfs/super.c +++ b/trunk/fs/btrfs/super.c @@ -635,9 +635,14 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - vol = memdup_user((void __user *)arg, sizeof(*vol)); - if (IS_ERR(vol)) - return PTR_ERR(vol); + vol = kmalloc(sizeof(*vol), GFP_KERNEL); + if (!vol) + return -ENOMEM; + + if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { + ret = -EFAULT; + goto out; + } switch (cmd) { case BTRFS_IOC_SCAN_DEV: @@ -645,7 +650,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd, &btrfs_fs_type, &fs_devices); break; } - +out: kfree(vol); return ret; } diff --git a/trunk/fs/btrfs/volumes.c b/trunk/fs/btrfs/volumes.c index e53835b88594..e0913e469728 100644 --- a/trunk/fs/btrfs/volumes.c +++ b/trunk/fs/btrfs/volumes.c @@ -125,20 +125,6 @@ static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid) return NULL; } -static void requeue_list(struct btrfs_pending_bios *pending_bios, - struct bio *head, struct bio *tail) -{ - - struct bio *old_head; - - old_head = pending_bios->head; - pending_bios->head = head; - if (pending_bios->tail) - tail->bi_next = old_head; - else - pending_bios->tail = tail; -} - /* * we try to collect pending bios for a device so we don't get a large * number of procs sending bios down to the same device. This greatly @@ -155,12 +141,10 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) struct bio *pending; struct backing_dev_info *bdi; struct btrfs_fs_info *fs_info; - struct btrfs_pending_bios *pending_bios; struct bio *tail; struct bio *cur; int again = 0; - unsigned long num_run; - unsigned long num_sync_run; + unsigned long num_run = 0; unsigned long limit; unsigned long last_waited = 0; @@ -169,30 +153,20 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) limit = btrfs_async_submit_limit(fs_info); limit = limit * 2 / 3; - /* we want to make sure that every time we switch from the sync - * list to the normal list, we unplug - */ - num_sync_run = 0; - loop: spin_lock(&device->io_lock); - num_run = 0; loop_lock: - /* take all the bios off the list at once and process them * later on (without the lock held). But, remember the * tail and other pointers so the bios can be properly reinserted * into the list if we hit congestion */ - if (device->pending_sync_bios.head) - pending_bios = &device->pending_sync_bios; - else - pending_bios = &device->pending_bios; - - pending = pending_bios->head; - tail = pending_bios->tail; + pending = device->pending_bios; + tail = device->pending_bio_tail; WARN_ON(pending && !tail); + device->pending_bios = NULL; + device->pending_bio_tail = NULL; /* * if pending was null this time around, no bios need processing @@ -202,41 +176,16 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) * device->running_pending is used to synchronize with the * schedule_bio code. */ - if (device->pending_sync_bios.head == NULL && - device->pending_bios.head == NULL) { - again = 0; - device->running_pending = 0; - } else { + if (pending) { again = 1; device->running_pending = 1; + } else { + again = 0; + device->running_pending = 0; } - - pending_bios->head = NULL; - pending_bios->tail = NULL; - spin_unlock(&device->io_lock); - /* - * if we're doing the regular priority list, make sure we unplug - * for any high prio bios we've sent down - */ - if (pending_bios == &device->pending_bios && num_sync_run > 0) { - num_sync_run = 0; - blk_run_backing_dev(bdi, NULL); - } - while (pending) { - - rmb(); - if (pending_bios != &device->pending_sync_bios && - device->pending_sync_bios.head && - num_run > 16) { - cond_resched(); - spin_lock(&device->io_lock); - requeue_list(pending_bios, pending, tail); - goto loop_lock; - } - cur = pending; pending = pending->bi_next; cur->bi_next = NULL; @@ -247,18 +196,10 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) wake_up(&fs_info->async_submit_wait); BUG_ON(atomic_read(&cur->bi_cnt) == 0); + bio_get(cur); submit_bio(cur->bi_rw, cur); + bio_put(cur); num_run++; - if (bio_sync(cur)) - num_sync_run++; - - if (need_resched()) { - if (num_sync_run) { - blk_run_backing_dev(bdi, NULL); - num_sync_run = 0; - } - cond_resched(); - } /* * we made progress, there is more work to do and the bdi @@ -267,6 +208,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) */ if (pending && bdi_write_congested(bdi) && num_run > 16 && fs_info->fs_devices->open_devices > 1) { + struct bio *old_head; struct io_context *ioc; ioc = current->io_context; @@ -291,17 +233,17 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) * against it before looping */ last_waited = ioc->last_waited; - if (need_resched()) { - if (num_sync_run) { - blk_run_backing_dev(bdi, NULL); - num_sync_run = 0; - } - cond_resched(); - } continue; } spin_lock(&device->io_lock); - requeue_list(pending_bios, pending, tail); + + old_head = device->pending_bios; + device->pending_bios = pending; + if (device->pending_bio_tail) + tail->bi_next = old_head; + else + device->pending_bio_tail = tail; + device->running_pending = 1; spin_unlock(&device->io_lock); @@ -309,18 +251,11 @@ static noinline int run_scheduled_bios(struct btrfs_device *device) goto done; } } - - if (num_sync_run) { - num_sync_run = 0; - blk_run_backing_dev(bdi, NULL); - } - - cond_resched(); if (again) goto loop; spin_lock(&device->io_lock); - if (device->pending_bios.head || device->pending_sync_bios.head) + if (device->pending_bios) goto loop_lock; spin_unlock(&device->io_lock); @@ -2562,7 +2497,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, max_errors = 1; } } - if (multi_ret && (rw & (1 << BIO_RW)) && + if (multi_ret && rw == WRITE && stripes_allocated < stripes_required) { stripes_allocated = map->num_stripes; free_extent_map(em); @@ -2827,7 +2762,6 @@ static noinline int schedule_bio(struct btrfs_root *root, int rw, struct bio *bio) { int should_queue = 1; - struct btrfs_pending_bios *pending_bios; /* don't bother with additional async steps for reads, right now */ if (!(rw & (1 << BIO_RW))) { @@ -2849,17 +2783,13 @@ static noinline int schedule_bio(struct btrfs_root *root, bio->bi_rw |= rw; spin_lock(&device->io_lock); - if (bio_sync(bio)) - pending_bios = &device->pending_sync_bios; - else - pending_bios = &device->pending_bios; - if (pending_bios->tail) - pending_bios->tail->bi_next = bio; + if (device->pending_bio_tail) + device->pending_bio_tail->bi_next = bio; - pending_bios->tail = bio; - if (!pending_bios->head) - pending_bios->head = bio; + device->pending_bio_tail = bio; + if (!device->pending_bios) + device->pending_bios = bio; if (device->running_pending) should_queue = 0; diff --git a/trunk/fs/btrfs/volumes.h b/trunk/fs/btrfs/volumes.h index 5836327ba5dd..2185de72ff7d 100644 --- a/trunk/fs/btrfs/volumes.h +++ b/trunk/fs/btrfs/volumes.h @@ -23,22 +23,13 @@ #include "async-thread.h" struct buffer_head; -struct btrfs_pending_bios { - struct bio *head; - struct bio *tail; -}; - struct btrfs_device { struct list_head dev_list; struct list_head dev_alloc_list; struct btrfs_fs_devices *fs_devices; struct btrfs_root *dev_root; - - /* regular prio bios */ - struct btrfs_pending_bios pending_bios; - /* WRITE_SYNC bios */ - struct btrfs_pending_bios pending_sync_bios; - + struct bio *pending_bios; + struct bio *pending_bio_tail; int running_pending; u64 generation; diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 379a399bf5c3..3f84d5f15889 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -181,24 +181,22 @@ asmlinkage long compat_sys_newstat(char __user * filename, struct compat_stat __user *statbuf) { struct kstat stat; - int error; + int error = vfs_stat_fd(AT_FDCWD, filename, &stat); - error = vfs_stat(filename, &stat); - if (error) - return error; - return cp_compat_stat(&stat, statbuf); + if (!error) + error = cp_compat_stat(&stat, statbuf); + return error; } asmlinkage long compat_sys_newlstat(char __user * filename, struct compat_stat __user *statbuf) { struct kstat stat; - int error; + int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); - error = vfs_lstat(filename, &stat); - if (error) - return error; - return cp_compat_stat(&stat, statbuf); + if (!error) + error = cp_compat_stat(&stat, statbuf); + return error; } #ifndef __ARCH_WANT_STAT64 @@ -206,12 +204,21 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename, struct compat_stat __user *statbuf, int flag) { struct kstat stat; - int error; + int error = -EINVAL; - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_compat_stat(&stat, statbuf); + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; + + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); + + if (!error) + error = cp_compat_stat(&stat, statbuf); + +out: + return error; } #endif diff --git a/trunk/fs/compat_ioctl.c b/trunk/fs/compat_ioctl.c index b83f6bcfa51a..3e87ce443ea2 100644 --- a/trunk/fs/compat_ioctl.c +++ b/trunk/fs/compat_ioctl.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -67,7 +68,6 @@ #include #ifdef CONFIG_BLOCK -#include #include #include #include @@ -2660,8 +2660,6 @@ HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) /* block stuff */ #ifdef CONFIG_BLOCK -/* loop */ -IGNORE_IOCTL(LOOP_CLR_FD) /* Raw devices */ HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) @@ -2730,6 +2728,9 @@ HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans) IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32) IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32) +/* loop */ +IGNORE_IOCTL(LOOP_CLR_FD) + #ifdef CONFIG_SPARC /* Sparc framebuffers, handled in sbusfb_compat_ioctl() */ IGNORE_IOCTL(FBIOGTYPE) diff --git a/trunk/fs/dcache.c b/trunk/fs/dcache.c index 1fcffebfb44f..761d30be2683 100644 --- a/trunk/fs/dcache.c +++ b/trunk/fs/dcache.c @@ -2149,6 +2149,7 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) int result; unsigned long seq; + /* FIXME: This is old behavior, needed? Please check callers. */ if (new_dentry == old_dentry) return 1; diff --git a/trunk/fs/ecryptfs/miscdev.c b/trunk/fs/ecryptfs/miscdev.c index dda3c58eefc0..a67fea655f49 100644 --- a/trunk/fs/ecryptfs/miscdev.c +++ b/trunk/fs/ecryptfs/miscdev.c @@ -418,13 +418,18 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, if (count == 0) goto out; - - data = memdup_user(buf, count); - if (IS_ERR(data)) { - printk(KERN_ERR "%s: memdup_user returned error [%ld]\n", - __func__, PTR_ERR(data)); + data = kmalloc(count, GFP_KERNEL); + if (!data) { + printk(KERN_ERR "%s: Out of memory whilst attempting to " + "kmalloc([%zd], GFP_KERNEL)\n", __func__, count); goto out; } + rc = copy_from_user(data, buf, count); + if (rc) { + printk(KERN_ERR "%s: copy_from_user returned error [%d]\n", + __func__, rc); + goto out_free; + } sz = count; i = 0; switch (data[i++]) { diff --git a/trunk/fs/filesystems.c b/trunk/fs/filesystems.c index a24c58e181db..1aa70260e6d1 100644 --- a/trunk/fs/filesystems.c +++ b/trunk/fs/filesystems.c @@ -199,7 +199,7 @@ SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2) return retval; } -int __init get_filesystem_list(char *buf) +int get_filesystem_list(char * buf) { int len = 0; struct file_system_type * tmp; diff --git a/trunk/fs/gfs2/glops.c b/trunk/fs/gfs2/glops.c index 70f87f43afa2..bf23a62aa925 100644 --- a/trunk/fs/gfs2/glops.c +++ b/trunk/fs/gfs2/glops.c @@ -156,12 +156,6 @@ static void inode_go_sync(struct gfs2_glock *gl) error = filemap_fdatawait(metamapping); mapping_set_error(metamapping, error); gfs2_ail_empty_gl(gl); - /* - * Writeback of the data mapping may cause the dirty flag to be set - * so we have to clear it again here. - */ - smp_mb__before_clear_bit(); - clear_bit(GLF_DIRTY, &gl->gl_flags); } /** diff --git a/trunk/fs/gfs2/ops_file.c b/trunk/fs/gfs2/ops_file.c index 5d82e91887e3..101caf3ee861 100644 --- a/trunk/fs/gfs2/ops_file.c +++ b/trunk/fs/gfs2/ops_file.c @@ -413,9 +413,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) gfs2_glock_dq(&gh); out: gfs2_holder_uninit(&gh); - if (ret == -ENOMEM) - ret = VM_FAULT_OOM; - else if (ret) + if (ret) ret = VM_FAULT_SIGBUS; return ret; } diff --git a/trunk/fs/hugetlbfs/inode.c b/trunk/fs/hugetlbfs/inode.c index 153d9681192b..23a3c76711e0 100644 --- a/trunk/fs/hugetlbfs/inode.c +++ b/trunk/fs/hugetlbfs/inode.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -841,7 +842,7 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig) bad_val: printk(KERN_ERR "hugetlbfs: Bad value '%s' for mount option '%s'\n", args[0].from, p); - return -EINVAL; + return 1; } static int diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 78f253cd2d4f..b8433ebfae05 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1248,8 +1248,6 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) int err; struct qstr this; - WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); - err = __lookup_one_len(name, &this, base, len); if (err) return ERR_PTR(err); diff --git a/trunk/fs/namespace.c b/trunk/fs/namespace.c index 41196209a906..d9138f81ec10 100644 --- a/trunk/fs/namespace.c +++ b/trunk/fs/namespace.c @@ -1377,7 +1377,7 @@ static int attach_recursive_mnt(struct vfsmount *source_mnt, if (parent_path) { detach_mnt(source_mnt, parent_path); attach_mnt(source_mnt, path); - touch_mnt_namespace(parent_path->mnt->mnt_ns); + touch_mnt_namespace(current->nsproxy->mnt_ns); } else { mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); commit_tree(source_mnt); diff --git a/trunk/fs/ncpfs/ioctl.c b/trunk/fs/ncpfs/ioctl.c index fa038df63ac8..f54360f50a9c 100644 --- a/trunk/fs/ncpfs/ioctl.c +++ b/trunk/fs/ncpfs/ioctl.c @@ -660,10 +660,13 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp, if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN) return -ENOMEM; if (user.object_name_len) { - newname = memdup_user(user.object_name, - user.object_name_len); - if (IS_ERR(newname)) - return PTR_ERR(newname); + newname = kmalloc(user.object_name_len, GFP_USER); + if (!newname) + return -ENOMEM; + if (copy_from_user(newname, user.object_name, user.object_name_len)) { + kfree(newname); + return -EFAULT; + } } else { newname = NULL; } @@ -757,9 +760,13 @@ static int __ncp_ioctl(struct inode *inode, struct file *filp, if (user.len > NCP_PRIVATE_DATA_MAX_LEN) return -ENOMEM; if (user.len) { - new = memdup_user(user.data, user.len); - if (IS_ERR(new)) - return PTR_ERR(new); + new = kmalloc(user.len, GFP_USER); + if (!new) + return -ENOMEM; + if (copy_from_user(new, user.data, user.len)) { + kfree(new); + return -EFAULT; + } } else { new = NULL; } diff --git a/trunk/fs/nfs/nfs3xdr.c b/trunk/fs/nfs/nfs3xdr.c index 35869a4921f1..e6a1932c7110 100644 --- a/trunk/fs/nfs/nfs3xdr.c +++ b/trunk/fs/nfs/nfs3xdr.c @@ -713,8 +713,7 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p, if (args->npages != 0) xdr_encode_pages(buf, args->pages, 0, args->len); else - req->rq_slen = xdr_adjust_iovec(req->rq_svec, - p + XDR_QUADLEN(args->len)); + req->rq_slen += args->len; err = nfsacl_encode(buf, base, args->inode, (args->mask & NFS_ACL) ? diff --git a/trunk/fs/nfsd/nfs4recover.c b/trunk/fs/nfsd/nfs4recover.c index 5275097a7565..3444c0052a87 100644 --- a/trunk/fs/nfsd/nfs4recover.c +++ b/trunk/fs/nfsd/nfs4recover.c @@ -229,23 +229,21 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f) goto out; status = vfs_readdir(filp, nfsd4_build_namelist, &names); fput(filp); - mutex_lock(&dir->d_inode->i_mutex); while (!list_empty(&names)) { entry = list_entry(names.next, struct name_list, list); dentry = lookup_one_len(entry->name, dir, HEXDIR_LEN-1); if (IS_ERR(dentry)) { status = PTR_ERR(dentry); - break; + goto out; } status = f(dir, dentry); dput(dentry); if (status) - break; + goto out; list_del(&entry->list); kfree(entry); } - mutex_unlock(&dir->d_inode->i_mutex); out: while (!list_empty(&names)) { entry = list_entry(names.next, struct name_list, list); @@ -256,6 +254,36 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f) return status; } +static int +nfsd4_remove_clid_file(struct dentry *dir, struct dentry *dentry) +{ + int status; + + if (!S_ISREG(dir->d_inode->i_mode)) { + printk("nfsd4: non-file found in client recovery directory\n"); + return -EINVAL; + } + mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); + status = vfs_unlink(dir->d_inode, dentry); + mutex_unlock(&dir->d_inode->i_mutex); + return status; +} + +static int +nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry) +{ + int status; + + /* For now this directory should already be empty, but we empty it of + * any regular files anyway, just in case the directory was created by + * a kernel from the future.... */ + nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file); + mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); + status = vfs_rmdir(dir->d_inode, dentry); + mutex_unlock(&dir->d_inode->i_mutex); + return status; +} + static int nfsd4_unlink_clid_dir(char *name, int namlen) { @@ -266,18 +294,18 @@ nfsd4_unlink_clid_dir(char *name, int namlen) mutex_lock(&rec_dir.dentry->d_inode->i_mutex); dentry = lookup_one_len(name, rec_dir.dentry, namlen); + mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); if (IS_ERR(dentry)) { status = PTR_ERR(dentry); - goto out_unlock; + return status; } status = -ENOENT; if (!dentry->d_inode) goto out; - status = vfs_rmdir(rec_dir.dentry->d_inode, dentry); + + status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry); out: dput(dentry); -out_unlock: - mutex_unlock(&rec_dir.dentry->d_inode->i_mutex); return status; } @@ -320,7 +348,7 @@ purge_old(struct dentry *parent, struct dentry *child) if (nfs4_has_reclaimed_state(child->d_name.name, false)) return 0; - status = vfs_rmdir(parent->d_inode, child); + status = nfsd4_clear_clid_dir(parent, child); if (status) printk("failed to remove client recovery directory %s\n", child->d_name.name); diff --git a/trunk/fs/nfsd/vfs.c b/trunk/fs/nfsd/vfs.c index 6c68ffd6b4bb..ab93fcfef254 100644 --- a/trunk/fs/nfsd/vfs.c +++ b/trunk/fs/nfsd/vfs.c @@ -116,15 +116,10 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, } if ((exp->ex_flags & NFSEXP_CROSSMOUNT) || EX_NOHIDE(exp2)) { /* successfully crossed mount point */ - /* - * This is subtle: dentry is *not* under mnt at this point. - * The only reason we are safe is that original mnt is pinned - * down by exp, so we should dput before putting exp. - */ - dput(dentry); - *dpp = mounts; exp_put(exp); *expp = exp2; + dput(dentry); + *dpp = mounts; } else { exp_put(exp2); dput(mounts); @@ -1890,8 +1885,8 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, return 0; } -static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, - struct readdir_cd *cdp, loff_t *offsetp) +static int nfsd_buffered_readdir(struct file *file, filldir_t func, + struct readdir_cd *cdp, loff_t *offsetp) { struct readdir_data buf; struct buffered_dirent *de; @@ -1901,12 +1896,11 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, buf.dirent = (void *)__get_free_page(GFP_KERNEL); if (!buf.dirent) - return nfserrno(-ENOMEM); + return -ENOMEM; offset = *offsetp; while (1) { - struct inode *dir_inode = file->f_path.dentry->d_inode; unsigned int reclen; cdp->err = nfserr_eof; /* will be cleared on successful read */ @@ -1925,38 +1919,26 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, if (!size) break; - /* - * Various filldir functions may end up calling back into - * lookup_one_len() and the file system's ->lookup() method. - * These expect i_mutex to be held, as it would within readdir. - */ - host_err = mutex_lock_killable(&dir_inode->i_mutex); - if (host_err) - break; - de = (struct buffered_dirent *)buf.dirent; while (size > 0) { offset = de->offset; if (func(cdp, de->name, de->namlen, de->offset, de->ino, de->d_type)) - break; + goto done; if (cdp->err != nfs_ok) - break; + goto done; reclen = ALIGN(sizeof(*de) + de->namlen, sizeof(u64)); size -= reclen; de = (struct buffered_dirent *)((char *)de + reclen); } - mutex_unlock(&dir_inode->i_mutex); - if (size > 0) /* We bailed out early */ - break; - offset = vfs_llseek(file, 0, SEEK_CUR); } + done: free_page((unsigned long)(buf.dirent)); if (host_err) diff --git a/trunk/fs/stat.c b/trunk/fs/stat.c index 075694e31d8b..2db740a0cfb5 100644 --- a/trunk/fs/stat.c +++ b/trunk/fs/stat.c @@ -55,54 +55,59 @@ int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) EXPORT_SYMBOL(vfs_getattr); -int vfs_fstat(unsigned int fd, struct kstat *stat) +int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat) { - struct file *f = fget(fd); - int error = -EBADF; + struct path path; + int error; - if (f) { - error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat); - fput(f); + error = user_path_at(dfd, name, LOOKUP_FOLLOW, &path); + if (!error) { + error = vfs_getattr(path.mnt, path.dentry, stat); + path_put(&path); } return error; } -EXPORT_SYMBOL(vfs_fstat); -int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag) +int vfs_stat(char __user *name, struct kstat *stat) { - struct path path; - int error = -EINVAL; - int lookup_flags = 0; - - if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) - goto out; + return vfs_stat_fd(AT_FDCWD, name, stat); +} - if (!(flag & AT_SYMLINK_NOFOLLOW)) - lookup_flags |= LOOKUP_FOLLOW; +EXPORT_SYMBOL(vfs_stat); - error = user_path_at(dfd, filename, lookup_flags, &path); - if (error) - goto out; +int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat) +{ + struct path path; + int error; - error = vfs_getattr(path.mnt, path.dentry, stat); - path_put(&path); -out: + error = user_path_at(dfd, name, 0, &path); + if (!error) { + error = vfs_getattr(path.mnt, path.dentry, stat); + path_put(&path); + } return error; } -EXPORT_SYMBOL(vfs_fstatat); -int vfs_stat(char __user *name, struct kstat *stat) +int vfs_lstat(char __user *name, struct kstat *stat) { - return vfs_fstatat(AT_FDCWD, name, stat, 0); + return vfs_lstat_fd(AT_FDCWD, name, stat); } -EXPORT_SYMBOL(vfs_stat); -int vfs_lstat(char __user *name, struct kstat *stat) +EXPORT_SYMBOL(vfs_lstat); + +int vfs_fstat(unsigned int fd, struct kstat *stat) { - return vfs_fstatat(AT_FDCWD, name, stat, AT_SYMLINK_NOFOLLOW); + struct file *f = fget(fd); + int error = -EBADF; + + if (f) { + error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat); + fput(f); + } + return error; } -EXPORT_SYMBOL(vfs_lstat); +EXPORT_SYMBOL(vfs_fstat); #ifdef __ARCH_WANT_OLD_STAT @@ -150,25 +155,23 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) { struct kstat stat; - int error; + int error = vfs_stat_fd(AT_FDCWD, filename, &stat); - error = vfs_stat(filename, &stat); - if (error) - return error; + if (!error) + error = cp_old_stat(&stat, statbuf); - return cp_old_stat(&stat, statbuf); + return error; } SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) { struct kstat stat; - int error; + int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); - error = vfs_lstat(filename, &stat); - if (error) - return error; + if (!error) + error = cp_old_stat(&stat, statbuf); - return cp_old_stat(&stat, statbuf); + return error; } SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf) @@ -237,23 +240,23 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf) { struct kstat stat; - int error = vfs_stat(filename, &stat); + int error = vfs_stat_fd(AT_FDCWD, filename, &stat); - if (error) - return error; - return cp_new_stat(&stat, statbuf); + if (!error) + error = cp_new_stat(&stat, statbuf); + + return error; } SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf) { struct kstat stat; - int error; + int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); - error = vfs_lstat(filename, &stat); - if (error) - return error; + if (!error) + error = cp_new_stat(&stat, statbuf); - return cp_new_stat(&stat, statbuf); + return error; } #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) @@ -261,12 +264,21 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename, struct stat __user *, statbuf, int, flag) { struct kstat stat; - int error; + int error = -EINVAL; - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_new_stat(&stat, statbuf); + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; + + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); + + if (!error) + error = cp_new_stat(&stat, statbuf); + +out: + return error; } #endif @@ -392,12 +404,21 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, struct stat64 __user *, statbuf, int, flag) { struct kstat stat; - int error; + int error = -EINVAL; + + if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) + goto out; + + if (flag & AT_SYMLINK_NOFOLLOW) + error = vfs_lstat_fd(dfd, filename, &stat); + else + error = vfs_stat_fd(dfd, filename, &stat); - error = vfs_fstatat(dfd, filename, &stat, flag); - if (error) - return error; - return cp_new_stat64(&stat, statbuf); + if (!error) + error = cp_new_stat64(&stat, statbuf); + +out: + return error; } #endif /* __ARCH_WANT_STAT64 */ diff --git a/trunk/fs/sysfs/bin.c b/trunk/fs/sysfs/bin.c index 9345806c8853..93e0c0281d45 100644 --- a/trunk/fs/sysfs/bin.c +++ b/trunk/fs/sysfs/bin.c @@ -157,9 +157,14 @@ static ssize_t write(struct file *file, const char __user *userbuf, count = size - offs; } - temp = memdup_user(userbuf, count); - if (IS_ERR(temp)) - return PTR_ERR(temp); + temp = kmalloc(count, GFP_KERNEL); + if (!temp) + return -ENOMEM; + + if (copy_from_user(temp, userbuf, count)) { + count = -EFAULT; + goto out_free; + } mutex_lock(&bb->mutex); @@ -171,6 +176,8 @@ static ssize_t write(struct file *file, const char __user *userbuf, if (count > 0) *off = offs + count; +out_free: + kfree(temp); return count; } diff --git a/trunk/fs/xattr.c b/trunk/fs/xattr.c index d51b8f9db921..197c4fcac032 100644 --- a/trunk/fs/xattr.c +++ b/trunk/fs/xattr.c @@ -237,9 +237,13 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, if (size) { if (size > XATTR_SIZE_MAX) return -E2BIG; - kvalue = memdup_user(value, size); - if (IS_ERR(kvalue)) - return PTR_ERR(kvalue); + kvalue = kmalloc(size, GFP_KERNEL); + if (!kvalue) + return -ENOMEM; + if (copy_from_user(kvalue, value, size)) { + kfree(kvalue); + return -EFAULT; + } } error = vfs_setxattr(d, kname, kvalue, size, flags); diff --git a/trunk/fs/xfs/linux-2.6/xfs_ioctl.c b/trunk/fs/xfs/linux-2.6/xfs_ioctl.c index 34eaab608e6e..d0b499418a7d 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/trunk/fs/xfs/linux-2.6/xfs_ioctl.c @@ -489,12 +489,17 @@ xfs_attrmulti_attr_set( if (len > XATTR_SIZE_MAX) return EINVAL; - kbuf = memdup_user(ubuf, len); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); + kbuf = kmalloc(len, GFP_KERNEL); + if (!kbuf) + return ENOMEM; + + if (copy_from_user(kbuf, ubuf, len)) + goto out_kfree; error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags); + out_kfree: + kfree(kbuf); return error; } @@ -535,16 +540,20 @@ xfs_attrmulti_by_handle( if (!size || size > 16 * PAGE_SIZE) goto out_dput; - ops = memdup_user(am_hreq.ops, size); - if (IS_ERR(ops)) { - error = PTR_ERR(ops); + error = ENOMEM; + ops = kmalloc(size, GFP_KERNEL); + if (!ops) goto out_dput; - } + + error = EFAULT; + if (copy_from_user(ops, am_hreq.ops, size)) + goto out_kfree_ops; attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); if (!attr_name) goto out_kfree_ops; + error = 0; for (i = 0; i < am_hreq.opcount; i++) { ops[i].am_error = strncpy_from_user(attr_name, diff --git a/trunk/fs/xfs/linux-2.6/xfs_ioctl32.c b/trunk/fs/xfs/linux-2.6/xfs_ioctl32.c index 0882d166239a..c70c4e3db790 100644 --- a/trunk/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/trunk/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -427,16 +427,20 @@ xfs_compat_attrmulti_by_handle( if (!size || size > 16 * PAGE_SIZE) goto out_dput; - ops = memdup_user(compat_ptr(am_hreq.ops), size); - if (IS_ERR(ops)) { - error = PTR_ERR(ops); + error = ENOMEM; + ops = kmalloc(size, GFP_KERNEL); + if (!ops) goto out_dput; - } + + error = EFAULT; + if (copy_from_user(ops, compat_ptr(am_hreq.ops), size)) + goto out_kfree_ops; attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); if (!attr_name) goto out_kfree_ops; + error = 0; for (i = 0; i < am_hreq.opcount; i++) { ops[i].am_error = strncpy_from_user(attr_name, diff --git a/trunk/include/acpi/processor.h b/trunk/include/acpi/processor.h index 4927c063347c..b09c4fde9725 100644 --- a/trunk/include/acpi/processor.h +++ b/trunk/include/acpi/processor.h @@ -84,6 +84,7 @@ struct acpi_processor_power { struct acpi_processor_cx *state; unsigned long bm_check_timestamp; u32 default_state; + u32 bm_activity; int count; struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; int timer_broadcast_on_state; diff --git a/trunk/include/asm-generic/percpu.h b/trunk/include/asm-generic/percpu.h index d7d50d7ee51e..b0e63c672ebd 100644 --- a/trunk/include/asm-generic/percpu.h +++ b/trunk/include/asm-generic/percpu.h @@ -1,9 +1,13 @@ #ifndef _ASM_GENERIC_PERCPU_H_ #define _ASM_GENERIC_PERCPU_H_ - #include #include -#include + +/* + * Determine the real variable name from the name visible in the + * kernel sources. + */ +#define per_cpu_var(var) per_cpu__##var #ifdef CONFIG_SMP @@ -69,32 +73,11 @@ extern void setup_per_cpu_areas(void); #endif /* SMP */ -#ifndef PER_CPU_BASE_SECTION -#ifdef CONFIG_SMP -#define PER_CPU_BASE_SECTION ".data.percpu" -#else -#define PER_CPU_BASE_SECTION ".data" -#endif -#endif - -#ifdef CONFIG_SMP - -#ifdef MODULE -#define PER_CPU_SHARED_ALIGNED_SECTION "" -#else -#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" -#endif -#define PER_CPU_FIRST_SECTION ".first" - -#else - -#define PER_CPU_SHARED_ALIGNED_SECTION "" -#define PER_CPU_FIRST_SECTION "" - -#endif - #ifndef PER_CPU_ATTRIBUTES #define PER_CPU_ATTRIBUTES #endif +#define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ + __typeof__(type) per_cpu_var(name) + #endif /* _ASM_GENERIC_PERCPU_H_ */ diff --git a/trunk/include/linux/acpi.h b/trunk/include/linux/acpi.h index 88be890ee3c7..6586cbd0d4af 100644 --- a/trunk/include/linux/acpi.h +++ b/trunk/include/linux/acpi.h @@ -111,7 +111,6 @@ int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); void acpi_irq_stats_init(void); extern u32 acpi_irq_handled; -extern u32 acpi_irq_not_handled; extern struct acpi_mcfg_allocation *pci_mmcfg_config; extern int pci_mmcfg_config_num; diff --git a/trunk/include/linux/clocksource.h b/trunk/include/linux/clocksource.h index 5a40d14daa9f..573819ef4cc0 100644 --- a/trunk/include/linux/clocksource.h +++ b/trunk/include/linux/clocksource.h @@ -143,9 +143,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, * 400-499: Perfect * The ideal clocksource. A must-use where * available. - * @read: returns a cycle value, passes clocksource as argument - * @enable: optional function to enable the clocksource - * @disable: optional function to disable the clocksource + * @read: returns a cycle value * @mask: bitmask for two's complement * subtraction of non 64 bit counters * @mult: cycle to nanosecond multiplier (adjusted by NTP) @@ -164,9 +162,7 @@ struct clocksource { char *name; struct list_head list; int rating; - cycle_t (*read)(struct clocksource *cs); - int (*enable)(struct clocksource *cs); - void (*disable)(struct clocksource *cs); + cycle_t (*read)(void); cycle_t mask; u32 mult; u32 mult_orig; @@ -275,34 +271,7 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant) */ static inline cycle_t clocksource_read(struct clocksource *cs) { - return cs->read(cs); -} - -/** - * clocksource_enable: - enable clocksource - * @cs: pointer to clocksource - * - * Enables the specified clocksource. The clocksource callback - * function should start up the hardware and setup mult and field - * members of struct clocksource to reflect hardware capabilities. - */ -static inline int clocksource_enable(struct clocksource *cs) -{ - return cs->enable ? cs->enable(cs) : 0; -} - -/** - * clocksource_disable: - disable clocksource - * @cs: pointer to clocksource - * - * Disables the specified clocksource. The clocksource callback - * function should power down the now unused hardware block to - * save power. - */ -static inline void clocksource_disable(struct clocksource *cs) -{ - if (cs->disable) - cs->disable(cs); + return cs->read(); } /** diff --git a/trunk/include/linux/device.h b/trunk/include/linux/device.h index 6a69caaac18a..2918c0e8fdfd 100644 --- a/trunk/include/linux/device.h +++ b/trunk/include/linux/device.h @@ -551,7 +551,6 @@ extern int (*platform_notify_remove)(struct device *dev); extern struct device *get_device(struct device *dev); extern void put_device(struct device *dev); -extern void wait_for_device_probe(void); /* drivers/base/power/shutdown.c */ extern void device_shutdown(void); diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 5bed436f4353..e766be0d4329 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -2299,8 +2299,9 @@ extern int vfs_readdir(struct file *, filldir_t, void *); extern int vfs_stat(char __user *, struct kstat *); extern int vfs_lstat(char __user *, struct kstat *); +extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); +extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); extern int vfs_fstat(unsigned int, struct kstat *); -extern int vfs_fstatat(int , char __user *, struct kstat *, int); extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg); @@ -2448,7 +2449,7 @@ struct ctl_table; int proc_nr_files(struct ctl_table *table, int write, struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos); -int __init get_filesystem_list(char *buf); +int get_filesystem_list(char * buf); #endif /* __KERNEL__ */ #endif /* _LINUX_FS_H */ diff --git a/trunk/include/linux/ipmi.h b/trunk/include/linux/ipmi.h index 65aae34759de..7ebdb4fb4e54 100644 --- a/trunk/include/linux/ipmi.h +++ b/trunk/include/linux/ipmi.h @@ -198,8 +198,6 @@ struct kernel_ipmi_msg { response. When you send a response message, this will be returned. */ -#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */ - /* Note that async events and received commands do not have a completion code as the first byte of the incoming data, unlike a response. */ diff --git a/trunk/include/linux/ipmi_msgdefs.h b/trunk/include/linux/ipmi_msgdefs.h index df97e6e31e87..b56a158d587a 100644 --- a/trunk/include/linux/ipmi_msgdefs.h +++ b/trunk/include/linux/ipmi_msgdefs.h @@ -58,12 +58,6 @@ #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 #define IPMI_GET_CHANNEL_INFO_CMD 0x42 -/* Bit for BMC global enables. */ -#define IPMI_BMC_RCV_MSG_INTR 0x01 -#define IPMI_BMC_EVT_MSG_INTR 0x02 -#define IPMI_BMC_EVT_MSG_BUFF 0x04 -#define IPMI_BMC_SYS_LOG 0x08 - #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b #define IPMI_ADD_SEL_ENTRY_CMD 0x44 @@ -115,7 +109,5 @@ #define IPMI_CHANNEL_MEDIUM_USB1 10 #define IPMI_CHANNEL_MEDIUM_USB2 11 #define IPMI_CHANNEL_MEDIUM_SYSINTF 12 -#define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60 -#define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f #endif /* __LINUX_IPMI_MSGDEFS_H */ diff --git a/trunk/include/linux/memcontrol.h b/trunk/include/linux/memcontrol.h index a9e3b76aa884..18146c980b68 100644 --- a/trunk/include/linux/memcontrol.h +++ b/trunk/include/linux/memcontrol.h @@ -75,7 +75,7 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) { struct mem_cgroup *mem; rcu_read_lock(); - mem = mem_cgroup_from_task(rcu_dereference((mm)->owner)); + mem = mem_cgroup_from_task((mm)->owner); rcu_read_unlock(); return cgroup == mem; } diff --git a/trunk/include/linux/percpu-defs.h b/trunk/include/linux/percpu-defs.h deleted file mode 100644 index 8f921d74f49f..000000000000 --- a/trunk/include/linux/percpu-defs.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _LINUX_PERCPU_DEFS_H -#define _LINUX_PERCPU_DEFS_H - -/* - * Determine the real variable name from the name visible in the - * kernel sources. - */ -#define per_cpu_var(var) per_cpu__##var - -/* - * Base implementations of per-CPU variable declarations and definitions, where - * the section in which the variable is to be placed is provided by the - * 'section' argument. This may be used to affect the parameters governing the - * variable's storage. - * - * NOTE! The sections for the DECLARE and for the DEFINE must match, lest - * linkage errors occur due the compiler generating the wrong code to access - * that section. - */ -#define DECLARE_PER_CPU_SECTION(type, name, section) \ - extern \ - __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ - PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name - -#define DEFINE_PER_CPU_SECTION(type, name, section) \ - __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ - PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name - -/* - * Variant on the per-CPU variable declaration/definition theme used for - * ordinary per-CPU variables. - */ -#define DECLARE_PER_CPU(type, name) \ - DECLARE_PER_CPU_SECTION(type, name, "") - -#define DEFINE_PER_CPU(type, name) \ - DEFINE_PER_CPU_SECTION(type, name, "") - -/* - * Declaration/definition used for per-CPU variables that must come first in - * the set of variables. - */ -#define DECLARE_PER_CPU_FIRST(type, name) \ - DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) - -#define DEFINE_PER_CPU_FIRST(type, name) \ - DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) - -/* - * Declaration/definition used for per-CPU variables that must be cacheline - * aligned under SMP conditions so that, whilst a particular instance of the - * data corresponds to a particular CPU, inefficiencies due to direct access by - * other CPUs are reduced by preventing the data from unnecessarily spanning - * cachelines. - * - * An example of this would be statistical data, where each CPU's set of data - * is updated by that CPU alone, but the data from across all CPUs is collated - * by a CPU processing a read from a proc file. - */ -#define DECLARE_PER_CPU_SHARED_ALIGNED(type, name) \ - DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ - ____cacheline_aligned_in_smp - -#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ - DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ - ____cacheline_aligned_in_smp - -/* - * Declaration/definition used for per-CPU variables that must be page aligned. - */ -#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ - DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") - -#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ - DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") - -/* - * Intermodule exports for per-CPU variables. - */ -#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) -#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) - - -#endif /* _LINUX_PERCPU_DEFS_H */ diff --git a/trunk/include/linux/percpu.h b/trunk/include/linux/percpu.h index 1581ff235c7e..cfda2d5ad319 100644 --- a/trunk/include/linux/percpu.h +++ b/trunk/include/linux/percpu.h @@ -9,6 +9,50 @@ #include +#ifndef PER_CPU_BASE_SECTION +#ifdef CONFIG_SMP +#define PER_CPU_BASE_SECTION ".data.percpu" +#else +#define PER_CPU_BASE_SECTION ".data" +#endif +#endif + +#ifdef CONFIG_SMP + +#ifdef MODULE +#define PER_CPU_SHARED_ALIGNED_SECTION "" +#else +#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" +#endif +#define PER_CPU_FIRST_SECTION ".first" + +#else + +#define PER_CPU_SHARED_ALIGNED_SECTION "" +#define PER_CPU_FIRST_SECTION "" + +#endif + +#define DEFINE_PER_CPU_SECTION(type, name, section) \ + __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ + PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name + +#define DEFINE_PER_CPU(type, name) \ + DEFINE_PER_CPU_SECTION(type, name, "") + +#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ + DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ + ____cacheline_aligned_in_smp + +#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ + DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") + +#define DEFINE_PER_CPU_FIRST(type, name) \ + DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) + +#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) +#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) + /* enough to cover all DEFINE_PER_CPUs in modules */ #ifdef CONFIG_MODULES #define PERCPU_MODULE_RESERVE (8 << 10) diff --git a/trunk/include/linux/reiserfs_fs_sb.h b/trunk/include/linux/reiserfs_fs_sb.h index 6b361d23a499..5621d87c4479 100644 --- a/trunk/include/linux/reiserfs_fs_sb.h +++ b/trunk/include/linux/reiserfs_fs_sb.h @@ -193,7 +193,7 @@ struct reiserfs_journal { atomic_t j_wcount; /* count of writers for current commit */ unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ - unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */ + unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */ struct buffer_head *j_header_bh; time_t j_trans_start_time; /* time this transaction started */ diff --git a/trunk/include/linux/slow-work.h b/trunk/include/linux/slow-work.h index b65c8881f07a..85958277f83d 100644 --- a/trunk/include/linux/slow-work.h +++ b/trunk/include/linux/slow-work.h @@ -67,7 +67,7 @@ static inline void slow_work_init(struct slow_work *work, } /** - * vslow_work_init - Initialise a very slow work item + * slow_work_init - Initialise a very slow work item * @work: The work item to initialise * @ops: The operations to use to handle the slow work item * diff --git a/trunk/include/linux/spi/spi.h b/trunk/include/linux/spi/spi.h index a0faa18f7b1b..2cc43fa380cb 100644 --- a/trunk/include/linux/spi/spi.h +++ b/trunk/include/linux/spi/spi.h @@ -245,12 +245,7 @@ struct spi_master { */ u16 dma_alignment; - /* Setup mode and clock, etc (spi driver may call many times). - * - * IMPORTANT: this may be called when transfers to another - * device are active. DO NOT UPDATE SHARED REGISTERS in ways - * which could break those transfers. - */ + /* setup mode and clock, etc (spi driver may call many times) */ int (*setup)(struct spi_device *spi); /* bidirectional bulk transfers diff --git a/trunk/include/linux/suspend.h b/trunk/include/linux/suspend.h index 795032edfc46..3e3a4364cbff 100644 --- a/trunk/include/linux/suspend.h +++ b/trunk/include/linux/suspend.h @@ -58,17 +58,10 @@ typedef int __bitwise suspend_state_t; * by @begin(). * @prepare() is called right after devices have been suspended (ie. the * appropriate .suspend() method has been executed for each device) and - * before device drivers' late suspend callbacks are executed. It returns - * 0 on success or a negative error code otherwise, in which case the - * system cannot enter the desired sleep state (@prepare_late(), @enter(), - * @wake(), and @finish() will not be called in that case). - * - * @prepare_late: Finish preparing the platform for entering the system sleep - * state indicated by @begin(). - * @prepare_late is called before disabling nonboot CPUs and after - * device drivers' late suspend callbacks have been executed. It returns - * 0 on success or a negative error code otherwise, in which case the - * system cannot enter the desired sleep state (@enter() and @wake()). + * before the nonboot CPUs are disabled (it is executed with IRQs enabled). + * This callback is optional. It returns 0 on success or a negative + * error code otherwise, in which case the system cannot enter the desired + * sleep state (@enter() and @finish() will not be called in that case). * * @enter: Enter the system sleep state indicated by @begin() or represented by * the argument if @begin() is not implemented. @@ -76,26 +69,19 @@ typedef int __bitwise suspend_state_t; * error code otherwise, in which case the system cannot enter the desired * sleep state. * - * @wake: Called when the system has just left a sleep state, right after - * the nonboot CPUs have been enabled and before device drivers' early - * resume callbacks are executed. - * This callback is optional, but should be implemented by the platforms - * that implement @prepare_late(). If implemented, it is always called - * after @enter(), even if @enter() fails. - * - * @finish: Finish wake-up of the platform. - * @finish is called right prior to calling device drivers' regular suspend - * callbacks. + * @finish: Called when the system has just left a sleep state, right after + * the nonboot CPUs have been enabled and before devices are resumed (it is + * executed with IRQs enabled). * This callback is optional, but should be implemented by the platforms * that implement @prepare(). If implemented, it is always called after - * @enter() and @wake(), if implemented, even if any of them fails. + * @enter() (even if @enter() fails). * * @end: Called by the PM core right after resuming devices, to indicate to * the platform that the system has returned to the working state or * the transition to the sleep state has been aborted. * This callback is optional, but should be implemented by the platforms - * that implement @begin(). Accordingly, platforms implementing @begin() - * should also provide a @end() which cleans up transitions aborted before + * that implement @begin(), but platforms implementing @begin() should + * also provide a @end() which cleans up transitions aborted before * @enter(). * * @recover: Recover the platform from a suspend failure. @@ -107,9 +93,7 @@ struct platform_suspend_ops { int (*valid)(suspend_state_t state); int (*begin)(suspend_state_t state); int (*prepare)(void); - int (*prepare_late)(void); int (*enter)(suspend_state_t state); - void (*wake)(void); void (*finish)(void); void (*end)(void); void (*recover)(void); diff --git a/trunk/include/linux/syscalls.h b/trunk/include/linux/syscalls.h index 40617c1d8976..dabe4ad89141 100644 --- a/trunk/include/linux/syscalls.h +++ b/trunk/include/linux/syscalls.h @@ -148,7 +148,7 @@ struct old_linux_dirent; asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) #else -#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) +#ifdef CONFIG_ALPHA #define SYSCALL_ALIAS(alias, name) \ asm ( #alias " = " #name "\n\t.globl " #alias) #else diff --git a/trunk/kernel/audit_tree.c b/trunk/kernel/audit_tree.c index 6e7351739a82..917ab9525568 100644 --- a/trunk/kernel/audit_tree.c +++ b/trunk/kernel/audit_tree.c @@ -734,6 +734,9 @@ int audit_tag_tree(char *old, char *new) dentry = dget(path.dentry); path_put(&path); + if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) + follow_up(&mnt, &dentry); + list_add_tail(&list, &tagged->mnt_list); mutex_lock(&audit_filter_mutex); diff --git a/trunk/kernel/power/main.c b/trunk/kernel/power/main.c index f99ed6a75eac..f172f41858bb 100644 --- a/trunk/kernel/power/main.c +++ b/trunk/kernel/power/main.c @@ -291,26 +291,20 @@ static int suspend_enter(suspend_state_t state) device_pm_lock(); - if (suspend_ops->prepare) { - error = suspend_ops->prepare(); - if (error) - goto Done; - } - error = device_power_down(PMSG_SUSPEND); if (error) { printk(KERN_ERR "PM: Some devices failed to power down\n"); - goto Platfrom_finish; + goto Done; } - if (suspend_ops->prepare_late) { - error = suspend_ops->prepare_late(); + if (suspend_ops->prepare) { + error = suspend_ops->prepare(); if (error) goto Power_up_devices; } if (suspend_test(TEST_PLATFORM)) - goto Platform_wake; + goto Platfrom_finish; error = disable_nonboot_cpus(); if (error || suspend_test(TEST_CPUS)) @@ -332,17 +326,13 @@ static int suspend_enter(suspend_state_t state) Enable_cpus: enable_nonboot_cpus(); - Platform_wake: - if (suspend_ops->wake) - suspend_ops->wake(); - - Power_up_devices: - device_power_up(PMSG_RESUME); - Platfrom_finish: if (suspend_ops->finish) suspend_ops->finish(); + Power_up_devices: + device_power_up(PMSG_RESUME); + Done: device_pm_unlock(); diff --git a/trunk/kernel/time/clocksource.c b/trunk/kernel/time/clocksource.c index ecfd7b5187e0..c46c931a7fe7 100644 --- a/trunk/kernel/time/clocksource.c +++ b/trunk/kernel/time/clocksource.c @@ -181,12 +181,12 @@ static void clocksource_watchdog(unsigned long data) resumed = test_and_clear_bit(0, &watchdog_resumed); - wdnow = watchdog->read(watchdog); + wdnow = watchdog->read(); wd_nsec = cyc2ns(watchdog, (wdnow - watchdog_last) & watchdog->mask); watchdog_last = wdnow; list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) { - csnow = cs->read(cs); + csnow = cs->read(); if (unlikely(resumed)) { cs->wd_last = csnow; @@ -247,7 +247,7 @@ static void clocksource_check_watchdog(struct clocksource *cs) list_add(&cs->wd_list, &watchdog_list); if (!started && watchdog) { - watchdog_last = watchdog->read(watchdog); + watchdog_last = watchdog->read(); watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask)); @@ -268,7 +268,7 @@ static void clocksource_check_watchdog(struct clocksource *cs) cse->flags &= ~CLOCK_SOURCE_WATCHDOG; /* Start if list is not empty */ if (!list_empty(&watchdog_list)) { - watchdog_last = watchdog->read(watchdog); + watchdog_last = watchdog->read(); watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; add_timer_on(&watchdog_timer, diff --git a/trunk/kernel/time/jiffies.c b/trunk/kernel/time/jiffies.c index c3f6c30816e3..06f197560f3b 100644 --- a/trunk/kernel/time/jiffies.c +++ b/trunk/kernel/time/jiffies.c @@ -50,7 +50,7 @@ */ #define JIFFIES_SHIFT 8 -static cycle_t jiffies_read(struct clocksource *cs) +static cycle_t jiffies_read(void) { return (cycle_t) jiffies; } diff --git a/trunk/kernel/time/timekeeping.c b/trunk/kernel/time/timekeeping.c index 687dff49f6e7..900f1b6598d1 100644 --- a/trunk/kernel/time/timekeeping.c +++ b/trunk/kernel/time/timekeeping.c @@ -182,7 +182,7 @@ EXPORT_SYMBOL(do_settimeofday); */ static void change_clocksource(void) { - struct clocksource *new, *old; + struct clocksource *new; new = clocksource_get_next(); @@ -191,16 +191,11 @@ static void change_clocksource(void) clocksource_forward_now(); - if (clocksource_enable(new)) - return; - new->raw_time = clock->raw_time; - old = clock; - clock = new; - clocksource_disable(old); + clock = new; clock->cycle_last = 0; - clock->cycle_last = clocksource_read(clock); + clock->cycle_last = clocksource_read(new); clock->error = 0; clock->xtime_nsec = 0; clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); @@ -297,7 +292,6 @@ void __init timekeeping_init(void) ntp_init(); clock = clocksource_get_next(); - clocksource_enable(clock); clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); clock->cycle_last = clocksource_read(clock); diff --git a/trunk/lib/kobject.c b/trunk/lib/kobject.c index bacf6fe4f7a0..a6dec32f2ddd 100644 --- a/trunk/lib/kobject.c +++ b/trunk/lib/kobject.c @@ -218,9 +218,6 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, const char *old_name = kobj->name; char *s; - if (kobj->name && !fmt) - return 0; - kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); if (!kobj->name) return -ENOMEM; diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index eac9577941f9..99155b7b8123 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -63,9 +63,6 @@ struct scan_control { /* Can mapped pages be reclaimed? */ int may_unmap; - /* Can pages be swapped as part of reclaim? */ - int may_swap; - /* This context's SWAP_CLUSTER_MAX. If freeing memory for * suspend, we effectively ignore SWAP_CLUSTER_MAX. * In this context, it doesn't matter that we scan the @@ -1383,7 +1380,7 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc, struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc); /* If we have no swap space, do not bother scanning anon pages. */ - if (!sc->may_swap || (nr_swap_pages <= 0)) { + if (nr_swap_pages <= 0) { percent[0] = 0; percent[1] = 100; return; @@ -1700,7 +1697,6 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order, .may_writepage = !laptop_mode, .swap_cluster_max = SWAP_CLUSTER_MAX, .may_unmap = 1, - .may_swap = 1, .swappiness = vm_swappiness, .order = order, .mem_cgroup = NULL, @@ -1721,7 +1717,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, struct scan_control sc = { .may_writepage = !laptop_mode, .may_unmap = 1, - .may_swap = !noswap, .swap_cluster_max = SWAP_CLUSTER_MAX, .swappiness = swappiness, .order = 0, @@ -1731,6 +1726,9 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, }; struct zonelist *zonelist; + if (noswap) + sc.may_unmap = 0; + sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); zonelist = NODE_DATA(numa_node_id())->node_zonelists; @@ -1769,7 +1767,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order) struct scan_control sc = { .gfp_mask = GFP_KERNEL, .may_unmap = 1, - .may_swap = 1, .swap_cluster_max = SWAP_CLUSTER_MAX, .swappiness = vm_swappiness, .order = order, @@ -2301,7 +2298,6 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) struct scan_control sc = { .may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE), .may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP), - .may_swap = 1, .swap_cluster_max = max_t(unsigned long, nr_pages, SWAP_CLUSTER_MAX), .gfp_mask = gfp_mask, diff --git a/trunk/net/rds/rds.h b/trunk/net/rds/rds.h index 71794449ca4e..619f0a30a4e5 100644 --- a/trunk/net/rds/rds.h +++ b/trunk/net/rds/rds.h @@ -638,7 +638,7 @@ struct rds_message *rds_send_get_message(struct rds_connection *, void rds_rdma_unuse(struct rds_sock *rs, u32 r_key, int force); /* stats.c */ -DECLARE_PER_CPU_SHARED_ALIGNED(struct rds_statistics, rds_stats); +DECLARE_PER_CPU(struct rds_statistics, rds_stats); #define rds_stats_inc_which(which, member) do { \ per_cpu(which, get_cpu()).member++; \ put_cpu(); \