diff options
42 files changed, 329 insertions, 437 deletions
diff --git a/arch/arm/include/asm/cnt32_to_63.h b/arch/arm/include/asm/cnt32_to_63.h deleted file mode 100644 index 480c873fa746..000000000000 --- a/arch/arm/include/asm/cnt32_to_63.h +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits | ||
| 3 | * | ||
| 4 | * Author: Nicolas Pitre | ||
| 5 | * Created: December 3, 2006 | ||
| 6 | * Copyright: MontaVista Software, Inc. | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 | ||
| 10 | * as published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __INCLUDE_CNT32_TO_63_H__ | ||
| 14 | #define __INCLUDE_CNT32_TO_63_H__ | ||
| 15 | |||
| 16 | #include <linux/compiler.h> | ||
| 17 | #include <asm/types.h> | ||
| 18 | #include <asm/byteorder.h> | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Prototype: u64 cnt32_to_63(u32 cnt) | ||
| 22 | * Many hardware clock counters are only 32 bits wide and therefore have | ||
| 23 | * a relatively short period making wrap-arounds rather frequent. This | ||
| 24 | * is a problem when implementing sched_clock() for example, where a 64-bit | ||
| 25 | * non-wrapping monotonic value is expected to be returned. | ||
| 26 | * | ||
| 27 | * To overcome that limitation, let's extend a 32-bit counter to 63 bits | ||
| 28 | * in a completely lock free fashion. Bits 0 to 31 of the clock are provided | ||
| 29 | * by the hardware while bits 32 to 62 are stored in memory. The top bit in | ||
| 30 | * memory is used to synchronize with the hardware clock half-period. When | ||
| 31 | * the top bit of both counters (hardware and in memory) differ then the | ||
| 32 | * memory is updated with a new value, incrementing it when the hardware | ||
| 33 | * counter wraps around. | ||
| 34 | * | ||
| 35 | * Because a word store in memory is atomic then the incremented value will | ||
| 36 | * always be in synch with the top bit indicating to any potential concurrent | ||
| 37 | * reader if the value in memory is up to date or not with regards to the | ||
| 38 | * needed increment. And any race in updating the value in memory is harmless | ||
| 39 | * as the same value would simply be stored more than once. | ||
| 40 | * | ||
| 41 | * The only restriction for the algorithm to work properly is that this | ||
| 42 | * code must be executed at least once per each half period of the 32-bit | ||
| 43 | * counter to properly update the state bit in memory. This is usually not a | ||
| 44 | * problem in practice, but if it is then a kernel timer could be scheduled | ||
| 45 | * to manage for this code to be executed often enough. | ||
| 46 | * | ||
| 47 | * Note that the top bit (bit 63) in the returned value should be considered | ||
| 48 | * as garbage. It is not cleared here because callers are likely to use a | ||
| 49 | * multiplier on the returned value which can get rid of the top bit | ||
| 50 | * implicitly by making the multiplier even, therefore saving on a runtime | ||
| 51 | * clear-bit instruction. Otherwise caller must remember to clear the top | ||
| 52 | * bit explicitly. | ||
| 53 | */ | ||
| 54 | |||
| 55 | /* this is used only to give gcc a clue about good code generation */ | ||
| 56 | typedef union { | ||
| 57 | struct { | ||
| 58 | #if defined(__LITTLE_ENDIAN) | ||
| 59 | u32 lo, hi; | ||
| 60 | #elif defined(__BIG_ENDIAN) | ||
| 61 | u32 hi, lo; | ||
| 62 | #endif | ||
| 63 | }; | ||
| 64 | u64 val; | ||
| 65 | } cnt32_to_63_t; | ||
| 66 | |||
| 67 | #define cnt32_to_63(cnt_lo) \ | ||
| 68 | ({ \ | ||
| 69 | static volatile u32 __m_cnt_hi = 0; \ | ||
| 70 | cnt32_to_63_t __x; \ | ||
| 71 | __x.hi = __m_cnt_hi; \ | ||
| 72 | __x.lo = (cnt_lo); \ | ||
| 73 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ | ||
| 74 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ | ||
| 75 | __x.val; \ | ||
| 76 | }) | ||
| 77 | |||
| 78 | #endif | ||
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index aaffaecffcd1..ba8ccfede964 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c | |||
| @@ -111,8 +111,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, | |||
| 111 | case 'D': | 111 | case 'D': |
| 112 | case 'k': | 112 | case 'k': |
| 113 | case 'c': | 113 | case 'c': |
| 114 | kgdb_contthread = NULL; | ||
| 115 | |||
| 116 | /* | 114 | /* |
| 117 | * Try to read optional parameter, pc unchanged if no parm. | 115 | * Try to read optional parameter, pc unchanged if no parm. |
| 118 | * If this was a compiled breakpoint, we need to move | 116 | * If this was a compiled breakpoint, we need to move |
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index a5f864c445b2..f57113f1f892 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
| @@ -216,10 +216,6 @@ config MEMORY_SIZE | |||
| 216 | default "01000000" if PLAT_M32104UT | 216 | default "01000000" if PLAT_M32104UT |
| 217 | default "00800000" if PLAT_OAKS32R | 217 | default "00800000" if PLAT_OAKS32R |
| 218 | 218 | ||
| 219 | config NOHIGHMEM | ||
| 220 | bool | ||
| 221 | default y | ||
| 222 | |||
| 223 | config ARCH_DISCONTIGMEM_ENABLE | 219 | config ARCH_DISCONTIGMEM_ENABLE |
| 224 | bool "Internal RAM Support" | 220 | bool "Internal RAM Support" |
| 225 | depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104 | 221 | depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104 |
| @@ -410,11 +406,7 @@ config PCI_DIRECT | |||
| 410 | source "drivers/pci/Kconfig" | 406 | source "drivers/pci/Kconfig" |
| 411 | 407 | ||
| 412 | config ISA | 408 | config ISA |
| 413 | bool "ISA support" | 409 | bool |
| 414 | help | ||
| 415 | Find out whether you have ISA slots on your motherboard. ISA is the | ||
| 416 | name of a bus system, i.e. the way the CPU talks to the other stuff | ||
| 417 | inside your box. If you have ISA, say Y, otherwise N. | ||
| 418 | 410 | ||
| 419 | source "drivers/pcmcia/Kconfig" | 411 | source "drivers/pcmcia/Kconfig" |
| 420 | 412 | ||
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S index d4eaa2fd1818..612d35b082a6 100644 --- a/arch/m32r/kernel/entry.S +++ b/arch/m32r/kernel/entry.S | |||
| @@ -143,7 +143,7 @@ ret_from_intr: | |||
| 143 | and3 r4, r4, #0x8000 ; check BSM bit | 143 | and3 r4, r4, #0x8000 ; check BSM bit |
| 144 | #endif | 144 | #endif |
| 145 | beqz r4, resume_kernel | 145 | beqz r4, resume_kernel |
| 146 | ENTRY(resume_userspace) | 146 | resume_userspace: |
| 147 | DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt | 147 | DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt |
| 148 | ; setting need_resched or sigpending | 148 | ; setting need_resched or sigpending |
| 149 | ; between sampling and the iret | 149 | ; between sampling and the iret |
diff --git a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S index dab7436d7bbe..40180778a5c7 100644 --- a/arch/m32r/kernel/head.S +++ b/arch/m32r/kernel/head.S | |||
| @@ -29,7 +29,6 @@ __INITDATA | |||
| 29 | .global _end | 29 | .global _end |
| 30 | ENTRY(stext) | 30 | ENTRY(stext) |
| 31 | ENTRY(_stext) | 31 | ENTRY(_stext) |
| 32 | ENTRY(startup_32) | ||
| 33 | /* Setup up the stack pointer */ | 32 | /* Setup up the stack pointer */ |
| 34 | LDIMM (r0, spi_stack_top) | 33 | LDIMM (r0, spi_stack_top) |
| 35 | LDIMM (r1, spu_stack_top) | 34 | LDIMM (r1, spu_stack_top) |
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c index d0c5b0b7da2f..2aeae4670098 100644 --- a/arch/m32r/kernel/irq.c +++ b/arch/m32r/kernel/irq.c | |||
| @@ -22,9 +22,6 @@ | |||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 24 | 24 | ||
| 25 | atomic_t irq_err_count; | ||
| 26 | atomic_t irq_mis_count; | ||
| 27 | |||
| 28 | /* | 25 | /* |
| 29 | * Generic, controller-independent functions: | 26 | * Generic, controller-independent functions: |
| 30 | */ | 27 | */ |
| @@ -63,9 +60,6 @@ int show_interrupts(struct seq_file *p, void *v) | |||
| 63 | seq_putc(p, '\n'); | 60 | seq_putc(p, '\n'); |
| 64 | skip: | 61 | skip: |
| 65 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 62 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
| 66 | } else if (i == NR_IRQS) { | ||
| 67 | seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); | ||
| 68 | seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); | ||
| 69 | } | 63 | } |
| 70 | return 0; | 64 | return 0; |
| 71 | } | 65 | } |
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c index 16bcb189a383..22624b51d4d3 100644 --- a/arch/m32r/kernel/m32r_ksyms.c +++ b/arch/m32r/kernel/m32r_ksyms.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <asm/delay.h> | 14 | #include <asm/delay.h> |
| 15 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
| 16 | #include <asm/tlbflush.h> | 16 | #include <asm/tlbflush.h> |
| 17 | #include <asm/pgtable.h> | ||
| 17 | 18 | ||
| 18 | /* platform dependent support */ | 19 | /* platform dependent support */ |
| 19 | EXPORT_SYMBOL(boot_cpu_data); | 20 | EXPORT_SYMBOL(boot_cpu_data); |
| @@ -65,6 +66,7 @@ EXPORT_SYMBOL(memset); | |||
| 65 | EXPORT_SYMBOL(copy_page); | 66 | EXPORT_SYMBOL(copy_page); |
| 66 | EXPORT_SYMBOL(clear_page); | 67 | EXPORT_SYMBOL(clear_page); |
| 67 | EXPORT_SYMBOL(strlen); | 68 | EXPORT_SYMBOL(strlen); |
| 69 | EXPORT_SYMBOL(empty_zero_page); | ||
| 68 | 70 | ||
| 69 | EXPORT_SYMBOL(_inb); | 71 | EXPORT_SYMBOL(_inb); |
| 70 | EXPORT_SYMBOL(_inw); | 72 | EXPORT_SYMBOL(_inw); |
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index a689e2978b6e..5be4faaf5b1c 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c | |||
| @@ -35,8 +35,6 @@ | |||
| 35 | 35 | ||
| 36 | #include <linux/err.h> | 36 | #include <linux/err.h> |
| 37 | 37 | ||
| 38 | static int hlt_counter=0; | ||
| 39 | |||
| 40 | /* | 38 | /* |
| 41 | * Return saved PC of a blocked thread. | 39 | * Return saved PC of a blocked thread. |
| 42 | */ | 40 | */ |
| @@ -48,31 +46,16 @@ unsigned long thread_saved_pc(struct task_struct *tsk) | |||
| 48 | /* | 46 | /* |
| 49 | * Powermanagement idle function, if any.. | 47 | * Powermanagement idle function, if any.. |
| 50 | */ | 48 | */ |
| 51 | void (*pm_idle)(void) = NULL; | 49 | static void (*pm_idle)(void) = NULL; |
| 52 | EXPORT_SYMBOL(pm_idle); | ||
| 53 | 50 | ||
| 54 | void (*pm_power_off)(void) = NULL; | 51 | void (*pm_power_off)(void) = NULL; |
| 55 | EXPORT_SYMBOL(pm_power_off); | 52 | EXPORT_SYMBOL(pm_power_off); |
| 56 | 53 | ||
| 57 | void disable_hlt(void) | ||
| 58 | { | ||
| 59 | hlt_counter++; | ||
| 60 | } | ||
| 61 | |||
| 62 | EXPORT_SYMBOL(disable_hlt); | ||
| 63 | |||
| 64 | void enable_hlt(void) | ||
| 65 | { | ||
| 66 | hlt_counter--; | ||
| 67 | } | ||
| 68 | |||
| 69 | EXPORT_SYMBOL(enable_hlt); | ||
| 70 | |||
| 71 | /* | 54 | /* |
| 72 | * We use this is we don't have any better | 55 | * We use this is we don't have any better |
| 73 | * idle routine.. | 56 | * idle routine.. |
| 74 | */ | 57 | */ |
| 75 | void default_idle(void) | 58 | static void default_idle(void) |
| 76 | { | 59 | { |
| 77 | /* M32R_FIXME: Please use "cpu_sleep" mode. */ | 60 | /* M32R_FIXME: Please use "cpu_sleep" mode. */ |
| 78 | cpu_relax(); | 61 | cpu_relax(); |
| @@ -260,15 +243,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, | |||
| 260 | return 0; | 243 | return 0; |
| 261 | } | 244 | } |
| 262 | 245 | ||
| 263 | /* | ||
| 264 | * Capture the user space registers if the task is not running (in user space) | ||
| 265 | */ | ||
| 266 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | ||
| 267 | { | ||
| 268 | /* M32R_FIXME */ | ||
| 269 | return 1; | ||
| 270 | } | ||
| 271 | |||
| 272 | asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, | 246 | asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, |
| 273 | unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, | 247 | unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, |
| 274 | struct pt_regs regs) | 248 | struct pt_regs regs) |
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 7577f971ea4e..929e5c9d3ad9 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c | |||
| @@ -84,7 +84,7 @@ void smp_send_timer(void); | |||
| 84 | void smp_ipi_timer_interrupt(struct pt_regs *); | 84 | void smp_ipi_timer_interrupt(struct pt_regs *); |
| 85 | void smp_local_timer_interrupt(void); | 85 | void smp_local_timer_interrupt(void); |
| 86 | 86 | ||
| 87 | void send_IPI_allbutself(int, int); | 87 | static void send_IPI_allbutself(int, int); |
| 88 | static void send_IPI_mask(cpumask_t, int, int); | 88 | static void send_IPI_mask(cpumask_t, int, int); |
| 89 | unsigned long send_IPI_mask_phys(cpumask_t, int, int); | 89 | unsigned long send_IPI_mask_phys(cpumask_t, int, int); |
| 90 | 90 | ||
| @@ -722,7 +722,7 @@ void smp_local_timer_interrupt(void) | |||
| 722 | * ---------- --- -------------------------------------------------------- | 722 | * ---------- --- -------------------------------------------------------- |
| 723 | * | 723 | * |
| 724 | *==========================================================================*/ | 724 | *==========================================================================*/ |
| 725 | void send_IPI_allbutself(int ipi_num, int try) | 725 | static void send_IPI_allbutself(int ipi_num, int try) |
| 726 | { | 726 | { |
| 727 | cpumask_t cpumask; | 727 | cpumask_t cpumask; |
| 728 | 728 | ||
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index 994cc1556355..6ea017727cce 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | #include <asm/hw_irq.h> | 34 | #include <asm/hw_irq.h> |
| 35 | 35 | ||
| 36 | #ifdef CONFIG_SMP | 36 | #ifdef CONFIG_SMP |
| 37 | extern void send_IPI_allbutself(int, int); | ||
| 38 | extern void smp_local_timer_interrupt(void); | 37 | extern void smp_local_timer_interrupt(void); |
| 39 | #endif | 38 | #endif |
| 40 | 39 | ||
| @@ -188,7 +187,7 @@ static long last_rtc_update = 0; | |||
| 188 | * timer_interrupt() needs to keep up the real-time clock, | 187 | * timer_interrupt() needs to keep up the real-time clock, |
| 189 | * as well as call the "do_timer()" routine every clocktick | 188 | * as well as call the "do_timer()" routine every clocktick |
| 190 | */ | 189 | */ |
| 191 | irqreturn_t timer_interrupt(int irq, void *dev_id) | 190 | static irqreturn_t timer_interrupt(int irq, void *dev_id) |
| 192 | { | 191 | { |
| 193 | #ifndef CONFIG_SMP | 192 | #ifndef CONFIG_SMP |
| 194 | profile_tick(CPU_PROFILING); | 193 | profile_tick(CPU_PROFILING); |
| @@ -228,7 +227,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
| 228 | return IRQ_HANDLED; | 227 | return IRQ_HANDLED; |
| 229 | } | 228 | } |
| 230 | 229 | ||
| 231 | struct irqaction irq0 = { | 230 | static struct irqaction irq0 = { |
| 232 | .handler = timer_interrupt, | 231 | .handler = timer_interrupt, |
| 233 | .flags = IRQF_DISABLED, | 232 | .flags = IRQF_DISABLED, |
| 234 | .mask = CPU_MASK_NONE, | 233 | .mask = CPU_MASK_NONE, |
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c index 46159a4e644b..03b14e55cd89 100644 --- a/arch/m32r/kernel/traps.c +++ b/arch/m32r/kernel/traps.c | |||
| @@ -61,7 +61,7 @@ extern unsigned long eit_vector[]; | |||
| 61 | ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ | 61 | ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ |
| 62 | + 0xff000000UL | 62 | + 0xff000000UL |
| 63 | 63 | ||
| 64 | void set_eit_vector_entries(void) | 64 | static void set_eit_vector_entries(void) |
| 65 | { | 65 | { |
| 66 | extern void default_eit_handler(void); | 66 | extern void default_eit_handler(void); |
| 67 | extern void system_call(void); | 67 | extern void system_call(void); |
| @@ -121,9 +121,9 @@ void __init trap_init(void) | |||
| 121 | cpu_init(); | 121 | cpu_init(); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | int kstack_depth_to_print = 24; | 124 | static int kstack_depth_to_print = 24; |
| 125 | 125 | ||
| 126 | void show_trace(struct task_struct *task, unsigned long *stack) | 126 | static void show_trace(struct task_struct *task, unsigned long *stack) |
| 127 | { | 127 | { |
| 128 | unsigned long addr; | 128 | unsigned long addr; |
| 129 | 129 | ||
| @@ -224,7 +224,7 @@ bad: | |||
| 224 | printk("\n"); | 224 | printk("\n"); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | DEFINE_SPINLOCK(die_lock); | 227 | static DEFINE_SPINLOCK(die_lock); |
| 228 | 228 | ||
| 229 | void die(const char * str, struct pt_regs * regs, long err) | 229 | void die(const char * str, struct pt_regs * regs, long err) |
| 230 | { | 230 | { |
diff --git a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c index 59bfc34e0d9f..ced549be80f5 100644 --- a/arch/m32r/lib/delay.c +++ b/arch/m32r/lib/delay.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <linux/param.h> | 8 | #include <linux/param.h> |
| 9 | #include <linux/module.h> | ||
| 9 | #ifdef CONFIG_SMP | 10 | #ifdef CONFIG_SMP |
| 10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| 11 | #include <asm/current.h> | 12 | #include <asm/current.h> |
| @@ -121,3 +122,4 @@ void __ndelay(unsigned long nsecs) | |||
| 121 | { | 122 | { |
| 122 | __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ | 123 | __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ |
| 123 | } | 124 | } |
| 125 | EXPORT_SYMBOL(__ndelay); | ||
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c index 1f058434b726..e660ddd611c4 100644 --- a/arch/mips/au1000/common/gpio.c +++ b/arch/mips/au1000/common/gpio.c | |||
| @@ -48,7 +48,7 @@ static void au1xxx_gpio2_write(unsigned gpio, int value) | |||
| 48 | { | 48 | { |
| 49 | gpio -= AU1XXX_GPIO_BASE; | 49 | gpio -= AU1XXX_GPIO_BASE; |
| 50 | 50 | ||
| 51 | gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio); | 51 | gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | static int au1xxx_gpio2_direction_input(unsigned gpio) | 54 | static int au1xxx_gpio2_direction_input(unsigned gpio) |
| @@ -62,7 +62,7 @@ static int au1xxx_gpio2_direction_output(unsigned gpio, int value) | |||
| 62 | { | 62 | { |
| 63 | gpio -= AU1XXX_GPIO_BASE; | 63 | gpio -= AU1XXX_GPIO_BASE; |
| 64 | gpio2->dir |= 0x01 << gpio; | 64 | gpio2->dir |= 0x01 << gpio; |
| 65 | gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio); | 65 | gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio); |
| 66 | return 0; | 66 | return 0; |
| 67 | } | 67 | } |
| 68 | 68 | ||
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c index 8f6d58ede33c..6e152c80cd4a 100644 --- a/arch/mips/kernel/kgdb.c +++ b/arch/mips/kernel/kgdb.c | |||
| @@ -236,8 +236,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
| 236 | 236 | ||
| 237 | atomic_set(&kgdb_cpu_doing_single_step, -1); | 237 | atomic_set(&kgdb_cpu_doing_single_step, -1); |
| 238 | if (remcom_in_buffer[0] == 's') | 238 | if (remcom_in_buffer[0] == 's') |
| 239 | if (kgdb_contthread) | 239 | atomic_set(&kgdb_cpu_doing_single_step, cpu); |
| 240 | atomic_set(&kgdb_cpu_doing_single_step, cpu); | ||
| 241 | 240 | ||
| 242 | return 0; | 241 | return 0; |
| 243 | } | 242 | } |
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile index 15e01aec37fd..c8c32f417b6c 100644 --- a/arch/mips/pci/Makefile +++ b/arch/mips/pci/Makefile | |||
| @@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o | |||
| 15 | obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o | 15 | obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o |
| 16 | obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o | 16 | obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o |
| 17 | obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o | 17 | obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o |
| 18 | obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o | ||
| 18 | 19 | ||
| 19 | # | 20 | # |
| 20 | # These are still pretty much in the old state, watch, go blind. | 21 | # These are still pretty much in the old state, watch, go blind. |
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c new file mode 100644 index 000000000000..bea9b6cdfdbf --- /dev/null +++ b/arch/mips/pci/pci-bcm47xx.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License as published by the | ||
| 6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 7 | * option) any later version. | ||
| 8 | * | ||
| 9 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
| 10 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
| 12 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 13 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 14 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
| 15 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
| 16 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 17 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 18 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 19 | * | ||
| 20 | * You should have received a copy of the GNU General Public License along | ||
| 21 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 22 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include <linux/types.h> | ||
| 26 | #include <linux/pci.h> | ||
| 27 | #include <linux/ssb/ssb.h> | ||
| 28 | |||
| 29 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
| 30 | { | ||
| 31 | return 0; | ||
| 32 | } | ||
| 33 | |||
| 34 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
| 35 | { | ||
| 36 | int res; | ||
| 37 | u8 slot, pin; | ||
| 38 | |||
| 39 | res = ssb_pcibios_plat_dev_init(dev); | ||
| 40 | if (res < 0) { | ||
| 41 | printk(KERN_ALERT "PCI: Failed to init device %s\n", | ||
| 42 | pci_name(dev)); | ||
| 43 | return res; | ||
| 44 | } | ||
| 45 | |||
| 46 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | ||
| 47 | slot = PCI_SLOT(dev->devfn); | ||
| 48 | res = ssb_pcibios_map_irq(dev, slot, pin); | ||
| 49 | |||
| 50 | /* IRQ-0 and IRQ-1 are software interrupts. */ | ||
| 51 | if (res < 2) { | ||
| 52 | printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n", | ||
| 53 | pci_name(dev)); | ||
| 54 | return res; | ||
| 55 | } | ||
| 56 | |||
| 57 | dev->irq = res; | ||
| 58 | return 0; | ||
| 59 | } | ||
| 60 | |||
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c index bd78368c82bf..f97ab1461012 100644 --- a/arch/mips/pci/pci-ip27.c +++ b/arch/mips/pci/pci-ip27.c | |||
| @@ -143,25 +143,47 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid) | |||
| 143 | */ | 143 | */ |
| 144 | int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 144 | int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| 145 | { | 145 | { |
| 146 | return 0; | ||
| 147 | } | ||
| 148 | |||
| 149 | /* Most MIPS systems have straight-forward swizzling needs. */ | ||
| 150 | static inline u8 bridge_swizzle(u8 pin, u8 slot) | ||
| 151 | { | ||
| 152 | return (((pin - 1) + slot) % 4) + 1; | ||
| 153 | } | ||
| 154 | |||
| 155 | static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev) | ||
| 156 | { | ||
| 157 | while (dev->bus->parent) { | ||
| 158 | /* Move up the chain of bridges. */ | ||
| 159 | dev = dev->bus->self; | ||
| 160 | } | ||
| 161 | |||
| 162 | return dev; | ||
| 163 | } | ||
| 164 | |||
| 165 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
| 166 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
| 167 | { | ||
| 146 | struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); | 168 | struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); |
| 147 | int irq = bc->pci_int[slot]; | 169 | struct pci_dev *rdev = bridge_root_dev(dev); |
| 170 | int slot = PCI_SLOT(rdev->devfn); | ||
| 171 | int irq; | ||
| 148 | 172 | ||
| 173 | irq = bc->pci_int[slot]; | ||
| 149 | if (irq == -1) { | 174 | if (irq == -1) { |
| 150 | irq = bc->pci_int[slot] = request_bridge_irq(bc); | 175 | irq = request_bridge_irq(bc); |
| 151 | if (irq < 0) | 176 | if (irq < 0) |
| 152 | panic("Can't allocate interrupt for PCI device %s\n", | 177 | return irq; |
| 153 | pci_name(dev)); | 178 | |
| 179 | bc->pci_int[slot] = irq; | ||
| 154 | } | 180 | } |
| 155 | 181 | ||
| 156 | irq_to_bridge[irq] = bc; | 182 | irq_to_bridge[irq] = bc; |
| 157 | irq_to_slot[irq] = slot; | 183 | irq_to_slot[irq] = slot; |
| 158 | 184 | ||
| 159 | return irq; | 185 | dev->irq = irq; |
| 160 | } | ||
| 161 | 186 | ||
| 162 | /* Do platform specific device initialization at pci_enable_device() time */ | ||
| 163 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
| 164 | { | ||
| 165 | return 0; | 187 | return 0; |
| 166 | } | 188 | } |
| 167 | 189 | ||
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index b4fdf2f2743c..fe8f71dd0b3f 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c | |||
| @@ -347,9 +347,8 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
| 347 | linux_regs->msr |= MSR_SE; | 347 | linux_regs->msr |= MSR_SE; |
| 348 | #endif | 348 | #endif |
| 349 | kgdb_single_step = 1; | 349 | kgdb_single_step = 1; |
| 350 | if (kgdb_contthread) | 350 | atomic_set(&kgdb_cpu_doing_single_step, |
| 351 | atomic_set(&kgdb_cpu_doing_single_step, | 351 | raw_smp_processor_id()); |
| 352 | raw_smp_processor_id()); | ||
| 353 | } | 352 | } |
| 354 | return 0; | 353 | return 0; |
| 355 | } | 354 | } |
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index f47f0eb886b8..8282a2139681 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
| @@ -69,6 +69,9 @@ static int gdb_x86vector = -1; | |||
| 69 | */ | 69 | */ |
| 70 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | 70 | void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) |
| 71 | { | 71 | { |
| 72 | #ifndef CONFIG_X86_32 | ||
| 73 | u32 *gdb_regs32 = (u32 *)gdb_regs; | ||
| 74 | #endif | ||
| 72 | gdb_regs[GDB_AX] = regs->ax; | 75 | gdb_regs[GDB_AX] = regs->ax; |
| 73 | gdb_regs[GDB_BX] = regs->bx; | 76 | gdb_regs[GDB_BX] = regs->bx; |
| 74 | gdb_regs[GDB_CX] = regs->cx; | 77 | gdb_regs[GDB_CX] = regs->cx; |
| @@ -76,9 +79,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 76 | gdb_regs[GDB_SI] = regs->si; | 79 | gdb_regs[GDB_SI] = regs->si; |
| 77 | gdb_regs[GDB_DI] = regs->di; | 80 | gdb_regs[GDB_DI] = regs->di; |
| 78 | gdb_regs[GDB_BP] = regs->bp; | 81 | gdb_regs[GDB_BP] = regs->bp; |
| 79 | gdb_regs[GDB_PS] = regs->flags; | ||
| 80 | gdb_regs[GDB_PC] = regs->ip; | 82 | gdb_regs[GDB_PC] = regs->ip; |
| 81 | #ifdef CONFIG_X86_32 | 83 | #ifdef CONFIG_X86_32 |
| 84 | gdb_regs[GDB_PS] = regs->flags; | ||
| 82 | gdb_regs[GDB_DS] = regs->ds; | 85 | gdb_regs[GDB_DS] = regs->ds; |
| 83 | gdb_regs[GDB_ES] = regs->es; | 86 | gdb_regs[GDB_ES] = regs->es; |
| 84 | gdb_regs[GDB_CS] = regs->cs; | 87 | gdb_regs[GDB_CS] = regs->cs; |
| @@ -94,6 +97,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 94 | gdb_regs[GDB_R13] = regs->r13; | 97 | gdb_regs[GDB_R13] = regs->r13; |
| 95 | gdb_regs[GDB_R14] = regs->r14; | 98 | gdb_regs[GDB_R14] = regs->r14; |
| 96 | gdb_regs[GDB_R15] = regs->r15; | 99 | gdb_regs[GDB_R15] = regs->r15; |
| 100 | gdb_regs32[GDB_PS] = regs->flags; | ||
| 101 | gdb_regs32[GDB_CS] = regs->cs; | ||
| 102 | gdb_regs32[GDB_SS] = regs->ss; | ||
| 97 | #endif | 103 | #endif |
| 98 | gdb_regs[GDB_SP] = regs->sp; | 104 | gdb_regs[GDB_SP] = regs->sp; |
| 99 | } | 105 | } |
| @@ -112,6 +118,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 112 | */ | 118 | */ |
| 113 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | 119 | void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) |
| 114 | { | 120 | { |
| 121 | #ifndef CONFIG_X86_32 | ||
| 122 | u32 *gdb_regs32 = (u32 *)gdb_regs; | ||
| 123 | #endif | ||
| 115 | gdb_regs[GDB_AX] = 0; | 124 | gdb_regs[GDB_AX] = 0; |
| 116 | gdb_regs[GDB_BX] = 0; | 125 | gdb_regs[GDB_BX] = 0; |
| 117 | gdb_regs[GDB_CX] = 0; | 126 | gdb_regs[GDB_CX] = 0; |
| @@ -129,8 +138,10 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | |||
| 129 | gdb_regs[GDB_FS] = 0xFFFF; | 138 | gdb_regs[GDB_FS] = 0xFFFF; |
| 130 | gdb_regs[GDB_GS] = 0xFFFF; | 139 | gdb_regs[GDB_GS] = 0xFFFF; |
| 131 | #else | 140 | #else |
| 132 | gdb_regs[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); | 141 | gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); |
| 133 | gdb_regs[GDB_PC] = 0; | 142 | gdb_regs32[GDB_CS] = __KERNEL_CS; |
| 143 | gdb_regs32[GDB_SS] = __KERNEL_DS; | ||
| 144 | gdb_regs[GDB_PC] = p->thread.ip; | ||
| 134 | gdb_regs[GDB_R8] = 0; | 145 | gdb_regs[GDB_R8] = 0; |
| 135 | gdb_regs[GDB_R9] = 0; | 146 | gdb_regs[GDB_R9] = 0; |
| 136 | gdb_regs[GDB_R10] = 0; | 147 | gdb_regs[GDB_R10] = 0; |
| @@ -153,6 +164,9 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) | |||
| 153 | */ | 164 | */ |
| 154 | void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | 165 | void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) |
| 155 | { | 166 | { |
| 167 | #ifndef CONFIG_X86_32 | ||
| 168 | u32 *gdb_regs32 = (u32 *)gdb_regs; | ||
| 169 | #endif | ||
| 156 | regs->ax = gdb_regs[GDB_AX]; | 170 | regs->ax = gdb_regs[GDB_AX]; |
| 157 | regs->bx = gdb_regs[GDB_BX]; | 171 | regs->bx = gdb_regs[GDB_BX]; |
| 158 | regs->cx = gdb_regs[GDB_CX]; | 172 | regs->cx = gdb_regs[GDB_CX]; |
| @@ -160,9 +174,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 160 | regs->si = gdb_regs[GDB_SI]; | 174 | regs->si = gdb_regs[GDB_SI]; |
| 161 | regs->di = gdb_regs[GDB_DI]; | 175 | regs->di = gdb_regs[GDB_DI]; |
| 162 | regs->bp = gdb_regs[GDB_BP]; | 176 | regs->bp = gdb_regs[GDB_BP]; |
| 163 | regs->flags = gdb_regs[GDB_PS]; | ||
| 164 | regs->ip = gdb_regs[GDB_PC]; | 177 | regs->ip = gdb_regs[GDB_PC]; |
| 165 | #ifdef CONFIG_X86_32 | 178 | #ifdef CONFIG_X86_32 |
| 179 | regs->flags = gdb_regs[GDB_PS]; | ||
| 166 | regs->ds = gdb_regs[GDB_DS]; | 180 | regs->ds = gdb_regs[GDB_DS]; |
| 167 | regs->es = gdb_regs[GDB_ES]; | 181 | regs->es = gdb_regs[GDB_ES]; |
| 168 | regs->cs = gdb_regs[GDB_CS]; | 182 | regs->cs = gdb_regs[GDB_CS]; |
| @@ -175,6 +189,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) | |||
| 175 | regs->r13 = gdb_regs[GDB_R13]; | 189 | regs->r13 = gdb_regs[GDB_R13]; |
| 176 | regs->r14 = gdb_regs[GDB_R14]; | 190 | regs->r14 = gdb_regs[GDB_R14]; |
| 177 | regs->r15 = gdb_regs[GDB_R15]; | 191 | regs->r15 = gdb_regs[GDB_R15]; |
| 192 | regs->flags = gdb_regs32[GDB_PS]; | ||
| 193 | regs->cs = gdb_regs32[GDB_CS]; | ||
| 194 | regs->ss = gdb_regs32[GDB_SS]; | ||
| 178 | #endif | 195 | #endif |
| 179 | } | 196 | } |
| 180 | 197 | ||
| @@ -378,10 +395,8 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code, | |||
| 378 | if (remcomInBuffer[0] == 's') { | 395 | if (remcomInBuffer[0] == 's') { |
| 379 | linux_regs->flags |= X86_EFLAGS_TF; | 396 | linux_regs->flags |= X86_EFLAGS_TF; |
| 380 | kgdb_single_step = 1; | 397 | kgdb_single_step = 1; |
| 381 | if (kgdb_contthread) { | 398 | atomic_set(&kgdb_cpu_doing_single_step, |
| 382 | atomic_set(&kgdb_cpu_doing_single_step, | 399 | raw_smp_processor_id()); |
| 383 | raw_smp_processor_id()); | ||
| 384 | } | ||
| 385 | } | 400 | } |
| 386 | 401 | ||
| 387 | get_debugreg(dr6, 6); | 402 | get_debugreg(dr6, 6); |
| @@ -466,9 +481,15 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd) | |||
| 466 | 481 | ||
| 467 | case DIE_DEBUG: | 482 | case DIE_DEBUG: |
| 468 | if (atomic_read(&kgdb_cpu_doing_single_step) == | 483 | if (atomic_read(&kgdb_cpu_doing_single_step) == |
| 469 | raw_smp_processor_id() && | 484 | raw_smp_processor_id()) { |
| 470 | user_mode(regs)) | 485 | if (user_mode(regs)) |
| 471 | return single_step_cont(regs, args); | 486 | return single_step_cont(regs, args); |
| 487 | break; | ||
| 488 | } else if (test_thread_flag(TIF_SINGLESTEP)) | ||
| 489 | /* This means a user thread is single stepping | ||
| 490 | * a system call which should be ignored | ||
| 491 | */ | ||
| 492 | return NOTIFY_DONE; | ||
| 472 | /* fall through */ | 493 | /* fall through */ |
| 473 | default: | 494 | default: |
| 474 | if (user_mode(regs)) | 495 | if (user_mode(regs)) |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 1e1f3f3757ae..14601dc05e41 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -309,6 +309,8 @@ static void nv_nf2_freeze(struct ata_port *ap); | |||
| 309 | static void nv_nf2_thaw(struct ata_port *ap); | 309 | static void nv_nf2_thaw(struct ata_port *ap); |
| 310 | static void nv_ck804_freeze(struct ata_port *ap); | 310 | static void nv_ck804_freeze(struct ata_port *ap); |
| 311 | static void nv_ck804_thaw(struct ata_port *ap); | 311 | static void nv_ck804_thaw(struct ata_port *ap); |
| 312 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
| 313 | unsigned long deadline); | ||
| 312 | static int nv_adma_slave_config(struct scsi_device *sdev); | 314 | static int nv_adma_slave_config(struct scsi_device *sdev); |
| 313 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); | 315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); |
| 314 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); | 316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); |
| @@ -403,28 +405,45 @@ static struct scsi_host_template nv_swncq_sht = { | |||
| 403 | .slave_configure = nv_swncq_slave_config, | 405 | .slave_configure = nv_swncq_slave_config, |
| 404 | }; | 406 | }; |
| 405 | 407 | ||
| 406 | static struct ata_port_operations nv_generic_ops = { | 408 | /* OSDL bz3352 reports that some nv controllers can't determine device |
| 409 | * signature reliably and nv_hardreset is implemented to work around | ||
| 410 | * the problem. This was reported on nf3 and it's unclear whether any | ||
| 411 | * other controllers are affected. However, the workaround has been | ||
| 412 | * applied to all variants and there isn't much to gain by trying to | ||
| 413 | * find out exactly which ones are affected at this point especially | ||
| 414 | * because NV has moved over to ahci for newer controllers. | ||
| 415 | */ | ||
| 416 | static struct ata_port_operations nv_common_ops = { | ||
| 407 | .inherits = &ata_bmdma_port_ops, | 417 | .inherits = &ata_bmdma_port_ops, |
| 408 | .hardreset = ATA_OP_NULL, | 418 | .hardreset = nv_hardreset, |
| 409 | .scr_read = nv_scr_read, | 419 | .scr_read = nv_scr_read, |
| 410 | .scr_write = nv_scr_write, | 420 | .scr_write = nv_scr_write, |
| 411 | }; | 421 | }; |
| 412 | 422 | ||
| 423 | /* OSDL bz11195 reports that link doesn't come online after hardreset | ||
| 424 | * on generic nv's and there have been several other similar reports | ||
| 425 | * on linux-ide. Disable hardreset for generic nv's. | ||
| 426 | */ | ||
| 427 | static struct ata_port_operations nv_generic_ops = { | ||
| 428 | .inherits = &nv_common_ops, | ||
| 429 | .hardreset = ATA_OP_NULL, | ||
| 430 | }; | ||
| 431 | |||
| 413 | static struct ata_port_operations nv_nf2_ops = { | 432 | static struct ata_port_operations nv_nf2_ops = { |
| 414 | .inherits = &nv_generic_ops, | 433 | .inherits = &nv_common_ops, |
| 415 | .freeze = nv_nf2_freeze, | 434 | .freeze = nv_nf2_freeze, |
| 416 | .thaw = nv_nf2_thaw, | 435 | .thaw = nv_nf2_thaw, |
| 417 | }; | 436 | }; |
| 418 | 437 | ||
| 419 | static struct ata_port_operations nv_ck804_ops = { | 438 | static struct ata_port_operations nv_ck804_ops = { |
| 420 | .inherits = &nv_generic_ops, | 439 | .inherits = &nv_common_ops, |
| 421 | .freeze = nv_ck804_freeze, | 440 | .freeze = nv_ck804_freeze, |
| 422 | .thaw = nv_ck804_thaw, | 441 | .thaw = nv_ck804_thaw, |
| 423 | .host_stop = nv_ck804_host_stop, | 442 | .host_stop = nv_ck804_host_stop, |
| 424 | }; | 443 | }; |
| 425 | 444 | ||
| 426 | static struct ata_port_operations nv_adma_ops = { | 445 | static struct ata_port_operations nv_adma_ops = { |
| 427 | .inherits = &nv_generic_ops, | 446 | .inherits = &nv_common_ops, |
| 428 | 447 | ||
| 429 | .check_atapi_dma = nv_adma_check_atapi_dma, | 448 | .check_atapi_dma = nv_adma_check_atapi_dma, |
| 430 | .sff_tf_read = nv_adma_tf_read, | 449 | .sff_tf_read = nv_adma_tf_read, |
| @@ -448,7 +467,7 @@ static struct ata_port_operations nv_adma_ops = { | |||
| 448 | }; | 467 | }; |
| 449 | 468 | ||
| 450 | static struct ata_port_operations nv_swncq_ops = { | 469 | static struct ata_port_operations nv_swncq_ops = { |
| 451 | .inherits = &nv_generic_ops, | 470 | .inherits = &nv_common_ops, |
| 452 | 471 | ||
| 453 | .qc_defer = ata_std_qc_defer, | 472 | .qc_defer = ata_std_qc_defer, |
| 454 | .qc_prep = nv_swncq_qc_prep, | 473 | .qc_prep = nv_swncq_qc_prep, |
| @@ -1586,6 +1605,21 @@ static void nv_mcp55_thaw(struct ata_port *ap) | |||
| 1586 | ata_sff_thaw(ap); | 1605 | ata_sff_thaw(ap); |
| 1587 | } | 1606 | } |
| 1588 | 1607 | ||
| 1608 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
| 1609 | unsigned long deadline) | ||
| 1610 | { | ||
| 1611 | int rc; | ||
| 1612 | |||
| 1613 | /* SATA hardreset fails to retrieve proper device signature on | ||
| 1614 | * some controllers. Request follow up SRST. For more info, | ||
| 1615 | * see http://bugzilla.kernel.org/show_bug.cgi?id=3352 | ||
| 1616 | */ | ||
| 1617 | rc = sata_sff_hardreset(link, class, deadline); | ||
| 1618 | if (rc) | ||
| 1619 | return rc; | ||
| 1620 | return -EAGAIN; | ||
| 1621 | } | ||
| 1622 | |||
| 1589 | static void nv_adma_error_handler(struct ata_port *ap) | 1623 | static void nv_adma_error_handler(struct ata_port *ap) |
| 1590 | { | 1624 | { |
| 1591 | struct nv_adma_port_priv *pp = ap->private_data; | 1625 | struct nv_adma_port_priv *pp = ap->private_data; |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index daeb8f766971..e4dce8709541 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) | |||
| 695 | { | 695 | { |
| 696 | struct tty_driver *p, *res = NULL; | 696 | struct tty_driver *p, *res = NULL; |
| 697 | int tty_line = 0; | 697 | int tty_line = 0; |
| 698 | int len; | ||
| 698 | char *str; | 699 | char *str; |
| 699 | 700 | ||
| 701 | for (str = name; *str; str++) | ||
| 702 | if ((*str >= '0' && *str <= '9') || *str == ',') | ||
| 703 | break; | ||
| 704 | if (!*str) | ||
| 705 | return NULL; | ||
| 706 | |||
| 707 | len = str - name; | ||
| 708 | tty_line = simple_strtoul(str, &str, 10); | ||
| 709 | |||
| 700 | mutex_lock(&tty_mutex); | 710 | mutex_lock(&tty_mutex); |
| 701 | /* Search through the tty devices to look for a match */ | 711 | /* Search through the tty devices to look for a match */ |
| 702 | list_for_each_entry(p, &tty_drivers, tty_drivers) { | 712 | list_for_each_entry(p, &tty_drivers, tty_drivers) { |
| 703 | str = name + strlen(p->name); | 713 | if (strncmp(name, p->name, len) != 0) |
| 704 | tty_line = simple_strtoul(str, &str, 10); | 714 | continue; |
| 705 | if (*str == ',') | 715 | if (*str == ',') |
| 706 | str++; | 716 | str++; |
| 707 | if (*str == '\0') | 717 | if (*str == '\0') |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 45a3b93eed57..bf41887cdd65 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
| @@ -1834,7 +1834,6 @@ clear_risc_ints: | |||
| 1834 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); | 1834 | WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); |
| 1835 | } | 1835 | } |
| 1836 | spin_unlock_irq(&ha->hardware_lock); | 1836 | spin_unlock_irq(&ha->hardware_lock); |
| 1837 | ha->isp_ops->enable_intrs(ha); | ||
| 1838 | 1837 | ||
| 1839 | fail: | 1838 | fail: |
| 1840 | return ret; | 1839 | return ret; |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 26afe44265c7..6d0f0e5f2827 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
| @@ -1740,6 +1740,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1740 | if (ret) | 1740 | if (ret) |
| 1741 | goto probe_failed; | 1741 | goto probe_failed; |
| 1742 | 1742 | ||
| 1743 | ha->isp_ops->enable_intrs(ha); | ||
| 1744 | |||
| 1743 | scsi_scan_host(host); | 1745 | scsi_scan_host(host); |
| 1744 | 1746 | ||
| 1745 | qla2x00_alloc_sysfs_attr(ha); | 1747 | qla2x00_alloc_sysfs_attr(ha); |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 4a1cf6377f6c..905350896725 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
| @@ -914,6 +914,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
| 914 | ds[i].d_count = sg_dma_len(s); | 914 | ds[i].d_count = sg_dma_len(s); |
| 915 | } | 915 | } |
| 916 | sg_count -= n; | 916 | sg_count -= n; |
| 917 | sg = s; | ||
| 917 | } | 918 | } |
| 918 | } else { | 919 | } else { |
| 919 | cmd->dataseg[0].d_base = 0; | 920 | cmd->dataseg[0].d_base = 0; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ff5d56b3ee4d..62307bd794a9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd) | |||
| 852 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | 852 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) |
| 853 | { | 853 | { |
| 854 | int result = cmd->result; | 854 | int result = cmd->result; |
| 855 | int this_count = scsi_bufflen(cmd); | 855 | int this_count; |
| 856 | struct request_queue *q = cmd->device->request_queue; | 856 | struct request_queue *q = cmd->device->request_queue; |
| 857 | struct request *req = cmd->request; | 857 | struct request *req = cmd->request; |
| 858 | int error = 0; | 858 | int error = 0; |
| @@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
| 908 | */ | 908 | */ |
| 909 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) | 909 | if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) |
| 910 | return; | 910 | return; |
| 911 | this_count = blk_rq_bytes(req); | ||
| 911 | 912 | ||
| 912 | /* good_bytes = 0, or (inclusive) there were leftovers and | 913 | /* good_bytes = 0, or (inclusive) there were leftovers and |
| 913 | * result = 0, so scsi_end_request couldn't retry. | 914 | * result = 0, so scsi_end_request couldn't retry. |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 87ab2443e66d..0ffabf5c0b60 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
| @@ -471,6 +471,7 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
| 471 | #endif | 471 | #endif |
| 472 | break; | 472 | break; |
| 473 | case SSB_BUSTYPE_SSB: | 473 | case SSB_BUSTYPE_SSB: |
| 474 | dev->dma_mask = &dev->coherent_dma_mask; | ||
| 474 | break; | 475 | break; |
| 475 | } | 476 | } |
| 476 | 477 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 80e93956aced..e7a1a99b7464 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name) | |||
| 1395 | if (dentry->d_parent != parent) | 1395 | if (dentry->d_parent != parent) |
| 1396 | goto next; | 1396 | goto next; |
| 1397 | 1397 | ||
| 1398 | /* non-existing due to RCU? */ | ||
| 1399 | if (d_unhashed(dentry)) | ||
| 1400 | goto next; | ||
| 1401 | |||
| 1398 | /* | 1402 | /* |
| 1399 | * It is safe to compare names since d_move() cannot | 1403 | * It is safe to compare names since d_move() cannot |
| 1400 | * change the qstr (protected by d_lock). | 1404 | * change the qstr (protected by d_lock). |
| @@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name) | |||
| 1410 | goto next; | 1414 | goto next; |
| 1411 | } | 1415 | } |
| 1412 | 1416 | ||
| 1413 | if (!d_unhashed(dentry)) { | 1417 | atomic_inc(&dentry->d_count); |
| 1414 | atomic_inc(&dentry->d_count); | 1418 | found = dentry; |
| 1415 | found = dentry; | ||
| 1416 | } | ||
| 1417 | spin_unlock(&dentry->d_lock); | 1419 | spin_unlock(&dentry->d_lock); |
| 1418 | break; | 1420 | break; |
| 1419 | next: | 1421 | next: |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index b9cb77473758..d7f7645779f2 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
| @@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node) | |||
| 538 | printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n); | 538 | printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n); |
| 539 | for (i = 0; i < n; i++) | 539 | for (i = 0; i < n; i++) |
| 540 | printk(KERN_DEBUG "\t ino %llu\n", | 540 | printk(KERN_DEBUG "\t ino %llu\n", |
| 541 | le64_to_cpu(orph->inos[i])); | 541 | (unsigned long long)le64_to_cpu(orph->inos[i])); |
| 542 | break; | 542 | break; |
| 543 | } | 543 | } |
| 544 | default: | 544 | default: |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 2b267c9a1806..526c01ec8003 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
| @@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
| 426 | 426 | ||
| 427 | while (1) { | 427 | while (1) { |
| 428 | dbg_gen("feed '%s', ino %llu, new f_pos %#x", | 428 | dbg_gen("feed '%s', ino %llu, new f_pos %#x", |
| 429 | dent->name, le64_to_cpu(dent->inum), | 429 | dent->name, (unsigned long long)le64_to_cpu(dent->inum), |
| 430 | key_hash_flash(c, &dent->key)); | 430 | key_hash_flash(c, &dent->key)); |
| 431 | ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum); | 431 | ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum); |
| 432 | 432 | ||
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c index e045c8b55423..47814cde2407 100644 --- a/fs/ubifs/find.c +++ b/fs/ubifs/find.c | |||
| @@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free, | |||
| 507 | rsvd_idx_lebs = 0; | 507 | rsvd_idx_lebs = 0; |
| 508 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - | 508 | lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - |
| 509 | c->lst.taken_empty_lebs; | 509 | c->lst.taken_empty_lebs; |
| 510 | ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs); | ||
| 511 | if (rsvd_idx_lebs < lebs) | 510 | if (rsvd_idx_lebs < lebs) |
| 512 | /* | 511 | /* |
| 513 | * OK to allocate an empty LEB, but we still don't want to go | 512 | * OK to allocate an empty LEB, but we still don't want to go |
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 13f1019c859f..02aba36fe3d4 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
| @@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) | |||
| 334 | 334 | ||
| 335 | err = move_nodes(c, sleb); | 335 | err = move_nodes(c, sleb); |
| 336 | if (err) | 336 | if (err) |
| 337 | goto out; | 337 | goto out_inc_seq; |
| 338 | 338 | ||
| 339 | err = gc_sync_wbufs(c); | 339 | err = gc_sync_wbufs(c); |
| 340 | if (err) | 340 | if (err) |
| 341 | goto out; | 341 | goto out_inc_seq; |
| 342 | 342 | ||
| 343 | err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); | 343 | err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); |
| 344 | if (err) | 344 | if (err) |
| 345 | goto out; | 345 | goto out_inc_seq; |
| 346 | 346 | ||
| 347 | /* Allow for races with TNC */ | 347 | /* Allow for races with TNC */ |
| 348 | c->gced_lnum = lnum; | 348 | c->gced_lnum = lnum; |
| @@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp) | |||
| 369 | out: | 369 | out: |
| 370 | ubifs_scan_destroy(sleb); | 370 | ubifs_scan_destroy(sleb); |
| 371 | return err; | 371 | return err; |
| 372 | |||
| 373 | out_inc_seq: | ||
| 374 | /* We may have moved at least some nodes so allow for races with TNC */ | ||
| 375 | c->gced_lnum = lnum; | ||
| 376 | smp_wmb(); | ||
| 377 | c->gc_seq += 1; | ||
| 378 | smp_wmb(); | ||
| 379 | goto out; | ||
| 372 | } | 380 | } |
| 373 | 381 | ||
| 374 | /** | 382 | /** |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 7562464ac83f..3f4902060c7a 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c) | |||
| 1024 | goto out_dereg; | 1024 | goto out_dereg; |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id); | ||
| 1027 | if (!mounted_read_only) { | 1028 | if (!mounted_read_only) { |
| 1028 | err = alloc_wbufs(c); | 1029 | err = alloc_wbufs(c); |
| 1029 | if (err) | 1030 | if (err) |
| 1030 | goto out_cbuf; | 1031 | goto out_cbuf; |
| 1031 | 1032 | ||
| 1032 | /* Create background thread */ | 1033 | /* Create background thread */ |
| 1033 | sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, | ||
| 1034 | c->vi.vol_id); | ||
| 1035 | c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name); | 1034 | c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name); |
| 1036 | if (!c->bgt) | 1035 | if (!c->bgt) |
| 1037 | c->bgt = ERR_PTR(-EINVAL); | 1036 | c->bgt = ERR_PTR(-EINVAL); |
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 7da209ab9378..7634c5970887 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
| @@ -1476,7 +1476,7 @@ again: | |||
| 1476 | } | 1476 | } |
| 1477 | 1477 | ||
| 1478 | err = fallible_read_node(c, key, &zbr, node); | 1478 | err = fallible_read_node(c, key, &zbr, node); |
| 1479 | if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { | 1479 | if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) { |
| 1480 | /* | 1480 | /* |
| 1481 | * The node may have been GC'ed out from under us so try again | 1481 | * The node may have been GC'ed out from under us so try again |
| 1482 | * while keeping the TNC mutex locked. | 1482 | * while keeping the TNC mutex locked. |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 00e80df9dd9d..dbd9cef852ec 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -4118,7 +4118,7 @@ xfs_iext_indirect_to_direct( | |||
| 4118 | ASSERT(nextents <= XFS_LINEAR_EXTS); | 4118 | ASSERT(nextents <= XFS_LINEAR_EXTS); |
| 4119 | size = nextents * sizeof(xfs_bmbt_rec_t); | 4119 | size = nextents * sizeof(xfs_bmbt_rec_t); |
| 4120 | 4120 | ||
| 4121 | xfs_iext_irec_compact_full(ifp); | 4121 | xfs_iext_irec_compact_pages(ifp); |
| 4122 | ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ); | 4122 | ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ); |
| 4123 | 4123 | ||
| 4124 | ep = ifp->if_u1.if_ext_irec->er_extbuf; | 4124 | ep = ifp->if_u1.if_ext_irec->er_extbuf; |
| @@ -4449,8 +4449,7 @@ xfs_iext_irec_remove( | |||
| 4449 | * compaction policy is as follows: | 4449 | * compaction policy is as follows: |
| 4450 | * | 4450 | * |
| 4451 | * Full Compaction: Extents fit into a single page (or inline buffer) | 4451 | * Full Compaction: Extents fit into a single page (or inline buffer) |
| 4452 | * Full Compaction: Extents occupy less than 10% of allocated space | 4452 | * Partial Compaction: Extents occupy less than 50% of allocated space |
| 4453 | * Partial Compaction: Extents occupy > 10% and < 50% of allocated space | ||
| 4454 | * No Compaction: Extents occupy at least 50% of allocated space | 4453 | * No Compaction: Extents occupy at least 50% of allocated space |
| 4455 | */ | 4454 | */ |
| 4456 | void | 4455 | void |
| @@ -4471,8 +4470,6 @@ xfs_iext_irec_compact( | |||
| 4471 | xfs_iext_direct_to_inline(ifp, nextents); | 4470 | xfs_iext_direct_to_inline(ifp, nextents); |
| 4472 | } else if (nextents <= XFS_LINEAR_EXTS) { | 4471 | } else if (nextents <= XFS_LINEAR_EXTS) { |
| 4473 | xfs_iext_indirect_to_direct(ifp); | 4472 | xfs_iext_indirect_to_direct(ifp); |
| 4474 | } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) { | ||
| 4475 | xfs_iext_irec_compact_full(ifp); | ||
| 4476 | } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) { | 4473 | } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) { |
| 4477 | xfs_iext_irec_compact_pages(ifp); | 4474 | xfs_iext_irec_compact_pages(ifp); |
| 4478 | } | 4475 | } |
| @@ -4496,7 +4493,7 @@ xfs_iext_irec_compact_pages( | |||
| 4496 | erp_next = erp + 1; | 4493 | erp_next = erp + 1; |
| 4497 | if (erp_next->er_extcount <= | 4494 | if (erp_next->er_extcount <= |
| 4498 | (XFS_LINEAR_EXTS - erp->er_extcount)) { | 4495 | (XFS_LINEAR_EXTS - erp->er_extcount)) { |
| 4499 | memmove(&erp->er_extbuf[erp->er_extcount], | 4496 | memcpy(&erp->er_extbuf[erp->er_extcount], |
| 4500 | erp_next->er_extbuf, erp_next->er_extcount * | 4497 | erp_next->er_extbuf, erp_next->er_extcount * |
| 4501 | sizeof(xfs_bmbt_rec_t)); | 4498 | sizeof(xfs_bmbt_rec_t)); |
| 4502 | erp->er_extcount += erp_next->er_extcount; | 4499 | erp->er_extcount += erp_next->er_extcount; |
| @@ -4516,91 +4513,6 @@ xfs_iext_irec_compact_pages( | |||
| 4516 | } | 4513 | } |
| 4517 | 4514 | ||
| 4518 | /* | 4515 | /* |
| 4519 | * Fully compact the extent records managed by the indirection array. | ||
| 4520 | */ | ||
| 4521 | void | ||
| 4522 | xfs_iext_irec_compact_full( | ||
| 4523 | xfs_ifork_t *ifp) /* inode fork pointer */ | ||
| 4524 | { | ||
| 4525 | xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */ | ||
| 4526 | xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */ | ||
| 4527 | int erp_idx = 0; /* extent irec index */ | ||
| 4528 | int ext_avail; /* empty entries in ex list */ | ||
| 4529 | int ext_diff; /* number of exts to add */ | ||
| 4530 | int nlists; /* number of irec's (ex lists) */ | ||
| 4531 | |||
| 4532 | ASSERT(ifp->if_flags & XFS_IFEXTIREC); | ||
| 4533 | |||
| 4534 | nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; | ||
| 4535 | erp = ifp->if_u1.if_ext_irec; | ||
| 4536 | ep = &erp->er_extbuf[erp->er_extcount]; | ||
| 4537 | erp_next = erp + 1; | ||
| 4538 | ep_next = erp_next->er_extbuf; | ||
| 4539 | |||
| 4540 | while (erp_idx < nlists - 1) { | ||
| 4541 | /* | ||
| 4542 | * Check how many extent records are available in this irec. | ||
| 4543 | * If there is none skip the whole exercise. | ||
| 4544 | */ | ||
| 4545 | ext_avail = XFS_LINEAR_EXTS - erp->er_extcount; | ||
| 4546 | if (ext_avail) { | ||
| 4547 | |||
| 4548 | /* | ||
| 4549 | * Copy over as many as possible extent records into | ||
| 4550 | * the previous page. | ||
| 4551 | */ | ||
| 4552 | ext_diff = MIN(ext_avail, erp_next->er_extcount); | ||
| 4553 | memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t)); | ||
| 4554 | erp->er_extcount += ext_diff; | ||
| 4555 | erp_next->er_extcount -= ext_diff; | ||
| 4556 | |||
| 4557 | /* | ||
| 4558 | * If the next irec is empty now we can simply | ||
| 4559 | * remove it. | ||
| 4560 | */ | ||
| 4561 | if (erp_next->er_extcount == 0) { | ||
| 4562 | /* | ||
| 4563 | * Free page before removing extent record | ||
| 4564 | * so er_extoffs don't get modified in | ||
| 4565 | * xfs_iext_irec_remove. | ||
| 4566 | */ | ||
| 4567 | kmem_free(erp_next->er_extbuf); | ||
| 4568 | erp_next->er_extbuf = NULL; | ||
| 4569 | xfs_iext_irec_remove(ifp, erp_idx + 1); | ||
| 4570 | erp = &ifp->if_u1.if_ext_irec[erp_idx]; | ||
| 4571 | nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ; | ||
| 4572 | |||
| 4573 | /* | ||
| 4574 | * If the next irec is not empty move up the content | ||
| 4575 | * that has not been copied to the previous page to | ||
| 4576 | * the beggining of this one. | ||
| 4577 | */ | ||
| 4578 | } else { | ||
| 4579 | memmove(erp_next->er_extbuf, &ep_next[ext_diff], | ||
| 4580 | erp_next->er_extcount * | ||
| 4581 | sizeof(xfs_bmbt_rec_t)); | ||
| 4582 | ep_next = erp_next->er_extbuf; | ||
| 4583 | memset(&ep_next[erp_next->er_extcount], 0, | ||
| 4584 | (XFS_LINEAR_EXTS - | ||
| 4585 | erp_next->er_extcount) * | ||
| 4586 | sizeof(xfs_bmbt_rec_t)); | ||
| 4587 | } | ||
| 4588 | } | ||
| 4589 | |||
| 4590 | if (erp->er_extcount == XFS_LINEAR_EXTS) { | ||
| 4591 | erp_idx++; | ||
| 4592 | if (erp_idx < nlists) | ||
| 4593 | erp = &ifp->if_u1.if_ext_irec[erp_idx]; | ||
| 4594 | else | ||
| 4595 | break; | ||
| 4596 | } | ||
| 4597 | ep = &erp->er_extbuf[erp->er_extcount]; | ||
| 4598 | erp_next = erp + 1; | ||
| 4599 | ep_next = erp_next->er_extbuf; | ||
| 4600 | } | ||
| 4601 | } | ||
| 4602 | |||
| 4603 | /* | ||
| 4604 | * This is called to update the er_extoff field in the indirection | 4516 | * This is called to update the er_extoff field in the indirection |
| 4605 | * array when extents have been added or removed from one of the | 4517 | * array when extents have been added or removed from one of the |
| 4606 | * extent lists. erp_idx contains the irec index to begin updating | 4518 | * extent lists. erp_idx contains the irec index to begin updating |
diff --git a/include/asm-x86/kgdb.h b/include/asm-x86/kgdb.h index 484c47554f3b..94d63db10365 100644 --- a/include/asm-x86/kgdb.h +++ b/include/asm-x86/kgdb.h | |||
| @@ -39,12 +39,13 @@ enum regnames { | |||
| 39 | GDB_FS, /* 14 */ | 39 | GDB_FS, /* 14 */ |
| 40 | GDB_GS, /* 15 */ | 40 | GDB_GS, /* 15 */ |
| 41 | }; | 41 | }; |
| 42 | #define NUMREGBYTES ((GDB_GS+1)*4) | ||
| 42 | #else /* ! CONFIG_X86_32 */ | 43 | #else /* ! CONFIG_X86_32 */ |
| 43 | enum regnames { | 44 | enum regnames64 { |
| 44 | GDB_AX, /* 0 */ | 45 | GDB_AX, /* 0 */ |
| 45 | GDB_DX, /* 1 */ | 46 | GDB_BX, /* 1 */ |
| 46 | GDB_CX, /* 2 */ | 47 | GDB_CX, /* 2 */ |
| 47 | GDB_BX, /* 3 */ | 48 | GDB_DX, /* 3 */ |
| 48 | GDB_SI, /* 4 */ | 49 | GDB_SI, /* 4 */ |
| 49 | GDB_DI, /* 5 */ | 50 | GDB_DI, /* 5 */ |
| 50 | GDB_BP, /* 6 */ | 51 | GDB_BP, /* 6 */ |
| @@ -58,18 +59,15 @@ enum regnames { | |||
| 58 | GDB_R14, /* 14 */ | 59 | GDB_R14, /* 14 */ |
| 59 | GDB_R15, /* 15 */ | 60 | GDB_R15, /* 15 */ |
| 60 | GDB_PC, /* 16 */ | 61 | GDB_PC, /* 16 */ |
| 61 | GDB_PS, /* 17 */ | ||
| 62 | }; | 62 | }; |
| 63 | #endif /* CONFIG_X86_32 */ | ||
| 64 | 63 | ||
| 65 | /* | 64 | enum regnames32 { |
| 66 | * Number of bytes of registers: | 65 | GDB_PS = 34, |
| 67 | */ | 66 | GDB_CS, |
| 68 | #ifdef CONFIG_X86_32 | 67 | GDB_SS, |
| 69 | # define NUMREGBYTES 64 | 68 | }; |
| 70 | #else | 69 | #define NUMREGBYTES ((GDB_SS+1)*4) |
| 71 | # define NUMREGBYTES ((GDB_PS+1)*8) | 70 | #endif /* CONFIG_X86_32 */ |
| 72 | #endif | ||
| 73 | 71 | ||
| 74 | static inline void arch_kgdb_breakpoint(void) | 72 | static inline void arch_kgdb_breakpoint(void) |
| 75 | { | 73 | { |
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index eaa21fc9ad1d..25d955dbb989 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
| @@ -488,7 +488,7 @@ static int write_mem_msg(int binary) | |||
| 488 | if (err) | 488 | if (err) |
| 489 | return err; | 489 | return err; |
| 490 | if (CACHE_FLUSH_IS_SAFE) | 490 | if (CACHE_FLUSH_IS_SAFE) |
| 491 | flush_icache_range(addr, addr + length + 1); | 491 | flush_icache_range(addr, addr + length); |
| 492 | return 0; | 492 | return 0; |
| 493 | } | 493 | } |
| 494 | 494 | ||
| @@ -1462,7 +1462,7 @@ acquirelock: | |||
| 1462 | * Get the passive CPU lock which will hold all the non-primary | 1462 | * Get the passive CPU lock which will hold all the non-primary |
| 1463 | * CPU in a spin state while the debugger is active | 1463 | * CPU in a spin state while the debugger is active |
| 1464 | */ | 1464 | */ |
| 1465 | if (!kgdb_single_step || !kgdb_contthread) { | 1465 | if (!kgdb_single_step) { |
| 1466 | for (i = 0; i < NR_CPUS; i++) | 1466 | for (i = 0; i < NR_CPUS; i++) |
| 1467 | atomic_set(&passive_cpu_wait[i], 1); | 1467 | atomic_set(&passive_cpu_wait[i], 1); |
| 1468 | } | 1468 | } |
| @@ -1475,7 +1475,7 @@ acquirelock: | |||
| 1475 | 1475 | ||
| 1476 | #ifdef CONFIG_SMP | 1476 | #ifdef CONFIG_SMP |
| 1477 | /* Signal the other CPUs to enter kgdb_wait() */ | 1477 | /* Signal the other CPUs to enter kgdb_wait() */ |
| 1478 | if ((!kgdb_single_step || !kgdb_contthread) && kgdb_do_roundup) | 1478 | if ((!kgdb_single_step) && kgdb_do_roundup) |
| 1479 | kgdb_roundup_cpus(flags); | 1479 | kgdb_roundup_cpus(flags); |
| 1480 | #endif | 1480 | #endif |
| 1481 | 1481 | ||
| @@ -1494,7 +1494,7 @@ acquirelock: | |||
| 1494 | kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code); | 1494 | kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code); |
| 1495 | kgdb_deactivate_sw_breakpoints(); | 1495 | kgdb_deactivate_sw_breakpoints(); |
| 1496 | kgdb_single_step = 0; | 1496 | kgdb_single_step = 0; |
| 1497 | kgdb_contthread = NULL; | 1497 | kgdb_contthread = current; |
| 1498 | exception_level = 0; | 1498 | exception_level = 0; |
| 1499 | 1499 | ||
| 1500 | /* Talk to debugger with gdbserial protocol */ | 1500 | /* Talk to debugger with gdbserial protocol */ |
| @@ -1508,7 +1508,7 @@ acquirelock: | |||
| 1508 | kgdb_info[ks->cpu].task = NULL; | 1508 | kgdb_info[ks->cpu].task = NULL; |
| 1509 | atomic_set(&cpu_in_kgdb[ks->cpu], 0); | 1509 | atomic_set(&cpu_in_kgdb[ks->cpu], 0); |
| 1510 | 1510 | ||
| 1511 | if (!kgdb_single_step || !kgdb_contthread) { | 1511 | if (!kgdb_single_step) { |
| 1512 | for (i = NR_CPUS-1; i >= 0; i--) | 1512 | for (i = NR_CPUS-1; i >= 0; i--) |
| 1513 | atomic_set(&passive_cpu_wait[i], 0); | 1513 | atomic_set(&passive_cpu_wait[i], 0); |
| 1514 | /* | 1514 | /* |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 36b5eedcdc75..3e1057f885c6 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -32,6 +32,7 @@ char *defconfig_file; | |||
| 32 | 32 | ||
| 33 | static int indent = 1; | 33 | static int indent = 1; |
| 34 | static int valid_stdin = 1; | 34 | static int valid_stdin = 1; |
| 35 | static int sync_kconfig; | ||
| 35 | static int conf_cnt; | 36 | static int conf_cnt; |
| 36 | static char line[128]; | 37 | static char line[128]; |
| 37 | static struct menu *rootEntry; | 38 | static struct menu *rootEntry; |
| @@ -65,7 +66,7 @@ static void strip(char *str) | |||
| 65 | 66 | ||
| 66 | static void check_stdin(void) | 67 | static void check_stdin(void) |
| 67 | { | 68 | { |
| 68 | if (!valid_stdin && input_mode == ask_silent) { | 69 | if (!valid_stdin) { |
| 69 | printf(_("aborted!\n\n")); | 70 | printf(_("aborted!\n\n")); |
| 70 | printf(_("Console input/output is redirected. ")); | 71 | printf(_("Console input/output is redirected. ")); |
| 71 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); | 72 | printf(_("Run 'make oldconfig' to update configuration.\n\n")); |
| @@ -427,43 +428,6 @@ static void check_conf(struct menu *menu) | |||
| 427 | check_conf(child); | 428 | check_conf(child); |
| 428 | } | 429 | } |
| 429 | 430 | ||
| 430 | static void conf_do_update(void) | ||
| 431 | { | ||
| 432 | /* Update until a loop caused no more changes */ | ||
| 433 | do { | ||
| 434 | conf_cnt = 0; | ||
| 435 | check_conf(&rootmenu); | ||
| 436 | } while (conf_cnt); | ||
| 437 | } | ||
| 438 | |||
| 439 | static int conf_silent_update(void) | ||
| 440 | { | ||
| 441 | const char *name; | ||
| 442 | |||
| 443 | if (conf_get_changed()) { | ||
| 444 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
| 445 | if (name && *name) { | ||
| 446 | fprintf(stderr, | ||
| 447 | _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
| 448 | return 1; | ||
| 449 | } | ||
| 450 | conf_do_update(); | ||
| 451 | } | ||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int conf_update(void) | ||
| 456 | { | ||
| 457 | rootEntry = &rootmenu; | ||
| 458 | conf(&rootmenu); | ||
| 459 | if (input_mode == ask_all) { | ||
| 460 | input_mode = ask_silent; | ||
| 461 | valid_stdin = 1; | ||
| 462 | } | ||
| 463 | conf_do_update(); | ||
| 464 | return 0; | ||
| 465 | } | ||
| 466 | |||
| 467 | int main(int ac, char **av) | 431 | int main(int ac, char **av) |
| 468 | { | 432 | { |
| 469 | int opt; | 433 | int opt; |
| @@ -477,11 +441,11 @@ int main(int ac, char **av) | |||
| 477 | while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { | 441 | while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { |
| 478 | switch (opt) { | 442 | switch (opt) { |
| 479 | case 'o': | 443 | case 'o': |
| 480 | input_mode = ask_new; | 444 | input_mode = ask_silent; |
| 481 | break; | 445 | break; |
| 482 | case 's': | 446 | case 's': |
| 483 | input_mode = ask_silent; | 447 | input_mode = ask_silent; |
| 484 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | 448 | sync_kconfig = 1; |
| 485 | break; | 449 | break; |
| 486 | case 'd': | 450 | case 'd': |
| 487 | input_mode = set_default; | 451 | input_mode = set_default; |
| @@ -519,6 +483,19 @@ int main(int ac, char **av) | |||
| 519 | name = av[optind]; | 483 | name = av[optind]; |
| 520 | conf_parse(name); | 484 | conf_parse(name); |
| 521 | //zconfdump(stdout); | 485 | //zconfdump(stdout); |
| 486 | if (sync_kconfig) { | ||
| 487 | if (stat(".config", &tmpstat)) { | ||
| 488 | fprintf(stderr, _("***\n" | ||
| 489 | "*** You have not yet configured your kernel!\n" | ||
| 490 | "*** (missing kernel .config file)\n" | ||
| 491 | "***\n" | ||
| 492 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
| 493 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
| 494 | "***\n")); | ||
| 495 | exit(1); | ||
| 496 | } | ||
| 497 | } | ||
| 498 | |||
| 522 | switch (input_mode) { | 499 | switch (input_mode) { |
| 523 | case set_default: | 500 | case set_default: |
| 524 | if (!defconfig_file) | 501 | if (!defconfig_file) |
| @@ -531,16 +508,6 @@ int main(int ac, char **av) | |||
| 531 | } | 508 | } |
| 532 | break; | 509 | break; |
| 533 | case ask_silent: | 510 | case ask_silent: |
| 534 | if (stat(".config", &tmpstat)) { | ||
| 535 | printf(_("***\n" | ||
| 536 | "*** You have not yet configured your kernel!\n" | ||
| 537 | "*** (missing kernel .config file)\n" | ||
| 538 | "***\n" | ||
| 539 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
| 540 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
| 541 | "***\n")); | ||
| 542 | exit(1); | ||
| 543 | } | ||
| 544 | case ask_all: | 511 | case ask_all: |
| 545 | case ask_new: | 512 | case ask_new: |
| 546 | conf_read(NULL); | 513 | conf_read(NULL); |
| @@ -569,6 +536,19 @@ int main(int ac, char **av) | |||
| 569 | default: | 536 | default: |
| 570 | break; | 537 | break; |
| 571 | } | 538 | } |
| 539 | |||
| 540 | if (sync_kconfig) { | ||
| 541 | if (conf_get_changed()) { | ||
| 542 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
| 543 | if (name && *name) { | ||
| 544 | fprintf(stderr, | ||
| 545 | _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
| 546 | return 1; | ||
| 547 | } | ||
| 548 | } | ||
| 549 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | ||
| 550 | } | ||
| 551 | |||
| 572 | switch (input_mode) { | 552 | switch (input_mode) { |
| 573 | case set_no: | 553 | case set_no: |
| 574 | conf_set_all_new_symbols(def_no); | 554 | conf_set_all_new_symbols(def_no); |
| @@ -585,27 +565,38 @@ int main(int ac, char **av) | |||
| 585 | case set_default: | 565 | case set_default: |
| 586 | conf_set_all_new_symbols(def_default); | 566 | conf_set_all_new_symbols(def_default); |
| 587 | break; | 567 | break; |
| 588 | case ask_silent: | ||
| 589 | case ask_new: | 568 | case ask_new: |
| 590 | if (conf_silent_update()) | ||
| 591 | exit(1); | ||
| 592 | break; | ||
| 593 | case ask_all: | 569 | case ask_all: |
| 594 | if (conf_update()) | 570 | rootEntry = &rootmenu; |
| 595 | exit(1); | 571 | conf(&rootmenu); |
| 572 | input_mode = ask_silent; | ||
| 573 | /* fall through */ | ||
| 574 | case ask_silent: | ||
| 575 | /* Update until a loop caused no more changes */ | ||
| 576 | do { | ||
| 577 | conf_cnt = 0; | ||
| 578 | check_conf(&rootmenu); | ||
| 579 | } while (conf_cnt); | ||
| 596 | break; | 580 | break; |
| 597 | } | 581 | } |
| 598 | 582 | ||
| 599 | if (conf_write(NULL)) { | 583 | if (sync_kconfig) { |
| 600 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 584 | /* silentoldconfig is used during the build so we shall update autoconf. |
| 601 | exit(1); | 585 | * All other commands are only used to generate a config. |
| 602 | } | 586 | */ |
| 603 | /* ask_silent is used during the build so we shall update autoconf. | 587 | if (conf_get_changed() && conf_write(NULL)) { |
| 604 | * All other commands are only used to generate a config. | 588 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
| 605 | */ | 589 | exit(1); |
| 606 | if (input_mode == ask_silent && conf_write_autoconf()) { | 590 | } |
| 607 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 591 | if (conf_write_autoconf()) { |
| 608 | return 1; | 592 | fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); |
| 593 | return 1; | ||
| 594 | } | ||
| 595 | } else { | ||
| 596 | if (conf_write(NULL)) { | ||
| 597 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
| 598 | exit(1); | ||
| 599 | } | ||
| 609 | } | 600 | } |
| 610 | return 0; | 601 | return 0; |
| 611 | } | 602 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index df6a188b9930..b91cf241a539 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -222,8 +222,10 @@ load: | |||
| 222 | continue; | 222 | continue; |
| 223 | if (def == S_DEF_USER) { | 223 | if (def == S_DEF_USER) { |
| 224 | sym = sym_find(line + 9); | 224 | sym = sym_find(line + 9); |
| 225 | if (!sym) | 225 | if (!sym) { |
| 226 | sym_add_change_count(1); | ||
| 226 | break; | 227 | break; |
| 228 | } | ||
| 227 | } else { | 229 | } else { |
| 228 | sym = sym_lookup(line + 9, 0); | 230 | sym = sym_lookup(line + 9, 0); |
| 229 | if (sym->type == S_UNKNOWN) | 231 | if (sym->type == S_UNKNOWN) |
| @@ -259,8 +261,10 @@ load: | |||
| 259 | } | 261 | } |
| 260 | if (def == S_DEF_USER) { | 262 | if (def == S_DEF_USER) { |
| 261 | sym = sym_find(line + 7); | 263 | sym = sym_find(line + 7); |
| 262 | if (!sym) | 264 | if (!sym) { |
| 265 | sym_add_change_count(1); | ||
| 263 | break; | 266 | break; |
| 267 | } | ||
| 264 | } else { | 268 | } else { |
| 265 | sym = sym_lookup(line + 7, 0); | 269 | sym = sym_lookup(line + 7, 0); |
| 266 | if (sym->type == S_UNKNOWN) | 270 | if (sym->type == S_UNKNOWN) |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 9dd9bc73fe1d..ece25c718e95 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
| @@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
| 781 | return -ENODEV; | 781 | return -ENODEV; |
| 782 | 782 | ||
| 783 | card = pcm->card; | 783 | card = pcm->card; |
| 784 | down_read(&card->controls_rwsem); | 784 | read_lock(&card->ctl_files_rwlock); |
| 785 | list_for_each_entry(kctl, &card->ctl_files, list) { | 785 | list_for_each_entry(kctl, &card->ctl_files, list) { |
| 786 | if (kctl->pid == current->pid) { | 786 | if (kctl->pid == current->pid) { |
| 787 | prefer_subdevice = kctl->prefer_pcm_subdevice; | 787 | prefer_subdevice = kctl->prefer_pcm_subdevice; |
| @@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, | |||
| 789 | break; | 789 | break; |
| 790 | } | 790 | } |
| 791 | } | 791 | } |
| 792 | up_read(&card->controls_rwsem); | 792 | read_unlock(&card->ctl_files_rwlock); |
| 793 | 793 | ||
| 794 | switch (stream) { | 794 | switch (stream) { |
| 795 | case SNDRV_PCM_STREAM_PLAYBACK: | 795 | case SNDRV_PCM_STREAM_PLAYBACK: |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index c49b9d9e303c..c487025d3457 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
| @@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
| 1546 | card = substream->pcm->card; | 1546 | card = substream->pcm->card; |
| 1547 | 1547 | ||
| 1548 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || | 1548 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN || |
| 1549 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) | 1549 | runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || |
| 1550 | runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | ||
| 1550 | return -EBADFD; | 1551 | return -EBADFD; |
| 1551 | 1552 | ||
| 1552 | snd_power_lock(card); | ||
| 1553 | if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { | ||
| 1554 | result = snd_power_wait(card, SNDRV_CTL_POWER_D0); | ||
| 1555 | if (result < 0) | ||
| 1556 | goto _unlock; | ||
| 1557 | } | ||
| 1558 | |||
| 1559 | snd_pcm_stream_lock_irq(substream); | 1553 | snd_pcm_stream_lock_irq(substream); |
| 1560 | /* resume pause */ | 1554 | /* resume pause */ |
| 1561 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) | 1555 | if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) |
| @@ -1564,8 +1558,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) | |||
| 1564 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); | 1558 | snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); |
| 1565 | /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ | 1559 | /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ |
| 1566 | snd_pcm_stream_unlock_irq(substream); | 1560 | snd_pcm_stream_unlock_irq(substream); |
| 1567 | _unlock: | 1561 | |
| 1568 | snd_power_unlock(card); | ||
| 1569 | return result; | 1562 | return result; |
| 1570 | } | 1563 | } |
| 1571 | 1564 | ||
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index f7ea7287c59c..b917a9f981c7 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
| @@ -418,7 +418,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
| 418 | mutex_lock(&rmidi->open_mutex); | 418 | mutex_lock(&rmidi->open_mutex); |
| 419 | while (1) { | 419 | while (1) { |
| 420 | subdevice = -1; | 420 | subdevice = -1; |
| 421 | down_read(&card->controls_rwsem); | 421 | read_lock(&card->ctl_files_rwlock); |
| 422 | list_for_each_entry(kctl, &card->ctl_files, list) { | 422 | list_for_each_entry(kctl, &card->ctl_files, list) { |
| 423 | if (kctl->pid == current->pid) { | 423 | if (kctl->pid == current->pid) { |
| 424 | subdevice = kctl->prefer_rawmidi_subdevice; | 424 | subdevice = kctl->prefer_rawmidi_subdevice; |
| @@ -426,7 +426,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
| 426 | break; | 426 | break; |
| 427 | } | 427 | } |
| 428 | } | 428 | } |
| 429 | up_read(&card->controls_rwsem); | 429 | read_unlock(&card->ctl_files_rwlock); |
| 430 | err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, | 430 | err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, |
| 431 | subdevice, fflags, rawmidi_file); | 431 | subdevice, fflags, rawmidi_file); |
| 432 | if (err >= 0) | 432 | if (err >= 0) |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 9deb8c74fdfd..d68650de39bc 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
| @@ -490,34 +490,7 @@ static int cs4270_mute(struct snd_soc_dai *dai, int mute) | |||
| 490 | 490 | ||
| 491 | #endif | 491 | #endif |
| 492 | 492 | ||
| 493 | static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind); | 493 | static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *); |
| 494 | |||
| 495 | /* | ||
| 496 | * Notify the driver that a new I2C bus has been found. | ||
| 497 | * | ||
| 498 | * This function is called for each I2C bus in the system. The function | ||
| 499 | * then asks the I2C subsystem to probe that bus at the addresses on which | ||
| 500 | * our device (the CS4270) could exist. If a device is found at one of | ||
| 501 | * those addresses, then our probe function (cs4270_i2c_probe) is called. | ||
| 502 | */ | ||
| 503 | static int cs4270_i2c_attach(struct i2c_adapter *adapter) | ||
| 504 | { | ||
| 505 | return i2c_probe(adapter, &addr_data, cs4270_i2c_probe); | ||
| 506 | } | ||
| 507 | |||
| 508 | static int cs4270_i2c_detach(struct i2c_client *client) | ||
| 509 | { | ||
| 510 | struct snd_soc_codec *codec = i2c_get_clientdata(client); | ||
| 511 | |||
| 512 | i2c_detach_client(client); | ||
| 513 | codec->control_data = NULL; | ||
| 514 | |||
| 515 | kfree(codec->reg_cache); | ||
| 516 | codec->reg_cache = NULL; | ||
| 517 | |||
| 518 | kfree(client); | ||
| 519 | return 0; | ||
| 520 | } | ||
| 521 | 494 | ||
| 522 | /* A list of non-DAPM controls that the CS4270 supports */ | 495 | /* A list of non-DAPM controls that the CS4270 supports */ |
| 523 | static const struct snd_kcontrol_new cs4270_snd_controls[] = { | 496 | static const struct snd_kcontrol_new cs4270_snd_controls[] = { |
| @@ -525,14 +498,19 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = { | |||
| 525 | CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) | 498 | CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) |
| 526 | }; | 499 | }; |
| 527 | 500 | ||
| 501 | static const struct i2c_device_id cs4270_id[] = { | ||
| 502 | {"cs4270", 0}, | ||
| 503 | {} | ||
| 504 | }; | ||
| 505 | MODULE_DEVICE_TABLE(i2c, cs4270_id); | ||
| 506 | |||
| 528 | static struct i2c_driver cs4270_i2c_driver = { | 507 | static struct i2c_driver cs4270_i2c_driver = { |
| 529 | .driver = { | 508 | .driver = { |
| 530 | .name = "CS4270 I2C", | 509 | .name = "CS4270 I2C", |
| 531 | .owner = THIS_MODULE, | 510 | .owner = THIS_MODULE, |
| 532 | }, | 511 | }, |
| 533 | .id = I2C_DRIVERID_CS4270, | 512 | .id_table = cs4270_id, |
| 534 | .attach_adapter = cs4270_i2c_attach, | 513 | .probe = cs4270_i2c_probe, |
| 535 | .detach_client = cs4270_i2c_detach, | ||
| 536 | }; | 514 | }; |
| 537 | 515 | ||
| 538 | /* | 516 | /* |
| @@ -561,11 +539,11 @@ static struct snd_soc_device *cs4270_socdev; | |||
| 561 | * Note: snd_soc_new_pcms() must be called before this function can be called, | 539 | * Note: snd_soc_new_pcms() must be called before this function can be called, |
| 562 | * because of snd_ctl_add(). | 540 | * because of snd_ctl_add(). |
| 563 | */ | 541 | */ |
| 564 | static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | 542 | static int cs4270_i2c_probe(struct i2c_client *i2c_client, |
| 543 | const struct i2c_device_id *id) | ||
| 565 | { | 544 | { |
| 566 | struct snd_soc_device *socdev = cs4270_socdev; | 545 | struct snd_soc_device *socdev = cs4270_socdev; |
| 567 | struct snd_soc_codec *codec = socdev->codec; | 546 | struct snd_soc_codec *codec = socdev->codec; |
| 568 | struct i2c_client *i2c_client = NULL; | ||
| 569 | int i; | 547 | int i; |
| 570 | int ret = 0; | 548 | int ret = 0; |
| 571 | 549 | ||
| @@ -578,12 +556,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
| 578 | 556 | ||
| 579 | /* Note: codec_dai->codec is NULL here */ | 557 | /* Note: codec_dai->codec is NULL here */ |
| 580 | 558 | ||
| 581 | i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
| 582 | if (!i2c_client) { | ||
| 583 | printk(KERN_ERR "cs4270: could not allocate I2C client\n"); | ||
| 584 | return -ENOMEM; | ||
| 585 | } | ||
| 586 | |||
| 587 | codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); | 559 | codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); |
| 588 | if (!codec->reg_cache) { | 560 | if (!codec->reg_cache) { |
| 589 | printk(KERN_ERR "cs4270: could not allocate register cache\n"); | 561 | printk(KERN_ERR "cs4270: could not allocate register cache\n"); |
| @@ -591,13 +563,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
| 591 | goto error; | 563 | goto error; |
| 592 | } | 564 | } |
| 593 | 565 | ||
| 594 | i2c_set_clientdata(i2c_client, codec); | ||
| 595 | strcpy(i2c_client->name, "CS4270"); | ||
| 596 | |||
| 597 | i2c_client->driver = &cs4270_i2c_driver; | ||
| 598 | i2c_client->adapter = adapter; | ||
| 599 | i2c_client->addr = addr; | ||
| 600 | |||
| 601 | /* Verify that we have a CS4270 */ | 566 | /* Verify that we have a CS4270 */ |
| 602 | 567 | ||
| 603 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); | 568 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); |
| @@ -612,18 +577,10 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
| 612 | goto error; | 577 | goto error; |
| 613 | } | 578 | } |
| 614 | 579 | ||
| 615 | printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr); | 580 | printk(KERN_INFO "cs4270: found device at I2C address %X\n", |
| 581 | i2c_client->addr); | ||
| 616 | printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); | 582 | printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); |
| 617 | 583 | ||
| 618 | /* Tell the I2C layer a new client has arrived */ | ||
| 619 | |||
| 620 | ret = i2c_attach_client(i2c_client); | ||
| 621 | if (ret) { | ||
| 622 | printk(KERN_ERR "cs4270: could not attach codec, " | ||
| 623 | "I2C address %x, error code %i\n", addr, ret); | ||
| 624 | goto error; | ||
| 625 | } | ||
| 626 | |||
| 627 | codec->control_data = i2c_client; | 584 | codec->control_data = i2c_client; |
| 628 | codec->read = cs4270_read_reg_cache; | 585 | codec->read = cs4270_read_reg_cache; |
| 629 | codec->write = cs4270_i2c_write; | 586 | codec->write = cs4270_i2c_write; |
| @@ -648,20 +605,17 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) | |||
| 648 | goto error; | 605 | goto error; |
| 649 | } | 606 | } |
| 650 | 607 | ||
| 608 | i2c_set_clientdata(i2c_client, codec); | ||
| 609 | |||
| 651 | return 0; | 610 | return 0; |
| 652 | 611 | ||
| 653 | error: | 612 | error: |
| 654 | if (codec->control_data) { | 613 | codec->control_data = NULL; |
| 655 | i2c_detach_client(i2c_client); | ||
| 656 | codec->control_data = NULL; | ||
| 657 | } | ||
| 658 | 614 | ||
| 659 | kfree(codec->reg_cache); | 615 | kfree(codec->reg_cache); |
| 660 | codec->reg_cache = NULL; | 616 | codec->reg_cache = NULL; |
| 661 | codec->reg_cache_size = 0; | 617 | codec->reg_cache_size = 0; |
| 662 | 618 | ||
| 663 | kfree(i2c_client); | ||
| 664 | |||
| 665 | return ret; | 619 | return ret; |
| 666 | } | 620 | } |
| 667 | 621 | ||
