diff options
195 files changed, 1922 insertions, 2126 deletions
diff --git a/.gitignore b/.gitignore index 3016ed30526d..090b293b8779 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -41,6 +41,7 @@ include/linux/autoconf.h | |||
| 41 | include/linux/compile.h | 41 | include/linux/compile.h |
| 42 | include/linux/version.h | 42 | include/linux/version.h |
| 43 | include/linux/utsrelease.h | 43 | include/linux/utsrelease.h |
| 44 | include/linux/bounds.h | ||
| 44 | 45 | ||
| 45 | # stgit generated dirs | 46 | # stgit generated dirs |
| 46 | patches-* | 47 | patches-* |
diff --git a/Documentation/hwmon/w83l785ts b/Documentation/hwmon/w83l785ts index 1841cedc25b2..bd1fa9d4468d 100644 --- a/Documentation/hwmon/w83l785ts +++ b/Documentation/hwmon/w83l785ts | |||
| @@ -33,7 +33,8 @@ Known Issues | |||
| 33 | ------------ | 33 | ------------ |
| 34 | 34 | ||
| 35 | On some systems (Asus), the BIOS is known to interfere with the driver | 35 | On some systems (Asus), the BIOS is known to interfere with the driver |
| 36 | and cause read errors. The driver will retry a given number of times | 36 | and cause read errors. Or maybe the W83L785TS-S chip is simply unreliable, |
| 37 | we don't really know. The driver will retry a given number of times | ||
| 37 | (5 by default) and then give up, returning the old value (or 0 if | 38 | (5 by default) and then give up, returning the old value (or 0 if |
| 38 | there is no old value). It seems to work well enough so that you should | 39 | there is no old value). It seems to work well enough so that you should |
| 39 | not notice anything. Thanks to James Bolt for helping test this feature. | 40 | not notice anything. Thanks to James Bolt for helping test this feature. |
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt index d0ac72cc19ff..b8e52c0355d3 100644 --- a/Documentation/kdump/kdump.txt +++ b/Documentation/kdump/kdump.txt | |||
| @@ -245,6 +245,8 @@ The syntax is: | |||
| 245 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] | 245 | crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] |
| 246 | range=start-[end] | 246 | range=start-[end] |
| 247 | 247 | ||
| 248 | 'start' is inclusive and 'end' is exclusive. | ||
| 249 | |||
| 248 | For example: | 250 | For example: |
| 249 | 251 | ||
| 250 | crashkernel=512M-2G:64M,2G-:128M | 252 | crashkernel=512M-2G:64M,2G-:128M |
| @@ -253,10 +255,11 @@ This would mean: | |||
| 253 | 255 | ||
| 254 | 1) if the RAM is smaller than 512M, then don't reserve anything | 256 | 1) if the RAM is smaller than 512M, then don't reserve anything |
| 255 | (this is the "rescue" case) | 257 | (this is the "rescue" case) |
| 256 | 2) if the RAM size is between 512M and 2G, then reserve 64M | 258 | 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M |
| 257 | 3) if the RAM size is larger than 2G, then reserve 128M | 259 | 3) if the RAM size is larger than 2G, then reserve 128M |
| 258 | 260 | ||
| 259 | 261 | ||
| 262 | |||
| 260 | Boot into System Kernel | 263 | Boot into System Kernel |
| 261 | ======================= | 264 | ======================= |
| 262 | 265 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index c3a533d5d382..cae9001a670d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1196,9 +1196,9 @@ S: Maintained | |||
| 1196 | 1196 | ||
| 1197 | CPUSETS | 1197 | CPUSETS |
| 1198 | P: Paul Jackson | 1198 | P: Paul Jackson |
| 1199 | P: Simon Derr | 1199 | P: Paul Menage |
| 1200 | M: pj@sgi.com | 1200 | M: pj@sgi.com |
| 1201 | M: simon.derr@bull.net | 1201 | M: menage@google.com |
| 1202 | L: linux-kernel@vger.kernel.org | 1202 | L: linux-kernel@vger.kernel.org |
| 1203 | W: http://www.bullopensource.org/cpuset/ | 1203 | W: http://www.bullopensource.org/cpuset/ |
| 1204 | S: Supported | 1204 | S: Supported |
| @@ -1557,6 +1557,14 @@ M: raisch@de.ibm.com | |||
| 1557 | L: general@lists.openfabrics.org | 1557 | L: general@lists.openfabrics.org |
| 1558 | S: Supported | 1558 | S: Supported |
| 1559 | 1559 | ||
| 1560 | EMBEDDED LINUX | ||
| 1561 | P: Paul Gortmaker | ||
| 1562 | M: paul.gortmaker@windriver.com | ||
| 1563 | P David Woodhouse | ||
| 1564 | M: dwmw2@infradead.org | ||
| 1565 | L: linux-embedded@vger.kernel.org | ||
| 1566 | S: Maintained | ||
| 1567 | |||
| 1560 | EMULEX LPFC FC SCSI DRIVER | 1568 | EMULEX LPFC FC SCSI DRIVER |
| 1561 | P: James Smart | 1569 | P: James Smart |
| 1562 | M: james.smart@emulex.com | 1570 | M: james.smart@emulex.com |
| @@ -794,7 +794,7 @@ endif # ifdef CONFIG_KALLSYMS | |||
| 794 | quiet_cmd_vmlinux-modpost = LD $@ | 794 | quiet_cmd_vmlinux-modpost = LD $@ |
| 795 | cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \ | 795 | cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \ |
| 796 | $(vmlinux-init) --start-group $(vmlinux-main) --end-group \ | 796 | $(vmlinux-init) --start-group $(vmlinux-main) --end-group \ |
| 797 | $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^) | 797 | $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^) |
| 798 | define rule_vmlinux-modpost | 798 | define rule_vmlinux-modpost |
| 799 | : | 799 | : |
| 800 | +$(call cmd,vmlinux-modpost) | 800 | +$(call cmd,vmlinux-modpost) |
| @@ -818,7 +818,9 @@ endif | |||
| 818 | ifdef CONFIG_KALLSYMS | 818 | ifdef CONFIG_KALLSYMS |
| 819 | .tmp_vmlinux1: vmlinux.o | 819 | .tmp_vmlinux1: vmlinux.o |
| 820 | endif | 820 | endif |
| 821 | vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE | 821 | |
| 822 | modpost-init := $(filter-out init/built-in.o, $(vmlinux-init)) | ||
| 823 | vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE | ||
| 822 | $(call if_changed_rule,vmlinux-modpost) | 824 | $(call if_changed_rule,vmlinux-modpost) |
| 823 | 825 | ||
| 824 | # The actual objects are generated when descending, | 826 | # The actual objects are generated when descending, |
diff --git a/arch/frv/mm/Makefile b/arch/frv/mm/Makefile index fb8b1d860f46..1bca5ab8a6ab 100644 --- a/arch/frv/mm/Makefile +++ b/arch/frv/mm/Makefile | |||
| @@ -6,4 +6,4 @@ obj-y := init.o kmap.o | |||
| 6 | 6 | ||
| 7 | obj-$(CONFIG_MMU) += \ | 7 | obj-$(CONFIG_MMU) += \ |
| 8 | pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \ | 8 | pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \ |
| 9 | mmu-context.o dma-alloc.o unaligned.o elf-fdpic.o | 9 | mmu-context.o dma-alloc.o elf-fdpic.o |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 6df073240135..318b81100623 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | /* | 1 | /* |
| 3 | * kvm_ia64.c: Basic KVM suppport On Itanium series processors | 2 | * kvm_ia64.c: Basic KVM suppport On Itanium series processors |
| 4 | * | 3 | * |
| @@ -431,7 +430,7 @@ int kvm_emulate_halt(struct kvm_vcpu *vcpu) | |||
| 431 | if (itc_diff < 0) | 430 | if (itc_diff < 0) |
| 432 | itc_diff = -itc_diff; | 431 | itc_diff = -itc_diff; |
| 433 | 432 | ||
| 434 | expires = div64_64(itc_diff, cyc_per_usec); | 433 | expires = div64_u64(itc_diff, cyc_per_usec); |
| 435 | kt = ktime_set(0, 1000 * expires); | 434 | kt = ktime_set(0, 1000 * expires); |
| 436 | vcpu->arch.ht_active = 1; | 435 | vcpu->arch.ht_active = 1; |
| 437 | hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); | 436 | hrtimer_start(p_ht, kt, HRTIMER_MODE_ABS); |
diff --git a/arch/m68knommu/kernel/asm-offsets.c b/arch/m68knommu/kernel/asm-offsets.c index fd0c685a7f11..c785d07c02cc 100644 --- a/arch/m68knommu/kernel/asm-offsets.c +++ b/arch/m68knommu/kernel/asm-offsets.c | |||
| @@ -87,6 +87,7 @@ int main(void) | |||
| 87 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); | 87 | DEFINE(TI_TASK, offsetof(struct thread_info, task)); |
| 88 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); | 88 | DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); |
| 89 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); | 89 | DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); |
| 90 | DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count)); | ||
| 90 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); | 91 | DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); |
| 91 | 92 | ||
| 92 | return 0; | 93 | return 0; |
diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S index 1e7ea6a3e1a1..f4782d2dce8f 100644 --- a/arch/m68knommu/kernel/entry.S +++ b/arch/m68knommu/kernel/entry.S | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <asm/segment.h> | 32 | #include <asm/segment.h> |
| 33 | #include <asm/asm-offsets.h> | 33 | #include <asm/asm-offsets.h> |
| 34 | #include <asm/entry.h> | 34 | #include <asm/entry.h> |
| 35 | #include <asm/unistd.h> | ||
| 35 | 36 | ||
| 36 | .text | 37 | .text |
| 37 | 38 | ||
| @@ -140,3 +141,11 @@ ENTRY(sys_rt_sigreturn) | |||
| 140 | RESTORE_SWITCH_STACK | 141 | RESTORE_SWITCH_STACK |
| 141 | rts | 142 | rts |
| 142 | 143 | ||
| 144 | ENTRY(ret_from_user_signal) | ||
| 145 | moveq #__NR_sigreturn,%d0 | ||
| 146 | trap #0 | ||
| 147 | |||
| 148 | ENTRY(ret_from_user_rt_signal) | ||
| 149 | move #__NR_rt_sigreturn,%d0 | ||
| 150 | trap #0 | ||
| 151 | |||
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c index d6f0200316fe..03f4fe6a2fc0 100644 --- a/arch/m68knommu/kernel/setup.c +++ b/arch/m68knommu/kernel/setup.c | |||
| @@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 162 | printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); | 162 | printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); |
| 163 | #endif | 163 | #endif |
| 164 | #ifdef CONFIG_M5235EVB | 164 | #ifdef CONFIG_M5235EVB |
| 165 | printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)"); | 165 | printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n"); |
| 166 | #endif | 166 | #endif |
| 167 | 167 | ||
| 168 | #ifdef DEBUG | 168 | #ifdef DEBUG |
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c index 70371378db86..bbfcae9e52b4 100644 --- a/arch/m68knommu/kernel/signal.c +++ b/arch/m68knommu/kernel/signal.c | |||
| @@ -51,6 +51,8 @@ | |||
| 51 | 51 | ||
| 52 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 52 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
| 53 | 53 | ||
| 54 | void ret_from_user_signal(void); | ||
| 55 | void ret_from_user_rt_signal(void); | ||
| 54 | asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); | 56 | asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); |
| 55 | 57 | ||
| 56 | /* | 58 | /* |
| @@ -539,10 +541,6 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) | |||
| 539 | return err; | 541 | return err; |
| 540 | } | 542 | } |
| 541 | 543 | ||
| 542 | static inline void push_cache (unsigned long vaddr) | ||
| 543 | { | ||
| 544 | } | ||
| 545 | |||
| 546 | static inline void * | 544 | static inline void * |
| 547 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | 545 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) |
| 548 | { | 546 | { |
| @@ -586,16 +584,11 @@ static void setup_frame (int sig, struct k_sigaction *ka, | |||
| 586 | err |= copy_to_user (&frame->sc, &context, sizeof(context)); | 584 | err |= copy_to_user (&frame->sc, &context, sizeof(context)); |
| 587 | 585 | ||
| 588 | /* Set up to return from userspace. */ | 586 | /* Set up to return from userspace. */ |
| 589 | err |= __put_user(frame->retcode, &frame->pretcode); | 587 | err |= __put_user((void *) ret_from_user_signal, &frame->pretcode); |
| 590 | /* moveq #,d0; trap #0 */ | ||
| 591 | err |= __put_user(0x70004e40 + (__NR_sigreturn << 16), | ||
| 592 | (long *)(frame->retcode)); | ||
| 593 | 588 | ||
| 594 | if (err) | 589 | if (err) |
| 595 | goto give_sigsegv; | 590 | goto give_sigsegv; |
| 596 | 591 | ||
| 597 | push_cache ((unsigned long) &frame->retcode); | ||
| 598 | |||
| 599 | /* Set up registers for signal handler */ | 592 | /* Set up registers for signal handler */ |
| 600 | wrusp ((unsigned long) frame); | 593 | wrusp ((unsigned long) frame); |
| 601 | regs->pc = (unsigned long) ka->sa.sa_handler; | 594 | regs->pc = (unsigned long) ka->sa.sa_handler; |
| @@ -655,17 +648,11 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 655 | err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); | 648 | err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); |
| 656 | 649 | ||
| 657 | /* Set up to return from userspace. */ | 650 | /* Set up to return from userspace. */ |
| 658 | err |= __put_user(frame->retcode, &frame->pretcode); | 651 | err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode); |
| 659 | /* moveq #,d0; notb d0; trap #0 */ | ||
| 660 | err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16), | ||
| 661 | (long *)(frame->retcode + 0)); | ||
| 662 | err |= __put_user(0x4e40, (short *)(frame->retcode + 4)); | ||
| 663 | 652 | ||
| 664 | if (err) | 653 | if (err) |
| 665 | goto give_sigsegv; | 654 | goto give_sigsegv; |
| 666 | 655 | ||
| 667 | push_cache ((unsigned long) &frame->retcode); | ||
| 668 | |||
| 669 | /* Set up registers for signal handler */ | 656 | /* Set up registers for signal handler */ |
| 670 | wrusp ((unsigned long) frame); | 657 | wrusp ((unsigned long) frame); |
| 671 | regs->pc = (unsigned long) ka->sa.sa_handler; | 658 | regs->pc = (unsigned long) ka->sa.sa_handler; |
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c index 437a061d8b94..ec9aea652e79 100644 --- a/arch/m68knommu/kernel/traps.c +++ b/arch/m68knommu/kernel/traps.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/linkage.h> | 28 | #include <linux/linkage.h> |
| 29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 30 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
| 31 | #include <linux/kallsyms.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
| 33 | #include <asm/fpu.h> | 34 | #include <asm/fpu.h> |
| @@ -102,56 +103,47 @@ asmlinkage void buserr_c(struct frame *fp) | |||
| 102 | force_sig(SIGSEGV, current); | 103 | force_sig(SIGSEGV, current); |
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | |||
| 106 | int kstack_depth_to_print = 48; | 106 | int kstack_depth_to_print = 48; |
| 107 | 107 | ||
| 108 | void show_stack(struct task_struct *task, unsigned long *stack) | 108 | static void __show_stack(struct task_struct *task, unsigned long *stack) |
| 109 | { | 109 | { |
| 110 | unsigned long *endstack, addr; | 110 | unsigned long *endstack, addr; |
| 111 | extern char _start, _etext; | 111 | unsigned long *last_stack; |
| 112 | int i; | 112 | int i; |
| 113 | 113 | ||
| 114 | if (!stack) { | 114 | if (!stack) |
| 115 | if (task) | 115 | stack = (unsigned long *)task->thread.ksp; |
| 116 | stack = (unsigned long *)task->thread.ksp; | ||
| 117 | else | ||
| 118 | stack = (unsigned long *)&stack; | ||
| 119 | } | ||
| 120 | 116 | ||
| 121 | addr = (unsigned long) stack; | 117 | addr = (unsigned long) stack; |
| 122 | endstack = (unsigned long *) PAGE_ALIGN(addr); | 118 | endstack = (unsigned long *) PAGE_ALIGN(addr); |
| 123 | 119 | ||
| 124 | printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); | 120 | printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); |
| 125 | for (i = 0; i < kstack_depth_to_print; i++) { | 121 | for (i = 0; i < kstack_depth_to_print; i++) { |
| 126 | if (stack + 1 > endstack) | 122 | if (stack + 1 + i > endstack) |
| 127 | break; | 123 | break; |
| 128 | if (i % 8 == 0) | 124 | if (i % 8 == 0) |
| 129 | printk("\n" KERN_EMERG " "); | 125 | printk("\n" KERN_EMERG " "); |
| 130 | printk(" %08lx", *stack++); | 126 | printk(" %08lx", *(stack + i)); |
| 131 | } | 127 | } |
| 132 | printk("\n"); | 128 | printk("\n"); |
| 133 | 129 | ||
| 134 | printk(KERN_EMERG "Call Trace:"); | 130 | #ifdef CONFIG_FRAME_POINTER |
| 135 | i = 0; | 131 | printk(KERN_EMERG "Call Trace:\n"); |
| 136 | while (stack + 1 <= endstack) { | 132 | |
| 137 | addr = *stack++; | 133 | last_stack = stack - 1; |
| 138 | /* | 134 | while (stack <= endstack && stack > last_stack) { |
| 139 | * If the address is either in the text segment of the | 135 | |
| 140 | * kernel, or in the region which contains vmalloc'ed | 136 | addr = *(stack + 1); |
| 141 | * memory, it *may* be the address of a calling | 137 | printk(KERN_EMERG " [%08lx] ", addr); |
| 142 | * routine; if so, print it so that someone tracing | 138 | print_symbol(KERN_CONT "%s\n", addr); |
| 143 | * down the cause of the crash will be able to figure | 139 | |
| 144 | * out the call path that was taken. | 140 | last_stack = stack; |
| 145 | */ | 141 | stack = (unsigned long *)*stack; |
| 146 | if (((addr >= (unsigned long) &_start) && | ||
| 147 | (addr <= (unsigned long) &_etext))) { | ||
| 148 | if (i % 4 == 0) | ||
| 149 | printk("\n" KERN_EMERG " "); | ||
| 150 | printk(" [<%08lx>]", addr); | ||
| 151 | i++; | ||
| 152 | } | ||
| 153 | } | 142 | } |
| 154 | printk("\n"); | 143 | printk("\n"); |
| 144 | #else | ||
| 145 | printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n"); | ||
| 146 | #endif | ||
| 155 | } | 147 | } |
| 156 | 148 | ||
| 157 | void bad_super_trap(struct frame *fp) | 149 | void bad_super_trap(struct frame *fp) |
| @@ -298,19 +290,47 @@ asmlinkage void set_esp0(unsigned long ssp) | |||
| 298 | current->thread.esp0 = ssp; | 290 | current->thread.esp0 = ssp; |
| 299 | } | 291 | } |
| 300 | 292 | ||
| 301 | |||
| 302 | /* | 293 | /* |
| 303 | * The architecture-independent backtrace generator | 294 | * The architecture-independent backtrace generator |
| 304 | */ | 295 | */ |
| 305 | void dump_stack(void) | 296 | void dump_stack(void) |
| 306 | { | 297 | { |
| 307 | unsigned long stack; | 298 | /* |
| 299 | * We need frame pointers for this little trick, which works as follows: | ||
| 300 | * | ||
| 301 | * +------------+ 0x00 | ||
| 302 | * | Next SP | -> 0x0c | ||
| 303 | * +------------+ 0x04 | ||
| 304 | * | Caller | | ||
| 305 | * +------------+ 0x08 | ||
| 306 | * | Local vars | -> our stack var | ||
| 307 | * +------------+ 0x0c | ||
| 308 | * | Next SP | -> 0x18, that is what we pass to show_stack() | ||
| 309 | * +------------+ 0x10 | ||
| 310 | * | Caller | | ||
| 311 | * +------------+ 0x14 | ||
| 312 | * | Local vars | | ||
| 313 | * +------------+ 0x18 | ||
| 314 | * | ... | | ||
| 315 | * +------------+ | ||
| 316 | */ | ||
| 308 | 317 | ||
| 309 | show_stack(current, &stack); | 318 | unsigned long *stack; |
| 310 | } | ||
| 311 | 319 | ||
| 320 | stack = (unsigned long *)&stack; | ||
| 321 | stack++; | ||
| 322 | __show_stack(current, stack); | ||
| 323 | } | ||
| 312 | EXPORT_SYMBOL(dump_stack); | 324 | EXPORT_SYMBOL(dump_stack); |
| 313 | 325 | ||
| 326 | void show_stack(struct task_struct *task, unsigned long *stack) | ||
| 327 | { | ||
| 328 | if (!stack && !task) | ||
| 329 | dump_stack(); | ||
| 330 | else | ||
| 331 | __show_stack(task, stack); | ||
| 332 | } | ||
| 333 | |||
| 314 | #ifdef CONFIG_M68KFPU_EMU | 334 | #ifdef CONFIG_M68KFPU_EMU |
| 315 | asmlinkage void fpemu_signal(int signal, int code, void *addr) | 335 | asmlinkage void fpemu_signal(int signal, int code, void *addr) |
| 316 | { | 336 | { |
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S index b44edb08e212..5592e0bf951f 100644 --- a/arch/m68knommu/kernel/vmlinux.lds.S +++ b/arch/m68knommu/kernel/vmlinux.lds.S | |||
| @@ -64,6 +64,7 @@ SECTIONS { | |||
| 64 | _stext = . ; | 64 | _stext = . ; |
| 65 | TEXT_TEXT | 65 | TEXT_TEXT |
| 66 | SCHED_TEXT | 66 | SCHED_TEXT |
| 67 | LOCK_TEXT | ||
| 67 | *(.text.lock) | 68 | *(.text.lock) |
| 68 | 69 | ||
| 69 | . = ALIGN(16); /* Exception table */ | 70 | . = ALIGN(16); /* Exception table */ |
| @@ -73,6 +74,7 @@ SECTIONS { | |||
| 73 | 74 | ||
| 74 | *(.rodata) *(.rodata.*) | 75 | *(.rodata) *(.rodata.*) |
| 75 | *(__vermagic) /* Kernel version magic */ | 76 | *(__vermagic) /* Kernel version magic */ |
| 77 | *(__markers_strings) | ||
| 76 | *(.rodata1) | 78 | *(.rodata1) |
| 77 | *(.rodata.str1.1) | 79 | *(.rodata.str1.1) |
| 78 | 80 | ||
| @@ -182,6 +184,7 @@ SECTIONS { | |||
| 182 | *(COMMON) | 184 | *(COMMON) |
| 183 | . = ALIGN(4) ; | 185 | . = ALIGN(4) ; |
| 184 | _ebss = . ; | 186 | _ebss = . ; |
| 187 | _end = . ; | ||
| 185 | } > BSS | 188 | } > BSS |
| 186 | 189 | ||
| 187 | } | 190 | } |
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c index a6692e958f6b..d01a5d2b7557 100644 --- a/arch/m68knommu/platform/5206e/config.c +++ b/arch/m68knommu/platform/5206e/config.c | |||
| @@ -48,7 +48,7 @@ static struct platform_device *m5206e_devices[] __initdata = { | |||
| 48 | 48 | ||
| 49 | /***************************************************************************/ | 49 | /***************************************************************************/ |
| 50 | 50 | ||
| 51 | static void __init m5206_uart_init_line(int line, int irq) | 51 | static void __init m5206e_uart_init_line(int line, int irq) |
| 52 | { | 52 | { |
| 53 | if (line == 0) { | 53 | if (line == 0) { |
| 54 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); | 54 | writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); |
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c index 2aca599a1ca7..230bae691a7f 100644 --- a/arch/m68knommu/platform/5272/config.c +++ b/arch/m68knommu/platform/5272/config.c | |||
| @@ -139,10 +139,6 @@ void __init config_BSP(char *commandp, int size) | |||
| 139 | /* Copy command line from FLASH to local buffer... */ | 139 | /* Copy command line from FLASH to local buffer... */ |
| 140 | memcpy(commandp, (char *) 0xf0004000, size); | 140 | memcpy(commandp, (char *) 0xf0004000, size); |
| 141 | commandp[size-1] = 0; | 141 | commandp[size-1] = 0; |
| 142 | #elif defined(CONFIG_MTD_KeyTechnology) | ||
| 143 | /* Copy command line from FLASH to local buffer... */ | ||
| 144 | memcpy(commandp, (char *) 0xffe06000, size); | ||
| 145 | commandp[size-1] = 0; | ||
| 146 | #elif defined(CONFIG_CANCam) | 142 | #elif defined(CONFIG_CANCam) |
| 147 | /* Copy command line from FLASH to local buffer... */ | 143 | /* Copy command line from FLASH to local buffer... */ |
| 148 | memcpy(commandp, (char *) 0xf0010000, size); | 144 | memcpy(commandp, (char *) 0xf0010000, size); |
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c index 036e1b73d944..dfdb5c2ed8e6 100644 --- a/arch/m68knommu/platform/528x/config.c +++ b/arch/m68knommu/platform/528x/config.c | |||
| @@ -26,9 +26,240 @@ | |||
| 26 | #include <asm/mcfuart.h> | 26 | #include <asm/mcfuart.h> |
| 27 | #include <asm/mcfqspi.h> | 27 | #include <asm/mcfqspi.h> |
| 28 | 28 | ||
| 29 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 30 | #include <linux/mtd/partitions.h> | ||
| 31 | #endif | ||
| 32 | |||
| 29 | /***************************************************************************/ | 33 | /***************************************************************************/ |
| 30 | 34 | ||
| 31 | void coldfire_reset(void); | 35 | void coldfire_reset(void); |
| 36 | static void coldfire_qspi_cs_control(u8 cs, u8 command); | ||
| 37 | |||
| 38 | /***************************************************************************/ | ||
| 39 | |||
| 40 | #if defined(CONFIG_SPI) | ||
| 41 | |||
| 42 | #if defined(CONFIG_WILDFIRE) | ||
| 43 | #define SPI_NUM_CHIPSELECTS 0x02 | ||
| 44 | #define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */ | ||
| 45 | #define SPI_CS_MASK 0x18 | ||
| 46 | |||
| 47 | #define FLASH_BLOCKSIZE (1024*64) | ||
| 48 | #define FLASH_NUMBLOCKS 16 | ||
| 49 | #define FLASH_TYPE "m25p80" | ||
| 50 | |||
| 51 | #define M25P80_CS 0 | ||
| 52 | #define MMC_CS 1 | ||
| 53 | |||
| 54 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 55 | static struct mtd_partition stm25p_partitions[] = { | ||
| 56 | /* sflash */ | ||
| 57 | [0] = { | ||
| 58 | .name = "stm25p80", | ||
| 59 | .offset = 0x00000000, | ||
| 60 | .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS, | ||
| 61 | .mask_flags = 0 | ||
| 62 | } | ||
| 63 | }; | ||
| 64 | |||
| 65 | #endif | ||
| 66 | |||
| 67 | #elif defined(CONFIG_WILDFIREMOD) | ||
| 68 | |||
| 69 | #define SPI_NUM_CHIPSELECTS 0x08 | ||
| 70 | #define SPI_PAR_VAL 0x07 /* Enable DIN, DOUT, CLK */ | ||
| 71 | #define SPI_CS_MASK 0x78 | ||
| 72 | |||
| 73 | #define FLASH_BLOCKSIZE (1024*64) | ||
| 74 | #define FLASH_NUMBLOCKS 64 | ||
| 75 | #define FLASH_TYPE "m25p32" | ||
| 76 | /* Reserve 1M for the kernel parition */ | ||
| 77 | #define FLASH_KERNEL_SIZE (1024 * 1024) | ||
| 78 | |||
| 79 | #define M25P80_CS 5 | ||
| 80 | #define MMC_CS 6 | ||
| 81 | |||
| 82 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 83 | static struct mtd_partition stm25p_partitions[] = { | ||
| 84 | /* sflash */ | ||
| 85 | [0] = { | ||
| 86 | .name = "kernel", | ||
| 87 | .offset = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE, | ||
| 88 | .size = FLASH_KERNEL_SIZE, | ||
| 89 | .mask_flags = 0 | ||
| 90 | }, | ||
| 91 | [1] = { | ||
| 92 | .name = "image", | ||
| 93 | .offset = 0x00000000, | ||
| 94 | .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS - FLASH_KERNEL_SIZE, | ||
| 95 | .mask_flags = 0 | ||
| 96 | }, | ||
| 97 | [2] = { | ||
| 98 | .name = "all", | ||
| 99 | .offset = 0x00000000, | ||
| 100 | .size = FLASH_BLOCKSIZE * FLASH_NUMBLOCKS, | ||
| 101 | .mask_flags = 0 | ||
| 102 | } | ||
| 103 | }; | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #else | ||
| 107 | #define SPI_NUM_CHIPSELECTS 0x04 | ||
| 108 | #define SPI_PAR_VAL 0x7F /* Enable DIN, DOUT, CLK, CS0 - CS4 */ | ||
| 109 | #endif | ||
| 110 | |||
| 111 | #ifdef MMC_CS | ||
| 112 | static struct coldfire_spi_chip flash_chip_info = { | ||
| 113 | .mode = SPI_MODE_0, | ||
| 114 | .bits_per_word = 16, | ||
| 115 | .del_cs_to_clk = 17, | ||
| 116 | .del_after_trans = 1, | ||
| 117 | .void_write_data = 0 | ||
| 118 | }; | ||
| 119 | |||
| 120 | static struct coldfire_spi_chip mmc_chip_info = { | ||
| 121 | .mode = SPI_MODE_0, | ||
| 122 | .bits_per_word = 16, | ||
| 123 | .del_cs_to_clk = 17, | ||
| 124 | .del_after_trans = 1, | ||
| 125 | .void_write_data = 0xFFFF | ||
| 126 | }; | ||
| 127 | #endif | ||
| 128 | |||
| 129 | #ifdef M25P80_CS | ||
| 130 | static struct flash_platform_data stm25p80_platform_data = { | ||
| 131 | .name = "ST M25P80 SPI Flash chip", | ||
| 132 | #ifdef CONFIG_MTD_PARTITIONS | ||
| 133 | .parts = stm25p_partitions, | ||
| 134 | .nr_parts = sizeof(stm25p_partitions) / sizeof(*stm25p_partitions), | ||
| 135 | #endif | ||
| 136 | .type = FLASH_TYPE | ||
| 137 | }; | ||
| 138 | #endif | ||
| 139 | |||
| 140 | static struct spi_board_info spi_board_info[] __initdata = { | ||
| 141 | #ifdef M25P80_CS | ||
| 142 | { | ||
| 143 | .modalias = "m25p80", | ||
| 144 | .max_speed_hz = 16000000, | ||
| 145 | .bus_num = 1, | ||
| 146 | .chip_select = M25P80_CS, | ||
| 147 | .platform_data = &stm25p80_platform_data, | ||
| 148 | .controller_data = &flash_chip_info | ||
| 149 | }, | ||
| 150 | #endif | ||
| 151 | #ifdef MMC_CS | ||
| 152 | { | ||
| 153 | .modalias = "mmc_spi", | ||
| 154 | .max_speed_hz = 16000000, | ||
| 155 | .bus_num = 1, | ||
| 156 | .chip_select = MMC_CS, | ||
| 157 | .controller_data = &mmc_chip_info | ||
| 158 | } | ||
| 159 | #endif | ||
| 160 | }; | ||
| 161 | |||
| 162 | static struct coldfire_spi_master coldfire_master_info = { | ||
| 163 | .bus_num = 1, | ||
| 164 | .num_chipselect = SPI_NUM_CHIPSELECTS, | ||
| 165 | .irq_source = MCF5282_QSPI_IRQ_SOURCE, | ||
| 166 | .irq_vector = MCF5282_QSPI_IRQ_VECTOR, | ||
| 167 | .irq_mask = ((0x01 << MCF5282_QSPI_IRQ_SOURCE) | 0x01), | ||
| 168 | .irq_lp = 0x2B, /* Level 5 and Priority 3 */ | ||
| 169 | .par_val = SPI_PAR_VAL, | ||
| 170 | .cs_control = coldfire_qspi_cs_control, | ||
| 171 | }; | ||
| 172 | |||
| 173 | static struct resource coldfire_spi_resources[] = { | ||
| 174 | [0] = { | ||
| 175 | .name = "qspi-par", | ||
| 176 | .start = MCF5282_QSPI_PAR, | ||
| 177 | .end = MCF5282_QSPI_PAR, | ||
| 178 | .flags = IORESOURCE_MEM | ||
| 179 | }, | ||
| 180 | |||
| 181 | [1] = { | ||
| 182 | .name = "qspi-module", | ||
| 183 | .start = MCF5282_QSPI_QMR, | ||
| 184 | .end = MCF5282_QSPI_QMR + 0x18, | ||
| 185 | .flags = IORESOURCE_MEM | ||
| 186 | }, | ||
| 187 | |||
| 188 | [2] = { | ||
| 189 | .name = "qspi-int-level", | ||
| 190 | .start = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE, | ||
| 191 | .end = MCF5282_INTC0 + MCFINTC_ICR0 + MCF5282_QSPI_IRQ_SOURCE, | ||
| 192 | .flags = IORESOURCE_MEM | ||
| 193 | }, | ||
| 194 | |||
| 195 | [3] = { | ||
| 196 | .name = "qspi-int-mask", | ||
| 197 | .start = MCF5282_INTC0 + MCFINTC_IMRL, | ||
| 198 | .end = MCF5282_INTC0 + MCFINTC_IMRL, | ||
| 199 | .flags = IORESOURCE_MEM | ||
| 200 | } | ||
| 201 | }; | ||
| 202 | |||
| 203 | static struct platform_device coldfire_spi = { | ||
| 204 | .name = "spi_coldfire", | ||
| 205 | .id = -1, | ||
| 206 | .resource = coldfire_spi_resources, | ||
| 207 | .num_resources = ARRAY_SIZE(coldfire_spi_resources), | ||
| 208 | .dev = { | ||
| 209 | .platform_data = &coldfire_master_info, | ||
| 210 | } | ||
| 211 | }; | ||
| 212 | |||
| 213 | static void coldfire_qspi_cs_control(u8 cs, u8 command) | ||
| 214 | { | ||
| 215 | u8 cs_bit = ((0x01 << cs) << 3) & SPI_CS_MASK; | ||
| 216 | |||
| 217 | #if defined(CONFIG_WILDFIRE) | ||
| 218 | u8 cs_mask = ~(((0x01 << cs) << 3) & SPI_CS_MASK); | ||
| 219 | #endif | ||
| 220 | #if defined(CONFIG_WILDFIREMOD) | ||
| 221 | u8 cs_mask = (cs << 3) & SPI_CS_MASK; | ||
| 222 | #endif | ||
| 223 | |||
| 224 | /* | ||
| 225 | * Don't do anything if the chip select is not | ||
| 226 | * one of the port qs pins. | ||
| 227 | */ | ||
| 228 | if (command & QSPI_CS_INIT) { | ||
| 229 | #if defined(CONFIG_WILDFIRE) | ||
| 230 | MCF5282_GPIO_DDRQS |= cs_bit; | ||
| 231 | MCF5282_GPIO_PQSPAR &= ~cs_bit; | ||
| 232 | #endif | ||
| 233 | |||
| 234 | #if defined(CONFIG_WILDFIREMOD) | ||
| 235 | MCF5282_GPIO_DDRQS |= SPI_CS_MASK; | ||
| 236 | MCF5282_GPIO_PQSPAR &= ~SPI_CS_MASK; | ||
| 237 | #endif | ||
| 238 | } | ||
| 239 | |||
| 240 | if (command & QSPI_CS_ASSERT) { | ||
| 241 | MCF5282_GPIO_PORTQS &= ~SPI_CS_MASK; | ||
| 242 | MCF5282_GPIO_PORTQS |= cs_mask; | ||
| 243 | } else if (command & QSPI_CS_DROP) { | ||
| 244 | MCF5282_GPIO_PORTQS |= SPI_CS_MASK; | ||
| 245 | } | ||
| 246 | } | ||
| 247 | |||
| 248 | static int __init spi_dev_init(void) | ||
| 249 | { | ||
| 250 | int retval; | ||
| 251 | |||
| 252 | retval = platform_device_register(&coldfire_spi); | ||
| 253 | if (retval < 0) | ||
| 254 | return retval; | ||
| 255 | |||
| 256 | if (ARRAY_SIZE(spi_board_info)) | ||
| 257 | retval = spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | ||
| 258 | |||
| 259 | return retval; | ||
| 260 | } | ||
| 261 | |||
| 262 | #endif /* CONFIG_SPI */ | ||
| 32 | 263 | ||
| 33 | /***************************************************************************/ | 264 | /***************************************************************************/ |
| 34 | 265 | ||
| @@ -111,10 +342,43 @@ void mcf_autovector(unsigned int vec) | |||
| 111 | 342 | ||
| 112 | /***************************************************************************/ | 343 | /***************************************************************************/ |
| 113 | 344 | ||
| 345 | #ifdef CONFIG_WILDFIRE | ||
| 346 | void wildfire_halt(void) | ||
| 347 | { | ||
| 348 | writeb(0, 0x30000007); | ||
| 349 | writeb(0x2, 0x30000007); | ||
| 350 | } | ||
| 351 | #endif | ||
| 352 | |||
| 353 | #ifdef CONFIG_WILDFIREMOD | ||
| 354 | void wildfiremod_halt(void) | ||
| 355 | { | ||
| 356 | printk(KERN_INFO "WildFireMod hibernating...\n"); | ||
| 357 | |||
| 358 | /* Set portE.5 to Digital IO */ | ||
| 359 | MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2)); | ||
| 360 | |||
| 361 | /* Make portE.5 an output */ | ||
| 362 | MCF5282_GPIO_DDRE |= (1 << 5); | ||
| 363 | |||
| 364 | /* Now toggle portE.5 from low to high */ | ||
| 365 | MCF5282_GPIO_PORTE &= ~(1 << 5); | ||
| 366 | MCF5282_GPIO_PORTE |= (1 << 5); | ||
| 367 | |||
| 368 | printk(KERN_EMERG "Failed to hibernate. Halting!\n"); | ||
| 369 | } | ||
| 370 | #endif | ||
| 371 | |||
| 114 | void __init config_BSP(char *commandp, int size) | 372 | void __init config_BSP(char *commandp, int size) |
| 115 | { | 373 | { |
| 116 | mcf_disableall(); | 374 | mcf_disableall(); |
| 117 | mach_reset = coldfire_reset; | 375 | |
| 376 | #ifdef CONFIG_WILDFIRE | ||
| 377 | mach_halt = wildfire_halt; | ||
| 378 | #endif | ||
| 379 | #ifdef CONFIG_WILDFIREMOD | ||
| 380 | mach_halt = wildfiremod_halt; | ||
| 381 | #endif | ||
| 118 | } | 382 | } |
| 119 | 383 | ||
| 120 | /***************************************************************************/ | 384 | /***************************************************************************/ |
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c index 92dc862fa826..11cff6625dcc 100644 --- a/arch/m68knommu/platform/5307/config.c +++ b/arch/m68knommu/platform/5307/config.c | |||
| @@ -124,8 +124,7 @@ void __init config_BSP(char *commandp, int size) | |||
| 124 | mcf_setimr(MCFSIM_IMR_MASKALL); | 124 | mcf_setimr(MCFSIM_IMR_MASKALL); |
| 125 | 125 | ||
| 126 | #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ | 126 | #if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ |
| 127 | defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ | 127 | defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA) |
| 128 | defined(CONFIG_CLEOPATRA) | ||
| 129 | /* Copy command line from FLASH to local buffer... */ | 128 | /* Copy command line from FLASH to local buffer... */ |
| 130 | memcpy(commandp, (char *) 0xf0004000, size); | 129 | memcpy(commandp, (char *) 0xf0004000, size); |
| 131 | commandp[size-1] = 0; | 130 | commandp[size-1] = 0; |
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S index 111b66dc737b..1e3c0dcbd7ac 100644 --- a/arch/m68knommu/platform/coldfire/entry.S +++ b/arch/m68knommu/platform/coldfire/entry.S | |||
| @@ -103,9 +103,26 @@ ret_from_signal: | |||
| 103 | addql #4,%sp | 103 | addql #4,%sp |
| 104 | 104 | ||
| 105 | ret_from_exception: | 105 | ret_from_exception: |
| 106 | move #0x2700,%sr /* disable intrs */ | ||
| 106 | btst #5,%sp@(PT_SR) /* check if returning to kernel */ | 107 | btst #5,%sp@(PT_SR) /* check if returning to kernel */ |
| 107 | jeq Luser_return /* if so, skip resched, signals */ | 108 | jeq Luser_return /* if so, skip resched, signals */ |
| 108 | 109 | ||
| 110 | #ifdef CONFIG_PREEMPT | ||
| 111 | movel %sp,%d1 /* get thread_info pointer */ | ||
| 112 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ | ||
| 113 | movel %d1,%a0 | ||
| 114 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ | ||
| 115 | andl #_TIF_NEED_RESCHED,%d1 | ||
| 116 | jeq Lkernel_return | ||
| 117 | |||
| 118 | movel %a0@(TI_PREEMPTCOUNT),%d1 | ||
| 119 | cmpl #0,%d1 | ||
| 120 | jne Lkernel_return | ||
| 121 | |||
| 122 | pea Lkernel_return | ||
| 123 | jmp preempt_schedule_irq /* preempt the kernel */ | ||
| 124 | #endif | ||
| 125 | |||
| 109 | Lkernel_return: | 126 | Lkernel_return: |
| 110 | moveml %sp@,%d1-%d5/%a0-%a2 | 127 | moveml %sp@,%d1-%d5/%a0-%a2 |
| 111 | lea %sp@(32),%sp /* space for 8 regs */ | 128 | lea %sp@(32),%sp /* space for 8 regs */ |
| @@ -140,6 +157,7 @@ Lreturn: | |||
| 140 | 157 | ||
| 141 | Lwork_to_do: | 158 | Lwork_to_do: |
| 142 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ | 159 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ |
| 160 | move #0x2000,%sr /* enable intrs again */ | ||
| 143 | btst #TIF_NEED_RESCHED,%d1 | 161 | btst #TIF_NEED_RESCHED,%d1 |
| 144 | jne reschedule | 162 | jne reschedule |
| 145 | 163 | ||
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c index 77db3473deab..9fdd8bcdd21e 100644 --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c | |||
| @@ -54,6 +54,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 54 | #include <linux/module.h> | 54 | #include <linux/module.h> |
| 55 | #include <linux/elfcore.h> | 55 | #include <linux/elfcore.h> |
| 56 | #include <linux/compat.h> | 56 | #include <linux/compat.h> |
| 57 | #include <linux/math64.h> | ||
| 57 | 58 | ||
| 58 | #define elf_prstatus elf_prstatus32 | 59 | #define elf_prstatus elf_prstatus32 |
| 59 | struct elf_prstatus32 | 60 | struct elf_prstatus32 |
| @@ -102,8 +103,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | |||
| 102 | * one divide. | 103 | * one divide. |
| 103 | */ | 104 | */ |
| 104 | u64 nsec = (u64)jiffies * TICK_NSEC; | 105 | u64 nsec = (u64)jiffies * TICK_NSEC; |
| 105 | long rem; | 106 | u32 rem; |
| 106 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); | 107 | value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); |
| 107 | value->tv_usec = rem / NSEC_PER_USEC; | 108 | value->tv_usec = rem / NSEC_PER_USEC; |
| 108 | } | 109 | } |
| 109 | 110 | ||
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c index 08f4cd781ee3..e1333d7319e2 100644 --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c | |||
| @@ -56,6 +56,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
| 56 | #include <linux/module.h> | 56 | #include <linux/module.h> |
| 57 | #include <linux/elfcore.h> | 57 | #include <linux/elfcore.h> |
| 58 | #include <linux/compat.h> | 58 | #include <linux/compat.h> |
| 59 | #include <linux/math64.h> | ||
| 59 | 60 | ||
| 60 | #define elf_prstatus elf_prstatus32 | 61 | #define elf_prstatus elf_prstatus32 |
| 61 | struct elf_prstatus32 | 62 | struct elf_prstatus32 |
| @@ -104,8 +105,8 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) | |||
| 104 | * one divide. | 105 | * one divide. |
| 105 | */ | 106 | */ |
| 106 | u64 nsec = (u64)jiffies * TICK_NSEC; | 107 | u64 nsec = (u64)jiffies * TICK_NSEC; |
| 107 | long rem; | 108 | u32 rem; |
| 108 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &rem); | 109 | value->tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem); |
| 109 | value->tv_usec = rem / NSEC_PER_USEC; | 110 | value->tv_usec = rem / NSEC_PER_USEC; |
| 110 | } | 111 | } |
| 111 | 112 | ||
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 3b26fbd6bec9..73401e83739a 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
| @@ -149,7 +149,7 @@ EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */ | |||
| 149 | u64 tb_to_xs; | 149 | u64 tb_to_xs; |
| 150 | unsigned tb_to_us; | 150 | unsigned tb_to_us; |
| 151 | 151 | ||
| 152 | #define TICKLEN_SCALE TICK_LENGTH_SHIFT | 152 | #define TICKLEN_SCALE NTP_SCALE_SHIFT |
| 153 | u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ | 153 | u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ |
| 154 | u64 ticklen_to_xs; /* 0.64 fraction */ | 154 | u64 ticklen_to_xs; /* 0.64 fraction */ |
| 155 | 155 | ||
| @@ -1007,8 +1007,6 @@ void __init time_init(void) | |||
| 1007 | vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; | 1007 | vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; |
| 1008 | vdso_data->tb_to_xs = tb_to_xs; | 1008 | vdso_data->tb_to_xs = tb_to_xs; |
| 1009 | 1009 | ||
| 1010 | time_freq = 0; | ||
| 1011 | |||
| 1012 | write_sequnlock_irqrestore(&xtime_lock, flags); | 1010 | write_sequnlock_irqrestore(&xtime_lock, flags); |
| 1013 | 1011 | ||
| 1014 | /* Register the clocksource, if we're not running on iSeries */ | 1012 | /* Register the clocksource, if we're not running on iSeries */ |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f70e3e3a9fa7..c3f880902d66 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -25,6 +25,18 @@ config X86 | |||
| 25 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) | 25 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) |
| 26 | select HAVE_ARCH_KGDB if !X86_VOYAGER | 26 | select HAVE_ARCH_KGDB if !X86_VOYAGER |
| 27 | 27 | ||
| 28 | config DEFCONFIG_LIST | ||
| 29 | string | ||
| 30 | depends on X86_32 | ||
| 31 | option defconfig_list | ||
| 32 | default "arch/x86/configs/i386_defconfig" | ||
| 33 | |||
| 34 | config DEFCONFIG_LIST | ||
| 35 | string | ||
| 36 | depends on X86_64 | ||
| 37 | option defconfig_list | ||
| 38 | default "arch/x86/configs/x86_64_defconfig" | ||
| 39 | |||
| 28 | 40 | ||
| 29 | config GENERIC_LOCKBREAK | 41 | config GENERIC_LOCKBREAK |
| 30 | def_bool n | 42 | def_bool n |
| @@ -180,7 +192,7 @@ config X86_HT | |||
| 180 | 192 | ||
| 181 | config X86_BIOS_REBOOT | 193 | config X86_BIOS_REBOOT |
| 182 | bool | 194 | bool |
| 183 | depends on X86_32 && !(X86_VISWS || X86_VOYAGER) | 195 | depends on !X86_VISWS && !X86_VOYAGER |
| 184 | default y | 196 | default y |
| 185 | 197 | ||
| 186 | config X86_TRAMPOLINE | 198 | config X86_TRAMPOLINE |
| @@ -1161,7 +1173,7 @@ source kernel/Kconfig.hz | |||
| 1161 | 1173 | ||
| 1162 | config KEXEC | 1174 | config KEXEC |
| 1163 | bool "kexec system call" | 1175 | bool "kexec system call" |
| 1164 | depends on X86_64 || X86_BIOS_REBOOT | 1176 | depends on X86_BIOS_REBOOT |
| 1165 | help | 1177 | help |
| 1166 | kexec is a system call that implements the ability to shutdown your | 1178 | kexec is a system call that implements the ability to shutdown your |
| 1167 | current kernel, and to start another kernel. It is like a reboot | 1179 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 7ef18b01f0bc..2ad6301849a1 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
| @@ -278,11 +278,6 @@ config GENERIC_CPU | |||
| 278 | 278 | ||
| 279 | endchoice | 279 | endchoice |
| 280 | 280 | ||
| 281 | config X86_CPU | ||
| 282 | def_bool y | ||
| 283 | select GENERIC_FIND_FIRST_BIT | ||
| 284 | select GENERIC_FIND_NEXT_BIT | ||
| 285 | |||
| 286 | config X86_GENERIC | 281 | config X86_GENERIC |
| 287 | bool "Generic x86 support" | 282 | bool "Generic x86 support" |
| 288 | depends on X86_32 | 283 | depends on X86_32 |
| @@ -297,6 +292,11 @@ config X86_GENERIC | |||
| 297 | 292 | ||
| 298 | endif | 293 | endif |
| 299 | 294 | ||
| 295 | config X86_CPU | ||
| 296 | def_bool y | ||
| 297 | select GENERIC_FIND_FIRST_BIT | ||
| 298 | select GENERIC_FIND_NEXT_BIT | ||
| 299 | |||
| 300 | # | 300 | # |
| 301 | # Define implied options from the CPU selection here | 301 | # Define implied options from the CPU selection here |
| 302 | config X86_L1_CACHE_BYTES | 302 | config X86_L1_CACHE_BYTES |
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 5b1979a45a1e..ac1e31ba4795 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
| @@ -118,7 +118,6 @@ config DEBUG_NX_TEST | |||
| 118 | config 4KSTACKS | 118 | config 4KSTACKS |
| 119 | bool "Use 4Kb for kernel stacks instead of 8Kb" | 119 | bool "Use 4Kb for kernel stacks instead of 8Kb" |
| 120 | depends on X86_32 | 120 | depends on X86_32 |
| 121 | default y | ||
| 122 | help | 121 | help |
| 123 | If you say Y here the kernel will use a 4Kb stacksize for the | 122 | If you say Y here the kernel will use a 4Kb stacksize for the |
| 124 | kernel stack attached to each process/thread. This facilitates | 123 | kernel stack attached to each process/thread. This facilitates |
| @@ -256,11 +255,9 @@ config CPA_DEBUG | |||
| 256 | help | 255 | help |
| 257 | Do change_page_attr() self-tests every 30 seconds. | 256 | Do change_page_attr() self-tests every 30 seconds. |
| 258 | 257 | ||
| 259 | endmenu | ||
| 260 | |||
| 261 | config OPTIMIZE_INLINING | 258 | config OPTIMIZE_INLINING |
| 262 | bool "Allow gcc to uninline functions marked 'inline'" | 259 | bool "Allow gcc to uninline functions marked 'inline'" |
| 263 | default y | 260 | depends on BROKEN |
| 264 | help | 261 | help |
| 265 | This option determines if the kernel forces gcc to inline the functions | 262 | This option determines if the kernel forces gcc to inline the functions |
| 266 | developers have marked 'inline'. Doing so takes away freedom from gcc to | 263 | developers have marked 'inline'. Doing so takes away freedom from gcc to |
| @@ -270,3 +267,6 @@ config OPTIMIZE_INLINING | |||
| 270 | this algorithm is so good that allowing gcc4 to make the decision can | 267 | this algorithm is so good that allowing gcc4 to make the decision can |
| 271 | become the default in the future, until then this option is there to | 268 | become the default in the future, until then this option is there to |
| 272 | test gcc for this. | 269 | test gcc for this. |
| 270 | |||
| 271 | endmenu | ||
| 272 | |||
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 30d54ed27e55..bbdacb398d48 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
| @@ -40,7 +40,6 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o | |||
| 40 | obj-y += cpu/ | 40 | obj-y += cpu/ |
| 41 | obj-y += acpi/ | 41 | obj-y += acpi/ |
| 42 | obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o | 42 | obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o |
| 43 | obj-$(CONFIG_X86_64) += reboot.o | ||
| 44 | obj-$(CONFIG_MCA) += mca_32.o | 43 | obj-$(CONFIG_MCA) += mca_32.o |
| 45 | obj-$(CONFIG_X86_MSR) += msr.o | 44 | obj-$(CONFIG_X86_MSR) += msr.o |
| 46 | obj-$(CONFIG_X86_CPUID) += cpuid.o | 45 | obj-$(CONFIG_X86_CPUID) += cpuid.o |
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c index 021624c83583..cbaaf69bedb2 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/genapic_64.c | |||
| @@ -83,7 +83,7 @@ unsigned int read_apic_id(void) | |||
| 83 | { | 83 | { |
| 84 | unsigned int id; | 84 | unsigned int id; |
| 85 | 85 | ||
| 86 | WARN_ON(preemptible()); | 86 | WARN_ON(preemptible() && num_online_cpus() > 1); |
| 87 | id = apic_read(APIC_ID); | 87 | id = apic_read(APIC_ID); |
| 88 | if (uv_system_type >= UV_X2APIC) | 88 | if (uv_system_type >= UV_X2APIC) |
| 89 | id |= __get_cpu_var(x2apic_extra_bits); | 89 | id |= __get_cpu_var(x2apic_extra_bits); |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 90f038af3adc..b2cc73768a9d 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
| @@ -656,15 +656,16 @@ int_msg: | |||
| 656 | .asciz "Unknown interrupt or fault at EIP %p %p %p\n" | 656 | .asciz "Unknown interrupt or fault at EIP %p %p %p\n" |
| 657 | 657 | ||
| 658 | fault_msg: | 658 | fault_msg: |
| 659 | .asciz \ | 659 | /* fault info: */ |
| 660 | /* fault info: */ "BUG: Int %d: CR2 %p\n" \ | 660 | .ascii "BUG: Int %d: CR2 %p\n" |
| 661 | /* pusha regs: */ " EDI %p ESI %p EBP %p ESP %p\n" \ | 661 | /* pusha regs: */ |
| 662 | " EBX %p EDX %p ECX %p EAX %p\n" \ | 662 | .ascii " EDI %p ESI %p EBP %p ESP %p\n" |
| 663 | /* fault frame: */ " err %p EIP %p CS %p flg %p\n" \ | 663 | .ascii " EBX %p EDX %p ECX %p EAX %p\n" |
| 664 | \ | 664 | /* fault frame: */ |
| 665 | "Stack: %p %p %p %p %p %p %p %p\n" \ | 665 | .ascii " err %p EIP %p CS %p flg %p\n" |
| 666 | " %p %p %p %p %p %p %p %p\n" \ | 666 | .ascii "Stack: %p %p %p %p %p %p %p %p\n" |
| 667 | " %p %p %p %p %p %p %p %p\n" | 667 | .ascii " %p %p %p %p %p %p %p %p\n" |
| 668 | .asciz " %p %p %p %p %p %p %p %p\n" | ||
| 668 | 669 | ||
| 669 | #include "../../x86/xen/xen-head.S" | 670 | #include "../../x86/xen/xen-head.S" |
| 670 | 671 | ||
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 9007f9ea64ee..9b5cfcdfc426 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -137,9 +137,10 @@ static void hpet_reserve_platform_timers(unsigned long id) | |||
| 137 | hd.hd_irq[0] = HPET_LEGACY_8254; | 137 | hd.hd_irq[0] = HPET_LEGACY_8254; |
| 138 | hd.hd_irq[1] = HPET_LEGACY_RTC; | 138 | hd.hd_irq[1] = HPET_LEGACY_RTC; |
| 139 | 139 | ||
| 140 | for (i = 2; i < nrtimers; timer++, i++) | 140 | for (i = 2; i < nrtimers; timer++, i++) { |
| 141 | hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >> | 141 | hd.hd_irq[i] = (readl(&timer->hpet_config) & Tn_INT_ROUTE_CNF_MASK) >> |
| 142 | Tn_INT_ROUTE_CNF_SHIFT; | 142 | Tn_INT_ROUTE_CNF_SHIFT; |
| 143 | } | ||
| 143 | 144 | ||
| 144 | hpet_alloc(&hd); | 145 | hpet_alloc(&hd); |
| 145 | 146 | ||
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 388b113a7d88..0c37f16b6950 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
| @@ -14,7 +14,7 @@ EXPORT_SYMBOL(forbid_dac); | |||
| 14 | const struct dma_mapping_ops *dma_ops; | 14 | const struct dma_mapping_ops *dma_ops; |
| 15 | EXPORT_SYMBOL(dma_ops); | 15 | EXPORT_SYMBOL(dma_ops); |
| 16 | 16 | ||
| 17 | int iommu_sac_force __read_mostly = 0; | 17 | static int iommu_sac_force __read_mostly; |
| 18 | 18 | ||
| 19 | #ifdef CONFIG_IOMMU_DEBUG | 19 | #ifdef CONFIG_IOMMU_DEBUG |
| 20 | int panic_on_overflow __read_mostly = 1; | 20 | int panic_on_overflow __read_mostly = 1; |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index a4a838306b2c..07c6d42ab5ff 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <asm/desc.h> | 9 | #include <asm/desc.h> |
| 10 | #include <asm/hpet.h> | 10 | #include <asm/hpet.h> |
| 11 | #include <asm/pgtable.h> | 11 | #include <asm/pgtable.h> |
| 12 | #include <asm/proto.h> | ||
| 12 | #include <asm/reboot_fixups.h> | 13 | #include <asm/reboot_fixups.h> |
| 13 | #include <asm/reboot.h> | 14 | #include <asm/reboot.h> |
| 14 | 15 | ||
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 361e31611276..4c943eabacc3 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #include "i8254.h" | 35 | #include "i8254.h" |
| 36 | 36 | ||
| 37 | #ifndef CONFIG_X86_64 | 37 | #ifndef CONFIG_X86_64 |
| 38 | #define mod_64(x, y) ((x) - (y) * div64_64(x, y)) | 38 | #define mod_64(x, y) ((x) - (y) * div64_u64(x, y)) |
| 39 | #else | 39 | #else |
| 40 | #define mod_64(x, y) ((x) % (y)) | 40 | #define mod_64(x, y) ((x) % (y)) |
| 41 | #endif | 41 | #endif |
| @@ -60,8 +60,8 @@ static u64 muldiv64(u64 a, u32 b, u32 c) | |||
| 60 | rl = (u64)u.l.low * (u64)b; | 60 | rl = (u64)u.l.low * (u64)b; |
| 61 | rh = (u64)u.l.high * (u64)b; | 61 | rh = (u64)u.l.high * (u64)b; |
| 62 | rh += (rl >> 32); | 62 | rh += (rl >> 32); |
| 63 | res.l.high = div64_64(rh, c); | 63 | res.l.high = div64_u64(rh, c); |
| 64 | res.l.low = div64_64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c); | 64 | res.l.low = div64_u64(((mod_64(rh, c) << 32) + (rl & 0xffffffff)), c); |
| 65 | return res.ll; | 65 | return res.ll; |
| 66 | } | 66 | } |
| 67 | 67 | ||
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 57ac4e4c556a..36809d79788b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -25,13 +25,13 @@ | |||
| 25 | #include <linux/hrtimer.h> | 25 | #include <linux/hrtimer.h> |
| 26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/math64.h> | ||
| 28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
| 29 | #include <asm/msr.h> | 30 | #include <asm/msr.h> |
| 30 | #include <asm/page.h> | 31 | #include <asm/page.h> |
| 31 | #include <asm/current.h> | 32 | #include <asm/current.h> |
| 32 | #include <asm/apicdef.h> | 33 | #include <asm/apicdef.h> |
| 33 | #include <asm/atomic.h> | 34 | #include <asm/atomic.h> |
| 34 | #include <asm/div64.h> | ||
| 35 | #include "irq.h" | 35 | #include "irq.h" |
| 36 | 36 | ||
| 37 | #define PRId64 "d" | 37 | #define PRId64 "d" |
| @@ -526,8 +526,8 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) | |||
| 526 | } else | 526 | } else |
| 527 | passed = ktime_sub(now, apic->timer.last_update); | 527 | passed = ktime_sub(now, apic->timer.last_update); |
| 528 | 528 | ||
| 529 | counter_passed = div64_64(ktime_to_ns(passed), | 529 | counter_passed = div64_u64(ktime_to_ns(passed), |
| 530 | (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); | 530 | (APIC_BUS_CYCLE_NS * apic->timer.divide_count)); |
| 531 | 531 | ||
| 532 | if (counter_passed > tmcct) { | 532 | if (counter_passed > tmcct) { |
| 533 | if (unlikely(!apic_lvtt_period(apic))) { | 533 | if (unlikely(!apic_lvtt_period(apic))) { |
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c index ecab9fff0fd1..2ad598c104af 100644 --- a/arch/x86/mach-voyager/voyager_cat.c +++ b/arch/x86/mach-voyager/voyager_cat.c | |||
| @@ -877,7 +877,7 @@ void __init voyager_cat_init(void) | |||
| 877 | request_resource(&iomem_resource, res); | 877 | request_resource(&iomem_resource, res); |
| 878 | } | 878 | } |
| 879 | 879 | ||
| 880 | qic_addr = (unsigned long)ioremap(qic_addr, 0x400); | 880 | qic_addr = (unsigned long)ioremap_cache(qic_addr, 0x400); |
| 881 | 881 | ||
| 882 | for (j = 0; j < 4; j++) { | 882 | for (j = 0; j < 4; j++) { |
| 883 | __u8 cpu; | 883 | __u8 cpu; |
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c index 9cf33d3ee5bc..165c871ba9af 100644 --- a/arch/x86/mm/highmem_32.c +++ b/arch/x86/mm/highmem_32.c | |||
| @@ -155,4 +155,3 @@ EXPORT_SYMBOL(kmap); | |||
| 155 | EXPORT_SYMBOL(kunmap); | 155 | EXPORT_SYMBOL(kunmap); |
| 156 | EXPORT_SYMBOL(kmap_atomic); | 156 | EXPORT_SYMBOL(kmap_atomic); |
| 157 | EXPORT_SYMBOL(kunmap_atomic); | 157 | EXPORT_SYMBOL(kunmap_atomic); |
| 158 | EXPORT_SYMBOL(kmap_atomic_to_page); | ||
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 804de18abcc2..71bb3159031a 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
| @@ -149,7 +149,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
| 149 | * Don't allow anybody to remap normal RAM that we're using.. | 149 | * Don't allow anybody to remap normal RAM that we're using.. |
| 150 | */ | 150 | */ |
| 151 | for (pfn = phys_addr >> PAGE_SHIFT; | 151 | for (pfn = phys_addr >> PAGE_SHIFT; |
| 152 | (pfn << PAGE_SHIFT) < last_addr; pfn++) { | 152 | (pfn << PAGE_SHIFT) < (last_addr & PAGE_MASK); |
| 153 | pfn++) { | ||
| 153 | 154 | ||
| 154 | int is_ram = page_is_ram(pfn); | 155 | int is_ram = page_is_ram(pfn); |
| 155 | 156 | ||
| @@ -176,11 +177,11 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
| 176 | /* | 177 | /* |
| 177 | * Do not fallback to certain memory types with certain | 178 | * Do not fallback to certain memory types with certain |
| 178 | * requested type: | 179 | * requested type: |
| 179 | * - request is uncached, return cannot be write-back | 180 | * - request is uc-, return cannot be write-back |
| 180 | * - request is uncached, return cannot be write-combine | 181 | * - request is uc-, return cannot be write-combine |
| 181 | * - request is write-combine, return cannot be write-back | 182 | * - request is write-combine, return cannot be write-back |
| 182 | */ | 183 | */ |
| 183 | if ((prot_val == _PAGE_CACHE_UC && | 184 | if ((prot_val == _PAGE_CACHE_UC_MINUS && |
| 184 | (new_prot_val == _PAGE_CACHE_WB || | 185 | (new_prot_val == _PAGE_CACHE_WB || |
| 185 | new_prot_val == _PAGE_CACHE_WC)) || | 186 | new_prot_val == _PAGE_CACHE_WC)) || |
| 186 | (prot_val == _PAGE_CACHE_WC && | 187 | (prot_val == _PAGE_CACHE_WC && |
| @@ -201,6 +202,9 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
| 201 | default: | 202 | default: |
| 202 | prot = PAGE_KERNEL_NOCACHE; | 203 | prot = PAGE_KERNEL_NOCACHE; |
| 203 | break; | 204 | break; |
| 205 | case _PAGE_CACHE_UC_MINUS: | ||
| 206 | prot = PAGE_KERNEL_UC_MINUS; | ||
| 207 | break; | ||
| 204 | case _PAGE_CACHE_WC: | 208 | case _PAGE_CACHE_WC: |
| 205 | prot = PAGE_KERNEL_WC; | 209 | prot = PAGE_KERNEL_WC; |
| 206 | break; | 210 | break; |
| @@ -255,7 +259,16 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
| 255 | */ | 259 | */ |
| 256 | void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) | 260 | void __iomem *ioremap_nocache(resource_size_t phys_addr, unsigned long size) |
| 257 | { | 261 | { |
| 258 | return __ioremap_caller(phys_addr, size, _PAGE_CACHE_UC, | 262 | /* |
| 263 | * Ideally, this should be: | ||
| 264 | * pat_wc_enabled ? _PAGE_CACHE_UC : _PAGE_CACHE_UC_MINUS; | ||
| 265 | * | ||
| 266 | * Till we fix all X drivers to use ioremap_wc(), we will use | ||
| 267 | * UC MINUS. | ||
| 268 | */ | ||
| 269 | unsigned long val = _PAGE_CACHE_UC_MINUS; | ||
| 270 | |||
| 271 | return __ioremap_caller(phys_addr, size, val, | ||
| 259 | __builtin_return_address(0)); | 272 | __builtin_return_address(0)); |
| 260 | } | 273 | } |
| 261 | EXPORT_SYMBOL(ioremap_nocache); | 274 | EXPORT_SYMBOL(ioremap_nocache); |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index bd5e05c654dc..60bcb5b6a37e 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
| @@ -777,14 +777,20 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages, | |||
| 777 | 777 | ||
| 778 | int _set_memory_uc(unsigned long addr, int numpages) | 778 | int _set_memory_uc(unsigned long addr, int numpages) |
| 779 | { | 779 | { |
| 780 | /* | ||
| 781 | * for now UC MINUS. see comments in ioremap_nocache() | ||
| 782 | */ | ||
| 780 | return change_page_attr_set(addr, numpages, | 783 | return change_page_attr_set(addr, numpages, |
| 781 | __pgprot(_PAGE_CACHE_UC)); | 784 | __pgprot(_PAGE_CACHE_UC_MINUS)); |
| 782 | } | 785 | } |
| 783 | 786 | ||
| 784 | int set_memory_uc(unsigned long addr, int numpages) | 787 | int set_memory_uc(unsigned long addr, int numpages) |
| 785 | { | 788 | { |
| 789 | /* | ||
| 790 | * for now UC MINUS. see comments in ioremap_nocache() | ||
| 791 | */ | ||
| 786 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, | 792 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, |
| 787 | _PAGE_CACHE_UC, NULL)) | 793 | _PAGE_CACHE_UC_MINUS, NULL)) |
| 788 | return -EINVAL; | 794 | return -EINVAL; |
| 789 | 795 | ||
| 790 | return _set_memory_uc(addr, numpages); | 796 | return _set_memory_uc(addr, numpages); |
diff --git a/arch/x86/pci/Makefile_32 b/arch/x86/pci/Makefile_32 index 2a1516efb542..7fa519868d70 100644 --- a/arch/x86/pci/Makefile_32 +++ b/arch/x86/pci/Makefile_32 | |||
| @@ -9,8 +9,8 @@ pci-y := fixup.o | |||
| 9 | pci-$(CONFIG_ACPI) += acpi.o | 9 | pci-$(CONFIG_ACPI) += acpi.o |
| 10 | pci-y += legacy.o irq.o | 10 | pci-y += legacy.o irq.o |
| 11 | 11 | ||
| 12 | pci-$(CONFIG_X86_VISWS) := visws.o fixup.o | 12 | pci-$(CONFIG_X86_VISWS) += visws.o fixup.o |
| 13 | pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o | 13 | pci-$(CONFIG_X86_NUMAQ) += numa.o irq.o |
| 14 | pci-$(CONFIG_NUMA) += mp_bus_to_node.o | 14 | pci-$(CONFIG_NUMA) += mp_bus_to_node.o |
| 15 | 15 | ||
| 16 | obj-y += $(pci-y) common.o early.o | 16 | obj-y += $(pci-y) common.o early.o |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 94f6c73a53d0..8af0f0bae2af 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
| @@ -301,6 +301,13 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
| 301 | prot = pgprot_val(vma->vm_page_prot); | 301 | prot = pgprot_val(vma->vm_page_prot); |
| 302 | if (pat_wc_enabled && write_combine) | 302 | if (pat_wc_enabled && write_combine) |
| 303 | prot |= _PAGE_CACHE_WC; | 303 | prot |= _PAGE_CACHE_WC; |
| 304 | else if (pat_wc_enabled) | ||
| 305 | /* | ||
| 306 | * ioremap() and ioremap_nocache() defaults to UC MINUS for now. | ||
| 307 | * To avoid attribute conflicts, request UC MINUS here | ||
| 308 | * aswell. | ||
| 309 | */ | ||
| 310 | prot |= _PAGE_CACHE_UC_MINUS; | ||
| 304 | else if (boot_cpu_data.x86 > 3) | 311 | else if (boot_cpu_data.x86 > 3) |
| 305 | prot |= _PAGE_CACHE_UC; | 312 | prot |= _PAGE_CACHE_UC; |
| 306 | 313 | ||
| @@ -319,9 +326,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
| 319 | * - request is uncached, return cannot be write-combine | 326 | * - request is uncached, return cannot be write-combine |
| 320 | * - request is write-combine, return cannot be write-back | 327 | * - request is write-combine, return cannot be write-back |
| 321 | */ | 328 | */ |
| 322 | if ((flags == _PAGE_CACHE_UC && | 329 | if ((flags == _PAGE_CACHE_UC_MINUS && |
| 323 | (new_flags == _PAGE_CACHE_WB || | 330 | (new_flags == _PAGE_CACHE_WB)) || |
| 324 | new_flags == _PAGE_CACHE_WC)) || | ||
| 325 | (flags == _PAGE_CACHE_WC && | 331 | (flags == _PAGE_CACHE_WC && |
| 326 | new_flags == _PAGE_CACHE_WB)) { | 332 | new_flags == _PAGE_CACHE_WB)) { |
| 327 | free_memtype(addr, addr+len); | 333 | free_memtype(addr, addr+len); |
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c index e2af8eee80e3..4dceeb1fc5e0 100644 --- a/arch/x86/vdso/vdso32-setup.c +++ b/arch/x86/vdso/vdso32-setup.c | |||
| @@ -303,8 +303,6 @@ int __init sysenter_setup(void) | |||
| 303 | 303 | ||
| 304 | #ifdef CONFIG_X86_32 | 304 | #ifdef CONFIG_X86_32 |
| 305 | gate_vma_init(); | 305 | gate_vma_init(); |
| 306 | |||
| 307 | printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); | ||
| 308 | #endif | 306 | #endif |
| 309 | 307 | ||
| 310 | if (!vdso32_sysenter()) { | 308 | if (!vdso32_sysenter()) { |
diff --git a/block/blk-barrier.c b/block/blk-barrier.c index 66e55288178c..a09ead19f9c5 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c | |||
| @@ -26,8 +26,7 @@ int blk_queue_ordered(struct request_queue *q, unsigned ordered, | |||
| 26 | { | 26 | { |
| 27 | if (ordered & (QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH) && | 27 | if (ordered & (QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH) && |
| 28 | prepare_flush_fn == NULL) { | 28 | prepare_flush_fn == NULL) { |
| 29 | printk(KERN_ERR "%s: prepare_flush_fn required\n", | 29 | printk(KERN_ERR "%s: prepare_flush_fn required\n", __func__); |
| 30 | __FUNCTION__); | ||
| 31 | return -EINVAL; | 30 | return -EINVAL; |
| 32 | } | 31 | } |
| 33 | 32 | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 5d09f8c56024..b754a4a2f9bd 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -136,7 +136,7 @@ static void req_bio_endio(struct request *rq, struct bio *bio, | |||
| 136 | 136 | ||
| 137 | if (unlikely(nbytes > bio->bi_size)) { | 137 | if (unlikely(nbytes > bio->bi_size)) { |
| 138 | printk(KERN_ERR "%s: want %u bytes done, %u left\n", | 138 | printk(KERN_ERR "%s: want %u bytes done, %u left\n", |
| 139 | __FUNCTION__, nbytes, bio->bi_size); | 139 | __func__, nbytes, bio->bi_size); |
| 140 | nbytes = bio->bi_size; | 140 | nbytes = bio->bi_size; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| @@ -1566,8 +1566,7 @@ static int __end_that_request_first(struct request *req, int error, | |||
| 1566 | if (unlikely(bio->bi_idx >= bio->bi_vcnt)) { | 1566 | if (unlikely(bio->bi_idx >= bio->bi_vcnt)) { |
| 1567 | blk_dump_rq_flags(req, "__end_that"); | 1567 | blk_dump_rq_flags(req, "__end_that"); |
| 1568 | printk(KERN_ERR "%s: bio idx %d >= vcnt %d\n", | 1568 | printk(KERN_ERR "%s: bio idx %d >= vcnt %d\n", |
| 1569 | __FUNCTION__, bio->bi_idx, | 1569 | __func__, bio->bi_idx, bio->bi_vcnt); |
| 1570 | bio->bi_vcnt); | ||
| 1571 | break; | 1570 | break; |
| 1572 | } | 1571 | } |
| 1573 | 1572 | ||
diff --git a/block/blk-settings.c b/block/blk-settings.c index 6089384ab064..bb93d4c32775 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
| @@ -168,8 +168,8 @@ void blk_queue_max_sectors(struct request_queue *q, unsigned int max_sectors) | |||
| 168 | { | 168 | { |
| 169 | if ((max_sectors << 9) < PAGE_CACHE_SIZE) { | 169 | if ((max_sectors << 9) < PAGE_CACHE_SIZE) { |
| 170 | max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); | 170 | max_sectors = 1 << (PAGE_CACHE_SHIFT - 9); |
| 171 | printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, | 171 | printk(KERN_INFO "%s: set to minimum %d\n", |
| 172 | max_sectors); | 172 | __func__, max_sectors); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | if (BLK_DEF_MAX_SECTORS > max_sectors) | 175 | if (BLK_DEF_MAX_SECTORS > max_sectors) |
| @@ -196,8 +196,8 @@ void blk_queue_max_phys_segments(struct request_queue *q, | |||
| 196 | { | 196 | { |
| 197 | if (!max_segments) { | 197 | if (!max_segments) { |
| 198 | max_segments = 1; | 198 | max_segments = 1; |
| 199 | printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, | 199 | printk(KERN_INFO "%s: set to minimum %d\n", |
| 200 | max_segments); | 200 | __func__, max_segments); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | q->max_phys_segments = max_segments; | 203 | q->max_phys_segments = max_segments; |
| @@ -220,8 +220,8 @@ void blk_queue_max_hw_segments(struct request_queue *q, | |||
| 220 | { | 220 | { |
| 221 | if (!max_segments) { | 221 | if (!max_segments) { |
| 222 | max_segments = 1; | 222 | max_segments = 1; |
| 223 | printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, | 223 | printk(KERN_INFO "%s: set to minimum %d\n", |
| 224 | max_segments); | 224 | __func__, max_segments); |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | q->max_hw_segments = max_segments; | 227 | q->max_hw_segments = max_segments; |
| @@ -241,8 +241,8 @@ void blk_queue_max_segment_size(struct request_queue *q, unsigned int max_size) | |||
| 241 | { | 241 | { |
| 242 | if (max_size < PAGE_CACHE_SIZE) { | 242 | if (max_size < PAGE_CACHE_SIZE) { |
| 243 | max_size = PAGE_CACHE_SIZE; | 243 | max_size = PAGE_CACHE_SIZE; |
| 244 | printk(KERN_INFO "%s: set to minimum %d\n", __FUNCTION__, | 244 | printk(KERN_INFO "%s: set to minimum %d\n", |
| 245 | max_size); | 245 | __func__, max_size); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | q->max_segment_size = max_size; | 248 | q->max_segment_size = max_size; |
| @@ -357,8 +357,8 @@ void blk_queue_segment_boundary(struct request_queue *q, unsigned long mask) | |||
| 357 | { | 357 | { |
| 358 | if (mask < PAGE_CACHE_SIZE - 1) { | 358 | if (mask < PAGE_CACHE_SIZE - 1) { |
| 359 | mask = PAGE_CACHE_SIZE - 1; | 359 | mask = PAGE_CACHE_SIZE - 1; |
| 360 | printk(KERN_INFO "%s: set to minimum %lx\n", __FUNCTION__, | 360 | printk(KERN_INFO "%s: set to minimum %lx\n", |
| 361 | mask); | 361 | __func__, mask); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | q->seg_boundary_mask = mask; | 364 | q->seg_boundary_mask = mask; |
diff --git a/block/blk-tag.c b/block/blk-tag.c index e176ddbe599e..de64e0429977 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
| @@ -112,7 +112,7 @@ init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth) | |||
| 112 | if (q && depth > q->nr_requests * 2) { | 112 | if (q && depth > q->nr_requests * 2) { |
| 113 | depth = q->nr_requests * 2; | 113 | depth = q->nr_requests * 2; |
| 114 | printk(KERN_ERR "%s: adjusted depth to %d\n", | 114 | printk(KERN_ERR "%s: adjusted depth to %d\n", |
| 115 | __FUNCTION__, depth); | 115 | __func__, depth); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | tag_index = kzalloc(depth * sizeof(struct request *), GFP_ATOMIC); | 118 | tag_index = kzalloc(depth * sizeof(struct request *), GFP_ATOMIC); |
| @@ -296,13 +296,13 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq) | |||
| 296 | 296 | ||
| 297 | if (unlikely(bqt->tag_index[tag] == NULL)) | 297 | if (unlikely(bqt->tag_index[tag] == NULL)) |
| 298 | printk(KERN_ERR "%s: tag %d is missing\n", | 298 | printk(KERN_ERR "%s: tag %d is missing\n", |
| 299 | __FUNCTION__, tag); | 299 | __func__, tag); |
| 300 | 300 | ||
| 301 | bqt->tag_index[tag] = NULL; | 301 | bqt->tag_index[tag] = NULL; |
| 302 | 302 | ||
| 303 | if (unlikely(!test_bit(tag, bqt->tag_map))) { | 303 | if (unlikely(!test_bit(tag, bqt->tag_map))) { |
| 304 | printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", | 304 | printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", |
| 305 | __FUNCTION__, tag); | 305 | __func__, tag); |
| 306 | return; | 306 | return; |
| 307 | } | 307 | } |
| 308 | /* | 308 | /* |
| @@ -340,7 +340,7 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) | |||
| 340 | if (unlikely((rq->cmd_flags & REQ_QUEUED))) { | 340 | if (unlikely((rq->cmd_flags & REQ_QUEUED))) { |
| 341 | printk(KERN_ERR | 341 | printk(KERN_ERR |
| 342 | "%s: request %p for device [%s] already tagged %d", | 342 | "%s: request %p for device [%s] already tagged %d", |
| 343 | __FUNCTION__, rq, | 343 | __func__, rq, |
| 344 | rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->tag); | 344 | rq->rq_disk ? rq->rq_disk->disk_name : "?", rq->tag); |
| 345 | BUG(); | 345 | BUG(); |
| 346 | } | 346 | } |
diff --git a/block/bsg.c b/block/bsg.c index 23ea4fd1a66d..fa796b605f55 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
| @@ -57,7 +57,7 @@ enum { | |||
| 57 | #undef BSG_DEBUG | 57 | #undef BSG_DEBUG |
| 58 | 58 | ||
| 59 | #ifdef BSG_DEBUG | 59 | #ifdef BSG_DEBUG |
| 60 | #define dprintk(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ##args) | 60 | #define dprintk(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ##args) |
| 61 | #else | 61 | #else |
| 62 | #define dprintk(fmt, args...) | 62 | #define dprintk(fmt, args...) |
| 63 | #endif | 63 | #endif |
diff --git a/block/elevator.c b/block/elevator.c index ac5310ef8270..980f8ae147b4 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -650,7 +650,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) | |||
| 650 | 650 | ||
| 651 | default: | 651 | default: |
| 652 | printk(KERN_ERR "%s: bad insertion point %d\n", | 652 | printk(KERN_ERR "%s: bad insertion point %d\n", |
| 653 | __FUNCTION__, where); | 653 | __func__, where); |
| 654 | BUG(); | 654 | BUG(); |
| 655 | } | 655 | } |
| 656 | 656 | ||
| @@ -808,8 +808,7 @@ struct request *elv_next_request(struct request_queue *q) | |||
| 808 | rq->cmd_flags |= REQ_QUIET; | 808 | rq->cmd_flags |= REQ_QUIET; |
| 809 | end_queued_request(rq, 0); | 809 | end_queued_request(rq, 0); |
| 810 | } else { | 810 | } else { |
| 811 | printk(KERN_ERR "%s: bad return=%d\n", __FUNCTION__, | 811 | printk(KERN_ERR "%s: bad return=%d\n", __func__, ret); |
| 812 | ret); | ||
| 813 | break; | 812 | break; |
| 814 | } | 813 | } |
| 815 | } | 814 | } |
diff --git a/crypto/authenc.c b/crypto/authenc.c index ed8ac5a6fa5f..4b226768752a 100644 --- a/crypto/authenc.c +++ b/crypto/authenc.c | |||
| @@ -217,9 +217,10 @@ static void crypto_authenc_givencrypt_done(struct crypto_async_request *req, | |||
| 217 | int err) | 217 | int err) |
| 218 | { | 218 | { |
| 219 | if (!err) { | 219 | if (!err) { |
| 220 | struct aead_givcrypt_request *greq = req->data; | 220 | struct aead_request *areq = req->data; |
| 221 | struct skcipher_givcrypt_request *greq = aead_request_ctx(areq); | ||
| 221 | 222 | ||
| 222 | err = crypto_authenc_genicv(&greq->areq, greq->giv, 0); | 223 | err = crypto_authenc_genicv(areq, greq->giv, 0); |
| 223 | } | 224 | } |
| 224 | 225 | ||
| 225 | aead_request_complete(req->data, err); | 226 | aead_request_complete(req->data, err); |
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 250425263e00..b150de562057 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
| @@ -190,8 +190,10 @@ static struct crypto_instance *cryptd_alloc_instance(struct crypto_alg *alg, | |||
| 190 | int err; | 190 | int err; |
| 191 | 191 | ||
| 192 | inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); | 192 | inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL); |
| 193 | if (IS_ERR(inst)) | 193 | if (!inst) { |
| 194 | inst = ERR_PTR(-ENOMEM); | ||
| 194 | goto out; | 195 | goto out; |
| 196 | } | ||
| 195 | 197 | ||
| 196 | err = -ENAMETOOLONG; | 198 | err = -ENAMETOOLONG; |
| 197 | if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, | 199 | if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, |
diff --git a/crypto/eseqiv.c b/crypto/eseqiv.c index b14f14e314b6..881d30910434 100644 --- a/crypto/eseqiv.c +++ b/crypto/eseqiv.c | |||
| @@ -136,7 +136,8 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req) | |||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | ablkcipher_request_set_crypt(subreq, reqctx->src, dst, | 138 | ablkcipher_request_set_crypt(subreq, reqctx->src, dst, |
| 139 | req->creq.nbytes, req->creq.info); | 139 | req->creq.nbytes + ivsize, |
| 140 | req->creq.info); | ||
| 140 | 141 | ||
| 141 | memcpy(req->creq.info, ctx->salt, ivsize); | 142 | memcpy(req->creq.info, ctx->salt, ivsize); |
| 142 | 143 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f7eb12e55602..5e5dda3a3027 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -1070,7 +1070,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
| 1070 | device_dir->owner = THIS_MODULE; | 1070 | device_dir->owner = THIS_MODULE; |
| 1071 | 1071 | ||
| 1072 | /* 'info' [R] */ | 1072 | /* 'info' [R] */ |
| 1073 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), | 1073 | entry = proc_create_data("info", S_IRUGO, device_dir, |
| 1074 | &acpi_video_device_info_fops, acpi_driver_data(device)); | 1074 | &acpi_video_device_info_fops, acpi_driver_data(device)); |
| 1075 | if (!entry) | 1075 | if (!entry) |
| 1076 | goto err_remove_dir; | 1076 | goto err_remove_dir; |
| @@ -1078,7 +1078,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
| 1078 | /* 'state' [R/W] */ | 1078 | /* 'state' [R/W] */ |
| 1079 | acpi_video_device_state_fops.write = acpi_video_device_write_state; | 1079 | acpi_video_device_state_fops.write = acpi_video_device_write_state; |
| 1080 | entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR, | 1080 | entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR, |
| 1081 | acpi_device_dir(device), | 1081 | device_dir, |
| 1082 | &acpi_video_device_state_fops, | 1082 | &acpi_video_device_state_fops, |
| 1083 | acpi_driver_data(device)); | 1083 | acpi_driver_data(device)); |
| 1084 | if (!entry) | 1084 | if (!entry) |
| @@ -1088,19 +1088,21 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
| 1088 | acpi_video_device_brightness_fops.write = | 1088 | acpi_video_device_brightness_fops.write = |
| 1089 | acpi_video_device_write_brightness; | 1089 | acpi_video_device_write_brightness; |
| 1090 | entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR, | 1090 | entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR, |
| 1091 | acpi_device_dir(device), | 1091 | device_dir, |
| 1092 | &acpi_video_device_brightness_fops, | 1092 | &acpi_video_device_brightness_fops, |
| 1093 | acpi_driver_data(device)); | 1093 | acpi_driver_data(device)); |
| 1094 | if (!entry) | 1094 | if (!entry) |
| 1095 | goto err_remove_state; | 1095 | goto err_remove_state; |
| 1096 | 1096 | ||
| 1097 | /* 'EDID' [R] */ | 1097 | /* 'EDID' [R] */ |
| 1098 | entry = proc_create_data("EDID", S_IRUGO, acpi_device_dir(device), | 1098 | entry = proc_create_data("EDID", S_IRUGO, device_dir, |
| 1099 | &acpi_video_device_EDID_fops, | 1099 | &acpi_video_device_EDID_fops, |
| 1100 | acpi_driver_data(device)); | 1100 | acpi_driver_data(device)); |
| 1101 | if (!entry) | 1101 | if (!entry) |
| 1102 | goto err_remove_brightness; | 1102 | goto err_remove_brightness; |
| 1103 | 1103 | ||
| 1104 | acpi_device_dir(device) = device_dir; | ||
| 1105 | |||
| 1104 | return 0; | 1106 | return 0; |
| 1105 | 1107 | ||
| 1106 | err_remove_brightness: | 1108 | err_remove_brightness: |
| @@ -1346,21 +1348,21 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) | |||
| 1346 | device_dir->owner = THIS_MODULE; | 1348 | device_dir->owner = THIS_MODULE; |
| 1347 | 1349 | ||
| 1348 | /* 'info' [R] */ | 1350 | /* 'info' [R] */ |
| 1349 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), | 1351 | entry = proc_create_data("info", S_IRUGO, device_dir, |
| 1350 | &acpi_video_bus_info_fops, | 1352 | &acpi_video_bus_info_fops, |
| 1351 | acpi_driver_data(device)); | 1353 | acpi_driver_data(device)); |
| 1352 | if (!entry) | 1354 | if (!entry) |
| 1353 | goto err_remove_dir; | 1355 | goto err_remove_dir; |
| 1354 | 1356 | ||
| 1355 | /* 'ROM' [R] */ | 1357 | /* 'ROM' [R] */ |
| 1356 | entry = proc_create_data("ROM", S_IRUGO, acpi_device_dir(device), | 1358 | entry = proc_create_data("ROM", S_IRUGO, device_dir, |
| 1357 | &acpi_video_bus_ROM_fops, | 1359 | &acpi_video_bus_ROM_fops, |
| 1358 | acpi_driver_data(device)); | 1360 | acpi_driver_data(device)); |
| 1359 | if (!entry) | 1361 | if (!entry) |
| 1360 | goto err_remove_info; | 1362 | goto err_remove_info; |
| 1361 | 1363 | ||
| 1362 | /* 'POST_info' [R] */ | 1364 | /* 'POST_info' [R] */ |
| 1363 | entry = proc_create_data("POST_info", S_IRUGO, acpi_device_dir(device), | 1365 | entry = proc_create_data("POST_info", S_IRUGO, device_dir, |
| 1364 | &acpi_video_bus_POST_info_fops, | 1366 | &acpi_video_bus_POST_info_fops, |
| 1365 | acpi_driver_data(device)); | 1367 | acpi_driver_data(device)); |
| 1366 | if (!entry) | 1368 | if (!entry) |
| @@ -1369,7 +1371,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) | |||
| 1369 | /* 'POST' [R/W] */ | 1371 | /* 'POST' [R/W] */ |
| 1370 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; | 1372 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; |
| 1371 | entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, | 1373 | entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, |
| 1372 | acpi_device_dir(device), | 1374 | device_dir, |
| 1373 | &acpi_video_bus_POST_fops, | 1375 | &acpi_video_bus_POST_fops, |
| 1374 | acpi_driver_data(device)); | 1376 | acpi_driver_data(device)); |
| 1375 | if (!entry) | 1377 | if (!entry) |
| @@ -1378,7 +1380,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) | |||
| 1378 | /* 'DOS' [R/W] */ | 1380 | /* 'DOS' [R/W] */ |
| 1379 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; | 1381 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; |
| 1380 | entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, | 1382 | entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, |
| 1381 | acpi_device_dir(device), | 1383 | device_dir, |
| 1382 | &acpi_video_bus_DOS_fops, | 1384 | &acpi_video_bus_DOS_fops, |
| 1383 | acpi_driver_data(device)); | 1385 | acpi_driver_data(device)); |
| 1384 | if (!entry) | 1386 | if (!entry) |
diff --git a/drivers/base/base.h b/drivers/base/base.h index c0444146c09a..2c9ae43e2219 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -64,17 +64,6 @@ extern void sysdev_shutdown(void); | |||
| 64 | extern int sysdev_suspend(pm_message_t state); | 64 | extern int sysdev_suspend(pm_message_t state); |
| 65 | extern int sysdev_resume(void); | 65 | extern int sysdev_resume(void); |
| 66 | 66 | ||
| 67 | static inline struct class_device *to_class_dev(struct kobject *obj) | ||
| 68 | { | ||
| 69 | return container_of(obj, struct class_device, kobj); | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline | ||
| 73 | struct class_device_attribute *to_class_dev_attr(struct attribute *_attr) | ||
| 74 | { | ||
| 75 | return container_of(_attr, struct class_device_attribute, attr); | ||
| 76 | } | ||
| 77 | |||
| 78 | extern char *make_class_name(const char *name, struct kobject *kobj); | 67 | extern char *make_class_name(const char *name, struct kobject *kobj); |
| 79 | 68 | ||
| 80 | extern int devres_release_all(struct device *dev); | 69 | extern int devres_release_all(struct device *dev); |
diff --git a/drivers/base/class.c b/drivers/base/class.c index b4901799308b..0ef00e8d4153 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -179,27 +179,13 @@ static void class_create_release(struct class *cls) | |||
| 179 | kfree(cls); | 179 | kfree(cls); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static void class_device_create_release(struct class_device *class_dev) | ||
| 183 | { | ||
| 184 | pr_debug("%s called for %s\n", __func__, class_dev->class_id); | ||
| 185 | kfree(class_dev); | ||
| 186 | } | ||
| 187 | |||
| 188 | /* needed to allow these devices to have parent class devices */ | ||
| 189 | static int class_device_create_uevent(struct class_device *class_dev, | ||
| 190 | struct kobj_uevent_env *env) | ||
| 191 | { | ||
| 192 | pr_debug("%s called for %s\n", __func__, class_dev->class_id); | ||
| 193 | return 0; | ||
| 194 | } | ||
| 195 | |||
| 196 | /** | 182 | /** |
| 197 | * class_create - create a struct class structure | 183 | * class_create - create a struct class structure |
| 198 | * @owner: pointer to the module that is to "own" this struct class | 184 | * @owner: pointer to the module that is to "own" this struct class |
| 199 | * @name: pointer to a string for the name of this class. | 185 | * @name: pointer to a string for the name of this class. |
| 200 | * | 186 | * |
| 201 | * This is used to create a struct class pointer that can then be used | 187 | * This is used to create a struct class pointer that can then be used |
| 202 | * in calls to class_device_create(). | 188 | * in calls to device_create(). |
| 203 | * | 189 | * |
| 204 | * Note, the pointer created here is to be destroyed when finished by | 190 | * Note, the pointer created here is to be destroyed when finished by |
| 205 | * making a call to class_destroy(). | 191 | * making a call to class_destroy(). |
| @@ -218,7 +204,6 @@ struct class *class_create(struct module *owner, const char *name) | |||
| 218 | cls->name = name; | 204 | cls->name = name; |
| 219 | cls->owner = owner; | 205 | cls->owner = owner; |
| 220 | cls->class_release = class_create_release; | 206 | cls->class_release = class_create_release; |
| 221 | cls->release = class_device_create_release; | ||
| 222 | 207 | ||
| 223 | retval = class_register(cls); | 208 | retval = class_register(cls); |
| 224 | if (retval) | 209 | if (retval) |
| @@ -246,113 +231,6 @@ void class_destroy(struct class *cls) | |||
| 246 | class_unregister(cls); | 231 | class_unregister(cls); |
| 247 | } | 232 | } |
| 248 | 233 | ||
| 249 | /* Class Device Stuff */ | ||
| 250 | |||
| 251 | int class_device_create_file(struct class_device *class_dev, | ||
| 252 | const struct class_device_attribute *attr) | ||
| 253 | { | ||
| 254 | int error = -EINVAL; | ||
| 255 | if (class_dev) | ||
| 256 | error = sysfs_create_file(&class_dev->kobj, &attr->attr); | ||
| 257 | return error; | ||
| 258 | } | ||
| 259 | |||
| 260 | void class_device_remove_file(struct class_device *class_dev, | ||
| 261 | const struct class_device_attribute *attr) | ||
| 262 | { | ||
| 263 | if (class_dev) | ||
| 264 | sysfs_remove_file(&class_dev->kobj, &attr->attr); | ||
| 265 | } | ||
| 266 | |||
| 267 | int class_device_create_bin_file(struct class_device *class_dev, | ||
| 268 | struct bin_attribute *attr) | ||
| 269 | { | ||
| 270 | int error = -EINVAL; | ||
| 271 | if (class_dev) | ||
| 272 | error = sysfs_create_bin_file(&class_dev->kobj, attr); | ||
| 273 | return error; | ||
| 274 | } | ||
| 275 | |||
| 276 | void class_device_remove_bin_file(struct class_device *class_dev, | ||
| 277 | struct bin_attribute *attr) | ||
| 278 | { | ||
| 279 | if (class_dev) | ||
| 280 | sysfs_remove_bin_file(&class_dev->kobj, attr); | ||
| 281 | } | ||
| 282 | |||
| 283 | static ssize_t class_device_attr_show(struct kobject *kobj, | ||
| 284 | struct attribute *attr, char *buf) | ||
| 285 | { | ||
| 286 | struct class_device_attribute *class_dev_attr = to_class_dev_attr(attr); | ||
| 287 | struct class_device *cd = to_class_dev(kobj); | ||
| 288 | ssize_t ret = 0; | ||
| 289 | |||
| 290 | if (class_dev_attr->show) | ||
| 291 | ret = class_dev_attr->show(cd, buf); | ||
| 292 | return ret; | ||
| 293 | } | ||
| 294 | |||
| 295 | static ssize_t class_device_attr_store(struct kobject *kobj, | ||
| 296 | struct attribute *attr, | ||
| 297 | const char *buf, size_t count) | ||
| 298 | { | ||
| 299 | struct class_device_attribute *class_dev_attr = to_class_dev_attr(attr); | ||
| 300 | struct class_device *cd = to_class_dev(kobj); | ||
| 301 | ssize_t ret = 0; | ||
| 302 | |||
| 303 | if (class_dev_attr->store) | ||
| 304 | ret = class_dev_attr->store(cd, buf, count); | ||
| 305 | return ret; | ||
| 306 | } | ||
| 307 | |||
| 308 | static struct sysfs_ops class_dev_sysfs_ops = { | ||
| 309 | .show = class_device_attr_show, | ||
| 310 | .store = class_device_attr_store, | ||
| 311 | }; | ||
| 312 | |||
| 313 | static void class_dev_release(struct kobject *kobj) | ||
| 314 | { | ||
| 315 | struct class_device *cd = to_class_dev(kobj); | ||
| 316 | struct class *cls = cd->class; | ||
| 317 | |||
| 318 | pr_debug("device class '%s': release.\n", cd->class_id); | ||
| 319 | |||
| 320 | if (cd->release) | ||
| 321 | cd->release(cd); | ||
| 322 | else if (cls->release) | ||
| 323 | cls->release(cd); | ||
| 324 | else { | ||
| 325 | printk(KERN_ERR "Class Device '%s' does not have a release() " | ||
| 326 | "function, it is broken and must be fixed.\n", | ||
| 327 | cd->class_id); | ||
| 328 | WARN_ON(1); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | |||
| 332 | static struct kobj_type class_device_ktype = { | ||
| 333 | .sysfs_ops = &class_dev_sysfs_ops, | ||
| 334 | .release = class_dev_release, | ||
| 335 | }; | ||
| 336 | |||
| 337 | static int class_uevent_filter(struct kset *kset, struct kobject *kobj) | ||
| 338 | { | ||
| 339 | struct kobj_type *ktype = get_ktype(kobj); | ||
| 340 | |||
| 341 | if (ktype == &class_device_ktype) { | ||
| 342 | struct class_device *class_dev = to_class_dev(kobj); | ||
| 343 | if (class_dev->class) | ||
| 344 | return 1; | ||
| 345 | } | ||
| 346 | return 0; | ||
| 347 | } | ||
| 348 | |||
| 349 | static const char *class_uevent_name(struct kset *kset, struct kobject *kobj) | ||
| 350 | { | ||
| 351 | struct class_device *class_dev = to_class_dev(kobj); | ||
| 352 | |||
| 353 | return class_dev->class->name; | ||
| 354 | } | ||
| 355 | |||
| 356 | #ifdef CONFIG_SYSFS_DEPRECATED | 234 | #ifdef CONFIG_SYSFS_DEPRECATED |
| 357 | char *make_class_name(const char *name, struct kobject *kobj) | 235 | char *make_class_name(const char *name, struct kobject *kobj) |
| 358 | { | 236 | { |
| @@ -370,445 +248,8 @@ char *make_class_name(const char *name, struct kobject *kobj) | |||
| 370 | strcat(class_name, kobject_name(kobj)); | 248 | strcat(class_name, kobject_name(kobj)); |
| 371 | return class_name; | 249 | return class_name; |
| 372 | } | 250 | } |
| 373 | |||
| 374 | static int make_deprecated_class_device_links(struct class_device *class_dev) | ||
| 375 | { | ||
| 376 | char *class_name; | ||
| 377 | int error; | ||
| 378 | |||
| 379 | if (!class_dev->dev) | ||
| 380 | return 0; | ||
| 381 | |||
| 382 | class_name = make_class_name(class_dev->class->name, &class_dev->kobj); | ||
| 383 | if (class_name) | ||
| 384 | error = sysfs_create_link(&class_dev->dev->kobj, | ||
| 385 | &class_dev->kobj, class_name); | ||
| 386 | else | ||
| 387 | error = -ENOMEM; | ||
| 388 | kfree(class_name); | ||
| 389 | return error; | ||
| 390 | } | ||
| 391 | |||
| 392 | static void remove_deprecated_class_device_links(struct class_device *class_dev) | ||
| 393 | { | ||
| 394 | char *class_name; | ||
| 395 | |||
| 396 | if (!class_dev->dev) | ||
| 397 | return; | ||
| 398 | |||
| 399 | class_name = make_class_name(class_dev->class->name, &class_dev->kobj); | ||
| 400 | if (class_name) | ||
| 401 | sysfs_remove_link(&class_dev->dev->kobj, class_name); | ||
| 402 | kfree(class_name); | ||
| 403 | } | ||
| 404 | #else | ||
| 405 | static inline int make_deprecated_class_device_links(struct class_device *cd) | ||
| 406 | { return 0; } | ||
| 407 | static void remove_deprecated_class_device_links(struct class_device *cd) | ||
| 408 | { } | ||
| 409 | #endif | 251 | #endif |
| 410 | 252 | ||
| 411 | static int class_uevent(struct kset *kset, struct kobject *kobj, | ||
| 412 | struct kobj_uevent_env *env) | ||
| 413 | { | ||
| 414 | struct class_device *class_dev = to_class_dev(kobj); | ||
| 415 | struct device *dev = class_dev->dev; | ||
| 416 | int retval = 0; | ||
| 417 | |||
| 418 | pr_debug("%s - name = %s\n", __func__, class_dev->class_id); | ||
| 419 | |||
| 420 | if (MAJOR(class_dev->devt)) { | ||
| 421 | add_uevent_var(env, "MAJOR=%u", MAJOR(class_dev->devt)); | ||
| 422 | |||
| 423 | add_uevent_var(env, "MINOR=%u", MINOR(class_dev->devt)); | ||
| 424 | } | ||
| 425 | |||
| 426 | if (dev) { | ||
| 427 | const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); | ||
| 428 | if (path) { | ||
| 429 | add_uevent_var(env, "PHYSDEVPATH=%s", path); | ||
| 430 | kfree(path); | ||
| 431 | } | ||
| 432 | |||
| 433 | if (dev->bus) | ||
| 434 | add_uevent_var(env, "PHYSDEVBUS=%s", dev->bus->name); | ||
| 435 | |||
| 436 | if (dev->driver) | ||
| 437 | add_uevent_var(env, "PHYSDEVDRIVER=%s", | ||
| 438 | dev->driver->name); | ||
| 439 | } | ||
| 440 | |||
| 441 | if (class_dev->uevent) { | ||
| 442 | /* have the class device specific function add its stuff */ | ||
| 443 | retval = class_dev->uevent(class_dev, env); | ||
| 444 | if (retval) | ||
| 445 | pr_debug("class_dev->uevent() returned %d\n", retval); | ||
| 446 | } else if (class_dev->class->uevent) { | ||
| 447 | /* have the class specific function add its stuff */ | ||
| 448 | retval = class_dev->class->uevent(class_dev, env); | ||
| 449 | if (retval) | ||
| 450 | pr_debug("class->uevent() returned %d\n", retval); | ||
| 451 | } | ||
| 452 | |||
| 453 | return retval; | ||
| 454 | } | ||
| 455 | |||
| 456 | static struct kset_uevent_ops class_uevent_ops = { | ||
| 457 | .filter = class_uevent_filter, | ||
| 458 | .name = class_uevent_name, | ||
| 459 | .uevent = class_uevent, | ||
| 460 | }; | ||
| 461 | |||
| 462 | /* | ||
| 463 | * DO NOT copy how this is created, kset_create_and_add() should be | ||
| 464 | * called, but this is a hold-over from the old-way and will be deleted | ||
| 465 | * entirely soon. | ||
| 466 | */ | ||
| 467 | static struct kset class_obj_subsys = { | ||
| 468 | .uevent_ops = &class_uevent_ops, | ||
| 469 | }; | ||
| 470 | |||
| 471 | static int class_device_add_attrs(struct class_device *cd) | ||
| 472 | { | ||
| 473 | int i; | ||
| 474 | int error = 0; | ||
| 475 | struct class *cls = cd->class; | ||
| 476 | |||
| 477 | if (cls->class_dev_attrs) { | ||
| 478 | for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) { | ||
| 479 | error = class_device_create_file(cd, | ||
| 480 | &cls->class_dev_attrs[i]); | ||
| 481 | if (error) | ||
| 482 | goto err; | ||
| 483 | } | ||
| 484 | } | ||
| 485 | done: | ||
| 486 | return error; | ||
| 487 | err: | ||
| 488 | while (--i >= 0) | ||
| 489 | class_device_remove_file(cd, &cls->class_dev_attrs[i]); | ||
| 490 | goto done; | ||
| 491 | } | ||
| 492 | |||
| 493 | static void class_device_remove_attrs(struct class_device *cd) | ||
| 494 | { | ||
| 495 | int i; | ||
| 496 | struct class *cls = cd->class; | ||
| 497 | |||
| 498 | if (cls->class_dev_attrs) { | ||
| 499 | for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) | ||
| 500 | class_device_remove_file(cd, &cls->class_dev_attrs[i]); | ||
| 501 | } | ||
| 502 | } | ||
| 503 | |||
| 504 | static int class_device_add_groups(struct class_device *cd) | ||
| 505 | { | ||
| 506 | int i; | ||
| 507 | int error = 0; | ||
| 508 | |||
| 509 | if (cd->groups) { | ||
| 510 | for (i = 0; cd->groups[i]; i++) { | ||
| 511 | error = sysfs_create_group(&cd->kobj, cd->groups[i]); | ||
| 512 | if (error) { | ||
| 513 | while (--i >= 0) | ||
| 514 | sysfs_remove_group(&cd->kobj, | ||
| 515 | cd->groups[i]); | ||
| 516 | goto out; | ||
| 517 | } | ||
| 518 | } | ||
| 519 | } | ||
| 520 | out: | ||
| 521 | return error; | ||
| 522 | } | ||
| 523 | |||
| 524 | static void class_device_remove_groups(struct class_device *cd) | ||
| 525 | { | ||
| 526 | int i; | ||
| 527 | if (cd->groups) | ||
| 528 | for (i = 0; cd->groups[i]; i++) | ||
| 529 | sysfs_remove_group(&cd->kobj, cd->groups[i]); | ||
| 530 | } | ||
| 531 | |||
| 532 | static ssize_t show_dev(struct class_device *class_dev, char *buf) | ||
| 533 | { | ||
| 534 | return print_dev_t(buf, class_dev->devt); | ||
| 535 | } | ||
| 536 | |||
| 537 | static struct class_device_attribute class_devt_attr = | ||
| 538 | __ATTR(dev, S_IRUGO, show_dev, NULL); | ||
| 539 | |||
| 540 | static ssize_t store_uevent(struct class_device *class_dev, | ||
| 541 | const char *buf, size_t count) | ||
| 542 | { | ||
| 543 | kobject_uevent(&class_dev->kobj, KOBJ_ADD); | ||
| 544 | return count; | ||
| 545 | } | ||
| 546 | |||
| 547 | static struct class_device_attribute class_uevent_attr = | ||
| 548 | __ATTR(uevent, S_IWUSR, NULL, store_uevent); | ||
| 549 | |||
| 550 | void class_device_initialize(struct class_device *class_dev) | ||
| 551 | { | ||
| 552 | class_dev->kobj.kset = &class_obj_subsys; | ||
| 553 | kobject_init(&class_dev->kobj, &class_device_ktype); | ||
| 554 | INIT_LIST_HEAD(&class_dev->node); | ||
| 555 | } | ||
| 556 | |||
| 557 | int class_device_add(struct class_device *class_dev) | ||
| 558 | { | ||
| 559 | struct class *parent_class = NULL; | ||
| 560 | struct class_device *parent_class_dev = NULL; | ||
| 561 | struct class_interface *class_intf; | ||
| 562 | int error = -EINVAL; | ||
| 563 | |||
| 564 | class_dev = class_device_get(class_dev); | ||
| 565 | if (!class_dev) | ||
| 566 | return -EINVAL; | ||
| 567 | |||
| 568 | if (!strlen(class_dev->class_id)) | ||
| 569 | goto out1; | ||
| 570 | |||
| 571 | parent_class = class_get(class_dev->class); | ||
| 572 | if (!parent_class) | ||
| 573 | goto out1; | ||
| 574 | |||
| 575 | parent_class_dev = class_device_get(class_dev->parent); | ||
| 576 | |||
| 577 | pr_debug("CLASS: registering class device: ID = '%s'\n", | ||
| 578 | class_dev->class_id); | ||
| 579 | |||
| 580 | /* first, register with generic layer. */ | ||
| 581 | if (parent_class_dev) | ||
| 582 | class_dev->kobj.parent = &parent_class_dev->kobj; | ||
| 583 | else | ||
| 584 | class_dev->kobj.parent = &parent_class->subsys.kobj; | ||
| 585 | |||
| 586 | error = kobject_add(&class_dev->kobj, class_dev->kobj.parent, | ||
| 587 | "%s", class_dev->class_id); | ||
| 588 | if (error) | ||
| 589 | goto out2; | ||
| 590 | |||
| 591 | /* add the needed attributes to this device */ | ||
| 592 | error = sysfs_create_link(&class_dev->kobj, | ||
| 593 | &parent_class->subsys.kobj, "subsystem"); | ||
| 594 | if (error) | ||
| 595 | goto out3; | ||
| 596 | |||
| 597 | error = class_device_create_file(class_dev, &class_uevent_attr); | ||
| 598 | if (error) | ||
| 599 | goto out3; | ||
| 600 | |||
| 601 | if (MAJOR(class_dev->devt)) { | ||
| 602 | error = class_device_create_file(class_dev, &class_devt_attr); | ||
| 603 | if (error) | ||
| 604 | goto out4; | ||
| 605 | } | ||
| 606 | |||
| 607 | error = class_device_add_attrs(class_dev); | ||
| 608 | if (error) | ||
| 609 | goto out5; | ||
| 610 | |||
| 611 | if (class_dev->dev) { | ||
| 612 | error = sysfs_create_link(&class_dev->kobj, | ||
| 613 | &class_dev->dev->kobj, "device"); | ||
| 614 | if (error) | ||
| 615 | goto out6; | ||
| 616 | } | ||
| 617 | |||
| 618 | error = class_device_add_groups(class_dev); | ||
| 619 | if (error) | ||
| 620 | goto out7; | ||
| 621 | |||
| 622 | error = make_deprecated_class_device_links(class_dev); | ||
| 623 | if (error) | ||
| 624 | goto out8; | ||
| 625 | |||
| 626 | kobject_uevent(&class_dev->kobj, KOBJ_ADD); | ||
| 627 | |||
| 628 | /* notify any interfaces this device is now here */ | ||
| 629 | down(&parent_class->sem); | ||
| 630 | list_add_tail(&class_dev->node, &parent_class->children); | ||
| 631 | list_for_each_entry(class_intf, &parent_class->interfaces, node) { | ||
| 632 | if (class_intf->add) | ||
| 633 | class_intf->add(class_dev, class_intf); | ||
| 634 | } | ||
| 635 | up(&parent_class->sem); | ||
| 636 | |||
| 637 | goto out1; | ||
| 638 | |||
| 639 | out8: | ||
| 640 | class_device_remove_groups(class_dev); | ||
| 641 | out7: | ||
| 642 | if (class_dev->dev) | ||
| 643 | sysfs_remove_link(&class_dev->kobj, "device"); | ||
| 644 | out6: | ||
| 645 | class_device_remove_attrs(class_dev); | ||
| 646 | out5: | ||
| 647 | if (MAJOR(class_dev->devt)) | ||
| 648 | class_device_remove_file(class_dev, &class_devt_attr); | ||
| 649 | out4: | ||
| 650 | class_device_remove_file(class_dev, &class_uevent_attr); | ||
| 651 | out3: | ||
| 652 | kobject_del(&class_dev->kobj); | ||
| 653 | out2: | ||
| 654 | if (parent_class_dev) | ||
| 655 | class_device_put(parent_class_dev); | ||
| 656 | class_put(parent_class); | ||
| 657 | out1: | ||
| 658 | class_device_put(class_dev); | ||
| 659 | return error; | ||
| 660 | } | ||
| 661 | |||
| 662 | int class_device_register(struct class_device *class_dev) | ||
| 663 | { | ||
| 664 | class_device_initialize(class_dev); | ||
| 665 | return class_device_add(class_dev); | ||
| 666 | } | ||
| 667 | |||
| 668 | /** | ||
| 669 | * class_device_create - creates a class device and registers it with sysfs | ||
| 670 | * @cls: pointer to the struct class that this device should be registered to. | ||
| 671 | * @parent: pointer to the parent struct class_device of this new device, if | ||
| 672 | * any. | ||
| 673 | * @devt: the dev_t for the char device to be added. | ||
| 674 | * @device: a pointer to a struct device that is assiociated with this class | ||
| 675 | * device. | ||
| 676 | * @fmt: string for the class device's name | ||
| 677 | * | ||
| 678 | * This function can be used by char device classes. A struct | ||
| 679 | * class_device will be created in sysfs, registered to the specified | ||
| 680 | * class. | ||
| 681 | * A "dev" file will be created, showing the dev_t for the device, if | ||
| 682 | * the dev_t is not 0,0. | ||
| 683 | * If a pointer to a parent struct class_device is passed in, the newly | ||
| 684 | * created struct class_device will be a child of that device in sysfs. | ||
| 685 | * The pointer to the struct class_device will be returned from the | ||
| 686 | * call. Any further sysfs files that might be required can be created | ||
| 687 | * using this pointer. | ||
| 688 | * | ||
| 689 | * Note: the struct class passed to this function must have previously | ||
| 690 | * been created with a call to class_create(). | ||
| 691 | */ | ||
| 692 | struct class_device *class_device_create(struct class *cls, | ||
| 693 | struct class_device *parent, | ||
| 694 | dev_t devt, | ||
| 695 | struct device *device, | ||
| 696 | const char *fmt, ...) | ||
| 697 | { | ||
| 698 | va_list args; | ||
| 699 | struct class_device *class_dev = NULL; | ||
| 700 | int retval = -ENODEV; | ||
| 701 | |||
| 702 | if (cls == NULL || IS_ERR(cls)) | ||
| 703 | goto error; | ||
| 704 | |||
| 705 | class_dev = kzalloc(sizeof(*class_dev), GFP_KERNEL); | ||
| 706 | if (!class_dev) { | ||
| 707 | retval = -ENOMEM; | ||
| 708 | goto error; | ||
| 709 | } | ||
| 710 | |||
| 711 | class_dev->devt = devt; | ||
| 712 | class_dev->dev = device; | ||
| 713 | class_dev->class = cls; | ||
| 714 | class_dev->parent = parent; | ||
| 715 | class_dev->release = class_device_create_release; | ||
| 716 | class_dev->uevent = class_device_create_uevent; | ||
| 717 | |||
| 718 | va_start(args, fmt); | ||
| 719 | vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); | ||
| 720 | va_end(args); | ||
| 721 | retval = class_device_register(class_dev); | ||
| 722 | if (retval) | ||
| 723 | goto error; | ||
| 724 | |||
| 725 | return class_dev; | ||
| 726 | |||
| 727 | error: | ||
| 728 | kfree(class_dev); | ||
| 729 | return ERR_PTR(retval); | ||
| 730 | } | ||
| 731 | |||
| 732 | void class_device_del(struct class_device *class_dev) | ||
| 733 | { | ||
| 734 | struct class *parent_class = class_dev->class; | ||
| 735 | struct class_device *parent_device = class_dev->parent; | ||
| 736 | struct class_interface *class_intf; | ||
| 737 | |||
| 738 | if (parent_class) { | ||
| 739 | down(&parent_class->sem); | ||
| 740 | list_del_init(&class_dev->node); | ||
| 741 | list_for_each_entry(class_intf, &parent_class->interfaces, node) | ||
| 742 | if (class_intf->remove) | ||
| 743 | class_intf->remove(class_dev, class_intf); | ||
| 744 | up(&parent_class->sem); | ||
| 745 | } | ||
| 746 | |||
| 747 | if (class_dev->dev) { | ||
| 748 | remove_deprecated_class_device_links(class_dev); | ||
| 749 | sysfs_remove_link(&class_dev->kobj, "device"); | ||
| 750 | } | ||
| 751 | sysfs_remove_link(&class_dev->kobj, "subsystem"); | ||
| 752 | class_device_remove_file(class_dev, &class_uevent_attr); | ||
| 753 | if (MAJOR(class_dev->devt)) | ||
| 754 | class_device_remove_file(class_dev, &class_devt_attr); | ||
| 755 | class_device_remove_attrs(class_dev); | ||
| 756 | class_device_remove_groups(class_dev); | ||
| 757 | |||
| 758 | kobject_uevent(&class_dev->kobj, KOBJ_REMOVE); | ||
| 759 | kobject_del(&class_dev->kobj); | ||
| 760 | |||
| 761 | class_device_put(parent_device); | ||
| 762 | class_put(parent_class); | ||
| 763 | } | ||
| 764 | |||
| 765 | void class_device_unregister(struct class_device *class_dev) | ||
| 766 | { | ||
| 767 | pr_debug("CLASS: Unregistering class device. ID = '%s'\n", | ||
| 768 | class_dev->class_id); | ||
| 769 | class_device_del(class_dev); | ||
| 770 | class_device_put(class_dev); | ||
| 771 | } | ||
| 772 | |||
| 773 | /** | ||
| 774 | * class_device_destroy - removes a class device that was created with class_device_create() | ||
| 775 | * @cls: the pointer to the struct class that this device was registered * with. | ||
| 776 | * @devt: the dev_t of the device that was previously registered. | ||
| 777 | * | ||
| 778 | * This call unregisters and cleans up a class device that was created with a | ||
| 779 | * call to class_device_create() | ||
| 780 | */ | ||
| 781 | void class_device_destroy(struct class *cls, dev_t devt) | ||
| 782 | { | ||
| 783 | struct class_device *class_dev = NULL; | ||
| 784 | struct class_device *class_dev_tmp; | ||
| 785 | |||
| 786 | down(&cls->sem); | ||
| 787 | list_for_each_entry(class_dev_tmp, &cls->children, node) { | ||
| 788 | if (class_dev_tmp->devt == devt) { | ||
| 789 | class_dev = class_dev_tmp; | ||
| 790 | break; | ||
| 791 | } | ||
| 792 | } | ||
| 793 | up(&cls->sem); | ||
| 794 | |||
| 795 | if (class_dev) | ||
| 796 | class_device_unregister(class_dev); | ||
| 797 | } | ||
| 798 | |||
| 799 | struct class_device *class_device_get(struct class_device *class_dev) | ||
| 800 | { | ||
| 801 | if (class_dev) | ||
| 802 | return to_class_dev(kobject_get(&class_dev->kobj)); | ||
| 803 | return NULL; | ||
| 804 | } | ||
| 805 | |||
| 806 | void class_device_put(struct class_device *class_dev) | ||
| 807 | { | ||
| 808 | if (class_dev) | ||
| 809 | kobject_put(&class_dev->kobj); | ||
| 810 | } | ||
| 811 | |||
| 812 | /** | 253 | /** |
| 813 | * class_for_each_device - device iterator | 254 | * class_for_each_device - device iterator |
| 814 | * @class: the class we're iterating | 255 | * @class: the class we're iterating |
| @@ -897,56 +338,9 @@ struct device *class_find_device(struct class *class, void *data, | |||
| 897 | } | 338 | } |
| 898 | EXPORT_SYMBOL_GPL(class_find_device); | 339 | EXPORT_SYMBOL_GPL(class_find_device); |
| 899 | 340 | ||
| 900 | /** | ||
| 901 | * class_find_child - device iterator for locating a particular class_device | ||
| 902 | * @class: the class we're iterating | ||
| 903 | * @data: data for the match function | ||
| 904 | * @match: function to check class_device | ||
| 905 | * | ||
| 906 | * This function returns a reference to a class_device that is 'found' for | ||
| 907 | * later use, as determined by the @match callback. | ||
| 908 | * | ||
| 909 | * The callback should return 0 if the class_device doesn't match and non-zero | ||
| 910 | * if it does. If the callback returns non-zero, this function will | ||
| 911 | * return to the caller and not iterate over any more class_devices. | ||
| 912 | * | ||
| 913 | * Note, you will need to drop the reference with class_device_put() after use. | ||
| 914 | * | ||
| 915 | * We hold class->sem in this function, so it can not be | ||
| 916 | * re-acquired in @match, otherwise it will self-deadlocking. For | ||
| 917 | * example, calls to add or remove class members would be verboten. | ||
| 918 | */ | ||
| 919 | struct class_device *class_find_child(struct class *class, void *data, | ||
| 920 | int (*match)(struct class_device *, void *)) | ||
| 921 | { | ||
| 922 | struct class_device *dev; | ||
| 923 | int found = 0; | ||
| 924 | |||
| 925 | if (!class) | ||
| 926 | return NULL; | ||
| 927 | |||
| 928 | down(&class->sem); | ||
| 929 | list_for_each_entry(dev, &class->children, node) { | ||
| 930 | dev = class_device_get(dev); | ||
| 931 | if (dev) { | ||
| 932 | if (match(dev, data)) { | ||
| 933 | found = 1; | ||
| 934 | break; | ||
| 935 | } else | ||
| 936 | class_device_put(dev); | ||
| 937 | } else | ||
| 938 | break; | ||
| 939 | } | ||
| 940 | up(&class->sem); | ||
| 941 | |||
| 942 | return found ? dev : NULL; | ||
| 943 | } | ||
| 944 | EXPORT_SYMBOL_GPL(class_find_child); | ||
| 945 | |||
| 946 | int class_interface_register(struct class_interface *class_intf) | 341 | int class_interface_register(struct class_interface *class_intf) |
| 947 | { | 342 | { |
| 948 | struct class *parent; | 343 | struct class *parent; |
| 949 | struct class_device *class_dev; | ||
| 950 | struct device *dev; | 344 | struct device *dev; |
| 951 | 345 | ||
| 952 | if (!class_intf || !class_intf->class) | 346 | if (!class_intf || !class_intf->class) |
| @@ -958,10 +352,6 @@ int class_interface_register(struct class_interface *class_intf) | |||
| 958 | 352 | ||
| 959 | down(&parent->sem); | 353 | down(&parent->sem); |
| 960 | list_add_tail(&class_intf->node, &parent->interfaces); | 354 | list_add_tail(&class_intf->node, &parent->interfaces); |
| 961 | if (class_intf->add) { | ||
| 962 | list_for_each_entry(class_dev, &parent->children, node) | ||
| 963 | class_intf->add(class_dev, class_intf); | ||
| 964 | } | ||
| 965 | if (class_intf->add_dev) { | 355 | if (class_intf->add_dev) { |
| 966 | list_for_each_entry(dev, &parent->devices, node) | 356 | list_for_each_entry(dev, &parent->devices, node) |
| 967 | class_intf->add_dev(dev, class_intf); | 357 | class_intf->add_dev(dev, class_intf); |
| @@ -974,7 +364,6 @@ int class_interface_register(struct class_interface *class_intf) | |||
| 974 | void class_interface_unregister(struct class_interface *class_intf) | 364 | void class_interface_unregister(struct class_interface *class_intf) |
| 975 | { | 365 | { |
| 976 | struct class *parent = class_intf->class; | 366 | struct class *parent = class_intf->class; |
| 977 | struct class_device *class_dev; | ||
| 978 | struct device *dev; | 367 | struct device *dev; |
| 979 | 368 | ||
| 980 | if (!parent) | 369 | if (!parent) |
| @@ -982,10 +371,6 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
| 982 | 371 | ||
| 983 | down(&parent->sem); | 372 | down(&parent->sem); |
| 984 | list_del_init(&class_intf->node); | 373 | list_del_init(&class_intf->node); |
| 985 | if (class_intf->remove) { | ||
| 986 | list_for_each_entry(class_dev, &parent->children, node) | ||
| 987 | class_intf->remove(class_dev, class_intf); | ||
| 988 | } | ||
| 989 | if (class_intf->remove_dev) { | 374 | if (class_intf->remove_dev) { |
| 990 | list_for_each_entry(dev, &parent->devices, node) | 375 | list_for_each_entry(dev, &parent->devices, node) |
| 991 | class_intf->remove_dev(dev, class_intf); | 376 | class_intf->remove_dev(dev, class_intf); |
| @@ -1000,13 +385,6 @@ int __init classes_init(void) | |||
| 1000 | class_kset = kset_create_and_add("class", NULL, NULL); | 385 | class_kset = kset_create_and_add("class", NULL, NULL); |
| 1001 | if (!class_kset) | 386 | if (!class_kset) |
| 1002 | return -ENOMEM; | 387 | return -ENOMEM; |
| 1003 | |||
| 1004 | /* ick, this is ugly, the things we go through to keep from showing up | ||
| 1005 | * in sysfs... */ | ||
| 1006 | kset_init(&class_obj_subsys); | ||
| 1007 | kobject_set_name(&class_obj_subsys.kobj, "class_obj"); | ||
| 1008 | if (!class_obj_subsys.kobj.parent) | ||
| 1009 | class_obj_subsys.kobj.parent = &class_obj_subsys.kobj; | ||
| 1010 | return 0; | 388 | return 0; |
| 1011 | } | 389 | } |
| 1012 | 390 | ||
| @@ -1017,19 +395,5 @@ EXPORT_SYMBOL_GPL(class_unregister); | |||
| 1017 | EXPORT_SYMBOL_GPL(class_create); | 395 | EXPORT_SYMBOL_GPL(class_create); |
| 1018 | EXPORT_SYMBOL_GPL(class_destroy); | 396 | EXPORT_SYMBOL_GPL(class_destroy); |
| 1019 | 397 | ||
| 1020 | EXPORT_SYMBOL_GPL(class_device_register); | ||
| 1021 | EXPORT_SYMBOL_GPL(class_device_unregister); | ||
| 1022 | EXPORT_SYMBOL_GPL(class_device_initialize); | ||
| 1023 | EXPORT_SYMBOL_GPL(class_device_add); | ||
| 1024 | EXPORT_SYMBOL_GPL(class_device_del); | ||
| 1025 | EXPORT_SYMBOL_GPL(class_device_get); | ||
| 1026 | EXPORT_SYMBOL_GPL(class_device_put); | ||
| 1027 | EXPORT_SYMBOL_GPL(class_device_create); | ||
| 1028 | EXPORT_SYMBOL_GPL(class_device_destroy); | ||
| 1029 | EXPORT_SYMBOL_GPL(class_device_create_file); | ||
| 1030 | EXPORT_SYMBOL_GPL(class_device_remove_file); | ||
| 1031 | EXPORT_SYMBOL_GPL(class_device_create_bin_file); | ||
| 1032 | EXPORT_SYMBOL_GPL(class_device_remove_bin_file); | ||
| 1033 | |||
| 1034 | EXPORT_SYMBOL_GPL(class_interface_register); | 398 | EXPORT_SYMBOL_GPL(class_interface_register); |
| 1035 | EXPORT_SYMBOL_GPL(class_interface_unregister); | 399 | EXPORT_SYMBOL_GPL(class_interface_unregister); |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 6fe417429977..e38dfed41d80 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
| @@ -18,7 +18,7 @@ struct sysdev_class cpu_sysdev_class = { | |||
| 18 | }; | 18 | }; |
| 19 | EXPORT_SYMBOL(cpu_sysdev_class); | 19 | EXPORT_SYMBOL(cpu_sysdev_class); |
| 20 | 20 | ||
| 21 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | 21 | static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); |
| 22 | 22 | ||
| 23 | #ifdef CONFIG_HOTPLUG_CPU | 23 | #ifdef CONFIG_HOTPLUG_CPU |
| 24 | static ssize_t show_online(struct sys_device *dev, char *buf) | 24 | static ssize_t show_online(struct sys_device *dev, char *buf) |
| @@ -68,7 +68,7 @@ void unregister_cpu(struct cpu *cpu) | |||
| 68 | sysdev_remove_file(&cpu->sysdev, &attr_online); | 68 | sysdev_remove_file(&cpu->sysdev, &attr_online); |
| 69 | 69 | ||
| 70 | sysdev_unregister(&cpu->sysdev); | 70 | sysdev_unregister(&cpu->sysdev); |
| 71 | cpu_sys_devices[logical_cpu] = NULL; | 71 | per_cpu(cpu_sys_devices, logical_cpu) = NULL; |
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 74 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
| @@ -167,7 +167,7 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) | |||
| 167 | if (!error && cpu->hotpluggable) | 167 | if (!error && cpu->hotpluggable) |
| 168 | register_cpu_control(cpu); | 168 | register_cpu_control(cpu); |
| 169 | if (!error) | 169 | if (!error) |
| 170 | cpu_sys_devices[num] = &cpu->sysdev; | 170 | per_cpu(cpu_sys_devices, num) = &cpu->sysdev; |
| 171 | if (!error) | 171 | if (!error) |
| 172 | register_cpu_under_node(num, cpu_to_node(num)); | 172 | register_cpu_under_node(num, cpu_to_node(num)); |
| 173 | 173 | ||
| @@ -180,8 +180,8 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) | |||
| 180 | 180 | ||
| 181 | struct sys_device *get_cpu_sysdev(unsigned cpu) | 181 | struct sys_device *get_cpu_sysdev(unsigned cpu) |
| 182 | { | 182 | { |
| 183 | if (cpu < NR_CPUS) | 183 | if (cpu < nr_cpu_ids && cpu_possible(cpu)) |
| 184 | return cpu_sys_devices[cpu]; | 184 | return per_cpu(cpu_sys_devices, cpu); |
| 185 | else | 185 | else |
| 186 | return NULL; | 186 | return NULL; |
| 187 | } | 187 | } |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 9a6537f14401..2ef5acf4368b 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
| @@ -217,12 +217,22 @@ static void driver_remove_groups(struct device_driver *drv, | |||
| 217 | int driver_register(struct device_driver *drv) | 217 | int driver_register(struct device_driver *drv) |
| 218 | { | 218 | { |
| 219 | int ret; | 219 | int ret; |
| 220 | struct device_driver *other; | ||
| 220 | 221 | ||
| 221 | if ((drv->bus->probe && drv->probe) || | 222 | if ((drv->bus->probe && drv->probe) || |
| 222 | (drv->bus->remove && drv->remove) || | 223 | (drv->bus->remove && drv->remove) || |
| 223 | (drv->bus->shutdown && drv->shutdown)) | 224 | (drv->bus->shutdown && drv->shutdown)) |
| 224 | printk(KERN_WARNING "Driver '%s' needs updating - please use " | 225 | printk(KERN_WARNING "Driver '%s' needs updating - please use " |
| 225 | "bus_type methods\n", drv->name); | 226 | "bus_type methods\n", drv->name); |
| 227 | |||
| 228 | other = driver_find(drv->name, drv->bus); | ||
| 229 | if (other) { | ||
| 230 | put_driver(other); | ||
| 231 | printk(KERN_ERR "Error: Driver '%s' is already registered, " | ||
| 232 | "aborting...\n", drv->name); | ||
| 233 | return -EEXIST; | ||
| 234 | } | ||
| 235 | |||
| 226 | ret = bus_add_driver(drv); | 236 | ret = bus_add_driver(drv); |
| 227 | if (ret) | 237 | if (ret) |
| 228 | return ret; | 238 | return ret; |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e539be5750dc..e336b05fe4a7 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -428,13 +428,9 @@ static void __devinit cciss_procinit(int i) | |||
| 428 | proc_cciss = proc_mkdir("driver/cciss", NULL); | 428 | proc_cciss = proc_mkdir("driver/cciss", NULL); |
| 429 | if (!proc_cciss) | 429 | if (!proc_cciss) |
| 430 | return; | 430 | return; |
| 431 | pde = proc_create(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP | | 431 | pde = proc_create_data(hba[i]->devname, S_IWUSR | S_IRUSR | S_IRGRP | |
| 432 | S_IROTH, proc_cciss, | 432 | S_IROTH, proc_cciss, |
| 433 | &cciss_proc_fops); | 433 | &cciss_proc_fops, hba[i]); |
| 434 | if (!pde) | ||
| 435 | return; | ||
| 436 | |||
| 437 | pde->data = hba[i]; | ||
| 438 | } | 434 | } |
| 439 | #endif /* CONFIG_PROC_FS */ | 435 | #endif /* CONFIG_PROC_FS */ |
| 440 | 436 | ||
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index f49037b744f9..b60d425ce8d1 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
| @@ -77,6 +77,10 @@ static int power_status; | |||
| 77 | module_param(power_status, bool, 0600); | 77 | module_param(power_status, bool, 0600); |
| 78 | MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); | 78 | MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); |
| 79 | 79 | ||
| 80 | static int fan_mult = I8K_FAN_MULT; | ||
| 81 | module_param(fan_mult, int, 0); | ||
| 82 | MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); | ||
| 83 | |||
| 80 | static int i8k_open_fs(struct inode *inode, struct file *file); | 84 | static int i8k_open_fs(struct inode *inode, struct file *file); |
| 81 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, | 85 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, |
| 82 | unsigned long); | 86 | unsigned long); |
| @@ -239,7 +243,7 @@ static int i8k_get_fan_speed(int fan) | |||
| 239 | struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; | 243 | struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; |
| 240 | 244 | ||
| 241 | regs.ebx = fan & 0xff; | 245 | regs.ebx = fan & 0xff; |
| 242 | return i8k_smm(®s) ? : (regs.eax & 0xffff) * I8K_FAN_MULT; | 246 | return i8k_smm(®s) ? : (regs.eax & 0xffff) * fan_mult; |
| 243 | } | 247 | } |
| 244 | 248 | ||
| 245 | /* | 249 | /* |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index d83db5d880e0..192961fd7173 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #include <linux/miscdevice.h> | 30 | #include <linux/miscdevice.h> |
| 31 | #include <linux/posix-timers.h> | 31 | #include <linux/posix-timers.h> |
| 32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
| 33 | #include <linux/time.h> | ||
| 34 | #include <linux/math64.h> | ||
| 33 | 35 | ||
| 34 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
| 35 | #include <asm/sn/addrs.h> | 37 | #include <asm/sn/addrs.h> |
| @@ -472,8 +474,8 @@ static int sgi_clock_get(clockid_t clockid, struct timespec *tp) | |||
| 472 | 474 | ||
| 473 | nsec = rtc_time() * sgi_clock_period | 475 | nsec = rtc_time() * sgi_clock_period |
| 474 | + sgi_clock_offset.tv_nsec; | 476 | + sgi_clock_offset.tv_nsec; |
| 475 | tp->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tp->tv_nsec) | 477 | *tp = ns_to_timespec(nsec); |
| 476 | + sgi_clock_offset.tv_sec; | 478 | tp->tv_sec += sgi_clock_offset.tv_sec; |
| 477 | return 0; | 479 | return 0; |
| 478 | }; | 480 | }; |
| 479 | 481 | ||
| @@ -481,11 +483,11 @@ static int sgi_clock_set(clockid_t clockid, struct timespec *tp) | |||
| 481 | { | 483 | { |
| 482 | 484 | ||
| 483 | u64 nsec; | 485 | u64 nsec; |
| 484 | u64 rem; | 486 | u32 rem; |
| 485 | 487 | ||
| 486 | nsec = rtc_time() * sgi_clock_period; | 488 | nsec = rtc_time() * sgi_clock_period; |
| 487 | 489 | ||
| 488 | sgi_clock_offset.tv_sec = tp->tv_sec - div_long_long_rem(nsec, NSEC_PER_SEC, &rem); | 490 | sgi_clock_offset.tv_sec = tp->tv_sec - div_u64_rem(nsec, NSEC_PER_SEC, &rem); |
| 489 | 491 | ||
| 490 | if (rem <= tp->tv_nsec) | 492 | if (rem <= tp->tv_nsec) |
| 491 | sgi_clock_offset.tv_nsec = tp->tv_sec - rem; | 493 | sgi_clock_offset.tv_nsec = tp->tv_sec - rem; |
| @@ -644,9 +646,6 @@ static int sgi_timer_del(struct k_itimer *timr) | |||
| 644 | return 0; | 646 | return 0; |
| 645 | } | 647 | } |
| 646 | 648 | ||
| 647 | #define timespec_to_ns(x) ((x).tv_nsec + (x).tv_sec * NSEC_PER_SEC) | ||
| 648 | #define ns_to_timespec(ts, nsec) (ts).tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &(ts).tv_nsec) | ||
| 649 | |||
| 650 | /* Assumption: it_lock is already held with irq's disabled */ | 649 | /* Assumption: it_lock is already held with irq's disabled */ |
| 651 | static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) | 650 | static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) |
| 652 | { | 651 | { |
| @@ -659,9 +658,8 @@ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) | |||
| 659 | return; | 658 | return; |
| 660 | } | 659 | } |
| 661 | 660 | ||
| 662 | ns_to_timespec(cur_setting->it_interval, timr->it.mmtimer.incr * sgi_clock_period); | 661 | cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * sgi_clock_period); |
| 663 | ns_to_timespec(cur_setting->it_value, (timr->it.mmtimer.expires - rtc_time())* sgi_clock_period); | 662 | cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period); |
| 664 | return; | ||
| 665 | } | 663 | } |
| 666 | 664 | ||
| 667 | 665 | ||
| @@ -679,8 +677,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, | |||
| 679 | sgi_timer_get(timr, old_setting); | 677 | sgi_timer_get(timr, old_setting); |
| 680 | 678 | ||
| 681 | sgi_timer_del(timr); | 679 | sgi_timer_del(timr); |
| 682 | when = timespec_to_ns(new_setting->it_value); | 680 | when = timespec_to_ns(&new_setting->it_value); |
| 683 | period = timespec_to_ns(new_setting->it_interval); | 681 | period = timespec_to_ns(&new_setting->it_interval); |
| 684 | 682 | ||
| 685 | if (when == 0) | 683 | if (when == 0) |
| 686 | /* Clear timer */ | 684 | /* Clear timer */ |
| @@ -695,7 +693,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, | |||
| 695 | unsigned long now; | 693 | unsigned long now; |
| 696 | 694 | ||
| 697 | getnstimeofday(&n); | 695 | getnstimeofday(&n); |
| 698 | now = timespec_to_ns(n); | 696 | now = timespec_to_ns(&n); |
| 699 | if (when > now) | 697 | if (when > now) |
| 700 | when -= now; | 698 | when -= now; |
| 701 | else | 699 | else |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 513b7c2f3e26..ac5080df2565 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
| @@ -2028,13 +2028,13 @@ static void mgsl_change_params(struct mgsl_struct *info) | |||
| 2028 | */ | 2028 | */ |
| 2029 | static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) | 2029 | static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) |
| 2030 | { | 2030 | { |
| 2031 | struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; | 2031 | struct mgsl_struct *info = tty->driver_data; |
| 2032 | unsigned long flags; | 2032 | unsigned long flags; |
| 2033 | int ret; | 2033 | int ret = 0; |
| 2034 | 2034 | ||
| 2035 | if ( debug_level >= DEBUG_LEVEL_INFO ) { | 2035 | if (debug_level >= DEBUG_LEVEL_INFO) { |
| 2036 | printk( "%s(%d):mgsl_put_char(%d) on %s\n", | 2036 | printk(KERN_DEBUG "%s(%d):mgsl_put_char(%d) on %s\n", |
| 2037 | __FILE__,__LINE__,ch,info->device_name); | 2037 | __FILE__, __LINE__, ch, info->device_name); |
| 2038 | } | 2038 | } |
| 2039 | 2039 | ||
| 2040 | if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) | 2040 | if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) |
| @@ -2043,9 +2043,9 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) | |||
| 2043 | if (!tty || !info->xmit_buf) | 2043 | if (!tty || !info->xmit_buf) |
| 2044 | return 0; | 2044 | return 0; |
| 2045 | 2045 | ||
| 2046 | spin_lock_irqsave(&info->irq_spinlock,flags); | 2046 | spin_lock_irqsave(&info->irq_spinlock, flags); |
| 2047 | 2047 | ||
| 2048 | if ( (info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active ) { | 2048 | if ((info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active) { |
| 2049 | if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { | 2049 | if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { |
| 2050 | info->xmit_buf[info->xmit_head++] = ch; | 2050 | info->xmit_buf[info->xmit_head++] = ch; |
| 2051 | info->xmit_head &= SERIAL_XMIT_SIZE-1; | 2051 | info->xmit_head &= SERIAL_XMIT_SIZE-1; |
| @@ -2053,7 +2053,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) | |||
| 2053 | ret = 1; | 2053 | ret = 1; |
| 2054 | } | 2054 | } |
| 2055 | } | 2055 | } |
| 2056 | spin_unlock_irqrestore(&info->irq_spinlock,flags); | 2056 | spin_unlock_irqrestore(&info->irq_spinlock, flags); |
| 2057 | return ret; | 2057 | return ret; |
| 2058 | 2058 | ||
| 2059 | } /* end of mgsl_put_char() */ | 2059 | } /* end of mgsl_put_char() */ |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index 64f1ceed0b2c..663cd15d7c78 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
| @@ -426,7 +426,7 @@ static int tosh_probe(void) | |||
| 426 | int i,major,minor,day,year,month,flag; | 426 | int i,major,minor,day,year,month,flag; |
| 427 | unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 }; | 427 | unsigned char signature[7] = { 0x54,0x4f,0x53,0x48,0x49,0x42,0x41 }; |
| 428 | SMMRegisters regs; | 428 | SMMRegisters regs; |
| 429 | void __iomem *bios = ioremap(0xf0000, 0x10000); | 429 | void __iomem *bios = ioremap_cache(0xf0000, 0x10000); |
| 430 | 430 | ||
| 431 | if (!bios) | 431 | if (!bios) |
| 432 | return -ENOMEM; | 432 | return -ENOMEM; |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 2a999373863e..62e3c9190983 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
| @@ -784,7 +784,7 @@ static void sbp2_release_target(struct kref *kref) | |||
| 784 | kfree(lu); | 784 | kfree(lu); |
| 785 | } | 785 | } |
| 786 | scsi_remove_host(shost); | 786 | scsi_remove_host(shost); |
| 787 | fw_notify("released %s\n", tgt->bus_id); | 787 | fw_notify("released %s, target %d:0:0\n", tgt->bus_id, shost->host_no); |
| 788 | 788 | ||
| 789 | fw_unit_put(tgt->unit); | 789 | fw_unit_put(tgt->unit); |
| 790 | scsi_host_put(shost); | 790 | scsi_host_put(shost); |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 5a99e81d2784..93f916720b13 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
| @@ -30,6 +30,8 @@ static const struct i2c_device_id pca953x_id[] = { | |||
| 30 | { "pca9537", 4, }, | 30 | { "pca9537", 4, }, |
| 31 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
| 32 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
| 33 | { "pca9555", 16, }, | ||
| 34 | { "pca9557", 8, }, | ||
| 33 | /* REVISIT several pca955x parts should work here too */ | 35 | /* REVISIT several pca955x parts should work here too */ |
| 34 | { } | 36 | { } |
| 35 | }; | 37 | }; |
| @@ -193,7 +195,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
| 193 | { | 195 | { |
| 194 | struct pca953x_platform_data *pdata; | 196 | struct pca953x_platform_data *pdata; |
| 195 | struct pca953x_chip *chip; | 197 | struct pca953x_chip *chip; |
| 196 | int ret, i; | 198 | int ret; |
| 197 | 199 | ||
| 198 | pdata = client->dev.platform_data; | 200 | pdata = client->dev.platform_data; |
| 199 | if (pdata == NULL) | 201 | if (pdata == NULL) |
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c index 9587869bdba0..c1009d6f9796 100644 --- a/drivers/hwmon/adt7473.c +++ b/drivers/hwmon/adt7473.c | |||
| @@ -422,18 +422,14 @@ static ssize_t show_volt(struct device *dev, struct device_attribute *devattr, | |||
| 422 | * number in the range -128 to 127, or as an unsigned number that must | 422 | * number in the range -128 to 127, or as an unsigned number that must |
| 423 | * be offset by 64. | 423 | * be offset by 64. |
| 424 | */ | 424 | */ |
| 425 | static int decode_temp(struct adt7473_data *data, u8 raw) | 425 | static int decode_temp(u8 twos_complement, u8 raw) |
| 426 | { | 426 | { |
| 427 | if (data->temp_twos_complement) | 427 | return twos_complement ? (s8)raw : raw - 64; |
| 428 | return (s8)raw; | ||
| 429 | return raw - 64; | ||
| 430 | } | 428 | } |
| 431 | 429 | ||
| 432 | static u8 encode_temp(struct adt7473_data *data, int cooked) | 430 | static u8 encode_temp(u8 twos_complement, int cooked) |
| 433 | { | 431 | { |
| 434 | if (data->temp_twos_complement) | 432 | return twos_complement ? cooked & 0xFF : cooked + 64; |
| 435 | return (cooked & 0xFF); | ||
| 436 | return cooked + 64; | ||
| 437 | } | 433 | } |
| 438 | 434 | ||
| 439 | static ssize_t show_temp_min(struct device *dev, | 435 | static ssize_t show_temp_min(struct device *dev, |
| @@ -442,8 +438,9 @@ static ssize_t show_temp_min(struct device *dev, | |||
| 442 | { | 438 | { |
| 443 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 439 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 444 | struct adt7473_data *data = adt7473_update_device(dev); | 440 | struct adt7473_data *data = adt7473_update_device(dev); |
| 445 | return sprintf(buf, "%d\n", | 441 | return sprintf(buf, "%d\n", 1000 * decode_temp( |
| 446 | 1000 * decode_temp(data, data->temp_min[attr->index])); | 442 | data->temp_twos_complement, |
| 443 | data->temp_min[attr->index])); | ||
| 447 | } | 444 | } |
| 448 | 445 | ||
| 449 | static ssize_t set_temp_min(struct device *dev, | 446 | static ssize_t set_temp_min(struct device *dev, |
| @@ -455,7 +452,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
| 455 | struct i2c_client *client = to_i2c_client(dev); | 452 | struct i2c_client *client = to_i2c_client(dev); |
| 456 | struct adt7473_data *data = i2c_get_clientdata(client); | 453 | struct adt7473_data *data = i2c_get_clientdata(client); |
| 457 | int temp = simple_strtol(buf, NULL, 10) / 1000; | 454 | int temp = simple_strtol(buf, NULL, 10) / 1000; |
| 458 | temp = encode_temp(data, temp); | 455 | temp = encode_temp(data->temp_twos_complement, temp); |
| 459 | 456 | ||
| 460 | mutex_lock(&data->lock); | 457 | mutex_lock(&data->lock); |
| 461 | data->temp_min[attr->index] = temp; | 458 | data->temp_min[attr->index] = temp; |
| @@ -472,8 +469,9 @@ static ssize_t show_temp_max(struct device *dev, | |||
| 472 | { | 469 | { |
| 473 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 470 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 474 | struct adt7473_data *data = adt7473_update_device(dev); | 471 | struct adt7473_data *data = adt7473_update_device(dev); |
| 475 | return sprintf(buf, "%d\n", | 472 | return sprintf(buf, "%d\n", 1000 * decode_temp( |
| 476 | 1000 * decode_temp(data, data->temp_max[attr->index])); | 473 | data->temp_twos_complement, |
| 474 | data->temp_max[attr->index])); | ||
| 477 | } | 475 | } |
| 478 | 476 | ||
| 479 | static ssize_t set_temp_max(struct device *dev, | 477 | static ssize_t set_temp_max(struct device *dev, |
| @@ -485,7 +483,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
| 485 | struct i2c_client *client = to_i2c_client(dev); | 483 | struct i2c_client *client = to_i2c_client(dev); |
| 486 | struct adt7473_data *data = i2c_get_clientdata(client); | 484 | struct adt7473_data *data = i2c_get_clientdata(client); |
| 487 | int temp = simple_strtol(buf, NULL, 10) / 1000; | 485 | int temp = simple_strtol(buf, NULL, 10) / 1000; |
| 488 | temp = encode_temp(data, temp); | 486 | temp = encode_temp(data->temp_twos_complement, temp); |
| 489 | 487 | ||
| 490 | mutex_lock(&data->lock); | 488 | mutex_lock(&data->lock); |
| 491 | data->temp_max[attr->index] = temp; | 489 | data->temp_max[attr->index] = temp; |
| @@ -501,8 +499,9 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, | |||
| 501 | { | 499 | { |
| 502 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 500 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 503 | struct adt7473_data *data = adt7473_update_device(dev); | 501 | struct adt7473_data *data = adt7473_update_device(dev); |
| 504 | return sprintf(buf, "%d\n", | 502 | return sprintf(buf, "%d\n", 1000 * decode_temp( |
| 505 | 1000 * decode_temp(data, data->temp[attr->index])); | 503 | data->temp_twos_complement, |
| 504 | data->temp[attr->index])); | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | static ssize_t show_fan_min(struct device *dev, | 507 | static ssize_t show_fan_min(struct device *dev, |
| @@ -671,8 +670,9 @@ static ssize_t show_temp_tmax(struct device *dev, | |||
| 671 | { | 670 | { |
| 672 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 671 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 673 | struct adt7473_data *data = adt7473_update_device(dev); | 672 | struct adt7473_data *data = adt7473_update_device(dev); |
| 674 | return sprintf(buf, "%d\n", | 673 | return sprintf(buf, "%d\n", 1000 * decode_temp( |
| 675 | 1000 * decode_temp(data, data->temp_tmax[attr->index])); | 674 | data->temp_twos_complement, |
| 675 | data->temp_tmax[attr->index])); | ||
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | static ssize_t set_temp_tmax(struct device *dev, | 678 | static ssize_t set_temp_tmax(struct device *dev, |
| @@ -684,7 +684,7 @@ static ssize_t set_temp_tmax(struct device *dev, | |||
| 684 | struct i2c_client *client = to_i2c_client(dev); | 684 | struct i2c_client *client = to_i2c_client(dev); |
| 685 | struct adt7473_data *data = i2c_get_clientdata(client); | 685 | struct adt7473_data *data = i2c_get_clientdata(client); |
| 686 | int temp = simple_strtol(buf, NULL, 10) / 1000; | 686 | int temp = simple_strtol(buf, NULL, 10) / 1000; |
| 687 | temp = encode_temp(data, temp); | 687 | temp = encode_temp(data->temp_twos_complement, temp); |
| 688 | 688 | ||
| 689 | mutex_lock(&data->lock); | 689 | mutex_lock(&data->lock); |
| 690 | data->temp_tmax[attr->index] = temp; | 690 | data->temp_tmax[attr->index] = temp; |
| @@ -701,8 +701,9 @@ static ssize_t show_temp_tmin(struct device *dev, | |||
| 701 | { | 701 | { |
| 702 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 702 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
| 703 | struct adt7473_data *data = adt7473_update_device(dev); | 703 | struct adt7473_data *data = adt7473_update_device(dev); |
| 704 | return sprintf(buf, "%d\n", | 704 | return sprintf(buf, "%d\n", 1000 * decode_temp( |
| 705 | 1000 * decode_temp(data, data->temp_tmin[attr->index])); | 705 | data->temp_twos_complement, |
| 706 | data->temp_tmin[attr->index])); | ||
| 706 | } | 707 | } |
| 707 | 708 | ||
| 708 | static ssize_t set_temp_tmin(struct device *dev, | 709 | static ssize_t set_temp_tmin(struct device *dev, |
| @@ -714,7 +715,7 @@ static ssize_t set_temp_tmin(struct device *dev, | |||
| 714 | struct i2c_client *client = to_i2c_client(dev); | 715 | struct i2c_client *client = to_i2c_client(dev); |
| 715 | struct adt7473_data *data = i2c_get_clientdata(client); | 716 | struct adt7473_data *data = i2c_get_clientdata(client); |
| 716 | int temp = simple_strtol(buf, NULL, 10) / 1000; | 717 | int temp = simple_strtol(buf, NULL, 10) / 1000; |
| 717 | temp = encode_temp(data, temp); | 718 | temp = encode_temp(data->temp_twos_complement, temp); |
| 718 | 719 | ||
| 719 | mutex_lock(&data->lock); | 720 | mutex_lock(&data->lock); |
| 720 | data->temp_tmin[attr->index] = temp; | 721 | data->temp_tmin[attr->index] = temp; |
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 84712a22acea..fe2eea4d799b 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
| @@ -953,12 +953,8 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value) | |||
| 953 | static void asb100_init_client(struct i2c_client *client) | 953 | static void asb100_init_client(struct i2c_client *client) |
| 954 | { | 954 | { |
| 955 | struct asb100_data *data = i2c_get_clientdata(client); | 955 | struct asb100_data *data = i2c_get_clientdata(client); |
| 956 | int vid = 0; | ||
| 957 | 956 | ||
| 958 | vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f; | ||
| 959 | vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4; | ||
| 960 | data->vrm = vid_which_vrm(); | 957 | data->vrm = vid_which_vrm(); |
| 961 | vid = vid_from_reg(vid, data->vrm); | ||
| 962 | 958 | ||
| 963 | /* Start monitoring */ | 959 | /* Start monitoring */ |
| 964 | asb100_write_value(client, ASB100_REG_CONFIG, | 960 | asb100_write_value(client, ASB100_REG_CONFIG, |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 115f4090b98e..fa7696905154 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
| @@ -248,7 +248,7 @@ static int lm75_detach_client(struct i2c_client *client) | |||
| 248 | 248 | ||
| 249 | /* All registers are word-sized, except for the configuration register. | 249 | /* All registers are word-sized, except for the configuration register. |
| 250 | LM75 uses a high-byte first convention, which is exactly opposite to | 250 | LM75 uses a high-byte first convention, which is exactly opposite to |
| 251 | the usual practice. */ | 251 | the SMBus standard. */ |
| 252 | static int lm75_read_value(struct i2c_client *client, u8 reg) | 252 | static int lm75_read_value(struct i2c_client *client, u8 reg) |
| 253 | { | 253 | { |
| 254 | if (reg == LM75_REG_CONF) | 254 | if (reg == LM75_REG_CONF) |
| @@ -257,9 +257,6 @@ static int lm75_read_value(struct i2c_client *client, u8 reg) | |||
| 257 | return swab16(i2c_smbus_read_word_data(client, reg)); | 257 | return swab16(i2c_smbus_read_word_data(client, reg)); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | /* All registers are word-sized, except for the configuration register. | ||
| 261 | LM75 uses a high-byte first convention, which is exactly opposite to | ||
| 262 | the usual practice. */ | ||
| 263 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) | 260 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) |
| 264 | { | 261 | { |
| 265 | if (reg == LM75_REG_CONF) | 262 | if (reg == LM75_REG_CONF) |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index f61d8f4185b2..eb03544c731c 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
| @@ -335,11 +335,23 @@ exit: | |||
| 335 | static int __init smsc47b397_find(unsigned short *addr) | 335 | static int __init smsc47b397_find(unsigned short *addr) |
| 336 | { | 336 | { |
| 337 | u8 id, rev; | 337 | u8 id, rev; |
| 338 | char *name; | ||
| 338 | 339 | ||
| 339 | superio_enter(); | 340 | superio_enter(); |
| 340 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 341 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
| 341 | 342 | ||
| 342 | if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) { | 343 | switch(id) { |
| 344 | case 0x81: | ||
| 345 | name = "SCH5307-NS"; | ||
| 346 | break; | ||
| 347 | case 0x6f: | ||
| 348 | name = "LPC47B397-NC"; | ||
| 349 | break; | ||
| 350 | case 0x85: | ||
| 351 | case 0x8c: | ||
| 352 | name = "SCH5317"; | ||
| 353 | break; | ||
| 354 | default: | ||
| 343 | superio_exit(); | 355 | superio_exit(); |
| 344 | return -ENODEV; | 356 | return -ENODEV; |
| 345 | } | 357 | } |
| @@ -352,8 +364,7 @@ static int __init smsc47b397_find(unsigned short *addr) | |||
| 352 | 364 | ||
| 353 | printk(KERN_INFO DRVNAME ": found SMSC %s " | 365 | printk(KERN_INFO DRVNAME ": found SMSC %s " |
| 354 | "(base address 0x%04x, revision %u)\n", | 366 | "(base address 0x%04x, revision %u)\n", |
| 355 | id == 0x81 ? "SCH5307-NS" : id == 0x85 ? "SCH5317" : | 367 | name, *addr, rev); |
| 356 | "LPC47B397-NC", *addr, rev); | ||
| 357 | 368 | ||
| 358 | superio_exit(); | 369 | superio_exit(); |
| 359 | return 0; | 370 | return 0; |
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index ee35af93b574..ed3c019b78c7 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
| @@ -1024,10 +1024,9 @@ static struct sensor_device_attribute_2 w83793_vid[] = { | |||
| 1024 | SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), | 1024 | SENSOR_ATTR_2(cpu0_vid, S_IRUGO, show_vid, NULL, NOT_USED, 0), |
| 1025 | SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), | 1025 | SENSOR_ATTR_2(cpu1_vid, S_IRUGO, show_vid, NULL, NOT_USED, 1), |
| 1026 | }; | 1026 | }; |
| 1027 | static DEVICE_ATTR(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm); | ||
| 1027 | 1028 | ||
| 1028 | static struct sensor_device_attribute_2 sda_single_files[] = { | 1029 | static struct sensor_device_attribute_2 sda_single_files[] = { |
| 1029 | SENSOR_ATTR_2(vrm, S_IWUSR | S_IRUGO, show_vrm, store_vrm, | ||
| 1030 | NOT_USED, NOT_USED), | ||
| 1031 | SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, | 1030 | SENSOR_ATTR_2(chassis, S_IWUSR | S_IRUGO, show_alarm_beep, |
| 1032 | store_chassis_clear, ALARM_STATUS, 30), | 1031 | store_chassis_clear, ALARM_STATUS, 30), |
| 1033 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, | 1032 | SENSOR_ATTR_2(beep_enable, S_IWUSR | S_IRUGO, show_beep_enable, |
| @@ -1080,6 +1079,7 @@ static int w83793_detach_client(struct i2c_client *client) | |||
| 1080 | 1079 | ||
| 1081 | for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) | 1080 | for (i = 0; i < ARRAY_SIZE(w83793_vid); i++) |
| 1082 | device_remove_file(dev, &w83793_vid[i].dev_attr); | 1081 | device_remove_file(dev, &w83793_vid[i].dev_attr); |
| 1082 | device_remove_file(dev, &dev_attr_vrm); | ||
| 1083 | 1083 | ||
| 1084 | for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) | 1084 | for (i = 0; i < ARRAY_SIZE(w83793_left_fan); i++) |
| 1085 | device_remove_file(dev, &w83793_left_fan[i].dev_attr); | 1085 | device_remove_file(dev, &w83793_left_fan[i].dev_attr); |
| @@ -1282,7 +1282,6 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1282 | /* Initialize the chip */ | 1282 | /* Initialize the chip */ |
| 1283 | w83793_init_client(client); | 1283 | w83793_init_client(client); |
| 1284 | 1284 | ||
| 1285 | data->vrm = vid_which_vrm(); | ||
| 1286 | /* | 1285 | /* |
| 1287 | Only fan 1-5 has their own input pins, | 1286 | Only fan 1-5 has their own input pins, |
| 1288 | Pwm 1-3 has their own pins | 1287 | Pwm 1-3 has their own pins |
| @@ -1293,7 +1292,9 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1293 | val = w83793_read_value(client, W83793_REG_FANIN_CTRL); | 1292 | val = w83793_read_value(client, W83793_REG_FANIN_CTRL); |
| 1294 | 1293 | ||
| 1295 | /* check the function of pins 49-56 */ | 1294 | /* check the function of pins 49-56 */ |
| 1296 | if (!(tmp & 0x80)) { | 1295 | if (tmp & 0x80) { |
| 1296 | data->has_vid |= 0x2; /* has VIDB */ | ||
| 1297 | } else { | ||
| 1297 | data->has_pwm |= 0x18; /* pwm 4,5 */ | 1298 | data->has_pwm |= 0x18; /* pwm 4,5 */ |
| 1298 | if (val & 0x01) { /* fan 6 */ | 1299 | if (val & 0x01) { /* fan 6 */ |
| 1299 | data->has_fan |= 0x20; | 1300 | data->has_fan |= 0x20; |
| @@ -1309,13 +1310,15 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1309 | } | 1310 | } |
| 1310 | } | 1311 | } |
| 1311 | 1312 | ||
| 1313 | /* check the function of pins 37-40 */ | ||
| 1314 | if (!(tmp & 0x29)) | ||
| 1315 | data->has_vid |= 0x1; /* has VIDA */ | ||
| 1312 | if (0x08 == (tmp & 0x0c)) { | 1316 | if (0x08 == (tmp & 0x0c)) { |
| 1313 | if (val & 0x08) /* fan 9 */ | 1317 | if (val & 0x08) /* fan 9 */ |
| 1314 | data->has_fan |= 0x100; | 1318 | data->has_fan |= 0x100; |
| 1315 | if (val & 0x10) /* fan 10 */ | 1319 | if (val & 0x10) /* fan 10 */ |
| 1316 | data->has_fan |= 0x200; | 1320 | data->has_fan |= 0x200; |
| 1317 | } | 1321 | } |
| 1318 | |||
| 1319 | if (0x20 == (tmp & 0x30)) { | 1322 | if (0x20 == (tmp & 0x30)) { |
| 1320 | if (val & 0x20) /* fan 11 */ | 1323 | if (val & 0x20) /* fan 11 */ |
| 1321 | data->has_fan |= 0x400; | 1324 | data->has_fan |= 0x400; |
| @@ -1359,13 +1362,6 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1359 | if (tmp & 0x02) | 1362 | if (tmp & 0x02) |
| 1360 | data->has_temp |= 0x20; | 1363 | data->has_temp |= 0x20; |
| 1361 | 1364 | ||
| 1362 | /* Detect the VID usage and ignore unused input */ | ||
| 1363 | tmp = w83793_read_value(client, W83793_REG_MFC); | ||
| 1364 | if (!(tmp & 0x29)) | ||
| 1365 | data->has_vid |= 0x1; /* has VIDA */ | ||
| 1366 | if (tmp & 0x80) | ||
| 1367 | data->has_vid |= 0x2; /* has VIDB */ | ||
| 1368 | |||
| 1369 | /* Register sysfs hooks */ | 1365 | /* Register sysfs hooks */ |
| 1370 | for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { | 1366 | for (i = 0; i < ARRAY_SIZE(w83793_sensor_attr_2); i++) { |
| 1371 | err = device_create_file(dev, | 1367 | err = device_create_file(dev, |
| @@ -1381,6 +1377,12 @@ static int w83793_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 1381 | if (err) | 1377 | if (err) |
| 1382 | goto exit_remove; | 1378 | goto exit_remove; |
| 1383 | } | 1379 | } |
| 1380 | if (data->has_vid) { | ||
| 1381 | data->vrm = vid_which_vrm(); | ||
| 1382 | err = device_create_file(dev, &dev_attr_vrm); | ||
| 1383 | if (err) | ||
| 1384 | goto exit_remove; | ||
| 1385 | } | ||
| 1384 | 1386 | ||
| 1385 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { | 1387 | for (i = 0; i < ARRAY_SIZE(sda_single_files); i++) { |
| 1386 | err = device_create_file(dev, &sda_single_files[i].dev_attr); | 1388 | err = device_create_file(dev, &sda_single_files[i].dev_attr); |
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 77f2d482888b..52e268e25dab 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
| @@ -301,8 +301,8 @@ static u8 w83l785ts_read_value(struct i2c_client *client, u8 reg, u8 defval) | |||
| 301 | msleep(i); | 301 | msleep(i); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | dev_err(&client->dev, "Couldn't read value from register 0x%02x. " | 304 | dev_err(&client->dev, "Couldn't read value from register 0x%02x.\n", |
| 305 | "Please report.\n", reg); | 305 | reg); |
| 306 | return defval; | 306 | return defval; |
| 307 | } | 307 | } |
| 308 | 308 | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 099a0fe1745b..591deda3f86a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -1347,7 +1347,8 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
| 1347 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) | 1347 | (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) |
| 1348 | hwif->irq = port ? 15 : 14; | 1348 | hwif->irq = port ? 15 : 14; |
| 1349 | 1349 | ||
| 1350 | hwif->host_flags = d->host_flags; | 1350 | /* ->host_flags may be set by ->init_iops (or even earlier...) */ |
| 1351 | hwif->host_flags |= d->host_flags; | ||
| 1351 | hwif->pio_mask = d->pio_mask; | 1352 | hwif->pio_mask = d->pio_mask; |
| 1352 | 1353 | ||
| 1353 | /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ | 1354 | /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 29d833e71cbf..05710c7c1220 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
| @@ -520,8 +520,11 @@ static ssize_t fw_show_drv_device_ids(struct device_driver *drv, char *buf) | |||
| 520 | char *scratch = buf; | 520 | char *scratch = buf; |
| 521 | 521 | ||
| 522 | driver = container_of(drv, struct hpsb_protocol_driver, driver); | 522 | driver = container_of(drv, struct hpsb_protocol_driver, driver); |
| 523 | id = driver->id_table; | ||
| 524 | if (!id) | ||
| 525 | return 0; | ||
| 523 | 526 | ||
| 524 | for (id = driver->id_table; id->match_flags != 0; id++) { | 527 | for (; id->match_flags != 0; id++) { |
| 525 | int need_coma = 0; | 528 | int need_coma = 0; |
| 526 | 529 | ||
| 527 | if (id->match_flags & IEEE1394_MATCH_VENDOR_ID) { | 530 | if (id->match_flags & IEEE1394_MATCH_VENDOR_ID) { |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 877be9922c3d..15906d005b05 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
| @@ -405,7 +405,8 @@ hysdn_procconf_init(void) | |||
| 405 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); | 405 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); |
| 406 | if ((card->procconf = (void *) proc_create(conf_name, | 406 | if ((card->procconf = (void *) proc_create(conf_name, |
| 407 | S_IFREG | S_IRUGO | S_IWUSR, | 407 | S_IFREG | S_IRUGO | S_IWUSR, |
| 408 | hysdn_proc_entry)) != NULL) { | 408 | hysdn_proc_entry, |
| 409 | &conf_fops)) != NULL) { | ||
| 409 | hysdn_proclog_init(card); /* init the log file entry */ | 410 | hysdn_proclog_init(card); /* init the log file entry */ |
| 410 | } | 411 | } |
| 411 | card = card->next; /* next entry */ | 412 | card = card->next; /* next entry */ |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e812df607a5c..fcd1aeccdf93 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -82,9 +82,8 @@ static struct mtd_info *cfi_intelext_setup (struct mtd_info *); | |||
| 82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); | 82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); |
| 83 | 83 | ||
| 84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, | 84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, |
| 85 | size_t *retlen, u_char **mtdbuf); | 85 | size_t *retlen, void **virt, resource_size_t *phys); |
| 86 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, | 86 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len); |
| 87 | size_t len); | ||
| 88 | 87 | ||
| 89 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 88 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
| 90 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 89 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
| @@ -1240,7 +1239,8 @@ static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t a | |||
| 1240 | return ret; | 1239 | return ret; |
| 1241 | } | 1240 | } |
| 1242 | 1241 | ||
| 1243 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) | 1242 | static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 1243 | size_t *retlen, void **virt, resource_size_t *phys) | ||
| 1244 | { | 1244 | { |
| 1245 | struct map_info *map = mtd->priv; | 1245 | struct map_info *map = mtd->priv; |
| 1246 | struct cfi_private *cfi = map->fldrv_priv; | 1246 | struct cfi_private *cfi = map->fldrv_priv; |
| @@ -1257,8 +1257,10 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
| 1257 | chipnum = (from >> cfi->chipshift); | 1257 | chipnum = (from >> cfi->chipshift); |
| 1258 | ofs = from - (chipnum << cfi->chipshift); | 1258 | ofs = from - (chipnum << cfi->chipshift); |
| 1259 | 1259 | ||
| 1260 | *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; | 1260 | *virt = map->virt + cfi->chips[chipnum].start + ofs; |
| 1261 | *retlen = 0; | 1261 | *retlen = 0; |
| 1262 | if (phys) | ||
| 1263 | *phys = map->phys + cfi->chips[chipnum].start + ofs; | ||
| 1262 | 1264 | ||
| 1263 | while (len) { | 1265 | while (len) { |
| 1264 | unsigned long thislen; | 1266 | unsigned long thislen; |
| @@ -1291,7 +1293,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
| 1291 | return 0; | 1293 | return 0; |
| 1292 | } | 1294 | } |
| 1293 | 1295 | ||
| 1294 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 1296 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 1295 | { | 1297 | { |
| 1296 | struct map_info *map = mtd->priv; | 1298 | struct map_info *map = mtd->priv; |
| 1297 | struct cfi_private *cfi = map->fldrv_priv; | 1299 | struct cfi_private *cfi = map->fldrv_priv; |
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index bf485ff49457..0399be178620 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c | |||
| @@ -48,18 +48,21 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, | 50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 51 | size_t *retlen, u_char **mtdbuf) | 51 | size_t *retlen, void **virt, resource_size_t *phys) |
| 52 | { | 52 | { |
| 53 | if (from + len > mtd->size) | 53 | if (from + len > mtd->size) |
| 54 | return -EINVAL; | 54 | return -EINVAL; |
| 55 | 55 | ||
| 56 | *mtdbuf = mtd->priv + from; | 56 | /* can we return a physical address with this driver? */ |
| 57 | if (phys) | ||
| 58 | return -EINVAL; | ||
| 59 | |||
| 60 | *virt = mtd->priv + from; | ||
| 57 | *retlen = len; | 61 | *retlen = len; |
| 58 | return 0; | 62 | return 0; |
| 59 | } | 63 | } |
| 60 | 64 | ||
| 61 | static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 65 | static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 62 | size_t len) | ||
| 63 | { | 66 | { |
| 64 | } | 67 | } |
| 65 | 68 | ||
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 5f960182da95..c7987b1c5e01 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
| @@ -57,20 +57,21 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, | 59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 60 | size_t *retlen, u_char **mtdbuf) | 60 | size_t *retlen, void **virt, resource_size_t *phys) |
| 61 | { | 61 | { |
| 62 | u_char *start = mtd->priv; | ||
| 63 | |||
| 64 | if (from + len > mtd->size) | 62 | if (from + len > mtd->size) |
| 65 | return -EINVAL; | 63 | return -EINVAL; |
| 66 | 64 | ||
| 67 | *mtdbuf = start + from; | 65 | /* can we return a physical address with this driver? */ |
| 66 | if (phys) | ||
| 67 | return -EINVAL; | ||
| 68 | |||
| 69 | *virt = mtd->priv + from; | ||
| 68 | *retlen = len; | 70 | *retlen = len; |
| 69 | return 0; | 71 | return 0; |
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, | 74 | static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 73 | size_t len) | ||
| 74 | { | 75 | { |
| 75 | } | 76 | } |
| 76 | 77 | ||
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index 7060a0895ce2..bc9981749064 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c | |||
| @@ -134,7 +134,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 134 | eoff_lo = end & (priv->asize - 1); | 134 | eoff_lo = end & (priv->asize - 1); |
| 135 | soff_lo = instr->addr & (priv->asize - 1); | 135 | soff_lo = instr->addr & (priv->asize - 1); |
| 136 | 136 | ||
| 137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr); | 137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, |
| 138 | (void **)&ptr, NULL); | ||
| 138 | 139 | ||
| 139 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { | 140 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { |
| 140 | /* The whole thing fits within one access, so just one shot | 141 | /* The whole thing fits within one access, so just one shot |
| @@ -154,7 +155,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 154 | } | 155 | } |
| 155 | soff_hi += priv->asize; | 156 | soff_hi += priv->asize; |
| 156 | pmc551_point(mtd, (priv->base_map0 | soff_hi), | 157 | pmc551_point(mtd, (priv->base_map0 | soff_hi), |
| 157 | priv->asize, &retlen, &ptr); | 158 | priv->asize, &retlen, |
| 159 | (void **)&ptr, NULL); | ||
| 158 | } | 160 | } |
| 159 | memset(ptr, 0xff, eoff_lo); | 161 | memset(ptr, 0xff, eoff_lo); |
| 160 | } | 162 | } |
| @@ -170,7 +172,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 170 | } | 172 | } |
| 171 | 173 | ||
| 172 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | 174 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 173 | size_t * retlen, u_char ** mtdbuf) | 175 | size_t *retlen, void **virt, resource_size_t *phys) |
| 174 | { | 176 | { |
| 175 | struct mypriv *priv = mtd->priv; | 177 | struct mypriv *priv = mtd->priv; |
| 176 | u32 soff_hi; | 178 | u32 soff_hi; |
| @@ -188,6 +190,10 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 188 | return -EINVAL; | 190 | return -EINVAL; |
| 189 | } | 191 | } |
| 190 | 192 | ||
| 193 | /* can we return a physical address with this driver? */ | ||
| 194 | if (phys) | ||
| 195 | return -EINVAL; | ||
| 196 | |||
| 191 | soff_hi = from & ~(priv->asize - 1); | 197 | soff_hi = from & ~(priv->asize - 1); |
| 192 | soff_lo = from & (priv->asize - 1); | 198 | soff_lo = from & (priv->asize - 1); |
| 193 | 199 | ||
| @@ -198,13 +204,12 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 198 | priv->curr_map0 = soff_hi; | 204 | priv->curr_map0 = soff_hi; |
| 199 | } | 205 | } |
| 200 | 206 | ||
| 201 | *mtdbuf = priv->start + soff_lo; | 207 | *virt = priv->start + soff_lo; |
| 202 | *retlen = len; | 208 | *retlen = len; |
| 203 | return 0; | 209 | return 0; |
| 204 | } | 210 | } |
| 205 | 211 | ||
| 206 | static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 212 | static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 207 | size_t len) | ||
| 208 | { | 213 | { |
| 209 | #ifdef CONFIG_MTD_PMC551_DEBUG | 214 | #ifdef CONFIG_MTD_PMC551_DEBUG |
| 210 | printk(KERN_DEBUG "pmc551_unpoint()\n"); | 215 | printk(KERN_DEBUG "pmc551_unpoint()\n"); |
| @@ -242,7 +247,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 242 | soff_lo = from & (priv->asize - 1); | 247 | soff_lo = from & (priv->asize - 1); |
| 243 | eoff_lo = end & (priv->asize - 1); | 248 | eoff_lo = end & (priv->asize - 1); |
| 244 | 249 | ||
| 245 | pmc551_point(mtd, from, len, retlen, &ptr); | 250 | pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); |
| 246 | 251 | ||
| 247 | if (soff_hi == eoff_hi) { | 252 | if (soff_hi == eoff_hi) { |
| 248 | /* The whole thing fits within one access, so just one shot | 253 | /* The whole thing fits within one access, so just one shot |
| @@ -263,7 +268,8 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
| 263 | goto out; | 268 | goto out; |
| 264 | } | 269 | } |
| 265 | soff_hi += priv->asize; | 270 | soff_hi += priv->asize; |
| 266 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 271 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
| 272 | (void **)&ptr, NULL); | ||
| 267 | } | 273 | } |
| 268 | memcpy(copyto, ptr, eoff_lo); | 274 | memcpy(copyto, ptr, eoff_lo); |
| 269 | copyto += eoff_lo; | 275 | copyto += eoff_lo; |
| @@ -308,7 +314,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 308 | soff_lo = to & (priv->asize - 1); | 314 | soff_lo = to & (priv->asize - 1); |
| 309 | eoff_lo = end & (priv->asize - 1); | 315 | eoff_lo = end & (priv->asize - 1); |
| 310 | 316 | ||
| 311 | pmc551_point(mtd, to, len, retlen, &ptr); | 317 | pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); |
| 312 | 318 | ||
| 313 | if (soff_hi == eoff_hi) { | 319 | if (soff_hi == eoff_hi) { |
| 314 | /* The whole thing fits within one access, so just one shot | 320 | /* The whole thing fits within one access, so just one shot |
| @@ -329,7 +335,8 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
| 329 | goto out; | 335 | goto out; |
| 330 | } | 336 | } |
| 331 | soff_hi += priv->asize; | 337 | soff_hi += priv->asize; |
| 332 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 338 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
| 339 | (void **)&ptr, NULL); | ||
| 333 | } | 340 | } |
| 334 | memcpy(ptr, copyfrom, eoff_lo); | 341 | memcpy(ptr, copyfrom, eoff_lo); |
| 335 | copyfrom += eoff_lo; | 342 | copyfrom += eoff_lo; |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index d293add1857c..cb86db746f28 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
| @@ -76,8 +76,9 @@ static char *map; | |||
| 76 | static slram_mtd_list_t *slram_mtdlist = NULL; | 76 | static slram_mtd_list_t *slram_mtdlist = NULL; |
| 77 | 77 | ||
| 78 | static int slram_erase(struct mtd_info *, struct erase_info *); | 78 | static int slram_erase(struct mtd_info *, struct erase_info *); |
| 79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **); | 79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **, |
| 80 | static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 80 | resource_size_t *); |
| 81 | static void slram_unpoint(struct mtd_info *, loff_t, size_t); | ||
| 81 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 82 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
| 82 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 83 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| 83 | 84 | ||
| @@ -104,19 +105,23 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
| 104 | } | 105 | } |
| 105 | 106 | ||
| 106 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, | 107 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 107 | size_t *retlen, u_char **mtdbuf) | 108 | size_t *retlen, void **virt, resource_size_t *phys) |
| 108 | { | 109 | { |
| 109 | slram_priv_t *priv = mtd->priv; | 110 | slram_priv_t *priv = mtd->priv; |
| 110 | 111 | ||
| 112 | /* can we return a physical address with this driver? */ | ||
| 113 | if (phys) | ||
| 114 | return -EINVAL; | ||
| 115 | |||
| 111 | if (from + len > mtd->size) | 116 | if (from + len > mtd->size) |
| 112 | return -EINVAL; | 117 | return -EINVAL; |
| 113 | 118 | ||
| 114 | *mtdbuf = priv->start + from; | 119 | *virt = priv->start + from; |
| 115 | *retlen = len; | 120 | *retlen = len; |
| 116 | return(0); | 121 | return(0); |
| 117 | } | 122 | } |
| 118 | 123 | ||
| 119 | static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 124 | static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 120 | { | 125 | { |
| 121 | } | 126 | } |
| 122 | 127 | ||
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index 14ffb1a9302a..c42f4b83f686 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
| @@ -40,10 +40,12 @@ struct mtd_partition uclinux_romfs[] = { | |||
| 40 | /****************************************************************************/ | 40 | /****************************************************************************/ |
| 41 | 41 | ||
| 42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, | 42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 43 | size_t *retlen, u_char **mtdbuf) | 43 | size_t *retlen, void **virt, resource_size_t *phys) |
| 44 | { | 44 | { |
| 45 | struct map_info *map = mtd->priv; | 45 | struct map_info *map = mtd->priv; |
| 46 | *mtdbuf = (u_char *) (map->virt + ((int) from)); | 46 | *virt = map->virt + from; |
| 47 | if (phys) | ||
| 48 | *phys = map->phys + from; | ||
| 47 | *retlen = len; | 49 | *retlen = len; |
| 48 | return(0); | 50 | return(0); |
| 49 | } | 51 | } |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index c66902df3171..07c701169344 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
| @@ -68,7 +68,7 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len, | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | 70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, |
| 71 | size_t *retlen, u_char **buf) | 71 | size_t *retlen, void **virt, resource_size_t *phys) |
| 72 | { | 72 | { |
| 73 | struct mtd_part *part = PART(mtd); | 73 | struct mtd_part *part = PART(mtd); |
| 74 | if (from >= mtd->size) | 74 | if (from >= mtd->size) |
| @@ -76,14 +76,14 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | |||
| 76 | else if (from + len > mtd->size) | 76 | else if (from + len > mtd->size) |
| 77 | len = mtd->size - from; | 77 | len = mtd->size - from; |
| 78 | return part->master->point (part->master, from + part->offset, | 78 | return part->master->point (part->master, from + part->offset, |
| 79 | len, retlen, buf); | 79 | len, retlen, virt, phys); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 82 | static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
| 83 | { | 83 | { |
| 84 | struct mtd_part *part = PART(mtd); | 84 | struct mtd_part *part = PART(mtd); |
| 85 | 85 | ||
| 86 | part->master->unpoint (part->master, addr, from + part->offset, len); | 86 | part->master->unpoint(part->master, from + part->offset, len); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, | 89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, |
diff --git a/drivers/mtd/nand/at91_nand.c b/drivers/mtd/nand/at91_nand.c index 414ceaecdb3a..0adb287027a2 100644 --- a/drivers/mtd/nand/at91_nand.c +++ b/drivers/mtd/nand/at91_nand.c | |||
| @@ -94,6 +94,24 @@ struct at91_nand_host { | |||
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
| 97 | * Enable NAND. | ||
| 98 | */ | ||
| 99 | static void at91_nand_enable(struct at91_nand_host *host) | ||
| 100 | { | ||
| 101 | if (host->board->enable_pin) | ||
| 102 | at91_set_gpio_value(host->board->enable_pin, 0); | ||
| 103 | } | ||
| 104 | |||
| 105 | /* | ||
| 106 | * Disable NAND. | ||
| 107 | */ | ||
| 108 | static void at91_nand_disable(struct at91_nand_host *host) | ||
| 109 | { | ||
| 110 | if (host->board->enable_pin) | ||
| 111 | at91_set_gpio_value(host->board->enable_pin, 1); | ||
| 112 | } | ||
| 113 | |||
| 114 | /* | ||
| 97 | * Hardware specific access to control-lines | 115 | * Hardware specific access to control-lines |
| 98 | */ | 116 | */ |
| 99 | static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | 117 | static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) |
| @@ -101,11 +119,11 @@ static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | |||
| 101 | struct nand_chip *nand_chip = mtd->priv; | 119 | struct nand_chip *nand_chip = mtd->priv; |
| 102 | struct at91_nand_host *host = nand_chip->priv; | 120 | struct at91_nand_host *host = nand_chip->priv; |
| 103 | 121 | ||
| 104 | if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) { | 122 | if (ctrl & NAND_CTRL_CHANGE) { |
| 105 | if (ctrl & NAND_NCE) | 123 | if (ctrl & NAND_NCE) |
| 106 | at91_set_gpio_value(host->board->enable_pin, 0); | 124 | at91_nand_enable(host); |
| 107 | else | 125 | else |
| 108 | at91_set_gpio_value(host->board->enable_pin, 1); | 126 | at91_nand_disable(host); |
| 109 | } | 127 | } |
| 110 | if (cmd == NAND_CMD_NONE) | 128 | if (cmd == NAND_CMD_NONE) |
| 111 | return; | 129 | return; |
| @@ -128,24 +146,6 @@ static int at91_nand_device_ready(struct mtd_info *mtd) | |||
| 128 | } | 146 | } |
| 129 | 147 | ||
| 130 | /* | 148 | /* |
| 131 | * Enable NAND. | ||
| 132 | */ | ||
| 133 | static void at91_nand_enable(struct at91_nand_host *host) | ||
| 134 | { | ||
| 135 | if (host->board->enable_pin) | ||
| 136 | at91_set_gpio_value(host->board->enable_pin, 0); | ||
| 137 | } | ||
| 138 | |||
| 139 | /* | ||
| 140 | * Disable NAND. | ||
| 141 | */ | ||
| 142 | static void at91_nand_disable(struct at91_nand_host *host) | ||
| 143 | { | ||
| 144 | if (host->board->enable_pin) | ||
| 145 | at91_set_gpio_value(host->board->enable_pin, 1); | ||
| 146 | } | ||
| 147 | |||
| 148 | /* | ||
| 149 | * write oob for small pages | 149 | * write oob for small pages |
| 150 | */ | 150 | */ |
| 151 | static int at91_nand_write_oob_512(struct mtd_info *mtd, | 151 | static int at91_nand_write_oob_512(struct mtd_info *mtd, |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index d7a3ea88eddb..32a4f17d35fc 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
| @@ -67,6 +67,10 @@ | |||
| 67 | #define FEC_MAX_PORTS 1 | 67 | #define FEC_MAX_PORTS 1 |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #if defined(CONFIG_FADS) || defined(CONFIG_RPXCLASSIC) || defined(CONFIG_M5272) | ||
| 71 | #define HAVE_mii_link_interrupt | ||
| 72 | #endif | ||
| 73 | |||
| 70 | /* | 74 | /* |
| 71 | * Define the fixed address of the FEC hardware. | 75 | * Define the fixed address of the FEC hardware. |
| 72 | */ | 76 | */ |
| @@ -205,7 +209,10 @@ struct fec_enet_private { | |||
| 205 | cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ | 209 | cbd_t *cur_rx, *cur_tx; /* The next free ring entry */ |
| 206 | cbd_t *dirty_tx; /* The ring entries to be free()ed. */ | 210 | cbd_t *dirty_tx; /* The ring entries to be free()ed. */ |
| 207 | uint tx_full; | 211 | uint tx_full; |
| 208 | spinlock_t lock; | 212 | /* hold while accessing the HW like ringbuffer for tx/rx but not MAC */ |
| 213 | spinlock_t hw_lock; | ||
| 214 | /* hold while accessing the mii_list_t() elements */ | ||
| 215 | spinlock_t mii_lock; | ||
| 209 | 216 | ||
| 210 | uint phy_id; | 217 | uint phy_id; |
| 211 | uint phy_id_done; | 218 | uint phy_id_done; |
| @@ -309,6 +316,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 309 | volatile fec_t *fecp; | 316 | volatile fec_t *fecp; |
| 310 | volatile cbd_t *bdp; | 317 | volatile cbd_t *bdp; |
| 311 | unsigned short status; | 318 | unsigned short status; |
| 319 | unsigned long flags; | ||
| 312 | 320 | ||
| 313 | fep = netdev_priv(dev); | 321 | fep = netdev_priv(dev); |
| 314 | fecp = (volatile fec_t*)dev->base_addr; | 322 | fecp = (volatile fec_t*)dev->base_addr; |
| @@ -318,6 +326,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 318 | return 1; | 326 | return 1; |
| 319 | } | 327 | } |
| 320 | 328 | ||
| 329 | spin_lock_irqsave(&fep->hw_lock, flags); | ||
| 321 | /* Fill in a Tx ring entry */ | 330 | /* Fill in a Tx ring entry */ |
| 322 | bdp = fep->cur_tx; | 331 | bdp = fep->cur_tx; |
| 323 | 332 | ||
| @@ -328,6 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 328 | * This should not happen, since dev->tbusy should be set. | 337 | * This should not happen, since dev->tbusy should be set. |
| 329 | */ | 338 | */ |
| 330 | printk("%s: tx queue full!.\n", dev->name); | 339 | printk("%s: tx queue full!.\n", dev->name); |
| 340 | spin_unlock_irqrestore(&fep->hw_lock, flags); | ||
| 331 | return 1; | 341 | return 1; |
| 332 | } | 342 | } |
| 333 | #endif | 343 | #endif |
| @@ -366,8 +376,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 366 | flush_dcache_range((unsigned long)skb->data, | 376 | flush_dcache_range((unsigned long)skb->data, |
| 367 | (unsigned long)skb->data + skb->len); | 377 | (unsigned long)skb->data + skb->len); |
| 368 | 378 | ||
| 369 | spin_lock_irq(&fep->lock); | ||
| 370 | |||
| 371 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | 379 | /* Send it on its way. Tell FEC it's ready, interrupt when done, |
| 372 | * it's the last BD of the frame, and to put the CRC on the end. | 380 | * it's the last BD of the frame, and to put the CRC on the end. |
| 373 | */ | 381 | */ |
| @@ -396,7 +404,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 396 | 404 | ||
| 397 | fep->cur_tx = (cbd_t *)bdp; | 405 | fep->cur_tx = (cbd_t *)bdp; |
| 398 | 406 | ||
| 399 | spin_unlock_irq(&fep->lock); | 407 | spin_unlock_irqrestore(&fep->hw_lock, flags); |
| 400 | 408 | ||
| 401 | return 0; | 409 | return 0; |
| 402 | } | 410 | } |
| @@ -454,19 +462,20 @@ fec_enet_interrupt(int irq, void * dev_id) | |||
| 454 | struct net_device *dev = dev_id; | 462 | struct net_device *dev = dev_id; |
| 455 | volatile fec_t *fecp; | 463 | volatile fec_t *fecp; |
| 456 | uint int_events; | 464 | uint int_events; |
| 457 | int handled = 0; | 465 | irqreturn_t ret = IRQ_NONE; |
| 458 | 466 | ||
| 459 | fecp = (volatile fec_t*)dev->base_addr; | 467 | fecp = (volatile fec_t*)dev->base_addr; |
| 460 | 468 | ||
| 461 | /* Get the interrupt events that caused us to be here. | 469 | /* Get the interrupt events that caused us to be here. |
| 462 | */ | 470 | */ |
| 463 | while ((int_events = fecp->fec_ievent) != 0) { | 471 | do { |
| 472 | int_events = fecp->fec_ievent; | ||
| 464 | fecp->fec_ievent = int_events; | 473 | fecp->fec_ievent = int_events; |
| 465 | 474 | ||
| 466 | /* Handle receive event in its own function. | 475 | /* Handle receive event in its own function. |
| 467 | */ | 476 | */ |
| 468 | if (int_events & FEC_ENET_RXF) { | 477 | if (int_events & FEC_ENET_RXF) { |
| 469 | handled = 1; | 478 | ret = IRQ_HANDLED; |
| 470 | fec_enet_rx(dev); | 479 | fec_enet_rx(dev); |
| 471 | } | 480 | } |
| 472 | 481 | ||
| @@ -475,17 +484,18 @@ fec_enet_interrupt(int irq, void * dev_id) | |||
| 475 | them as part of the transmit process. | 484 | them as part of the transmit process. |
| 476 | */ | 485 | */ |
| 477 | if (int_events & FEC_ENET_TXF) { | 486 | if (int_events & FEC_ENET_TXF) { |
| 478 | handled = 1; | 487 | ret = IRQ_HANDLED; |
| 479 | fec_enet_tx(dev); | 488 | fec_enet_tx(dev); |
| 480 | } | 489 | } |
| 481 | 490 | ||
| 482 | if (int_events & FEC_ENET_MII) { | 491 | if (int_events & FEC_ENET_MII) { |
| 483 | handled = 1; | 492 | ret = IRQ_HANDLED; |
| 484 | fec_enet_mii(dev); | 493 | fec_enet_mii(dev); |
| 485 | } | 494 | } |
| 486 | 495 | ||
| 487 | } | 496 | } while (int_events); |
| 488 | return IRQ_RETVAL(handled); | 497 | |
| 498 | return ret; | ||
| 489 | } | 499 | } |
| 490 | 500 | ||
| 491 | 501 | ||
| @@ -498,7 +508,7 @@ fec_enet_tx(struct net_device *dev) | |||
| 498 | struct sk_buff *skb; | 508 | struct sk_buff *skb; |
| 499 | 509 | ||
| 500 | fep = netdev_priv(dev); | 510 | fep = netdev_priv(dev); |
| 501 | spin_lock(&fep->lock); | 511 | spin_lock_irq(&fep->hw_lock); |
| 502 | bdp = fep->dirty_tx; | 512 | bdp = fep->dirty_tx; |
| 503 | 513 | ||
| 504 | while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) { | 514 | while (((status = bdp->cbd_sc) & BD_ENET_TX_READY) == 0) { |
| @@ -557,7 +567,7 @@ fec_enet_tx(struct net_device *dev) | |||
| 557 | } | 567 | } |
| 558 | } | 568 | } |
| 559 | fep->dirty_tx = (cbd_t *)bdp; | 569 | fep->dirty_tx = (cbd_t *)bdp; |
| 560 | spin_unlock(&fep->lock); | 570 | spin_unlock_irq(&fep->hw_lock); |
| 561 | } | 571 | } |
| 562 | 572 | ||
| 563 | 573 | ||
| @@ -584,6 +594,8 @@ fec_enet_rx(struct net_device *dev) | |||
| 584 | fep = netdev_priv(dev); | 594 | fep = netdev_priv(dev); |
| 585 | fecp = (volatile fec_t*)dev->base_addr; | 595 | fecp = (volatile fec_t*)dev->base_addr; |
| 586 | 596 | ||
| 597 | spin_lock_irq(&fep->hw_lock); | ||
| 598 | |||
| 587 | /* First, grab all of the stats for the incoming packet. | 599 | /* First, grab all of the stats for the incoming packet. |
| 588 | * These get messed up if we get called due to a busy condition. | 600 | * These get messed up if we get called due to a busy condition. |
| 589 | */ | 601 | */ |
| @@ -689,6 +701,8 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) { | |||
| 689 | */ | 701 | */ |
| 690 | fecp->fec_r_des_active = 0; | 702 | fecp->fec_r_des_active = 0; |
| 691 | #endif | 703 | #endif |
| 704 | |||
| 705 | spin_unlock_irq(&fep->hw_lock); | ||
| 692 | } | 706 | } |
| 693 | 707 | ||
| 694 | 708 | ||
| @@ -702,11 +716,11 @@ fec_enet_mii(struct net_device *dev) | |||
| 702 | uint mii_reg; | 716 | uint mii_reg; |
| 703 | 717 | ||
| 704 | fep = netdev_priv(dev); | 718 | fep = netdev_priv(dev); |
| 719 | spin_lock_irq(&fep->mii_lock); | ||
| 720 | |||
| 705 | ep = fep->hwp; | 721 | ep = fep->hwp; |
| 706 | mii_reg = ep->fec_mii_data; | 722 | mii_reg = ep->fec_mii_data; |
| 707 | 723 | ||
| 708 | spin_lock(&fep->lock); | ||
| 709 | |||
| 710 | if ((mip = mii_head) == NULL) { | 724 | if ((mip = mii_head) == NULL) { |
| 711 | printk("MII and no head!\n"); | 725 | printk("MII and no head!\n"); |
| 712 | goto unlock; | 726 | goto unlock; |
| @@ -723,7 +737,7 @@ fec_enet_mii(struct net_device *dev) | |||
| 723 | ep->fec_mii_data = mip->mii_regval; | 737 | ep->fec_mii_data = mip->mii_regval; |
| 724 | 738 | ||
| 725 | unlock: | 739 | unlock: |
| 726 | spin_unlock(&fep->lock); | 740 | spin_unlock_irq(&fep->mii_lock); |
| 727 | } | 741 | } |
| 728 | 742 | ||
| 729 | static int | 743 | static int |
| @@ -737,12 +751,11 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi | |||
| 737 | /* Add PHY address to register command. | 751 | /* Add PHY address to register command. |
| 738 | */ | 752 | */ |
| 739 | fep = netdev_priv(dev); | 753 | fep = netdev_priv(dev); |
| 740 | regval |= fep->phy_addr << 23; | 754 | spin_lock_irqsave(&fep->mii_lock, flags); |
| 741 | 755 | ||
| 756 | regval |= fep->phy_addr << 23; | ||
| 742 | retval = 0; | 757 | retval = 0; |
| 743 | 758 | ||
| 744 | spin_lock_irqsave(&fep->lock,flags); | ||
| 745 | |||
| 746 | if ((mip = mii_free) != NULL) { | 759 | if ((mip = mii_free) != NULL) { |
| 747 | mii_free = mip->mii_next; | 760 | mii_free = mip->mii_next; |
| 748 | mip->mii_regval = regval; | 761 | mip->mii_regval = regval; |
| @@ -759,9 +772,8 @@ mii_queue(struct net_device *dev, int regval, void (*func)(uint, struct net_devi | |||
| 759 | retval = 1; | 772 | retval = 1; |
| 760 | } | 773 | } |
| 761 | 774 | ||
| 762 | spin_unlock_irqrestore(&fep->lock,flags); | 775 | spin_unlock_irqrestore(&fep->mii_lock, flags); |
| 763 | 776 | return retval; | |
| 764 | return(retval); | ||
| 765 | } | 777 | } |
| 766 | 778 | ||
| 767 | static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c) | 779 | static void mii_do_cmd(struct net_device *dev, const phy_cmd_t *c) |
| @@ -1222,7 +1234,7 @@ static phy_info_t const * const phy_info[] = { | |||
| 1222 | }; | 1234 | }; |
| 1223 | 1235 | ||
| 1224 | /* ------------------------------------------------------------------------- */ | 1236 | /* ------------------------------------------------------------------------- */ |
| 1225 | #if !defined(CONFIG_M532x) | 1237 | #ifdef HAVE_mii_link_interrupt |
| 1226 | #ifdef CONFIG_RPXCLASSIC | 1238 | #ifdef CONFIG_RPXCLASSIC |
| 1227 | static void | 1239 | static void |
| 1228 | mii_link_interrupt(void *dev_id); | 1240 | mii_link_interrupt(void *dev_id); |
| @@ -1362,18 +1374,8 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
| 1362 | unsigned short irq; | 1374 | unsigned short irq; |
| 1363 | } *idp, id[] = { | 1375 | } *idp, id[] = { |
| 1364 | { "fec(TXF)", 23 }, | 1376 | { "fec(TXF)", 23 }, |
| 1365 | { "fec(TXB)", 24 }, | ||
| 1366 | { "fec(TXFIFO)", 25 }, | ||
| 1367 | { "fec(TXCR)", 26 }, | ||
| 1368 | { "fec(RXF)", 27 }, | 1377 | { "fec(RXF)", 27 }, |
| 1369 | { "fec(RXB)", 28 }, | ||
| 1370 | { "fec(MII)", 29 }, | 1378 | { "fec(MII)", 29 }, |
| 1371 | { "fec(LC)", 30 }, | ||
| 1372 | { "fec(HBERR)", 31 }, | ||
| 1373 | { "fec(GRA)", 32 }, | ||
| 1374 | { "fec(EBERR)", 33 }, | ||
| 1375 | { "fec(BABT)", 34 }, | ||
| 1376 | { "fec(BABR)", 35 }, | ||
| 1377 | { NULL }, | 1379 | { NULL }, |
| 1378 | }; | 1380 | }; |
| 1379 | 1381 | ||
| @@ -1533,18 +1535,8 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
| 1533 | unsigned short irq; | 1535 | unsigned short irq; |
| 1534 | } *idp, id[] = { | 1536 | } *idp, id[] = { |
| 1535 | { "fec(TXF)", 23 }, | 1537 | { "fec(TXF)", 23 }, |
| 1536 | { "fec(TXB)", 24 }, | ||
| 1537 | { "fec(TXFIFO)", 25 }, | ||
| 1538 | { "fec(TXCR)", 26 }, | ||
| 1539 | { "fec(RXF)", 27 }, | 1538 | { "fec(RXF)", 27 }, |
| 1540 | { "fec(RXB)", 28 }, | ||
| 1541 | { "fec(MII)", 29 }, | 1539 | { "fec(MII)", 29 }, |
| 1542 | { "fec(LC)", 30 }, | ||
| 1543 | { "fec(HBERR)", 31 }, | ||
| 1544 | { "fec(GRA)", 32 }, | ||
| 1545 | { "fec(EBERR)", 33 }, | ||
| 1546 | { "fec(BABT)", 34 }, | ||
| 1547 | { "fec(BABR)", 35 }, | ||
| 1548 | { NULL }, | 1540 | { NULL }, |
| 1549 | }; | 1541 | }; |
| 1550 | 1542 | ||
| @@ -1660,18 +1652,8 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
| 1660 | unsigned short irq; | 1652 | unsigned short irq; |
| 1661 | } *idp, id[] = { | 1653 | } *idp, id[] = { |
| 1662 | { "fec(TXF)", 36 }, | 1654 | { "fec(TXF)", 36 }, |
| 1663 | { "fec(TXB)", 37 }, | ||
| 1664 | { "fec(TXFIFO)", 38 }, | ||
| 1665 | { "fec(TXCR)", 39 }, | ||
| 1666 | { "fec(RXF)", 40 }, | 1655 | { "fec(RXF)", 40 }, |
| 1667 | { "fec(RXB)", 41 }, | ||
| 1668 | { "fec(MII)", 42 }, | 1656 | { "fec(MII)", 42 }, |
| 1669 | { "fec(LC)", 43 }, | ||
| 1670 | { "fec(HBERR)", 44 }, | ||
| 1671 | { "fec(GRA)", 45 }, | ||
| 1672 | { "fec(EBERR)", 46 }, | ||
| 1673 | { "fec(BABT)", 47 }, | ||
| 1674 | { "fec(BABR)", 48 }, | ||
| 1675 | { NULL }, | 1657 | { NULL }, |
| 1676 | }; | 1658 | }; |
| 1677 | 1659 | ||
| @@ -2126,6 +2108,7 @@ mii_discover_phy(uint mii_reg, struct net_device *dev) | |||
| 2126 | 2108 | ||
| 2127 | /* This interrupt occurs when the PHY detects a link change. | 2109 | /* This interrupt occurs when the PHY detects a link change. |
| 2128 | */ | 2110 | */ |
| 2111 | #ifdef HAVE_mii_link_interrupt | ||
| 2129 | #ifdef CONFIG_RPXCLASSIC | 2112 | #ifdef CONFIG_RPXCLASSIC |
| 2130 | static void | 2113 | static void |
| 2131 | mii_link_interrupt(void *dev_id) | 2114 | mii_link_interrupt(void *dev_id) |
| @@ -2148,6 +2131,7 @@ mii_link_interrupt(int irq, void * dev_id) | |||
| 2148 | 2131 | ||
| 2149 | return IRQ_HANDLED; | 2132 | return IRQ_HANDLED; |
| 2150 | } | 2133 | } |
| 2134 | #endif | ||
| 2151 | 2135 | ||
| 2152 | static int | 2136 | static int |
| 2153 | fec_enet_open(struct net_device *dev) | 2137 | fec_enet_open(struct net_device *dev) |
| @@ -2243,13 +2227,13 @@ static void set_multicast_list(struct net_device *dev) | |||
| 2243 | /* Catch all multicast addresses, so set the | 2227 | /* Catch all multicast addresses, so set the |
| 2244 | * filter to all 1's. | 2228 | * filter to all 1's. |
| 2245 | */ | 2229 | */ |
| 2246 | ep->fec_hash_table_high = 0xffffffff; | 2230 | ep->fec_grp_hash_table_high = 0xffffffff; |
| 2247 | ep->fec_hash_table_low = 0xffffffff; | 2231 | ep->fec_grp_hash_table_low = 0xffffffff; |
| 2248 | } else { | 2232 | } else { |
| 2249 | /* Clear filter and add the addresses in hash register. | 2233 | /* Clear filter and add the addresses in hash register. |
| 2250 | */ | 2234 | */ |
| 2251 | ep->fec_hash_table_high = 0; | 2235 | ep->fec_grp_hash_table_high = 0; |
| 2252 | ep->fec_hash_table_low = 0; | 2236 | ep->fec_grp_hash_table_low = 0; |
| 2253 | 2237 | ||
| 2254 | dmi = dev->mc_list; | 2238 | dmi = dev->mc_list; |
| 2255 | 2239 | ||
| @@ -2280,9 +2264,9 @@ static void set_multicast_list(struct net_device *dev) | |||
| 2280 | hash = (crc >> (32 - HASH_BITS)) & 0x3f; | 2264 | hash = (crc >> (32 - HASH_BITS)) & 0x3f; |
| 2281 | 2265 | ||
| 2282 | if (hash > 31) | 2266 | if (hash > 31) |
| 2283 | ep->fec_hash_table_high |= 1 << (hash - 32); | 2267 | ep->fec_grp_hash_table_high |= 1 << (hash - 32); |
| 2284 | else | 2268 | else |
| 2285 | ep->fec_hash_table_low |= 1 << hash; | 2269 | ep->fec_grp_hash_table_low |= 1 << hash; |
| 2286 | } | 2270 | } |
| 2287 | } | 2271 | } |
| 2288 | } | 2272 | } |
| @@ -2332,6 +2316,9 @@ int __init fec_enet_init(struct net_device *dev) | |||
| 2332 | return -ENOMEM; | 2316 | return -ENOMEM; |
| 2333 | } | 2317 | } |
| 2334 | 2318 | ||
| 2319 | spin_lock_init(&fep->hw_lock); | ||
| 2320 | spin_lock_init(&fep->mii_lock); | ||
| 2321 | |||
| 2335 | /* Create an Ethernet device instance. | 2322 | /* Create an Ethernet device instance. |
| 2336 | */ | 2323 | */ |
| 2337 | fecp = (volatile fec_t *) fec_hw[index]; | 2324 | fecp = (volatile fec_t *) fec_hw[index]; |
| @@ -2430,11 +2417,15 @@ int __init fec_enet_init(struct net_device *dev) | |||
| 2430 | */ | 2417 | */ |
| 2431 | fec_request_intrs(dev); | 2418 | fec_request_intrs(dev); |
| 2432 | 2419 | ||
| 2433 | fecp->fec_hash_table_high = 0; | 2420 | fecp->fec_grp_hash_table_high = 0; |
| 2434 | fecp->fec_hash_table_low = 0; | 2421 | fecp->fec_grp_hash_table_low = 0; |
| 2435 | fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; | 2422 | fecp->fec_r_buff_size = PKT_MAXBLR_SIZE; |
| 2436 | fecp->fec_ecntrl = 2; | 2423 | fecp->fec_ecntrl = 2; |
| 2437 | fecp->fec_r_des_active = 0; | 2424 | fecp->fec_r_des_active = 0; |
| 2425 | #ifndef CONFIG_M5272 | ||
| 2426 | fecp->fec_hash_table_high = 0; | ||
| 2427 | fecp->fec_hash_table_low = 0; | ||
| 2428 | #endif | ||
| 2438 | 2429 | ||
| 2439 | dev->base_addr = (unsigned long)fecp; | 2430 | dev->base_addr = (unsigned long)fecp; |
| 2440 | 2431 | ||
| @@ -2455,8 +2446,7 @@ int __init fec_enet_init(struct net_device *dev) | |||
| 2455 | 2446 | ||
| 2456 | /* Clear and enable interrupts */ | 2447 | /* Clear and enable interrupts */ |
| 2457 | fecp->fec_ievent = 0xffc00000; | 2448 | fecp->fec_ievent = 0xffc00000; |
| 2458 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | | 2449 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII); |
| 2459 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); | ||
| 2460 | 2450 | ||
| 2461 | /* Queue up command to detect the PHY and initialize the | 2451 | /* Queue up command to detect the PHY and initialize the |
| 2462 | * remainder of the interface. | 2452 | * remainder of the interface. |
| @@ -2500,8 +2490,8 @@ fec_restart(struct net_device *dev, int duplex) | |||
| 2500 | 2490 | ||
| 2501 | /* Reset all multicast. | 2491 | /* Reset all multicast. |
| 2502 | */ | 2492 | */ |
| 2503 | fecp->fec_hash_table_high = 0; | 2493 | fecp->fec_grp_hash_table_high = 0; |
| 2504 | fecp->fec_hash_table_low = 0; | 2494 | fecp->fec_grp_hash_table_low = 0; |
| 2505 | 2495 | ||
| 2506 | /* Set maximum receive buffer size. | 2496 | /* Set maximum receive buffer size. |
| 2507 | */ | 2497 | */ |
| @@ -2583,8 +2573,7 @@ fec_restart(struct net_device *dev, int duplex) | |||
| 2583 | 2573 | ||
| 2584 | /* Enable interrupts we wish to service. | 2574 | /* Enable interrupts we wish to service. |
| 2585 | */ | 2575 | */ |
| 2586 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_TXB | | 2576 | fecp->fec_imask = (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII); |
| 2587 | FEC_ENET_RXF | FEC_ENET_RXB | FEC_ENET_MII); | ||
| 2588 | } | 2577 | } |
| 2589 | 2578 | ||
| 2590 | static void | 2579 | static void |
| @@ -2624,7 +2613,7 @@ fec_stop(struct net_device *dev) | |||
| 2624 | static int __init fec_enet_module_init(void) | 2613 | static int __init fec_enet_module_init(void) |
| 2625 | { | 2614 | { |
| 2626 | struct net_device *dev; | 2615 | struct net_device *dev; |
| 2627 | int i, j, err; | 2616 | int i, err; |
| 2628 | DECLARE_MAC_BUF(mac); | 2617 | DECLARE_MAC_BUF(mac); |
| 2629 | 2618 | ||
| 2630 | printk("FEC ENET Version 0.2\n"); | 2619 | printk("FEC ENET Version 0.2\n"); |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 1d421606984f..292719daceff 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
| @@ -88,8 +88,8 @@ typedef struct fec { | |||
| 88 | unsigned long fec_reserved7[158]; | 88 | unsigned long fec_reserved7[158]; |
| 89 | unsigned long fec_addr_low; /* Low 32bits MAC address */ | 89 | unsigned long fec_addr_low; /* Low 32bits MAC address */ |
| 90 | unsigned long fec_addr_high; /* High 16bits MAC address */ | 90 | unsigned long fec_addr_high; /* High 16bits MAC address */ |
| 91 | unsigned long fec_hash_table_high; /* High 32bits hash table */ | 91 | unsigned long fec_grp_hash_table_high;/* High 32bits hash table */ |
| 92 | unsigned long fec_hash_table_low; /* Low 32bits hash table */ | 92 | unsigned long fec_grp_hash_table_low; /* Low 32bits hash table */ |
| 93 | unsigned long fec_r_des_start; /* Receive descriptor ring */ | 93 | unsigned long fec_r_des_start; /* Receive descriptor ring */ |
| 94 | unsigned long fec_x_des_start; /* Transmit descriptor ring */ | 94 | unsigned long fec_x_des_start; /* Transmit descriptor ring */ |
| 95 | unsigned long fec_r_buff_size; /* Maximum receive buff size */ | 95 | unsigned long fec_r_buff_size; /* Maximum receive buff size */ |
diff --git a/drivers/pcmcia/au1000_db1x00.c b/drivers/pcmcia/au1000_db1x00.c index 74e051535d6c..c78d77fd7e3b 100644 --- a/drivers/pcmcia/au1000_db1x00.c +++ b/drivers/pcmcia/au1000_db1x00.c | |||
| @@ -194,7 +194,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s | |||
| 194 | default: | 194 | default: |
| 195 | pwr |= SET_VCC_VPP(0,0,sock); | 195 | pwr |= SET_VCC_VPP(0,0,sock); |
| 196 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 196 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 197 | __FUNCTION__, | 197 | __func__, |
| 198 | state->Vcc, | 198 | state->Vcc, |
| 199 | state->Vpp); | 199 | state->Vpp); |
| 200 | break; | 200 | break; |
| @@ -215,7 +215,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s | |||
| 215 | default: | 215 | default: |
| 216 | pwr |= SET_VCC_VPP(0,0,sock); | 216 | pwr |= SET_VCC_VPP(0,0,sock); |
| 217 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 217 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 218 | __FUNCTION__, | 218 | __func__, |
| 219 | state->Vcc, | 219 | state->Vcc, |
| 220 | state->Vpp); | 220 | state->Vpp); |
| 221 | break; | 221 | break; |
| @@ -224,7 +224,7 @@ db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_s | |||
| 224 | default: /* what's this ? */ | 224 | default: /* what's this ? */ |
| 225 | pwr |= SET_VCC_VPP(0,0,sock); | 225 | pwr |= SET_VCC_VPP(0,0,sock); |
| 226 | printk(KERN_ERR "%s: bad Vcc %d\n", | 226 | printk(KERN_ERR "%s: bad Vcc %d\n", |
| 227 | __FUNCTION__, state->Vcc); | 227 | __func__, state->Vcc); |
| 228 | break; | 228 | break; |
| 229 | } | 229 | } |
| 230 | 230 | ||
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index b693367d38cd..75e8f8505e47 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/notifier.h> | 41 | #include <linux/notifier.h> |
| 42 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
| 43 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
| 44 | #include <linux/mutex.h> | ||
| 44 | #include <linux/platform_device.h> | 45 | #include <linux/platform_device.h> |
| 45 | 46 | ||
| 46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
| @@ -71,7 +72,7 @@ extern struct au1000_pcmcia_socket au1000_pcmcia_socket[]; | |||
| 71 | u32 *pcmcia_base_vaddrs[2]; | 72 | u32 *pcmcia_base_vaddrs[2]; |
| 72 | extern const unsigned long mips_io_port_base; | 73 | extern const unsigned long mips_io_port_base; |
| 73 | 74 | ||
| 74 | DECLARE_MUTEX(pcmcia_sockets_lock); | 75 | static DEFINE_MUTEX(pcmcia_sockets_lock); |
| 75 | 76 | ||
| 76 | static int (*au1x00_pcmcia_hw_init[])(struct device *dev) = { | 77 | static int (*au1x00_pcmcia_hw_init[])(struct device *dev) = { |
| 77 | au1x_board_init, | 78 | au1x_board_init, |
| @@ -472,7 +473,7 @@ int au1x00_drv_pcmcia_remove(struct device *dev) | |||
| 472 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); | 473 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); |
| 473 | int i; | 474 | int i; |
| 474 | 475 | ||
| 475 | down(&pcmcia_sockets_lock); | 476 | mutex_lock(&pcmcia_sockets_lock); |
| 476 | dev_set_drvdata(dev, NULL); | 477 | dev_set_drvdata(dev, NULL); |
| 477 | 478 | ||
| 478 | for (i = 0; i < sinfo->nskt; i++) { | 479 | for (i = 0; i < sinfo->nskt; i++) { |
| @@ -488,7 +489,7 @@ int au1x00_drv_pcmcia_remove(struct device *dev) | |||
| 488 | } | 489 | } |
| 489 | 490 | ||
| 490 | kfree(sinfo); | 491 | kfree(sinfo); |
| 491 | up(&pcmcia_sockets_lock); | 492 | mutex_unlock(&pcmcia_sockets_lock); |
| 492 | return 0; | 493 | return 0; |
| 493 | } | 494 | } |
| 494 | 495 | ||
| @@ -501,13 +502,13 @@ static int au1x00_drv_pcmcia_probe(struct device *dev) | |||
| 501 | { | 502 | { |
| 502 | int i, ret = -ENODEV; | 503 | int i, ret = -ENODEV; |
| 503 | 504 | ||
| 504 | down(&pcmcia_sockets_lock); | 505 | mutex_lock(&pcmcia_sockets_lock); |
| 505 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { | 506 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { |
| 506 | ret = au1x00_pcmcia_hw_init[i](dev); | 507 | ret = au1x00_pcmcia_hw_init[i](dev); |
| 507 | if (ret == 0) | 508 | if (ret == 0) |
| 508 | break; | 509 | break; |
| 509 | } | 510 | } |
| 510 | up(&pcmcia_sockets_lock); | 511 | mutex_unlock(&pcmcia_sockets_lock); |
| 511 | return ret; | 512 | return ret; |
| 512 | } | 513 | } |
| 513 | 514 | ||
diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index 86c0808d6a05..157e41423a0a 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c | |||
| @@ -244,7 +244,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 244 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, | 244 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, |
| 245 | configure->sock); | 245 | configure->sock); |
| 246 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 246 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 247 | __FUNCTION__, | 247 | __func__, |
| 248 | configure->vcc, | 248 | configure->vcc, |
| 249 | configure->vpp); | 249 | configure->vpp); |
| 250 | break; | 250 | break; |
| @@ -272,7 +272,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 272 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, | 272 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, |
| 273 | configure->sock); | 273 | configure->sock); |
| 274 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 274 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 275 | __FUNCTION__, | 275 | __func__, |
| 276 | configure->vcc, | 276 | configure->vcc, |
| 277 | configure->vpp); | 277 | configure->vpp); |
| 278 | break; | 278 | break; |
| @@ -300,7 +300,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 300 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, | 300 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ, |
| 301 | configure->sock); | 301 | configure->sock); |
| 302 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 302 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 303 | __FUNCTION__, | 303 | __func__, |
| 304 | configure->vcc, | 304 | configure->vcc, |
| 305 | configure->vpp); | 305 | configure->vpp); |
| 306 | break; | 306 | break; |
| @@ -309,7 +309,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 309 | default: /* what's this ? */ | 309 | default: /* what's this ? */ |
| 310 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ,configure->sock); | 310 | pcr |= SET_VCC_VPP(VCC_HIZ,VPP_HIZ,configure->sock); |
| 311 | printk(KERN_ERR "%s: bad Vcc %d\n", | 311 | printk(KERN_ERR "%s: bad Vcc %d\n", |
| 312 | __FUNCTION__, configure->vcc); | 312 | __func__, configure->vcc); |
| 313 | break; | 313 | break; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| @@ -353,7 +353,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 353 | default: | 353 | default: |
| 354 | pcr |= SET_VCC_VPP(0,0); | 354 | pcr |= SET_VCC_VPP(0,0); |
| 355 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 355 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 356 | __FUNCTION__, | 356 | __func__, |
| 357 | configure->vcc, | 357 | configure->vcc, |
| 358 | configure->vpp); | 358 | configure->vpp); |
| 359 | break; | 359 | break; |
| @@ -374,7 +374,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 374 | default: | 374 | default: |
| 375 | pcr |= SET_VCC_VPP(0,0); | 375 | pcr |= SET_VCC_VPP(0,0); |
| 376 | printk("%s: bad Vcc/Vpp (%d:%d)\n", | 376 | printk("%s: bad Vcc/Vpp (%d:%d)\n", |
| 377 | __FUNCTION__, | 377 | __func__, |
| 378 | configure->vcc, | 378 | configure->vcc, |
| 379 | configure->vpp); | 379 | configure->vpp); |
| 380 | break; | 380 | break; |
| @@ -383,7 +383,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure) | |||
| 383 | default: /* what's this ? */ | 383 | default: /* what's this ? */ |
| 384 | pcr |= SET_VCC_VPP(0,0); | 384 | pcr |= SET_VCC_VPP(0,0); |
| 385 | printk(KERN_ERR "%s: bad Vcc %d\n", | 385 | printk(KERN_ERR "%s: bad Vcc %d\n", |
| 386 | __FUNCTION__, configure->vcc); | 386 | __func__, configure->vcc); |
| 387 | break; | 387 | break; |
| 388 | } | 388 | } |
| 389 | 389 | ||
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index ce9d5c44a7b5..c78ed5347510 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #define PCMCIA_IRQ AU1000_GPIO_4 | 56 | #define PCMCIA_IRQ AU1000_GPIO_4 |
| 57 | 57 | ||
| 58 | #if 0 | 58 | #if 0 |
| 59 | #define DEBUG(x,args...) printk(__FUNCTION__ ": " x,##args) | 59 | #define DEBUG(x, args...) printk(__func__ ": " x, ##args) |
| 60 | #else | 60 | #else |
| 61 | #define DEBUG(x,args...) | 61 | #define DEBUG(x,args...) |
| 62 | #endif | 62 | #endif |
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 714baaeb6da1..fb2f38dc92c5 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
| @@ -209,7 +209,7 @@ static void cardbus_assign_irqs(struct pci_bus *bus, int irq) | |||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | int cb_alloc(struct pcmcia_socket * s) | 212 | int __ref cb_alloc(struct pcmcia_socket * s) |
| 213 | { | 213 | { |
| 214 | struct pci_bus *bus = s->cb_dev->subordinate; | 214 | struct pci_bus *bus = s->cb_dev->subordinate; |
| 215 | struct pci_dev *dev; | 215 | struct pci_dev *dev; |
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 56230dbd347a..29276bd28295 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
| @@ -652,6 +652,9 @@ static int pccardd(void *__skt) | |||
| 652 | complete(&skt->thread_done); | 652 | complete(&skt->thread_done); |
| 653 | return 0; | 653 | return 0; |
| 654 | } | 654 | } |
| 655 | ret = pccard_sysfs_add_socket(&skt->dev); | ||
| 656 | if (ret) | ||
| 657 | dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); | ||
| 655 | 658 | ||
| 656 | add_wait_queue(&skt->thread_wait, &wait); | 659 | add_wait_queue(&skt->thread_wait, &wait); |
| 657 | complete(&skt->thread_done); | 660 | complete(&skt->thread_done); |
| @@ -694,6 +697,7 @@ static int pccardd(void *__skt) | |||
| 694 | remove_wait_queue(&skt->thread_wait, &wait); | 697 | remove_wait_queue(&skt->thread_wait, &wait); |
| 695 | 698 | ||
| 696 | /* remove from the device core */ | 699 | /* remove from the device core */ |
| 700 | pccard_sysfs_remove_socket(&skt->dev); | ||
| 697 | device_unregister(&skt->dev); | 701 | device_unregister(&skt->dev); |
| 698 | 702 | ||
| 699 | return 0; | 703 | return 0; |
| @@ -940,20 +944,13 @@ EXPORT_SYMBOL(pcmcia_socket_class); | |||
| 940 | 944 | ||
| 941 | static int __init init_pcmcia_cs(void) | 945 | static int __init init_pcmcia_cs(void) |
| 942 | { | 946 | { |
| 943 | int ret; | ||
| 944 | |||
| 945 | init_completion(&pcmcia_unload); | 947 | init_completion(&pcmcia_unload); |
| 946 | ret = class_register(&pcmcia_socket_class); | 948 | return class_register(&pcmcia_socket_class); |
| 947 | if (ret) | ||
| 948 | return (ret); | ||
| 949 | return class_interface_register(&pccard_sysfs_interface); | ||
| 950 | } | 949 | } |
| 951 | 950 | ||
| 952 | static void __exit exit_pcmcia_cs(void) | 951 | static void __exit exit_pcmcia_cs(void) |
| 953 | { | 952 | { |
| 954 | class_interface_unregister(&pccard_sysfs_interface); | ||
| 955 | class_unregister(&pcmcia_socket_class); | 953 | class_unregister(&pcmcia_socket_class); |
| 956 | |||
| 957 | wait_for_completion(&pcmcia_unload); | 954 | wait_for_completion(&pcmcia_unload); |
| 958 | } | 955 | } |
| 959 | 956 | ||
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 9fa207e3c7b3..e7d5d141f24d 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
| @@ -121,7 +121,8 @@ struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, | |||
| 121 | void release_resource_db(struct pcmcia_socket *s); | 121 | void release_resource_db(struct pcmcia_socket *s); |
| 122 | 122 | ||
| 123 | /* In socket_sysfs.c */ | 123 | /* In socket_sysfs.c */ |
| 124 | extern struct class_interface pccard_sysfs_interface; | 124 | extern int pccard_sysfs_add_socket(struct device *dev); |
| 125 | extern void pccard_sysfs_remove_socket(struct device *dev); | ||
| 125 | 126 | ||
| 126 | /* In cs.c */ | 127 | /* In cs.c */ |
| 127 | extern struct rw_semaphore pcmcia_socket_list_rwsem; | 128 | extern struct rw_semaphore pcmcia_socket_list_rwsem; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 5a85871f5ee9..e40775443d04 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
| @@ -1520,7 +1520,7 @@ static void pcmcia_bus_remove_socket(struct device *dev, | |||
| 1520 | 1520 | ||
| 1521 | 1521 | ||
| 1522 | /* the pcmcia_bus_interface is used to handle pcmcia socket devices */ | 1522 | /* the pcmcia_bus_interface is used to handle pcmcia socket devices */ |
| 1523 | static struct class_interface pcmcia_bus_interface = { | 1523 | static struct class_interface pcmcia_bus_interface __refdata = { |
| 1524 | .class = &pcmcia_socket_class, | 1524 | .class = &pcmcia_socket_class, |
| 1525 | .add_dev = &pcmcia_bus_add_socket, | 1525 | .add_dev = &pcmcia_bus_add_socket, |
| 1526 | .remove_dev = &pcmcia_bus_remove_socket, | 1526 | .remove_dev = &pcmcia_bus_remove_socket, |
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index e54ecc580d9e..e13618656ff7 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c | |||
| @@ -53,7 +53,7 @@ static int i82092aa_socket_resume (struct pci_dev *dev) | |||
| 53 | } | 53 | } |
| 54 | #endif | 54 | #endif |
| 55 | 55 | ||
| 56 | static struct pci_driver i82092aa_pci_drv = { | 56 | static struct pci_driver i82092aa_pci_driver = { |
| 57 | .name = "i82092aa", | 57 | .name = "i82092aa", |
| 58 | .id_table = i82092aa_pci_ids, | 58 | .id_table = i82092aa_pci_ids, |
| 59 | .probe = i82092aa_pci_probe, | 59 | .probe = i82092aa_pci_probe, |
| @@ -714,13 +714,13 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ | |||
| 714 | 714 | ||
| 715 | static int i82092aa_module_init(void) | 715 | static int i82092aa_module_init(void) |
| 716 | { | 716 | { |
| 717 | return pci_register_driver(&i82092aa_pci_drv); | 717 | return pci_register_driver(&i82092aa_pci_driver); |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | static void i82092aa_module_exit(void) | 720 | static void i82092aa_module_exit(void) |
| 721 | { | 721 | { |
| 722 | enter("i82092aa_module_exit"); | 722 | enter("i82092aa_module_exit"); |
| 723 | pci_unregister_driver(&i82092aa_pci_drv); | 723 | pci_unregister_driver(&i82092aa_pci_driver); |
| 724 | if (sockets[0].io_base>0) | 724 | if (sockets[0].io_base>0) |
| 725 | release_region(sockets[0].io_base, 2); | 725 | release_region(sockets[0].io_base, 2); |
| 726 | leave("i82092aa_module_exit"); | 726 | leave("i82092aa_module_exit"); |
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index bb6db3a582b2..46314b420765 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c | |||
| @@ -153,7 +153,7 @@ omap_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) | |||
| 153 | 153 | ||
| 154 | static int omap_cf_ss_suspend(struct pcmcia_socket *s) | 154 | static int omap_cf_ss_suspend(struct pcmcia_socket *s) |
| 155 | { | 155 | { |
| 156 | pr_debug("%s: %s\n", driver_name, __FUNCTION__); | 156 | pr_debug("%s: %s\n", driver_name, __func__); |
| 157 | return omap_cf_set_socket(s, &dead_socket); | 157 | return omap_cf_set_socket(s, &dead_socket); |
| 158 | } | 158 | } |
| 159 | 159 | ||
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index abc10fe49bd8..8bed1dab9039 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
| @@ -778,7 +778,7 @@ static struct pci_device_id pd6729_pci_ids[] = { | |||
| 778 | }; | 778 | }; |
| 779 | MODULE_DEVICE_TABLE(pci, pd6729_pci_ids); | 779 | MODULE_DEVICE_TABLE(pci, pd6729_pci_ids); |
| 780 | 780 | ||
| 781 | static struct pci_driver pd6729_pci_drv = { | 781 | static struct pci_driver pd6729_pci_driver = { |
| 782 | .name = "pd6729", | 782 | .name = "pd6729", |
| 783 | .id_table = pd6729_pci_ids, | 783 | .id_table = pd6729_pci_ids, |
| 784 | .probe = pd6729_pci_probe, | 784 | .probe = pd6729_pci_probe, |
| @@ -791,12 +791,12 @@ static struct pci_driver pd6729_pci_drv = { | |||
| 791 | 791 | ||
| 792 | static int pd6729_module_init(void) | 792 | static int pd6729_module_init(void) |
| 793 | { | 793 | { |
| 794 | return pci_register_driver(&pd6729_pci_drv); | 794 | return pci_register_driver(&pd6729_pci_driver); |
| 795 | } | 795 | } |
| 796 | 796 | ||
| 797 | static void pd6729_module_exit(void) | 797 | static void pd6729_module_exit(void) |
| 798 | { | 798 | { |
| 799 | pci_unregister_driver(&pd6729_pci_drv); | 799 | pci_unregister_driver(&pd6729_pci_driver); |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | module_init(pd6729_module_init); | 802 | module_init(pd6729_module_init); |
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 4a05802213c8..881ec8a8e389 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
| @@ -87,7 +87,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 87 | 87 | ||
| 88 | default: | 88 | default: |
| 89 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 89 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
| 90 | __FUNCTION__, state->Vcc); | 90 | __func__, state->Vcc); |
| 91 | ret = -1; | 91 | ret = -1; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| @@ -104,7 +104,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 104 | pa_dwr_set |= GPIO_A0; | 104 | pa_dwr_set |= GPIO_A0; |
| 105 | else { | 105 | else { |
| 106 | printk(KERN_ERR "%s(): unrecognized Vpp %u\n", | 106 | printk(KERN_ERR "%s(): unrecognized Vpp %u\n", |
| 107 | __FUNCTION__, state->Vpp); | 107 | __func__, state->Vpp); |
| 108 | ret = -1; | 108 | ret = -1; |
| 109 | break; | 109 | break; |
| 110 | } | 110 | } |
| @@ -128,14 +128,14 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 128 | 128 | ||
| 129 | default: | 129 | default: |
| 130 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 130 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
| 131 | __FUNCTION__, state->Vcc); | 131 | __func__, state->Vcc); |
| 132 | ret = -1; | 132 | ret = -1; |
| 133 | break; | 133 | break; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | if (state->Vpp != state->Vcc && state->Vpp != 0) { | 136 | if (state->Vpp != state->Vcc && state->Vpp != 0) { |
| 137 | printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n", | 137 | printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n", |
| 138 | __FUNCTION__, state->Vpp); | 138 | __func__, state->Vpp); |
| 139 | ret = -1; | 139 | ret = -1; |
| 140 | break; | 140 | break; |
| 141 | } | 141 | } |
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 6fa5eaaab8af..145b85e0f02c 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
| @@ -99,7 +99,7 @@ static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 99 | case 50: power |= MST_PCMCIA_PWR_VCC_50; break; | 99 | case 50: power |= MST_PCMCIA_PWR_VCC_50; break; |
| 100 | default: | 100 | default: |
| 101 | printk(KERN_ERR "%s(): bad Vcc %u\n", | 101 | printk(KERN_ERR "%s(): bad Vcc %u\n", |
| 102 | __FUNCTION__, state->Vcc); | 102 | __func__, state->Vcc); |
| 103 | ret = -1; | 103 | ret = -1; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| @@ -111,7 +111,7 @@ static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 111 | power |= MST_PCMCIA_PWR_VPP_VCC; | 111 | power |= MST_PCMCIA_PWR_VPP_VCC; |
| 112 | } else { | 112 | } else { |
| 113 | printk(KERN_ERR "%s(): bad Vpp %u\n", | 113 | printk(KERN_ERR "%s(): bad Vpp %u\n", |
| 114 | __FUNCTION__, state->Vpp); | 114 | __func__, state->Vpp); |
| 115 | ret = -1; | 115 | ret = -1; |
| 116 | } | 116 | } |
| 117 | } | 117 | } |
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index a8d100707721..0fcf763b9175 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c | |||
| @@ -1045,7 +1045,7 @@ static void __devexit pccard_sysfs_remove_rsrc(struct device *dev, | |||
| 1045 | device_remove_file(dev, *attr); | 1045 | device_remove_file(dev, *attr); |
| 1046 | } | 1046 | } |
| 1047 | 1047 | ||
| 1048 | static struct class_interface pccard_rsrc_interface = { | 1048 | static struct class_interface pccard_rsrc_interface __refdata = { |
| 1049 | .class = &pcmcia_socket_class, | 1049 | .class = &pcmcia_socket_class, |
| 1050 | .add_dev = &pccard_sysfs_add_rsrc, | 1050 | .add_dev = &pccard_sysfs_add_rsrc, |
| 1051 | .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc), | 1051 | .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc), |
diff --git a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c index 7c57fdd3c8d7..ce133ce81c10 100644 --- a/drivers/pcmcia/sa1100_assabet.c +++ b/drivers/pcmcia/sa1100_assabet.c | |||
| @@ -66,14 +66,14 @@ assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_stat | |||
| 66 | 66 | ||
| 67 | case 50: | 67 | case 50: |
| 68 | printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V...\n", | 68 | printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V...\n", |
| 69 | __FUNCTION__); | 69 | __func__); |
| 70 | 70 | ||
| 71 | case 33: /* Can only apply 3.3V to the CF slot. */ | 71 | case 33: /* Can only apply 3.3V to the CF slot. */ |
| 72 | mask = ASSABET_BCR_CF_PWR; | 72 | mask = ASSABET_BCR_CF_PWR; |
| 73 | break; | 73 | break; |
| 74 | 74 | ||
| 75 | default: | 75 | default: |
| 76 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__, | 76 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __func__, |
| 77 | state->Vcc); | 77 | state->Vcc); |
| 78 | return -1; | 78 | return -1; |
| 79 | } | 79 | } |
diff --git a/drivers/pcmcia/sa1100_badge4.c b/drivers/pcmcia/sa1100_badge4.c index 62bfc7566ec2..607c3f326eca 100644 --- a/drivers/pcmcia/sa1100_badge4.c +++ b/drivers/pcmcia/sa1100_badge4.c | |||
| @@ -82,14 +82,14 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state | |||
| 82 | case 0: | 82 | case 0: |
| 83 | if ((state->Vcc != 0) && | 83 | if ((state->Vcc != 0) && |
| 84 | (state->Vcc != badge4_pcmvcc)) { | 84 | (state->Vcc != badge4_pcmvcc)) { |
| 85 | complain_about_jumpering(__FUNCTION__, "pcmvcc", | 85 | complain_about_jumpering(__func__, "pcmvcc", |
| 86 | badge4_pcmvcc, state->Vcc); | 86 | badge4_pcmvcc, state->Vcc); |
| 87 | // Apply power regardless of the jumpering. | 87 | // Apply power regardless of the jumpering. |
| 88 | // return -1; | 88 | // return -1; |
| 89 | } | 89 | } |
| 90 | if ((state->Vpp != 0) && | 90 | if ((state->Vpp != 0) && |
| 91 | (state->Vpp != badge4_pcmvpp)) { | 91 | (state->Vpp != badge4_pcmvpp)) { |
| 92 | complain_about_jumpering(__FUNCTION__, "pcmvpp", | 92 | complain_about_jumpering(__func__, "pcmvpp", |
| 93 | badge4_pcmvpp, state->Vpp); | 93 | badge4_pcmvpp, state->Vpp); |
| 94 | return -1; | 94 | return -1; |
| 95 | } | 95 | } |
| @@ -98,7 +98,7 @@ badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state | |||
| 98 | case 1: | 98 | case 1: |
| 99 | if ((state->Vcc != 0) && | 99 | if ((state->Vcc != 0) && |
| 100 | (state->Vcc != badge4_cfvcc)) { | 100 | (state->Vcc != badge4_cfvcc)) { |
| 101 | complain_about_jumpering(__FUNCTION__, "cfvcc", | 101 | complain_about_jumpering(__func__, "cfvcc", |
| 102 | badge4_cfvcc, state->Vcc); | 102 | badge4_cfvcc, state->Vcc); |
| 103 | return -1; | 103 | return -1; |
| 104 | } | 104 | } |
| @@ -143,7 +143,7 @@ int pcmcia_badge4_init(struct device *dev) | |||
| 143 | if (machine_is_badge4()) { | 143 | if (machine_is_badge4()) { |
| 144 | printk(KERN_INFO | 144 | printk(KERN_INFO |
| 145 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | 145 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", |
| 146 | __FUNCTION__, | 146 | __func__, |
| 147 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | 147 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); |
| 148 | 148 | ||
| 149 | ret = sa11xx_drv_pcmcia_probe(dev, &badge4_pcmcia_ops, 0, 2); | 149 | ret = sa11xx_drv_pcmcia_probe(dev, &badge4_pcmcia_ops, 0, 2); |
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c index 549a1529fe35..7c3951a2675d 100644 --- a/drivers/pcmcia/sa1100_cerf.c +++ b/drivers/pcmcia/sa1100_cerf.c | |||
| @@ -63,7 +63,7 @@ cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 63 | 63 | ||
| 64 | default: | 64 | default: |
| 65 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 65 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
| 66 | __FUNCTION__, state->Vcc); | 66 | __func__, state->Vcc); |
| 67 | return -1; | 67 | return -1; |
| 68 | } | 68 | } |
| 69 | 69 | ||
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c index 6284c35dabc6..2167e6714d2d 100644 --- a/drivers/pcmcia/sa1100_jornada720.c +++ b/drivers/pcmcia/sa1100_jornada720.c | |||
| @@ -42,7 +42,7 @@ jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s | |||
| 42 | unsigned int pa_dwr_mask, pa_dwr_set; | 42 | unsigned int pa_dwr_mask, pa_dwr_set; |
| 43 | int ret; | 43 | int ret; |
| 44 | 44 | ||
| 45 | printk("%s(): config socket %d vcc %d vpp %d\n", __FUNCTION__, | 45 | printk("%s(): config socket %d vcc %d vpp %d\n", __func__, |
| 46 | skt->nr, state->Vcc, state->Vpp); | 46 | skt->nr, state->Vcc, state->Vpp); |
| 47 | 47 | ||
| 48 | switch (skt->nr) { | 48 | switch (skt->nr) { |
| @@ -74,7 +74,7 @@ printk("%s(): config socket %d vcc %d vpp %d\n", __FUNCTION__, | |||
| 74 | 74 | ||
| 75 | if (state->Vpp != state->Vcc && state->Vpp != 0) { | 75 | if (state->Vpp != state->Vcc && state->Vpp != 0) { |
| 76 | printk(KERN_ERR "%s(): slot cannot support VPP %u\n", | 76 | printk(KERN_ERR "%s(): slot cannot support VPP %u\n", |
| 77 | __FUNCTION__, state->Vpp); | 77 | __func__, state->Vpp); |
| 78 | return -1; | 78 | return -1; |
| 79 | } | 79 | } |
| 80 | 80 | ||
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c index 5bc9e9532b9d..687492fcd5b4 100644 --- a/drivers/pcmcia/sa1100_neponset.c +++ b/drivers/pcmcia/sa1100_neponset.c | |||
| @@ -59,7 +59,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta | |||
| 59 | ncr_set = NCR_A0VPP; | 59 | ncr_set = NCR_A0VPP; |
| 60 | else { | 60 | else { |
| 61 | printk(KERN_ERR "%s(): unrecognized VPP %u\n", | 61 | printk(KERN_ERR "%s(): unrecognized VPP %u\n", |
| 62 | __FUNCTION__, state->Vpp); | 62 | __func__, state->Vpp); |
| 63 | return -1; | 63 | return -1; |
| 64 | } | 64 | } |
| 65 | break; | 65 | break; |
| @@ -71,7 +71,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta | |||
| 71 | 71 | ||
| 72 | if (state->Vpp != state->Vcc && state->Vpp != 0) { | 72 | if (state->Vpp != state->Vcc && state->Vpp != 0) { |
| 73 | printk(KERN_ERR "%s(): CF slot cannot support VPP %u\n", | 73 | printk(KERN_ERR "%s(): CF slot cannot support VPP %u\n", |
| 74 | __FUNCTION__, state->Vpp); | 74 | __func__, state->Vpp); |
| 75 | return -1; | 75 | return -1; |
| 76 | } | 76 | } |
| 77 | break; | 77 | break; |
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c index 9456f5478d09..494912fccc0d 100644 --- a/drivers/pcmcia/sa1100_shannon.c +++ b/drivers/pcmcia/sa1100_shannon.c | |||
| @@ -73,19 +73,19 @@ shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 73 | { | 73 | { |
| 74 | switch (state->Vcc) { | 74 | switch (state->Vcc) { |
| 75 | case 0: /* power off */ | 75 | case 0: /* power off */ |
| 76 | printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __FUNCTION__); | 76 | printk(KERN_WARNING "%s(): CS asked for 0V, still applying 3.3V..\n", __func__); |
| 77 | break; | 77 | break; |
| 78 | case 50: | 78 | case 50: |
| 79 | printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __FUNCTION__); | 79 | printk(KERN_WARNING "%s(): CS asked for 5V, applying 3.3V..\n", __func__); |
| 80 | case 33: | 80 | case 33: |
| 81 | break; | 81 | break; |
| 82 | default: | 82 | default: |
| 83 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 83 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
| 84 | __FUNCTION__, state->Vcc); | 84 | __func__, state->Vcc); |
| 85 | return -1; | 85 | return -1; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __FUNCTION__); | 88 | printk(KERN_WARNING "%s(): Warning, Can't perform reset\n", __func__); |
| 89 | 89 | ||
| 90 | /* Silently ignore Vpp, output enable, speaker enable. */ | 90 | /* Silently ignore Vpp, output enable, speaker enable. */ |
| 91 | 91 | ||
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c index 04d6f7f75f78..42567de894b9 100644 --- a/drivers/pcmcia/sa1100_simpad.c +++ b/drivers/pcmcia/sa1100_simpad.c | |||
| @@ -90,7 +90,7 @@ simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
| 90 | 90 | ||
| 91 | default: | 91 | default: |
| 92 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | 92 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", |
| 93 | __FUNCTION__, state->Vcc); | 93 | __func__, state->Vcc); |
| 94 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); | 94 | clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1); |
| 95 | local_irq_restore(flags); | 95 | local_irq_restore(flags); |
| 96 | return -1; | 96 | return -1; |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index aa7779d89752..420a77540f41 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
| 38 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
| 39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
| 40 | #include <linux/mutex.h> | ||
| 40 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
| 41 | #include <linux/irq.h> | 42 | #include <linux/irq.h> |
| 42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
| @@ -353,7 +354,7 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m | |||
| 353 | (map->flags&MAP_PREFETCH)?"PREFETCH ":""); | 354 | (map->flags&MAP_PREFETCH)?"PREFETCH ":""); |
| 354 | 355 | ||
| 355 | if (map->map >= MAX_IO_WIN) { | 356 | if (map->map >= MAX_IO_WIN) { |
| 356 | printk(KERN_ERR "%s(): map (%d) out of range\n", __FUNCTION__, | 357 | printk(KERN_ERR "%s(): map (%d) out of range\n", __func__, |
| 357 | map->map); | 358 | map->map); |
| 358 | return -1; | 359 | return -1; |
| 359 | } | 360 | } |
| @@ -578,7 +579,7 @@ EXPORT_SYMBOL(soc_pcmcia_enable_irqs); | |||
| 578 | 579 | ||
| 579 | 580 | ||
| 580 | LIST_HEAD(soc_pcmcia_sockets); | 581 | LIST_HEAD(soc_pcmcia_sockets); |
| 581 | DECLARE_MUTEX(soc_pcmcia_sockets_lock); | 582 | static DEFINE_MUTEX(soc_pcmcia_sockets_lock); |
| 582 | 583 | ||
| 583 | static const char *skt_names[] = { | 584 | static const char *skt_names[] = { |
| 584 | "PCMCIA socket 0", | 585 | "PCMCIA socket 0", |
| @@ -601,11 +602,11 @@ soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) | |||
| 601 | struct cpufreq_freqs *freqs = data; | 602 | struct cpufreq_freqs *freqs = data; |
| 602 | int ret = 0; | 603 | int ret = 0; |
| 603 | 604 | ||
| 604 | down(&soc_pcmcia_sockets_lock); | 605 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 605 | list_for_each_entry(skt, &soc_pcmcia_sockets, node) | 606 | list_for_each_entry(skt, &soc_pcmcia_sockets, node) |
| 606 | if ( skt->ops->frequency_change ) | 607 | if ( skt->ops->frequency_change ) |
| 607 | ret += skt->ops->frequency_change(skt, val, freqs); | 608 | ret += skt->ops->frequency_change(skt, val, freqs); |
| 608 | up(&soc_pcmcia_sockets_lock); | 609 | mutex_unlock(&soc_pcmcia_sockets_lock); |
| 609 | 610 | ||
| 610 | return ret; | 611 | return ret; |
| 611 | } | 612 | } |
| @@ -642,7 +643,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops | |||
| 642 | struct soc_pcmcia_socket *skt; | 643 | struct soc_pcmcia_socket *skt; |
| 643 | int ret, i; | 644 | int ret, i; |
| 644 | 645 | ||
| 645 | down(&soc_pcmcia_sockets_lock); | 646 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 646 | 647 | ||
| 647 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); | 648 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL); |
| 648 | if (!sinfo) { | 649 | if (!sinfo) { |
| @@ -782,7 +783,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops | |||
| 782 | kfree(sinfo); | 783 | kfree(sinfo); |
| 783 | 784 | ||
| 784 | out: | 785 | out: |
| 785 | up(&soc_pcmcia_sockets_lock); | 786 | mutex_unlock(&soc_pcmcia_sockets_lock); |
| 786 | return ret; | 787 | return ret; |
| 787 | } | 788 | } |
| 788 | 789 | ||
| @@ -793,7 +794,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) | |||
| 793 | 794 | ||
| 794 | dev_set_drvdata(dev, NULL); | 795 | dev_set_drvdata(dev, NULL); |
| 795 | 796 | ||
| 796 | down(&soc_pcmcia_sockets_lock); | 797 | mutex_lock(&soc_pcmcia_sockets_lock); |
| 797 | for (i = 0; i < sinfo->nskt; i++) { | 798 | for (i = 0; i < sinfo->nskt; i++) { |
| 798 | struct soc_pcmcia_socket *skt = &sinfo->skt[i]; | 799 | struct soc_pcmcia_socket *skt = &sinfo->skt[i]; |
| 799 | 800 | ||
| @@ -818,7 +819,7 @@ int soc_common_drv_pcmcia_remove(struct device *dev) | |||
| 818 | if (list_empty(&soc_pcmcia_sockets)) | 819 | if (list_empty(&soc_pcmcia_sockets)) |
| 819 | soc_pcmcia_cpufreq_unregister(); | 820 | soc_pcmcia_cpufreq_unregister(); |
| 820 | 821 | ||
| 821 | up(&soc_pcmcia_sockets_lock); | 822 | mutex_unlock(&soc_pcmcia_sockets_lock); |
| 822 | 823 | ||
| 823 | kfree(sinfo); | 824 | kfree(sinfo); |
| 824 | 825 | ||
diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 6f14126889b3..1edc1da9d353 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h | |||
| @@ -133,7 +133,6 @@ extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_ | |||
| 133 | 133 | ||
| 134 | 134 | ||
| 135 | extern struct list_head soc_pcmcia_sockets; | 135 | extern struct list_head soc_pcmcia_sockets; |
| 136 | extern struct semaphore soc_pcmcia_sockets_lock; | ||
| 137 | 136 | ||
| 138 | extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); | 137 | extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr); |
| 139 | extern int soc_common_drv_pcmcia_remove(struct device *dev); | 138 | extern int soc_common_drv_pcmcia_remove(struct device *dev); |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index b4409002b7f8..562384d6f321 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
| @@ -356,19 +356,23 @@ static ssize_t pccard_store_cis(struct kobject *kobj, | |||
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | 358 | ||
| 359 | static struct device_attribute *pccard_socket_attributes[] = { | 359 | static struct attribute *pccard_socket_attributes[] = { |
| 360 | &dev_attr_card_type, | 360 | &dev_attr_card_type.attr, |
| 361 | &dev_attr_card_voltage, | 361 | &dev_attr_card_voltage.attr, |
| 362 | &dev_attr_card_vpp, | 362 | &dev_attr_card_vpp.attr, |
| 363 | &dev_attr_card_vcc, | 363 | &dev_attr_card_vcc.attr, |
| 364 | &dev_attr_card_insert, | 364 | &dev_attr_card_insert.attr, |
| 365 | &dev_attr_card_pm_state, | 365 | &dev_attr_card_pm_state.attr, |
| 366 | &dev_attr_card_eject, | 366 | &dev_attr_card_eject.attr, |
| 367 | &dev_attr_card_irq_mask, | 367 | &dev_attr_card_irq_mask.attr, |
| 368 | &dev_attr_available_resources_setup_done, | 368 | &dev_attr_available_resources_setup_done.attr, |
| 369 | NULL, | 369 | NULL, |
| 370 | }; | 370 | }; |
| 371 | 371 | ||
| 372 | static const struct attribute_group socket_attrs = { | ||
| 373 | .attrs = pccard_socket_attributes, | ||
| 374 | }; | ||
| 375 | |||
| 372 | static struct bin_attribute pccard_cis_attr = { | 376 | static struct bin_attribute pccard_cis_attr = { |
| 373 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, | 377 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, |
| 374 | .size = 0x200, | 378 | .size = 0x200, |
| @@ -376,35 +380,21 @@ static struct bin_attribute pccard_cis_attr = { | |||
| 376 | .write = pccard_store_cis, | 380 | .write = pccard_store_cis, |
| 377 | }; | 381 | }; |
| 378 | 382 | ||
| 379 | static int __devinit pccard_sysfs_add_socket(struct device *dev, | 383 | int pccard_sysfs_add_socket(struct device *dev) |
| 380 | struct class_interface *class_intf) | ||
| 381 | { | 384 | { |
| 382 | struct device_attribute **attr; | ||
| 383 | int ret = 0; | 385 | int ret = 0; |
| 384 | 386 | ||
| 385 | for (attr = pccard_socket_attributes; *attr; attr++) { | 387 | ret = sysfs_create_group(&dev->kobj, &socket_attrs); |
| 386 | ret = device_create_file(dev, *attr); | 388 | if (!ret) { |
| 389 | ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); | ||
| 387 | if (ret) | 390 | if (ret) |
| 388 | break; | 391 | sysfs_remove_group(&dev->kobj, &socket_attrs); |
| 389 | } | 392 | } |
| 390 | if (!ret) | ||
| 391 | ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr); | ||
| 392 | |||
| 393 | return ret; | 393 | return ret; |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | static void __devexit pccard_sysfs_remove_socket(struct device *dev, | 396 | void pccard_sysfs_remove_socket(struct device *dev) |
| 397 | struct class_interface *class_intf) | ||
| 398 | { | 397 | { |
| 399 | struct device_attribute **attr; | ||
| 400 | |||
| 401 | sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); | 398 | sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr); |
| 402 | for (attr = pccard_socket_attributes; *attr; attr++) | 399 | sysfs_remove_group(&dev->kobj, &socket_attrs); |
| 403 | device_remove_file(dev, *attr); | ||
| 404 | } | 400 | } |
| 405 | |||
| 406 | struct class_interface pccard_sysfs_interface = { | ||
| 407 | .class = &pcmcia_socket_class, | ||
| 408 | .add_dev = &pccard_sysfs_add_socket, | ||
| 409 | .remove_dev = __devexit_p(&pccard_sysfs_remove_socket), | ||
| 410 | }; | ||
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 2e2c457a0fea..5ff9a4c0447e 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
| @@ -591,7 +591,8 @@ static void pnpbios_encode_irq(struct pnp_dev *dev, unsigned char *p, | |||
| 591 | p[1] = map & 0xff; | 591 | p[1] = map & 0xff; |
| 592 | p[2] = (map >> 8) & 0xff; | 592 | p[2] = (map >> 8) & 0xff; |
| 593 | 593 | ||
| 594 | dev_dbg(&dev->dev, " encode irq %d\n", res->start); | 594 | dev_dbg(&dev->dev, " encode irq %llu\n", |
| 595 | (unsigned long long)res->start); | ||
| 595 | } | 596 | } |
| 596 | 597 | ||
| 597 | static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, | 598 | static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, |
| @@ -602,7 +603,8 @@ static void pnpbios_encode_dma(struct pnp_dev *dev, unsigned char *p, | |||
| 602 | map = 1 << res->start; | 603 | map = 1 << res->start; |
| 603 | p[1] = map & 0xff; | 604 | p[1] = map & 0xff; |
| 604 | 605 | ||
| 605 | dev_dbg(&dev->dev, " encode dma %d\n", res->start); | 606 | dev_dbg(&dev->dev, " encode dma %llu\n", |
| 607 | (unsigned long long)res->start); | ||
| 606 | } | 608 | } |
| 607 | 609 | ||
| 608 | static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, | 610 | static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p, |
diff --git a/drivers/scsi/mvsas.c b/drivers/scsi/mvsas.c index e55b9037adb2..1dd70d7a4947 100644 --- a/drivers/scsi/mvsas.c +++ b/drivers/scsi/mvsas.c | |||
| @@ -2822,7 +2822,9 @@ static void mvs_update_phyinfo(struct mvs_info *mvi, int i, | |||
| 2822 | dev_printk(KERN_DEBUG, &pdev->dev, | 2822 | dev_printk(KERN_DEBUG, &pdev->dev, |
| 2823 | "phy[%d] Get Attached Address 0x%llX ," | 2823 | "phy[%d] Get Attached Address 0x%llX ," |
| 2824 | " SAS Address 0x%llX\n", | 2824 | " SAS Address 0x%llX\n", |
| 2825 | i, phy->att_dev_sas_addr, phy->dev_sas_addr); | 2825 | i, |
| 2826 | (unsigned long long)phy->att_dev_sas_addr, | ||
| 2827 | (unsigned long long)phy->dev_sas_addr); | ||
| 2826 | dev_printk(KERN_DEBUG, &pdev->dev, | 2828 | dev_printk(KERN_DEBUG, &pdev->dev, |
| 2827 | "Rate = %x , type = %d\n", | 2829 | "Rate = %x , type = %d\n", |
| 2828 | sas_phy->linkrate, phy->phy_type); | 2830 | sas_phy->linkrate, phy->phy_type); |
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index ceab4f73caf1..c57c94c0ffd2 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
| @@ -8222,7 +8222,7 @@ static void process_waiting_list(struct ncb *np, int sts) | |||
| 8222 | #ifdef DEBUG_WAITING_LIST | 8222 | #ifdef DEBUG_WAITING_LIST |
| 8223 | if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts); | 8223 | if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts); |
| 8224 | #endif | 8224 | #endif |
| 8225 | while (wcmd = waiting_list) { | 8225 | while ((wcmd = waiting_list) != NULL) { |
| 8226 | waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd; | 8226 | waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd; |
| 8227 | wcmd->next_wcmd = NULL; | 8227 | wcmd->next_wcmd = NULL; |
| 8228 | if (sts == DID_OK) { | 8228 | if (sts == DID_OK) { |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index ea41f2626458..a1ca9b7bf2d5 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -2271,7 +2271,8 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) | |||
| 2271 | } | 2271 | } |
| 2272 | 2272 | ||
| 2273 | if (up->port.flags & UPF_IOREMAP) { | 2273 | if (up->port.flags & UPF_IOREMAP) { |
| 2274 | up->port.membase = ioremap(up->port.mapbase, size); | 2274 | up->port.membase = ioremap_nocache(up->port.mapbase, |
| 2275 | size); | ||
| 2275 | if (!up->port.membase) { | 2276 | if (!up->port.membase) { |
| 2276 | release_mem_region(up->port.mapbase, size); | 2277 | release_mem_region(up->port.mapbase, size); |
| 2277 | ret = -ENOMEM; | 2278 | ret = -ENOMEM; |
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c index cd898704ba4f..f279745e9fef 100644 --- a/drivers/serial/8250_early.c +++ b/drivers/serial/8250_early.c | |||
| @@ -153,7 +153,7 @@ static int __init parse_options(struct early_serial8250_device *device, | |||
| 153 | (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE); | 153 | (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE); |
| 154 | port->membase += port->mapbase & ~PAGE_MASK; | 154 | port->membase += port->mapbase & ~PAGE_MASK; |
| 155 | #else | 155 | #else |
| 156 | port->membase = ioremap(port->mapbase, 64); | 156 | port->membase = ioremap_nocache(port->mapbase, 64); |
| 157 | if (!port->membase) { | 157 | if (!port->membase) { |
| 158 | printk(KERN_ERR "%s: Couldn't ioremap 0x%llx\n", | 158 | printk(KERN_ERR "%s: Couldn't ioremap 0x%llx\n", |
| 159 | __func__, | 159 | __func__, |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 6e57382b9137..53fa19cf2f06 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
| @@ -86,7 +86,7 @@ setup_port(struct serial_private *priv, struct uart_port *port, | |||
| 86 | len = pci_resource_len(dev, bar); | 86 | len = pci_resource_len(dev, bar); |
| 87 | 87 | ||
| 88 | if (!priv->remapped_bar[bar]) | 88 | if (!priv->remapped_bar[bar]) |
| 89 | priv->remapped_bar[bar] = ioremap(base, len); | 89 | priv->remapped_bar[bar] = ioremap_nocache(base, len); |
| 90 | if (!priv->remapped_bar[bar]) | 90 | if (!priv->remapped_bar[bar]) |
| 91 | return -ENOMEM; | 91 | return -ENOMEM; |
| 92 | 92 | ||
| @@ -270,7 +270,7 @@ static int pci_plx9050_init(struct pci_dev *dev) | |||
| 270 | /* | 270 | /* |
| 271 | * enable/disable interrupts | 271 | * enable/disable interrupts |
| 272 | */ | 272 | */ |
| 273 | p = ioremap(pci_resource_start(dev, 0), 0x80); | 273 | p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); |
| 274 | if (p == NULL) | 274 | if (p == NULL) |
| 275 | return -ENOMEM; | 275 | return -ENOMEM; |
| 276 | writel(irq_config, p + 0x4c); | 276 | writel(irq_config, p + 0x4c); |
| @@ -294,7 +294,7 @@ static void __devexit pci_plx9050_exit(struct pci_dev *dev) | |||
| 294 | /* | 294 | /* |
| 295 | * disable interrupts | 295 | * disable interrupts |
| 296 | */ | 296 | */ |
| 297 | p = ioremap(pci_resource_start(dev, 0), 0x80); | 297 | p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); |
| 298 | if (p != NULL) { | 298 | if (p != NULL) { |
| 299 | writel(0, p + 0x4c); | 299 | writel(0, p + 0x4c); |
| 300 | 300 | ||
| @@ -341,7 +341,8 @@ static int sbs_init(struct pci_dev *dev) | |||
| 341 | { | 341 | { |
| 342 | u8 __iomem *p; | 342 | u8 __iomem *p; |
| 343 | 343 | ||
| 344 | p = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0)); | 344 | p = ioremap_nocache(pci_resource_start(dev, 0), |
| 345 | pci_resource_len(dev, 0)); | ||
| 345 | 346 | ||
| 346 | if (p == NULL) | 347 | if (p == NULL) |
| 347 | return -ENOMEM; | 348 | return -ENOMEM; |
| @@ -365,7 +366,8 @@ static void __devexit sbs_exit(struct pci_dev *dev) | |||
| 365 | { | 366 | { |
| 366 | u8 __iomem *p; | 367 | u8 __iomem *p; |
| 367 | 368 | ||
| 368 | p = ioremap(pci_resource_start(dev, 0), pci_resource_len(dev, 0)); | 369 | p = ioremap_nocache(pci_resource_start(dev, 0), |
| 370 | pci_resource_len(dev, 0)); | ||
| 369 | /* FIXME: What if resource_len < OCT_REG_CR_OFF */ | 371 | /* FIXME: What if resource_len < OCT_REG_CR_OFF */ |
| 370 | if (p != NULL) | 372 | if (p != NULL) |
| 371 | writeb(0, p + OCT_REG_CR_OFF); | 373 | writeb(0, p + OCT_REG_CR_OFF); |
| @@ -419,7 +421,7 @@ static int pci_siig10x_init(struct pci_dev *dev) | |||
| 419 | break; | 421 | break; |
| 420 | } | 422 | } |
| 421 | 423 | ||
| 422 | p = ioremap(pci_resource_start(dev, 0), 0x80); | 424 | p = ioremap_nocache(pci_resource_start(dev, 0), 0x80); |
| 423 | if (p == NULL) | 425 | if (p == NULL) |
| 424 | return -ENOMEM; | 426 | return -ENOMEM; |
| 425 | 427 | ||
diff --git a/drivers/serial/jsm/jsm.h b/drivers/serial/jsm/jsm.h index 12c934a1f274..8871aaa3dba6 100644 --- a/drivers/serial/jsm/jsm.h +++ b/drivers/serial/jsm/jsm.h | |||
| @@ -373,6 +373,7 @@ struct neo_uart_struct { | |||
| 373 | #define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME "Neo 2 - DB9 Universal PCI - Powered Ring Indicator" | 373 | #define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME "Neo 2 - DB9 Universal PCI - Powered Ring Indicator" |
| 374 | #define PCI_DEVICE_NEO_2RJ45_PCI_NAME "Neo 2 - RJ45 Universal PCI" | 374 | #define PCI_DEVICE_NEO_2RJ45_PCI_NAME "Neo 2 - RJ45 Universal PCI" |
| 375 | #define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME "Neo 2 - RJ45 Universal PCI - Powered Ring Indicator" | 375 | #define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME "Neo 2 - RJ45 Universal PCI - Powered Ring Indicator" |
| 376 | #define PCIE_DEVICE_NEO_IBM_PCI_NAME "Neo 4 - PCI Express - IBM" | ||
| 376 | 377 | ||
| 377 | /* | 378 | /* |
| 378 | * Our Global Variables. | 379 | * Our Global Variables. |
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index 6767ee381cd1..338cf8a08b43 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
| @@ -82,7 +82,10 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 82 | /* store the info for the board we've found */ | 82 | /* store the info for the board we've found */ |
| 83 | brd->boardnum = adapter_count++; | 83 | brd->boardnum = adapter_count++; |
| 84 | brd->pci_dev = pdev; | 84 | brd->pci_dev = pdev; |
| 85 | brd->maxports = 2; | 85 | if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM) |
| 86 | brd->maxports = 4; | ||
| 87 | else | ||
| 88 | brd->maxports = 2; | ||
| 86 | 89 | ||
| 87 | spin_lock_init(&brd->bd_lock); | 90 | spin_lock_init(&brd->bd_lock); |
| 88 | spin_lock_init(&brd->bd_intr_lock); | 91 | spin_lock_init(&brd->bd_intr_lock); |
| @@ -208,6 +211,7 @@ static struct pci_device_id jsm_pci_tbl[] = { | |||
| 208 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9PRI), 0, 0, 1 }, | 211 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2DB9PRI), 0, 0, 1 }, |
| 209 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, | 212 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 }, |
| 210 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, | 213 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 }, |
| 214 | { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 }, | ||
| 211 | { 0, } | 215 | { 0, } |
| 212 | }; | 216 | }; |
| 213 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); | 217 | MODULE_DEVICE_TABLE(pci, jsm_pci_tbl); |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index a9ac1fdb3094..7fea3cf4588a 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
| @@ -608,6 +608,7 @@ static void pump_transfers(unsigned long data) | |||
| 608 | u8 width; | 608 | u8 width; |
| 609 | u16 cr, dma_width, dma_config; | 609 | u16 cr, dma_width, dma_config; |
| 610 | u32 tranf_success = 1; | 610 | u32 tranf_success = 1; |
| 611 | u8 full_duplex = 0; | ||
| 611 | 612 | ||
| 612 | /* Get current state information */ | 613 | /* Get current state information */ |
| 613 | message = drv_data->cur_msg; | 614 | message = drv_data->cur_msg; |
| @@ -658,6 +659,7 @@ static void pump_transfers(unsigned long data) | |||
| 658 | } | 659 | } |
| 659 | 660 | ||
| 660 | if (transfer->rx_buf != NULL) { | 661 | if (transfer->rx_buf != NULL) { |
| 662 | full_duplex = transfer->tx_buf != NULL; | ||
| 661 | drv_data->rx = transfer->rx_buf; | 663 | drv_data->rx = transfer->rx_buf; |
| 662 | drv_data->rx_end = drv_data->rx + transfer->len; | 664 | drv_data->rx_end = drv_data->rx + transfer->len; |
| 663 | dev_dbg(&drv_data->pdev->dev, "rx_buf is %p, rx_end is %p\n", | 665 | dev_dbg(&drv_data->pdev->dev, "rx_buf is %p, rx_end is %p\n", |
| @@ -740,7 +742,8 @@ static void pump_transfers(unsigned long data) | |||
| 740 | * successful use different way to r/w according to | 742 | * successful use different way to r/w according to |
| 741 | * drv_data->cur_chip->enable_dma | 743 | * drv_data->cur_chip->enable_dma |
| 742 | */ | 744 | */ |
| 743 | if (drv_data->cur_chip->enable_dma && drv_data->len > 6) { | 745 | if (!full_duplex && drv_data->cur_chip->enable_dma |
| 746 | && drv_data->len > 6) { | ||
| 744 | 747 | ||
| 745 | disable_dma(drv_data->dma_channel); | 748 | disable_dma(drv_data->dma_channel); |
| 746 | clear_dma_irqstat(drv_data->dma_channel); | 749 | clear_dma_irqstat(drv_data->dma_channel); |
| @@ -828,7 +831,7 @@ static void pump_transfers(unsigned long data) | |||
| 828 | /* IO mode write then read */ | 831 | /* IO mode write then read */ |
| 829 | dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); | 832 | dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n"); |
| 830 | 833 | ||
| 831 | if (drv_data->tx != NULL && drv_data->rx != NULL) { | 834 | if (full_duplex) { |
| 832 | /* full duplex mode */ | 835 | /* full duplex mode */ |
| 833 | BUG_ON((drv_data->tx_end - drv_data->tx) != | 836 | BUG_ON((drv_data->tx_end - drv_data->tx) != |
| 834 | (drv_data->rx_end - drv_data->rx)); | 837 | (drv_data->rx_end - drv_data->rx)); |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 34bfb7dd7764..0885cc357a37 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
| @@ -125,10 +125,10 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi, | |||
| 125 | /* is clk = pclk / (2 * (pre+1)), or is it | 125 | /* is clk = pclk / (2 * (pre+1)), or is it |
| 126 | * clk = (pclk * 2) / ( pre + 1) */ | 126 | * clk = (pclk * 2) / ( pre + 1) */ |
| 127 | 127 | ||
| 128 | div = (div / 2) - 1; | 128 | div /= 2; |
| 129 | 129 | ||
| 130 | if (div < 0) | 130 | if (div > 0) |
| 131 | div = 1; | 131 | div -= 1; |
| 132 | 132 | ||
| 133 | if (div > 255) | 133 | if (div > 255) |
| 134 | div = 255; | 134 | div = 255; |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index d96e5c14a9ca..894fee54d4d8 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
| @@ -73,8 +73,8 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |||
| 73 | status = 0; | 73 | status = 0; |
| 74 | done: | 74 | done: |
| 75 | DPRINTK("returning = %d", status); | 75 | DPRINTK("returning = %d", status); |
| 76 | mntput(mnt); | ||
| 77 | dput(dentry); | 76 | dput(dentry); |
| 77 | mntput(mnt); | ||
| 78 | return status; | 78 | return status; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| @@ -333,7 +333,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
| 333 | /* Can we expire this guy */ | 333 | /* Can we expire this guy */ |
| 334 | if (autofs4_can_expire(dentry, timeout, do_now)) { | 334 | if (autofs4_can_expire(dentry, timeout, do_now)) { |
| 335 | expired = dentry; | 335 | expired = dentry; |
| 336 | break; | 336 | goto found; |
| 337 | } | 337 | } |
| 338 | goto next; | 338 | goto next; |
| 339 | } | 339 | } |
| @@ -352,7 +352,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
| 352 | inf->flags |= AUTOFS_INF_EXPIRING; | 352 | inf->flags |= AUTOFS_INF_EXPIRING; |
| 353 | spin_unlock(&sbi->fs_lock); | 353 | spin_unlock(&sbi->fs_lock); |
| 354 | expired = dentry; | 354 | expired = dentry; |
| 355 | break; | 355 | goto found; |
| 356 | } | 356 | } |
| 357 | spin_unlock(&sbi->fs_lock); | 357 | spin_unlock(&sbi->fs_lock); |
| 358 | /* | 358 | /* |
| @@ -363,7 +363,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
| 363 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); | 363 | expired = autofs4_check_leaves(mnt, dentry, timeout, do_now); |
| 364 | if (expired) { | 364 | if (expired) { |
| 365 | dput(dentry); | 365 | dput(dentry); |
| 366 | break; | 366 | goto found; |
| 367 | } | 367 | } |
| 368 | } | 368 | } |
| 369 | next: | 369 | next: |
| @@ -371,18 +371,16 @@ next: | |||
| 371 | spin_lock(&dcache_lock); | 371 | spin_lock(&dcache_lock); |
| 372 | next = next->next; | 372 | next = next->next; |
| 373 | } | 373 | } |
| 374 | |||
| 375 | if (expired) { | ||
| 376 | DPRINTK("returning %p %.*s", | ||
| 377 | expired, (int)expired->d_name.len, expired->d_name.name); | ||
| 378 | spin_lock(&dcache_lock); | ||
| 379 | list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); | ||
| 380 | spin_unlock(&dcache_lock); | ||
| 381 | return expired; | ||
| 382 | } | ||
| 383 | spin_unlock(&dcache_lock); | 374 | spin_unlock(&dcache_lock); |
| 384 | |||
| 385 | return NULL; | 375 | return NULL; |
| 376 | |||
| 377 | found: | ||
| 378 | DPRINTK("returning %p %.*s", | ||
| 379 | expired, (int)expired->d_name.len, expired->d_name.name); | ||
| 380 | spin_lock(&dcache_lock); | ||
| 381 | list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); | ||
| 382 | spin_unlock(&dcache_lock); | ||
| 383 | return expired; | ||
| 386 | } | 384 | } |
| 387 | 385 | ||
| 388 | /* Perform an expiry operation */ | 386 | /* Perform an expiry operation */ |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index aa4c5ff8a40d..edf5b6bddb52 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
| @@ -146,17 +146,17 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) | |||
| 146 | 146 | ||
| 147 | if (d_mountpoint(dentry)) { | 147 | if (d_mountpoint(dentry)) { |
| 148 | struct file *fp = NULL; | 148 | struct file *fp = NULL; |
| 149 | struct vfsmount *fp_mnt = mntget(mnt); | 149 | struct path fp_path = { .dentry = dentry, .mnt = mnt }; |
| 150 | struct dentry *fp_dentry = dget(dentry); | ||
| 151 | 150 | ||
| 152 | if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) { | 151 | path_get(&fp_path); |
| 153 | dput(fp_dentry); | 152 | |
| 154 | mntput(fp_mnt); | 153 | if (!autofs4_follow_mount(&fp_path.mnt, &fp_path.dentry)) { |
| 154 | path_put(&fp_path); | ||
| 155 | dcache_dir_close(inode, file); | 155 | dcache_dir_close(inode, file); |
| 156 | goto out; | 156 | goto out; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); | 159 | fp = dentry_open(fp_path.dentry, fp_path.mnt, file->f_flags); |
| 160 | status = PTR_ERR(fp); | 160 | status = PTR_ERR(fp); |
| 161 | if (IS_ERR(fp)) { | 161 | if (IS_ERR(fp)) { |
| 162 | dcache_dir_close(inode, file); | 162 | dcache_dir_close(inode, file); |
| @@ -242,7 +242,8 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) | |||
| 242 | { | 242 | { |
| 243 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 243 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
| 244 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 244 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
| 245 | int status = 0; | 245 | struct dentry *new; |
| 246 | int status; | ||
| 246 | 247 | ||
| 247 | /* Block on any pending expiry here; invalidate the dentry | 248 | /* Block on any pending expiry here; invalidate the dentry |
| 248 | when expiration is done to trigger mount request with a new | 249 | when expiration is done to trigger mount request with a new |
| @@ -318,7 +319,28 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags) | |||
| 318 | spin_lock(&dentry->d_lock); | 319 | spin_lock(&dentry->d_lock); |
| 319 | dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; | 320 | dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; |
| 320 | spin_unlock(&dentry->d_lock); | 321 | spin_unlock(&dentry->d_lock); |
| 321 | return status; | 322 | |
| 323 | /* | ||
| 324 | * The dentry that is passed in from lookup may not be the one | ||
| 325 | * we end up using, as mkdir can create a new one. If this | ||
| 326 | * happens, and another process tries the lookup at the same time, | ||
| 327 | * it will set the PENDING flag on this new dentry, but add itself | ||
| 328 | * to our waitq. Then, if after the lookup succeeds, the first | ||
| 329 | * process that requested the mount performs another lookup of the | ||
| 330 | * same directory, it will show up as still pending! So, we need | ||
| 331 | * to redo the lookup here and clear pending on that dentry. | ||
| 332 | */ | ||
| 333 | if (d_unhashed(dentry)) { | ||
| 334 | new = d_lookup(dentry->d_parent, &dentry->d_name); | ||
| 335 | if (new) { | ||
| 336 | spin_lock(&new->d_lock); | ||
| 337 | new->d_flags &= ~DCACHE_AUTOFS_PENDING; | ||
| 338 | spin_unlock(&new->d_lock); | ||
| 339 | dput(new); | ||
| 340 | } | ||
| 341 | } | ||
| 342 | |||
| 343 | return 0; | ||
| 322 | } | 344 | } |
| 323 | 345 | ||
| 324 | /* For autofs direct mounts the follow link triggers the mount */ | 346 | /* For autofs direct mounts the follow link triggers the mount */ |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 1fe28e4754c2..75e5955c3f6d 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
| @@ -171,7 +171,7 @@ static int autofs4_getpath(struct autofs_sb_info *sbi, | |||
| 171 | for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent) | 171 | for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent) |
| 172 | len += tmp->d_name.len + 1; | 172 | len += tmp->d_name.len + 1; |
| 173 | 173 | ||
| 174 | if (--len > NAME_MAX) { | 174 | if (!len || --len > NAME_MAX) { |
| 175 | spin_unlock(&dcache_lock); | 175 | spin_unlock(&dcache_lock); |
| 176 | return 0; | 176 | return 0; |
| 177 | } | 177 | } |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index fddffe4851f5..159a5efd6a8a 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * 2 as published by the Free Software Foundation. | 9 | * 2 as published by the Free Software Foundation. |
| 10 | * | 10 | * |
| 11 | * debugfs is for people to use instead of /proc or /sys. | 11 | * debugfs is for people to use instead of /proc or /sys. |
| 12 | * See Documentation/DocBook/kernel-api for more details. | 12 | * See Documentation/DocBook/filesystems for more details. |
| 13 | * | 13 | * |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
diff --git a/fs/dnotify.c b/fs/dnotify.c index 28d01ed66de0..eaecc4cfe540 100644 --- a/fs/dnotify.c +++ b/fs/dnotify.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
| 21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/file.h> | ||
| 23 | 24 | ||
| 24 | int dir_notify_enable __read_mostly = 1; | 25 | int dir_notify_enable __read_mostly = 1; |
| 25 | 26 | ||
| @@ -66,6 +67,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) | |||
| 66 | struct dnotify_struct **prev; | 67 | struct dnotify_struct **prev; |
| 67 | struct inode *inode; | 68 | struct inode *inode; |
| 68 | fl_owner_t id = current->files; | 69 | fl_owner_t id = current->files; |
| 70 | struct file *f; | ||
| 69 | int error = 0; | 71 | int error = 0; |
| 70 | 72 | ||
| 71 | if ((arg & ~DN_MULTISHOT) == 0) { | 73 | if ((arg & ~DN_MULTISHOT) == 0) { |
| @@ -92,6 +94,15 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg) | |||
| 92 | prev = &odn->dn_next; | 94 | prev = &odn->dn_next; |
| 93 | } | 95 | } |
| 94 | 96 | ||
| 97 | rcu_read_lock(); | ||
| 98 | f = fcheck(fd); | ||
| 99 | rcu_read_unlock(); | ||
| 100 | /* we'd lost the race with close(), sod off silently */ | ||
| 101 | /* note that inode->i_lock prevents reordering problems | ||
| 102 | * between accesses to descriptor table and ->i_dnotify */ | ||
| 103 | if (f != filp) | ||
| 104 | goto out_free; | ||
| 105 | |||
| 95 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); | 106 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); |
| 96 | if (error) | 107 | if (error) |
| 97 | goto out_free; | 108 | goto out_free; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 9ced35b00686..f28cf8b46f80 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -934,7 +934,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf, | |||
| 934 | 934 | ||
| 935 | nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT); | 935 | nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT); |
| 936 | npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; | 936 | npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; |
| 937 | npages = min(max(npages, 1), FUSE_MAX_PAGES_PER_REQ); | 937 | npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ); |
| 938 | down_read(¤t->mm->mmap_sem); | 938 | down_read(¤t->mm->mmap_sem); |
| 939 | npages = get_user_pages(current, current->mm, user_addr, npages, write, | 939 | npages = get_user_pages(current, current->mm, user_addr, npages, write, |
| 940 | 0, req->pages, NULL); | 940 | 0, req->pages, NULL); |
diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c index d58f845ccb85..c5e1450d79f9 100644 --- a/fs/jffs2/build.c +++ b/fs/jffs2/build.c | |||
| @@ -46,7 +46,7 @@ next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) | |||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, | 48 | static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, |
| 49 | struct jffs2_inode_cache *ic) | 49 | struct jffs2_inode_cache *ic) |
| 50 | { | 50 | { |
| 51 | struct jffs2_full_dirent *fd; | 51 | struct jffs2_full_dirent *fd; |
| 52 | 52 | ||
| @@ -68,11 +68,17 @@ static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, | |||
| 68 | continue; | 68 | continue; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | if (child_ic->nlink++ && fd->type == DT_DIR) { | 71 | if (fd->type == DT_DIR) { |
| 72 | JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", | 72 | if (child_ic->pino_nlink) { |
| 73 | fd->name, fd->ino, ic->ino); | 73 | JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", |
| 74 | /* TODO: What do we do about it? */ | 74 | fd->name, fd->ino, ic->ino); |
| 75 | } | 75 | /* TODO: What do we do about it? */ |
| 76 | } else { | ||
| 77 | child_ic->pino_nlink = ic->ino; | ||
| 78 | } | ||
| 79 | } else | ||
| 80 | child_ic->pino_nlink++; | ||
| 81 | |||
| 76 | dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); | 82 | dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); |
| 77 | /* Can't free scan_dents so far. We might need them in pass 2 */ | 83 | /* Can't free scan_dents so far. We might need them in pass 2 */ |
| 78 | } | 84 | } |
| @@ -125,7 +131,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) | |||
| 125 | dbg_fsbuild("pass 2 starting\n"); | 131 | dbg_fsbuild("pass 2 starting\n"); |
| 126 | 132 | ||
| 127 | for_each_inode(i, c, ic) { | 133 | for_each_inode(i, c, ic) { |
| 128 | if (ic->nlink) | 134 | if (ic->pino_nlink) |
| 129 | continue; | 135 | continue; |
| 130 | 136 | ||
| 131 | jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); | 137 | jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); |
| @@ -232,16 +238,19 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c, | |||
| 232 | /* Reduce nlink of the child. If it's now zero, stick it on the | 238 | /* Reduce nlink of the child. If it's now zero, stick it on the |
| 233 | dead_fds list to be cleaned up later. Else just free the fd */ | 239 | dead_fds list to be cleaned up later. Else just free the fd */ |
| 234 | 240 | ||
| 235 | child_ic->nlink--; | 241 | if (fd->type == DT_DIR) |
| 242 | child_ic->pino_nlink = 0; | ||
| 243 | else | ||
| 244 | child_ic->pino_nlink--; | ||
| 236 | 245 | ||
| 237 | if (!child_ic->nlink) { | 246 | if (!child_ic->pino_nlink) { |
| 238 | dbg_fsbuild("inode #%u (\"%s\") has now got zero nlink, adding to dead_fds list.\n", | 247 | dbg_fsbuild("inode #%u (\"%s\") now has no links; adding to dead_fds list.\n", |
| 239 | fd->ino, fd->name); | 248 | fd->ino, fd->name); |
| 240 | fd->next = *dead_fds; | 249 | fd->next = *dead_fds; |
| 241 | *dead_fds = fd; | 250 | *dead_fds = fd; |
| 242 | } else { | 251 | } else { |
| 243 | dbg_fsbuild("inode #%u (\"%s\") has now got nlink %d. Ignoring.\n", | 252 | dbg_fsbuild("inode #%u (\"%s\") has now got nlink %d. Ignoring.\n", |
| 244 | fd->ino, fd->name, child_ic->nlink); | 253 | fd->ino, fd->name, child_ic->pino_nlink); |
| 245 | jffs2_free_full_dirent(fd); | 254 | jffs2_free_full_dirent(fd); |
| 246 | } | 255 | } |
| 247 | } | 256 | } |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index c63e7a96af0d..c0c141f6fde1 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
| @@ -208,6 +208,13 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
| 208 | f = JFFS2_INODE_INFO(inode); | 208 | f = JFFS2_INODE_INFO(inode); |
| 209 | dir_f = JFFS2_INODE_INFO(dir_i); | 209 | dir_f = JFFS2_INODE_INFO(dir_i); |
| 210 | 210 | ||
| 211 | /* jffs2_do_create() will want to lock it, _after_ reserving | ||
| 212 | space and taking c-alloc_sem. If we keep it locked here, | ||
| 213 | lockdep gets unhappy (although it's a false positive; | ||
| 214 | nothing else will be looking at this inode yet so there's | ||
| 215 | no chance of AB-BA deadlock involving its f->sem). */ | ||
| 216 | mutex_unlock(&f->sem); | ||
| 217 | |||
| 211 | ret = jffs2_do_create(c, dir_f, f, ri, | 218 | ret = jffs2_do_create(c, dir_f, f, ri, |
| 212 | dentry->d_name.name, dentry->d_name.len); | 219 | dentry->d_name.name, dentry->d_name.len); |
| 213 | if (ret) | 220 | if (ret) |
| @@ -219,7 +226,8 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | |||
| 219 | d_instantiate(dentry, inode); | 226 | d_instantiate(dentry, inode); |
| 220 | 227 | ||
| 221 | D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", | 228 | D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", |
| 222 | inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages)); | 229 | inode->i_ino, inode->i_mode, inode->i_nlink, |
| 230 | f->inocache->pino_nlink, inode->i_mapping->nrpages)); | ||
| 223 | return 0; | 231 | return 0; |
| 224 | 232 | ||
| 225 | fail: | 233 | fail: |
| @@ -243,7 +251,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry) | |||
| 243 | ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, | 251 | ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, |
| 244 | dentry->d_name.len, dead_f, now); | 252 | dentry->d_name.len, dead_f, now); |
| 245 | if (dead_f->inocache) | 253 | if (dead_f->inocache) |
| 246 | dentry->d_inode->i_nlink = dead_f->inocache->nlink; | 254 | dentry->d_inode->i_nlink = dead_f->inocache->pino_nlink; |
| 247 | if (!ret) | 255 | if (!ret) |
| 248 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 256 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
| 249 | return ret; | 257 | return ret; |
| @@ -276,7 +284,7 @@ static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct de | |||
| 276 | 284 | ||
| 277 | if (!ret) { | 285 | if (!ret) { |
| 278 | mutex_lock(&f->sem); | 286 | mutex_lock(&f->sem); |
| 279 | old_dentry->d_inode->i_nlink = ++f->inocache->nlink; | 287 | old_dentry->d_inode->i_nlink = ++f->inocache->pino_nlink; |
| 280 | mutex_unlock(&f->sem); | 288 | mutex_unlock(&f->sem); |
| 281 | d_instantiate(dentry, old_dentry->d_inode); | 289 | d_instantiate(dentry, old_dentry->d_inode); |
| 282 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | 290 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); |
| @@ -493,11 +501,14 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 493 | 501 | ||
| 494 | inode->i_op = &jffs2_dir_inode_operations; | 502 | inode->i_op = &jffs2_dir_inode_operations; |
| 495 | inode->i_fop = &jffs2_dir_operations; | 503 | inode->i_fop = &jffs2_dir_operations; |
| 496 | /* Directories get nlink 2 at start */ | ||
| 497 | inode->i_nlink = 2; | ||
| 498 | 504 | ||
| 499 | f = JFFS2_INODE_INFO(inode); | 505 | f = JFFS2_INODE_INFO(inode); |
| 500 | 506 | ||
| 507 | /* Directories get nlink 2 at start */ | ||
| 508 | inode->i_nlink = 2; | ||
| 509 | /* but ic->pino_nlink is the parent ino# */ | ||
| 510 | f->inocache->pino_nlink = dir_i->i_ino; | ||
| 511 | |||
| 501 | ri->data_crc = cpu_to_je32(0); | 512 | ri->data_crc = cpu_to_je32(0); |
| 502 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); | 513 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); |
| 503 | 514 | ||
| @@ -594,17 +605,25 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | |||
| 594 | 605 | ||
| 595 | static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) | 606 | static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) |
| 596 | { | 607 | { |
| 608 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); | ||
| 609 | struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); | ||
| 597 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); | 610 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); |
| 598 | struct jffs2_full_dirent *fd; | 611 | struct jffs2_full_dirent *fd; |
| 599 | int ret; | 612 | int ret; |
| 613 | uint32_t now = get_seconds(); | ||
| 600 | 614 | ||
| 601 | for (fd = f->dents ; fd; fd = fd->next) { | 615 | for (fd = f->dents ; fd; fd = fd->next) { |
| 602 | if (fd->ino) | 616 | if (fd->ino) |
| 603 | return -ENOTEMPTY; | 617 | return -ENOTEMPTY; |
| 604 | } | 618 | } |
| 605 | ret = jffs2_unlink(dir_i, dentry); | 619 | |
| 606 | if (!ret) | 620 | ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, |
| 621 | dentry->d_name.len, f, now); | ||
| 622 | if (!ret) { | ||
| 623 | dir_i->i_mtime = dir_i->i_ctime = ITIME(now); | ||
| 624 | clear_nlink(dentry->d_inode); | ||
| 607 | drop_nlink(dir_i); | 625 | drop_nlink(dir_i); |
| 626 | } | ||
| 608 | return ret; | 627 | return ret; |
| 609 | } | 628 | } |
| 610 | 629 | ||
| @@ -817,7 +836,10 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 817 | inode which didn't exist. */ | 836 | inode which didn't exist. */ |
| 818 | if (victim_f->inocache) { | 837 | if (victim_f->inocache) { |
| 819 | mutex_lock(&victim_f->sem); | 838 | mutex_lock(&victim_f->sem); |
| 820 | victim_f->inocache->nlink--; | 839 | if (S_ISDIR(new_dentry->d_inode->i_mode)) |
| 840 | victim_f->inocache->pino_nlink = 0; | ||
| 841 | else | ||
| 842 | victim_f->inocache->pino_nlink--; | ||
| 821 | mutex_unlock(&victim_f->sem); | 843 | mutex_unlock(&victim_f->sem); |
| 822 | } | 844 | } |
| 823 | } | 845 | } |
| @@ -838,8 +860,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
| 838 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); | 860 | struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); |
| 839 | mutex_lock(&f->sem); | 861 | mutex_lock(&f->sem); |
| 840 | inc_nlink(old_dentry->d_inode); | 862 | inc_nlink(old_dentry->d_inode); |
| 841 | if (f->inocache) | 863 | if (f->inocache && !S_ISDIR(old_dentry->d_inode->i_mode)) |
| 842 | f->inocache->nlink++; | 864 | f->inocache->pino_nlink++; |
| 843 | mutex_unlock(&f->sem); | 865 | mutex_unlock(&f->sem); |
| 844 | 866 | ||
| 845 | printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); | 867 | printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index 25a640e566d3..dddb2a6c9e2c 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
| @@ -294,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, | |||
| 294 | break; | 294 | break; |
| 295 | #endif | 295 | #endif |
| 296 | default: | 296 | default: |
| 297 | if (ic->nodes == (void *)ic && ic->nlink == 0) | 297 | if (ic->nodes == (void *)ic && ic->pino_nlink == 0) |
| 298 | jffs2_del_ino_cache(c, ic); | 298 | jffs2_del_ino_cache(c, ic); |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| @@ -332,7 +332,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
| 332 | if (c->mtd->point) { | 332 | if (c->mtd->point) { |
| 333 | unsigned long *wordebuf; | 333 | unsigned long *wordebuf; |
| 334 | 334 | ||
| 335 | ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf); | 335 | ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, |
| 336 | &retlen, &ebuf, NULL); | ||
| 336 | if (ret) { | 337 | if (ret) { |
| 337 | D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); | 338 | D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); |
| 338 | goto do_flash_read; | 339 | goto do_flash_read; |
| @@ -340,7 +341,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
| 340 | if (retlen < c->sector_size) { | 341 | if (retlen < c->sector_size) { |
| 341 | /* Don't muck about if it won't let us point to the whole erase sector */ | 342 | /* Don't muck about if it won't let us point to the whole erase sector */ |
| 342 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); | 343 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); |
| 343 | c->mtd->unpoint(c->mtd, ebuf, jeb->offset, retlen); | 344 | c->mtd->unpoint(c->mtd, jeb->offset, retlen); |
| 344 | goto do_flash_read; | 345 | goto do_flash_read; |
| 345 | } | 346 | } |
| 346 | wordebuf = ebuf-sizeof(*wordebuf); | 347 | wordebuf = ebuf-sizeof(*wordebuf); |
| @@ -349,7 +350,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
| 349 | if (*++wordebuf != ~0) | 350 | if (*++wordebuf != ~0) |
| 350 | break; | 351 | break; |
| 351 | } while(--retlen); | 352 | } while(--retlen); |
| 352 | c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size); | 353 | c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size); |
| 353 | if (retlen) { | 354 | if (retlen) { |
| 354 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", | 355 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", |
| 355 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); | 356 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 3eb1c84b0a33..086c43830221 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
| @@ -273,7 +273,7 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) | |||
| 273 | inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); | 273 | inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); |
| 274 | inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); | 274 | inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); |
| 275 | 275 | ||
| 276 | inode->i_nlink = f->inocache->nlink; | 276 | inode->i_nlink = f->inocache->pino_nlink; |
| 277 | 277 | ||
| 278 | inode->i_blocks = (inode->i_size + 511) >> 9; | 278 | inode->i_blocks = (inode->i_size + 511) >> 9; |
| 279 | 279 | ||
| @@ -286,13 +286,12 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) | |||
| 286 | case S_IFDIR: | 286 | case S_IFDIR: |
| 287 | { | 287 | { |
| 288 | struct jffs2_full_dirent *fd; | 288 | struct jffs2_full_dirent *fd; |
| 289 | inode->i_nlink = 2; /* parent and '.' */ | ||
| 289 | 290 | ||
| 290 | for (fd=f->dents; fd; fd = fd->next) { | 291 | for (fd=f->dents; fd; fd = fd->next) { |
| 291 | if (fd->type == DT_DIR && fd->ino) | 292 | if (fd->type == DT_DIR && fd->ino) |
| 292 | inc_nlink(inode); | 293 | inc_nlink(inode); |
| 293 | } | 294 | } |
| 294 | /* and '..' */ | ||
| 295 | inc_nlink(inode); | ||
| 296 | /* Root dir gets i_nlink 3 for some reason */ | 295 | /* Root dir gets i_nlink 3 for some reason */ |
| 297 | if (inode->i_ino == 1) | 296 | if (inode->i_ino == 1) |
| 298 | inc_nlink(inode); | 297 | inc_nlink(inode); |
| @@ -586,11 +585,12 @@ void jffs2_gc_release_inode(struct jffs2_sb_info *c, | |||
| 586 | } | 585 | } |
| 587 | 586 | ||
| 588 | struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | 587 | struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, |
| 589 | int inum, int nlink) | 588 | int inum, int unlinked) |
| 590 | { | 589 | { |
| 591 | struct inode *inode; | 590 | struct inode *inode; |
| 592 | struct jffs2_inode_cache *ic; | 591 | struct jffs2_inode_cache *ic; |
| 593 | if (!nlink) { | 592 | |
| 593 | if (unlinked) { | ||
| 594 | /* The inode has zero nlink but its nodes weren't yet marked | 594 | /* The inode has zero nlink but its nodes weren't yet marked |
| 595 | obsolete. This has to be because we're still waiting for | 595 | obsolete. This has to be because we're still waiting for |
| 596 | the final (close() and) iput() to happen. | 596 | the final (close() and) iput() to happen. |
| @@ -638,8 +638,8 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | |||
| 638 | return ERR_CAST(inode); | 638 | return ERR_CAST(inode); |
| 639 | } | 639 | } |
| 640 | if (is_bad_inode(inode)) { | 640 | if (is_bad_inode(inode)) { |
| 641 | printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n", | 641 | printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n", |
| 642 | inum, nlink); | 642 | inum, unlinked); |
| 643 | /* NB. This will happen again. We need to do something appropriate here. */ | 643 | /* NB. This will happen again. We need to do something appropriate here. */ |
| 644 | iput(inode); | 644 | iput(inode); |
| 645 | return ERR_PTR(-EIO); | 645 | return ERR_PTR(-EIO); |
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c index bad005664e30..090c556ffed2 100644 --- a/fs/jffs2/gc.c +++ b/fs/jffs2/gc.c | |||
| @@ -161,8 +161,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
| 161 | continue; | 161 | continue; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | if (!ic->nlink) { | 164 | if (!ic->pino_nlink) { |
| 165 | D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink zero\n", | 165 | D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink/pino zero\n", |
| 166 | ic->ino)); | 166 | ic->ino)); |
| 167 | spin_unlock(&c->inocache_lock); | 167 | spin_unlock(&c->inocache_lock); |
| 168 | jffs2_xattr_delete_inode(c, ic); | 168 | jffs2_xattr_delete_inode(c, ic); |
| @@ -398,10 +398,10 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) | |||
| 398 | it's vaguely possible. */ | 398 | it's vaguely possible. */ |
| 399 | 399 | ||
| 400 | inum = ic->ino; | 400 | inum = ic->ino; |
| 401 | nlink = ic->nlink; | 401 | nlink = ic->pino_nlink; |
| 402 | spin_unlock(&c->inocache_lock); | 402 | spin_unlock(&c->inocache_lock); |
| 403 | 403 | ||
| 404 | f = jffs2_gc_fetch_inode(c, inum, nlink); | 404 | f = jffs2_gc_fetch_inode(c, inum, !nlink); |
| 405 | if (IS_ERR(f)) { | 405 | if (IS_ERR(f)) { |
| 406 | ret = PTR_ERR(f); | 406 | ret = PTR_ERR(f); |
| 407 | goto release_sem; | 407 | goto release_sem; |
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h index 8219df6eb6d8..1750445556c3 100644 --- a/fs/jffs2/nodelist.h +++ b/fs/jffs2/nodelist.h | |||
| @@ -177,7 +177,10 @@ struct jffs2_inode_cache { | |||
| 177 | #ifdef CONFIG_JFFS2_FS_XATTR | 177 | #ifdef CONFIG_JFFS2_FS_XATTR |
| 178 | struct jffs2_xattr_ref *xref; | 178 | struct jffs2_xattr_ref *xref; |
| 179 | #endif | 179 | #endif |
| 180 | int nlink; | 180 | uint32_t pino_nlink; /* Directories store parent inode |
| 181 | here; other inodes store nlink. | ||
| 182 | Zero always means that it's | ||
| 183 | completely unlinked. */ | ||
| 181 | }; | 184 | }; |
| 182 | 185 | ||
| 183 | /* Inode states for 'state' above. We need the 'GC' state to prevent | 186 | /* Inode states for 'state' above. We need the 'GC' state to prevent |
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 9df8f3ef20df..a9bf9603c1ba 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
| @@ -709,7 +709,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
| 709 | break; | 709 | break; |
| 710 | #endif | 710 | #endif |
| 711 | default: | 711 | default: |
| 712 | if (ic->nodes == (void *)ic && ic->nlink == 0) | 712 | if (ic->nodes == (void *)ic && ic->pino_nlink == 0) |
| 713 | jffs2_del_ino_cache(c, ic); | 713 | jffs2_del_ino_cache(c, ic); |
| 714 | break; | 714 | break; |
| 715 | } | 715 | } |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 1b10d2594092..2cc866cf134f 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
| @@ -187,7 +187,7 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); | |||
| 187 | void jffs2_gc_release_inode(struct jffs2_sb_info *c, | 187 | void jffs2_gc_release_inode(struct jffs2_sb_info *c, |
| 188 | struct jffs2_inode_info *f); | 188 | struct jffs2_inode_info *f); |
| 189 | struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, | 189 | struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, |
| 190 | int inum, int nlink); | 190 | int inum, int unlinked); |
| 191 | 191 | ||
| 192 | unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, | 192 | unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, |
| 193 | struct jffs2_inode_info *f, | 193 | struct jffs2_inode_info *f, |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 4cb4d76de07f..6ca08ad887c0 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
| @@ -63,10 +63,11 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
| 63 | /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), | 63 | /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), |
| 64 | * adding and jffs2_flash_read_end() interface. */ | 64 | * adding and jffs2_flash_read_end() interface. */ |
| 65 | if (c->mtd->point) { | 65 | if (c->mtd->point) { |
| 66 | err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); | 66 | err = c->mtd->point(c->mtd, ofs, len, &retlen, |
| 67 | (void **)&buffer, NULL); | ||
| 67 | if (!err && retlen < len) { | 68 | if (!err && retlen < len) { |
| 68 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); | 69 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); |
| 69 | c->mtd->unpoint(c->mtd, buffer, ofs, retlen); | 70 | c->mtd->unpoint(c->mtd, ofs, retlen); |
| 70 | } else if (err) | 71 | } else if (err) |
| 71 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); | 72 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); |
| 72 | else | 73 | else |
| @@ -100,7 +101,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
| 100 | kfree(buffer); | 101 | kfree(buffer); |
| 101 | #ifndef __ECOS | 102 | #ifndef __ECOS |
| 102 | else | 103 | else |
| 103 | c->mtd->unpoint(c->mtd, buffer, ofs, len); | 104 | c->mtd->unpoint(c->mtd, ofs, len); |
| 104 | #endif | 105 | #endif |
| 105 | 106 | ||
| 106 | if (crc != tn->data_crc) { | 107 | if (crc != tn->data_crc) { |
| @@ -136,7 +137,7 @@ free_out: | |||
| 136 | kfree(buffer); | 137 | kfree(buffer); |
| 137 | #ifndef __ECOS | 138 | #ifndef __ECOS |
| 138 | else | 139 | else |
| 139 | c->mtd->unpoint(c->mtd, buffer, ofs, len); | 140 | c->mtd->unpoint(c->mtd, ofs, len); |
| 140 | #endif | 141 | #endif |
| 141 | return err; | 142 | return err; |
| 142 | } | 143 | } |
| @@ -1123,7 +1124,8 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, | |||
| 1123 | size_t retlen; | 1124 | size_t retlen; |
| 1124 | int ret; | 1125 | int ret; |
| 1125 | 1126 | ||
| 1126 | dbg_readinode("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink); | 1127 | dbg_readinode("ino #%u pino/nlink is %d\n", f->inocache->ino, |
| 1128 | f->inocache->pino_nlink); | ||
| 1127 | 1129 | ||
| 1128 | memset(&rii, 0, sizeof(rii)); | 1130 | memset(&rii, 0, sizeof(rii)); |
| 1129 | 1131 | ||
| @@ -1358,7 +1360,7 @@ int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
| 1358 | } | 1360 | } |
| 1359 | dbg_readinode("creating inocache for root inode\n"); | 1361 | dbg_readinode("creating inocache for root inode\n"); |
| 1360 | memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); | 1362 | memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); |
| 1361 | f->inocache->ino = f->inocache->nlink = 1; | 1363 | f->inocache->ino = f->inocache->pino_nlink = 1; |
| 1362 | f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; | 1364 | f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; |
| 1363 | f->inocache->state = INO_STATE_READING; | 1365 | f->inocache->state = INO_STATE_READING; |
| 1364 | jffs2_add_ino_cache(c, f->inocache); | 1366 | jffs2_add_ino_cache(c, f->inocache); |
| @@ -1401,7 +1403,7 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) | |||
| 1401 | jffs2_clear_acl(f); | 1403 | jffs2_clear_acl(f); |
| 1402 | jffs2_xattr_delete_inode(c, f->inocache); | 1404 | jffs2_xattr_delete_inode(c, f->inocache); |
| 1403 | mutex_lock(&f->sem); | 1405 | mutex_lock(&f->sem); |
| 1404 | deleted = f->inocache && !f->inocache->nlink; | 1406 | deleted = f->inocache && !f->inocache->pino_nlink; |
| 1405 | 1407 | ||
| 1406 | if (f->inocache && f->inocache->state != INO_STATE_CHECKING) | 1408 | if (f->inocache && f->inocache->state != INO_STATE_CHECKING) |
| 1407 | jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING); | 1409 | jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING); |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 272872d27fd5..1d437de1e9a8 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
| @@ -97,11 +97,12 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
| 97 | size_t pointlen; | 97 | size_t pointlen; |
| 98 | 98 | ||
| 99 | if (c->mtd->point) { | 99 | if (c->mtd->point) { |
| 100 | ret = c->mtd->point (c->mtd, 0, c->mtd->size, &pointlen, &flashbuf); | 100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, |
| 101 | (void **)&flashbuf, NULL); | ||
| 101 | if (!ret && pointlen < c->mtd->size) { | 102 | if (!ret && pointlen < c->mtd->size) { |
| 102 | /* Don't muck about if it won't let us point to the whole flash */ | 103 | /* Don't muck about if it won't let us point to the whole flash */ |
| 103 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); | 104 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); |
| 104 | c->mtd->unpoint(c->mtd, flashbuf, 0, pointlen); | 105 | c->mtd->unpoint(c->mtd, 0, pointlen); |
| 105 | flashbuf = NULL; | 106 | flashbuf = NULL; |
| 106 | } | 107 | } |
| 107 | if (ret) | 108 | if (ret) |
| @@ -267,7 +268,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
| 267 | kfree(flashbuf); | 268 | kfree(flashbuf); |
| 268 | #ifndef __ECOS | 269 | #ifndef __ECOS |
| 269 | else | 270 | else |
| 270 | c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); | 271 | c->mtd->unpoint(c->mtd, 0, c->mtd->size); |
| 271 | #endif | 272 | #endif |
| 272 | if (s) | 273 | if (s) |
| 273 | kfree(s); | 274 | kfree(s); |
| @@ -940,7 +941,7 @@ struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uin | |||
| 940 | ic->nodes = (void *)ic; | 941 | ic->nodes = (void *)ic; |
| 941 | jffs2_add_ino_cache(c, ic); | 942 | jffs2_add_ino_cache(c, ic); |
| 942 | if (ino == 1) | 943 | if (ino == 1) |
| 943 | ic->nlink = 1; | 944 | ic->pino_nlink = 1; |
| 944 | return ic; | 945 | return ic; |
| 945 | } | 946 | } |
| 946 | 947 | ||
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index f3353df178e7..7da69eae49e4 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
| @@ -31,11 +31,12 @@ static struct kmem_cache *jffs2_inode_cachep; | |||
| 31 | 31 | ||
| 32 | static struct inode *jffs2_alloc_inode(struct super_block *sb) | 32 | static struct inode *jffs2_alloc_inode(struct super_block *sb) |
| 33 | { | 33 | { |
| 34 | struct jffs2_inode_info *ei; | 34 | struct jffs2_inode_info *f; |
| 35 | ei = (struct jffs2_inode_info *)kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); | 35 | |
| 36 | if (!ei) | 36 | f = kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); |
| 37 | if (!f) | ||
| 37 | return NULL; | 38 | return NULL; |
| 38 | return &ei->vfs_inode; | 39 | return &f->vfs_inode; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | static void jffs2_destroy_inode(struct inode *inode) | 42 | static void jffs2_destroy_inode(struct inode *inode) |
| @@ -45,10 +46,10 @@ static void jffs2_destroy_inode(struct inode *inode) | |||
| 45 | 46 | ||
| 46 | static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) | 47 | static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) |
| 47 | { | 48 | { |
| 48 | struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; | 49 | struct jffs2_inode_info *f = foo; |
| 49 | 50 | ||
| 50 | mutex_init(&ei->sem); | 51 | mutex_init(&f->sem); |
| 51 | inode_init_once(&ei->vfs_inode); | 52 | inode_init_once(&f->vfs_inode); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | static int jffs2_sync_fs(struct super_block *sb, int wait) | 55 | static int jffs2_sync_fs(struct super_block *sb, int wait) |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 8de52b607678..0e78b00035e4 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
| @@ -494,7 +494,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) | |||
| 494 | /* If it's an in-core inode, then we have to adjust any | 494 | /* If it's an in-core inode, then we have to adjust any |
| 495 | full_dirent or full_dnode structure to point to the | 495 | full_dirent or full_dnode structure to point to the |
| 496 | new version instead of the old */ | 496 | new version instead of the old */ |
| 497 | f = jffs2_gc_fetch_inode(c, ic->ino, ic->nlink); | 497 | f = jffs2_gc_fetch_inode(c, ic->ino, !ic->pino_nlink); |
| 498 | if (IS_ERR(f)) { | 498 | if (IS_ERR(f)) { |
| 499 | /* Should never happen; it _must_ be present */ | 499 | /* Should never happen; it _must_ be present */ |
| 500 | JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n", | 500 | JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n", |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index 665fce9797d3..ca29440e9435 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
| @@ -19,7 +19,8 @@ | |||
| 19 | #include "compr.h" | 19 | #include "compr.h" |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri) | 22 | int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, |
| 23 | uint32_t mode, struct jffs2_raw_inode *ri) | ||
| 23 | { | 24 | { |
| 24 | struct jffs2_inode_cache *ic; | 25 | struct jffs2_inode_cache *ic; |
| 25 | 26 | ||
| @@ -31,7 +32,7 @@ int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint | |||
| 31 | memset(ic, 0, sizeof(*ic)); | 32 | memset(ic, 0, sizeof(*ic)); |
| 32 | 33 | ||
| 33 | f->inocache = ic; | 34 | f->inocache = ic; |
| 34 | f->inocache->nlink = 1; | 35 | f->inocache->pino_nlink = 1; /* Will be overwritten shortly for directories */ |
| 35 | f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; | 36 | f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; |
| 36 | f->inocache->state = INO_STATE_PRESENT; | 37 | f->inocache->state = INO_STATE_PRESENT; |
| 37 | 38 | ||
| @@ -438,10 +439,10 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str | |||
| 438 | ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL, | 439 | ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL, |
| 439 | JFFS2_SUMMARY_INODE_SIZE); | 440 | JFFS2_SUMMARY_INODE_SIZE); |
| 440 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); | 441 | D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); |
| 441 | if (ret) { | 442 | if (ret) |
| 442 | mutex_unlock(&f->sem); | ||
| 443 | return ret; | 443 | return ret; |
| 444 | } | 444 | |
| 445 | mutex_lock(&f->sem); | ||
| 445 | 446 | ||
| 446 | ri->data_crc = cpu_to_je32(0); | 447 | ri->data_crc = cpu_to_je32(0); |
| 447 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); | 448 | ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); |
| @@ -635,9 +636,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, | |||
| 635 | jffs2_mark_node_obsolete(c, fd->raw); | 636 | jffs2_mark_node_obsolete(c, fd->raw); |
| 636 | jffs2_free_full_dirent(fd); | 637 | jffs2_free_full_dirent(fd); |
| 637 | } | 638 | } |
| 638 | } | 639 | dead_f->inocache->pino_nlink = 0; |
| 639 | 640 | } else | |
| 640 | dead_f->inocache->nlink--; | 641 | dead_f->inocache->pino_nlink--; |
| 641 | /* NB: Caller must set inode nlink if appropriate */ | 642 | /* NB: Caller must set inode nlink if appropriate */ |
| 642 | mutex_unlock(&dead_f->sem); | 643 | mutex_unlock(&dead_f->sem); |
| 643 | } | 644 | } |
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 574cb7532d6c..082e844ab2db 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c | |||
| @@ -592,7 +592,7 @@ void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache | |||
| 592 | When an inode with XATTR is removed, those XATTRs must be removed. */ | 592 | When an inode with XATTR is removed, those XATTRs must be removed. */ |
| 593 | struct jffs2_xattr_ref *ref, *_ref; | 593 | struct jffs2_xattr_ref *ref, *_ref; |
| 594 | 594 | ||
| 595 | if (!ic || ic->nlink > 0) | 595 | if (!ic || ic->pino_nlink > 0) |
| 596 | return; | 596 | return; |
| 597 | 597 | ||
| 598 | down_write(&c->xattr_sem); | 598 | down_write(&c->xattr_sem); |
| @@ -829,7 +829,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c) | |||
| 829 | ref->xd and ref->ic are not valid yet. */ | 829 | ref->xd and ref->ic are not valid yet. */ |
| 830 | xd = jffs2_find_xattr_datum(c, ref->xid); | 830 | xd = jffs2_find_xattr_datum(c, ref->xid); |
| 831 | ic = jffs2_get_ino_cache(c, ref->ino); | 831 | ic = jffs2_get_ino_cache(c, ref->ino); |
| 832 | if (!xd || !ic || !ic->nlink) { | 832 | if (!xd || !ic || !ic->pino_nlink) { |
| 833 | dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", | 833 | dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", |
| 834 | ref->ino, ref->xid, ref->xseqno); | 834 | ref->ino, ref->xid, ref->xseqno); |
| 835 | ref->xseqno |= XREF_DELETE_MARKER; | 835 | ref->xseqno |= XREF_DELETE_MARKER; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index f8b82e73b3bf..eb53c632f856 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
| @@ -59,6 +59,8 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | |||
| 59 | if (error) | 59 | if (error) |
| 60 | return error; | 60 | return error; |
| 61 | 61 | ||
| 62 | iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ | ||
| 63 | |||
| 62 | error = inode_setattr(inode, iattr); | 64 | error = inode_setattr(inode, iattr); |
| 63 | if (error) | 65 | if (error) |
| 64 | return error; | 66 | return error; |
diff --git a/fs/utimes.c b/fs/utimes.c index a2bef77dc9c9..af059d5cb485 100644 --- a/fs/utimes.c +++ b/fs/utimes.c | |||
| @@ -40,9 +40,14 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) | |||
| 40 | 40 | ||
| 41 | #endif | 41 | #endif |
| 42 | 42 | ||
| 43 | static bool nsec_special(long nsec) | ||
| 44 | { | ||
| 45 | return nsec == UTIME_OMIT || nsec == UTIME_NOW; | ||
| 46 | } | ||
| 47 | |||
| 43 | static bool nsec_valid(long nsec) | 48 | static bool nsec_valid(long nsec) |
| 44 | { | 49 | { |
| 45 | if (nsec == UTIME_OMIT || nsec == UTIME_NOW) | 50 | if (nsec_special(nsec)) |
| 46 | return true; | 51 | return true; |
| 47 | 52 | ||
| 48 | return nsec >= 0 && nsec <= 999999999; | 53 | return nsec >= 0 && nsec <= 999999999; |
| @@ -119,7 +124,15 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags | |||
| 119 | newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; | 124 | newattrs.ia_mtime.tv_nsec = times[1].tv_nsec; |
| 120 | newattrs.ia_valid |= ATTR_MTIME_SET; | 125 | newattrs.ia_valid |= ATTR_MTIME_SET; |
| 121 | } | 126 | } |
| 122 | } else { | 127 | } |
| 128 | |||
| 129 | /* | ||
| 130 | * If times is NULL or both times are either UTIME_OMIT or | ||
| 131 | * UTIME_NOW, then need to check permissions, because | ||
| 132 | * inode_change_ok() won't do it. | ||
| 133 | */ | ||
| 134 | if (!times || (nsec_special(times[0].tv_nsec) && | ||
| 135 | nsec_special(times[1].tv_nsec))) { | ||
| 123 | error = -EACCES; | 136 | error = -EACCES; |
| 124 | if (IS_IMMUTABLE(inode)) | 137 | if (IS_IMMUTABLE(inode)) |
| 125 | goto mnt_drop_write_and_out; | 138 | goto mnt_drop_write_and_out; |
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h index 0b5f881c3d85..5001390be958 100644 --- a/include/asm-arm/div64.h +++ b/include/asm-arm/div64.h | |||
| @@ -224,6 +224,4 @@ | |||
| 224 | 224 | ||
| 225 | #endif | 225 | #endif |
| 226 | 226 | ||
| 227 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 228 | |||
| 229 | #endif | 227 | #endif |
diff --git a/include/asm-frv/unaligned.h b/include/asm-frv/unaligned.h index 64ccc736f2d8..839a2fbffa0f 100644 --- a/include/asm-frv/unaligned.h +++ b/include/asm-frv/unaligned.h | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #ifndef _ASM_FRV_UNALIGNED_H | 12 | #ifndef _ASM_UNALIGNED_H |
| 13 | #define _ASM_FRV_UNALIGNED_H | 13 | #define _ASM_UNALIGNED_H |
| 14 | 14 | ||
| 15 | #include <linux/unaligned/le_byteshift.h> | 15 | #include <linux/unaligned/le_byteshift.h> |
| 16 | #include <linux/unaligned/be_byteshift.h> | 16 | #include <linux/unaligned/be_byteshift.h> |
| @@ -19,4 +19,4 @@ | |||
| 19 | #define get_unaligned __get_unaligned_be | 19 | #define get_unaligned __get_unaligned_be |
| 20 | #define put_unaligned __put_unaligned_be | 20 | #define put_unaligned __put_unaligned_be |
| 21 | 21 | ||
| 22 | #endif /* _ASM_FRV_UNALIGNED_H */ | 22 | #endif /* _ASM_UNALIGNED_H */ |
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index a4a49370793c..8f4e3193342e 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h | |||
| @@ -30,11 +30,6 @@ | |||
| 30 | __rem; \ | 30 | __rem; \ |
| 31 | }) | 31 | }) |
| 32 | 32 | ||
| 33 | static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
| 34 | { | ||
| 35 | return dividend / divisor; | ||
| 36 | } | ||
| 37 | |||
| 38 | #elif BITS_PER_LONG == 32 | 33 | #elif BITS_PER_LONG == 32 |
| 39 | 34 | ||
| 40 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); | 35 | extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); |
| @@ -54,8 +49,6 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); | |||
| 54 | __rem; \ | 49 | __rem; \ |
| 55 | }) | 50 | }) |
| 56 | 51 | ||
| 57 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 58 | |||
| 59 | #else /* BITS_PER_LONG == ?? */ | 52 | #else /* BITS_PER_LONG == ?? */ |
| 60 | 53 | ||
| 61 | # error do_div() does not yet support the C64 | 54 | # error do_div() does not yet support the C64 |
diff --git a/include/asm-ia64/dmi.h b/include/asm-ia64/dmi.h index f3efaa229525..00eb1b130b63 100644 --- a/include/asm-ia64/dmi.h +++ b/include/asm-ia64/dmi.h | |||
| @@ -3,4 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include <asm/io.h> | 4 | #include <asm/io.h> |
| 5 | 5 | ||
| 6 | /* Use normal IO mappings for DMI */ | ||
| 7 | #define dmi_ioremap ioremap | ||
| 8 | #define dmi_iounmap(x,l) iounmap(x) | ||
| 9 | #define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) | ||
| 10 | |||
| 6 | #endif | 11 | #endif |
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h index 4ebed77aa472..260a85ac9d6a 100644 --- a/include/asm-ia64/io.h +++ b/include/asm-ia64/io.h | |||
| @@ -423,11 +423,6 @@ extern void __iomem * ioremap(unsigned long offset, unsigned long size); | |||
| 423 | extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); | 423 | extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); |
| 424 | extern void iounmap (volatile void __iomem *addr); | 424 | extern void iounmap (volatile void __iomem *addr); |
| 425 | 425 | ||
| 426 | /* Use normal IO mappings for DMI */ | ||
| 427 | #define dmi_ioremap ioremap | ||
| 428 | #define dmi_iounmap(x,l) iounmap(x) | ||
| 429 | #define dmi_alloc(l) kmalloc(l, GFP_ATOMIC) | ||
| 430 | |||
| 431 | /* | 426 | /* |
| 432 | * String version of IO memory access ops: | 427 | * String version of IO memory access ops: |
| 433 | */ | 428 | */ |
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h index 33caad1628d4..8243c931b5c0 100644 --- a/include/asm-m68k/div64.h +++ b/include/asm-m68k/div64.h | |||
| @@ -25,5 +25,4 @@ | |||
| 25 | __rem; \ | 25 | __rem; \ |
| 26 | }) | 26 | }) |
| 27 | 27 | ||
| 28 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 29 | #endif /* _M68K_DIV64_H */ | 28 | #endif /* _M68K_DIV64_H */ |
diff --git a/include/asm-m68knommu/dma.h b/include/asm-m68knommu/dma.h index 3f20419c633a..939a02056217 100644 --- a/include/asm-m68knommu/dma.h +++ b/include/asm-m68knommu/dma.h | |||
| @@ -35,7 +35,8 @@ | |||
| 35 | /* | 35 | /* |
| 36 | * Set number of channels of DMA on ColdFire for different implementations. | 36 | * Set number of channels of DMA on ColdFire for different implementations. |
| 37 | */ | 37 | */ |
| 38 | #if defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) | 38 | #if defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) || \ |
| 39 | defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) | ||
| 39 | #define MAX_M68K_DMA_CHANNELS 4 | 40 | #define MAX_M68K_DMA_CHANNELS 4 |
| 40 | #elif defined(CONFIG_M5272) | 41 | #elif defined(CONFIG_M5272) |
| 41 | #define MAX_M68K_DMA_CHANNELS 1 | 42 | #define MAX_M68K_DMA_CHANNELS 1 |
diff --git a/include/asm-m68knommu/param.h b/include/asm-m68knommu/param.h index 96c451018324..6044397adb64 100644 --- a/include/asm-m68knommu/param.h +++ b/include/asm-m68knommu/param.h | |||
| @@ -1,13 +1,16 @@ | |||
| 1 | #ifndef _M68KNOMMU_PARAM_H | 1 | #ifndef _M68KNOMMU_PARAM_H |
| 2 | #define _M68KNOMMU_PARAM_H | 2 | #define _M68KNOMMU_PARAM_H |
| 3 | 3 | ||
| 4 | #define HZ CONFIG_HZ | ||
| 5 | |||
| 6 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
| 5 | #define HZ CONFIG_HZ | ||
| 7 | #define USER_HZ HZ | 6 | #define USER_HZ HZ |
| 8 | #define CLOCKS_PER_SEC (USER_HZ) | 7 | #define CLOCKS_PER_SEC (USER_HZ) |
| 9 | #endif | 8 | #endif |
| 10 | 9 | ||
| 10 | #ifndef HZ | ||
| 11 | #define HZ 100 | ||
| 12 | #endif | ||
| 13 | |||
| 11 | #define EXEC_PAGESIZE 4096 | 14 | #define EXEC_PAGESIZE 4096 |
| 12 | 15 | ||
| 13 | #ifndef NOGROUP | 16 | #ifndef NOGROUP |
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h index 716371bd0980..d1d699105c11 100644 --- a/include/asm-mips/div64.h +++ b/include/asm-mips/div64.h | |||
| @@ -82,7 +82,6 @@ | |||
| 82 | (n) = __quot; \ | 82 | (n) = __quot; \ |
| 83 | __mod; }) | 83 | __mod; }) |
| 84 | 84 | ||
| 85 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 86 | #endif /* (_MIPS_SZLONG == 32) */ | 85 | #endif /* (_MIPS_SZLONG == 32) */ |
| 87 | 86 | ||
| 88 | #if (_MIPS_SZLONG == 64) | 87 | #if (_MIPS_SZLONG == 64) |
| @@ -106,11 +105,6 @@ extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | |||
| 106 | (n) = __quot; \ | 105 | (n) = __quot; \ |
| 107 | __mod; }) | 106 | __mod; }) |
| 108 | 107 | ||
| 109 | static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
| 110 | { | ||
| 111 | return dividend / divisor; | ||
| 112 | } | ||
| 113 | |||
| 114 | #endif /* (_MIPS_SZLONG == 64) */ | 108 | #endif /* (_MIPS_SZLONG == 64) */ |
| 115 | 109 | ||
| 116 | #endif /* _ASM_DIV64_H */ | 110 | #endif /* _ASM_DIV64_H */ |
diff --git a/include/asm-mn10300/div64.h b/include/asm-mn10300/div64.h index bf9c515a998c..3a8329b3e869 100644 --- a/include/asm-mn10300/div64.h +++ b/include/asm-mn10300/div64.h | |||
| @@ -97,7 +97,4 @@ signed __muldiv64s(signed val, signed mult, signed div) | |||
| 97 | return result; | 97 | return result; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | extern __attribute__((const)) | ||
| 101 | uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 102 | |||
| 103 | #endif /* _ASM_DIV64 */ | 100 | #endif /* _ASM_DIV64 */ |
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h index 7b73b2cd5b34..1e17f7409cab 100644 --- a/include/asm-um/div64.h +++ b/include/asm-um/div64.h | |||
| @@ -3,5 +3,4 @@ | |||
| 3 | 3 | ||
| 4 | #include "asm/arch/div64.h" | 4 | #include "asm/arch/div64.h" |
| 5 | 5 | ||
| 6 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 7 | #endif | 6 | #endif |
diff --git a/include/asm-x86/div64.h b/include/asm-x86/div64.h index 0dbf8bf3ef0a..9a2d644c08ef 100644 --- a/include/asm-x86/div64.h +++ b/include/asm-x86/div64.h | |||
| @@ -33,25 +33,25 @@ | |||
| 33 | __mod; \ | 33 | __mod; \ |
| 34 | }) | 34 | }) |
| 35 | 35 | ||
| 36 | /* | 36 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) |
| 37 | * (long)X = ((long long)divs) / (long)div | ||
| 38 | * (long)rem = ((long long)divs) % (long)div | ||
| 39 | * | ||
| 40 | * Warning, this will do an exception if X overflows. | ||
| 41 | */ | ||
| 42 | #define div_long_long_rem(a, b, c) div_ll_X_l_rem(a, b, c) | ||
| 43 | |||
| 44 | static inline long div_ll_X_l_rem(long long divs, long div, long *rem) | ||
| 45 | { | 37 | { |
| 46 | long dum2; | 38 | union { |
| 47 | asm("divl %2":"=a"(dum2), "=d"(*rem) | 39 | u64 v64; |
| 48 | : "rm"(div), "A"(divs)); | 40 | u32 v32[2]; |
| 49 | 41 | } d = { dividend }; | |
| 50 | return dum2; | 42 | u32 upper; |
| 51 | 43 | ||
| 44 | upper = d.v32[1]; | ||
| 45 | d.v32[1] = 0; | ||
| 46 | if (upper >= divisor) { | ||
| 47 | d.v32[1] = upper / divisor; | ||
| 48 | upper %= divisor; | ||
| 49 | } | ||
| 50 | asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) : | ||
| 51 | "rm" (divisor), "0" (d.v32[0]), "1" (upper)); | ||
| 52 | return d.v64; | ||
| 52 | } | 53 | } |
| 53 | 54 | #define div_u64_rem div_u64_rem | |
| 54 | extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
| 55 | 55 | ||
| 56 | #else | 56 | #else |
| 57 | # include <asm-generic/div64.h> | 57 | # include <asm-generic/div64.h> |
diff --git a/include/asm-x86/dmi.h b/include/asm-x86/dmi.h index 1241e6ad1935..4edf7514a750 100644 --- a/include/asm-x86/dmi.h +++ b/include/asm-x86/dmi.h | |||
| @@ -27,6 +27,7 @@ static inline void *dmi_alloc(unsigned len) | |||
| 27 | 27 | ||
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | /* Use early IO mappings for DMI because it's initialized early */ | ||
| 30 | #define dmi_ioremap early_ioremap | 31 | #define dmi_ioremap early_ioremap |
| 31 | #define dmi_iounmap early_iounmap | 32 | #define dmi_iounmap early_iounmap |
| 32 | 33 | ||
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h index 6e73467a4fb1..049e81e797a0 100644 --- a/include/asm-x86/io_32.h +++ b/include/asm-x86/io_32.h | |||
| @@ -133,11 +133,6 @@ extern void *early_ioremap(unsigned long offset, unsigned long size); | |||
| 133 | extern void early_iounmap(void *addr, unsigned long size); | 133 | extern void early_iounmap(void *addr, unsigned long size); |
| 134 | extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); | 134 | extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); |
| 135 | 135 | ||
| 136 | /* Use early IO mappings for DMI because it's initialized early */ | ||
| 137 | #define dmi_ioremap early_ioremap | ||
| 138 | #define dmi_iounmap early_iounmap | ||
| 139 | #define dmi_alloc alloc_bootmem | ||
| 140 | |||
| 141 | /* | 136 | /* |
| 142 | * ISA I/O bus memory addresses are 1:1 with the physical address. | 137 | * ISA I/O bus memory addresses are 1:1 with the physical address. |
| 143 | */ | 138 | */ |
diff --git a/include/asm-x86/mach-default/mach_apic.h b/include/asm-x86/mach-default/mach_apic.h index 0a6634f62abe..21003b56ae95 100644 --- a/include/asm-x86/mach-default/mach_apic.h +++ b/include/asm-x86/mach-default/mach_apic.h | |||
| @@ -109,13 +109,8 @@ static inline int cpu_to_logical_apicid(int cpu) | |||
| 109 | 109 | ||
| 110 | static inline int cpu_present_to_apicid(int mps_cpu) | 110 | static inline int cpu_present_to_apicid(int mps_cpu) |
| 111 | { | 111 | { |
| 112 | #ifdef CONFIG_X86_64 | 112 | if (mps_cpu < NR_CPUS && cpu_present(mps_cpu)) |
| 113 | if (cpu_present(mps_cpu)) | ||
| 114 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); | 113 | return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu); |
| 115 | #else | ||
| 116 | if (mps_cpu < get_physical_broadcast()) | ||
| 117 | return mps_cpu; | ||
| 118 | #endif | ||
| 119 | else | 114 | else |
| 120 | return BAD_APICID; | 115 | return BAD_APICID; |
| 121 | } | 116 | } |
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h index 2e7974ec77ec..559105220a47 100644 --- a/include/asm-x86/processor.h +++ b/include/asm-x86/processor.h | |||
| @@ -3,9 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <asm/processor-flags.h> | 4 | #include <asm/processor-flags.h> |
| 5 | 5 | ||
| 6 | /* migration helper, for KVM - will be removed in 2.6.25: */ | ||
| 7 | #define Xgt_desc_struct desc_ptr | ||
| 8 | |||
| 9 | /* Forward declaration, a strange C thing */ | 6 | /* Forward declaration, a strange C thing */ |
| 10 | struct task_struct; | 7 | struct task_struct; |
| 11 | struct mm_struct; | 8 | struct mm_struct; |
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h index 1e17bcce450e..6c8b41b03f6d 100644 --- a/include/asm-x86/proto.h +++ b/include/asm-x86/proto.h | |||
| @@ -20,7 +20,11 @@ extern void syscall32_cpu_init(void); | |||
| 20 | 20 | ||
| 21 | extern void check_efer(void); | 21 | extern void check_efer(void); |
| 22 | 22 | ||
| 23 | #ifdef CONFIG_X86_BIOS_REBOOT | ||
| 23 | extern int reboot_force; | 24 | extern int reboot_force; |
| 25 | #else | ||
| 26 | static const int reboot_force = 0; | ||
| 27 | #endif | ||
| 24 | 28 | ||
| 25 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); | 29 | long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); |
| 26 | 30 | ||
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h index 224658b8d806..833d208c25d6 100644 --- a/include/crypto/scatterwalk.h +++ b/include/crypto/scatterwalk.h | |||
| @@ -57,10 +57,14 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num, | |||
| 57 | struct scatterlist *sg2) | 57 | struct scatterlist *sg2) |
| 58 | { | 58 | { |
| 59 | sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); | 59 | sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0); |
| 60 | sg1[num - 1].page_link &= ~0x02; | ||
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) | 63 | static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) |
| 63 | { | 64 | { |
| 65 | if (sg_is_last(sg)) | ||
| 66 | return NULL; | ||
| 67 | |||
| 64 | return (++sg)->length ? sg : (void *)sg_page(sg); | 68 | return (++sg)->length ? sg : (void *)sg_page(sg); |
| 65 | } | 69 | } |
| 66 | 70 | ||
diff --git a/include/linux/calc64.h b/include/linux/calc64.h deleted file mode 100644 index ebf4b8f38d88..000000000000 --- a/include/linux/calc64.h +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | #ifndef _LINUX_CALC64_H | ||
| 2 | #define _LINUX_CALC64_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <asm/div64.h> | ||
| 6 | |||
| 7 | /* | ||
| 8 | * This is a generic macro which is used when the architecture | ||
| 9 | * specific div64.h does not provide a optimized one. | ||
| 10 | * | ||
| 11 | * The 64bit dividend is divided by the divisor (data type long), the | ||
| 12 | * result is returned and the remainder stored in the variable | ||
| 13 | * referenced by remainder (data type long *). In contrast to the | ||
| 14 | * do_div macro the dividend is kept intact. | ||
| 15 | */ | ||
| 16 | #ifndef div_long_long_rem | ||
| 17 | #define div_long_long_rem(dividend, divisor, remainder) \ | ||
| 18 | do_div_llr((dividend), divisor, remainder) | ||
| 19 | |||
| 20 | static inline unsigned long do_div_llr(const long long dividend, | ||
| 21 | const long divisor, long *remainder) | ||
| 22 | { | ||
| 23 | u64 result = dividend; | ||
| 24 | |||
| 25 | *(remainder) = do_div(result, divisor); | ||
| 26 | return (unsigned long) result; | ||
| 27 | } | ||
| 28 | #endif | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Sign aware variation of the above. On some architectures a | ||
| 32 | * negative dividend leads to an divide overflow exception, which | ||
| 33 | * is avoided by the sign check. | ||
| 34 | */ | ||
| 35 | static inline long div_long_long_rem_signed(const long long dividend, | ||
| 36 | const long divisor, long *remainder) | ||
| 37 | { | ||
| 38 | long res; | ||
| 39 | |||
| 40 | if (unlikely(dividend < 0)) { | ||
| 41 | res = -div_long_long_rem(-dividend, divisor, remainder); | ||
| 42 | *remainder = -(*remainder); | ||
| 43 | } else | ||
| 44 | res = div_long_long_rem(dividend, divisor, remainder); | ||
| 45 | |||
| 46 | return res; | ||
| 47 | } | ||
| 48 | |||
| 49 | #endif | ||
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 35094479ca55..55e434feec99 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -93,6 +93,8 @@ struct clocksource { | |||
| 93 | #endif | 93 | #endif |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | extern struct clocksource *clock; /* current clocksource */ | ||
| 97 | |||
| 96 | /* | 98 | /* |
| 97 | * Clock source flags bits:: | 99 | * Clock source flags bits:: |
| 98 | */ | 100 | */ |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 8fa7857e153b..cf8d11cad5ae 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
| @@ -65,10 +65,11 @@ struct compat_timex { | |||
| 65 | compat_long_t calcnt; | 65 | compat_long_t calcnt; |
| 66 | compat_long_t errcnt; | 66 | compat_long_t errcnt; |
| 67 | compat_long_t stbcnt; | 67 | compat_long_t stbcnt; |
| 68 | compat_int_t tai; | ||
| 68 | 69 | ||
| 69 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 70 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
| 70 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 71 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
| 71 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; | 72 | compat_int_t :32; compat_int_t :32; compat_int_t :32; |
| 72 | }; | 73 | }; |
| 73 | 74 | ||
| 74 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) | 75 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
diff --git a/include/linux/device.h b/include/linux/device.h index 1a060265acea..832fb0eb2933 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -35,7 +35,6 @@ struct device; | |||
| 35 | struct device_driver; | 35 | struct device_driver; |
| 36 | struct driver_private; | 36 | struct driver_private; |
| 37 | struct class; | 37 | struct class; |
| 38 | struct class_device; | ||
| 39 | struct bus_type; | 38 | struct bus_type; |
| 40 | struct bus_type_private; | 39 | struct bus_type_private; |
| 41 | 40 | ||
| @@ -190,13 +189,10 @@ struct class { | |||
| 190 | struct kset class_dirs; | 189 | struct kset class_dirs; |
| 191 | struct semaphore sem; /* locks children, devices, interfaces */ | 190 | struct semaphore sem; /* locks children, devices, interfaces */ |
| 192 | struct class_attribute *class_attrs; | 191 | struct class_attribute *class_attrs; |
| 193 | struct class_device_attribute *class_dev_attrs; | ||
| 194 | struct device_attribute *dev_attrs; | 192 | struct device_attribute *dev_attrs; |
| 195 | 193 | ||
| 196 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | ||
| 197 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 194 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 198 | 195 | ||
| 199 | void (*release)(struct class_device *dev); | ||
| 200 | void (*class_release)(struct class *class); | 196 | void (*class_release)(struct class *class); |
| 201 | void (*dev_release)(struct device *dev); | 197 | void (*dev_release)(struct device *dev); |
| 202 | 198 | ||
| @@ -210,9 +206,6 @@ extern int class_for_each_device(struct class *class, void *data, | |||
| 210 | int (*fn)(struct device *dev, void *data)); | 206 | int (*fn)(struct device *dev, void *data)); |
| 211 | extern struct device *class_find_device(struct class *class, void *data, | 207 | extern struct device *class_find_device(struct class *class, void *data, |
| 212 | int (*match)(struct device *, void *)); | 208 | int (*match)(struct device *, void *)); |
| 213 | extern struct class_device *class_find_child(struct class *class, void *data, | ||
| 214 | int (*match)(struct class_device *, void *)); | ||
| 215 | |||
| 216 | 209 | ||
| 217 | struct class_attribute { | 210 | struct class_attribute { |
| 218 | struct attribute attr; | 211 | struct attribute attr; |
| @@ -228,92 +221,10 @@ extern int __must_check class_create_file(struct class *class, | |||
| 228 | extern void class_remove_file(struct class *class, | 221 | extern void class_remove_file(struct class *class, |
| 229 | const struct class_attribute *attr); | 222 | const struct class_attribute *attr); |
| 230 | 223 | ||
| 231 | struct class_device_attribute { | ||
| 232 | struct attribute attr; | ||
| 233 | ssize_t (*show)(struct class_device *, char *buf); | ||
| 234 | ssize_t (*store)(struct class_device *, const char *buf, size_t count); | ||
| 235 | }; | ||
| 236 | |||
| 237 | #define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \ | ||
| 238 | struct class_device_attribute class_device_attr_##_name = \ | ||
| 239 | __ATTR(_name, _mode, _show, _store) | ||
| 240 | |||
| 241 | extern int __must_check class_device_create_file(struct class_device *, | ||
| 242 | const struct class_device_attribute *); | ||
| 243 | |||
| 244 | /** | ||
| 245 | * struct class_device - class devices | ||
| 246 | * @class: pointer to the parent class for this class device. This is required. | ||
| 247 | * @devt: for internal use by the driver core only. | ||
| 248 | * @node: for internal use by the driver core only. | ||
| 249 | * @kobj: for internal use by the driver core only. | ||
| 250 | * @groups: optional additional groups to be created | ||
| 251 | * @dev: if set, a symlink to the struct device is created in the sysfs | ||
| 252 | * directory for this struct class device. | ||
| 253 | * @class_data: pointer to whatever you want to store here for this struct | ||
| 254 | * class_device. Use class_get_devdata() and class_set_devdata() to get and | ||
| 255 | * set this pointer. | ||
| 256 | * @parent: pointer to a struct class_device that is the parent of this struct | ||
| 257 | * class_device. If NULL, this class_device will show up at the root of the | ||
| 258 | * struct class in sysfs (which is probably what you want to have happen.) | ||
| 259 | * @release: pointer to a release function for this struct class_device. If | ||
| 260 | * set, this will be called instead of the class specific release function. | ||
| 261 | * Only use this if you want to override the default release function, like | ||
| 262 | * when you are nesting class_device structures. | ||
| 263 | * @uevent: pointer to a uevent function for this struct class_device. If | ||
| 264 | * set, this will be called instead of the class specific uevent function. | ||
| 265 | * Only use this if you want to override the default uevent function, like | ||
| 266 | * when you are nesting class_device structures. | ||
| 267 | */ | ||
| 268 | struct class_device { | ||
| 269 | struct list_head node; | ||
| 270 | |||
| 271 | struct kobject kobj; | ||
| 272 | struct class *class; | ||
| 273 | dev_t devt; | ||
| 274 | struct device *dev; | ||
| 275 | void *class_data; | ||
| 276 | struct class_device *parent; | ||
| 277 | struct attribute_group **groups; | ||
| 278 | |||
| 279 | void (*release)(struct class_device *dev); | ||
| 280 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | ||
| 281 | char class_id[BUS_ID_SIZE]; | ||
| 282 | }; | ||
| 283 | |||
| 284 | static inline void *class_get_devdata(struct class_device *dev) | ||
| 285 | { | ||
| 286 | return dev->class_data; | ||
| 287 | } | ||
| 288 | |||
| 289 | static inline void class_set_devdata(struct class_device *dev, void *data) | ||
| 290 | { | ||
| 291 | dev->class_data = data; | ||
| 292 | } | ||
| 293 | |||
| 294 | |||
| 295 | extern int __must_check class_device_register(struct class_device *); | ||
| 296 | extern void class_device_unregister(struct class_device *); | ||
| 297 | extern void class_device_initialize(struct class_device *); | ||
| 298 | extern int __must_check class_device_add(struct class_device *); | ||
| 299 | extern void class_device_del(struct class_device *); | ||
| 300 | |||
| 301 | extern struct class_device *class_device_get(struct class_device *); | ||
| 302 | extern void class_device_put(struct class_device *); | ||
| 303 | |||
| 304 | extern void class_device_remove_file(struct class_device *, | ||
| 305 | const struct class_device_attribute *); | ||
| 306 | extern int __must_check class_device_create_bin_file(struct class_device *, | ||
| 307 | struct bin_attribute *); | ||
| 308 | extern void class_device_remove_bin_file(struct class_device *, | ||
| 309 | struct bin_attribute *); | ||
| 310 | |||
| 311 | struct class_interface { | 224 | struct class_interface { |
| 312 | struct list_head node; | 225 | struct list_head node; |
| 313 | struct class *class; | 226 | struct class *class; |
| 314 | 227 | ||
| 315 | int (*add) (struct class_device *, struct class_interface *); | ||
| 316 | void (*remove) (struct class_device *, struct class_interface *); | ||
| 317 | int (*add_dev) (struct device *, struct class_interface *); | 228 | int (*add_dev) (struct device *, struct class_interface *); |
| 318 | void (*remove_dev) (struct device *, struct class_interface *); | 229 | void (*remove_dev) (struct device *, struct class_interface *); |
| 319 | }; | 230 | }; |
| @@ -323,13 +234,6 @@ extern void class_interface_unregister(struct class_interface *); | |||
| 323 | 234 | ||
| 324 | extern struct class *class_create(struct module *owner, const char *name); | 235 | extern struct class *class_create(struct module *owner, const char *name); |
| 325 | extern void class_destroy(struct class *cls); | 236 | extern void class_destroy(struct class *cls); |
| 326 | extern struct class_device *class_device_create(struct class *cls, | ||
| 327 | struct class_device *parent, | ||
| 328 | dev_t devt, | ||
| 329 | struct device *device, | ||
| 330 | const char *fmt, ...) | ||
| 331 | __attribute__((format(printf, 5, 6))); | ||
| 332 | extern void class_device_destroy(struct class *cls, dev_t devt); | ||
| 333 | 237 | ||
| 334 | /* | 238 | /* |
| 335 | * The type of device, "struct device" is embedded in. A class | 239 | * The type of device, "struct device" is embedded in. A class |
| @@ -465,7 +369,6 @@ struct device { | |||
| 465 | spinlock_t devres_lock; | 369 | spinlock_t devres_lock; |
| 466 | struct list_head devres_head; | 370 | struct list_head devres_head; |
| 467 | 371 | ||
| 468 | /* class_device migration path */ | ||
| 469 | struct list_head node; | 372 | struct list_head node; |
| 470 | struct class *class; | 373 | struct class *class; |
| 471 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 374 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
diff --git a/include/linux/io.h b/include/linux/io.h index e3b2dda6c8eb..3a03a3604cce 100644 --- a/include/linux/io.h +++ b/include/linux/io.h | |||
| @@ -58,9 +58,9 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) | |||
| 58 | } | 58 | } |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | void __iomem * devm_ioremap(struct device *dev, unsigned long offset, | 61 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
| 62 | unsigned long size); | 62 | unsigned long size); |
| 63 | void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset, | 63 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
| 64 | unsigned long size); | 64 | unsigned long size); |
| 65 | void devm_iounmap(struct device *dev, void __iomem *addr); | 65 | void devm_iounmap(struct device *dev, void __iomem *addr); |
| 66 | int check_signature(const volatile void __iomem *io_addr, | 66 | int check_signature(const volatile void __iomem *io_addr, |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 33ef710dac24..abb6ac639e8e 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _LINUX_JIFFIES_H | 1 | #ifndef _LINUX_JIFFIES_H |
| 2 | #define _LINUX_JIFFIES_H | 2 | #define _LINUX_JIFFIES_H |
| 3 | 3 | ||
| 4 | #include <linux/calc64.h> | 4 | #include <linux/math64.h> |
| 5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
| 6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
| 7 | #include <linux/time.h> | 7 | #include <linux/time.h> |
diff --git a/include/linux/klist.h b/include/linux/klist.h index 74071254c9d3..06c338ef7f1b 100644 --- a/include/linux/klist.h +++ b/include/linux/klist.h | |||
| @@ -25,37 +25,47 @@ struct klist { | |||
| 25 | void (*put)(struct klist_node *); | 25 | void (*put)(struct klist_node *); |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | #define KLIST_INIT(_name, _get, _put) \ | ||
| 29 | { .k_lock = __SPIN_LOCK_UNLOCKED(_name.k_lock), \ | ||
| 30 | .k_list = LIST_HEAD_INIT(_name.k_list), \ | ||
| 31 | .get = _get, \ | ||
| 32 | .put = _put, } | ||
| 28 | 33 | ||
| 29 | extern void klist_init(struct klist * k, void (*get)(struct klist_node *), | 34 | #define DEFINE_KLIST(_name, _get, _put) \ |
| 35 | struct klist _name = KLIST_INIT(_name, _get, _put) | ||
| 36 | |||
| 37 | extern void klist_init(struct klist *k, void (*get)(struct klist_node *), | ||
| 30 | void (*put)(struct klist_node *)); | 38 | void (*put)(struct klist_node *)); |
| 31 | 39 | ||
| 32 | struct klist_node { | 40 | struct klist_node { |
| 33 | struct klist * n_klist; | 41 | struct klist *n_klist; |
| 34 | struct list_head n_node; | 42 | struct list_head n_node; |
| 35 | struct kref n_ref; | 43 | struct kref n_ref; |
| 36 | struct completion n_removed; | 44 | struct completion n_removed; |
| 37 | }; | 45 | }; |
| 38 | 46 | ||
| 39 | extern void klist_add_tail(struct klist_node * n, struct klist * k); | 47 | extern void klist_add_tail(struct klist_node *n, struct klist *k); |
| 40 | extern void klist_add_head(struct klist_node * n, struct klist * k); | 48 | extern void klist_add_head(struct klist_node *n, struct klist *k); |
| 49 | extern void klist_add_after(struct klist_node *n, struct klist_node *pos); | ||
| 50 | extern void klist_add_before(struct klist_node *n, struct klist_node *pos); | ||
| 41 | 51 | ||
| 42 | extern void klist_del(struct klist_node * n); | 52 | extern void klist_del(struct klist_node *n); |
| 43 | extern void klist_remove(struct klist_node * n); | 53 | extern void klist_remove(struct klist_node *n); |
| 44 | 54 | ||
| 45 | extern int klist_node_attached(struct klist_node * n); | 55 | extern int klist_node_attached(struct klist_node *n); |
| 46 | 56 | ||
| 47 | 57 | ||
| 48 | struct klist_iter { | 58 | struct klist_iter { |
| 49 | struct klist * i_klist; | 59 | struct klist *i_klist; |
| 50 | struct list_head * i_head; | 60 | struct list_head *i_head; |
| 51 | struct klist_node * i_cur; | 61 | struct klist_node *i_cur; |
| 52 | }; | 62 | }; |
| 53 | 63 | ||
| 54 | 64 | ||
| 55 | extern void klist_iter_init(struct klist * k, struct klist_iter * i); | 65 | extern void klist_iter_init(struct klist *k, struct klist_iter *i); |
| 56 | extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, | 66 | extern void klist_iter_init_node(struct klist *k, struct klist_iter *i, |
| 57 | struct klist_node * n); | 67 | struct klist_node *n); |
| 58 | extern void klist_iter_exit(struct klist_iter * i); | 68 | extern void klist_iter_exit(struct klist_iter *i); |
| 59 | extern struct klist_node * klist_next(struct klist_iter * i); | 69 | extern struct klist_node *klist_next(struct klist_iter *i); |
| 60 | 70 | ||
| 61 | #endif | 71 | #endif |
diff --git a/include/linux/math64.h b/include/linux/math64.h new file mode 100644 index 000000000000..c1a5f81501ff --- /dev/null +++ b/include/linux/math64.h | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | #ifndef _LINUX_MATH64_H | ||
| 2 | #define _LINUX_MATH64_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <asm/div64.h> | ||
| 6 | |||
| 7 | #if BITS_PER_LONG == 64 | ||
| 8 | |||
| 9 | /** | ||
| 10 | * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder | ||
| 11 | * | ||
| 12 | * This is commonly provided by 32bit archs to provide an optimized 64bit | ||
| 13 | * divide. | ||
| 14 | */ | ||
| 15 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | ||
| 16 | { | ||
| 17 | *remainder = dividend % divisor; | ||
| 18 | return dividend / divisor; | ||
| 19 | } | ||
| 20 | |||
| 21 | /** | ||
| 22 | * div_s64_rem - signed 64bit divide with 32bit divisor with remainder | ||
| 23 | */ | ||
| 24 | static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) | ||
| 25 | { | ||
| 26 | *remainder = dividend % divisor; | ||
| 27 | return dividend / divisor; | ||
| 28 | } | ||
| 29 | |||
| 30 | /** | ||
| 31 | * div64_u64 - unsigned 64bit divide with 64bit divisor | ||
| 32 | */ | ||
| 33 | static inline u64 div64_u64(u64 dividend, u64 divisor) | ||
| 34 | { | ||
| 35 | return dividend / divisor; | ||
| 36 | } | ||
| 37 | |||
| 38 | #elif BITS_PER_LONG == 32 | ||
| 39 | |||
| 40 | #ifndef div_u64_rem | ||
| 41 | static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) | ||
| 42 | { | ||
| 43 | *remainder = do_div(dividend, divisor); | ||
| 44 | return dividend; | ||
| 45 | } | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #ifndef div_s64_rem | ||
| 49 | extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder); | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifndef div64_u64 | ||
| 53 | extern u64 div64_u64(u64 dividend, u64 divisor); | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #endif /* BITS_PER_LONG */ | ||
| 57 | |||
| 58 | /** | ||
| 59 | * div_u64 - unsigned 64bit divide with 32bit divisor | ||
| 60 | * | ||
| 61 | * This is the most common 64bit divide and should be used if possible, | ||
| 62 | * as many 32bit archs can optimize this variant better than a full 64bit | ||
| 63 | * divide. | ||
| 64 | */ | ||
| 65 | #ifndef div_u64 | ||
| 66 | static inline u64 div_u64(u64 dividend, u32 divisor) | ||
| 67 | { | ||
| 68 | u32 remainder; | ||
| 69 | return div_u64_rem(dividend, divisor, &remainder); | ||
| 70 | } | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /** | ||
| 74 | * div_s64 - signed 64bit divide with 32bit divisor | ||
| 75 | */ | ||
| 76 | #ifndef div_s64 | ||
| 77 | static inline s64 div_s64(s64 dividend, s32 divisor) | ||
| 78 | { | ||
| 79 | s32 remainder; | ||
| 80 | return div_s64_rem(dividend, divisor, &remainder); | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #endif /* _LINUX_MATH64_H */ | ||
diff --git a/include/linux/module.h b/include/linux/module.h index 819c4e889bf1..3e03b1acbc94 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -190,7 +190,7 @@ void *__symbol_get_gpl(const char *symbol); | |||
| 190 | extern typeof(sym) sym; \ | 190 | extern typeof(sym) sym; \ |
| 191 | __CRC_SYMBOL(sym, sec) \ | 191 | __CRC_SYMBOL(sym, sec) \ |
| 192 | static const char __kstrtab_##sym[] \ | 192 | static const char __kstrtab_##sym[] \ |
| 193 | __attribute__((section("__ksymtab_strings"))) \ | 193 | __attribute__((section("__ksymtab_strings"), aligned(1))) \ |
| 194 | = MODULE_SYMBOL_PREFIX #sym; \ | 194 | = MODULE_SYMBOL_PREFIX #sym; \ |
| 195 | static const struct kernel_symbol __ksymtab_##sym \ | 195 | static const struct kernel_symbol __ksymtab_##sym \ |
| 196 | __used \ | 196 | __used \ |
| @@ -229,23 +229,6 @@ enum module_state | |||
| 229 | MODULE_STATE_GOING, | 229 | MODULE_STATE_GOING, |
| 230 | }; | 230 | }; |
| 231 | 231 | ||
| 232 | /* Similar stuff for section attributes. */ | ||
| 233 | struct module_sect_attr | ||
| 234 | { | ||
| 235 | struct module_attribute mattr; | ||
| 236 | char *name; | ||
| 237 | unsigned long address; | ||
| 238 | }; | ||
| 239 | |||
| 240 | struct module_sect_attrs | ||
| 241 | { | ||
| 242 | struct attribute_group grp; | ||
| 243 | int nsections; | ||
| 244 | struct module_sect_attr attrs[0]; | ||
| 245 | }; | ||
| 246 | |||
| 247 | struct module_param_attrs; | ||
| 248 | |||
| 249 | struct module | 232 | struct module |
| 250 | { | 233 | { |
| 251 | enum module_state state; | 234 | enum module_state state; |
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h deleted file mode 100644 index 9006feb218b9..000000000000 --- a/include/linux/mtd/jedec.h +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | |||
| 2 | /* JEDEC Flash Interface. | ||
| 3 | * This is an older type of interface for self programming flash. It is | ||
| 4 | * commonly use in older AMD chips and is obsolete compared with CFI. | ||
| 5 | * It is called JEDEC because the JEDEC association distributes the ID codes | ||
| 6 | * for the chips. | ||
| 7 | * | ||
| 8 | * See the AMD flash databook for information on how to operate the interface. | ||
| 9 | * | ||
| 10 | * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef __LINUX_MTD_JEDEC_H__ | ||
| 14 | #define __LINUX_MTD_JEDEC_H__ | ||
| 15 | |||
| 16 | #include <linux/types.h> | ||
| 17 | |||
| 18 | #define MAX_JEDEC_CHIPS 16 | ||
| 19 | |||
| 20 | // Listing of all supported chips and their information | ||
| 21 | struct JEDECTable | ||
| 22 | { | ||
| 23 | __u16 jedec; | ||
| 24 | char *name; | ||
| 25 | unsigned long size; | ||
| 26 | unsigned long sectorsize; | ||
| 27 | __u32 capabilities; | ||
| 28 | }; | ||
| 29 | |||
| 30 | // JEDEC being 0 is the end of the chip array | ||
| 31 | struct jedec_flash_chip | ||
| 32 | { | ||
| 33 | __u16 jedec; | ||
| 34 | unsigned long size; | ||
| 35 | unsigned long sectorsize; | ||
| 36 | |||
| 37 | // *(__u8*)(base + (adder << addrshift)) = data << datashift | ||
| 38 | // Address size = size << addrshift | ||
| 39 | unsigned long base; // Byte 0 of the flash, will be unaligned | ||
| 40 | unsigned int datashift; // Useful for 32bit/16bit accesses | ||
| 41 | unsigned int addrshift; | ||
| 42 | unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash | ||
| 43 | |||
| 44 | __u32 capabilities; | ||
| 45 | |||
| 46 | // These markers are filled in by the flash_chip_scan function | ||
| 47 | unsigned long start; | ||
| 48 | unsigned long length; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct jedec_private | ||
| 52 | { | ||
| 53 | unsigned long size; // Total size of all the devices | ||
| 54 | |||
| 55 | /* Bank handling. If sum(bank_fill) == size then this is linear flash. | ||
| 56 | Otherwise the mapping has holes in it. bank_fill may be used to | ||
| 57 | find the holes, but in the common symetric case | ||
| 58 | bank_fill[0] == bank_fill[*], thus addresses may be computed | ||
| 59 | mathmatically. bank_fill must be powers of two */ | ||
| 60 | unsigned is_banked; | ||
| 61 | unsigned long bank_fill[MAX_JEDEC_CHIPS]; | ||
| 62 | |||
| 63 | struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; | ||
| 64 | }; | ||
| 65 | |||
| 66 | #endif | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 0a13bb35f044..245f9098e171 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -143,10 +143,12 @@ struct mtd_info { | |||
| 143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); |
| 144 | 144 | ||
| 145 | /* This stuff for eXecute-In-Place */ | 145 | /* This stuff for eXecute-In-Place */ |
| 146 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 146 | /* phys is optional and may be set to NULL */ |
| 147 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | ||
| 148 | size_t *retlen, void **virt, resource_size_t *phys); | ||
| 147 | 149 | ||
| 148 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 150 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
| 149 | void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); | 151 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
| 150 | 152 | ||
| 151 | 153 | ||
| 152 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 154 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index a7f6d20ad407..5cc070c24d88 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h | |||
| @@ -36,8 +36,9 @@ struct mypriv { | |||
| 36 | * Function Prototypes | 36 | * Function Prototypes |
| 37 | */ | 37 | */ |
| 38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); | 38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); |
| 39 | static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 39 | static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); |
| 40 | static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 40 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
| 41 | size_t *retlen, void **virt, resource_size_t *phys); | ||
| 41 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 42 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
| 42 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 43 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| 43 | 44 | ||
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index e5a53daf17f1..cf6dbd759395 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -1429,6 +1429,7 @@ | |||
| 1429 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 | 1429 | #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 |
| 1430 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA | 1430 | #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA |
| 1431 | #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB | 1431 | #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB |
| 1432 | #define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4 | ||
| 1432 | 1433 | ||
| 1433 | #define PCI_VENDOR_ID_XIRCOM 0x115d | 1434 | #define PCI_VENDOR_ID_XIRCOM 0x115d |
| 1434 | #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 | 1435 | #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 52e49dce6584..dcddfb200947 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -347,6 +347,9 @@ struct quota_info { | |||
| 347 | ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ | 347 | ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \ |
| 348 | (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) | 348 | (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED)) |
| 349 | 349 | ||
| 350 | #define sb_any_quota_suspended(sb) (sb_has_quota_suspended(sb, USRQUOTA) | \ | ||
| 351 | sb_has_quota_suspended(sb, GRPQUOTA)) | ||
| 352 | |||
| 350 | int register_quota_format(struct quota_format_type *fmt); | 353 | int register_quota_format(struct quota_format_type *fmt); |
| 351 | void unregister_quota_format(struct quota_format_type *fmt); | 354 | void unregister_quota_format(struct quota_format_type *fmt); |
| 352 | 355 | ||
diff --git a/include/linux/string.h b/include/linux/string.h index c5d3fcad7b57..efdc44593b52 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -109,5 +109,7 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp); | |||
| 109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); | 109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
| 110 | extern void argv_free(char **argv); | 110 | extern void argv_free(char **argv); |
| 111 | 111 | ||
| 112 | extern bool sysfs_streq(const char *s1, const char *s2); | ||
| 113 | |||
| 112 | #endif | 114 | #endif |
| 113 | #endif /* _LINUX_STRING_H_ */ | 115 | #endif /* _LINUX_STRING_H_ */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index add3c5a40827..27bad59dae79 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -190,6 +190,18 @@ static inline int sysfs_create_group(struct kobject *kobj, | |||
| 190 | return 0; | 190 | return 0; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | static inline int sysfs_update_group(struct kobject *kobj, | ||
| 194 | const struct attribute_group *grp) | ||
| 195 | { | ||
| 196 | return 0; | ||
| 197 | } | ||
| 198 | |||
| 199 | static inline int sysfs_update_group(struct kobject *kobj, | ||
| 200 | const struct attribute_group *grp) | ||
| 201 | { | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | |||
| 193 | static inline void sysfs_remove_group(struct kobject *kobj, | 205 | static inline void sysfs_remove_group(struct kobject *kobj, |
| 194 | const struct attribute_group *grp) | 206 | const struct attribute_group *grp) |
| 195 | { | 207 | { |
diff --git a/include/linux/timex.h b/include/linux/timex.h index 8ea3e71ba7fa..fc6035d29d56 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
| @@ -58,6 +58,8 @@ | |||
| 58 | 58 | ||
| 59 | #include <asm/param.h> | 59 | #include <asm/param.h> |
| 60 | 60 | ||
| 61 | #define NTP_API 4 /* NTP API version */ | ||
| 62 | |||
| 61 | /* | 63 | /* |
| 62 | * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen | 64 | * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen |
| 63 | * for a slightly underdamped convergence characteristic. SHIFT_KH | 65 | * for a slightly underdamped convergence characteristic. SHIFT_KH |
| @@ -74,24 +76,22 @@ | |||
| 74 | #define MAXTC 10 /* maximum time constant (shift) */ | 76 | #define MAXTC 10 /* maximum time constant (shift) */ |
| 75 | 77 | ||
| 76 | /* | 78 | /* |
| 77 | * The SHIFT_UPDATE define establishes the decimal point of the | ||
| 78 | * time_offset variable which represents the current offset with | ||
| 79 | * respect to standard time. | ||
| 80 | * | ||
| 81 | * SHIFT_USEC defines the scaling (shift) of the time_freq and | 79 | * SHIFT_USEC defines the scaling (shift) of the time_freq and |
| 82 | * time_tolerance variables, which represent the current frequency | 80 | * time_tolerance variables, which represent the current frequency |
| 83 | * offset and maximum frequency tolerance. | 81 | * offset and maximum frequency tolerance. |
| 84 | */ | 82 | */ |
| 85 | #define SHIFT_UPDATE (SHIFT_HZ + 1) /* time offset scale (shift) */ | ||
| 86 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ | 83 | #define SHIFT_USEC 16 /* frequency offset scale (shift) */ |
| 87 | #define SHIFT_NSEC 12 /* kernel frequency offset scale */ | 84 | #define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) |
| 88 | 85 | #define PPM_SCALE_INV_SHIFT 20 | |
| 89 | #define MAXPHASE 512000L /* max phase error (us) */ | 86 | #define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ |
| 90 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ | 87 | PPM_SCALE + 1) |
| 91 | #define MAXFREQ_NSEC (512000L << SHIFT_NSEC) /* max frequency error (ppb) */ | 88 | |
| 89 | #define MAXPHASE 500000000l /* max phase error (ns) */ | ||
| 90 | #define MAXFREQ 500000 /* max frequency error (ns/s) */ | ||
| 91 | #define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) | ||
| 92 | #define MINSEC 256 /* min interval between updates (s) */ | 92 | #define MINSEC 256 /* min interval between updates (s) */ |
| 93 | #define MAXSEC 2048 /* max interval between updates (s) */ | 93 | #define MAXSEC 2048 /* max interval between updates (s) */ |
| 94 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ | 94 | #define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */ |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
| 97 | * syscall interface - used (mainly by NTP daemon) | 97 | * syscall interface - used (mainly by NTP daemon) |
| @@ -121,9 +121,11 @@ struct timex { | |||
| 121 | long errcnt; /* calibration errors (ro) */ | 121 | long errcnt; /* calibration errors (ro) */ |
| 122 | long stbcnt; /* stability limit exceeded (ro) */ | 122 | long stbcnt; /* stability limit exceeded (ro) */ |
| 123 | 123 | ||
| 124 | int tai; /* TAI offset (ro) */ | ||
| 125 | |||
| 124 | int :32; int :32; int :32; int :32; | 126 | int :32; int :32; int :32; int :32; |
| 125 | int :32; int :32; int :32; int :32; | 127 | int :32; int :32; int :32; int :32; |
| 126 | int :32; int :32; int :32; int :32; | 128 | int :32; int :32; int :32; |
| 127 | }; | 129 | }; |
| 128 | 130 | ||
| 129 | /* | 131 | /* |
| @@ -135,6 +137,9 @@ struct timex { | |||
| 135 | #define ADJ_ESTERROR 0x0008 /* estimated time error */ | 137 | #define ADJ_ESTERROR 0x0008 /* estimated time error */ |
| 136 | #define ADJ_STATUS 0x0010 /* clock status */ | 138 | #define ADJ_STATUS 0x0010 /* clock status */ |
| 137 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ | 139 | #define ADJ_TIMECONST 0x0020 /* pll time constant */ |
| 140 | #define ADJ_TAI 0x0080 /* set TAI offset */ | ||
| 141 | #define ADJ_MICRO 0x1000 /* select microsecond resolution */ | ||
| 142 | #define ADJ_NANO 0x2000 /* select nanosecond resolution */ | ||
| 138 | #define ADJ_TICK 0x4000 /* tick value */ | 143 | #define ADJ_TICK 0x4000 /* tick value */ |
| 139 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ | 144 | #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ |
| 140 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ | 145 | #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ |
| @@ -146,8 +151,6 @@ struct timex { | |||
| 146 | #define MOD_ESTERROR ADJ_ESTERROR | 151 | #define MOD_ESTERROR ADJ_ESTERROR |
| 147 | #define MOD_STATUS ADJ_STATUS | 152 | #define MOD_STATUS ADJ_STATUS |
| 148 | #define MOD_TIMECONST ADJ_TIMECONST | 153 | #define MOD_TIMECONST ADJ_TIMECONST |
| 149 | #define MOD_CLKB ADJ_TICK | ||
| 150 | #define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ | ||
| 151 | 154 | ||
| 152 | 155 | ||
| 153 | /* | 156 | /* |
| @@ -169,9 +172,13 @@ struct timex { | |||
| 169 | #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ | 172 | #define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ |
| 170 | 173 | ||
| 171 | #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ | 174 | #define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ |
| 175 | #define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ | ||
| 176 | #define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ | ||
| 177 | #define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ | ||
| 172 | 178 | ||
| 179 | /* read-only bits */ | ||
| 173 | #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ | 180 | #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ |
| 174 | STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ | 181 | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) |
| 175 | 182 | ||
| 176 | /* | 183 | /* |
| 177 | * Clock states (time_state) | 184 | * Clock states (time_state) |
| @@ -203,10 +210,9 @@ extern int time_status; /* clock synchronization status bits */ | |||
| 203 | extern long time_maxerror; /* maximum error */ | 210 | extern long time_maxerror; /* maximum error */ |
| 204 | extern long time_esterror; /* estimated error */ | 211 | extern long time_esterror; /* estimated error */ |
| 205 | 212 | ||
| 206 | extern long time_freq; /* frequency offset (scaled ppm) */ | ||
| 207 | |||
| 208 | extern long time_adjust; /* The amount of adjtime left */ | 213 | extern long time_adjust; /* The amount of adjtime left */ |
| 209 | 214 | ||
| 215 | extern void ntp_init(void); | ||
| 210 | extern void ntp_clear(void); | 216 | extern void ntp_clear(void); |
| 211 | 217 | ||
| 212 | /** | 218 | /** |
| @@ -225,7 +231,7 @@ static inline int ntp_synced(void) | |||
| 225 | __x < 0 ? -(-__x >> __s) : __x >> __s; \ | 231 | __x < 0 ? -(-__x >> __s) : __x >> __s; \ |
| 226 | }) | 232 | }) |
| 227 | 233 | ||
| 228 | #define TICK_LENGTH_SHIFT 32 | 234 | #define NTP_SCALE_SHIFT 32 |
| 229 | 235 | ||
| 230 | #ifdef CONFIG_NO_HZ | 236 | #ifdef CONFIG_NO_HZ |
| 231 | #define NTP_INTERVAL_FREQ (2) | 237 | #define NTP_INTERVAL_FREQ (2) |
| @@ -234,8 +240,8 @@ static inline int ntp_synced(void) | |||
| 234 | #endif | 240 | #endif |
| 235 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 241 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) |
| 236 | 242 | ||
| 237 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ | 243 | /* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ |
| 238 | extern u64 current_tick_length(void); | 244 | extern u64 tick_length; |
| 239 | 245 | ||
| 240 | extern void second_overflow(void); | 246 | extern void second_overflow(void); |
| 241 | extern void update_ntp_one_tick(void); | 247 | extern void update_ntp_one_tick(void); |
diff --git a/kernel/compat.c b/kernel/compat.c index 4a856a3643bb..32c254a8ab9a 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
| @@ -955,7 +955,8 @@ asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) | |||
| 955 | __put_user(txc.jitcnt, &utp->jitcnt) || | 955 | __put_user(txc.jitcnt, &utp->jitcnt) || |
| 956 | __put_user(txc.calcnt, &utp->calcnt) || | 956 | __put_user(txc.calcnt, &utp->calcnt) || |
| 957 | __put_user(txc.errcnt, &utp->errcnt) || | 957 | __put_user(txc.errcnt, &utp->errcnt) || |
| 958 | __put_user(txc.stbcnt, &utp->stbcnt)) | 958 | __put_user(txc.stbcnt, &utp->stbcnt) || |
| 959 | __put_user(txc.tai, &utp->tai)) | ||
| 959 | ret = -EFAULT; | 960 | ret = -EFAULT; |
| 960 | 961 | ||
| 961 | return ret; | 962 | return ret; |
diff --git a/kernel/kexec.c b/kernel/kexec.c index cb85c79989b4..1c5fcacbcf33 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -1217,7 +1217,7 @@ static int __init parse_crashkernel_mem(char *cmdline, | |||
| 1217 | } | 1217 | } |
| 1218 | 1218 | ||
| 1219 | /* match ? */ | 1219 | /* match ? */ |
| 1220 | if (system_ram >= start && system_ram <= end) { | 1220 | if (system_ram >= start && system_ram < end) { |
| 1221 | *crash_size = size; | 1221 | *crash_size = size; |
| 1222 | break; | 1222 | break; |
| 1223 | } | 1223 | } |
diff --git a/kernel/module.c b/kernel/module.c index 8d6cccc6c3cf..8674a390a2e8 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -164,131 +164,140 @@ static const struct kernel_symbol *lookup_symbol(const char *name, | |||
| 164 | return NULL; | 164 | return NULL; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static void printk_unused_warning(const char *name) | 167 | static bool always_ok(bool gplok, bool warn, const char *name) |
| 168 | { | 168 | { |
| 169 | printk(KERN_WARNING "Symbol %s is marked as UNUSED, " | 169 | return true; |
| 170 | "however this module is using it.\n", name); | ||
| 171 | printk(KERN_WARNING "This symbol will go away in the future.\n"); | ||
| 172 | printk(KERN_WARNING "Please evalute if this is the right api to use, " | ||
| 173 | "and if it really is, submit a report the linux kernel " | ||
| 174 | "mailinglist together with submitting your code for " | ||
| 175 | "inclusion.\n"); | ||
| 176 | } | 170 | } |
| 177 | 171 | ||
| 178 | /* Find a symbol, return value, crc and module which owns it */ | 172 | static bool printk_unused_warning(bool gplok, bool warn, const char *name) |
| 179 | static unsigned long __find_symbol(const char *name, | ||
| 180 | struct module **owner, | ||
| 181 | const unsigned long **crc, | ||
| 182 | int gplok) | ||
| 183 | { | 173 | { |
| 184 | struct module *mod; | 174 | if (warn) { |
| 185 | const struct kernel_symbol *ks; | 175 | printk(KERN_WARNING "Symbol %s is marked as UNUSED, " |
| 186 | 176 | "however this module is using it.\n", name); | |
| 187 | /* Core kernel first. */ | 177 | printk(KERN_WARNING |
| 188 | *owner = NULL; | 178 | "This symbol will go away in the future.\n"); |
| 189 | ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab); | 179 | printk(KERN_WARNING |
| 190 | if (ks) { | 180 | "Please evalute if this is the right api to use and if " |
| 191 | *crc = symversion(__start___kcrctab, (ks - __start___ksymtab)); | 181 | "it really is, submit a report the linux kernel " |
| 192 | return ks->value; | 182 | "mailinglist together with submitting your code for " |
| 183 | "inclusion.\n"); | ||
| 193 | } | 184 | } |
| 194 | if (gplok) { | 185 | return true; |
| 195 | ks = lookup_symbol(name, __start___ksymtab_gpl, | 186 | } |
| 196 | __stop___ksymtab_gpl); | 187 | |
| 197 | if (ks) { | 188 | static bool gpl_only_unused_warning(bool gplok, bool warn, const char *name) |
| 198 | *crc = symversion(__start___kcrctab_gpl, | 189 | { |
| 199 | (ks - __start___ksymtab_gpl)); | 190 | if (!gplok) |
| 200 | return ks->value; | 191 | return false; |
| 201 | } | 192 | return printk_unused_warning(gplok, warn, name); |
| 202 | } | 193 | } |
| 203 | ks = lookup_symbol(name, __start___ksymtab_gpl_future, | 194 | |
| 204 | __stop___ksymtab_gpl_future); | 195 | static bool gpl_only(bool gplok, bool warn, const char *name) |
| 205 | if (ks) { | 196 | { |
| 206 | if (!gplok) { | 197 | return gplok; |
| 207 | printk(KERN_WARNING "Symbol %s is being used " | 198 | } |
| 208 | "by a non-GPL module, which will not " | 199 | |
| 209 | "be allowed in the future\n", name); | 200 | static bool warn_if_not_gpl(bool gplok, bool warn, const char *name) |
| 210 | printk(KERN_WARNING "Please see the file " | 201 | { |
| 211 | "Documentation/feature-removal-schedule.txt " | 202 | if (!gplok && warn) { |
| 212 | "in the kernel source tree for more " | 203 | printk(KERN_WARNING "Symbol %s is being used " |
| 213 | "details.\n"); | 204 | "by a non-GPL module, which will not " |
| 214 | } | 205 | "be allowed in the future\n", name); |
| 215 | *crc = symversion(__start___kcrctab_gpl_future, | 206 | printk(KERN_WARNING "Please see the file " |
| 216 | (ks - __start___ksymtab_gpl_future)); | 207 | "Documentation/feature-removal-schedule.txt " |
| 217 | return ks->value; | 208 | "in the kernel source tree for more details.\n"); |
| 218 | } | 209 | } |
| 210 | return true; | ||
| 211 | } | ||
| 219 | 212 | ||
| 220 | ks = lookup_symbol(name, __start___ksymtab_unused, | 213 | struct symsearch { |
| 221 | __stop___ksymtab_unused); | 214 | const struct kernel_symbol *start, *stop; |
| 222 | if (ks) { | 215 | const unsigned long *crcs; |
| 223 | printk_unused_warning(name); | 216 | bool (*check)(bool gplok, bool warn, const char *name); |
| 224 | *crc = symversion(__start___kcrctab_unused, | 217 | }; |
| 225 | (ks - __start___ksymtab_unused)); | 218 | |
| 226 | return ks->value; | 219 | /* Look through this array of symbol tables for a symbol match which |
| 220 | * passes the check function. */ | ||
| 221 | static const struct kernel_symbol *search_symarrays(const struct symsearch *arr, | ||
| 222 | unsigned int num, | ||
| 223 | const char *name, | ||
| 224 | bool gplok, | ||
| 225 | bool warn, | ||
| 226 | const unsigned long **crc) | ||
| 227 | { | ||
| 228 | unsigned int i; | ||
| 229 | const struct kernel_symbol *ks; | ||
| 230 | |||
| 231 | for (i = 0; i < num; i++) { | ||
| 232 | ks = lookup_symbol(name, arr[i].start, arr[i].stop); | ||
| 233 | if (!ks || !arr[i].check(gplok, warn, name)) | ||
| 234 | continue; | ||
| 235 | |||
| 236 | if (crc) | ||
| 237 | *crc = symversion(arr[i].crcs, ks - arr[i].start); | ||
| 238 | return ks; | ||
| 227 | } | 239 | } |
| 240 | return NULL; | ||
| 241 | } | ||
| 242 | |||
| 243 | /* Find a symbol, return value, (optional) crc and (optional) module | ||
| 244 | * which owns it */ | ||
| 245 | static unsigned long find_symbol(const char *name, | ||
| 246 | struct module **owner, | ||
| 247 | const unsigned long **crc, | ||
| 248 | bool gplok, | ||
| 249 | bool warn) | ||
| 250 | { | ||
| 251 | struct module *mod; | ||
| 252 | const struct kernel_symbol *ks; | ||
| 253 | const struct symsearch arr[] = { | ||
| 254 | { __start___ksymtab, __stop___ksymtab, __start___kcrctab, | ||
| 255 | always_ok }, | ||
| 256 | { __start___ksymtab_gpl, __stop___ksymtab_gpl, | ||
| 257 | __start___kcrctab_gpl, gpl_only }, | ||
| 258 | { __start___ksymtab_gpl_future, __stop___ksymtab_gpl_future, | ||
| 259 | __start___kcrctab_gpl_future, warn_if_not_gpl }, | ||
| 260 | { __start___ksymtab_unused, __stop___ksymtab_unused, | ||
| 261 | __start___kcrctab_unused, printk_unused_warning }, | ||
| 262 | { __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl, | ||
| 263 | __start___kcrctab_unused_gpl, gpl_only_unused_warning }, | ||
| 264 | }; | ||
| 228 | 265 | ||
| 229 | if (gplok) | 266 | /* Core kernel first. */ |
| 230 | ks = lookup_symbol(name, __start___ksymtab_unused_gpl, | 267 | ks = search_symarrays(arr, ARRAY_SIZE(arr), name, gplok, warn, crc); |
| 231 | __stop___ksymtab_unused_gpl); | ||
| 232 | if (ks) { | 268 | if (ks) { |
| 233 | printk_unused_warning(name); | 269 | if (owner) |
| 234 | *crc = symversion(__start___kcrctab_unused_gpl, | 270 | *owner = NULL; |
| 235 | (ks - __start___ksymtab_unused_gpl)); | ||
| 236 | return ks->value; | 271 | return ks->value; |
| 237 | } | 272 | } |
| 238 | 273 | ||
| 239 | /* Now try modules. */ | 274 | /* Now try modules. */ |
| 240 | list_for_each_entry(mod, &modules, list) { | 275 | list_for_each_entry(mod, &modules, list) { |
| 241 | *owner = mod; | 276 | struct symsearch arr[] = { |
| 242 | ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms); | 277 | { mod->syms, mod->syms + mod->num_syms, mod->crcs, |
| 243 | if (ks) { | 278 | always_ok }, |
| 244 | *crc = symversion(mod->crcs, (ks - mod->syms)); | 279 | { mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms, |
| 245 | return ks->value; | 280 | mod->gpl_crcs, gpl_only }, |
| 246 | } | 281 | { mod->gpl_future_syms, |
| 247 | 282 | mod->gpl_future_syms + mod->num_gpl_future_syms, | |
| 248 | if (gplok) { | 283 | mod->gpl_future_crcs, warn_if_not_gpl }, |
| 249 | ks = lookup_symbol(name, mod->gpl_syms, | 284 | { mod->unused_syms, |
| 250 | mod->gpl_syms + mod->num_gpl_syms); | 285 | mod->unused_syms + mod->num_unused_syms, |
| 251 | if (ks) { | 286 | mod->unused_crcs, printk_unused_warning }, |
| 252 | *crc = symversion(mod->gpl_crcs, | 287 | { mod->unused_gpl_syms, |
| 253 | (ks - mod->gpl_syms)); | 288 | mod->unused_gpl_syms + mod->num_unused_gpl_syms, |
| 254 | return ks->value; | 289 | mod->unused_gpl_crcs, gpl_only_unused_warning }, |
| 255 | } | 290 | }; |
| 256 | } | 291 | |
| 257 | ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms); | 292 | ks = search_symarrays(arr, ARRAY_SIZE(arr), |
| 293 | name, gplok, warn, crc); | ||
| 258 | if (ks) { | 294 | if (ks) { |
| 259 | printk_unused_warning(name); | 295 | if (owner) |
| 260 | *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms)); | 296 | *owner = mod; |
| 261 | return ks->value; | ||
| 262 | } | ||
| 263 | |||
| 264 | if (gplok) { | ||
| 265 | ks = lookup_symbol(name, mod->unused_gpl_syms, | ||
| 266 | mod->unused_gpl_syms + mod->num_unused_gpl_syms); | ||
| 267 | if (ks) { | ||
| 268 | printk_unused_warning(name); | ||
| 269 | *crc = symversion(mod->unused_gpl_crcs, | ||
| 270 | (ks - mod->unused_gpl_syms)); | ||
| 271 | return ks->value; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | ks = lookup_symbol(name, mod->gpl_future_syms, | ||
| 275 | (mod->gpl_future_syms + | ||
| 276 | mod->num_gpl_future_syms)); | ||
| 277 | if (ks) { | ||
| 278 | if (!gplok) { | ||
| 279 | printk(KERN_WARNING "Symbol %s is being used " | ||
| 280 | "by a non-GPL module, which will not " | ||
| 281 | "be allowed in the future\n", name); | ||
| 282 | printk(KERN_WARNING "Please see the file " | ||
| 283 | "Documentation/feature-removal-schedule.txt " | ||
| 284 | "in the kernel source tree for more " | ||
| 285 | "details.\n"); | ||
| 286 | } | ||
| 287 | *crc = symversion(mod->gpl_future_crcs, | ||
| 288 | (ks - mod->gpl_future_syms)); | ||
| 289 | return ks->value; | 297 | return ks->value; |
| 290 | } | 298 | } |
| 291 | } | 299 | } |
| 300 | |||
| 292 | DEBUGP("Failed to find symbol %s\n", name); | 301 | DEBUGP("Failed to find symbol %s\n", name); |
| 293 | return -ENOENT; | 302 | return -ENOENT; |
| 294 | } | 303 | } |
| @@ -736,12 +745,13 @@ sys_delete_module(const char __user *name_user, unsigned int flags) | |||
| 736 | if (!forced && module_refcount(mod) != 0) | 745 | if (!forced && module_refcount(mod) != 0) |
| 737 | wait_for_zero_refcount(mod); | 746 | wait_for_zero_refcount(mod); |
| 738 | 747 | ||
| 748 | mutex_unlock(&module_mutex); | ||
| 739 | /* Final destruction now noone is using it. */ | 749 | /* Final destruction now noone is using it. */ |
| 740 | if (mod->exit != NULL) { | 750 | if (mod->exit != NULL) |
| 741 | mutex_unlock(&module_mutex); | ||
| 742 | mod->exit(); | 751 | mod->exit(); |
| 743 | mutex_lock(&module_mutex); | 752 | blocking_notifier_call_chain(&module_notify_list, |
| 744 | } | 753 | MODULE_STATE_GOING, mod); |
| 754 | mutex_lock(&module_mutex); | ||
| 745 | /* Store the name of the last unloaded module for diagnostic purposes */ | 755 | /* Store the name of the last unloaded module for diagnostic purposes */ |
| 746 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); | 756 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); |
| 747 | free_module(mod); | 757 | free_module(mod); |
| @@ -777,10 +787,9 @@ static void print_unload_info(struct seq_file *m, struct module *mod) | |||
| 777 | void __symbol_put(const char *symbol) | 787 | void __symbol_put(const char *symbol) |
| 778 | { | 788 | { |
| 779 | struct module *owner; | 789 | struct module *owner; |
| 780 | const unsigned long *crc; | ||
| 781 | 790 | ||
| 782 | preempt_disable(); | 791 | preempt_disable(); |
| 783 | if (IS_ERR_VALUE(__find_symbol(symbol, &owner, &crc, 1))) | 792 | if (IS_ERR_VALUE(find_symbol(symbol, &owner, NULL, true, false))) |
| 784 | BUG(); | 793 | BUG(); |
| 785 | module_put(owner); | 794 | module_put(owner); |
| 786 | preempt_enable(); | 795 | preempt_enable(); |
| @@ -924,13 +933,10 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs, | |||
| 924 | struct module *mod) | 933 | struct module *mod) |
| 925 | { | 934 | { |
| 926 | const unsigned long *crc; | 935 | const unsigned long *crc; |
| 927 | struct module *owner; | ||
| 928 | 936 | ||
| 929 | if (IS_ERR_VALUE(__find_symbol("struct_module", | 937 | if (IS_ERR_VALUE(find_symbol("struct_module", NULL, &crc, true, false))) |
| 930 | &owner, &crc, 1))) | ||
| 931 | BUG(); | 938 | BUG(); |
| 932 | return check_version(sechdrs, versindex, "struct_module", mod, | 939 | return check_version(sechdrs, versindex, "struct_module", mod, crc); |
| 933 | crc); | ||
| 934 | } | 940 | } |
| 935 | 941 | ||
| 936 | /* First part is kernel version, which we ignore. */ | 942 | /* First part is kernel version, which we ignore. */ |
| @@ -974,8 +980,8 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs, | |||
| 974 | unsigned long ret; | 980 | unsigned long ret; |
| 975 | const unsigned long *crc; | 981 | const unsigned long *crc; |
| 976 | 982 | ||
| 977 | ret = __find_symbol(name, &owner, &crc, | 983 | ret = find_symbol(name, &owner, &crc, |
| 978 | !(mod->taints & TAINT_PROPRIETARY_MODULE)); | 984 | !(mod->taints & TAINT_PROPRIETARY_MODULE), true); |
| 979 | if (!IS_ERR_VALUE(ret)) { | 985 | if (!IS_ERR_VALUE(ret)) { |
| 980 | /* use_module can fail due to OOM, | 986 | /* use_module can fail due to OOM, |
| 981 | or module initialization or unloading */ | 987 | or module initialization or unloading */ |
| @@ -991,6 +997,20 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs, | |||
| 991 | * J. Corbet <corbet@lwn.net> | 997 | * J. Corbet <corbet@lwn.net> |
| 992 | */ | 998 | */ |
| 993 | #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) | 999 | #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS) |
| 1000 | struct module_sect_attr | ||
| 1001 | { | ||
| 1002 | struct module_attribute mattr; | ||
| 1003 | char *name; | ||
| 1004 | unsigned long address; | ||
| 1005 | }; | ||
| 1006 | |||
| 1007 | struct module_sect_attrs | ||
| 1008 | { | ||
| 1009 | struct attribute_group grp; | ||
| 1010 | unsigned int nsections; | ||
| 1011 | struct module_sect_attr attrs[0]; | ||
| 1012 | }; | ||
| 1013 | |||
| 994 | static ssize_t module_sect_show(struct module_attribute *mattr, | 1014 | static ssize_t module_sect_show(struct module_attribute *mattr, |
| 995 | struct module *mod, char *buf) | 1015 | struct module *mod, char *buf) |
| 996 | { | 1016 | { |
| @@ -1001,7 +1021,7 @@ static ssize_t module_sect_show(struct module_attribute *mattr, | |||
| 1001 | 1021 | ||
| 1002 | static void free_sect_attrs(struct module_sect_attrs *sect_attrs) | 1022 | static void free_sect_attrs(struct module_sect_attrs *sect_attrs) |
| 1003 | { | 1023 | { |
| 1004 | int section; | 1024 | unsigned int section; |
| 1005 | 1025 | ||
| 1006 | for (section = 0; section < sect_attrs->nsections; section++) | 1026 | for (section = 0; section < sect_attrs->nsections; section++) |
| 1007 | kfree(sect_attrs->attrs[section].name); | 1027 | kfree(sect_attrs->attrs[section].name); |
| @@ -1362,10 +1382,9 @@ void *__symbol_get(const char *symbol) | |||
| 1362 | { | 1382 | { |
| 1363 | struct module *owner; | 1383 | struct module *owner; |
| 1364 | unsigned long value; | 1384 | unsigned long value; |
| 1365 | const unsigned long *crc; | ||
| 1366 | 1385 | ||
| 1367 | preempt_disable(); | 1386 | preempt_disable(); |
| 1368 | value = __find_symbol(symbol, &owner, &crc, 1); | 1387 | value = find_symbol(symbol, &owner, NULL, true, true); |
| 1369 | if (IS_ERR_VALUE(value)) | 1388 | if (IS_ERR_VALUE(value)) |
| 1370 | value = 0; | 1389 | value = 0; |
| 1371 | else if (strong_try_module_get(owner)) | 1390 | else if (strong_try_module_get(owner)) |
| @@ -1382,33 +1401,33 @@ EXPORT_SYMBOL_GPL(__symbol_get); | |||
| 1382 | */ | 1401 | */ |
| 1383 | static int verify_export_symbols(struct module *mod) | 1402 | static int verify_export_symbols(struct module *mod) |
| 1384 | { | 1403 | { |
| 1385 | const char *name = NULL; | 1404 | unsigned int i; |
| 1386 | unsigned long i, ret = 0; | ||
| 1387 | struct module *owner; | 1405 | struct module *owner; |
| 1388 | const unsigned long *crc; | 1406 | const struct kernel_symbol *s; |
| 1389 | 1407 | struct { | |
| 1390 | for (i = 0; i < mod->num_syms; i++) | 1408 | const struct kernel_symbol *sym; |
| 1391 | if (!IS_ERR_VALUE(__find_symbol(mod->syms[i].name, | 1409 | unsigned int num; |
| 1392 | &owner, &crc, 1))) { | 1410 | } arr[] = { |
| 1393 | name = mod->syms[i].name; | 1411 | { mod->syms, mod->num_syms }, |
| 1394 | ret = -ENOEXEC; | 1412 | { mod->gpl_syms, mod->num_gpl_syms }, |
| 1395 | goto dup; | 1413 | { mod->gpl_future_syms, mod->num_gpl_future_syms }, |
| 1396 | } | 1414 | { mod->unused_syms, mod->num_unused_syms }, |
| 1415 | { mod->unused_gpl_syms, mod->num_unused_gpl_syms }, | ||
| 1416 | }; | ||
| 1397 | 1417 | ||
| 1398 | for (i = 0; i < mod->num_gpl_syms; i++) | 1418 | for (i = 0; i < ARRAY_SIZE(arr); i++) { |
| 1399 | if (!IS_ERR_VALUE(__find_symbol(mod->gpl_syms[i].name, | 1419 | for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { |
| 1400 | &owner, &crc, 1))) { | 1420 | if (!IS_ERR_VALUE(find_symbol(s->name, &owner, |
| 1401 | name = mod->gpl_syms[i].name; | 1421 | NULL, true, false))) { |
| 1402 | ret = -ENOEXEC; | 1422 | printk(KERN_ERR |
| 1403 | goto dup; | 1423 | "%s: exports duplicate symbol %s" |
| 1424 | " (owned by %s)\n", | ||
| 1425 | mod->name, s->name, module_name(owner)); | ||
| 1426 | return -ENOEXEC; | ||
| 1427 | } | ||
| 1404 | } | 1428 | } |
| 1405 | 1429 | } | |
| 1406 | dup: | 1430 | return 0; |
| 1407 | if (ret) | ||
| 1408 | printk(KERN_ERR "%s: exports duplicate symbol %s (owned by %s)\n", | ||
| 1409 | mod->name, name, module_name(owner)); | ||
| 1410 | |||
| 1411 | return ret; | ||
| 1412 | } | 1431 | } |
| 1413 | 1432 | ||
| 1414 | /* Change all symbols so that st_value encodes the pointer directly. */ | 1433 | /* Change all symbols so that st_value encodes the pointer directly. */ |
| @@ -1814,8 +1833,9 @@ static struct module *load_module(void __user *umod, | |||
| 1814 | unwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME); | 1833 | unwindex = find_sec(hdr, sechdrs, secstrings, ARCH_UNWIND_SECTION_NAME); |
| 1815 | #endif | 1834 | #endif |
| 1816 | 1835 | ||
| 1817 | /* Don't keep modinfo section */ | 1836 | /* Don't keep modinfo and version sections. */ |
| 1818 | sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC; | 1837 | sechdrs[infoindex].sh_flags &= ~(unsigned long)SHF_ALLOC; |
| 1838 | sechdrs[versindex].sh_flags &= ~(unsigned long)SHF_ALLOC; | ||
| 1819 | #ifdef CONFIG_KALLSYMS | 1839 | #ifdef CONFIG_KALLSYMS |
| 1820 | /* Keep symbol and string tables for decoding later. */ | 1840 | /* Keep symbol and string tables for decoding later. */ |
| 1821 | sechdrs[symindex].sh_flags |= SHF_ALLOC; | 1841 | sechdrs[symindex].sh_flags |= SHF_ALLOC; |
| @@ -1977,7 +1997,8 @@ static struct module *load_module(void __user *umod, | |||
| 1977 | mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; | 1997 | mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr; |
| 1978 | mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr; | 1998 | mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr; |
| 1979 | if (unusedgplcrcindex) | 1999 | if (unusedgplcrcindex) |
| 1980 | mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; | 2000 | mod->unused_gpl_crcs |
| 2001 | = (void *)sechdrs[unusedgplcrcindex].sh_addr; | ||
| 1981 | 2002 | ||
| 1982 | #ifdef CONFIG_MODVERSIONS | 2003 | #ifdef CONFIG_MODVERSIONS |
| 1983 | if ((mod->num_syms && !crcindex) || | 2004 | if ((mod->num_syms && !crcindex) || |
| @@ -2171,6 +2192,8 @@ sys_init_module(void __user *umod, | |||
| 2171 | mod->state = MODULE_STATE_GOING; | 2192 | mod->state = MODULE_STATE_GOING; |
| 2172 | synchronize_sched(); | 2193 | synchronize_sched(); |
| 2173 | module_put(mod); | 2194 | module_put(mod); |
| 2195 | blocking_notifier_call_chain(&module_notify_list, | ||
| 2196 | MODULE_STATE_GOING, mod); | ||
| 2174 | mutex_lock(&module_mutex); | 2197 | mutex_lock(&module_mutex); |
| 2175 | free_module(mod); | 2198 | free_module(mod); |
| 2176 | mutex_unlock(&module_mutex); | 2199 | mutex_unlock(&module_mutex); |
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index ae5c6c147c4b..f1525ad06cb3 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
| @@ -4,8 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
| 6 | #include <linux/posix-timers.h> | 6 | #include <linux/posix-timers.h> |
| 7 | #include <asm/uaccess.h> | ||
| 8 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
| 8 | #include <linux/math64.h> | ||
| 9 | #include <asm/uaccess.h> | ||
| 9 | 10 | ||
| 10 | static int check_clock(const clockid_t which_clock) | 11 | static int check_clock(const clockid_t which_clock) |
| 11 | { | 12 | { |
| @@ -47,12 +48,10 @@ static void sample_to_timespec(const clockid_t which_clock, | |||
| 47 | union cpu_time_count cpu, | 48 | union cpu_time_count cpu, |
| 48 | struct timespec *tp) | 49 | struct timespec *tp) |
| 49 | { | 50 | { |
| 50 | if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) { | 51 | if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) |
| 51 | tp->tv_sec = div_long_long_rem(cpu.sched, | 52 | *tp = ns_to_timespec(cpu.sched); |
| 52 | NSEC_PER_SEC, &tp->tv_nsec); | 53 | else |
| 53 | } else { | ||
| 54 | cputime_to_timespec(cpu.cpu, tp); | 54 | cputime_to_timespec(cpu.cpu, tp); |
| 55 | } | ||
| 56 | } | 55 | } |
| 57 | 56 | ||
| 58 | static inline int cpu_time_before(const clockid_t which_clock, | 57 | static inline int cpu_time_before(const clockid_t which_clock, |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index dcc199c43a12..6c19e94fd0a5 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
| @@ -534,7 +534,6 @@ struct task_struct *ptrace_get_task_struct(pid_t pid) | |||
| 534 | #define arch_ptrace_attach(child) do { } while (0) | 534 | #define arch_ptrace_attach(child) do { } while (0) |
| 535 | #endif | 535 | #endif |
| 536 | 536 | ||
| 537 | #ifndef __ARCH_SYS_PTRACE | ||
| 538 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | 537 | asmlinkage long sys_ptrace(long request, long pid, long addr, long data) |
| 539 | { | 538 | { |
| 540 | struct task_struct *child; | 539 | struct task_struct *child; |
| @@ -582,7 +581,6 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data) | |||
| 582 | unlock_kernel(); | 581 | unlock_kernel(); |
| 583 | return ret; | 582 | return ret; |
| 584 | } | 583 | } |
| 585 | #endif /* __ARCH_SYS_PTRACE */ | ||
| 586 | 584 | ||
| 587 | int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data) | 585 | int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data) |
| 588 | { | 586 | { |
diff --git a/kernel/sched.c b/kernel/sched.c index e2f7f5acc807..34bcc5bc120e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -8025,7 +8025,7 @@ static void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, | |||
| 8025 | 8025 | ||
| 8026 | se->my_q = cfs_rq; | 8026 | se->my_q = cfs_rq; |
| 8027 | se->load.weight = tg->shares; | 8027 | se->load.weight = tg->shares; |
| 8028 | se->load.inv_weight = div64_64(1ULL<<32, se->load.weight); | 8028 | se->load.inv_weight = div64_u64(1ULL<<32, se->load.weight); |
| 8029 | se->parent = parent; | 8029 | se->parent = parent; |
| 8030 | } | 8030 | } |
| 8031 | #endif | 8031 | #endif |
| @@ -8692,7 +8692,7 @@ static void __set_se_shares(struct sched_entity *se, unsigned long shares) | |||
| 8692 | dequeue_entity(cfs_rq, se, 0); | 8692 | dequeue_entity(cfs_rq, se, 0); |
| 8693 | 8693 | ||
| 8694 | se->load.weight = shares; | 8694 | se->load.weight = shares; |
| 8695 | se->load.inv_weight = div64_64((1ULL<<32), shares); | 8695 | se->load.inv_weight = div64_u64((1ULL<<32), shares); |
| 8696 | 8696 | ||
| 8697 | if (on_rq) | 8697 | if (on_rq) |
| 8698 | enqueue_entity(cfs_rq, se, 0); | 8698 | enqueue_entity(cfs_rq, se, 0); |
| @@ -8787,7 +8787,7 @@ static unsigned long to_ratio(u64 period, u64 runtime) | |||
| 8787 | if (runtime == RUNTIME_INF) | 8787 | if (runtime == RUNTIME_INF) |
| 8788 | return 1ULL << 16; | 8788 | return 1ULL << 16; |
| 8789 | 8789 | ||
| 8790 | return div64_64(runtime << 16, period); | 8790 | return div64_u64(runtime << 16, period); |
| 8791 | } | 8791 | } |
| 8792 | 8792 | ||
| 8793 | #ifdef CONFIG_CGROUP_SCHED | 8793 | #ifdef CONFIG_CGROUP_SCHED |
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 8a9498e7c831..6b4a12558e88 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
| @@ -357,8 +357,8 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
| 357 | 357 | ||
| 358 | avg_per_cpu = p->se.sum_exec_runtime; | 358 | avg_per_cpu = p->se.sum_exec_runtime; |
| 359 | if (p->se.nr_migrations) { | 359 | if (p->se.nr_migrations) { |
| 360 | avg_per_cpu = div64_64(avg_per_cpu, | 360 | avg_per_cpu = div64_u64(avg_per_cpu, |
| 361 | p->se.nr_migrations); | 361 | p->se.nr_migrations); |
| 362 | } else { | 362 | } else { |
| 363 | avg_per_cpu = -1LL; | 363 | avg_per_cpu = -1LL; |
| 364 | } | 364 | } |
diff --git a/kernel/softirq.c b/kernel/softirq.c index 3c44956ee7e2..36e061740047 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
| @@ -589,16 +589,20 @@ static void takeover_tasklets(unsigned int cpu) | |||
| 589 | local_irq_disable(); | 589 | local_irq_disable(); |
| 590 | 590 | ||
| 591 | /* Find end, append list for that CPU. */ | 591 | /* Find end, append list for that CPU. */ |
| 592 | *__get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).head; | 592 | if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) { |
| 593 | __get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).tail; | 593 | *(__get_cpu_var(tasklet_vec).tail) = per_cpu(tasklet_vec, cpu).head; |
| 594 | per_cpu(tasklet_vec, cpu).head = NULL; | 594 | __get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).tail; |
| 595 | per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head; | 595 | per_cpu(tasklet_vec, cpu).head = NULL; |
| 596 | per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head; | ||
| 597 | } | ||
| 596 | raise_softirq_irqoff(TASKLET_SOFTIRQ); | 598 | raise_softirq_irqoff(TASKLET_SOFTIRQ); |
| 597 | 599 | ||
| 598 | *__get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).head; | 600 | if (&per_cpu(tasklet_hi_vec, cpu).head != per_cpu(tasklet_hi_vec, cpu).tail) { |
| 599 | __get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).tail; | 601 | *__get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).head; |
| 600 | per_cpu(tasklet_hi_vec, cpu).head = NULL; | 602 | __get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).tail; |
| 601 | per_cpu(tasklet_hi_vec, cpu).tail = &per_cpu(tasklet_hi_vec, cpu).head; | 603 | per_cpu(tasklet_hi_vec, cpu).head = NULL; |
| 604 | per_cpu(tasklet_hi_vec, cpu).tail = &per_cpu(tasklet_hi_vec, cpu).head; | ||
| 605 | } | ||
| 602 | raise_softirq_irqoff(HI_SOFTIRQ); | 606 | raise_softirq_irqoff(HI_SOFTIRQ); |
| 603 | 607 | ||
| 604 | local_irq_enable(); | 608 | local_irq_enable(); |
diff --git a/kernel/time.c b/kernel/time.c index 86729042e4cd..cbe0d5a222ff 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/security.h> | 36 | #include <linux/security.h> |
| 37 | #include <linux/fs.h> | 37 | #include <linux/fs.h> |
| 38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
| 39 | #include <linux/math64.h> | ||
| 39 | 40 | ||
| 40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
| 41 | #include <asm/unistd.h> | 42 | #include <asm/unistd.h> |
| @@ -391,13 +392,17 @@ EXPORT_SYMBOL(set_normalized_timespec); | |||
| 391 | struct timespec ns_to_timespec(const s64 nsec) | 392 | struct timespec ns_to_timespec(const s64 nsec) |
| 392 | { | 393 | { |
| 393 | struct timespec ts; | 394 | struct timespec ts; |
| 395 | s32 rem; | ||
| 394 | 396 | ||
| 395 | if (!nsec) | 397 | if (!nsec) |
| 396 | return (struct timespec) {0, 0}; | 398 | return (struct timespec) {0, 0}; |
| 397 | 399 | ||
| 398 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, &ts.tv_nsec); | 400 | ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); |
| 399 | if (unlikely(nsec < 0)) | 401 | if (unlikely(rem < 0)) { |
| 400 | set_normalized_timespec(&ts, ts.tv_sec, ts.tv_nsec); | 402 | ts.tv_sec--; |
| 403 | rem += NSEC_PER_SEC; | ||
| 404 | } | ||
| 405 | ts.tv_nsec = rem; | ||
| 401 | 406 | ||
| 402 | return ts; | 407 | return ts; |
| 403 | } | 408 | } |
| @@ -527,8 +532,10 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) | |||
| 527 | * Convert jiffies to nanoseconds and separate with | 532 | * Convert jiffies to nanoseconds and separate with |
| 528 | * one divide. | 533 | * one divide. |
| 529 | */ | 534 | */ |
| 530 | u64 nsec = (u64)jiffies * TICK_NSEC; | 535 | u32 rem; |
| 531 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_nsec); | 536 | value->tv_sec = div_u64_rem((u64)jiffies * TICK_NSEC, |
| 537 | NSEC_PER_SEC, &rem); | ||
| 538 | value->tv_nsec = rem; | ||
| 532 | } | 539 | } |
| 533 | EXPORT_SYMBOL(jiffies_to_timespec); | 540 | EXPORT_SYMBOL(jiffies_to_timespec); |
| 534 | 541 | ||
| @@ -566,12 +573,11 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | |||
| 566 | * Convert jiffies to nanoseconds and separate with | 573 | * Convert jiffies to nanoseconds and separate with |
| 567 | * one divide. | 574 | * one divide. |
| 568 | */ | 575 | */ |
| 569 | u64 nsec = (u64)jiffies * TICK_NSEC; | 576 | u32 rem; |
| 570 | long tv_usec; | ||
| 571 | 577 | ||
| 572 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec); | 578 | value->tv_sec = div_u64_rem((u64)jiffies * TICK_NSEC, |
| 573 | tv_usec /= NSEC_PER_USEC; | 579 | NSEC_PER_SEC, &rem); |
| 574 | value->tv_usec = tv_usec; | 580 | value->tv_usec = rem / NSEC_PER_USEC; |
| 575 | } | 581 | } |
| 576 | EXPORT_SYMBOL(jiffies_to_timeval); | 582 | EXPORT_SYMBOL(jiffies_to_timeval); |
| 577 | 583 | ||
| @@ -587,9 +593,7 @@ clock_t jiffies_to_clock_t(long x) | |||
| 587 | return x / (HZ / USER_HZ); | 593 | return x / (HZ / USER_HZ); |
| 588 | # endif | 594 | # endif |
| 589 | #else | 595 | #else |
| 590 | u64 tmp = (u64)x * TICK_NSEC; | 596 | return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ); |
| 591 | do_div(tmp, (NSEC_PER_SEC / USER_HZ)); | ||
| 592 | return (long)tmp; | ||
| 593 | #endif | 597 | #endif |
| 594 | } | 598 | } |
| 595 | EXPORT_SYMBOL(jiffies_to_clock_t); | 599 | EXPORT_SYMBOL(jiffies_to_clock_t); |
| @@ -601,16 +605,12 @@ unsigned long clock_t_to_jiffies(unsigned long x) | |||
| 601 | return ~0UL; | 605 | return ~0UL; |
| 602 | return x * (HZ / USER_HZ); | 606 | return x * (HZ / USER_HZ); |
| 603 | #else | 607 | #else |
| 604 | u64 jif; | ||
| 605 | |||
| 606 | /* Don't worry about loss of precision here .. */ | 608 | /* Don't worry about loss of precision here .. */ |
| 607 | if (x >= ~0UL / HZ * USER_HZ) | 609 | if (x >= ~0UL / HZ * USER_HZ) |
| 608 | return ~0UL; | 610 | return ~0UL; |
| 609 | 611 | ||
| 610 | /* .. but do try to contain it here */ | 612 | /* .. but do try to contain it here */ |
| 611 | jif = x * (u64) HZ; | 613 | return div_u64((u64)x * HZ, USER_HZ); |
| 612 | do_div(jif, USER_HZ); | ||
| 613 | return jif; | ||
| 614 | #endif | 614 | #endif |
| 615 | } | 615 | } |
| 616 | EXPORT_SYMBOL(clock_t_to_jiffies); | 616 | EXPORT_SYMBOL(clock_t_to_jiffies); |
| @@ -619,10 +619,9 @@ u64 jiffies_64_to_clock_t(u64 x) | |||
| 619 | { | 619 | { |
| 620 | #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0 | 620 | #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0 |
| 621 | # if HZ < USER_HZ | 621 | # if HZ < USER_HZ |
| 622 | x *= USER_HZ; | 622 | x = div_u64(x * USER_HZ, HZ); |
| 623 | do_div(x, HZ); | ||
| 624 | # elif HZ > USER_HZ | 623 | # elif HZ > USER_HZ |
| 625 | do_div(x, HZ / USER_HZ); | 624 | x = div_u64(x, HZ / USER_HZ); |
| 626 | # else | 625 | # else |
| 627 | /* Nothing to do */ | 626 | /* Nothing to do */ |
| 628 | # endif | 627 | # endif |
| @@ -632,8 +631,7 @@ u64 jiffies_64_to_clock_t(u64 x) | |||
| 632 | * but even this doesn't overflow in hundreds of years | 631 | * but even this doesn't overflow in hundreds of years |
| 633 | * in 64 bits, so.. | 632 | * in 64 bits, so.. |
| 634 | */ | 633 | */ |
| 635 | x *= TICK_NSEC; | 634 | x = div_u64(x * TICK_NSEC, (NSEC_PER_SEC / USER_HZ)); |
| 636 | do_div(x, (NSEC_PER_SEC / USER_HZ)); | ||
| 637 | #endif | 635 | #endif |
| 638 | return x; | 636 | return x; |
| 639 | } | 637 | } |
| @@ -642,21 +640,17 @@ EXPORT_SYMBOL(jiffies_64_to_clock_t); | |||
| 642 | u64 nsec_to_clock_t(u64 x) | 640 | u64 nsec_to_clock_t(u64 x) |
| 643 | { | 641 | { |
| 644 | #if (NSEC_PER_SEC % USER_HZ) == 0 | 642 | #if (NSEC_PER_SEC % USER_HZ) == 0 |
| 645 | do_div(x, (NSEC_PER_SEC / USER_HZ)); | 643 | return div_u64(x, NSEC_PER_SEC / USER_HZ); |
| 646 | #elif (USER_HZ % 512) == 0 | 644 | #elif (USER_HZ % 512) == 0 |
| 647 | x *= USER_HZ/512; | 645 | return div_u64(x * USER_HZ / 512, NSEC_PER_SEC / 512); |
| 648 | do_div(x, (NSEC_PER_SEC / 512)); | ||
| 649 | #else | 646 | #else |
| 650 | /* | 647 | /* |
| 651 | * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024, | 648 | * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024, |
| 652 | * overflow after 64.99 years. | 649 | * overflow after 64.99 years. |
| 653 | * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ... | 650 | * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ... |
| 654 | */ | 651 | */ |
| 655 | x *= 9; | 652 | return div_u64(x * 9, (9ull * NSEC_PER_SEC + (USER_HZ / 2)) / USER_HZ); |
| 656 | do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2)) / | ||
| 657 | USER_HZ)); | ||
| 658 | #endif | 653 | #endif |
| 659 | return x; | ||
| 660 | } | 654 | } |
| 661 | 655 | ||
| 662 | #if (BITS_PER_LONG < 64) | 656 | #if (BITS_PER_LONG < 64) |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 5fd9b9469770..5125ddd8196b 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
| @@ -15,7 +15,8 @@ | |||
| 15 | #include <linux/jiffies.h> | 15 | #include <linux/jiffies.h> |
| 16 | #include <linux/hrtimer.h> | 16 | #include <linux/hrtimer.h> |
| 17 | #include <linux/capability.h> | 17 | #include <linux/capability.h> |
| 18 | #include <asm/div64.h> | 18 | #include <linux/math64.h> |
| 19 | #include <linux/clocksource.h> | ||
| 19 | #include <asm/timex.h> | 20 | #include <asm/timex.h> |
| 20 | 21 | ||
| 21 | /* | 22 | /* |
| @@ -23,11 +24,14 @@ | |||
| 23 | */ | 24 | */ |
| 24 | unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */ | 25 | unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */ |
| 25 | unsigned long tick_nsec; /* ACTHZ period (nsec) */ | 26 | unsigned long tick_nsec; /* ACTHZ period (nsec) */ |
| 26 | static u64 tick_length, tick_length_base; | 27 | u64 tick_length; |
| 28 | static u64 tick_length_base; | ||
| 29 | |||
| 30 | static struct hrtimer leap_timer; | ||
| 27 | 31 | ||
| 28 | #define MAX_TICKADJ 500 /* microsecs */ | 32 | #define MAX_TICKADJ 500 /* microsecs */ |
| 29 | #define MAX_TICKADJ_SCALED (((u64)(MAX_TICKADJ * NSEC_PER_USEC) << \ | 33 | #define MAX_TICKADJ_SCALED (((u64)(MAX_TICKADJ * NSEC_PER_USEC) << \ |
| 30 | TICK_LENGTH_SHIFT) / NTP_INTERVAL_FREQ) | 34 | NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) |
| 31 | 35 | ||
| 32 | /* | 36 | /* |
| 33 | * phase-lock loop variables | 37 | * phase-lock loop variables |
| @@ -35,11 +39,12 @@ static u64 tick_length, tick_length_base; | |||
| 35 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 39 | /* TIME_ERROR prevents overwriting the CMOS clock */ |
| 36 | static int time_state = TIME_OK; /* clock synchronization status */ | 40 | static int time_state = TIME_OK; /* clock synchronization status */ |
| 37 | int time_status = STA_UNSYNC; /* clock status bits */ | 41 | int time_status = STA_UNSYNC; /* clock status bits */ |
| 38 | static s64 time_offset; /* time adjustment (ns) */ | 42 | static long time_tai; /* TAI offset (s) */ |
| 43 | static s64 time_offset; /* time adjustment (ns) */ | ||
| 39 | static long time_constant = 2; /* pll time constant */ | 44 | static long time_constant = 2; /* pll time constant */ |
| 40 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 45 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ |
| 41 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 46 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ |
| 42 | long time_freq; /* frequency offset (scaled ppm)*/ | 47 | static s64 time_freq; /* frequency offset (scaled ns/s)*/ |
| 43 | static long time_reftime; /* time at last adjustment (s) */ | 48 | static long time_reftime; /* time at last adjustment (s) */ |
| 44 | long time_adjust; | 49 | long time_adjust; |
| 45 | static long ntp_tick_adj; | 50 | static long ntp_tick_adj; |
| @@ -47,16 +52,56 @@ static long ntp_tick_adj; | |||
| 47 | static void ntp_update_frequency(void) | 52 | static void ntp_update_frequency(void) |
| 48 | { | 53 | { |
| 49 | u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) | 54 | u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) |
| 50 | << TICK_LENGTH_SHIFT; | 55 | << NTP_SCALE_SHIFT; |
| 51 | second_length += (s64)ntp_tick_adj << TICK_LENGTH_SHIFT; | 56 | second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; |
| 52 | second_length += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC); | 57 | second_length += time_freq; |
| 53 | 58 | ||
| 54 | tick_length_base = second_length; | 59 | tick_length_base = second_length; |
| 55 | 60 | ||
| 56 | do_div(second_length, HZ); | 61 | tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; |
| 57 | tick_nsec = second_length >> TICK_LENGTH_SHIFT; | 62 | tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ); |
| 63 | } | ||
| 64 | |||
| 65 | static void ntp_update_offset(long offset) | ||
| 66 | { | ||
| 67 | long mtemp; | ||
| 68 | s64 freq_adj; | ||
| 69 | |||
| 70 | if (!(time_status & STA_PLL)) | ||
| 71 | return; | ||
| 58 | 72 | ||
| 59 | do_div(tick_length_base, NTP_INTERVAL_FREQ); | 73 | if (!(time_status & STA_NANO)) |
| 74 | offset *= NSEC_PER_USEC; | ||
| 75 | |||
| 76 | /* | ||
| 77 | * Scale the phase adjustment and | ||
| 78 | * clamp to the operating range. | ||
| 79 | */ | ||
| 80 | offset = min(offset, MAXPHASE); | ||
| 81 | offset = max(offset, -MAXPHASE); | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Select how the frequency is to be controlled | ||
| 85 | * and in which mode (PLL or FLL). | ||
| 86 | */ | ||
| 87 | if (time_status & STA_FREQHOLD || time_reftime == 0) | ||
| 88 | time_reftime = xtime.tv_sec; | ||
| 89 | mtemp = xtime.tv_sec - time_reftime; | ||
| 90 | time_reftime = xtime.tv_sec; | ||
| 91 | |||
| 92 | freq_adj = (s64)offset * mtemp; | ||
| 93 | freq_adj <<= NTP_SCALE_SHIFT - 2 * (SHIFT_PLL + 2 + time_constant); | ||
| 94 | time_status &= ~STA_MODE; | ||
| 95 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { | ||
| 96 | freq_adj += div_s64((s64)offset << (NTP_SCALE_SHIFT - SHIFT_FLL), | ||
| 97 | mtemp); | ||
| 98 | time_status |= STA_MODE; | ||
| 99 | } | ||
| 100 | freq_adj += time_freq; | ||
| 101 | freq_adj = min(freq_adj, MAXFREQ_SCALED); | ||
| 102 | time_freq = max(freq_adj, -MAXFREQ_SCALED); | ||
| 103 | |||
| 104 | time_offset = div_s64((s64)offset << NTP_SCALE_SHIFT, NTP_INTERVAL_FREQ); | ||
| 60 | } | 105 | } |
| 61 | 106 | ||
| 62 | /** | 107 | /** |
| @@ -78,62 +123,70 @@ void ntp_clear(void) | |||
| 78 | } | 123 | } |
| 79 | 124 | ||
| 80 | /* | 125 | /* |
| 81 | * this routine handles the overflow of the microsecond field | 126 | * Leap second processing. If in leap-insert state at the end of the |
| 82 | * | 127 | * day, the system clock is set back one second; if in leap-delete |
| 83 | * The tricky bits of code to handle the accurate clock support | 128 | * state, the system clock is set ahead one second. |
| 84 | * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. | ||
| 85 | * They were originally developed for SUN and DEC kernels. | ||
| 86 | * All the kudos should go to Dave for this stuff. | ||
| 87 | */ | 129 | */ |
| 88 | void second_overflow(void) | 130 | static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) |
| 89 | { | 131 | { |
| 90 | long time_adj; | 132 | enum hrtimer_restart res = HRTIMER_NORESTART; |
| 91 | 133 | ||
| 92 | /* Bump the maxerror field */ | 134 | write_seqlock_irq(&xtime_lock); |
| 93 | time_maxerror += MAXFREQ >> SHIFT_USEC; | ||
| 94 | if (time_maxerror > NTP_PHASE_LIMIT) { | ||
| 95 | time_maxerror = NTP_PHASE_LIMIT; | ||
| 96 | time_status |= STA_UNSYNC; | ||
| 97 | } | ||
| 98 | 135 | ||
| 99 | /* | ||
| 100 | * Leap second processing. If in leap-insert state at the end of the | ||
| 101 | * day, the system clock is set back one second; if in leap-delete | ||
| 102 | * state, the system clock is set ahead one second. The microtime() | ||
| 103 | * routine or external clock driver will insure that reported time is | ||
| 104 | * always monotonic. The ugly divides should be replaced. | ||
| 105 | */ | ||
| 106 | switch (time_state) { | 136 | switch (time_state) { |
| 107 | case TIME_OK: | 137 | case TIME_OK: |
| 108 | if (time_status & STA_INS) | ||
| 109 | time_state = TIME_INS; | ||
| 110 | else if (time_status & STA_DEL) | ||
| 111 | time_state = TIME_DEL; | ||
| 112 | break; | 138 | break; |
| 113 | case TIME_INS: | 139 | case TIME_INS: |
| 114 | if (xtime.tv_sec % 86400 == 0) { | 140 | xtime.tv_sec--; |
| 115 | xtime.tv_sec--; | 141 | wall_to_monotonic.tv_sec++; |
| 116 | wall_to_monotonic.tv_sec++; | 142 | time_state = TIME_OOP; |
| 117 | time_state = TIME_OOP; | 143 | printk(KERN_NOTICE "Clock: " |
| 118 | printk(KERN_NOTICE "Clock: inserting leap second " | 144 | "inserting leap second 23:59:60 UTC\n"); |
| 119 | "23:59:60 UTC\n"); | 145 | leap_timer.expires = ktime_add_ns(leap_timer.expires, |
| 120 | } | 146 | NSEC_PER_SEC); |
| 147 | res = HRTIMER_RESTART; | ||
| 121 | break; | 148 | break; |
| 122 | case TIME_DEL: | 149 | case TIME_DEL: |
| 123 | if ((xtime.tv_sec + 1) % 86400 == 0) { | 150 | xtime.tv_sec++; |
| 124 | xtime.tv_sec++; | 151 | time_tai--; |
| 125 | wall_to_monotonic.tv_sec--; | 152 | wall_to_monotonic.tv_sec--; |
| 126 | time_state = TIME_WAIT; | 153 | time_state = TIME_WAIT; |
| 127 | printk(KERN_NOTICE "Clock: deleting leap second " | 154 | printk(KERN_NOTICE "Clock: " |
| 128 | "23:59:59 UTC\n"); | 155 | "deleting leap second 23:59:59 UTC\n"); |
| 129 | } | ||
| 130 | break; | 156 | break; |
| 131 | case TIME_OOP: | 157 | case TIME_OOP: |
| 158 | time_tai++; | ||
| 132 | time_state = TIME_WAIT; | 159 | time_state = TIME_WAIT; |
| 133 | break; | 160 | /* fall through */ |
| 134 | case TIME_WAIT: | 161 | case TIME_WAIT: |
| 135 | if (!(time_status & (STA_INS | STA_DEL))) | 162 | if (!(time_status & (STA_INS | STA_DEL))) |
| 136 | time_state = TIME_OK; | 163 | time_state = TIME_OK; |
| 164 | break; | ||
| 165 | } | ||
| 166 | update_vsyscall(&xtime, clock); | ||
| 167 | |||
| 168 | write_sequnlock_irq(&xtime_lock); | ||
| 169 | |||
| 170 | return res; | ||
| 171 | } | ||
| 172 | |||
| 173 | /* | ||
| 174 | * this routine handles the overflow of the microsecond field | ||
| 175 | * | ||
| 176 | * The tricky bits of code to handle the accurate clock support | ||
| 177 | * were provided by Dave Mills (Mills@UDEL.EDU) of NTP fame. | ||
| 178 | * They were originally developed for SUN and DEC kernels. | ||
| 179 | * All the kudos should go to Dave for this stuff. | ||
| 180 | */ | ||
| 181 | void second_overflow(void) | ||
| 182 | { | ||
| 183 | s64 time_adj; | ||
| 184 | |||
| 185 | /* Bump the maxerror field */ | ||
| 186 | time_maxerror += MAXFREQ / NSEC_PER_USEC; | ||
| 187 | if (time_maxerror > NTP_PHASE_LIMIT) { | ||
| 188 | time_maxerror = NTP_PHASE_LIMIT; | ||
| 189 | time_status |= STA_UNSYNC; | ||
| 137 | } | 190 | } |
| 138 | 191 | ||
| 139 | /* | 192 | /* |
| @@ -143,7 +196,7 @@ void second_overflow(void) | |||
| 143 | tick_length = tick_length_base; | 196 | tick_length = tick_length_base; |
| 144 | time_adj = shift_right(time_offset, SHIFT_PLL + time_constant); | 197 | time_adj = shift_right(time_offset, SHIFT_PLL + time_constant); |
| 145 | time_offset -= time_adj; | 198 | time_offset -= time_adj; |
| 146 | tick_length += (s64)time_adj << (TICK_LENGTH_SHIFT - SHIFT_UPDATE); | 199 | tick_length += time_adj; |
| 147 | 200 | ||
| 148 | if (unlikely(time_adjust)) { | 201 | if (unlikely(time_adjust)) { |
| 149 | if (time_adjust > MAX_TICKADJ) { | 202 | if (time_adjust > MAX_TICKADJ) { |
| @@ -154,25 +207,12 @@ void second_overflow(void) | |||
| 154 | tick_length -= MAX_TICKADJ_SCALED; | 207 | tick_length -= MAX_TICKADJ_SCALED; |
| 155 | } else { | 208 | } else { |
| 156 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / | 209 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / |
| 157 | NTP_INTERVAL_FREQ) << TICK_LENGTH_SHIFT; | 210 | NTP_INTERVAL_FREQ) << NTP_SCALE_SHIFT; |
| 158 | time_adjust = 0; | 211 | time_adjust = 0; |
| 159 | } | 212 | } |
| 160 | } | 213 | } |
| 161 | } | 214 | } |
| 162 | 215 | ||
| 163 | /* | ||
| 164 | * Return how long ticks are at the moment, that is, how much time | ||
| 165 | * update_wall_time_one_tick will add to xtime next time we call it | ||
| 166 | * (assuming no calls to do_adjtimex in the meantime). | ||
| 167 | * The return value is in fixed-point nanoseconds shifted by the | ||
| 168 | * specified number of bits to the right of the binary point. | ||
| 169 | * This function has no side-effects. | ||
| 170 | */ | ||
| 171 | u64 current_tick_length(void) | ||
| 172 | { | ||
| 173 | return tick_length; | ||
| 174 | } | ||
| 175 | |||
| 176 | #ifdef CONFIG_GENERIC_CMOS_UPDATE | 216 | #ifdef CONFIG_GENERIC_CMOS_UPDATE |
| 177 | 217 | ||
| 178 | /* Disable the cmos update - used by virtualization and embedded */ | 218 | /* Disable the cmos update - used by virtualization and embedded */ |
| @@ -236,8 +276,8 @@ static inline void notify_cmos_timer(void) { } | |||
| 236 | */ | 276 | */ |
| 237 | int do_adjtimex(struct timex *txc) | 277 | int do_adjtimex(struct timex *txc) |
| 238 | { | 278 | { |
| 239 | long mtemp, save_adjust, rem; | 279 | struct timespec ts; |
| 240 | s64 freq_adj, temp64; | 280 | long save_adjust, sec; |
| 241 | int result; | 281 | int result; |
| 242 | 282 | ||
| 243 | /* In order to modify anything, you gotta be super-user! */ | 283 | /* In order to modify anything, you gotta be super-user! */ |
| @@ -247,147 +287,132 @@ int do_adjtimex(struct timex *txc) | |||
| 247 | /* Now we validate the data before disabling interrupts */ | 287 | /* Now we validate the data before disabling interrupts */ |
| 248 | 288 | ||
| 249 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) { | 289 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) { |
| 250 | /* singleshot must not be used with any other mode bits */ | 290 | /* singleshot must not be used with any other mode bits */ |
| 251 | if (txc->modes != ADJ_OFFSET_SINGLESHOT && | 291 | if (txc->modes & ~ADJ_OFFSET_SS_READ) |
| 252 | txc->modes != ADJ_OFFSET_SS_READ) | ||
| 253 | return -EINVAL; | 292 | return -EINVAL; |
| 254 | } | 293 | } |
| 255 | 294 | ||
| 256 | if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET)) | ||
| 257 | /* adjustment Offset limited to +- .512 seconds */ | ||
| 258 | if (txc->offset <= - MAXPHASE || txc->offset >= MAXPHASE ) | ||
| 259 | return -EINVAL; | ||
| 260 | |||
| 261 | /* if the quartz is off by more than 10% something is VERY wrong ! */ | 295 | /* if the quartz is off by more than 10% something is VERY wrong ! */ |
| 262 | if (txc->modes & ADJ_TICK) | 296 | if (txc->modes & ADJ_TICK) |
| 263 | if (txc->tick < 900000/USER_HZ || | 297 | if (txc->tick < 900000/USER_HZ || |
| 264 | txc->tick > 1100000/USER_HZ) | 298 | txc->tick > 1100000/USER_HZ) |
| 265 | return -EINVAL; | 299 | return -EINVAL; |
| 266 | 300 | ||
| 301 | if (time_state != TIME_OK && txc->modes & ADJ_STATUS) | ||
| 302 | hrtimer_cancel(&leap_timer); | ||
| 303 | getnstimeofday(&ts); | ||
| 304 | |||
| 267 | write_seqlock_irq(&xtime_lock); | 305 | write_seqlock_irq(&xtime_lock); |
| 268 | result = time_state; /* mostly `TIME_OK' */ | ||
| 269 | 306 | ||
| 270 | /* Save for later - semantics of adjtime is to return old value */ | 307 | /* Save for later - semantics of adjtime is to return old value */ |
| 271 | save_adjust = time_adjust; | 308 | save_adjust = time_adjust; |
| 272 | 309 | ||
| 273 | #if 0 /* STA_CLOCKERR is never set yet */ | ||
| 274 | time_status &= ~STA_CLOCKERR; /* reset STA_CLOCKERR */ | ||
| 275 | #endif | ||
| 276 | /* If there are input parameters, then process them */ | 310 | /* If there are input parameters, then process them */ |
| 277 | if (txc->modes) | 311 | if (txc->modes) { |
| 278 | { | 312 | if (txc->modes & ADJ_STATUS) { |
| 279 | if (txc->modes & ADJ_STATUS) /* only set allowed bits */ | 313 | if ((time_status & STA_PLL) && |
| 280 | time_status = (txc->status & ~STA_RONLY) | | 314 | !(txc->status & STA_PLL)) { |
| 281 | (time_status & STA_RONLY); | 315 | time_state = TIME_OK; |
| 282 | 316 | time_status = STA_UNSYNC; | |
| 283 | if (txc->modes & ADJ_FREQUENCY) { /* p. 22 */ | 317 | } |
| 284 | if (txc->freq > MAXFREQ || txc->freq < -MAXFREQ) { | 318 | /* only set allowed bits */ |
| 285 | result = -EINVAL; | 319 | time_status &= STA_RONLY; |
| 286 | goto leave; | 320 | time_status |= txc->status & ~STA_RONLY; |
| 287 | } | 321 | |
| 288 | time_freq = ((s64)txc->freq * NSEC_PER_USEC) | 322 | switch (time_state) { |
| 289 | >> (SHIFT_USEC - SHIFT_NSEC); | 323 | case TIME_OK: |
| 290 | } | 324 | start_timer: |
| 291 | 325 | sec = ts.tv_sec; | |
| 292 | if (txc->modes & ADJ_MAXERROR) { | 326 | if (time_status & STA_INS) { |
| 293 | if (txc->maxerror < 0 || txc->maxerror >= NTP_PHASE_LIMIT) { | 327 | time_state = TIME_INS; |
| 294 | result = -EINVAL; | 328 | sec += 86400 - sec % 86400; |
| 295 | goto leave; | 329 | hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS); |
| 330 | } else if (time_status & STA_DEL) { | ||
| 331 | time_state = TIME_DEL; | ||
| 332 | sec += 86400 - (sec + 1) % 86400; | ||
| 333 | hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS); | ||
| 334 | } | ||
| 335 | break; | ||
| 336 | case TIME_INS: | ||
| 337 | case TIME_DEL: | ||
| 338 | time_state = TIME_OK; | ||
| 339 | goto start_timer; | ||
| 340 | break; | ||
| 341 | case TIME_WAIT: | ||
| 342 | if (!(time_status & (STA_INS | STA_DEL))) | ||
| 343 | time_state = TIME_OK; | ||
| 344 | break; | ||
| 345 | case TIME_OOP: | ||
| 346 | hrtimer_restart(&leap_timer); | ||
| 347 | break; | ||
| 348 | } | ||
| 296 | } | 349 | } |
| 297 | time_maxerror = txc->maxerror; | ||
| 298 | } | ||
| 299 | 350 | ||
| 300 | if (txc->modes & ADJ_ESTERROR) { | 351 | if (txc->modes & ADJ_NANO) |
| 301 | if (txc->esterror < 0 || txc->esterror >= NTP_PHASE_LIMIT) { | 352 | time_status |= STA_NANO; |
| 302 | result = -EINVAL; | 353 | if (txc->modes & ADJ_MICRO) |
| 303 | goto leave; | 354 | time_status &= ~STA_NANO; |
| 355 | |||
| 356 | if (txc->modes & ADJ_FREQUENCY) { | ||
| 357 | time_freq = (s64)txc->freq * PPM_SCALE; | ||
| 358 | time_freq = min(time_freq, MAXFREQ_SCALED); | ||
| 359 | time_freq = max(time_freq, -MAXFREQ_SCALED); | ||
| 304 | } | 360 | } |
| 305 | time_esterror = txc->esterror; | ||
| 306 | } | ||
| 307 | 361 | ||
| 308 | if (txc->modes & ADJ_TIMECONST) { /* p. 24 */ | 362 | if (txc->modes & ADJ_MAXERROR) |
| 309 | if (txc->constant < 0) { /* NTP v4 uses values > 6 */ | 363 | time_maxerror = txc->maxerror; |
| 310 | result = -EINVAL; | 364 | if (txc->modes & ADJ_ESTERROR) |
| 311 | goto leave; | 365 | time_esterror = txc->esterror; |
| 366 | |||
| 367 | if (txc->modes & ADJ_TIMECONST) { | ||
| 368 | time_constant = txc->constant; | ||
| 369 | if (!(time_status & STA_NANO)) | ||
| 370 | time_constant += 4; | ||
| 371 | time_constant = min(time_constant, (long)MAXTC); | ||
| 372 | time_constant = max(time_constant, 0l); | ||
| 312 | } | 373 | } |
| 313 | time_constant = min(txc->constant + 4, (long)MAXTC); | ||
| 314 | } | ||
| 315 | 374 | ||
| 316 | if (txc->modes & ADJ_OFFSET) { /* values checked earlier */ | 375 | if (txc->modes & ADJ_TAI && txc->constant > 0) |
| 317 | if (txc->modes == ADJ_OFFSET_SINGLESHOT) { | 376 | time_tai = txc->constant; |
| 318 | /* adjtime() is independent from ntp_adjtime() */ | 377 | |
| 319 | time_adjust = txc->offset; | 378 | if (txc->modes & ADJ_OFFSET) { |
| 379 | if (txc->modes == ADJ_OFFSET_SINGLESHOT) | ||
| 380 | /* adjtime() is independent from ntp_adjtime() */ | ||
| 381 | time_adjust = txc->offset; | ||
| 382 | else | ||
| 383 | ntp_update_offset(txc->offset); | ||
| 320 | } | 384 | } |
| 321 | else if (time_status & STA_PLL) { | 385 | if (txc->modes & ADJ_TICK) |
| 322 | time_offset = txc->offset * NSEC_PER_USEC; | 386 | tick_usec = txc->tick; |
| 323 | 387 | ||
| 324 | /* | 388 | if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET)) |
| 325 | * Scale the phase adjustment and | 389 | ntp_update_frequency(); |
| 326 | * clamp to the operating range. | 390 | } |
| 327 | */ | 391 | |
| 328 | time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC); | 392 | result = time_state; /* mostly `TIME_OK' */ |
| 329 | time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC); | 393 | if (time_status & (STA_UNSYNC|STA_CLOCKERR)) |
| 330 | |||
| 331 | /* | ||
| 332 | * Select whether the frequency is to be controlled | ||
| 333 | * and in which mode (PLL or FLL). Clamp to the operating | ||
| 334 | * range. Ugly multiply/divide should be replaced someday. | ||
| 335 | */ | ||
| 336 | |||
| 337 | if (time_status & STA_FREQHOLD || time_reftime == 0) | ||
| 338 | time_reftime = xtime.tv_sec; | ||
| 339 | mtemp = xtime.tv_sec - time_reftime; | ||
| 340 | time_reftime = xtime.tv_sec; | ||
| 341 | |||
| 342 | freq_adj = time_offset * mtemp; | ||
| 343 | freq_adj = shift_right(freq_adj, time_constant * 2 + | ||
| 344 | (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); | ||
| 345 | if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { | ||
| 346 | u64 utemp64; | ||
| 347 | temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL); | ||
| 348 | if (time_offset < 0) { | ||
| 349 | utemp64 = -temp64; | ||
| 350 | do_div(utemp64, mtemp); | ||
| 351 | freq_adj -= utemp64; | ||
| 352 | } else { | ||
| 353 | utemp64 = temp64; | ||
| 354 | do_div(utemp64, mtemp); | ||
| 355 | freq_adj += utemp64; | ||
| 356 | } | ||
| 357 | } | ||
| 358 | freq_adj += time_freq; | ||
| 359 | freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); | ||
| 360 | time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); | ||
| 361 | time_offset = div_long_long_rem_signed(time_offset, | ||
| 362 | NTP_INTERVAL_FREQ, | ||
| 363 | &rem); | ||
| 364 | time_offset <<= SHIFT_UPDATE; | ||
| 365 | } /* STA_PLL */ | ||
| 366 | } /* txc->modes & ADJ_OFFSET */ | ||
| 367 | if (txc->modes & ADJ_TICK) | ||
| 368 | tick_usec = txc->tick; | ||
| 369 | |||
| 370 | if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET)) | ||
| 371 | ntp_update_frequency(); | ||
| 372 | } /* txc->modes */ | ||
| 373 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | ||
| 374 | result = TIME_ERROR; | 394 | result = TIME_ERROR; |
| 375 | 395 | ||
| 376 | if ((txc->modes == ADJ_OFFSET_SINGLESHOT) || | 396 | if ((txc->modes == ADJ_OFFSET_SINGLESHOT) || |
| 377 | (txc->modes == ADJ_OFFSET_SS_READ)) | 397 | (txc->modes == ADJ_OFFSET_SS_READ)) |
| 378 | txc->offset = save_adjust; | 398 | txc->offset = save_adjust; |
| 379 | else | 399 | else { |
| 380 | txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) * | 400 | txc->offset = shift_right(time_offset * NTP_INTERVAL_FREQ, |
| 381 | NTP_INTERVAL_FREQ / 1000; | 401 | NTP_SCALE_SHIFT); |
| 382 | txc->freq = (time_freq / NSEC_PER_USEC) << | 402 | if (!(time_status & STA_NANO)) |
| 383 | (SHIFT_USEC - SHIFT_NSEC); | 403 | txc->offset /= NSEC_PER_USEC; |
| 404 | } | ||
| 405 | txc->freq = shift_right((s32)(time_freq >> PPM_SCALE_INV_SHIFT) * | ||
| 406 | (s64)PPM_SCALE_INV, | ||
| 407 | NTP_SCALE_SHIFT); | ||
| 384 | txc->maxerror = time_maxerror; | 408 | txc->maxerror = time_maxerror; |
| 385 | txc->esterror = time_esterror; | 409 | txc->esterror = time_esterror; |
| 386 | txc->status = time_status; | 410 | txc->status = time_status; |
| 387 | txc->constant = time_constant; | 411 | txc->constant = time_constant; |
| 388 | txc->precision = 1; | 412 | txc->precision = 1; |
| 389 | txc->tolerance = MAXFREQ; | 413 | txc->tolerance = MAXFREQ_SCALED / PPM_SCALE; |
| 390 | txc->tick = tick_usec; | 414 | txc->tick = tick_usec; |
| 415 | txc->tai = time_tai; | ||
| 391 | 416 | ||
| 392 | /* PPS is not implemented, so these are zero */ | 417 | /* PPS is not implemented, so these are zero */ |
| 393 | txc->ppsfreq = 0; | 418 | txc->ppsfreq = 0; |
| @@ -399,9 +424,15 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | |||
| 399 | txc->errcnt = 0; | 424 | txc->errcnt = 0; |
| 400 | txc->stbcnt = 0; | 425 | txc->stbcnt = 0; |
| 401 | write_sequnlock_irq(&xtime_lock); | 426 | write_sequnlock_irq(&xtime_lock); |
| 402 | do_gettimeofday(&txc->time); | 427 | |
| 428 | txc->time.tv_sec = ts.tv_sec; | ||
| 429 | txc->time.tv_usec = ts.tv_nsec; | ||
| 430 | if (!(time_status & STA_NANO)) | ||
| 431 | txc->time.tv_usec /= NSEC_PER_USEC; | ||
| 432 | |||
| 403 | notify_cmos_timer(); | 433 | notify_cmos_timer(); |
| 404 | return(result); | 434 | |
| 435 | return result; | ||
| 405 | } | 436 | } |
| 406 | 437 | ||
| 407 | static int __init ntp_tick_adj_setup(char *str) | 438 | static int __init ntp_tick_adj_setup(char *str) |
| @@ -411,3 +442,10 @@ static int __init ntp_tick_adj_setup(char *str) | |||
| 411 | } | 442 | } |
| 412 | 443 | ||
| 413 | __setup("ntp_tick_adj=", ntp_tick_adj_setup); | 444 | __setup("ntp_tick_adj=", ntp_tick_adj_setup); |
| 445 | |||
| 446 | void __init ntp_init(void) | ||
| 447 | { | ||
| 448 | ntp_clear(); | ||
| 449 | hrtimer_init(&leap_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); | ||
| 450 | leap_timer.function = ntp_leap_second; | ||
| 451 | } | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 2d6087c7cf98..e91c29f961c9 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -53,7 +53,7 @@ void update_xtime_cache(u64 nsec) | |||
| 53 | timespec_add_ns(&xtime_cache, nsec); | 53 | timespec_add_ns(&xtime_cache, nsec); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static struct clocksource *clock; /* pointer to current clocksource */ | 56 | struct clocksource *clock; |
| 57 | 57 | ||
| 58 | 58 | ||
| 59 | #ifdef CONFIG_GENERIC_TIME | 59 | #ifdef CONFIG_GENERIC_TIME |
| @@ -246,7 +246,7 @@ void __init timekeeping_init(void) | |||
| 246 | 246 | ||
| 247 | write_seqlock_irqsave(&xtime_lock, flags); | 247 | write_seqlock_irqsave(&xtime_lock, flags); |
| 248 | 248 | ||
| 249 | ntp_clear(); | 249 | ntp_init(); |
| 250 | 250 | ||
| 251 | clock = clocksource_get_next(); | 251 | clock = clocksource_get_next(); |
| 252 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); | 252 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); |
| @@ -371,7 +371,7 @@ static __always_inline int clocksource_bigadjust(s64 error, s64 *interval, | |||
| 371 | * here. This is tuned so that an error of about 1 msec is adjusted | 371 | * here. This is tuned so that an error of about 1 msec is adjusted |
| 372 | * within about 1 sec (or 2^20 nsec in 2^SHIFT_HZ ticks). | 372 | * within about 1 sec (or 2^20 nsec in 2^SHIFT_HZ ticks). |
| 373 | */ | 373 | */ |
| 374 | error2 = clock->error >> (TICK_LENGTH_SHIFT + 22 - 2 * SHIFT_HZ); | 374 | error2 = clock->error >> (NTP_SCALE_SHIFT + 22 - 2 * SHIFT_HZ); |
| 375 | error2 = abs(error2); | 375 | error2 = abs(error2); |
| 376 | for (look_ahead = 0; error2 > 0; look_ahead++) | 376 | for (look_ahead = 0; error2 > 0; look_ahead++) |
| 377 | error2 >>= 2; | 377 | error2 >>= 2; |
| @@ -380,8 +380,7 @@ static __always_inline int clocksource_bigadjust(s64 error, s64 *interval, | |||
| 380 | * Now calculate the error in (1 << look_ahead) ticks, but first | 380 | * Now calculate the error in (1 << look_ahead) ticks, but first |
| 381 | * remove the single look ahead already included in the error. | 381 | * remove the single look ahead already included in the error. |
| 382 | */ | 382 | */ |
| 383 | tick_error = current_tick_length() >> | 383 | tick_error = tick_length >> (NTP_SCALE_SHIFT - clock->shift + 1); |
| 384 | (TICK_LENGTH_SHIFT - clock->shift + 1); | ||
| 385 | tick_error -= clock->xtime_interval >> 1; | 384 | tick_error -= clock->xtime_interval >> 1; |
| 386 | error = ((error - tick_error) >> look_ahead) + tick_error; | 385 | error = ((error - tick_error) >> look_ahead) + tick_error; |
| 387 | 386 | ||
| @@ -412,7 +411,7 @@ static void clocksource_adjust(s64 offset) | |||
| 412 | s64 error, interval = clock->cycle_interval; | 411 | s64 error, interval = clock->cycle_interval; |
| 413 | int adj; | 412 | int adj; |
| 414 | 413 | ||
| 415 | error = clock->error >> (TICK_LENGTH_SHIFT - clock->shift - 1); | 414 | error = clock->error >> (NTP_SCALE_SHIFT - clock->shift - 1); |
| 416 | if (error > interval) { | 415 | if (error > interval) { |
| 417 | error >>= 2; | 416 | error >>= 2; |
| 418 | if (likely(error <= interval)) | 417 | if (likely(error <= interval)) |
| @@ -434,7 +433,7 @@ static void clocksource_adjust(s64 offset) | |||
| 434 | clock->xtime_interval += interval; | 433 | clock->xtime_interval += interval; |
| 435 | clock->xtime_nsec -= offset; | 434 | clock->xtime_nsec -= offset; |
| 436 | clock->error -= (interval - offset) << | 435 | clock->error -= (interval - offset) << |
| 437 | (TICK_LENGTH_SHIFT - clock->shift); | 436 | (NTP_SCALE_SHIFT - clock->shift); |
| 438 | } | 437 | } |
| 439 | 438 | ||
| 440 | /** | 439 | /** |
| @@ -473,8 +472,8 @@ void update_wall_time(void) | |||
| 473 | } | 472 | } |
| 474 | 473 | ||
| 475 | /* accumulate error between NTP and clock interval */ | 474 | /* accumulate error between NTP and clock interval */ |
| 476 | clock->error += current_tick_length(); | 475 | clock->error += tick_length; |
| 477 | clock->error -= clock->xtime_interval << (TICK_LENGTH_SHIFT - clock->shift); | 476 | clock->error -= clock->xtime_interval << (NTP_SCALE_SHIFT - clock->shift); |
| 478 | } | 477 | } |
| 479 | 478 | ||
| 480 | /* correct the clock when NTP error is too big */ | 479 | /* correct the clock when NTP error is too big */ |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 721093a22561..29fc39f1029c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -195,7 +195,6 @@ static void delayed_work_timer_fn(unsigned long __data) | |||
| 195 | int queue_delayed_work(struct workqueue_struct *wq, | 195 | int queue_delayed_work(struct workqueue_struct *wq, |
| 196 | struct delayed_work *dwork, unsigned long delay) | 196 | struct delayed_work *dwork, unsigned long delay) |
| 197 | { | 197 | { |
| 198 | timer_stats_timer_set_start_info(&dwork->timer); | ||
| 199 | if (delay == 0) | 198 | if (delay == 0) |
| 200 | return queue_work(wq, &dwork->work); | 199 | return queue_work(wq, &dwork->work); |
| 201 | 200 | ||
| @@ -219,11 +218,12 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
| 219 | struct timer_list *timer = &dwork->timer; | 218 | struct timer_list *timer = &dwork->timer; |
| 220 | struct work_struct *work = &dwork->work; | 219 | struct work_struct *work = &dwork->work; |
| 221 | 220 | ||
| 222 | timer_stats_timer_set_start_info(&dwork->timer); | ||
| 223 | if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { | 221 | if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) { |
| 224 | BUG_ON(timer_pending(timer)); | 222 | BUG_ON(timer_pending(timer)); |
| 225 | BUG_ON(!list_empty(&work->entry)); | 223 | BUG_ON(!list_empty(&work->entry)); |
| 226 | 224 | ||
| 225 | timer_stats_timer_set_start_info(&dwork->timer); | ||
| 226 | |||
| 227 | /* This stores cwq for the moment, for the timer_fn */ | 227 | /* This stores cwq for the moment, for the timer_fn */ |
| 228 | set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id())); | 228 | set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id())); |
| 229 | timer->expires = jiffies + delay; | 229 | timer->expires = jiffies + delay; |
| @@ -564,7 +564,6 @@ EXPORT_SYMBOL(schedule_work); | |||
| 564 | int schedule_delayed_work(struct delayed_work *dwork, | 564 | int schedule_delayed_work(struct delayed_work *dwork, |
| 565 | unsigned long delay) | 565 | unsigned long delay) |
| 566 | { | 566 | { |
| 567 | timer_stats_timer_set_start_info(&dwork->timer); | ||
| 568 | return queue_delayed_work(keventd_wq, dwork, delay); | 567 | return queue_delayed_work(keventd_wq, dwork, delay); |
| 569 | } | 568 | } |
| 570 | EXPORT_SYMBOL(schedule_delayed_work); | 569 | EXPORT_SYMBOL(schedule_delayed_work); |
| @@ -581,7 +580,6 @@ EXPORT_SYMBOL(schedule_delayed_work); | |||
| 581 | int schedule_delayed_work_on(int cpu, | 580 | int schedule_delayed_work_on(int cpu, |
| 582 | struct delayed_work *dwork, unsigned long delay) | 581 | struct delayed_work *dwork, unsigned long delay) |
| 583 | { | 582 | { |
| 584 | timer_stats_timer_set_start_info(&dwork->timer); | ||
| 585 | return queue_delayed_work_on(cpu, keventd_wq, dwork, delay); | 583 | return queue_delayed_work_on(cpu, keventd_wq, dwork, delay); |
| 586 | } | 584 | } |
| 587 | EXPORT_SYMBOL(schedule_delayed_work_on); | 585 | EXPORT_SYMBOL(schedule_delayed_work_on); |
diff --git a/lib/devres.c b/lib/devres.c index edc27a5d1b73..26c87c49d776 100644 --- a/lib/devres.c +++ b/lib/devres.c | |||
| @@ -20,7 +20,7 @@ static int devm_ioremap_match(struct device *dev, void *res, void *match_data) | |||
| 20 | * | 20 | * |
| 21 | * Managed ioremap(). Map is automatically unmapped on driver detach. | 21 | * Managed ioremap(). Map is automatically unmapped on driver detach. |
| 22 | */ | 22 | */ |
| 23 | void __iomem *devm_ioremap(struct device *dev, unsigned long offset, | 23 | void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, |
| 24 | unsigned long size) | 24 | unsigned long size) |
| 25 | { | 25 | { |
| 26 | void __iomem **ptr, *addr; | 26 | void __iomem **ptr, *addr; |
| @@ -49,7 +49,7 @@ EXPORT_SYMBOL(devm_ioremap); | |||
| 49 | * Managed ioremap_nocache(). Map is automatically unmapped on driver | 49 | * Managed ioremap_nocache(). Map is automatically unmapped on driver |
| 50 | * detach. | 50 | * detach. |
| 51 | */ | 51 | */ |
| 52 | void __iomem *devm_ioremap_nocache(struct device *dev, unsigned long offset, | 52 | void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, |
| 53 | unsigned long size) | 53 | unsigned long size) |
| 54 | { | 54 | { |
| 55 | void __iomem **ptr, *addr; | 55 | void __iomem **ptr, *addr; |
diff --git a/lib/div64.c b/lib/div64.c index b71cf93c529a..bb5bd0c0f030 100644 --- a/lib/div64.c +++ b/lib/div64.c | |||
| @@ -16,9 +16,8 @@ | |||
| 16 | * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. | 16 | * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/types.h> | ||
| 20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 21 | #include <asm/div64.h> | 20 | #include <linux/math64.h> |
| 22 | 21 | ||
| 23 | /* Not needed on 64bit architectures */ | 22 | /* Not needed on 64bit architectures */ |
| 24 | #if BITS_PER_LONG == 32 | 23 | #if BITS_PER_LONG == 32 |
| @@ -58,10 +57,31 @@ uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) | |||
| 58 | 57 | ||
| 59 | EXPORT_SYMBOL(__div64_32); | 58 | EXPORT_SYMBOL(__div64_32); |
| 60 | 59 | ||
| 60 | #ifndef div_s64_rem | ||
| 61 | s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder) | ||
| 62 | { | ||
| 63 | u64 quotient; | ||
| 64 | |||
| 65 | if (dividend < 0) { | ||
| 66 | quotient = div_u64_rem(-dividend, abs(divisor), (u32 *)remainder); | ||
| 67 | *remainder = -*remainder; | ||
| 68 | if (divisor > 0) | ||
| 69 | quotient = -quotient; | ||
| 70 | } else { | ||
| 71 | quotient = div_u64_rem(dividend, abs(divisor), (u32 *)remainder); | ||
| 72 | if (divisor < 0) | ||
| 73 | quotient = -quotient; | ||
| 74 | } | ||
| 75 | return quotient; | ||
| 76 | } | ||
| 77 | EXPORT_SYMBOL(div_s64_rem); | ||
| 78 | #endif | ||
| 79 | |||
| 61 | /* 64bit divisor, dividend and result. dynamic precision */ | 80 | /* 64bit divisor, dividend and result. dynamic precision */ |
| 62 | uint64_t div64_64(uint64_t dividend, uint64_t divisor) | 81 | #ifndef div64_u64 |
| 82 | u64 div64_u64(u64 dividend, u64 divisor) | ||
| 63 | { | 83 | { |
| 64 | uint32_t high, d; | 84 | u32 high, d; |
| 65 | 85 | ||
| 66 | high = divisor >> 32; | 86 | high = divisor >> 32; |
| 67 | if (high) { | 87 | if (high) { |
| @@ -72,10 +92,9 @@ uint64_t div64_64(uint64_t dividend, uint64_t divisor) | |||
| 72 | } else | 92 | } else |
| 73 | d = divisor; | 93 | d = divisor; |
| 74 | 94 | ||
| 75 | do_div(dividend, d); | 95 | return div_u64(dividend, d); |
| 76 | |||
| 77 | return dividend; | ||
| 78 | } | 96 | } |
| 79 | EXPORT_SYMBOL(div64_64); | 97 | EXPORT_SYMBOL(div64_u64); |
| 98 | #endif | ||
| 80 | 99 | ||
| 81 | #endif /* BITS_PER_LONG == 32 */ | 100 | #endif /* BITS_PER_LONG == 32 */ |
| @@ -385,8 +385,8 @@ void idr_remove(struct idr *idp, int id) | |||
| 385 | while (idp->id_free_cnt >= IDR_FREE_MAX) { | 385 | while (idp->id_free_cnt >= IDR_FREE_MAX) { |
| 386 | p = alloc_layer(idp); | 386 | p = alloc_layer(idp); |
| 387 | kmem_cache_free(idr_layer_cache, p); | 387 | kmem_cache_free(idr_layer_cache, p); |
| 388 | return; | ||
| 389 | } | 388 | } |
| 389 | return; | ||
| 390 | } | 390 | } |
| 391 | EXPORT_SYMBOL(idr_remove); | 391 | EXPORT_SYMBOL(idr_remove); |
| 392 | 392 | ||
diff --git a/lib/klist.c b/lib/klist.c index 120bd175aa78..cca37f96faa2 100644 --- a/lib/klist.c +++ b/lib/klist.c | |||
| @@ -1,38 +1,37 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * klist.c - Routines for manipulating klists. | 2 | * klist.c - Routines for manipulating klists. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005 Patrick Mochel | ||
| 4 | * | 5 | * |
| 5 | * This klist interface provides a couple of structures that wrap around | 6 | * This file is released under the GPL v2. |
| 6 | * struct list_head to provide explicit list "head" (struct klist) and | ||
| 7 | * list "node" (struct klist_node) objects. For struct klist, a spinlock | ||
| 8 | * is included that protects access to the actual list itself. struct | ||
| 9 | * klist_node provides a pointer to the klist that owns it and a kref | ||
| 10 | * reference count that indicates the number of current users of that node | ||
| 11 | * in the list. | ||
| 12 | * | 7 | * |
| 13 | * The entire point is to provide an interface for iterating over a list | 8 | * This klist interface provides a couple of structures that wrap around |
| 14 | * that is safe and allows for modification of the list during the | 9 | * struct list_head to provide explicit list "head" (struct klist) and list |
| 15 | * iteration (e.g. insertion and removal), including modification of the | 10 | * "node" (struct klist_node) objects. For struct klist, a spinlock is |
| 16 | * current node on the list. | 11 | * included that protects access to the actual list itself. struct |
| 12 | * klist_node provides a pointer to the klist that owns it and a kref | ||
| 13 | * reference count that indicates the number of current users of that node | ||
| 14 | * in the list. | ||
| 17 | * | 15 | * |
| 18 | * It works using a 3rd object type - struct klist_iter - that is declared | 16 | * The entire point is to provide an interface for iterating over a list |
| 19 | * and initialized before an iteration. klist_next() is used to acquire the | 17 | * that is safe and allows for modification of the list during the |
| 20 | * next element in the list. It returns NULL if there are no more items. | 18 | * iteration (e.g. insertion and removal), including modification of the |
| 21 | * Internally, that routine takes the klist's lock, decrements the reference | 19 | * current node on the list. |
| 22 | * count of the previous klist_node and increments the count of the next | ||
| 23 | * klist_node. It then drops the lock and returns. | ||
| 24 | * | 20 | * |
| 25 | * There are primitives for adding and removing nodes to/from a klist. | 21 | * It works using a 3rd object type - struct klist_iter - that is declared |
| 26 | * When deleting, klist_del() will simply decrement the reference count. | 22 | * and initialized before an iteration. klist_next() is used to acquire the |
| 27 | * Only when the count goes to 0 is the node removed from the list. | 23 | * next element in the list. It returns NULL if there are no more items. |
| 28 | * klist_remove() will try to delete the node from the list and block | 24 | * Internally, that routine takes the klist's lock, decrements the |
| 29 | * until it is actually removed. This is useful for objects (like devices) | 25 | * reference count of the previous klist_node and increments the count of |
| 30 | * that have been removed from the system and must be freed (but must wait | 26 | * the next klist_node. It then drops the lock and returns. |
| 31 | * until all accessors have finished). | ||
| 32 | * | 27 | * |
| 33 | * Copyright (C) 2005 Patrick Mochel | 28 | * There are primitives for adding and removing nodes to/from a klist. |
| 34 | * | 29 | * When deleting, klist_del() will simply decrement the reference count. |
| 35 | * This file is released under the GPL v2. | 30 | * Only when the count goes to 0 is the node removed from the list. |
| 31 | * klist_remove() will try to delete the node from the list and block until | ||
| 32 | * it is actually removed. This is useful for objects (like devices) that | ||
| 33 | * have been removed from the system and must be freed (but must wait until | ||
| 34 | * all accessors have finished). | ||
| 36 | */ | 35 | */ |
| 37 | 36 | ||
| 38 | #include <linux/klist.h> | 37 | #include <linux/klist.h> |
| @@ -40,10 +39,10 @@ | |||
| 40 | 39 | ||
| 41 | 40 | ||
| 42 | /** | 41 | /** |
| 43 | * klist_init - Initialize a klist structure. | 42 | * klist_init - Initialize a klist structure. |
| 44 | * @k: The klist we're initializing. | 43 | * @k: The klist we're initializing. |
| 45 | * @get: The get function for the embedding object (NULL if none) | 44 | * @get: The get function for the embedding object (NULL if none) |
| 46 | * @put: The put function for the embedding object (NULL if none) | 45 | * @put: The put function for the embedding object (NULL if none) |
| 47 | * | 46 | * |
| 48 | * Initialises the klist structure. If the klist_node structures are | 47 | * Initialises the klist structure. If the klist_node structures are |
| 49 | * going to be embedded in refcounted objects (necessary for safe | 48 | * going to be embedded in refcounted objects (necessary for safe |
| @@ -51,8 +50,7 @@ | |||
| 51 | * functions that take and release references on the embedding | 50 | * functions that take and release references on the embedding |
| 52 | * objects. | 51 | * objects. |
| 53 | */ | 52 | */ |
| 54 | 53 | void klist_init(struct klist *k, void (*get)(struct klist_node *), | |
| 55 | void klist_init(struct klist * k, void (*get)(struct klist_node *), | ||
| 56 | void (*put)(struct klist_node *)) | 54 | void (*put)(struct klist_node *)) |
| 57 | { | 55 | { |
| 58 | INIT_LIST_HEAD(&k->k_list); | 56 | INIT_LIST_HEAD(&k->k_list); |
| @@ -60,26 +58,23 @@ void klist_init(struct klist * k, void (*get)(struct klist_node *), | |||
| 60 | k->get = get; | 58 | k->get = get; |
| 61 | k->put = put; | 59 | k->put = put; |
| 62 | } | 60 | } |
| 63 | |||
| 64 | EXPORT_SYMBOL_GPL(klist_init); | 61 | EXPORT_SYMBOL_GPL(klist_init); |
| 65 | 62 | ||
| 66 | 63 | static void add_head(struct klist *k, struct klist_node *n) | |
| 67 | static void add_head(struct klist * k, struct klist_node * n) | ||
| 68 | { | 64 | { |
| 69 | spin_lock(&k->k_lock); | 65 | spin_lock(&k->k_lock); |
| 70 | list_add(&n->n_node, &k->k_list); | 66 | list_add(&n->n_node, &k->k_list); |
| 71 | spin_unlock(&k->k_lock); | 67 | spin_unlock(&k->k_lock); |
| 72 | } | 68 | } |
| 73 | 69 | ||
| 74 | static void add_tail(struct klist * k, struct klist_node * n) | 70 | static void add_tail(struct klist *k, struct klist_node *n) |
| 75 | { | 71 | { |
| 76 | spin_lock(&k->k_lock); | 72 | spin_lock(&k->k_lock); |
| 77 | list_add_tail(&n->n_node, &k->k_list); | 73 | list_add_tail(&n->n_node, &k->k_list); |
| 78 | spin_unlock(&k->k_lock); | 74 | spin_unlock(&k->k_lock); |
| 79 | } | 75 | } |
| 80 | 76 | ||
| 81 | 77 | static void klist_node_init(struct klist *k, struct klist_node *n) | |
| 82 | static void klist_node_init(struct klist * k, struct klist_node * n) | ||
| 83 | { | 78 | { |
| 84 | INIT_LIST_HEAD(&n->n_node); | 79 | INIT_LIST_HEAD(&n->n_node); |
| 85 | init_completion(&n->n_removed); | 80 | init_completion(&n->n_removed); |
| @@ -89,60 +84,83 @@ static void klist_node_init(struct klist * k, struct klist_node * n) | |||
| 89 | k->get(n); | 84 | k->get(n); |
| 90 | } | 85 | } |
| 91 | 86 | ||
| 92 | |||
| 93 | /** | 87 | /** |
| 94 | * klist_add_head - Initialize a klist_node and add it to front. | 88 | * klist_add_head - Initialize a klist_node and add it to front. |
| 95 | * @n: node we're adding. | 89 | * @n: node we're adding. |
| 96 | * @k: klist it's going on. | 90 | * @k: klist it's going on. |
| 97 | */ | 91 | */ |
| 98 | 92 | void klist_add_head(struct klist_node *n, struct klist *k) | |
| 99 | void klist_add_head(struct klist_node * n, struct klist * k) | ||
| 100 | { | 93 | { |
| 101 | klist_node_init(k, n); | 94 | klist_node_init(k, n); |
| 102 | add_head(k, n); | 95 | add_head(k, n); |
| 103 | } | 96 | } |
| 104 | |||
| 105 | EXPORT_SYMBOL_GPL(klist_add_head); | 97 | EXPORT_SYMBOL_GPL(klist_add_head); |
| 106 | 98 | ||
| 107 | |||
| 108 | /** | 99 | /** |
| 109 | * klist_add_tail - Initialize a klist_node and add it to back. | 100 | * klist_add_tail - Initialize a klist_node and add it to back. |
| 110 | * @n: node we're adding. | 101 | * @n: node we're adding. |
| 111 | * @k: klist it's going on. | 102 | * @k: klist it's going on. |
| 112 | */ | 103 | */ |
| 113 | 104 | void klist_add_tail(struct klist_node *n, struct klist *k) | |
| 114 | void klist_add_tail(struct klist_node * n, struct klist * k) | ||
| 115 | { | 105 | { |
| 116 | klist_node_init(k, n); | 106 | klist_node_init(k, n); |
| 117 | add_tail(k, n); | 107 | add_tail(k, n); |
| 118 | } | 108 | } |
| 119 | |||
| 120 | EXPORT_SYMBOL_GPL(klist_add_tail); | 109 | EXPORT_SYMBOL_GPL(klist_add_tail); |
| 121 | 110 | ||
| 111 | /** | ||
| 112 | * klist_add_after - Init a klist_node and add it after an existing node | ||
| 113 | * @n: node we're adding. | ||
| 114 | * @pos: node to put @n after | ||
| 115 | */ | ||
| 116 | void klist_add_after(struct klist_node *n, struct klist_node *pos) | ||
| 117 | { | ||
| 118 | struct klist *k = pos->n_klist; | ||
| 119 | |||
| 120 | klist_node_init(k, n); | ||
| 121 | spin_lock(&k->k_lock); | ||
| 122 | list_add(&n->n_node, &pos->n_node); | ||
| 123 | spin_unlock(&k->k_lock); | ||
| 124 | } | ||
| 125 | EXPORT_SYMBOL_GPL(klist_add_after); | ||
| 126 | |||
| 127 | /** | ||
| 128 | * klist_add_before - Init a klist_node and add it before an existing node | ||
| 129 | * @n: node we're adding. | ||
| 130 | * @pos: node to put @n after | ||
| 131 | */ | ||
| 132 | void klist_add_before(struct klist_node *n, struct klist_node *pos) | ||
| 133 | { | ||
| 134 | struct klist *k = pos->n_klist; | ||
| 135 | |||
| 136 | klist_node_init(k, n); | ||
| 137 | spin_lock(&k->k_lock); | ||
| 138 | list_add_tail(&n->n_node, &pos->n_node); | ||
| 139 | spin_unlock(&k->k_lock); | ||
| 140 | } | ||
| 141 | EXPORT_SYMBOL_GPL(klist_add_before); | ||
| 122 | 142 | ||
| 123 | static void klist_release(struct kref * kref) | 143 | static void klist_release(struct kref *kref) |
| 124 | { | 144 | { |
| 125 | struct klist_node * n = container_of(kref, struct klist_node, n_ref); | 145 | struct klist_node *n = container_of(kref, struct klist_node, n_ref); |
| 126 | 146 | ||
| 127 | list_del(&n->n_node); | 147 | list_del(&n->n_node); |
| 128 | complete(&n->n_removed); | 148 | complete(&n->n_removed); |
| 129 | n->n_klist = NULL; | 149 | n->n_klist = NULL; |
| 130 | } | 150 | } |
| 131 | 151 | ||
| 132 | static int klist_dec_and_del(struct klist_node * n) | 152 | static int klist_dec_and_del(struct klist_node *n) |
| 133 | { | 153 | { |
| 134 | return kref_put(&n->n_ref, klist_release); | 154 | return kref_put(&n->n_ref, klist_release); |
| 135 | } | 155 | } |
| 136 | 156 | ||
| 137 | |||
| 138 | /** | 157 | /** |
| 139 | * klist_del - Decrement the reference count of node and try to remove. | 158 | * klist_del - Decrement the reference count of node and try to remove. |
| 140 | * @n: node we're deleting. | 159 | * @n: node we're deleting. |
| 141 | */ | 160 | */ |
| 142 | 161 | void klist_del(struct klist_node *n) | |
| 143 | void klist_del(struct klist_node * n) | ||
| 144 | { | 162 | { |
| 145 | struct klist * k = n->n_klist; | 163 | struct klist *k = n->n_klist; |
| 146 | void (*put)(struct klist_node *) = k->put; | 164 | void (*put)(struct klist_node *) = k->put; |
| 147 | 165 | ||
| 148 | spin_lock(&k->k_lock); | 166 | spin_lock(&k->k_lock); |
| @@ -152,48 +170,40 @@ void klist_del(struct klist_node * n) | |||
| 152 | if (put) | 170 | if (put) |
| 153 | put(n); | 171 | put(n); |
| 154 | } | 172 | } |
| 155 | |||
| 156 | EXPORT_SYMBOL_GPL(klist_del); | 173 | EXPORT_SYMBOL_GPL(klist_del); |
| 157 | 174 | ||
| 158 | |||
| 159 | /** | 175 | /** |
| 160 | * klist_remove - Decrement the refcount of node and wait for it to go away. | 176 | * klist_remove - Decrement the refcount of node and wait for it to go away. |
| 161 | * @n: node we're removing. | 177 | * @n: node we're removing. |
| 162 | */ | 178 | */ |
| 163 | 179 | void klist_remove(struct klist_node *n) | |
| 164 | void klist_remove(struct klist_node * n) | ||
| 165 | { | 180 | { |
| 166 | klist_del(n); | 181 | klist_del(n); |
| 167 | wait_for_completion(&n->n_removed); | 182 | wait_for_completion(&n->n_removed); |
| 168 | } | 183 | } |
| 169 | |||
| 170 | EXPORT_SYMBOL_GPL(klist_remove); | 184 | EXPORT_SYMBOL_GPL(klist_remove); |
| 171 | 185 | ||
| 172 | |||
| 173 | /** | 186 | /** |
| 174 | * klist_node_attached - Say whether a node is bound to a list or not. | 187 | * klist_node_attached - Say whether a node is bound to a list or not. |
| 175 | * @n: Node that we're testing. | 188 | * @n: Node that we're testing. |
| 176 | */ | 189 | */ |
| 177 | 190 | int klist_node_attached(struct klist_node *n) | |
| 178 | int klist_node_attached(struct klist_node * n) | ||
| 179 | { | 191 | { |
| 180 | return (n->n_klist != NULL); | 192 | return (n->n_klist != NULL); |
| 181 | } | 193 | } |
| 182 | |||
| 183 | EXPORT_SYMBOL_GPL(klist_node_attached); | 194 | EXPORT_SYMBOL_GPL(klist_node_attached); |
| 184 | 195 | ||
| 185 | |||
| 186 | /** | 196 | /** |
| 187 | * klist_iter_init_node - Initialize a klist_iter structure. | 197 | * klist_iter_init_node - Initialize a klist_iter structure. |
| 188 | * @k: klist we're iterating. | 198 | * @k: klist we're iterating. |
| 189 | * @i: klist_iter we're filling. | 199 | * @i: klist_iter we're filling. |
| 190 | * @n: node to start with. | 200 | * @n: node to start with. |
| 191 | * | 201 | * |
| 192 | * Similar to klist_iter_init(), but starts the action off with @n, | 202 | * Similar to klist_iter_init(), but starts the action off with @n, |
| 193 | * instead of with the list head. | 203 | * instead of with the list head. |
| 194 | */ | 204 | */ |
| 195 | 205 | void klist_iter_init_node(struct klist *k, struct klist_iter *i, | |
| 196 | void klist_iter_init_node(struct klist * k, struct klist_iter * i, struct klist_node * n) | 206 | struct klist_node *n) |
| 197 | { | 207 | { |
| 198 | i->i_klist = k; | 208 | i->i_klist = k; |
| 199 | i->i_head = &k->k_list; | 209 | i->i_head = &k->k_list; |
| @@ -201,66 +211,56 @@ void klist_iter_init_node(struct klist * k, struct klist_iter * i, struct klist_ | |||
| 201 | if (n) | 211 | if (n) |
| 202 | kref_get(&n->n_ref); | 212 | kref_get(&n->n_ref); |
| 203 | } | 213 | } |
| 204 | |||
| 205 | EXPORT_SYMBOL_GPL(klist_iter_init_node); | 214 | EXPORT_SYMBOL_GPL(klist_iter_init_node); |
| 206 | 215 | ||
| 207 | |||
| 208 | /** | 216 | /** |
| 209 | * klist_iter_init - Iniitalize a klist_iter structure. | 217 | * klist_iter_init - Iniitalize a klist_iter structure. |
| 210 | * @k: klist we're iterating. | 218 | * @k: klist we're iterating. |
| 211 | * @i: klist_iter structure we're filling. | 219 | * @i: klist_iter structure we're filling. |
| 212 | * | 220 | * |
| 213 | * Similar to klist_iter_init_node(), but start with the list head. | 221 | * Similar to klist_iter_init_node(), but start with the list head. |
| 214 | */ | 222 | */ |
| 215 | 223 | void klist_iter_init(struct klist *k, struct klist_iter *i) | |
| 216 | void klist_iter_init(struct klist * k, struct klist_iter * i) | ||
| 217 | { | 224 | { |
| 218 | klist_iter_init_node(k, i, NULL); | 225 | klist_iter_init_node(k, i, NULL); |
| 219 | } | 226 | } |
| 220 | |||
| 221 | EXPORT_SYMBOL_GPL(klist_iter_init); | 227 | EXPORT_SYMBOL_GPL(klist_iter_init); |
| 222 | 228 | ||
| 223 | |||
| 224 | /** | 229 | /** |
| 225 | * klist_iter_exit - Finish a list iteration. | 230 | * klist_iter_exit - Finish a list iteration. |
| 226 | * @i: Iterator structure. | 231 | * @i: Iterator structure. |
| 227 | * | 232 | * |
| 228 | * Must be called when done iterating over list, as it decrements the | 233 | * Must be called when done iterating over list, as it decrements the |
| 229 | * refcount of the current node. Necessary in case iteration exited before | 234 | * refcount of the current node. Necessary in case iteration exited before |
| 230 | * the end of the list was reached, and always good form. | 235 | * the end of the list was reached, and always good form. |
| 231 | */ | 236 | */ |
| 232 | 237 | void klist_iter_exit(struct klist_iter *i) | |
| 233 | void klist_iter_exit(struct klist_iter * i) | ||
| 234 | { | 238 | { |
| 235 | if (i->i_cur) { | 239 | if (i->i_cur) { |
| 236 | klist_del(i->i_cur); | 240 | klist_del(i->i_cur); |
| 237 | i->i_cur = NULL; | 241 | i->i_cur = NULL; |
| 238 | } | 242 | } |
| 239 | } | 243 | } |
| 240 | |||
| 241 | EXPORT_SYMBOL_GPL(klist_iter_exit); | 244 | EXPORT_SYMBOL_GPL(klist_iter_exit); |
| 242 | 245 | ||
| 243 | 246 | static struct klist_node *to_klist_node(struct list_head *n) | |
| 244 | static struct klist_node * to_klist_node(struct list_head * n) | ||
| 245 | { | 247 | { |
| 246 | return container_of(n, struct klist_node, n_node); | 248 | return container_of(n, struct klist_node, n_node); |
| 247 | } | 249 | } |
| 248 | 250 | ||
| 249 | |||
| 250 | /** | 251 | /** |
| 251 | * klist_next - Ante up next node in list. | 252 | * klist_next - Ante up next node in list. |
| 252 | * @i: Iterator structure. | 253 | * @i: Iterator structure. |
| 253 | * | 254 | * |
| 254 | * First grab list lock. Decrement the reference count of the previous | 255 | * First grab list lock. Decrement the reference count of the previous |
| 255 | * node, if there was one. Grab the next node, increment its reference | 256 | * node, if there was one. Grab the next node, increment its reference |
| 256 | * count, drop the lock, and return that next node. | 257 | * count, drop the lock, and return that next node. |
| 257 | */ | 258 | */ |
| 258 | 259 | struct klist_node *klist_next(struct klist_iter *i) | |
| 259 | struct klist_node * klist_next(struct klist_iter * i) | ||
| 260 | { | 260 | { |
| 261 | struct list_head * next; | 261 | struct list_head *next; |
| 262 | struct klist_node * lnode = i->i_cur; | 262 | struct klist_node *lnode = i->i_cur; |
| 263 | struct klist_node * knode = NULL; | 263 | struct klist_node *knode = NULL; |
| 264 | void (*put)(struct klist_node *) = i->i_klist->put; | 264 | void (*put)(struct klist_node *) = i->i_klist->put; |
| 265 | 265 | ||
| 266 | spin_lock(&i->i_klist->k_lock); | 266 | spin_lock(&i->i_klist->k_lock); |
| @@ -281,7 +281,4 @@ struct klist_node * klist_next(struct klist_iter * i) | |||
| 281 | put(lnode); | 281 | put(lnode); |
| 282 | return knode; | 282 | return knode; |
| 283 | } | 283 | } |
| 284 | |||
| 285 | EXPORT_SYMBOL_GPL(klist_next); | 284 | EXPORT_SYMBOL_GPL(klist_next); |
| 286 | |||
| 287 | |||
diff --git a/lib/kobject.c b/lib/kobject.c index fd7874032163..718e5101c263 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -216,21 +216,12 @@ static int kobject_add_internal(struct kobject *kobj) | |||
| 216 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | 216 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, |
| 217 | va_list vargs) | 217 | va_list vargs) |
| 218 | { | 218 | { |
| 219 | va_list aq; | ||
| 220 | char *name; | ||
| 221 | |||
| 222 | va_copy(aq, vargs); | ||
| 223 | name = kvasprintf(GFP_KERNEL, fmt, vargs); | ||
| 224 | va_end(aq); | ||
| 225 | |||
| 226 | if (!name) | ||
| 227 | return -ENOMEM; | ||
| 228 | |||
| 229 | /* Free the old name, if necessary. */ | 219 | /* Free the old name, if necessary. */ |
| 230 | kfree(kobj->name); | 220 | kfree(kobj->name); |
| 231 | 221 | ||
| 232 | /* Now, set the new name */ | 222 | kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); |
| 233 | kobj->name = name; | 223 | if (!kobj->name) |
| 224 | return -ENOMEM; | ||
| 234 | 225 | ||
| 235 | return 0; | 226 | return 0; |
| 236 | } | 227 | } |
| @@ -246,12 +237,12 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | |||
| 246 | */ | 237 | */ |
| 247 | int kobject_set_name(struct kobject *kobj, const char *fmt, ...) | 238 | int kobject_set_name(struct kobject *kobj, const char *fmt, ...) |
| 248 | { | 239 | { |
| 249 | va_list args; | 240 | va_list vargs; |
| 250 | int retval; | 241 | int retval; |
| 251 | 242 | ||
| 252 | va_start(args, fmt); | 243 | va_start(vargs, fmt); |
| 253 | retval = kobject_set_name_vargs(kobj, fmt, args); | 244 | retval = kobject_set_name_vargs(kobj, fmt, vargs); |
| 254 | va_end(args); | 245 | va_end(vargs); |
| 255 | 246 | ||
| 256 | return retval; | 247 | return retval; |
| 257 | } | 248 | } |
| @@ -301,12 +292,9 @@ EXPORT_SYMBOL(kobject_init); | |||
| 301 | static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, | 292 | static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, |
| 302 | const char *fmt, va_list vargs) | 293 | const char *fmt, va_list vargs) |
| 303 | { | 294 | { |
| 304 | va_list aq; | ||
| 305 | int retval; | 295 | int retval; |
| 306 | 296 | ||
| 307 | va_copy(aq, vargs); | 297 | retval = kobject_set_name_vargs(kobj, fmt, vargs); |
| 308 | retval = kobject_set_name_vargs(kobj, fmt, aq); | ||
| 309 | va_end(aq); | ||
| 310 | if (retval) { | 298 | if (retval) { |
| 311 | printk(KERN_ERR "kobject: can not set name properly!\n"); | 299 | printk(KERN_ERR "kobject: can not set name properly!\n"); |
| 312 | return retval; | 300 | return retval; |
diff --git a/lib/string.c b/lib/string.c index 5efafed3d6b6..b19b87af65a3 100644 --- a/lib/string.c +++ b/lib/string.c | |||
| @@ -493,6 +493,33 @@ char *strsep(char **s, const char *ct) | |||
| 493 | EXPORT_SYMBOL(strsep); | 493 | EXPORT_SYMBOL(strsep); |
| 494 | #endif | 494 | #endif |
| 495 | 495 | ||
| 496 | /** | ||
| 497 | * sysfs_streq - return true if strings are equal, modulo trailing newline | ||
| 498 | * @s1: one string | ||
| 499 | * @s2: another string | ||
| 500 | * | ||
| 501 | * This routine returns true iff two strings are equal, treating both | ||
| 502 | * NUL and newline-then-NUL as equivalent string terminations. It's | ||
| 503 | * geared for use with sysfs input strings, which generally terminate | ||
| 504 | * with newlines but are compared against values without newlines. | ||
| 505 | */ | ||
| 506 | bool sysfs_streq(const char *s1, const char *s2) | ||
| 507 | { | ||
| 508 | while (*s1 && *s1 == *s2) { | ||
| 509 | s1++; | ||
| 510 | s2++; | ||
| 511 | } | ||
| 512 | |||
| 513 | if (*s1 == *s2) | ||
| 514 | return true; | ||
| 515 | if (!*s1 && *s2 == '\n' && !s2[1]) | ||
| 516 | return true; | ||
| 517 | if (*s1 == '\n' && !s1[1] && !*s2) | ||
| 518 | return true; | ||
| 519 | return false; | ||
| 520 | } | ||
| 521 | EXPORT_SYMBOL(sysfs_streq); | ||
| 522 | |||
| 496 | #ifndef __HAVE_ARCH_MEMSET | 523 | #ifndef __HAVE_ARCH_MEMSET |
| 497 | /** | 524 | /** |
| 498 | * memset - Fill a region of memory with the given value | 525 | * memset - Fill a region of memory with the given value |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 33add96cd5fb..e46451e1d9b7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -48,6 +48,8 @@ enum mem_cgroup_stat_index { | |||
| 48 | */ | 48 | */ |
| 49 | MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ | 49 | MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ |
| 50 | MEM_CGROUP_STAT_RSS, /* # of pages charged as rss */ | 50 | MEM_CGROUP_STAT_RSS, /* # of pages charged as rss */ |
| 51 | MEM_CGROUP_STAT_PGPGIN_COUNT, /* # of pages paged in */ | ||
| 52 | MEM_CGROUP_STAT_PGPGOUT_COUNT, /* # of pages paged out */ | ||
| 51 | 53 | ||
| 52 | MEM_CGROUP_STAT_NSTATS, | 54 | MEM_CGROUP_STAT_NSTATS, |
| 53 | }; | 55 | }; |
| @@ -199,6 +201,13 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, int flags, | |||
| 199 | __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val); | 201 | __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val); |
| 200 | else | 202 | else |
| 201 | __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val); | 203 | __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val); |
| 204 | |||
| 205 | if (charge) | ||
| 206 | __mem_cgroup_stat_add_safe(stat, | ||
| 207 | MEM_CGROUP_STAT_PGPGIN_COUNT, 1); | ||
| 208 | else | ||
| 209 | __mem_cgroup_stat_add_safe(stat, | ||
| 210 | MEM_CGROUP_STAT_PGPGOUT_COUNT, 1); | ||
| 202 | } | 211 | } |
| 203 | 212 | ||
| 204 | static struct mem_cgroup_per_zone * | 213 | static struct mem_cgroup_per_zone * |
| @@ -884,6 +893,8 @@ static const struct mem_cgroup_stat_desc { | |||
| 884 | } mem_cgroup_stat_desc[] = { | 893 | } mem_cgroup_stat_desc[] = { |
| 885 | [MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, }, | 894 | [MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, }, |
| 886 | [MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, }, | 895 | [MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, }, |
| 896 | [MEM_CGROUP_STAT_PGPGIN_COUNT] = {"pgpgin", 1, }, | ||
| 897 | [MEM_CGROUP_STAT_PGPGOUT_COUNT] = {"pgpgout", 1, }, | ||
| 887 | }; | 898 | }; |
| 888 | 899 | ||
| 889 | static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, | 900 | static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, |
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/debugobjects.h> | 22 | #include <linux/debugobjects.h> |
| 23 | #include <linux/kallsyms.h> | 23 | #include <linux/kallsyms.h> |
| 24 | #include <linux/memory.h> | 24 | #include <linux/memory.h> |
| 25 | #include <linux/math64.h> | ||
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| 27 | * Lock order: | 28 | * Lock order: |
| @@ -3621,12 +3622,10 @@ static int list_locations(struct kmem_cache *s, char *buf, | |||
| 3621 | len += sprintf(buf + len, "<not-available>"); | 3622 | len += sprintf(buf + len, "<not-available>"); |
| 3622 | 3623 | ||
| 3623 | if (l->sum_time != l->min_time) { | 3624 | if (l->sum_time != l->min_time) { |
| 3624 | unsigned long remainder; | ||
| 3625 | |||
| 3626 | len += sprintf(buf + len, " age=%ld/%ld/%ld", | 3625 | len += sprintf(buf + len, " age=%ld/%ld/%ld", |
| 3627 | l->min_time, | 3626 | l->min_time, |
| 3628 | div_long_long_rem(l->sum_time, l->count, &remainder), | 3627 | (long)div_u64(l->sum_time, l->count), |
| 3629 | l->max_time); | 3628 | l->max_time); |
| 3630 | } else | 3629 | } else |
| 3631 | len += sprintf(buf + len, " age=%ld", | 3630 | len += sprintf(buf + len, " age=%ld", |
| 3632 | l->min_time); | 3631 | l->min_time); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 2a39cf128aba..6e45b0f3d125 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -547,6 +547,7 @@ void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot) | |||
| 547 | * @gfp_mask: flags for the page level allocator | 547 | * @gfp_mask: flags for the page level allocator |
| 548 | * @prot: protection mask for the allocated pages | 548 | * @prot: protection mask for the allocated pages |
| 549 | * @node: node to use for allocation or -1 | 549 | * @node: node to use for allocation or -1 |
| 550 | * @caller: caller's return address | ||
| 550 | * | 551 | * |
| 551 | * Allocate enough pages to cover @size from the page level | 552 | * Allocate enough pages to cover @size from the page level |
| 552 | * allocator with @gfp_mask flags. Map them into contiguous | 553 | * allocator with @gfp_mask flags. Map them into contiguous |
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index eb5b9854c8c7..4a1221e5e8ee 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | 15 | ||
| 16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/math64.h> | ||
| 18 | #include <net/tcp.h> | 19 | #include <net/tcp.h> |
| 19 | #include <asm/div64.h> | ||
| 20 | 20 | ||
| 21 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation | 21 | #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation |
| 22 | * max_cwnd = snd_cwnd * beta | 22 | * max_cwnd = snd_cwnd * beta |
| @@ -128,7 +128,7 @@ static u32 cubic_root(u64 a) | |||
| 128 | * x = ( 2 * x + a / x ) / 3 | 128 | * x = ( 2 * x + a / x ) / 3 |
| 129 | * k+1 k k | 129 | * k+1 k k |
| 130 | */ | 130 | */ |
| 131 | x = (2 * x + (u32)div64_64(a, (u64)x * (u64)(x - 1))); | 131 | x = (2 * x + (u32)div64_u64(a, (u64)x * (u64)(x - 1))); |
| 132 | x = ((x * 341) >> 10); | 132 | x = ((x * 341) >> 10); |
| 133 | return x; | 133 | return x; |
| 134 | } | 134 | } |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index b4a26f2505f8..56d55fecf8ec 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -1089,10 +1089,6 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
| 1089 | if(level != SOL_IPV6) | 1089 | if(level != SOL_IPV6) |
| 1090 | return -ENOPROTOOPT; | 1090 | return -ENOPROTOOPT; |
| 1091 | 1091 | ||
| 1092 | if (optname == MCAST_MSFILTER) | ||
| 1093 | return compat_mc_getsockopt(sk, level, optname, optval, optlen, | ||
| 1094 | ipv6_getsockopt); | ||
| 1095 | |||
| 1096 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); | 1092 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); |
| 1097 | #ifdef CONFIG_NETFILTER | 1093 | #ifdef CONFIG_NETFILTER |
| 1098 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1094 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
| @@ -1131,6 +1127,10 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
| 1131 | if (level != SOL_IPV6) | 1127 | if (level != SOL_IPV6) |
| 1132 | return -ENOPROTOOPT; | 1128 | return -ENOPROTOOPT; |
| 1133 | 1129 | ||
| 1130 | if (optname == MCAST_MSFILTER) | ||
| 1131 | return compat_mc_getsockopt(sk, level, optname, optval, optlen, | ||
| 1132 | ipv6_getsockopt); | ||
| 1133 | |||
| 1134 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); | 1134 | err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); |
| 1135 | #ifdef CONFIG_NETFILTER | 1135 | #ifdef CONFIG_NETFILTER |
| 1136 | /* we need to exclude all possible ENOPROTOOPTs except default case */ | 1136 | /* we need to exclude all possible ENOPROTOOPTs except default case */ |
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c index b15e7e2fa143..d7e8983cd37f 100644 --- a/net/netfilter/xt_connbytes.c +++ b/net/netfilter/xt_connbytes.c | |||
| @@ -4,12 +4,11 @@ | |||
| 4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
| 5 | #include <linux/bitops.h> | 5 | #include <linux/bitops.h> |
| 6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
| 7 | #include <linux/math64.h> | ||
| 7 | #include <linux/netfilter/x_tables.h> | 8 | #include <linux/netfilter/x_tables.h> |
| 8 | #include <linux/netfilter/xt_connbytes.h> | 9 | #include <linux/netfilter/xt_connbytes.h> |
| 9 | #include <net/netfilter/nf_conntrack.h> | 10 | #include <net/netfilter/nf_conntrack.h> |
| 10 | 11 | ||
| 11 | #include <asm/div64.h> | ||
| 12 | |||
| 13 | MODULE_LICENSE("GPL"); | 12 | MODULE_LICENSE("GPL"); |
| 14 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); | 13 | MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); |
| 15 | MODULE_DESCRIPTION("Xtables: Number of packets/bytes per connection matching"); | 14 | MODULE_DESCRIPTION("Xtables: Number of packets/bytes per connection matching"); |
| @@ -82,7 +81,7 @@ connbytes_mt(const struct sk_buff *skb, const struct net_device *in, | |||
| 82 | break; | 81 | break; |
| 83 | } | 82 | } |
| 84 | if (pkts != 0) | 83 | if (pkts != 0) |
| 85 | what = div64_64(bytes, pkts); | 84 | what = div64_u64(bytes, pkts); |
| 86 | break; | 85 | break; |
| 87 | } | 86 | } |
| 88 | 87 | ||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 62e1e02126e6..5552154cbedb 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
| @@ -36,8 +36,10 @@ trap "rm -f $tmp" 0 1 2 3 15 | |||
| 36 | 36 | ||
| 37 | # Check if we can link to ncurses | 37 | # Check if we can link to ncurses |
| 38 | check() { | 38 | check() { |
| 39 | echo -e " #include CURSES_LOC \n main() {}" | | 39 | $cc -xc - -o $tmp 2>/dev/null <<'EOF' |
| 40 | $cc -xc - -o $tmp 2> /dev/null | 40 | #include CURSES_LOC |
| 41 | main() {} | ||
| 42 | EOF | ||
| 41 | if [ $? != 0 ]; then | 43 | if [ $? != 0 ]; then |
| 42 | echo " *** Unable to find the ncurses libraries or the" 1>&2 | 44 | echo " *** Unable to find the ncurses libraries or the" 1>&2 |
| 43 | echo " *** required header files." 1>&2 | 45 | echo " *** required header files." 1>&2 |
