diff --git a/[refs] b/[refs] index a7d52b361d31..a3aa070c66f9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 456eac94789e1b512515e6974e091ef655f343de +refs/heads/master: 25719e6b4631959c9ecb1db6967537a124c4a7fa diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 4c33ca82f9b1..c2238cd474c7 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -729,26 +729,14 @@ config ARCH_U8500 endchoice -source "arch/arm/mach-aaec2000/Kconfig" - -source "arch/arm/mach-at91/Kconfig" - -source "arch/arm/mach-bcmring/Kconfig" - source "arch/arm/mach-clps711x/Kconfig" -source "arch/arm/mach-davinci/Kconfig" - -source "arch/arm/mach-dove/Kconfig" - source "arch/arm/mach-ep93xx/Kconfig" source "arch/arm/mach-footbridge/Kconfig" source "arch/arm/mach-gemini/Kconfig" -source "arch/arm/mach-h720x/Kconfig" - source "arch/arm/mach-integrator/Kconfig" source "arch/arm/mach-iop32x/Kconfig" @@ -763,26 +751,16 @@ source "arch/arm/mach-ixp2000/Kconfig" source "arch/arm/mach-ixp23xx/Kconfig" -source "arch/arm/mach-kirkwood/Kconfig" - -source "arch/arm/mach-ks8695/Kconfig" - -source "arch/arm/mach-lh7a40x/Kconfig" - source "arch/arm/mach-loki/Kconfig" -source "arch/arm/mach-msm/Kconfig" - source "arch/arm/mach-mv78xx0/Kconfig" -source "arch/arm/plat-mxc/Kconfig" - -source "arch/arm/mach-netx/Kconfig" +source "arch/arm/mach-pxa/Kconfig" +source "arch/arm/plat-pxa/Kconfig" -source "arch/arm/mach-nomadik/Kconfig" -source "arch/arm/plat-nomadik/Kconfig" +source "arch/arm/mach-mmp/Kconfig" -source "arch/arm/mach-ns9xxx/Kconfig" +source "arch/arm/mach-sa1100/Kconfig" source "arch/arm/plat-omap/Kconfig" @@ -792,14 +770,9 @@ source "arch/arm/mach-omap2/Kconfig" source "arch/arm/mach-orion5x/Kconfig" -source "arch/arm/mach-pxa/Kconfig" -source "arch/arm/plat-pxa/Kconfig" - -source "arch/arm/mach-mmp/Kconfig" - -source "arch/arm/mach-realview/Kconfig" +source "arch/arm/mach-kirkwood/Kconfig" -source "arch/arm/mach-sa1100/Kconfig" +source "arch/arm/mach-dove/Kconfig" source "arch/arm/plat-samsung/Kconfig" source "arch/arm/plat-s3c24xx/Kconfig" @@ -827,14 +800,41 @@ if ARCH_S5PC1XX source "arch/arm/mach-s5pc100/Kconfig" endif -source "arch/arm/mach-u300/Kconfig" +source "arch/arm/mach-lh7a40x/Kconfig" -source "arch/arm/mach-ux500/Kconfig" +source "arch/arm/mach-h720x/Kconfig" source "arch/arm/mach-versatile/Kconfig" +source "arch/arm/mach-aaec2000/Kconfig" + +source "arch/arm/mach-realview/Kconfig" + +source "arch/arm/mach-at91/Kconfig" + +source "arch/arm/plat-mxc/Kconfig" + +source "arch/arm/mach-nomadik/Kconfig" +source "arch/arm/plat-nomadik/Kconfig" + +source "arch/arm/mach-netx/Kconfig" + +source "arch/arm/mach-ns9xxx/Kconfig" + +source "arch/arm/mach-davinci/Kconfig" + +source "arch/arm/mach-ks8695/Kconfig" + +source "arch/arm/mach-msm/Kconfig" + +source "arch/arm/mach-u300/Kconfig" + source "arch/arm/mach-w90x900/Kconfig" +source "arch/arm/mach-bcmring/Kconfig" + +source "arch/arm/mach-ux500/Kconfig" + # Definitions to make life easier config ARCH_ACORN bool diff --git a/trunk/arch/arm/Makefile b/trunk/arch/arm/Makefile index 9e7582572741..e9da08483b3c 100644 --- a/trunk/arch/arm/Makefile +++ b/trunk/arch/arm/Makefile @@ -146,7 +146,6 @@ machine-$(CONFIG_ARCH_MX1) := mx1 machine-$(CONFIG_ARCH_MX2) := mx2 machine-$(CONFIG_ARCH_MX25) := mx25 machine-$(CONFIG_ARCH_MX3) := mx3 -machine-$(CONFIG_ARCH_MXC91231) := mxc91231 machine-$(CONFIG_ARCH_NETX) := netx machine-$(CONFIG_ARCH_NOMADIK) := nomadik machine-$(CONFIG_ARCH_NS9XXX) := ns9xxx @@ -172,12 +171,12 @@ machine-$(CONFIG_ARCH_U8500) := ux500 machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_W90X900) := w90x900 machine-$(CONFIG_FOOTBRIDGE) := footbridge +machine-$(CONFIG_ARCH_MXC91231) := mxc91231 # Platform directory name. This list is sorted alphanumerically # by CONFIG_* macro name. plat-$(CONFIG_ARCH_MXC) := mxc plat-$(CONFIG_ARCH_OMAP) := omap -plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx plat-$(CONFIG_PLAT_IOP) := iop plat-$(CONFIG_PLAT_NOMADIK) := nomadik plat-$(CONFIG_PLAT_ORION) := orion @@ -185,6 +184,7 @@ plat-$(CONFIG_PLAT_PXA) := pxa plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx s3c samsung plat-$(CONFIG_PLAT_S3C64XX) := s3c64xx s3c samsung plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx s3c samsung +plat-$(CONFIG_ARCH_STMP3XXX) := stmp3xxx ifeq ($(CONFIG_ARCH_EBSA110),y) # This is what happens if you forget the IOCS16 line. diff --git a/trunk/arch/arm/boot/compressed/head.S b/trunk/arch/arm/boot/compressed/head.S index 4fddc509e78e..d356af7cef82 100644 --- a/trunk/arch/arm/boot/compressed/head.S +++ b/trunk/arch/arm/boot/compressed/head.S @@ -27,14 +27,6 @@ .macro writeb, ch, rb mcr p14, 0, \ch, c0, c5, 0 .endm -#elif defined(CONFIG_CPU_V7) - .macro loadsp, rb - .endm - .macro writeb, ch, rb -wait: mrc p14, 0, pc, c0, c1, 0 - bcs wait - mcr p14, 0, \ch, c0, c5, 0 - .endm #elif defined(CONFIG_CPU_XSCALE) .macro loadsp, rb .endm diff --git a/trunk/arch/arm/boot/compressed/misc.c b/trunk/arch/arm/boot/compressed/misc.c index 56a0d116d271..7e0fe4d42c7b 100644 --- a/trunk/arch/arm/boot/compressed/misc.c +++ b/trunk/arch/arm/boot/compressed/misc.c @@ -53,18 +53,6 @@ static void icedcc_putc(int ch) asm("mcr p14, 0, %0, c0, c5, 0" : : "r" (ch)); } - -#elif defined(CONFIG_CPU_V7) - -static void icedcc_putc(int ch) -{ - asm( - "wait: mrc p14, 0, pc, c0, c1, 0 \n\ - bcs wait \n\ - mcr p14, 0, %0, c0, c5, 0 " - : : "r" (ch)); -} - #elif defined(CONFIG_CPU_XSCALE) static void icedcc_putc(int ch) @@ -100,6 +88,7 @@ static void icedcc_putc(int ch) #endif #define putc(ch) icedcc_putc(ch) +#define flush() do { } while (0) #endif static void putstr(const char *ptr) diff --git a/trunk/arch/arm/include/asm/cacheflush.h b/trunk/arch/arm/include/asm/cacheflush.h index c77d2fa1f6e5..730aefcfbee3 100644 --- a/trunk/arch/arm/include/asm/cacheflush.h +++ b/trunk/arch/arm/include/asm/cacheflush.h @@ -154,16 +154,16 @@ * Please note that the implementation of these, and the required * effects are cache-type (VIVT/VIPT/PIPT) specific. * - * flush_kern_all() + * flush_cache_kern_all() * * Unconditionally clean and invalidate the entire cache. * - * flush_user_all() + * flush_cache_user_mm(mm) * * Clean and invalidate all user space cache entries * before a change of page tables. * - * flush_user_range(start, end, flags) + * flush_cache_user_range(start, end, flags) * * Clean and invalidate a range of cache entries in the * specified address space before a change of page tables. @@ -179,20 +179,6 @@ * - start - virtual start address * - end - virtual end address * - * coherent_user_range(start, end) - * - * Ensure coherency between the Icache and the Dcache in the - * region described by start, end. If you have non-snooping - * Harvard caches, you need to implement this function. - * - start - virtual start address - * - end - virtual end address - * - * flush_kern_dcache_area(kaddr, size) - * - * Ensure that the data held in page is written back. - * - kaddr - page address - * - size - region size - * * DMA Cache Coherency * =================== * diff --git a/trunk/arch/arm/kernel/debug.S b/trunk/arch/arm/kernel/debug.S index 5c91addcaebc..b121b6053cce 100644 --- a/trunk/arch/arm/kernel/debug.S +++ b/trunk/arch/arm/kernel/debug.S @@ -49,26 +49,6 @@ 1002: .endm -#elif defined(CONFIG_CPU_V7) - - .macro addruart, rx - .endm - - .macro senduart, rd, rx - mcr p14, 0, \rd, c0, c5, 0 - .endm - - .macro busyuart, rd, rx -busy: mrc p14, 0, pc, c0, c1, 0 - bcs busy - .endm - - .macro waituart, rd, rx -wait: mrc p14, 0, pc, c0, c1, 0 - bcs wait - - .endm - #elif defined(CONFIG_CPU_XSCALE) .macro addruart, rx diff --git a/trunk/arch/arm/kernel/elf.c b/trunk/arch/arm/kernel/elf.c index d4a0da1e48f4..950391f194c4 100644 --- a/trunk/arch/arm/kernel/elf.c +++ b/trunk/arch/arm/kernel/elf.c @@ -78,6 +78,15 @@ int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack) return 1; if (cpu_architecture() < CPU_ARCH_ARMv6) return 1; +#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) + /* + * If we have support for OABI programs, we can never allow NX + * support - our signal syscall restart mechanism relies upon + * being able to execute code placed on the user stack. + */ + return 1; +#else return 0; +#endif } EXPORT_SYMBOL(arm_elf_read_implies_exec); diff --git a/trunk/arch/arm/mach-gemini/include/mach/uncompress.h b/trunk/arch/arm/mach-gemini/include/mach/uncompress.h index 5483f61a8061..59c5df7e716c 100644 --- a/trunk/arch/arm/mach-gemini/include/mach/uncompress.h +++ b/trunk/arch/arm/mach-gemini/include/mach/uncompress.h @@ -30,9 +30,7 @@ static inline void putc(char c) UART[UART_TX] = c; } -static inline void flush(void) -{ -} +#define flush() do { } while (0) /* * nothing to do diff --git a/trunk/arch/arm/mm/mmu.c b/trunk/arch/arm/mm/mmu.c index 761ffede6a23..1708da82da96 100644 --- a/trunk/arch/arm/mm/mmu.c +++ b/trunk/arch/arm/mm/mmu.c @@ -1067,6 +1067,4 @@ void setup_mm_for_reboot(char mode) pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))); flush_pmd_entry(pmd); } - - local_flush_tlb_all(); } diff --git a/trunk/arch/arm/mm/proc-v6.S b/trunk/arch/arm/mm/proc-v6.S index 7a5337ed7d68..395cc90c6613 100644 --- a/trunk/arch/arm/mm/proc-v6.S +++ b/trunk/arch/arm/mm/proc-v6.S @@ -59,6 +59,8 @@ ENTRY(cpu_v6_proc_fin) * to what would be the reset vector. * * - loc - location to jump to for soft reset + * + * It is assumed that: */ .align 5 ENTRY(cpu_v6_reset) diff --git a/trunk/arch/arm/mm/proc-v7.S b/trunk/arch/arm/mm/proc-v7.S index 7aaf88a3b7aa..3a285218fd15 100644 --- a/trunk/arch/arm/mm/proc-v7.S +++ b/trunk/arch/arm/mm/proc-v7.S @@ -45,14 +45,7 @@ ENTRY(cpu_v7_proc_init) ENDPROC(cpu_v7_proc_init) ENTRY(cpu_v7_proc_fin) - stmfd sp!, {lr} - cpsid if @ disable interrupts - bl v7_flush_kern_cache_all - mrc p15, 0, r0, c1, c0, 0 @ ctrl register - bic r0, r0, #0x1000 @ ...i............ - bic r0, r0, #0x0006 @ .............ca. - mcr p15, 0, r0, c1, c0, 0 @ disable caches - ldmfd sp!, {pc} + mov pc, lr ENDPROC(cpu_v7_proc_fin) /* @@ -63,6 +56,8 @@ ENDPROC(cpu_v7_proc_fin) * to what would be the reset vector. * * - loc - location to jump to for soft reset + * + * It is assumed that: */ .align 5 ENTRY(cpu_v7_reset) diff --git a/trunk/arch/arm/plat-mxc/include/mach/uncompress.h b/trunk/arch/arm/plat-mxc/include/mach/uncompress.h index d49384cb1e97..4d5d395ad63b 100644 --- a/trunk/arch/arm/plat-mxc/include/mach/uncompress.h +++ b/trunk/arch/arm/plat-mxc/include/mach/uncompress.h @@ -60,9 +60,7 @@ static void putc(int ch) UART(TXR) = ch; } -static inline void flush(void) -{ -} +#define flush() do { } while (0) #define MX1_UART1_BASE_ADDR 0x00206000 #define MX25_UART1_BASE_ADDR 0x43f90000 diff --git a/trunk/arch/sh/boards/mach-se/7724/setup.c b/trunk/arch/sh/boards/mach-se/7724/setup.c index 858ecb25d469..5d0f70b46c97 100644 --- a/trunk/arch/sh/boards/mach-se/7724/setup.c +++ b/trunk/arch/sh/boards/mach-se/7724/setup.c @@ -533,7 +533,7 @@ static int __init sh_eth_is_eeprom_ready(void) while (t--) { if (!ctrl_inw(EEPROM_STAT)) return 1; - udelay(1); + cpu_relax(); } printk(KERN_ERR "ms7724se can not access to eeprom\n"); diff --git a/trunk/arch/sh/include/asm/unistd_32.h b/trunk/arch/sh/include/asm/unistd_32.h index 365744b05269..f18c4f9baf27 100644 --- a/trunk/arch/sh/include/asm/unistd_32.h +++ b/trunk/arch/sh/include/asm/unistd_32.h @@ -345,13 +345,12 @@ #define __NR_pwritev 334 #define __NR_rt_tgsigqueueinfo 335 #define __NR_perf_event_open 336 +#define __NR_recvmmsg 337 -#define NR_syscalls 337 +#define NR_syscalls 338 #ifdef __KERNEL__ -#define __IGNORE_recvmmsg - #define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT diff --git a/trunk/arch/sh/include/asm/unistd_64.h b/trunk/arch/sh/include/asm/unistd_64.h index 25de158aac3a..3e7645d11130 100644 --- a/trunk/arch/sh/include/asm/unistd_64.h +++ b/trunk/arch/sh/include/asm/unistd_64.h @@ -386,11 +386,10 @@ #define __NR_rt_tgsigqueueinfo 363 #define __NR_perf_event_open 364 #define __NR_recvmmsg 365 -#define __NR_accept4 366 #ifdef __KERNEL__ -#define NR_syscalls 367 +#define NR_syscalls 366 #define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_OLD_READDIR diff --git a/trunk/arch/sh/kernel/syscalls_32.S b/trunk/arch/sh/kernel/syscalls_32.S index 19fd11dd9871..4bd5a1146956 100644 --- a/trunk/arch/sh/kernel/syscalls_32.S +++ b/trunk/arch/sh/kernel/syscalls_32.S @@ -353,3 +353,4 @@ ENTRY(sys_call_table) .long sys_pwritev .long sys_rt_tgsigqueueinfo /* 335 */ .long sys_perf_event_open + .long sys_recvmmsg diff --git a/trunk/arch/sh/kernel/syscalls_64.S b/trunk/arch/sh/kernel/syscalls_64.S index 2048a20d7c80..07d2aaea9ae8 100644 --- a/trunk/arch/sh/kernel/syscalls_64.S +++ b/trunk/arch/sh/kernel/syscalls_64.S @@ -392,4 +392,3 @@ sys_call_table: .long sys_rt_tgsigqueueinfo .long sys_perf_event_open .long sys_recvmmsg /* 365 */ - .long sys_accept4 diff --git a/trunk/arch/x86/kernel/acpi/boot.c b/trunk/arch/x86/kernel/acpi/boot.c index 036d28adf59d..fb1035cd9a6a 100644 --- a/trunk/arch/x86/kernel/acpi/boot.c +++ b/trunk/arch/x86/kernel/acpi/boot.c @@ -1529,10 +1529,16 @@ static struct dmi_system_id __initdata acpi_dmi_table_late[] = { * if acpi_blacklisted() acpi_disabled = 1; * acpi_irq_model=... * ... + * + * return value: (currently ignored) + * 0: success + * !0: failure */ -void __init acpi_boot_table_init(void) +int __init acpi_boot_table_init(void) { + int error; + dmi_check_system(acpi_dmi_table); /* @@ -1540,14 +1546,15 @@ void __init acpi_boot_table_init(void) * One exception: acpi=ht continues far enough to enumerate LAPICs */ if (acpi_disabled && !acpi_ht) - return; + return 1; /* * Initialize the ACPI boot-time table parser. */ - if (acpi_table_init()) { + error = acpi_table_init(); + if (error) { disable_acpi(); - return; + return error; } acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); @@ -1555,15 +1562,18 @@ void __init acpi_boot_table_init(void) /* * blacklist may disable ACPI entirely */ - if (acpi_blacklisted()) { + error = acpi_blacklisted(); + if (error) { if (acpi_force) { printk(KERN_WARNING PREFIX "acpi=force override\n"); } else { printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); disable_acpi(); - return; + return error; } } + + return 0; } int __init early_acpi_boot_init(void) diff --git a/trunk/block/blk-ioc.c b/trunk/block/blk-ioc.c index 98e6bf61b0ac..cbdabb0dd6d7 100644 --- a/trunk/block/blk-ioc.c +++ b/trunk/block/blk-ioc.c @@ -39,6 +39,8 @@ int put_io_context(struct io_context *ioc) if (atomic_long_dec_and_test(&ioc->refcount)) { rcu_read_lock(); + if (ioc->aic && ioc->aic->dtor) + ioc->aic->dtor(ioc->aic); cfq_dtor(ioc); rcu_read_unlock(); @@ -74,6 +76,8 @@ void exit_io_context(struct task_struct *task) task_unlock(task); if (atomic_dec_and_test(&ioc->nr_tasks)) { + if (ioc->aic && ioc->aic->exit) + ioc->aic->exit(ioc->aic); cfq_exit(ioc); } @@ -93,6 +97,7 @@ struct io_context *alloc_io_context(gfp_t gfp_flags, int node) ret->ioprio = 0; ret->last_waited = jiffies; /* doesn't matter... */ ret->nr_batch_requests = 0; /* because this is 0 */ + ret->aic = NULL; INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH); INIT_HLIST_HEAD(&ret->cic_list); ret->ioc_data = NULL; diff --git a/trunk/block/blk-settings.c b/trunk/block/blk-settings.c index 5eeb9e0d256e..d52d4adc440b 100644 --- a/trunk/block/blk-settings.c +++ b/trunk/block/blk-settings.c @@ -528,7 +528,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, sector_t offset) { sector_t alignment; - unsigned int top, bottom, ret = 0; + unsigned int top, bottom; t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); @@ -546,8 +546,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->max_segment_size = min_not_zero(t->max_segment_size, b->max_segment_size); - t->misaligned |= b->misaligned; - alignment = queue_limit_alignment_offset(b, offset); /* Bottom device has different alignment. Check that it is @@ -560,10 +558,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, bottom = max(b->physical_block_size, b->io_min) + alignment; /* Verify that top and bottom intervals line up */ - if (max(top, bottom) & (min(top, bottom) - 1)) { + if (max(top, bottom) & (min(top, bottom) - 1)) t->misaligned = 1; - ret = -1; - } } t->logical_block_size = max(t->logical_block_size, @@ -582,21 +578,18 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, if (t->physical_block_size & (t->logical_block_size - 1)) { t->physical_block_size = t->logical_block_size; t->misaligned = 1; - ret = -1; } /* Minimum I/O a multiple of the physical block size? */ if (t->io_min & (t->physical_block_size - 1)) { t->io_min = t->physical_block_size; t->misaligned = 1; - ret = -1; } /* Optimal I/O a multiple of the physical block size? */ if (t->io_opt & (t->physical_block_size - 1)) { t->io_opt = 0; t->misaligned = 1; - ret = -1; } /* Find lowest common alignment_offset */ @@ -604,10 +597,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, & (max(t->physical_block_size, t->io_min) - 1); /* Verify that new alignment_offset is on a logical block boundary */ - if (t->alignment_offset & (t->logical_block_size - 1)) { + if (t->alignment_offset & (t->logical_block_size - 1)) t->misaligned = 1; - ret = -1; - } /* Discard alignment and granularity */ if (b->discard_granularity) { @@ -635,32 +626,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, (t->discard_granularity - 1); } - return ret; + return t->misaligned ? -1 : 0; } EXPORT_SYMBOL(blk_stack_limits); -/** - * bdev_stack_limits - adjust queue limits for stacked drivers - * @t: the stacking driver limits (top device) - * @bdev: the component block_device (bottom) - * @start: first data sector within component device - * - * Description: - * Merges queue limits for a top device and a block_device. Returns - * 0 if alignment didn't change. Returns -1 if adding the bottom - * device caused misalignment. - */ -int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, - sector_t start) -{ - struct request_queue *bq = bdev_get_queue(bdev); - - start += get_start_sect(bdev); - - return blk_stack_limits(t, &bq->limits, start << 9); -} -EXPORT_SYMBOL(bdev_stack_limits); - /** * disk_stack_limits - adjust queue limits for stacked drivers * @disk: MD/DM gendisk (top) diff --git a/trunk/block/cfq-iosched.c b/trunk/block/cfq-iosched.c index ee130f14d1fc..918c7fd9aeb1 100644 --- a/trunk/block/cfq-iosched.c +++ b/trunk/block/cfq-iosched.c @@ -3076,12 +3076,6 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, if (cfq_class_idle(cfqq)) return true; - /* - * Don't allow a non-RT request to preempt an ongoing RT cfqq timeslice. - */ - if (cfq_class_rt(cfqq) && !cfq_class_rt(new_cfqq)) - return false; - /* * if the new request is sync, but the currently running queue is * not, let the sync request have priority. diff --git a/trunk/block/genhd.c b/trunk/block/genhd.c index d13ba76a169c..b11a4ad7d571 100644 --- a/trunk/block/genhd.c +++ b/trunk/block/genhd.c @@ -867,7 +867,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev, { struct gendisk *disk = dev_to_disk(dev); - return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue)); + return sprintf(buf, "%u\n", queue_discard_alignment(disk->queue)); } static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); diff --git a/trunk/drivers/acpi/acpi_pad.c b/trunk/drivers/acpi/acpi_pad.c index 7e52295f1ecc..97991ac6f5fc 100644 --- a/trunk/drivers/acpi/acpi_pad.c +++ b/trunk/drivers/acpi/acpi_pad.c @@ -208,7 +208,7 @@ static int power_saving_thread(void *data) * the mechanism only works when all CPUs have RT task running, * as if one CPU hasn't RT task, RT task from other CPUs will * borrow CPU time from this CPU and cause RT task use > 95% - * CPU time. To make 'avoid starvation' work, takes a nap here. + * CPU time. To make 'avoid staration' work, takes a nap here. */ if (do_sleep) schedule_timeout_killable(HZ * idle_pct / 100); @@ -222,18 +222,14 @@ static struct task_struct *ps_tsks[NR_CPUS]; static unsigned int ps_tsk_num; static int create_power_saving_task(void) { - int rc = -ENOMEM; - ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, (void *)(unsigned long)ps_tsk_num, "power_saving/%d", ps_tsk_num); - rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; - if (!rc) + if (ps_tsks[ps_tsk_num]) { ps_tsk_num++; - else - ps_tsks[ps_tsk_num] = NULL; - - return rc; + return 0; + } + return -EINVAL; } static void destroy_power_saving_task(void) @@ -241,7 +237,6 @@ static void destroy_power_saving_task(void) if (ps_tsk_num > 0) { ps_tsk_num--; kthread_stop(ps_tsks[ps_tsk_num]); - ps_tsks[ps_tsk_num] = NULL; } } @@ -258,7 +253,7 @@ static void set_power_saving_task_num(unsigned int num) } } -static void acpi_pad_idle_cpus(unsigned int num_cpus) +static int acpi_pad_idle_cpus(unsigned int num_cpus) { get_online_cpus(); @@ -266,6 +261,7 @@ static void acpi_pad_idle_cpus(unsigned int num_cpus) set_power_saving_task_num(num_cpus); put_online_cpus(); + return 0; } static uint32_t acpi_pad_idle_cpus_num(void) @@ -373,21 +369,19 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) static int acpi_pad_pur(acpi_handle handle, int *num_cpus) { struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + acpi_status status; union acpi_object *package; int rev, num, ret = -EINVAL; - if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) - return -EINVAL; - - if (!buffer.length || !buffer.pointer) + status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer); + if (ACPI_FAILURE(status)) return -EINVAL; - package = buffer.pointer; if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) goto out; rev = package->package.elements[0].integer.value; num = package->package.elements[1].integer.value; - if (rev != 1 || num < 0) + if (rev != 1) goto out; *num_cpus = num; ret = 0; @@ -416,7 +410,7 @@ static void acpi_pad_ost(acpi_handle handle, int stat, static void acpi_pad_handle_notify(acpi_handle handle) { - int num_cpus; + int num_cpus, ret; uint32_t idle_cpus; mutex_lock(&isolated_cpus_lock); @@ -424,9 +418,12 @@ static void acpi_pad_handle_notify(acpi_handle handle) mutex_unlock(&isolated_cpus_lock); return; } - acpi_pad_idle_cpus(num_cpus); + ret = acpi_pad_idle_cpus(num_cpus); idle_cpus = acpi_pad_idle_cpus_num(); - acpi_pad_ost(handle, 0, idle_cpus); + if (!ret) + acpi_pad_ost(handle, 0, idle_cpus); + else + acpi_pad_ost(handle, 1, 0); mutex_unlock(&isolated_cpus_lock); } diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index a52126e46307..cf761b904e4a 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -490,14 +490,9 @@ static void acpi_bus_osc_support(void) capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ -#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ - defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) +#ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; #endif - -#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) - capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; -#endif if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) return; if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index d6471bb6852f..fd1801bdee66 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -201,13 +201,14 @@ static void advance_transaction(struct acpi_ec *ec, u8 status) spin_unlock_irqrestore(&ec->curr_lock, flags); } -static int acpi_ec_sync_query(struct acpi_ec *ec); +static void acpi_ec_gpe_query(void *ec_cxt); -static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) +static int ec_check_sci(struct acpi_ec *ec, u8 state) { if (state & ACPI_EC_FLAG_SCI) { if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) - return acpi_ec_sync_query(ec); + return acpi_os_execute(OSL_EC_BURST_HANDLER, + acpi_ec_gpe_query, ec); } return 0; } @@ -248,6 +249,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, { unsigned long tmp; int ret = 0; + pr_debug(PREFIX "transaction start\n"); + /* disable GPE during transaction if storm is detected */ + if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { + acpi_disable_gpe(NULL, ec->gpe); + } if (EC_FLAGS_MSI) udelay(ACPI_EC_MSI_UDELAY); /* start transaction */ @@ -259,9 +265,20 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); spin_unlock_irqrestore(&ec->curr_lock, tmp); ret = ec_poll(ec); + pr_debug(PREFIX "transaction end\n"); spin_lock_irqsave(&ec->curr_lock, tmp); ec->curr = NULL; spin_unlock_irqrestore(&ec->curr_lock, tmp); + if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { + /* check if we received SCI during transaction */ + ec_check_sci(ec, acpi_ec_read_status(ec)); + /* it is safe to enable GPE outside of transaction */ + acpi_enable_gpe(NULL, ec->gpe); + } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { + pr_info(PREFIX "GPE storm detected, " + "transactions will use polling mode\n"); + set_bit(EC_FLAGS_GPE_STORM, &ec->flags); + } return ret; } @@ -304,26 +321,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) status = -ETIME; goto end; } - pr_debug(PREFIX "transaction start\n"); - /* disable GPE during transaction if storm is detected */ - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { - acpi_disable_gpe(NULL, ec->gpe); - } - status = acpi_ec_transaction_unlocked(ec, t); - - /* check if we received SCI during transaction */ - ec_check_sci_sync(ec, acpi_ec_read_status(ec)); - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { - msleep(1); - /* it is safe to enable GPE outside of transaction */ - acpi_enable_gpe(NULL, ec->gpe); - } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { - pr_info(PREFIX "GPE storm detected, " - "transactions will use polling mode\n"); - set_bit(EC_FLAGS_GPE_STORM, &ec->flags); - } - pr_debug(PREFIX "transaction end\n"); end: if (ec->global_lock) acpi_release_global_lock(glk); @@ -445,7 +443,7 @@ int ec_transaction(u8 command, EXPORT_SYMBOL(ec_transaction); -static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) +static int acpi_ec_query(struct acpi_ec *ec, u8 * data) { int result; u8 d; @@ -454,16 +452,20 @@ static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) .wlen = 0, .rlen = 1}; if (!ec || !data) return -EINVAL; + /* * Query the EC to find out which _Qxx method we need to evaluate. * Note that successful completion of the query causes the ACPI_EC_SCI * bit to be cleared (and thus clearing the interrupt source). */ - result = acpi_ec_transaction_unlocked(ec, &t); + + result = acpi_ec_transaction(ec, &t); if (result) return result; + if (!d) return -ENODATA; + *data = d; return 0; } @@ -507,79 +509,43 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); -static void acpi_ec_run(void *cxt) -{ - struct acpi_ec_query_handler *handler = cxt; - if (!handler) - return; - pr_debug(PREFIX "start query execution\n"); - if (handler->func) - handler->func(handler->data); - else if (handler->handle) - acpi_evaluate_object(handler->handle, NULL, NULL, NULL); - pr_debug(PREFIX "stop query execution\n"); - kfree(handler); -} - -static int acpi_ec_sync_query(struct acpi_ec *ec) +static void acpi_ec_gpe_query(void *ec_cxt) { + struct acpi_ec *ec = ec_cxt; u8 value = 0; - int status; - struct acpi_ec_query_handler *handler, *copy; - if ((status = acpi_ec_query_unlocked(ec, &value))) - return status; + struct acpi_ec_query_handler *handler, copy; + + if (!ec || acpi_ec_query(ec, &value)) + return; + mutex_lock(&ec->lock); list_for_each_entry(handler, &ec->list, node) { if (value == handler->query_bit) { /* have custom handler for this bit */ - copy = kmalloc(sizeof(*handler), GFP_KERNEL); - if (!copy) - return -ENOMEM; - memcpy(copy, handler, sizeof(*copy)); - pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); - return acpi_os_execute((copy->func) ? - OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, - acpi_ec_run, copy); + memcpy(©, handler, sizeof(copy)); + mutex_unlock(&ec->lock); + if (copy.func) { + copy.func(copy.data); + } else if (copy.handle) { + acpi_evaluate_object(copy.handle, NULL, NULL, NULL); + } + return; } } - return 0; -} - -static void acpi_ec_gpe_query(void *ec_cxt) -{ - struct acpi_ec *ec = ec_cxt; - if (!ec) - return; - mutex_lock(&ec->lock); - acpi_ec_sync_query(ec); mutex_unlock(&ec->lock); } -static void acpi_ec_gpe_query(void *ec_cxt); - -static int ec_check_sci(struct acpi_ec *ec, u8 state) -{ - if (state & ACPI_EC_FLAG_SCI) { - if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { - pr_debug(PREFIX "push gpe query to the queue\n"); - return acpi_os_execute(OSL_NOTIFY_HANDLER, - acpi_ec_gpe_query, ec); - } - } - return 0; -} - static u32 acpi_ec_gpe_handler(void *data) { struct acpi_ec *ec = data; + u8 status; pr_debug(PREFIX "~~~> interrupt\n"); + status = acpi_ec_read_status(ec); - advance_transaction(ec, acpi_ec_read_status(ec)); - if (ec_transaction_done(ec) && - (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { + advance_transaction(ec, status); + if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) wake_up(&ec->wait); - ec_check_sci(ec, acpi_ec_read_status(ec)); - } + ec_check_sci(ec, status); return ACPI_INTERRUPT_HANDLED; } diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index 04b0f007c9b7..394ae89409c2 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -56,7 +56,7 @@ ACPI_MODULE_NAME("pci_link"); static int acpi_pci_link_add(struct acpi_device *device); static int acpi_pci_link_remove(struct acpi_device *device, int type); -static const struct acpi_device_id link_device_ids[] = { +static struct acpi_device_id link_device_ids[] = { {"PNP0C0F", 0}, {"", 0}, }; diff --git a/trunk/drivers/acpi/pci_root.c b/trunk/drivers/acpi/pci_root.c index 64f55b6db73c..101cce3681d1 100644 --- a/trunk/drivers/acpi/pci_root.c +++ b/trunk/drivers/acpi/pci_root.c @@ -46,7 +46,7 @@ static int acpi_pci_root_add(struct acpi_device *device); static int acpi_pci_root_remove(struct acpi_device *device, int type); static int acpi_pci_root_start(struct acpi_device *device); -static const struct acpi_device_id root_device_ids[] = { +static struct acpi_device_id root_device_ids[] = { {"PNP0A03", 0}, {"", 0}, }; diff --git a/trunk/drivers/acpi/power.c b/trunk/drivers/acpi/power.c index 0f30c3c1eea4..22b297916519 100644 --- a/trunk/drivers/acpi/power.c +++ b/trunk/drivers/acpi/power.c @@ -65,7 +65,7 @@ static int acpi_power_remove(struct acpi_device *device, int type); static int acpi_power_resume(struct acpi_device *device); static int acpi_power_open_fs(struct inode *inode, struct file *file); -static const struct acpi_device_id power_device_ids[] = { +static struct acpi_device_id power_device_ids[] = { {ACPI_POWER_HID, 0}, {"", 0}, }; diff --git a/trunk/drivers/acpi/power_meter.c b/trunk/drivers/acpi/power_meter.c index dc4ffadf8122..2ef7030a0c28 100644 --- a/trunk/drivers/acpi/power_meter.c +++ b/trunk/drivers/acpi/power_meter.c @@ -64,7 +64,7 @@ static int can_cap_in_hardware(void) return force_cap_on || cap_in_hardware; } -static const struct acpi_device_id power_meter_ids[] = { +static struct acpi_device_id power_meter_ids[] = { {"ACPI000D", 0}, {"", 0}, }; @@ -534,7 +534,6 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource) kfree(resource->domain_devices); kobject_put(resource->holders_dir); - resource->num_domain_devices = 0; } static int read_domain_devices(struct acpi_power_meter_resource *resource) @@ -741,6 +740,7 @@ static int setup_attrs(struct acpi_power_meter_resource *resource) return res; error: + remove_domain_devices(resource); remove_attrs(resource); return res; } diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 7c0441f63b39..d1676b1754d9 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -305,28 +305,6 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; - /* - * FADT specified C2 latency must be less than or equal to - * 100 microseconds. - */ - if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); - /* invalidate C2 */ - pr->power.states[ACPI_STATE_C2].address = 0; - } - - /* - * FADT supplied C3 latency must be less than or equal to - * 1000 microseconds. - */ - if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); - /* invalidate C3 */ - pr->power.states[ACPI_STATE_C3].address = 0; - } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "lvl2[0x%08x] lvl3[0x%08x]\n", pr->power.states[ACPI_STATE_C2].address, @@ -516,6 +494,33 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) return status; } +static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) +{ + + if (!cx->address) + return; + + /* + * C2 latency must be less than or equal to 100 + * microseconds. + */ + else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "latency too large [%d]\n", cx->latency)); + return; + } + + /* + * Otherwise we've met all of our C2 requirements. + * Normalize the C2 latency to expidite policy + */ + cx->valid = 1; + + cx->latency_ticks = cx->latency; + + return; +} + static void acpi_processor_power_verify_c3(struct acpi_processor *pr, struct acpi_processor_cx *cx) { @@ -526,6 +531,16 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, if (!cx->address) return; + /* + * C3 latency must be less than or equal to 1000 + * microseconds. + */ + else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "latency too large [%d]\n", cx->latency)); + return; + } + /* * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) * DMA transfers are used by any ISA device to avoid livelock. @@ -614,10 +629,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) break; case ACPI_STATE_C2: - if (!cx->address) - break; - cx->valid = 1; - cx->latency_ticks = cx->latency; /* Normalize latency */ + acpi_processor_power_verify_c2(cx); break; case ACPI_STATE_C3: diff --git a/trunk/drivers/acpi/processor_pdc.c b/trunk/drivers/acpi/processor_pdc.c index 7247819dbd80..30e4dc0cdf30 100644 --- a/trunk/drivers/acpi/processor_pdc.c +++ b/trunk/drivers/acpi/processor_pdc.c @@ -144,29 +144,6 @@ void acpi_processor_set_pdc(acpi_handle handle) } EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); -static int early_pdc_optin; -static int set_early_pdc_optin(const struct dmi_system_id *id) -{ - early_pdc_optin = 1; - return 0; -} - -static struct dmi_system_id __cpuinitdata early_pdc_optin_table[] = { - { - set_early_pdc_optin, "HP Envy", { - DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Envy") }, NULL}, - { - set_early_pdc_optin, "HP Pavilion dv6", { - DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6") }, NULL}, - { - set_early_pdc_optin, "HP Pavilion dv7", { - DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7") }, NULL}, - {}, -}; - static acpi_status early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) { @@ -174,7 +151,7 @@ early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) return AE_OK; } -void __init acpi_early_processor_set_pdc(void) +void acpi_early_processor_set_pdc(void) { /* * Check whether the system is DMI table. If yes, OSPM @@ -182,13 +159,6 @@ void __init acpi_early_processor_set_pdc(void) */ dmi_check_system(processor_idle_dmi_table); - /* - * Allow systems to opt-in to early _PDC evaluation. - */ - dmi_check_system(early_pdc_optin_table); - if (!early_pdc_optin) - return; - acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, early_init_pdc, NULL, NULL, NULL); diff --git a/trunk/drivers/acpi/processor_thermal.c b/trunk/drivers/acpi/processor_thermal.c index 6deafb4aa0da..140c5c5b423c 100644 --- a/trunk/drivers/acpi/processor_thermal.c +++ b/trunk/drivers/acpi/processor_thermal.c @@ -443,7 +443,8 @@ struct thermal_cooling_device_ops processor_cooling_ops = { #ifdef CONFIG_ACPI_PROCFS static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) { - struct acpi_processor *pr = seq->private; + struct acpi_processor *pr = (struct acpi_processor *)seq->private; + if (!pr) goto end; diff --git a/trunk/drivers/acpi/sbs.c b/trunk/drivers/acpi/sbs.c index b16ddbf23a9c..52b9db8afc20 100644 --- a/trunk/drivers/acpi/sbs.c +++ b/trunk/drivers/acpi/sbs.c @@ -822,10 +822,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) static void acpi_battery_remove(struct acpi_sbs *sbs, int id) { -#if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) struct acpi_battery *battery = &sbs->battery[id]; -#endif - #ifdef CONFIG_ACPI_SYSFS_POWER if (battery->bat.dev) { if (battery->have_sysfs_alarm) diff --git a/trunk/drivers/acpi/sbshc.c b/trunk/drivers/acpi/sbshc.c index fd09229282ea..d9339806df45 100644 --- a/trunk/drivers/acpi/sbshc.c +++ b/trunk/drivers/acpi/sbshc.c @@ -242,7 +242,7 @@ static int smbus_alarm(void *context) case ACPI_SBS_CHARGER: case ACPI_SBS_MANAGER: case ACPI_SBS_BATTERY: - acpi_os_execute(OSL_NOTIFY_HANDLER, + acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc); default:; } diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index b765790b32be..72e76b4b6538 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -78,13 +78,6 @@ MODULE_LICENSE("GPL"); static int brightness_switch_enabled = 1; module_param(brightness_switch_enabled, bool, 0644); -/* - * By default, we don't allow duplicate ACPI video bus devices - * under the same VGA controller - */ -static int allow_duplicates; -module_param(allow_duplicates, bool, 0644); - static int register_count = 0; static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_remove(struct acpi_device *device, int type); @@ -2246,47 +2239,11 @@ static int acpi_video_resume(struct acpi_device *device) return AE_OK; } -static acpi_status -acpi_video_bus_match(acpi_handle handle, u32 level, void *context, - void **return_value) -{ - struct acpi_device *device = context; - struct acpi_device *sibling; - int result; - - if (handle == device->handle) - return AE_CTRL_TERMINATE; - - result = acpi_bus_get_device(handle, &sibling); - if (result) - return AE_OK; - - if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) - return AE_ALREADY_EXISTS; - - return AE_OK; -} - static int acpi_video_bus_add(struct acpi_device *device) { struct acpi_video_bus *video; struct input_dev *input; int error; - acpi_status status; - - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, - device->parent->handle, 1, - acpi_video_bus_match, NULL, - device, NULL); - if (status == AE_ALREADY_EXISTS) { - printk(KERN_WARNING FW_BUG - "Duplicate ACPI video bus devices for the" - " same VGA controller, please try module " - "parameter \"video.allow_duplicates=1\"" - "if the current driver doesn't work.\n"); - if (!allow_duplicates) - return -ENODEV; - } video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); if (!video) diff --git a/trunk/drivers/block/drbd/Kconfig b/trunk/drivers/block/drbd/Kconfig index df0983787390..f4acd04ebeef 100644 --- a/trunk/drivers/block/drbd/Kconfig +++ b/trunk/drivers/block/drbd/Kconfig @@ -3,7 +3,7 @@ # comment "DRBD disabled because PROC_FS, INET or CONNECTOR not selected" - depends on PROC_FS='n' || INET='n' || CONNECTOR='n' + depends on !PROC_FS || !INET || !CONNECTOR config BLK_DEV_DRBD tristate "DRBD Distributed Replicated Block Device support" diff --git a/trunk/drivers/block/drbd/drbd_int.h b/trunk/drivers/block/drbd/drbd_int.h index 2bf3a6ef3684..c97558763430 100644 --- a/trunk/drivers/block/drbd/drbd_int.h +++ b/trunk/drivers/block/drbd/drbd_int.h @@ -1275,7 +1275,7 @@ struct bm_extent { #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32 #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_BM #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM -#elif !defined(CONFIG_LBDAF) && BITS_PER_LONG == 32 +#elif !defined(CONFIG_LBD) && BITS_PER_LONG == 32 #define DRBD_MAX_SECTORS DRBD_MAX_SECTORS_32 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32 #else @@ -1371,9 +1371,10 @@ extern int is_valid_ar_handle(struct drbd_request *, sector_t); extern void drbd_suspend_io(struct drbd_conf *mdev); extern void drbd_resume_io(struct drbd_conf *mdev); extern char *ppsize(char *buf, unsigned long long size); -extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *, int); +extern sector_t drbd_new_dev_size(struct drbd_conf *, + struct drbd_backing_dev *); enum determine_dev_size { dev_size_error = -1, unchanged = 0, shrunk = 1, grew = 2 }; -extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *, int force) __must_hold(local); +extern enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *) __must_hold(local); extern void resync_after_online_grow(struct drbd_conf *); extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int) __must_hold(local); extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, diff --git a/trunk/drivers/block/drbd/drbd_main.c b/trunk/drivers/block/drbd/drbd_main.c index e898ad9eb1c3..9348f33f6242 100644 --- a/trunk/drivers/block/drbd/drbd_main.c +++ b/trunk/drivers/block/drbd/drbd_main.c @@ -1298,7 +1298,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, dev_err(DEV, "Sending state in drbd_io_error() failed\n"); } - wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); lc_destroy(mdev->resync); mdev->resync = NULL; lc_destroy(mdev->act_log); diff --git a/trunk/drivers/block/drbd/drbd_nl.c b/trunk/drivers/block/drbd/drbd_nl.c index 1292e0620663..4e0726aa53b0 100644 --- a/trunk/drivers/block/drbd/drbd_nl.c +++ b/trunk/drivers/block/drbd/drbd_nl.c @@ -510,7 +510,7 @@ void drbd_resume_io(struct drbd_conf *mdev) * Returns 0 on success, negative return values indicate errors. * You should call drbd_md_sync() after calling this function. */ -enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force) __must_hold(local) +enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev) __must_hold(local) { sector_t prev_first_sect, prev_size; /* previous meta location */ sector_t la_size; @@ -541,7 +541,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force /* TODO: should only be some assert here, not (re)init... */ drbd_md_set_sector_offsets(mdev, mdev->ldev); - size = drbd_new_dev_size(mdev, mdev->ldev, force); + size = drbd_new_dev_size(mdev, mdev->ldev); if (drbd_get_capacity(mdev->this_bdev) != size || drbd_bm_capacity(mdev) != size) { @@ -596,7 +596,7 @@ enum determine_dev_size drbd_determin_dev_size(struct drbd_conf *mdev, int force } sector_t -drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int assume_peer_has_space) +drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) { sector_t p_size = mdev->p_size; /* partner's disk size. */ sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */ @@ -606,11 +606,6 @@ drbd_new_dev_size(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, int ass m_size = drbd_get_max_capacity(bdev); - if (mdev->state.conn < C_CONNECTED && assume_peer_has_space) { - dev_warn(DEV, "Resize while not connected was forced by the user!\n"); - p_size = m_size; - } - if (p_size && m_size) { size = min_t(sector_t, p_size, m_size); } else { @@ -970,7 +965,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp /* Prevent shrinking of consistent devices ! */ if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && - drbd_new_dev_size(mdev, nbc, 0) < nbc->md.la_size_sect) { + drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) { dev_warn(DEV, "refusing to truncate a consistent device\n"); retcode = ERR_DISK_TO_SMALL; goto force_diskless_dec; @@ -1057,7 +1052,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp !drbd_md_test_flag(mdev->ldev, MDF_CONNECTED_IND)) set_bit(USE_DEGR_WFC_T, &mdev->flags); - dd = drbd_determin_dev_size(mdev, 0); + dd = drbd_determin_dev_size(mdev); if (dd == dev_size_error) { retcode = ERR_NOMEM_BITMAP; goto force_diskless_dec; @@ -1276,7 +1271,7 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, goto fail; } - if (!drbd_crypto_is_hash(crypto_hash_tfm(tfm))) { + if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_SHASH) { retcode = ERR_AUTH_ALG_ND; goto fail; } @@ -1509,7 +1504,7 @@ static int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, } mdev->ldev->dc.disk_size = (sector_t)rs.resize_size; - dd = drbd_determin_dev_size(mdev, rs.resize_force); + dd = drbd_determin_dev_size(mdev); drbd_md_sync(mdev); put_ldev(mdev); if (dd == dev_size_error) { diff --git a/trunk/drivers/block/drbd/drbd_receiver.c b/trunk/drivers/block/drbd/drbd_receiver.c index f22a5283128a..259c1351b152 100644 --- a/trunk/drivers/block/drbd/drbd_receiver.c +++ b/trunk/drivers/block/drbd/drbd_receiver.c @@ -878,13 +878,9 @@ static int drbd_connect(struct drbd_conf *mdev) if (mdev->cram_hmac_tfm) { /* drbd_request_state(mdev, NS(conn, WFAuth)); */ - switch (drbd_do_auth(mdev)) { - case -1: + if (!drbd_do_auth(mdev)) { dev_err(DEV, "Authentication of peer failed\n"); return -1; - case 0: - dev_err(DEV, "Authentication of peer failed, trying again.\n"); - return 0; } } @@ -1205,11 +1201,10 @@ static int receive_Barrier(struct drbd_conf *mdev, struct p_header *h) case WO_bdev_flush: case WO_drain_io: - if (rv == FE_STILL_LIVE) { - set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); - drbd_wait_ee_list_empty(mdev, &mdev->active_ee); - rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); - } + D_ASSERT(rv == FE_STILL_LIVE); + set_bit(DE_BARRIER_IN_NEXT_EPOCH_ISSUED, &mdev->current_epoch->flags); + drbd_wait_ee_list_empty(mdev, &mdev->active_ee); + rv = drbd_flush_after_epoch(mdev, mdev->current_epoch); if (rv == FE_RECYCLED) return TRUE; @@ -2870,7 +2865,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) /* Never shrink a device with usable data during connect. But allow online shrinking if we are connected. */ - if (drbd_new_dev_size(mdev, mdev->ldev, 0) < + if (drbd_new_dev_size(mdev, mdev->ldev) < drbd_get_capacity(mdev->this_bdev) && mdev->state.disk >= D_OUTDATED && mdev->state.conn < C_CONNECTED) { @@ -2885,7 +2880,7 @@ static int receive_sizes(struct drbd_conf *mdev, struct p_header *h) #undef min_not_zero if (get_ldev(mdev)) { - dd = drbd_determin_dev_size(mdev, 0); + dd = drbd_determin_dev_size(mdev); put_ldev(mdev); if (dd == dev_size_error) return FALSE; @@ -3835,17 +3830,10 @@ static int drbd_do_auth(struct drbd_conf *mdev) { dev_err(DEV, "This kernel was build without CONFIG_CRYPTO_HMAC.\n"); dev_err(DEV, "You need to disable 'cram-hmac-alg' in drbd.conf.\n"); - return -1; + return 0; } #else #define CHALLENGE_LEN 64 - -/* Return value: - 1 - auth succeeded, - 0 - failed, try again (network error), - -1 - auth failed, don't try again. -*/ - static int drbd_do_auth(struct drbd_conf *mdev) { char my_challenge[CHALLENGE_LEN]; /* 64 Bytes... */ @@ -3866,7 +3854,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) (u8 *)mdev->net_conf->shared_secret, key_len); if (rv) { dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); - rv = -1; + rv = 0; goto fail; } @@ -3889,14 +3877,14 @@ static int drbd_do_auth(struct drbd_conf *mdev) if (p.length > CHALLENGE_LEN*2) { dev_err(DEV, "expected AuthChallenge payload too big.\n"); - rv = -1; + rv = 0; goto fail; } peers_ch = kmalloc(p.length, GFP_NOIO); if (peers_ch == NULL) { dev_err(DEV, "kmalloc of peers_ch failed\n"); - rv = -1; + rv = 0; goto fail; } @@ -3912,7 +3900,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) response = kmalloc(resp_size, GFP_NOIO); if (response == NULL) { dev_err(DEV, "kmalloc of response failed\n"); - rv = -1; + rv = 0; goto fail; } @@ -3922,7 +3910,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) rv = crypto_hash_digest(&desc, &sg, sg.length, response); if (rv) { dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); - rv = -1; + rv = 0; goto fail; } @@ -3956,9 +3944,9 @@ static int drbd_do_auth(struct drbd_conf *mdev) } right_response = kmalloc(resp_size, GFP_NOIO); - if (right_response == NULL) { + if (response == NULL) { dev_err(DEV, "kmalloc of right_response failed\n"); - rv = -1; + rv = 0; goto fail; } @@ -3967,7 +3955,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) rv = crypto_hash_digest(&desc, &sg, sg.length, right_response); if (rv) { dev_err(DEV, "crypto_hash_digest() failed with %d\n", rv); - rv = -1; + rv = 0; goto fail; } @@ -3976,8 +3964,6 @@ static int drbd_do_auth(struct drbd_conf *mdev) if (rv) dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", resp_size, mdev->net_conf->cram_hmac_alg); - else - rv = -1; fail: kfree(peers_ch); diff --git a/trunk/drivers/md/dm-table.c b/trunk/drivers/md/dm-table.c index 4b22feb01a0c..be625475cf6d 100644 --- a/trunk/drivers/md/dm-table.c +++ b/trunk/drivers/md/dm-table.c @@ -503,15 +503,16 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, return 0; } - if (bdev_stack_limits(limits, bdev, start) < 0) - DMWARN("%s: adding target device %s caused an alignment inconsistency: " + if (blk_stack_limits(limits, &q->limits, start << 9) < 0) + DMWARN("%s: target device %s is misaligned: " "physical_block_size=%u, logical_block_size=%u, " "alignment_offset=%u, start=%llu", dm_device_name(ti->table->md), bdevname(bdev, b), q->limits.physical_block_size, q->limits.logical_block_size, q->limits.alignment_offset, - (unsigned long long) start << SECTOR_SHIFT); + (unsigned long long) start << 9); + /* * Check if merge fn is supported. @@ -1025,9 +1026,9 @@ int dm_calculate_queue_limits(struct dm_table *table, * for the table. */ if (blk_stack_limits(limits, &ti_limits, 0) < 0) - DMWARN("%s: adding target device " + DMWARN("%s: target device " "(start sect %llu len %llu) " - "caused an alignment inconsistency", + "is misaligned", dm_device_name(table->md), (unsigned long long) ti->begin, (unsigned long long) ti->len); @@ -1078,6 +1079,15 @@ static void dm_table_set_integrity(struct dm_table *t) void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, struct queue_limits *limits) { + /* + * Each target device in the table has a data area that should normally + * be aligned such that the DM device's alignment_offset is 0. + * FIXME: Propagate alignment_offsets up the stack and warn of + * sub-optimal or inconsistent settings. + */ + limits->alignment_offset = 0; + limits->misaligned = 0; + /* * Copy table's limits to the DM device's request_queue */ diff --git a/trunk/drivers/platform/x86/Kconfig b/trunk/drivers/platform/x86/Kconfig index f526e735c5ab..db32c25e3605 100644 --- a/trunk/drivers/platform/x86/Kconfig +++ b/trunk/drivers/platform/x86/Kconfig @@ -364,7 +364,6 @@ config EEEPC_LAPTOP select HWMON select LEDS_CLASS select NEW_LEDS - select INPUT_SPARSEKMAP ---help--- This driver supports the Fn-Fx keys on Eee PC laptops. diff --git a/trunk/drivers/platform/x86/eeepc-laptop.c b/trunk/drivers/platform/x86/eeepc-laptop.c index e2be6bb33d92..5838c69b2fb3 100644 --- a/trunk/drivers/platform/x86/eeepc-laptop.c +++ b/trunk/drivers/platform/x86/eeepc-laptop.c @@ -31,12 +31,10 @@ #include #include #include -#include #include #include #include #include -#include #define EEEPC_LAPTOP_VERSION "0.1" #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" @@ -50,14 +48,6 @@ MODULE_AUTHOR("Corentin Chary, Eric Cooper"); MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); MODULE_LICENSE("GPL"); -static bool hotplug_disabled; - -module_param(hotplug_disabled, bool, 0644); -MODULE_PARM_DESC(hotplug_disabled, - "Disable hotplug for wireless device. " - "If your laptop need that, please report to " - "acpi4asus-user@lists.sourceforge.net."); - /* * Definitions for Asus EeePC */ @@ -130,28 +120,38 @@ static const char *cm_setv[] = { NULL, NULL, "PBPS", "TPDS" }; +struct key_entry { + char type; + u8 code; + u16 keycode; +}; + +enum { KE_KEY, KE_END }; + static const struct key_entry eeepc_keymap[] = { - { KE_KEY, 0x10, { KEY_WLAN } }, - { KE_KEY, 0x11, { KEY_WLAN } }, - { KE_KEY, 0x12, { KEY_PROG1 } }, - { KE_KEY, 0x13, { KEY_MUTE } }, - { KE_KEY, 0x14, { KEY_VOLUMEDOWN } }, - { KE_KEY, 0x15, { KEY_VOLUMEUP } }, - { KE_KEY, 0x16, { KEY_DISPLAY_OFF } }, - { KE_KEY, 0x1a, { KEY_COFFEE } }, - { KE_KEY, 0x1b, { KEY_ZOOM } }, - { KE_KEY, 0x1c, { KEY_PROG2 } }, - { KE_KEY, 0x1d, { KEY_PROG3 } }, - { KE_KEY, NOTIFY_BRN_MIN, { KEY_BRIGHTNESSDOWN } }, - { KE_KEY, NOTIFY_BRN_MAX, { KEY_BRIGHTNESSUP } }, - { KE_KEY, 0x30, { KEY_SWITCHVIDEOMODE } }, - { KE_KEY, 0x31, { KEY_SWITCHVIDEOMODE } }, - { KE_KEY, 0x32, { KEY_SWITCHVIDEOMODE } }, - { KE_KEY, 0x37, { KEY_F13 } }, /* Disable Touchpad */ - { KE_KEY, 0x38, { KEY_F14 } }, - { KE_END, 0 }, + /* Sleep already handled via generic ACPI code */ + {KE_KEY, 0x10, KEY_WLAN }, + {KE_KEY, 0x11, KEY_WLAN }, + {KE_KEY, 0x12, KEY_PROG1 }, + {KE_KEY, 0x13, KEY_MUTE }, + {KE_KEY, 0x14, KEY_VOLUMEDOWN }, + {KE_KEY, 0x15, KEY_VOLUMEUP }, + {KE_KEY, 0x16, KEY_DISPLAY_OFF }, + {KE_KEY, 0x1a, KEY_COFFEE }, + {KE_KEY, 0x1b, KEY_ZOOM }, + {KE_KEY, 0x1c, KEY_PROG2 }, + {KE_KEY, 0x1d, KEY_PROG3 }, + {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN }, + {KE_KEY, NOTIFY_BRN_MAX, KEY_BRIGHTNESSUP }, + {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, + {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, + {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, + {KE_KEY, 0x37, KEY_F13 }, /* Disable Touchpad */ + {KE_KEY, 0x38, KEY_F14 }, + {KE_END, 0}, }; + /* * This is the main structure, we can use it to store useful information */ @@ -159,8 +159,6 @@ struct eeepc_laptop { acpi_handle handle; /* the handle of the acpi device */ u32 cm_supported; /* the control methods supported by this BIOS */ - bool cpufv_disabled; - bool hotplug_disabled; u16 event_count[128]; /* count for each event */ struct platform_device *platform_device; @@ -380,8 +378,6 @@ static ssize_t store_cpufv(struct device *dev, struct eeepc_cpufv c; int rv, value; - if (eeepc->cpufv_disabled) - return -EPERM; if (get_cpufv(eeepc, &c)) return -ENODEV; rv = parse_arg(buf, count, &value); @@ -393,41 +389,6 @@ static ssize_t store_cpufv(struct device *dev, return rv; } -static ssize_t show_cpufv_disabled(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct eeepc_laptop *eeepc = dev_get_drvdata(dev); - - return sprintf(buf, "%d\n", eeepc->cpufv_disabled); -} - -static ssize_t store_cpufv_disabled(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct eeepc_laptop *eeepc = dev_get_drvdata(dev); - int rv, value; - - rv = parse_arg(buf, count, &value); - if (rv < 0) - return rv; - - switch (value) { - case 0: - if (eeepc->cpufv_disabled) - pr_warning("cpufv enabled (not officially supported " - "on this model)\n"); - eeepc->cpufv_disabled = false; - return rv; - case 1: - return -EPERM; - default: - return -EINVAL; - } -} - - static struct device_attribute dev_attr_cpufv = { .attr = { .name = "cpufv", @@ -443,22 +404,12 @@ static struct device_attribute dev_attr_available_cpufv = { .show = show_available_cpufv }; -static struct device_attribute dev_attr_cpufv_disabled = { - .attr = { - .name = "cpufv_disabled", - .mode = 0644 }, - .show = show_cpufv_disabled, - .store = store_cpufv_disabled -}; - - static struct attribute *platform_attributes[] = { &dev_attr_camera.attr, &dev_attr_cardr.attr, &dev_attr_disp.attr, &dev_attr_cpufv.attr, &dev_attr_available_cpufv.attr, - &dev_attr_cpufv_disabled.attr, NULL }; @@ -845,9 +796,6 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) if (result && result != -ENODEV) goto exit; - if (eeepc->hotplug_disabled) - return 0; - result = eeepc_setup_pci_hotplug(eeepc); /* * If we get -EBUSY then something else is handling the PCI hotplug - @@ -1142,42 +1090,120 @@ static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) /* * Input device (i.e. hotkeys) */ -static int eeepc_input_init(struct eeepc_laptop *eeepc) +static struct key_entry *eeepc_get_entry_by_scancode( + struct eeepc_laptop *eeepc, + int code) { - struct input_dev *input; - int error; + struct key_entry *key; - input = input_allocate_device(); - if (!input) { - pr_info("Unable to allocate input device\n"); - return -ENOMEM; + for (key = eeepc->keymap; key->type != KE_END; key++) + if (code == key->code) + return key; + + return NULL; +} + +static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) +{ + static struct key_entry *key; + + key = eeepc_get_entry_by_scancode(eeepc, event); + if (key) { + switch (key->type) { + case KE_KEY: + input_report_key(eeepc->inputdev, key->keycode, + 1); + input_sync(eeepc->inputdev); + input_report_key(eeepc->inputdev, key->keycode, + 0); + input_sync(eeepc->inputdev); + break; + } } +} + +static struct key_entry *eeepc_get_entry_by_keycode( + struct eeepc_laptop *eeepc, int code) +{ + struct key_entry *key; + + for (key = eeepc->keymap; key->type != KE_END; key++) + if (code == key->keycode && key->type == KE_KEY) + return key; - input->name = "Asus EeePC extra buttons"; - input->phys = EEEPC_LAPTOP_FILE "/input0"; - input->id.bustype = BUS_HOST; - input->dev.parent = &eeepc->platform_device->dev; + return NULL; +} - error = sparse_keymap_setup(input, eeepc_keymap, NULL); - if (error) { - pr_err("Unable to setup input device keymap\n"); - goto err_free_dev; +static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode) +{ + struct eeepc_laptop *eeepc = input_get_drvdata(dev); + struct key_entry *key = eeepc_get_entry_by_scancode(eeepc, scancode); + + if (key && key->type == KE_KEY) { + *keycode = key->keycode; + return 0; } - error = input_register_device(input); - if (error) { - pr_err("Unable to register input device\n"); - goto err_free_keymap; + return -EINVAL; +} + +static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) +{ + struct eeepc_laptop *eeepc = input_get_drvdata(dev); + struct key_entry *key; + int old_keycode; + + if (keycode < 0 || keycode > KEY_MAX) + return -EINVAL; + + key = eeepc_get_entry_by_scancode(eeepc, scancode); + if (key && key->type == KE_KEY) { + old_keycode = key->keycode; + key->keycode = keycode; + set_bit(keycode, dev->keybit); + if (!eeepc_get_entry_by_keycode(eeepc, old_keycode)) + clear_bit(old_keycode, dev->keybit); + return 0; } - eeepc->inputdev = input; - return 0; + return -EINVAL; +} - err_free_keymap: - sparse_keymap_free(input); - err_free_dev: - input_free_device(input); - return error; +static int eeepc_input_init(struct eeepc_laptop *eeepc) +{ + const struct key_entry *key; + int result; + + eeepc->inputdev = input_allocate_device(); + if (!eeepc->inputdev) { + pr_info("Unable to allocate input device\n"); + return -ENOMEM; + } + eeepc->inputdev->name = "Asus EeePC extra buttons"; + eeepc->inputdev->dev.parent = &eeepc->platform_device->dev; + eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0"; + eeepc->inputdev->id.bustype = BUS_HOST; + eeepc->inputdev->getkeycode = eeepc_getkeycode; + eeepc->inputdev->setkeycode = eeepc_setkeycode; + input_set_drvdata(eeepc->inputdev, eeepc); + + eeepc->keymap = kmemdup(eeepc_keymap, sizeof(eeepc_keymap), + GFP_KERNEL); + for (key = eeepc_keymap; key->type != KE_END; key++) { + switch (key->type) { + case KE_KEY: + set_bit(EV_KEY, eeepc->inputdev->evbit); + set_bit(key->keycode, eeepc->inputdev->keybit); + break; + } + } + result = input_register_device(eeepc->inputdev); + if (result) { + pr_info("Unable to register input device\n"); + input_free_device(eeepc->inputdev); + return result; + } + return 0; } static void eeepc_input_exit(struct eeepc_laptop *eeepc) @@ -1227,59 +1253,11 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) * event will be desired value (or else ignored) */ } - sparse_keymap_report_event(eeepc->inputdev, event, - 1, true); + eeepc_input_notify(eeepc, event); } } else { /* Everything else is a bona-fide keypress event */ - sparse_keymap_report_event(eeepc->inputdev, event, 1, true); - } -} - -static void eeepc_dmi_check(struct eeepc_laptop *eeepc) -{ - const char *model; - - model = dmi_get_system_info(DMI_PRODUCT_NAME); - if (!model) - return; - - /* - * Blacklist for setting cpufv (cpu speed). - * - * EeePC 4G ("701") implements CFVS, but it is not supported - * by the pre-installed OS, and the original option to change it - * in the BIOS setup screen was removed in later versions. - * - * Judging by the lack of "Super Hybrid Engine" on Asus product pages, - * this applies to all "701" models (4G/4G Surf/2G Surf). - * - * So Asus made a deliberate decision not to support it on this model. - * We have several reports that using it can cause the system to hang - * - * The hang has also been reported on a "702" (Model name "8G"?). - * - * We avoid dmi_check_system() / dmi_match(), because they use - * substring matching. We don't want to affect the "701SD" - * and "701SDX" models, because they do support S.H.E. - */ - if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) { - eeepc->cpufv_disabled = true; - pr_info("model %s does not officially support setting cpu " - "speed\n", model); - pr_info("cpufv disabled to avoid instability\n"); - } - - /* - * Blacklist for wlan hotplug - * - * Eeepc 1005HA doesn't work like others models and don't need the - * hotplug code. In fact, current hotplug code seems to unplug another - * device... - */ - if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) { - eeepc->hotplug_disabled = true; - pr_info("wlan hotplug disabled\n"); + eeepc_input_notify(eeepc, event); } } @@ -1364,10 +1342,6 @@ static int __devinit eeepc_acpi_add(struct acpi_device *device) strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); device->driver_data = eeepc; - eeepc->hotplug_disabled = hotplug_disabled; - - eeepc_dmi_check(eeepc); - result = eeepc_acpi_init(eeepc, device); if (result) goto fail_platform; @@ -1478,12 +1452,10 @@ static int __init eeepc_laptop_init(void) result = acpi_bus_register_driver(&eeepc_acpi_driver); if (result < 0) goto fail_acpi_driver; - if (!eeepc_device_present) { result = -ENODEV; goto fail_no_device; } - return 0; fail_no_device: diff --git a/trunk/drivers/platform/x86/sony-laptop.c b/trunk/drivers/platform/x86/sony-laptop.c index 3f71a605a492..5af53340da6f 100644 --- a/trunk/drivers/platform/x86/sony-laptop.c +++ b/trunk/drivers/platform/x86/sony-laptop.c @@ -1201,12 +1201,9 @@ static void sony_nc_rfkill_setup(struct acpi_device *device) /* the buffer is filled with magic numbers describing the devices * available, 0xff terminates the enumeration */ - for (i = 0; i < device_enum->buffer.length; i++) { - - dev_code = *(device_enum->buffer.pointer + i); - if (dev_code == 0xff) - break; - + while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff && + i < device_enum->buffer.length) { + i++; dprintk("Radio devices, looking at 0x%.2x\n", dev_code); if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI]) diff --git a/trunk/drivers/usb/serial/generic.c b/trunk/drivers/usb/serial/generic.c index f1ea3a33b6e6..5ce033ab9b99 100644 --- a/trunk/drivers/usb/serial/generic.c +++ b/trunk/drivers/usb/serial/generic.c @@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) dbg("%s - port %d", __func__, port->number); - if (serial->type->max_in_flight_urbs) { - spin_lock_irqsave(&port->lock, flags); + spin_lock_irqsave(&port->lock, flags); + if (serial->type->max_in_flight_urbs) chars = port->tx_bytes_flight; - spin_unlock_irqrestore(&port->lock, flags); - } else if (serial->num_bulk_out) + else if (serial->num_bulk_out) chars = kfifo_len(&port->write_fifo); + spin_unlock_irqrestore(&port->lock, flags); dbg("%s - returns %d", __func__, chars); return chars; diff --git a/trunk/fs/bio.c b/trunk/fs/bio.c index 12429c9553eb..76e6713abf94 100644 --- a/trunk/fs/bio.c +++ b/trunk/fs/bio.c @@ -78,7 +78,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) i = 0; while (i < bio_slab_nr) { - bslab = &bio_slabs[i]; + struct bio_slab *bslab = &bio_slabs[i]; if (!bslab->slab && entry == -1) entry = i; diff --git a/trunk/fs/btrfs/acl.c b/trunk/fs/btrfs/acl.c index 54f4798ab46a..2e9e69987a82 100644 --- a/trunk/fs/btrfs/acl.c +++ b/trunk/fs/btrfs/acl.c @@ -112,14 +112,12 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, switch (type) { case ACL_TYPE_ACCESS: mode = inode->i_mode; - name = POSIX_ACL_XATTR_ACCESS; - if (acl) { - ret = posix_acl_equiv_mode(acl, &mode); - if (ret < 0) - return ret; - inode->i_mode = mode; - } + ret = posix_acl_equiv_mode(acl, &mode); + if (ret < 0) + return ret; ret = 0; + inode->i_mode = mode; + name = POSIX_ACL_XATTR_ACCESS; break; case ACL_TYPE_DEFAULT: if (!S_ISDIR(inode->i_mode)) diff --git a/trunk/fs/btrfs/extent-tree.c b/trunk/fs/btrfs/extent-tree.c index 432a2da4641e..56e50137d0e6 100644 --- a/trunk/fs/btrfs/extent-tree.c +++ b/trunk/fs/btrfs/extent-tree.c @@ -83,17 +83,6 @@ static int block_group_bits(struct btrfs_block_group_cache *cache, u64 bits) return (cache->flags & bits) == bits; } -void btrfs_get_block_group(struct btrfs_block_group_cache *cache) -{ - atomic_inc(&cache->count); -} - -void btrfs_put_block_group(struct btrfs_block_group_cache *cache) -{ - if (atomic_dec_and_test(&cache->count)) - kfree(cache); -} - /* * this adds the block group to the fs_info rb tree for the block group * cache @@ -167,7 +156,7 @@ block_group_cache_tree_search(struct btrfs_fs_info *info, u64 bytenr, } } if (ret) - btrfs_get_block_group(ret); + atomic_inc(&ret->count); spin_unlock(&info->block_group_cache_lock); return ret; @@ -418,8 +407,6 @@ static int caching_kthread(void *data) put_caching_control(caching_ctl); atomic_dec(&block_group->space_info->caching_threads); - btrfs_put_block_group(block_group); - return 0; } @@ -460,7 +447,6 @@ static int cache_block_group(struct btrfs_block_group_cache *cache) up_write(&fs_info->extent_commit_sem); atomic_inc(&cache->space_info->caching_threads); - btrfs_get_block_group(cache); tsk = kthread_run(caching_kthread, cache, "btrfs-cache-%llu\n", cache->key.objectid); @@ -500,6 +486,12 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group( return cache; } +void btrfs_put_block_group(struct btrfs_block_group_cache *cache) +{ + if (atomic_dec_and_test(&cache->count)) + kfree(cache); +} + static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info, u64 flags) { @@ -2590,7 +2582,7 @@ next_block_group(struct btrfs_root *root, if (node) { cache = rb_entry(node, struct btrfs_block_group_cache, cache_node); - btrfs_get_block_group(cache); + atomic_inc(&cache->count); } else cache = NULL; spin_unlock(&root->fs_info->block_group_cache_lock); @@ -4235,7 +4227,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, u64 offset; int cached; - btrfs_get_block_group(block_group); + atomic_inc(&block_group->count); search_start = block_group->key.objectid; have_block_group: @@ -4323,7 +4315,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, btrfs_put_block_group(block_group); block_group = last_ptr->block_group; - btrfs_get_block_group(block_group); + atomic_inc(&block_group->count); spin_unlock(&last_ptr->lock); spin_unlock(&last_ptr->refill_lock); @@ -7403,7 +7395,9 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) wait_block_group_cache_done(block_group); btrfs_remove_free_space_cache(block_group); - btrfs_put_block_group(block_group); + + WARN_ON(atomic_read(&block_group->count) != 1); + kfree(block_group); spin_lock(&info->block_group_cache_lock); } diff --git a/trunk/fs/btrfs/file.c b/trunk/fs/btrfs/file.c index c02033596f02..feaa13b105d9 100644 --- a/trunk/fs/btrfs/file.c +++ b/trunk/fs/btrfs/file.c @@ -506,8 +506,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, } static int extent_mergeable(struct extent_buffer *leaf, int slot, - u64 objectid, u64 bytenr, u64 orig_offset, - u64 *start, u64 *end) + u64 objectid, u64 bytenr, u64 *start, u64 *end) { struct btrfs_file_extent_item *fi; struct btrfs_key key; @@ -523,7 +522,6 @@ static int extent_mergeable(struct extent_buffer *leaf, int slot, fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG || btrfs_file_extent_disk_bytenr(leaf, fi) != bytenr || - btrfs_file_extent_offset(leaf, fi) != key.offset - orig_offset || btrfs_file_extent_compression(leaf, fi) || btrfs_file_extent_encryption(leaf, fi) || btrfs_file_extent_other_encoding(leaf, fi)) @@ -563,7 +561,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, u64 split; int del_nr = 0; int del_slot = 0; - int recow; int ret; btrfs_drop_extent_cache(inode, start, end - 1, 0); @@ -571,7 +568,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, path = btrfs_alloc_path(); BUG_ON(!path); again: - recow = 0; split = start; key.objectid = inode->i_ino; key.type = BTRFS_EXTENT_DATA_KEY; @@ -595,60 +591,12 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi); - memcpy(&new_key, &key, sizeof(new_key)); - - if (start == key.offset && end < extent_end) { - other_start = 0; - other_end = start; - if (extent_mergeable(leaf, path->slots[0] - 1, - inode->i_ino, bytenr, orig_offset, - &other_start, &other_end)) { - new_key.offset = end; - btrfs_set_item_key_safe(trans, root, path, &new_key); - fi = btrfs_item_ptr(leaf, path->slots[0], - struct btrfs_file_extent_item); - btrfs_set_file_extent_num_bytes(leaf, fi, - extent_end - end); - btrfs_set_file_extent_offset(leaf, fi, - end - orig_offset); - fi = btrfs_item_ptr(leaf, path->slots[0] - 1, - struct btrfs_file_extent_item); - btrfs_set_file_extent_num_bytes(leaf, fi, - end - other_start); - btrfs_mark_buffer_dirty(leaf); - goto out; - } - } - - if (start > key.offset && end == extent_end) { - other_start = end; - other_end = 0; - if (extent_mergeable(leaf, path->slots[0] + 1, - inode->i_ino, bytenr, orig_offset, - &other_start, &other_end)) { - fi = btrfs_item_ptr(leaf, path->slots[0], - struct btrfs_file_extent_item); - btrfs_set_file_extent_num_bytes(leaf, fi, - start - key.offset); - path->slots[0]++; - new_key.offset = start; - btrfs_set_item_key_safe(trans, root, path, &new_key); - - fi = btrfs_item_ptr(leaf, path->slots[0], - struct btrfs_file_extent_item); - btrfs_set_file_extent_num_bytes(leaf, fi, - other_end - start); - btrfs_set_file_extent_offset(leaf, fi, - start - orig_offset); - btrfs_mark_buffer_dirty(leaf); - goto out; - } - } while (start > key.offset || end < extent_end) { if (key.offset == start) split = end; + memcpy(&new_key, &key, sizeof(new_key)); new_key.offset = split; ret = btrfs_duplicate_item(trans, root, path, &new_key); if (ret == -EAGAIN) { @@ -683,18 +631,15 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, path->slots[0]--; extent_end = end; } - recow = 1; } + fi = btrfs_item_ptr(leaf, path->slots[0], + struct btrfs_file_extent_item); + other_start = end; other_end = 0; - if (extent_mergeable(leaf, path->slots[0] + 1, - inode->i_ino, bytenr, orig_offset, - &other_start, &other_end)) { - if (recow) { - btrfs_release_path(root, path); - goto again; - } + if (extent_mergeable(leaf, path->slots[0] + 1, inode->i_ino, + bytenr, &other_start, &other_end)) { extent_end = other_end; del_slot = path->slots[0] + 1; del_nr++; @@ -705,13 +650,8 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, } other_start = 0; other_end = start; - if (extent_mergeable(leaf, path->slots[0] - 1, - inode->i_ino, bytenr, orig_offset, - &other_start, &other_end)) { - if (recow) { - btrfs_release_path(root, path); - goto again; - } + if (extent_mergeable(leaf, path->slots[0] - 1, inode->i_ino, + bytenr, &other_start, &other_end)) { key.offset = other_start; del_slot = path->slots[0]; del_nr++; @@ -720,22 +660,22 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, inode->i_ino, orig_offset); BUG_ON(ret); } - fi = btrfs_item_ptr(leaf, path->slots[0], - struct btrfs_file_extent_item); if (del_nr == 0) { btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG); btrfs_mark_buffer_dirty(leaf); - } else { - btrfs_set_file_extent_type(leaf, fi, - BTRFS_FILE_EXTENT_REG); - btrfs_set_file_extent_num_bytes(leaf, fi, - extent_end - key.offset); - btrfs_mark_buffer_dirty(leaf); - - ret = btrfs_del_items(trans, root, path, del_slot, del_nr); - BUG_ON(ret); + goto out; } + + fi = btrfs_item_ptr(leaf, del_slot - 1, + struct btrfs_file_extent_item); + btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG); + btrfs_set_file_extent_num_bytes(leaf, fi, + extent_end - key.offset); + btrfs_mark_buffer_dirty(leaf); + + ret = btrfs_del_items(trans, root, path, del_slot, del_nr); + BUG_ON(ret); out: btrfs_free_path(path); return 0; diff --git a/trunk/fs/btrfs/inode.c b/trunk/fs/btrfs/inode.c index b330e27c2d8b..5440bab23635 100644 --- a/trunk/fs/btrfs/inode.c +++ b/trunk/fs/btrfs/inode.c @@ -3796,12 +3796,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) if (location.type == BTRFS_INODE_ITEM_KEY) { inode = btrfs_iget(dir->i_sb, &location, root); - if (unlikely(root->clean_orphans) && - !(inode->i_sb->s_flags & MS_RDONLY)) { - down_read(&root->fs_info->cleanup_work_sem); - btrfs_orphan_cleanup(root); - up_read(&root->fs_info->cleanup_work_sem); - } return inode; } @@ -4001,11 +3995,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, /* Reached end of directory/root. Bump pos past the last item. */ if (key_type == BTRFS_DIR_INDEX_KEY) - /* - * 32-bit glibc will use getdents64, but then strtol - - * so the last number we can serve is this. - */ - filp->f_pos = 0x7fffffff; + filp->f_pos = INT_LIMIT(off_t); else filp->f_pos++; nopos: diff --git a/trunk/fs/btrfs/ordered-data.c b/trunk/fs/btrfs/ordered-data.c index 5c2a9e78a949..b10a49d4bc6a 100644 --- a/trunk/fs/btrfs/ordered-data.c +++ b/trunk/fs/btrfs/ordered-data.c @@ -626,8 +626,6 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset, if (ordered) offset = entry_end(ordered); - else - offset = ALIGN(offset, BTRFS_I(inode)->root->sectorsize); mutex_lock(&tree->mutex); disk_i_size = BTRFS_I(inode)->disk_i_size; diff --git a/trunk/fs/btrfs/relocation.c b/trunk/fs/btrfs/relocation.c index ed3e4a2ec2c8..a9728680eca8 100644 --- a/trunk/fs/btrfs/relocation.c +++ b/trunk/fs/btrfs/relocation.c @@ -3281,10 +3281,8 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) return -ENOMEM; path = btrfs_alloc_path(); - if (!path) { - kfree(cluster); + if (!path) return -ENOMEM; - } rc->extents_found = 0; rc->extents_skipped = 0; diff --git a/trunk/fs/btrfs/volumes.c b/trunk/fs/btrfs/volumes.c index 220dad5db017..198cff28766d 100644 --- a/trunk/fs/btrfs/volumes.c +++ b/trunk/fs/btrfs/volumes.c @@ -2649,10 +2649,8 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, em = lookup_extent_mapping(em_tree, logical, *length); read_unlock(&em_tree->lock); - if (!em && unplug_page) { - kfree(multi); + if (!em && unplug_page) return 0; - } if (!em) { printk(KERN_CRIT "unable to find logical %llu len %llu\n", diff --git a/trunk/fs/ecryptfs/crypto.c b/trunk/fs/ecryptfs/crypto.c index 7cb0a59f4b9d..fbb6e5eed697 100644 --- a/trunk/fs/ecryptfs/crypto.c +++ b/trunk/fs/ecryptfs/crypto.c @@ -1748,7 +1748,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, char *cipher_name, size_t *key_size) { char dummy_key[ECRYPTFS_MAX_KEY_BYTES]; - char *full_alg_name = NULL; + char *full_alg_name; int rc; *key_tfm = NULL; @@ -1763,6 +1763,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, if (rc) goto out; *key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC); + kfree(full_alg_name); if (IS_ERR(*key_tfm)) { rc = PTR_ERR(*key_tfm); printk(KERN_ERR "Unable to allocate crypto cipher with name " @@ -1785,7 +1786,6 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm, goto out; } out: - kfree(full_alg_name); return rc; } diff --git a/trunk/fs/ecryptfs/file.c b/trunk/fs/ecryptfs/file.c index 678172b61be2..9e944057001b 100644 --- a/trunk/fs/ecryptfs/file.c +++ b/trunk/fs/ecryptfs/file.c @@ -158,7 +158,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file) struct dentry *ecryptfs_dentry = file->f_path.dentry; /* Private value of ecryptfs_dentry allocated in * ecryptfs_lookup() */ - struct dentry *lower_dentry; + struct dentry *lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); struct ecryptfs_file_info *file_info; mount_crypt_stat = &ecryptfs_superblock_to_private( @@ -191,6 +191,13 @@ static int ecryptfs_open(struct inode *inode, struct file *file) | ECRYPTFS_ENCRYPTED); } mutex_unlock(&crypt_stat->cs_mutex); + if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) + && !(file->f_flags & O_RDONLY)) { + rc = -EPERM; + printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " + "file must hence be opened RO\n", __func__); + goto out; + } if (!ecryptfs_inode_to_private(inode)->lower_file) { rc = ecryptfs_init_persistent_file(ecryptfs_dentry); if (rc) { @@ -201,13 +208,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file) goto out; } } - if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) - && !(file->f_flags & O_RDONLY)) { - rc = -EPERM; - printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " - "file must hence be opened RO\n", __func__); - goto out; - } ecryptfs_set_file_lower( file, ecryptfs_inode_to_private(inode)->lower_file); if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { @@ -299,6 +299,7 @@ static int ecryptfs_ioctl(struct inode *inode, struct file *file, const struct file_operations ecryptfs_dir_fops = { .readdir = ecryptfs_readdir, .ioctl = ecryptfs_ioctl, + .mmap = generic_file_mmap, .open = ecryptfs_open, .flush = ecryptfs_flush, .release = ecryptfs_release, diff --git a/trunk/fs/ecryptfs/inode.c b/trunk/fs/ecryptfs/inode.c index 4a430ab4115c..7f8545032930 100644 --- a/trunk/fs/ecryptfs/inode.c +++ b/trunk/fs/ecryptfs/inode.c @@ -282,8 +282,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, goto out; } rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry, - ecryptfs_dir_inode->i_sb, - ECRYPTFS_INTERPOSE_FLAG_D_ADD); + ecryptfs_dir_inode->i_sb, 1); if (rc) { printk(KERN_ERR "%s: Error interposing; rc = [%d]\n", __func__, rc); @@ -464,6 +463,9 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, unlock_dir(lower_dir_dentry); dput(lower_new_dentry); dput(lower_old_dentry); + d_drop(lower_old_dentry); + d_drop(new_dentry); + d_drop(old_dentry); return rc; } @@ -612,7 +614,6 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct dentry *lower_new_dentry; struct dentry *lower_old_dir_dentry; struct dentry *lower_new_dir_dentry; - struct dentry *trap = NULL; lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); @@ -620,17 +621,7 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, dget(lower_new_dentry); lower_old_dir_dentry = dget_parent(lower_old_dentry); lower_new_dir_dentry = dget_parent(lower_new_dentry); - trap = lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); - /* source should not be ancestor of target */ - if (trap == lower_old_dentry) { - rc = -EINVAL; - goto out_lock; - } - /* target should not be ancestor of source */ - if (trap == lower_new_dentry) { - rc = -ENOTEMPTY; - goto out_lock; - } + lock_rename(lower_old_dir_dentry, lower_new_dir_dentry); rc = vfs_rename(lower_old_dir_dentry->d_inode, lower_old_dentry, lower_new_dir_dentry->d_inode, lower_new_dentry); if (rc) @@ -781,23 +772,18 @@ upper_size_to_lower_size(struct ecryptfs_crypt_stat *crypt_stat, } /** - * truncate_upper + * ecryptfs_truncate * @dentry: The ecryptfs layer dentry - * @ia: Address of the ecryptfs inode's attributes - * @lower_ia: Address of the lower inode's attributes + * @new_length: The length to expand the file to * * Function to handle truncations modifying the size of the file. Note * that the file sizes are interpolated. When expanding, we are simply - * writing strings of 0's out. When truncating, we truncate the upper - * inode and update the lower_ia according to the page index - * interpolations. If ATTR_SIZE is set in lower_ia->ia_valid upon return, - * the caller must use lower_ia in a call to notify_change() to perform - * the truncation of the lower inode. + * writing strings of 0's out. When truncating, we need to modify the + * underlying file size according to the page index interpolations. * * Returns zero on success; non-zero otherwise */ -static int truncate_upper(struct dentry *dentry, struct iattr *ia, - struct iattr *lower_ia) +int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) { int rc = 0; struct inode *inode = dentry->d_inode; @@ -808,10 +794,8 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, loff_t lower_size_before_truncate; loff_t lower_size_after_truncate; - if (unlikely((ia->ia_size == i_size))) { - lower_ia->ia_valid &= ~ATTR_SIZE; + if (unlikely((new_length == i_size))) goto out; - } crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; /* Set up a fake ecryptfs file, this is used to interface with * the file in the underlying filesystem so that the @@ -831,30 +815,28 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, &fake_ecryptfs_file, ecryptfs_inode_to_private(dentry->d_inode)->lower_file); /* Switch on growing or shrinking file */ - if (ia->ia_size > i_size) { + if (new_length > i_size) { char zero[] = { 0x00 }; - lower_ia->ia_valid &= ~ATTR_SIZE; /* Write a single 0 at the last position of the file; * this triggers code that will fill in 0's throughout * the intermediate portion of the previous end of the * file and the new and of the file */ rc = ecryptfs_write(&fake_ecryptfs_file, zero, - (ia->ia_size - 1), 1); - } else { /* ia->ia_size < i_size_read(inode) */ - /* We're chopping off all the pages down to the page - * in which ia->ia_size is located. Fill in the end of - * that page from (ia->ia_size & ~PAGE_CACHE_MASK) to + (new_length - 1), 1); + } else { /* new_length < i_size_read(inode) */ + /* We're chopping off all the pages down do the page + * in which new_length is located. Fill in the end of + * that page from (new_length & ~PAGE_CACHE_MASK) to * PAGE_CACHE_SIZE with zeros. */ size_t num_zeros = (PAGE_CACHE_SIZE - - (ia->ia_size & ~PAGE_CACHE_MASK)); + - (new_length & ~PAGE_CACHE_MASK)); if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { - rc = vmtruncate(inode, ia->ia_size); + rc = vmtruncate(inode, new_length); if (rc) goto out_free; - lower_ia->ia_size = ia->ia_size; - lower_ia->ia_valid |= ATTR_SIZE; + rc = vmtruncate(lower_dentry->d_inode, new_length); goto out_free; } if (num_zeros) { @@ -866,7 +848,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, goto out_free; } rc = ecryptfs_write(&fake_ecryptfs_file, zeros_virt, - ia->ia_size, num_zeros); + new_length, num_zeros); kfree(zeros_virt); if (rc) { printk(KERN_ERR "Error attempting to zero out " @@ -875,7 +857,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, goto out_free; } } - vmtruncate(inode, ia->ia_size); + vmtruncate(inode, new_length); rc = ecryptfs_write_inode_size_to_metadata(inode); if (rc) { printk(KERN_ERR "Problem with " @@ -888,12 +870,10 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, lower_size_before_truncate = upper_size_to_lower_size(crypt_stat, i_size); lower_size_after_truncate = - upper_size_to_lower_size(crypt_stat, ia->ia_size); - if (lower_size_after_truncate < lower_size_before_truncate) { - lower_ia->ia_size = lower_size_after_truncate; - lower_ia->ia_valid |= ATTR_SIZE; - } else - lower_ia->ia_valid &= ~ATTR_SIZE; + upper_size_to_lower_size(crypt_stat, new_length); + if (lower_size_after_truncate < lower_size_before_truncate) + vmtruncate(lower_dentry->d_inode, + lower_size_after_truncate); } out_free: if (ecryptfs_file_to_private(&fake_ecryptfs_file)) @@ -903,33 +883,6 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, return rc; } -/** - * ecryptfs_truncate - * @dentry: The ecryptfs layer dentry - * @new_length: The length to expand the file to - * - * Simple function that handles the truncation of an eCryptfs inode and - * its corresponding lower inode. - * - * Returns zero on success; non-zero otherwise - */ -int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) -{ - struct iattr ia = { .ia_valid = ATTR_SIZE, .ia_size = new_length }; - struct iattr lower_ia = { .ia_valid = 0 }; - int rc; - - rc = truncate_upper(dentry, &ia, &lower_ia); - if (!rc && lower_ia.ia_valid & ATTR_SIZE) { - struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); - - mutex_lock(&lower_dentry->d_inode->i_mutex); - rc = notify_change(lower_dentry, &lower_ia); - mutex_unlock(&lower_dentry->d_inode->i_mutex); - } - return rc; -} - static int ecryptfs_permission(struct inode *inode, int mask) { @@ -952,7 +905,6 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) { int rc = 0; struct dentry *lower_dentry; - struct iattr lower_ia; struct inode *inode; struct inode *lower_inode; struct ecryptfs_crypt_stat *crypt_stat; @@ -991,11 +943,15 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) } } mutex_unlock(&crypt_stat->cs_mutex); - memcpy(&lower_ia, ia, sizeof(lower_ia)); - if (ia->ia_valid & ATTR_FILE) - lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); if (ia->ia_valid & ATTR_SIZE) { - rc = truncate_upper(dentry, ia, &lower_ia); + ecryptfs_printk(KERN_DEBUG, + "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n", + ia->ia_valid, ATTR_SIZE); + rc = ecryptfs_truncate(dentry, ia->ia_size); + /* ecryptfs_truncate handles resizing of the lower file */ + ia->ia_valid &= ~ATTR_SIZE; + ecryptfs_printk(KERN_DEBUG, "ia->ia_valid = [%x]\n", + ia->ia_valid); if (rc < 0) goto out; } @@ -1004,32 +960,17 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) * mode change is for clearing setuid/setgid bits. Allow lower fs * to interpret this in its own way. */ - if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) - lower_ia.ia_valid &= ~ATTR_MODE; + if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) + ia->ia_valid &= ~ATTR_MODE; mutex_lock(&lower_dentry->d_inode->i_mutex); - rc = notify_change(lower_dentry, &lower_ia); + rc = notify_change(lower_dentry, ia); mutex_unlock(&lower_dentry->d_inode->i_mutex); out: fsstack_copy_attr_all(inode, lower_inode); return rc; } -int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, - struct kstat *stat) -{ - struct kstat lower_stat; - int rc; - - rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), - ecryptfs_dentry_to_lower(dentry), &lower_stat); - if (!rc) { - generic_fillattr(dentry->d_inode, stat); - stat->blocks = lower_stat.blocks; - } - return rc; -} - int ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) @@ -1159,7 +1100,6 @@ const struct inode_operations ecryptfs_dir_iops = { const struct inode_operations ecryptfs_main_iops = { .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, - .getattr = ecryptfs_getattr, .setxattr = ecryptfs_setxattr, .getxattr = ecryptfs_getxattr, .listxattr = ecryptfs_listxattr, diff --git a/trunk/fs/ecryptfs/main.c b/trunk/fs/ecryptfs/main.c index ea2f92101dfe..567bc4b9f70a 100644 --- a/trunk/fs/ecryptfs/main.c +++ b/trunk/fs/ecryptfs/main.c @@ -585,8 +585,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name) * with as much information as it can before needing * the lower filesystem. * ecryptfs_read_super(): this accesses the lower filesystem and uses - * ecryptfs_interpose to perform most of the linking - * ecryptfs_interpose(): links the lower filesystem into ecryptfs (inode.c) + * ecryptfs_interpolate to perform most of the linking + * ecryptfs_interpolate(): links the lower filesystem into ecryptfs */ static int ecryptfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *raw_data, diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index 09469971472f..9d7febde10a1 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) #include #define ACPI_PREEMPTION_POINT() \ do { \ - if (!in_atomic_preempt_off() && !irqs_disabled()) \ + if (!in_atomic_preempt_off()) \ cond_resched(); \ } while (0) diff --git a/trunk/include/linux/acpi.h b/trunk/include/linux/acpi.h index b926afe8c03e..36924255c0d5 100644 --- a/trunk/include/linux/acpi.h +++ b/trunk/include/linux/acpi.h @@ -80,7 +80,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void); int acpi_boot_init (void); -void acpi_boot_table_init (void); +int acpi_boot_table_init (void); int acpi_mps_check (void); int acpi_numa_init (void); @@ -321,9 +321,9 @@ static inline int acpi_boot_init(void) return 0; } -static inline void acpi_boot_table_init(void) +static inline int acpi_boot_table_init(void) { - return; + return 0; } static inline int acpi_mps_check(void) diff --git a/trunk/include/linux/blkdev.h b/trunk/include/linux/blkdev.h index 5c8018977efa..9b98173a8184 100644 --- a/trunk/include/linux/blkdev.h +++ b/trunk/include/linux/blkdev.h @@ -938,8 +938,6 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); extern void blk_set_default_limits(struct queue_limits *lim); extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, sector_t offset); -extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, - sector_t offset); extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, sector_t offset); extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); @@ -1150,11 +1148,8 @@ static inline int queue_discard_alignment(struct request_queue *q) static inline int queue_sector_discard_alignment(struct request_queue *q, sector_t sector) { - struct queue_limits *lim = &q->limits; - unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1); - - return (lim->discard_granularity + lim->discard_alignment - alignment) - & (lim->discard_granularity - 1); + return ((sector << 9) - q->limits.discard_alignment) + & (q->limits.discard_granularity - 1); } static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) diff --git a/trunk/include/linux/drbd.h b/trunk/include/linux/drbd.h index 78962272338a..e84f4733cb55 100644 --- a/trunk/include/linux/drbd.h +++ b/trunk/include/linux/drbd.h @@ -53,7 +53,7 @@ extern const char *drbd_buildtag(void); -#define REL_VERSION "8.3.7" +#define REL_VERSION "8.3.6" #define API_VERSION 88 #define PRO_VERSION_MIN 86 #define PRO_VERSION_MAX 91 diff --git a/trunk/include/linux/drbd_nl.h b/trunk/include/linux/drbd_nl.h index a4d82f895994..db5721ad50d1 100644 --- a/trunk/include/linux/drbd_nl.h +++ b/trunk/include/linux/drbd_nl.h @@ -69,7 +69,6 @@ NL_PACKET(disconnect, 6, ) NL_PACKET(resize, 7, NL_INT64( 29, T_MAY_IGNORE, resize_size) - NL_BIT( 68, T_MAY_IGNORE, resize_force) ) NL_PACKET(syncer_conf, 8, diff --git a/trunk/include/linux/genhd.h b/trunk/include/linux/genhd.h index 9717081c75ad..c6c0c41af35f 100644 --- a/trunk/include/linux/genhd.h +++ b/trunk/include/linux/genhd.h @@ -256,9 +256,9 @@ extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, #define part_stat_read(part, field) \ ({ \ typeof((part)->dkstats->field) res = 0; \ - unsigned int _cpu; \ - for_each_possible_cpu(_cpu) \ - res += per_cpu_ptr((part)->dkstats, _cpu)->field; \ + int i; \ + for_each_possible_cpu(i) \ + res += per_cpu_ptr((part)->dkstats, i)->field; \ res; \ }) diff --git a/trunk/include/linux/iocontext.h b/trunk/include/linux/iocontext.h index 78ef023227d4..a63235996309 100644 --- a/trunk/include/linux/iocontext.h +++ b/trunk/include/linux/iocontext.h @@ -4,6 +4,32 @@ #include #include +/* + * This is the per-process anticipatory I/O scheduler state. + */ +struct as_io_context { + spinlock_t lock; + + void (*dtor)(struct as_io_context *aic); /* destructor */ + void (*exit)(struct as_io_context *aic); /* called on task exit */ + + unsigned long state; + atomic_t nr_queued; /* queued reads & sync writes */ + atomic_t nr_dispatched; /* number of requests gone to the drivers */ + + /* IO History tracking */ + /* Thinktime */ + unsigned long last_end_request; + unsigned long ttime_total; + unsigned long ttime_samples; + unsigned long ttime_mean; + /* Layout pattern */ + unsigned int seek_samples; + sector_t last_request_pos; + u64 seek_total; + sector_t seek_mean; +}; + struct cfq_queue; struct cfq_io_context { void *key; @@ -52,6 +78,7 @@ struct io_context { unsigned long last_waited; /* Time last woken after wait for request */ int nr_batch_requests; /* Number of requests left in the batch */ + struct as_io_context *aic; struct radix_tree_root radix_root; struct hlist_head cic_list; void *ioc_data; diff --git a/trunk/mm/vmalloc.c b/trunk/mm/vmalloc.c index d55d905463eb..37e69295f250 100644 --- a/trunk/mm/vmalloc.c +++ b/trunk/mm/vmalloc.c @@ -555,8 +555,10 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, } rcu_read_unlock(); - if (nr) + if (nr) { + BUG_ON(nr > atomic_read(&vmap_lazy_nr)); atomic_sub(nr, &vmap_lazy_nr); + } if (nr || force_flush) flush_tlb_kernel_range(*start, *end);