aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/debugging-via-ohci1394.txt8
-rw-r--r--Documentation/feature-removal-schedule.txt30
-rw-r--r--Documentation/filesystems/ext3.txt16
-rw-r--r--Documentation/sound/alsa/HD-Audio-Models.txt1
-rw-r--r--MAINTAINERS13
-rw-r--r--Makefile46
-rw-r--r--arch/arm/include/asm/bitops.h6
-rw-r--r--arch/arm/kernel/traps.c76
-rw-r--r--arch/arm/mach-bcmring/core.c4
-rw-r--r--arch/arm/mach-bcmring/include/mach/system.h2
-rw-r--r--arch/arm/mach-ep93xx/Kconfig44
-rw-r--r--arch/arm/mach-ep93xx/Makefile.boot9
-rw-r--r--arch/arm/mach-ep93xx/clock.c166
-rw-r--r--arch/arm/mach-ep93xx/core.c31
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c31
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h42
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio.h16
-rw-r--r--arch/arm/mach-ep93xx/include/mach/memory.h6
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h4
-rw-r--r--arch/arm/mach-ep93xx/micro9.c132
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c2
-rw-r--r--arch/arm/mach-pxa/csb726.c2
-rw-r--r--arch/arm/mach-sa1100/Makefile1
-rw-r--r--arch/arm/mm/cache-v6.S20
-rw-r--r--arch/arm/mm/cache-v7.S19
-rw-r--r--arch/arm/mm/fault-armv.c9
-rw-r--r--arch/arm/mm/fault.c5
-rw-r--r--arch/arm/mm/highmem.c2
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/s390/hypfs/hypfs_diag.c2
-rw-r--r--arch/s390/kernel/processor.c6
-rw-r--r--arch/sh/kernel/entry-common.S2
-rw-r--r--arch/sh/kernel/ftrace.c37
-rw-r--r--arch/sh/kernel/setup.c2
-rw-r--r--arch/sh/kernel/signal_32.c9
-rw-r--r--arch/sh/kernel/smp.c2
-rw-r--r--arch/sh/kernel/traps_32.c7
-rw-r--r--arch/sh/mm/cache.c2
-rw-r--r--arch/sparc/kernel/ldc.c4
-rw-r--r--arch/sparc/kernel/perf_event.c2
-rw-r--r--arch/sparc/mm/init_64.c2
-rw-r--r--arch/x86/Kconfig11
-rw-r--r--arch/x86/include/asm/paravirt.h28
-rw-r--r--arch/x86/include/asm/paravirt_types.h10
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.lds.S4
-rw-r--r--arch/x86/kernel/irq.c2
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/kernel/smp.c1
-rw-r--r--arch/x86/kernel/time.c3
-rw-r--r--arch/x86/kernel/trampoline.c12
-rw-r--r--arch/x86/kernel/trampoline_64.S4
-rw-r--r--arch/x86/kernel/vmi_32.c2
-rw-r--r--arch/x86/kernel/vmlinux.lds.S17
-rw-r--r--block/blk-core.c16
-rw-r--r--block/blk-merge.c2
-rw-r--r--block/blk-settings.c2
-rw-r--r--block/blk-tag.c2
-rw-r--r--block/cfq-iosched.c259
-rw-r--r--block/elevator.c4
-rw-r--r--block/genhd.c4
-rw-r--r--drivers/acpi/pci_root.c11
-rw-r--r--drivers/block/cciss.c79
-rw-r--r--drivers/char/genrtc.c1
-rw-r--r--drivers/char/rtc.c1
-rw-r--r--drivers/char/sonypi.c1
-rw-r--r--drivers/char/tty_buffer.c31
-rw-r--r--drivers/firewire/sbp2.c39
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-twinhan.c4
-rw-r--r--drivers/hid/hidraw.c5
-rw-r--r--drivers/md/dm.c16
-rw-r--r--drivers/mfd/twl4030-core.c89
-rw-r--r--drivers/mmc/host/pxamci.c4
-rw-r--r--drivers/net/wan/c101.c1
-rw-r--r--drivers/net/wan/n2.c1
-rw-r--r--drivers/net/wan/pci200syn.c1
-rw-r--r--drivers/oprofile/event_buffer.c35
-rw-r--r--drivers/pci/dmar.c13
-rw-r--r--drivers/pci/hotplug/cpqphp.h1
-rw-r--r--drivers/pci/intel-iommu.c82
-rw-r--r--drivers/pci/pci.c27
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c2
-rw-r--r--drivers/pci/pcie/portdrv_pci.c3
-rw-r--r--drivers/pci/quirks.c32
-rw-r--r--drivers/pci/setup-bus.c13
-rw-r--r--drivers/pci/setup-res.c37
-rw-r--r--drivers/s390/block/dasd.c13
-rw-r--r--drivers/s390/block/dasd_eckd.c8
-rw-r--r--drivers/s390/char/sclp_async.c4
-rw-r--r--drivers/s390/char/sclp_vt220.c30
-rw-r--r--drivers/s390/char/tape_block.c3
-rw-r--r--drivers/s390/cio/device.c9
-rw-r--r--drivers/serial/serial_core.c7
-rw-r--r--drivers/spi/amba-pl022.c2
-rw-r--r--drivers/usb/host/pci-quirks.c2
-rw-r--r--drivers/usb/musb/Kconfig2
-rw-r--r--drivers/watchdog/riowd.c2
-rw-r--r--fs/ext3/super.c13
-rw-r--r--fs/nfs/super.c4
-rw-r--r--fs/partitions/check.c12
-rw-r--r--include/linux/blkdev.h4
-rw-r--r--include/linux/genhd.h21
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/workqueue.h1
-rw-r--r--kernel/lockdep.c20
-rw-r--r--kernel/sched.c13
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace_events_filter.c3
-rw-r--r--kernel/workqueue.c18
-rw-r--r--mm/backing-dev.c2
-rw-r--r--mm/page-writeback.c3
-rw-r--r--mm/percpu.c5
-rw-r--r--scripts/Kbuild.include2
-rw-r--r--scripts/Makefile.lib2
-rwxr-xr-xscripts/checkkconfigsymbols.sh4
-rw-r--r--scripts/headers_install.pl2
-rwxr-xr-xscripts/mkcompile_h12
-rw-r--r--scripts/package/Makefile11
-rwxr-xr-xscripts/package/mkspec2
-rw-r--r--sound/arm/aaci.c1
-rw-r--r--sound/pci/bt87x.c2
-rw-r--r--sound/pci/hda/patch_nvhdmi.c31
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c29
-rw-r--r--sound/pci/ice1712/amp.c8
-rw-r--r--sound/pci/ice1712/ice1724.c2
-rw-r--r--tools/perf/Makefile21
-rw-r--r--tools/perf/builtin-sched.c4
-rw-r--r--tools/perf/util/parse-events.c5
-rw-r--r--tools/perf/util/trace-event-parse.c8
131 files changed, 1304 insertions, 792 deletions
diff --git a/Documentation/debugging-via-ohci1394.txt b/Documentation/debugging-via-ohci1394.txt
index 59a91e5c6909..611f5a5499b1 100644
--- a/Documentation/debugging-via-ohci1394.txt
+++ b/Documentation/debugging-via-ohci1394.txt
@@ -64,14 +64,14 @@ be used to view the printk buffer of a remote machine, even with live update.
64 64
65Bernhard Kaindl enhanced firescope to support accessing 64-bit machines 65Bernhard Kaindl enhanced firescope to support accessing 64-bit machines
66from 32-bit firescope and vice versa: 66from 32-bit firescope and vice versa:
67- ftp://ftp.suse.de/private/bk/firewire/tools/firescope-0.2.2.tar.bz2 67- http://halobates.de/firewire/firescope-0.2.2.tar.bz2
68 68
69and he implemented fast system dump (alpha version - read README.txt): 69and he implemented fast system dump (alpha version - read README.txt):
70- ftp://ftp.suse.de/private/bk/firewire/tools/firedump-0.1.tar.bz2 70- http://halobates.de/firewire/firedump-0.1.tar.bz2
71 71
72There is also a gdb proxy for firewire which allows to use gdb to access 72There is also a gdb proxy for firewire which allows to use gdb to access
73data which can be referenced from symbols found by gdb in vmlinux: 73data which can be referenced from symbols found by gdb in vmlinux:
74- ftp://ftp.suse.de/private/bk/firewire/tools/fireproxy-0.33.tar.bz2 74- http://halobates.de/firewire/fireproxy-0.33.tar.bz2
75 75
76The latest version of this gdb proxy (fireproxy-0.34) can communicate (not 76The latest version of this gdb proxy (fireproxy-0.34) can communicate (not
77yet stable) with kgdb over an memory-based communication module (kgdbom). 77yet stable) with kgdb over an memory-based communication module (kgdbom).
@@ -178,7 +178,7 @@ Step-by-step instructions for using firescope with early OHCI initialization:
178 178
179Notes 179Notes
180----- 180-----
181Documentation and specifications: ftp://ftp.suse.de/private/bk/firewire/docs 181Documentation and specifications: http://halobates.de/firewire/
182 182
183FireWire is a trademark of Apple Inc. - for more information please refer to: 183FireWire is a trademark of Apple Inc. - for more information please refer to:
184http://en.wikipedia.org/wiki/FireWire 184http://en.wikipedia.org/wiki/FireWire
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 89a47b5aff07..04e6c819b28a 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -451,3 +451,33 @@ Why: OSS sound_core grabs all legacy minors (0-255) of SOUND_MAJOR
451 will also allow making ALSA OSS emulation independent of 451 will also allow making ALSA OSS emulation independent of
452 sound_core. The dependency will be broken then too. 452 sound_core. The dependency will be broken then too.
453Who: Tejun Heo <tj@kernel.org> 453Who: Tejun Heo <tj@kernel.org>
454
455----------------------------
456
457What: Support for VMware's guest paravirtuliazation technique [VMI] will be
458 dropped.
459When: 2.6.37 or earlier.
460Why: With the recent innovations in CPU hardware acceleration technologies
461 from Intel and AMD, VMware ran a few experiments to compare these
462 techniques to guest paravirtualization technique on VMware's platform.
463 These hardware assisted virtualization techniques have outperformed the
464 performance benefits provided by VMI in most of the workloads. VMware
465 expects that these hardware features will be ubiquitous in a couple of
466 years, as a result, VMware has started a phased retirement of this
467 feature from the hypervisor. We will be removing this feature from the
468 Kernel too. Right now we are targeting 2.6.37 but can retire earlier if
469 technical reasons (read opportunity to remove major chunk of pvops)
470 arise.
471
472 Please note that VMI has always been an optimization and non-VMI kernels
473 still work fine on VMware's platform.
474 Latest versions of VMware's product which support VMI are,
475 Workstation 7.0 and VSphere 4.0 on ESX side, future maintainence
476 releases for these products will continue supporting VMI.
477
478 For more details about VMI retirement take a look at this,
479 http://blogs.vmware.com/guestosguide/2009/09/vmi-retirement.html
480
481Who: Alok N Kataria <akataria@vmware.com>
482
483----------------------------
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt
index 570f9bd9be2b..05d5cf1d743f 100644
--- a/Documentation/filesystems/ext3.txt
+++ b/Documentation/filesystems/ext3.txt
@@ -123,10 +123,18 @@ resuid=n The user ID which may use the reserved blocks.
123 123
124sb=n Use alternate superblock at this location. 124sb=n Use alternate superblock at this location.
125 125
126quota 126quota These options are ignored by the filesystem. They
127noquota 127noquota are used only by quota tools to recognize volumes
128grpquota 128grpquota where quota should be turned on. See documentation
129usrquota 129usrquota in the quota-tools package for more details
130 (http://sourceforge.net/projects/linuxquota).
131
132jqfmt=<quota type> These options tell filesystem details about quota
133usrjquota=<file> so that quota information can be properly updated
134grpjquota=<file> during journal replay. They replace the above
135 quota options. See documentation in the quota-tools
136 package for more details
137 (http://sourceforge.net/projects/linuxquota).
130 138
131bh (*) ext3 associates buffer heads to data pages to 139bh (*) ext3 associates buffer heads to data pages to
132nobh (a) cache disk block mapping information 140nobh (a) cache disk block mapping information
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 75fddb40f416..4c7f9aee5c4e 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -359,6 +359,7 @@ STAC9227/9228/9229/927x
359 5stack-no-fp D965 5stack without front panel 359 5stack-no-fp D965 5stack without front panel
360 dell-3stack Dell Dimension E520 360 dell-3stack Dell Dimension E520
361 dell-bios Fixes with Dell BIOS setup 361 dell-bios Fixes with Dell BIOS setup
362 volknob Fixes with volume-knob widget 0x24
362 auto BIOS setup (default) 363 auto BIOS setup (default)
363 364
364STAC92HD71B* 365STAC92HD71B*
diff --git a/MAINTAINERS b/MAINTAINERS
index 69e31aab1308..d5eb8c13ef05 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -577,6 +577,11 @@ M: Mike Rapoport <mike@compulab.co.il>
577L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 577L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
578S: Maintained 578S: Maintained
579 579
580ARM/CONTEC MICRO9 MACHINE SUPPORT
581M: Hubert Feurstein <hubert.feurstein@contec.at>
582S: Maintained
583F: arch/arm/mach-ep93xx/micro9.c
584
580ARM/CORGI MACHINE SUPPORT 585ARM/CORGI MACHINE SUPPORT
581M: Richard Purdie <rpurdie@rpsys.net> 586M: Richard Purdie <rpurdie@rpsys.net>
582S: Maintained 587S: Maintained
@@ -2610,6 +2615,7 @@ L: linux1394-devel@lists.sourceforge.net
2610W: http://www.linux1394.org/ 2615W: http://www.linux1394.org/
2611T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git 2616T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
2612S: Maintained 2617S: Maintained
2618F: Documentation/debugging-via-ohci1394.txt
2613F: drivers/ieee1394/ 2619F: drivers/ieee1394/
2614 2620
2615IEEE 1394 RAW I/O DRIVER 2621IEEE 1394 RAW I/O DRIVER
@@ -4071,6 +4077,13 @@ M: Peter Zijlstra <a.p.zijlstra@chello.nl>
4071M: Paul Mackerras <paulus@samba.org> 4077M: Paul Mackerras <paulus@samba.org>
4072M: Ingo Molnar <mingo@elte.hu> 4078M: Ingo Molnar <mingo@elte.hu>
4073S: Supported 4079S: Supported
4080F: kernel/perf_event.c
4081F: include/linux/perf_event.h
4082F: arch/*/*/kernel/perf_event.c
4083F: arch/*/include/asm/perf_event.h
4084F: arch/*/lib/perf_event.c
4085F: arch/*/kernel/perf_callchain.c
4086F: tools/perf/
4074 4087
4075PERSONALITY HANDLING 4088PERSONALITY HANDLING
4076M: Christoph Hellwig <hch@infradead.org> 4089M: Christoph Hellwig <hch@infradead.org>
diff --git a/Makefile b/Makefile
index 927d7a32ed9e..326791575b0a 100644
--- a/Makefile
+++ b/Makefile
@@ -179,46 +179,9 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
179# Alternatively CROSS_COMPILE can be set in the environment. 179# Alternatively CROSS_COMPILE can be set in the environment.
180# Default value for CROSS_COMPILE is not to prefix executables 180# Default value for CROSS_COMPILE is not to prefix executables
181# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 181# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
182#
183# To force ARCH and CROSS_COMPILE settings include kernel.* files
184# in the kernel tree - do not patch this file.
185export KBUILD_BUILDHOST := $(SUBARCH) 182export KBUILD_BUILDHOST := $(SUBARCH)
186 183ARCH ?= $(SUBARCH)
187# Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files. 184CROSS_COMPILE ?=
188# Restore these settings and check that user did not specify
189# conflicting values.
190
191saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null)
192saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null)
193
194ifneq ($(CROSS_COMPILE),)
195 ifneq ($(saved_cross),)
196 ifneq ($(CROSS_COMPILE),$(saved_cross))
197 $(error CROSS_COMPILE changed from \
198 "$(saved_cross)" to \
199 to "$(CROSS_COMPILE)". \
200 Use "make mrproper" to fix it up)
201 endif
202 endif
203else
204 CROSS_COMPILE := $(saved_cross)
205endif
206
207ifneq ($(ARCH),)
208 ifneq ($(saved_arch),)
209 ifneq ($(saved_arch),$(ARCH))
210 $(error ARCH changed from \
211 "$(saved_arch)" to "$(ARCH)". \
212 Use "make mrproper" to fix it up)
213 endif
214 endif
215else
216 ifneq ($(saved_arch),)
217 ARCH := $(saved_arch)
218 else
219 ARCH := $(SUBARCH)
220 endif
221endif
222 185
223# Architecture as present in compile.h 186# Architecture as present in compile.h
224UTS_MACHINE := $(ARCH) 187UTS_MACHINE := $(ARCH)
@@ -483,11 +446,6 @@ ifeq ($(config-targets),1)
483include $(srctree)/arch/$(SRCARCH)/Makefile 446include $(srctree)/arch/$(SRCARCH)/Makefile
484export KBUILD_DEFCONFIG KBUILD_KCONFIG 447export KBUILD_DEFCONFIG KBUILD_KCONFIG
485 448
486# save ARCH & CROSS_COMPILE settings
487$(shell mkdir -p include/generated && \
488 echo $(ARCH) > include/generated/kernel.arch && \
489 echo $(CROSS_COMPILE) > include/generated/kernel.cross)
490
491config: scripts_basic outputmakefile FORCE 449config: scripts_basic outputmakefile FORCE
492 $(Q)mkdir -p include/linux include/config 450 $(Q)mkdir -p include/linux include/config
493 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 451 $(Q)$(MAKE) $(build)=scripts/kconfig $@
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 63a481fbbed4..338ff19ae447 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -84,7 +84,7 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
84 *p = res | mask; 84 *p = res | mask;
85 raw_local_irq_restore(flags); 85 raw_local_irq_restore(flags);
86 86
87 return res & mask; 87 return (res & mask) != 0;
88} 88}
89 89
90static inline int 90static inline int
@@ -101,7 +101,7 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
101 *p = res & ~mask; 101 *p = res & ~mask;
102 raw_local_irq_restore(flags); 102 raw_local_irq_restore(flags);
103 103
104 return res & mask; 104 return (res & mask) != 0;
105} 105}
106 106
107static inline int 107static inline int
@@ -118,7 +118,7 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
118 *p = res ^ mask; 118 *p = res ^ mask;
119 raw_local_irq_restore(flags); 119 raw_local_irq_restore(flags);
120 120
121 return res & mask; 121 return (res & mask) != 0;
122} 122}
123 123
124#include <asm-generic/bitops/non-atomic.h> 124#include <asm-generic/bitops/non-atomic.h>
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 467b69ed1021..f838f36eb702 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -45,21 +45,21 @@ static int __init user_debug_setup(char *str)
45__setup("user_debug=", user_debug_setup); 45__setup("user_debug=", user_debug_setup);
46#endif 46#endif
47 47
48static void dump_mem(const char *str, unsigned long bottom, unsigned long top); 48static void dump_mem(const char *, const char *, unsigned long, unsigned long);
49 49
50void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) 50void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
51{ 51{
52#ifdef CONFIG_KALLSYMS 52#ifdef CONFIG_KALLSYMS
53 printk("[<%08lx>] ", where); 53 char sym1[KSYM_SYMBOL_LEN], sym2[KSYM_SYMBOL_LEN];
54 print_symbol("(%s) ", where); 54 sprint_symbol(sym1, where);
55 printk("from [<%08lx>] ", from); 55 sprint_symbol(sym2, from);
56 print_symbol("(%s)\n", from); 56 printk("[<%08lx>] (%s) from [<%08lx>] (%s)\n", where, sym1, from, sym2);
57#else 57#else
58 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); 58 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
59#endif 59#endif
60 60
61 if (in_exception_text(where)) 61 if (in_exception_text(where))
62 dump_mem("Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); 62 dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs));
63} 63}
64 64
65#ifndef CONFIG_ARM_UNWIND 65#ifndef CONFIG_ARM_UNWIND
@@ -81,9 +81,10 @@ static int verify_stack(unsigned long sp)
81/* 81/*
82 * Dump out the contents of some memory nicely... 82 * Dump out the contents of some memory nicely...
83 */ 83 */
84static void dump_mem(const char *str, unsigned long bottom, unsigned long top) 84static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
85 unsigned long top)
85{ 86{
86 unsigned long p = bottom & ~31; 87 unsigned long first;
87 mm_segment_t fs; 88 mm_segment_t fs;
88 int i; 89 int i;
89 90
@@ -95,33 +96,37 @@ static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
95 fs = get_fs(); 96 fs = get_fs();
96 set_fs(KERNEL_DS); 97 set_fs(KERNEL_DS);
97 98
98 printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top); 99 printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top);
99 100
100 for (p = bottom & ~31; p < top;) { 101 for (first = bottom & ~31; first < top; first += 32) {
101 printk("%04lx: ", p & 0xffff); 102 unsigned long p;
103 char str[sizeof(" 12345678") * 8 + 1];
102 104
103 for (i = 0; i < 8; i++, p += 4) { 105 memset(str, ' ', sizeof(str));
104 unsigned int val; 106 str[sizeof(str) - 1] = '\0';
105 107
106 if (p < bottom || p >= top) 108 for (p = first, i = 0; i < 8 && p < top; i++, p += 4) {
107 printk(" "); 109 if (p >= bottom && p < top) {
108 else { 110 unsigned long val;
109 __get_user(val, (unsigned long *)p); 111 if (__get_user(val, (unsigned long *)p) == 0)
110 printk("%08x ", val); 112 sprintf(str + i * 9, " %08lx", val);
113 else
114 sprintf(str + i * 9, " ????????");
111 } 115 }
112 } 116 }
113 printk ("\n"); 117 printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
114 } 118 }
115 119
116 set_fs(fs); 120 set_fs(fs);
117} 121}
118 122
119static void dump_instr(struct pt_regs *regs) 123static void dump_instr(const char *lvl, struct pt_regs *regs)
120{ 124{
121 unsigned long addr = instruction_pointer(regs); 125 unsigned long addr = instruction_pointer(regs);
122 const int thumb = thumb_mode(regs); 126 const int thumb = thumb_mode(regs);
123 const int width = thumb ? 4 : 8; 127 const int width = thumb ? 4 : 8;
124 mm_segment_t fs; 128 mm_segment_t fs;
129 char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
125 int i; 130 int i;
126 131
127 /* 132 /*
@@ -132,7 +137,6 @@ static void dump_instr(struct pt_regs *regs)
132 fs = get_fs(); 137 fs = get_fs();
133 set_fs(KERNEL_DS); 138 set_fs(KERNEL_DS);
134 139
135 printk("Code: ");
136 for (i = -4; i < 1; i++) { 140 for (i = -4; i < 1; i++) {
137 unsigned int val, bad; 141 unsigned int val, bad;
138 142
@@ -142,13 +146,14 @@ static void dump_instr(struct pt_regs *regs)
142 bad = __get_user(val, &((u32 *)addr)[i]); 146 bad = __get_user(val, &((u32 *)addr)[i]);
143 147
144 if (!bad) 148 if (!bad)
145 printk(i == 0 ? "(%0*x) " : "%0*x ", width, val); 149 p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
150 width, val);
146 else { 151 else {
147 printk("bad PC value."); 152 p += sprintf(p, "bad PC value");
148 break; 153 break;
149 } 154 }
150 } 155 }
151 printk("\n"); 156 printk("%sCode: %s\n", lvl, str);
152 157
153 set_fs(fs); 158 set_fs(fs);
154} 159}
@@ -224,18 +229,19 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
224 struct task_struct *tsk = thread->task; 229 struct task_struct *tsk = thread->task;
225 static int die_counter; 230 static int die_counter;
226 231
227 printk("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", 232 printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
228 str, err, ++die_counter); 233 str, err, ++die_counter);
234 sysfs_printk_last_file();
229 print_modules(); 235 print_modules();
230 __show_regs(regs); 236 __show_regs(regs);
231 printk("Process %s (pid: %d, stack limit = 0x%p)\n", 237 printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n",
232 tsk->comm, task_pid_nr(tsk), thread + 1); 238 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1);
233 239
234 if (!user_mode(regs) || in_interrupt()) { 240 if (!user_mode(regs) || in_interrupt()) {
235 dump_mem("Stack: ", regs->ARM_sp, 241 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp,
236 THREAD_SIZE + (unsigned long)task_stack_page(tsk)); 242 THREAD_SIZE + (unsigned long)task_stack_page(tsk));
237 dump_backtrace(regs, tsk); 243 dump_backtrace(regs, tsk);
238 dump_instr(regs); 244 dump_instr(KERN_EMERG, regs);
239 } 245 }
240} 246}
241 247
@@ -250,13 +256,14 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
250 256
251 oops_enter(); 257 oops_enter();
252 258
253 console_verbose();
254 spin_lock_irq(&die_lock); 259 spin_lock_irq(&die_lock);
260 console_verbose();
255 bust_spinlocks(1); 261 bust_spinlocks(1);
256 __die(str, err, thread, regs); 262 __die(str, err, thread, regs);
257 bust_spinlocks(0); 263 bust_spinlocks(0);
258 add_taint(TAINT_DIE); 264 add_taint(TAINT_DIE);
259 spin_unlock_irq(&die_lock); 265 spin_unlock_irq(&die_lock);
266 oops_exit();
260 267
261 if (in_interrupt()) 268 if (in_interrupt())
262 panic("Fatal exception in interrupt"); 269 panic("Fatal exception in interrupt");
@@ -264,7 +271,6 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
264 if (panic_on_oops) 271 if (panic_on_oops)
265 panic("Fatal exception"); 272 panic("Fatal exception");
266 273
267 oops_exit();
268 do_exit(SIGSEGV); 274 do_exit(SIGSEGV);
269} 275}
270 276
@@ -349,7 +355,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
349 if (user_debug & UDBG_UNDEFINED) { 355 if (user_debug & UDBG_UNDEFINED) {
350 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", 356 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
351 current->comm, task_pid_nr(current), pc); 357 current->comm, task_pid_nr(current), pc);
352 dump_instr(regs); 358 dump_instr(KERN_INFO, regs);
353 } 359 }
354#endif 360#endif
355 361
@@ -400,7 +406,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
400 if (user_debug & UDBG_SYSCALL) { 406 if (user_debug & UDBG_SYSCALL) {
401 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", 407 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
402 task_pid_nr(current), current->comm, n); 408 task_pid_nr(current), current->comm, n);
403 dump_instr(regs); 409 dump_instr(KERN_ERR, regs);
404 } 410 }
405#endif 411#endif
406 412
@@ -579,7 +585,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
579 if (user_debug & UDBG_SYSCALL) { 585 if (user_debug & UDBG_SYSCALL) {
580 printk("[%d] %s: arm syscall %d\n", 586 printk("[%d] %s: arm syscall %d\n",
581 task_pid_nr(current), current->comm, no); 587 task_pid_nr(current), current->comm, no);
582 dump_instr(regs); 588 dump_instr("", regs);
583 if (user_mode(regs)) { 589 if (user_mode(regs)) {
584 __show_regs(regs); 590 __show_regs(regs);
585 c_backtrace(regs->ARM_fp, processor_mode(regs)); 591 c_backtrace(regs->ARM_fp, processor_mode(regs));
@@ -656,7 +662,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
656 if (user_debug & UDBG_BADABORT) { 662 if (user_debug & UDBG_BADABORT) {
657 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", 663 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
658 task_pid_nr(current), current->comm, code, instr); 664 task_pid_nr(current), current->comm, code, instr);
659 dump_instr(regs); 665 dump_instr(KERN_ERR, regs);
660 show_pte(current->mm, addr); 666 show_pte(current->mm, addr);
661 } 667 }
662#endif 668#endif
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 4b4f69251b31..e590bbe0a7b4 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -271,12 +271,12 @@ static struct irqaction bcmring_timer_irq = {
271 .handler = bcmring_timer_interrupt, 271 .handler = bcmring_timer_interrupt,
272}; 272};
273 273
274static cycle_t bcmring_get_cycles_timer1(void) 274static cycle_t bcmring_get_cycles_timer1(struct clocksource *cs)
275{ 275{
276 return ~readl(TIMER1_VA_BASE + TIMER_VALUE); 276 return ~readl(TIMER1_VA_BASE + TIMER_VALUE);
277} 277}
278 278
279static cycle_t bcmring_get_cycles_timer3(void) 279static cycle_t bcmring_get_cycles_timer3(struct clocksource *cs)
280{ 280{
281 return ~readl(TIMER3_VA_BASE + TIMER_VALUE); 281 return ~readl(TIMER3_VA_BASE + TIMER_VALUE);
282} 282}
diff --git a/arch/arm/mach-bcmring/include/mach/system.h b/arch/arm/mach-bcmring/include/mach/system.h
index cdbf93c694a6..38b37060d426 100644
--- a/arch/arm/mach-bcmring/include/mach/system.h
+++ b/arch/arm/mach-bcmring/include/mach/system.h
@@ -29,7 +29,7 @@ static inline void arch_idle(void)
29 cpu_do_idle(); 29 cpu_do_idle();
30} 30}
31 31
32static inline void arch_reset(char mode, char *cmd) 32static inline void arch_reset(char mode, const char *cmd)
33{ 33{
34 printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot); 34 printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot);
35 35
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index d7291c682a64..9167c3d2a5ed 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -17,13 +17,31 @@ config EP93XX_SDCE3_SYNC_PHYS_OFFSET
17 bool "0x00000000 - SDCE3/SyncBoot" 17 bool "0x00000000 - SDCE3/SyncBoot"
18 help 18 help
19 Select this option if you want support for EP93xx boards with the 19 Select this option if you want support for EP93xx boards with the
20 first SDRAM bank at 0x00000000 20 first SDRAM bank at 0x00000000.
21 21
22config EP93XX_SDCE0_PHYS_OFFSET 22config EP93XX_SDCE0_PHYS_OFFSET
23 bool "0xc0000000 - SDCEO" 23 bool "0xc0000000 - SDCEO"
24 help 24 help
25 Select this option if you want support for EP93xx boards with the 25 Select this option if you want support for EP93xx boards with the
26 first SDRAM bank at 0xc0000000 26 first SDRAM bank at 0xc0000000.
27
28config EP93XX_SDCE1_PHYS_OFFSET
29 bool "0xd0000000 - SDCE1"
30 help
31 Select this option if you want support for EP93xx boards with the
32 first SDRAM bank at 0xd0000000.
33
34config EP93XX_SDCE2_PHYS_OFFSET
35 bool "0xe0000000 - SDCE2"
36 help
37 Select this option if you want support for EP93xx boards with the
38 first SDRAM bank at 0xe0000000.
39
40config EP93XX_SDCE3_ASYNC_PHYS_OFFSET
41 bool "0xf0000000 - SDCE3/AsyncBoot"
42 help
43 Select this option if you want support for EP93xx boards with the
44 first SDRAM bank at 0xf0000000.
27 45
28endchoice 46endchoice
29 47
@@ -112,28 +130,36 @@ config MACH_MICRO9
112 bool 130 bool
113 131
114config MACH_MICRO9H 132config MACH_MICRO9H
115 bool "Support Contec Hypercontrol Micro9-H" 133 bool "Support Contec Micro9-High"
116 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET 134 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
117 select MACH_MICRO9 135 select MACH_MICRO9
118 help 136 help
119 Say 'Y' here if you want your kernel to support the 137 Say 'Y' here if you want your kernel to support the
120 Contec Hypercontrol Micro9-H board. 138 Contec Micro9-High board.
121 139
122config MACH_MICRO9M 140config MACH_MICRO9M
123 bool "Support Contec Hypercontrol Micro9-M" 141 bool "Support Contec Micro9-Mid"
124 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET 142 depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET
125 select MACH_MICRO9 143 select MACH_MICRO9
126 help 144 help
127 Say 'Y' here if you want your kernel to support the 145 Say 'Y' here if you want your kernel to support the
128 Contec Hypercontrol Micro9-M board. 146 Contec Micro9-Mid board.
129 147
130config MACH_MICRO9L 148config MACH_MICRO9L
131 bool "Support Contec Hypercontrol Micro9-L" 149 bool "Support Contec Micro9-Lite"
132 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET 150 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
133 select MACH_MICRO9 151 select MACH_MICRO9
134 help 152 help
135 Say 'Y' here if you want your kernel to support the 153 Say 'Y' here if you want your kernel to support the
136 Contec Hypercontrol Micro9-L board. 154 Contec Micro9-Lite board.
155
156config MACH_MICRO9S
157 bool "Support Contec Micro9-Slim"
158 depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET
159 select MACH_MICRO9
160 help
161 Say 'Y' here if you want your kernel to support the
162 Contec Micro9-Slim board.
137 163
138config MACH_TS72XX 164config MACH_TS72XX
139 bool "Support Technologic Systems TS-72xx SBC" 165 bool "Support Technologic Systems TS-72xx SBC"
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot
index 27a085a8f12a..0ad33f15c622 100644
--- a/arch/arm/mach-ep93xx/Makefile.boot
+++ b/arch/arm/mach-ep93xx/Makefile.boot
@@ -3,3 +3,12 @@ params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100
3 3
4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000
5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100
6
7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0008000
8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100
9
10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0008000
11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100
12
13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0008000
14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index dda19cd76194..1d0f9d8aff2e 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -16,13 +16,16 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/spinlock.h>
20
21#include <mach/hardware.h>
19 22
20#include <asm/clkdev.h> 23#include <asm/clkdev.h>
21#include <asm/div64.h> 24#include <asm/div64.h>
22#include <mach/hardware.h>
23 25
24 26
25struct clk { 27struct clk {
28 struct clk *parent;
26 unsigned long rate; 29 unsigned long rate;
27 int users; 30 int users;
28 int sw_locked; 31 int sw_locked;
@@ -39,40 +42,60 @@ static unsigned long get_uart_rate(struct clk *clk);
39static int set_keytchclk_rate(struct clk *clk, unsigned long rate); 42static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
40static int set_div_rate(struct clk *clk, unsigned long rate); 43static int set_div_rate(struct clk *clk, unsigned long rate);
41 44
45
46static struct clk clk_xtali = {
47 .rate = EP93XX_EXT_CLK_RATE,
48};
42static struct clk clk_uart1 = { 49static struct clk clk_uart1 = {
50 .parent = &clk_xtali,
43 .sw_locked = 1, 51 .sw_locked = 1,
44 .enable_reg = EP93XX_SYSCON_DEVCFG, 52 .enable_reg = EP93XX_SYSCON_DEVCFG,
45 .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN, 53 .enable_mask = EP93XX_SYSCON_DEVCFG_U1EN,
46 .get_rate = get_uart_rate, 54 .get_rate = get_uart_rate,
47}; 55};
48static struct clk clk_uart2 = { 56static struct clk clk_uart2 = {
57 .parent = &clk_xtali,
49 .sw_locked = 1, 58 .sw_locked = 1,
50 .enable_reg = EP93XX_SYSCON_DEVCFG, 59 .enable_reg = EP93XX_SYSCON_DEVCFG,
51 .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN, 60 .enable_mask = EP93XX_SYSCON_DEVCFG_U2EN,
52 .get_rate = get_uart_rate, 61 .get_rate = get_uart_rate,
53}; 62};
54static struct clk clk_uart3 = { 63static struct clk clk_uart3 = {
64 .parent = &clk_xtali,
55 .sw_locked = 1, 65 .sw_locked = 1,
56 .enable_reg = EP93XX_SYSCON_DEVCFG, 66 .enable_reg = EP93XX_SYSCON_DEVCFG,
57 .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN, 67 .enable_mask = EP93XX_SYSCON_DEVCFG_U3EN,
58 .get_rate = get_uart_rate, 68 .get_rate = get_uart_rate,
59}; 69};
60static struct clk clk_pll1; 70static struct clk clk_pll1 = {
61static struct clk clk_f; 71 .parent = &clk_xtali,
62static struct clk clk_h; 72};
63static struct clk clk_p; 73static struct clk clk_f = {
64static struct clk clk_pll2; 74 .parent = &clk_pll1,
75};
76static struct clk clk_h = {
77 .parent = &clk_pll1,
78};
79static struct clk clk_p = {
80 .parent = &clk_pll1,
81};
82static struct clk clk_pll2 = {
83 .parent = &clk_xtali,
84};
65static struct clk clk_usb_host = { 85static struct clk clk_usb_host = {
86 .parent = &clk_pll2,
66 .enable_reg = EP93XX_SYSCON_PWRCNT, 87 .enable_reg = EP93XX_SYSCON_PWRCNT,
67 .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN, 88 .enable_mask = EP93XX_SYSCON_PWRCNT_USH_EN,
68}; 89};
69static struct clk clk_keypad = { 90static struct clk clk_keypad = {
91 .parent = &clk_xtali,
70 .sw_locked = 1, 92 .sw_locked = 1,
71 .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV, 93 .enable_reg = EP93XX_SYSCON_KEYTCHCLKDIV,
72 .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, 94 .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN,
73 .set_rate = set_keytchclk_rate, 95 .set_rate = set_keytchclk_rate,
74}; 96};
75static struct clk clk_pwm = { 97static struct clk clk_pwm = {
98 .parent = &clk_xtali,
76 .rate = EP93XX_EXT_CLK_RATE, 99 .rate = EP93XX_EXT_CLK_RATE,
77}; 100};
78 101
@@ -85,50 +108,62 @@ static struct clk clk_video = {
85 108
86/* DMA Clocks */ 109/* DMA Clocks */
87static struct clk clk_m2p0 = { 110static struct clk clk_m2p0 = {
111 .parent = &clk_h,
88 .enable_reg = EP93XX_SYSCON_PWRCNT, 112 .enable_reg = EP93XX_SYSCON_PWRCNT,
89 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0, 113 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P0,
90}; 114};
91static struct clk clk_m2p1 = { 115static struct clk clk_m2p1 = {
116 .parent = &clk_h,
92 .enable_reg = EP93XX_SYSCON_PWRCNT, 117 .enable_reg = EP93XX_SYSCON_PWRCNT,
93 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1, 118 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P1,
94}; 119};
95static struct clk clk_m2p2 = { 120static struct clk clk_m2p2 = {
121 .parent = &clk_h,
96 .enable_reg = EP93XX_SYSCON_PWRCNT, 122 .enable_reg = EP93XX_SYSCON_PWRCNT,
97 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2, 123 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P2,
98}; 124};
99static struct clk clk_m2p3 = { 125static struct clk clk_m2p3 = {
126 .parent = &clk_h,
100 .enable_reg = EP93XX_SYSCON_PWRCNT, 127 .enable_reg = EP93XX_SYSCON_PWRCNT,
101 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3, 128 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P3,
102}; 129};
103static struct clk clk_m2p4 = { 130static struct clk clk_m2p4 = {
131 .parent = &clk_h,
104 .enable_reg = EP93XX_SYSCON_PWRCNT, 132 .enable_reg = EP93XX_SYSCON_PWRCNT,
105 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4, 133 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P4,
106}; 134};
107static struct clk clk_m2p5 = { 135static struct clk clk_m2p5 = {
136 .parent = &clk_h,
108 .enable_reg = EP93XX_SYSCON_PWRCNT, 137 .enable_reg = EP93XX_SYSCON_PWRCNT,
109 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5, 138 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P5,
110}; 139};
111static struct clk clk_m2p6 = { 140static struct clk clk_m2p6 = {
141 .parent = &clk_h,
112 .enable_reg = EP93XX_SYSCON_PWRCNT, 142 .enable_reg = EP93XX_SYSCON_PWRCNT,
113 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6, 143 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P6,
114}; 144};
115static struct clk clk_m2p7 = { 145static struct clk clk_m2p7 = {
146 .parent = &clk_h,
116 .enable_reg = EP93XX_SYSCON_PWRCNT, 147 .enable_reg = EP93XX_SYSCON_PWRCNT,
117 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7, 148 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P7,
118}; 149};
119static struct clk clk_m2p8 = { 150static struct clk clk_m2p8 = {
151 .parent = &clk_h,
120 .enable_reg = EP93XX_SYSCON_PWRCNT, 152 .enable_reg = EP93XX_SYSCON_PWRCNT,
121 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8, 153 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P8,
122}; 154};
123static struct clk clk_m2p9 = { 155static struct clk clk_m2p9 = {
156 .parent = &clk_h,
124 .enable_reg = EP93XX_SYSCON_PWRCNT, 157 .enable_reg = EP93XX_SYSCON_PWRCNT,
125 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9, 158 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2P9,
126}; 159};
127static struct clk clk_m2m0 = { 160static struct clk clk_m2m0 = {
161 .parent = &clk_h,
128 .enable_reg = EP93XX_SYSCON_PWRCNT, 162 .enable_reg = EP93XX_SYSCON_PWRCNT,
129 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0, 163 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M0,
130}; 164};
131static struct clk clk_m2m1 = { 165static struct clk clk_m2m1 = {
166 .parent = &clk_h,
132 .enable_reg = EP93XX_SYSCON_PWRCNT, 167 .enable_reg = EP93XX_SYSCON_PWRCNT,
133 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1, 168 .enable_mask = EP93XX_SYSCON_PWRCNT_DMA_M2M1,
134}; 169};
@@ -137,6 +172,7 @@ static struct clk clk_m2m1 = {
137 { .dev_id = dev, .con_id = con, .clk = ck } 172 { .dev_id = dev, .con_id = con, .clk = ck }
138 173
139static struct clk_lookup clocks[] = { 174static struct clk_lookup clocks[] = {
175 INIT_CK(NULL, "xtali", &clk_xtali),
140 INIT_CK("apb:uart1", NULL, &clk_uart1), 176 INIT_CK("apb:uart1", NULL, &clk_uart1),
141 INIT_CK("apb:uart2", NULL, &clk_uart2), 177 INIT_CK("apb:uart2", NULL, &clk_uart2),
142 INIT_CK("apb:uart3", NULL, &clk_uart3), 178 INIT_CK("apb:uart3", NULL, &clk_uart3),
@@ -163,48 +199,84 @@ static struct clk_lookup clocks[] = {
163 INIT_CK(NULL, "m2m1", &clk_m2m1), 199 INIT_CK(NULL, "m2m1", &clk_m2m1),
164}; 200};
165 201
202static DEFINE_SPINLOCK(clk_lock);
203
204static void __clk_enable(struct clk *clk)
205{
206 if (!clk->users++) {
207 if (clk->parent)
208 __clk_enable(clk->parent);
209
210 if (clk->enable_reg) {
211 u32 v;
212
213 v = __raw_readl(clk->enable_reg);
214 v |= clk->enable_mask;
215 if (clk->sw_locked)
216 ep93xx_syscon_swlocked_write(v, clk->enable_reg);
217 else
218 __raw_writel(v, clk->enable_reg);
219 }
220 }
221}
166 222
167int clk_enable(struct clk *clk) 223int clk_enable(struct clk *clk)
168{ 224{
169 if (!clk->users++ && clk->enable_reg) { 225 unsigned long flags;
170 u32 value;
171 226
172 value = __raw_readl(clk->enable_reg); 227 if (!clk)
173 value |= clk->enable_mask; 228 return -EINVAL;
174 if (clk->sw_locked) 229
175 ep93xx_syscon_swlocked_write(value, clk->enable_reg); 230 spin_lock_irqsave(&clk_lock, flags);
176 else 231 __clk_enable(clk);
177 __raw_writel(value, clk->enable_reg); 232 spin_unlock_irqrestore(&clk_lock, flags);
178 }
179 233
180 return 0; 234 return 0;
181} 235}
182EXPORT_SYMBOL(clk_enable); 236EXPORT_SYMBOL(clk_enable);
183 237
184void clk_disable(struct clk *clk) 238static void __clk_disable(struct clk *clk)
185{ 239{
186 if (!--clk->users && clk->enable_reg) { 240 if (!--clk->users) {
187 u32 value; 241 if (clk->enable_reg) {
242 u32 v;
243
244 v = __raw_readl(clk->enable_reg);
245 v &= ~clk->enable_mask;
246 if (clk->sw_locked)
247 ep93xx_syscon_swlocked_write(v, clk->enable_reg);
248 else
249 __raw_writel(v, clk->enable_reg);
250 }
188 251
189 value = __raw_readl(clk->enable_reg); 252 if (clk->parent)
190 value &= ~clk->enable_mask; 253 __clk_disable(clk->parent);
191 if (clk->sw_locked)
192 ep93xx_syscon_swlocked_write(value, clk->enable_reg);
193 else
194 __raw_writel(value, clk->enable_reg);
195 } 254 }
196} 255}
256
257void clk_disable(struct clk *clk)
258{
259 unsigned long flags;
260
261 if (!clk)
262 return;
263
264 spin_lock_irqsave(&clk_lock, flags);
265 __clk_disable(clk);
266 spin_unlock_irqrestore(&clk_lock, flags);
267}
197EXPORT_SYMBOL(clk_disable); 268EXPORT_SYMBOL(clk_disable);
198 269
199static unsigned long get_uart_rate(struct clk *clk) 270static unsigned long get_uart_rate(struct clk *clk)
200{ 271{
272 unsigned long rate = clk_get_rate(clk->parent);
201 u32 value; 273 u32 value;
202 274
203 value = __raw_readl(EP93XX_SYSCON_PWRCNT); 275 value = __raw_readl(EP93XX_SYSCON_PWRCNT);
204 if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) 276 if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD)
205 return EP93XX_EXT_CLK_RATE; 277 return rate;
206 else 278 else
207 return EP93XX_EXT_CLK_RATE / 2; 279 return rate / 2;
208} 280}
209 281
210unsigned long clk_get_rate(struct clk *clk) 282unsigned long clk_get_rate(struct clk *clk)
@@ -244,16 +316,16 @@ static int set_keytchclk_rate(struct clk *clk, unsigned long rate)
244 return 0; 316 return 0;
245} 317}
246 318
247static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel, 319static int calc_clk_div(struct clk *clk, unsigned long rate,
248 int *pdiv, int *div) 320 int *psel, int *esel, int *pdiv, int *div)
249{ 321{
250 unsigned long max_rate, best_rate = 0, 322 struct clk *mclk;
251 actual_rate = 0, mclk_rate = 0, rate_err = -1; 323 unsigned long max_rate, actual_rate, mclk_rate, rate_err = -1;
252 int i, found = 0, __div = 0, __pdiv = 0; 324 int i, found = 0, __div = 0, __pdiv = 0;
253 325
254 /* Don't exceed the maximum rate */ 326 /* Don't exceed the maximum rate */
255 max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4), 327 max_rate = max(max(clk_pll1.rate / 4, clk_pll2.rate / 4),
256 (unsigned long)EP93XX_EXT_CLK_RATE / 4); 328 clk_xtali.rate / 4);
257 rate = min(rate, max_rate); 329 rate = min(rate, max_rate);
258 330
259 /* 331 /*
@@ -267,11 +339,12 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel,
267 */ 339 */
268 for (i = 0; i < 3; i++) { 340 for (i = 0; i < 3; i++) {
269 if (i == 0) 341 if (i == 0)
270 mclk_rate = EP93XX_EXT_CLK_RATE * 2; 342 mclk = &clk_xtali;
271 else if (i == 1) 343 else if (i == 1)
272 mclk_rate = clk_pll1.rate * 2; 344 mclk = &clk_pll1;
273 else if (i == 2) 345 else
274 mclk_rate = clk_pll2.rate * 2; 346 mclk = &clk_pll2;
347 mclk_rate = mclk->rate * 2;
275 348
276 /* Try each predivider value */ 349 /* Try each predivider value */
277 for (__pdiv = 4; __pdiv <= 6; __pdiv++) { 350 for (__pdiv = 4; __pdiv <= 6; __pdiv++) {
@@ -286,7 +359,8 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel,
286 *div = __div; 359 *div = __div;
287 *psel = (i == 2); 360 *psel = (i == 2);
288 *esel = (i != 0); 361 *esel = (i != 0);
289 best_rate = actual_rate; 362 clk->parent = mclk;
363 clk->rate = actual_rate;
290 rate_err = abs(actual_rate - rate); 364 rate_err = abs(actual_rate - rate);
291 found = 1; 365 found = 1;
292 } 366 }
@@ -294,21 +368,19 @@ static unsigned long calc_clk_div(unsigned long rate, int *psel, int *esel,
294 } 368 }
295 369
296 if (!found) 370 if (!found)
297 return 0; 371 return -EINVAL;
298 372
299 return best_rate; 373 return 0;
300} 374}
301 375
302static int set_div_rate(struct clk *clk, unsigned long rate) 376static int set_div_rate(struct clk *clk, unsigned long rate)
303{ 377{
304 unsigned long actual_rate; 378 int err, psel = 0, esel = 0, pdiv = 0, div = 0;
305 int psel = 0, esel = 0, pdiv = 0, div = 0;
306 u32 val; 379 u32 val;
307 380
308 actual_rate = calc_clk_div(rate, &psel, &esel, &pdiv, &div); 381 err = calc_clk_div(clk, rate, &psel, &esel, &pdiv, &div);
309 if (actual_rate == 0) 382 if (err)
310 return -EINVAL; 383 return err;
311 clk->rate = actual_rate;
312 384
313 /* Clear the esel, psel, pdiv and div bits */ 385 /* Clear the esel, psel, pdiv and div bits */
314 val = __raw_readl(clk->enable_reg); 386 val = __raw_readl(clk->enable_reg);
@@ -344,7 +416,7 @@ static unsigned long calc_pll_rate(u32 config_word)
344 unsigned long long rate; 416 unsigned long long rate;
345 int i; 417 int i;
346 418
347 rate = EP93XX_EXT_CLK_RATE; 419 rate = clk_xtali.rate;
348 rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ 420 rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */
349 rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ 421 rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */
350 do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ 422 do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */
@@ -377,7 +449,7 @@ static int __init ep93xx_clock_init(void)
377 449
378 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1); 450 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET1);
379 if (!(value & 0x00800000)) { /* PLL1 bypassed? */ 451 if (!(value & 0x00800000)) { /* PLL1 bypassed? */
380 clk_pll1.rate = EP93XX_EXT_CLK_RATE; 452 clk_pll1.rate = clk_xtali.rate;
381 } else { 453 } else {
382 clk_pll1.rate = calc_pll_rate(value); 454 clk_pll1.rate = calc_pll_rate(value);
383 } 455 }
@@ -388,7 +460,7 @@ static int __init ep93xx_clock_init(void)
388 460
389 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2); 461 value = __raw_readl(EP93XX_SYSCON_CLOCK_SET2);
390 if (!(value & 0x00080000)) { /* PLL2 bypassed? */ 462 if (!(value & 0x00080000)) { /* PLL2 bypassed? */
391 clk_pll2.rate = EP93XX_EXT_CLK_RATE; 463 clk_pll2.rate = clk_xtali.rate;
392 } else if (value & 0x00040000) { /* PLL2 enabled? */ 464 } else if (value & 0x00040000) { /* PLL2 enabled? */
393 clk_pll2.rate = calc_pll_rate(value); 465 clk_pll2.rate = calc_pll_rate(value);
394 } else { 466 } else {
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index f7ebed942f66..f95dc160c34b 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -550,13 +550,11 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr)
550 platform_device_register(&ep93xx_eth_device); 550 platform_device_register(&ep93xx_eth_device);
551} 551}
552 552
553static struct i2c_gpio_platform_data ep93xx_i2c_data = { 553
554 .sda_pin = EP93XX_GPIO_LINE_EEDAT, 554/*************************************************************************
555 .sda_is_open_drain = 0, 555 * EP93xx i2c peripheral handling
556 .scl_pin = EP93XX_GPIO_LINE_EECLK, 556 *************************************************************************/
557 .scl_is_open_drain = 0, 557static struct i2c_gpio_platform_data ep93xx_i2c_data;
558 .udelay = 2,
559};
560 558
561static struct platform_device ep93xx_i2c_device = { 559static struct platform_device ep93xx_i2c_device = {
562 .name = "i2c-gpio", 560 .name = "i2c-gpio",
@@ -564,8 +562,25 @@ static struct platform_device ep93xx_i2c_device = {
564 .dev.platform_data = &ep93xx_i2c_data, 562 .dev.platform_data = &ep93xx_i2c_data,
565}; 563};
566 564
567void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num) 565void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
566 struct i2c_board_info *devices, int num)
568{ 567{
568 /*
569 * Set the EEPROM interface pin drive type control.
570 * Defines the driver type for the EECLK and EEDAT pins as either
571 * open drain, which will require an external pull-up, or a normal
572 * CMOS driver.
573 */
574 if (data->sda_is_open_drain && data->sda_pin != EP93XX_GPIO_LINE_EEDAT)
575 pr_warning("ep93xx: sda != EEDAT, open drain has no effect\n");
576 if (data->scl_is_open_drain && data->scl_pin != EP93XX_GPIO_LINE_EECLK)
577 pr_warning("ep93xx: scl != EECLK, open drain has no effect\n");
578
579 __raw_writel((data->sda_is_open_drain << 1) |
580 (data->scl_is_open_drain << 0),
581 EP93XX_GPIO_EEDRIVE);
582
583 ep93xx_i2c_data = *data;
569 i2c_register_board_info(0, devices, num); 584 i2c_register_board_info(0, devices, num);
570 platform_device_register(&ep93xx_i2c_device); 585 platform_device_register(&ep93xx_i2c_device);
571} 586}
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 73145ae5d3fa..ca71cf1a72a0 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -27,8 +27,10 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/i2c.h>
31#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31#include <linux/gpio.h>
32#include <linux/i2c.h>
33#include <linux/i2c-gpio.h>
32 34
33#include <mach/hardware.h> 35#include <mach/hardware.h>
34 36
@@ -76,13 +78,26 @@ static struct ep93xx_eth_data edb93xx_eth_data = {
76 .phy_id = 1, 78 .phy_id = 1,
77}; 79};
78 80
79static struct i2c_board_info __initdata edb93xxa_i2c_data[] = { 81
82/*************************************************************************
83 * EDB93xx i2c peripheral handling
84 *************************************************************************/
85static struct i2c_gpio_platform_data edb93xx_i2c_gpio_data = {
86 .sda_pin = EP93XX_GPIO_LINE_EEDAT,
87 .sda_is_open_drain = 0,
88 .scl_pin = EP93XX_GPIO_LINE_EECLK,
89 .scl_is_open_drain = 0,
90 .udelay = 0, /* default to 100 kHz */
91 .timeout = 0, /* default to 100 ms */
92};
93
94static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
80 { 95 {
81 I2C_BOARD_INFO("isl1208", 0x6f), 96 I2C_BOARD_INFO("isl1208", 0x6f),
82 }, 97 },
83}; 98};
84 99
85static struct i2c_board_info __initdata edb93xx_i2c_data[] = { 100static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
86 { 101 {
87 I2C_BOARD_INFO("ds1337", 0x68), 102 I2C_BOARD_INFO("ds1337", 0x68),
88 }, 103 },
@@ -92,12 +107,14 @@ static void __init edb93xx_register_i2c(void)
92{ 107{
93 if (machine_is_edb9302a() || machine_is_edb9307a() || 108 if (machine_is_edb9302a() || machine_is_edb9307a() ||
94 machine_is_edb9315a()) { 109 machine_is_edb9315a()) {
95 ep93xx_register_i2c(edb93xxa_i2c_data, 110 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
96 ARRAY_SIZE(edb93xxa_i2c_data)); 111 edb93xxa_i2c_board_info,
112 ARRAY_SIZE(edb93xxa_i2c_board_info));
97 } else if (machine_is_edb9307() || machine_is_edb9312() || 113 } else if (machine_is_edb9307() || machine_is_edb9312() ||
98 machine_is_edb9315()) { 114 machine_is_edb9315()) {
99 ep93xx_register_i2c(edb93xx_i2c_data, 115 ep93xx_register_i2c(&edb93xx_i2c_gpio_data
100 ARRAY_SIZE(edb93xx_i2c_data)); 116 edb93xx_i2c_board_info,
117 ARRAY_SIZE(edb93xx_i2c_board_info));
101 } 118 }
102} 119}
103 120
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
index 0fbf87b16338..b1f937eda29c 100644
--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
+++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
@@ -52,25 +52,27 @@
52#define EP93XX_AHB_VIRT_BASE 0xfef00000 52#define EP93XX_AHB_VIRT_BASE 0xfef00000
53#define EP93XX_AHB_SIZE 0x00100000 53#define EP93XX_AHB_SIZE 0x00100000
54 54
55#define EP93XX_AHB_PHYS(x) (EP93XX_AHB_PHYS_BASE + (x))
55#define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) 56#define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x))
56 57
57#define EP93XX_APB_PHYS_BASE 0x80800000 58#define EP93XX_APB_PHYS_BASE 0x80800000
58#define EP93XX_APB_VIRT_BASE 0xfed00000 59#define EP93XX_APB_VIRT_BASE 0xfed00000
59#define EP93XX_APB_SIZE 0x00200000 60#define EP93XX_APB_SIZE 0x00200000
60 61
62#define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x))
61#define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) 63#define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x))
62 64
63 65
64/* AHB peripherals */ 66/* AHB peripherals */
65#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) 67#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000)
66 68
67#define EP93XX_ETHERNET_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00010000) 69#define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000)
68#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) 70#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000)
69 71
70#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000) 72#define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000)
71#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) 73#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000)
72 74
73#define EP93XX_RASTER_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00030000) 75#define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000)
74#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) 76#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000)
75 77
76#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) 78#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000)
@@ -112,21 +114,10 @@
112 114
113#define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) 115#define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000)
114#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) 116#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
115#define EP93XX_GPIO_F_INT_TYPE1 EP93XX_GPIO_REG(0x4c)
116#define EP93XX_GPIO_F_INT_TYPE2 EP93XX_GPIO_REG(0x50)
117#define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54)
118#define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58)
119#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) 117#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c)
120#define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90)
121#define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94)
122#define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98)
123#define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c)
124#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) 118#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0)
125#define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac)
126#define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0)
127#define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4)
128#define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8)
129#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) 119#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc)
120#define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8)
130 121
131#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) 122#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000)
132 123
@@ -134,13 +125,13 @@
134 125
135#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) 126#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000)
136 127
137#define EP93XX_UART1_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000c0000) 128#define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000)
138#define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) 129#define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000)
139 130
140#define EP93XX_UART2_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000d0000) 131#define EP93XX_UART2_PHYS_BASE EP93XX_APB_PHYS(0x000d0000)
141#define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) 132#define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000)
142 133
143#define EP93XX_UART3_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000e0000) 134#define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000)
144#define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) 135#define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000)
145 136
146#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) 137#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000)
@@ -148,10 +139,10 @@
148#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) 139#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000)
149#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) 140#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000)
150 141
151#define EP93XX_PWM_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00110000) 142#define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000)
152#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) 143#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000)
153 144
154#define EP93XX_RTC_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x00120000) 145#define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000)
155#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) 146#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000)
156 147
157#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) 148#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000)
@@ -218,6 +209,17 @@
218#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) 209#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16)
219#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15) 210#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN (1<<15)
220#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) 211#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0)
212#define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c)
213#define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000)
214#define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28)
215#define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8)
216#define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7)
217#define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6)
218#define EP93XX_SYSCON_SYSCFG_LASDO (1<<5)
219#define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4)
220#define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3)
221#define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1)
222#define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0)
221#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) 223#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
222 224
223#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) 225#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000)
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h
index 0a1498ae899a..c991b149bdf2 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio.h
@@ -114,17 +114,9 @@ extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable);
114 * B0..B7 (7..15) to irq 72..79, and 114 * B0..B7 (7..15) to irq 72..79, and
115 * F0..F7 (16..24) to irq 80..87. 115 * F0..F7 (16..24) to irq 80..87.
116 */ 116 */
117static inline int gpio_to_irq(unsigned gpio) 117#define gpio_to_irq(gpio) \
118{ 118 (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
119 if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ) 119
120 return 64 + gpio; 120#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
121
122 return -EINVAL;
123}
124
125static inline int irq_to_gpio(unsigned irq)
126{
127 return irq - gpio_to_irq(0);
128}
129 121
130#endif 122#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/memory.h b/arch/arm/mach-ep93xx/include/mach/memory.h
index 925b12ea0990..554064e90307 100644
--- a/arch/arm/mach-ep93xx/include/mach/memory.h
+++ b/arch/arm/mach-ep93xx/include/mach/memory.h
@@ -9,6 +9,12 @@
9#define PHYS_OFFSET UL(0x00000000) 9#define PHYS_OFFSET UL(0x00000000)
10#elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) 10#elif defined(CONFIG_EP93XX_SDCE0_PHYS_OFFSET)
11#define PHYS_OFFSET UL(0xc0000000) 11#define PHYS_OFFSET UL(0xc0000000)
12#elif defined(CONFIG_EP93XX_SDCE1_PHYS_OFFSET)
13#define PHYS_OFFSET UL(0xd0000000)
14#elif defined(CONFIG_EP93XX_SDCE2_PHYS_OFFSET)
15#define PHYS_OFFSET UL(0xe0000000)
16#elif defined(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET)
17#define PHYS_OFFSET UL(0xf0000000)
12#else 18#else
13#error "Kconfig bug: No EP93xx PHYS_OFFSET set" 19#error "Kconfig bug: No EP93xx PHYS_OFFSET set"
14#endif 20#endif
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 01a0f0838e5b..a3ec33fd79d4 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -4,6 +4,7 @@
4 4
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6 6
7struct i2c_gpio_platform_data;
7struct i2c_board_info; 8struct i2c_board_info;
8struct platform_device; 9struct platform_device;
9struct ep93xxfb_mach_info; 10struct ep93xxfb_mach_info;
@@ -33,7 +34,8 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
33} 34}
34 35
35void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 36void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
36void ep93xx_register_i2c(struct i2c_board_info *devices, int num); 37void ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
38 struct i2c_board_info *devices, int num);
37void ep93xx_register_fb(struct ep93xxfb_mach_info *data); 39void ep93xx_register_fb(struct ep93xxfb_mach_info *data);
38void ep93xx_register_pwm(int pwm0, int pwm1); 40void ep93xx_register_pwm(int pwm0, int pwm1);
39int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); 41int ep93xx_pwm_acquire_gpio(struct platform_device *pdev);
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 0a313e82fb74..d83b80478b09 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -2,7 +2,9 @@
2 * linux/arch/arm/mach-ep93xx/micro9.c 2 * linux/arch/arm/mach-ep93xx/micro9.c
3 * 3 *
4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH 4 * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
5 * Manfred Gruber <manfred.gruber@contec.at> 5 * Manfred Gruber <m.gruber@tirol.com>
6 * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
7 * Hubert Feurstein <hubert.feurstein@contec.at>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -20,104 +22,124 @@
20#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
21 23
22 24
23static struct ep93xx_eth_data micro9_eth_data = { 25/*************************************************************************
24 .phy_id = 0x1f, 26 * Micro9 NOR Flash
25}; 27 *
26 28 * Micro9-High has up to 64MB of 32-bit flash on CS1
27static void __init micro9_init(void) 29 * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
28{ 30 * Micro9-Lite uses a seperate MTD map driver for flash support
29 ep93xx_register_eth(&micro9_eth_data, 1); 31 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
30} 32 *************************************************************************/
31 33static struct physmap_flash_data micro9_flash_data;
32/* 34
33 * Micro9-H 35static struct resource micro9_flash_resource = {
34 */
35#ifdef CONFIG_MACH_MICRO9H
36static struct physmap_flash_data micro9h_flash_data = {
37 .width = 4,
38};
39
40static struct resource micro9h_flash_resource = {
41 .start = EP93XX_CS1_PHYS_BASE, 36 .start = EP93XX_CS1_PHYS_BASE,
42 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1, 37 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
43 .flags = IORESOURCE_MEM, 38 .flags = IORESOURCE_MEM,
44}; 39};
45 40
46static struct platform_device micro9h_flash = { 41static struct platform_device micro9_flash = {
47 .name = "physmap-flash", 42 .name = "physmap-flash",
48 .id = 0, 43 .id = 0,
49 .dev = { 44 .dev = {
50 .platform_data = &micro9h_flash_data, 45 .platform_data = &micro9_flash_data,
51 }, 46 },
52 .num_resources = 1, 47 .num_resources = 1,
53 .resource = &micro9h_flash_resource, 48 .resource = &micro9_flash_resource,
54}; 49};
55 50
56static void __init micro9h_init(void) 51static void __init __micro9_register_flash(unsigned int width)
52{
53 micro9_flash_data.width = width;
54
55 platform_device_register(&micro9_flash);
56}
57
58static unsigned int __init micro9_detect_bootwidth(void)
59{
60 u32 v;
61
62 /* Detect the bus width of the external flash memory */
63 v = __raw_readl(EP93XX_SYSCON_SYSCFG);
64 if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
65 return 4; /* 32-bit */
66 else
67 return 2; /* 16-bit */
68}
69
70static void __init micro9_register_flash(void)
57{ 71{
58 platform_device_register(&micro9h_flash); 72 if (machine_is_micro9())
73 __micro9_register_flash(4);
74 else if (machine_is_micro9m() || machine_is_micro9s())
75 __micro9_register_flash(micro9_detect_bootwidth());
59} 76}
60 77
61static void __init micro9h_init_machine(void) 78
79/*************************************************************************
80 * Micro9 Ethernet
81 *************************************************************************/
82static struct ep93xx_eth_data micro9_eth_data = {
83 .phy_id = 0x1f,
84};
85
86
87static void __init micro9_init_machine(void)
62{ 88{
63 ep93xx_init_devices(); 89 ep93xx_init_devices();
64 micro9_init(); 90 ep93xx_register_eth(&micro9_eth_data, 1);
65 micro9h_init(); 91 micro9_register_flash();
66} 92}
67 93
68MACHINE_START(MICRO9, "Contec Hypercontrol Micro9-H") 94
69 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */ 95#ifdef CONFIG_MACH_MICRO9H
96MACHINE_START(MICRO9, "Contec Micro9-High")
97 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
70 .phys_io = EP93XX_APB_PHYS_BASE, 98 .phys_io = EP93XX_APB_PHYS_BASE,
71 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 99 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
72 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 100 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
73 .map_io = ep93xx_map_io, 101 .map_io = ep93xx_map_io,
74 .init_irq = ep93xx_init_irq, 102 .init_irq = ep93xx_init_irq,
75 .timer = &ep93xx_timer, 103 .timer = &ep93xx_timer,
76 .init_machine = micro9h_init_machine, 104 .init_machine = micro9_init_machine,
77MACHINE_END 105MACHINE_END
78#endif 106#endif
79 107
80/*
81 * Micro9-M
82 */
83#ifdef CONFIG_MACH_MICRO9M 108#ifdef CONFIG_MACH_MICRO9M
84static void __init micro9m_init_machine(void) 109MACHINE_START(MICRO9M, "Contec Micro9-Mid")
85{ 110 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
86 ep93xx_init_devices();
87 micro9_init();
88}
89
90MACHINE_START(MICRO9M, "Contec Hypercontrol Micro9-M")
91 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
92 .phys_io = EP93XX_APB_PHYS_BASE, 111 .phys_io = EP93XX_APB_PHYS_BASE,
93 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 112 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
94 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 113 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
95 .map_io = ep93xx_map_io, 114 .map_io = ep93xx_map_io,
96 .init_irq = ep93xx_init_irq, 115 .init_irq = ep93xx_init_irq,
97 .timer = &ep93xx_timer, 116 .timer = &ep93xx_timer,
98 .init_machine = micro9m_init_machine, 117 .init_machine = micro9_init_machine,
99MACHINE_END 118MACHINE_END
100#endif 119#endif
101 120
102/*
103 * Micro9-L
104 */
105#ifdef CONFIG_MACH_MICRO9L 121#ifdef CONFIG_MACH_MICRO9L
106static void __init micro9l_init_machine(void) 122MACHINE_START(MICRO9L, "Contec Micro9-Lite")
107{ 123 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
108 ep93xx_init_devices();
109 micro9_init();
110}
111
112MACHINE_START(MICRO9L, "Contec Hypercontrol Micro9-L")
113 /* Maintainer: Manfred Gruber <manfred.gruber@contec.at> */
114 .phys_io = EP93XX_APB_PHYS_BASE, 124 .phys_io = EP93XX_APB_PHYS_BASE,
115 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc, 125 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
116 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100, 126 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
117 .map_io = ep93xx_map_io, 127 .map_io = ep93xx_map_io,
118 .init_irq = ep93xx_init_irq, 128 .init_irq = ep93xx_init_irq,
119 .timer = &ep93xx_timer, 129 .timer = &ep93xx_timer,
120 .init_machine = micro9l_init_machine, 130 .init_machine = micro9_init_machine,
121MACHINE_END 131MACHINE_END
122#endif 132#endif
123 133
134#ifdef CONFIG_MACH_MICRO9S
135MACHINE_START(MICRO9S, "Contec Micro9-Slim")
136 /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
137 .phys_io = EP93XX_APB_PHYS_BASE,
138 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
139 .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
140 .map_io = ep93xx_map_io,
141 .init_irq = ep93xx_init_irq,
142 .timer = &ep93xx_timer,
143 .init_machine = micro9_init_machine,
144MACHINE_END
145#endif
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 3a8ee2272add..983cc8c20081 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -155,7 +155,7 @@ MODULE_PARM_DESC(pxa255_turbo_table, "Selects the frequency table (0 = run table
155 155
156static pxa_freqs_t pxa27x_freqs[] = { 156static pxa_freqs_t pxa27x_freqs[] = {
157 {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 }, 157 {104000, 104000, PXA27x_CCCR(1, 8, 2), 0, CCLKCFG2(1, 0, 1), 900000, 1705000 },
158 {156000, 104000, PXA27x_CCCR(1, 8, 6), 0, CCLKCFG2(1, 1, 1), 1000000, 1705000 }, 158 {156000, 104000, PXA27x_CCCR(1, 8, 3), 0, CCLKCFG2(1, 0, 1), 1000000, 1705000 },
159 {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 }, 159 {208000, 208000, PXA27x_CCCR(0, 16, 2), 1, CCLKCFG2(0, 0, 1), 1180000, 1705000 },
160 {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 }, 160 {312000, 208000, PXA27x_CCCR(1, 16, 3), 1, CCLKCFG2(1, 0, 1), 1250000, 1705000 },
161 {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 }, 161 {416000, 208000, PXA27x_CCCR(1, 16, 4), 1, CCLKCFG2(1, 0, 1), 1350000, 1705000 },
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
index 79141f862728..965480eb4fe6 100644
--- a/arch/arm/mach-pxa/csb726.c
+++ b/arch/arm/mach-pxa/csb726.c
@@ -238,7 +238,7 @@ static struct resource csb726_lan_resources[] = {
238}; 238};
239 239
240struct smsc911x_platform_config csb726_lan_config = { 240struct smsc911x_platform_config csb726_lan_config = {
241 .irq_type = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 241 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
242 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, 242 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
243 .flags = SMSC911X_USE_32BIT, 243 .flags = SMSC911X_USE_32BIT,
244 .phy_interface = PHY_INTERFACE_MODE_MII, 244 .phy_interface = PHY_INTERFACE_MODE_MII,
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 8a5546e6d547..bb7b8198d0c4 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -25,6 +25,7 @@ led-$(CONFIG_SA1100_CERF) += leds-cerf.o
25 25
26obj-$(CONFIG_SA1100_COLLIE) += collie.o 26obj-$(CONFIG_SA1100_COLLIE) += collie.o
27 27
28obj-$(CONFIG_SA1100_H3100) += h3600.o
28obj-$(CONFIG_SA1100_H3600) += h3600.o 29obj-$(CONFIG_SA1100_H3600) += h3600.o
29 30
30obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o 31obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 8f5c13f4c936..295e25dd6381 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -12,6 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/unwind.h>
15 16
16#include "proc-macros.S" 17#include "proc-macros.S"
17 18
@@ -121,11 +122,13 @@ ENTRY(v6_coherent_kern_range)
121 * - the Icache does not read data from the write buffer 122 * - the Icache does not read data from the write buffer
122 */ 123 */
123ENTRY(v6_coherent_user_range) 124ENTRY(v6_coherent_user_range)
124 125 UNWIND(.fnstart )
125#ifdef HARVARD_CACHE 126#ifdef HARVARD_CACHE
126 bic r0, r0, #CACHE_LINE_SIZE - 1 127 bic r0, r0, #CACHE_LINE_SIZE - 1
1271: mcr p15, 0, r0, c7, c10, 1 @ clean D line 1281:
129 USER( mcr p15, 0, r0, c7, c10, 1 ) @ clean D line
128 add r0, r0, #CACHE_LINE_SIZE 130 add r0, r0, #CACHE_LINE_SIZE
1312:
129 cmp r0, r1 132 cmp r0, r1
130 blo 1b 133 blo 1b
131#endif 134#endif
@@ -143,6 +146,19 @@ ENTRY(v6_coherent_user_range)
143 mov pc, lr 146 mov pc, lr
144 147
145/* 148/*
149 * Fault handling for the cache operation above. If the virtual address in r0
150 * isn't mapped, just try the next page.
151 */
1529001:
153 mov r0, r0, lsr #12
154 mov r0, r0, lsl #12
155 add r0, r0, #4096
156 b 2b
157 UNWIND(.fnend )
158ENDPROC(v6_coherent_user_range)
159ENDPROC(v6_coherent_kern_range)
160
161/*
146 * v6_flush_kern_dcache_page(kaddr) 162 * v6_flush_kern_dcache_page(kaddr)
147 * 163 *
148 * Ensure that the data held in the page kaddr is written back 164 * Ensure that the data held in the page kaddr is written back
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index bda0ec31a4e2..e1bd9759617f 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -13,6 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <asm/unwind.h>
16 17
17#include "proc-macros.S" 18#include "proc-macros.S"
18 19
@@ -153,13 +154,16 @@ ENTRY(v7_coherent_kern_range)
153 * - the Icache does not read data from the write buffer 154 * - the Icache does not read data from the write buffer
154 */ 155 */
155ENTRY(v7_coherent_user_range) 156ENTRY(v7_coherent_user_range)
157 UNWIND(.fnstart )
156 dcache_line_size r2, r3 158 dcache_line_size r2, r3
157 sub r3, r2, #1 159 sub r3, r2, #1
158 bic r0, r0, r3 160 bic r0, r0, r3
1591: mcr p15, 0, r0, c7, c11, 1 @ clean D line to the point of unification 1611:
162 USER( mcr p15, 0, r0, c7, c11, 1 ) @ clean D line to the point of unification
160 dsb 163 dsb
161 mcr p15, 0, r0, c7, c5, 1 @ invalidate I line 164 USER( mcr p15, 0, r0, c7, c5, 1 ) @ invalidate I line
162 add r0, r0, r2 165 add r0, r0, r2
1662:
163 cmp r0, r1 167 cmp r0, r1
164 blo 1b 168 blo 1b
165 mov r0, #0 169 mov r0, #0
@@ -167,6 +171,17 @@ ENTRY(v7_coherent_user_range)
167 dsb 171 dsb
168 isb 172 isb
169 mov pc, lr 173 mov pc, lr
174
175/*
176 * Fault handling for the cache operation above. If the virtual address in r0
177 * isn't mapped, just try the next page.
178 */
1799001:
180 mov r0, r0, lsr #12
181 mov r0, r0, lsl #12
182 add r0, r0, #4096
183 b 2b
184 UNWIND(.fnend )
170ENDPROC(v7_coherent_kern_range) 185ENDPROC(v7_coherent_kern_range)
171ENDPROC(v7_coherent_user_range) 186ENDPROC(v7_coherent_user_range)
172 187
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index bc0099d5ae85..d0d17b6a3703 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -153,14 +153,11 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
153 153
154 page = pfn_to_page(pfn); 154 page = pfn_to_page(pfn);
155 mapping = page_mapping(page); 155 mapping = page_mapping(page);
156 if (mapping) {
157#ifndef CONFIG_SMP 156#ifndef CONFIG_SMP
158 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 157 if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
159 158 __flush_dcache_page(mapping, page);
160 if (dirty)
161 __flush_dcache_page(mapping, page);
162#endif 159#endif
163 160 if (mapping) {
164 if (cache_is_vivt()) 161 if (cache_is_vivt())
165 make_coherent(mapping, vma, addr, pfn); 162 make_coherent(mapping, vma, addr, pfn);
166 else if (vma->vm_flags & VM_EXEC) 163 else if (vma->vm_flags & VM_EXEC)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index ae0e25f5a70e..10e06801afb3 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -292,6 +292,11 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
292 * down_read() 292 * down_read()
293 */ 293 */
294 might_sleep(); 294 might_sleep();
295#ifdef CONFIG_DEBUG_VM
296 if (!user_mode(regs) &&
297 !search_exception_tables(regs->ARM_pc))
298 goto no_context;
299#endif
295 } 300 }
296 301
297 fault = __do_page_fault(mm, addr, fsr, tsk); 302 fault = __do_page_fault(mm, addr, fsr, tsk);
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index 73cae57fa707..30f82fb5918c 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -46,6 +46,8 @@ void *kmap_atomic(struct page *page, enum km_type type)
46 if (!PageHighMem(page)) 46 if (!PageHighMem(page))
47 return page_address(page); 47 return page_address(page);
48 48
49 debug_kmap_atomic(type);
50
49 kmap = kmap_high_get(page); 51 kmap = kmap_high_get(page);
50 if (kmap) 52 if (kmap)
51 return kmap; 53 return kmap;
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 877c492f8e10..40940d7ce4ff 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -483,7 +483,7 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
483 /* 483 /*
484 * Convert start_pfn/end_pfn to a struct page pointer. 484 * Convert start_pfn/end_pfn to a struct page pointer.
485 */ 485 */
486 start_pg = pfn_to_page(start_pfn); 486 start_pg = pfn_to_page(start_pfn - 1) + 1;
487 end_pg = pfn_to_page(end_pfn); 487 end_pg = pfn_to_page(end_pfn);
488 488
489 /* 489 /*
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 704dd396257b..77df726180ba 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -438,7 +438,7 @@ static int diag204_probe(void)
438 } 438 }
439 if (diag204((unsigned long)SUBC_STIB6 | 439 if (diag204((unsigned long)SUBC_STIB6 |
440 (unsigned long)INFO_EXT, pages, buf) >= 0) { 440 (unsigned long)INFO_EXT, pages, buf) >= 0) {
441 diag204_store_sc = SUBC_STIB7; 441 diag204_store_sc = SUBC_STIB6;
442 diag204_info_type = INFO_EXT; 442 diag204_info_type = INFO_EXT;
443 goto out; 443 goto out;
444 } 444 }
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 802c8ab247f3..0729f36c2fe3 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -31,9 +31,9 @@ void __cpuinit print_cpu_info(void)
31 31
32static int show_cpuinfo(struct seq_file *m, void *v) 32static int show_cpuinfo(struct seq_file *m, void *v)
33{ 33{
34 static const char *hwcap_str[9] = { 34 static const char *hwcap_str[10] = {
35 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp", 35 "esan3", "zarch", "stfle", "msa", "ldisp", "eimm", "dfp",
36 "edat", "etf3eh" 36 "edat", "etf3eh", "highgprs"
37 }; 37 };
38 struct _lowcore *lc; 38 struct _lowcore *lc;
39 unsigned long n = (unsigned long) v - 1; 39 unsigned long n = (unsigned long) v - 1;
@@ -48,7 +48,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
48 num_online_cpus(), loops_per_jiffy/(500000/HZ), 48 num_online_cpus(), loops_per_jiffy/(500000/HZ),
49 (loops_per_jiffy/(5000/HZ))%100); 49 (loops_per_jiffy/(5000/HZ))%100);
50 seq_puts(m, "features\t: "); 50 seq_puts(m, "features\t: ");
51 for (i = 0; i < 9; i++) 51 for (i = 0; i < 10; i++)
52 if (hwcap_str[i] && (elf_hwcap & (1UL << i))) 52 if (hwcap_str[i] && (elf_hwcap & (1UL << i)))
53 seq_printf(m, "%s ", hwcap_str[i]); 53 seq_printf(m, "%s ", hwcap_str[i]);
54 seq_puts(m, "\n"); 54 seq_puts(m, "\n");
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 68d9223b145e..3eb84931d2aa 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -121,7 +121,7 @@ noresched:
121ENTRY(resume_userspace) 121ENTRY(resume_userspace)
122 ! r8: current_thread_info 122 ! r8: current_thread_info
123 cli 123 cli
124 TRACE_IRQS_OfF 124 TRACE_IRQS_OFF
125 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags 125 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags
126 tst #(_TIF_WORK_MASK & 0xff), r0 126 tst #(_TIF_WORK_MASK & 0xff), r0
127 bt/s __restore_all 127 bt/s __restore_all
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
index a3dcc6d5d253..2c48e267256e 100644
--- a/arch/sh/kernel/ftrace.c
+++ b/arch/sh/kernel/ftrace.c
@@ -291,31 +291,48 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)
291 return syscalls_metadata[nr]; 291 return syscalls_metadata[nr];
292} 292}
293 293
294void arch_init_ftrace_syscalls(void) 294int syscall_name_to_nr(char *name)
295{
296 int i;
297
298 if (!syscalls_metadata)
299 return -1;
300 for (i = 0; i < NR_syscalls; i++)
301 if (syscalls_metadata[i])
302 if (!strcmp(syscalls_metadata[i]->name, name))
303 return i;
304 return -1;
305}
306
307void set_syscall_enter_id(int num, int id)
308{
309 syscalls_metadata[num]->enter_id = id;
310}
311
312void set_syscall_exit_id(int num, int id)
313{
314 syscalls_metadata[num]->exit_id = id;
315}
316
317static int __init arch_init_ftrace_syscalls(void)
295{ 318{
296 int i; 319 int i;
297 struct syscall_metadata *meta; 320 struct syscall_metadata *meta;
298 unsigned long **psys_syscall_table = &sys_call_table; 321 unsigned long **psys_syscall_table = &sys_call_table;
299 static atomic_t refs;
300
301 if (atomic_inc_return(&refs) != 1)
302 goto end;
303 322
304 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * 323 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
305 FTRACE_SYSCALL_MAX, GFP_KERNEL); 324 FTRACE_SYSCALL_MAX, GFP_KERNEL);
306 if (!syscalls_metadata) { 325 if (!syscalls_metadata) {
307 WARN_ON(1); 326 WARN_ON(1);
308 return; 327 return -ENOMEM;
309 } 328 }
310 329
311 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { 330 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
312 meta = find_syscall_meta(psys_syscall_table[i]); 331 meta = find_syscall_meta(psys_syscall_table[i]);
313 syscalls_metadata[i] = meta; 332 syscalls_metadata[i] = meta;
314 } 333 }
315 return;
316 334
317 /* Paranoid: avoid overflow */ 335 return 0;
318end:
319 atomic_dec(&refs);
320} 336}
337arch_initcall(arch_init_ftrace_syscalls);
321#endif /* CONFIG_FTRACE_SYSCALLS */ 338#endif /* CONFIG_FTRACE_SYSCALLS */
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index f9d44f8e0df6..99b4fb553bf1 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -549,6 +549,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
549 549
550 if (cpu == 0) 550 if (cpu == 0)
551 seq_printf(m, "machine\t\t: %s\n", get_system_type()); 551 seq_printf(m, "machine\t\t: %s\n", get_system_type());
552 else
553 seq_printf(m, "\n");
552 554
553 seq_printf(m, "processor\t: %d\n", cpu); 555 seq_printf(m, "processor\t: %d\n", cpu);
554 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); 556 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 6729703547a1..3db37425210d 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -145,7 +145,7 @@ static inline int restore_sigcontext_fpu(struct sigcontext __user *sc)
145{ 145{
146 struct task_struct *tsk = current; 146 struct task_struct *tsk = current;
147 147
148 if (!(current_cpu_data.flags & CPU_HAS_FPU)) 148 if (!(boot_cpu_data.flags & CPU_HAS_FPU))
149 return 0; 149 return 0;
150 150
151 set_used_math(); 151 set_used_math();
@@ -158,7 +158,7 @@ static inline int save_sigcontext_fpu(struct sigcontext __user *sc,
158{ 158{
159 struct task_struct *tsk = current; 159 struct task_struct *tsk = current;
160 160
161 if (!(current_cpu_data.flags & CPU_HAS_FPU)) 161 if (!(boot_cpu_data.flags & CPU_HAS_FPU))
162 return 0; 162 return 0;
163 163
164 if (!used_math()) { 164 if (!used_math()) {
@@ -199,7 +199,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *r0_p
199#undef COPY 199#undef COPY
200 200
201#ifdef CONFIG_SH_FPU 201#ifdef CONFIG_SH_FPU
202 if (current_cpu_data.flags & CPU_HAS_FPU) { 202 if (boot_cpu_data.flags & CPU_HAS_FPU) {
203 int owned_fp; 203 int owned_fp;
204 struct task_struct *tsk = current; 204 struct task_struct *tsk = current;
205 205
@@ -472,6 +472,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
472 err |= __put_user(OR_R0_R0, &frame->retcode[6]); 472 err |= __put_user(OR_R0_R0, &frame->retcode[6]);
473 err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]); 473 err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]);
474 regs->pr = (unsigned long) frame->retcode; 474 regs->pr = (unsigned long) frame->retcode;
475 flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
475 } 476 }
476 477
477 if (err) 478 if (err)
@@ -497,8 +498,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
497 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", 498 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
498 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); 499 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
499 500
500 flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
501
502 return 0; 501 return 0;
503 502
504give_sigsegv: 503give_sigsegv:
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 442d8d47a41e..160db1003cfb 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -35,6 +35,8 @@ static inline void __init smp_store_cpu_info(unsigned int cpu)
35{ 35{
36 struct sh_cpuinfo *c = cpu_data + cpu; 36 struct sh_cpuinfo *c = cpu_data + cpu;
37 37
38 memcpy(c, &boot_cpu_data, sizeof(struct sh_cpuinfo));
39
38 c->loops_per_jiffy = loops_per_jiffy; 40 c->loops_per_jiffy = loops_per_jiffy;
39} 41}
40 42
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index e0b5e4b5accd..7a2ee3a6b8e7 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -25,6 +25,7 @@
25#include <linux/kexec.h> 25#include <linux/kexec.h>
26#include <linux/limits.h> 26#include <linux/limits.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/sysfs.h>
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/fpu.h> 31#include <asm/fpu.h>
@@ -159,12 +160,12 @@ void die(const char * str, struct pt_regs * regs, long err)
159 160
160 oops_enter(); 161 oops_enter();
161 162
162 console_verbose();
163 spin_lock_irq(&die_lock); 163 spin_lock_irq(&die_lock);
164 console_verbose();
164 bust_spinlocks(1); 165 bust_spinlocks(1);
165 166
166 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 167 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
167 168 sysfs_printk_last_file();
168 print_modules(); 169 print_modules();
169 show_regs(regs); 170 show_regs(regs);
170 171
@@ -180,6 +181,7 @@ void die(const char * str, struct pt_regs * regs, long err)
180 bust_spinlocks(0); 181 bust_spinlocks(0);
181 add_taint(TAINT_DIE); 182 add_taint(TAINT_DIE);
182 spin_unlock_irq(&die_lock); 183 spin_unlock_irq(&die_lock);
184 oops_exit();
183 185
184 if (kexec_should_crash(current)) 186 if (kexec_should_crash(current))
185 crash_kexec(regs); 187 crash_kexec(regs);
@@ -190,7 +192,6 @@ void die(const char * str, struct pt_regs * regs, long err)
190 if (panic_on_oops) 192 if (panic_on_oops)
191 panic("Fatal exception"); 193 panic("Fatal exception");
192 194
193 oops_exit();
194 do_exit(SIGSEGV); 195 do_exit(SIGSEGV);
195} 196}
196 197
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 35c37b7f717a..5e1091be9dc4 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -128,7 +128,7 @@ void __update_cache(struct vm_area_struct *vma,
128 return; 128 return;
129 129
130 page = pfn_to_page(pfn); 130 page = pfn_to_page(pfn);
131 if (pfn_valid(pfn) && page_mapping(page)) { 131 if (pfn_valid(pfn)) {
132 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 132 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
133 if (dirty) { 133 if (dirty) {
134 unsigned long addr = (unsigned long)page_address(page); 134 unsigned long addr = (unsigned long)page_address(page);
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index adf5f273868a..cb3c72c45aab 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -1242,13 +1242,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
1242 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name); 1242 snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
1243 1243
1244 err = request_irq(lp->cfg.rx_irq, ldc_rx, 1244 err = request_irq(lp->cfg.rx_irq, ldc_rx,
1245 IRQF_SAMPLE_RANDOM | IRQF_SHARED, 1245 IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
1246 lp->rx_irq_name, lp); 1246 lp->rx_irq_name, lp);
1247 if (err) 1247 if (err)
1248 return err; 1248 return err;
1249 1249
1250 err = request_irq(lp->cfg.tx_irq, ldc_tx, 1250 err = request_irq(lp->cfg.tx_irq, ldc_tx,
1251 IRQF_SAMPLE_RANDOM | IRQF_SHARED, 1251 IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
1252 lp->tx_irq_name, lp); 1252 lp->tx_irq_name, lp);
1253 if (err) { 1253 if (err) {
1254 free_irq(lp->cfg.rx_irq, lp); 1254 free_irq(lp->cfg.rx_irq, lp);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 04db92743896..fa5936e1c3b9 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -437,7 +437,7 @@ static const struct sparc_pmu niagara2_pmu = {
437 .lower_shift = 6, 437 .lower_shift = 6,
438 .event_mask = 0xfff, 438 .event_mask = 0xfff,
439 .hv_bit = 0x8, 439 .hv_bit = 0x8,
440 .irq_bit = 0x03, 440 .irq_bit = 0x30,
441 .upper_nop = 0x220, 441 .upper_nop = 0x220,
442 .lower_nop = 0x220, 442 .lower_nop = 0x220,
443}; 443};
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index a70a5e1904d9..1886d37d411b 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -265,7 +265,7 @@ static void flush_dcache(unsigned long pfn)
265 struct page *page; 265 struct page *page;
266 266
267 page = pfn_to_page(pfn); 267 page = pfn_to_page(pfn);
268 if (page && page_mapping(page)) { 268 if (page) {
269 unsigned long pg_flags; 269 unsigned long pg_flags;
270 270
271 pg_flags = page->flags; 271 pg_flags = page->flags;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c876bace8fdc..07e01149e3bf 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -491,7 +491,7 @@ if PARAVIRT_GUEST
491source "arch/x86/xen/Kconfig" 491source "arch/x86/xen/Kconfig"
492 492
493config VMI 493config VMI
494 bool "VMI Guest support" 494 bool "VMI Guest support (DEPRECATED)"
495 select PARAVIRT 495 select PARAVIRT
496 depends on X86_32 496 depends on X86_32
497 ---help--- 497 ---help---
@@ -500,6 +500,15 @@ config VMI
500 at the moment), by linking the kernel to a GPL-ed ROM module 500 at the moment), by linking the kernel to a GPL-ed ROM module
501 provided by the hypervisor. 501 provided by the hypervisor.
502 502
503 As of September 2009, VMware has started a phased retirement
504 of this feature from VMware's products. Please see
505 feature-removal-schedule.txt for details. If you are
506 planning to enable this option, please note that you cannot
507 live migrate a VMI enabled VM to a future VMware product,
508 which doesn't support VMI. So if you expect your kernel to
509 seamlessly migrate to newer VMware products, keep this
510 disabled.
511
503config KVM_CLOCK 512config KVM_CLOCK
504 bool "KVM paravirtualized clock" 513 bool "KVM paravirtualized clock"
505 select PARAVIRT 514 select PARAVIRT
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 8aebcc41041d..efb38994859c 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -840,42 +840,22 @@ static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
840 840
841static inline unsigned long __raw_local_save_flags(void) 841static inline unsigned long __raw_local_save_flags(void)
842{ 842{
843 unsigned long f; 843 return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
844
845 asm volatile(paravirt_alt(PARAVIRT_CALL)
846 : "=a"(f)
847 : paravirt_type(pv_irq_ops.save_fl),
848 paravirt_clobber(CLBR_EAX)
849 : "memory", "cc");
850 return f;
851} 844}
852 845
853static inline void raw_local_irq_restore(unsigned long f) 846static inline void raw_local_irq_restore(unsigned long f)
854{ 847{
855 asm volatile(paravirt_alt(PARAVIRT_CALL) 848 PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
856 : "=a"(f)
857 : PV_FLAGS_ARG(f),
858 paravirt_type(pv_irq_ops.restore_fl),
859 paravirt_clobber(CLBR_EAX)
860 : "memory", "cc");
861} 849}
862 850
863static inline void raw_local_irq_disable(void) 851static inline void raw_local_irq_disable(void)
864{ 852{
865 asm volatile(paravirt_alt(PARAVIRT_CALL) 853 PVOP_VCALLEE0(pv_irq_ops.irq_disable);
866 :
867 : paravirt_type(pv_irq_ops.irq_disable),
868 paravirt_clobber(CLBR_EAX)
869 : "memory", "eax", "cc");
870} 854}
871 855
872static inline void raw_local_irq_enable(void) 856static inline void raw_local_irq_enable(void)
873{ 857{
874 asm volatile(paravirt_alt(PARAVIRT_CALL) 858 PVOP_VCALLEE0(pv_irq_ops.irq_enable);
875 :
876 : paravirt_type(pv_irq_ops.irq_enable),
877 paravirt_clobber(CLBR_EAX)
878 : "memory", "eax", "cc");
879} 859}
880 860
881static inline unsigned long __raw_local_irq_save(void) 861static inline unsigned long __raw_local_irq_save(void)
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index dd0f5b32489d..9357473c8da0 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -494,10 +494,11 @@ int paravirt_disable_iospace(void);
494#define EXTRA_CLOBBERS 494#define EXTRA_CLOBBERS
495#define VEXTRA_CLOBBERS 495#define VEXTRA_CLOBBERS
496#else /* CONFIG_X86_64 */ 496#else /* CONFIG_X86_64 */
497/* [re]ax isn't an arg, but the return val */
497#define PVOP_VCALL_ARGS \ 498#define PVOP_VCALL_ARGS \
498 unsigned long __edi = __edi, __esi = __esi, \ 499 unsigned long __edi = __edi, __esi = __esi, \
499 __edx = __edx, __ecx = __ecx 500 __edx = __edx, __ecx = __ecx, __eax = __eax
500#define PVOP_CALL_ARGS PVOP_VCALL_ARGS, __eax 501#define PVOP_CALL_ARGS PVOP_VCALL_ARGS
501 502
502#define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x)) 503#define PVOP_CALL_ARG1(x) "D" ((unsigned long)(x))
503#define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x)) 504#define PVOP_CALL_ARG2(x) "S" ((unsigned long)(x))
@@ -509,6 +510,7 @@ int paravirt_disable_iospace(void);
509 "=c" (__ecx) 510 "=c" (__ecx)
510#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) 511#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax)
511 512
513/* void functions are still allowed [re]ax for scratch */
512#define PVOP_VCALLEE_CLOBBERS "=a" (__eax) 514#define PVOP_VCALLEE_CLOBBERS "=a" (__eax)
513#define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS 515#define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS
514 516
@@ -583,8 +585,8 @@ int paravirt_disable_iospace(void);
583 VEXTRA_CLOBBERS, \ 585 VEXTRA_CLOBBERS, \
584 pre, post, ##__VA_ARGS__) 586 pre, post, ##__VA_ARGS__)
585 587
586#define __PVOP_VCALLEESAVE(rettype, op, pre, post, ...) \ 588#define __PVOP_VCALLEESAVE(op, pre, post, ...) \
587 ____PVOP_CALL(rettype, op.func, CLBR_RET_REG, \ 589 ____PVOP_VCALL(op.func, CLBR_RET_REG, \
588 PVOP_VCALLEE_CLOBBERS, , \ 590 PVOP_VCALLEE_CLOBBERS, , \
589 pre, post, ##__VA_ARGS__) 591 pre, post, ##__VA_ARGS__)
590 592
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.lds.S b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
index 7da00b799cda..0e50e1e5c573 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.lds.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.lds.S
@@ -56,6 +56,6 @@ SECTIONS
56 /DISCARD/ : { 56 /DISCARD/ : {
57 *(.note*) 57 *(.note*)
58 } 58 }
59
60 . = ASSERT(_end <= WAKEUP_SIZE, "Wakeup too big!");
61} 59}
60
61ASSERT(_end <= WAKEUP_SIZE, "Wakeup too big!");
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 391206199515..74656d1d4e30 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -244,7 +244,6 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
244 __func__, smp_processor_id(), vector, irq); 244 __func__, smp_processor_id(), vector, irq);
245 } 245 }
246 246
247 run_local_timers();
248 irq_exit(); 247 irq_exit();
249 248
250 set_irq_regs(old_regs); 249 set_irq_regs(old_regs);
@@ -269,7 +268,6 @@ void smp_generic_interrupt(struct pt_regs *regs)
269 if (generic_interrupt_extension) 268 if (generic_interrupt_extension)
270 generic_interrupt_extension(); 269 generic_interrupt_extension();
271 270
272 run_local_timers();
273 irq_exit(); 271 irq_exit();
274 272
275 set_irq_regs(old_regs); 273 set_irq_regs(old_regs);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index d20009b4e6ef..b2a71dca5642 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -311,7 +311,7 @@ void pci_iommu_shutdown(void)
311 amd_iommu_shutdown(); 311 amd_iommu_shutdown();
312} 312}
313/* Must execute after PCI subsystem */ 313/* Must execute after PCI subsystem */
314fs_initcall(pci_iommu_init); 314rootfs_initcall(pci_iommu_init);
315 315
316#ifdef CONFIG_PCI 316#ifdef CONFIG_PCI
317/* Many VIA bridges seem to corrupt data for DAC. Disable it here */ 317/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index d915d956e66d..ec1de97600e7 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -198,7 +198,6 @@ void smp_reschedule_interrupt(struct pt_regs *regs)
198{ 198{
199 ack_APIC_irq(); 199 ack_APIC_irq();
200 inc_irq_stat(irq_resched_count); 200 inc_irq_stat(irq_resched_count);
201 run_local_timers();
202 /* 201 /*
203 * KVM uses this interrupt to force a cpu out of guest mode 202 * KVM uses this interrupt to force a cpu out of guest mode
204 */ 203 */
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index dcb00d278512..be2573448ed9 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -38,7 +38,8 @@ unsigned long profile_pc(struct pt_regs *regs)
38#ifdef CONFIG_FRAME_POINTER 38#ifdef CONFIG_FRAME_POINTER
39 return *(unsigned long *)(regs->bp + sizeof(long)); 39 return *(unsigned long *)(regs->bp + sizeof(long));
40#else 40#else
41 unsigned long *sp = (unsigned long *)regs->sp; 41 unsigned long *sp =
42 (unsigned long *)kernel_stack_pointer(regs);
42 /* 43 /*
43 * Return address is either directly at stack pointer 44 * Return address is either directly at stack pointer
44 * or above a saved flags. Eflags has bits 22-31 zero, 45 * or above a saved flags. Eflags has bits 22-31 zero,
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
index 699f7eeb896a..cd022121cab6 100644
--- a/arch/x86/kernel/trampoline.c
+++ b/arch/x86/kernel/trampoline.c
@@ -3,8 +3,16 @@
3#include <asm/trampoline.h> 3#include <asm/trampoline.h>
4#include <asm/e820.h> 4#include <asm/e820.h>
5 5
6#if defined(CONFIG_X86_64) && defined(CONFIG_ACPI_SLEEP)
7#define __trampinit
8#define __trampinitdata
9#else
10#define __trampinit __cpuinit
11#define __trampinitdata __cpuinitdata
12#endif
13
6/* ready for x86_64 and x86 */ 14/* ready for x86_64 and x86 */
7unsigned char *__cpuinitdata trampoline_base = __va(TRAMPOLINE_BASE); 15unsigned char *__trampinitdata trampoline_base = __va(TRAMPOLINE_BASE);
8 16
9void __init reserve_trampoline_memory(void) 17void __init reserve_trampoline_memory(void)
10{ 18{
@@ -26,7 +34,7 @@ void __init reserve_trampoline_memory(void)
26 * bootstrap into the page concerned. The caller 34 * bootstrap into the page concerned. The caller
27 * has made sure it's suitably aligned. 35 * has made sure it's suitably aligned.
28 */ 36 */
29unsigned long __cpuinit setup_trampoline(void) 37unsigned long __trampinit setup_trampoline(void)
30{ 38{
31 memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); 39 memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE);
32 return virt_to_phys(trampoline_base); 40 return virt_to_phys(trampoline_base);
diff --git a/arch/x86/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S
index 596d54c660a5..3af2dff58b21 100644
--- a/arch/x86/kernel/trampoline_64.S
+++ b/arch/x86/kernel/trampoline_64.S
@@ -32,8 +32,12 @@
32#include <asm/segment.h> 32#include <asm/segment.h>
33#include <asm/processor-flags.h> 33#include <asm/processor-flags.h>
34 34
35#ifdef CONFIG_ACPI_SLEEP
36.section .rodata, "a", @progbits
37#else
35/* We can free up the trampoline after bootup if cpu hotplug is not supported. */ 38/* We can free up the trampoline after bootup if cpu hotplug is not supported. */
36__CPUINITRODATA 39__CPUINITRODATA
40#endif
37.code16 41.code16
38 42
39ENTRY(trampoline_data) 43ENTRY(trampoline_data)
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 31e6f6cfe53e..d430e4c30193 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -648,7 +648,7 @@ static inline int __init activate_vmi(void)
648 648
649 pv_info.paravirt_enabled = 1; 649 pv_info.paravirt_enabled = 1;
650 pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK; 650 pv_info.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK;
651 pv_info.name = "vmi"; 651 pv_info.name = "vmi [deprecated]";
652 652
653 pv_init_ops.patch = vmi_patch; 653 pv_init_ops.patch = vmi_patch;
654 654
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 92929fb3f9fa..8d6001ad8d8d 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -305,8 +305,8 @@ SECTIONS
305 305
306 306
307#ifdef CONFIG_X86_32 307#ifdef CONFIG_X86_32
308. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE), 308ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
309 "kernel image bigger than KERNEL_IMAGE_SIZE"); 309 "kernel image bigger than KERNEL_IMAGE_SIZE");
310#else 310#else
311/* 311/*
312 * Per-cpu symbols which need to be offset from __per_cpu_load 312 * Per-cpu symbols which need to be offset from __per_cpu_load
@@ -319,12 +319,12 @@ INIT_PER_CPU(irq_stack_union);
319/* 319/*
320 * Build-time check on the image size: 320 * Build-time check on the image size:
321 */ 321 */
322. = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE), 322ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
323 "kernel image bigger than KERNEL_IMAGE_SIZE"); 323 "kernel image bigger than KERNEL_IMAGE_SIZE");
324 324
325#ifdef CONFIG_SMP 325#ifdef CONFIG_SMP
326. = ASSERT((per_cpu__irq_stack_union == 0), 326ASSERT((per_cpu__irq_stack_union == 0),
327 "irq_stack_union is not at start of per-cpu area"); 327 "irq_stack_union is not at start of per-cpu area");
328#endif 328#endif
329 329
330#endif /* CONFIG_X86_32 */ 330#endif /* CONFIG_X86_32 */
@@ -332,7 +332,6 @@ INIT_PER_CPU(irq_stack_union);
332#ifdef CONFIG_KEXEC 332#ifdef CONFIG_KEXEC
333#include <asm/kexec.h> 333#include <asm/kexec.h>
334 334
335. = ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE, 335ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
336 "kexec control code size is too big"); 336 "kexec control code size is too big");
337#endif 337#endif
338
diff --git a/block/blk-core.c b/block/blk-core.c
index 81f34311659a..ac0fa10f8fa5 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -70,7 +70,7 @@ static void drive_stat_acct(struct request *rq, int new_io)
70 part_stat_inc(cpu, part, merges[rw]); 70 part_stat_inc(cpu, part, merges[rw]);
71 else { 71 else {
72 part_round_stats(cpu, part); 72 part_round_stats(cpu, part);
73 part_inc_in_flight(part); 73 part_inc_in_flight(part, rw);
74 } 74 }
75 75
76 part_stat_unlock(); 76 part_stat_unlock();
@@ -1030,9 +1030,9 @@ static void part_round_stats_single(int cpu, struct hd_struct *part,
1030 if (now == part->stamp) 1030 if (now == part->stamp)
1031 return; 1031 return;
1032 1032
1033 if (part->in_flight) { 1033 if (part_in_flight(part)) {
1034 __part_stat_add(cpu, part, time_in_queue, 1034 __part_stat_add(cpu, part, time_in_queue,
1035 part->in_flight * (now - part->stamp)); 1035 part_in_flight(part) * (now - part->stamp));
1036 __part_stat_add(cpu, part, io_ticks, (now - part->stamp)); 1036 __part_stat_add(cpu, part, io_ticks, (now - part->stamp));
1037 } 1037 }
1038 part->stamp = now; 1038 part->stamp = now;
@@ -1739,7 +1739,7 @@ static void blk_account_io_done(struct request *req)
1739 part_stat_inc(cpu, part, ios[rw]); 1739 part_stat_inc(cpu, part, ios[rw]);
1740 part_stat_add(cpu, part, ticks[rw], duration); 1740 part_stat_add(cpu, part, ticks[rw], duration);
1741 part_round_stats(cpu, part); 1741 part_round_stats(cpu, part);
1742 part_dec_in_flight(part); 1742 part_dec_in_flight(part, rw);
1743 1743
1744 part_stat_unlock(); 1744 part_stat_unlock();
1745 } 1745 }
@@ -2492,14 +2492,6 @@ int kblockd_schedule_work(struct request_queue *q, struct work_struct *work)
2492} 2492}
2493EXPORT_SYMBOL(kblockd_schedule_work); 2493EXPORT_SYMBOL(kblockd_schedule_work);
2494 2494
2495int kblockd_schedule_delayed_work(struct request_queue *q,
2496 struct delayed_work *work,
2497 unsigned long delay)
2498{
2499 return queue_delayed_work(kblockd_workqueue, work, delay);
2500}
2501EXPORT_SYMBOL(kblockd_schedule_delayed_work);
2502
2503int __init blk_dev_init(void) 2495int __init blk_dev_init(void)
2504{ 2496{
2505 BUILD_BUG_ON(__REQ_NR_BITS > 8 * 2497 BUILD_BUG_ON(__REQ_NR_BITS > 8 *
diff --git a/block/blk-merge.c b/block/blk-merge.c
index b0de8574fdc8..99cb5cf1f447 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -351,7 +351,7 @@ static void blk_account_io_merge(struct request *req)
351 part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req)); 351 part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
352 352
353 part_round_stats(cpu, part); 353 part_round_stats(cpu, part);
354 part_dec_in_flight(part); 354 part_dec_in_flight(part, rq_data_dir(req));
355 355
356 part_stat_unlock(); 356 part_stat_unlock();
357 } 357 }
diff --git a/block/blk-settings.c b/block/blk-settings.c
index e0695bca7027..66d4aa8799b7 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -242,7 +242,7 @@ EXPORT_SYMBOL(blk_queue_max_hw_sectors);
242/** 242/**
243 * blk_queue_max_discard_sectors - set max sectors for a single discard 243 * blk_queue_max_discard_sectors - set max sectors for a single discard
244 * @q: the request queue for the device 244 * @q: the request queue for the device
245 * @max_discard: maximum number of sectors to discard 245 * @max_discard_sectors: maximum number of sectors to discard
246 **/ 246 **/
247void blk_queue_max_discard_sectors(struct request_queue *q, 247void blk_queue_max_discard_sectors(struct request_queue *q,
248 unsigned int max_discard_sectors) 248 unsigned int max_discard_sectors)
diff --git a/block/blk-tag.c b/block/blk-tag.c
index 2e5cfeb59333..6b0f52c20964 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -359,7 +359,7 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
359 max_depth -= 2; 359 max_depth -= 2;
360 if (!max_depth) 360 if (!max_depth)
361 max_depth = 1; 361 max_depth = 1;
362 if (q->in_flight[0] > max_depth) 362 if (q->in_flight[BLK_RW_ASYNC] > max_depth)
363 return 1; 363 return 1;
364 } 364 }
365 365
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 9c4b679908f4..069a61017c02 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -150,7 +150,7 @@ struct cfq_data {
150 * idle window management 150 * idle window management
151 */ 151 */
152 struct timer_list idle_slice_timer; 152 struct timer_list idle_slice_timer;
153 struct delayed_work unplug_work; 153 struct work_struct unplug_work;
154 154
155 struct cfq_queue *active_queue; 155 struct cfq_queue *active_queue;
156 struct cfq_io_context *active_cic; 156 struct cfq_io_context *active_cic;
@@ -230,7 +230,7 @@ CFQ_CFQQ_FNS(coop);
230 blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args) 230 blk_add_trace_msg((cfqd)->queue, "cfq " fmt, ##args)
231 231
232static void cfq_dispatch_insert(struct request_queue *, struct request *); 232static void cfq_dispatch_insert(struct request_queue *, struct request *);
233static struct cfq_queue *cfq_get_queue(struct cfq_data *, int, 233static struct cfq_queue *cfq_get_queue(struct cfq_data *, bool,
234 struct io_context *, gfp_t); 234 struct io_context *, gfp_t);
235static struct cfq_io_context *cfq_cic_lookup(struct cfq_data *, 235static struct cfq_io_context *cfq_cic_lookup(struct cfq_data *,
236 struct io_context *); 236 struct io_context *);
@@ -241,40 +241,35 @@ static inline int rq_in_driver(struct cfq_data *cfqd)
241} 241}
242 242
243static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_context *cic, 243static inline struct cfq_queue *cic_to_cfqq(struct cfq_io_context *cic,
244 int is_sync) 244 bool is_sync)
245{ 245{
246 return cic->cfqq[!!is_sync]; 246 return cic->cfqq[is_sync];
247} 247}
248 248
249static inline void cic_set_cfqq(struct cfq_io_context *cic, 249static inline void cic_set_cfqq(struct cfq_io_context *cic,
250 struct cfq_queue *cfqq, int is_sync) 250 struct cfq_queue *cfqq, bool is_sync)
251{ 251{
252 cic->cfqq[!!is_sync] = cfqq; 252 cic->cfqq[is_sync] = cfqq;
253} 253}
254 254
255/* 255/*
256 * We regard a request as SYNC, if it's either a read or has the SYNC bit 256 * We regard a request as SYNC, if it's either a read or has the SYNC bit
257 * set (in which case it could also be direct WRITE). 257 * set (in which case it could also be direct WRITE).
258 */ 258 */
259static inline int cfq_bio_sync(struct bio *bio) 259static inline bool cfq_bio_sync(struct bio *bio)
260{ 260{
261 if (bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO)) 261 return bio_data_dir(bio) == READ || bio_rw_flagged(bio, BIO_RW_SYNCIO);
262 return 1;
263
264 return 0;
265} 262}
266 263
267/* 264/*
268 * scheduler run of queue, if there are requests pending and no one in the 265 * scheduler run of queue, if there are requests pending and no one in the
269 * driver that will restart queueing 266 * driver that will restart queueing
270 */ 267 */
271static inline void cfq_schedule_dispatch(struct cfq_data *cfqd, 268static inline void cfq_schedule_dispatch(struct cfq_data *cfqd)
272 unsigned long delay)
273{ 269{
274 if (cfqd->busy_queues) { 270 if (cfqd->busy_queues) {
275 cfq_log(cfqd, "schedule dispatch"); 271 cfq_log(cfqd, "schedule dispatch");
276 kblockd_schedule_delayed_work(cfqd->queue, &cfqd->unplug_work, 272 kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work);
277 delay);
278 } 273 }
279} 274}
280 275
@@ -290,7 +285,7 @@ static int cfq_queue_empty(struct request_queue *q)
290 * if a queue is marked sync and has sync io queued. A sync queue with async 285 * if a queue is marked sync and has sync io queued. A sync queue with async
291 * io only, should not get full sync slice length. 286 * io only, should not get full sync slice length.
292 */ 287 */
293static inline int cfq_prio_slice(struct cfq_data *cfqd, int sync, 288static inline int cfq_prio_slice(struct cfq_data *cfqd, bool sync,
294 unsigned short prio) 289 unsigned short prio)
295{ 290{
296 const int base_slice = cfqd->cfq_slice[sync]; 291 const int base_slice = cfqd->cfq_slice[sync];
@@ -318,7 +313,7 @@ cfq_set_prio_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq)
318 * isn't valid until the first request from the dispatch is activated 313 * isn't valid until the first request from the dispatch is activated
319 * and the slice time set. 314 * and the slice time set.
320 */ 315 */
321static inline int cfq_slice_used(struct cfq_queue *cfqq) 316static inline bool cfq_slice_used(struct cfq_queue *cfqq)
322{ 317{
323 if (cfq_cfqq_slice_new(cfqq)) 318 if (cfq_cfqq_slice_new(cfqq))
324 return 0; 319 return 0;
@@ -493,7 +488,7 @@ static unsigned long cfq_slice_offset(struct cfq_data *cfqd,
493 * we will service the queues. 488 * we will service the queues.
494 */ 489 */
495static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq, 490static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
496 int add_front) 491 bool add_front)
497{ 492{
498 struct rb_node **p, *parent; 493 struct rb_node **p, *parent;
499 struct cfq_queue *__cfqq; 494 struct cfq_queue *__cfqq;
@@ -509,11 +504,20 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
509 } else 504 } else
510 rb_key += jiffies; 505 rb_key += jiffies;
511 } else if (!add_front) { 506 } else if (!add_front) {
507 /*
508 * Get our rb key offset. Subtract any residual slice
509 * value carried from last service. A negative resid
510 * count indicates slice overrun, and this should position
511 * the next service time further away in the tree.
512 */
512 rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies; 513 rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies;
513 rb_key += cfqq->slice_resid; 514 rb_key -= cfqq->slice_resid;
514 cfqq->slice_resid = 0; 515 cfqq->slice_resid = 0;
515 } else 516 } else {
516 rb_key = 0; 517 rb_key = -HZ;
518 __cfqq = cfq_rb_first(&cfqd->service_tree);
519 rb_key += __cfqq ? __cfqq->rb_key : jiffies;
520 }
517 521
518 if (!RB_EMPTY_NODE(&cfqq->rb_node)) { 522 if (!RB_EMPTY_NODE(&cfqq->rb_node)) {
519 /* 523 /*
@@ -547,7 +551,7 @@ static void cfq_service_tree_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
547 n = &(*p)->rb_left; 551 n = &(*p)->rb_left;
548 else if (cfq_class_idle(cfqq) > cfq_class_idle(__cfqq)) 552 else if (cfq_class_idle(cfqq) > cfq_class_idle(__cfqq))
549 n = &(*p)->rb_right; 553 n = &(*p)->rb_right;
550 else if (rb_key < __cfqq->rb_key) 554 else if (time_before(rb_key, __cfqq->rb_key))
551 n = &(*p)->rb_left; 555 n = &(*p)->rb_left;
552 else 556 else
553 n = &(*p)->rb_right; 557 n = &(*p)->rb_right;
@@ -827,8 +831,10 @@ cfq_merged_requests(struct request_queue *q, struct request *rq,
827 * reposition in fifo if next is older than rq 831 * reposition in fifo if next is older than rq
828 */ 832 */
829 if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && 833 if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) &&
830 time_before(next->start_time, rq->start_time)) 834 time_before(rq_fifo_time(next), rq_fifo_time(rq))) {
831 list_move(&rq->queuelist, &next->queuelist); 835 list_move(&rq->queuelist, &next->queuelist);
836 rq_set_fifo_time(rq, rq_fifo_time(next));
837 }
832 838
833 cfq_remove_request(next); 839 cfq_remove_request(next);
834} 840}
@@ -844,7 +850,7 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
844 * Disallow merge of a sync bio into an async request. 850 * Disallow merge of a sync bio into an async request.
845 */ 851 */
846 if (cfq_bio_sync(bio) && !rq_is_sync(rq)) 852 if (cfq_bio_sync(bio) && !rq_is_sync(rq))
847 return 0; 853 return false;
848 854
849 /* 855 /*
850 * Lookup the cfqq that this bio will be queued with. Allow 856 * Lookup the cfqq that this bio will be queued with. Allow
@@ -852,13 +858,10 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
852 */ 858 */
853 cic = cfq_cic_lookup(cfqd, current->io_context); 859 cic = cfq_cic_lookup(cfqd, current->io_context);
854 if (!cic) 860 if (!cic)
855 return 0; 861 return false;
856 862
857 cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); 863 cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio));
858 if (cfqq == RQ_CFQQ(rq)) 864 return cfqq == RQ_CFQQ(rq);
859 return 1;
860
861 return 0;
862} 865}
863 866
864static void __cfq_set_active_queue(struct cfq_data *cfqd, 867static void __cfq_set_active_queue(struct cfq_data *cfqd,
@@ -886,7 +889,7 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
886 */ 889 */
887static void 890static void
888__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, 891__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
889 int timed_out) 892 bool timed_out)
890{ 893{
891 cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out); 894 cfq_log_cfqq(cfqd, cfqq, "slice expired t=%d", timed_out);
892 895
@@ -914,7 +917,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
914 } 917 }
915} 918}
916 919
917static inline void cfq_slice_expired(struct cfq_data *cfqd, int timed_out) 920static inline void cfq_slice_expired(struct cfq_data *cfqd, bool timed_out)
918{ 921{
919 struct cfq_queue *cfqq = cfqd->active_queue; 922 struct cfq_queue *cfqq = cfqd->active_queue;
920 923
@@ -1026,7 +1029,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1026 */ 1029 */
1027static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd, 1030static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
1028 struct cfq_queue *cur_cfqq, 1031 struct cfq_queue *cur_cfqq,
1029 int probe) 1032 bool probe)
1030{ 1033{
1031 struct cfq_queue *cfqq; 1034 struct cfq_queue *cfqq;
1032 1035
@@ -1090,6 +1093,15 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
1090 if (!cic || !atomic_read(&cic->ioc->nr_tasks)) 1093 if (!cic || !atomic_read(&cic->ioc->nr_tasks))
1091 return; 1094 return;
1092 1095
1096 /*
1097 * If our average think time is larger than the remaining time
1098 * slice, then don't idle. This avoids overrunning the allotted
1099 * time slice.
1100 */
1101 if (sample_valid(cic->ttime_samples) &&
1102 (cfqq->slice_end - jiffies < cic->ttime_mean))
1103 return;
1104
1093 cfq_mark_cfqq_wait_request(cfqq); 1105 cfq_mark_cfqq_wait_request(cfqq);
1094 1106
1095 /* 1107 /*
@@ -1129,9 +1141,7 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq)
1129 */ 1141 */
1130static struct request *cfq_check_fifo(struct cfq_queue *cfqq) 1142static struct request *cfq_check_fifo(struct cfq_queue *cfqq)
1131{ 1143{
1132 struct cfq_data *cfqd = cfqq->cfqd; 1144 struct request *rq = NULL;
1133 struct request *rq;
1134 int fifo;
1135 1145
1136 if (cfq_cfqq_fifo_expire(cfqq)) 1146 if (cfq_cfqq_fifo_expire(cfqq))
1137 return NULL; 1147 return NULL;
@@ -1141,13 +1151,11 @@ static struct request *cfq_check_fifo(struct cfq_queue *cfqq)
1141 if (list_empty(&cfqq->fifo)) 1151 if (list_empty(&cfqq->fifo))
1142 return NULL; 1152 return NULL;
1143 1153
1144 fifo = cfq_cfqq_sync(cfqq);
1145 rq = rq_entry_fifo(cfqq->fifo.next); 1154 rq = rq_entry_fifo(cfqq->fifo.next);
1146 1155 if (time_before(jiffies, rq_fifo_time(rq)))
1147 if (time_before(jiffies, rq->start_time + cfqd->cfq_fifo_expire[fifo]))
1148 rq = NULL; 1156 rq = NULL;
1149 1157
1150 cfq_log_cfqq(cfqd, cfqq, "fifo=%p", rq); 1158 cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq);
1151 return rq; 1159 return rq;
1152} 1160}
1153 1161
@@ -1248,67 +1256,21 @@ static int cfq_forced_dispatch(struct cfq_data *cfqd)
1248 return dispatched; 1256 return dispatched;
1249} 1257}
1250 1258
1251/* 1259static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1252 * Dispatch a request from cfqq, moving them to the request queue
1253 * dispatch list.
1254 */
1255static void cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1256{ 1260{
1257 struct request *rq;
1258
1259 BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list));
1260
1261 /*
1262 * follow expired path, else get first next available
1263 */
1264 rq = cfq_check_fifo(cfqq);
1265 if (!rq)
1266 rq = cfqq->next_rq;
1267
1268 /*
1269 * insert request into driver dispatch list
1270 */
1271 cfq_dispatch_insert(cfqd->queue, rq);
1272
1273 if (!cfqd->active_cic) {
1274 struct cfq_io_context *cic = RQ_CIC(rq);
1275
1276 atomic_long_inc(&cic->ioc->refcount);
1277 cfqd->active_cic = cic;
1278 }
1279}
1280
1281/*
1282 * Find the cfqq that we need to service and move a request from that to the
1283 * dispatch list
1284 */
1285static int cfq_dispatch_requests(struct request_queue *q, int force)
1286{
1287 struct cfq_data *cfqd = q->elevator->elevator_data;
1288 struct cfq_queue *cfqq;
1289 unsigned int max_dispatch; 1261 unsigned int max_dispatch;
1290 1262
1291 if (!cfqd->busy_queues)
1292 return 0;
1293
1294 if (unlikely(force))
1295 return cfq_forced_dispatch(cfqd);
1296
1297 cfqq = cfq_select_queue(cfqd);
1298 if (!cfqq)
1299 return 0;
1300
1301 /* 1263 /*
1302 * Drain async requests before we start sync IO 1264 * Drain async requests before we start sync IO
1303 */ 1265 */
1304 if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC]) 1266 if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC])
1305 return 0; 1267 return false;
1306 1268
1307 /* 1269 /*
1308 * If this is an async queue and we have sync IO in flight, let it wait 1270 * If this is an async queue and we have sync IO in flight, let it wait
1309 */ 1271 */
1310 if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq)) 1272 if (cfqd->sync_flight && !cfq_cfqq_sync(cfqq))
1311 return 0; 1273 return false;
1312 1274
1313 max_dispatch = cfqd->cfq_quantum; 1275 max_dispatch = cfqd->cfq_quantum;
1314 if (cfq_class_idle(cfqq)) 1276 if (cfq_class_idle(cfqq))
@@ -1322,13 +1284,13 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
1322 * idle queue must always only have a single IO in flight 1284 * idle queue must always only have a single IO in flight
1323 */ 1285 */
1324 if (cfq_class_idle(cfqq)) 1286 if (cfq_class_idle(cfqq))
1325 return 0; 1287 return false;
1326 1288
1327 /* 1289 /*
1328 * We have other queues, don't allow more IO from this one 1290 * We have other queues, don't allow more IO from this one
1329 */ 1291 */
1330 if (cfqd->busy_queues > 1) 1292 if (cfqd->busy_queues > 1)
1331 return 0; 1293 return false;
1332 1294
1333 /* 1295 /*
1334 * Sole queue user, allow bigger slice 1296 * Sole queue user, allow bigger slice
@@ -1352,13 +1314,72 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
1352 max_dispatch = depth; 1314 max_dispatch = depth;
1353 } 1315 }
1354 1316
1355 if (cfqq->dispatched >= max_dispatch) 1317 /*
1318 * If we're below the current max, allow a dispatch
1319 */
1320 return cfqq->dispatched < max_dispatch;
1321}
1322
1323/*
1324 * Dispatch a request from cfqq, moving them to the request queue
1325 * dispatch list.
1326 */
1327static bool cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1328{
1329 struct request *rq;
1330
1331 BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list));
1332
1333 if (!cfq_may_dispatch(cfqd, cfqq))
1334 return false;
1335
1336 /*
1337 * follow expired path, else get first next available
1338 */
1339 rq = cfq_check_fifo(cfqq);
1340 if (!rq)
1341 rq = cfqq->next_rq;
1342
1343 /*
1344 * insert request into driver dispatch list
1345 */
1346 cfq_dispatch_insert(cfqd->queue, rq);
1347
1348 if (!cfqd->active_cic) {
1349 struct cfq_io_context *cic = RQ_CIC(rq);
1350
1351 atomic_long_inc(&cic->ioc->refcount);
1352 cfqd->active_cic = cic;
1353 }
1354
1355 return true;
1356}
1357
1358/*
1359 * Find the cfqq that we need to service and move a request from that to the
1360 * dispatch list
1361 */
1362static int cfq_dispatch_requests(struct request_queue *q, int force)
1363{
1364 struct cfq_data *cfqd = q->elevator->elevator_data;
1365 struct cfq_queue *cfqq;
1366
1367 if (!cfqd->busy_queues)
1368 return 0;
1369
1370 if (unlikely(force))
1371 return cfq_forced_dispatch(cfqd);
1372
1373 cfqq = cfq_select_queue(cfqd);
1374 if (!cfqq)
1356 return 0; 1375 return 0;
1357 1376
1358 /* 1377 /*
1359 * Dispatch a request from this cfqq 1378 * Dispatch a request from this cfqq, if it is allowed
1360 */ 1379 */
1361 cfq_dispatch_request(cfqd, cfqq); 1380 if (!cfq_dispatch_request(cfqd, cfqq))
1381 return 0;
1382
1362 cfqq->slice_dispatch++; 1383 cfqq->slice_dispatch++;
1363 cfq_clear_cfqq_must_dispatch(cfqq); 1384 cfq_clear_cfqq_must_dispatch(cfqq);
1364 1385
@@ -1399,7 +1420,7 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
1399 1420
1400 if (unlikely(cfqd->active_queue == cfqq)) { 1421 if (unlikely(cfqd->active_queue == cfqq)) {
1401 __cfq_slice_expired(cfqd, cfqq, 0); 1422 __cfq_slice_expired(cfqd, cfqq, 0);
1402 cfq_schedule_dispatch(cfqd, 0); 1423 cfq_schedule_dispatch(cfqd);
1403 } 1424 }
1404 1425
1405 kmem_cache_free(cfq_pool, cfqq); 1426 kmem_cache_free(cfq_pool, cfqq);
@@ -1494,7 +1515,7 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1494{ 1515{
1495 if (unlikely(cfqq == cfqd->active_queue)) { 1516 if (unlikely(cfqq == cfqd->active_queue)) {
1496 __cfq_slice_expired(cfqd, cfqq, 0); 1517 __cfq_slice_expired(cfqd, cfqq, 0);
1497 cfq_schedule_dispatch(cfqd, 0); 1518 cfq_schedule_dispatch(cfqd);
1498 } 1519 }
1499 1520
1500 cfq_put_queue(cfqq); 1521 cfq_put_queue(cfqq);
@@ -1658,7 +1679,7 @@ static void cfq_ioc_set_ioprio(struct io_context *ioc)
1658} 1679}
1659 1680
1660static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1681static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1661 pid_t pid, int is_sync) 1682 pid_t pid, bool is_sync)
1662{ 1683{
1663 RB_CLEAR_NODE(&cfqq->rb_node); 1684 RB_CLEAR_NODE(&cfqq->rb_node);
1664 RB_CLEAR_NODE(&cfqq->p_node); 1685 RB_CLEAR_NODE(&cfqq->p_node);
@@ -1678,7 +1699,7 @@ static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1678} 1699}
1679 1700
1680static struct cfq_queue * 1701static struct cfq_queue *
1681cfq_find_alloc_queue(struct cfq_data *cfqd, int is_sync, 1702cfq_find_alloc_queue(struct cfq_data *cfqd, bool is_sync,
1682 struct io_context *ioc, gfp_t gfp_mask) 1703 struct io_context *ioc, gfp_t gfp_mask)
1683{ 1704{
1684 struct cfq_queue *cfqq, *new_cfqq = NULL; 1705 struct cfq_queue *cfqq, *new_cfqq = NULL;
@@ -1742,7 +1763,7 @@ cfq_async_queue_prio(struct cfq_data *cfqd, int ioprio_class, int ioprio)
1742} 1763}
1743 1764
1744static struct cfq_queue * 1765static struct cfq_queue *
1745cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct io_context *ioc, 1766cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct io_context *ioc,
1746 gfp_t gfp_mask) 1767 gfp_t gfp_mask)
1747{ 1768{
1748 const int ioprio = task_ioprio(ioc); 1769 const int ioprio = task_ioprio(ioc);
@@ -1977,7 +1998,10 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1977 (!cfqd->cfq_latency && cfqd->hw_tag && CIC_SEEKY(cic))) 1998 (!cfqd->cfq_latency && cfqd->hw_tag && CIC_SEEKY(cic)))
1978 enable_idle = 0; 1999 enable_idle = 0;
1979 else if (sample_valid(cic->ttime_samples)) { 2000 else if (sample_valid(cic->ttime_samples)) {
1980 if (cic->ttime_mean > cfqd->cfq_slice_idle) 2001 unsigned int slice_idle = cfqd->cfq_slice_idle;
2002 if (sample_valid(cic->seek_samples) && CIC_SEEKY(cic))
2003 slice_idle = msecs_to_jiffies(CFQ_MIN_TT);
2004 if (cic->ttime_mean > slice_idle)
1981 enable_idle = 0; 2005 enable_idle = 0;
1982 else 2006 else
1983 enable_idle = 1; 2007 enable_idle = 1;
@@ -1996,7 +2020,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1996 * Check if new_cfqq should preempt the currently active queue. Return 0 for 2020 * Check if new_cfqq should preempt the currently active queue. Return 0 for
1997 * no or if we aren't sure, a 1 will cause a preempt. 2021 * no or if we aren't sure, a 1 will cause a preempt.
1998 */ 2022 */
1999static int 2023static bool
2000cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, 2024cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
2001 struct request *rq) 2025 struct request *rq)
2002{ 2026{
@@ -2004,48 +2028,48 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
2004 2028
2005 cfqq = cfqd->active_queue; 2029 cfqq = cfqd->active_queue;
2006 if (!cfqq) 2030 if (!cfqq)
2007 return 0; 2031 return false;
2008 2032
2009 if (cfq_slice_used(cfqq)) 2033 if (cfq_slice_used(cfqq))
2010 return 1; 2034 return true;
2011 2035
2012 if (cfq_class_idle(new_cfqq)) 2036 if (cfq_class_idle(new_cfqq))
2013 return 0; 2037 return false;
2014 2038
2015 if (cfq_class_idle(cfqq)) 2039 if (cfq_class_idle(cfqq))
2016 return 1; 2040 return true;
2017 2041
2018 /* 2042 /*
2019 * if the new request is sync, but the currently running queue is 2043 * if the new request is sync, but the currently running queue is
2020 * not, let the sync request have priority. 2044 * not, let the sync request have priority.
2021 */ 2045 */
2022 if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq)) 2046 if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
2023 return 1; 2047 return true;
2024 2048
2025 /* 2049 /*
2026 * So both queues are sync. Let the new request get disk time if 2050 * So both queues are sync. Let the new request get disk time if
2027 * it's a metadata request and the current queue is doing regular IO. 2051 * it's a metadata request and the current queue is doing regular IO.
2028 */ 2052 */
2029 if (rq_is_meta(rq) && !cfqq->meta_pending) 2053 if (rq_is_meta(rq) && !cfqq->meta_pending)
2030 return 1; 2054 return false;
2031 2055
2032 /* 2056 /*
2033 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice. 2057 * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
2034 */ 2058 */
2035 if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq)) 2059 if (cfq_class_rt(new_cfqq) && !cfq_class_rt(cfqq))
2036 return 1; 2060 return true;
2037 2061
2038 if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq)) 2062 if (!cfqd->active_cic || !cfq_cfqq_wait_request(cfqq))
2039 return 0; 2063 return false;
2040 2064
2041 /* 2065 /*
2042 * if this request is as-good as one we would expect from the 2066 * if this request is as-good as one we would expect from the
2043 * current cfqq, let it preempt 2067 * current cfqq, let it preempt
2044 */ 2068 */
2045 if (cfq_rq_close(cfqd, rq)) 2069 if (cfq_rq_close(cfqd, rq))
2046 return 1; 2070 return true;
2047 2071
2048 return 0; 2072 return false;
2049} 2073}
2050 2074
2051/* 2075/*
@@ -2130,6 +2154,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
2130 2154
2131 cfq_add_rq_rb(rq); 2155 cfq_add_rq_rb(rq);
2132 2156
2157 rq_set_fifo_time(rq, jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]);
2133 list_add_tail(&rq->queuelist, &cfqq->fifo); 2158 list_add_tail(&rq->queuelist, &cfqq->fifo);
2134 2159
2135 cfq_rq_enqueued(cfqd, cfqq, rq); 2160 cfq_rq_enqueued(cfqd, cfqq, rq);
@@ -2211,7 +2236,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
2211 } 2236 }
2212 2237
2213 if (!rq_in_driver(cfqd)) 2238 if (!rq_in_driver(cfqd))
2214 cfq_schedule_dispatch(cfqd, 0); 2239 cfq_schedule_dispatch(cfqd);
2215} 2240}
2216 2241
2217/* 2242/*
@@ -2309,7 +2334,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
2309 struct cfq_data *cfqd = q->elevator->elevator_data; 2334 struct cfq_data *cfqd = q->elevator->elevator_data;
2310 struct cfq_io_context *cic; 2335 struct cfq_io_context *cic;
2311 const int rw = rq_data_dir(rq); 2336 const int rw = rq_data_dir(rq);
2312 const int is_sync = rq_is_sync(rq); 2337 const bool is_sync = rq_is_sync(rq);
2313 struct cfq_queue *cfqq; 2338 struct cfq_queue *cfqq;
2314 unsigned long flags; 2339 unsigned long flags;
2315 2340
@@ -2341,7 +2366,7 @@ queue_fail:
2341 if (cic) 2366 if (cic)
2342 put_io_context(cic->ioc); 2367 put_io_context(cic->ioc);
2343 2368
2344 cfq_schedule_dispatch(cfqd, 0); 2369 cfq_schedule_dispatch(cfqd);
2345 spin_unlock_irqrestore(q->queue_lock, flags); 2370 spin_unlock_irqrestore(q->queue_lock, flags);
2346 cfq_log(cfqd, "set_request fail"); 2371 cfq_log(cfqd, "set_request fail");
2347 return 1; 2372 return 1;
@@ -2350,7 +2375,7 @@ queue_fail:
2350static void cfq_kick_queue(struct work_struct *work) 2375static void cfq_kick_queue(struct work_struct *work)
2351{ 2376{
2352 struct cfq_data *cfqd = 2377 struct cfq_data *cfqd =
2353 container_of(work, struct cfq_data, unplug_work.work); 2378 container_of(work, struct cfq_data, unplug_work);
2354 struct request_queue *q = cfqd->queue; 2379 struct request_queue *q = cfqd->queue;
2355 2380
2356 spin_lock_irq(q->queue_lock); 2381 spin_lock_irq(q->queue_lock);
@@ -2404,7 +2429,7 @@ static void cfq_idle_slice_timer(unsigned long data)
2404expire: 2429expire:
2405 cfq_slice_expired(cfqd, timed_out); 2430 cfq_slice_expired(cfqd, timed_out);
2406out_kick: 2431out_kick:
2407 cfq_schedule_dispatch(cfqd, 0); 2432 cfq_schedule_dispatch(cfqd);
2408out_cont: 2433out_cont:
2409 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); 2434 spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
2410} 2435}
@@ -2412,7 +2437,7 @@ out_cont:
2412static void cfq_shutdown_timer_wq(struct cfq_data *cfqd) 2437static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
2413{ 2438{
2414 del_timer_sync(&cfqd->idle_slice_timer); 2439 del_timer_sync(&cfqd->idle_slice_timer);
2415 cancel_delayed_work_sync(&cfqd->unplug_work); 2440 cancel_work_sync(&cfqd->unplug_work);
2416} 2441}
2417 2442
2418static void cfq_put_async_queues(struct cfq_data *cfqd) 2443static void cfq_put_async_queues(struct cfq_data *cfqd)
@@ -2494,7 +2519,7 @@ static void *cfq_init_queue(struct request_queue *q)
2494 cfqd->idle_slice_timer.function = cfq_idle_slice_timer; 2519 cfqd->idle_slice_timer.function = cfq_idle_slice_timer;
2495 cfqd->idle_slice_timer.data = (unsigned long) cfqd; 2520 cfqd->idle_slice_timer.data = (unsigned long) cfqd;
2496 2521
2497 INIT_DELAYED_WORK(&cfqd->unplug_work, cfq_kick_queue); 2522 INIT_WORK(&cfqd->unplug_work, cfq_kick_queue);
2498 2523
2499 cfqd->cfq_quantum = cfq_quantum; 2524 cfqd->cfq_quantum = cfq_quantum;
2500 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0]; 2525 cfqd->cfq_fifo_expire[0] = cfq_fifo_expire[0];
diff --git a/block/elevator.c b/block/elevator.c
index 1975b619c86d..a847046c6e53 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -1059,9 +1059,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
1059 return count; 1059 return count;
1060 1060
1061 strlcpy(elevator_name, name, sizeof(elevator_name)); 1061 strlcpy(elevator_name, name, sizeof(elevator_name));
1062 strstrip(elevator_name); 1062 e = elevator_get(strstrip(elevator_name));
1063
1064 e = elevator_get(elevator_name);
1065 if (!e) { 1063 if (!e) {
1066 printk(KERN_ERR "elevator: type %s not found\n", elevator_name); 1064 printk(KERN_ERR "elevator: type %s not found\n", elevator_name);
1067 return -EINVAL; 1065 return -EINVAL;
diff --git a/block/genhd.c b/block/genhd.c
index 5a0861da324d..517e4332cb37 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -869,6 +869,7 @@ static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
869static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL); 869static DEVICE_ATTR(alignment_offset, S_IRUGO, disk_alignment_offset_show, NULL);
870static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); 870static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL);
871static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); 871static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
872static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
872#ifdef CONFIG_FAIL_MAKE_REQUEST 873#ifdef CONFIG_FAIL_MAKE_REQUEST
873static struct device_attribute dev_attr_fail = 874static struct device_attribute dev_attr_fail =
874 __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); 875 __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store);
@@ -888,6 +889,7 @@ static struct attribute *disk_attrs[] = {
888 &dev_attr_alignment_offset.attr, 889 &dev_attr_alignment_offset.attr,
889 &dev_attr_capability.attr, 890 &dev_attr_capability.attr,
890 &dev_attr_stat.attr, 891 &dev_attr_stat.attr,
892 &dev_attr_inflight.attr,
891#ifdef CONFIG_FAIL_MAKE_REQUEST 893#ifdef CONFIG_FAIL_MAKE_REQUEST
892 &dev_attr_fail.attr, 894 &dev_attr_fail.attr,
893#endif 895#endif
@@ -1053,7 +1055,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
1053 part_stat_read(hd, merges[1]), 1055 part_stat_read(hd, merges[1]),
1054 (unsigned long long)part_stat_read(hd, sectors[1]), 1056 (unsigned long long)part_stat_read(hd, sectors[1]),
1055 jiffies_to_msecs(part_stat_read(hd, ticks[1])), 1057 jiffies_to_msecs(part_stat_read(hd, ticks[1])),
1056 hd->in_flight, 1058 part_in_flight(hd),
1057 jiffies_to_msecs(part_stat_read(hd, io_ticks)), 1059 jiffies_to_msecs(part_stat_read(hd, io_ticks)),
1058 jiffies_to_msecs(part_stat_read(hd, time_in_queue)) 1060 jiffies_to_msecs(part_stat_read(hd, time_in_queue))
1059 ); 1061 );
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 31122214e0ec..1af808171d46 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -389,6 +389,17 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
389 389
390 pbus = pdev->subordinate; 390 pbus = pdev->subordinate;
391 pci_dev_put(pdev); 391 pci_dev_put(pdev);
392
393 /*
394 * This function may be called for a non-PCI device that has a
395 * PCI parent (eg. a disk under a PCI SATA controller). In that
396 * case pdev->subordinate will be NULL for the parent.
397 */
398 if (!pbus) {
399 dev_dbg(&pdev->dev, "Not a PCI-to-PCI bridge\n");
400 pdev = NULL;
401 break;
402 }
392 } 403 }
393out: 404out:
394 list_for_each_entry_safe(node, tmp, &device_list, node) 405 list_for_each_entry_safe(node, tmp, &device_list, node)
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index fb5be2d95d52..6399e5090df4 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -68,6 +68,12 @@ MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
68MODULE_VERSION("3.6.20"); 68MODULE_VERSION("3.6.20");
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
70 70
71static int cciss_allow_hpsa;
72module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
73MODULE_PARM_DESC(cciss_allow_hpsa,
74 "Prevent cciss driver from accessing hardware known to be "
75 " supported by the hpsa driver");
76
71#include "cciss_cmd.h" 77#include "cciss_cmd.h"
72#include "cciss.h" 78#include "cciss.h"
73#include <linux/cciss_ioctl.h> 79#include <linux/cciss_ioctl.h>
@@ -101,8 +107,6 @@ static const struct pci_device_id cciss_pci_device_id[] = {
101 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249}, 107 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
102 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A}, 108 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324A},
103 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B}, 109 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x324B},
104 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
105 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
106 {0,} 110 {0,}
107}; 111};
108 112
@@ -123,8 +127,6 @@ static struct board_type products[] = {
123 {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, 127 {0x409D0E11, "Smart Array 6400 EM", &SA5_access},
124 {0x40910E11, "Smart Array 6i", &SA5_access}, 128 {0x40910E11, "Smart Array 6i", &SA5_access},
125 {0x3225103C, "Smart Array P600", &SA5_access}, 129 {0x3225103C, "Smart Array P600", &SA5_access},
126 {0x3223103C, "Smart Array P800", &SA5_access},
127 {0x3234103C, "Smart Array P400", &SA5_access},
128 {0x3235103C, "Smart Array P400i", &SA5_access}, 130 {0x3235103C, "Smart Array P400i", &SA5_access},
129 {0x3211103C, "Smart Array E200i", &SA5_access}, 131 {0x3211103C, "Smart Array E200i", &SA5_access},
130 {0x3212103C, "Smart Array E200", &SA5_access}, 132 {0x3212103C, "Smart Array E200", &SA5_access},
@@ -132,6 +134,10 @@ static struct board_type products[] = {
132 {0x3214103C, "Smart Array E200i", &SA5_access}, 134 {0x3214103C, "Smart Array E200i", &SA5_access},
133 {0x3215103C, "Smart Array E200i", &SA5_access}, 135 {0x3215103C, "Smart Array E200i", &SA5_access},
134 {0x3237103C, "Smart Array E500", &SA5_access}, 136 {0x3237103C, "Smart Array E500", &SA5_access},
137/* controllers below this line are also supported by the hpsa driver. */
138#define HPSA_BOUNDARY 0x3223103C
139 {0x3223103C, "Smart Array P800", &SA5_access},
140 {0x3234103C, "Smart Array P400", &SA5_access},
135 {0x323D103C, "Smart Array P700m", &SA5_access}, 141 {0x323D103C, "Smart Array P700m", &SA5_access},
136 {0x3241103C, "Smart Array P212", &SA5_access}, 142 {0x3241103C, "Smart Array P212", &SA5_access},
137 {0x3243103C, "Smart Array P410", &SA5_access}, 143 {0x3243103C, "Smart Array P410", &SA5_access},
@@ -140,7 +146,6 @@ static struct board_type products[] = {
140 {0x3249103C, "Smart Array P812", &SA5_access}, 146 {0x3249103C, "Smart Array P812", &SA5_access},
141 {0x324A103C, "Smart Array P712m", &SA5_access}, 147 {0x324A103C, "Smart Array P712m", &SA5_access},
142 {0x324B103C, "Smart Array P711m", &SA5_access}, 148 {0x324B103C, "Smart Array P711m", &SA5_access},
143 {0xFFFF103C, "Unknown Smart Array", &SA5_access},
144}; 149};
145 150
146/* How long to wait (in milliseconds) for board to go into simple mode */ 151/* How long to wait (in milliseconds) for board to go into simple mode */
@@ -3754,7 +3759,27 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
3754 __u64 cfg_offset; 3759 __u64 cfg_offset;
3755 __u32 cfg_base_addr; 3760 __u32 cfg_base_addr;
3756 __u64 cfg_base_addr_index; 3761 __u64 cfg_base_addr_index;
3757 int i, err; 3762 int i, prod_index, err;
3763
3764 subsystem_vendor_id = pdev->subsystem_vendor;
3765 subsystem_device_id = pdev->subsystem_device;
3766 board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) |
3767 subsystem_vendor_id);
3768
3769 for (i = 0; i < ARRAY_SIZE(products); i++) {
3770 /* Stand aside for hpsa driver on request */
3771 if (cciss_allow_hpsa && products[i].board_id == HPSA_BOUNDARY)
3772 return -ENODEV;
3773 if (board_id == products[i].board_id)
3774 break;
3775 }
3776 prod_index = i;
3777 if (prod_index == ARRAY_SIZE(products)) {
3778 dev_warn(&pdev->dev,
3779 "unrecognized board ID: 0x%08lx, ignoring.\n",
3780 (unsigned long) board_id);
3781 return -ENODEV;
3782 }
3758 3783
3759 /* check to see if controller has been disabled */ 3784 /* check to see if controller has been disabled */
3760 /* BEFORE trying to enable it */ 3785 /* BEFORE trying to enable it */
@@ -3778,11 +3803,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
3778 return err; 3803 return err;
3779 } 3804 }
3780 3805
3781 subsystem_vendor_id = pdev->subsystem_vendor;
3782 subsystem_device_id = pdev->subsystem_device;
3783 board_id = (((__u32) (subsystem_device_id << 16) & 0xffff0000) |
3784 subsystem_vendor_id);
3785
3786#ifdef CCISS_DEBUG 3806#ifdef CCISS_DEBUG
3787 printk("command = %x\n", command); 3807 printk("command = %x\n", command);
3788 printk("irq = %x\n", pdev->irq); 3808 printk("irq = %x\n", pdev->irq);
@@ -3868,14 +3888,9 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
3868 * leave a little room for ioctl calls. 3888 * leave a little room for ioctl calls.
3869 */ 3889 */
3870 c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); 3890 c->max_commands = readl(&(c->cfgtable->CmdsOutMax));
3871 for (i = 0; i < ARRAY_SIZE(products); i++) { 3891 c->product_name = products[prod_index].product_name;
3872 if (board_id == products[i].board_id) { 3892 c->access = *(products[prod_index].access);
3873 c->product_name = products[i].product_name; 3893 c->nr_cmds = c->max_commands - 4;
3874 c->access = *(products[i].access);
3875 c->nr_cmds = c->max_commands - 4;
3876 break;
3877 }
3878 }
3879 if ((readb(&c->cfgtable->Signature[0]) != 'C') || 3894 if ((readb(&c->cfgtable->Signature[0]) != 'C') ||
3880 (readb(&c->cfgtable->Signature[1]) != 'I') || 3895 (readb(&c->cfgtable->Signature[1]) != 'I') ||
3881 (readb(&c->cfgtable->Signature[2]) != 'S') || 3896 (readb(&c->cfgtable->Signature[2]) != 'S') ||
@@ -3884,27 +3899,6 @@ static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
3884 err = -ENODEV; 3899 err = -ENODEV;
3885 goto err_out_free_res; 3900 goto err_out_free_res;
3886 } 3901 }
3887 /* We didn't find the controller in our list. We know the
3888 * signature is valid. If it's an HP device let's try to
3889 * bind to the device and fire it up. Otherwise we bail.
3890 */
3891 if (i == ARRAY_SIZE(products)) {
3892 if (subsystem_vendor_id == PCI_VENDOR_ID_HP) {
3893 c->product_name = products[i-1].product_name;
3894 c->access = *(products[i-1].access);
3895 c->nr_cmds = c->max_commands - 4;
3896 printk(KERN_WARNING "cciss: This is an unknown "
3897 "Smart Array controller.\n"
3898 "cciss: Please update to the latest driver "
3899 "available from www.hp.com.\n");
3900 } else {
3901 printk(KERN_WARNING "cciss: Sorry, I don't know how"
3902 " to access the Smart Array controller %08lx\n"
3903 , (unsigned long)board_id);
3904 err = -ENODEV;
3905 goto err_out_free_res;
3906 }
3907 }
3908#ifdef CONFIG_X86 3902#ifdef CONFIG_X86
3909 { 3903 {
3910 /* Need to enable prefetch in the SCSI core for 6400 in x86 */ 3904 /* Need to enable prefetch in the SCSI core for 6400 in x86 */
@@ -4254,7 +4248,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
4254 mutex_init(&hba[i]->busy_shutting_down); 4248 mutex_init(&hba[i]->busy_shutting_down);
4255 4249
4256 if (cciss_pci_init(hba[i], pdev) != 0) 4250 if (cciss_pci_init(hba[i], pdev) != 0)
4257 goto clean0; 4251 goto clean_no_release_regions;
4258 4252
4259 sprintf(hba[i]->devname, "cciss%d", i); 4253 sprintf(hba[i]->devname, "cciss%d", i);
4260 hba[i]->ctlr = i; 4254 hba[i]->ctlr = i;
@@ -4391,13 +4385,14 @@ clean2:
4391clean1: 4385clean1:
4392 cciss_destroy_hba_sysfs_entry(hba[i]); 4386 cciss_destroy_hba_sysfs_entry(hba[i]);
4393clean0: 4387clean0:
4388 pci_release_regions(pdev);
4389clean_no_release_regions:
4394 hba[i]->busy_initializing = 0; 4390 hba[i]->busy_initializing = 0;
4395 4391
4396 /* 4392 /*
4397 * Deliberately omit pci_disable_device(): it does something nasty to 4393 * Deliberately omit pci_disable_device(): it does something nasty to
4398 * Smart Array controllers that pci_enable_device does not undo 4394 * Smart Array controllers that pci_enable_device does not undo
4399 */ 4395 */
4400 pci_release_regions(pdev);
4401 pci_set_drvdata(pdev, NULL); 4396 pci_set_drvdata(pdev, NULL);
4402 free_hba(i); 4397 free_hba(i);
4403 return -1; 4398 return -1;
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index aac0985a572b..31e7c91c2d9d 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -43,6 +43,7 @@
43#define RTC_VERSION "1.07" 43#define RTC_VERSION "1.07"
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/sched.h>
46#include <linux/errno.h> 47#include <linux/errno.h>
47#include <linux/miscdevice.h> 48#include <linux/miscdevice.h>
48#include <linux/fcntl.h> 49#include <linux/fcntl.h>
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index e0d0f8b2696b..bc4ab3e54550 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -74,6 +74,7 @@
74#include <linux/proc_fs.h> 74#include <linux/proc_fs.h>
75#include <linux/seq_file.h> 75#include <linux/seq_file.h>
76#include <linux/spinlock.h> 76#include <linux/spinlock.h>
77#include <linux/sched.h>
77#include <linux/sysctl.h> 78#include <linux/sysctl.h>
78#include <linux/wait.h> 79#include <linux/wait.h>
79#include <linux/bcd.h> 80#include <linux/bcd.h>
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index fd3dced97776..8c262aaf7c26 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -36,6 +36,7 @@
36 */ 36 */
37 37
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/sched.h>
39#include <linux/input.h> 40#include <linux/input.h>
40#include <linux/pci.h> 41#include <linux/pci.h>
41#include <linux/init.h> 42#include <linux/init.h>
diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c
index 3108991c5c8b..66fa4e10d76b 100644
--- a/drivers/char/tty_buffer.c
+++ b/drivers/char/tty_buffer.c
@@ -402,28 +402,26 @@ static void flush_to_ldisc(struct work_struct *work)
402 container_of(work, struct tty_struct, buf.work.work); 402 container_of(work, struct tty_struct, buf.work.work);
403 unsigned long flags; 403 unsigned long flags;
404 struct tty_ldisc *disc; 404 struct tty_ldisc *disc;
405 struct tty_buffer *tbuf, *head;
406 char *char_buf;
407 unsigned char *flag_buf;
408 405
409 disc = tty_ldisc_ref(tty); 406 disc = tty_ldisc_ref(tty);
410 if (disc == NULL) /* !TTY_LDISC */ 407 if (disc == NULL) /* !TTY_LDISC */
411 return; 408 return;
412 409
413 spin_lock_irqsave(&tty->buf.lock, flags); 410 spin_lock_irqsave(&tty->buf.lock, flags);
414 /* So we know a flush is running */ 411
415 set_bit(TTY_FLUSHING, &tty->flags); 412 if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
416 head = tty->buf.head; 413 struct tty_buffer *head;
417 if (head != NULL) { 414 while ((head = tty->buf.head) != NULL) {
418 tty->buf.head = NULL; 415 int count;
419 for (;;) { 416 char *char_buf;
420 int count = head->commit - head->read; 417 unsigned char *flag_buf;
418
419 count = head->commit - head->read;
421 if (!count) { 420 if (!count) {
422 if (head->next == NULL) 421 if (head->next == NULL)
423 break; 422 break;
424 tbuf = head; 423 tty->buf.head = head->next;
425 head = head->next; 424 tty_buffer_free(tty, head);
426 tty_buffer_free(tty, tbuf);
427 continue; 425 continue;
428 } 426 }
429 /* Ldisc or user is trying to flush the buffers 427 /* Ldisc or user is trying to flush the buffers
@@ -445,9 +443,9 @@ static void flush_to_ldisc(struct work_struct *work)
445 flag_buf, count); 443 flag_buf, count);
446 spin_lock_irqsave(&tty->buf.lock, flags); 444 spin_lock_irqsave(&tty->buf.lock, flags);
447 } 445 }
448 /* Restore the queue head */ 446 clear_bit(TTY_FLUSHING, &tty->flags);
449 tty->buf.head = head;
450 } 447 }
448
451 /* We may have a deferred request to flush the input buffer, 449 /* We may have a deferred request to flush the input buffer,
452 if so pull the chain under the lock and empty the queue */ 450 if so pull the chain under the lock and empty the queue */
453 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) { 451 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
@@ -455,7 +453,6 @@ static void flush_to_ldisc(struct work_struct *work)
455 clear_bit(TTY_FLUSHPENDING, &tty->flags); 453 clear_bit(TTY_FLUSHPENDING, &tty->flags);
456 wake_up(&tty->read_wait); 454 wake_up(&tty->read_wait);
457 } 455 }
458 clear_bit(TTY_FLUSHING, &tty->flags);
459 spin_unlock_irqrestore(&tty->buf.lock, flags); 456 spin_unlock_irqrestore(&tty->buf.lock, flags);
460 457
461 tty_ldisc_deref(disc); 458 tty_ldisc_deref(disc);
@@ -471,7 +468,7 @@ static void flush_to_ldisc(struct work_struct *work)
471 */ 468 */
472void tty_flush_to_ldisc(struct tty_struct *tty) 469void tty_flush_to_ldisc(struct tty_struct *tty)
473{ 470{
474 flush_to_ldisc(&tty->buf.work.work); 471 flush_delayed_work(&tty->buf.work);
475} 472}
476 473
477/** 474/**
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 50f0176de615..98dbbda3ad41 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -188,14 +188,7 @@ static struct fw_device *target_device(struct sbp2_target *tgt)
188/* Impossible login_id, to detect logout attempt before successful login */ 188/* Impossible login_id, to detect logout attempt before successful login */
189#define INVALID_LOGIN_ID 0x10000 189#define INVALID_LOGIN_ID 0x10000
190 190
191/* 191#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */
192 * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be
193 * provided in the config rom. Most devices do provide a value, which
194 * we'll use for login management orbs, but with some sane limits.
195 */
196#define SBP2_MIN_LOGIN_ORB_TIMEOUT 5000U /* Timeout in ms */
197#define SBP2_MAX_LOGIN_ORB_TIMEOUT 40000U /* Timeout in ms */
198#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */
199#define SBP2_ORB_NULL 0x80000000 192#define SBP2_ORB_NULL 0x80000000
200#define SBP2_RETRY_LIMIT 0xf /* 15 retries */ 193#define SBP2_RETRY_LIMIT 0xf /* 15 retries */
201#define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ 194#define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */
@@ -1034,7 +1027,6 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory,
1034{ 1027{
1035 struct fw_csr_iterator ci; 1028 struct fw_csr_iterator ci;
1036 int key, value; 1029 int key, value;
1037 unsigned int timeout;
1038 1030
1039 fw_csr_iterator_init(&ci, directory); 1031 fw_csr_iterator_init(&ci, directory);
1040 while (fw_csr_iterator_next(&ci, &key, &value)) { 1032 while (fw_csr_iterator_next(&ci, &key, &value)) {
@@ -1059,17 +1051,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory,
1059 1051
1060 case SBP2_CSR_UNIT_CHARACTERISTICS: 1052 case SBP2_CSR_UNIT_CHARACTERISTICS:
1061 /* the timeout value is stored in 500ms units */ 1053 /* the timeout value is stored in 500ms units */
1062 timeout = ((unsigned int) value >> 8 & 0xff) * 500; 1054 tgt->mgt_orb_timeout = (value >> 8 & 0xff) * 500;
1063 timeout = max(timeout, SBP2_MIN_LOGIN_ORB_TIMEOUT);
1064 tgt->mgt_orb_timeout =
1065 min(timeout, SBP2_MAX_LOGIN_ORB_TIMEOUT);
1066
1067 if (timeout > tgt->mgt_orb_timeout)
1068 fw_notify("%s: config rom contains %ds "
1069 "management ORB timeout, limiting "
1070 "to %ds\n", tgt->bus_id,
1071 timeout / 1000,
1072 tgt->mgt_orb_timeout / 1000);
1073 break; 1055 break;
1074 1056
1075 case SBP2_CSR_LOGICAL_UNIT_NUMBER: 1057 case SBP2_CSR_LOGICAL_UNIT_NUMBER:
@@ -1087,6 +1069,22 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory,
1087 return 0; 1069 return 0;
1088} 1070}
1089 1071
1072/*
1073 * Per section 7.4.8 of the SBP-2 spec, a mgt_ORB_timeout value can be
1074 * provided in the config rom. Most devices do provide a value, which
1075 * we'll use for login management orbs, but with some sane limits.
1076 */
1077static void sbp2_clamp_management_orb_timeout(struct sbp2_target *tgt)
1078{
1079 unsigned int timeout = tgt->mgt_orb_timeout;
1080
1081 if (timeout > 40000)
1082 fw_notify("%s: %ds mgt_ORB_timeout limited to 40s\n",
1083 tgt->bus_id, timeout / 1000);
1084
1085 tgt->mgt_orb_timeout = clamp_val(timeout, 5000, 40000);
1086}
1087
1090static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, 1088static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
1091 u32 firmware_revision) 1089 u32 firmware_revision)
1092{ 1090{
@@ -1171,6 +1169,7 @@ static int sbp2_probe(struct device *dev)
1171 &firmware_revision) < 0) 1169 &firmware_revision) < 0)
1172 goto fail_tgt_put; 1170 goto fail_tgt_put;
1173 1171
1172 sbp2_clamp_management_orb_timeout(tgt);
1174 sbp2_init_workarounds(tgt, model, firmware_revision); 1173 sbp2_init_workarounds(tgt, model, firmware_revision);
1175 1174
1176 /* 1175 /*
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index be34d32906bd..7d05c4bb201e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1066,7 +1066,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
1066 * @type: HID report type (HID_*_REPORT) 1066 * @type: HID report type (HID_*_REPORT)
1067 * @data: report contents 1067 * @data: report contents
1068 * @size: size of data parameter 1068 * @size: size of data parameter
1069 * @interrupt: called from atomic? 1069 * @interrupt: distinguish between interrupt and control transfers
1070 * 1070 *
1071 * This is data entry for lower layers. 1071 * This is data entry for lower layers.
1072 */ 1072 */
diff --git a/drivers/hid/hid-twinhan.c b/drivers/hid/hid-twinhan.c
index b05f602c051e..c40afc57fc8f 100644
--- a/drivers/hid/hid-twinhan.c
+++ b/drivers/hid/hid-twinhan.c
@@ -132,12 +132,12 @@ static struct hid_driver twinhan_driver = {
132 .input_mapping = twinhan_input_mapping, 132 .input_mapping = twinhan_input_mapping,
133}; 133};
134 134
135static int twinhan_init(void) 135static int __init twinhan_init(void)
136{ 136{
137 return hid_register_driver(&twinhan_driver); 137 return hid_register_driver(&twinhan_driver);
138} 138}
139 139
140static void twinhan_exit(void) 140static void __exit twinhan_exit(void)
141{ 141{
142 hid_unregister_driver(&twinhan_driver); 142 hid_unregister_driver(&twinhan_driver);
143} 143}
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index ba05275e5104..cdd136942bca 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -48,10 +48,9 @@ static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count,
48 char *report; 48 char *report;
49 DECLARE_WAITQUEUE(wait, current); 49 DECLARE_WAITQUEUE(wait, current);
50 50
51 while (ret == 0) { 51 mutex_lock(&list->read_mutex);
52
53 mutex_lock(&list->read_mutex);
54 52
53 while (ret == 0) {
55 if (list->head == list->tail) { 54 if (list->head == list->tail) {
56 add_wait_queue(&list->hidraw->wait, &wait); 55 add_wait_queue(&list->hidraw->wait, &wait);
57 set_current_state(TASK_INTERRUPTIBLE); 56 set_current_state(TASK_INTERRUPTIBLE);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 23e76fe0d359..376f1ab48a24 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -130,7 +130,7 @@ struct mapped_device {
130 /* 130 /*
131 * A list of ios that arrived while we were suspended. 131 * A list of ios that arrived while we were suspended.
132 */ 132 */
133 atomic_t pending; 133 atomic_t pending[2];
134 wait_queue_head_t wait; 134 wait_queue_head_t wait;
135 struct work_struct work; 135 struct work_struct work;
136 struct bio_list deferred; 136 struct bio_list deferred;
@@ -453,13 +453,14 @@ static void start_io_acct(struct dm_io *io)
453{ 453{
454 struct mapped_device *md = io->md; 454 struct mapped_device *md = io->md;
455 int cpu; 455 int cpu;
456 int rw = bio_data_dir(io->bio);
456 457
457 io->start_time = jiffies; 458 io->start_time = jiffies;
458 459
459 cpu = part_stat_lock(); 460 cpu = part_stat_lock();
460 part_round_stats(cpu, &dm_disk(md)->part0); 461 part_round_stats(cpu, &dm_disk(md)->part0);
461 part_stat_unlock(); 462 part_stat_unlock();
462 dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending); 463 dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]);
463} 464}
464 465
465static void end_io_acct(struct dm_io *io) 466static void end_io_acct(struct dm_io *io)
@@ -479,8 +480,9 @@ static void end_io_acct(struct dm_io *io)
479 * After this is decremented the bio must not be touched if it is 480 * After this is decremented the bio must not be touched if it is
480 * a barrier. 481 * a barrier.
481 */ 482 */
482 dm_disk(md)->part0.in_flight = pending = 483 dm_disk(md)->part0.in_flight[rw] = pending =
483 atomic_dec_return(&md->pending); 484 atomic_dec_return(&md->pending[rw]);
485 pending += atomic_read(&md->pending[rw^0x1]);
484 486
485 /* nudge anyone waiting on suspend queue */ 487 /* nudge anyone waiting on suspend queue */
486 if (!pending) 488 if (!pending)
@@ -1785,7 +1787,8 @@ static struct mapped_device *alloc_dev(int minor)
1785 if (!md->disk) 1787 if (!md->disk)
1786 goto bad_disk; 1788 goto bad_disk;
1787 1789
1788 atomic_set(&md->pending, 0); 1790 atomic_set(&md->pending[0], 0);
1791 atomic_set(&md->pending[1], 0);
1789 init_waitqueue_head(&md->wait); 1792 init_waitqueue_head(&md->wait);
1790 INIT_WORK(&md->work, dm_wq_work); 1793 INIT_WORK(&md->work, dm_wq_work);
1791 init_waitqueue_head(&md->eventq); 1794 init_waitqueue_head(&md->eventq);
@@ -2088,7 +2091,8 @@ static int dm_wait_for_completion(struct mapped_device *md, int interruptible)
2088 break; 2091 break;
2089 } 2092 }
2090 spin_unlock_irqrestore(q->queue_lock, flags); 2093 spin_unlock_irqrestore(q->queue_lock, flags);
2091 } else if (!atomic_read(&md->pending)) 2094 } else if (!atomic_read(&md->pending[0]) &&
2095 !atomic_read(&md->pending[1]))
2092 break; 2096 break;
2093 2097
2094 if (interruptible == TASK_INTERRUPTIBLE && 2098 if (interruptible == TASK_INTERRUPTIBLE &&
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index e424cf6d8e9e..e832e975da60 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -480,7 +480,6 @@ static int
480add_children(struct twl4030_platform_data *pdata, unsigned long features) 480add_children(struct twl4030_platform_data *pdata, unsigned long features)
481{ 481{
482 struct device *child; 482 struct device *child;
483 struct device *usb_transceiver = NULL;
484 483
485 if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { 484 if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) {
486 child = add_child(3, "twl4030_bci", 485 child = add_child(3, "twl4030_bci",
@@ -532,16 +531,61 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
532 } 531 }
533 532
534 if (twl_has_usb() && pdata->usb) { 533 if (twl_has_usb() && pdata->usb) {
534
535 static struct regulator_consumer_supply usb1v5 = {
536 .supply = "usb1v5",
537 };
538 static struct regulator_consumer_supply usb1v8 = {
539 .supply = "usb1v8",
540 };
541 static struct regulator_consumer_supply usb3v1 = {
542 .supply = "usb3v1",
543 };
544
545 /* First add the regulators so that they can be used by transceiver */
546 if (twl_has_regulator()) {
547 /* this is a template that gets copied */
548 struct regulator_init_data usb_fixed = {
549 .constraints.valid_modes_mask =
550 REGULATOR_MODE_NORMAL
551 | REGULATOR_MODE_STANDBY,
552 .constraints.valid_ops_mask =
553 REGULATOR_CHANGE_MODE
554 | REGULATOR_CHANGE_STATUS,
555 };
556
557 child = add_regulator_linked(TWL4030_REG_VUSB1V5,
558 &usb_fixed, &usb1v5, 1);
559 if (IS_ERR(child))
560 return PTR_ERR(child);
561
562 child = add_regulator_linked(TWL4030_REG_VUSB1V8,
563 &usb_fixed, &usb1v8, 1);
564 if (IS_ERR(child))
565 return PTR_ERR(child);
566
567 child = add_regulator_linked(TWL4030_REG_VUSB3V1,
568 &usb_fixed, &usb3v1, 1);
569 if (IS_ERR(child))
570 return PTR_ERR(child);
571
572 }
573
535 child = add_child(0, "twl4030_usb", 574 child = add_child(0, "twl4030_usb",
536 pdata->usb, sizeof(*pdata->usb), 575 pdata->usb, sizeof(*pdata->usb),
537 true, 576 true,
538 /* irq0 = USB_PRES, irq1 = USB */ 577 /* irq0 = USB_PRES, irq1 = USB */
539 pdata->irq_base + 8 + 2, pdata->irq_base + 4); 578 pdata->irq_base + 8 + 2, pdata->irq_base + 4);
579
540 if (IS_ERR(child)) 580 if (IS_ERR(child))
541 return PTR_ERR(child); 581 return PTR_ERR(child);
542 582
543 /* we need to connect regulators to this transceiver */ 583 /* we need to connect regulators to this transceiver */
544 usb_transceiver = child; 584 if (twl_has_regulator() && child) {
585 usb1v5.dev = child;
586 usb1v8.dev = child;
587 usb3v1.dev = child;
588 }
545 } 589 }
546 590
547 if (twl_has_watchdog()) { 591 if (twl_has_watchdog()) {
@@ -580,47 +624,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
580 return PTR_ERR(child); 624 return PTR_ERR(child);
581 } 625 }
582 626
583 if (twl_has_regulator() && usb_transceiver) {
584 static struct regulator_consumer_supply usb1v5 = {
585 .supply = "usb1v5",
586 };
587 static struct regulator_consumer_supply usb1v8 = {
588 .supply = "usb1v8",
589 };
590 static struct regulator_consumer_supply usb3v1 = {
591 .supply = "usb3v1",
592 };
593
594 /* this is a template that gets copied */
595 struct regulator_init_data usb_fixed = {
596 .constraints.valid_modes_mask =
597 REGULATOR_MODE_NORMAL
598 | REGULATOR_MODE_STANDBY,
599 .constraints.valid_ops_mask =
600 REGULATOR_CHANGE_MODE
601 | REGULATOR_CHANGE_STATUS,
602 };
603
604 usb1v5.dev = usb_transceiver;
605 usb1v8.dev = usb_transceiver;
606 usb3v1.dev = usb_transceiver;
607
608 child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed,
609 &usb1v5, 1);
610 if (IS_ERR(child))
611 return PTR_ERR(child);
612
613 child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed,
614 &usb1v8, 1);
615 if (IS_ERR(child))
616 return PTR_ERR(child);
617
618 child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed,
619 &usb3v1, 1);
620 if (IS_ERR(child))
621 return PTR_ERR(child);
622 }
623
624 /* maybe add LDOs that are omitted on cost-reduced parts */ 627 /* maybe add LDOs that are omitted on cost-reduced parts */
625 if (twl_has_regulator() && !(features & TPS_SUBSET)) { 628 if (twl_has_regulator() && !(features & TPS_SUBSET)) {
626 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); 629 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2);
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 5e0b1529964d..b00d67319058 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -693,7 +693,7 @@ static int pxamci_probe(struct platform_device *pdev)
693 if (gpio_is_valid(gpio_ro)) { 693 if (gpio_is_valid(gpio_ro)) {
694 ret = gpio_request(gpio_ro, "mmc card read only"); 694 ret = gpio_request(gpio_ro, "mmc card read only");
695 if (ret) { 695 if (ret) {
696 dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_power); 696 dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro);
697 goto err_gpio_ro; 697 goto err_gpio_ro;
698 } 698 }
699 gpio_direction_input(gpio_ro); 699 gpio_direction_input(gpio_ro);
@@ -701,7 +701,7 @@ static int pxamci_probe(struct platform_device *pdev)
701 if (gpio_is_valid(gpio_cd)) { 701 if (gpio_is_valid(gpio_cd)) {
702 ret = gpio_request(gpio_cd, "mmc card detect"); 702 ret = gpio_request(gpio_cd, "mmc card detect");
703 if (ret) { 703 if (ret) {
704 dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_power); 704 dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd);
705 goto err_gpio_cd; 705 goto err_gpio_cd;
706 } 706 }
707 gpio_direction_input(gpio_cd); 707 gpio_direction_input(gpio_cd);
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
index 9693b0fd323d..0bd898c94759 100644
--- a/drivers/net/wan/c101.c
+++ b/drivers/net/wan/c101.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/capability.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/string.h> 22#include <linux/string.h>
diff --git a/drivers/net/wan/n2.c b/drivers/net/wan/n2.c
index 83da596e2052..58c66819f39b 100644
--- a/drivers/net/wan/n2.c
+++ b/drivers/net/wan/n2.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/capability.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
22#include <linux/types.h> 23#include <linux/types.h>
23#include <linux/fcntl.h> 24#include <linux/fcntl.h>
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index a52f29c72c33..f1340faaf022 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/capability.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/fcntl.h> 22#include <linux/fcntl.h>
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index 2b7ae366ceb1..5df60a6b6776 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -35,12 +35,23 @@ static size_t buffer_pos;
35/* atomic_t because wait_event checks it outside of buffer_mutex */ 35/* atomic_t because wait_event checks it outside of buffer_mutex */
36static atomic_t buffer_ready = ATOMIC_INIT(0); 36static atomic_t buffer_ready = ATOMIC_INIT(0);
37 37
38/* Add an entry to the event buffer. When we 38/*
39 * get near to the end we wake up the process 39 * Add an entry to the event buffer. When we get near to the end we
40 * sleeping on the read() of the file. 40 * wake up the process sleeping on the read() of the file. To protect
41 * the event_buffer this function may only be called when buffer_mutex
42 * is set.
41 */ 43 */
42void add_event_entry(unsigned long value) 44void add_event_entry(unsigned long value)
43{ 45{
46 /*
47 * This shouldn't happen since all workqueues or handlers are
48 * canceled or flushed before the event buffer is freed.
49 */
50 if (!event_buffer) {
51 WARN_ON_ONCE(1);
52 return;
53 }
54
44 if (buffer_pos == buffer_size) { 55 if (buffer_pos == buffer_size) {
45 atomic_inc(&oprofile_stats.event_lost_overflow); 56 atomic_inc(&oprofile_stats.event_lost_overflow);
46 return; 57 return;
@@ -69,7 +80,6 @@ void wake_up_buffer_waiter(void)
69 80
70int alloc_event_buffer(void) 81int alloc_event_buffer(void)
71{ 82{
72 int err = -ENOMEM;
73 unsigned long flags; 83 unsigned long flags;
74 84
75 spin_lock_irqsave(&oprofilefs_lock, flags); 85 spin_lock_irqsave(&oprofilefs_lock, flags);
@@ -80,21 +90,22 @@ int alloc_event_buffer(void)
80 if (buffer_watershed >= buffer_size) 90 if (buffer_watershed >= buffer_size)
81 return -EINVAL; 91 return -EINVAL;
82 92
93 buffer_pos = 0;
83 event_buffer = vmalloc(sizeof(unsigned long) * buffer_size); 94 event_buffer = vmalloc(sizeof(unsigned long) * buffer_size);
84 if (!event_buffer) 95 if (!event_buffer)
85 goto out; 96 return -ENOMEM;
86 97
87 err = 0; 98 return 0;
88out:
89 return err;
90} 99}
91 100
92 101
93void free_event_buffer(void) 102void free_event_buffer(void)
94{ 103{
104 mutex_lock(&buffer_mutex);
95 vfree(event_buffer); 105 vfree(event_buffer);
96 106 buffer_pos = 0;
97 event_buffer = NULL; 107 event_buffer = NULL;
108 mutex_unlock(&buffer_mutex);
98} 109}
99 110
100 111
@@ -167,6 +178,12 @@ static ssize_t event_buffer_read(struct file *file, char __user *buf,
167 178
168 mutex_lock(&buffer_mutex); 179 mutex_lock(&buffer_mutex);
169 180
181 /* May happen if the buffer is freed during pending reads. */
182 if (!event_buffer) {
183 retval = -EINTR;
184 goto out;
185 }
186
170 atomic_set(&buffer_ready, 0); 187 atomic_set(&buffer_ready, 0);
171 188
172 retval = -EFAULT; 189 retval = -EFAULT;
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
index 14bbaa17e2ca..22b02c6df854 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -354,6 +354,7 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
354 struct acpi_dmar_hardware_unit *drhd; 354 struct acpi_dmar_hardware_unit *drhd;
355 struct acpi_dmar_reserved_memory *rmrr; 355 struct acpi_dmar_reserved_memory *rmrr;
356 struct acpi_dmar_atsr *atsr; 356 struct acpi_dmar_atsr *atsr;
357 struct acpi_dmar_rhsa *rhsa;
357 358
358 switch (header->type) { 359 switch (header->type) {
359 case ACPI_DMAR_TYPE_HARDWARE_UNIT: 360 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -375,6 +376,12 @@ dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
375 atsr = container_of(header, struct acpi_dmar_atsr, header); 376 atsr = container_of(header, struct acpi_dmar_atsr, header);
376 printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags); 377 printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags);
377 break; 378 break;
379 case ACPI_DMAR_HARDWARE_AFFINITY:
380 rhsa = container_of(header, struct acpi_dmar_rhsa, header);
381 printk(KERN_INFO PREFIX "RHSA base: %#016Lx proximity domain: %#x\n",
382 (unsigned long long)rhsa->base_address,
383 rhsa->proximity_domain);
384 break;
378 } 385 }
379} 386}
380 387
@@ -459,9 +466,13 @@ parse_dmar_table(void)
459 ret = dmar_parse_one_atsr(entry_header); 466 ret = dmar_parse_one_atsr(entry_header);
460#endif 467#endif
461 break; 468 break;
469 case ACPI_DMAR_HARDWARE_AFFINITY:
470 /* We don't do anything with RHSA (yet?) */
471 break;
462 default: 472 default:
463 printk(KERN_WARNING PREFIX 473 printk(KERN_WARNING PREFIX
464 "Unknown DMAR structure type\n"); 474 "Unknown DMAR structure type %d\n",
475 entry_header->type);
465 ret = 0; /* for forward compatibility */ 476 ret = 0; /* for forward compatibility */
466 break; 477 break;
467 } 478 }
diff --git a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h
index 53836001d511..9c6a9fd26812 100644
--- a/drivers/pci/hotplug/cpqphp.h
+++ b/drivers/pci/hotplug/cpqphp.h
@@ -32,6 +32,7 @@
32#include <asm/io.h> /* for read? and write? functions */ 32#include <asm/io.h> /* for read? and write? functions */
33#include <linux/delay.h> /* for delays */ 33#include <linux/delay.h> /* for delays */
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/sched.h> /* for signal_pending() */
35 36
36#define MY_NAME "cpqphp" 37#define MY_NAME "cpqphp"
37 38
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 855dd7ca47f3..b1e97e682500 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -48,6 +48,7 @@
48 48
49#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) 49#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
50#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) 50#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
51#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
51 52
52#define IOAPIC_RANGE_START (0xfee00000) 53#define IOAPIC_RANGE_START (0xfee00000)
53#define IOAPIC_RANGE_END (0xfeefffff) 54#define IOAPIC_RANGE_END (0xfeefffff)
@@ -94,6 +95,7 @@ static inline unsigned long virt_to_dma_pfn(void *p)
94/* global iommu list, set NULL for ignored DMAR units */ 95/* global iommu list, set NULL for ignored DMAR units */
95static struct intel_iommu **g_iommus; 96static struct intel_iommu **g_iommus;
96 97
98static void __init check_tylersburg_isoch(void);
97static int rwbf_quirk; 99static int rwbf_quirk;
98 100
99/* 101/*
@@ -1934,6 +1936,9 @@ error:
1934} 1936}
1935 1937
1936static int iommu_identity_mapping; 1938static int iommu_identity_mapping;
1939#define IDENTMAP_ALL 1
1940#define IDENTMAP_GFX 2
1941#define IDENTMAP_AZALIA 4
1937 1942
1938static int iommu_domain_identity_map(struct dmar_domain *domain, 1943static int iommu_domain_identity_map(struct dmar_domain *domain,
1939 unsigned long long start, 1944 unsigned long long start,
@@ -2151,8 +2156,14 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2151 2156
2152static int iommu_should_identity_map(struct pci_dev *pdev, int startup) 2157static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
2153{ 2158{
2154 if (iommu_identity_mapping == 2) 2159 if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
2155 return IS_GFX_DEVICE(pdev); 2160 return 1;
2161
2162 if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev))
2163 return 1;
2164
2165 if (!(iommu_identity_mapping & IDENTMAP_ALL))
2166 return 0;
2156 2167
2157 /* 2168 /*
2158 * We want to start off with all devices in the 1:1 domain, and 2169 * We want to start off with all devices in the 1:1 domain, and
@@ -2332,11 +2343,14 @@ int __init init_dmars(void)
2332 } 2343 }
2333 2344
2334 if (iommu_pass_through) 2345 if (iommu_pass_through)
2335 iommu_identity_mapping = 1; 2346 iommu_identity_mapping |= IDENTMAP_ALL;
2347
2336#ifdef CONFIG_DMAR_BROKEN_GFX_WA 2348#ifdef CONFIG_DMAR_BROKEN_GFX_WA
2337 else 2349 iommu_identity_mapping |= IDENTMAP_GFX;
2338 iommu_identity_mapping = 2;
2339#endif 2350#endif
2351
2352 check_tylersburg_isoch();
2353
2340 /* 2354 /*
2341 * If pass through is not set or not enabled, setup context entries for 2355 * If pass through is not set or not enabled, setup context entries for
2342 * identity mappings for rmrr, gfx, and isa and may fall back to static 2356 * identity mappings for rmrr, gfx, and isa and may fall back to static
@@ -3670,3 +3684,61 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
3670} 3684}
3671 3685
3672DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); 3686DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
3687
3688/* On Tylersburg chipsets, some BIOSes have been known to enable the
3689 ISOCH DMAR unit for the Azalia sound device, but not give it any
3690 TLB entries, which causes it to deadlock. Check for that. We do
3691 this in a function called from init_dmars(), instead of in a PCI
3692 quirk, because we don't want to print the obnoxious "BIOS broken"
3693 message if VT-d is actually disabled.
3694*/
3695static void __init check_tylersburg_isoch(void)
3696{
3697 struct pci_dev *pdev;
3698 uint32_t vtisochctrl;
3699
3700 /* If there's no Azalia in the system anyway, forget it. */
3701 pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x3a3e, NULL);
3702 if (!pdev)
3703 return;
3704 pci_dev_put(pdev);
3705
3706 /* System Management Registers. Might be hidden, in which case
3707 we can't do the sanity check. But that's OK, because the
3708 known-broken BIOSes _don't_ actually hide it, so far. */
3709 pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x342e, NULL);
3710 if (!pdev)
3711 return;
3712
3713 if (pci_read_config_dword(pdev, 0x188, &vtisochctrl)) {
3714 pci_dev_put(pdev);
3715 return;
3716 }
3717
3718 pci_dev_put(pdev);
3719
3720 /* If Azalia DMA is routed to the non-isoch DMAR unit, fine. */
3721 if (vtisochctrl & 1)
3722 return;
3723
3724 /* Drop all bits other than the number of TLB entries */
3725 vtisochctrl &= 0x1c;
3726
3727 /* If we have the recommended number of TLB entries (16), fine. */
3728 if (vtisochctrl == 0x10)
3729 return;
3730
3731 /* Zero TLB entries? You get to ride the short bus to school. */
3732 if (!vtisochctrl) {
3733 WARN(1, "Your BIOS is broken; DMA routed to ISOCH DMAR unit but no TLB space.\n"
3734 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
3735 dmi_get_system_info(DMI_BIOS_VENDOR),
3736 dmi_get_system_info(DMI_BIOS_VERSION),
3737 dmi_get_system_info(DMI_PRODUCT_VERSION));
3738 iommu_identity_mapping |= IDENTMAP_AZALIA;
3739 return;
3740 }
3741
3742 printk(KERN_WARNING "DMAR: Recommended TLB entries for ISOCH unit is 16; your BIOS set %d\n",
3743 vtisochctrl);
3744}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 6edecff0b419..4e4c295a049f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -513,7 +513,11 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
513 else if (state == PCI_D2 || dev->current_state == PCI_D2) 513 else if (state == PCI_D2 || dev->current_state == PCI_D2)
514 udelay(PCI_PM_D2_DELAY); 514 udelay(PCI_PM_D2_DELAY);
515 515
516 dev->current_state = state; 516 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
517 dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
518 if (dev->current_state != state && printk_ratelimit())
519 dev_info(&dev->dev, "Refused to change power state, "
520 "currently in D%d\n", dev->current_state);
517 521
518 /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT 522 /* According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
519 * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning 523 * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning
@@ -2542,10 +2546,10 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type)
2542 2546
2543/** 2547/**
2544 * pci_set_vga_state - set VGA decode state on device and parents if requested 2548 * pci_set_vga_state - set VGA decode state on device and parents if requested
2545 * @dev the PCI device 2549 * @dev: the PCI device
2546 * @decode - true = enable decoding, false = disable decoding 2550 * @decode: true = enable decoding, false = disable decoding
2547 * @command_bits PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY 2551 * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY
2548 * @change_bridge - traverse ancestors and change bridges 2552 * @change_bridge: traverse ancestors and change bridges
2549 */ 2553 */
2550int pci_set_vga_state(struct pci_dev *dev, bool decode, 2554int pci_set_vga_state(struct pci_dev *dev, bool decode,
2551 unsigned int command_bits, bool change_bridge) 2555 unsigned int command_bits, bool change_bridge)
@@ -2719,17 +2723,6 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev)
2719 return 1; 2723 return 1;
2720} 2724}
2721 2725
2722static int __devinit pci_init(void)
2723{
2724 struct pci_dev *dev = NULL;
2725
2726 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
2727 pci_fixup_device(pci_fixup_final, dev);
2728 }
2729
2730 return 0;
2731}
2732
2733static int __init pci_setup(char *str) 2726static int __init pci_setup(char *str)
2734{ 2727{
2735 while (str) { 2728 while (str) {
@@ -2767,8 +2760,6 @@ static int __init pci_setup(char *str)
2767} 2760}
2768early_param("pci", pci_setup); 2761early_param("pci", pci_setup);
2769 2762
2770device_initcall(pci_init);
2771
2772EXPORT_SYMBOL(pci_reenable_device); 2763EXPORT_SYMBOL(pci_reenable_device);
2773EXPORT_SYMBOL(pci_enable_device_io); 2764EXPORT_SYMBOL(pci_enable_device_io);
2774EXPORT_SYMBOL(pci_enable_device_mem); 2765EXPORT_SYMBOL(pci_enable_device_mem);
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index d49ecc94bd49..40c3cc5d1caf 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -53,7 +53,7 @@ static struct pci_error_handlers aer_error_handlers = {
53 53
54static struct pcie_port_service_driver aerdriver = { 54static struct pcie_port_service_driver aerdriver = {
55 .name = "aer", 55 .name = "aer",
56 .port_type = PCIE_ANY_PORT, 56 .port_type = PCIE_RC_PORT,
57 .service = PCIE_PORT_SERVICE_AER, 57 .service = PCIE_PORT_SERVICE_AER,
58 58
59 .probe = aer_probe, 59 .probe = aer_probe,
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 6df5c984a791..f635e476d632 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -30,7 +30,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32/* global data */ 32/* global data */
33static const char device_name[] = "pcieport-driver";
34 33
35static int pcie_portdrv_restore_config(struct pci_dev *dev) 34static int pcie_portdrv_restore_config(struct pci_dev *dev)
36{ 35{
@@ -262,7 +261,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = {
262}; 261};
263 262
264static struct pci_driver pcie_portdriver = { 263static struct pci_driver pcie_portdriver = {
265 .name = (char *)device_name, 264 .name = "pcieport",
266 .id_table = &port_pci_ids[0], 265 .id_table = &port_pci_ids[0],
267 266
268 .probe = pcie_portdrv_probe, 267 .probe = pcie_portdrv_probe,
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6099facecd79..a790b1771f9f 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -670,6 +670,25 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev)
670} 670}
671DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); 671DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi);
672 672
673/*
674 * TI XIO2000a PCIe-PCI Bridge erroneously reports it supports fast back-to-back:
675 * Disable fast back-to-back on the secondary bus segment
676 */
677static void __devinit quirk_xio2000a(struct pci_dev *dev)
678{
679 struct pci_dev *pdev;
680 u16 command;
681
682 dev_warn(&dev->dev, "TI XIO2000a quirk detected; "
683 "secondary bus fast back-to-back transfers disabled\n");
684 list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) {
685 pci_read_config_word(pdev, PCI_COMMAND, &command);
686 if (command & PCI_COMMAND_FAST_BACK)
687 pci_write_config_word(pdev, PCI_COMMAND, command & ~PCI_COMMAND_FAST_BACK);
688 }
689}
690DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XIO2000A,
691 quirk_xio2000a);
673 692
674#ifdef CONFIG_X86_IO_APIC 693#ifdef CONFIG_X86_IO_APIC
675 694
@@ -2572,6 +2591,19 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
2572 } 2591 }
2573 pci_do_fixups(dev, start, end); 2592 pci_do_fixups(dev, start, end);
2574} 2593}
2594
2595static int __init pci_apply_final_quirks(void)
2596{
2597 struct pci_dev *dev = NULL;
2598
2599 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
2600 pci_fixup_device(pci_fixup_final, dev);
2601 }
2602
2603 return 0;
2604}
2605
2606fs_initcall_sync(pci_apply_final_quirks);
2575#else 2607#else
2576void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} 2608void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
2577#endif 2609#endif
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index cb1a027eb552..0959430534b2 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -299,8 +299,17 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon
299 r = bus->resource[i]; 299 r = bus->resource[i];
300 if (r == &ioport_resource || r == &iomem_resource) 300 if (r == &ioport_resource || r == &iomem_resource)
301 continue; 301 continue;
302 if (r && (r->flags & type_mask) == type && !r->parent) 302 if (r && (r->flags & type_mask) == type) {
303 return r; 303 if (!r->parent)
304 return r;
305 /*
306 * if there is no child under that, we should release
307 * and use it. don't need to reset it, pbus_size_* will
308 * set it again
309 */
310 if (!r->child && !release_resource(r))
311 return r;
312 }
304 } 313 }
305 return NULL; 314 return NULL;
306} 315}
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 706f82d8111f..c54526b206b5 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -205,43 +205,6 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
205 return ret; 205 return ret;
206} 206}
207 207
208#if 0
209int pci_assign_resource_fixed(struct pci_dev *dev, int resno)
210{
211 struct pci_bus *bus = dev->bus;
212 struct resource *res = dev->resource + resno;
213 unsigned int type_mask;
214 int i, ret = -EBUSY;
215
216 type_mask = IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH;
217
218 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
219 struct resource *r = bus->resource[i];
220 if (!r)
221 continue;
222
223 /* type_mask must match */
224 if ((res->flags ^ r->flags) & type_mask)
225 continue;
226
227 ret = request_resource(r, res);
228
229 if (ret == 0)
230 break;
231 }
232
233 if (ret) {
234 dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n",
235 resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res);
236 } else if (resno < PCI_BRIDGE_RESOURCES) {
237 pci_update_resource(dev, resno);
238 }
239
240 return ret;
241}
242EXPORT_SYMBOL_GPL(pci_assign_resource_fixed);
243#endif
244
245/* Sort resources by alignment */ 208/* Sort resources by alignment */
246void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) 209void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
247{ 210{
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 53b8c255360a..aaccc8ecfa8f 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2533,6 +2533,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
2533{ 2533{
2534 struct dasd_ccw_req *cqr; 2534 struct dasd_ccw_req *cqr;
2535 struct ccw1 *ccw; 2535 struct ccw1 *ccw;
2536 unsigned long *idaw;
2536 2537
2537 cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); 2538 cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device);
2538 2539
@@ -2546,9 +2547,17 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
2546 2547
2547 ccw = cqr->cpaddr; 2548 ccw = cqr->cpaddr;
2548 ccw->cmd_code = CCW_CMD_RDC; 2549 ccw->cmd_code = CCW_CMD_RDC;
2549 ccw->cda = (__u32)(addr_t)rdc_buffer; 2550 if (idal_is_needed(rdc_buffer, rdc_buffer_size)) {
2550 ccw->count = rdc_buffer_size; 2551 idaw = (unsigned long *) (cqr->data);
2552 ccw->cda = (__u32)(addr_t) idaw;
2553 ccw->flags = CCW_FLAG_IDA;
2554 idaw = idal_create_words(idaw, rdc_buffer, rdc_buffer_size);
2555 } else {
2556 ccw->cda = (__u32)(addr_t) rdc_buffer;
2557 ccw->flags = 0;
2558 }
2551 2559
2560 ccw->count = rdc_buffer_size;
2552 cqr->startdev = device; 2561 cqr->startdev = device;
2553 cqr->memdev = device; 2562 cqr->memdev = device;
2554 cqr->expires = 10*HZ; 2563 cqr->expires = 10*HZ;
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 0be7c15f45c5..417b97cd3f94 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -3216,6 +3216,7 @@ int dasd_eckd_restore_device(struct dasd_device *device)
3216 struct dasd_eckd_characteristics temp_rdc_data; 3216 struct dasd_eckd_characteristics temp_rdc_data;
3217 int is_known, rc; 3217 int is_known, rc;
3218 struct dasd_uid temp_uid; 3218 struct dasd_uid temp_uid;
3219 unsigned long flags;
3219 3220
3220 private = (struct dasd_eckd_private *) device->private; 3221 private = (struct dasd_eckd_private *) device->private;
3221 3222
@@ -3228,7 +3229,8 @@ int dasd_eckd_restore_device(struct dasd_device *device)
3228 rc = dasd_eckd_generate_uid(device, &private->uid); 3229 rc = dasd_eckd_generate_uid(device, &private->uid);
3229 dasd_get_uid(device->cdev, &temp_uid); 3230 dasd_get_uid(device->cdev, &temp_uid);
3230 if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0) 3231 if (memcmp(&private->uid, &temp_uid, sizeof(struct dasd_uid)) != 0)
3231 dev_err(&device->cdev->dev, "The UID of the DASD has changed\n"); 3232 dev_err(&device->cdev->dev, "The UID of the DASD has "
3233 "changed\n");
3232 if (rc) 3234 if (rc)
3233 goto out_err; 3235 goto out_err;
3234 dasd_set_uid(device->cdev, &private->uid); 3236 dasd_set_uid(device->cdev, &private->uid);
@@ -3256,9 +3258,9 @@ int dasd_eckd_restore_device(struct dasd_device *device)
3256 "device: %s", rc, dev_name(&device->cdev->dev)); 3258 "device: %s", rc, dev_name(&device->cdev->dev));
3257 goto out_err; 3259 goto out_err;
3258 } 3260 }
3259 spin_lock(get_ccwdev_lock(device->cdev)); 3261 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
3260 memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data)); 3262 memcpy(&private->rdc_data, &temp_rdc_data, sizeof(temp_rdc_data));
3261 spin_unlock(get_ccwdev_lock(device->cdev)); 3263 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
3262 3264
3263 /* add device to alias management */ 3265 /* add device to alias management */
3264 dasd_alias_add_device(device); 3266 dasd_alias_add_device(device);
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index daaec185ed36..a4f68e5b9c96 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -62,7 +62,7 @@ static struct notifier_block call_home_panic_nb = {
62 .priority = INT_MAX, 62 .priority = INT_MAX,
63}; 63};
64 64
65static int proc_handler_callhome(ctl_table *ctl, int write, struct file *filp, 65static int proc_handler_callhome(struct ctl_table *ctl, int write,
66 void __user *buffer, size_t *count, 66 void __user *buffer, size_t *count,
67 loff_t *ppos) 67 loff_t *ppos)
68{ 68{
@@ -100,7 +100,7 @@ static struct ctl_table callhome_table[] = {
100 { 100 {
101 .procname = "callhome", 101 .procname = "callhome",
102 .mode = 0644, 102 .mode = 0644,
103 .proc_handler = &proc_handler_callhome, 103 .proc_handler = proc_handler_callhome,
104 }, 104 },
105 { .ctl_name = 0 } 105 { .ctl_name = 0 }
106}; 106};
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 178724f2a4c3..b9d2a007e93b 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -705,21 +705,6 @@ out_driver:
705} 705}
706__initcall(sclp_vt220_tty_init); 706__initcall(sclp_vt220_tty_init);
707 707
708#ifdef CONFIG_SCLP_VT220_CONSOLE
709
710static void
711sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count)
712{
713 __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0);
714}
715
716static struct tty_driver *
717sclp_vt220_con_device(struct console *c, int *index)
718{
719 *index = 0;
720 return sclp_vt220_driver;
721}
722
723static void __sclp_vt220_flush_buffer(void) 708static void __sclp_vt220_flush_buffer(void)
724{ 709{
725 unsigned long flags; 710 unsigned long flags;
@@ -776,6 +761,21 @@ static void sclp_vt220_pm_event_fn(struct sclp_register *reg,
776 } 761 }
777} 762}
778 763
764#ifdef CONFIG_SCLP_VT220_CONSOLE
765
766static void
767sclp_vt220_con_write(struct console *con, const char *buf, unsigned int count)
768{
769 __sclp_vt220_write((const unsigned char *) buf, count, 1, 1, 0);
770}
771
772static struct tty_driver *
773sclp_vt220_con_device(struct console *c, int *index)
774{
775 *index = 0;
776 return sclp_vt220_driver;
777}
778
779static int 779static int
780sclp_vt220_notify(struct notifier_block *self, 780sclp_vt220_notify(struct notifier_block *self,
781 unsigned long event, void *data) 781 unsigned long event, void *data)
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 64f57ef2763c..0c0705b91c28 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -162,9 +162,10 @@ tapeblock_requeue(struct work_struct *work) {
162 spin_lock_irq(&device->blk_data.request_queue_lock); 162 spin_lock_irq(&device->blk_data.request_queue_lock);
163 while ( 163 while (
164 !blk_queue_plugged(queue) && 164 !blk_queue_plugged(queue) &&
165 (req = blk_fetch_request(queue)) && 165 blk_peek_request(queue) &&
166 nr_queued < TAPEBLOCK_MIN_REQUEUE 166 nr_queued < TAPEBLOCK_MIN_REQUEUE
167 ) { 167 ) {
168 req = blk_fetch_request(queue);
168 if (rq_data_dir(req) == WRITE) { 169 if (rq_data_dir(req) == WRITE) {
169 DBF_EVENT(1, "TBLOCK: Rejecting write request\n"); 170 DBF_EVENT(1, "TBLOCK: Rejecting write request\n");
170 spin_unlock_irq(&device->blk_data.request_queue_lock); 171 spin_unlock_irq(&device->blk_data.request_queue_lock);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 2ee093ec86e4..2490b741e16a 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1250,8 +1250,7 @@ static int io_subchannel_probe(struct subchannel *sch)
1250 unsigned long flags; 1250 unsigned long flags;
1251 struct ccw_dev_id dev_id; 1251 struct ccw_dev_id dev_id;
1252 1252
1253 cdev = sch_get_cdev(sch); 1253 if (cio_is_console(sch->schid)) {
1254 if (cdev) {
1255 rc = sysfs_create_group(&sch->dev.kobj, 1254 rc = sysfs_create_group(&sch->dev.kobj,
1256 &io_subchannel_attr_group); 1255 &io_subchannel_attr_group);
1257 if (rc) 1256 if (rc)
@@ -1260,13 +1259,13 @@ static int io_subchannel_probe(struct subchannel *sch)
1260 "0.%x.%04x (rc=%d)\n", 1259 "0.%x.%04x (rc=%d)\n",
1261 sch->schid.ssid, sch->schid.sch_no, rc); 1260 sch->schid.ssid, sch->schid.sch_no, rc);
1262 /* 1261 /*
1263 * This subchannel already has an associated ccw_device. 1262 * The console subchannel already has an associated ccw_device.
1264 * Throw the delayed uevent for the subchannel, register 1263 * Throw the delayed uevent for the subchannel, register
1265 * the ccw_device and exit. This happens for all early 1264 * the ccw_device and exit.
1266 * devices, e.g. the console.
1267 */ 1265 */
1268 dev_set_uevent_suppress(&sch->dev, 0); 1266 dev_set_uevent_suppress(&sch->dev, 0);
1269 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 1267 kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
1268 cdev = sch_get_cdev(sch);
1270 cdev->dev.groups = ccwdev_attr_groups; 1269 cdev->dev.groups = ccwdev_attr_groups;
1271 device_initialize(&cdev->dev); 1270 device_initialize(&cdev->dev);
1272 ccw_device_register(cdev); 1271 ccw_device_register(cdev);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 1689bda1d13b..dcc72444e8e7 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1270,6 +1270,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1270 1270
1271 BUG_ON(!kernel_locked()); 1271 BUG_ON(!kernel_locked());
1272 1272
1273 if (!state)
1274 return;
1275
1273 uport = state->uart_port; 1276 uport = state->uart_port;
1274 port = &state->port; 1277 port = &state->port;
1275 1278
@@ -1316,9 +1319,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1316 */ 1319 */
1317 if (port->flags & ASYNC_INITIALIZED) { 1320 if (port->flags & ASYNC_INITIALIZED) {
1318 unsigned long flags; 1321 unsigned long flags;
1319 spin_lock_irqsave(&port->lock, flags); 1322 spin_lock_irqsave(&uport->lock, flags);
1320 uport->ops->stop_rx(uport); 1323 uport->ops->stop_rx(uport);
1321 spin_unlock_irqrestore(&port->lock, flags); 1324 spin_unlock_irqrestore(&uport->lock, flags);
1322 /* 1325 /*
1323 * Before we drop DTR, make sure the UART transmitter 1326 * Before we drop DTR, make sure the UART transmitter
1324 * has completely drained; this is especially 1327 * has completely drained; this is especially
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 958a3ffc8987..ff5bbb9c43c9 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -1826,7 +1826,7 @@ static struct amba_id pl022_ids[] = {
1826 * ST Micro derivative, this has 32bit wide 1826 * ST Micro derivative, this has 32bit wide
1827 * and 32 locations deep TX/RX FIFO 1827 * and 32 locations deep TX/RX FIFO
1828 */ 1828 */
1829 .id = 0x00108022, 1829 .id = 0x01080022,
1830 .mask = 0xffffffff, 1830 .mask = 0xffffffff,
1831 .data = &vendor_st, 1831 .data = &vendor_st,
1832 }, 1832 },
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 23cf3bde4762..83b5f9cea85a 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -475,4 +475,4 @@ static void __devinit quirk_usb_early_handoff(struct pci_dev *pdev)
475 else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI) 475 else if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
476 quirk_usb_handoff_xhci(pdev); 476 quirk_usb_handoff_xhci(pdev);
477} 477}
478DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff); 478DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_usb_early_handoff);
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 760e7271d17b..b84abd8ee8a5 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -9,7 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options"
9# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 9# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
10config USB_MUSB_HDRC 10config USB_MUSB_HDRC
11 depends on (USB || USB_GADGET) 11 depends on (USB || USB_GADGET)
12 depends on !SUPERH 12 depends on (ARM || BLACKFIN)
13 select NOP_USB_XCEIV if ARCH_DAVINCI 13 select NOP_USB_XCEIV if ARCH_DAVINCI
14 select TWL4030_USB if MACH_OMAP_3430SDP 14 select TWL4030_USB if MACH_OMAP_3430SDP
15 select NOP_USB_XCEIV if MACH_OMAP3EVM 15 select NOP_USB_XCEIV if MACH_OMAP3EVM
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 1e8f02f440e6..d3c824dc2358 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -206,7 +206,7 @@ static int __devinit riowd_probe(struct of_device *op,
206 206
207 dev_set_drvdata(&op->dev, p); 207 dev_set_drvdata(&op->dev, p);
208 riowd_device = p; 208 riowd_device = p;
209 err = 0; 209 return 0;
210 210
211out_iounmap: 211out_iounmap:
212 of_iounmap(&op->resource[0], p->regs, 2); 212 of_iounmap(&op->resource[0], p->regs, 2);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 72743d360509..7a520a862f49 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2321,7 +2321,18 @@ static int ext3_commit_super(struct super_block *sb,
2321 2321
2322 if (!sbh) 2322 if (!sbh)
2323 return error; 2323 return error;
2324 es->s_wtime = cpu_to_le32(get_seconds()); 2324 /*
2325 * If the file system is mounted read-only, don't update the
2326 * superblock write time. This avoids updating the superblock
2327 * write time when we are mounting the root file system
2328 * read/only but we need to replay the journal; at that point,
2329 * for people who are east of GMT and who make their clock
2330 * tick in localtime for Windows bug-for-bug compatibility,
2331 * the clock is set in the future, and this will cause e2fsck
2332 * to complain and force a full file system check.
2333 */
2334 if (!(sb->s_flags & MS_RDONLY))
2335 es->s_wtime = cpu_to_le32(get_seconds());
2325 es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb)); 2336 es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb));
2326 es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb)); 2337 es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb));
2327 BUFFER_TRACE(sbh, "marking dirty"); 2338 BUFFER_TRACE(sbh, "marking dirty");
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 6dabf6feec94..a2c18acb8568 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1848,8 +1848,8 @@ nfs_compare_remount_data(struct nfs_server *nfss,
1848 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || 1848 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
1849 data->nfs_server.port != nfss->port || 1849 data->nfs_server.port != nfss->port ||
1850 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || 1850 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
1851 !rpc_cmp_addr(&data->nfs_server.address, 1851 !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address,
1852 &nfss->nfs_client->cl_addr)) 1852 (struct sockaddr *)&nfss->nfs_client->cl_addr))
1853 return -EINVAL; 1853 return -EINVAL;
1854 1854
1855 return 0; 1855 return 0;
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index f38fee0311a7..7b685e10cbad 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -248,11 +248,19 @@ ssize_t part_stat_show(struct device *dev,
248 part_stat_read(p, merges[WRITE]), 248 part_stat_read(p, merges[WRITE]),
249 (unsigned long long)part_stat_read(p, sectors[WRITE]), 249 (unsigned long long)part_stat_read(p, sectors[WRITE]),
250 jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), 250 jiffies_to_msecs(part_stat_read(p, ticks[WRITE])),
251 p->in_flight, 251 part_in_flight(p),
252 jiffies_to_msecs(part_stat_read(p, io_ticks)), 252 jiffies_to_msecs(part_stat_read(p, io_ticks)),
253 jiffies_to_msecs(part_stat_read(p, time_in_queue))); 253 jiffies_to_msecs(part_stat_read(p, time_in_queue)));
254} 254}
255 255
256ssize_t part_inflight_show(struct device *dev,
257 struct device_attribute *attr, char *buf)
258{
259 struct hd_struct *p = dev_to_part(dev);
260
261 return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]);
262}
263
256#ifdef CONFIG_FAIL_MAKE_REQUEST 264#ifdef CONFIG_FAIL_MAKE_REQUEST
257ssize_t part_fail_show(struct device *dev, 265ssize_t part_fail_show(struct device *dev,
258 struct device_attribute *attr, char *buf) 266 struct device_attribute *attr, char *buf)
@@ -281,6 +289,7 @@ static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL);
281static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); 289static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
282static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); 290static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL);
283static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); 291static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
292static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
284#ifdef CONFIG_FAIL_MAKE_REQUEST 293#ifdef CONFIG_FAIL_MAKE_REQUEST
285static struct device_attribute dev_attr_fail = 294static struct device_attribute dev_attr_fail =
286 __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); 295 __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store);
@@ -292,6 +301,7 @@ static struct attribute *part_attrs[] = {
292 &dev_attr_size.attr, 301 &dev_attr_size.attr,
293 &dev_attr_alignment_offset.attr, 302 &dev_attr_alignment_offset.attr,
294 &dev_attr_stat.attr, 303 &dev_attr_stat.attr,
304 &dev_attr_inflight.attr,
295#ifdef CONFIG_FAIL_MAKE_REQUEST 305#ifdef CONFIG_FAIL_MAKE_REQUEST
296 &dev_attr_fail.attr, 306 &dev_attr_fail.attr,
297#endif 307#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 25119041e034..221cecd86bd3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1172,11 +1172,7 @@ static inline void put_dev_sector(Sector p)
1172} 1172}
1173 1173
1174struct work_struct; 1174struct work_struct;
1175struct delayed_work;
1176int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1175int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1177int kblockd_schedule_delayed_work(struct request_queue *q,
1178 struct delayed_work *work,
1179 unsigned long delay);
1180 1176
1181#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1177#define MODULE_ALIAS_BLOCKDEV(major,minor) \
1182 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 1178 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 7beaa21b3880..297df45ffd0a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -98,7 +98,7 @@ struct hd_struct {
98 int make_it_fail; 98 int make_it_fail;
99#endif 99#endif
100 unsigned long stamp; 100 unsigned long stamp;
101 int in_flight; 101 int in_flight[2];
102#ifdef CONFIG_SMP 102#ifdef CONFIG_SMP
103 struct disk_stats *dkstats; 103 struct disk_stats *dkstats;
104#else 104#else
@@ -322,18 +322,23 @@ static inline void free_part_stats(struct hd_struct *part)
322#define part_stat_sub(cpu, gendiskp, field, subnd) \ 322#define part_stat_sub(cpu, gendiskp, field, subnd) \
323 part_stat_add(cpu, gendiskp, field, -subnd) 323 part_stat_add(cpu, gendiskp, field, -subnd)
324 324
325static inline void part_inc_in_flight(struct hd_struct *part) 325static inline void part_inc_in_flight(struct hd_struct *part, int rw)
326{ 326{
327 part->in_flight++; 327 part->in_flight[rw]++;
328 if (part->partno) 328 if (part->partno)
329 part_to_disk(part)->part0.in_flight++; 329 part_to_disk(part)->part0.in_flight[rw]++;
330} 330}
331 331
332static inline void part_dec_in_flight(struct hd_struct *part) 332static inline void part_dec_in_flight(struct hd_struct *part, int rw)
333{ 333{
334 part->in_flight--; 334 part->in_flight[rw]--;
335 if (part->partno) 335 if (part->partno)
336 part_to_disk(part)->part0.in_flight--; 336 part_to_disk(part)->part0.in_flight[rw]--;
337}
338
339static inline int part_in_flight(struct hd_struct *part)
340{
341 return part->in_flight[0] + part->in_flight[1];
337} 342}
338 343
339/* block/blk-core.c */ 344/* block/blk-core.c */
@@ -546,6 +551,8 @@ extern ssize_t part_size_show(struct device *dev,
546 struct device_attribute *attr, char *buf); 551 struct device_attribute *attr, char *buf);
547extern ssize_t part_stat_show(struct device *dev, 552extern ssize_t part_stat_show(struct device *dev,
548 struct device_attribute *attr, char *buf); 553 struct device_attribute *attr, char *buf);
554extern ssize_t part_inflight_show(struct device *dev,
555 struct device_attribute *attr, char *buf);
549#ifdef CONFIG_FAIL_MAKE_REQUEST 556#ifdef CONFIG_FAIL_MAKE_REQUEST
550extern ssize_t part_fail_show(struct device *dev, 557extern ssize_t part_fail_show(struct device *dev,
551 struct device_attribute *attr, char *buf); 558 struct device_attribute *attr, char *buf);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d3cd23f30039..f4e3184fa054 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -659,6 +659,12 @@ extern int do_sysinfo(struct sysinfo *info);
659 659
660#endif /* __KERNEL__ */ 660#endif /* __KERNEL__ */
661 661
662#ifndef __EXPORTED_HEADERS__
663#ifndef __KERNEL__
664#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
665#endif /* __KERNEL__ */
666#endif /* __EXPORTED_HEADERS__ */
667
662#define SI_LOAD_SHIFT 16 668#define SI_LOAD_SHIFT 16
663struct sysinfo { 669struct sysinfo {
664 long uptime; /* Seconds since boot */ 670 long uptime; /* Seconds since boot */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index da1fda8623e0..f490e7a7307a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -776,6 +776,7 @@
776#define PCI_DEVICE_ID_TI_X515 0x8036 776#define PCI_DEVICE_ID_TI_X515 0x8036
777#define PCI_DEVICE_ID_TI_XX12 0x8039 777#define PCI_DEVICE_ID_TI_XX12 0x8039
778#define PCI_DEVICE_ID_TI_XX12_FM 0x803b 778#define PCI_DEVICE_ID_TI_XX12_FM 0x803b
779#define PCI_DEVICE_ID_TI_XIO2000A 0x8231
779#define PCI_DEVICE_ID_TI_1130 0xac12 780#define PCI_DEVICE_ID_TI_1130 0xac12
780#define PCI_DEVICE_ID_TI_1031 0xac13 781#define PCI_DEVICE_ID_TI_1031 0xac13
781#define PCI_DEVICE_ID_TI_1131 0xac15 782#define PCI_DEVICE_ID_TI_1131 0xac15
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 7ef0c7b94f31..cf24c20de9e4 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -207,6 +207,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
207 207
208extern void flush_workqueue(struct workqueue_struct *wq); 208extern void flush_workqueue(struct workqueue_struct *wq);
209extern void flush_scheduled_work(void); 209extern void flush_scheduled_work(void);
210extern void flush_delayed_work(struct delayed_work *work);
210 211
211extern int schedule_work(struct work_struct *work); 212extern int schedule_work(struct work_struct *work);
212extern int schedule_work_on(int cpu, struct work_struct *work); 213extern int schedule_work_on(int cpu, struct work_struct *work);
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 3815ac1d58b2..9af56723c096 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -142,6 +142,11 @@ static inline struct lock_class *hlock_class(struct held_lock *hlock)
142#ifdef CONFIG_LOCK_STAT 142#ifdef CONFIG_LOCK_STAT
143static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats); 143static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats);
144 144
145static inline u64 lockstat_clock(void)
146{
147 return cpu_clock(smp_processor_id());
148}
149
145static int lock_point(unsigned long points[], unsigned long ip) 150static int lock_point(unsigned long points[], unsigned long ip)
146{ 151{
147 int i; 152 int i;
@@ -158,7 +163,7 @@ static int lock_point(unsigned long points[], unsigned long ip)
158 return i; 163 return i;
159} 164}
160 165
161static void lock_time_inc(struct lock_time *lt, s64 time) 166static void lock_time_inc(struct lock_time *lt, u64 time)
162{ 167{
163 if (time > lt->max) 168 if (time > lt->max)
164 lt->max = time; 169 lt->max = time;
@@ -234,12 +239,12 @@ static void put_lock_stats(struct lock_class_stats *stats)
234static void lock_release_holdtime(struct held_lock *hlock) 239static void lock_release_holdtime(struct held_lock *hlock)
235{ 240{
236 struct lock_class_stats *stats; 241 struct lock_class_stats *stats;
237 s64 holdtime; 242 u64 holdtime;
238 243
239 if (!lock_stat) 244 if (!lock_stat)
240 return; 245 return;
241 246
242 holdtime = sched_clock() - hlock->holdtime_stamp; 247 holdtime = lockstat_clock() - hlock->holdtime_stamp;
243 248
244 stats = get_lock_stats(hlock_class(hlock)); 249 stats = get_lock_stats(hlock_class(hlock));
245 if (hlock->read) 250 if (hlock->read)
@@ -2792,7 +2797,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
2792 hlock->references = references; 2797 hlock->references = references;
2793#ifdef CONFIG_LOCK_STAT 2798#ifdef CONFIG_LOCK_STAT
2794 hlock->waittime_stamp = 0; 2799 hlock->waittime_stamp = 0;
2795 hlock->holdtime_stamp = sched_clock(); 2800 hlock->holdtime_stamp = lockstat_clock();
2796#endif 2801#endif
2797 2802
2798 if (check == 2 && !mark_irqflags(curr, hlock)) 2803 if (check == 2 && !mark_irqflags(curr, hlock))
@@ -3322,7 +3327,7 @@ found_it:
3322 if (hlock->instance != lock) 3327 if (hlock->instance != lock)
3323 return; 3328 return;
3324 3329
3325 hlock->waittime_stamp = sched_clock(); 3330 hlock->waittime_stamp = lockstat_clock();
3326 3331
3327 contention_point = lock_point(hlock_class(hlock)->contention_point, ip); 3332 contention_point = lock_point(hlock_class(hlock)->contention_point, ip);
3328 contending_point = lock_point(hlock_class(hlock)->contending_point, 3333 contending_point = lock_point(hlock_class(hlock)->contending_point,
@@ -3345,8 +3350,7 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip)
3345 struct held_lock *hlock, *prev_hlock; 3350 struct held_lock *hlock, *prev_hlock;
3346 struct lock_class_stats *stats; 3351 struct lock_class_stats *stats;
3347 unsigned int depth; 3352 unsigned int depth;
3348 u64 now; 3353 u64 now, waittime = 0;
3349 s64 waittime = 0;
3350 int i, cpu; 3354 int i, cpu;
3351 3355
3352 depth = curr->lockdep_depth; 3356 depth = curr->lockdep_depth;
@@ -3374,7 +3378,7 @@ found_it:
3374 3378
3375 cpu = smp_processor_id(); 3379 cpu = smp_processor_id();
3376 if (hlock->waittime_stamp) { 3380 if (hlock->waittime_stamp) {
3377 now = sched_clock(); 3381 now = lockstat_clock();
3378 waittime = now - hlock->waittime_stamp; 3382 waittime = now - hlock->waittime_stamp;
3379 hlock->holdtime_stamp = now; 3383 hlock->holdtime_stamp = now;
3380 } 3384 }
diff --git a/kernel/sched.c b/kernel/sched.c
index 76c0e9691fc0..e88689522e66 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -676,6 +676,7 @@ inline void update_rq_clock(struct rq *rq)
676 676
677/** 677/**
678 * runqueue_is_locked 678 * runqueue_is_locked
679 * @cpu: the processor in question.
679 * 680 *
680 * Returns true if the current cpu runqueue is locked. 681 * Returns true if the current cpu runqueue is locked.
681 * This interface allows printk to be called with the runqueue lock 682 * This interface allows printk to be called with the runqueue lock
@@ -2311,7 +2312,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2311{ 2312{
2312 int cpu, orig_cpu, this_cpu, success = 0; 2313 int cpu, orig_cpu, this_cpu, success = 0;
2313 unsigned long flags; 2314 unsigned long flags;
2314 struct rq *rq; 2315 struct rq *rq, *orig_rq;
2315 2316
2316 if (!sched_feat(SYNC_WAKEUPS)) 2317 if (!sched_feat(SYNC_WAKEUPS))
2317 wake_flags &= ~WF_SYNC; 2318 wake_flags &= ~WF_SYNC;
@@ -2319,7 +2320,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2319 this_cpu = get_cpu(); 2320 this_cpu = get_cpu();
2320 2321
2321 smp_wmb(); 2322 smp_wmb();
2322 rq = task_rq_lock(p, &flags); 2323 rq = orig_rq = task_rq_lock(p, &flags);
2323 update_rq_clock(rq); 2324 update_rq_clock(rq);
2324 if (!(p->state & state)) 2325 if (!(p->state & state))
2325 goto out; 2326 goto out;
@@ -2350,6 +2351,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state,
2350 set_task_cpu(p, cpu); 2351 set_task_cpu(p, cpu);
2351 2352
2352 rq = task_rq_lock(p, &flags); 2353 rq = task_rq_lock(p, &flags);
2354
2355 if (rq != orig_rq)
2356 update_rq_clock(rq);
2357
2353 WARN_ON(p->state != TASK_WAKING); 2358 WARN_ON(p->state != TASK_WAKING);
2354 cpu = task_cpu(p); 2359 cpu = task_cpu(p);
2355 2360
@@ -3656,6 +3661,7 @@ static void update_group_power(struct sched_domain *sd, int cpu)
3656 3661
3657/** 3662/**
3658 * update_sg_lb_stats - Update sched_group's statistics for load balancing. 3663 * update_sg_lb_stats - Update sched_group's statistics for load balancing.
3664 * @sd: The sched_domain whose statistics are to be updated.
3659 * @group: sched_group whose statistics are to be updated. 3665 * @group: sched_group whose statistics are to be updated.
3660 * @this_cpu: Cpu for which load balance is currently performed. 3666 * @this_cpu: Cpu for which load balance is currently performed.
3661 * @idle: Idle status of this_cpu 3667 * @idle: Idle status of this_cpu
@@ -6718,9 +6724,6 @@ EXPORT_SYMBOL(yield);
6718/* 6724/*
6719 * This task is about to go to sleep on IO. Increment rq->nr_iowait so 6725 * This task is about to go to sleep on IO. Increment rq->nr_iowait so
6720 * that process accounting knows that this is a task in IO wait state. 6726 * that process accounting knows that this is a task in IO wait state.
6721 *
6722 * But don't do that if it is a deliberate, throttling IO wait (this task
6723 * has set its backing_dev_info: the queue against which it should throttle)
6724 */ 6727 */
6725void __sched io_schedule(void) 6728void __sched io_schedule(void)
6726{ 6729{
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 45068269ebb1..c820b0310a12 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1393,7 +1393,7 @@ int trace_array_vprintk(struct trace_array *tr,
1393 1393
1394int trace_vprintk(unsigned long ip, const char *fmt, va_list args) 1394int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
1395{ 1395{
1396 return trace_array_printk(&global_trace, ip, fmt, args); 1396 return trace_array_vprintk(&global_trace, ip, fmt, args);
1397} 1397}
1398EXPORT_SYMBOL_GPL(trace_vprintk); 1398EXPORT_SYMBOL_GPL(trace_vprintk);
1399 1399
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 23245785927f..98a6cc5c64ed 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -933,8 +933,9 @@ static void postfix_clear(struct filter_parse_state *ps)
933 933
934 while (!list_empty(&ps->postfix)) { 934 while (!list_empty(&ps->postfix)) {
935 elt = list_first_entry(&ps->postfix, struct postfix_elt, list); 935 elt = list_first_entry(&ps->postfix, struct postfix_elt, list);
936 kfree(elt->operand);
937 list_del(&elt->list); 936 list_del(&elt->list);
937 kfree(elt->operand);
938 kfree(elt);
938 } 939 }
939} 940}
940 941
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index addfe2df93b1..ccefe574dcf7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -640,6 +640,24 @@ int schedule_delayed_work(struct delayed_work *dwork,
640EXPORT_SYMBOL(schedule_delayed_work); 640EXPORT_SYMBOL(schedule_delayed_work);
641 641
642/** 642/**
643 * flush_delayed_work - block until a dwork_struct's callback has terminated
644 * @dwork: the delayed work which is to be flushed
645 *
646 * Any timeout is cancelled, and any pending work is run immediately.
647 */
648void flush_delayed_work(struct delayed_work *dwork)
649{
650 if (del_timer(&dwork->timer)) {
651 struct cpu_workqueue_struct *cwq;
652 cwq = wq_per_cpu(keventd_wq, get_cpu());
653 __queue_work(cwq, &dwork->work);
654 put_cpu();
655 }
656 flush_work(&dwork->work);
657}
658EXPORT_SYMBOL(flush_delayed_work);
659
660/**
643 * schedule_delayed_work_on - queue work in global workqueue on CPU after delay 661 * schedule_delayed_work_on - queue work in global workqueue on CPU after delay
644 * @cpu: cpu to use 662 * @cpu: cpu to use
645 * @dwork: job to be done 663 * @dwork: job to be done
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 3d3accb1f800..5a37e2055717 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -92,7 +92,7 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v)
92 "BdiDirtyThresh: %8lu kB\n" 92 "BdiDirtyThresh: %8lu kB\n"
93 "DirtyThresh: %8lu kB\n" 93 "DirtyThresh: %8lu kB\n"
94 "BackgroundThresh: %8lu kB\n" 94 "BackgroundThresh: %8lu kB\n"
95 "WriteBack threads:%8lu\n" 95 "WritebackThreads: %8lu\n"
96 "b_dirty: %8lu\n" 96 "b_dirty: %8lu\n"
97 "b_io: %8lu\n" 97 "b_io: %8lu\n"
98 "b_more_io: %8lu\n" 98 "b_more_io: %8lu\n"
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index a3b14090b1fb..2c5d79236ead 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -566,7 +566,8 @@ static void balance_dirty_pages(struct address_space *mapping,
566 if (pages_written >= write_chunk) 566 if (pages_written >= write_chunk)
567 break; /* We've done our duty */ 567 break; /* We've done our duty */
568 568
569 schedule_timeout_interruptible(pause); 569 __set_current_state(TASK_INTERRUPTIBLE);
570 io_schedule_timeout(pause);
570 571
571 /* 572 /*
572 * Increase the delay for each loop, up to our previous 573 * Increase the delay for each loop, up to our previous
diff --git a/mm/percpu.c b/mm/percpu.c
index 4a048abad043..6af78c1ee704 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1870,13 +1870,14 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size,
1870 max_distance = 0; 1870 max_distance = 0;
1871 for (group = 0; group < ai->nr_groups; group++) { 1871 for (group = 0; group < ai->nr_groups; group++) {
1872 ai->groups[group].base_offset = areas[group] - base; 1872 ai->groups[group].base_offset = areas[group] - base;
1873 max_distance = max(max_distance, ai->groups[group].base_offset); 1873 max_distance = max_t(size_t, max_distance,
1874 ai->groups[group].base_offset);
1874 } 1875 }
1875 max_distance += ai->unit_size; 1876 max_distance += ai->unit_size;
1876 1877
1877 /* warn if maximum distance is further than 75% of vmalloc space */ 1878 /* warn if maximum distance is further than 75% of vmalloc space */
1878 if (max_distance > (VMALLOC_END - VMALLOC_START) * 3 / 4) { 1879 if (max_distance > (VMALLOC_END - VMALLOC_START) * 3 / 4) {
1879 pr_warning("PERCPU: max_distance=0x%lx too large for vmalloc " 1880 pr_warning("PERCPU: max_distance=0x%zx too large for vmalloc "
1880 "space 0x%lx\n", 1881 "space 0x%lx\n",
1881 max_distance, VMALLOC_END - VMALLOC_START); 1882 max_distance, VMALLOC_END - VMALLOC_START);
1882#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK 1883#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 4f9c1908593b..c67e73ecd5be 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -100,7 +100,7 @@ as-option = $(call try-run,\
100# Usage: cflags-y += $(call as-instr,instr,option1,option2) 100# Usage: cflags-y += $(call as-instr,instr,option1,option2)
101 101
102as-instr = $(call try-run,\ 102as-instr = $(call try-run,\
103 echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) 103 /bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
104 104
105# cc-option 105# cc-option
106# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 106# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7a7778746ea6..ffdafb26f539 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -208,7 +208,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
208 208
209# Bzip2 and LZMA do not include size in file... so we have to fake that; 209# Bzip2 and LZMA do not include size in file... so we have to fake that;
210# append the size as a 32-bit littleendian number as gzip does. 210# append the size as a 32-bit littleendian number as gzip does.
211size_append = echo -ne $(shell \ 211size_append = /bin/echo -ne $(shell \
212dec_size=0; \ 212dec_size=0; \
213for F in $1; do \ 213for F in $1; do \
214 fsize=$$(stat -c "%s" $$F); \ 214 fsize=$$(stat -c "%s" $$F); \
diff --git a/scripts/checkkconfigsymbols.sh b/scripts/checkkconfigsymbols.sh
index 39677c82747a..46be3c5a62b7 100755
--- a/scripts/checkkconfigsymbols.sh
+++ b/scripts/checkkconfigsymbols.sh
@@ -9,7 +9,7 @@ paths="$@"
9# Doing this once at the beginning saves a lot of time, on a cache-hot tree. 9# Doing this once at the beginning saves a lot of time, on a cache-hot tree.
10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`" 10Kconfigs="`find . -name 'Kconfig' -o -name 'Kconfig*[^~]'`"
11 11
12echo -e "File list \tundefined symbol used" 12/bin/echo -e "File list \tundefined symbol used"
13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i 13find $paths -name '*.[chS]' -o -name 'Makefile' -o -name 'Makefile*[^~]'| while read i
14do 14do
15 # Output the bare Kconfig variable and the filename; the _MODULE part at 15 # Output the bare Kconfig variable and the filename; the _MODULE part at
@@ -54,6 +54,6 @@ while read symb files; do
54 # beyond the purpose of this script. 54 # beyond the purpose of this script.
55 symb_bare=`echo $symb | sed -e 's/_MODULE//'` 55 symb_bare=`echo $symb | sed -e 's/_MODULE//'`
56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then 56 if ! grep -q "\<$symb_bare\>" $Kconfigs; then
57 echo -e "$files: \t$symb" 57 /bin/echo -e "$files: \t$symb"
58 fi 58 fi
59done|sort 59done|sort
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index c6ae4052ab43..b89ca2c58fdb 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -20,7 +20,7 @@ use strict;
20 20
21my ($readdir, $installdir, $arch, @files) = @ARGV; 21my ($readdir, $installdir, $arch, @files) = @ARGV;
22 22
23my $unifdef = "scripts/unifdef -U__KERNEL__"; 23my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
24 24
25foreach my $file (@files) { 25foreach my $file (@files) {
26 local *INFILE; 26 local *INFILE;
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 6a12dd9f1181..bce3d0fe6fbd 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -1,3 +1,5 @@
1#!/bin/sh
2
1TARGET=$1 3TARGET=$1
2ARCH=$2 4ARCH=$2
3SMP=$3 5SMP=$3
@@ -50,7 +52,7 @@ UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
50# Truncate to maximum length 52# Truncate to maximum length
51 53
52UTS_LEN=64 54UTS_LEN=64
53UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" 55UTS_TRUNCATE="cut -b -$UTS_LEN"
54 56
55# Generate a temporary compile.h 57# Generate a temporary compile.h
56 58
@@ -66,9 +68,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
66 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" 68 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
67 69
68 if [ -x /bin/dnsdomainname ]; then 70 if [ -x /bin/dnsdomainname ]; then
69 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" 71 domain=`dnsdomainname 2> /dev/null`
70 elif [ -x /bin/domainname ]; then 72 elif [ -x /bin/domainname ]; then
71 echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" 73 domain=`domainname 2> /dev/null`
74 fi
75
76 if [ -n "$domain" ]; then
77 echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\"
72 else 78 else
73 echo \#define LINUX_COMPILE_DOMAIN 79 echo \#define LINUX_COMPILE_DOMAIN
74 fi 80 fi
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index fa4a0a17b7e0..f67cc885c807 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -18,6 +18,9 @@
18# e) generate the rpm files, based on kernel.spec 18# e) generate the rpm files, based on kernel.spec
19# - Use /. to avoid tar packing just the symlink 19# - Use /. to avoid tar packing just the symlink
20 20
21# Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT,
22# but the binrpm-pkg target can; for some reason O= gets ignored.
23
21# Do we have rpmbuild, otherwise fall back to the older rpm 24# Do we have rpmbuild, otherwise fall back to the older rpm
22RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ 25RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
23 else echo rpm; fi) 26 else echo rpm; fi)
@@ -33,6 +36,12 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
33 $(CONFIG_SHELL) $(MKSPEC) > $@ 36 $(CONFIG_SHELL) $(MKSPEC) > $@
34 37
35rpm-pkg rpm: $(objtree)/kernel.spec FORCE 38rpm-pkg rpm: $(objtree)/kernel.spec FORCE
39 @if test -n "$(KBUILD_OUTPUT)"; then \
40 echo "Building source + binary RPM is not possible outside the"; \
41 echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
42 echo "binrpm-pkg target instead."; \
43 false; \
44 fi
36 $(MAKE) clean 45 $(MAKE) clean
37 $(PREV) ln -sf $(srctree) $(KERNELPATH) 46 $(PREV) ln -sf $(srctree) $(KERNELPATH)
38 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion 47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion
@@ -61,7 +70,7 @@ binrpm-pkg: $(objtree)/binkernel.spec FORCE
61 set -e; \ 70 set -e; \
62 mv -f $(objtree)/.tmp_version $(objtree)/.version 71 mv -f $(objtree)/.tmp_version $(objtree)/.version
63 72
64 $(RPM) $(RPMOPTS) --define "_builddir $(srctree)" --target \ 73 $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \
65 $(UTS_MACHINE) -bb $< 74 $(UTS_MACHINE) -bb $<
66 75
67clean-files += $(objtree)/binkernel.spec 76clean-files += $(objtree)/binkernel.spec
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 3d93f8c81252..47bdd2f99b78 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -70,7 +70,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
70echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' 70echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
71echo "%endif" 71echo "%endif"
72 72
73echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' 73echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} KBUILD_SRC= modules_install'
74echo "%ifarch ia64" 74echo "%ifarch ia64"
75echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" 75echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
76echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" 76echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index dc78272fc39f..1f0f8213e2d5 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -937,6 +937,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci)
937 struct snd_ac97 *ac97; 937 struct snd_ac97 *ac97;
938 int ret; 938 int ret;
939 939
940 writel(0, aaci->base + AC97_POWERDOWN);
940 /* 941 /*
941 * Assert AACIRESET for 2us 942 * Assert AACIRESET for 2us
942 */ 943 */
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 24585c6c6d01..4e2b925a94cc 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -808,6 +808,8 @@ static struct pci_device_id snd_bt87x_ids[] = {
808 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC), 808 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, GENERIC),
809 /* Leadtek Winfast tv 2000xp delux */ 809 /* Leadtek Winfast tv 2000xp delux */
810 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC), 810 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x107d, 0x6606, GENERIC),
811 /* Pinnacle PCTV */
812 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x11bd, 0x0012, GENERIC),
811 /* Voodoo TV 200 */ 813 /* Voodoo TV 200 */
812 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC), 814 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x121a, 0x3000, GENERIC),
813 /* Askey Computer Corp. MagicTView'99 */ 815 /* Askey Computer Corp. MagicTView'99 */
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index c8435c9a97f9..9fb60276f5c9 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -29,6 +29,9 @@
29#include "hda_codec.h" 29#include "hda_codec.h"
30#include "hda_local.h" 30#include "hda_local.h"
31 31
32/* define below to restrict the supported rates and formats */
33/* #define LIMITED_RATE_FMT_SUPPORT */
34
32struct nvhdmi_spec { 35struct nvhdmi_spec {
33 struct hda_multi_out multiout; 36 struct hda_multi_out multiout;
34 37
@@ -60,6 +63,22 @@ static struct hda_verb nvhdmi_basic_init[] = {
60 {} /* terminator */ 63 {} /* terminator */
61}; 64};
62 65
66#ifdef LIMITED_RATE_FMT_SUPPORT
67/* support only the safe format and rate */
68#define SUPPORTED_RATES SNDRV_PCM_RATE_48000
69#define SUPPORTED_MAXBPS 16
70#define SUPPORTED_FORMATS SNDRV_PCM_FMTBIT_S16_LE
71#else
72/* support all rates and formats */
73#define SUPPORTED_RATES \
74 (SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
75 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\
76 SNDRV_PCM_RATE_192000)
77#define SUPPORTED_MAXBPS 24
78#define SUPPORTED_FORMATS \
79 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
80#endif
81
63/* 82/*
64 * Controls 83 * Controls
65 */ 84 */
@@ -258,9 +277,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch = {
258 .channels_min = 2, 277 .channels_min = 2,
259 .channels_max = 8, 278 .channels_max = 8,
260 .nid = Nv_Master_Convert_nid, 279 .nid = Nv_Master_Convert_nid,
261 .rates = SNDRV_PCM_RATE_48000, 280 .rates = SUPPORTED_RATES,
262 .maxbps = 16, 281 .maxbps = SUPPORTED_MAXBPS,
263 .formats = SNDRV_PCM_FMTBIT_S16_LE, 282 .formats = SUPPORTED_FORMATS,
264 .ops = { 283 .ops = {
265 .open = nvhdmi_dig_playback_pcm_open, 284 .open = nvhdmi_dig_playback_pcm_open,
266 .close = nvhdmi_dig_playback_pcm_close_8ch, 285 .close = nvhdmi_dig_playback_pcm_close_8ch,
@@ -273,9 +292,9 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_2ch = {
273 .channels_min = 2, 292 .channels_min = 2,
274 .channels_max = 2, 293 .channels_max = 2,
275 .nid = Nv_Master_Convert_nid, 294 .nid = Nv_Master_Convert_nid,
276 .rates = SNDRV_PCM_RATE_48000, 295 .rates = SUPPORTED_RATES,
277 .maxbps = 16, 296 .maxbps = SUPPORTED_MAXBPS,
278 .formats = SNDRV_PCM_FMTBIT_S16_LE, 297 .formats = SUPPORTED_FORMATS,
279 .ops = { 298 .ops = {
280 .open = nvhdmi_dig_playback_pcm_open, 299 .open = nvhdmi_dig_playback_pcm_open,
281 .close = nvhdmi_dig_playback_pcm_close_2ch, 300 .close = nvhdmi_dig_playback_pcm_close_2ch,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 470fd74a0a1a..c08ca660daba 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -275,7 +275,7 @@ struct alc_spec {
275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
277 277
278 const struct hda_verb *init_verbs[5]; /* initialization verbs 278 const struct hda_verb *init_verbs[10]; /* initialization verbs
279 * don't forget NULL 279 * don't forget NULL
280 * termination! 280 * termination!
281 */ 281 */
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a9b26828a651..66c0876bf734 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -158,6 +158,7 @@ enum {
158 STAC_D965_5ST_NO_FP, 158 STAC_D965_5ST_NO_FP,
159 STAC_DELL_3ST, 159 STAC_DELL_3ST,
160 STAC_DELL_BIOS, 160 STAC_DELL_BIOS,
161 STAC_927X_VOLKNOB,
161 STAC_927X_MODELS 162 STAC_927X_MODELS
162}; 163};
163 164
@@ -907,6 +908,16 @@ static struct hda_verb d965_core_init[] = {
907 {} 908 {}
908}; 909};
909 910
911static struct hda_verb dell_3st_core_init[] = {
912 /* don't set delta bit */
913 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
914 /* unmute node 0x1b */
915 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
916 /* select node 0x03 as DAC */
917 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
918 {}
919};
920
910static struct hda_verb stac927x_core_init[] = { 921static struct hda_verb stac927x_core_init[] = {
911 /* set master volume and direct control */ 922 /* set master volume and direct control */
912 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 923 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
@@ -915,6 +926,14 @@ static struct hda_verb stac927x_core_init[] = {
915 {} 926 {}
916}; 927};
917 928
929static struct hda_verb stac927x_volknob_core_init[] = {
930 /* don't set delta bit */
931 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
932 /* enable analog pc beep path */
933 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
934 {}
935};
936
918static struct hda_verb stac9205_core_init[] = { 937static struct hda_verb stac9205_core_init[] = {
919 /* set master volume and direct control */ 938 /* set master volume and direct control */
920 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 939 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
@@ -1999,6 +2018,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
1999 [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, 2018 [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs,
2000 [STAC_DELL_3ST] = dell_3st_pin_configs, 2019 [STAC_DELL_3ST] = dell_3st_pin_configs,
2001 [STAC_DELL_BIOS] = NULL, 2020 [STAC_DELL_BIOS] = NULL,
2021 [STAC_927X_VOLKNOB] = NULL,
2002}; 2022};
2003 2023
2004static const char *stac927x_models[STAC_927X_MODELS] = { 2024static const char *stac927x_models[STAC_927X_MODELS] = {
@@ -2010,6 +2030,7 @@ static const char *stac927x_models[STAC_927X_MODELS] = {
2010 [STAC_D965_5ST_NO_FP] = "5stack-no-fp", 2030 [STAC_D965_5ST_NO_FP] = "5stack-no-fp",
2011 [STAC_DELL_3ST] = "dell-3stack", 2031 [STAC_DELL_3ST] = "dell-3stack",
2012 [STAC_DELL_BIOS] = "dell-bios", 2032 [STAC_DELL_BIOS] = "dell-bios",
2033 [STAC_927X_VOLKNOB] = "volknob",
2013}; 2034};
2014 2035
2015static struct snd_pci_quirk stac927x_cfg_tbl[] = { 2036static struct snd_pci_quirk stac927x_cfg_tbl[] = {
@@ -2045,6 +2066,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2045 "Intel D965", STAC_D965_5ST), 2066 "Intel D965", STAC_D965_5ST),
2046 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, 2067 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
2047 "Intel D965", STAC_D965_5ST), 2068 "Intel D965", STAC_D965_5ST),
2069 /* volume-knob fixes */
2070 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
2048 {} /* terminator */ 2071 {} /* terminator */
2049}; 2072};
2050 2073
@@ -5612,10 +5635,14 @@ static int patch_stac927x(struct hda_codec *codec)
5612 spec->dmic_nids = stac927x_dmic_nids; 5635 spec->dmic_nids = stac927x_dmic_nids;
5613 spec->num_dmics = STAC927X_NUM_DMICS; 5636 spec->num_dmics = STAC927X_NUM_DMICS;
5614 5637
5615 spec->init = d965_core_init; 5638 spec->init = dell_3st_core_init;
5616 spec->dmux_nids = stac927x_dmux_nids; 5639 spec->dmux_nids = stac927x_dmux_nids;
5617 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); 5640 spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids);
5618 break; 5641 break;
5642 case STAC_927X_VOLKNOB:
5643 spec->num_dmics = 0;
5644 spec->init = stac927x_volknob_core_init;
5645 break;
5619 default: 5646 default:
5620 spec->num_dmics = 0; 5647 spec->num_dmics = 0;
5621 spec->init = stac927x_core_init; 5648 spec->init = stac927x_core_init;
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
index 37564300b50d..6da21a2bcade 100644
--- a/sound/pci/ice1712/amp.c
+++ b/sound/pci/ice1712/amp.c
@@ -52,11 +52,13 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)
52 52
53 /* only use basic functionality for now */ 53 /* only use basic functionality for now */
54 54
55 ice->num_total_dacs = 2; /* only PSDOUT0 is connected */ 55 /* VT1616 6ch codec connected to PSDOUT0 using packed mode */
56 ice->num_total_dacs = 6;
56 ice->num_total_adcs = 2; 57 ice->num_total_adcs = 2;
57 58
58 /* Chaintech AV-710 has another codecs, which need initialization */ 59 /* Chaintech AV-710 has another WM8728 codec connected to PSDOUT4
59 /* initialize WM8728 codec */ 60 (shared with the SPDIF output). Mixer control for this codec
61 is not yet supported. */
60 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) { 62 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AV710) {
61 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) 63 for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
62 wm_put(ice, wm_inits[i], wm_inits[i+1]); 64 wm_put(ice, wm_inits[i], wm_inits[i+1]);
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 76b717dae4b6..10fc92c05574 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -648,7 +648,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
648 (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) { 648 (inb(ICEMT1724(ice, DMA_PAUSE)) & DMA_PAUSES)) {
649 /* running? we cannot change the rate now... */ 649 /* running? we cannot change the rate now... */
650 spin_unlock_irqrestore(&ice->reg_lock, flags); 650 spin_unlock_irqrestore(&ice->reg_lock, flags);
651 return -EBUSY; 651 return ((rate == ice->cur_rate) && !force) ? 0 : -EBUSY;
652 } 652 }
653 if (!force && is_pro_rate_locked(ice)) { 653 if (!force && is_pro_rate_locked(ice)) {
654 spin_unlock_irqrestore(&ice->reg_lock, flags); 654 spin_unlock_irqrestore(&ice->reg_lock, flags);
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5881943f0c34..742a32eee8fc 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -157,11 +157,18 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
157uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 157uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
158uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 158uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
159 159
160# If we're on a 64-bit kernel, use -m64 160#
161ifndef NO_64BIT 161# Add -m32 for cross-builds:
162 ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) 162#
163 M64 := -m64 163ifdef NO_64BIT
164 endif 164 MBITS := -m32
165else
166 #
167 # If we're on a 64-bit kernel, use -m64:
168 #
169 ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
170 MBITS := -m64
171 endif
165endif 172endif
166 173
167# CFLAGS and LDFLAGS are for the users to override from the command line. 174# CFLAGS and LDFLAGS are for the users to override from the command line.
@@ -194,7 +201,7 @@ EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
194EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes 201EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
195EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement 202EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
196 203
197CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) 204CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
198LDFLAGS = -lpthread -lrt -lelf -lm 205LDFLAGS = -lpthread -lrt -lelf -lm
199ALL_CFLAGS = $(CFLAGS) 206ALL_CFLAGS = $(CFLAGS)
200ALL_LDFLAGS = $(LDFLAGS) 207ALL_LDFLAGS = $(LDFLAGS)
@@ -416,7 +423,7 @@ ifeq ($(uname_S),Darwin)
416endif 423endif
417 424
418ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) 425ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
419 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); 426 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
420endif 427endif
421 428
422ifdef NO_DEMANGLE 429ifdef NO_DEMANGLE
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index ea9c15c0cdfe..ce2d5be4f30e 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1287,7 +1287,7 @@ static struct sort_dimension *available_sorts[] = {
1287 1287
1288static LIST_HEAD(sort_list); 1288static LIST_HEAD(sort_list);
1289 1289
1290static int sort_dimension__add(char *tok, struct list_head *list) 1290static int sort_dimension__add(const char *tok, struct list_head *list)
1291{ 1291{
1292 int i; 1292 int i;
1293 1293
@@ -1917,7 +1917,7 @@ static void setup_sorting(void)
1917 1917
1918 free(str); 1918 free(str);
1919 1919
1920 sort_dimension__add((char *)"pid", &cmp_pid); 1920 sort_dimension__add("pid", &cmp_pid);
1921} 1921}
1922 1922
1923static const char *record_args[] = { 1923static const char *record_args[] = {
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 87c424de79ee..8cfb48cbbea0 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -691,7 +691,10 @@ static void store_event_type(const char *orgname)
691 FILE *file; 691 FILE *file;
692 int id; 692 int id;
693 693
694 sprintf(filename, "/sys/kernel/debug/tracing/events/%s/id", orgname); 694 sprintf(filename, "%s/", debugfs_path);
695 strncat(filename, orgname, strlen(orgname));
696 strcat(filename, "/id");
697
695 c = strchr(filename, ':'); 698 c = strchr(filename, ':');
696 if (c) 699 if (c)
697 *c = '/'; 700 *c = '/';
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 55b41b9e3834..55c9659a56e2 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -618,7 +618,7 @@ static int test_type(enum event_type type, enum event_type expect)
618} 618}
619 619
620static int test_type_token(enum event_type type, char *token, 620static int test_type_token(enum event_type type, char *token,
621 enum event_type expect, char *expect_tok) 621 enum event_type expect, const char *expect_tok)
622{ 622{
623 if (type != expect) { 623 if (type != expect) {
624 die("Error: expected type %d but read %d", 624 die("Error: expected type %d but read %d",
@@ -650,7 +650,7 @@ static int read_expect_type(enum event_type expect, char **tok)
650 return __read_expect_type(expect, tok, 1); 650 return __read_expect_type(expect, tok, 1);
651} 651}
652 652
653static int __read_expected(enum event_type expect, char *str, int newline_ok) 653static int __read_expected(enum event_type expect, const char *str, int newline_ok)
654{ 654{
655 enum event_type type; 655 enum event_type type;
656 char *token; 656 char *token;
@@ -668,12 +668,12 @@ static int __read_expected(enum event_type expect, char *str, int newline_ok)
668 return 0; 668 return 0;
669} 669}
670 670
671static int read_expected(enum event_type expect, char *str) 671static int read_expected(enum event_type expect, const char *str)
672{ 672{
673 return __read_expected(expect, str, 1); 673 return __read_expected(expect, str, 1);
674} 674}
675 675
676static int read_expected_item(enum event_type expect, char *str) 676static int read_expected_item(enum event_type expect, const char *str)
677{ 677{
678 return __read_expected(expect, str, 0); 678 return __read_expected(expect, str, 0);
679} 679}