aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-platform-asus-laptop16
-rw-r--r--Documentation/ABI/testing/sysfs-platform-eeepc-wmi10
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/boot/Makefile5
-rw-r--r--arch/arm/boot/bootp/init.S2
-rw-r--r--arch/arm/boot/compressed/head.S13
-rw-r--r--arch/arm/common/gic.c40
-rw-r--r--arch/arm/kernel/entry-armv.S2
-rw-r--r--arch/arm/kernel/head.S7
-rw-r--r--arch/arm/kernel/relocate_kernel.S2
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c2
-rw-r--r--arch/arm/mach-realview/headsmp.S1
-rw-r--r--arch/arm/mach-s3c2412/Kconfig2
-rw-r--r--arch/arm/mach-s3c2416/Kconfig3
-rw-r--r--arch/arm/mach-s3c2440/Kconfig4
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c11
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c14
-rw-r--r--arch/arm/mach-s3c2443/Kconfig1
-rw-r--r--arch/arm/mach-tegra/include/mach/debug-macro.S4
-rw-r--r--arch/arm/mach-vexpress/headsmp.S1
-rw-r--r--arch/arm/mm/proc-v7.S4
-rw-r--r--arch/arm/plat-iop/time.c3
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c8
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c2
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/s3c244x.h7
-rw-r--r--arch/arm/plat-samsung/gpio-config.c47
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h11
-rw-r--r--arch/arm/vfp/vfphw.S1
-rw-r--r--arch/mn10300/include/asm/syscall.h117
-rw-r--r--arch/mn10300/kernel/gdb-io-serial.c3
-rw-r--r--arch/mn10300/kernel/gdb-io-ttysm.c3
-rw-r--r--arch/mn10300/kernel/gdb-stub.c3
-rw-r--r--arch/parisc/kernel/irq.c7
-rw-r--r--arch/parisc/kernel/signal.c9
-rw-r--r--arch/s390/kernel/vtime.c19
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c34
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c47
-rw-r--r--arch/sh/include/asm/cacheflush.h2
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7724.h3
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c44
-rw-r--r--arch/sh/mm/cache-sh4.c4
-rw-r--r--arch/sh/mm/cache-sh7705.c2
-rw-r--r--arch/sh/mm/cache.c14
-rw-r--r--arch/sh/mm/kmap.c2
-rw-r--r--arch/x86/include/asm/pvclock.h1
-rw-r--r--arch/x86/kernel/pvclock.c5
-rw-r--r--arch/x86/pci/xen.c27
-rw-r--r--arch/x86/xen/enlighten.c4
-rw-r--r--arch/x86/xen/platform-pci-unplug.c2
-rw-r--r--arch/x86/xen/setup.c41
-rw-r--r--arch/x86/xen/suspend.c1
-rw-r--r--arch/x86/xen/time.c2
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--drivers/char/agp/intel-gtt.c6
-rw-r--r--drivers/dma/shdma.c1
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c2
-rw-r--r--drivers/gpu/drm/drm_irq.c19
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c12
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h1
-rw-r--r--drivers/gpu/drm/i915/intel_acpi.c34
-rw-r--r--drivers/gpu/drm/i915/intel_display.c76
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c25
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c98
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c30
-rw-r--r--drivers/gpu/drm/radeon/r600.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c13
-rw-r--r--drivers/hid/Kconfig10
-rw-r--r--drivers/hid/Makefile13
-rw-r--r--drivers/hid/hid-3m-pct.c2
-rw-r--r--drivers/hid/hid-a4tech.c6
-rw-r--r--drivers/hid/hid-apple.c63
-rw-r--r--drivers/hid/hid-axff.c14
-rw-r--r--drivers/hid/hid-belkin.c4
-rw-r--r--drivers/hid/hid-cando.c2
-rw-r--r--drivers/hid/hid-cherry.c3
-rw-r--r--drivers/hid/hid-core.c118
-rw-r--r--drivers/hid/hid-cypress.c4
-rw-r--r--drivers/hid/hid-debug.c4
-rw-r--r--drivers/hid/hid-drff.c14
-rw-r--r--drivers/hid/hid-egalax.c2
-rw-r--r--drivers/hid/hid-elecom.c3
-rw-r--r--drivers/hid/hid-emsff.c161
-rw-r--r--drivers/hid/hid-gaff.c13
-rw-r--r--drivers/hid/hid-ids.h10
-rw-r--r--drivers/hid/hid-input.c18
-rw-r--r--drivers/hid/hid-kye.c4
-rw-r--r--drivers/hid/hid-lg.c15
-rw-r--r--drivers/hid/hid-lg2ff.c9
-rw-r--r--drivers/hid/hid-lg3ff.c9
-rw-r--r--drivers/hid/hid-lg4ff.c9
-rw-r--r--drivers/hid/hid-lgff.c8
-rw-r--r--drivers/hid/hid-magicmouse.c15
-rw-r--r--drivers/hid/hid-microsoft.c7
-rw-r--r--drivers/hid/hid-monterey.c3
-rw-r--r--drivers/hid/hid-mosart.c2
-rw-r--r--drivers/hid/hid-ntrig.c9
-rw-r--r--drivers/hid/hid-ortek.c3
-rw-r--r--drivers/hid/hid-petalynx.c7
-rw-r--r--drivers/hid/hid-picolcd.c53
-rw-r--r--drivers/hid/hid-pl.c16
-rw-r--r--drivers/hid/hid-prodikeys.c27
-rw-r--r--drivers/hid/hid-quanta.c2
-rw-r--r--drivers/hid/hid-roccat-kone.c22
-rw-r--r--drivers/hid/hid-roccat-pyra.c20
-rw-r--r--drivers/hid/hid-roccat.c36
-rw-r--r--drivers/hid/hid-samsung.c8
-rw-r--r--drivers/hid/hid-sjoy.c16
-rw-r--r--drivers/hid/hid-sony.c11
-rw-r--r--drivers/hid/hid-stantum.c2
-rw-r--r--drivers/hid/hid-sunplus.c3
-rw-r--r--drivers/hid/hid-tmff.c27
-rw-r--r--drivers/hid/hid-topseed.c1
-rw-r--r--drivers/hid/hid-wacom.c28
-rw-r--r--drivers/hid/hid-zpff.c11
-rw-r--r--drivers/hid/hid-zydacron.c11
-rw-r--r--drivers/hid/hidraw.c36
-rw-r--r--drivers/hid/usbhid/Makefile6
-rw-r--r--drivers/hid/usbhid/hid-core.c105
-rw-r--r--drivers/hid/usbhid/hid-pidff.c164
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
-rw-r--r--drivers/hid/usbhid/hiddev.c241
-rw-r--r--drivers/hid/usbhid/usbhid.h1
-rw-r--r--drivers/hid/usbhid/usbkbd.c24
-rw-r--r--drivers/i2c/Kconfig3
-rw-r--r--drivers/i2c/algos/Kconfig14
-rw-r--r--drivers/input/joystick/turbografx.c1
-rw-r--r--drivers/input/keyboard/Kconfig16
-rw-r--r--drivers/input/keyboard/Makefile1
-rw-r--r--drivers/input/keyboard/gpio_keys_polled.c261
-rw-r--r--drivers/input/mouse/bcm5974.c40
-rw-r--r--drivers/input/mouse/synaptics.h3
-rw-r--r--drivers/input/serio/gscps2.c2
-rw-r--r--drivers/input/tablet/wacom_wac.c9
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c1
-rw-r--r--drivers/media/common/tuners/Kconfig8
-rw-r--r--drivers/media/dvb/frontends/Kconfig5
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/mtd/ubi/io.c37
-rw-r--r--drivers/mtd/ubi/scan.c4
-rw-r--r--drivers/parisc/dino.c1
-rw-r--r--drivers/parisc/eisa.c3
-rw-r--r--drivers/parisc/gsc.c3
-rw-r--r--drivers/parisc/iosapic.c8
-rw-r--r--drivers/parisc/led.c17
-rw-r--r--drivers/parisc/superio.c3
-rw-r--r--drivers/pcmcia/soc_common.c1
-rw-r--r--drivers/platform/x86/asus-laptop.c97
-rw-r--r--drivers/platform/x86/eeepc-wmi.c4
-rw-r--r--drivers/platform/x86/hp-wmi.c2
-rw-r--r--drivers/platform/x86/ibm_rtl.c34
-rw-r--r--drivers/platform/x86/msi-wmi.c16
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c1
-rw-r--r--drivers/platform/x86/toshiba_acpi.c1
-rw-r--r--drivers/platform/x86/wmi.c2
-rw-r--r--drivers/s390/cio/css.c2
-rw-r--r--drivers/video/da8xx-fb.c14
-rw-r--r--drivers/video/fbcmap.c1
-rw-r--r--drivers/video/geode/lxfb.h4
-rw-r--r--drivers/video/geode/lxfb_ops.c20
-rw-r--r--drivers/xen/balloon.c12
-rw-r--r--drivers/xen/events.c109
-rw-r--r--drivers/xen/manage.c1
-rw-r--r--fs/autofs4/root.c12
-rw-r--r--fs/ocfs2/cluster/heartbeat.c14
-rw-r--r--fs/ocfs2/dcache.c1
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c2
-rw-r--r--fs/ocfs2/ocfs2.h6
-rw-r--r--fs/ocfs2/stack_user.c2
-rw-r--r--fs/proc/base.c2
-rw-r--r--include/drm/i915_drm.h2
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/hid.h75
-rw-r--r--include/linux/input.h25
-rw-r--r--include/xen/events.h7
-rw-r--r--include/xen/interface/physdev.h10
-rw-r--r--kernel/irq/proc.c2
-rw-r--r--kernel/power/hibernate.c22
-rw-r--r--kernel/power/suspend.c5
-rw-r--r--kernel/power/swap.c53
-rw-r--r--kernel/power/user.c2
-rw-r--r--kernel/printk.c4
-rw-r--r--mm/page_alloc.c19
-rw-r--r--mm/slub.c4
-rw-r--r--scripts/kconfig/expr.h1
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/menu.c11
-rw-r--r--scripts/kconfig/zconf.gperf1
-rw-r--r--scripts/kconfig/zconf.hash.c_shipped122
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped570
-rw-r--r--scripts/kconfig/zconf.y21
-rw-r--r--sound/core/oss/pcm_oss.c19
-rw-r--r--sound/pci/hda/patch_realtek.c1
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/soc/codecs/wm8731.c2
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c1
-rw-r--r--sound/soc/fsl/p1022_ds.c1
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c15
-rw-r--r--sound/soc/nuc900/nuc900-audio.h2
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c11
-rw-r--r--sound/soc/omap/Kconfig2
-rw-r--r--sound/soc/s6000/s6000-i2s.c2
-rw-r--r--sound/soc/s6000/s6000-pcm.c2
-rw-r--r--sound/soc/s6000/s6105-ipcam.c2
-rw-r--r--tools/perf/builtin-record.c6
-rw-r--r--tools/perf/util/header.c11
-rw-r--r--tools/perf/util/symbol.c59
-rw-r--r--usr/initramfs_data.S5
211 files changed, 2784 insertions, 1516 deletions
diff --git a/Documentation/ABI/testing/sysfs-platform-asus-laptop b/Documentation/ABI/testing/sysfs-platform-asus-laptop
index 1d775390e856..41ff8ae4dee0 100644
--- a/Documentation/ABI/testing/sysfs-platform-asus-laptop
+++ b/Documentation/ABI/testing/sysfs-platform-asus-laptop
@@ -47,6 +47,20 @@ Date: January 2007
47KernelVersion: 2.6.20 47KernelVersion: 2.6.20
48Contact: "Corentin Chary" <corentincj@iksaif.net> 48Contact: "Corentin Chary" <corentincj@iksaif.net>
49Description: 49Description:
50 Control the bluetooth device. 1 means on, 0 means off. 50 Control the wlan device. 1 means on, 0 means off.
51 This may control the led, the device or both. 51 This may control the led, the device or both.
52Users: Lapsus 52Users: Lapsus
53
54What: /sys/devices/platform/asus_laptop/wimax
55Date: October 2010
56KernelVersion: 2.6.37
57Contact: "Corentin Chary" <corentincj@iksaif.net>
58Description:
59 Control the wimax device. 1 means on, 0 means off.
60
61What: /sys/devices/platform/asus_laptop/wwan
62Date: October 2010
63KernelVersion: 2.6.37
64Contact: "Corentin Chary" <corentincj@iksaif.net>
65Description:
66 Control the wwan (3G) device. 1 means on, 0 means off.
diff --git a/Documentation/ABI/testing/sysfs-platform-eeepc-wmi b/Documentation/ABI/testing/sysfs-platform-eeepc-wmi
new file mode 100644
index 000000000000..e4b5fef5fadd
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-platform-eeepc-wmi
@@ -0,0 +1,10 @@
1What: /sys/devices/platform/eeepc-wmi/cpufv
2Date: Oct 2010
3KernelVersion: 2.6.37
4Contact: "Corentin Chary" <corentincj@iksaif.net>
5Description:
6 Change CPU clock configuration (write-only).
7 There are three available clock configuration:
8 * 0 -> Super Performance Mode
9 * 1 -> High Performance Mode
10 * 2 -> Power Saving Mode
diff --git a/Makefile b/Makefile
index 9e3c89030f5c..3d94974542ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 37 3SUBLEVEL = 37
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc5
5NAME = Flesh-Eating Bats with Fangs 5NAME = Flesh-Eating Bats with Fangs
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index db524e75c4a2..f1d9297b1050 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,7 +9,7 @@ config ARM
9 select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI) 9 select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI)
10 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 10 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
11 select HAVE_ARCH_KGDB 11 select HAVE_ARCH_KGDB
12 select HAVE_KPROBES if (!XIP_KERNEL) 12 select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL)
13 select HAVE_KRETPROBES if (HAVE_KPROBES) 13 select HAVE_KRETPROBES if (HAVE_KPROBES)
14 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 14 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
15 select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) 15 select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 4a590f4113e2..4d26f2c52a75 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -70,12 +70,7 @@ else
70$(obj)/uImage: LOADADDR=$(ZRELADDR) 70$(obj)/uImage: LOADADDR=$(ZRELADDR)
71endif 71endif
72 72
73ifeq ($(CONFIG_THUMB2_KERNEL),y)
74# Set bit 0 to 1 so that "mov pc, rx" switches to Thumb-2 mode
75$(obj)/uImage: STARTADDR=$(shell echo $(LOADADDR) | sed -e "s/.$$/1/")
76else
77$(obj)/uImage: STARTADDR=$(LOADADDR) 73$(obj)/uImage: STARTADDR=$(LOADADDR)
78endif
79 74
80$(obj)/uImage: $(obj)/zImage FORCE 75$(obj)/uImage: $(obj)/zImage FORCE
81 $(call if_changed,uimage) 76 $(call if_changed,uimage)
diff --git a/arch/arm/boot/bootp/init.S b/arch/arm/boot/bootp/init.S
index 8b0de41c3dcb..78b508075161 100644
--- a/arch/arm/boot/bootp/init.S
+++ b/arch/arm/boot/bootp/init.S
@@ -73,6 +73,8 @@ move: ldmia r4!, {r7 - r10} @ move 32-bytes at a time
73 73
74 .size _start, . - _start 74 .size _start, . - _start
75 75
76 .align
77
76 .type data,#object 78 .type data,#object
77data: .word initrd_start @ source initrd address 79data: .word initrd_start @ source initrd address
78 .word initrd_phys @ destination initrd address 80 .word initrd_phys @ destination initrd address
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 9be21ba648cd..7193884ed8b0 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -125,9 +125,13 @@ wait: mrc p14, 0, pc, c0, c1, 0
125 * sort out different calling conventions 125 * sort out different calling conventions
126 */ 126 */
127 .align 127 .align
128 .arm @ Always enter in ARM state
128start: 129start:
129 .type start,#function 130 .type start,#function
130 .rept 8 131 THUMB( adr r12, BSYM(1f) )
132 THUMB( bx r12 )
133 THUMB( .rept 6 )
134 ARM( .rept 8 )
131 mov r0, r0 135 mov r0, r0
132 .endr 136 .endr
133 137
@@ -135,6 +139,7 @@ start:
135 .word 0x016f2818 @ Magic numbers to help the loader 139 .word 0x016f2818 @ Magic numbers to help the loader
136 .word start @ absolute load/run zImage address 140 .word start @ absolute load/run zImage address
137 .word _edata @ zImage end address 141 .word _edata @ zImage end address
142 THUMB( .thumb )
1381: mov r7, r1 @ save architecture ID 1431: mov r7, r1 @ save architecture ID
139 mov r8, r2 @ save atags pointer 144 mov r8, r2 @ save atags pointer
140 145
@@ -174,7 +179,8 @@ not_angel:
174 ldr sp, [r0, #28] 179 ldr sp, [r0, #28]
175#ifdef CONFIG_AUTO_ZRELADDR 180#ifdef CONFIG_AUTO_ZRELADDR
176 @ determine final kernel image address 181 @ determine final kernel image address
177 and r4, pc, #0xf8000000 182 mov r4, pc
183 and r4, r4, #0xf8000000
178 add r4, r4, #TEXT_OFFSET 184 add r4, r4, #TEXT_OFFSET
179#else 185#else
180 ldr r4, =zreladdr 186 ldr r4, =zreladdr
@@ -445,7 +451,8 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
445 */ 451 */
446 mov r1, #0x1e 452 mov r1, #0x1e
447 orr r1, r1, #3 << 10 453 orr r1, r1, #3 << 10
448 mov r2, pc, lsr #20 454 mov r2, pc
455 mov r2, r2, lsr #20
449 orr r1, r1, r2, lsl #20 456 orr r1, r1, r2, lsl #20
450 add r0, r3, r2, lsl #2 457 add r0, r3, r2, lsl #2
451 str r1, [r0], #4 458 str r1, [r0], #4
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 772f95f1aecd..e6388dcd8cfa 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -146,9 +146,15 @@ static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
146 unsigned int shift = (irq % 4) * 8; 146 unsigned int shift = (irq % 4) * 8;
147 unsigned int cpu = cpumask_first(mask_val); 147 unsigned int cpu = cpumask_first(mask_val);
148 u32 val; 148 u32 val;
149 struct irq_desc *desc;
149 150
150 spin_lock(&irq_controller_lock); 151 spin_lock(&irq_controller_lock);
151 irq_desc[irq].node = cpu; 152 desc = irq_to_desc(irq);
153 if (desc == NULL) {
154 spin_unlock(&irq_controller_lock);
155 return -EINVAL;
156 }
157 desc->node = cpu;
152 val = readl(reg) & ~(0xff << shift); 158 val = readl(reg) & ~(0xff << shift);
153 val |= 1 << (cpu + shift); 159 val |= 1 << (cpu + shift);
154 writel(val, reg); 160 writel(val, reg);
@@ -210,7 +216,7 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
210void __init gic_dist_init(unsigned int gic_nr, void __iomem *base, 216void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
211 unsigned int irq_start) 217 unsigned int irq_start)
212{ 218{
213 unsigned int max_irq, i; 219 unsigned int gic_irqs, irq_limit, i;
214 u32 cpumask = 1 << smp_processor_id(); 220 u32 cpumask = 1 << smp_processor_id();
215 221
216 if (gic_nr >= MAX_GIC_NR) 222 if (gic_nr >= MAX_GIC_NR)
@@ -226,47 +232,49 @@ void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
226 232
227 /* 233 /*
228 * Find out how many interrupts are supported. 234 * Find out how many interrupts are supported.
229 */
230 max_irq = readl(base + GIC_DIST_CTR) & 0x1f;
231 max_irq = (max_irq + 1) * 32;
232
233 /*
234 * The GIC only supports up to 1020 interrupt sources. 235 * The GIC only supports up to 1020 interrupt sources.
235 * Limit this to either the architected maximum, or the
236 * platform maximum.
237 */ 236 */
238 if (max_irq > max(1020, NR_IRQS)) 237 gic_irqs = readl(base + GIC_DIST_CTR) & 0x1f;
239 max_irq = max(1020, NR_IRQS); 238 gic_irqs = (gic_irqs + 1) * 32;
239 if (gic_irqs > 1020)
240 gic_irqs = 1020;
240 241
241 /* 242 /*
242 * Set all global interrupts to be level triggered, active low. 243 * Set all global interrupts to be level triggered, active low.
243 */ 244 */
244 for (i = 32; i < max_irq; i += 16) 245 for (i = 32; i < gic_irqs; i += 16)
245 writel(0, base + GIC_DIST_CONFIG + i * 4 / 16); 246 writel(0, base + GIC_DIST_CONFIG + i * 4 / 16);
246 247
247 /* 248 /*
248 * Set all global interrupts to this CPU only. 249 * Set all global interrupts to this CPU only.
249 */ 250 */
250 for (i = 32; i < max_irq; i += 4) 251 for (i = 32; i < gic_irqs; i += 4)
251 writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 252 writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
252 253
253 /* 254 /*
254 * Set priority on all global interrupts. 255 * Set priority on all global interrupts.
255 */ 256 */
256 for (i = 32; i < max_irq; i += 4) 257 for (i = 32; i < gic_irqs; i += 4)
257 writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4); 258 writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4);
258 259
259 /* 260 /*
260 * Disable all interrupts. Leave the PPI and SGIs alone 261 * Disable all interrupts. Leave the PPI and SGIs alone
261 * as these enables are banked registers. 262 * as these enables are banked registers.
262 */ 263 */
263 for (i = 32; i < max_irq; i += 32) 264 for (i = 32; i < gic_irqs; i += 32)
264 writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); 265 writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32);
265 266
266 /* 267 /*
268 * Limit number of interrupts registered to the platform maximum
269 */
270 irq_limit = gic_data[gic_nr].irq_offset + gic_irqs;
271 if (WARN_ON(irq_limit > NR_IRQS))
272 irq_limit = NR_IRQS;
273
274 /*
267 * Setup the Linux IRQ subsystem. 275 * Setup the Linux IRQ subsystem.
268 */ 276 */
269 for (i = irq_start; i < gic_data[gic_nr].irq_offset + max_irq; i++) { 277 for (i = irq_start; i < irq_limit; i++) {
270 set_irq_chip(i, &gic_chip); 278 set_irq_chip(i, &gic_chip);
271 set_irq_chip_data(i, &gic_data[gic_nr]); 279 set_irq_chip_data(i, &gic_data[gic_nr]);
272 set_irq_handler(i, handle_level_irq); 280 set_irq_handler(i, handle_level_irq);
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index c09e3573c5de..bb96a7d4bbf5 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -911,7 +911,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
911 * A special ghost syscall is used for that (see traps.c). 911 * A special ghost syscall is used for that (see traps.c).
912 */ 912 */
913 stmfd sp!, {r7, lr} 913 stmfd sp!, {r7, lr}
914 ldr r7, =1f @ it's 20 bits 914 ldr r7, 1f @ it's 20 bits
915 swi __ARM_NR_cmpxchg 915 swi __ARM_NR_cmpxchg
916 ldmfd sp!, {r7, pc} 916 ldmfd sp!, {r7, pc}
9171: .word __ARM_NR_cmpxchg 9171: .word __ARM_NR_cmpxchg
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index dd6b369ac69c..6bd82d25683c 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -85,9 +85,11 @@ ENTRY(stext)
85 mrc p15, 0, r9, c0, c0 @ get processor id 85 mrc p15, 0, r9, c0, c0 @ get processor id
86 bl __lookup_processor_type @ r5=procinfo r9=cpuid 86 bl __lookup_processor_type @ r5=procinfo r9=cpuid
87 movs r10, r5 @ invalid processor (r5=0)? 87 movs r10, r5 @ invalid processor (r5=0)?
88 THUMB( it eq ) @ force fixup-able long branch encoding
88 beq __error_p @ yes, error 'p' 89 beq __error_p @ yes, error 'p'
89 bl __lookup_machine_type @ r5=machinfo 90 bl __lookup_machine_type @ r5=machinfo
90 movs r8, r5 @ invalid machine (r5=0)? 91 movs r8, r5 @ invalid machine (r5=0)?
92 THUMB( it eq ) @ force fixup-able long branch encoding
91 beq __error_a @ yes, error 'a' 93 beq __error_a @ yes, error 'a'
92 bl __vet_atags 94 bl __vet_atags
93#ifdef CONFIG_SMP_ON_UP 95#ifdef CONFIG_SMP_ON_UP
@@ -262,6 +264,7 @@ __create_page_tables:
262 mov pc, lr 264 mov pc, lr
263ENDPROC(__create_page_tables) 265ENDPROC(__create_page_tables)
264 .ltorg 266 .ltorg
267 .align
265__enable_mmu_loc: 268__enable_mmu_loc:
266 .long . 269 .long .
267 .long __enable_mmu 270 .long __enable_mmu
@@ -282,6 +285,7 @@ ENTRY(secondary_startup)
282 bl __lookup_processor_type 285 bl __lookup_processor_type
283 movs r10, r5 @ invalid processor? 286 movs r10, r5 @ invalid processor?
284 moveq r0, #'p' @ yes, error 'p' 287 moveq r0, #'p' @ yes, error 'p'
288 THUMB( it eq ) @ force fixup-able long branch encoding
285 beq __error_p 289 beq __error_p
286 290
287 /* 291 /*
@@ -308,6 +312,8 @@ ENTRY(__secondary_switched)
308 b secondary_start_kernel 312 b secondary_start_kernel
309ENDPROC(__secondary_switched) 313ENDPROC(__secondary_switched)
310 314
315 .align
316
311 .type __secondary_data, %object 317 .type __secondary_data, %object
312__secondary_data: 318__secondary_data:
313 .long . 319 .long .
@@ -413,6 +419,7 @@ __fixup_smp_on_up:
413 mov pc, lr 419 mov pc, lr
414ENDPROC(__fixup_smp) 420ENDPROC(__fixup_smp)
415 421
422 .align
4161: .word . 4231: .word .
417 .word __smpalt_begin 424 .word __smpalt_begin
418 .word __smpalt_end 425 .word __smpalt_end
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index fd26f8d65151..9cf4cbf8f95b 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -59,6 +59,8 @@ relocate_new_kernel:
59 ldr r2,kexec_boot_atags 59 ldr r2,kexec_boot_atags
60 mov pc,lr 60 mov pc,lr
61 61
62 .align
63
62 .globl kexec_start_address 64 .globl kexec_start_address
63kexec_start_address: 65kexec_start_address:
64 .long 0x0 66 .long 0x0
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index 38088c36936c..78defd71a829 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -369,7 +369,7 @@ static int __init cns3xxx_pcie_init(void)
369{ 369{
370 int i; 370 int i;
371 371
372 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 372 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0,
373 "imprecise external abort"); 373 "imprecise external abort");
374 374
375 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) { 375 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
diff --git a/arch/arm/mach-realview/headsmp.S b/arch/arm/mach-realview/headsmp.S
index 4075473cf68a..b34be4554d40 100644
--- a/arch/arm/mach-realview/headsmp.S
+++ b/arch/arm/mach-realview/headsmp.S
@@ -35,5 +35,6 @@ pen: ldr r7, [r6]
35 */ 35 */
36 b secondary_startup 36 b secondary_startup
37 37
38 .align
381: .long . 391: .long .
39 .long pen_release 40 .long pen_release
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index cef6a65637bd..fa2e5bffbb8e 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -16,7 +16,7 @@ config CPU_S3C2412
16config CPU_S3C2412_ONLY 16config CPU_S3C2412_ONLY
17 bool 17 bool
18 depends on ARCH_S3C2410 && !CPU_S3C2400 && !CPU_S3C2410 && \ 18 depends on ARCH_S3C2410 && !CPU_S3C2400 && !CPU_S3C2410 && \
19 !CPU_2416 && !CPU_S3C2440 && !CPU_S3C2442 && \ 19 !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \
20 !CPU_S3C2443 && CPU_S3C2412 20 !CPU_S3C2443 && CPU_S3C2412
21 default y if CPU_S3C2412 21 default y if CPU_S3C2412
22 22
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig
index 87b9c9f003bd..27b3e7c9d613 100644
--- a/arch/arm/mach-s3c2416/Kconfig
+++ b/arch/arm/mach-s3c2416/Kconfig
@@ -35,9 +35,12 @@ menu "S3C2416 Machines"
35config MACH_SMDK2416 35config MACH_SMDK2416
36 bool "SMDK2416" 36 bool "SMDK2416"
37 select CPU_S3C2416 37 select CPU_S3C2416
38 select MACH_SMDK
38 select S3C_DEV_FB 39 select S3C_DEV_FB
39 select S3C_DEV_HSMMC 40 select S3C_DEV_HSMMC
40 select S3C_DEV_HSMMC1 41 select S3C_DEV_HSMMC1
42 select S3C_DEV_NAND
43 select S3C_DEV_USB_HOST
41 select S3C2416_PM if PM 44 select S3C2416_PM if PM
42 help 45 help
43 Say Y here if you are using an SMDK2416 46 Say Y here if you are using an SMDK2416
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index ff024a6c0f85..a0cb2581894f 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -18,6 +18,7 @@ config CPU_S3C2440
18config CPU_S3C2442 18config CPU_S3C2442
19 bool 19 bool
20 select CPU_ARM920T 20 select CPU_ARM920T
21 select S3C_GPIO_PULL_DOWN
21 select S3C2410_CLOCK 22 select S3C2410_CLOCK
22 select S3C2410_GPIO 23 select S3C2410_GPIO
23 select S3C2410_PM if PM 24 select S3C2410_PM if PM
@@ -178,6 +179,9 @@ config MACH_MINI2440
178 bool "MINI2440 development board" 179 bool "MINI2440 development board"
179 select CPU_S3C2440 180 select CPU_S3C2440
180 select EEPROM_AT24 181 select EEPROM_AT24
182 select NEW_LEDS
183 select LEDS_CLASS
184 select LEDS_TRIGGER
181 select LEDS_TRIGGER_BACKLIGHT 185 select LEDS_TRIGGER_BACKLIGHT
182 select S3C_DEV_NAND 186 select S3C_DEV_NAND
183 select S3C_DEV_USB_HOST 187 select S3C_DEV_USB_HOST
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index d50f3ae6173d..f7663f731ea0 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -46,9 +46,6 @@ int __init s3c2440_init(void)
46{ 46{
47 printk("S3C2440: Initialising architecture\n"); 47 printk("S3C2440: Initialising architecture\n");
48 48
49 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
50 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;
51
52 /* change irq for watchdog */ 49 /* change irq for watchdog */
53 50
54 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; 51 s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
@@ -58,3 +55,11 @@ int __init s3c2440_init(void)
58 55
59 return sysdev_register(&s3c2440_sysdev); 56 return sysdev_register(&s3c2440_sysdev);
60} 57}
58
59void __init s3c2440_map_io(void)
60{
61 s3c244x_map_io();
62
63 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
64 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;
65}
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 188ad1e57dc0..ecf813546554 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -32,6 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/gpio.h>
35#include <linux/clk.h> 36#include <linux/clk.h>
36#include <linux/io.h> 37#include <linux/io.h>
37 38
@@ -43,6 +44,11 @@
43 44
44#include <plat/clock.h> 45#include <plat/clock.h>
45#include <plat/cpu.h> 46#include <plat/cpu.h>
47#include <plat/s3c244x.h>
48
49#include <plat/gpio-core.h>
50#include <plat/gpio-cfg.h>
51#include <plat/gpio-cfg-helpers.h>
46 52
47/* S3C2442 extended clock support */ 53/* S3C2442 extended clock support */
48 54
@@ -163,3 +169,11 @@ int __init s3c2442_init(void)
163 169
164 return sysdev_register(&s3c2442_sysdev); 170 return sysdev_register(&s3c2442_sysdev);
165} 171}
172
173void __init s3c2442_map_io(void)
174{
175 s3c244x_map_io();
176
177 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1down;
178 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1down;
179}
diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig
index 4fef723126fa..31babec90cec 100644
--- a/arch/arm/mach-s3c2443/Kconfig
+++ b/arch/arm/mach-s3c2443/Kconfig
@@ -5,6 +5,7 @@
5config CPU_S3C2443 5config CPU_S3C2443
6 bool 6 bool
7 depends on ARCH_S3C2410 7 depends on ARCH_S3C2410
8 select CPU_ARM920T
8 select S3C2443_DMA if S3C2410_DMA 9 select S3C2443_DMA if S3C2410_DMA
9 select CPU_LLSERIAL_S3C2440 10 select CPU_LLSERIAL_S3C2440
10 select SAMSUNG_CLKSRC 11 select SAMSUNG_CLKSRC
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index 8ea3bffb4e00..a0e7c12868bd 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -21,8 +21,8 @@
21#include <mach/io.h> 21#include <mach/io.h>
22 22
23 .macro addruart, rp, rv 23 .macro addruart, rp, rv
24 ldreq \rp, =IO_APB_PHYS @ physical 24 ldr \rp, =IO_APB_PHYS @ physical
25 ldrne \rv, =IO_APB_VIRT @ virtual 25 ldr \rv, =IO_APB_VIRT @ virtual
26#if defined(CONFIG_TEGRA_DEBUG_UART_NONE) 26#if defined(CONFIG_TEGRA_DEBUG_UART_NONE)
27#error "A debug UART must be selected in the kernel config to use DEBUG_LL" 27#error "A debug UART must be selected in the kernel config to use DEBUG_LL"
28#elif defined(CONFIG_TEGRA_DEBUG_UARTA) 28#elif defined(CONFIG_TEGRA_DEBUG_UARTA)
diff --git a/arch/arm/mach-vexpress/headsmp.S b/arch/arm/mach-vexpress/headsmp.S
index 8a78ff68e1ee..7a3f0632947c 100644
--- a/arch/arm/mach-vexpress/headsmp.S
+++ b/arch/arm/mach-vexpress/headsmp.S
@@ -35,5 +35,6 @@ pen: ldr r7, [r6]
35 */ 35 */
36 b secondary_startup 36 b secondary_startup
37 37
38 .align
381: .long . 391: .long .
39 .long pen_release 40 .long pen_release
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 53cbe2225153..9b9ff5d949fd 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -381,7 +381,7 @@ __v7_ca9mp_proc_info:
381 PMD_SECT_XN | \ 381 PMD_SECT_XN | \
382 PMD_SECT_AP_WRITE | \ 382 PMD_SECT_AP_WRITE | \
383 PMD_SECT_AP_READ 383 PMD_SECT_AP_READ
384 b __v7_ca9mp_setup 384 W(b) __v7_ca9mp_setup
385 .long cpu_arch_name 385 .long cpu_arch_name
386 .long cpu_elf_name 386 .long cpu_elf_name
387 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS 387 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
@@ -413,7 +413,7 @@ __v7_proc_info:
413 PMD_SECT_XN | \ 413 PMD_SECT_XN | \
414 PMD_SECT_AP_WRITE | \ 414 PMD_SECT_AP_WRITE | \
415 PMD_SECT_AP_READ 415 PMD_SECT_AP_READ
416 b __v7_setup 416 W(b) __v7_setup
417 .long cpu_arch_name 417 .long cpu_arch_name
418 .long cpu_elf_name 418 .long cpu_elf_name
419 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS 419 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 85d3e55ca4a9..558cdfaf76b6 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -18,6 +18,7 @@
18#include <linux/time.h> 18#include <linux/time.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <linux/sched.h>
21#include <linux/io.h> 22#include <linux/io.h>
22#include <linux/clocksource.h> 23#include <linux/clocksource.h>
23#include <linux/clockchips.h> 24#include <linux/clockchips.h>
@@ -36,7 +37,7 @@
36/* 37/*
37 * IOP clocksource (free-running timer 1). 38 * IOP clocksource (free-running timer 1).
38 */ 39 */
39static cycle_t iop_clocksource_read(struct clocksource *unused) 40static cycle_t notrace iop_clocksource_read(struct clocksource *unused)
40{ 41{
41 return 0xffffffffu - read_tcr1(); 42 return 0xffffffffu - read_tcr1();
42} 43}
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 76d0858c3cbb..4a10c0f684b2 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -88,7 +88,7 @@ static struct cpu_table cpu_ids[] __initdata = {
88 { 88 {
89 .idcode = 0x32440000, 89 .idcode = 0x32440000,
90 .idmask = 0xffffffff, 90 .idmask = 0xffffffff,
91 .map_io = s3c244x_map_io, 91 .map_io = s3c2440_map_io,
92 .init_clocks = s3c244x_init_clocks, 92 .init_clocks = s3c244x_init_clocks,
93 .init_uarts = s3c244x_init_uarts, 93 .init_uarts = s3c244x_init_uarts,
94 .init = s3c2440_init, 94 .init = s3c2440_init,
@@ -97,7 +97,7 @@ static struct cpu_table cpu_ids[] __initdata = {
97 { 97 {
98 .idcode = 0x32440001, 98 .idcode = 0x32440001,
99 .idmask = 0xffffffff, 99 .idmask = 0xffffffff,
100 .map_io = s3c244x_map_io, 100 .map_io = s3c2440_map_io,
101 .init_clocks = s3c244x_init_clocks, 101 .init_clocks = s3c244x_init_clocks,
102 .init_uarts = s3c244x_init_uarts, 102 .init_uarts = s3c244x_init_uarts,
103 .init = s3c2440_init, 103 .init = s3c2440_init,
@@ -106,7 +106,7 @@ static struct cpu_table cpu_ids[] __initdata = {
106 { 106 {
107 .idcode = 0x32440aaa, 107 .idcode = 0x32440aaa,
108 .idmask = 0xffffffff, 108 .idmask = 0xffffffff,
109 .map_io = s3c244x_map_io, 109 .map_io = s3c2442_map_io,
110 .init_clocks = s3c244x_init_clocks, 110 .init_clocks = s3c244x_init_clocks,
111 .init_uarts = s3c244x_init_uarts, 111 .init_uarts = s3c244x_init_uarts,
112 .init = s3c2442_init, 112 .init = s3c2442_init,
@@ -115,7 +115,7 @@ static struct cpu_table cpu_ids[] __initdata = {
115 { 115 {
116 .idcode = 0x32440aab, 116 .idcode = 0x32440aab,
117 .idmask = 0xffffffff, 117 .idmask = 0xffffffff,
118 .map_io = s3c244x_map_io, 118 .map_io = s3c2442_map_io,
119 .init_clocks = s3c244x_init_clocks, 119 .init_clocks = s3c244x_init_clocks,
120 .init_uarts = s3c244x_init_uarts, 120 .init_uarts = s3c244x_init_uarts,
121 .init = s3c2442_init, 121 .init = s3c2442_init,
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 24c6f5a30596..243b6411050d 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -82,8 +82,6 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
82struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { 82struct s3c_gpio_cfg s3c24xx_gpiocfg_default = {
83 .set_config = s3c_gpio_setcfg_s3c24xx, 83 .set_config = s3c_gpio_setcfg_s3c24xx,
84 .get_config = s3c_gpio_getcfg_s3c24xx, 84 .get_config = s3c_gpio_getcfg_s3c24xx,
85 .set_pull = s3c_gpio_setpull_1up,
86 .get_pull = s3c_gpio_getpull_1up,
87}; 85};
88 86
89struct s3c_gpio_chip s3c24xx_gpios[] = { 87struct s3c_gpio_chip s3c24xx_gpios[] = {
diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c244x.h b/arch/arm/plat-s3c24xx/include/plat/s3c244x.h
index 307248d1ccbb..89e8d0a25f87 100644
--- a/arch/arm/plat-s3c24xx/include/plat/s3c244x.h
+++ b/arch/arm/plat-s3c24xx/include/plat/s3c244x.h
@@ -21,17 +21,22 @@ extern void s3c244x_init_clocks(int xtal);
21#else 21#else
22#define s3c244x_init_clocks NULL 22#define s3c244x_init_clocks NULL
23#define s3c244x_init_uarts NULL 23#define s3c244x_init_uarts NULL
24#define s3c244x_map_io NULL
25#endif 24#endif
26 25
27#ifdef CONFIG_CPU_S3C2440 26#ifdef CONFIG_CPU_S3C2440
28extern int s3c2440_init(void); 27extern int s3c2440_init(void);
28
29extern void s3c2440_map_io(void);
29#else 30#else
30#define s3c2440_init NULL 31#define s3c2440_init NULL
32#define s3c2440_map_io NULL
31#endif 33#endif
32 34
33#ifdef CONFIG_CPU_S3C2442 35#ifdef CONFIG_CPU_S3C2442
34extern int s3c2442_init(void); 36extern int s3c2442_init(void);
37
38extern void s3c2442_map_io(void);
35#else 39#else
36#define s3c2442_init NULL 40#define s3c2442_init NULL
41#define s3c2442_map_io NULL
37#endif 42#endif
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index b732b773b9af..0aa32f242ee4 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -280,18 +280,17 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
280} 280}
281#endif 281#endif
282 282
283#ifdef CONFIG_S3C_GPIO_PULL_UP 283#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
284int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, 284static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip,
285 unsigned int off, s3c_gpio_pull_t pull) 285 unsigned int off, s3c_gpio_pull_t pull,
286 s3c_gpio_pull_t updown)
286{ 287{
287 void __iomem *reg = chip->base + 0x08; 288 void __iomem *reg = chip->base + 0x08;
288 u32 pup = __raw_readl(reg); 289 u32 pup = __raw_readl(reg);
289 290
290 pup = __raw_readl(reg); 291 if (pull == updown)
291
292 if (pup == S3C_GPIO_PULL_UP)
293 pup &= ~(1 << off); 292 pup &= ~(1 << off);
294 else if (pup == S3C_GPIO_PULL_NONE) 293 else if (pull == S3C_GPIO_PULL_NONE)
295 pup |= (1 << off); 294 pup |= (1 << off);
296 else 295 else
297 return -EINVAL; 296 return -EINVAL;
@@ -300,17 +299,45 @@ int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
300 return 0; 299 return 0;
301} 300}
302 301
303s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, 302static s3c_gpio_pull_t s3c_gpio_getpull_1(struct s3c_gpio_chip *chip,
304 unsigned int off) 303 unsigned int off, s3c_gpio_pull_t updown)
305{ 304{
306 void __iomem *reg = chip->base + 0x08; 305 void __iomem *reg = chip->base + 0x08;
307 u32 pup = __raw_readl(reg); 306 u32 pup = __raw_readl(reg);
308 307
309 pup &= (1 << off); 308 pup &= (1 << off);
310 return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP; 309 return pup ? S3C_GPIO_PULL_NONE : updown;
310}
311#endif /* CONFIG_S3C_GPIO_PULL_UP || CONFIG_S3C_GPIO_PULL_DOWN */
312
313#ifdef CONFIG_S3C_GPIO_PULL_UP
314s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
315 unsigned int off)
316{
317 return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_UP);
318}
319
320int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip,
321 unsigned int off, s3c_gpio_pull_t pull)
322{
323 return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_UP);
311} 324}
312#endif /* CONFIG_S3C_GPIO_PULL_UP */ 325#endif /* CONFIG_S3C_GPIO_PULL_UP */
313 326
327#ifdef CONFIG_S3C_GPIO_PULL_DOWN
328s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip,
329 unsigned int off)
330{
331 return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_DOWN);
332}
333
334int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip,
335 unsigned int off, s3c_gpio_pull_t pull)
336{
337 return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN);
338}
339#endif /* CONFIG_S3C_GPIO_PULL_DOWN */
340
314#ifdef CONFIG_S5P_GPIO_DRVSTR 341#ifdef CONFIG_S5P_GPIO_DRVSTR
315s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) 342s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin)
316{ 343{
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
index 8fd65d8b5863..0d2c5703f1ee 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -210,6 +210,17 @@ extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip,
210 unsigned int off); 210 unsigned int off);
211 211
212/** 212/**
213 * s3c_gpio_getpull_1down() - Get configuration for choice of down or none
214 * @chip: The gpio chip that the GPIO pin belongs to
215 * @off: The offset to the pin to get the configuration of.
216 *
217 * This helper function reads the state of the pull-down resistor for the
218 * given GPIO in the same case as s3c_gpio_setpull_1down.
219*/
220extern s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip,
221 unsigned int off);
222
223/**
213 * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. 224 * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443.
214 * @chip: The gpio chip that is being configured. 225 * @chip: The gpio chip that is being configured.
215 * @off: The offset for the GPIO being configured. 226 * @off: The offset for the GPIO being configured.
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index d66cead97d28..9897dcfc16d6 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -206,6 +206,7 @@ ENTRY(vfp_save_state)
206 mov pc, lr 206 mov pc, lr
207ENDPROC(vfp_save_state) 207ENDPROC(vfp_save_state)
208 208
209 .align
209last_VFP_context_address: 210last_VFP_context_address:
210 .word last_VFP_context 211 .word last_VFP_context
211 212
diff --git a/arch/mn10300/include/asm/syscall.h b/arch/mn10300/include/asm/syscall.h
new file mode 100644
index 000000000000..b44b0bb75a01
--- /dev/null
+++ b/arch/mn10300/include/asm/syscall.h
@@ -0,0 +1,117 @@
1/* Access to user system call parameters and results
2 *
3 * See asm-generic/syscall.h for function descriptions.
4 *
5 * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _ASM_SYSCALL_H
15#define _ASM_SYSCALL_H
16
17#include <linux/sched.h>
18#include <linux/err.h>
19
20extern const unsigned long sys_call_table[];
21
22static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
23{
24 return regs->orig_d0;
25}
26
27static inline void syscall_rollback(struct task_struct *task,
28 struct pt_regs *regs)
29{
30 regs->d0 = regs->orig_d0;
31}
32
33static inline long syscall_get_error(struct task_struct *task,
34 struct pt_regs *regs)
35{
36 unsigned long error = regs->d0;
37 return IS_ERR_VALUE(error) ? error : 0;
38}
39
40static inline long syscall_get_return_value(struct task_struct *task,
41 struct pt_regs *regs)
42{
43 return regs->d0;
44}
45
46static inline void syscall_set_return_value(struct task_struct *task,
47 struct pt_regs *regs,
48 int error, long val)
49{
50 regs->d0 = (long) error ?: val;
51}
52
53static inline void syscall_get_arguments(struct task_struct *task,
54 struct pt_regs *regs,
55 unsigned int i, unsigned int n,
56 unsigned long *args)
57{
58 switch (i) {
59 case 0:
60 if (!n--) break;
61 *args++ = regs->a0;
62 case 1:
63 if (!n--) break;
64 *args++ = regs->d1;
65 case 2:
66 if (!n--) break;
67 *args++ = regs->a3;
68 case 3:
69 if (!n--) break;
70 *args++ = regs->a2;
71 case 4:
72 if (!n--) break;
73 *args++ = regs->d3;
74 case 5:
75 if (!n--) break;
76 *args++ = regs->d2;
77 case 6:
78 if (!n--) break;
79 default:
80 BUG();
81 break;
82 }
83}
84
85static inline void syscall_set_arguments(struct task_struct *task,
86 struct pt_regs *regs,
87 unsigned int i, unsigned int n,
88 const unsigned long *args)
89{
90 switch (i) {
91 case 0:
92 if (!n--) break;
93 regs->a0 = *args++;
94 case 1:
95 if (!n--) break;
96 regs->d1 = *args++;
97 case 2:
98 if (!n--) break;
99 regs->a3 = *args++;
100 case 3:
101 if (!n--) break;
102 regs->a2 = *args++;
103 case 4:
104 if (!n--) break;
105 regs->d3 = *args++;
106 case 5:
107 if (!n--) break;
108 regs->d2 = *args++;
109 case 6:
110 if (!n--) break;
111 default:
112 BUG();
113 break;
114 }
115}
116
117#endif /* _ASM_SYSCALL_H */
diff --git a/arch/mn10300/kernel/gdb-io-serial.c b/arch/mn10300/kernel/gdb-io-serial.c
index 0d5d63c91dc3..f28dc99c6f72 100644
--- a/arch/mn10300/kernel/gdb-io-serial.c
+++ b/arch/mn10300/kernel/gdb-io-serial.c
@@ -73,7 +73,8 @@ void gdbstub_io_init(void)
73 GDBPORT_SERIAL_IER = UART_IER_RDI | UART_IER_RLSI; 73 GDBPORT_SERIAL_IER = UART_IER_RDI | UART_IER_RLSI;
74 74
75 /* permit level 0 IRQs to take place */ 75 /* permit level 0 IRQs to take place */
76 local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); 76 arch_local_change_intr_mask_level(
77 NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1));
77} 78}
78 79
79/* 80/*
diff --git a/arch/mn10300/kernel/gdb-io-ttysm.c b/arch/mn10300/kernel/gdb-io-ttysm.c
index 97dfda23342c..abdeea153c89 100644
--- a/arch/mn10300/kernel/gdb-io-ttysm.c
+++ b/arch/mn10300/kernel/gdb-io-ttysm.c
@@ -87,7 +87,8 @@ void __init gdbstub_io_init(void)
87 tmp = *gdbstub_port->_control; 87 tmp = *gdbstub_port->_control;
88 88
89 /* permit level 0 IRQs only */ 89 /* permit level 0 IRQs only */
90 local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); 90 arch_local_change_intr_mask_level(
91 NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1));
91} 92}
92 93
93/* 94/*
diff --git a/arch/mn10300/kernel/gdb-stub.c b/arch/mn10300/kernel/gdb-stub.c
index a5fc3f05309b..b169d99d9f20 100644
--- a/arch/mn10300/kernel/gdb-stub.c
+++ b/arch/mn10300/kernel/gdb-stub.c
@@ -1194,7 +1194,8 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1194 1194
1195 asm volatile("mov mdr,%0" : "=d"(mdr)); 1195 asm volatile("mov mdr,%0" : "=d"(mdr));
1196 local_save_flags(epsw); 1196 local_save_flags(epsw);
1197 local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); 1197 arch_local_change_intr_mask_level(
1198 NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1));
1198 1199
1199 gdbstub_store_fpu(); 1200 gdbstub_store_fpu();
1200 1201
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 5024f643b3b1..d7d94b845dc2 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -75,9 +75,6 @@ static void cpu_unmask_irq(unsigned int irq)
75 smp_send_all_nop(); 75 smp_send_all_nop();
76} 76}
77 77
78void no_ack_irq(unsigned int irq) { }
79void no_end_irq(unsigned int irq) { }
80
81void cpu_ack_irq(unsigned int irq) 78void cpu_ack_irq(unsigned int irq)
82{ 79{
83 unsigned long mask = EIEM_MASK(irq); 80 unsigned long mask = EIEM_MASK(irq);
@@ -241,7 +238,7 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
241 238
242 /* for iosapic interrupts */ 239 /* for iosapic interrupts */
243 if (type) { 240 if (type) {
244 set_irq_chip_and_handler(irq, type, handle_level_irq); 241 set_irq_chip_and_handler(irq, type, handle_percpu_irq);
245 set_irq_chip_data(irq, data); 242 set_irq_chip_data(irq, data);
246 cpu_unmask_irq(irq); 243 cpu_unmask_irq(irq);
247 } 244 }
@@ -392,7 +389,7 @@ static void claim_cpu_irqs(void)
392 int i; 389 int i;
393 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { 390 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) {
394 set_irq_chip_and_handler(i, &cpu_interrupt_type, 391 set_irq_chip_and_handler(i, &cpu_interrupt_type,
395 handle_level_irq); 392 handle_percpu_irq);
396 } 393 }
397 394
398 set_irq_handler(TIMER_IRQ, handle_percpu_irq); 395 set_irq_handler(TIMER_IRQ, handle_percpu_irq);
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 35c827e94e31..609a331878e7 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -98,7 +98,6 @@ void
98sys_rt_sigreturn(struct pt_regs *regs, int in_syscall) 98sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
99{ 99{
100 struct rt_sigframe __user *frame; 100 struct rt_sigframe __user *frame;
101 struct siginfo si;
102 sigset_t set; 101 sigset_t set;
103 unsigned long usp = (regs->gr[30] & ~(0x01UL)); 102 unsigned long usp = (regs->gr[30] & ~(0x01UL));
104 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE; 103 unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
@@ -178,13 +177,7 @@ sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
178 177
179give_sigsegv: 178give_sigsegv:
180 DBG(1,"sys_rt_sigreturn: Sending SIGSEGV\n"); 179 DBG(1,"sys_rt_sigreturn: Sending SIGSEGV\n");
181 si.si_signo = SIGSEGV; 180 force_sig(SIGSEGV, current);
182 si.si_errno = 0;
183 si.si_code = SI_KERNEL;
184 si.si_pid = task_pid_vnr(current);
185 si.si_uid = current_uid();
186 si.si_addr = &frame->uc;
187 force_sig_info(SIGSEGV, &si, current);
188 return; 181 return;
189} 182}
190 183
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 56c8687b29b3..7eff9b7347c0 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -19,6 +19,7 @@
19#include <linux/kernel_stat.h> 19#include <linux/kernel_stat.h>
20#include <linux/rcupdate.h> 20#include <linux/rcupdate.h>
21#include <linux/posix-timers.h> 21#include <linux/posix-timers.h>
22#include <linux/cpu.h>
22 23
23#include <asm/s390_ext.h> 24#include <asm/s390_ext.h>
24#include <asm/timer.h> 25#include <asm/timer.h>
@@ -566,6 +567,23 @@ void init_cpu_vtimer(void)
566 __ctl_set_bit(0,10); 567 __ctl_set_bit(0,10);
567} 568}
568 569
570static int __cpuinit s390_nohz_notify(struct notifier_block *self,
571 unsigned long action, void *hcpu)
572{
573 struct s390_idle_data *idle;
574 long cpu = (long) hcpu;
575
576 idle = &per_cpu(s390_idle, cpu);
577 switch (action) {
578 case CPU_DYING:
579 case CPU_DYING_FROZEN:
580 idle->nohz_delay = 0;
581 default:
582 break;
583 }
584 return NOTIFY_OK;
585}
586
569void __init vtime_init(void) 587void __init vtime_init(void)
570{ 588{
571 /* request the cpu timer external interrupt */ 589 /* request the cpu timer external interrupt */
@@ -574,5 +592,6 @@ void __init vtime_init(void)
574 592
575 /* Enable cpu timer interrupts on the boot cpu. */ 593 /* Enable cpu timer interrupts on the boot cpu. */
576 init_cpu_vtimer(); 594 init_cpu_vtimer();
595 cpu_notifier(s390_nohz_notify, 0);
577} 596}
578 597
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 2eaeb9e59585..f48c492a68d3 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -720,32 +720,6 @@ static struct platform_device camera_devices[] = {
720}; 720};
721 721
722/* FSI */ 722/* FSI */
723/*
724 * FSI-B use external clock which came from da7210.
725 * So, we should change parent of fsi
726 */
727#define FCLKBCR 0xa415000c
728static void fsimck_init(struct clk *clk)
729{
730 u32 status = __raw_readl(clk->enable_reg);
731
732 /* use external clock */
733 status &= ~0x000000ff;
734 status |= 0x00000080;
735
736 __raw_writel(status, clk->enable_reg);
737}
738
739static struct clk_ops fsimck_clk_ops = {
740 .init = fsimck_init,
741};
742
743static struct clk fsimckb_clk = {
744 .ops = &fsimck_clk_ops,
745 .enable_reg = (void __iomem *)FCLKBCR,
746 .rate = 0, /* unknown */
747};
748
749static struct sh_fsi_platform_info fsi_info = { 723static struct sh_fsi_platform_info fsi_info = {
750 .portb_flags = SH_FSI_BRS_INV | 724 .portb_flags = SH_FSI_BRS_INV |
751 SH_FSI_OUT_SLAVE_MODE | 725 SH_FSI_OUT_SLAVE_MODE |
@@ -1264,10 +1238,10 @@ static int __init arch_setup(void)
1264 /* change parent of FSI B */ 1238 /* change parent of FSI B */
1265 clk = clk_get(NULL, "fsib_clk"); 1239 clk = clk_get(NULL, "fsib_clk");
1266 if (!IS_ERR(clk)) { 1240 if (!IS_ERR(clk)) {
1267 clk_register(&fsimckb_clk); 1241 /* 48kHz dummy clock was used to make sure 1/1 divide */
1268 clk_set_parent(clk, &fsimckb_clk); 1242 clk_set_rate(&sh7724_fsimckb_clk, 48000);
1269 clk_set_rate(clk, 11000); 1243 clk_set_parent(clk, &sh7724_fsimckb_clk);
1270 clk_set_rate(&fsimckb_clk, 11000); 1244 clk_set_rate(clk, 48000);
1271 clk_put(clk); 1245 clk_put(clk);
1272 } 1246 }
1273 1247
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index c31d228fdfc6..527a0cd956b5 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -283,31 +283,6 @@ static struct platform_device ceu1_device = {
283}; 283};
284 284
285/* FSI */ 285/* FSI */
286/*
287 * FSI-A use external clock which came from ak464x.
288 * So, we should change parent of fsi
289 */
290#define FCLKACR 0xa4150008
291static void fsimck_init(struct clk *clk)
292{
293 u32 status = __raw_readl(clk->enable_reg);
294
295 /* use external clock */
296 status &= ~0x000000ff;
297 status |= 0x00000080;
298 __raw_writel(status, clk->enable_reg);
299}
300
301static struct clk_ops fsimck_clk_ops = {
302 .init = fsimck_init,
303};
304
305static struct clk fsimcka_clk = {
306 .ops = &fsimck_clk_ops,
307 .enable_reg = (void __iomem *)FCLKACR,
308 .rate = 0, /* unknown */
309};
310
311/* change J20, J21, J22 pin to 1-2 connection to use slave mode */ 286/* change J20, J21, J22 pin to 1-2 connection to use slave mode */
312static struct sh_fsi_platform_info fsi_info = { 287static struct sh_fsi_platform_info fsi_info = {
313 .porta_flags = SH_FSI_BRS_INV | 288 .porta_flags = SH_FSI_BRS_INV |
@@ -852,37 +827,29 @@ static int __init devices_setup(void)
852 gpio_request(GPIO_FN_KEYOUT0, NULL); 827 gpio_request(GPIO_FN_KEYOUT0, NULL);
853 828
854 /* enable FSI */ 829 /* enable FSI */
855 gpio_request(GPIO_FN_FSIMCKB, NULL);
856 gpio_request(GPIO_FN_FSIMCKA, NULL); 830 gpio_request(GPIO_FN_FSIMCKA, NULL);
831 gpio_request(GPIO_FN_FSIIASD, NULL);
857 gpio_request(GPIO_FN_FSIOASD, NULL); 832 gpio_request(GPIO_FN_FSIOASD, NULL);
858 gpio_request(GPIO_FN_FSIIABCK, NULL); 833 gpio_request(GPIO_FN_FSIIABCK, NULL);
859 gpio_request(GPIO_FN_FSIIALRCK, NULL); 834 gpio_request(GPIO_FN_FSIIALRCK, NULL);
860 gpio_request(GPIO_FN_FSIOABCK, NULL); 835 gpio_request(GPIO_FN_FSIOABCK, NULL);
861 gpio_request(GPIO_FN_FSIOALRCK, NULL); 836 gpio_request(GPIO_FN_FSIOALRCK, NULL);
862 gpio_request(GPIO_FN_CLKAUDIOAO, NULL); 837 gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
863 gpio_request(GPIO_FN_FSIIBSD, NULL);
864 gpio_request(GPIO_FN_FSIOBSD, NULL);
865 gpio_request(GPIO_FN_FSIIBBCK, NULL);
866 gpio_request(GPIO_FN_FSIIBLRCK, NULL);
867 gpio_request(GPIO_FN_FSIOBBCK, NULL);
868 gpio_request(GPIO_FN_FSIOBLRCK, NULL);
869 gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
870 gpio_request(GPIO_FN_FSIIASD, NULL);
871 838
872 /* set SPU2 clock to 83.4 MHz */ 839 /* set SPU2 clock to 83.4 MHz */
873 clk = clk_get(NULL, "spu_clk"); 840 clk = clk_get(NULL, "spu_clk");
874 if (clk) { 841 if (!IS_ERR(clk)) {
875 clk_set_rate(clk, clk_round_rate(clk, 83333333)); 842 clk_set_rate(clk, clk_round_rate(clk, 83333333));
876 clk_put(clk); 843 clk_put(clk);
877 } 844 }
878 845
879 /* change parent of FSI A */ 846 /* change parent of FSI A */
880 clk = clk_get(NULL, "fsia_clk"); 847 clk = clk_get(NULL, "fsia_clk");
881 if (clk) { 848 if (!IS_ERR(clk)) {
882 clk_register(&fsimcka_clk); 849 /* 48kHz dummy clock was used to make sure 1/1 divide */
883 clk_set_parent(clk, &fsimcka_clk); 850 clk_set_rate(&sh7724_fsimcka_clk, 48000);
884 clk_set_rate(clk, 11000); 851 clk_set_parent(clk, &sh7724_fsimcka_clk);
885 clk_set_rate(&fsimcka_clk, 11000); 852 clk_set_rate(clk, 48000);
886 clk_put(clk); 853 clk_put(clk);
887 } 854 }
888 855
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index 1f4e562c5e8c..82e1eabeac98 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -96,7 +96,7 @@ void kmap_coherent_init(void);
96void *kmap_coherent(struct page *page, unsigned long addr); 96void *kmap_coherent(struct page *page, unsigned long addr);
97void kunmap_coherent(void *kvaddr); 97void kunmap_coherent(void *kvaddr);
98 98
99#define PG_dcache_dirty PG_arch_1 99#define PG_dcache_clean PG_arch_1
100 100
101void cpu_cache_init(void); 101void cpu_cache_init(void);
102 102
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index 4c27b68789b3..7eb435999426 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -303,4 +303,7 @@ enum {
303 SHDMA_SLAVE_SDHI1_RX, 303 SHDMA_SLAVE_SDHI1_RX,
304}; 304};
305 305
306extern struct clk sh7724_fsimcka_clk;
307extern struct clk sh7724_fsimckb_clk;
308
306#endif /* __ASM_SH7724_H__ */ 309#endif /* __ASM_SH7724_H__ */
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 0fe2e9329cb2..271c0b325a9a 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -111,12 +111,21 @@ static struct clk div3_clk = {
111 .parent = &pll_clk, 111 .parent = &pll_clk,
112}; 112};
113 113
114/* External input clock (pin name: FSIMCKA/FSIMCKB ) */
115struct clk sh7724_fsimcka_clk = {
116};
117
118struct clk sh7724_fsimckb_clk = {
119};
120
114static struct clk *main_clks[] = { 121static struct clk *main_clks[] = {
115 &r_clk, 122 &r_clk,
116 &extal_clk, 123 &extal_clk,
117 &fll_clk, 124 &fll_clk,
118 &pll_clk, 125 &pll_clk,
119 &div3_clk, 126 &div3_clk,
127 &sh7724_fsimcka_clk,
128 &sh7724_fsimckb_clk,
120}; 129};
121 130
122static void div4_kick(struct clk *clk) 131static void div4_kick(struct clk *clk)
@@ -154,16 +163,38 @@ struct clk div4_clks[DIV4_NR] = {
154 [DIV4_M1] = DIV4(FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT), 163 [DIV4_M1] = DIV4(FRQCRB, 4, 0x2f7c, CLK_ENABLE_ON_INIT),
155}; 164};
156 165
157enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR }; 166enum { DIV6_V, DIV6_I, DIV6_S, DIV6_NR };
158 167
159static struct clk div6_clks[DIV6_NR] = { 168static struct clk div6_clks[DIV6_NR] = {
160 [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0), 169 [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
161 [DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0),
162 [DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0),
163 [DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0), 170 [DIV6_I] = SH_CLK_DIV6(&div3_clk, IRDACLKCR, 0),
164 [DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT), 171 [DIV6_S] = SH_CLK_DIV6(&div3_clk, SPUCLKCR, CLK_ENABLE_ON_INIT),
165}; 172};
166 173
174enum { DIV6_FA, DIV6_FB, DIV6_REPARENT_NR };
175
176/* Indices are important - they are the actual src selecting values */
177static struct clk *fclkacr_parent[] = {
178 [0] = &div3_clk,
179 [1] = NULL,
180 [2] = &sh7724_fsimcka_clk,
181 [3] = NULL,
182};
183
184static struct clk *fclkbcr_parent[] = {
185 [0] = &div3_clk,
186 [1] = NULL,
187 [2] = &sh7724_fsimckb_clk,
188 [3] = NULL,
189};
190
191static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
192 [DIV6_FA] = SH_CLK_DIV6_EXT(&div3_clk, FCLKACR, 0,
193 fclkacr_parent, ARRAY_SIZE(fclkacr_parent), 6, 2),
194 [DIV6_FB] = SH_CLK_DIV6_EXT(&div3_clk, FCLKBCR, 0,
195 fclkbcr_parent, ARRAY_SIZE(fclkbcr_parent), 6, 2),
196};
197
167static struct clk mstp_clks[HWBLK_NR] = { 198static struct clk mstp_clks[HWBLK_NR] = {
168 SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT), 199 SH_HWBLK_CLK(HWBLK_TLB, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
169 SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT), 200 SH_HWBLK_CLK(HWBLK_IC, &div4_clks[DIV4_I], CLK_ENABLE_ON_INIT),
@@ -240,8 +271,8 @@ static struct clk_lookup lookups[] = {
240 271
241 /* DIV6 clocks */ 272 /* DIV6 clocks */
242 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]), 273 CLKDEV_CON_ID("video_clk", &div6_clks[DIV6_V]),
243 CLKDEV_CON_ID("fsia_clk", &div6_clks[DIV6_FA]), 274 CLKDEV_CON_ID("fsia_clk", &div6_reparent_clks[DIV6_FA]),
244 CLKDEV_CON_ID("fsib_clk", &div6_clks[DIV6_FB]), 275 CLKDEV_CON_ID("fsib_clk", &div6_reparent_clks[DIV6_FB]),
245 CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]), 276 CLKDEV_CON_ID("irda_clk", &div6_clks[DIV6_I]),
246 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]), 277 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_S]),
247 278
@@ -376,6 +407,9 @@ int __init arch_clk_init(void)
376 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 407 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
377 408
378 if (!ret) 409 if (!ret)
410 ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR);
411
412 if (!ret)
379 ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR); 413 ret = sh_hwblk_clk_register(mstp_clks, HWBLK_NR);
380 414
381 return ret; 415 return ret;
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 2cfae81914aa..92eb98633ab0 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -114,7 +114,7 @@ static void sh4_flush_dcache_page(void *arg)
114 struct address_space *mapping = page_mapping(page); 114 struct address_space *mapping = page_mapping(page);
115 115
116 if (mapping && !mapping_mapped(mapping)) 116 if (mapping && !mapping_mapped(mapping))
117 set_bit(PG_dcache_dirty, &page->flags); 117 clear_bit(PG_dcache_clean, &page->flags);
118 else 118 else
119#endif 119#endif
120 flush_cache_one(CACHE_OC_ADDRESS_ARRAY | 120 flush_cache_one(CACHE_OC_ADDRESS_ARRAY |
@@ -239,7 +239,7 @@ static void sh4_flush_cache_page(void *args)
239 * another ASID than the current one. 239 * another ASID than the current one.
240 */ 240 */
241 map_coherent = (current_cpu_data.dcache.n_aliases && 241 map_coherent = (current_cpu_data.dcache.n_aliases &&
242 !test_bit(PG_dcache_dirty, &page->flags) && 242 test_bit(PG_dcache_clean, &page->flags) &&
243 page_mapped(page)); 243 page_mapped(page));
244 if (map_coherent) 244 if (map_coherent)
245 vaddr = kmap_coherent(page, address); 245 vaddr = kmap_coherent(page, address);
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c
index f498da1cce7a..7729cca727eb 100644
--- a/arch/sh/mm/cache-sh7705.c
+++ b/arch/sh/mm/cache-sh7705.c
@@ -139,7 +139,7 @@ static void sh7705_flush_dcache_page(void *arg)
139 struct address_space *mapping = page_mapping(page); 139 struct address_space *mapping = page_mapping(page);
140 140
141 if (mapping && !mapping_mapped(mapping)) 141 if (mapping && !mapping_mapped(mapping))
142 set_bit(PG_dcache_dirty, &page->flags); 142 clear_bit(PG_dcache_clean, &page->flags);
143 else 143 else
144 __flush_dcache_page(__pa(page_address(page))); 144 __flush_dcache_page(__pa(page_address(page)));
145} 145}
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index ba401d137bb9..88d3dc3d30d5 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -60,14 +60,14 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
60 unsigned long len) 60 unsigned long len)
61{ 61{
62 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && 62 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
63 !test_bit(PG_dcache_dirty, &page->flags)) { 63 test_bit(PG_dcache_clean, &page->flags)) {
64 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 64 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
65 memcpy(vto, src, len); 65 memcpy(vto, src, len);
66 kunmap_coherent(vto); 66 kunmap_coherent(vto);
67 } else { 67 } else {
68 memcpy(dst, src, len); 68 memcpy(dst, src, len);
69 if (boot_cpu_data.dcache.n_aliases) 69 if (boot_cpu_data.dcache.n_aliases)
70 set_bit(PG_dcache_dirty, &page->flags); 70 clear_bit(PG_dcache_clean, &page->flags);
71 } 71 }
72 72
73 if (vma->vm_flags & VM_EXEC) 73 if (vma->vm_flags & VM_EXEC)
@@ -79,14 +79,14 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
79 unsigned long len) 79 unsigned long len)
80{ 80{
81 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && 81 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
82 !test_bit(PG_dcache_dirty, &page->flags)) { 82 test_bit(PG_dcache_clean, &page->flags)) {
83 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK); 83 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
84 memcpy(dst, vfrom, len); 84 memcpy(dst, vfrom, len);
85 kunmap_coherent(vfrom); 85 kunmap_coherent(vfrom);
86 } else { 86 } else {
87 memcpy(dst, src, len); 87 memcpy(dst, src, len);
88 if (boot_cpu_data.dcache.n_aliases) 88 if (boot_cpu_data.dcache.n_aliases)
89 set_bit(PG_dcache_dirty, &page->flags); 89 clear_bit(PG_dcache_clean, &page->flags);
90 } 90 }
91} 91}
92 92
@@ -98,7 +98,7 @@ void copy_user_highpage(struct page *to, struct page *from,
98 vto = kmap_atomic(to, KM_USER1); 98 vto = kmap_atomic(to, KM_USER1);
99 99
100 if (boot_cpu_data.dcache.n_aliases && page_mapped(from) && 100 if (boot_cpu_data.dcache.n_aliases && page_mapped(from) &&
101 !test_bit(PG_dcache_dirty, &from->flags)) { 101 test_bit(PG_dcache_clean, &from->flags)) {
102 vfrom = kmap_coherent(from, vaddr); 102 vfrom = kmap_coherent(from, vaddr);
103 copy_page(vto, vfrom); 103 copy_page(vto, vfrom);
104 kunmap_coherent(vfrom); 104 kunmap_coherent(vfrom);
@@ -141,7 +141,7 @@ void __update_cache(struct vm_area_struct *vma,
141 141
142 page = pfn_to_page(pfn); 142 page = pfn_to_page(pfn);
143 if (pfn_valid(pfn)) { 143 if (pfn_valid(pfn)) {
144 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags); 144 int dirty = !test_and_set_bit(PG_dcache_clean, &page->flags);
145 if (dirty) 145 if (dirty)
146 __flush_purge_region(page_address(page), PAGE_SIZE); 146 __flush_purge_region(page_address(page), PAGE_SIZE);
147 } 147 }
@@ -153,7 +153,7 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr)
153 153
154 if (pages_do_alias(addr, vmaddr)) { 154 if (pages_do_alias(addr, vmaddr)) {
155 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) && 155 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
156 !test_bit(PG_dcache_dirty, &page->flags)) { 156 test_bit(PG_dcache_clean, &page->flags)) {
157 void *kaddr; 157 void *kaddr;
158 158
159 kaddr = kmap_coherent(page, vmaddr); 159 kaddr = kmap_coherent(page, vmaddr);
diff --git a/arch/sh/mm/kmap.c b/arch/sh/mm/kmap.c
index 15d74ea42094..ec29e14ec5a8 100644
--- a/arch/sh/mm/kmap.c
+++ b/arch/sh/mm/kmap.c
@@ -34,7 +34,7 @@ void *kmap_coherent(struct page *page, unsigned long addr)
34 enum fixed_addresses idx; 34 enum fixed_addresses idx;
35 unsigned long vaddr; 35 unsigned long vaddr;
36 36
37 BUG_ON(test_bit(PG_dcache_dirty, &page->flags)); 37 BUG_ON(!test_bit(PG_dcache_clean, &page->flags));
38 38
39 pagefault_disable(); 39 pagefault_disable();
40 40
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
index 7f7e577a0e39..31d84acc1512 100644
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -11,6 +11,7 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
11void pvclock_read_wallclock(struct pvclock_wall_clock *wall, 11void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
12 struct pvclock_vcpu_time_info *vcpu, 12 struct pvclock_vcpu_time_info *vcpu,
13 struct timespec *ts); 13 struct timespec *ts);
14void pvclock_resume(void);
14 15
15/* 16/*
16 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, 17 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index 008b91eefa18..42eb3300dfc6 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -83,6 +83,11 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
83 83
84static atomic64_t last_value = ATOMIC64_INIT(0); 84static atomic64_t last_value = ATOMIC64_INIT(0);
85 85
86void pvclock_resume(void)
87{
88 atomic64_set(&last_value, 0);
89}
90
86cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) 91cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
87{ 92{
88 struct pvclock_shadow_time shadow; 93 struct pvclock_shadow_time shadow;
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index d7b5109f7a9c..25cd4a07d09f 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -70,6 +70,9 @@ static int acpi_register_gsi_xen_hvm(struct device *dev, u32 gsi,
70struct xen_pci_frontend_ops *xen_pci_frontend; 70struct xen_pci_frontend_ops *xen_pci_frontend;
71EXPORT_SYMBOL_GPL(xen_pci_frontend); 71EXPORT_SYMBOL_GPL(xen_pci_frontend);
72 72
73#define XEN_PIRQ_MSI_DATA (MSI_DATA_TRIGGER_EDGE | \
74 MSI_DATA_LEVEL_ASSERT | (3 << 8) | MSI_DATA_VECTOR(0))
75
73static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq, 76static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq,
74 struct msi_msg *msg) 77 struct msi_msg *msg)
75{ 78{
@@ -83,12 +86,7 @@ static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq,
83 MSI_ADDR_REDIRECTION_CPU | 86 MSI_ADDR_REDIRECTION_CPU |
84 MSI_ADDR_DEST_ID(pirq); 87 MSI_ADDR_DEST_ID(pirq);
85 88
86 msg->data = 89 msg->data = XEN_PIRQ_MSI_DATA;
87 MSI_DATA_TRIGGER_EDGE |
88 MSI_DATA_LEVEL_ASSERT |
89 /* delivery mode reserved */
90 (3 << 8) |
91 MSI_DATA_VECTOR(0);
92} 90}
93 91
94static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 92static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
@@ -98,8 +96,23 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
98 struct msi_msg msg; 96 struct msi_msg msg;
99 97
100 list_for_each_entry(msidesc, &dev->msi_list, list) { 98 list_for_each_entry(msidesc, &dev->msi_list, list) {
99 __read_msi_msg(msidesc, &msg);
100 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
101 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
102 if (xen_irq_from_pirq(pirq) >= 0 && msg.data == XEN_PIRQ_MSI_DATA) {
103 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
104 "msi-x" : "msi", &irq, &pirq, XEN_ALLOC_IRQ);
105 if (irq < 0)
106 goto error;
107 ret = set_irq_msi(irq, msidesc);
108 if (ret < 0)
109 goto error_while;
110 printk(KERN_DEBUG "xen: msi already setup: msi --> irq=%d"
111 " pirq=%d\n", irq, pirq);
112 return 0;
113 }
101 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? 114 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
102 "msi-x" : "msi", &irq, &pirq); 115 "msi-x" : "msi", &irq, &pirq, (XEN_ALLOC_IRQ | XEN_ALLOC_PIRQ));
103 if (irq < 0 || pirq < 0) 116 if (irq < 0 || pirq < 0)
104 goto error; 117 goto error;
105 printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq); 118 printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 02c710bebf7a..44dcad43989d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1021,10 +1021,6 @@ static void xen_reboot(int reason)
1021{ 1021{
1022 struct sched_shutdown r = { .reason = reason }; 1022 struct sched_shutdown r = { .reason = reason };
1023 1023
1024#ifdef CONFIG_SMP
1025 stop_other_cpus();
1026#endif
1027
1028 if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) 1024 if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r))
1029 BUG(); 1025 BUG();
1030} 1026}
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 0f456386cce5..25c52f94a27c 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -68,7 +68,7 @@ static int __init check_platform_magic(void)
68 return 0; 68 return 0;
69} 69}
70 70
71void __init xen_unplug_emulated_devices(void) 71void xen_unplug_emulated_devices(void)
72{ 72{
73 int r; 73 int r;
74 74
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 01afd8a94607..b5a7f928234b 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -181,24 +181,21 @@ char * __init xen_memory_setup(void)
181 for (i = 0; i < memmap.nr_entries; i++) { 181 for (i = 0; i < memmap.nr_entries; i++) {
182 unsigned long long end = map[i].addr + map[i].size; 182 unsigned long long end = map[i].addr + map[i].size;
183 183
184 if (map[i].type == E820_RAM) { 184 if (map[i].type == E820_RAM && end > mem_end) {
185 if (map[i].addr < mem_end && end > mem_end) { 185 /* RAM off the end - may be partially included */
186 /* Truncate region to max_mem. */ 186 u64 delta = min(map[i].size, end - mem_end);
187 u64 delta = end - mem_end;
188 187
189 map[i].size -= delta; 188 map[i].size -= delta;
190 extra_pages += PFN_DOWN(delta); 189 end -= delta;
191 190
192 end = mem_end; 191 extra_pages += PFN_DOWN(delta);
193 }
194 } 192 }
195 193
196 if (end > xen_extra_mem_start) 194 if (map[i].size > 0 && end > xen_extra_mem_start)
197 xen_extra_mem_start = end; 195 xen_extra_mem_start = end;
198 196
199 /* If region is non-RAM or below mem_end, add what remains */ 197 /* Add region if any remains */
200 if ((map[i].type != E820_RAM || map[i].addr < mem_end) && 198 if (map[i].size > 0)
201 map[i].size > 0)
202 e820_add_region(map[i].addr, map[i].size, map[i].type); 199 e820_add_region(map[i].addr, map[i].size, map[i].type);
203 } 200 }
204 201
@@ -252,20 +249,6 @@ char * __init xen_memory_setup(void)
252 return "Xen"; 249 return "Xen";
253} 250}
254 251
255static void xen_idle(void)
256{
257 local_irq_disable();
258
259 if (need_resched())
260 local_irq_enable();
261 else {
262 current_thread_info()->status &= ~TS_POLLING;
263 smp_mb__after_clear_bit();
264 safe_halt();
265 current_thread_info()->status |= TS_POLLING;
266 }
267}
268
269/* 252/*
270 * Set the bit indicating "nosegneg" library variants should be used. 253 * Set the bit indicating "nosegneg" library variants should be used.
271 * We only need to bother in pure 32-bit mode; compat 32-bit processes 254 * We only need to bother in pure 32-bit mode; compat 32-bit processes
@@ -362,7 +345,11 @@ void __init xen_arch_setup(void)
362 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ? 345 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
363 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE); 346 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
364 347
365 pm_idle = xen_idle; 348 /* Set up idle, making sure it calls safe_halt() pvop */
349#ifdef CONFIG_X86_32
350 boot_cpu_data.hlt_works_ok = 1;
351#endif
352 pm_idle = default_idle;
366 353
367 fiddle_vdso(); 354 fiddle_vdso();
368} 355}
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 1d789d56877c..9bbd63a129b5 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -31,6 +31,7 @@ void xen_hvm_post_suspend(int suspend_cancelled)
31 int cpu; 31 int cpu;
32 xen_hvm_init_shared_info(); 32 xen_hvm_init_shared_info();
33 xen_callback_vector(); 33 xen_callback_vector();
34 xen_unplug_emulated_devices();
34 if (xen_feature(XENFEAT_hvm_safe_pvclock)) { 35 if (xen_feature(XENFEAT_hvm_safe_pvclock)) {
35 for_each_online_cpu(cpu) { 36 for_each_online_cpu(cpu) {
36 xen_setup_runstate_info(cpu); 37 xen_setup_runstate_info(cpu);
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index b2bb5aa3b054..5da5e53fb94c 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -426,6 +426,8 @@ void xen_timer_resume(void)
426{ 426{
427 int cpu; 427 int cpu;
428 428
429 pvclock_resume();
430
429 if (xen_clockevent != &xen_vcpuop_clockevent) 431 if (xen_clockevent != &xen_vcpuop_clockevent)
430 return; 432 return;
431 433
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 64044747348e..9d41bf985757 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -43,7 +43,7 @@ void xen_vcpu_restore(void);
43 43
44void xen_callback_vector(void); 44void xen_callback_vector(void);
45void xen_hvm_init_shared_info(void); 45void xen_hvm_init_shared_info(void);
46void __init xen_unplug_emulated_devices(void); 46void xen_unplug_emulated_devices(void);
47 47
48void __init xen_build_dynamic_phys_to_machine(void); 48void __init xen_build_dynamic_phys_to_machine(void);
49 49
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9272c38dd3c6..16a2847b7cdb 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -812,8 +812,10 @@ static int intel_fake_agp_fetch_size(void)
812 812
813static void i830_cleanup(void) 813static void i830_cleanup(void)
814{ 814{
815 kunmap(intel_private.i8xx_page); 815 if (intel_private.i8xx_flush_page) {
816 intel_private.i8xx_flush_page = NULL; 816 kunmap(intel_private.i8xx_flush_page);
817 intel_private.i8xx_flush_page = NULL;
818 }
817 819
818 __free_page(intel_private.i8xx_page); 820 __free_page(intel_private.i8xx_page);
819 intel_private.i8xx_page = NULL; 821 intel_private.i8xx_page = NULL;
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index eb6b54dbb806..85ffd5e38c50 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -1213,3 +1213,4 @@ module_exit(sh_dmae_exit);
1213MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>"); 1213MODULE_AUTHOR("Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>");
1214MODULE_DESCRIPTION("Renesas SH DMA Engine driver"); 1214MODULE_DESCRIPTION("Renesas SH DMA Engine driver");
1215MODULE_LICENSE("GPL"); 1215MODULE_LICENSE("GPL");
1216MODULE_ALIAS("platform:sh-dma-engine");
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 7ca59359fee2..bede10a03407 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -241,7 +241,7 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)
241 } 241 }
242 242
243 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 243 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
244 if (!drm_helper_encoder_in_use(encoder)) { 244 if (encoder->crtc && !drm_helper_encoder_in_use(encoder)) {
245 drm_encoder_disable(encoder); 245 drm_encoder_disable(encoder);
246 /* disconnector encoder from any connector */ 246 /* disconnector encoder from any connector */
247 encoder->crtc = NULL; 247 encoder->crtc = NULL;
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 9d3a5030b6e1..722700d5d73e 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -585,10 +585,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
585 struct timeval now; 585 struct timeval now;
586 unsigned long flags; 586 unsigned long flags;
587 unsigned int seq; 587 unsigned int seq;
588 int ret;
588 589
589 e = kzalloc(sizeof *e, GFP_KERNEL); 590 e = kzalloc(sizeof *e, GFP_KERNEL);
590 if (e == NULL) 591 if (e == NULL) {
591 return -ENOMEM; 592 ret = -ENOMEM;
593 goto err_put;
594 }
592 595
593 e->pipe = pipe; 596 e->pipe = pipe;
594 e->base.pid = current->pid; 597 e->base.pid = current->pid;
@@ -603,9 +606,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
603 spin_lock_irqsave(&dev->event_lock, flags); 606 spin_lock_irqsave(&dev->event_lock, flags);
604 607
605 if (file_priv->event_space < sizeof e->event) { 608 if (file_priv->event_space < sizeof e->event) {
606 spin_unlock_irqrestore(&dev->event_lock, flags); 609 ret = -EBUSY;
607 kfree(e); 610 goto err_unlock;
608 return -ENOMEM;
609 } 611 }
610 612
611 file_priv->event_space -= sizeof e->event; 613 file_priv->event_space -= sizeof e->event;
@@ -638,6 +640,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
638 spin_unlock_irqrestore(&dev->event_lock, flags); 640 spin_unlock_irqrestore(&dev->event_lock, flags);
639 641
640 return 0; 642 return 0;
643
644err_unlock:
645 spin_unlock_irqrestore(&dev->event_lock, flags);
646 kfree(e);
647err_put:
648 drm_vblank_put(dev, e->pipe);
649 return ret;
641} 650}
642 651
643/** 652/**
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 7a26f4dd21ae..e6800819bca8 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -767,6 +767,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
767 case I915_PARAM_HAS_BLT: 767 case I915_PARAM_HAS_BLT:
768 value = HAS_BLT(dev); 768 value = HAS_BLT(dev);
769 break; 769 break;
770 case I915_PARAM_HAS_COHERENT_RINGS:
771 value = 1;
772 break;
770 default: 773 default:
771 DRM_DEBUG_DRIVER("Unknown parameter %d\n", 774 DRM_DEBUG_DRIVER("Unknown parameter %d\n",
772 param->param); 775 param->param);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5e54821af996..275ec6ed43ae 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4374,10 +4374,20 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
4374 * use this buffer rather sooner than later, so issuing the required 4374 * use this buffer rather sooner than later, so issuing the required
4375 * flush earlier is beneficial. 4375 * flush earlier is beneficial.
4376 */ 4376 */
4377 if (obj->write_domain & I915_GEM_GPU_DOMAINS) 4377 if (obj->write_domain & I915_GEM_GPU_DOMAINS) {
4378 i915_gem_flush_ring(dev, file_priv, 4378 i915_gem_flush_ring(dev, file_priv,
4379 obj_priv->ring, 4379 obj_priv->ring,
4380 0, obj->write_domain); 4380 0, obj->write_domain);
4381 } else if (obj_priv->ring->outstanding_lazy_request) {
4382 /* This ring is not being cleared by active usage,
4383 * so emit a request to do so.
4384 */
4385 u32 seqno = i915_add_request(dev,
4386 NULL, NULL,
4387 obj_priv->ring);
4388 if (seqno == 0)
4389 ret = -ENOMEM;
4390 }
4381 4391
4382 /* Update the active list for the hardware's current position. 4392 /* Update the active list for the hardware's current position.
4383 * Otherwise this only updates on a delayed timer or when irqs 4393 * Otherwise this only updates on a delayed timer or when irqs
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 25ed911a3112..878fc766a12c 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3033,6 +3033,7 @@
3033#define TRANS_DP_10BPC (1<<9) 3033#define TRANS_DP_10BPC (1<<9)
3034#define TRANS_DP_6BPC (2<<9) 3034#define TRANS_DP_6BPC (2<<9)
3035#define TRANS_DP_12BPC (3<<9) 3035#define TRANS_DP_12BPC (3<<9)
3036#define TRANS_DP_BPC_MASK (3<<9)
3036#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) 3037#define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4)
3037#define TRANS_DP_VSYNC_ACTIVE_LOW 0 3038#define TRANS_DP_VSYNC_ACTIVE_LOW 0
3038#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) 3039#define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3)
diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
index 65c88f9ba12c..2cb8e0b9f1ee 100644
--- a/drivers/gpu/drm/i915/intel_acpi.c
+++ b/drivers/gpu/drm/i915/intel_acpi.c
@@ -190,37 +190,6 @@ out:
190 kfree(output.pointer); 190 kfree(output.pointer);
191} 191}
192 192
193static int intel_dsm_switchto(enum vga_switcheroo_client_id id)
194{
195 return 0;
196}
197
198static int intel_dsm_power_state(enum vga_switcheroo_client_id id,
199 enum vga_switcheroo_state state)
200{
201 return 0;
202}
203
204static int intel_dsm_init(void)
205{
206 return 0;
207}
208
209static int intel_dsm_get_client_id(struct pci_dev *pdev)
210{
211 if (intel_dsm_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev))
212 return VGA_SWITCHEROO_IGD;
213 else
214 return VGA_SWITCHEROO_DIS;
215}
216
217static struct vga_switcheroo_handler intel_dsm_handler = {
218 .switchto = intel_dsm_switchto,
219 .power_state = intel_dsm_power_state,
220 .init = intel_dsm_init,
221 .get_client_id = intel_dsm_get_client_id,
222};
223
224static bool intel_dsm_pci_probe(struct pci_dev *pdev) 193static bool intel_dsm_pci_probe(struct pci_dev *pdev)
225{ 194{
226 acpi_handle dhandle, intel_handle; 195 acpi_handle dhandle, intel_handle;
@@ -276,11 +245,8 @@ void intel_register_dsm_handler(void)
276{ 245{
277 if (!intel_dsm_detect()) 246 if (!intel_dsm_detect())
278 return; 247 return;
279
280 vga_switcheroo_register_handler(&intel_dsm_handler);
281} 248}
282 249
283void intel_unregister_dsm_handler(void) 250void intel_unregister_dsm_handler(void)
284{ 251{
285 vga_switcheroo_unregister_handler();
286} 252}
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 255b52ee0091..d9b7092439ef 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2120,9 +2120,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
2120 reg = TRANS_DP_CTL(pipe); 2120 reg = TRANS_DP_CTL(pipe);
2121 temp = I915_READ(reg); 2121 temp = I915_READ(reg);
2122 temp &= ~(TRANS_DP_PORT_SEL_MASK | 2122 temp &= ~(TRANS_DP_PORT_SEL_MASK |
2123 TRANS_DP_SYNC_MASK); 2123 TRANS_DP_SYNC_MASK |
2124 TRANS_DP_BPC_MASK);
2124 temp |= (TRANS_DP_OUTPUT_ENABLE | 2125 temp |= (TRANS_DP_OUTPUT_ENABLE |
2125 TRANS_DP_ENH_FRAMING); 2126 TRANS_DP_ENH_FRAMING);
2127 temp |= TRANS_DP_8BPC;
2126 2128
2127 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) 2129 if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
2128 temp |= TRANS_DP_HSYNC_ACTIVE_HIGH; 2130 temp |= TRANS_DP_HSYNC_ACTIVE_HIGH;
@@ -2712,27 +2714,19 @@ fdi_reduce_ratio(u32 *num, u32 *den)
2712 } 2714 }
2713} 2715}
2714 2716
2715#define DATA_N 0x800000
2716#define LINK_N 0x80000
2717
2718static void 2717static void
2719ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, 2718ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock,
2720 int link_clock, struct fdi_m_n *m_n) 2719 int link_clock, struct fdi_m_n *m_n)
2721{ 2720{
2722 u64 temp;
2723
2724 m_n->tu = 64; /* default size */ 2721 m_n->tu = 64; /* default size */
2725 2722
2726 temp = (u64) DATA_N * pixel_clock; 2723 /* BUG_ON(pixel_clock > INT_MAX / 36); */
2727 temp = div_u64(temp, link_clock); 2724 m_n->gmch_m = bits_per_pixel * pixel_clock;
2728 m_n->gmch_m = div_u64(temp * bits_per_pixel, nlanes); 2725 m_n->gmch_n = link_clock * nlanes * 8;
2729 m_n->gmch_m >>= 3; /* convert to bytes_per_pixel */
2730 m_n->gmch_n = DATA_N;
2731 fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); 2726 fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n);
2732 2727
2733 temp = (u64) LINK_N * pixel_clock; 2728 m_n->link_m = pixel_clock;
2734 m_n->link_m = div_u64(temp, link_clock); 2729 m_n->link_n = link_clock;
2735 m_n->link_n = LINK_N;
2736 fdi_reduce_ratio(&m_n->link_m, &m_n->link_n); 2730 fdi_reduce_ratio(&m_n->link_m, &m_n->link_n);
2737} 2731}
2738 2732
@@ -3716,6 +3710,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3716 3710
3717 /* FDI link */ 3711 /* FDI link */
3718 if (HAS_PCH_SPLIT(dev)) { 3712 if (HAS_PCH_SPLIT(dev)) {
3713 int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
3719 int lane = 0, link_bw, bpp; 3714 int lane = 0, link_bw, bpp;
3720 /* CPU eDP doesn't require FDI link, so just set DP M/N 3715 /* CPU eDP doesn't require FDI link, so just set DP M/N
3721 according to current link config */ 3716 according to current link config */
@@ -3799,6 +3794,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3799 3794
3800 intel_crtc->fdi_lanes = lane; 3795 intel_crtc->fdi_lanes = lane;
3801 3796
3797 if (pixel_multiplier > 1)
3798 link_bw *= pixel_multiplier;
3802 ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); 3799 ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n);
3803 } 3800 }
3804 3801
@@ -5236,6 +5233,55 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
5236 .page_flip = intel_crtc_page_flip, 5233 .page_flip = intel_crtc_page_flip,
5237}; 5234};
5238 5235
5236static void intel_sanitize_modesetting(struct drm_device *dev,
5237 int pipe, int plane)
5238{
5239 struct drm_i915_private *dev_priv = dev->dev_private;
5240 u32 reg, val;
5241
5242 if (HAS_PCH_SPLIT(dev))
5243 return;
5244
5245 /* Who knows what state these registers were left in by the BIOS or
5246 * grub?
5247 *
5248 * If we leave the registers in a conflicting state (e.g. with the
5249 * display plane reading from the other pipe than the one we intend
5250 * to use) then when we attempt to teardown the active mode, we will
5251 * not disable the pipes and planes in the correct order -- leaving
5252 * a plane reading from a disabled pipe and possibly leading to
5253 * undefined behaviour.
5254 */
5255
5256 reg = DSPCNTR(plane);
5257 val = I915_READ(reg);
5258
5259 if ((val & DISPLAY_PLANE_ENABLE) == 0)
5260 return;
5261 if (!!(val & DISPPLANE_SEL_PIPE_MASK) == pipe)
5262 return;
5263
5264 /* This display plane is active and attached to the other CPU pipe. */
5265 pipe = !pipe;
5266
5267 /* Disable the plane and wait for it to stop reading from the pipe. */
5268 I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE);
5269 intel_flush_display_plane(dev, plane);
5270
5271 if (IS_GEN2(dev))
5272 intel_wait_for_vblank(dev, pipe);
5273
5274 if (pipe == 0 && (dev_priv->quirks & QUIRK_PIPEA_FORCE))
5275 return;
5276
5277 /* Switch off the pipe. */
5278 reg = PIPECONF(pipe);
5279 val = I915_READ(reg);
5280 if (val & PIPECONF_ENABLE) {
5281 I915_WRITE(reg, val & ~PIPECONF_ENABLE);
5282 intel_wait_for_pipe_off(dev, pipe);
5283 }
5284}
5239 5285
5240static void intel_crtc_init(struct drm_device *dev, int pipe) 5286static void intel_crtc_init(struct drm_device *dev, int pipe)
5241{ 5287{
@@ -5287,6 +5333,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
5287 5333
5288 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, 5334 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer,
5289 (unsigned long)intel_crtc); 5335 (unsigned long)intel_crtc);
5336
5337 intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
5290} 5338}
5291 5339
5292int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, 5340int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 300f64b4238b..df648cb4c296 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1376,6 +1376,9 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1376 struct drm_i915_private *dev_priv = dev->dev_private; 1376 struct drm_i915_private *dev_priv = dev->dev_private;
1377 uint32_t DP = intel_dp->DP; 1377 uint32_t DP = intel_dp->DP;
1378 1378
1379 if ((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0)
1380 return;
1381
1379 DRM_DEBUG_KMS("\n"); 1382 DRM_DEBUG_KMS("\n");
1380 1383
1381 if (is_edp(intel_dp)) { 1384 if (is_edp(intel_dp)) {
@@ -1398,6 +1401,28 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1398 1401
1399 if (is_edp(intel_dp)) 1402 if (is_edp(intel_dp))
1400 DP |= DP_LINK_TRAIN_OFF; 1403 DP |= DP_LINK_TRAIN_OFF;
1404
1405 if (!HAS_PCH_CPT(dev) &&
1406 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
1407 struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);
1408 /* Hardware workaround: leaving our transcoder select
1409 * set to transcoder B while it's off will prevent the
1410 * corresponding HDMI output on transcoder A.
1411 *
1412 * Combine this with another hardware workaround:
1413 * transcoder select bit can only be cleared while the
1414 * port is enabled.
1415 */
1416 DP &= ~DP_PIPEB_SELECT;
1417 I915_WRITE(intel_dp->output_reg, DP);
1418
1419 /* Changes to enable or select take place the vblank
1420 * after being written.
1421 */
1422 intel_wait_for_vblank(intel_dp->base.base.dev,
1423 intel_crtc->pipe);
1424 }
1425
1401 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); 1426 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
1402 POSTING_READ(intel_dp->output_reg); 1427 POSTING_READ(intel_dp->output_reg);
1403} 1428}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index f79327fc6653..25bcedf386fd 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -68,7 +68,7 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector)
68/** 68/**
69 * Sets the power state for the panel. 69 * Sets the power state for the panel.
70 */ 70 */
71static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on) 71static void intel_lvds_enable(struct intel_lvds *intel_lvds)
72{ 72{
73 struct drm_device *dev = intel_lvds->base.base.dev; 73 struct drm_device *dev = intel_lvds->base.base.dev;
74 struct drm_i915_private *dev_priv = dev->dev_private; 74 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -82,26 +82,61 @@ static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on)
82 lvds_reg = LVDS; 82 lvds_reg = LVDS;
83 } 83 }
84 84
85 if (on) { 85 I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN);
86 I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN);
87 I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON);
88 intel_panel_set_backlight(dev, dev_priv->backlight_level);
89 } else {
90 dev_priv->backlight_level = intel_panel_get_backlight(dev);
91
92 intel_panel_set_backlight(dev, 0);
93 I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON);
94 86
95 if (intel_lvds->pfit_control) { 87 if (intel_lvds->pfit_dirty) {
96 if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) 88 /*
97 DRM_ERROR("timed out waiting for panel to power off\n"); 89 * Enable automatic panel scaling so that non-native modes
98 I915_WRITE(PFIT_CONTROL, 0); 90 * fill the screen. The panel fitter should only be
99 intel_lvds->pfit_control = 0; 91 * adjusted whilst the pipe is disabled, according to
92 * register description and PRM.
93 */
94 DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n",
95 intel_lvds->pfit_control,
96 intel_lvds->pfit_pgm_ratios);
97 if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) {
98 DRM_ERROR("timed out waiting for panel to power off\n");
99 } else {
100 I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios);
101 I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control);
100 intel_lvds->pfit_dirty = false; 102 intel_lvds->pfit_dirty = false;
101 } 103 }
104 }
105
106 I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON);
107 POSTING_READ(lvds_reg);
108
109 intel_panel_set_backlight(dev, dev_priv->backlight_level);
110}
102 111
103 I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); 112static void intel_lvds_disable(struct intel_lvds *intel_lvds)
113{
114 struct drm_device *dev = intel_lvds->base.base.dev;
115 struct drm_i915_private *dev_priv = dev->dev_private;
116 u32 ctl_reg, lvds_reg;
117
118 if (HAS_PCH_SPLIT(dev)) {
119 ctl_reg = PCH_PP_CONTROL;
120 lvds_reg = PCH_LVDS;
121 } else {
122 ctl_reg = PP_CONTROL;
123 lvds_reg = LVDS;
124 }
125
126 dev_priv->backlight_level = intel_panel_get_backlight(dev);
127 intel_panel_set_backlight(dev, 0);
128
129 I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON);
130
131 if (intel_lvds->pfit_control) {
132 if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000))
133 DRM_ERROR("timed out waiting for panel to power off\n");
134
135 I915_WRITE(PFIT_CONTROL, 0);
136 intel_lvds->pfit_dirty = true;
104 } 137 }
138
139 I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN);
105 POSTING_READ(lvds_reg); 140 POSTING_READ(lvds_reg);
106} 141}
107 142
@@ -110,9 +145,9 @@ static void intel_lvds_dpms(struct drm_encoder *encoder, int mode)
110 struct intel_lvds *intel_lvds = to_intel_lvds(encoder); 145 struct intel_lvds *intel_lvds = to_intel_lvds(encoder);
111 146
112 if (mode == DRM_MODE_DPMS_ON) 147 if (mode == DRM_MODE_DPMS_ON)
113 intel_lvds_set_power(intel_lvds, true); 148 intel_lvds_enable(intel_lvds);
114 else 149 else
115 intel_lvds_set_power(intel_lvds, false); 150 intel_lvds_disable(intel_lvds);
116 151
117 /* XXX: We never power down the LVDS pairs. */ 152 /* XXX: We never power down the LVDS pairs. */
118} 153}
@@ -411,43 +446,18 @@ static void intel_lvds_commit(struct drm_encoder *encoder)
411 /* Always do a full power on as we do not know what state 446 /* Always do a full power on as we do not know what state
412 * we were left in. 447 * we were left in.
413 */ 448 */
414 intel_lvds_set_power(intel_lvds, true); 449 intel_lvds_enable(intel_lvds);
415} 450}
416 451
417static void intel_lvds_mode_set(struct drm_encoder *encoder, 452static void intel_lvds_mode_set(struct drm_encoder *encoder,
418 struct drm_display_mode *mode, 453 struct drm_display_mode *mode,
419 struct drm_display_mode *adjusted_mode) 454 struct drm_display_mode *adjusted_mode)
420{ 455{
421 struct drm_device *dev = encoder->dev;
422 struct drm_i915_private *dev_priv = dev->dev_private;
423 struct intel_lvds *intel_lvds = to_intel_lvds(encoder);
424
425 /* 456 /*
426 * The LVDS pin pair will already have been turned on in the 457 * The LVDS pin pair will already have been turned on in the
427 * intel_crtc_mode_set since it has a large impact on the DPLL 458 * intel_crtc_mode_set since it has a large impact on the DPLL
428 * settings. 459 * settings.
429 */ 460 */
430
431 if (HAS_PCH_SPLIT(dev))
432 return;
433
434 if (!intel_lvds->pfit_dirty)
435 return;
436
437 /*
438 * Enable automatic panel scaling so that non-native modes fill the
439 * screen. Should be enabled before the pipe is enabled, according to
440 * register description and PRM.
441 */
442 DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n",
443 intel_lvds->pfit_control,
444 intel_lvds->pfit_pgm_ratios);
445 if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000))
446 DRM_ERROR("timed out waiting for panel to power off\n");
447
448 I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios);
449 I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control);
450 intel_lvds->pfit_dirty = false;
451} 461}
452 462
453/** 463/**
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index b83306f9244b..89a65be8a3f3 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -156,23 +156,25 @@ static int init_ring_common(struct drm_device *dev,
156 156
157 /* G45 ring initialization fails to reset head to zero */ 157 /* G45 ring initialization fails to reset head to zero */
158 if (head != 0) { 158 if (head != 0) {
159 DRM_ERROR("%s head not reset to zero " 159 DRM_DEBUG_KMS("%s head not reset to zero "
160 "ctl %08x head %08x tail %08x start %08x\n", 160 "ctl %08x head %08x tail %08x start %08x\n",
161 ring->name, 161 ring->name,
162 I915_READ_CTL(ring), 162 I915_READ_CTL(ring),
163 I915_READ_HEAD(ring), 163 I915_READ_HEAD(ring),
164 I915_READ_TAIL(ring), 164 I915_READ_TAIL(ring),
165 I915_READ_START(ring)); 165 I915_READ_START(ring));
166 166
167 I915_WRITE_HEAD(ring, 0); 167 I915_WRITE_HEAD(ring, 0);
168 168
169 DRM_ERROR("%s head forced to zero " 169 if (I915_READ_HEAD(ring) & HEAD_ADDR) {
170 "ctl %08x head %08x tail %08x start %08x\n", 170 DRM_ERROR("failed to set %s head to zero "
171 ring->name, 171 "ctl %08x head %08x tail %08x start %08x\n",
172 I915_READ_CTL(ring), 172 ring->name,
173 I915_READ_HEAD(ring), 173 I915_READ_CTL(ring),
174 I915_READ_TAIL(ring), 174 I915_READ_HEAD(ring),
175 I915_READ_START(ring)); 175 I915_READ_TAIL(ring),
176 I915_READ_START(ring));
177 }
176 } 178 }
177 179
178 I915_WRITE_CTL(ring, 180 I915_WRITE_CTL(ring,
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index a3552594ccc4..a322d4f647bd 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1195,8 +1195,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1195 mc->vram_end, mc->real_vram_size >> 20); 1195 mc->vram_end, mc->real_vram_size >> 20);
1196 } else { 1196 } else {
1197 u64 base = 0; 1197 u64 base = 0;
1198 if (rdev->flags & RADEON_IS_IGP) 1198 if (rdev->flags & RADEON_IS_IGP) {
1199 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; 1199 base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF;
1200 base <<= 24;
1201 }
1200 radeon_vram_location(rdev, &rdev->mc, base); 1202 radeon_vram_location(rdev, &rdev->mc, base);
1201 rdev->mc.gtt_base_align = 0; 1203 rdev->mc.gtt_base_align = 0;
1202 radeon_gtt_location(rdev, mc); 1204 radeon_gtt_location(rdev, mc);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index d8ac1849180d..e12e79326cb1 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -286,7 +286,7 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64
286 mc->mc_vram_size = mc->aper_size; 286 mc->mc_vram_size = mc->aper_size;
287 } 287 }
288 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 288 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
289 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 289 dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n",
290 mc->mc_vram_size >> 20, mc->vram_start, 290 mc->mc_vram_size >> 20, mc->vram_start,
291 mc->vram_end, mc->real_vram_size >> 20); 291 mc->vram_end, mc->real_vram_size >> 20);
292} 292}
@@ -323,7 +323,7 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
323 mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; 323 mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align;
324 } 324 }
325 mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; 325 mc->gtt_end = mc->gtt_start + mc->gtt_size - 1;
326 dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n", 326 dev_info(rdev->dev, "GTT: %lluM 0x%016llX - 0x%016llX\n",
327 mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); 327 mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end);
328} 328}
329 329
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 1d067743fee0..a598d0049aa5 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
69 u32 c = 0; 69 u32 c = 0;
70 70
71 rbo->placement.fpfn = 0; 71 rbo->placement.fpfn = 0;
72 rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; 72 rbo->placement.lpfn = 0;
73 rbo->placement.placement = rbo->placements; 73 rbo->placement.placement = rbo->placements;
74 rbo->placement.busy_placement = rbo->placements; 74 rbo->placement.busy_placement = rbo->placements;
75 if (domain & RADEON_GEM_DOMAIN_VRAM) 75 if (domain & RADEON_GEM_DOMAIN_VRAM)
@@ -91,7 +91,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
91{ 91{
92 struct radeon_bo *bo; 92 struct radeon_bo *bo;
93 enum ttm_bo_type type; 93 enum ttm_bo_type type;
94 int page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; 94 unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT;
95 unsigned long max_size = 0;
95 int r; 96 int r;
96 97
97 if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { 98 if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) {
@@ -104,6 +105,14 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
104 } 105 }
105 *bo_ptr = NULL; 106 *bo_ptr = NULL;
106 107
108 /* maximun bo size is the minimun btw visible vram and gtt size */
109 max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size);
110 if ((page_align << PAGE_SHIFT) >= max_size) {
111 printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n",
112 __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20);
113 return -ENOMEM;
114 }
115
107retry: 116retry:
108 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); 117 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
109 if (bo == NULL) 118 if (bo == NULL)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 3052e2969ad0..3d9a95f28aea 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -150,6 +150,16 @@ config DRAGONRISE_FF
150 Say Y here if you want to enable force feedback support for DragonRise Inc. 150 Say Y here if you want to enable force feedback support for DragonRise Inc.
151 game controllers. 151 game controllers.
152 152
153config HID_EMS_FF
154 tristate "EMS Production Inc. force feedback support"
155 depends on USB_HID
156 select INPUT_FF_MEMLESS
157 ---help---
158 Say Y here if you want to enable force feedback support for devices by
159 EMS Production Ltd.
160 Currently the following devices are known to be supported:
161 - Trio Linker Plus II
162
153config HID_EGALAX 163config HID_EGALAX
154 tristate "eGalax multi-touch panel" 164 tristate "eGalax multi-touch panel"
155 depends on USB_HID 165 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index c335605b9200..b406269d1bcb 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the HID driver 2# Makefile for the HID driver
3# 3#
4hid-objs := hid-core.o hid-input.o 4hid-y := hid-core.o hid-input.o
5 5
6ifdef CONFIG_DEBUG_FS 6ifdef CONFIG_DEBUG_FS
7 hid-objs += hid-debug.o 7 hid-objs += hid-debug.o
@@ -11,18 +11,18 @@ obj-$(CONFIG_HID) += hid.o
11 11
12hid-$(CONFIG_HIDRAW) += hidraw.o 12hid-$(CONFIG_HIDRAW) += hidraw.o
13 13
14hid-logitech-objs := hid-lg.o 14hid-logitech-y := hid-lg.o
15ifdef CONFIG_LOGITECH_FF 15ifdef CONFIG_LOGITECH_FF
16 hid-logitech-objs += hid-lgff.o 16 hid-logitech-y += hid-lgff.o
17endif 17endif
18ifdef CONFIG_LOGIRUMBLEPAD2_FF 18ifdef CONFIG_LOGIRUMBLEPAD2_FF
19 hid-logitech-objs += hid-lg2ff.o 19 hid-logitech-y += hid-lg2ff.o
20endif 20endif
21ifdef CONFIG_LOGIG940_FF 21ifdef CONFIG_LOGIG940_FF
22 hid-logitech-objs += hid-lg3ff.o 22 hid-logitech-y += hid-lg3ff.o
23endif 23endif
24ifdef CONFIG_LOGIWII_FF 24ifdef CONFIG_LOGIWII_FF
25 hid-logitech-objs += hid-lg4ff.o 25 hid-logitech-y += hid-lg4ff.o
26endif 26endif
27 27
28obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o 28obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o
@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o
38obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
38obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 39obj-$(CONFIG_HID_EGALAX) += hid-egalax.o
39obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 40obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
40obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 41obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-3m-pct.c b/drivers/hid/hid-3m-pct.c
index 02d8cd3b1b1b..4546c123eb77 100644
--- a/drivers/hid/hid-3m-pct.c
+++ b/drivers/hid/hid-3m-pct.c
@@ -274,7 +274,7 @@ static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)
274 274
275 md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL); 275 md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
276 if (!md) { 276 if (!md) {
277 dev_err(&hdev->dev, "cannot allocate 3M data\n"); 277 hid_err(hdev, "cannot allocate 3M data\n");
278 return -ENOMEM; 278 return -ENOMEM;
279 } 279 }
280 hid_set_drvdata(hdev, md); 280 hid_set_drvdata(hdev, md);
diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c
index 1666c1684e79..902d1dfeb1b5 100644
--- a/drivers/hid/hid-a4tech.c
+++ b/drivers/hid/hid-a4tech.c
@@ -93,7 +93,7 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)
93 93
94 a4 = kzalloc(sizeof(*a4), GFP_KERNEL); 94 a4 = kzalloc(sizeof(*a4), GFP_KERNEL);
95 if (a4 == NULL) { 95 if (a4 == NULL) {
96 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 96 hid_err(hdev, "can't alloc device descriptor\n");
97 ret = -ENOMEM; 97 ret = -ENOMEM;
98 goto err_free; 98 goto err_free;
99 } 99 }
@@ -104,13 +104,13 @@ static int a4_probe(struct hid_device *hdev, const struct hid_device_id *id)
104 104
105 ret = hid_parse(hdev); 105 ret = hid_parse(hdev);
106 if (ret) { 106 if (ret) {
107 dev_err(&hdev->dev, "parse failed\n"); 107 hid_err(hdev, "parse failed\n");
108 goto err_free; 108 goto err_free;
109 } 109 }
110 110
111 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 111 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
112 if (ret) { 112 if (ret) {
113 dev_err(&hdev->dev, "hw start failed\n"); 113 hid_err(hdev, "hw start failed\n");
114 goto err_free; 114 goto err_free;
115 } 115 }
116 116
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index eaeca564a8d3..61aa71233392 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -16,6 +16,8 @@
16 * any later version. 16 * any later version.
17 */ 17 */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/device.h> 21#include <linux/device.h>
20#include <linux/hid.h> 22#include <linux/hid.h>
21#include <linux/module.h> 23#include <linux/module.h>
@@ -59,6 +61,27 @@ struct apple_key_translation {
59 u8 flags; 61 u8 flags;
60}; 62};
61 63
64static const struct apple_key_translation macbookair_fn_keys[] = {
65 { KEY_BACKSPACE, KEY_DELETE },
66 { KEY_ENTER, KEY_INSERT },
67 { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
68 { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
69 { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
70 { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
71 { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
72 { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
73 { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
74 { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
75 { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
76 { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
77 { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
78 { KEY_UP, KEY_PAGEUP },
79 { KEY_DOWN, KEY_PAGEDOWN },
80 { KEY_LEFT, KEY_HOME },
81 { KEY_RIGHT, KEY_END },
82 { }
83};
84
62static const struct apple_key_translation apple_fn_keys[] = { 85static const struct apple_key_translation apple_fn_keys[] = {
63 { KEY_BACKSPACE, KEY_DELETE }, 86 { KEY_BACKSPACE, KEY_DELETE },
64 { KEY_ENTER, KEY_INSERT }, 87 { KEY_ENTER, KEY_INSERT },
@@ -146,7 +169,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
146 struct hid_usage *usage, __s32 value) 169 struct hid_usage *usage, __s32 value)
147{ 170{
148 struct apple_sc *asc = hid_get_drvdata(hid); 171 struct apple_sc *asc = hid_get_drvdata(hid);
149 const struct apple_key_translation *trans; 172 const struct apple_key_translation *trans, *table;
150 173
151 if (usage->code == KEY_FN) { 174 if (usage->code == KEY_FN) {
152 asc->fn_on = !!value; 175 asc->fn_on = !!value;
@@ -157,10 +180,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
157 if (fnmode) { 180 if (fnmode) {
158 int do_translate; 181 int do_translate;
159 182
160 trans = apple_find_translation((hid->product < 0x21d || 183 if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
161 hid->product >= 0x300) ? 184 hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS)
162 powerbook_fn_keys : apple_fn_keys, 185 table = macbookair_fn_keys;
163 usage->code); 186 else if (hid->product < 0x21d || hid->product >= 0x300)
187 table = powerbook_fn_keys;
188 else
189 table = apple_fn_keys;
190
191 trans = apple_find_translation (table, usage->code);
192
164 if (trans) { 193 if (trans) {
165 if (test_bit(usage->code, asc->pressed_fn)) 194 if (test_bit(usage->code, asc->pressed_fn))
166 do_translate = 1; 195 do_translate = 1;
@@ -253,8 +282,8 @@ static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc,
253 282
254 if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && 283 if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 &&
255 rdesc[53] == 0x65 && rdesc[59] == 0x65) { 284 rdesc[53] == 0x65 && rdesc[59] == 0x65) {
256 dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " 285 hid_info(hdev,
257 "descriptor\n"); 286 "fixing up MacBook JIS keyboard report descriptor\n");
258 rdesc[53] = rdesc[59] = 0xe7; 287 rdesc[53] = rdesc[59] = 0xe7;
259 } 288 }
260 return rdesc; 289 return rdesc;
@@ -324,7 +353,7 @@ static int apple_probe(struct hid_device *hdev,
324 353
325 asc = kzalloc(sizeof(*asc), GFP_KERNEL); 354 asc = kzalloc(sizeof(*asc), GFP_KERNEL);
326 if (asc == NULL) { 355 if (asc == NULL) {
327 dev_err(&hdev->dev, "can't alloc apple descriptor\n"); 356 hid_err(hdev, "can't alloc apple descriptor\n");
328 return -ENOMEM; 357 return -ENOMEM;
329 } 358 }
330 359
@@ -334,7 +363,7 @@ static int apple_probe(struct hid_device *hdev,
334 363
335 ret = hid_parse(hdev); 364 ret = hid_parse(hdev);
336 if (ret) { 365 if (ret) {
337 dev_err(&hdev->dev, "parse failed\n"); 366 hid_err(hdev, "parse failed\n");
338 goto err_free; 367 goto err_free;
339 } 368 }
340 369
@@ -345,7 +374,7 @@ static int apple_probe(struct hid_device *hdev,
345 374
346 ret = hid_hw_start(hdev, connect_mask); 375 ret = hid_hw_start(hdev, connect_mask);
347 if (ret) { 376 if (ret) {
348 dev_err(&hdev->dev, "hw start failed\n"); 377 hid_err(hdev, "hw start failed\n");
349 goto err_free; 378 goto err_free;
350 } 379 }
351 380
@@ -440,6 +469,18 @@ static const struct hid_device_id apple_devices[] = {
440 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 469 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
441 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), 470 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
442 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 471 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
472 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
473 .driver_data = APPLE_HAS_FN },
474 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
475 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
476 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
477 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
478 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
479 .driver_data = APPLE_HAS_FN },
480 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
481 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
482 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
483 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
443 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 484 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
444 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 485 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
445 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), 486 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
@@ -473,7 +514,7 @@ static int __init apple_init(void)
473 514
474 ret = hid_register_driver(&apple_driver); 515 ret = hid_register_driver(&apple_driver);
475 if (ret) 516 if (ret)
476 printk(KERN_ERR "can't register apple driver\n"); 517 pr_err("can't register apple driver\n");
477 518
478 return ret; 519 return ret;
479} 520}
diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c
index f42ee140738a..e5b961d6ff22 100644
--- a/drivers/hid/hid-axff.c
+++ b/drivers/hid/hid-axff.c
@@ -73,14 +73,14 @@ static int axff_init(struct hid_device *hid)
73 int error; 73 int error;
74 74
75 if (list_empty(report_list)) { 75 if (list_empty(report_list)) {
76 dev_err(&hid->dev, "no output reports found\n"); 76 hid_err(hid, "no output reports found\n");
77 return -ENODEV; 77 return -ENODEV;
78 } 78 }
79 79
80 report = list_first_entry(report_list, struct hid_report, list); 80 report = list_first_entry(report_list, struct hid_report, list);
81 81
82 if (report->maxfield < 4) { 82 if (report->maxfield < 4) {
83 dev_err(&hid->dev, "no fields in the report: %d\n", report->maxfield); 83 hid_err(hid, "no fields in the report: %d\n", report->maxfield);
84 return -ENODEV; 84 return -ENODEV;
85 } 85 }
86 86
@@ -101,7 +101,7 @@ static int axff_init(struct hid_device *hid)
101 axff->report->field[3]->value[0] = 0x00; 101 axff->report->field[3]->value[0] = 0x00;
102 usbhid_submit_report(hid, axff->report, USB_DIR_OUT); 102 usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
103 103
104 dev_info(&hid->dev, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n"); 104 hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n");
105 105
106 return 0; 106 return 0;
107 107
@@ -114,17 +114,17 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
114{ 114{
115 int error; 115 int error;
116 116
117 dev_dbg(&hdev->dev, "ACRUX HID hardware probe..."); 117 dev_dbg(&hdev->dev, "ACRUX HID hardware probe...\n");
118 118
119 error = hid_parse(hdev); 119 error = hid_parse(hdev);
120 if (error) { 120 if (error) {
121 dev_err(&hdev->dev, "parse failed\n"); 121 hid_err(hdev, "parse failed\n");
122 return error; 122 return error;
123 } 123 }
124 124
125 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 125 error = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
126 if (error) { 126 if (error) {
127 dev_err(&hdev->dev, "hw start failed\n"); 127 hid_err(hdev, "hw start failed\n");
128 return error; 128 return error;
129 } 129 }
130 130
@@ -134,7 +134,7 @@ static int ax_probe(struct hid_device *hdev, const struct hid_device_id *id)
134 * Do not fail device initialization completely as device 134 * Do not fail device initialization completely as device
135 * may still be partially operable, just warn. 135 * may still be partially operable, just warn.
136 */ 136 */
137 dev_warn(&hdev->dev, 137 hid_warn(hdev,
138 "Failed to enable force feedback support, error: %d\n", 138 "Failed to enable force feedback support, error: %d\n",
139 error); 139 error);
140 } 140 }
diff --git a/drivers/hid/hid-belkin.c b/drivers/hid/hid-belkin.c
index 4ce7aa3a519f..a1a765a5b08a 100644
--- a/drivers/hid/hid-belkin.c
+++ b/drivers/hid/hid-belkin.c
@@ -56,14 +56,14 @@ static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id)
56 56
57 ret = hid_parse(hdev); 57 ret = hid_parse(hdev);
58 if (ret) { 58 if (ret) {
59 dev_err(&hdev->dev, "parse failed\n"); 59 hid_err(hdev, "parse failed\n");
60 goto err_free; 60 goto err_free;
61 } 61 }
62 62
63 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | 63 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
64 ((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0)); 64 ((quirks & BELKIN_HIDDEV) ? HID_CONNECT_HIDDEV_FORCE : 0));
65 if (ret) { 65 if (ret) {
66 dev_err(&hdev->dev, "hw start failed\n"); 66 hid_err(hdev, "hw start failed\n");
67 goto err_free; 67 goto err_free;
68 } 68 }
69 69
diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c
index 5925bdcd417d..375b50929a50 100644
--- a/drivers/hid/hid-cando.c
+++ b/drivers/hid/hid-cando.c
@@ -207,7 +207,7 @@ static int cando_probe(struct hid_device *hdev, const struct hid_device_id *id)
207 207
208 td = kmalloc(sizeof(struct cando_data), GFP_KERNEL); 208 td = kmalloc(sizeof(struct cando_data), GFP_KERNEL);
209 if (!td) { 209 if (!td) {
210 dev_err(&hdev->dev, "cannot allocate Cando Touch data\n"); 210 hid_err(hdev, "cannot allocate Cando Touch data\n");
211 return -ENOMEM; 211 return -ENOMEM;
212 } 212 }
213 hid_set_drvdata(hdev, td); 213 hid_set_drvdata(hdev, td);
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
index e880086c2311..888ece68a47c 100644
--- a/drivers/hid/hid-cherry.c
+++ b/drivers/hid/hid-cherry.c
@@ -30,8 +30,7 @@ static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
30 unsigned int *rsize) 30 unsigned int *rsize)
31{ 31{
32 if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { 32 if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) {
33 dev_info(&hdev->dev, "fixing up Cherry Cymotion report " 33 hid_info(hdev, "fixing up Cherry Cymotion report descriptor\n");
34 "descriptor\n");
35 rdesc[11] = rdesc[16] = 0xff; 34 rdesc[11] = rdesc[16] = 0xff;
36 rdesc[12] = rdesc[17] = 0x03; 35 rdesc[12] = rdesc[17] = 0x03;
37 } 36 }
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 88cb04e7962b..c4d47e635f95 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -14,6 +14,8 @@
14 * any later version. 14 * any later version.
15 */ 15 */
16 16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
17#include <linux/module.h> 19#include <linux/module.h>
18#include <linux/slab.h> 20#include <linux/slab.h>
19#include <linux/init.h> 21#include <linux/init.h>
@@ -59,7 +61,8 @@ struct hid_report *hid_register_report(struct hid_device *device, unsigned type,
59 if (report_enum->report_id_hash[id]) 61 if (report_enum->report_id_hash[id])
60 return report_enum->report_id_hash[id]; 62 return report_enum->report_id_hash[id];
61 63
62 if (!(report = kzalloc(sizeof(struct hid_report), GFP_KERNEL))) 64 report = kzalloc(sizeof(struct hid_report), GFP_KERNEL);
65 if (!report)
63 return NULL; 66 return NULL;
64 67
65 if (id != 0) 68 if (id != 0)
@@ -90,8 +93,11 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
90 return NULL; 93 return NULL;
91 } 94 }
92 95
93 if (!(field = kzalloc(sizeof(struct hid_field) + usages * sizeof(struct hid_usage) 96 field = kzalloc((sizeof(struct hid_field) +
94 + values * sizeof(unsigned), GFP_KERNEL))) return NULL; 97 usages * sizeof(struct hid_usage) +
98 values * sizeof(unsigned)), GFP_KERNEL);
99 if (!field)
100 return NULL;
95 101
96 field->index = report->maxfield++; 102 field->index = report->maxfield++;
97 report->field[field->index] = field; 103 report->field[field->index] = field;
@@ -172,10 +178,14 @@ static int close_collection(struct hid_parser *parser)
172 178
173static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) 179static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
174{ 180{
181 struct hid_collection *collection = parser->device->collection;
175 int n; 182 int n;
176 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) 183
177 if (parser->device->collection[parser->collection_stack[n]].type == type) 184 for (n = parser->collection_stack_ptr - 1; n >= 0; n--) {
178 return parser->device->collection[parser->collection_stack[n]].usage; 185 unsigned index = parser->collection_stack[n];
186 if (collection[index].type == type)
187 return collection[index].usage;
188 }
179 return 0; /* we know nothing about this usage type */ 189 return 0; /* we know nothing about this usage type */
180} 190}
181 191
@@ -209,7 +219,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
209 unsigned offset; 219 unsigned offset;
210 int i; 220 int i;
211 221
212 if (!(report = hid_register_report(parser->device, report_type, parser->global.report_id))) { 222 report = hid_register_report(parser->device, report_type, parser->global.report_id);
223 if (!report) {
213 dbg_hid("hid_register_report failed\n"); 224 dbg_hid("hid_register_report failed\n");
214 return -1; 225 return -1;
215 } 226 }
@@ -227,7 +238,8 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
227 238
228 usages = max_t(int, parser->local.usage_index, parser->global.report_count); 239 usages = max_t(int, parser->local.usage_index, parser->global.report_count);
229 240
230 if ((field = hid_register_field(report, usages, parser->global.report_count)) == NULL) 241 field = hid_register_field(report, usages, parser->global.report_count);
242 if (!field)
231 return 0; 243 return 0;
232 244
233 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL); 245 field->physical = hid_lookup_collection(parser, HID_COLLECTION_PHYSICAL);
@@ -652,13 +664,12 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
652 return -ENOMEM; 664 return -ENOMEM;
653 device->rsize = size; 665 device->rsize = size;
654 666
655 parser = vmalloc(sizeof(struct hid_parser)); 667 parser = vzalloc(sizeof(struct hid_parser));
656 if (!parser) { 668 if (!parser) {
657 ret = -ENOMEM; 669 ret = -ENOMEM;
658 goto err; 670 goto err;
659 } 671 }
660 672
661 memset(parser, 0, sizeof(struct hid_parser));
662 parser->device = device; 673 parser->device = device;
663 674
664 end = start + size; 675 end = start + size;
@@ -672,7 +683,8 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
672 683
673 if (dispatch_type[item.type](parser, &item)) { 684 if (dispatch_type[item.type](parser, &item)) {
674 dbg_hid("item %u %u %u %u parsing failed\n", 685 dbg_hid("item %u %u %u %u parsing failed\n",
675 item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); 686 item.format, (unsigned)item.size,
687 (unsigned)item.type, (unsigned)item.tag);
676 goto err; 688 goto err;
677 } 689 }
678 690
@@ -737,13 +749,14 @@ static u32 s32ton(__s32 value, unsigned n)
737 * Search linux-kernel and linux-usb-devel archives for "hid-core extract". 749 * Search linux-kernel and linux-usb-devel archives for "hid-core extract".
738 */ 750 */
739 751
740static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) 752static __u32 extract(const struct hid_device *hid, __u8 *report,
753 unsigned offset, unsigned n)
741{ 754{
742 u64 x; 755 u64 x;
743 756
744 if (n > 32) 757 if (n > 32)
745 printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n", 758 hid_warn(hid, "extract() called with n (%d) > 32! (%s)\n",
746 n, current->comm); 759 n, current->comm);
747 760
748 report += offset >> 3; /* adjust byte index */ 761 report += offset >> 3; /* adjust byte index */
749 offset &= 7; /* now only need bit offset into one byte */ 762 offset &= 7; /* now only need bit offset into one byte */
@@ -760,18 +773,19 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
760 * endianness of register values by considering a register 773 * endianness of register values by considering a register
761 * a "cached" copy of the little endiad bit stream. 774 * a "cached" copy of the little endiad bit stream.
762 */ 775 */
763static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 776static void implement(const struct hid_device *hid, __u8 *report,
777 unsigned offset, unsigned n, __u32 value)
764{ 778{
765 u64 x; 779 u64 x;
766 u64 m = (1ULL << n) - 1; 780 u64 m = (1ULL << n) - 1;
767 781
768 if (n > 32) 782 if (n > 32)
769 printk(KERN_WARNING "HID: implement() called with n (%d) > 32! (%s)\n", 783 hid_warn(hid, "%s() called with n (%d) > 32! (%s)\n",
770 n, current->comm); 784 __func__, n, current->comm);
771 785
772 if (value > m) 786 if (value > m)
773 printk(KERN_WARNING "HID: implement() called with too large value %d! (%s)\n", 787 hid_warn(hid, "%s() called with too large value %d! (%s)\n",
774 value, current->comm); 788 __func__, value, current->comm);
775 WARN_ON(value > m); 789 WARN_ON(value > m);
776 value &= m; 790 value &= m;
777 791
@@ -788,7 +802,7 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3
788 * Search an array for a value. 802 * Search an array for a value.
789 */ 803 */
790 804
791static __inline__ int search(__s32 *array, __s32 value, unsigned n) 805static int search(__s32 *array, __s32 value, unsigned n)
792{ 806{
793 while (n--) { 807 while (n--) {
794 if (*array++ == value) 808 if (*array++ == value)
@@ -887,18 +901,22 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field,
887 __s32 max = field->logical_maximum; 901 __s32 max = field->logical_maximum;
888 __s32 *value; 902 __s32 *value;
889 903
890 if (!(value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC))) 904 value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC);
905 if (!value)
891 return; 906 return;
892 907
893 for (n = 0; n < count; n++) { 908 for (n = 0; n < count; n++) {
894 909
895 value[n] = min < 0 ? snto32(extract(data, offset + n * size, size), size) : 910 value[n] = min < 0 ?
896 extract(data, offset + n * size, size); 911 snto32(extract(hid, data, offset + n * size, size),
912 size) :
913 extract(hid, data, offset + n * size, size);
897 914
898 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) /* Ignore report if ErrorRollOver */ 915 /* Ignore report if ErrorRollOver */
899 && value[n] >= min && value[n] <= max 916 if (!(field->flags & HID_MAIN_ITEM_VARIABLE) &&
900 && field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) 917 value[n] >= min && value[n] <= max &&
901 goto exit; 918 field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1)
919 goto exit;
902 } 920 }
903 921
904 for (n = 0; n < count; n++) { 922 for (n = 0; n < count; n++) {
@@ -928,7 +946,8 @@ exit:
928 * Output the field into the report. 946 * Output the field into the report.
929 */ 947 */
930 948
931static void hid_output_field(struct hid_field *field, __u8 *data) 949static void hid_output_field(const struct hid_device *hid,
950 struct hid_field *field, __u8 *data)
932{ 951{
933 unsigned count = field->report_count; 952 unsigned count = field->report_count;
934 unsigned offset = field->report_offset; 953 unsigned offset = field->report_offset;
@@ -937,9 +956,11 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
937 956
938 for (n = 0; n < count; n++) { 957 for (n = 0; n < count; n++) {
939 if (field->logical_minimum < 0) /* signed values */ 958 if (field->logical_minimum < 0) /* signed values */
940 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 959 implement(hid, data, offset + n * size, size,
960 s32ton(field->value[n], size));
941 else /* unsigned values */ 961 else /* unsigned values */
942 implement(data, offset + n * size, size, field->value[n]); 962 implement(hid, data, offset + n * size, size,
963 field->value[n]);
943 } 964 }
944} 965}
945 966
@@ -956,7 +977,7 @@ void hid_output_report(struct hid_report *report, __u8 *data)
956 977
957 memset(data, 0, ((report->size - 1) >> 3) + 1); 978 memset(data, 0, ((report->size - 1) >> 3) + 1);
958 for (n = 0; n < report->maxfield; n++) 979 for (n = 0; n < report->maxfield; n++)
959 hid_output_field(report->field[n], data); 980 hid_output_field(report->device, report->field[n], data);
960} 981}
961EXPORT_SYMBOL_GPL(hid_output_report); 982EXPORT_SYMBOL_GPL(hid_output_report);
962 983
@@ -1169,8 +1190,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1169 hdev->claimed |= HID_CLAIMED_HIDRAW; 1190 hdev->claimed |= HID_CLAIMED_HIDRAW;
1170 1191
1171 if (!hdev->claimed) { 1192 if (!hdev->claimed) {
1172 dev_err(&hdev->dev, "claimed by neither input, hiddev nor " 1193 hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n");
1173 "hidraw\n");
1174 return -ENODEV; 1194 return -ENODEV;
1175 } 1195 }
1176 1196
@@ -1210,9 +1230,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1210 bus = "<UNKNOWN>"; 1230 bus = "<UNKNOWN>";
1211 } 1231 }
1212 1232
1213 dev_info(&hdev->dev, "%s: %s HID v%x.%02x %s [%s] on %s\n", 1233 hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
1214 buf, bus, hdev->version >> 8, hdev->version & 0xff, 1234 buf, bus, hdev->version >> 8, hdev->version & 0xff,
1215 type, hdev->name, hdev->phys); 1235 type, hdev->name, hdev->phys);
1216 1236
1217 return 0; 1237 return 0;
1218} 1238}
@@ -1230,7 +1250,7 @@ void hid_disconnect(struct hid_device *hdev)
1230EXPORT_SYMBOL_GPL(hid_disconnect); 1250EXPORT_SYMBOL_GPL(hid_disconnect);
1231 1251
1232/* a list of devices for which there is a specialized driver on HID bus */ 1252/* a list of devices for which there is a specialized driver on HID bus */
1233static const struct hid_device_id hid_blacklist[] = { 1253static const struct hid_device_id hid_have_special_driver[] = {
1234 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) }, 1254 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M1968) },
1235 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, 1255 { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) },
1236 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1256 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
@@ -1276,6 +1296,12 @@ static const struct hid_device_id hid_blacklist[] = {
1276 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1277 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1278 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1279 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1305 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1280 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1281 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, 1307 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1292,6 +1318,7 @@ static const struct hid_device_id hid_blacklist[] = {
1292 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1318 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1293 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, 1319 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1320 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1321 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 1322 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1323 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1324 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
@@ -1301,6 +1328,7 @@ static const struct hid_device_id hid_blacklist[] = {
1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1328 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 1329 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1330 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
1331 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1332 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1305 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1333 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1306 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1334 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
@@ -1496,9 +1524,9 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
1496 if (!hid_match_device(hdev, hdrv)) 1524 if (!hid_match_device(hdev, hdrv))
1497 return 0; 1525 return 0;
1498 1526
1499 /* generic wants all non-blacklisted */ 1527 /* generic wants all that don't have specialized driver */
1500 if (!strncmp(hdrv->name, "generic-", 8)) 1528 if (!strncmp(hdrv->name, "generic-", 8))
1501 return !hid_match_id(hdev, hid_blacklist); 1529 return !hid_match_id(hdev, hid_have_special_driver);
1502 1530
1503 return 1; 1531 return 1;
1504} 1532}
@@ -1757,6 +1785,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1757 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) }, 1785 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1758 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) }, 1786 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1759 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) }, 1787 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1788 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
1789 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
1790 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
1791 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
1792 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
1793 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
1760 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1794 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1761 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1795 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1762 { } 1796 { }
@@ -1948,12 +1982,12 @@ static int __init hid_init(void)
1948 int ret; 1982 int ret;
1949 1983
1950 if (hid_debug) 1984 if (hid_debug)
1951 printk(KERN_WARNING "HID: hid_debug is now used solely for parser and driver debugging.\n" 1985 pr_warn("hid_debug is now used solely for parser and driver debugging.\n"
1952 "HID: debugfs is now used for inspecting the device (report descriptor, reports)\n"); 1986 "debugfs is now used for inspecting the device (report descriptor, reports)\n");
1953 1987
1954 ret = bus_register(&hid_bus_type); 1988 ret = bus_register(&hid_bus_type);
1955 if (ret) { 1989 if (ret) {
1956 printk(KERN_ERR "HID: can't register hid bus\n"); 1990 pr_err("can't register hid bus\n");
1957 goto err; 1991 goto err;
1958 } 1992 }
1959 1993
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index 4cd0e2345991..2f0be4c66af7 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -107,13 +107,13 @@ static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id)
107 107
108 ret = hid_parse(hdev); 108 ret = hid_parse(hdev);
109 if (ret) { 109 if (ret) {
110 dev_err(&hdev->dev, "parse failed\n"); 110 hid_err(hdev, "parse failed\n");
111 goto err_free; 111 goto err_free;
112 } 112 }
113 113
114 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 114 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
115 if (ret) { 115 if (ret) {
116 dev_err(&hdev->dev, "hw start failed\n"); 116 hid_err(hdev, "hw start failed\n");
117 goto err_free; 117 goto err_free;
118 } 118 }
119 119
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 75c5e23d09d2..555382fc7417 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -26,6 +26,8 @@
26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 26 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
27 */ 27 */
28 28
29#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
29#include <linux/debugfs.h> 31#include <linux/debugfs.h>
30#include <linux/seq_file.h> 32#include <linux/seq_file.h>
31#include <linux/sched.h> 33#include <linux/sched.h>
@@ -393,7 +395,7 @@ char *hid_resolv_usage(unsigned usage, struct seq_file *f) {
393 395
394 buf = resolv_usage_page(usage >> 16, f); 396 buf = resolv_usage_page(usage >> 16, f);
395 if (IS_ERR(buf)) { 397 if (IS_ERR(buf)) {
396 printk(KERN_ERR "error allocating HID debug buffer\n"); 398 pr_err("error allocating HID debug buffer\n");
397 return NULL; 399 return NULL;
398 } 400 }
399 401
diff --git a/drivers/hid/hid-drff.c b/drivers/hid/hid-drff.c
index 968b04f9b796..afcf3d67eb02 100644
--- a/drivers/hid/hid-drff.c
+++ b/drivers/hid/hid-drff.c
@@ -96,18 +96,18 @@ static int drff_init(struct hid_device *hid)
96 int error; 96 int error;
97 97
98 if (list_empty(report_list)) { 98 if (list_empty(report_list)) {
99 dev_err(&hid->dev, "no output reports found\n"); 99 hid_err(hid, "no output reports found\n");
100 return -ENODEV; 100 return -ENODEV;
101 } 101 }
102 102
103 report = list_first_entry(report_list, struct hid_report, list); 103 report = list_first_entry(report_list, struct hid_report, list);
104 if (report->maxfield < 1) { 104 if (report->maxfield < 1) {
105 dev_err(&hid->dev, "no fields in the report\n"); 105 hid_err(hid, "no fields in the report\n");
106 return -ENODEV; 106 return -ENODEV;
107 } 107 }
108 108
109 if (report->field[0]->report_count < 7) { 109 if (report->field[0]->report_count < 7) {
110 dev_err(&hid->dev, "not enough values in the field\n"); 110 hid_err(hid, "not enough values in the field\n");
111 return -ENODEV; 111 return -ENODEV;
112 } 112 }
113 113
@@ -133,8 +133,8 @@ static int drff_init(struct hid_device *hid)
133 drff->report->field[0]->value[6] = 0x00; 133 drff->report->field[0]->value[6] = 0x00;
134 usbhid_submit_report(hid, drff->report, USB_DIR_OUT); 134 usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
135 135
136 dev_info(&hid->dev, "Force Feedback for DragonRise Inc. game " 136 hid_info(hid, "Force Feedback for DragonRise Inc. "
137 "controllers by Richard Walmsley <richwalm@gmail.com>\n"); 137 "game controllers by Richard Walmsley <richwalm@gmail.com>\n");
138 138
139 return 0; 139 return 0;
140} 140}
@@ -153,13 +153,13 @@ static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id)
153 153
154 ret = hid_parse(hdev); 154 ret = hid_parse(hdev);
155 if (ret) { 155 if (ret) {
156 dev_err(&hdev->dev, "parse failed\n"); 156 hid_err(hdev, "parse failed\n");
157 goto err; 157 goto err;
158 } 158 }
159 159
160 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 160 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
161 if (ret) { 161 if (ret) {
162 dev_err(&hdev->dev, "hw start failed\n"); 162 hid_err(hdev, "hw start failed\n");
163 goto err; 163 goto err;
164 } 164 }
165 165
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c
index 5a1b52e0eb85..72b1dd8d16ce 100644
--- a/drivers/hid/hid-egalax.c
+++ b/drivers/hid/hid-egalax.c
@@ -223,7 +223,7 @@ static int egalax_probe(struct hid_device *hdev, const struct hid_device_id *id)
223 223
224 td = kzalloc(sizeof(struct egalax_data), GFP_KERNEL); 224 td = kzalloc(sizeof(struct egalax_data), GFP_KERNEL);
225 if (!td) { 225 if (!td) {
226 dev_err(&hdev->dev, "cannot allocate eGalax data\n"); 226 hid_err(hdev, "cannot allocate eGalax data\n");
227 return -ENOMEM; 227 return -ENOMEM;
228 } 228 }
229 hid_set_drvdata(hdev, td); 229 hid_set_drvdata(hdev, td);
diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c
index 6e31f305397d..79d0c61e7214 100644
--- a/drivers/hid/hid-elecom.c
+++ b/drivers/hid/hid-elecom.c
@@ -24,8 +24,7 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
24 unsigned int *rsize) 24 unsigned int *rsize)
25{ 25{
26 if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { 26 if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
27 dev_info(&hdev->dev, "Fixing up Elecom BM084 " 27 hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n");
28 "report descriptor.\n");
29 rdesc[47] = 0x00; 28 rdesc[47] = 0x00;
30 } 29 }
31 return rdesc; 30 return rdesc;
diff --git a/drivers/hid/hid-emsff.c b/drivers/hid/hid-emsff.c
new file mode 100644
index 000000000000..81877c67caea
--- /dev/null
+++ b/drivers/hid/hid-emsff.c
@@ -0,0 +1,161 @@
1/*
2 * Force feedback support for EMS Trio Linker Plus II
3 *
4 * Copyright (c) 2010 Ignaz Forster <ignaz.forster@gmx.de>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
24#include <linux/hid.h>
25#include <linux/input.h>
26#include <linux/usb.h>
27
28#include "hid-ids.h"
29#include "usbhid/usbhid.h"
30
31struct emsff_device {
32 struct hid_report *report;
33};
34
35static int emsff_play(struct input_dev *dev, void *data,
36 struct ff_effect *effect)
37{
38 struct hid_device *hid = input_get_drvdata(dev);
39 struct emsff_device *emsff = data;
40 int weak, strong;
41
42 weak = effect->u.rumble.weak_magnitude;
43 strong = effect->u.rumble.strong_magnitude;
44
45 dbg_hid("called with 0x%04x 0x%04x\n", strong, weak);
46
47 weak = weak * 0xff / 0xffff;
48 strong = strong * 0xff / 0xffff;
49
50 emsff->report->field[0]->value[1] = weak;
51 emsff->report->field[0]->value[2] = strong;
52
53 dbg_hid("running with 0x%02x 0x%02x\n", strong, weak);
54 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
55
56 return 0;
57}
58
59static int emsff_init(struct hid_device *hid)
60{
61 struct emsff_device *emsff;
62 struct hid_report *report;
63 struct hid_input *hidinput = list_first_entry(&hid->inputs,
64 struct hid_input, list);
65 struct list_head *report_list =
66 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
67 struct input_dev *dev = hidinput->input;
68 int error;
69
70 if (list_empty(report_list)) {
71 hid_err(hid, "no output reports found\n");
72 return -ENODEV;
73 }
74
75 report = list_first_entry(report_list, struct hid_report, list);
76 if (report->maxfield < 1) {
77 hid_err(hid, "no fields in the report\n");
78 return -ENODEV;
79 }
80
81 if (report->field[0]->report_count < 7) {
82 hid_err(hid, "not enough values in the field\n");
83 return -ENODEV;
84 }
85
86 emsff = kzalloc(sizeof(struct emsff_device), GFP_KERNEL);
87 if (!emsff)
88 return -ENOMEM;
89
90 set_bit(FF_RUMBLE, dev->ffbit);
91
92 error = input_ff_create_memless(dev, emsff, emsff_play);
93 if (error) {
94 kfree(emsff);
95 return error;
96 }
97
98 emsff->report = report;
99 emsff->report->field[0]->value[0] = 0x01;
100 emsff->report->field[0]->value[1] = 0x00;
101 emsff->report->field[0]->value[2] = 0x00;
102 emsff->report->field[0]->value[3] = 0x00;
103 emsff->report->field[0]->value[4] = 0x00;
104 emsff->report->field[0]->value[5] = 0x00;
105 emsff->report->field[0]->value[6] = 0x00;
106 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
107
108 hid_info(hid, "force feedback for EMS based devices by Ignaz Forster <ignaz.forster@gmx.de>\n");
109
110 return 0;
111}
112
113static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
114{
115 int ret;
116
117 ret = hid_parse(hdev);
118 if (ret) {
119 hid_err(hdev, "parse failed\n");
120 goto err;
121 }
122
123 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
124 if (ret) {
125 hid_err(hdev, "hw start failed\n");
126 goto err;
127 }
128
129 emsff_init(hdev);
130
131 return 0;
132err:
133 return ret;
134}
135
136static const struct hid_device_id ems_devices[] = {
137 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, 0x118) },
138 { }
139};
140MODULE_DEVICE_TABLE(hid, ems_devices);
141
142static struct hid_driver ems_driver = {
143 .name = "hkems",
144 .id_table = ems_devices,
145 .probe = ems_probe,
146};
147
148static int ems_init(void)
149{
150 return hid_register_driver(&ems_driver);
151}
152
153static void ems_exit(void)
154{
155 hid_unregister_driver(&ems_driver);
156}
157
158module_init(ems_init);
159module_exit(ems_exit);
160MODULE_LICENSE("GPL");
161
diff --git a/drivers/hid/hid-gaff.c b/drivers/hid/hid-gaff.c
index 88dfcf49a5d7..279ba530003c 100644
--- a/drivers/hid/hid-gaff.c
+++ b/drivers/hid/hid-gaff.c
@@ -87,7 +87,7 @@ static int gaff_init(struct hid_device *hid)
87 int error; 87 int error;
88 88
89 if (list_empty(report_list)) { 89 if (list_empty(report_list)) {
90 dev_err(&hid->dev, "no output reports found\n"); 90 hid_err(hid, "no output reports found\n");
91 return -ENODEV; 91 return -ENODEV;
92 } 92 }
93 93
@@ -95,12 +95,12 @@ static int gaff_init(struct hid_device *hid)
95 95
96 report = list_entry(report_ptr, struct hid_report, list); 96 report = list_entry(report_ptr, struct hid_report, list);
97 if (report->maxfield < 1) { 97 if (report->maxfield < 1) {
98 dev_err(&hid->dev, "no fields in the report\n"); 98 hid_err(hid, "no fields in the report\n");
99 return -ENODEV; 99 return -ENODEV;
100 } 100 }
101 101
102 if (report->field[0]->report_count < 6) { 102 if (report->field[0]->report_count < 6) {
103 dev_err(&hid->dev, "not enough values in the field\n"); 103 hid_err(hid, "not enough values in the field\n");
104 return -ENODEV; 104 return -ENODEV;
105 } 105 }
106 106
@@ -128,8 +128,7 @@ static int gaff_init(struct hid_device *hid)
128 128
129 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT); 129 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
130 130
131 dev_info(&hid->dev, "Force Feedback for GreenAsia 0x12" 131 hid_info(hid, "Force Feedback for GreenAsia 0x12 devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
132 " devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
133 132
134 return 0; 133 return 0;
135} 134}
@@ -148,13 +147,13 @@ static int ga_probe(struct hid_device *hdev, const struct hid_device_id *id)
148 147
149 ret = hid_parse(hdev); 148 ret = hid_parse(hdev);
150 if (ret) { 149 if (ret) {
151 dev_err(&hdev->dev, "parse failed\n"); 150 hid_err(hdev, "parse failed\n");
152 goto err; 151 goto err;
153 } 152 }
154 153
155 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 154 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
156 if (ret) { 155 if (ret) {
157 dev_err(&hdev->dev, "hw start failed\n"); 156 hid_err(hdev, "hw start failed\n");
158 goto err; 157 goto err;
159 } 158 }
160 159
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3341baa86a30..5cd1a6a356a3 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -97,6 +97,12 @@
97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 97#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 98#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 99#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
100#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
101#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
102#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
103#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
104#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
105#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
100#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 106#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
101#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a 107#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
102#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b 108#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
@@ -156,6 +162,7 @@
156#define USB_VENDOR_ID_CHICONY 0x04f2 162#define USB_VENDOR_ID_CHICONY 0x04f2
157#define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 163#define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
158#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d 164#define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d
165#define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
159 166
160#define USB_VENDOR_ID_CIDC 0x1677 167#define USB_VENDOR_ID_CIDC 0x1677
161 168
@@ -203,6 +210,9 @@
203#define USB_VENDOR_ID_ELO 0x04E7 210#define USB_VENDOR_ID_ELO 0x04E7
204#define USB_DEVICE_ID_ELO_TS2700 0x0020 211#define USB_DEVICE_ID_ELO_TS2700 0x0020
205 212
213#define USB_VENDOR_ID_EMS 0x2006
214#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
215
206#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 216#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
207#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 217#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
208 218
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index d8d372bae3cc..e60fdb88101f 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -319,21 +319,21 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
319 319
320 switch (field->application) { 320 switch (field->application) {
321 case HID_GD_MOUSE: 321 case HID_GD_MOUSE:
322 case HID_GD_POINTER: code += 0x110; break; 322 case HID_GD_POINTER: code += BTN_MOUSE; break;
323 case HID_GD_JOYSTICK: 323 case HID_GD_JOYSTICK:
324 if (code <= 0xf) 324 if (code <= 0xf)
325 code += BTN_JOYSTICK; 325 code += BTN_JOYSTICK;
326 else 326 else
327 code += BTN_TRIGGER_HAPPY; 327 code += BTN_TRIGGER_HAPPY;
328 break; 328 break;
329 case HID_GD_GAMEPAD: code += 0x130; break; 329 case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break;
330 default: 330 default:
331 switch (field->physical) { 331 switch (field->physical) {
332 case HID_GD_MOUSE: 332 case HID_GD_MOUSE:
333 case HID_GD_POINTER: code += 0x110; break; 333 case HID_GD_POINTER: code += BTN_MOUSE; break;
334 case HID_GD_JOYSTICK: code += 0x120; break; 334 case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break;
335 case HID_GD_GAMEPAD: code += 0x130; break; 335 case HID_GD_GAMEPAD: code += BTN_GAMEPAD; break;
336 default: code += 0x100; 336 default: code += BTN_MISC;
337 } 337 }
338 } 338 }
339 339
@@ -817,14 +817,14 @@ static int hidinput_open(struct input_dev *dev)
817{ 817{
818 struct hid_device *hid = input_get_drvdata(dev); 818 struct hid_device *hid = input_get_drvdata(dev);
819 819
820 return hid->ll_driver->open(hid); 820 return hid_hw_open(hid);
821} 821}
822 822
823static void hidinput_close(struct input_dev *dev) 823static void hidinput_close(struct input_dev *dev)
824{ 824{
825 struct hid_device *hid = input_get_drvdata(dev); 825 struct hid_device *hid = input_get_drvdata(dev);
826 826
827 hid->ll_driver->close(hid); 827 hid_hw_close(hid);
828} 828}
829 829
830/* 830/*
@@ -871,7 +871,7 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
871 if (!hidinput || !input_dev) { 871 if (!hidinput || !input_dev) {
872 kfree(hidinput); 872 kfree(hidinput);
873 input_free_device(input_dev); 873 input_free_device(input_dev);
874 err_hid("Out of memory during hid input probe"); 874 hid_err(hid, "Out of memory during hid input probe\n");
875 goto out_unwind; 875 goto out_unwind;
876 } 876 }
877 877
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
index 817247ee006c..f2ba9efc3a53 100644
--- a/drivers/hid/hid-kye.c
+++ b/drivers/hid/hid-kye.c
@@ -32,8 +32,8 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
32 rdesc[65] == 0x29 && rdesc[66] == 0x0f && 32 rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
33 rdesc[71] == 0x75 && rdesc[72] == 0x08 && 33 rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
34 rdesc[73] == 0x95 && rdesc[74] == 0x01) { 34 rdesc[73] == 0x95 && rdesc[74] == 0x01) {
35 dev_info(&hdev->dev, "fixing up Kye/Genius Ergo Mouse report " 35 hid_info(hdev,
36 "descriptor\n"); 36 "fixing up Kye/Genius Ergo Mouse report descriptor\n");
37 rdesc[62] = 0x09; 37 rdesc[62] = 0x09;
38 rdesc[64] = 0x04; 38 rdesc[64] = 0x04;
39 rdesc[66] = 0x07; 39 rdesc[66] = 0x07;
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index b629fba5a057..aef4104da141 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -53,23 +53,22 @@ static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
53 53
54 if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && 54 if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
55 rdesc[84] == 0x8c && rdesc[85] == 0x02) { 55 rdesc[84] == 0x8c && rdesc[85] == 0x02) {
56 dev_info(&hdev->dev, "fixing up Logitech keyboard report " 56 hid_info(hdev,
57 "descriptor\n"); 57 "fixing up Logitech keyboard report descriptor\n");
58 rdesc[84] = rdesc[89] = 0x4d; 58 rdesc[84] = rdesc[89] = 0x4d;
59 rdesc[85] = rdesc[90] = 0x10; 59 rdesc[85] = rdesc[90] = 0x10;
60 } 60 }
61 if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && 61 if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 &&
62 rdesc[32] == 0x81 && rdesc[33] == 0x06 && 62 rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
63 rdesc[49] == 0x81 && rdesc[50] == 0x06) { 63 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
64 dev_info(&hdev->dev, "fixing up rel/abs in Logitech " 64 hid_info(hdev,
65 "report descriptor\n"); 65 "fixing up rel/abs in Logitech report descriptor\n");
66 rdesc[33] = rdesc[50] = 0x02; 66 rdesc[33] = rdesc[50] = 0x02;
67 } 67 }
68 if ((quirks & LG_FF4) && *rsize >= 101 && 68 if ((quirks & LG_FF4) && *rsize >= 101 &&
69 rdesc[41] == 0x95 && rdesc[42] == 0x0B && 69 rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
70 rdesc[47] == 0x05 && rdesc[48] == 0x09) { 70 rdesc[47] == 0x05 && rdesc[48] == 0x09) {
71 dev_info(&hdev->dev, "fixing up Logitech Speed Force Wireless " 71 hid_info(hdev, "fixing up Logitech Speed Force Wireless button descriptor\n");
72 "button descriptor\n");
73 rdesc[41] = 0x05; 72 rdesc[41] = 0x05;
74 rdesc[42] = 0x09; 73 rdesc[42] = 0x09;
75 rdesc[47] = 0x95; 74 rdesc[47] = 0x95;
@@ -288,7 +287,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
288 287
289 ret = hid_parse(hdev); 288 ret = hid_parse(hdev);
290 if (ret) { 289 if (ret) {
291 dev_err(&hdev->dev, "parse failed\n"); 290 hid_err(hdev, "parse failed\n");
292 goto err_free; 291 goto err_free;
293 } 292 }
294 293
@@ -297,7 +296,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
297 296
298 ret = hid_hw_start(hdev, connect_mask); 297 ret = hid_hw_start(hdev, connect_mask);
299 if (ret) { 298 if (ret) {
300 dev_err(&hdev->dev, "hw start failed\n"); 299 hid_err(hdev, "hw start failed\n");
301 goto err_free; 300 goto err_free;
302 } 301 }
303 302
diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c
index 4258253c36b3..3c31bc650e5d 100644
--- a/drivers/hid/hid-lg2ff.c
+++ b/drivers/hid/hid-lg2ff.c
@@ -72,18 +72,18 @@ int lg2ff_init(struct hid_device *hid)
72 int error; 72 int error;
73 73
74 if (list_empty(report_list)) { 74 if (list_empty(report_list)) {
75 dev_err(&hid->dev, "no output report found\n"); 75 hid_err(hid, "no output report found\n");
76 return -ENODEV; 76 return -ENODEV;
77 } 77 }
78 78
79 report = list_entry(report_list->next, struct hid_report, list); 79 report = list_entry(report_list->next, struct hid_report, list);
80 80
81 if (report->maxfield < 1) { 81 if (report->maxfield < 1) {
82 dev_err(&hid->dev, "output report is empty\n"); 82 hid_err(hid, "output report is empty\n");
83 return -ENODEV; 83 return -ENODEV;
84 } 84 }
85 if (report->field[0]->report_count < 7) { 85 if (report->field[0]->report_count < 7) {
86 dev_err(&hid->dev, "not enough values in the field\n"); 86 hid_err(hid, "not enough values in the field\n");
87 return -ENODEV; 87 return -ENODEV;
88 } 88 }
89 89
@@ -110,8 +110,7 @@ int lg2ff_init(struct hid_device *hid)
110 110
111 usbhid_submit_report(hid, report, USB_DIR_OUT); 111 usbhid_submit_report(hid, report, USB_DIR_OUT);
112 112
113 dev_info(&hid->dev, "Force feedback for Logitech RumblePad/Rumblepad 2 by " 113 hid_info(hid, "Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.hannula@gmail.com>\n");
114 "Anssi Hannula <anssi.hannula@gmail.com>\n");
115 114
116 return 0; 115 return 0;
117} 116}
diff --git a/drivers/hid/hid-lg3ff.c b/drivers/hid/hid-lg3ff.c
index 4002832ee4af..f98644c26c1d 100644
--- a/drivers/hid/hid-lg3ff.c
+++ b/drivers/hid/hid-lg3ff.c
@@ -141,20 +141,20 @@ int lg3ff_init(struct hid_device *hid)
141 141
142 /* Find the report to use */ 142 /* Find the report to use */
143 if (list_empty(report_list)) { 143 if (list_empty(report_list)) {
144 err_hid("No output report found"); 144 hid_err(hid, "No output report found\n");
145 return -1; 145 return -1;
146 } 146 }
147 147
148 /* Check that the report looks ok */ 148 /* Check that the report looks ok */
149 report = list_entry(report_list->next, struct hid_report, list); 149 report = list_entry(report_list->next, struct hid_report, list);
150 if (!report) { 150 if (!report) {
151 err_hid("NULL output report"); 151 hid_err(hid, "NULL output report\n");
152 return -1; 152 return -1;
153 } 153 }
154 154
155 field = report->field[0]; 155 field = report->field[0];
156 if (!field) { 156 if (!field) {
157 err_hid("NULL field"); 157 hid_err(hid, "NULL field\n");
158 return -1; 158 return -1;
159 } 159 }
160 160
@@ -169,8 +169,7 @@ int lg3ff_init(struct hid_device *hid)
169 if (test_bit(FF_AUTOCENTER, dev->ffbit)) 169 if (test_bit(FF_AUTOCENTER, dev->ffbit))
170 dev->ff->set_autocenter = hid_lg3ff_set_autocenter; 170 dev->ff->set_autocenter = hid_lg3ff_set_autocenter;
171 171
172 dev_info(&hid->dev, "Force feedback for Logitech Flight System G940 by " 172 hid_info(hid, "Force feedback for Logitech Flight System G940 by Gary Stein <LordCnidarian@gmail.com>\n");
173 "Gary Stein <LordCnidarian@gmail.com>\n");
174 return 0; 173 return 0;
175} 174}
176 175
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 7eef5a2ce948..fa550c8e1d1b 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -101,20 +101,20 @@ int lg4ff_init(struct hid_device *hid)
101 101
102 /* Find the report to use */ 102 /* Find the report to use */
103 if (list_empty(report_list)) { 103 if (list_empty(report_list)) {
104 err_hid("No output report found"); 104 hid_err(hid, "No output report found\n");
105 return -1; 105 return -1;
106 } 106 }
107 107
108 /* Check that the report looks ok */ 108 /* Check that the report looks ok */
109 report = list_entry(report_list->next, struct hid_report, list); 109 report = list_entry(report_list->next, struct hid_report, list);
110 if (!report) { 110 if (!report) {
111 err_hid("NULL output report"); 111 hid_err(hid, "NULL output report\n");
112 return -1; 112 return -1;
113 } 113 }
114 114
115 field = report->field[0]; 115 field = report->field[0];
116 if (!field) { 116 if (!field) {
117 err_hid("NULL field"); 117 hid_err(hid, "NULL field\n");
118 return -1; 118 return -1;
119 } 119 }
120 120
@@ -129,8 +129,7 @@ int lg4ff_init(struct hid_device *hid)
129 if (test_bit(FF_AUTOCENTER, dev->ffbit)) 129 if (test_bit(FF_AUTOCENTER, dev->ffbit))
130 dev->ff->set_autocenter = hid_lg4ff_set_autocenter; 130 dev->ff->set_autocenter = hid_lg4ff_set_autocenter;
131 131
132 dev_info(&hid->dev, "Force feedback for Logitech Speed Force Wireless by " 132 hid_info(hid, "Force feedback for Logitech Speed Force Wireless by Simon Wood <simon@mungewell.org>\n");
133 "Simon Wood <simon@mungewell.org>\n");
134 return 0; 133 return 0;
135} 134}
136 135
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c
index 61142b76a9b1..90d0ef2c92be 100644
--- a/drivers/hid/hid-lgff.c
+++ b/drivers/hid/hid-lgff.c
@@ -27,6 +27,8 @@
27 * e-mail - mail your message to <johann.deneux@it.uu.se> 27 * e-mail - mail your message to <johann.deneux@it.uu.se>
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#include <linux/input.h> 32#include <linux/input.h>
31#include <linux/usb.h> 33#include <linux/usb.h>
32#include <linux/hid.h> 34#include <linux/hid.h>
@@ -146,7 +148,7 @@ int lgff_init(struct hid_device* hid)
146 148
147 /* Find the report to use */ 149 /* Find the report to use */
148 if (list_empty(report_list)) { 150 if (list_empty(report_list)) {
149 err_hid("No output report found"); 151 hid_err(hid, "No output report found\n");
150 return -1; 152 return -1;
151 } 153 }
152 154
@@ -154,7 +156,7 @@ int lgff_init(struct hid_device* hid)
154 report = list_entry(report_list->next, struct hid_report, list); 156 report = list_entry(report_list->next, struct hid_report, list);
155 field = report->field[0]; 157 field = report->field[0];
156 if (!field) { 158 if (!field) {
157 err_hid("NULL field"); 159 hid_err(hid, "NULL field\n");
158 return -1; 160 return -1;
159 } 161 }
160 162
@@ -176,7 +178,7 @@ int lgff_init(struct hid_device* hid)
176 if ( test_bit(FF_AUTOCENTER, dev->ffbit) ) 178 if ( test_bit(FF_AUTOCENTER, dev->ffbit) )
177 dev->ff->set_autocenter = hid_lgff_set_autocenter; 179 dev->ff->set_autocenter = hid_lgff_set_autocenter;
178 180
179 printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n"); 181 pr_info("Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n");
180 182
181 return 0; 183 return 0;
182} 184}
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index ed732b746c96..698e6459fd0b 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -12,6 +12,8 @@
12 * any later version. 12 * any later version.
13 */ 13 */
14 14
15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16
15#include <linux/device.h> 17#include <linux/device.h>
16#include <linux/hid.h> 18#include <linux/hid.h>
17#include <linux/module.h> 19#include <linux/module.h>
@@ -451,7 +453,7 @@ static int magicmouse_probe(struct hid_device *hdev,
451 453
452 msc = kzalloc(sizeof(*msc), GFP_KERNEL); 454 msc = kzalloc(sizeof(*msc), GFP_KERNEL);
453 if (msc == NULL) { 455 if (msc == NULL) {
454 dev_err(&hdev->dev, "can't alloc magicmouse descriptor\n"); 456 hid_err(hdev, "can't alloc magicmouse descriptor\n");
455 return -ENOMEM; 457 return -ENOMEM;
456 } 458 }
457 459
@@ -464,13 +466,13 @@ static int magicmouse_probe(struct hid_device *hdev,
464 466
465 ret = hid_parse(hdev); 467 ret = hid_parse(hdev);
466 if (ret) { 468 if (ret) {
467 dev_err(&hdev->dev, "magicmouse hid parse failed\n"); 469 hid_err(hdev, "magicmouse hid parse failed\n");
468 goto err_free; 470 goto err_free;
469 } 471 }
470 472
471 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 473 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
472 if (ret) { 474 if (ret) {
473 dev_err(&hdev->dev, "magicmouse hw start failed\n"); 475 hid_err(hdev, "magicmouse hw start failed\n");
474 goto err_free; 476 goto err_free;
475 } 477 }
476 478
@@ -491,7 +493,7 @@ static int magicmouse_probe(struct hid_device *hdev,
491 } 493 }
492 494
493 if (!report) { 495 if (!report) {
494 dev_err(&hdev->dev, "unable to register touch report\n"); 496 hid_err(hdev, "unable to register touch report\n");
495 ret = -ENOMEM; 497 ret = -ENOMEM;
496 goto err_stop_hw; 498 goto err_stop_hw;
497 } 499 }
@@ -500,8 +502,7 @@ static int magicmouse_probe(struct hid_device *hdev,
500 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), 502 ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
501 HID_FEATURE_REPORT); 503 HID_FEATURE_REPORT);
502 if (ret != sizeof(feature)) { 504 if (ret != sizeof(feature)) {
503 dev_err(&hdev->dev, "unable to request touch data (%d)\n", 505 hid_err(hdev, "unable to request touch data (%d)\n", ret);
504 ret);
505 goto err_stop_hw; 506 goto err_stop_hw;
506 } 507 }
507 508
@@ -545,7 +546,7 @@ static int __init magicmouse_init(void)
545 546
546 ret = hid_register_driver(&magicmouse_driver); 547 ret = hid_register_driver(&magicmouse_driver);
547 if (ret) 548 if (ret)
548 printk(KERN_ERR "can't register magicmouse driver\n"); 549 pr_err("can't register magicmouse driver\n");
549 550
550 return ret; 551 return ret;
551} 552}
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index dc618c33d0a2..0f6fc54dc196 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -40,8 +40,7 @@ static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 40
41 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && 41 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
42 rdesc[559] == 0x29) { 42 rdesc[559] == 0x29) {
43 dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " 43 hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
44 "Model 1028 report descriptor\n");
45 rdesc[557] = 0x35; 44 rdesc[557] = 0x35;
46 rdesc[559] = 0x45; 45 rdesc[559] = 0x45;
47 } 46 }
@@ -155,14 +154,14 @@ static int ms_probe(struct hid_device *hdev, const struct hid_device_id *id)
155 154
156 ret = hid_parse(hdev); 155 ret = hid_parse(hdev);
157 if (ret) { 156 if (ret) {
158 dev_err(&hdev->dev, "parse failed\n"); 157 hid_err(hdev, "parse failed\n");
159 goto err_free; 158 goto err_free;
160 } 159 }
161 160
162 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ? 161 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | ((quirks & MS_HIDINPUT) ?
163 HID_CONNECT_HIDINPUT_FORCE : 0)); 162 HID_CONNECT_HIDINPUT_FORCE : 0));
164 if (ret) { 163 if (ret) {
165 dev_err(&hdev->dev, "hw start failed\n"); 164 hid_err(hdev, "hw start failed\n");
166 goto err_free; 165 goto err_free;
167 } 166 }
168 167
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
index c95c31e2d869..dedf757781ae 100644
--- a/drivers/hid/hid-monterey.c
+++ b/drivers/hid/hid-monterey.c
@@ -26,8 +26,7 @@ static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
26 unsigned int *rsize) 26 unsigned int *rsize)
27{ 27{
28 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { 28 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
29 dev_info(&hdev->dev, "fixing up button/consumer in HID report " 29 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n");
30 "descriptor\n");
31 rdesc[30] = 0x0c; 30 rdesc[30] = 0x0c;
32 } 31 }
33 return rdesc; 32 return rdesc;
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c
index 15d03811f96a..9fb050ce6f04 100644
--- a/drivers/hid/hid-mosart.c
+++ b/drivers/hid/hid-mosart.c
@@ -203,7 +203,7 @@ static int mosart_probe(struct hid_device *hdev, const struct hid_device_id *id)
203 203
204 td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL); 204 td = kmalloc(sizeof(struct mosart_data), GFP_KERNEL);
205 if (!td) { 205 if (!td) {
206 dev_err(&hdev->dev, "cannot allocate MosArt data\n"); 206 hid_err(hdev, "cannot allocate MosArt data\n");
207 return -ENOMEM; 207 return -ENOMEM;
208 } 208 }
209 td->valid = false; 209 td->valid = false;
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 69169efa1e16..beb403421e72 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -130,8 +130,7 @@ static void ntrig_report_version(struct hid_device *hdev)
130 if (ret == 8) { 130 if (ret == 8) {
131 ret = ntrig_version_string(&data[2], buf); 131 ret = ntrig_version_string(&data[2], buf);
132 132
133 dev_info(&hdev->dev, 133 hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n",
134 "Firmware version: %s (%02x%02x %02x%02x)\n",
135 buf, data[2], data[3], data[4], data[5]); 134 buf, data[2], data[3], data[4], data[5]);
136 } 135 }
137 136
@@ -831,7 +830,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
831 830
832 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL); 831 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
833 if (!nd) { 832 if (!nd) {
834 dev_err(&hdev->dev, "cannot allocate N-Trig data\n"); 833 hid_err(hdev, "cannot allocate N-Trig data\n");
835 return -ENOMEM; 834 return -ENOMEM;
836 } 835 }
837 836
@@ -850,13 +849,13 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
850 849
851 ret = hid_parse(hdev); 850 ret = hid_parse(hdev);
852 if (ret) { 851 if (ret) {
853 dev_err(&hdev->dev, "parse failed\n"); 852 hid_err(hdev, "parse failed\n");
854 goto err_free; 853 goto err_free;
855 } 854 }
856 855
857 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 856 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
858 if (ret) { 857 if (ret) {
859 dev_err(&hdev->dev, "hw start failed\n"); 858 hid_err(hdev, "hw start failed\n");
860 goto err_free; 859 goto err_free;
861 } 860 }
862 861
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index 2e79716dca31..e90edfc63051 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -23,8 +23,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
23 unsigned int *rsize) 23 unsigned int *rsize)
24{ 24{
25 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 25 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
26 dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " 26 hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n");
27 "report descriptor.\n");
28 rdesc[55] = 0x92; 27 rdesc[55] = 0x92;
29 } 28 }
30 return rdesc; 29 return rdesc;
diff --git a/drivers/hid/hid-petalynx.c b/drivers/hid/hid-petalynx.c
index 308d6ae48a3e..f1ea3ff8a98d 100644
--- a/drivers/hid/hid-petalynx.c
+++ b/drivers/hid/hid-petalynx.c
@@ -29,8 +29,7 @@ static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc,
29 if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && 29 if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 &&
30 rdesc[41] == 0x00 && rdesc[59] == 0x26 && 30 rdesc[41] == 0x00 && rdesc[59] == 0x26 &&
31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) { 31 rdesc[60] == 0xf9 && rdesc[61] == 0x00) {
32 dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " 32 hid_info(hdev, "fixing up Petalynx Maxter Remote report descriptor\n");
33 "descriptor\n");
34 rdesc[60] = 0xfa; 33 rdesc[60] = 0xfa;
35 rdesc[40] = 0xfa; 34 rdesc[40] = 0xfa;
36 } 35 }
@@ -77,13 +76,13 @@ static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id)
77 76
78 ret = hid_parse(hdev); 77 ret = hid_parse(hdev);
79 if (ret) { 78 if (ret) {
80 dev_err(&hdev->dev, "parse failed\n"); 79 hid_err(hdev, "parse failed\n");
81 goto err_free; 80 goto err_free;
82 } 81 }
83 82
84 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 83 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
85 if (ret) { 84 if (ret) {
86 dev_err(&hdev->dev, "hw start failed\n"); 85 hid_err(hdev, "hw start failed\n");
87 goto err_free; 86 goto err_free;
88 } 87 }
89 88
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index abd0bdc84624..de9cf21b3494 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -253,7 +253,7 @@ static struct hid_report *picolcd_report(int id, struct hid_device *hdev, int di
253 if (report->id == id) 253 if (report->id == id)
254 return report; 254 return report;
255 } 255 }
256 dev_warn(&hdev->dev, "No report with id 0x%x found\n", id); 256 hid_warn(hdev, "No report with id 0x%x found\n", id);
257 return NULL; 257 return NULL;
258} 258}
259 259
@@ -1329,7 +1329,7 @@ static int picolcd_check_version(struct hid_device *hdev)
1329 1329
1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0); 1330 verinfo = picolcd_send_and_wait(hdev, REPORT_VERSION, NULL, 0);
1331 if (!verinfo) { 1331 if (!verinfo) {
1332 dev_err(&hdev->dev, "no version response from PicoLCD"); 1332 hid_err(hdev, "no version response from PicoLCD\n");
1333 return -ENODEV; 1333 return -ENODEV;
1334 } 1334 }
1335 1335
@@ -1337,14 +1337,14 @@ static int picolcd_check_version(struct hid_device *hdev)
1337 data->version[0] = verinfo->raw_data[1]; 1337 data->version[0] = verinfo->raw_data[1];
1338 data->version[1] = verinfo->raw_data[0]; 1338 data->version[1] = verinfo->raw_data[0];
1339 if (data->status & PICOLCD_BOOTLOADER) { 1339 if (data->status & PICOLCD_BOOTLOADER) {
1340 dev_info(&hdev->dev, "PicoLCD, bootloader version %d.%d\n", 1340 hid_info(hdev, "PicoLCD, bootloader version %d.%d\n",
1341 verinfo->raw_data[1], verinfo->raw_data[0]); 1341 verinfo->raw_data[1], verinfo->raw_data[0]);
1342 } else { 1342 } else {
1343 dev_info(&hdev->dev, "PicoLCD, firmware version %d.%d\n", 1343 hid_info(hdev, "PicoLCD, firmware version %d.%d\n",
1344 verinfo->raw_data[1], verinfo->raw_data[0]); 1344 verinfo->raw_data[1], verinfo->raw_data[0]);
1345 } 1345 }
1346 } else { 1346 } else {
1347 dev_err(&hdev->dev, "confused, got unexpected version response from PicoLCD\n"); 1347 hid_err(hdev, "confused, got unexpected version response from PicoLCD\n");
1348 ret = -EINVAL; 1348 ret = -EINVAL;
1349 } 1349 }
1350 kfree(verinfo); 1350 kfree(verinfo);
@@ -2329,8 +2329,7 @@ static void picolcd_init_devfs(struct picolcd_data *data,
2329 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0), 2329 (flash_w ? S_IWUSR : 0) | (flash_r ? S_IRUSR : 0),
2330 hdev->debug_dir, data, &picolcd_debug_flash_fops); 2330 hdev->debug_dir, data, &picolcd_debug_flash_fops);
2331 } else if (flash_r || flash_w) 2331 } else if (flash_r || flash_w)
2332 dev_warn(&hdev->dev, "Unexpected FLASH access reports, " 2332 hid_warn(hdev, "Unexpected FLASH access reports, please submit rdesc for review\n");
2333 "please submit rdesc for review\n");
2334} 2333}
2335 2334
2336static void picolcd_exit_devfs(struct picolcd_data *data) 2335static void picolcd_exit_devfs(struct picolcd_data *data)
@@ -2458,13 +2457,13 @@ static int picolcd_init_keys(struct picolcd_data *data,
2458 return -ENODEV; 2457 return -ENODEV;
2459 if (report->maxfield != 1 || report->field[0]->report_count != 2 || 2458 if (report->maxfield != 1 || report->field[0]->report_count != 2 ||
2460 report->field[0]->report_size != 8) { 2459 report->field[0]->report_size != 8) {
2461 dev_err(&hdev->dev, "unsupported KEY_STATE report"); 2460 hid_err(hdev, "unsupported KEY_STATE report\n");
2462 return -EINVAL; 2461 return -EINVAL;
2463 } 2462 }
2464 2463
2465 idev = input_allocate_device(); 2464 idev = input_allocate_device();
2466 if (idev == NULL) { 2465 if (idev == NULL) {
2467 dev_err(&hdev->dev, "failed to allocate input device"); 2466 hid_err(hdev, "failed to allocate input device\n");
2468 return -ENOMEM; 2467 return -ENOMEM;
2469 } 2468 }
2470 input_set_drvdata(idev, hdev); 2469 input_set_drvdata(idev, hdev);
@@ -2486,7 +2485,7 @@ static int picolcd_init_keys(struct picolcd_data *data,
2486 input_set_capability(idev, EV_KEY, data->keycode[i]); 2485 input_set_capability(idev, EV_KEY, data->keycode[i]);
2487 error = input_register_device(idev); 2486 error = input_register_device(idev);
2488 if (error) { 2487 if (error) {
2489 dev_err(&hdev->dev, "error registering the input device"); 2488 hid_err(hdev, "error registering the input device\n");
2490 input_free_device(idev); 2489 input_free_device(idev);
2491 return error; 2490 return error;
2492 } 2491 }
@@ -2523,9 +2522,8 @@ static int picolcd_probe_lcd(struct hid_device *hdev, struct picolcd_data *data)
2523 return error; 2522 return error;
2524 2523
2525 if (data->version[0] != 0 && data->version[1] != 3) 2524 if (data->version[0] != 0 && data->version[1] != 3)
2526 dev_info(&hdev->dev, "Device with untested firmware revision, " 2525 hid_info(hdev, "Device with untested firmware revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2527 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2526 dev_name(&hdev->dev));
2528 dev_name(&hdev->dev));
2529 2527
2530 /* Setup keypad input device */ 2528 /* Setup keypad input device */
2531 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev)); 2529 error = picolcd_init_keys(data, picolcd_in_report(REPORT_KEY_STATE, hdev));
@@ -2582,9 +2580,8 @@ static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data
2582 return error; 2580 return error;
2583 2581
2584 if (data->version[0] != 1 && data->version[1] != 0) 2582 if (data->version[0] != 1 && data->version[1] != 0)
2585 dev_info(&hdev->dev, "Device with untested bootloader revision, " 2583 hid_info(hdev, "Device with untested bootloader revision, please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n",
2586 "please submit /sys/kernel/debug/hid/%s/rdesc for this device.\n", 2584 dev_name(&hdev->dev));
2587 dev_name(&hdev->dev));
2588 2585
2589 picolcd_init_devfs(data, NULL, NULL, 2586 picolcd_init_devfs(data, NULL, NULL,
2590 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), 2587 picolcd_out_report(REPORT_BL_READ_MEMORY, hdev),
@@ -2606,7 +2603,7 @@ static int picolcd_probe(struct hid_device *hdev,
2606 */ 2603 */
2607 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL); 2604 data = kzalloc(sizeof(struct picolcd_data), GFP_KERNEL);
2608 if (data == NULL) { 2605 if (data == NULL) {
2609 dev_err(&hdev->dev, "can't allocate space for Minibox PicoLCD device data\n"); 2606 hid_err(hdev, "can't allocate space for Minibox PicoLCD device data\n");
2610 error = -ENOMEM; 2607 error = -ENOMEM;
2611 goto err_no_cleanup; 2608 goto err_no_cleanup;
2612 } 2609 }
@@ -2622,7 +2619,7 @@ static int picolcd_probe(struct hid_device *hdev,
2622 /* Parse the device reports and start it up */ 2619 /* Parse the device reports and start it up */
2623 error = hid_parse(hdev); 2620 error = hid_parse(hdev);
2624 if (error) { 2621 if (error) {
2625 dev_err(&hdev->dev, "device report parse failed\n"); 2622 hid_err(hdev, "device report parse failed\n");
2626 goto err_cleanup_data; 2623 goto err_cleanup_data;
2627 } 2624 }
2628 2625
@@ -2632,25 +2629,25 @@ static int picolcd_probe(struct hid_device *hdev,
2632 error = hid_hw_start(hdev, 0); 2629 error = hid_hw_start(hdev, 0);
2633 hdev->claimed = 0; 2630 hdev->claimed = 0;
2634 if (error) { 2631 if (error) {
2635 dev_err(&hdev->dev, "hardware start failed\n"); 2632 hid_err(hdev, "hardware start failed\n");
2636 goto err_cleanup_data; 2633 goto err_cleanup_data;
2637 } 2634 }
2638 2635
2639 error = hdev->ll_driver->open(hdev); 2636 error = hid_hw_open(hdev);
2640 if (error) { 2637 if (error) {
2641 dev_err(&hdev->dev, "failed to open input interrupt pipe for key and IR events\n"); 2638 hid_err(hdev, "failed to open input interrupt pipe for key and IR events\n");
2642 goto err_cleanup_hid_hw; 2639 goto err_cleanup_hid_hw;
2643 } 2640 }
2644 2641
2645 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay); 2642 error = device_create_file(&hdev->dev, &dev_attr_operation_mode_delay);
2646 if (error) { 2643 if (error) {
2647 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2644 hid_err(hdev, "failed to create sysfs attributes\n");
2648 goto err_cleanup_hid_ll; 2645 goto err_cleanup_hid_ll;
2649 } 2646 }
2650 2647
2651 error = device_create_file(&hdev->dev, &dev_attr_operation_mode); 2648 error = device_create_file(&hdev->dev, &dev_attr_operation_mode);
2652 if (error) { 2649 if (error) {
2653 dev_err(&hdev->dev, "failed to create sysfs attributes\n"); 2650 hid_err(hdev, "failed to create sysfs attributes\n");
2654 goto err_cleanup_sysfs1; 2651 goto err_cleanup_sysfs1;
2655 } 2652 }
2656 2653
@@ -2669,7 +2666,7 @@ err_cleanup_sysfs2:
2669err_cleanup_sysfs1: 2666err_cleanup_sysfs1:
2670 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); 2667 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay);
2671err_cleanup_hid_ll: 2668err_cleanup_hid_ll:
2672 hdev->ll_driver->close(hdev); 2669 hid_hw_close(hdev);
2673err_cleanup_hid_hw: 2670err_cleanup_hid_hw:
2674 hid_hw_stop(hdev); 2671 hid_hw_stop(hdev);
2675err_cleanup_data: 2672err_cleanup_data:
@@ -2700,7 +2697,7 @@ static void picolcd_remove(struct hid_device *hdev)
2700 picolcd_exit_devfs(data); 2697 picolcd_exit_devfs(data);
2701 device_remove_file(&hdev->dev, &dev_attr_operation_mode); 2698 device_remove_file(&hdev->dev, &dev_attr_operation_mode);
2702 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay); 2699 device_remove_file(&hdev->dev, &dev_attr_operation_mode_delay);
2703 hdev->ll_driver->close(hdev); 2700 hid_hw_close(hdev);
2704 hid_hw_stop(hdev); 2701 hid_hw_stop(hdev);
2705 hid_set_drvdata(hdev, NULL); 2702 hid_set_drvdata(hdev, NULL);
2706 2703
@@ -2754,7 +2751,7 @@ static void __exit picolcd_exit(void)
2754{ 2751{
2755 hid_unregister_driver(&picolcd_driver); 2752 hid_unregister_driver(&picolcd_driver);
2756#ifdef CONFIG_HID_PICOLCD_FB 2753#ifdef CONFIG_HID_PICOLCD_FB
2757 flush_scheduled_work(); 2754 flush_work_sync(&picolcd_fb_cleanup);
2758 WARN_ON(fb_pending); 2755 WARN_ON(fb_pending);
2759#endif 2756#endif
2760} 2757}
diff --git a/drivers/hid/hid-pl.c b/drivers/hid/hid-pl.c
index 9f41e2bd8483..06e5300d43d2 100644
--- a/drivers/hid/hid-pl.c
+++ b/drivers/hid/hid-pl.c
@@ -103,7 +103,7 @@ static int plff_init(struct hid_device *hid)
103 */ 103 */
104 104
105 if (list_empty(report_list)) { 105 if (list_empty(report_list)) {
106 dev_err(&hid->dev, "no output reports found\n"); 106 hid_err(hid, "no output reports found\n");
107 return -ENODEV; 107 return -ENODEV;
108 } 108 }
109 109
@@ -112,14 +112,13 @@ static int plff_init(struct hid_device *hid)
112 report_ptr = report_ptr->next; 112 report_ptr = report_ptr->next;
113 113
114 if (report_ptr == report_list) { 114 if (report_ptr == report_list) {
115 dev_err(&hid->dev, "required output report is " 115 hid_err(hid, "required output report is missing\n");
116 "missing\n");
117 return -ENODEV; 116 return -ENODEV;
118 } 117 }
119 118
120 report = list_entry(report_ptr, struct hid_report, list); 119 report = list_entry(report_ptr, struct hid_report, list);
121 if (report->maxfield < 1) { 120 if (report->maxfield < 1) {
122 dev_err(&hid->dev, "no fields in the report\n"); 121 hid_err(hid, "no fields in the report\n");
123 return -ENODEV; 122 return -ENODEV;
124 } 123 }
125 124
@@ -137,7 +136,7 @@ static int plff_init(struct hid_device *hid)
137 weak = &report->field[3]->value[0]; 136 weak = &report->field[3]->value[0];
138 debug("detected 4-field device"); 137 debug("detected 4-field device");
139 } else { 138 } else {
140 dev_err(&hid->dev, "not enough fields or values\n"); 139 hid_err(hid, "not enough fields or values\n");
141 return -ENODEV; 140 return -ENODEV;
142 } 141 }
143 142
@@ -164,8 +163,7 @@ static int plff_init(struct hid_device *hid)
164 usbhid_submit_report(hid, plff->report, USB_DIR_OUT); 163 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
165 } 164 }
166 165
167 dev_info(&hid->dev, "Force feedback for PantherLord/GreenAsia " 166 hid_info(hid, "Force feedback for PantherLord/GreenAsia devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
168 "devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
169 167
170 return 0; 168 return 0;
171} 169}
@@ -185,13 +183,13 @@ static int pl_probe(struct hid_device *hdev, const struct hid_device_id *id)
185 183
186 ret = hid_parse(hdev); 184 ret = hid_parse(hdev);
187 if (ret) { 185 if (ret) {
188 dev_err(&hdev->dev, "parse failed\n"); 186 hid_err(hdev, "parse failed\n");
189 goto err; 187 goto err;
190 } 188 }
191 189
192 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 190 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
193 if (ret) { 191 if (ret) {
194 dev_err(&hdev->dev, "hw start failed\n"); 192 hid_err(hdev, "hw start failed\n");
195 goto err; 193 goto err;
196 } 194 }
197 195
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 48eab84f53b5..ab19f2905d27 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -16,6 +16,8 @@
16 * any later version. 16 * any later version.
17 */ 17 */
18 18
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
20
19#include <linux/device.h> 21#include <linux/device.h>
20#include <linux/module.h> 22#include <linux/module.h>
21#include <linux/usb.h> 23#include <linux/usb.h>
@@ -130,7 +132,7 @@ static ssize_t store_channel(struct device *dev,
130 return -EINVAL; 132 return -EINVAL;
131} 133}
132 134
133static DEVICE_ATTR(channel, S_IRUGO | S_IWUGO, show_channel, 135static DEVICE_ATTR(channel, S_IRUGO | S_IWUSR | S_IWGRP , show_channel,
134 store_channel); 136 store_channel);
135 137
136static struct device_attribute *sysfs_device_attr_channel = { 138static struct device_attribute *sysfs_device_attr_channel = {
@@ -169,7 +171,7 @@ static ssize_t store_sustain(struct device *dev,
169 return -EINVAL; 171 return -EINVAL;
170} 172}
171 173
172static DEVICE_ATTR(sustain, S_IRUGO | S_IWUGO, show_sustain, 174static DEVICE_ATTR(sustain, S_IRUGO | S_IWUSR | S_IWGRP, show_sustain,
173 store_sustain); 175 store_sustain);
174 176
175static struct device_attribute *sysfs_device_attr_sustain = { 177static struct device_attribute *sysfs_device_attr_sustain = {
@@ -207,7 +209,7 @@ static ssize_t store_octave(struct device *dev,
207 return -EINVAL; 209 return -EINVAL;
208} 210}
209 211
210static DEVICE_ATTR(octave, S_IRUGO | S_IWUGO, show_octave, 212static DEVICE_ATTR(octave, S_IRUGO | S_IWUSR | S_IWGRP, show_octave,
211 store_octave); 213 store_octave);
212 214
213static struct device_attribute *sysfs_device_attr_octave = { 215static struct device_attribute *sysfs_device_attr_octave = {
@@ -285,11 +287,11 @@ static int pcmidi_get_output_report(struct pcmidi_snd *pm)
285 continue; 287 continue;
286 288
287 if (report->maxfield < 1) { 289 if (report->maxfield < 1) {
288 dev_err(&hdev->dev, "output report is empty\n"); 290 hid_err(hdev, "output report is empty\n");
289 break; 291 break;
290 } 292 }
291 if (report->field[0]->report_count != 2) { 293 if (report->field[0]->report_count != 2) {
292 dev_err(&hdev->dev, "field count too low\n"); 294 hid_err(hdev, "field count too low\n");
293 break; 295 break;
294 } 296 }
295 pm->pcmidi_report6 = report; 297 pm->pcmidi_report6 = report;
@@ -746,8 +748,8 @@ static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc,
746 if (*rsize == 178 && 748 if (*rsize == 178 &&
747 rdesc[111] == 0x06 && rdesc[112] == 0x00 && 749 rdesc[111] == 0x06 && rdesc[112] == 0x00 &&
748 rdesc[113] == 0xff) { 750 rdesc[113] == 0xff) {
749 dev_info(&hdev->dev, "fixing up pc-midi keyboard report " 751 hid_info(hdev,
750 "descriptor\n"); 752 "fixing up pc-midi keyboard report descriptor\n");
751 753
752 rdesc[144] = 0x18; /* report 4: was 0x10 report count */ 754 rdesc[144] = 0x18; /* report 4: was 0x10 report count */
753 } 755 }
@@ -805,7 +807,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
805 807
806 pk = kzalloc(sizeof(*pk), GFP_KERNEL); 808 pk = kzalloc(sizeof(*pk), GFP_KERNEL);
807 if (pk == NULL) { 809 if (pk == NULL) {
808 dev_err(&hdev->dev, "prodikeys: can't alloc descriptor\n"); 810 hid_err(hdev, "can't alloc descriptor\n");
809 return -ENOMEM; 811 return -ENOMEM;
810 } 812 }
811 813
@@ -813,8 +815,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
813 815
814 pm = kzalloc(sizeof(*pm), GFP_KERNEL); 816 pm = kzalloc(sizeof(*pm), GFP_KERNEL);
815 if (pm == NULL) { 817 if (pm == NULL) {
816 dev_err(&hdev->dev, 818 hid_err(hdev, "can't alloc descriptor\n");
817 "prodikeys: can't alloc descriptor\n");
818 ret = -ENOMEM; 819 ret = -ENOMEM;
819 goto err_free; 820 goto err_free;
820 } 821 }
@@ -827,7 +828,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
827 828
828 ret = hid_parse(hdev); 829 ret = hid_parse(hdev);
829 if (ret) { 830 if (ret) {
830 dev_err(&hdev->dev, "prodikeys: hid parse failed\n"); 831 hid_err(hdev, "hid parse failed\n");
831 goto err_free; 832 goto err_free;
832 } 833 }
833 834
@@ -837,7 +838,7 @@ static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
837 838
838 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 839 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
839 if (ret) { 840 if (ret) {
840 dev_err(&hdev->dev, "prodikeys: hw start failed\n"); 841 hid_err(hdev, "hw start failed\n");
841 goto err_free; 842 goto err_free;
842 } 843 }
843 844
@@ -896,7 +897,7 @@ static int pk_init(void)
896 897
897 ret = hid_register_driver(&pk_driver); 898 ret = hid_register_driver(&pk_driver);
898 if (ret) 899 if (ret)
899 printk(KERN_ERR "can't register prodikeys driver\n"); 900 pr_err("can't register prodikeys driver\n");
900 901
901 return ret; 902 return ret;
902} 903}
diff --git a/drivers/hid/hid-quanta.c b/drivers/hid/hid-quanta.c
index 54d3db50605b..87a54df4d4ac 100644
--- a/drivers/hid/hid-quanta.c
+++ b/drivers/hid/hid-quanta.c
@@ -195,7 +195,7 @@ static int quanta_probe(struct hid_device *hdev, const struct hid_device_id *id)
195 195
196 td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL); 196 td = kmalloc(sizeof(struct quanta_data), GFP_KERNEL);
197 if (!td) { 197 if (!td) {
198 dev_err(&hdev->dev, "cannot allocate Quanta Touch data\n"); 198 hid_err(hdev, "cannot allocate Quanta Touch data\n");
199 return -ENOMEM; 199 return -ENOMEM;
200 } 200 }
201 td->valid = false; 201 td->valid = false;
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f77695762cb5..73199de2e37f 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -90,8 +90,7 @@ static int kone_check_write(struct usb_device *usb_dev)
90 kfree(data); 90 kfree(data);
91 return 0; 91 return 0;
92 } else { /* unknown answer */ 92 } else { /* unknown answer */
93 dev_err(&usb_dev->dev, "got retval %d when checking write\n", 93 hid_err(usb_dev, "got retval %d when checking write\n", *data);
94 *data);
95 kfree(data); 94 kfree(data);
96 return -EIO; 95 return -EIO;
97 } 96 }
@@ -556,7 +555,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
556 555
557 retval = kone_set_settings(usb_dev, &kone->settings); 556 retval = kone_set_settings(usb_dev, &kone->settings);
558 if (retval) { 557 if (retval) {
559 dev_err(&usb_dev->dev, "couldn't set tcu state\n"); 558 hid_err(usb_dev, "couldn't set tcu state\n");
560 /* 559 /*
561 * try to reread valid settings into buffer overwriting 560 * try to reread valid settings into buffer overwriting
562 * first error code 561 * first error code
@@ -570,7 +569,7 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
570 569
571 retval = size; 570 retval = size;
572exit_no_settings: 571exit_no_settings:
573 dev_err(&usb_dev->dev, "couldn't read settings\n"); 572 hid_err(usb_dev, "couldn't read settings\n");
574exit_unlock: 573exit_unlock:
575 mutex_unlock(&kone->kone_lock); 574 mutex_unlock(&kone->kone_lock);
576 return retval; 575 return retval;
@@ -818,21 +817,20 @@ static int kone_init_specials(struct hid_device *hdev)
818 817
819 kone = kzalloc(sizeof(*kone), GFP_KERNEL); 818 kone = kzalloc(sizeof(*kone), GFP_KERNEL);
820 if (!kone) { 819 if (!kone) {
821 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 820 hid_err(hdev, "can't alloc device descriptor\n");
822 return -ENOMEM; 821 return -ENOMEM;
823 } 822 }
824 hid_set_drvdata(hdev, kone); 823 hid_set_drvdata(hdev, kone);
825 824
826 retval = kone_init_kone_device_struct(usb_dev, kone); 825 retval = kone_init_kone_device_struct(usb_dev, kone);
827 if (retval) { 826 if (retval) {
828 dev_err(&hdev->dev, 827 hid_err(hdev, "couldn't init struct kone_device\n");
829 "couldn't init struct kone_device\n");
830 goto exit_free; 828 goto exit_free;
831 } 829 }
832 830
833 retval = roccat_connect(hdev); 831 retval = roccat_connect(hdev);
834 if (retval < 0) { 832 if (retval < 0) {
835 dev_err(&hdev->dev, "couldn't init char dev\n"); 833 hid_err(hdev, "couldn't init char dev\n");
836 /* be tolerant about not getting chrdev */ 834 /* be tolerant about not getting chrdev */
837 } else { 835 } else {
838 kone->roccat_claimed = 1; 836 kone->roccat_claimed = 1;
@@ -841,7 +839,7 @@ static int kone_init_specials(struct hid_device *hdev)
841 839
842 retval = kone_create_sysfs_attributes(intf); 840 retval = kone_create_sysfs_attributes(intf);
843 if (retval) { 841 if (retval) {
844 dev_err(&hdev->dev, "cannot create sysfs files\n"); 842 hid_err(hdev, "cannot create sysfs files\n");
845 goto exit_free; 843 goto exit_free;
846 } 844 }
847 } else { 845 } else {
@@ -876,19 +874,19 @@ static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id)
876 874
877 retval = hid_parse(hdev); 875 retval = hid_parse(hdev);
878 if (retval) { 876 if (retval) {
879 dev_err(&hdev->dev, "parse failed\n"); 877 hid_err(hdev, "parse failed\n");
880 goto exit; 878 goto exit;
881 } 879 }
882 880
883 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 881 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
884 if (retval) { 882 if (retval) {
885 dev_err(&hdev->dev, "hw start failed\n"); 883 hid_err(hdev, "hw start failed\n");
886 goto exit; 884 goto exit;
887 } 885 }
888 886
889 retval = kone_init_specials(hdev); 887 retval = kone_init_specials(hdev);
890 if (retval) { 888 if (retval) {
891 dev_err(&hdev->dev, "couldn't install mouse\n"); 889 hid_err(hdev, "couldn't install mouse\n");
892 goto exit_stop; 890 goto exit_stop;
893 } 891 }
894 892
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 9bf23047892a..e7b4affe2664 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -87,9 +87,8 @@ static int pyra_receive_control_status(struct usb_device *usb_dev)
87 control.value == 1) 87 control.value == 1)
88 return 0; 88 return 0;
89 else { 89 else {
90 dev_err(&usb_dev->dev, "receive control status: " 90 hid_err(usb_dev, "receive control status: unknown response 0x%x 0x%x\n",
91 "unknown response 0x%x 0x%x\n", 91 control.request, control.value);
92 control.request, control.value);
93 return -EINVAL; 92 return -EINVAL;
94 } 93 }
95} 94}
@@ -770,21 +769,20 @@ static int pyra_init_specials(struct hid_device *hdev)
770 769
771 pyra = kzalloc(sizeof(*pyra), GFP_KERNEL); 770 pyra = kzalloc(sizeof(*pyra), GFP_KERNEL);
772 if (!pyra) { 771 if (!pyra) {
773 dev_err(&hdev->dev, "can't alloc device descriptor\n"); 772 hid_err(hdev, "can't alloc device descriptor\n");
774 return -ENOMEM; 773 return -ENOMEM;
775 } 774 }
776 hid_set_drvdata(hdev, pyra); 775 hid_set_drvdata(hdev, pyra);
777 776
778 retval = pyra_init_pyra_device_struct(usb_dev, pyra); 777 retval = pyra_init_pyra_device_struct(usb_dev, pyra);
779 if (retval) { 778 if (retval) {
780 dev_err(&hdev->dev, 779 hid_err(hdev, "couldn't init struct pyra_device\n");
781 "couldn't init struct pyra_device\n");
782 goto exit_free; 780 goto exit_free;
783 } 781 }
784 782
785 retval = roccat_connect(hdev); 783 retval = roccat_connect(hdev);
786 if (retval < 0) { 784 if (retval < 0) {
787 dev_err(&hdev->dev, "couldn't init char dev\n"); 785 hid_err(hdev, "couldn't init char dev\n");
788 } else { 786 } else {
789 pyra->chrdev_minor = retval; 787 pyra->chrdev_minor = retval;
790 pyra->roccat_claimed = 1; 788 pyra->roccat_claimed = 1;
@@ -792,7 +790,7 @@ static int pyra_init_specials(struct hid_device *hdev)
792 790
793 retval = pyra_create_sysfs_attributes(intf); 791 retval = pyra_create_sysfs_attributes(intf);
794 if (retval) { 792 if (retval) {
795 dev_err(&hdev->dev, "cannot create sysfs files\n"); 793 hid_err(hdev, "cannot create sysfs files\n");
796 goto exit_free; 794 goto exit_free;
797 } 795 }
798 } else { 796 } else {
@@ -826,19 +824,19 @@ static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id)
826 824
827 retval = hid_parse(hdev); 825 retval = hid_parse(hdev);
828 if (retval) { 826 if (retval) {
829 dev_err(&hdev->dev, "parse failed\n"); 827 hid_err(hdev, "parse failed\n");
830 goto exit; 828 goto exit;
831 } 829 }
832 830
833 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 831 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
834 if (retval) { 832 if (retval) {
835 dev_err(&hdev->dev, "hw start failed\n"); 833 hid_err(hdev, "hw start failed\n");
836 goto exit; 834 goto exit;
837 } 835 }
838 836
839 retval = pyra_init_specials(hdev); 837 retval = pyra_init_specials(hdev);
840 if (retval) { 838 if (retval) {
841 dev_err(&hdev->dev, "couldn't install mouse\n"); 839 hid_err(hdev, "couldn't install mouse\n");
842 goto exit_stop; 840 goto exit_stop;
843 } 841 }
844 return 0; 842 return 0;
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 5a6879e235ac..4bc7a93dc1f5 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -21,6 +21,8 @@
21 * It is inspired by hidraw, but uses only one circular buffer for all readers. 21 * It is inspired by hidraw, but uses only one circular buffer for all readers.
22 */ 22 */
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#include <linux/cdev.h> 26#include <linux/cdev.h>
25#include <linux/poll.h> 27#include <linux/poll.h>
26#include <linux/sched.h> 28#include <linux/sched.h>
@@ -165,27 +167,22 @@ static int roccat_open(struct inode *inode, struct file *file)
165 mutex_lock(&device->readers_lock); 167 mutex_lock(&device->readers_lock);
166 168
167 if (!device) { 169 if (!device) {
168 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 170 pr_emerg("roccat device with minor %d doesn't exist\n", minor);
169 minor);
170 error = -ENODEV; 171 error = -ENODEV;
171 goto exit_err; 172 goto exit_err;
172 } 173 }
173 174
174 if (!device->open++) { 175 if (!device->open++) {
175 /* power on device on adding first reader */ 176 /* power on device on adding first reader */
176 if (device->hid->ll_driver->power) { 177 error = hid_hw_power(device->hid, PM_HINT_FULLON);
177 error = device->hid->ll_driver->power(device->hid, 178 if (error < 0) {
178 PM_HINT_FULLON); 179 --device->open;
179 if (error < 0) { 180 goto exit_err;
180 --device->open;
181 goto exit_err;
182 }
183 } 181 }
184 error = device->hid->ll_driver->open(device->hid); 182
183 error = hid_hw_open(device->hid);
185 if (error < 0) { 184 if (error < 0) {
186 if (device->hid->ll_driver->power) 185 hid_hw_power(device->hid, PM_HINT_NORMAL);
187 device->hid->ll_driver->power(device->hid,
188 PM_HINT_NORMAL);
189 --device->open; 186 --device->open;
190 goto exit_err; 187 goto exit_err;
191 } 188 }
@@ -218,8 +215,7 @@ static int roccat_release(struct inode *inode, struct file *file)
218 device = devices[minor]; 215 device = devices[minor];
219 if (!device) { 216 if (!device) {
220 mutex_unlock(&devices_lock); 217 mutex_unlock(&devices_lock);
221 printk(KERN_EMERG "roccat device with minor %d doesn't exist\n", 218 pr_emerg("roccat device with minor %d doesn't exist\n", minor);
222 minor);
223 return -ENODEV; 219 return -ENODEV;
224 } 220 }
225 221
@@ -231,10 +227,8 @@ static int roccat_release(struct inode *inode, struct file *file)
231 if (!--device->open) { 227 if (!--device->open) {
232 /* removing last reader */ 228 /* removing last reader */
233 if (device->exist) { 229 if (device->exist) {
234 if (device->hid->ll_driver->power) 230 hid_hw_power(device->hid, PM_HINT_NORMAL);
235 device->hid->ll_driver->power(device->hid, 231 hid_hw_close(device->hid);
236 PM_HINT_NORMAL);
237 device->hid->ll_driver->close(device->hid);
238 } else { 232 } else {
239 kfree(device); 233 kfree(device);
240 } 234 }
@@ -370,7 +364,7 @@ void roccat_disconnect(int minor)
370 device_destroy(roccat_class, MKDEV(roccat_major, minor)); 364 device_destroy(roccat_class, MKDEV(roccat_major, minor));
371 365
372 if (device->open) { 366 if (device->open) {
373 device->hid->ll_driver->close(device->hid); 367 hid_hw_close(device->hid);
374 wake_up_interruptible(&device->wait); 368 wake_up_interruptible(&device->wait);
375 } else { 369 } else {
376 kfree(device); 370 kfree(device);
@@ -398,7 +392,7 @@ static int __init roccat_init(void)
398 roccat_major = MAJOR(dev_id); 392 roccat_major = MAJOR(dev_id);
399 393
400 if (retval < 0) { 394 if (retval < 0) {
401 printk(KERN_WARNING "roccat: can't get major number\n"); 395 pr_warn("can't get major number\n");
402 return retval; 396 return retval;
403 } 397 }
404 398
diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
index 35894444e000..3c1fd8af5e0c 100644
--- a/drivers/hid/hid-samsung.c
+++ b/drivers/hid/hid-samsung.c
@@ -57,8 +57,8 @@
57static inline void samsung_irda_dev_trace(struct hid_device *hdev, 57static inline void samsung_irda_dev_trace(struct hid_device *hdev,
58 unsigned int rsize) 58 unsigned int rsize)
59{ 59{
60 dev_info(&hdev->dev, "fixing up Samsung IrDA %d byte report " 60 hid_info(hdev, "fixing up Samsung IrDA %d byte report descriptor\n",
61 "descriptor\n", rsize); 61 rsize);
62} 62}
63 63
64static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, 64static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -160,7 +160,7 @@ static int samsung_probe(struct hid_device *hdev,
160 160
161 ret = hid_parse(hdev); 161 ret = hid_parse(hdev);
162 if (ret) { 162 if (ret) {
163 dev_err(&hdev->dev, "parse failed\n"); 163 hid_err(hdev, "parse failed\n");
164 goto err_free; 164 goto err_free;
165 } 165 }
166 166
@@ -174,7 +174,7 @@ static int samsung_probe(struct hid_device *hdev,
174 174
175 ret = hid_hw_start(hdev, cmask); 175 ret = hid_hw_start(hdev, cmask);
176 if (ret) { 176 if (ret) {
177 dev_err(&hdev->dev, "hw start failed\n"); 177 hid_err(hdev, "hw start failed\n");
178 goto err_free; 178 goto err_free;
179 } 179 }
180 180
diff --git a/drivers/hid/hid-sjoy.c b/drivers/hid/hid-sjoy.c
index e10a7687ebf2..16f7cafc9695 100644
--- a/drivers/hid/hid-sjoy.c
+++ b/drivers/hid/hid-sjoy.c
@@ -74,26 +74,25 @@ static int sjoyff_init(struct hid_device *hid)
74 int error; 74 int error;
75 75
76 if (list_empty(report_list)) { 76 if (list_empty(report_list)) {
77 dev_err(&hid->dev, "no output reports found\n"); 77 hid_err(hid, "no output reports found\n");
78 return -ENODEV; 78 return -ENODEV;
79 } 79 }
80 80
81 report_ptr = report_ptr->next; 81 report_ptr = report_ptr->next;
82 82
83 if (report_ptr == report_list) { 83 if (report_ptr == report_list) {
84 dev_err(&hid->dev, "required output report is " 84 hid_err(hid, "required output report is missing\n");
85 "missing\n");
86 return -ENODEV; 85 return -ENODEV;
87 } 86 }
88 87
89 report = list_entry(report_ptr, struct hid_report, list); 88 report = list_entry(report_ptr, struct hid_report, list);
90 if (report->maxfield < 1) { 89 if (report->maxfield < 1) {
91 dev_err(&hid->dev, "no fields in the report\n"); 90 hid_err(hid, "no fields in the report\n");
92 return -ENODEV; 91 return -ENODEV;
93 } 92 }
94 93
95 if (report->field[0]->report_count < 3) { 94 if (report->field[0]->report_count < 3) {
96 dev_err(&hid->dev, "not enough values in the field\n"); 95 hid_err(hid, "not enough values in the field\n");
97 return -ENODEV; 96 return -ENODEV;
98 } 97 }
99 98
@@ -117,8 +116,7 @@ static int sjoyff_init(struct hid_device *hid)
117 sjoyff->report->field[0]->value[2] = 0x00; 116 sjoyff->report->field[0]->value[2] = 0x00;
118 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT); 117 usbhid_submit_report(hid, sjoyff->report, USB_DIR_OUT);
119 118
120 dev_info(&hid->dev, 119 hid_info(hid, "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
121 "Force feedback for SmartJoy PLUS PS2/USB adapter\n");
122 120
123 return 0; 121 return 0;
124} 122}
@@ -135,13 +133,13 @@ static int sjoy_probe(struct hid_device *hdev, const struct hid_device_id *id)
135 133
136 ret = hid_parse(hdev); 134 ret = hid_parse(hdev);
137 if (ret) { 135 if (ret) {
138 dev_err(&hdev->dev, "parse failed\n"); 136 hid_err(hdev, "parse failed\n");
139 goto err; 137 goto err;
140 } 138 }
141 139
142 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 140 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
143 if (ret) { 141 if (ret) {
144 dev_err(&hdev->dev, "hw start failed\n"); 142 hid_err(hdev, "hw start failed\n");
145 goto err; 143 goto err;
146 } 144 }
147 145
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 677bb3da10e8..68d7b36e31e4 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -40,8 +40,7 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40 40
41 if ((sc->quirks & VAIO_RDESC_CONSTANT) && 41 if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
42 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { 42 *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
43 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " 43 hid_info(hdev, "Fixing up Sony Vaio VGX report descriptor\n");
44 "descriptor\n");
45 rdesc[55] = 0x06; 44 rdesc[55] = 0x06;
46 } 45 }
47 return rdesc; 46 return rdesc;
@@ -89,7 +88,7 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
89 (3 << 8) | 0xf2, ifnum, buf, 17, 88 (3 << 8) | 0xf2, ifnum, buf, 17,
90 USB_CTRL_GET_TIMEOUT); 89 USB_CTRL_GET_TIMEOUT);
91 if (ret < 0) 90 if (ret < 0)
92 dev_err(&hdev->dev, "can't set operational mode\n"); 91 hid_err(hdev, "can't set operational mode\n");
93 92
94 kfree(buf); 93 kfree(buf);
95 94
@@ -110,7 +109,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
110 109
111 sc = kzalloc(sizeof(*sc), GFP_KERNEL); 110 sc = kzalloc(sizeof(*sc), GFP_KERNEL);
112 if (sc == NULL) { 111 if (sc == NULL) {
113 dev_err(&hdev->dev, "can't alloc sony descriptor\n"); 112 hid_err(hdev, "can't alloc sony descriptor\n");
114 return -ENOMEM; 113 return -ENOMEM;
115 } 114 }
116 115
@@ -119,14 +118,14 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
119 118
120 ret = hid_parse(hdev); 119 ret = hid_parse(hdev);
121 if (ret) { 120 if (ret) {
122 dev_err(&hdev->dev, "parse failed\n"); 121 hid_err(hdev, "parse failed\n");
123 goto err_free; 122 goto err_free;
124 } 123 }
125 124
126 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | 125 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
127 HID_CONNECT_HIDDEV_FORCE); 126 HID_CONNECT_HIDDEV_FORCE);
128 if (ret) { 127 if (ret) {
129 dev_err(&hdev->dev, "hw start failed\n"); 128 hid_err(hdev, "hw start failed\n");
130 goto err_free; 129 goto err_free;
131 } 130 }
132 131
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
index 3171be28c3d5..b2be1d11916b 100644
--- a/drivers/hid/hid-stantum.c
+++ b/drivers/hid/hid-stantum.c
@@ -222,7 +222,7 @@ static int stantum_probe(struct hid_device *hdev,
222 222
223 sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL); 223 sd = kmalloc(sizeof(struct stantum_data), GFP_KERNEL);
224 if (!sd) { 224 if (!sd) {
225 dev_err(&hdev->dev, "cannot allocate Stantum data\n"); 225 hid_err(hdev, "cannot allocate Stantum data\n");
226 return -ENOMEM; 226 return -ENOMEM;
227 } 227 }
228 sd->valid = false; 228 sd->valid = false;
diff --git a/drivers/hid/hid-sunplus.c b/drivers/hid/hid-sunplus.c
index 164ed568f6cf..d484a0043dd4 100644
--- a/drivers/hid/hid-sunplus.c
+++ b/drivers/hid/hid-sunplus.c
@@ -27,8 +27,7 @@ static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27{ 27{
28 if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && 28 if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 &&
29 rdesc[106] == 0x03) { 29 rdesc[106] == 0x03) {
30 dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " 30 hid_info(hdev, "fixing up Sunplus Wireless Desktop report descriptor\n");
31 "report descriptor\n");
32 rdesc[105] = rdesc[110] = 0x03; 31 rdesc[105] = rdesc[110] = 0x03;
33 rdesc[106] = rdesc[111] = 0x21; 32 rdesc[106] = rdesc[111] = 0x21;
34 } 33 }
diff --git a/drivers/hid/hid-tmff.c b/drivers/hid/hid-tmff.c
index 25be4e1461bd..575862b0688e 100644
--- a/drivers/hid/hid-tmff.c
+++ b/drivers/hid/hid-tmff.c
@@ -151,28 +151,23 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
151 switch (field->usage[0].hid) { 151 switch (field->usage[0].hid) {
152 case THRUSTMASTER_USAGE_FF: 152 case THRUSTMASTER_USAGE_FF:
153 if (field->report_count < 2) { 153 if (field->report_count < 2) {
154 dev_warn(&hid->dev, "ignoring FF field " 154 hid_warn(hid, "ignoring FF field with report_count < 2\n");
155 "with report_count < 2\n");
156 continue; 155 continue;
157 } 156 }
158 157
159 if (field->logical_maximum == 158 if (field->logical_maximum ==
160 field->logical_minimum) { 159 field->logical_minimum) {
161 dev_warn(&hid->dev, "ignoring FF field " 160 hid_warn(hid, "ignoring FF field with logical_maximum == logical_minimum\n");
162 "with logical_maximum "
163 "== logical_minimum\n");
164 continue; 161 continue;
165 } 162 }
166 163
167 if (tmff->report && tmff->report != report) { 164 if (tmff->report && tmff->report != report) {
168 dev_warn(&hid->dev, "ignoring FF field " 165 hid_warn(hid, "ignoring FF field in other report\n");
169 "in other report\n");
170 continue; 166 continue;
171 } 167 }
172 168
173 if (tmff->ff_field && tmff->ff_field != field) { 169 if (tmff->ff_field && tmff->ff_field != field) {
174 dev_warn(&hid->dev, "ignoring " 170 hid_warn(hid, "ignoring duplicate FF field\n");
175 "duplicate FF field\n");
176 continue; 171 continue;
177 } 172 }
178 173
@@ -185,16 +180,15 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
185 break; 180 break;
186 181
187 default: 182 default:
188 dev_warn(&hid->dev, "ignoring unknown output " 183 hid_warn(hid, "ignoring unknown output usage %08x\n",
189 "usage %08x\n", 184 field->usage[0].hid);
190 field->usage[0].hid);
191 continue; 185 continue;
192 } 186 }
193 } 187 }
194 } 188 }
195 189
196 if (!tmff->report) { 190 if (!tmff->report) {
197 dev_err(&hid->dev, "can't find FF field in output reports\n"); 191 hid_err(hid, "can't find FF field in output reports\n");
198 error = -ENODEV; 192 error = -ENODEV;
199 goto fail; 193 goto fail;
200 } 194 }
@@ -203,8 +197,7 @@ static int tmff_init(struct hid_device *hid, const signed short *ff_bits)
203 if (error) 197 if (error)
204 goto fail; 198 goto fail;
205 199
206 dev_info(&hid->dev, "force feedback for ThrustMaster devices by Zinx " 200 hid_info(hid, "force feedback for ThrustMaster devices by Zinx Verituse <zinx@epicsol.org>\n");
207 "Verituse <zinx@epicsol.org>");
208 return 0; 201 return 0;
209 202
210fail: 203fail:
@@ -224,13 +217,13 @@ static int tm_probe(struct hid_device *hdev, const struct hid_device_id *id)
224 217
225 ret = hid_parse(hdev); 218 ret = hid_parse(hdev);
226 if (ret) { 219 if (ret) {
227 dev_err(&hdev->dev, "parse failed\n"); 220 hid_err(hdev, "parse failed\n");
228 goto err; 221 goto err;
229 } 222 }
230 223
231 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 224 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
232 if (ret) { 225 if (ret) {
233 dev_err(&hdev->dev, "hw start failed\n"); 226 hid_err(hdev, "hw start failed\n");
234 goto err; 227 goto err;
235 } 228 }
236 229
diff --git a/drivers/hid/hid-topseed.c b/drivers/hid/hid-topseed.c
index 956ed9ac19d4..613ff7b1d746 100644
--- a/drivers/hid/hid-topseed.c
+++ b/drivers/hid/hid-topseed.c
@@ -66,6 +66,7 @@ static const struct hid_device_id ts_devices[] = {
66 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
67 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, 67 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
68 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 68 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
69 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
69 { } 70 { }
70}; 71};
71MODULE_DEVICE_TABLE(hid, ts_devices); 72MODULE_DEVICE_TABLE(hid, ts_devices);
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 724f46ed612f..06888323828c 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -18,6 +18,8 @@
18 * any later version. 18 * any later version.
19 */ 19 */
20 20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
21#include <linux/device.h> 23#include <linux/device.h>
22#include <linux/hid.h> 24#include <linux/hid.h>
23#include <linux/module.h> 25#include <linux/module.h>
@@ -141,8 +143,8 @@ static void wacom_poke(struct hid_device *hdev, u8 speed)
141 * Note that if the raw queries fail, it's not a hard failure and it 143 * Note that if the raw queries fail, it's not a hard failure and it
142 * is safe to continue 144 * is safe to continue
143 */ 145 */
144 dev_warn(&hdev->dev, "failed to poke device, command %d, err %d\n", 146 hid_warn(hdev, "failed to poke device, command %d, err %d\n",
145 rep_data[0], ret); 147 rep_data[0], ret);
146 return; 148 return;
147} 149}
148 150
@@ -172,7 +174,7 @@ static ssize_t wacom_store_speed(struct device *dev,
172 return -EINVAL; 174 return -EINVAL;
173} 175}
174 176
175static DEVICE_ATTR(speed, S_IRUGO | S_IWUGO, 177static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP,
176 wacom_show_speed, wacom_store_speed); 178 wacom_show_speed, wacom_store_speed);
177 179
178static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, 180static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
@@ -312,7 +314,7 @@ static int wacom_probe(struct hid_device *hdev,
312 314
313 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); 315 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
314 if (wdata == NULL) { 316 if (wdata == NULL) {
315 dev_err(&hdev->dev, "can't alloc wacom descriptor\n"); 317 hid_err(hdev, "can't alloc wacom descriptor\n");
316 return -ENOMEM; 318 return -ENOMEM;
317 } 319 }
318 320
@@ -321,20 +323,20 @@ static int wacom_probe(struct hid_device *hdev,
321 /* Parse the HID report now */ 323 /* Parse the HID report now */
322 ret = hid_parse(hdev); 324 ret = hid_parse(hdev);
323 if (ret) { 325 if (ret) {
324 dev_err(&hdev->dev, "parse failed\n"); 326 hid_err(hdev, "parse failed\n");
325 goto err_free; 327 goto err_free;
326 } 328 }
327 329
328 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 330 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
329 if (ret) { 331 if (ret) {
330 dev_err(&hdev->dev, "hw start failed\n"); 332 hid_err(hdev, "hw start failed\n");
331 goto err_free; 333 goto err_free;
332 } 334 }
333 335
334 ret = device_create_file(&hdev->dev, &dev_attr_speed); 336 ret = device_create_file(&hdev->dev, &dev_attr_speed);
335 if (ret) 337 if (ret)
336 dev_warn(&hdev->dev, 338 hid_warn(hdev,
337 "can't create sysfs speed attribute err: %d\n", ret); 339 "can't create sysfs speed attribute err: %d\n", ret);
338 340
339 /* Set Wacom mode 2 with high reporting speed */ 341 /* Set Wacom mode 2 with high reporting speed */
340 wacom_poke(hdev, 1); 342 wacom_poke(hdev, 1);
@@ -349,8 +351,8 @@ static int wacom_probe(struct hid_device *hdev,
349 351
350 ret = power_supply_register(&hdev->dev, &wdata->battery); 352 ret = power_supply_register(&hdev->dev, &wdata->battery);
351 if (ret) { 353 if (ret) {
352 dev_warn(&hdev->dev, 354 hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
353 "can't create sysfs battery attribute, err: %d\n", ret); 355 ret);
354 /* 356 /*
355 * battery attribute is not critical for the tablet, but if it 357 * battery attribute is not critical for the tablet, but if it
356 * failed then there is no need to create ac attribute 358 * failed then there is no need to create ac attribute
@@ -367,8 +369,8 @@ static int wacom_probe(struct hid_device *hdev,
367 369
368 ret = power_supply_register(&hdev->dev, &wdata->ac); 370 ret = power_supply_register(&hdev->dev, &wdata->ac);
369 if (ret) { 371 if (ret) {
370 dev_warn(&hdev->dev, 372 hid_warn(hdev,
371 "can't create ac battery attribute, err: %d\n", ret); 373 "can't create ac battery attribute, err: %d\n", ret);
372 /* 374 /*
373 * ac attribute is not critical for the tablet, but if it 375 * ac attribute is not critical for the tablet, but if it
374 * failed then we don't want to battery attribute to exist 376 * failed then we don't want to battery attribute to exist
@@ -454,7 +456,7 @@ static int __init wacom_init(void)
454 456
455 ret = hid_register_driver(&wacom_driver); 457 ret = hid_register_driver(&wacom_driver);
456 if (ret) 458 if (ret)
457 printk(KERN_ERR "can't register wacom driver\n"); 459 pr_err("can't register wacom driver\n");
458 return ret; 460 return ret;
459} 461}
460 462
diff --git a/drivers/hid/hid-zpff.c b/drivers/hid/hid-zpff.c
index b7acceabba80..f31fab012f2f 100644
--- a/drivers/hid/hid-zpff.c
+++ b/drivers/hid/hid-zpff.c
@@ -75,14 +75,14 @@ static int zpff_init(struct hid_device *hid)
75 int error; 75 int error;
76 76
77 if (list_empty(report_list)) { 77 if (list_empty(report_list)) {
78 dev_err(&hid->dev, "no output report found\n"); 78 hid_err(hid, "no output report found\n");
79 return -ENODEV; 79 return -ENODEV;
80 } 80 }
81 81
82 report = list_entry(report_list->next, struct hid_report, list); 82 report = list_entry(report_list->next, struct hid_report, list);
83 83
84 if (report->maxfield < 4) { 84 if (report->maxfield < 4) {
85 dev_err(&hid->dev, "not enough fields in report\n"); 85 hid_err(hid, "not enough fields in report\n");
86 return -ENODEV; 86 return -ENODEV;
87 } 87 }
88 88
@@ -105,8 +105,7 @@ static int zpff_init(struct hid_device *hid)
105 zpff->report->field[3]->value[0] = 0x00; 105 zpff->report->field[3]->value[0] = 0x00;
106 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT); 106 usbhid_submit_report(hid, zpff->report, USB_DIR_OUT);
107 107
108 dev_info(&hid->dev, "force feedback for Zeroplus based devices by " 108 hid_info(hid, "force feedback for Zeroplus based devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
109 "Anssi Hannula <anssi.hannula@gmail.com>\n");
110 109
111 return 0; 110 return 0;
112} 111}
@@ -123,13 +122,13 @@ static int zp_probe(struct hid_device *hdev, const struct hid_device_id *id)
123 122
124 ret = hid_parse(hdev); 123 ret = hid_parse(hdev);
125 if (ret) { 124 if (ret) {
126 dev_err(&hdev->dev, "parse failed\n"); 125 hid_err(hdev, "parse failed\n");
127 goto err; 126 goto err;
128 } 127 }
129 128
130 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 129 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
131 if (ret) { 130 if (ret) {
132 dev_err(&hdev->dev, "hw start failed\n"); 131 hid_err(hdev, "hw start failed\n");
133 goto err; 132 goto err;
134 } 133 }
135 134
diff --git a/drivers/hid/hid-zydacron.c b/drivers/hid/hid-zydacron.c
index aac1f9273149..e90371508fd2 100644
--- a/drivers/hid/hid-zydacron.c
+++ b/drivers/hid/hid-zydacron.c
@@ -34,9 +34,8 @@ static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc,
34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff && 34 rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff &&
35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff && 35 rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff &&
36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) { 36 rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) {
37 dev_info(&hdev->dev, 37 hid_info(hdev,
38 "fixing up zydacron remote control report " 38 "fixing up zydacron remote control report descriptor\n");
39 "descriptor\n");
40 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c; 39 rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c;
41 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00; 40 rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00;
42 } 41 }
@@ -172,7 +171,7 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
172 171
173 zc = kzalloc(sizeof(*zc), GFP_KERNEL); 172 zc = kzalloc(sizeof(*zc), GFP_KERNEL);
174 if (zc == NULL) { 173 if (zc == NULL) {
175 dev_err(&hdev->dev, "zydacron: can't alloc descriptor\n"); 174 hid_err(hdev, "can't alloc descriptor\n");
176 return -ENOMEM; 175 return -ENOMEM;
177 } 176 }
178 177
@@ -180,13 +179,13 @@ static int zc_probe(struct hid_device *hdev, const struct hid_device_id *id)
180 179
181 ret = hid_parse(hdev); 180 ret = hid_parse(hdev);
182 if (ret) { 181 if (ret) {
183 dev_err(&hdev->dev, "zydacron: parse failed\n"); 182 hid_err(hdev, "parse failed\n");
184 goto err_free; 183 goto err_free;
185 } 184 }
186 185
187 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 186 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
188 if (ret) { 187 if (ret) {
189 dev_err(&hdev->dev, "zydacron: hw start failed\n"); 188 hid_err(hdev, "hw start failed\n");
190 goto err_free; 189 goto err_free;
191 } 190 }
192 191
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index e1f07483691f..468e87b53ed2 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -19,6 +19,8 @@
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/fs.h> 24#include <linux/fs.h>
23#include <linux/module.h> 25#include <linux/module.h>
24#include <linux/errno.h> 26#include <linux/errno.h>
@@ -122,15 +124,15 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
122 } 124 }
123 125
124 if (count > HID_MAX_BUFFER_SIZE) { 126 if (count > HID_MAX_BUFFER_SIZE) {
125 printk(KERN_WARNING "hidraw: pid %d passed too large report\n", 127 hid_warn(dev, "pid %d passed too large report\n",
126 task_pid_nr(current)); 128 task_pid_nr(current));
127 ret = -EINVAL; 129 ret = -EINVAL;
128 goto out; 130 goto out;
129 } 131 }
130 132
131 if (count < 2) { 133 if (count < 2) {
132 printk(KERN_WARNING "hidraw: pid %d passed too short report\n", 134 hid_warn(dev, "pid %d passed too short report\n",
133 task_pid_nr(current)); 135 task_pid_nr(current));
134 ret = -EINVAL; 136 ret = -EINVAL;
135 goto out; 137 goto out;
136 } 138 }
@@ -192,15 +194,13 @@ static int hidraw_open(struct inode *inode, struct file *file)
192 194
193 dev = hidraw_table[minor]; 195 dev = hidraw_table[minor];
194 if (!dev->open++) { 196 if (!dev->open++) {
195 if (dev->hid->ll_driver->power) { 197 err = hid_hw_power(dev->hid, PM_HINT_FULLON);
196 err = dev->hid->ll_driver->power(dev->hid, PM_HINT_FULLON); 198 if (err < 0)
197 if (err < 0) 199 goto out_unlock;
198 goto out_unlock; 200
199 } 201 err = hid_hw_open(dev->hid);
200 err = dev->hid->ll_driver->open(dev->hid);
201 if (err < 0) { 202 if (err < 0) {
202 if (dev->hid->ll_driver->power) 203 hid_hw_power(dev->hid, PM_HINT_NORMAL);
203 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL);
204 dev->open--; 204 dev->open--;
205 } 205 }
206 } 206 }
@@ -229,9 +229,8 @@ static int hidraw_release(struct inode * inode, struct file * file)
229 dev = hidraw_table[minor]; 229 dev = hidraw_table[minor];
230 if (!--dev->open) { 230 if (!--dev->open) {
231 if (list->hidraw->exist) { 231 if (list->hidraw->exist) {
232 if (dev->hid->ll_driver->power) 232 hid_hw_power(dev->hid, PM_HINT_NORMAL);
233 dev->hid->ll_driver->power(dev->hid, PM_HINT_NORMAL); 233 hid_hw_close(dev->hid);
234 dev->hid->ll_driver->close(dev->hid);
235 } else { 234 } else {
236 kfree(list->hidraw); 235 kfree(list->hidraw);
237 } 236 }
@@ -345,6 +344,9 @@ static const struct file_operations hidraw_ops = {
345 .open = hidraw_open, 344 .open = hidraw_open,
346 .release = hidraw_release, 345 .release = hidraw_release,
347 .unlocked_ioctl = hidraw_ioctl, 346 .unlocked_ioctl = hidraw_ioctl,
347#ifdef CONFIG_COMPAT
348 .compat_ioctl = hidraw_ioctl,
349#endif
348 .llseek = noop_llseek, 350 .llseek = noop_llseek,
349}; 351};
350 352
@@ -433,7 +435,7 @@ void hidraw_disconnect(struct hid_device *hid)
433 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); 435 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
434 436
435 if (hidraw->open) { 437 if (hidraw->open) {
436 hid->ll_driver->close(hid); 438 hid_hw_close(hid);
437 wake_up_interruptible(&hidraw->wait); 439 wake_up_interruptible(&hidraw->wait);
438 } else { 440 } else {
439 kfree(hidraw); 441 kfree(hidraw);
@@ -452,7 +454,7 @@ int __init hidraw_init(void)
452 hidraw_major = MAJOR(dev_id); 454 hidraw_major = MAJOR(dev_id);
453 455
454 if (result < 0) { 456 if (result < 0) {
455 printk(KERN_WARNING "hidraw: can't get major number\n"); 457 pr_warn("can't get major number\n");
456 result = 0; 458 result = 0;
457 goto out; 459 goto out;
458 } 460 }
diff --git a/drivers/hid/usbhid/Makefile b/drivers/hid/usbhid/Makefile
index 1329ecb37a1c..db3cf31c6fa1 100644
--- a/drivers/hid/usbhid/Makefile
+++ b/drivers/hid/usbhid/Makefile
@@ -3,15 +3,15 @@
3# 3#
4 4
5# Multipart objects. 5# Multipart objects.
6usbhid-objs := hid-core.o hid-quirks.o 6usbhid-y := hid-core.o hid-quirks.o
7 7
8# Optional parts of multipart objects. 8# Optional parts of multipart objects.
9 9
10ifeq ($(CONFIG_USB_HIDDEV),y) 10ifeq ($(CONFIG_USB_HIDDEV),y)
11 usbhid-objs += hiddev.o 11 usbhid-y += hiddev.o
12endif 12endif
13ifeq ($(CONFIG_HID_PID),y) 13ifeq ($(CONFIG_HID_PID),y)
14 usbhid-objs += hid-pidff.o 14 usbhid-y += hid-pidff.o
15endif 15endif
16 16
17obj-$(CONFIG_USB_HID) += usbhid.o 17obj-$(CONFIG_USB_HID) += usbhid.o
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5489eab3a6bd..b336dd84036f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -67,7 +67,6 @@ MODULE_PARM_DESC(quirks, "Add/modify USB HID quirks by specifying "
67 * Input submission and I/O error handler. 67 * Input submission and I/O error handler.
68 */ 68 */
69static DEFINE_MUTEX(hid_open_mut); 69static DEFINE_MUTEX(hid_open_mut);
70static struct workqueue_struct *resumption_waker;
71 70
72static void hid_io_error(struct hid_device *hid); 71static void hid_io_error(struct hid_device *hid);
73static int hid_submit_out(struct hid_device *hid); 72static int hid_submit_out(struct hid_device *hid);
@@ -136,10 +135,10 @@ static void hid_reset(struct work_struct *work)
136 hid_io_error(hid); 135 hid_io_error(hid);
137 break; 136 break;
138 default: 137 default:
139 err_hid("can't reset device, %s-%s/input%d, status %d", 138 hid_err(hid, "can't reset device, %s-%s/input%d, status %d\n",
140 hid_to_usb_dev(hid)->bus->bus_name, 139 hid_to_usb_dev(hid)->bus->bus_name,
141 hid_to_usb_dev(hid)->devpath, 140 hid_to_usb_dev(hid)->devpath,
142 usbhid->ifnum, rc); 141 usbhid->ifnum, rc);
143 /* FALLTHROUGH */ 142 /* FALLTHROUGH */
144 case -EHOSTUNREACH: 143 case -EHOSTUNREACH:
145 case -ENODEV: 144 case -ENODEV:
@@ -278,18 +277,18 @@ static void hid_irq_in(struct urb *urb)
278 hid_io_error(hid); 277 hid_io_error(hid);
279 return; 278 return;
280 default: /* error */ 279 default: /* error */
281 dev_warn(&urb->dev->dev, "input irq status %d " 280 hid_warn(urb->dev, "input irq status %d received\n",
282 "received\n", urb->status); 281 urb->status);
283 } 282 }
284 283
285 status = usb_submit_urb(urb, GFP_ATOMIC); 284 status = usb_submit_urb(urb, GFP_ATOMIC);
286 if (status) { 285 if (status) {
287 clear_bit(HID_IN_RUNNING, &usbhid->iofl); 286 clear_bit(HID_IN_RUNNING, &usbhid->iofl);
288 if (status != -EPERM) { 287 if (status != -EPERM) {
289 err_hid("can't resubmit intr, %s-%s/input%d, status %d", 288 hid_err(hid, "can't resubmit intr, %s-%s/input%d, status %d\n",
290 hid_to_usb_dev(hid)->bus->bus_name, 289 hid_to_usb_dev(hid)->bus->bus_name,
291 hid_to_usb_dev(hid)->devpath, 290 hid_to_usb_dev(hid)->devpath,
292 usbhid->ifnum, status); 291 usbhid->ifnum, status);
293 hid_io_error(hid); 292 hid_io_error(hid);
294 } 293 }
295 } 294 }
@@ -300,10 +299,19 @@ static int hid_submit_out(struct hid_device *hid)
300 struct hid_report *report; 299 struct hid_report *report;
301 char *raw_report; 300 char *raw_report;
302 struct usbhid_device *usbhid = hid->driver_data; 301 struct usbhid_device *usbhid = hid->driver_data;
302 int r;
303 303
304 report = usbhid->out[usbhid->outtail].report; 304 report = usbhid->out[usbhid->outtail].report;
305 raw_report = usbhid->out[usbhid->outtail].raw_report; 305 raw_report = usbhid->out[usbhid->outtail].raw_report;
306 306
307 r = usb_autopm_get_interface_async(usbhid->intf);
308 if (r < 0)
309 return -1;
310
311 /*
312 * if the device hasn't been woken, we leave the output
313 * to resume()
314 */
307 if (!test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) { 315 if (!test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) {
308 usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0); 316 usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + 1 + (report->id > 0);
309 usbhid->urbout->dev = hid_to_usb_dev(hid); 317 usbhid->urbout->dev = hid_to_usb_dev(hid);
@@ -313,17 +321,11 @@ static int hid_submit_out(struct hid_device *hid)
313 dbg_hid("submitting out urb\n"); 321 dbg_hid("submitting out urb\n");
314 322
315 if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) { 323 if (usb_submit_urb(usbhid->urbout, GFP_ATOMIC)) {
316 err_hid("usb_submit_urb(out) failed"); 324 hid_err(hid, "usb_submit_urb(out) failed\n");
325 usb_autopm_put_interface_async(usbhid->intf);
317 return -1; 326 return -1;
318 } 327 }
319 usbhid->last_out = jiffies; 328 usbhid->last_out = jiffies;
320 } else {
321 /*
322 * queue work to wake up the device.
323 * as the work queue is freezeable, this is safe
324 * with respect to STD and STR
325 */
326 queue_work(resumption_waker, &usbhid->restart_work);
327 } 329 }
328 330
329 return 0; 331 return 0;
@@ -334,13 +336,16 @@ static int hid_submit_ctrl(struct hid_device *hid)
334 struct hid_report *report; 336 struct hid_report *report;
335 unsigned char dir; 337 unsigned char dir;
336 char *raw_report; 338 char *raw_report;
337 int len; 339 int len, r;
338 struct usbhid_device *usbhid = hid->driver_data; 340 struct usbhid_device *usbhid = hid->driver_data;
339 341
340 report = usbhid->ctrl[usbhid->ctrltail].report; 342 report = usbhid->ctrl[usbhid->ctrltail].report;
341 raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report; 343 raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report;
342 dir = usbhid->ctrl[usbhid->ctrltail].dir; 344 dir = usbhid->ctrl[usbhid->ctrltail].dir;
343 345
346 r = usb_autopm_get_interface_async(usbhid->intf);
347 if (r < 0)
348 return -1;
344 if (!test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) { 349 if (!test_bit(HID_REPORTED_IDLE, &usbhid->iofl)) {
345 len = ((report->size - 1) >> 3) + 1 + (report->id > 0); 350 len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
346 if (dir == USB_DIR_OUT) { 351 if (dir == USB_DIR_OUT) {
@@ -375,17 +380,11 @@ static int hid_submit_ctrl(struct hid_device *hid)
375 usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength); 380 usbhid->cr->wValue, usbhid->cr->wIndex, usbhid->cr->wLength);
376 381
377 if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) { 382 if (usb_submit_urb(usbhid->urbctrl, GFP_ATOMIC)) {
378 err_hid("usb_submit_urb(ctrl) failed"); 383 usb_autopm_put_interface_async(usbhid->intf);
384 hid_err(hid, "usb_submit_urb(ctrl) failed\n");
379 return -1; 385 return -1;
380 } 386 }
381 usbhid->last_ctrl = jiffies; 387 usbhid->last_ctrl = jiffies;
382 } else {
383 /*
384 * queue work to wake up the device.
385 * as the work queue is freezeable, this is safe
386 * with respect to STD and STR
387 */
388 queue_work(resumption_waker, &usbhid->restart_work);
389 } 388 }
390 389
391 return 0; 390 return 0;
@@ -413,8 +412,8 @@ static void hid_irq_out(struct urb *urb)
413 case -ENOENT: 412 case -ENOENT:
414 break; 413 break;
415 default: /* error */ 414 default: /* error */
416 dev_warn(&urb->dev->dev, "output irq status %d " 415 hid_warn(urb->dev, "output irq status %d received\n",
417 "received\n", urb->status); 416 urb->status);
418 } 417 }
419 418
420 spin_lock_irqsave(&usbhid->lock, flags); 419 spin_lock_irqsave(&usbhid->lock, flags);
@@ -435,6 +434,7 @@ static void hid_irq_out(struct urb *urb)
435 434
436 clear_bit(HID_OUT_RUNNING, &usbhid->iofl); 435 clear_bit(HID_OUT_RUNNING, &usbhid->iofl);
437 spin_unlock_irqrestore(&usbhid->lock, flags); 436 spin_unlock_irqrestore(&usbhid->lock, flags);
437 usb_autopm_put_interface_async(usbhid->intf);
438 wake_up(&usbhid->wait); 438 wake_up(&usbhid->wait);
439} 439}
440 440
@@ -466,8 +466,7 @@ static void hid_ctrl(struct urb *urb)
466 case -EPIPE: /* report not available */ 466 case -EPIPE: /* report not available */
467 break; 467 break;
468 default: /* error */ 468 default: /* error */
469 dev_warn(&urb->dev->dev, "ctrl urb status %d " 469 hid_warn(urb->dev, "ctrl urb status %d received\n", status);
470 "received\n", status);
471 } 470 }
472 471
473 if (unplug) 472 if (unplug)
@@ -481,11 +480,13 @@ static void hid_ctrl(struct urb *urb)
481 wake_up(&usbhid->wait); 480 wake_up(&usbhid->wait);
482 } 481 }
483 spin_unlock(&usbhid->lock); 482 spin_unlock(&usbhid->lock);
483 usb_autopm_put_interface_async(usbhid->intf);
484 return; 484 return;
485 } 485 }
486 486
487 clear_bit(HID_CTRL_RUNNING, &usbhid->iofl); 487 clear_bit(HID_CTRL_RUNNING, &usbhid->iofl);
488 spin_unlock(&usbhid->lock); 488 spin_unlock(&usbhid->lock);
489 usb_autopm_put_interface_async(usbhid->intf);
489 wake_up(&usbhid->wait); 490 wake_up(&usbhid->wait);
490} 491}
491 492
@@ -501,13 +502,13 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
501 502
502 if (usbhid->urbout && dir == USB_DIR_OUT && report->type == HID_OUTPUT_REPORT) { 503 if (usbhid->urbout && dir == USB_DIR_OUT && report->type == HID_OUTPUT_REPORT) {
503 if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) { 504 if ((head = (usbhid->outhead + 1) & (HID_OUTPUT_FIFO_SIZE - 1)) == usbhid->outtail) {
504 dev_warn(&hid->dev, "output queue full\n"); 505 hid_warn(hid, "output queue full\n");
505 return; 506 return;
506 } 507 }
507 508
508 usbhid->out[usbhid->outhead].raw_report = kmalloc(len, GFP_ATOMIC); 509 usbhid->out[usbhid->outhead].raw_report = kmalloc(len, GFP_ATOMIC);
509 if (!usbhid->out[usbhid->outhead].raw_report) { 510 if (!usbhid->out[usbhid->outhead].raw_report) {
510 dev_warn(&hid->dev, "output queueing failed\n"); 511 hid_warn(hid, "output queueing failed\n");
511 return; 512 return;
512 } 513 }
513 hid_output_report(report, usbhid->out[usbhid->outhead].raw_report); 514 hid_output_report(report, usbhid->out[usbhid->outhead].raw_report);
@@ -532,14 +533,14 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re
532 } 533 }
533 534
534 if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) { 535 if ((head = (usbhid->ctrlhead + 1) & (HID_CONTROL_FIFO_SIZE - 1)) == usbhid->ctrltail) {
535 dev_warn(&hid->dev, "control queue full\n"); 536 hid_warn(hid, "control queue full\n");
536 return; 537 return;
537 } 538 }
538 539
539 if (dir == USB_DIR_OUT) { 540 if (dir == USB_DIR_OUT) {
540 usbhid->ctrl[usbhid->ctrlhead].raw_report = kmalloc(len, GFP_ATOMIC); 541 usbhid->ctrl[usbhid->ctrlhead].raw_report = kmalloc(len, GFP_ATOMIC);
541 if (!usbhid->ctrl[usbhid->ctrlhead].raw_report) { 542 if (!usbhid->ctrl[usbhid->ctrlhead].raw_report) {
542 dev_warn(&hid->dev, "control queueing failed\n"); 543 hid_warn(hid, "control queueing failed\n");
543 return; 544 return;
544 } 545 }
545 hid_output_report(report, usbhid->ctrl[usbhid->ctrlhead].raw_report); 546 hid_output_report(report, usbhid->ctrl[usbhid->ctrlhead].raw_report);
@@ -590,7 +591,7 @@ static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, un
590 return -1; 591 return -1;
591 592
592 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) { 593 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) {
593 dev_warn(&dev->dev, "event field not found\n"); 594 hid_warn(dev, "event field not found\n");
594 return -1; 595 return -1;
595 } 596 }
596 597
@@ -656,7 +657,7 @@ int usbhid_open(struct hid_device *hid)
656 mutex_lock(&hid_open_mut); 657 mutex_lock(&hid_open_mut);
657 if (!hid->open++) { 658 if (!hid->open++) {
658 res = usb_autopm_get_interface(usbhid->intf); 659 res = usb_autopm_get_interface(usbhid->intf);
659 /* the device must be awake to reliable request remote wakeup */ 660 /* the device must be awake to reliably request remote wakeup */
660 if (res < 0) { 661 if (res < 0) {
661 hid->open--; 662 hid->open--;
662 mutex_unlock(&hid_open_mut); 663 mutex_unlock(&hid_open_mut);
@@ -722,7 +723,7 @@ void usbhid_init_reports(struct hid_device *hid)
722 } 723 }
723 724
724 if (err) 725 if (err)
725 dev_warn(&hid->dev, "timeout initializing reports\n"); 726 hid_warn(hid, "timeout initializing reports\n");
726} 727}
727 728
728/* 729/*
@@ -857,18 +858,6 @@ static void usbhid_restart_queues(struct usbhid_device *usbhid)
857 usbhid_restart_ctrl_queue(usbhid); 858 usbhid_restart_ctrl_queue(usbhid);
858} 859}
859 860
860static void __usbhid_restart_queues(struct work_struct *work)
861{
862 struct usbhid_device *usbhid =
863 container_of(work, struct usbhid_device, restart_work);
864 int r;
865
866 r = usb_autopm_get_interface(usbhid->intf);
867 if (r < 0)
868 return;
869 usb_autopm_put_interface(usbhid->intf);
870}
871
872static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) 861static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
873{ 862{
874 struct usbhid_device *usbhid = hid->driver_data; 863 struct usbhid_device *usbhid = hid->driver_data;
@@ -1140,8 +1129,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1140 if (usb_endpoint_is_int_in(&interface->endpoint[n].desc)) 1129 if (usb_endpoint_is_int_in(&interface->endpoint[n].desc))
1141 has_in++; 1130 has_in++;
1142 if (!has_in) { 1131 if (!has_in) {
1143 dev_err(&intf->dev, "couldn't find an input interrupt " 1132 hid_err(intf, "couldn't find an input interrupt endpoint\n");
1144 "endpoint\n");
1145 return -ENODEV; 1133 return -ENODEV;
1146 } 1134 }
1147 1135
@@ -1206,14 +1194,13 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1206 1194
1207 init_waitqueue_head(&usbhid->wait); 1195 init_waitqueue_head(&usbhid->wait);
1208 INIT_WORK(&usbhid->reset_work, hid_reset); 1196 INIT_WORK(&usbhid->reset_work, hid_reset);
1209 INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1210 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); 1197 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1211 spin_lock_init(&usbhid->lock); 1198 spin_lock_init(&usbhid->lock);
1212 1199
1213 ret = hid_add_device(hid); 1200 ret = hid_add_device(hid);
1214 if (ret) { 1201 if (ret) {
1215 if (ret != -ENODEV) 1202 if (ret != -ENODEV)
1216 dev_err(&intf->dev, "can't add hid device: %d\n", ret); 1203 hid_err(intf, "can't add hid device: %d\n", ret);
1217 goto err_free; 1204 goto err_free;
1218 } 1205 }
1219 1206
@@ -1241,7 +1228,6 @@ static void usbhid_disconnect(struct usb_interface *intf)
1241static void hid_cancel_delayed_stuff(struct usbhid_device *usbhid) 1228static void hid_cancel_delayed_stuff(struct usbhid_device *usbhid)
1242{ 1229{
1243 del_timer_sync(&usbhid->io_retry); 1230 del_timer_sync(&usbhid->io_retry);
1244 cancel_work_sync(&usbhid->restart_work);
1245 cancel_work_sync(&usbhid->reset_work); 1231 cancel_work_sync(&usbhid->reset_work);
1246} 1232}
1247 1233
@@ -1262,7 +1248,6 @@ static int hid_pre_reset(struct usb_interface *intf)
1262 spin_lock_irq(&usbhid->lock); 1248 spin_lock_irq(&usbhid->lock);
1263 set_bit(HID_RESET_PENDING, &usbhid->iofl); 1249 set_bit(HID_RESET_PENDING, &usbhid->iofl);
1264 spin_unlock_irq(&usbhid->lock); 1250 spin_unlock_irq(&usbhid->lock);
1265 cancel_work_sync(&usbhid->restart_work);
1266 hid_cease_io(usbhid); 1251 hid_cease_io(usbhid);
1267 1252
1268 return 0; 1253 return 0;
@@ -1461,9 +1446,6 @@ static int __init hid_init(void)
1461{ 1446{
1462 int retval = -ENOMEM; 1447 int retval = -ENOMEM;
1463 1448
1464 resumption_waker = create_freezeable_workqueue("usbhid_resumer");
1465 if (!resumption_waker)
1466 goto no_queue;
1467 retval = hid_register_driver(&hid_usb_driver); 1449 retval = hid_register_driver(&hid_usb_driver);
1468 if (retval) 1450 if (retval)
1469 goto hid_register_fail; 1451 goto hid_register_fail;
@@ -1481,8 +1463,6 @@ usb_register_fail:
1481usbhid_quirks_init_fail: 1463usbhid_quirks_init_fail:
1482 hid_unregister_driver(&hid_usb_driver); 1464 hid_unregister_driver(&hid_usb_driver);
1483hid_register_fail: 1465hid_register_fail:
1484 destroy_workqueue(resumption_waker);
1485no_queue:
1486 return retval; 1466 return retval;
1487} 1467}
1488 1468
@@ -1491,7 +1471,6 @@ static void __exit hid_exit(void)
1491 usb_deregister(&hid_driver); 1471 usb_deregister(&hid_driver);
1492 usbhid_quirks_exit(); 1472 usbhid_quirks_exit();
1493 hid_unregister_driver(&hid_usb_driver); 1473 hid_unregister_driver(&hid_usb_driver);
1494 destroy_workqueue(resumption_waker);
1495} 1474}
1496 1475
1497module_init(hid_init); 1476module_init(hid_init);
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index ef381d79cfa8..f91c136821f7 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -22,7 +22,7 @@
22 22
23/* #define DEBUG */ 23/* #define DEBUG */
24 24
25#define debug(format, arg...) pr_debug("hid-pidff: " format "\n" , ## arg) 25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26 26
27#include <linux/input.h> 27#include <linux/input.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
@@ -220,7 +220,7 @@ static int pidff_rescale_signed(int i, struct hid_field *field)
220static void pidff_set(struct pidff_usage *usage, u16 value) 220static void pidff_set(struct pidff_usage *usage, u16 value)
221{ 221{
222 usage->value[0] = pidff_rescale(value, 0xffff, usage->field); 222 usage->value[0] = pidff_rescale(value, 0xffff, usage->field);
223 debug("calculated from %d to %d", value, usage->value[0]); 223 pr_debug("calculated from %d to %d\n", value, usage->value[0]);
224} 224}
225 225
226static void pidff_set_signed(struct pidff_usage *usage, s16 value) 226static void pidff_set_signed(struct pidff_usage *usage, s16 value)
@@ -235,7 +235,7 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)
235 usage->value[0] = 235 usage->value[0] =
236 pidff_rescale(value, 0x7fff, usage->field); 236 pidff_rescale(value, 0x7fff, usage->field);
237 } 237 }
238 debug("calculated from %d to %d", value, usage->value[0]); 238 pr_debug("calculated from %d to %d\n", value, usage->value[0]);
239} 239}
240 240
241/* 241/*
@@ -259,8 +259,9 @@ static void pidff_set_envelope_report(struct pidff_device *pidff,
259 pidff->set_envelope[PID_ATTACK_TIME].value[0] = envelope->attack_length; 259 pidff->set_envelope[PID_ATTACK_TIME].value[0] = envelope->attack_length;
260 pidff->set_envelope[PID_FADE_TIME].value[0] = envelope->fade_length; 260 pidff->set_envelope[PID_FADE_TIME].value[0] = envelope->fade_length;
261 261
262 debug("attack %u => %d", envelope->attack_level, 262 hid_dbg(pidff->hid, "attack %u => %d\n",
263 pidff->set_envelope[PID_ATTACK_LEVEL].value[0]); 263 envelope->attack_level,
264 pidff->set_envelope[PID_ATTACK_LEVEL].value[0]);
264 265
265 usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE], 266 usbhid_submit_report(pidff->hid, pidff->reports[PID_SET_ENVELOPE],
266 USB_DIR_OUT); 267 USB_DIR_OUT);
@@ -466,33 +467,33 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
466 pidff->create_new_effect_type->value[0] = efnum; 467 pidff->create_new_effect_type->value[0] = efnum;
467 usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], 468 usbhid_submit_report(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT],
468 USB_DIR_OUT); 469 USB_DIR_OUT);
469 debug("create_new_effect sent, type: %d", efnum); 470 hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum);
470 471
471 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; 472 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0;
472 pidff->block_load_status->value[0] = 0; 473 pidff->block_load_status->value[0] = 0;
473 usbhid_wait_io(pidff->hid); 474 usbhid_wait_io(pidff->hid);
474 475
475 for (j = 0; j < 60; j++) { 476 for (j = 0; j < 60; j++) {
476 debug("pid_block_load requested"); 477 hid_dbg(pidff->hid, "pid_block_load requested\n");
477 usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD], 478 usbhid_submit_report(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
478 USB_DIR_IN); 479 USB_DIR_IN);
479 usbhid_wait_io(pidff->hid); 480 usbhid_wait_io(pidff->hid);
480 if (pidff->block_load_status->value[0] == 481 if (pidff->block_load_status->value[0] ==
481 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { 482 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) {
482 debug("device reported free memory: %d bytes", 483 hid_dbg(pidff->hid, "device reported free memory: %d bytes\n",
483 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ? 484 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ?
484 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1); 485 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);
485 return 0; 486 return 0;
486 } 487 }
487 if (pidff->block_load_status->value[0] == 488 if (pidff->block_load_status->value[0] ==
488 pidff->status_id[PID_BLOCK_LOAD_FULL]) { 489 pidff->status_id[PID_BLOCK_LOAD_FULL]) {
489 debug("not enough memory free: %d bytes", 490 hid_dbg(pidff->hid, "not enough memory free: %d bytes\n",
490 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ? 491 pidff->block_load[PID_RAM_POOL_AVAILABLE].value ?
491 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1); 492 pidff->block_load[PID_RAM_POOL_AVAILABLE].value[0] : -1);
492 return -ENOSPC; 493 return -ENOSPC;
493 } 494 }
494 } 495 }
495 printk(KERN_ERR "hid-pidff: pid_block_load failed 60 times\n"); 496 hid_err(pidff->hid, "pid_block_load failed 60 times\n");
496 return -EIO; 497 return -EIO;
497} 498}
498 499
@@ -546,7 +547,8 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id)
546 struct pidff_device *pidff = dev->ff->private; 547 struct pidff_device *pidff = dev->ff->private;
547 int pid_id = pidff->pid_id[effect_id]; 548 int pid_id = pidff->pid_id[effect_id];
548 549
549 debug("starting to erase %d/%d", effect_id, pidff->pid_id[effect_id]); 550 hid_dbg(pidff->hid, "starting to erase %d/%d\n",
551 effect_id, pidff->pid_id[effect_id]);
550 /* Wait for the queue to clear. We do not want a full fifo to 552 /* Wait for the queue to clear. We do not want a full fifo to
551 prevent the effect removal. */ 553 prevent the effect removal. */
552 usbhid_wait_io(pidff->hid); 554 usbhid_wait_io(pidff->hid);
@@ -604,8 +606,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
604 type_id = PID_SAW_DOWN; 606 type_id = PID_SAW_DOWN;
605 break; 607 break;
606 default: 608 default:
607 printk(KERN_ERR 609 hid_err(pidff->hid, "invalid waveform\n");
608 "hid-pidff: invalid waveform\n");
609 return -EINVAL; 610 return -EINVAL;
610 } 611 }
611 612
@@ -696,7 +697,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
696 break; 697 break;
697 698
698 default: 699 default:
699 printk(KERN_ERR "hid-pidff: invalid type\n"); 700 hid_err(pidff->hid, "invalid type\n");
700 return -EINVAL; 701 return -EINVAL;
701 } 702 }
702 703
@@ -704,7 +705,7 @@ static int pidff_upload_effect(struct input_dev *dev, struct ff_effect *effect,
704 pidff->pid_id[effect->id] = 705 pidff->pid_id[effect->id] =
705 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0]; 706 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0];
706 707
707 debug("uploaded"); 708 hid_dbg(pidff->hid, "uploaded\n");
708 709
709 return 0; 710 return 0;
710} 711}
@@ -770,14 +771,14 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
770 for (i = 0; i < report->maxfield; i++) { 771 for (i = 0; i < report->maxfield; i++) {
771 if (report->field[i]->maxusage != 772 if (report->field[i]->maxusage !=
772 report->field[i]->report_count) { 773 report->field[i]->report_count) {
773 debug("maxusage and report_count do not match, " 774 pr_debug("maxusage and report_count do not match, skipping\n");
774 "skipping");
775 continue; 775 continue;
776 } 776 }
777 for (j = 0; j < report->field[i]->maxusage; j++) { 777 for (j = 0; j < report->field[i]->maxusage; j++) {
778 if (report->field[i]->usage[j].hid == 778 if (report->field[i]->usage[j].hid ==
779 (HID_UP_PID | table[k])) { 779 (HID_UP_PID | table[k])) {
780 debug("found %d at %d->%d", k, i, j); 780 pr_debug("found %d at %d->%d\n",
781 k, i, j);
781 usage[k].field = report->field[i]; 782 usage[k].field = report->field[i];
782 usage[k].value = 783 usage[k].value =
783 &report->field[i]->value[j]; 784 &report->field[i]->value[j];
@@ -789,7 +790,7 @@ static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
789 break; 790 break;
790 } 791 }
791 if (!found && strict) { 792 if (!found && strict) {
792 debug("failed to locate %d", k); 793 pr_debug("failed to locate %d\n", k);
793 return -1; 794 return -1;
794 } 795 }
795 } 796 }
@@ -826,8 +827,8 @@ static void pidff_find_reports(struct hid_device *hid, int report_type,
826 continue; 827 continue;
827 ret = pidff_check_usage(report->field[0]->logical); 828 ret = pidff_check_usage(report->field[0]->logical);
828 if (ret != -1) { 829 if (ret != -1) {
829 debug("found usage 0x%02x from field->logical", 830 hid_dbg(hid, "found usage 0x%02x from field->logical\n",
830 pidff_reports[ret]); 831 pidff_reports[ret]);
831 pidff->reports[ret] = report; 832 pidff->reports[ret] = report;
832 continue; 833 continue;
833 } 834 }
@@ -845,8 +846,9 @@ static void pidff_find_reports(struct hid_device *hid, int report_type,
845 continue; 846 continue;
846 ret = pidff_check_usage(hid->collection[i - 1].usage); 847 ret = pidff_check_usage(hid->collection[i - 1].usage);
847 if (ret != -1 && !pidff->reports[ret]) { 848 if (ret != -1 && !pidff->reports[ret]) {
848 debug("found usage 0x%02x from collection array", 849 hid_dbg(hid,
849 pidff_reports[ret]); 850 "found usage 0x%02x from collection array\n",
851 pidff_reports[ret]);
850 pidff->reports[ret] = report; 852 pidff->reports[ret] = report;
851 } 853 }
852 } 854 }
@@ -861,7 +863,7 @@ static int pidff_reports_ok(struct pidff_device *pidff)
861 863
862 for (i = 0; i <= PID_REQUIRED_REPORTS; i++) { 864 for (i = 0; i <= PID_REQUIRED_REPORTS; i++) {
863 if (!pidff->reports[i]) { 865 if (!pidff->reports[i]) {
864 debug("%d missing", i); 866 hid_dbg(pidff->hid, "%d missing\n", i);
865 return 0; 867 return 0;
866 } 868 }
867 } 869 }
@@ -884,8 +886,7 @@ static struct hid_field *pidff_find_special_field(struct hid_report *report,
884 report->field[i]->logical_minimum == 1) 886 report->field[i]->logical_minimum == 1)
885 return report->field[i]; 887 return report->field[i];
886 else { 888 else {
887 printk(KERN_ERR "hid-pidff: logical_minimum " 889 pr_err("logical_minimum is not 1 as it should be\n");
888 "is not 1 as it should be\n");
889 return NULL; 890 return NULL;
890 } 891 }
891 } 892 }
@@ -924,7 +925,7 @@ static int pidff_find_special_keys(int *keys, struct hid_field *fld,
924 */ 925 */
925static int pidff_find_special_fields(struct pidff_device *pidff) 926static int pidff_find_special_fields(struct pidff_device *pidff)
926{ 927{
927 debug("finding special fields"); 928 hid_dbg(pidff->hid, "finding special fields\n");
928 929
929 pidff->create_new_effect_type = 930 pidff->create_new_effect_type =
930 pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT], 931 pidff_find_special_field(pidff->reports[PID_CREATE_NEW_EFFECT],
@@ -945,32 +946,30 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
945 pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION], 946 pidff_find_special_field(pidff->reports[PID_EFFECT_OPERATION],
946 0x78, 1); 947 0x78, 1);
947 948
948 debug("search done"); 949 hid_dbg(pidff->hid, "search done\n");
949 950
950 if (!pidff->create_new_effect_type || !pidff->set_effect_type) { 951 if (!pidff->create_new_effect_type || !pidff->set_effect_type) {
951 printk(KERN_ERR "hid-pidff: effect lists not found\n"); 952 hid_err(pidff->hid, "effect lists not found\n");
952 return -1; 953 return -1;
953 } 954 }
954 955
955 if (!pidff->effect_direction) { 956 if (!pidff->effect_direction) {
956 printk(KERN_ERR "hid-pidff: direction field not found\n"); 957 hid_err(pidff->hid, "direction field not found\n");
957 return -1; 958 return -1;
958 } 959 }
959 960
960 if (!pidff->device_control) { 961 if (!pidff->device_control) {
961 printk(KERN_ERR "hid-pidff: device control field not found\n"); 962 hid_err(pidff->hid, "device control field not found\n");
962 return -1; 963 return -1;
963 } 964 }
964 965
965 if (!pidff->block_load_status) { 966 if (!pidff->block_load_status) {
966 printk(KERN_ERR 967 hid_err(pidff->hid, "block load status field not found\n");
967 "hid-pidff: block load status field not found\n");
968 return -1; 968 return -1;
969 } 969 }
970 970
971 if (!pidff->effect_operation_status) { 971 if (!pidff->effect_operation_status) {
972 printk(KERN_ERR 972 hid_err(pidff->hid, "effect operation field not found\n");
973 "hid-pidff: effect operation field not found\n");
974 return -1; 973 return -1;
975 } 974 }
976 975
@@ -982,23 +981,22 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
982 981
983 if (!PIDFF_FIND_SPECIAL_KEYS(type_id, create_new_effect_type, 982 if (!PIDFF_FIND_SPECIAL_KEYS(type_id, create_new_effect_type,
984 effect_types)) { 983 effect_types)) {
985 printk(KERN_ERR "hid-pidff: no effect types found\n"); 984 hid_err(pidff->hid, "no effect types found\n");
986 return -1; 985 return -1;
987 } 986 }
988 987
989 if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status, 988 if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status,
990 block_load_status) != 989 block_load_status) !=
991 sizeof(pidff_block_load_status)) { 990 sizeof(pidff_block_load_status)) {
992 printk(KERN_ERR 991 hid_err(pidff->hid,
993 "hidpidff: block load status identifiers not found\n"); 992 "block load status identifiers not found\n");
994 return -1; 993 return -1;
995 } 994 }
996 995
997 if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status, 996 if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status,
998 effect_operation_status) != 997 effect_operation_status) !=
999 sizeof(pidff_effect_operation_status)) { 998 sizeof(pidff_effect_operation_status)) {
1000 printk(KERN_ERR 999 hid_err(pidff->hid, "effect operation identifiers not found\n");
1001 "hidpidff: effect operation identifiers not found\n");
1002 return -1; 1000 return -1;
1003 } 1001 }
1004 1002
@@ -1017,8 +1015,8 @@ static int pidff_find_effects(struct pidff_device *pidff,
1017 int pidff_type = pidff->type_id[i]; 1015 int pidff_type = pidff->type_id[i];
1018 if (pidff->set_effect_type->usage[pidff_type].hid != 1016 if (pidff->set_effect_type->usage[pidff_type].hid !=
1019 pidff->create_new_effect_type->usage[pidff_type].hid) { 1017 pidff->create_new_effect_type->usage[pidff_type].hid) {
1020 printk(KERN_ERR "hid-pidff: " 1018 hid_err(pidff->hid,
1021 "effect type number %d is invalid\n", i); 1019 "effect type number %d is invalid\n", i);
1022 return -1; 1020 return -1;
1023 } 1021 }
1024 } 1022 }
@@ -1073,27 +1071,23 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1073 int envelope_ok = 0; 1071 int envelope_ok = 0;
1074 1072
1075 if (PIDFF_FIND_FIELDS(set_effect, PID_SET_EFFECT, 1)) { 1073 if (PIDFF_FIND_FIELDS(set_effect, PID_SET_EFFECT, 1)) {
1076 printk(KERN_ERR 1074 hid_err(pidff->hid, "unknown set_effect report layout\n");
1077 "hid-pidff: unknown set_effect report layout\n");
1078 return -ENODEV; 1075 return -ENODEV;
1079 } 1076 }
1080 1077
1081 PIDFF_FIND_FIELDS(block_load, PID_BLOCK_LOAD, 0); 1078 PIDFF_FIND_FIELDS(block_load, PID_BLOCK_LOAD, 0);
1082 if (!pidff->block_load[PID_EFFECT_BLOCK_INDEX].value) { 1079 if (!pidff->block_load[PID_EFFECT_BLOCK_INDEX].value) {
1083 printk(KERN_ERR 1080 hid_err(pidff->hid, "unknown pid_block_load report layout\n");
1084 "hid-pidff: unknown pid_block_load report layout\n");
1085 return -ENODEV; 1081 return -ENODEV;
1086 } 1082 }
1087 1083
1088 if (PIDFF_FIND_FIELDS(effect_operation, PID_EFFECT_OPERATION, 1)) { 1084 if (PIDFF_FIND_FIELDS(effect_operation, PID_EFFECT_OPERATION, 1)) {
1089 printk(KERN_ERR 1085 hid_err(pidff->hid, "unknown effect_operation report layout\n");
1090 "hid-pidff: unknown effect_operation report layout\n");
1091 return -ENODEV; 1086 return -ENODEV;
1092 } 1087 }
1093 1088
1094 if (PIDFF_FIND_FIELDS(block_free, PID_BLOCK_FREE, 1)) { 1089 if (PIDFF_FIND_FIELDS(block_free, PID_BLOCK_FREE, 1)) {
1095 printk(KERN_ERR 1090 hid_err(pidff->hid, "unknown pid_block_free report layout\n");
1096 "hid-pidff: unknown pid_block_free report layout\n");
1097 return -ENODEV; 1091 return -ENODEV;
1098 } 1092 }
1099 1093
@@ -1105,27 +1099,26 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1105 1099
1106 if (!envelope_ok) { 1100 if (!envelope_ok) {
1107 if (test_and_clear_bit(FF_CONSTANT, dev->ffbit)) 1101 if (test_and_clear_bit(FF_CONSTANT, dev->ffbit))
1108 printk(KERN_WARNING "hid-pidff: " 1102 hid_warn(pidff->hid,
1109 "has constant effect but no envelope\n"); 1103 "has constant effect but no envelope\n");
1110 if (test_and_clear_bit(FF_RAMP, dev->ffbit)) 1104 if (test_and_clear_bit(FF_RAMP, dev->ffbit))
1111 printk(KERN_WARNING "hid-pidff: " 1105 hid_warn(pidff->hid,
1112 "has ramp effect but no envelope\n"); 1106 "has ramp effect but no envelope\n");
1113 1107
1114 if (test_and_clear_bit(FF_PERIODIC, dev->ffbit)) 1108 if (test_and_clear_bit(FF_PERIODIC, dev->ffbit))
1115 printk(KERN_WARNING "hid-pidff: " 1109 hid_warn(pidff->hid,
1116 "has periodic effect but no envelope\n"); 1110 "has periodic effect but no envelope\n");
1117 } 1111 }
1118 1112
1119 if (test_bit(FF_CONSTANT, dev->ffbit) && 1113 if (test_bit(FF_CONSTANT, dev->ffbit) &&
1120 PIDFF_FIND_FIELDS(set_constant, PID_SET_CONSTANT, 1)) { 1114 PIDFF_FIND_FIELDS(set_constant, PID_SET_CONSTANT, 1)) {
1121 printk(KERN_WARNING 1115 hid_warn(pidff->hid, "unknown constant effect layout\n");
1122 "hid-pidff: unknown constant effect layout\n");
1123 clear_bit(FF_CONSTANT, dev->ffbit); 1116 clear_bit(FF_CONSTANT, dev->ffbit);
1124 } 1117 }
1125 1118
1126 if (test_bit(FF_RAMP, dev->ffbit) && 1119 if (test_bit(FF_RAMP, dev->ffbit) &&
1127 PIDFF_FIND_FIELDS(set_ramp, PID_SET_RAMP, 1)) { 1120 PIDFF_FIND_FIELDS(set_ramp, PID_SET_RAMP, 1)) {
1128 printk(KERN_WARNING "hid-pidff: unknown ramp effect layout\n"); 1121 hid_warn(pidff->hid, "unknown ramp effect layout\n");
1129 clear_bit(FF_RAMP, dev->ffbit); 1122 clear_bit(FF_RAMP, dev->ffbit);
1130 } 1123 }
1131 1124
@@ -1134,8 +1127,7 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1134 test_bit(FF_FRICTION, dev->ffbit) || 1127 test_bit(FF_FRICTION, dev->ffbit) ||
1135 test_bit(FF_INERTIA, dev->ffbit)) && 1128 test_bit(FF_INERTIA, dev->ffbit)) &&
1136 PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) { 1129 PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) {
1137 printk(KERN_WARNING 1130 hid_warn(pidff->hid, "unknown condition effect layout\n");
1138 "hid-pidff: unknown condition effect layout\n");
1139 clear_bit(FF_SPRING, dev->ffbit); 1131 clear_bit(FF_SPRING, dev->ffbit);
1140 clear_bit(FF_DAMPER, dev->ffbit); 1132 clear_bit(FF_DAMPER, dev->ffbit);
1141 clear_bit(FF_FRICTION, dev->ffbit); 1133 clear_bit(FF_FRICTION, dev->ffbit);
@@ -1144,8 +1136,7 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
1144 1136
1145 if (test_bit(FF_PERIODIC, dev->ffbit) && 1137 if (test_bit(FF_PERIODIC, dev->ffbit) &&
1146 PIDFF_FIND_FIELDS(set_periodic, PID_SET_PERIODIC, 1)) { 1138 PIDFF_FIND_FIELDS(set_periodic, PID_SET_PERIODIC, 1)) {
1147 printk(KERN_WARNING 1139 hid_warn(pidff->hid, "unknown periodic effect layout\n");
1148 "hid-pidff: unknown periodic effect layout\n");
1149 clear_bit(FF_PERIODIC, dev->ffbit); 1140 clear_bit(FF_PERIODIC, dev->ffbit);
1150 } 1141 }
1151 1142
@@ -1184,12 +1175,12 @@ static void pidff_reset(struct pidff_device *pidff)
1184 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { 1175 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) {
1185 while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { 1176 while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) {
1186 if (i++ > 20) { 1177 if (i++ > 20) {
1187 printk(KERN_WARNING "hid-pidff: device reports " 1178 hid_warn(pidff->hid,
1188 "%d simultaneous effects\n", 1179 "device reports %d simultaneous effects\n",
1189 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); 1180 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
1190 break; 1181 break;
1191 } 1182 }
1192 debug("pid_pool requested again"); 1183 hid_dbg(pidff->hid, "pid_pool requested again\n");
1193 usbhid_submit_report(hid, pidff->reports[PID_POOL], 1184 usbhid_submit_report(hid, pidff->reports[PID_POOL],
1194 USB_DIR_IN); 1185 USB_DIR_IN);
1195 usbhid_wait_io(hid); 1186 usbhid_wait_io(hid);
@@ -1215,7 +1206,7 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
1215 1206
1216 error = pidff_request_effect_upload(pidff, 1); 1207 error = pidff_request_effect_upload(pidff, 1);
1217 if (error) { 1208 if (error) {
1218 printk(KERN_ERR "hid-pidff: upload request failed\n"); 1209 hid_err(pidff->hid, "upload request failed\n");
1219 return error; 1210 return error;
1220 } 1211 }
1221 1212
@@ -1224,8 +1215,8 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
1224 pidff_autocenter(pidff, 0xffff); 1215 pidff_autocenter(pidff, 0xffff);
1225 set_bit(FF_AUTOCENTER, dev->ffbit); 1216 set_bit(FF_AUTOCENTER, dev->ffbit);
1226 } else { 1217 } else {
1227 printk(KERN_NOTICE "hid-pidff: " 1218 hid_notice(pidff->hid,
1228 "device has unknown autocenter control method\n"); 1219 "device has unknown autocenter control method\n");
1229 } 1220 }
1230 1221
1231 pidff_erase_pid(pidff, 1222 pidff_erase_pid(pidff,
@@ -1248,10 +1239,10 @@ int hid_pidff_init(struct hid_device *hid)
1248 int max_effects; 1239 int max_effects;
1249 int error; 1240 int error;
1250 1241
1251 debug("starting pid init"); 1242 hid_dbg(hid, "starting pid init\n");
1252 1243
1253 if (list_empty(&hid->report_enum[HID_OUTPUT_REPORT].report_list)) { 1244 if (list_empty(&hid->report_enum[HID_OUTPUT_REPORT].report_list)) {
1254 debug("not a PID device, no output report"); 1245 hid_dbg(hid, "not a PID device, no output report\n");
1255 return -ENODEV; 1246 return -ENODEV;
1256 } 1247 }
1257 1248
@@ -1265,7 +1256,7 @@ int hid_pidff_init(struct hid_device *hid)
1265 pidff_find_reports(hid, HID_FEATURE_REPORT, pidff); 1256 pidff_find_reports(hid, HID_FEATURE_REPORT, pidff);
1266 1257
1267 if (!pidff_reports_ok(pidff)) { 1258 if (!pidff_reports_ok(pidff)) {
1268 debug("reports not ok, aborting"); 1259 hid_dbg(hid, "reports not ok, aborting\n");
1269 error = -ENODEV; 1260 error = -ENODEV;
1270 goto fail; 1261 goto fail;
1271 } 1262 }
@@ -1278,8 +1269,8 @@ int hid_pidff_init(struct hid_device *hid)
1278 1269
1279 if (test_bit(FF_GAIN, dev->ffbit)) { 1270 if (test_bit(FF_GAIN, dev->ffbit)) {
1280 pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff); 1271 pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], 0xffff);
1281 usbhid_submit_report(pidff->hid, pidff->reports[PID_DEVICE_GAIN], 1272 usbhid_submit_report(hid, pidff->reports[PID_DEVICE_GAIN],
1282 USB_DIR_OUT); 1273 USB_DIR_OUT);
1283 } 1274 }
1284 1275
1285 error = pidff_check_autocenter(pidff, dev); 1276 error = pidff_check_autocenter(pidff, dev);
@@ -1290,23 +1281,23 @@ int hid_pidff_init(struct hid_device *hid)
1290 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_maximum - 1281 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_maximum -
1291 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_minimum + 1282 pidff->block_load[PID_EFFECT_BLOCK_INDEX].field->logical_minimum +
1292 1; 1283 1;
1293 debug("max effects is %d", max_effects); 1284 hid_dbg(hid, "max effects is %d\n", max_effects);
1294 1285
1295 if (max_effects > PID_EFFECTS_MAX) 1286 if (max_effects > PID_EFFECTS_MAX)
1296 max_effects = PID_EFFECTS_MAX; 1287 max_effects = PID_EFFECTS_MAX;
1297 1288
1298 if (pidff->pool[PID_SIMULTANEOUS_MAX].value) 1289 if (pidff->pool[PID_SIMULTANEOUS_MAX].value)
1299 debug("max simultaneous effects is %d", 1290 hid_dbg(hid, "max simultaneous effects is %d\n",
1300 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); 1291 pidff->pool[PID_SIMULTANEOUS_MAX].value[0]);
1301 1292
1302 if (pidff->pool[PID_RAM_POOL_SIZE].value) 1293 if (pidff->pool[PID_RAM_POOL_SIZE].value)
1303 debug("device memory size is %d bytes", 1294 hid_dbg(hid, "device memory size is %d bytes\n",
1304 pidff->pool[PID_RAM_POOL_SIZE].value[0]); 1295 pidff->pool[PID_RAM_POOL_SIZE].value[0]);
1305 1296
1306 if (pidff->pool[PID_DEVICE_MANAGED_POOL].value && 1297 if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
1307 pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) { 1298 pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
1308 printk(KERN_NOTICE "hid-pidff: " 1299 hid_notice(hid,
1309 "device does not support device managed pool\n"); 1300 "device does not support device managed pool\n");
1310 goto fail; 1301 goto fail;
1311 } 1302 }
1312 1303
@@ -1322,8 +1313,7 @@ int hid_pidff_init(struct hid_device *hid)
1322 ff->set_autocenter = pidff_set_autocenter; 1313 ff->set_autocenter = pidff_set_autocenter;
1323 ff->playback = pidff_playback; 1314 ff->playback = pidff_playback;
1324 1315
1325 printk(KERN_INFO "Force feedback for USB HID PID devices by " 1316 hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
1326 "Anssi Hannula <anssi.hannula@gmail.com>\n");
1327 1317
1328 return 0; 1318 return 0;
1329 1319
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 2c185477eeb3..76b9a149c7df 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -85,7 +85,7 @@ static const struct hid_blacklist {
85 { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, 85 { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE },
86 86
87 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT }, 87 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT },
88 88 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT },
89 { 0, 0 } 89 { 0, 0 }
90}; 90};
91 91
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 984feb351a5a..af0a7c1002af 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -585,163 +585,168 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
585{ 585{
586 struct hiddev_list *list = file->private_data; 586 struct hiddev_list *list = file->private_data;
587 struct hiddev *hiddev = list->hiddev; 587 struct hiddev *hiddev = list->hiddev;
588 struct hid_device *hid = hiddev->hid; 588 struct hid_device *hid;
589 struct usb_device *dev;
590 struct hiddev_collection_info cinfo; 589 struct hiddev_collection_info cinfo;
591 struct hiddev_report_info rinfo; 590 struct hiddev_report_info rinfo;
592 struct hiddev_field_info finfo; 591 struct hiddev_field_info finfo;
593 struct hiddev_devinfo dinfo; 592 struct hiddev_devinfo dinfo;
594 struct hid_report *report; 593 struct hid_report *report;
595 struct hid_field *field; 594 struct hid_field *field;
596 struct usbhid_device *usbhid = hid->driver_data;
597 void __user *user_arg = (void __user *)arg; 595 void __user *user_arg = (void __user *)arg;
598 int i, r; 596 int i, r = -EINVAL;
599 597
600 /* Called without BKL by compat methods so no BKL taken */ 598 /* Called without BKL by compat methods so no BKL taken */
601 599
602 /* FIXME: Who or what stop this racing with a disconnect ?? */ 600 mutex_lock(&hiddev->existancelock);
603 if (!hiddev->exist || !hid) 601 if (!hiddev->exist) {
604 return -EIO; 602 r = -ENODEV;
603 goto ret_unlock;
604 }
605 605
606 dev = hid_to_usb_dev(hid); 606 hid = hiddev->hid;
607 607
608 switch (cmd) { 608 switch (cmd) {
609 609
610 case HIDIOCGVERSION: 610 case HIDIOCGVERSION:
611 return put_user(HID_VERSION, (int __user *)arg); 611 r = put_user(HID_VERSION, (int __user *)arg) ?
612 -EFAULT : 0;
613 break;
612 614
613 case HIDIOCAPPLICATION: 615 case HIDIOCAPPLICATION:
614 if (arg < 0 || arg >= hid->maxapplication) 616 if (arg < 0 || arg >= hid->maxapplication)
615 return -EINVAL; 617 break;
616 618
617 for (i = 0; i < hid->maxcollection; i++) 619 for (i = 0; i < hid->maxcollection; i++)
618 if (hid->collection[i].type == 620 if (hid->collection[i].type ==
619 HID_COLLECTION_APPLICATION && arg-- == 0) 621 HID_COLLECTION_APPLICATION && arg-- == 0)
620 break; 622 break;
621 623
622 if (i == hid->maxcollection) 624 if (i < hid->maxcollection)
623 return -EINVAL; 625 r = hid->collection[i].usage;
624 626 break;
625 return hid->collection[i].usage;
626 627
627 case HIDIOCGDEVINFO: 628 case HIDIOCGDEVINFO:
628 dinfo.bustype = BUS_USB; 629 {
629 dinfo.busnum = dev->bus->busnum; 630 struct usb_device *dev = hid_to_usb_dev(hid);
630 dinfo.devnum = dev->devnum; 631 struct usbhid_device *usbhid = hid->driver_data;
631 dinfo.ifnum = usbhid->ifnum; 632
632 dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor); 633 dinfo.bustype = BUS_USB;
633 dinfo.product = le16_to_cpu(dev->descriptor.idProduct); 634 dinfo.busnum = dev->bus->busnum;
634 dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice); 635 dinfo.devnum = dev->devnum;
635 dinfo.num_applications = hid->maxapplication; 636 dinfo.ifnum = usbhid->ifnum;
636 if (copy_to_user(user_arg, &dinfo, sizeof(dinfo))) 637 dinfo.vendor = le16_to_cpu(dev->descriptor.idVendor);
637 return -EFAULT; 638 dinfo.product = le16_to_cpu(dev->descriptor.idProduct);
638 639 dinfo.version = le16_to_cpu(dev->descriptor.bcdDevice);
639 return 0; 640 dinfo.num_applications = hid->maxapplication;
641
642 r = copy_to_user(user_arg, &dinfo, sizeof(dinfo)) ?
643 -EFAULT : 0;
644 break;
645 }
640 646
641 case HIDIOCGFLAG: 647 case HIDIOCGFLAG:
642 if (put_user(list->flags, (int __user *)arg)) 648 r = put_user(list->flags, (int __user *)arg) ?
643 return -EFAULT; 649 -EFAULT : 0;
644 650 break;
645 return 0;
646 651
647 case HIDIOCSFLAG: 652 case HIDIOCSFLAG:
648 { 653 {
649 int newflags; 654 int newflags;
650 if (get_user(newflags, (int __user *)arg)) 655
651 return -EFAULT; 656 if (get_user(newflags, (int __user *)arg)) {
657 r = -EFAULT;
658 break;
659 }
652 660
653 if ((newflags & ~HIDDEV_FLAGS) != 0 || 661 if ((newflags & ~HIDDEV_FLAGS) != 0 ||
654 ((newflags & HIDDEV_FLAG_REPORT) != 0 && 662 ((newflags & HIDDEV_FLAG_REPORT) != 0 &&
655 (newflags & HIDDEV_FLAG_UREF) == 0)) 663 (newflags & HIDDEV_FLAG_UREF) == 0))
656 return -EINVAL; 664 break;
657 665
658 list->flags = newflags; 666 list->flags = newflags;
659 667
660 return 0; 668 r = 0;
669 break;
661 } 670 }
662 671
663 case HIDIOCGSTRING: 672 case HIDIOCGSTRING:
664 mutex_lock(&hiddev->existancelock); 673 r = hiddev_ioctl_string(hiddev, cmd, user_arg);
665 if (hiddev->exist) 674 break;
666 r = hiddev_ioctl_string(hiddev, cmd, user_arg);
667 else
668 r = -ENODEV;
669 mutex_unlock(&hiddev->existancelock);
670 return r;
671 675
672 case HIDIOCINITREPORT: 676 case HIDIOCINITREPORT:
673 mutex_lock(&hiddev->existancelock);
674 if (!hiddev->exist) {
675 mutex_unlock(&hiddev->existancelock);
676 return -ENODEV;
677 }
678 usbhid_init_reports(hid); 677 usbhid_init_reports(hid);
679 mutex_unlock(&hiddev->existancelock); 678 r = 0;
680 679 break;
681 return 0;
682 680
683 case HIDIOCGREPORT: 681 case HIDIOCGREPORT:
684 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 682 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
685 return -EFAULT; 683 r = -EFAULT;
684 break;
685 }
686 686
687 if (rinfo.report_type == HID_REPORT_TYPE_OUTPUT) 687 if (rinfo.report_type == HID_REPORT_TYPE_OUTPUT)
688 return -EINVAL; 688 break;
689 689
690 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 690 report = hiddev_lookup_report(hid, &rinfo);
691 return -EINVAL; 691 if (report == NULL)
692 break;
692 693
693 mutex_lock(&hiddev->existancelock); 694 usbhid_submit_report(hid, report, USB_DIR_IN);
694 if (hiddev->exist) { 695 usbhid_wait_io(hid);
695 usbhid_submit_report(hid, report, USB_DIR_IN);
696 usbhid_wait_io(hid);
697 }
698 mutex_unlock(&hiddev->existancelock);
699 696
700 return 0; 697 r = 0;
698 break;
701 699
702 case HIDIOCSREPORT: 700 case HIDIOCSREPORT:
703 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 701 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
704 return -EFAULT; 702 r = -EFAULT;
703 break;
704 }
705 705
706 if (rinfo.report_type == HID_REPORT_TYPE_INPUT) 706 if (rinfo.report_type == HID_REPORT_TYPE_INPUT)
707 return -EINVAL; 707 break;
708 708
709 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 709 report = hiddev_lookup_report(hid, &rinfo);
710 return -EINVAL; 710 if (report == NULL)
711 break;
711 712
712 mutex_lock(&hiddev->existancelock); 713 usbhid_submit_report(hid, report, USB_DIR_OUT);
713 if (hiddev->exist) { 714 usbhid_wait_io(hid);
714 usbhid_submit_report(hid, report, USB_DIR_OUT);
715 usbhid_wait_io(hid);
716 }
717 mutex_unlock(&hiddev->existancelock);
718 715
719 return 0; 716 r = 0;
717 break;
720 718
721 case HIDIOCGREPORTINFO: 719 case HIDIOCGREPORTINFO:
722 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) 720 if (copy_from_user(&rinfo, user_arg, sizeof(rinfo))) {
723 return -EFAULT; 721 r = -EFAULT;
722 break;
723 }
724 724
725 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 725 report = hiddev_lookup_report(hid, &rinfo);
726 return -EINVAL; 726 if (report == NULL)
727 break;
727 728
728 rinfo.num_fields = report->maxfield; 729 rinfo.num_fields = report->maxfield;
729 730
730 if (copy_to_user(user_arg, &rinfo, sizeof(rinfo))) 731 r = copy_to_user(user_arg, &rinfo, sizeof(rinfo)) ?
731 return -EFAULT; 732 -EFAULT : 0;
732 733 break;
733 return 0;
734 734
735 case HIDIOCGFIELDINFO: 735 case HIDIOCGFIELDINFO:
736 if (copy_from_user(&finfo, user_arg, sizeof(finfo))) 736 if (copy_from_user(&finfo, user_arg, sizeof(finfo))) {
737 return -EFAULT; 737 r = -EFAULT;
738 break;
739 }
740
738 rinfo.report_type = finfo.report_type; 741 rinfo.report_type = finfo.report_type;
739 rinfo.report_id = finfo.report_id; 742 rinfo.report_id = finfo.report_id;
740 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 743
741 return -EINVAL; 744 report = hiddev_lookup_report(hid, &rinfo);
745 if (report == NULL)
746 break;
742 747
743 if (finfo.field_index >= report->maxfield) 748 if (finfo.field_index >= report->maxfield)
744 return -EINVAL; 749 break;
745 750
746 field = report->field[finfo.field_index]; 751 field = report->field[finfo.field_index];
747 memset(&finfo, 0, sizeof(finfo)); 752 memset(&finfo, 0, sizeof(finfo));
@@ -760,10 +765,9 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
760 finfo.unit_exponent = field->unit_exponent; 765 finfo.unit_exponent = field->unit_exponent;
761 finfo.unit = field->unit; 766 finfo.unit = field->unit;
762 767
763 if (copy_to_user(user_arg, &finfo, sizeof(finfo))) 768 r = copy_to_user(user_arg, &finfo, sizeof(finfo)) ?
764 return -EFAULT; 769 -EFAULT : 0;
765 770 break;
766 return 0;
767 771
768 case HIDIOCGUCODE: 772 case HIDIOCGUCODE:
769 /* fall through */ 773 /* fall through */
@@ -772,57 +776,66 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
772 case HIDIOCGUSAGES: 776 case HIDIOCGUSAGES:
773 case HIDIOCSUSAGES: 777 case HIDIOCSUSAGES:
774 case HIDIOCGCOLLECTIONINDEX: 778 case HIDIOCGCOLLECTIONINDEX:
775 mutex_lock(&hiddev->existancelock); 779 r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
776 if (hiddev->exist) 780 break;
777 r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
778 else
779 r = -ENODEV;
780 mutex_unlock(&hiddev->existancelock);
781 return r;
782 781
783 case HIDIOCGCOLLECTIONINFO: 782 case HIDIOCGCOLLECTIONINFO:
784 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) 783 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) {
785 return -EFAULT; 784 r = -EFAULT;
785 break;
786 }
786 787
787 if (cinfo.index >= hid->maxcollection) 788 if (cinfo.index >= hid->maxcollection)
788 return -EINVAL; 789 break;
789 790
790 cinfo.type = hid->collection[cinfo.index].type; 791 cinfo.type = hid->collection[cinfo.index].type;
791 cinfo.usage = hid->collection[cinfo.index].usage; 792 cinfo.usage = hid->collection[cinfo.index].usage;
792 cinfo.level = hid->collection[cinfo.index].level; 793 cinfo.level = hid->collection[cinfo.index].level;
793 794
794 if (copy_to_user(user_arg, &cinfo, sizeof(cinfo))) 795 r = copy_to_user(user_arg, &cinfo, sizeof(cinfo)) ?
795 return -EFAULT; 796 -EFAULT : 0;
796 return 0; 797 break;
797 798
798 default: 799 default:
799
800 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) 800 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ)
801 return -EINVAL; 801 break;
802 802
803 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) { 803 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGNAME(0))) {
804 int len; 804 int len;
805 if (!hid->name) 805
806 return 0; 806 if (!hid->name) {
807 r = 0;
808 break;
809 }
810
807 len = strlen(hid->name) + 1; 811 len = strlen(hid->name) + 1;
808 if (len > _IOC_SIZE(cmd)) 812 if (len > _IOC_SIZE(cmd))
809 len = _IOC_SIZE(cmd); 813 len = _IOC_SIZE(cmd);
810 return copy_to_user(user_arg, hid->name, len) ? 814 r = copy_to_user(user_arg, hid->name, len) ?
811 -EFAULT : len; 815 -EFAULT : len;
816 break;
812 } 817 }
813 818
814 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) { 819 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGPHYS(0))) {
815 int len; 820 int len;
816 if (!hid->phys) 821
817 return 0; 822 if (!hid->phys) {
823 r = 0;
824 break;
825 }
826
818 len = strlen(hid->phys) + 1; 827 len = strlen(hid->phys) + 1;
819 if (len > _IOC_SIZE(cmd)) 828 if (len > _IOC_SIZE(cmd))
820 len = _IOC_SIZE(cmd); 829 len = _IOC_SIZE(cmd);
821 return copy_to_user(user_arg, hid->phys, len) ? 830 r = copy_to_user(user_arg, hid->phys, len) ?
822 -EFAULT : len; 831 -EFAULT : len;
832 break;
823 } 833 }
824 } 834 }
825 return -EINVAL; 835
836ret_unlock:
837 mutex_unlock(&hiddev->existancelock);
838 return r;
826} 839}
827 840
828#ifdef CONFIG_COMPAT 841#ifdef CONFIG_COMPAT
@@ -892,7 +905,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
892 hiddev->exist = 1; 905 hiddev->exist = 1;
893 retval = usb_register_dev(usbhid->intf, &hiddev_class); 906 retval = usb_register_dev(usbhid->intf, &hiddev_class);
894 if (retval) { 907 if (retval) {
895 err_hid("Not able to get a minor for this device."); 908 hid_err(hid, "Not able to get a minor for this device\n");
896 hid->hiddev = NULL; 909 hid->hiddev = NULL;
897 kfree(hiddev); 910 kfree(hiddev);
898 return -1; 911 return -1;
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index 89d2e847dcc6..1673cac93d77 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -95,7 +95,6 @@ struct usbhid_device {
95 unsigned long stop_retry; /* Time to give up, in jiffies */ 95 unsigned long stop_retry; /* Time to give up, in jiffies */
96 unsigned int retry_delay; /* Delay length in ms */ 96 unsigned int retry_delay; /* Delay length in ms */
97 struct work_struct reset_work; /* Task context for resets */ 97 struct work_struct reset_work; /* Task context for resets */
98 struct work_struct restart_work; /* waking up for output to be done in a task */
99 wait_queue_head_t wait; /* For sleeping */ 98 wait_queue_head_t wait; /* For sleeping */
100 int ledcount; /* counting the number of active leds */ 99 int ledcount; /* counting the number of active leds */
101}; 100};
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index a948605564fb..065817329f03 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -24,6 +24,8 @@
24 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 24 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
25 */ 25 */
26 26
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28
27#include <linux/kernel.h> 29#include <linux/kernel.h>
28#include <linux/slab.h> 30#include <linux/slab.h>
29#include <linux/module.h> 31#include <linux/module.h>
@@ -104,16 +106,18 @@ static void usb_kbd_irq(struct urb *urb)
104 if (usb_kbd_keycode[kbd->old[i]]) 106 if (usb_kbd_keycode[kbd->old[i]])
105 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); 107 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0);
106 else 108 else
107 dev_info(&urb->dev->dev, 109 hid_info(urb->dev,
108 "Unknown key (scancode %#x) released.\n", kbd->old[i]); 110 "Unknown key (scancode %#x) released.\n",
111 kbd->old[i]);
109 } 112 }
110 113
111 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { 114 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) {
112 if (usb_kbd_keycode[kbd->new[i]]) 115 if (usb_kbd_keycode[kbd->new[i]])
113 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); 116 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1);
114 else 117 else
115 dev_info(&urb->dev->dev, 118 hid_info(urb->dev,
116 "Unknown key (scancode %#x) released.\n", kbd->new[i]); 119 "Unknown key (scancode %#x) released.\n",
120 kbd->new[i]);
117 } 121 }
118 } 122 }
119 123
@@ -124,9 +128,9 @@ static void usb_kbd_irq(struct urb *urb)
124resubmit: 128resubmit:
125 i = usb_submit_urb (urb, GFP_ATOMIC); 129 i = usb_submit_urb (urb, GFP_ATOMIC);
126 if (i) 130 if (i)
127 err_hid ("can't resubmit intr, %s-%s/input0, status %d", 131 hid_err(urb->dev, "can't resubmit intr, %s-%s/input0, status %d",
128 kbd->usbdev->bus->bus_name, 132 kbd->usbdev->bus->bus_name,
129 kbd->usbdev->devpath, i); 133 kbd->usbdev->devpath, i);
130} 134}
131 135
132static int usb_kbd_event(struct input_dev *dev, unsigned int type, 136static int usb_kbd_event(struct input_dev *dev, unsigned int type,
@@ -150,7 +154,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,
150 *(kbd->leds) = kbd->newleds; 154 *(kbd->leds) = kbd->newleds;
151 kbd->led->dev = kbd->usbdev; 155 kbd->led->dev = kbd->usbdev;
152 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) 156 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
153 err_hid("usb_submit_urb(leds) failed"); 157 pr_err("usb_submit_urb(leds) failed\n");
154 158
155 return 0; 159 return 0;
156} 160}
@@ -160,7 +164,7 @@ static void usb_kbd_led(struct urb *urb)
160 struct usb_kbd *kbd = urb->context; 164 struct usb_kbd *kbd = urb->context;
161 165
162 if (urb->status) 166 if (urb->status)
163 dev_warn(&urb->dev->dev, "led urb status %d received\n", 167 hid_warn(urb->dev, "led urb status %d received\n",
164 urb->status); 168 urb->status);
165 169
166 if (*(kbd->leds) == kbd->newleds) 170 if (*(kbd->leds) == kbd->newleds)
@@ -169,7 +173,7 @@ static void usb_kbd_led(struct urb *urb)
169 *(kbd->leds) = kbd->newleds; 173 *(kbd->leds) = kbd->newleds;
170 kbd->led->dev = kbd->usbdev; 174 kbd->led->dev = kbd->usbdev;
171 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) 175 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
172 err_hid("usb_submit_urb(leds) failed"); 176 hid_err(urb->dev, "usb_submit_urb(leds) failed\n");
173} 177}
174 178
175static int usb_kbd_open(struct input_dev *dev) 179static int usb_kbd_open(struct input_dev *dev)
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index b923074b2cbe..30f06e956bfb 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -75,8 +75,7 @@ config I2C_HELPER_AUTO
75 In doubt, say Y. 75 In doubt, say Y.
76 76
77config I2C_SMBUS 77config I2C_SMBUS
78 tristate 78 tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO
79 prompt "SMBus-specific protocols" if !I2C_HELPER_AUTO
80 help 79 help
81 Say Y here if you want support for SMBus extensions to the I2C 80 Say Y here if you want support for SMBus extensions to the I2C
82 specification. At the moment, the only supported extension is 81 specification. At the moment, the only supported extension is
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
index 3998dd620a03..f1cfe7e5508b 100644
--- a/drivers/i2c/algos/Kconfig
+++ b/drivers/i2c/algos/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "I2C Algorithms" 5menu "I2C Algorithms"
6 depends on !I2C_HELPER_AUTO 6 visible if !I2C_HELPER_AUTO
7 7
8config I2C_ALGOBIT 8config I2C_ALGOBIT
9 tristate "I2C bit-banging interfaces" 9 tristate "I2C bit-banging interfaces"
@@ -15,15 +15,3 @@ config I2C_ALGOPCA
15 tristate "I2C PCA 9564 interfaces" 15 tristate "I2C PCA 9564 interfaces"
16 16
17endmenu 17endmenu
18
19# In automatic configuration mode, we still have to define the
20# symbols to avoid unmet dependencies.
21
22if I2C_HELPER_AUTO
23config I2C_ALGOBIT
24 tristate
25config I2C_ALGOPCF
26 tristate
27config I2C_ALGOPCA
28 tristate
29endif
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index d53b9e900234..27b6a3ce18ca 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -245,6 +245,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
245 goto err_free_tgfx; 245 goto err_free_tgfx;
246 } 246 }
247 247
248 parport_put_port(pp);
248 return tgfx; 249 return tgfx;
249 250
250 err_free_dev: 251 err_free_dev:
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index b8c51b9781db..3a87f3ba5f75 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -179,6 +179,22 @@ config KEYBOARD_GPIO
179 To compile this driver as a module, choose M here: the 179 To compile this driver as a module, choose M here: the
180 module will be called gpio_keys. 180 module will be called gpio_keys.
181 181
182config KEYBOARD_GPIO_POLLED
183 tristate "Polled GPIO buttons"
184 depends on GENERIC_GPIO
185 select INPUT_POLLDEV
186 help
187 This driver implements support for buttons connected
188 to GPIO pins that are not capable of generating interrupts.
189
190 Say Y here if your device has buttons connected
191 directly to such GPIO pins. Your board-specific
192 setup logic must also provide a platform device,
193 with configuration data saying which GPIOs are used.
194
195 To compile this driver as a module, choose M here: the
196 module will be called gpio_keys_polled.
197
182config KEYBOARD_TCA6416 198config KEYBOARD_TCA6416
183 tristate "TCA6416 Keypad Support" 199 tristate "TCA6416 Keypad Support"
184 depends on I2C 200 depends on I2C
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index a34452e8ebe2..622de73a445d 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
14obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o 14obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
15obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o 15obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o
16obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o 16obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
17obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o
17obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o 18obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
18obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o 19obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
19obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o 20obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
new file mode 100644
index 000000000000..4c17aff20657
--- /dev/null
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -0,0 +1,261 @@
1/*
2 * Driver for buttons on GPIO lines not capable of generating interrupts
3 *
4 * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com>
6 *
7 * This file was based on: /drivers/input/misc/cobalt_btns.c
8 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
9 *
10 * also was based on: /drivers/input/keyboard/gpio_keys.c
11 * Copyright 2005 Phil Blundell
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/slab.h>
22#include <linux/input.h>
23#include <linux/input-polldev.h>
24#include <linux/ioport.h>
25#include <linux/platform_device.h>
26#include <linux/gpio.h>
27#include <linux/gpio_keys.h>
28
29#define DRV_NAME "gpio-keys-polled"
30
31struct gpio_keys_button_data {
32 int last_state;
33 int count;
34 int threshold;
35 int can_sleep;
36};
37
38struct gpio_keys_polled_dev {
39 struct input_polled_dev *poll_dev;
40 struct device *dev;
41 struct gpio_keys_platform_data *pdata;
42 struct gpio_keys_button_data data[0];
43};
44
45static void gpio_keys_polled_check_state(struct input_dev *input,
46 struct gpio_keys_button *button,
47 struct gpio_keys_button_data *bdata)
48{
49 int state;
50
51 if (bdata->can_sleep)
52 state = !!gpio_get_value_cansleep(button->gpio);
53 else
54 state = !!gpio_get_value(button->gpio);
55
56 if (state != bdata->last_state) {
57 unsigned int type = button->type ?: EV_KEY;
58
59 input_event(input, type, button->code,
60 !!(state ^ button->active_low));
61 input_sync(input);
62 bdata->count = 0;
63 bdata->last_state = state;
64 }
65}
66
67static void gpio_keys_polled_poll(struct input_polled_dev *dev)
68{
69 struct gpio_keys_polled_dev *bdev = dev->private;
70 struct gpio_keys_platform_data *pdata = bdev->pdata;
71 struct input_dev *input = dev->input;
72 int i;
73
74 for (i = 0; i < bdev->pdata->nbuttons; i++) {
75 struct gpio_keys_button_data *bdata = &bdev->data[i];
76
77 if (bdata->count < bdata->threshold)
78 bdata->count++;
79 else
80 gpio_keys_polled_check_state(input, &pdata->buttons[i],
81 bdata);
82 }
83}
84
85static void gpio_keys_polled_open(struct input_polled_dev *dev)
86{
87 struct gpio_keys_polled_dev *bdev = dev->private;
88 struct gpio_keys_platform_data *pdata = bdev->pdata;
89
90 if (pdata->enable)
91 pdata->enable(bdev->dev);
92}
93
94static void gpio_keys_polled_close(struct input_polled_dev *dev)
95{
96 struct gpio_keys_polled_dev *bdev = dev->private;
97 struct gpio_keys_platform_data *pdata = bdev->pdata;
98
99 if (pdata->disable)
100 pdata->disable(bdev->dev);
101}
102
103static int __devinit gpio_keys_polled_probe(struct platform_device *pdev)
104{
105 struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
106 struct device *dev = &pdev->dev;
107 struct gpio_keys_polled_dev *bdev;
108 struct input_polled_dev *poll_dev;
109 struct input_dev *input;
110 int error;
111 int i;
112
113 if (!pdata || !pdata->poll_interval)
114 return -EINVAL;
115
116 bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
117 pdata->nbuttons * sizeof(struct gpio_keys_button_data),
118 GFP_KERNEL);
119 if (!bdev) {
120 dev_err(dev, "no memory for private data\n");
121 return -ENOMEM;
122 }
123
124 poll_dev = input_allocate_polled_device();
125 if (!poll_dev) {
126 dev_err(dev, "no memory for polled device\n");
127 error = -ENOMEM;
128 goto err_free_bdev;
129 }
130
131 poll_dev->private = bdev;
132 poll_dev->poll = gpio_keys_polled_poll;
133 poll_dev->poll_interval = pdata->poll_interval;
134 poll_dev->open = gpio_keys_polled_open;
135 poll_dev->close = gpio_keys_polled_close;
136
137 input = poll_dev->input;
138
139 input->evbit[0] = BIT(EV_KEY);
140 input->name = pdev->name;
141 input->phys = DRV_NAME"/input0";
142 input->dev.parent = &pdev->dev;
143
144 input->id.bustype = BUS_HOST;
145 input->id.vendor = 0x0001;
146 input->id.product = 0x0001;
147 input->id.version = 0x0100;
148
149 for (i = 0; i < pdata->nbuttons; i++) {
150 struct gpio_keys_button *button = &pdata->buttons[i];
151 struct gpio_keys_button_data *bdata = &bdev->data[i];
152 unsigned int gpio = button->gpio;
153 unsigned int type = button->type ?: EV_KEY;
154
155 if (button->wakeup) {
156 dev_err(dev, DRV_NAME " does not support wakeup\n");
157 error = -EINVAL;
158 goto err_free_gpio;
159 }
160
161 error = gpio_request(gpio,
162 button->desc ? button->desc : DRV_NAME);
163 if (error) {
164 dev_err(dev, "unable to claim gpio %u, err=%d\n",
165 gpio, error);
166 goto err_free_gpio;
167 }
168
169 error = gpio_direction_input(gpio);
170 if (error) {
171 dev_err(dev,
172 "unable to set direction on gpio %u, err=%d\n",
173 gpio, error);
174 goto err_free_gpio;
175 }
176
177 bdata->can_sleep = gpio_cansleep(gpio);
178 bdata->last_state = -1;
179 bdata->threshold = DIV_ROUND_UP(button->debounce_interval,
180 pdata->poll_interval);
181
182 input_set_capability(input, type, button->code);
183 }
184
185 bdev->poll_dev = poll_dev;
186 bdev->dev = dev;
187 bdev->pdata = pdata;
188 platform_set_drvdata(pdev, bdev);
189
190 error = input_register_polled_device(poll_dev);
191 if (error) {
192 dev_err(dev, "unable to register polled device, err=%d\n",
193 error);
194 goto err_free_gpio;
195 }
196
197 /* report initial state of the buttons */
198 for (i = 0; i < pdata->nbuttons; i++)
199 gpio_keys_polled_check_state(input, &pdata->buttons[i],
200 &bdev->data[i]);
201
202 return 0;
203
204err_free_gpio:
205 while (--i >= 0)
206 gpio_free(pdata->buttons[i].gpio);
207
208 input_free_polled_device(poll_dev);
209
210err_free_bdev:
211 kfree(bdev);
212
213 platform_set_drvdata(pdev, NULL);
214 return error;
215}
216
217static int __devexit gpio_keys_polled_remove(struct platform_device *pdev)
218{
219 struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev);
220 struct gpio_keys_platform_data *pdata = bdev->pdata;
221 int i;
222
223 input_unregister_polled_device(bdev->poll_dev);
224
225 for (i = 0; i < pdata->nbuttons; i++)
226 gpio_free(pdata->buttons[i].gpio);
227
228 input_free_polled_device(bdev->poll_dev);
229
230 kfree(bdev);
231 platform_set_drvdata(pdev, NULL);
232
233 return 0;
234}
235
236static struct platform_driver gpio_keys_polled_driver = {
237 .probe = gpio_keys_polled_probe,
238 .remove = __devexit_p(gpio_keys_polled_remove),
239 .driver = {
240 .name = DRV_NAME,
241 .owner = THIS_MODULE,
242 },
243};
244
245static int __init gpio_keys_polled_init(void)
246{
247 return platform_driver_register(&gpio_keys_polled_driver);
248}
249
250static void __exit gpio_keys_polled_exit(void)
251{
252 platform_driver_unregister(&gpio_keys_polled_driver);
253}
254
255module_init(gpio_keys_polled_init);
256module_exit(gpio_keys_polled_exit);
257
258MODULE_LICENSE("GPL v2");
259MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
260MODULE_DESCRIPTION("Polled GPIO Buttons driver");
261MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index b95231763911..ee82851afe3e 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -55,6 +55,14 @@
55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236 55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237 56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238 57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
58/* MacbookAir3,2 (unibody), aka wellspring5 */
59#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
60#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
61#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
62/* MacbookAir3,1 (unibody), aka wellspring4 */
63#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
64#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
65#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
58 66
59#define BCM5974_DEVICE(prod) { \ 67#define BCM5974_DEVICE(prod) { \
60 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ 68 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -80,6 +88,14 @@ static const struct usb_device_id bcm5974_table[] = {
80 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI), 88 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
81 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO), 89 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
82 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS), 90 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
91 /* MacbookAir3,2 */
92 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
93 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
94 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
95 /* MacbookAir3,1 */
96 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
97 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
98 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
83 /* Terminating entry */ 99 /* Terminating entry */
84 {} 100 {}
85}; 101};
@@ -234,6 +250,30 @@ static const struct bcm5974_config bcm5974_config_table[] = {
234 { DIM_X, DIM_X / SN_COORD, -4460, 5166 }, 250 { DIM_X, DIM_X / SN_COORD, -4460, 5166 },
235 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 } 251 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
236 }, 252 },
253 {
254 USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI,
255 USB_DEVICE_ID_APPLE_WELLSPRING4_ISO,
256 USB_DEVICE_ID_APPLE_WELLSPRING4_JIS,
257 HAS_INTEGRATED_BUTTON,
258 0x84, sizeof(struct bt_data),
259 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
260 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
261 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
262 { DIM_X, DIM_X / SN_COORD, -4620, 5140 },
263 { DIM_Y, DIM_Y / SN_COORD, -150, 6600 }
264 },
265 {
266 USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI,
267 USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO,
268 USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS,
269 HAS_INTEGRATED_BUTTON,
270 0x84, sizeof(struct bt_data),
271 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
272 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
273 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
274 { DIM_X, DIM_X / SN_COORD, -4616, 5112 },
275 { DIM_Y, DIM_Y / SN_COORD, -142, 5234 }
276 },
237 {} 277 {}
238}; 278};
239 279
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 613a3652f98f..0aefaa885871 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -51,7 +51,8 @@
51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) 53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
54#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) 54#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */
55#define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */
55#define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) 56#define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000)
56 57
57/* synaptics modes query bits */ 58/* synaptics modes query bits */
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index 3c287dd879d3..4225f5d6b15f 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -358,7 +358,7 @@ static int __devinit gscps2_probe(struct parisc_device *dev)
358 gscps2_reset(ps2port); 358 gscps2_reset(ps2port);
359 ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f; 359 ps2port->id = readb(ps2port->addr + GSC_ID) & 0x0f;
360 360
361 snprintf(serio->name, sizeof(serio->name), "GSC PS/2 %s", 361 snprintf(serio->name, sizeof(serio->name), "gsc-ps2-%s",
362 (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse"); 362 (ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse");
363 strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys)); 363 strlcpy(serio->phys, dev_name(&dev->dev), sizeof(serio->phys));
364 serio->id.type = SERIO_8042; 364 serio->id.type = SERIO_8042;
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index b3252ef1e279..4852b440960a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -1436,6 +1436,12 @@ static struct wacom_features wacom_features_0xD2 =
1436 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1436 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1437static struct wacom_features wacom_features_0xD3 = 1437static struct wacom_features wacom_features_0xD3 =
1438 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1438 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
1439static struct wacom_features wacom_features_0xD8 =
1440 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
1441static struct wacom_features wacom_features_0xDA =
1442 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1443static struct wacom_features wacom_features_0xDB =
1444 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
1439 1445
1440#define USB_DEVICE_WACOM(prod) \ 1446#define USB_DEVICE_WACOM(prod) \
1441 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ 1447 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1504,6 +1510,9 @@ const struct usb_device_id wacom_ids[] = {
1504 { USB_DEVICE_WACOM(0xD1) }, 1510 { USB_DEVICE_WACOM(0xD1) },
1505 { USB_DEVICE_WACOM(0xD2) }, 1511 { USB_DEVICE_WACOM(0xD2) },
1506 { USB_DEVICE_WACOM(0xD3) }, 1512 { USB_DEVICE_WACOM(0xD3) },
1513 { USB_DEVICE_WACOM(0xD8) },
1514 { USB_DEVICE_WACOM(0xDA) },
1515 { USB_DEVICE_WACOM(0xDB) },
1507 { USB_DEVICE_WACOM(0xF0) }, 1516 { USB_DEVICE_WACOM(0xF0) },
1508 { USB_DEVICE_WACOM(0xCC) }, 1517 { USB_DEVICE_WACOM(0xCC) },
1509 { USB_DEVICE_WACOM(0x90) }, 1518 { USB_DEVICE_WACOM(0x90) },
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index f45f80f6d336..73fd6642b681 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -178,6 +178,7 @@ static const struct usb_device_id usbtouch_devices[] = {
178 178
179#ifdef CONFIG_TOUCHSCREEN_USB_ITM 179#ifdef CONFIG_TOUCHSCREEN_USB_ITM
180 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, 180 {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM},
181 {USB_DEVICE(0x16e3, 0xf9e9), .driver_info = DEVTYPE_ITM},
181#endif 182#endif
182 183
183#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO 184#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig
index 2385e6cca635..78b089526e02 100644
--- a/drivers/media/common/tuners/Kconfig
+++ b/drivers/media/common/tuners/Kconfig
@@ -31,7 +31,7 @@ config MEDIA_TUNER
31 select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE 31 select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE
32 select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE 32 select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE
33 33
34menuconfig MEDIA_TUNER_CUSTOMISE 34config MEDIA_TUNER_CUSTOMISE
35 bool "Customize analog and hybrid tuner modules to build" 35 bool "Customize analog and hybrid tuner modules to build"
36 depends on MEDIA_TUNER 36 depends on MEDIA_TUNER
37 default y if EMBEDDED 37 default y if EMBEDDED
@@ -44,7 +44,8 @@ menuconfig MEDIA_TUNER_CUSTOMISE
44 44
45 If unsure say N. 45 If unsure say N.
46 46
47if MEDIA_TUNER_CUSTOMISE 47menu "Customize TV tuners"
48 visible if MEDIA_TUNER_CUSTOMISE
48 49
49config MEDIA_TUNER_SIMPLE 50config MEDIA_TUNER_SIMPLE
50 tristate "Simple tuner support" 51 tristate "Simple tuner support"
@@ -185,5 +186,4 @@ config MEDIA_TUNER_TDA18218
185 default m if MEDIA_TUNER_CUSTOMISE 186 default m if MEDIA_TUNER_CUSTOMISE
186 help 187 help
187 NXP TDA18218 silicon tuner driver. 188 NXP TDA18218 silicon tuner driver.
188 189endmenu
189endif # MEDIA_TUNER_CUSTOMISE
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index e9062b08a485..96b27016670e 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -12,9 +12,8 @@ config DVB_FE_CUSTOMISE
12 12
13 If unsure say N. 13 If unsure say N.
14 14
15if DVB_FE_CUSTOMISE
16
17menu "Customise DVB Frontends" 15menu "Customise DVB Frontends"
16 visible if DVB_FE_CUSTOMISE
18 17
19comment "Multistandard (satellite) frontends" 18comment "Multistandard (satellite) frontends"
20 depends on DVB_CORE 19 depends on DVB_CORE
@@ -619,5 +618,3 @@ config DVB_DUMMY_FE
619 tristate "Dummy frontend driver" 618 tristate "Dummy frontend driver"
620 default n 619 default n
621endmenu 620endmenu
622
623endif
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index ac16e815e275..6830d2848bd7 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -112,7 +112,7 @@ config VIDEO_IR_I2C
112# 112#
113 113
114menu "Encoders/decoders and other helper chips" 114menu "Encoders/decoders and other helper chips"
115 depends on !VIDEO_HELPER_CHIPS_AUTO 115 visible if !VIDEO_HELPER_CHIPS_AUTO
116 116
117comment "Audio decoders" 117comment "Audio decoders"
118 118
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index c2960ac9f39c..811775aa8ee8 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -482,10 +482,17 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
482 uint32_t data = 0; 482 uint32_t data = 0;
483 struct ubi_vid_hdr vid_hdr; 483 struct ubi_vid_hdr vid_hdr;
484 484
485 addr = (loff_t)pnum * ubi->peb_size + ubi->vid_hdr_aloffset; 485 /*
486 * It is important to first invalidate the EC header, and then the VID
487 * header. Otherwise a power cut may lead to valid EC header and
488 * invalid VID header, in which case UBI will treat this PEB as
489 * corrupted and will try to preserve it, and print scary warnings (see
490 * the header comment in scan.c for more information).
491 */
492 addr = (loff_t)pnum * ubi->peb_size;
486 err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); 493 err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data);
487 if (!err) { 494 if (!err) {
488 addr -= ubi->vid_hdr_aloffset; 495 addr += ubi->vid_hdr_aloffset;
489 err = ubi->mtd->write(ubi->mtd, addr, 4, &written, 496 err = ubi->mtd->write(ubi->mtd, addr, 4, &written,
490 (void *)&data); 497 (void *)&data);
491 if (!err) 498 if (!err)
@@ -494,18 +501,24 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
494 501
495 /* 502 /*
496 * We failed to write to the media. This was observed with Spansion 503 * We failed to write to the media. This was observed with Spansion
497 * S29GL512N NOR flash. Most probably the eraseblock erasure was 504 * S29GL512N NOR flash. Most probably the previously eraseblock erasure
498 * interrupted at a very inappropriate moment, so it became unwritable. 505 * was interrupted at a very inappropriate moment, so it became
499 * In this case we probably anyway have garbage in this PEB. 506 * unwritable. In this case we probably anyway have garbage in this
507 * PEB.
500 */ 508 */
501 err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); 509 err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0);
502 if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) 510 if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) {
503 /* 511 struct ubi_ec_hdr ec_hdr;
504 * The VID header is corrupted, so we can safely erase this 512
505 * PEB and not afraid that it will be treated as a valid PEB in 513 err1 = ubi_io_read_ec_hdr(ubi, pnum, &ec_hdr, 0);
506 * case of an unclean reboot. 514 if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR)
507 */ 515 /*
508 return 0; 516 * Both VID and EC headers are corrupted, so we can
517 * safely erase this PEB and not afraid that it will be
518 * treated as a valid PEB in case of an unclean reboot.
519 */
520 return 0;
521 }
509 522
510 /* 523 /*
511 * The PEB contains a valid VID header, but we cannot invalidate it. 524 * The PEB contains a valid VID header, but we cannot invalidate it.
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 204345be8e62..79ca304fc4db 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -953,6 +953,10 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
953 * impossible to distinguish it from a PEB which just 953 * impossible to distinguish it from a PEB which just
954 * contains garbage because of a power cut during erase 954 * contains garbage because of a power cut during erase
955 * operation. So we just schedule this PEB for erasure. 955 * operation. So we just schedule this PEB for erasure.
956 *
957 * Besides, in case of NOR flash, we deliberatly
958 * corrupt both headers because NOR flash erasure is
959 * slow and can start from the end.
956 */ 960 */
957 err = 0; 961 err = 0;
958 else 962 else
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index d9f51485beee..9383063d2b16 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -349,7 +349,6 @@ static struct irq_chip dino_interrupt_type = {
349 .name = "GSC-PCI", 349 .name = "GSC-PCI",
350 .unmask = dino_unmask_irq, 350 .unmask = dino_unmask_irq,
351 .mask = dino_mask_irq, 351 .mask = dino_mask_irq,
352 .ack = no_ack_irq,
353}; 352};
354 353
355 354
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index 1211974f55aa..e860038b0b84 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -186,7 +186,6 @@ static struct irq_chip eisa_interrupt_type = {
186 .name = "EISA", 186 .name = "EISA",
187 .unmask = eisa_unmask_irq, 187 .unmask = eisa_unmask_irq,
188 .mask = eisa_mask_irq, 188 .mask = eisa_mask_irq,
189 .ack = no_ack_irq,
190}; 189};
191 190
192static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) 191static irqreturn_t eisa_irq(int wax_irq, void *intr_dev)
@@ -340,7 +339,7 @@ static int __init eisa_probe(struct parisc_device *dev)
340 setup_irq(2, &irq2_action); 339 setup_irq(2, &irq2_action);
341 for (i = 0; i < 16; i++) { 340 for (i = 0; i < 16; i++) {
342 set_irq_chip_and_handler(i, &eisa_interrupt_type, 341 set_irq_chip_and_handler(i, &eisa_interrupt_type,
343 handle_level_irq); 342 handle_simple_irq);
344 } 343 }
345 344
346 EISA_bus = 1; 345 EISA_bus = 1;
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
index e605298e3aee..772b1939ac21 100644
--- a/drivers/parisc/gsc.c
+++ b/drivers/parisc/gsc.c
@@ -143,7 +143,6 @@ static struct irq_chip gsc_asic_interrupt_type = {
143 .name = "GSC-ASIC", 143 .name = "GSC-ASIC",
144 .unmask = gsc_asic_unmask_irq, 144 .unmask = gsc_asic_unmask_irq,
145 .mask = gsc_asic_mask_irq, 145 .mask = gsc_asic_mask_irq,
146 .ack = no_ack_irq,
147}; 146};
148 147
149int gsc_assign_irq(struct irq_chip *type, void *data) 148int gsc_assign_irq(struct irq_chip *type, void *data)
@@ -153,7 +152,7 @@ int gsc_assign_irq(struct irq_chip *type, void *data)
153 if (irq > GSC_IRQ_MAX) 152 if (irq > GSC_IRQ_MAX)
154 return NO_IRQ; 153 return NO_IRQ;
155 154
156 set_irq_chip_and_handler(irq, type, handle_level_irq); 155 set_irq_chip_and_handler(irq, type, handle_simple_irq);
157 set_irq_chip_data(irq, data); 156 set_irq_chip_data(irq, data);
158 157
159 return irq++; 158 return irq++;
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index a3120a09c43d..0327894bf235 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -669,6 +669,13 @@ printk("\n");
669 DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq, 669 DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq,
670 vi->eoi_addr, vi->eoi_data); 670 vi->eoi_addr, vi->eoi_data);
671 iosapic_eoi(vi->eoi_addr, vi->eoi_data); 671 iosapic_eoi(vi->eoi_addr, vi->eoi_data);
672}
673
674static void iosapic_eoi_irq(unsigned int irq)
675{
676 struct vector_info *vi = get_irq_chip_data(irq);
677
678 iosapic_eoi(vi->eoi_addr, vi->eoi_data);
672 cpu_eoi_irq(irq); 679 cpu_eoi_irq(irq);
673} 680}
674 681
@@ -705,6 +712,7 @@ static struct irq_chip iosapic_interrupt_type = {
705 .unmask = iosapic_unmask_irq, 712 .unmask = iosapic_unmask_irq,
706 .mask = iosapic_mask_irq, 713 .mask = iosapic_mask_irq,
707 .ack = cpu_ack_irq, 714 .ack = cpu_ack_irq,
715 .eoi = iosapic_eoi_irq,
708#ifdef CONFIG_SMP 716#ifdef CONFIG_SMP
709 .set_affinity = iosapic_set_affinity_irq, 717 .set_affinity = iosapic_set_affinity_irq,
710#endif 718#endif
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 2350e8a86eef..f2f501e5b6a0 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -64,6 +64,7 @@ static unsigned int led_diskio __read_mostly = 1;
64static unsigned int led_lanrxtx __read_mostly = 1; 64static unsigned int led_lanrxtx __read_mostly = 1;
65static char lcd_text[32] __read_mostly; 65static char lcd_text[32] __read_mostly;
66static char lcd_text_default[32] __read_mostly; 66static char lcd_text_default[32] __read_mostly;
67static int lcd_no_led_support __read_mostly = 0; /* KittyHawk doesn't support LED on its LCD */
67 68
68 69
69static struct workqueue_struct *led_wq; 70static struct workqueue_struct *led_wq;
@@ -115,7 +116,7 @@ lcd_info __attribute__((aligned(8))) __read_mostly =
115 .lcd_width = 16, 116 .lcd_width = 16,
116 .lcd_cmd_reg_addr = KITTYHAWK_LCD_CMD, 117 .lcd_cmd_reg_addr = KITTYHAWK_LCD_CMD,
117 .lcd_data_reg_addr = KITTYHAWK_LCD_DATA, 118 .lcd_data_reg_addr = KITTYHAWK_LCD_DATA,
118 .min_cmd_delay = 40, 119 .min_cmd_delay = 80,
119 .reset_cmd1 = 0x80, 120 .reset_cmd1 = 0x80,
120 .reset_cmd2 = 0xc0, 121 .reset_cmd2 = 0xc0,
121}; 122};
@@ -135,6 +136,9 @@ static int start_task(void)
135 /* Display the default text now */ 136 /* Display the default text now */
136 if (led_type == LED_HASLCD) lcd_print( lcd_text_default ); 137 if (led_type == LED_HASLCD) lcd_print( lcd_text_default );
137 138
139 /* KittyHawk has no LED support on its LCD */
140 if (lcd_no_led_support) return 0;
141
138 /* Create the work queue and queue the LED task */ 142 /* Create the work queue and queue the LED task */
139 led_wq = create_singlethread_workqueue("led_wq"); 143 led_wq = create_singlethread_workqueue("led_wq");
140 queue_delayed_work(led_wq, &led_task, 0); 144 queue_delayed_work(led_wq, &led_task, 0);
@@ -248,9 +252,13 @@ static int __init led_create_procfs(void)
248 252
249 proc_pdc_root = proc_mkdir("pdc", 0); 253 proc_pdc_root = proc_mkdir("pdc", 0);
250 if (!proc_pdc_root) return -1; 254 if (!proc_pdc_root) return -1;
251 ent = proc_create_data("led", S_IRUGO|S_IWUSR, proc_pdc_root, 255
252 &led_proc_fops, (void *)LED_NOLCD); /* LED */ 256 if (!lcd_no_led_support)
253 if (!ent) return -1; 257 {
258 ent = proc_create_data("led", S_IRUGO|S_IWUSR, proc_pdc_root,
259 &led_proc_fops, (void *)LED_NOLCD); /* LED */
260 if (!ent) return -1;
261 }
254 262
255 if (led_type == LED_HASLCD) 263 if (led_type == LED_HASLCD)
256 { 264 {
@@ -692,6 +700,7 @@ int __init led_init(void)
692 case 0x58B: /* KittyHawk DC2 100 (K200) */ 700 case 0x58B: /* KittyHawk DC2 100 (K200) */
693 printk(KERN_INFO "%s: KittyHawk-Machine (hversion 0x%x) found, " 701 printk(KERN_INFO "%s: KittyHawk-Machine (hversion 0x%x) found, "
694 "LED detection skipped.\n", __FILE__, CPU_HVERSION); 702 "LED detection skipped.\n", __FILE__, CPU_HVERSION);
703 lcd_no_led_support = 1;
695 goto found; /* use the preinitialized values of lcd_info */ 704 goto found; /* use the preinitialized values of lcd_info */
696 } 705 }
697 706
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 0846dafdfff1..28241532c0fd 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -323,7 +323,6 @@ static struct irq_chip superio_interrupt_type = {
323 .name = SUPERIO, 323 .name = SUPERIO,
324 .unmask = superio_unmask_irq, 324 .unmask = superio_unmask_irq,
325 .mask = superio_mask_irq, 325 .mask = superio_mask_irq,
326 .ack = no_ack_irq,
327}; 326};
328 327
329#ifdef DEBUG_SUPERIO_INIT 328#ifdef DEBUG_SUPERIO_INIT
@@ -354,7 +353,7 @@ int superio_fixup_irq(struct pci_dev *pcidev)
354#endif 353#endif
355 354
356 for (i = 0; i < 16; i++) { 355 for (i = 0; i < 16; i++) {
357 set_irq_chip_and_handler(i, &superio_interrupt_type, handle_level_irq); 356 set_irq_chip_and_handler(i, &superio_interrupt_type, handle_simple_irq);
358 } 357 }
359 358
360 /* 359 /*
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 3753fd0722e7..2fe8cb8e95cd 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -70,6 +70,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
70 va_end(args); 70 va_end(args);
71 } 71 }
72} 72}
73EXPORT_SYMBOL(soc_pcmcia_debug);
73 74
74#endif 75#endif
75 76
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 60a5a5c6b50a..d235f44fd7a3 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -81,6 +81,8 @@ MODULE_PARM_DESC(wapf, "WAPF value");
81 81
82static int wlan_status = 1; 82static int wlan_status = 1;
83static int bluetooth_status = 1; 83static int bluetooth_status = 1;
84static int wimax_status = -1;
85static int wwan_status = -1;
84 86
85module_param(wlan_status, int, 0444); 87module_param(wlan_status, int, 0444);
86MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " 88MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot "
@@ -92,6 +94,16 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
92 "(0 = disabled, 1 = enabled, -1 = don't do anything). " 94 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
93 "default is 1"); 95 "default is 1");
94 96
97module_param(wimax_status, int, 0444);
98MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot "
99 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
100 "default is 1");
101
102module_param(wwan_status, int, 0444);
103MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot "
104 "(0 = disabled, 1 = enabled, -1 = don't do anything). "
105 "default is 1");
106
95/* 107/*
96 * Some events we use, same for all Asus 108 * Some events we use, same for all Asus
97 */ 109 */
@@ -114,6 +126,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
114 */ 126 */
115#define WL_RSTS 0x01 /* internal Wifi */ 127#define WL_RSTS 0x01 /* internal Wifi */
116#define BT_RSTS 0x02 /* internal Bluetooth */ 128#define BT_RSTS 0x02 /* internal Bluetooth */
129#define WM_RSTS 0x08 /* internal wimax */
130#define WW_RSTS 0x20 /* internal wwan */
117 131
118/* LED */ 132/* LED */
119#define METHOD_MLED "MLED" 133#define METHOD_MLED "MLED"
@@ -132,6 +146,11 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
132 */ 146 */
133#define METHOD_WLAN "WLED" 147#define METHOD_WLAN "WLED"
134#define METHOD_BLUETOOTH "BLED" 148#define METHOD_BLUETOOTH "BLED"
149
150/* WWAN and WIMAX */
151#define METHOD_WWAN "GSMC"
152#define METHOD_WIMAX "WMXC"
153
135#define METHOD_WL_STATUS "RSTS" 154#define METHOD_WL_STATUS "RSTS"
136 155
137/* Brightness */ 156/* Brightness */
@@ -883,6 +902,64 @@ static ssize_t store_bluetooth(struct device *dev,
883} 902}
884 903
885/* 904/*
905 * Wimax
906 */
907static int asus_wimax_set(struct asus_laptop *asus, int status)
908{
909 if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) {
910 pr_warning("Error setting wimax status to %d", status);
911 return -EIO;
912 }
913 return 0;
914}
915
916static ssize_t show_wimax(struct device *dev,
917 struct device_attribute *attr, char *buf)
918{
919 struct asus_laptop *asus = dev_get_drvdata(dev);
920
921 return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS));
922}
923
924static ssize_t store_wimax(struct device *dev,
925 struct device_attribute *attr, const char *buf,
926 size_t count)
927{
928 struct asus_laptop *asus = dev_get_drvdata(dev);
929
930 return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX);
931}
932
933/*
934 * Wwan
935 */
936static int asus_wwan_set(struct asus_laptop *asus, int status)
937{
938 if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) {
939 pr_warning("Error setting wwan status to %d", status);
940 return -EIO;
941 }
942 return 0;
943}
944
945static ssize_t show_wwan(struct device *dev,
946 struct device_attribute *attr, char *buf)
947{
948 struct asus_laptop *asus = dev_get_drvdata(dev);
949
950 return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS));
951}
952
953static ssize_t store_wwan(struct device *dev,
954 struct device_attribute *attr, const char *buf,
955 size_t count)
956{
957 struct asus_laptop *asus = dev_get_drvdata(dev);
958
959 return sysfs_acpi_set(asus, buf, count, METHOD_WWAN);
960}
961
962/*
886 * Display 963 * Display
887 */ 964 */
888static void asus_set_display(struct asus_laptop *asus, int value) 965static void asus_set_display(struct asus_laptop *asus, int value)
@@ -1202,6 +1279,8 @@ static DEVICE_ATTR(infos, S_IRUGO, show_infos, NULL);
1202static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); 1279static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan);
1203static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, 1280static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR,
1204 show_bluetooth, store_bluetooth); 1281 show_bluetooth, store_bluetooth);
1282static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax);
1283static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan);
1205static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); 1284static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp);
1206static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); 1285static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd);
1207static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); 1286static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl);
@@ -1212,6 +1291,8 @@ static struct attribute *asus_attributes[] = {
1212 &dev_attr_infos.attr, 1291 &dev_attr_infos.attr,
1213 &dev_attr_wlan.attr, 1292 &dev_attr_wlan.attr,
1214 &dev_attr_bluetooth.attr, 1293 &dev_attr_bluetooth.attr,
1294 &dev_attr_wimax.attr,
1295 &dev_attr_wwan.attr,
1215 &dev_attr_display.attr, 1296 &dev_attr_display.attr,
1216 &dev_attr_ledd.attr, 1297 &dev_attr_ledd.attr,
1217 &dev_attr_ls_level.attr, 1298 &dev_attr_ls_level.attr,
@@ -1239,6 +1320,13 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj,
1239 } else if (attr == &dev_attr_display.attr) { 1320 } else if (attr == &dev_attr_display.attr) {
1240 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); 1321 supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL);
1241 1322
1323 } else if (attr == &dev_attr_wimax.attr) {
1324 supported =
1325 !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL);
1326
1327 } else if (attr == &dev_attr_wwan.attr) {
1328 supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL);
1329
1242 } else if (attr == &dev_attr_ledd.attr) { 1330 } else if (attr == &dev_attr_ledd.attr) {
1243 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); 1331 supported = !acpi_check_handle(handle, METHOD_LEDD, NULL);
1244 1332
@@ -1397,7 +1485,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1397 1485
1398 /* 1486 /*
1399 * The HWRS method return informations about the hardware. 1487 * The HWRS method return informations about the hardware.
1400 * 0x80 bit is for WLAN, 0x100 for Bluetooth. 1488 * 0x80 bit is for WLAN, 0x100 for Bluetooth,
1489 * 0x40 for WWAN, 0x10 for WIMAX.
1401 * The significance of others is yet to be found. 1490 * The significance of others is yet to be found.
1402 */ 1491 */
1403 status = 1492 status =
@@ -1440,6 +1529,12 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
1440 if (wlan_status >= 0) 1529 if (wlan_status >= 0)
1441 asus_wlan_set(asus, !!wlan_status); 1530 asus_wlan_set(asus, !!wlan_status);
1442 1531
1532 if (wimax_status >= 0)
1533 asus_wimax_set(asus, !!wimax_status);
1534
1535 if (wwan_status >= 0)
1536 asus_wwan_set(asus, !!wwan_status);
1537
1443 /* Keyboard Backlight is on by default */ 1538 /* Keyboard Backlight is on by default */
1444 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) 1539 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL))
1445 asus_kled_set(asus, 1); 1540 asus_kled_set(asus, 1);
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 462ceab93f87..0d50fbbe2478 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -298,8 +298,8 @@ static void eeepc_wmi_notify(u32 value, void *context)
298 kfree(obj); 298 kfree(obj);
299} 299}
300 300
301static int store_cpufv(struct device *dev, struct device_attribute *attr, 301static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
302 const char *buf, size_t count) 302 const char *buf, size_t count)
303{ 303{
304 int value; 304 int value;
305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value }; 305 struct acpi_buffer input = { (acpi_size)sizeof(value), &value };
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 1dac659b5e0c..9e05af9c41cb 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -172,6 +172,8 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer,
172 bios_return = *((struct bios_return *)obj->buffer.pointer); 172 bios_return = *((struct bios_return *)obj->buffer.pointer);
173 173
174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); 174 memcpy(buffer, &bios_return.value, sizeof(bios_return.value));
175
176 kfree(obj);
175 return 0; 177 return 0;
176} 178}
177 179
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 3c2c6b91ecb3..94a114aa8e28 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/dmi.h> 30#include <linux/dmi.h>
31#include <linux/efi.h>
31#include <linux/mutex.h> 32#include <linux/mutex.h>
32#include <asm/bios_ebda.h> 33#include <asm/bios_ebda.h>
33 34
@@ -220,32 +221,13 @@ static void rtl_teardown_sysfs(void) {
220 sysdev_class_unregister(&class_rtl); 221 sysdev_class_unregister(&class_rtl);
221} 222}
222 223
223static int dmi_check_cb(const struct dmi_system_id *id)
224{
225 RTL_DEBUG("found IBM server '%s'\n", id->ident);
226 return 0;
227}
228
229#define ibm_dmi_entry(NAME, TYPE) \
230{ \
231 .ident = NAME, \
232 .matches = { \
233 DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
234 DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \
235 }, \
236 .callback = dmi_check_cb \
237}
238 224
239static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { 225static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = {
240 ibm_dmi_entry("BladeCenter LS21", "7971"), 226 { \
241 ibm_dmi_entry("BladeCenter LS22", "7901"), 227 .matches = { \
242 ibm_dmi_entry("BladeCenter HS21 XM", "7995"), 228 DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \
243 ibm_dmi_entry("BladeCenter HS22", "7870"), 229 }, \
244 ibm_dmi_entry("BladeCenter HS22V", "7871"), 230 },
245 ibm_dmi_entry("System x3550 M2", "7946"),
246 ibm_dmi_entry("System x3650 M2", "7947"),
247 ibm_dmi_entry("System x3550 M3", "7944"),
248 ibm_dmi_entry("System x3650 M3", "7945"),
249 { } 231 { }
250}; 232};
251 233
@@ -257,7 +239,7 @@ static int __init ibm_rtl_init(void) {
257 if (force) 239 if (force)
258 pr_warning("ibm-rtl: module loaded by force\n"); 240 pr_warning("ibm-rtl: module loaded by force\n");
259 /* first ensure that we are running on IBM HW */ 241 /* first ensure that we are running on IBM HW */
260 else if (!dmi_check_system(ibm_rtl_dmi_table)) 242 else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table))
261 return -ENODEV; 243 return -ENODEV;
262 244
263 /* Get the address for the Extended BIOS Data Area */ 245 /* Get the address for the Extended BIOS Data Area */
@@ -302,7 +284,7 @@ static int __init ibm_rtl_init(void) {
302 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", 284 RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n",
303 rtl_cmd_width, rtl_cmd_type); 285 rtl_cmd_width, rtl_cmd_type);
304 addr = ioread32(&rtl_table->cmd_port_address); 286 addr = ioread32(&rtl_table->cmd_port_address);
305 RTL_DEBUG("addr = %#llx\n", addr); 287 RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr);
306 plen = rtl_cmd_width/sizeof(char); 288 plen = rtl_cmd_width/sizeof(char);
307 rtl_cmd_addr = rtl_port_map(addr, plen); 289 rtl_cmd_addr = rtl_port_map(addr, plen);
308 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); 290 RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr);
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index 42a5469a2459..35278ad7e628 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -43,16 +43,18 @@ MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2");
43 43
44#define dprintk(msg...) pr_debug(DRV_PFX msg) 44#define dprintk(msg...) pr_debug(DRV_PFX msg)
45 45
46#define KEYCODE_BASE 0xD0 46#define SCANCODE_BASE 0xD0
47#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE 47#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE
48#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) 48#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1)
49#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) 49#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2)
50#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) 50#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3)
51#define MSI_WMI_MUTE (SCANCODE_BASE + 4)
51static struct key_entry msi_wmi_keymap[] = { 52static struct key_entry msi_wmi_keymap[] = {
52 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, 53 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
53 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, 54 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
54 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, 55 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
55 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, 56 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
57 { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} },
56 { KE_END, 0} 58 { KE_END, 0}
57}; 59};
58static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; 60static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
@@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context)
169 ktime_t diff; 171 ktime_t diff;
170 cur = ktime_get_real(); 172 cur = ktime_get_real();
171 diff = ktime_sub(cur, last_pressed[key->code - 173 diff = ktime_sub(cur, last_pressed[key->code -
172 KEYCODE_BASE]); 174 SCANCODE_BASE]);
173 /* Ignore event if the same event happened in a 50 ms 175 /* Ignore event if the same event happened in a 50 ms
174 timeframe -> Key press may result in 10-20 GPEs */ 176 timeframe -> Key press may result in 10-20 GPEs */
175 if (ktime_to_us(diff) < 1000 * 50) { 177 if (ktime_to_us(diff) < 1000 * 50) {
@@ -178,7 +180,7 @@ static void msi_wmi_notify(u32 value, void *context)
178 key->code, ktime_to_us(diff)); 180 key->code, ktime_to_us(diff));
179 return; 181 return;
180 } 182 }
181 last_pressed[key->code - KEYCODE_BASE] = cur; 183 last_pressed[key->code - SCANCODE_BASE] = cur;
182 184
183 if (key->type == KE_KEY && 185 if (key->type == KE_KEY &&
184 /* Brightness is served via acpi video driver */ 186 /* Brightness is served via acpi video driver */
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 2d61186ad5a2..e8c21994b36d 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm)
8497 ibm->acpi->type, 8497 ibm->acpi->type,
8498 dispatch_acpi_notify); 8498 dispatch_acpi_notify);
8499 ibm->flags.acpi_notify_installed = 0; 8499 ibm->flags.acpi_notify_installed = 0;
8500 ibm->flags.acpi_notify_installed = 0;
8501 } 8500 }
8502 8501
8503 if (ibm->flags.proc_created) { 8502 if (ibm->flags.proc_created) {
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 06f304f46e02..4276da7291b8 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -135,6 +135,7 @@ static const struct key_entry toshiba_acpi_keymap[] __initconst = {
135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, 135 { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } },
136 { KE_KEY, 0x142, { KEY_WLAN } }, 136 { KE_KEY, 0x142, { KEY_WLAN } },
137 { KE_KEY, 0x143, { KEY_PROG1 } }, 137 { KE_KEY, 0x143, { KEY_PROG1 } },
138 { KE_KEY, 0x17f, { KEY_FN } },
138 { KE_KEY, 0xb05, { KEY_PROG2 } }, 139 { KE_KEY, 0xb05, { KEY_PROG2 } },
139 { KE_KEY, 0xb06, { KEY_WWW } }, 140 { KE_KEY, 0xb06, { KEY_WWW } },
140 { KE_KEY, 0xb07, { KEY_MAIL } }, 141 { KE_KEY, 0xb07, { KEY_MAIL } },
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 104b77c87ef5..aecd9a9b549f 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -755,7 +755,7 @@ static bool guid_already_parsed(const char *guid_string)
755 struct wmi_block *wblock; 755 struct wmi_block *wblock;
756 756
757 list_for_each_entry(wblock, &wmi_block_list, list) 757 list_for_each_entry(wblock, &wmi_block_list, list)
758 if (strncmp(wblock->gblock.guid, guid_string, 16) == 0) 758 if (memcmp(wblock->gblock.guid, guid_string, 16) == 0)
759 return true; 759 return true;
760 760
761 return false; 761 return false;
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index a5050e217150..825951b6b83f 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -635,7 +635,7 @@ static void css_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
635 init_subchannel_id(&mchk_schid); 635 init_subchannel_id(&mchk_schid);
636 mchk_schid.sch_no = crw0->rsid; 636 mchk_schid.sch_no = crw0->rsid;
637 if (crw1) 637 if (crw1)
638 mchk_schid.ssid = (crw1->rsid >> 8) & 3; 638 mchk_schid.ssid = (crw1->rsid >> 4) & 3;
639 639
640 /* 640 /*
641 * Since we are always presented with IPI in the CRW, we have to 641 * Since we are always presented with IPI in the CRW, we have to
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index cad7d45c8bac..c265aed09e04 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1029,10 +1029,6 @@ static int __init fb_probe(struct platform_device *device)
1029 goto err_release_pl_mem; 1029 goto err_release_pl_mem;
1030 } 1030 }
1031 1031
1032 ret = request_irq(par->irq, lcdc_irq_handler, 0, DRIVER_NAME, par);
1033 if (ret)
1034 goto err_release_pl_mem;
1035
1036 /* Initialize par */ 1032 /* Initialize par */
1037 da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp; 1033 da8xx_fb_info->var.bits_per_pixel = lcd_cfg->bpp;
1038 1034
@@ -1060,7 +1056,7 @@ static int __init fb_probe(struct platform_device *device)
1060 1056
1061 ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0); 1057 ret = fb_alloc_cmap(&da8xx_fb_info->cmap, PALETTE_SIZE, 0);
1062 if (ret) 1058 if (ret)
1063 goto err_free_irq; 1059 goto err_release_pl_mem;
1064 da8xx_fb_info->cmap.len = par->palette_sz; 1060 da8xx_fb_info->cmap.len = par->palette_sz;
1065 1061
1066 /* initialize var_screeninfo */ 1062 /* initialize var_screeninfo */
@@ -1088,8 +1084,13 @@ static int __init fb_probe(struct platform_device *device)
1088 goto err_cpu_freq; 1084 goto err_cpu_freq;
1089 } 1085 }
1090#endif 1086#endif
1087
1088 ret = request_irq(par->irq, lcdc_irq_handler, 0, DRIVER_NAME, par);
1089 if (ret)
1090 goto irq_freq;
1091 return 0; 1091 return 0;
1092 1092
1093irq_freq:
1093#ifdef CONFIG_CPU_FREQ 1094#ifdef CONFIG_CPU_FREQ
1094err_cpu_freq: 1095err_cpu_freq:
1095 unregister_framebuffer(da8xx_fb_info); 1096 unregister_framebuffer(da8xx_fb_info);
@@ -1098,9 +1099,6 @@ err_cpu_freq:
1098err_dealloc_cmap: 1099err_dealloc_cmap:
1099 fb_dealloc_cmap(&da8xx_fb_info->cmap); 1100 fb_dealloc_cmap(&da8xx_fb_info->cmap);
1100 1101
1101err_free_irq:
1102 free_irq(par->irq, par);
1103
1104err_release_pl_mem: 1102err_release_pl_mem:
1105 dma_free_coherent(NULL, PALETTE_SIZE, par->v_palette_base, 1103 dma_free_coherent(NULL, PALETTE_SIZE, par->v_palette_base,
1106 par->p_palette_base); 1104 par->p_palette_base);
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
index affdf3e32cf3..5c3960da755a 100644
--- a/drivers/video/fbcmap.c
+++ b/drivers/video/fbcmap.c
@@ -80,6 +80,7 @@ static const struct fb_cmap default_16_colors = {
80 * @cmap: frame buffer colormap structure 80 * @cmap: frame buffer colormap structure
81 * @len: length of @cmap 81 * @len: length of @cmap
82 * @transp: boolean, 1 if there is transparency, 0 otherwise 82 * @transp: boolean, 1 if there is transparency, 0 otherwise
83 * @flags: flags for kmalloc memory allocation
83 * 84 *
84 * Allocates memory for a colormap @cmap. @len is the 85 * Allocates memory for a colormap @cmap. @len is the
85 * number of entries in the palette. 86 * number of entries in the palette.
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h
index e4c4d89b7860..be8ccb47ebe0 100644
--- a/drivers/video/geode/lxfb.h
+++ b/drivers/video/geode/lxfb.h
@@ -22,6 +22,7 @@
22#define DC_HFILT_COUNT 0x100 22#define DC_HFILT_COUNT 0x100
23#define DC_VFILT_COUNT 0x100 23#define DC_VFILT_COUNT 0x100
24#define VP_COEFF_SIZE 0x1000 24#define VP_COEFF_SIZE 0x1000
25#define VP_PAL_COUNT 0x100
25 26
26#define OUTPUT_CRT 0x01 27#define OUTPUT_CRT 0x01
27#define OUTPUT_PANEL 0x02 28#define OUTPUT_PANEL 0x02
@@ -48,7 +49,8 @@ struct lxfb_par {
48 uint64_t vp[VP_REG_COUNT]; 49 uint64_t vp[VP_REG_COUNT];
49 uint64_t fp[FP_REG_COUNT]; 50 uint64_t fp[FP_REG_COUNT];
50 51
51 uint32_t pal[DC_PAL_COUNT]; 52 uint32_t dc_pal[DC_PAL_COUNT];
53 uint32_t vp_pal[VP_PAL_COUNT];
52 uint32_t hcoeff[DC_HFILT_COUNT * 2]; 54 uint32_t hcoeff[DC_HFILT_COUNT * 2];
53 uint32_t vcoeff[DC_VFILT_COUNT]; 55 uint32_t vcoeff[DC_VFILT_COUNT];
54 uint32_t vp_coeff[VP_COEFF_SIZE / 4]; 56 uint32_t vp_coeff[VP_COEFF_SIZE / 4];
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c
index 85ec7f64c42a..79e9abc72b83 100644
--- a/drivers/video/geode/lxfb_ops.c
+++ b/drivers/video/geode/lxfb_ops.c
@@ -610,10 +610,15 @@ static void lx_save_regs(struct lxfb_par *par)
610 memcpy(par->vp, par->vp_regs, sizeof(par->vp)); 610 memcpy(par->vp, par->vp_regs, sizeof(par->vp));
611 memcpy(par->fp, par->vp_regs + VP_FP_START, sizeof(par->fp)); 611 memcpy(par->fp, par->vp_regs + VP_FP_START, sizeof(par->fp));
612 612
613 /* save the palette */ 613 /* save the display controller palette */
614 write_dc(par, DC_PAL_ADDRESS, 0); 614 write_dc(par, DC_PAL_ADDRESS, 0);
615 for (i = 0; i < ARRAY_SIZE(par->pal); i++) 615 for (i = 0; i < ARRAY_SIZE(par->dc_pal); i++)
616 par->pal[i] = read_dc(par, DC_PAL_DATA); 616 par->dc_pal[i] = read_dc(par, DC_PAL_DATA);
617
618 /* save the video processor palette */
619 write_vp(par, VP_PAR, 0);
620 for (i = 0; i < ARRAY_SIZE(par->vp_pal); i++)
621 par->vp_pal[i] = read_vp(par, VP_PDR);
617 622
618 /* save the horizontal filter coefficients */ 623 /* save the horizontal filter coefficients */
619 filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; 624 filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL;
@@ -706,8 +711,8 @@ static void lx_restore_display_ctlr(struct lxfb_par *par)
706 711
707 /* restore the palette */ 712 /* restore the palette */
708 write_dc(par, DC_PAL_ADDRESS, 0); 713 write_dc(par, DC_PAL_ADDRESS, 0);
709 for (i = 0; i < ARRAY_SIZE(par->pal); i++) 714 for (i = 0; i < ARRAY_SIZE(par->dc_pal); i++)
710 write_dc(par, DC_PAL_DATA, par->pal[i]); 715 write_dc(par, DC_PAL_DATA, par->dc_pal[i]);
711 716
712 /* restore the horizontal filter coefficients */ 717 /* restore the horizontal filter coefficients */
713 filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL; 718 filt = par->dc[DC_IRQ_FILT_CTL] | DC_IRQ_FILT_CTL_H_FILT_SEL;
@@ -751,6 +756,11 @@ static void lx_restore_video_proc(struct lxfb_par *par)
751 } 756 }
752 } 757 }
753 758
759 /* restore video processor palette */
760 write_vp(par, VP_PAR, 0);
761 for (i = 0; i < ARRAY_SIZE(par->vp_pal); i++)
762 write_vp(par, VP_PDR, par->vp_pal[i]);
763
754 /* restore video coeff ram */ 764 /* restore video coeff ram */
755 memcpy(par->vp_regs + VP_VCR, par->vp_coeff, sizeof(par->vp_coeff)); 765 memcpy(par->vp_regs + VP_VCR, par->vp_coeff, sizeof(par->vp_coeff));
756} 766}
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 2b17ad5b4b32..43f9f02c7db0 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -412,8 +412,16 @@ static int __init balloon_init(void)
412 412
413 register_balloon(&balloon_sysdev); 413 register_balloon(&balloon_sysdev);
414 414
415 /* Initialise the balloon with excess memory space. */ 415 /*
416 extra_pfn_end = min(e820_end_of_ram_pfn(), 416 * Initialise the balloon with excess memory space. We need
417 * to make sure we don't add memory which doesn't exist or
418 * logically exist. The E820 map can be trimmed to be smaller
419 * than the amount of physical memory due to the mem= command
420 * line parameter. And if this is a 32-bit non-HIGHMEM kernel
421 * on a system with memory which requires highmem to access,
422 * don't try to use it.
423 */
424 extra_pfn_end = min(min(max_pfn, e820_end_of_ram_pfn()),
417 (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); 425 (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size));
418 for (pfn = PFN_UP(xen_extra_mem_start); 426 for (pfn = PFN_UP(xen_extra_mem_start);
419 pfn < extra_pfn_end; 427 pfn < extra_pfn_end;
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 2811bb988ea0..31af0ac31a98 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -105,7 +105,6 @@ struct irq_info
105 105
106static struct irq_info *irq_info; 106static struct irq_info *irq_info;
107static int *pirq_to_irq; 107static int *pirq_to_irq;
108static int nr_pirqs;
109 108
110static int *evtchn_to_irq; 109static int *evtchn_to_irq;
111struct cpu_evtchn_s { 110struct cpu_evtchn_s {
@@ -385,12 +384,17 @@ static int get_nr_hw_irqs(void)
385 return ret; 384 return ret;
386} 385}
387 386
388/* callers of this function should make sure that PHYSDEVOP_get_nr_pirqs 387static int find_unbound_pirq(int type)
389 * succeeded otherwise nr_pirqs won't hold the right value */
390static int find_unbound_pirq(void)
391{ 388{
392 int i; 389 int rc, i;
393 for (i = nr_pirqs-1; i >= 0; i--) { 390 struct physdev_get_free_pirq op_get_free_pirq;
391 op_get_free_pirq.type = type;
392
393 rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_free_pirq, &op_get_free_pirq);
394 if (!rc)
395 return op_get_free_pirq.pirq;
396
397 for (i = 0; i < nr_irqs; i++) {
394 if (pirq_to_irq[i] < 0) 398 if (pirq_to_irq[i] < 0)
395 return i; 399 return i;
396 } 400 }
@@ -423,7 +427,7 @@ static int find_unbound_irq(void)
423 if (irq == start) 427 if (irq == start)
424 goto no_irqs; 428 goto no_irqs;
425 429
426 res = irq_alloc_desc_at(irq, 0); 430 res = irq_alloc_desc_at(irq, -1);
427 431
428 if (WARN_ON(res != irq)) 432 if (WARN_ON(res != irq))
429 return -1; 433 return -1;
@@ -611,10 +615,10 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name)
611 615
612 spin_lock(&irq_mapping_update_lock); 616 spin_lock(&irq_mapping_update_lock);
613 617
614 if ((pirq > nr_pirqs) || (gsi > nr_irqs)) { 618 if ((pirq > nr_irqs) || (gsi > nr_irqs)) {
615 printk(KERN_WARNING "xen_map_pirq_gsi: %s %s is incorrect!\n", 619 printk(KERN_WARNING "xen_map_pirq_gsi: %s %s is incorrect!\n",
616 pirq > nr_pirqs ? "nr_pirqs" :"", 620 pirq > nr_irqs ? "pirq" :"",
617 gsi > nr_irqs ? "nr_irqs" : ""); 621 gsi > nr_irqs ? "gsi" : "");
618 goto out; 622 goto out;
619 } 623 }
620 624
@@ -630,7 +634,7 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name)
630 if (identity_mapped_irq(gsi) || (!xen_initial_domain() && 634 if (identity_mapped_irq(gsi) || (!xen_initial_domain() &&
631 xen_pv_domain())) { 635 xen_pv_domain())) {
632 irq = gsi; 636 irq = gsi;
633 irq_alloc_desc_at(irq, 0); 637 irq_alloc_desc_at(irq, -1);
634 } else 638 } else
635 irq = find_unbound_irq(); 639 irq = find_unbound_irq();
636 640
@@ -664,17 +668,21 @@ out:
664#include <linux/msi.h> 668#include <linux/msi.h>
665#include "../pci/msi.h" 669#include "../pci/msi.h"
666 670
667void xen_allocate_pirq_msi(char *name, int *irq, int *pirq) 671void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc)
668{ 672{
669 spin_lock(&irq_mapping_update_lock); 673 spin_lock(&irq_mapping_update_lock);
670 674
671 *irq = find_unbound_irq(); 675 if (alloc & XEN_ALLOC_IRQ) {
672 if (*irq == -1) 676 *irq = find_unbound_irq();
673 goto out; 677 if (*irq == -1)
678 goto out;
679 }
674 680
675 *pirq = find_unbound_pirq(); 681 if (alloc & XEN_ALLOC_PIRQ) {
676 if (*pirq == -1) 682 *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI);
677 goto out; 683 if (*pirq == -1)
684 goto out;
685 }
678 686
679 set_irq_chip_and_handler_name(*irq, &xen_pirq_chip, 687 set_irq_chip_and_handler_name(*irq, &xen_pirq_chip,
680 handle_level_irq, name); 688 handle_level_irq, name);
@@ -762,6 +770,7 @@ int xen_destroy_irq(int irq)
762 printk(KERN_WARNING "unmap irq failed %d\n", rc); 770 printk(KERN_WARNING "unmap irq failed %d\n", rc);
763 goto out; 771 goto out;
764 } 772 }
773 pirq_to_irq[info->u.pirq.pirq] = -1;
765 } 774 }
766 irq_info[irq] = mk_unbound_info(); 775 irq_info[irq] = mk_unbound_info();
767 776
@@ -782,6 +791,11 @@ int xen_gsi_from_irq(unsigned irq)
782 return gsi_from_irq(irq); 791 return gsi_from_irq(irq);
783} 792}
784 793
794int xen_irq_from_pirq(unsigned pirq)
795{
796 return pirq_to_irq[pirq];
797}
798
785int bind_evtchn_to_irq(unsigned int evtchn) 799int bind_evtchn_to_irq(unsigned int evtchn)
786{ 800{
787 int irq; 801 int irq;
@@ -1279,6 +1293,42 @@ static int retrigger_dynirq(unsigned int irq)
1279 return ret; 1293 return ret;
1280} 1294}
1281 1295
1296static void restore_cpu_pirqs(void)
1297{
1298 int pirq, rc, irq, gsi;
1299 struct physdev_map_pirq map_irq;
1300
1301 for (pirq = 0; pirq < nr_irqs; pirq++) {
1302 irq = pirq_to_irq[pirq];
1303 if (irq == -1)
1304 continue;
1305
1306 /* save/restore of PT devices doesn't work, so at this point the
1307 * only devices present are GSI based emulated devices */
1308 gsi = gsi_from_irq(irq);
1309 if (!gsi)
1310 continue;
1311
1312 map_irq.domid = DOMID_SELF;
1313 map_irq.type = MAP_PIRQ_TYPE_GSI;
1314 map_irq.index = gsi;
1315 map_irq.pirq = pirq;
1316
1317 rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
1318 if (rc) {
1319 printk(KERN_WARNING "xen map irq failed gsi=%d irq=%d pirq=%d rc=%d\n",
1320 gsi, irq, pirq, rc);
1321 irq_info[irq] = mk_unbound_info();
1322 pirq_to_irq[pirq] = -1;
1323 continue;
1324 }
1325
1326 printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);
1327
1328 startup_pirq(irq);
1329 }
1330}
1331
1282static void restore_cpu_virqs(unsigned int cpu) 1332static void restore_cpu_virqs(unsigned int cpu)
1283{ 1333{
1284 struct evtchn_bind_virq bind_virq; 1334 struct evtchn_bind_virq bind_virq;
@@ -1422,6 +1472,8 @@ void xen_irq_resume(void)
1422 1472
1423 unmask_evtchn(evtchn); 1473 unmask_evtchn(evtchn);
1424 } 1474 }
1475
1476 restore_cpu_pirqs();
1425} 1477}
1426 1478
1427static struct irq_chip xen_dynamic_chip __read_mostly = { 1479static struct irq_chip xen_dynamic_chip __read_mostly = {
@@ -1506,26 +1558,17 @@ void xen_callback_vector(void) {}
1506 1558
1507void __init xen_init_IRQ(void) 1559void __init xen_init_IRQ(void)
1508{ 1560{
1509 int i, rc; 1561 int i;
1510 struct physdev_nr_pirqs op_nr_pirqs;
1511 1562
1512 cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), 1563 cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s),
1513 GFP_KERNEL); 1564 GFP_KERNEL);
1514 irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL); 1565 irq_info = kcalloc(nr_irqs, sizeof(*irq_info), GFP_KERNEL);
1515 1566
1516 rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_nr_pirqs, &op_nr_pirqs); 1567 /* We are using nr_irqs as the maximum number of pirq available but
1517 if (rc < 0) { 1568 * that number is actually chosen by Xen and we don't know exactly
1518 nr_pirqs = nr_irqs; 1569 * what it is. Be careful choosing high pirq numbers. */
1519 if (rc != -ENOSYS) 1570 pirq_to_irq = kcalloc(nr_irqs, sizeof(*pirq_to_irq), GFP_KERNEL);
1520 printk(KERN_WARNING "PHYSDEVOP_get_nr_pirqs returned rc=%d\n", rc); 1571 for (i = 0; i < nr_irqs; i++)
1521 } else {
1522 if (xen_pv_domain() && !xen_initial_domain())
1523 nr_pirqs = max((int)op_nr_pirqs.nr_pirqs, nr_irqs);
1524 else
1525 nr_pirqs = op_nr_pirqs.nr_pirqs;
1526 }
1527 pirq_to_irq = kcalloc(nr_pirqs, sizeof(*pirq_to_irq), GFP_KERNEL);
1528 for (i = 0; i < nr_pirqs; i++)
1529 pirq_to_irq[i] = -1; 1572 pirq_to_irq[i] = -1;
1530 1573
1531 evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq), 1574 evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq),
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index ef9c7db52077..db8c4c4ac880 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -49,6 +49,7 @@ static int xen_hvm_suspend(void *data)
49 49
50 if (!*cancelled) { 50 if (!*cancelled) {
51 xen_irq_resume(); 51 xen_irq_resume();
52 xen_console_resume();
52 xen_timer_resume(); 53 xen_timer_resume();
53 } 54 }
54 55
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index d5c1401f0031..d34896cfb19f 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -980,19 +980,11 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
980 } 980 }
981} 981}
982 982
983static DEFINE_MUTEX(autofs4_ioctl_mutex);
984
985static long autofs4_root_ioctl(struct file *filp, 983static long autofs4_root_ioctl(struct file *filp,
986 unsigned int cmd, unsigned long arg) 984 unsigned int cmd, unsigned long arg)
987{ 985{
988 long ret;
989 struct inode *inode = filp->f_dentry->d_inode; 986 struct inode *inode = filp->f_dentry->d_inode;
990 987 return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
991 mutex_lock(&autofs4_ioctl_mutex);
992 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
993 mutex_unlock(&autofs4_ioctl_mutex);
994
995 return ret;
996} 988}
997 989
998#ifdef CONFIG_COMPAT 990#ifdef CONFIG_COMPAT
@@ -1002,13 +994,11 @@ static long autofs4_root_compat_ioctl(struct file *filp,
1002 struct inode *inode = filp->f_path.dentry->d_inode; 994 struct inode *inode = filp->f_path.dentry->d_inode;
1003 int ret; 995 int ret;
1004 996
1005 mutex_lock(&autofs4_ioctl_mutex);
1006 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) 997 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
1007 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 998 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
1008 else 999 else
1009 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, 1000 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd,
1010 (unsigned long)compat_ptr(arg)); 1001 (unsigned long)compat_ptr(arg));
1011 mutex_unlock(&autofs4_ioctl_mutex);
1012 1002
1013 return ret; 1003 return ret;
1014} 1004}
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 52c7557f3e25..9f26ac9be2a4 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1964,8 +1964,10 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
1964 if (reg == NULL) 1964 if (reg == NULL)
1965 return ERR_PTR(-ENOMEM); 1965 return ERR_PTR(-ENOMEM);
1966 1966
1967 if (strlen(name) > O2HB_MAX_REGION_NAME_LEN) 1967 if (strlen(name) > O2HB_MAX_REGION_NAME_LEN) {
1968 return ERR_PTR(-ENAMETOOLONG); 1968 ret = -ENAMETOOLONG;
1969 goto free;
1970 }
1969 1971
1970 spin_lock(&o2hb_live_lock); 1972 spin_lock(&o2hb_live_lock);
1971 reg->hr_region_num = 0; 1973 reg->hr_region_num = 0;
@@ -1974,7 +1976,8 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
1974 O2NM_MAX_REGIONS); 1976 O2NM_MAX_REGIONS);
1975 if (reg->hr_region_num >= O2NM_MAX_REGIONS) { 1977 if (reg->hr_region_num >= O2NM_MAX_REGIONS) {
1976 spin_unlock(&o2hb_live_lock); 1978 spin_unlock(&o2hb_live_lock);
1977 return ERR_PTR(-EFBIG); 1979 ret = -EFBIG;
1980 goto free;
1978 } 1981 }
1979 set_bit(reg->hr_region_num, o2hb_region_bitmap); 1982 set_bit(reg->hr_region_num, o2hb_region_bitmap);
1980 } 1983 }
@@ -1986,10 +1989,13 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
1986 ret = o2hb_debug_region_init(reg, o2hb_debug_dir); 1989 ret = o2hb_debug_region_init(reg, o2hb_debug_dir);
1987 if (ret) { 1990 if (ret) {
1988 config_item_put(&reg->hr_item); 1991 config_item_put(&reg->hr_item);
1989 return ERR_PTR(ret); 1992 goto free;
1990 } 1993 }
1991 1994
1992 return &reg->hr_item; 1995 return &reg->hr_item;
1996free:
1997 kfree(reg);
1998 return ERR_PTR(ret);
1993} 1999}
1994 2000
1995static void o2hb_heartbeat_group_drop_item(struct config_group *group, 2001static void o2hb_heartbeat_group_drop_item(struct config_group *group,
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index edaded48e7e9..895532ac4d98 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -476,7 +476,6 @@ static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
476 476
477out: 477out:
478 iput(inode); 478 iput(inode);
479 ocfs2_dentry_attach_gen(dentry);
480} 479}
481 480
482/* 481/*
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 58a93b953735..cc2aaa96cfe5 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -959,7 +959,7 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,
959 r += O2HB_MAX_REGION_NAME_LEN; 959 r += O2HB_MAX_REGION_NAME_LEN;
960 } 960 }
961 961
962 local = kmalloc(sizeof(qr->qr_regions), GFP_KERNEL); 962 local = kmalloc(sizeof(qr->qr_regions), GFP_ATOMIC);
963 if (!local) { 963 if (!local) {
964 status = -ENOMEM; 964 status = -ENOMEM;
965 goto bail; 965 goto bail;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 1efea3615589..70dd3b1798f1 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -159,9 +159,9 @@ struct ocfs2_lock_res {
159 char l_name[OCFS2_LOCK_ID_MAX_LEN]; 159 char l_name[OCFS2_LOCK_ID_MAX_LEN];
160 unsigned int l_ro_holders; 160 unsigned int l_ro_holders;
161 unsigned int l_ex_holders; 161 unsigned int l_ex_holders;
162 char l_level; 162 signed char l_level;
163 char l_requested; 163 signed char l_requested;
164 char l_blocking; 164 signed char l_blocking;
165 165
166 /* Data packed - type enum ocfs2_lock_type */ 166 /* Data packed - type enum ocfs2_lock_type */
167 unsigned char l_type; 167 unsigned char l_type;
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 252e7c82f929..a5ebe421195f 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -190,7 +190,7 @@ static struct ocfs2_live_connection *ocfs2_connection_find(const char *name)
190 return c; 190 return c;
191 } 191 }
192 192
193 return c; 193 return NULL;
194} 194}
195 195
196/* 196/*
diff --git a/fs/proc/base.c b/fs/proc/base.c
index f3d02ca461ec..182845147fe4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1574,7 +1574,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
1574 if (!tmp) 1574 if (!tmp)
1575 return -ENOMEM; 1575 return -ENOMEM;
1576 1576
1577 pathname = d_path_with_unreachable(path, tmp, PAGE_SIZE); 1577 pathname = d_path(path, tmp, PAGE_SIZE);
1578 len = PTR_ERR(pathname); 1578 len = PTR_ERR(pathname);
1579 if (IS_ERR(pathname)) 1579 if (IS_ERR(pathname))
1580 goto out; 1580 goto out;
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8c641bed9bbd..a2776e2807a4 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -287,6 +287,8 @@ typedef struct drm_i915_irq_wait {
287#define I915_PARAM_HAS_EXECBUF2 9 287#define I915_PARAM_HAS_EXECBUF2 9
288#define I915_PARAM_HAS_BSD 10 288#define I915_PARAM_HAS_BSD 10
289#define I915_PARAM_HAS_BLT 11 289#define I915_PARAM_HAS_BLT 11
290#define I915_PARAM_HAS_RELAXED_FENCING 12
291#define I915_PARAM_HAS_COHERENT_RINGS 13
290 292
291typedef struct drm_i915_getparam { 293typedef struct drm_i915_getparam {
292 int param; 294 int param;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index e8713d55360a..f54adfcbec9c 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -360,7 +360,7 @@ void drain_local_pages(void *dummy);
360 360
361extern gfp_t gfp_allowed_mask; 361extern gfp_t gfp_allowed_mask;
362 362
363extern void set_gfp_allowed_mask(gfp_t mask); 363extern void pm_restrict_gfp_mask(void);
364extern gfp_t clear_gfp_allowed_mask(gfp_t mask); 364extern void pm_restore_gfp_mask(void);
365 365
366#endif /* __LINUX_GFP_H */ 366#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ce73a30113b4..dd1a56fbe924 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -16,6 +16,8 @@ struct gpio_keys_button {
16struct gpio_keys_platform_data { 16struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int poll_interval; /* polling interval in msecs -
20 for polling driver only */
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 21 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev); 22 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev); 23 void (*disable)(struct device *dev);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index bb0f56f5c01e..20b9801f669b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -820,6 +820,49 @@ static inline void hid_hw_stop(struct hid_device *hdev)
820 hdev->ll_driver->stop(hdev); 820 hdev->ll_driver->stop(hdev);
821} 821}
822 822
823/**
824 * hid_hw_open - signal underlaying HW to start delivering events
825 *
826 * @hdev: hid device
827 *
828 * Tell underlying HW to start delivering events from the device.
829 * This function should be called sometime after successful call
830 * to hid_hiw_start().
831 */
832static inline int __must_check hid_hw_open(struct hid_device *hdev)
833{
834 return hdev->ll_driver->open(hdev);
835}
836
837/**
838 * hid_hw_close - signal underlaying HW to stop delivering events
839 *
840 * @hdev: hid device
841 *
842 * This function indicates that we are not interested in the events
843 * from this device anymore. Delivery of events may or may not stop,
844 * depending on the number of users still outstanding.
845 */
846static inline void hid_hw_close(struct hid_device *hdev)
847{
848 hdev->ll_driver->close(hdev);
849}
850
851/**
852 * hid_hw_power - requests underlying HW to go into given power mode
853 *
854 * @hdev: hid device
855 * @level: requested power level (one of %PM_HINT_* defines)
856 *
857 * This function requests underlying hardware to enter requested power
858 * mode.
859 */
860
861static inline int hid_hw_power(struct hid_device *hdev, int level)
862{
863 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
864}
865
823void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 866void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
824 int interrupt); 867 int interrupt);
825 868
@@ -838,12 +881,32 @@ int hid_pidff_init(struct hid_device *hid);
838#define hid_pidff_init NULL 881#define hid_pidff_init NULL
839#endif 882#endif
840 883
841#define dbg_hid(format, arg...) if (hid_debug) \ 884#define dbg_hid(format, arg...) \
842 printk(KERN_DEBUG "%s: " format ,\ 885do { \
843 __FILE__ , ## arg) 886 if (hid_debug) \
844#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 887 printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \
845 __FILE__ , ## arg) 888} while (0)
846#endif /* HID_FF */ 889
890#define hid_printk(level, hid, fmt, arg...) \
891 dev_printk(level, &(hid)->dev, fmt, ##arg)
892#define hid_emerg(hid, fmt, arg...) \
893 dev_emerg(&(hid)->dev, fmt, ##arg)
894#define hid_crit(hid, fmt, arg...) \
895 dev_crit(&(hid)->dev, fmt, ##arg)
896#define hid_alert(hid, fmt, arg...) \
897 dev_alert(&(hid)->dev, fmt, ##arg)
898#define hid_err(hid, fmt, arg...) \
899 dev_err(&(hid)->dev, fmt, ##arg)
900#define hid_notice(hid, fmt, arg...) \
901 dev_notice(&(hid)->dev, fmt, ##arg)
902#define hid_warn(hid, fmt, arg...) \
903 dev_warn(&(hid)->dev, fmt, ##arg)
904#define hid_info(hid, fmt, arg...) \
905 dev_info(&(hid)->dev, fmt, ##arg)
906#define hid_dbg(hid, fmt, arg...) \
907 dev_dbg(&(hid)->dev, fmt, ##arg)
908
909#endif /* __KERNEL__ */
847 910
848#endif 911#endif
849 912
diff --git a/include/linux/input.h b/include/linux/input.h
index 6ef44465db8d..a8af21d42bc1 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -47,6 +47,25 @@ struct input_id {
47 __u16 version; 47 __u16 version;
48}; 48};
49 49
50/**
51 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
52 * @value: latest reported value for the axis.
53 * @minimum: specifies minimum value for the axis.
54 * @maximum: specifies maximum value for the axis.
55 * @fuzz: specifies fuzz value that is used to filter noise from
56 * the event stream.
57 * @flat: values that are within this value will be discarded by
58 * joydev interface and reported as 0 instead.
59 * @resolution: specifies resolution for the values reported for
60 * the axis.
61 *
62 * Note that input core does not clamp reported values to the
63 * [minimum, maximum] limits, such task is left to userspace.
64 *
65 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
66 * units per millimeter (units/mm), resolution for rotational axes
67 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
68 */
50struct input_absinfo { 69struct input_absinfo {
51 __s32 value; 70 __s32 value;
52 __s32 minimum; 71 __s32 minimum;
@@ -624,6 +643,10 @@ struct input_keymap_entry {
624#define KEY_CAMERA_FOCUS 0x210 643#define KEY_CAMERA_FOCUS 0x210
625#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ 644#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
626 645
646#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
647#define KEY_TOUCHPAD_ON 0x213
648#define KEY_TOUCHPAD_OFF 0x214
649
627#define BTN_TRIGGER_HAPPY 0x2c0 650#define BTN_TRIGGER_HAPPY 0x2c0
628#define BTN_TRIGGER_HAPPY1 0x2c0 651#define BTN_TRIGGER_HAPPY1 0x2c0
629#define BTN_TRIGGER_HAPPY2 0x2c1 652#define BTN_TRIGGER_HAPPY2 0x2c1
@@ -1130,7 +1153,7 @@ struct input_mt_slot {
1130 * of tracked contacts 1153 * of tracked contacts
1131 * @mtsize: number of MT slots the device uses 1154 * @mtsize: number of MT slots the device uses
1132 * @slot: MT slot currently being transmitted 1155 * @slot: MT slot currently being transmitted
1133 * @absinfo: array of &struct absinfo elements holding information 1156 * @absinfo: array of &struct input_absinfo elements holding information
1134 * about absolute axes (current value, min, max, flat, fuzz, 1157 * about absolute axes (current value, min, max, flat, fuzz,
1135 * resolution) 1158 * resolution)
1136 * @key: reflects current state of device's keys/buttons 1159 * @key: reflects current state of device's keys/buttons
diff --git a/include/xen/events.h b/include/xen/events.h
index 646dd17d3aa4..00f53ddcc062 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -76,7 +76,9 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name);
76 76
77#ifdef CONFIG_PCI_MSI 77#ifdef CONFIG_PCI_MSI
78/* Allocate an irq and a pirq to be used with MSIs. */ 78/* Allocate an irq and a pirq to be used with MSIs. */
79void xen_allocate_pirq_msi(char *name, int *irq, int *pirq); 79#define XEN_ALLOC_PIRQ (1 << 0)
80#define XEN_ALLOC_IRQ (1 << 1)
81void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask);
80int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); 82int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type);
81#endif 83#endif
82 84
@@ -89,4 +91,7 @@ int xen_vector_from_irq(unsigned pirq);
89/* Return gsi allocated to pirq */ 91/* Return gsi allocated to pirq */
90int xen_gsi_from_irq(unsigned pirq); 92int xen_gsi_from_irq(unsigned pirq);
91 93
94/* Return irq from pirq */
95int xen_irq_from_pirq(unsigned pirq);
96
92#endif /* _XEN_EVENTS_H */ 97#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 2b2c66c3df00..534cac89a77d 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -188,6 +188,16 @@ struct physdev_nr_pirqs {
188 uint32_t nr_pirqs; 188 uint32_t nr_pirqs;
189}; 189};
190 190
191/* type is MAP_PIRQ_TYPE_GSI or MAP_PIRQ_TYPE_MSI
192 * the hypercall returns a free pirq */
193#define PHYSDEVOP_get_free_pirq 23
194struct physdev_get_free_pirq {
195 /* IN */
196 int type;
197 /* OUT */
198 uint32_t pirq;
199};
200
191/* 201/*
192 * Notify that some PIRQ-bound event channels have been unmasked. 202 * Notify that some PIRQ-bound event channels have been unmasked.
193 * ** This command is obsolete since interface version 0x00030202 and is ** 203 * ** This command is obsolete since interface version 0x00030202 and is **
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 01b1d3a88983..6c8a2a9f8a7b 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -214,7 +214,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v)
214 214
215static int irq_spurious_proc_open(struct inode *inode, struct file *file) 215static int irq_spurious_proc_open(struct inode *inode, struct file *file)
216{ 216{
217 return single_open(file, irq_spurious_proc_show, NULL); 217 return single_open(file, irq_spurious_proc_show, PDE(inode)->data);
218} 218}
219 219
220static const struct file_operations irq_spurious_proc_fops = { 220static const struct file_operations irq_spurious_proc_fops = {
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 657272e91d0a..048d0b514831 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -327,7 +327,6 @@ static int create_image(int platform_mode)
327int hibernation_snapshot(int platform_mode) 327int hibernation_snapshot(int platform_mode)
328{ 328{
329 int error; 329 int error;
330 gfp_t saved_mask;
331 330
332 error = platform_begin(platform_mode); 331 error = platform_begin(platform_mode);
333 if (error) 332 if (error)
@@ -339,7 +338,7 @@ int hibernation_snapshot(int platform_mode)
339 goto Close; 338 goto Close;
340 339
341 suspend_console(); 340 suspend_console();
342 saved_mask = clear_gfp_allowed_mask(GFP_IOFS); 341 pm_restrict_gfp_mask();
343 error = dpm_suspend_start(PMSG_FREEZE); 342 error = dpm_suspend_start(PMSG_FREEZE);
344 if (error) 343 if (error)
345 goto Recover_platform; 344 goto Recover_platform;
@@ -348,7 +347,10 @@ int hibernation_snapshot(int platform_mode)
348 goto Recover_platform; 347 goto Recover_platform;
349 348
350 error = create_image(platform_mode); 349 error = create_image(platform_mode);
351 /* Control returns here after successful restore */ 350 /*
351 * Control returns here (1) after the image has been created or the
352 * image creation has failed and (2) after a successful restore.
353 */
352 354
353 Resume_devices: 355 Resume_devices:
354 /* We may need to release the preallocated image pages here. */ 356 /* We may need to release the preallocated image pages here. */
@@ -357,7 +359,10 @@ int hibernation_snapshot(int platform_mode)
357 359
358 dpm_resume_end(in_suspend ? 360 dpm_resume_end(in_suspend ?
359 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); 361 (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
360 set_gfp_allowed_mask(saved_mask); 362
363 if (error || !in_suspend)
364 pm_restore_gfp_mask();
365
361 resume_console(); 366 resume_console();
362 Close: 367 Close:
363 platform_end(platform_mode); 368 platform_end(platform_mode);
@@ -452,17 +457,16 @@ static int resume_target_kernel(bool platform_mode)
452int hibernation_restore(int platform_mode) 457int hibernation_restore(int platform_mode)
453{ 458{
454 int error; 459 int error;
455 gfp_t saved_mask;
456 460
457 pm_prepare_console(); 461 pm_prepare_console();
458 suspend_console(); 462 suspend_console();
459 saved_mask = clear_gfp_allowed_mask(GFP_IOFS); 463 pm_restrict_gfp_mask();
460 error = dpm_suspend_start(PMSG_QUIESCE); 464 error = dpm_suspend_start(PMSG_QUIESCE);
461 if (!error) { 465 if (!error) {
462 error = resume_target_kernel(platform_mode); 466 error = resume_target_kernel(platform_mode);
463 dpm_resume_end(PMSG_RECOVER); 467 dpm_resume_end(PMSG_RECOVER);
464 } 468 }
465 set_gfp_allowed_mask(saved_mask); 469 pm_restore_gfp_mask();
466 resume_console(); 470 resume_console();
467 pm_restore_console(); 471 pm_restore_console();
468 return error; 472 return error;
@@ -476,7 +480,6 @@ int hibernation_restore(int platform_mode)
476int hibernation_platform_enter(void) 480int hibernation_platform_enter(void)
477{ 481{
478 int error; 482 int error;
479 gfp_t saved_mask;
480 483
481 if (!hibernation_ops) 484 if (!hibernation_ops)
482 return -ENOSYS; 485 return -ENOSYS;
@@ -492,7 +495,6 @@ int hibernation_platform_enter(void)
492 495
493 entering_platform_hibernation = true; 496 entering_platform_hibernation = true;
494 suspend_console(); 497 suspend_console();
495 saved_mask = clear_gfp_allowed_mask(GFP_IOFS);
496 error = dpm_suspend_start(PMSG_HIBERNATE); 498 error = dpm_suspend_start(PMSG_HIBERNATE);
497 if (error) { 499 if (error) {
498 if (hibernation_ops->recover) 500 if (hibernation_ops->recover)
@@ -536,7 +538,6 @@ int hibernation_platform_enter(void)
536 Resume_devices: 538 Resume_devices:
537 entering_platform_hibernation = false; 539 entering_platform_hibernation = false;
538 dpm_resume_end(PMSG_RESTORE); 540 dpm_resume_end(PMSG_RESTORE);
539 set_gfp_allowed_mask(saved_mask);
540 resume_console(); 541 resume_console();
541 542
542 Close: 543 Close:
@@ -646,6 +647,7 @@ int hibernate(void)
646 swsusp_free(); 647 swsusp_free();
647 if (!error) 648 if (!error)
648 power_down(); 649 power_down();
650 pm_restore_gfp_mask();
649 } else { 651 } else {
650 pr_debug("PM: Image restored successfully.\n"); 652 pr_debug("PM: Image restored successfully.\n");
651 } 653 }
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 7335952ee473..ecf770509d0d 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -197,7 +197,6 @@ static int suspend_enter(suspend_state_t state)
197int suspend_devices_and_enter(suspend_state_t state) 197int suspend_devices_and_enter(suspend_state_t state)
198{ 198{
199 int error; 199 int error;
200 gfp_t saved_mask;
201 200
202 if (!suspend_ops) 201 if (!suspend_ops)
203 return -ENOSYS; 202 return -ENOSYS;
@@ -208,7 +207,7 @@ int suspend_devices_and_enter(suspend_state_t state)
208 goto Close; 207 goto Close;
209 } 208 }
210 suspend_console(); 209 suspend_console();
211 saved_mask = clear_gfp_allowed_mask(GFP_IOFS); 210 pm_restrict_gfp_mask();
212 suspend_test_start(); 211 suspend_test_start();
213 error = dpm_suspend_start(PMSG_SUSPEND); 212 error = dpm_suspend_start(PMSG_SUSPEND);
214 if (error) { 213 if (error) {
@@ -225,7 +224,7 @@ int suspend_devices_and_enter(suspend_state_t state)
225 suspend_test_start(); 224 suspend_test_start();
226 dpm_resume_end(PMSG_RESUME); 225 dpm_resume_end(PMSG_RESUME);
227 suspend_test_finish("resume devices"); 226 suspend_test_finish("resume devices");
228 set_gfp_allowed_mask(saved_mask); 227 pm_restore_gfp_mask();
229 resume_console(); 228 resume_console();
230 Close: 229 Close:
231 if (suspend_ops->end) 230 if (suspend_ops->end)
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index a0e4a86ccf94..baf667bb2794 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@ucw.cz> 7 * Copyright (C) 1998,2001-2005 Pavel Machek <pavel@ucw.cz>
8 * Copyright (C) 2006 Rafael J. Wysocki <rjw@sisk.pl> 8 * Copyright (C) 2006 Rafael J. Wysocki <rjw@sisk.pl>
9 * Copyright (C) 2010 Bojan Smojver <bojan@rexursive.com>
9 * 10 *
10 * This file is released under the GPLv2. 11 * This file is released under the GPLv2.
11 * 12 *
@@ -753,30 +754,43 @@ static int load_image_lzo(struct swap_map_handle *handle,
753{ 754{
754 unsigned int m; 755 unsigned int m;
755 int error = 0; 756 int error = 0;
757 struct bio *bio;
756 struct timeval start; 758 struct timeval start;
757 struct timeval stop; 759 struct timeval stop;
758 unsigned nr_pages; 760 unsigned nr_pages;
759 size_t off, unc_len, cmp_len; 761 size_t i, off, unc_len, cmp_len;
760 unsigned char *unc, *cmp, *page; 762 unsigned char *unc, *cmp, *page[LZO_CMP_PAGES];
761 763
762 page = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH); 764 for (i = 0; i < LZO_CMP_PAGES; i++) {
763 if (!page) { 765 page[i] = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH);
764 printk(KERN_ERR "PM: Failed to allocate LZO page\n"); 766 if (!page[i]) {
765 return -ENOMEM; 767 printk(KERN_ERR "PM: Failed to allocate LZO page\n");
768
769 while (i)
770 free_page((unsigned long)page[--i]);
771
772 return -ENOMEM;
773 }
766 } 774 }
767 775
768 unc = vmalloc(LZO_UNC_SIZE); 776 unc = vmalloc(LZO_UNC_SIZE);
769 if (!unc) { 777 if (!unc) {
770 printk(KERN_ERR "PM: Failed to allocate LZO uncompressed\n"); 778 printk(KERN_ERR "PM: Failed to allocate LZO uncompressed\n");
771 free_page((unsigned long)page); 779
780 for (i = 0; i < LZO_CMP_PAGES; i++)
781 free_page((unsigned long)page[i]);
782
772 return -ENOMEM; 783 return -ENOMEM;
773 } 784 }
774 785
775 cmp = vmalloc(LZO_CMP_SIZE); 786 cmp = vmalloc(LZO_CMP_SIZE);
776 if (!cmp) { 787 if (!cmp) {
777 printk(KERN_ERR "PM: Failed to allocate LZO compressed\n"); 788 printk(KERN_ERR "PM: Failed to allocate LZO compressed\n");
789
778 vfree(unc); 790 vfree(unc);
779 free_page((unsigned long)page); 791 for (i = 0; i < LZO_CMP_PAGES; i++)
792 free_page((unsigned long)page[i]);
793
780 return -ENOMEM; 794 return -ENOMEM;
781 } 795 }
782 796
@@ -787,6 +801,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
787 if (!m) 801 if (!m)
788 m = 1; 802 m = 1;
789 nr_pages = 0; 803 nr_pages = 0;
804 bio = NULL;
790 do_gettimeofday(&start); 805 do_gettimeofday(&start);
791 806
792 error = snapshot_write_next(snapshot); 807 error = snapshot_write_next(snapshot);
@@ -794,11 +809,11 @@ static int load_image_lzo(struct swap_map_handle *handle,
794 goto out_finish; 809 goto out_finish;
795 810
796 for (;;) { 811 for (;;) {
797 error = swap_read_page(handle, page, NULL); /* sync */ 812 error = swap_read_page(handle, page[0], NULL); /* sync */
798 if (error) 813 if (error)
799 break; 814 break;
800 815
801 cmp_len = *(size_t *)page; 816 cmp_len = *(size_t *)page[0];
802 if (unlikely(!cmp_len || 817 if (unlikely(!cmp_len ||
803 cmp_len > lzo1x_worst_compress(LZO_UNC_SIZE))) { 818 cmp_len > lzo1x_worst_compress(LZO_UNC_SIZE))) {
804 printk(KERN_ERR "PM: Invalid LZO compressed length\n"); 819 printk(KERN_ERR "PM: Invalid LZO compressed length\n");
@@ -806,13 +821,20 @@ static int load_image_lzo(struct swap_map_handle *handle,
806 break; 821 break;
807 } 822 }
808 823
809 memcpy(cmp, page, PAGE_SIZE); 824 for (off = PAGE_SIZE, i = 1;
810 for (off = PAGE_SIZE; off < LZO_HEADER + cmp_len; off += PAGE_SIZE) { 825 off < LZO_HEADER + cmp_len; off += PAGE_SIZE, i++) {
811 error = swap_read_page(handle, page, NULL); /* sync */ 826 error = swap_read_page(handle, page[i], &bio);
812 if (error) 827 if (error)
813 goto out_finish; 828 goto out_finish;
829 }
814 830
815 memcpy(cmp + off, page, PAGE_SIZE); 831 error = hib_wait_on_bio_chain(&bio); /* need all data now */
832 if (error)
833 goto out_finish;
834
835 for (off = 0, i = 0;
836 off < LZO_HEADER + cmp_len; off += PAGE_SIZE, i++) {
837 memcpy(cmp + off, page[i], PAGE_SIZE);
816 } 838 }
817 839
818 unc_len = LZO_UNC_SIZE; 840 unc_len = LZO_UNC_SIZE;
@@ -857,7 +879,8 @@ out_finish:
857 879
858 vfree(cmp); 880 vfree(cmp);
859 vfree(unc); 881 vfree(unc);
860 free_page((unsigned long)page); 882 for (i = 0; i < LZO_CMP_PAGES; i++)
883 free_page((unsigned long)page[i]);
861 884
862 return error; 885 return error;
863} 886}
diff --git a/kernel/power/user.c b/kernel/power/user.c
index e819e17877ca..1b2ea31e6bd8 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -263,6 +263,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
263 case SNAPSHOT_UNFREEZE: 263 case SNAPSHOT_UNFREEZE:
264 if (!data->frozen || data->ready) 264 if (!data->frozen || data->ready)
265 break; 265 break;
266 pm_restore_gfp_mask();
266 thaw_processes(); 267 thaw_processes();
267 usermodehelper_enable(); 268 usermodehelper_enable();
268 data->frozen = 0; 269 data->frozen = 0;
@@ -275,6 +276,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
275 error = -EPERM; 276 error = -EPERM;
276 break; 277 break;
277 } 278 }
279 pm_restore_gfp_mask();
278 error = hibernation_snapshot(data->platform_support); 280 error = hibernation_snapshot(data->platform_support);
279 if (!error) 281 if (!error)
280 error = put_user(in_suspend, (int __user *)arg); 282 error = put_user(in_suspend, (int __user *)arg);
diff --git a/kernel/printk.c b/kernel/printk.c
index 9a2264fc42ca..a23315dc4498 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1082,13 +1082,15 @@ void printk_tick(void)
1082 1082
1083int printk_needs_cpu(int cpu) 1083int printk_needs_cpu(int cpu)
1084{ 1084{
1085 if (unlikely(cpu_is_offline(cpu)))
1086 printk_tick();
1085 return per_cpu(printk_pending, cpu); 1087 return per_cpu(printk_pending, cpu);
1086} 1088}
1087 1089
1088void wake_up_klogd(void) 1090void wake_up_klogd(void)
1089{ 1091{
1090 if (waitqueue_active(&log_wait)) 1092 if (waitqueue_active(&log_wait))
1091 __raw_get_cpu_var(printk_pending) = 1; 1093 this_cpu_write(printk_pending, 1);
1092} 1094}
1093 1095
1094/** 1096/**
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e4092704c1a9..ff7e15872398 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -104,19 +104,24 @@ gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
104 * only be modified with pm_mutex held, unless the suspend/hibernate code is 104 * only be modified with pm_mutex held, unless the suspend/hibernate code is
105 * guaranteed not to run in parallel with that modification). 105 * guaranteed not to run in parallel with that modification).
106 */ 106 */
107void set_gfp_allowed_mask(gfp_t mask) 107
108static gfp_t saved_gfp_mask;
109
110void pm_restore_gfp_mask(void)
108{ 111{
109 WARN_ON(!mutex_is_locked(&pm_mutex)); 112 WARN_ON(!mutex_is_locked(&pm_mutex));
110 gfp_allowed_mask = mask; 113 if (saved_gfp_mask) {
114 gfp_allowed_mask = saved_gfp_mask;
115 saved_gfp_mask = 0;
116 }
111} 117}
112 118
113gfp_t clear_gfp_allowed_mask(gfp_t mask) 119void pm_restrict_gfp_mask(void)
114{ 120{
115 gfp_t ret = gfp_allowed_mask;
116
117 WARN_ON(!mutex_is_locked(&pm_mutex)); 121 WARN_ON(!mutex_is_locked(&pm_mutex));
118 gfp_allowed_mask &= ~mask; 122 WARN_ON(saved_gfp_mask);
119 return ret; 123 saved_gfp_mask = gfp_allowed_mask;
124 gfp_allowed_mask &= ~GFP_IOFS;
120} 125}
121#endif /* CONFIG_PM_SLEEP */ 126#endif /* CONFIG_PM_SLEEP */
122 127
diff --git a/mm/slub.c b/mm/slub.c
index 981fb730aa04..bec0e355fbad 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3401,13 +3401,13 @@ static int validate_slab(struct kmem_cache *s, struct page *page,
3401 3401
3402 for_each_free_object(p, s, page->freelist) { 3402 for_each_free_object(p, s, page->freelist) {
3403 set_bit(slab_index(p, s, addr), map); 3403 set_bit(slab_index(p, s, addr), map);
3404 if (!check_object(s, page, p, 0)) 3404 if (!check_object(s, page, p, SLUB_RED_INACTIVE))
3405 return 0; 3405 return 0;
3406 } 3406 }
3407 3407
3408 for_each_object(p, s, addr, page->objects) 3408 for_each_object(p, s, addr, page->objects)
3409 if (!test_bit(slab_index(p, s, addr), map)) 3409 if (!test_bit(slab_index(p, s, addr), map))
3410 if (!check_object(s, page, p, 1)) 3410 if (!check_object(s, page, p, SLUB_RED_ACTIVE))
3411 return 0; 3411 return 0;
3412 return 1; 3412 return 1;
3413} 3413}
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 184eb6a0b505..e57826ced380 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -164,6 +164,7 @@ struct menu {
164 struct menu *list; 164 struct menu *list;
165 struct symbol *sym; 165 struct symbol *sym;
166 struct property *prompt; 166 struct property *prompt;
167 struct expr *visibility;
167 struct expr *dep; 168 struct expr *dep;
168 unsigned int flags; 169 unsigned int flags;
169 char *help; 170 char *help;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 753cdbd7b805..3f7240df0f3b 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -107,6 +107,7 @@ void menu_end_menu(void);
107void menu_add_entry(struct symbol *sym); 107void menu_add_entry(struct symbol *sym);
108void menu_end_entry(void); 108void menu_end_entry(void);
109void menu_add_dep(struct expr *dep); 109void menu_add_dep(struct expr *dep);
110void menu_add_visibility(struct expr *dep);
110struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); 111struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
111struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); 112struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
112void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); 113void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e83aef42c6d..b9d9aa18e6d6 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -152,6 +152,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
152 return menu_add_prop(type, prompt, NULL, dep); 152 return menu_add_prop(type, prompt, NULL, dep);
153} 153}
154 154
155void menu_add_visibility(struct expr *expr)
156{
157 current_entry->visibility = expr_alloc_and(current_entry->visibility,
158 expr);
159}
160
155void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) 161void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
156{ 162{
157 menu_add_prop(type, NULL, expr, dep); 163 menu_add_prop(type, NULL, expr, dep);
@@ -410,6 +416,11 @@ bool menu_is_visible(struct menu *menu)
410 if (!menu->prompt) 416 if (!menu->prompt)
411 return false; 417 return false;
412 418
419 if (menu->visibility) {
420 if (expr_calc_value(menu->visibility) == no)
421 return no;
422 }
423
413 sym = menu->sym; 424 sym = menu->sym;
414 if (sym) { 425 if (sym) {
415 sym_calc_value(sym); 426 sym_calc_value(sym);
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf
index d8bc74249622..c9e690eb7545 100644
--- a/scripts/kconfig/zconf.gperf
+++ b/scripts/kconfig/zconf.gperf
@@ -38,6 +38,7 @@ hex, T_TYPE, TF_COMMAND, S_HEX
38string, T_TYPE, TF_COMMAND, S_STRING 38string, T_TYPE, TF_COMMAND, S_STRING
39select, T_SELECT, TF_COMMAND 39select, T_SELECT, TF_COMMAND
40range, T_RANGE, TF_COMMAND 40range, T_RANGE, TF_COMMAND
41visible, T_VISIBLE, TF_COMMAND
41option, T_OPTION, TF_COMMAND 42option, T_OPTION, TF_COMMAND
42on, T_ON, TF_PARAM 43on, T_ON, TF_PARAM
43modules, T_OPT_MODULES, TF_OPTION 44modules, T_OPT_MODULES, TF_OPTION
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped
index c1748faf4634..4055d5de1750 100644
--- a/scripts/kconfig/zconf.hash.c_shipped
+++ b/scripts/kconfig/zconf.hash.c_shipped
@@ -32,7 +32,7 @@
32struct kconf_id; 32struct kconf_id;
33 33
34static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); 34static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
35/* maximum key range = 47, duplicates = 0 */ 35/* maximum key range = 50, duplicates = 0 */
36 36
37#ifdef __GNUC__ 37#ifdef __GNUC__
38__inline 38__inline
@@ -46,32 +46,32 @@ kconf_id_hash (register const char *str, register unsigned int len)
46{ 46{
47 static unsigned char asso_values[] = 47 static unsigned char asso_values[] =
48 { 48 {
49 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
50 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
51 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 51 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 52 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
53 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 53 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
54 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 54 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
55 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 55 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
56 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 56 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
57 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 57 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
58 49, 49, 49, 49, 49, 49, 49, 49, 11, 5, 58 52, 52, 52, 52, 52, 52, 52, 52, 40, 5,
59 0, 0, 5, 49, 5, 20, 49, 49, 5, 20, 59 0, 0, 5, 52, 0, 20, 52, 52, 10, 20,
60 5, 0, 30, 49, 0, 15, 0, 10, 0, 49, 60 5, 0, 35, 52, 0, 30, 0, 15, 0, 52,
61 25, 49, 49, 49, 49, 49, 49, 49, 49, 49, 61 15, 52, 52, 52, 52, 52, 52, 52, 52, 52,
62 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 62 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
63 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 63 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
64 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 64 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
65 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 65 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
66 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 66 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
67 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 67 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
68 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 68 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
69 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 69 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
70 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 70 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
71 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 71 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
72 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 72 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
73 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 73 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
74 49, 49, 49, 49, 49, 49 74 52, 52, 52, 52, 52, 52
75 }; 75 };
76 register int hval = len; 76 register int hval = len;
77 77
@@ -102,25 +102,26 @@ struct kconf_id_strings_t
102 char kconf_id_strings_str12[sizeof("default")]; 102 char kconf_id_strings_str12[sizeof("default")];
103 char kconf_id_strings_str13[sizeof("def_bool")]; 103 char kconf_id_strings_str13[sizeof("def_bool")];
104 char kconf_id_strings_str14[sizeof("help")]; 104 char kconf_id_strings_str14[sizeof("help")];
105 char kconf_id_strings_str15[sizeof("bool")];
106 char kconf_id_strings_str16[sizeof("config")]; 105 char kconf_id_strings_str16[sizeof("config")];
107 char kconf_id_strings_str17[sizeof("def_tristate")]; 106 char kconf_id_strings_str17[sizeof("def_tristate")];
108 char kconf_id_strings_str18[sizeof("boolean")]; 107 char kconf_id_strings_str18[sizeof("hex")];
109 char kconf_id_strings_str19[sizeof("defconfig_list")]; 108 char kconf_id_strings_str19[sizeof("defconfig_list")];
110 char kconf_id_strings_str21[sizeof("string")];
111 char kconf_id_strings_str22[sizeof("if")]; 109 char kconf_id_strings_str22[sizeof("if")];
112 char kconf_id_strings_str23[sizeof("int")]; 110 char kconf_id_strings_str23[sizeof("int")];
113 char kconf_id_strings_str26[sizeof("select")];
114 char kconf_id_strings_str27[sizeof("modules")]; 111 char kconf_id_strings_str27[sizeof("modules")];
115 char kconf_id_strings_str28[sizeof("tristate")]; 112 char kconf_id_strings_str28[sizeof("tristate")];
116 char kconf_id_strings_str29[sizeof("menu")]; 113 char kconf_id_strings_str29[sizeof("menu")];
117 char kconf_id_strings_str31[sizeof("source")];
118 char kconf_id_strings_str32[sizeof("comment")]; 114 char kconf_id_strings_str32[sizeof("comment")];
119 char kconf_id_strings_str33[sizeof("hex")];
120 char kconf_id_strings_str35[sizeof("menuconfig")]; 115 char kconf_id_strings_str35[sizeof("menuconfig")];
121 char kconf_id_strings_str36[sizeof("prompt")]; 116 char kconf_id_strings_str36[sizeof("string")];
122 char kconf_id_strings_str37[sizeof("depends")]; 117 char kconf_id_strings_str37[sizeof("visible")];
118 char kconf_id_strings_str41[sizeof("prompt")];
119 char kconf_id_strings_str42[sizeof("depends")];
120 char kconf_id_strings_str44[sizeof("bool")];
121 char kconf_id_strings_str46[sizeof("select")];
122 char kconf_id_strings_str47[sizeof("boolean")];
123 char kconf_id_strings_str48[sizeof("mainmenu")]; 123 char kconf_id_strings_str48[sizeof("mainmenu")];
124 char kconf_id_strings_str51[sizeof("source")];
124 }; 125 };
125static struct kconf_id_strings_t kconf_id_strings_contents = 126static struct kconf_id_strings_t kconf_id_strings_contents =
126 { 127 {
@@ -136,25 +137,26 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
136 "default", 137 "default",
137 "def_bool", 138 "def_bool",
138 "help", 139 "help",
139 "bool",
140 "config", 140 "config",
141 "def_tristate", 141 "def_tristate",
142 "boolean", 142 "hex",
143 "defconfig_list", 143 "defconfig_list",
144 "string",
145 "if", 144 "if",
146 "int", 145 "int",
147 "select",
148 "modules", 146 "modules",
149 "tristate", 147 "tristate",
150 "menu", 148 "menu",
151 "source",
152 "comment", 149 "comment",
153 "hex",
154 "menuconfig", 150 "menuconfig",
151 "string",
152 "visible",
155 "prompt", 153 "prompt",
156 "depends", 154 "depends",
157 "mainmenu" 155 "bool",
156 "select",
157 "boolean",
158 "mainmenu",
159 "source"
158 }; 160 };
159#define kconf_id_strings ((const char *) &kconf_id_strings_contents) 161#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
160#ifdef __GNUC__ 162#ifdef __GNUC__
@@ -168,11 +170,11 @@ kconf_id_lookup (register const char *str, register unsigned int len)
168{ 170{
169 enum 171 enum
170 { 172 {
171 TOTAL_KEYWORDS = 31, 173 TOTAL_KEYWORDS = 32,
172 MIN_WORD_LENGTH = 2, 174 MIN_WORD_LENGTH = 2,
173 MAX_WORD_LENGTH = 14, 175 MAX_WORD_LENGTH = 14,
174 MIN_HASH_VALUE = 2, 176 MIN_HASH_VALUE = 2,
175 MAX_HASH_VALUE = 48 177 MAX_HASH_VALUE = 51
176 }; 178 };
177 179
178 static struct kconf_id wordlist[] = 180 static struct kconf_id wordlist[] =
@@ -191,31 +193,35 @@ kconf_id_lookup (register const char *str, register unsigned int len)
191 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, 193 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
192 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, 194 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
193 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND}, 195 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
194 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN}, 196 {-1},
195 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND}, 197 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
196 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, 198 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
197 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN}, 199 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
198 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION}, 200 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
199 {-1}, 201 {-1}, {-1},
200 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
201 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, 202 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
202 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, 203 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
203 {-1}, {-1}, 204 {-1}, {-1}, {-1},
204 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
205 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, 205 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
206 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, 206 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
207 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, 207 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
208 {-1}, 208 {-1}, {-1},
209 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
210 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, 209 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
211 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX}, 210 {-1}, {-1},
212 {-1},
213 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, 211 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
214 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND}, 212 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING},
215 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND}, 213 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
216 {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, 214 {-1}, {-1}, {-1},
215 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND},
216 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND},
217 {-1}, 217 {-1},
218 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND} 218 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
219 {-1},
220 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND},
221 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
222 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND},
223 {-1}, {-1},
224 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND}
219 }; 225 };
220 226
221 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 227 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 699d4b265186..4c5495ea205e 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -160,18 +160,19 @@ static struct menu *current_menu, *current_entry;
160 T_DEFAULT = 275, 160 T_DEFAULT = 275,
161 T_SELECT = 276, 161 T_SELECT = 276,
162 T_RANGE = 277, 162 T_RANGE = 277,
163 T_OPTION = 278, 163 T_VISIBLE = 278,
164 T_ON = 279, 164 T_OPTION = 279,
165 T_WORD = 280, 165 T_ON = 280,
166 T_WORD_QUOTE = 281, 166 T_WORD = 281,
167 T_UNEQUAL = 282, 167 T_WORD_QUOTE = 282,
168 T_CLOSE_PAREN = 283, 168 T_UNEQUAL = 283,
169 T_OPEN_PAREN = 284, 169 T_CLOSE_PAREN = 284,
170 T_EOL = 285, 170 T_OPEN_PAREN = 285,
171 T_OR = 286, 171 T_EOL = 286,
172 T_AND = 287, 172 T_OR = 287,
173 T_EQUAL = 288, 173 T_AND = 288,
174 T_NOT = 289 174 T_EQUAL = 289,
175 T_NOT = 290
175 }; 176 };
176#endif 177#endif
177 178
@@ -419,20 +420,20 @@ union yyalloc
419/* YYFINAL -- State number of the termination state. */ 420/* YYFINAL -- State number of the termination state. */
420#define YYFINAL 11 421#define YYFINAL 11
421/* YYLAST -- Last index in YYTABLE. */ 422/* YYLAST -- Last index in YYTABLE. */
422#define YYLAST 277 423#define YYLAST 290
423 424
424/* YYNTOKENS -- Number of terminals. */ 425/* YYNTOKENS -- Number of terminals. */
425#define YYNTOKENS 35 426#define YYNTOKENS 36
426/* YYNNTS -- Number of nonterminals. */ 427/* YYNNTS -- Number of nonterminals. */
427#define YYNNTS 48 428#define YYNNTS 50
428/* YYNRULES -- Number of rules. */ 429/* YYNRULES -- Number of rules. */
429#define YYNRULES 113 430#define YYNRULES 118
430/* YYNRULES -- Number of states. */ 431/* YYNRULES -- Number of states. */
431#define YYNSTATES 185 432#define YYNSTATES 191
432 433
433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 434/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
434#define YYUNDEFTOK 2 435#define YYUNDEFTOK 2
435#define YYMAXUTOK 289 436#define YYMAXUTOK 290
436 437
437#define YYTRANSLATE(YYX) \ 438#define YYTRANSLATE(YYX) \
438 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 439 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -468,7 +469,8 @@ static const yytype_uint8 yytranslate[] =
468 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 469 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
469 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 470 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
470 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 471 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
471 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 472 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
473 35
472}; 474};
473 475
474#if YYDEBUG 476#if YYDEBUG
@@ -478,72 +480,73 @@ static const yytype_uint16 yyprhs[] =
478{ 480{
479 0, 0, 3, 6, 8, 11, 13, 14, 17, 20, 481 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
480 23, 26, 31, 36, 40, 42, 44, 46, 48, 50, 482 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
481 52, 54, 56, 58, 60, 62, 64, 66, 70, 73, 483 52, 54, 56, 58, 60, 62, 64, 66, 68, 72,
482 77, 80, 84, 87, 88, 91, 94, 97, 100, 103, 484 75, 79, 82, 86, 89, 90, 93, 96, 99, 102,
483 106, 110, 115, 120, 125, 131, 135, 136, 140, 141, 485 105, 108, 112, 117, 122, 127, 133, 137, 138, 142,
484 144, 148, 151, 153, 157, 158, 161, 164, 167, 170, 486 143, 146, 150, 153, 155, 159, 160, 163, 166, 169,
485 173, 178, 182, 185, 190, 191, 194, 198, 200, 204, 487 172, 175, 180, 184, 187, 192, 193, 196, 200, 202,
486 205, 208, 211, 214, 218, 222, 225, 227, 231, 232, 488 206, 207, 210, 213, 216, 220, 224, 228, 230, 234,
487 235, 238, 241, 245, 249, 252, 255, 258, 259, 262, 489 235, 238, 241, 244, 248, 252, 255, 258, 261, 262,
488 265, 268, 273, 274, 277, 279, 281, 284, 287, 290, 490 265, 268, 271, 276, 277, 280, 283, 286, 287, 290,
489 292, 295, 296, 299, 301, 305, 309, 313, 316, 320, 491 292, 294, 297, 300, 303, 305, 308, 309, 312, 314,
490 324, 326, 328, 329 492 318, 322, 326, 329, 333, 337, 339, 341, 342
491}; 493};
492 494
493/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 495/* YYRHS -- A `-1'-separated list of the rules' RHS. */
494static const yytype_int8 yyrhs[] = 496static const yytype_int8 yyrhs[] =
495{ 497{
496 36, 0, -1, 78, 37, -1, 37, -1, 62, 38, 498 37, 0, -1, 81, 38, -1, 38, -1, 63, 39,
497 -1, 38, -1, -1, 38, 40, -1, 38, 54, -1, 499 -1, 39, -1, -1, 39, 41, -1, 39, 55, -1,
498 38, 66, -1, 38, 77, -1, 38, 25, 1, 30, 500 39, 67, -1, 39, 80, -1, 39, 26, 1, 31,
499 -1, 38, 39, 1, 30, -1, 38, 1, 30, -1, 501 -1, 39, 40, 1, 31, -1, 39, 1, 31, -1,
500 16, -1, 18, -1, 19, -1, 21, -1, 17, -1, 502 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
501 22, -1, 20, -1, 30, -1, 60, -1, 70, -1, 503 22, -1, 20, -1, 23, -1, 31, -1, 61, -1,
502 43, -1, 45, -1, 68, -1, 25, 1, 30, -1, 504 71, -1, 44, -1, 46, -1, 69, -1, 26, 1,
503 1, 30, -1, 10, 25, 30, -1, 42, 46, -1, 505 31, -1, 1, 31, -1, 10, 26, 31, -1, 43,
504 11, 25, 30, -1, 44, 46, -1, -1, 46, 47, 506 47, -1, 11, 26, 31, -1, 45, 47, -1, -1,
505 -1, 46, 48, -1, 46, 74, -1, 46, 72, -1, 507 47, 48, -1, 47, 49, -1, 47, 75, -1, 47,
506 46, 41, -1, 46, 30, -1, 19, 75, 30, -1, 508 73, -1, 47, 42, -1, 47, 31, -1, 19, 78,
507 18, 76, 79, 30, -1, 20, 80, 79, 30, -1, 509 31, -1, 18, 79, 82, 31, -1, 20, 83, 82,
508 21, 25, 79, 30, -1, 22, 81, 81, 79, 30, 510 31, -1, 21, 26, 82, 31, -1, 22, 84, 84,
509 -1, 23, 49, 30, -1, -1, 49, 25, 50, -1, 511 82, 31, -1, 24, 50, 31, -1, -1, 50, 26,
510 -1, 33, 76, -1, 7, 82, 30, -1, 51, 55, 512 51, -1, -1, 34, 79, -1, 7, 85, 31, -1,
511 -1, 77, -1, 52, 57, 53, -1, -1, 55, 56, 513 52, 56, -1, 80, -1, 53, 58, 54, -1, -1,
512 -1, 55, 74, -1, 55, 72, -1, 55, 30, -1, 514 56, 57, -1, 56, 75, -1, 56, 73, -1, 56,
513 55, 41, -1, 18, 76, 79, 30, -1, 19, 75, 515 31, -1, 56, 42, -1, 18, 79, 82, 31, -1,
514 30, -1, 17, 30, -1, 20, 25, 79, 30, -1, 516 19, 78, 31, -1, 17, 31, -1, 20, 26, 82,
515 -1, 57, 40, -1, 14, 80, 78, -1, 77, -1, 517 31, -1, -1, 58, 41, -1, 14, 83, 81, -1,
516 58, 61, 59, -1, -1, 61, 40, -1, 61, 66, 518 80, -1, 59, 62, 60, -1, -1, 62, 41, -1,
517 -1, 61, 54, -1, 3, 76, 78, -1, 4, 76, 519 62, 67, -1, 62, 55, -1, 3, 79, 81, -1,
518 30, -1, 63, 73, -1, 77, -1, 64, 67, 65, 520 4, 79, 31, -1, 64, 76, 74, -1, 80, -1,
519 -1, -1, 67, 40, -1, 67, 66, -1, 67, 54, 521 65, 68, 66, -1, -1, 68, 41, -1, 68, 67,
520 -1, 6, 76, 30, -1, 9, 76, 30, -1, 69, 522 -1, 68, 55, -1, 6, 79, 31, -1, 9, 79,
521 73, -1, 12, 30, -1, 71, 13, -1, -1, 73, 523 31, -1, 70, 74, -1, 12, 31, -1, 72, 13,
522 74, -1, 73, 30, -1, 73, 41, -1, 16, 24, 524 -1, -1, 74, 75, -1, 74, 31, -1, 74, 42,
523 80, 30, -1, -1, 76, 79, -1, 25, -1, 26, 525 -1, 16, 25, 83, 31, -1, -1, 76, 77, -1,
524 -1, 5, 30, -1, 8, 30, -1, 15, 30, -1, 526 76, 31, -1, 23, 82, -1, -1, 79, 82, -1,
525 30, -1, 78, 30, -1, -1, 14, 80, -1, 81, 527 26, -1, 27, -1, 5, 31, -1, 8, 31, -1,
526 -1, 81, 33, 81, -1, 81, 27, 81, -1, 29, 528 15, 31, -1, 31, -1, 81, 31, -1, -1, 14,
527 80, 28, -1, 34, 80, -1, 80, 31, 80, -1, 529 83, -1, 84, -1, 84, 34, 84, -1, 84, 28,
528 80, 32, 80, -1, 25, -1, 26, -1, -1, 25, 530 84, -1, 30, 83, 29, -1, 35, 83, -1, 83,
529 -1 531 32, 83, -1, 83, 33, 83, -1, 26, -1, 27,
532 -1, -1, 26, -1
530}; 533};
531 534
532/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 535/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
533static const yytype_uint16 yyrline[] = 536static const yytype_uint16 yyrline[] =
534{ 537{
535 0, 107, 107, 107, 109, 109, 111, 113, 114, 115, 538 0, 108, 108, 108, 110, 110, 112, 114, 115, 116,
536 116, 117, 118, 122, 126, 126, 126, 126, 126, 126, 539 117, 118, 119, 123, 127, 127, 127, 127, 127, 127,
537 126, 130, 131, 132, 133, 134, 135, 139, 140, 146, 540 127, 127, 131, 132, 133, 134, 135, 136, 140, 141,
538 154, 160, 168, 178, 180, 181, 182, 183, 184, 185, 541 147, 155, 161, 169, 179, 181, 182, 183, 184, 185,
539 188, 196, 202, 212, 218, 224, 227, 229, 240, 241, 542 186, 189, 197, 203, 213, 219, 225, 228, 230, 241,
540 246, 255, 260, 268, 271, 273, 274, 275, 276, 277, 543 242, 247, 256, 261, 269, 272, 274, 275, 276, 277,
541 280, 286, 297, 303, 313, 315, 320, 328, 336, 339, 544 278, 281, 287, 298, 304, 314, 316, 321, 329, 337,
542 341, 342, 343, 348, 355, 362, 367, 375, 378, 380, 545 340, 342, 343, 344, 349, 356, 363, 368, 376, 379,
543 381, 382, 385, 393, 400, 407, 413, 420, 422, 423, 546 381, 382, 383, 386, 394, 401, 408, 414, 421, 423,
544 424, 427, 435, 437, 442, 443, 446, 447, 448, 452, 547 424, 425, 428, 436, 438, 439, 442, 449, 451, 456,
545 453, 456, 457, 460, 461, 462, 463, 464, 465, 466, 548 457, 460, 461, 462, 466, 467, 470, 471, 474, 475,
546 469, 470, 473, 474 549 476, 477, 478, 479, 480, 483, 484, 487, 488
547}; 550};
548#endif 551#endif
549 552
@@ -556,7 +559,7 @@ static const char *const yytname[] =
556 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", 559 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
557 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", 560 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
558 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", 561 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
559 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 562 "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
560 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", 563 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
561 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", 564 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
562 "common_stmt", "option_error", "config_entry_start", "config_stmt", 565 "common_stmt", "option_error", "config_entry_start", "config_stmt",
@@ -567,8 +570,8 @@ static const char *const yytname[] =
567 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu", 570 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
568 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", 571 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
569 "comment", "comment_stmt", "help_start", "help", "depends_list", 572 "comment", "comment_stmt", "help_start", "help", "depends_list",
570 "depends", "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", 573 "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
571 "symbol", "word_opt", 0 574 "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0
572}; 575};
573#endif 576#endif
574 577
@@ -580,25 +583,25 @@ static const yytype_uint16 yytoknum[] =
580 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 583 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
581 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 584 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
582 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 585 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
583 285, 286, 287, 288, 289 586 285, 286, 287, 288, 289, 290
584}; 587};
585# endif 588# endif
586 589
587/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 590/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
588static const yytype_uint8 yyr1[] = 591static const yytype_uint8 yyr1[] =
589{ 592{
590 0, 35, 36, 36, 37, 37, 38, 38, 38, 38, 593 0, 36, 37, 37, 38, 38, 39, 39, 39, 39,
591 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 594 39, 39, 39, 39, 40, 40, 40, 40, 40, 40,
592 39, 40, 40, 40, 40, 40, 40, 41, 41, 42, 595 40, 40, 41, 41, 41, 41, 41, 41, 42, 42,
593 43, 44, 45, 46, 46, 46, 46, 46, 46, 46, 596 43, 44, 45, 46, 47, 47, 47, 47, 47, 47,
594 47, 47, 47, 47, 47, 48, 49, 49, 50, 50, 597 47, 48, 48, 48, 48, 48, 49, 50, 50, 51,
595 51, 52, 53, 54, 55, 55, 55, 55, 55, 55, 598 51, 52, 53, 54, 55, 56, 56, 56, 56, 56,
596 56, 56, 56, 56, 57, 57, 58, 59, 60, 61, 599 56, 57, 57, 57, 57, 58, 58, 59, 60, 61,
597 61, 61, 61, 62, 63, 64, 65, 66, 67, 67, 600 62, 62, 62, 62, 63, 64, 65, 66, 67, 68,
598 67, 67, 68, 69, 70, 71, 72, 73, 73, 73, 601 68, 68, 68, 69, 70, 71, 72, 73, 74, 74,
599 73, 74, 75, 75, 76, 76, 77, 77, 77, 78, 602 74, 74, 75, 76, 76, 76, 77, 78, 78, 79,
600 78, 79, 79, 80, 80, 80, 80, 80, 80, 80, 603 79, 80, 80, 80, 81, 81, 82, 82, 83, 83,
601 81, 81, 82, 82 604 83, 83, 83, 83, 83, 84, 84, 85, 85
602}; 605};
603 606
604/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 607/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -606,16 +609,16 @@ static const yytype_uint8 yyr2[] =
606{ 609{
607 0, 2, 2, 1, 2, 1, 0, 2, 2, 2, 610 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
608 2, 4, 4, 3, 1, 1, 1, 1, 1, 1, 611 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
609 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, 612 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
610 2, 3, 2, 0, 2, 2, 2, 2, 2, 2, 613 3, 2, 3, 2, 0, 2, 2, 2, 2, 2,
611 3, 4, 4, 4, 5, 3, 0, 3, 0, 2, 614 2, 3, 4, 4, 4, 5, 3, 0, 3, 0,
612 3, 2, 1, 3, 0, 2, 2, 2, 2, 2, 615 2, 3, 2, 1, 3, 0, 2, 2, 2, 2,
613 4, 3, 2, 4, 0, 2, 3, 1, 3, 0, 616 2, 4, 3, 2, 4, 0, 2, 3, 1, 3,
614 2, 2, 2, 3, 3, 2, 1, 3, 0, 2, 617 0, 2, 2, 2, 3, 3, 3, 1, 3, 0,
615 2, 2, 3, 3, 2, 2, 2, 0, 2, 2, 618 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
616 2, 4, 0, 2, 1, 1, 2, 2, 2, 1, 619 2, 2, 4, 0, 2, 2, 2, 0, 2, 1,
617 2, 0, 2, 1, 3, 3, 3, 2, 3, 3, 620 1, 2, 2, 2, 1, 2, 0, 2, 1, 3,
618 1, 1, 0, 1 621 3, 3, 2, 3, 3, 1, 1, 0, 1
619}; 622};
620 623
621/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 624/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -623,165 +626,172 @@ static const yytype_uint8 yyr2[] =
623 means the default is an error. */ 626 means the default is an error. */
624static const yytype_uint8 yydefact[] = 627static const yytype_uint8 yydefact[] =
625{ 628{
626 6, 0, 99, 0, 3, 0, 6, 6, 94, 95, 629 6, 0, 104, 0, 3, 0, 6, 6, 99, 100,
627 0, 1, 0, 0, 0, 0, 112, 0, 0, 0, 630 0, 1, 0, 0, 0, 0, 117, 0, 0, 0,
628 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, 631 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
629 0, 21, 0, 7, 33, 24, 33, 25, 54, 64, 632 21, 0, 22, 0, 7, 34, 25, 34, 26, 55,
630 8, 69, 22, 87, 78, 9, 26, 87, 23, 10, 633 65, 8, 70, 23, 93, 79, 9, 27, 88, 24,
631 0, 100, 2, 73, 13, 0, 96, 0, 113, 0, 634 10, 0, 105, 2, 74, 13, 0, 101, 0, 118,
632 97, 0, 0, 0, 110, 111, 0, 0, 0, 103, 635 0, 102, 0, 0, 0, 115, 116, 0, 0, 0,
633 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 636 108, 103, 0, 0, 0, 0, 0, 0, 0, 88,
634 0, 74, 82, 50, 83, 29, 31, 0, 107, 0, 637 0, 0, 75, 83, 51, 84, 30, 32, 0, 112,
635 0, 66, 0, 0, 11, 12, 0, 0, 0, 0, 638 0, 0, 67, 0, 0, 11, 12, 0, 0, 0,
636 92, 0, 0, 0, 46, 0, 39, 38, 34, 35, 639 0, 97, 0, 0, 0, 47, 0, 40, 39, 35,
637 0, 37, 36, 0, 0, 92, 0, 58, 59, 55, 640 36, 0, 38, 37, 0, 0, 97, 0, 59, 60,
638 57, 56, 65, 53, 52, 70, 72, 68, 71, 67, 641 56, 58, 57, 66, 54, 53, 71, 73, 69, 72,
639 89, 90, 88, 79, 81, 77, 80, 76, 106, 108, 642 68, 106, 95, 0, 94, 80, 82, 78, 81, 77,
640 109, 105, 104, 28, 85, 0, 101, 0, 101, 101, 643 90, 91, 89, 111, 113, 114, 110, 109, 29, 86,
641 101, 0, 0, 0, 86, 62, 101, 0, 101, 0, 644 0, 106, 0, 106, 106, 106, 0, 0, 0, 87,
642 0, 0, 40, 93, 0, 0, 101, 48, 45, 27, 645 63, 106, 0, 106, 0, 96, 0, 0, 41, 98,
643 0, 61, 0, 91, 102, 41, 42, 43, 0, 0, 646 0, 0, 106, 49, 46, 28, 0, 62, 0, 107,
644 47, 60, 63, 44, 49 647 92, 42, 43, 44, 0, 0, 48, 61, 64, 45,
648 50
645}; 649};
646 650
647/* YYDEFGOTO[NTERM-NUM]. */ 651/* YYDEFGOTO[NTERM-NUM]. */
648static const yytype_int16 yydefgoto[] = 652static const yytype_int16 yydefgoto[] =
649{ 653{
650 -1, 3, 4, 5, 32, 33, 107, 34, 35, 36, 654 -1, 3, 4, 5, 33, 34, 108, 35, 36, 37,
651 37, 73, 108, 109, 152, 180, 38, 39, 123, 40, 655 38, 74, 109, 110, 157, 186, 39, 40, 124, 41,
652 75, 119, 76, 41, 127, 42, 77, 6, 43, 44, 656 76, 120, 77, 42, 128, 43, 78, 6, 44, 45,
653 135, 45, 79, 46, 47, 48, 110, 111, 78, 112, 657 137, 46, 80, 47, 48, 49, 111, 112, 81, 113,
654 147, 148, 49, 7, 161, 68, 69, 59 658 79, 134, 152, 153, 50, 7, 165, 69, 70, 60
655}; 659};
656 660
657/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 661/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
658 STATE-NUM. */ 662 STATE-NUM. */
659#define YYPACT_NINF -89 663#define YYPACT_NINF -90
660static const yytype_int16 yypact[] = 664static const yytype_int16 yypact[] =
661{ 665{
662 3, 4, -89, 20, -89, 100, -89, 7, -89, -89, 666 4, 42, -90, 96, -90, 111, -90, 15, -90, -90,
663 -8, -89, 17, 4, 28, 4, 37, 36, 4, 68, 667 75, -90, 82, 42, 104, 42, 110, 107, 42, 115,
664 87, -18, 69, -89, -89, -89, -89, -89, -89, -89, 668 125, -4, 121, -90, -90, -90, -90, -90, -90, -90,
665 128, -89, 138, -89, -89, -89, -89, -89, -89, -89, 669 -90, 162, -90, 163, -90, -90, -90, -90, -90, -90,
666 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 670 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
667 127, -89, -89, 110, -89, 126, -89, 136, -89, 137, 671 -90, 139, -90, -90, 138, -90, 142, -90, 143, -90,
668 -89, 147, 150, 152, -89, -89, -18, -18, 171, -14, 672 152, -90, 164, 167, 168, -90, -90, -4, -4, 77,
669 -89, 153, 157, 34, 67, 180, 233, 220, 207, 220, 673 -18, -90, 177, 185, 33, 71, 195, 247, 236, -2,
670 154, -89, -89, -89, -89, -89, -89, 0, -89, -18, 674 236, 171, -90, -90, -90, -90, -90, -90, 41, -90,
671 -18, 110, 44, 44, -89, -89, 163, 174, 182, 4, 675 -4, -4, 138, 97, 97, -90, -90, 186, 187, 194,
672 4, -18, 194, 44, -89, 219, -89, -89, -89, -89, 676 42, 42, -4, 196, 97, -90, 219, -90, -90, -90,
673 223, -89, -89, 203, 4, 4, 215, -89, -89, -89, 677 -90, 210, -90, -90, 204, 42, 42, 199, -90, -90,
674 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 678 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
675 -89, -89, -89, -89, -89, -89, -89, -89, -89, 213, 679 -90, 222, -90, 223, -90, -90, -90, -90, -90, -90,
676 -89, -89, -89, -89, -89, -18, 232, 227, 232, -5, 680 -90, -90, -90, -90, 215, -90, -90, -90, -90, -90,
677 232, 44, 35, 234, -89, -89, 232, 235, 232, 224, 681 -4, 222, 228, 222, -5, 222, 97, 35, 229, -90,
678 -18, 236, -89, -89, 237, 238, 232, 216, -89, -89, 682 -90, 222, 232, 222, -4, -90, 135, 233, -90, -90,
679 240, -89, 241, -89, 71, -89, -89, -89, 242, 4, 683 234, 235, 222, 240, -90, -90, 237, -90, 239, -13,
680 -89, -89, -89, -89, -89 684 -90, -90, -90, -90, 244, 42, -90, -90, -90, -90,
685 -90
681}; 686};
682 687
683/* YYPGOTO[NTERM-NUM]. */ 688/* YYPGOTO[NTERM-NUM]. */
684static const yytype_int16 yypgoto[] = 689static const yytype_int16 yypgoto[] =
685{ 690{
686 -89, -89, 255, 267, -89, 47, -57, -89, -89, -89, 691 -90, -90, 269, 271, -90, 23, -70, -90, -90, -90,
687 -89, 239, -89, -89, -89, -89, -89, -89, -89, 130, 692 -90, 243, -90, -90, -90, -90, -90, -90, -90, -48,
688 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 693 -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
689 -89, 181, -89, -89, -89, -89, -89, 199, 229, 16, 694 -90, -20, -90, -90, -90, -90, -90, 206, 205, -68,
690 162, -1, 74, -7, 103, -65, -88, -89 695 -90, -90, 169, -1, 27, -7, 118, -66, -89, -90
691}; 696};
692 697
693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 698/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
694 positive, shift that token. If negative, reduce the rule which 699 positive, shift that token. If negative, reduce the rule which
695 number is the opposite. If zero, do what YYDEFACT says. 700 number is the opposite. If zero, do what YYDEFACT says.
696 If YYTABLE_NINF, syntax error. */ 701 If YYTABLE_NINF, syntax error. */
697#define YYTABLE_NINF -85 702#define YYTABLE_NINF -86
698static const yytype_int16 yytable[] = 703static const yytype_int16 yytable[] =
699{ 704{
700 10, 87, 88, 53, 141, 142, 1, 64, 65, 160, 705 10, 88, 89, 54, 146, 147, 119, 1, 122, 164,
701 1, 66, 55, 92, 57, 151, 67, 61, 118, 93, 706 93, 141, 56, 142, 58, 156, 94, 62, 1, 90,
702 11, 131, 2, 131, 139, 140, 89, 90, 138, 8, 707 91, 131, 65, 66, 144, 145, 67, 90, 91, 132,
703 9, 89, 90, 2, -30, 96, 149, 51, -30, -30, 708 127, 68, 136, -31, 97, 2, 154, -31, -31, -31,
704 -30, -30, -30, -30, -30, -30, 97, 54, -30, -30, 709 -31, -31, -31, -31, -31, 98, 52, -31, -31, 99,
705 98, -30, 99, 100, 101, 102, 103, 104, 56, 105, 710 -31, 100, 101, 102, 103, 104, -31, 105, 129, 106,
706 167, 91, 58, 166, 106, 168, 60, -32, 96, 64, 711 138, 173, 92, 141, 107, 142, 174, 172, 8, 9,
707 65, -32, -32, -32, -32, -32, -32, -32, -32, 97, 712 143, -33, 97, 90, 91, -33, -33, -33, -33, -33,
708 159, -32, -32, 98, -32, 99, 100, 101, 102, 103, 713 -33, -33, -33, 98, 166, -33, -33, 99, -33, 100,
709 104, 121, 105, 62, 132, 174, 132, 106, 146, 70, 714 101, 102, 103, 104, -33, 105, 11, 106, 179, 151,
710 -5, 12, 89, 90, 13, 14, 15, 16, 17, 18, 715 123, 126, 107, 135, 125, 130, 2, 139, 2, 90,
711 19, 20, 63, 156, 21, 22, 23, 24, 25, 26, 716 91, -5, 12, 55, 161, 13, 14, 15, 16, 17,
712 27, 28, 29, 122, 125, 30, 133, -4, 12, 71, 717 18, 19, 20, 65, 66, 21, 22, 23, 24, 25,
713 31, 13, 14, 15, 16, 17, 18, 19, 20, 72, 718 26, 27, 28, 29, 30, 57, 59, 31, 61, -4,
714 51, 21, 22, 23, 24, 25, 26, 27, 28, 29, 719 12, 63, 32, 13, 14, 15, 16, 17, 18, 19,
715 124, 129, 30, 137, -84, 96, 81, 31, -84, -84, 720 20, 64, 71, 21, 22, 23, 24, 25, 26, 27,
716 -84, -84, -84, -84, -84, -84, 82, 83, -84, -84, 721 28, 29, 30, 72, 73, 31, 180, 90, 91, 52,
717 98, -84, -84, -84, -84, -84, -84, 84, 184, 105, 722 32, -85, 97, 82, 83, -85, -85, -85, -85, -85,
718 85, 96, 86, 94, 130, -51, -51, 95, -51, -51, 723 -85, -85, -85, 84, 190, -85, -85, 99, -85, -85,
719 -51, -51, 97, 143, -51, -51, 98, 113, 114, 115, 724 -85, -85, -85, -85, -85, 85, 97, 106, 86, 87,
720 116, 2, 89, 90, 144, 105, 145, 126, 96, 134, 725 -52, -52, 140, -52, -52, -52, -52, 98, 95, -52,
721 117, -75, -75, -75, -75, -75, -75, -75, -75, 150, 726 -52, 99, 114, 115, 116, 117, 96, 148, 149, 150,
722 153, -75, -75, 98, 13, 14, 15, 16, 17, 18, 727 158, 106, 155, 159, 97, 163, 118, -76, -76, -76,
723 19, 20, 105, 155, 21, 22, 154, 130, 14, 15, 728 -76, -76, -76, -76, -76, 160, 164, -76, -76, 99,
724 158, 17, 18, 19, 20, 90, 160, 21, 22, 179, 729 13, 14, 15, 16, 17, 18, 19, 20, 91, 106,
725 31, 163, 164, 165, 173, 89, 90, 162, 128, 170, 730 21, 22, 14, 15, 140, 17, 18, 19, 20, 168,
726 136, 172, 52, 31, 169, 171, 175, 176, 177, 178, 731 175, 21, 22, 177, 181, 182, 183, 32, 187, 167,
727 181, 182, 183, 50, 120, 74, 80, 157 732 188, 169, 170, 171, 185, 189, 53, 51, 32, 176,
733 75, 178, 121, 0, 133, 162, 0, 0, 0, 0,
734 184
728}; 735};
729 736
730static const yytype_uint8 yycheck[] = 737static const yytype_int16 yycheck[] =
731{ 738{
732 1, 66, 67, 10, 92, 93, 3, 25, 26, 14, 739 1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
733 3, 29, 13, 27, 15, 103, 34, 18, 75, 33, 740 28, 81, 13, 81, 15, 104, 34, 18, 3, 32,
734 0, 78, 30, 80, 89, 90, 31, 32, 28, 25, 741 33, 23, 26, 27, 90, 91, 30, 32, 33, 31,
735 26, 31, 32, 30, 0, 1, 101, 30, 4, 5, 742 78, 35, 80, 0, 1, 31, 102, 4, 5, 6,
736 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, 743 7, 8, 9, 10, 11, 12, 31, 14, 15, 16,
737 16, 17, 18, 19, 20, 21, 22, 23, 30, 25, 744 17, 18, 19, 20, 21, 22, 23, 24, 78, 26,
738 25, 68, 25, 151, 30, 30, 30, 0, 1, 25, 745 80, 26, 69, 133, 31, 133, 31, 156, 26, 27,
739 26, 4, 5, 6, 7, 8, 9, 10, 11, 12, 746 29, 0, 1, 32, 33, 4, 5, 6, 7, 8,
740 145, 14, 15, 16, 17, 18, 19, 20, 21, 22, 747 9, 10, 11, 12, 150, 14, 15, 16, 17, 18,
741 23, 75, 25, 25, 78, 160, 80, 30, 99, 30, 748 19, 20, 21, 22, 23, 24, 0, 26, 164, 100,
742 0, 1, 31, 32, 4, 5, 6, 7, 8, 9, 749 77, 78, 31, 80, 77, 78, 31, 80, 31, 32,
743 10, 11, 25, 114, 14, 15, 16, 17, 18, 19, 750 33, 0, 1, 31, 115, 4, 5, 6, 7, 8,
744 20, 21, 22, 76, 77, 25, 79, 0, 1, 1, 751 9, 10, 11, 26, 27, 14, 15, 16, 17, 18,
745 30, 4, 5, 6, 7, 8, 9, 10, 11, 1, 752 19, 20, 21, 22, 23, 31, 26, 26, 31, 0,
746 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, 753 1, 26, 31, 4, 5, 6, 7, 8, 9, 10,
747 76, 77, 25, 79, 0, 1, 30, 30, 4, 5, 754 11, 26, 31, 14, 15, 16, 17, 18, 19, 20,
748 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, 755 21, 22, 23, 1, 1, 26, 31, 32, 33, 31,
749 16, 17, 18, 19, 20, 21, 22, 30, 179, 25, 756 31, 0, 1, 31, 31, 4, 5, 6, 7, 8,
750 30, 1, 30, 30, 30, 5, 6, 30, 8, 9, 757 9, 10, 11, 31, 185, 14, 15, 16, 17, 18,
751 10, 11, 12, 30, 14, 15, 16, 17, 18, 19, 758 19, 20, 21, 22, 23, 31, 1, 26, 31, 31,
752 20, 30, 31, 32, 30, 25, 24, 77, 1, 79, 759 5, 6, 31, 8, 9, 10, 11, 12, 31, 14,
753 30, 4, 5, 6, 7, 8, 9, 10, 11, 25, 760 15, 16, 17, 18, 19, 20, 31, 31, 31, 25,
754 1, 14, 15, 16, 4, 5, 6, 7, 8, 9, 761 1, 26, 26, 13, 1, 26, 31, 4, 5, 6,
755 10, 11, 25, 30, 14, 15, 13, 30, 5, 6, 762 7, 8, 9, 10, 11, 31, 14, 14, 15, 16,
756 25, 8, 9, 10, 11, 32, 14, 14, 15, 33, 763 4, 5, 6, 7, 8, 9, 10, 11, 33, 26,
757 30, 148, 149, 150, 30, 31, 32, 30, 77, 156, 764 14, 15, 5, 6, 31, 8, 9, 10, 11, 31,
758 79, 158, 7, 30, 30, 30, 30, 30, 30, 166, 765 31, 14, 15, 31, 31, 31, 31, 31, 31, 151,
759 30, 30, 30, 6, 75, 36, 47, 115 766 31, 153, 154, 155, 34, 31, 7, 6, 31, 161,
767 37, 163, 76, -1, 79, 116, -1, -1, -1, -1,
768 172
760}; 769};
761 770
762/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 771/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
763 symbol of state STATE-NUM. */ 772 symbol of state STATE-NUM. */
764static const yytype_uint8 yystos[] = 773static const yytype_uint8 yystos[] =
765{ 774{
766 0, 3, 30, 36, 37, 38, 62, 78, 25, 26, 775 0, 3, 31, 37, 38, 39, 63, 81, 26, 27,
767 76, 0, 1, 4, 5, 6, 7, 8, 9, 10, 776 79, 0, 1, 4, 5, 6, 7, 8, 9, 10,
768 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 777 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
769 25, 30, 39, 40, 42, 43, 44, 45, 51, 52, 778 23, 26, 31, 40, 41, 43, 44, 45, 46, 52,
770 54, 58, 60, 63, 64, 66, 68, 69, 70, 77, 779 53, 55, 59, 61, 64, 65, 67, 69, 70, 71,
771 38, 30, 37, 78, 30, 76, 30, 76, 25, 82, 780 80, 39, 31, 38, 81, 31, 79, 31, 79, 26,
772 30, 76, 25, 25, 25, 26, 29, 34, 80, 81, 781 85, 31, 79, 26, 26, 26, 27, 30, 35, 83,
773 30, 1, 1, 46, 46, 55, 57, 61, 73, 67, 782 84, 31, 1, 1, 47, 47, 56, 58, 62, 76,
774 73, 30, 30, 30, 30, 30, 30, 80, 80, 31, 783 68, 74, 31, 31, 31, 31, 31, 31, 83, 83,
775 32, 78, 27, 33, 30, 30, 1, 12, 16, 18, 784 32, 33, 81, 28, 34, 31, 31, 1, 12, 16,
776 19, 20, 21, 22, 23, 25, 30, 41, 47, 48, 785 18, 19, 20, 21, 22, 24, 26, 31, 42, 48,
777 71, 72, 74, 17, 18, 19, 20, 30, 41, 56, 786 49, 72, 73, 75, 17, 18, 19, 20, 31, 42,
778 72, 74, 40, 53, 77, 40, 54, 59, 66, 77, 787 57, 73, 75, 41, 54, 80, 41, 55, 60, 67,
779 30, 41, 74, 40, 54, 65, 66, 77, 28, 80, 788 80, 23, 31, 74, 77, 41, 55, 66, 67, 80,
780 80, 81, 81, 30, 30, 24, 76, 75, 76, 80, 789 31, 42, 75, 29, 83, 83, 84, 84, 31, 31,
781 25, 81, 49, 1, 13, 30, 76, 75, 25, 80, 790 25, 79, 78, 79, 83, 26, 84, 50, 1, 13,
782 14, 79, 30, 79, 79, 79, 81, 25, 30, 30, 791 31, 79, 78, 26, 14, 82, 83, 82, 31, 82,
783 79, 30, 79, 30, 80, 30, 30, 30, 79, 33, 792 82, 82, 84, 26, 31, 31, 82, 31, 82, 83,
784 50, 30, 30, 30, 76 793 31, 31, 31, 31, 82, 34, 51, 31, 31, 31,
794 79
785}; 795};
786 796
787#define yyerrok (yyerrstatus = 0) 797#define yyerrok (yyerrstatus = 0)
@@ -1292,7 +1302,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1292 1302
1293 switch (yytype) 1303 switch (yytype)
1294 { 1304 {
1295 case 52: /* "choice_entry" */ 1305 case 53: /* "choice_entry" */
1296 1306
1297 { 1307 {
1298 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1308 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1302,7 +1312,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1302}; 1312};
1303 1313
1304 break; 1314 break;
1305 case 58: /* "if_entry" */ 1315 case 59: /* "if_entry" */
1306 1316
1307 { 1317 {
1308 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1318 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1312,7 +1322,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1312}; 1322};
1313 1323
1314 break; 1324 break;
1315 case 64: /* "menu_entry" */ 1325 case 65: /* "menu_entry" */
1316 1326
1317 { 1327 {
1318 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1328 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1644,17 +1654,17 @@ yyreduce:
1644 { zconf_error("invalid statement"); ;} 1654 { zconf_error("invalid statement"); ;}
1645 break; 1655 break;
1646 1656
1647 case 27: 1657 case 28:
1648 1658
1649 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} 1659 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
1650 break; 1660 break;
1651 1661
1652 case 28: 1662 case 29:
1653 1663
1654 { zconf_error("invalid option"); ;} 1664 { zconf_error("invalid option"); ;}
1655 break; 1665 break;
1656 1666
1657 case 29: 1667 case 30:
1658 1668
1659 { 1669 {
1660 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1670 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1664,7 +1674,7 @@ yyreduce:
1664;} 1674;}
1665 break; 1675 break;
1666 1676
1667 case 30: 1677 case 31:
1668 1678
1669 { 1679 {
1670 menu_end_entry(); 1680 menu_end_entry();
@@ -1672,7 +1682,7 @@ yyreduce:
1672;} 1682;}
1673 break; 1683 break;
1674 1684
1675 case 31: 1685 case 32:
1676 1686
1677 { 1687 {
1678 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1688 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1682,7 +1692,7 @@ yyreduce:
1682;} 1692;}
1683 break; 1693 break;
1684 1694
1685 case 32: 1695 case 33:
1686 1696
1687 { 1697 {
1688 if (current_entry->prompt) 1698 if (current_entry->prompt)
@@ -1694,7 +1704,7 @@ yyreduce:
1694;} 1704;}
1695 break; 1705 break;
1696 1706
1697 case 40: 1707 case 41:
1698 1708
1699 { 1709 {
1700 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1710 menu_set_type((yyvsp[(1) - (3)].id)->stype);
@@ -1704,7 +1714,7 @@ yyreduce:
1704;} 1714;}
1705 break; 1715 break;
1706 1716
1707 case 41: 1717 case 42:
1708 1718
1709 { 1719 {
1710 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1720 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1712,7 +1722,7 @@ yyreduce:
1712;} 1722;}
1713 break; 1723 break;
1714 1724
1715 case 42: 1725 case 43:
1716 1726
1717 { 1727 {
1718 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); 1728 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
@@ -1724,7 +1734,7 @@ yyreduce:
1724;} 1734;}
1725 break; 1735 break;
1726 1736
1727 case 43: 1737 case 44:
1728 1738
1729 { 1739 {
1730 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1740 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
@@ -1732,7 +1742,7 @@ yyreduce:
1732;} 1742;}
1733 break; 1743 break;
1734 1744
1735 case 44: 1745 case 45:
1736 1746
1737 { 1747 {
1738 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1748 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
@@ -1740,7 +1750,7 @@ yyreduce:
1740;} 1750;}
1741 break; 1751 break;
1742 1752
1743 case 47: 1753 case 48:
1744 1754
1745 { 1755 {
1746 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); 1756 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
@@ -1752,17 +1762,17 @@ yyreduce:
1752;} 1762;}
1753 break; 1763 break;
1754 1764
1755 case 48: 1765 case 49:
1756 1766
1757 { (yyval.string) = NULL; ;} 1767 { (yyval.string) = NULL; ;}
1758 break; 1768 break;
1759 1769
1760 case 49: 1770 case 50:
1761 1771
1762 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 1772 { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
1763 break; 1773 break;
1764 1774
1765 case 50: 1775 case 51:
1766 1776
1767 { 1777 {
1768 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); 1778 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
@@ -1773,14 +1783,14 @@ yyreduce:
1773;} 1783;}
1774 break; 1784 break;
1775 1785
1776 case 51: 1786 case 52:
1777 1787
1778 { 1788 {
1779 (yyval.menu) = menu_add_menu(); 1789 (yyval.menu) = menu_add_menu();
1780;} 1790;}
1781 break; 1791 break;
1782 1792
1783 case 52: 1793 case 53:
1784 1794
1785 { 1795 {
1786 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { 1796 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
@@ -1790,7 +1800,7 @@ yyreduce:
1790;} 1800;}
1791 break; 1801 break;
1792 1802
1793 case 60: 1803 case 61:
1794 1804
1795 { 1805 {
1796 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1806 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1798,7 +1808,7 @@ yyreduce:
1798;} 1808;}
1799 break; 1809 break;
1800 1810
1801 case 61: 1811 case 62:
1802 1812
1803 { 1813 {
1804 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { 1814 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
@@ -1811,7 +1821,7 @@ yyreduce:
1811;} 1821;}
1812 break; 1822 break;
1813 1823
1814 case 62: 1824 case 63:
1815 1825
1816 { 1826 {
1817 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1827 current_entry->sym->flags |= SYMBOL_OPTIONAL;
@@ -1819,7 +1829,7 @@ yyreduce:
1819;} 1829;}
1820 break; 1830 break;
1821 1831
1822 case 63: 1832 case 64:
1823 1833
1824 { 1834 {
1825 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { 1835 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
@@ -1831,7 +1841,7 @@ yyreduce:
1831;} 1841;}
1832 break; 1842 break;
1833 1843
1834 case 66: 1844 case 67:
1835 1845
1836 { 1846 {
1837 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1847 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
@@ -1841,7 +1851,7 @@ yyreduce:
1841;} 1851;}
1842 break; 1852 break;
1843 1853
1844 case 67: 1854 case 68:
1845 1855
1846 { 1856 {
1847 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { 1857 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
@@ -1851,14 +1861,14 @@ yyreduce:
1851;} 1861;}
1852 break; 1862 break;
1853 1863
1854 case 73: 1864 case 74:
1855 1865
1856 { 1866 {
1857 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); 1867 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1858;} 1868;}
1859 break; 1869 break;
1860 1870
1861 case 74: 1871 case 75:
1862 1872
1863 { 1873 {
1864 menu_add_entry(NULL); 1874 menu_add_entry(NULL);
@@ -1867,14 +1877,14 @@ yyreduce:
1867;} 1877;}
1868 break; 1878 break;
1869 1879
1870 case 75: 1880 case 76:
1871 1881
1872 { 1882 {
1873 (yyval.menu) = menu_add_menu(); 1883 (yyval.menu) = menu_add_menu();
1874;} 1884;}
1875 break; 1885 break;
1876 1886
1877 case 76: 1887 case 77:
1878 1888
1879 { 1889 {
1880 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { 1890 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
@@ -1884,7 +1894,7 @@ yyreduce:
1884;} 1894;}
1885 break; 1895 break;
1886 1896
1887 case 82: 1897 case 83:
1888 1898
1889 { 1899 {
1890 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1900 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
@@ -1892,7 +1902,7 @@ yyreduce:
1892;} 1902;}
1893 break; 1903 break;
1894 1904
1895 case 83: 1905 case 84:
1896 1906
1897 { 1907 {
1898 menu_add_entry(NULL); 1908 menu_add_entry(NULL);
@@ -1901,14 +1911,14 @@ yyreduce:
1901;} 1911;}
1902 break; 1912 break;
1903 1913
1904 case 84: 1914 case 85:
1905 1915
1906 { 1916 {
1907 menu_end_entry(); 1917 menu_end_entry();
1908;} 1918;}
1909 break; 1919 break;
1910 1920
1911 case 85: 1921 case 86:
1912 1922
1913 { 1923 {
1914 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1924 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
@@ -1916,14 +1926,14 @@ yyreduce:
1916;} 1926;}
1917 break; 1927 break;
1918 1928
1919 case 86: 1929 case 87:
1920 1930
1921 { 1931 {
1922 current_entry->help = (yyvsp[(2) - (2)].string); 1932 current_entry->help = (yyvsp[(2) - (2)].string);
1923;} 1933;}
1924 break; 1934 break;
1925 1935
1926 case 91: 1936 case 92:
1927 1937
1928 { 1938 {
1929 menu_add_dep((yyvsp[(3) - (4)].expr)); 1939 menu_add_dep((yyvsp[(3) - (4)].expr));
@@ -1931,84 +1941,91 @@ yyreduce:
1931;} 1941;}
1932 break; 1942 break;
1933 1943
1934 case 93: 1944 case 96:
1945
1946 {
1947 menu_add_visibility((yyvsp[(2) - (2)].expr));
1948;}
1949 break;
1950
1951 case 98:
1935 1952
1936 { 1953 {
1937 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1954 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1938;} 1955;}
1939 break; 1956 break;
1940 1957
1941 case 96: 1958 case 101:
1942 1959
1943 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1960 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1944 break; 1961 break;
1945 1962
1946 case 97: 1963 case 102:
1947 1964
1948 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1965 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1949 break; 1966 break;
1950 1967
1951 case 98: 1968 case 103:
1952 1969
1953 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1970 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1954 break; 1971 break;
1955 1972
1956 case 101: 1973 case 106:
1957 1974
1958 { (yyval.expr) = NULL; ;} 1975 { (yyval.expr) = NULL; ;}
1959 break; 1976 break;
1960 1977
1961 case 102: 1978 case 107:
1962 1979
1963 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} 1980 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
1964 break; 1981 break;
1965 1982
1966 case 103: 1983 case 108:
1967 1984
1968 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} 1985 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
1969 break; 1986 break;
1970 1987
1971 case 104: 1988 case 109:
1972 1989
1973 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1990 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1974 break; 1991 break;
1975 1992
1976 case 105: 1993 case 110:
1977 1994
1978 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1995 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1979 break; 1996 break;
1980 1997
1981 case 106: 1998 case 111:
1982 1999
1983 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} 2000 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
1984 break; 2001 break;
1985 2002
1986 case 107: 2003 case 112:
1987 2004
1988 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} 2005 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
1989 break; 2006 break;
1990 2007
1991 case 108: 2008 case 113:
1992 2009
1993 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 2010 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1994 break; 2011 break;
1995 2012
1996 case 109: 2013 case 114:
1997 2014
1998 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 2015 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1999 break; 2016 break;
2000 2017
2001 case 110: 2018 case 115:
2002 2019
2003 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} 2020 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
2004 break; 2021 break;
2005 2022
2006 case 111: 2023 case 116:
2007 2024
2008 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} 2025 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
2009 break; 2026 break;
2010 2027
2011 case 112: 2028 case 117:
2012 2029
2013 { (yyval.string) = NULL; ;} 2030 { (yyval.string) = NULL; ;}
2014 break; 2031 break;
@@ -2278,6 +2295,7 @@ static const char *zconf_tokenname(int token)
2278 case T_IF: return "if"; 2295 case T_IF: return "if";
2279 case T_ENDIF: return "endif"; 2296 case T_ENDIF: return "endif";
2280 case T_DEPENDS: return "depends"; 2297 case T_DEPENDS: return "depends";
2298 case T_VISIBLE: return "visible";
2281 } 2299 }
2282 return "<token>"; 2300 return "<token>";
2283} 2301}
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 2abd3c7ff15d..49fb4ab664c3 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
36#define YYERROR_VERBOSE 36#define YYERROR_VERBOSE
37#endif 37#endif
38%} 38%}
39%expect 28 39%expect 30
40 40
41%union 41%union
42{ 42{
@@ -68,6 +68,7 @@ static struct menu *current_menu, *current_entry;
68%token <id>T_DEFAULT 68%token <id>T_DEFAULT
69%token <id>T_SELECT 69%token <id>T_SELECT
70%token <id>T_RANGE 70%token <id>T_RANGE
71%token <id>T_VISIBLE
71%token <id>T_OPTION 72%token <id>T_OPTION
72%token <id>T_ON 73%token <id>T_ON
73%token <string> T_WORD 74%token <string> T_WORD
@@ -123,7 +124,7 @@ stmt_list:
123; 124;
124 125
125option_name: 126option_name:
126 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT 127 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
127; 128;
128 129
129common_stmt: 130common_stmt:
@@ -359,7 +360,7 @@ menu: T_MENU prompt T_EOL
359 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); 360 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
360}; 361};
361 362
362menu_entry: menu depends_list 363menu_entry: menu visibility_list depends_list
363{ 364{
364 $$ = menu_add_menu(); 365 $$ = menu_add_menu();
365}; 366};
@@ -430,6 +431,19 @@ depends: T_DEPENDS T_ON expr T_EOL
430 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); 431 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
431}; 432};
432 433
434/* visibility option */
435
436visibility_list:
437 /* empty */
438 | visibility_list visible
439 | visibility_list T_EOL
440;
441
442visible: T_VISIBLE if_expr
443{
444 menu_add_visibility($2);
445};
446
433/* prompt statement */ 447/* prompt statement */
434 448
435prompt_stmt_opt: 449prompt_stmt_opt:
@@ -526,6 +540,7 @@ static const char *zconf_tokenname(int token)
526 case T_IF: return "if"; 540 case T_IF: return "if";
527 case T_ENDIF: return "endif"; 541 case T_ENDIF: return "endif";
528 case T_DEPENDS: return "depends"; 542 case T_DEPENDS: return "depends";
543 case T_VISIBLE: return "visible";
529 } 544 }
530 return "<token>"; 545 return "<token>";
531} 546}
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 5c8c7dff8ede..b753ec661fcf 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
1510static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) 1510static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
1511{ 1511{
1512 struct snd_pcm_substream *substream; 1512 struct snd_pcm_substream *substream;
1513 struct snd_pcm_runtime *runtime;
1514 int i;
1513 1515
1514 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 1516 for (i = 0; i < 2; i++) {
1515 if (substream != NULL) { 1517 substream = pcm_oss_file->streams[i];
1516 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); 1518 if (!substream)
1517 substream->runtime->oss.prepare = 1; 1519 continue;
1518 } 1520 runtime = substream->runtime;
1519 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
1520 if (substream != NULL) {
1521 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); 1521 snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
1522 substream->runtime->oss.prepare = 1; 1522 runtime->oss.prepare = 1;
1523 runtime->oss.buffer_used = 0;
1524 runtime->oss.prev_hw_ptr_period = 0;
1525 runtime->oss.period_ptr = 0;
1523 } 1526 }
1524 return 0; 1527 return 0;
1525} 1528}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 886d7c72936e..8fddc9d08726 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9865,7 +9865,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
9865 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), 9865 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9866 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), 9866 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9867 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), 9867 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9868 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9869 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), 9868 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9870 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), 9869 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9871 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), 9870 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 5c710807dfe5..efa4225f5fd6 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1627,6 +1627,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1627static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { 1627static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1628 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, 1628 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1629 "Alienware M17x", STAC_ALIENWARE_M17X), 1629 "Alienware M17x", STAC_ALIENWARE_M17X),
1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1631 "Alienware M17x", STAC_ALIENWARE_M17X),
1630 {} /* terminator */ 1632 {} /* terminator */
1631}; 1633};
1632 1634
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 631385802eb4..e725c09a3e79 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -526,7 +526,7 @@ static int wm8731_probe(struct snd_soc_codec *codec)
526 snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0); 526 snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0);
527 527
528 /* Disable bypass path by default */ 528 /* Disable bypass path by default */
529 snd_soc_update_bits(codec, WM8731_APANA, 0x4, 0); 529 snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0);
530 530
531 snd_soc_add_controls(codec, wm8731_snd_controls, 531 snd_soc_add_controls(codec, wm8731_snd_controls,
532 ARRAY_SIZE(wm8731_snd_controls)); 532 ARRAY_SIZE(wm8731_snd_controls));
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 0d7dcf1e4863..7d7847a1e66b 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -498,6 +498,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
498 dev_err(&pdev->dev, "platform device add failed\n"); 498 dev_err(&pdev->dev, "platform device add failed\n");
499 goto error; 499 goto error;
500 } 500 }
501 dev_set_drvdata(&pdev->dev, sound_device);
501 502
502 of_node_put(codec_np); 503 of_node_put(codec_np);
503 504
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 63b9eaa1ebc2..026b756961e0 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -498,6 +498,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
498 dev_err(&pdev->dev, "platform device add failed\n"); 498 dev_err(&pdev->dev, "platform device add failed\n");
499 goto error; 499 goto error;
500 } 500 }
501 dev_set_drvdata(&pdev->dev, sound_device);
501 502
502 of_node_put(codec_np); 503 of_node_put(codec_np);
503 504
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index e00e39dd6576..dac6732da969 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -49,7 +49,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97,
49 mutex_lock(&ac97_mutex); 49 mutex_lock(&ac97_mutex);
50 50
51 val = nuc900_checkready(); 51 val = nuc900_checkready();
52 if (!!val) { 52 if (val) {
53 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 53 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
54 goto out; 54 goto out;
55 } 55 }
@@ -102,7 +102,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
102 mutex_lock(&ac97_mutex); 102 mutex_lock(&ac97_mutex);
103 103
104 tmp = nuc900_checkready(); 104 tmp = nuc900_checkready();
105 if (!!tmp) 105 if (tmp)
106 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 106 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
107 107
108 /* clear the R_WB bit and write register index */ 108 /* clear the R_WB bit and write register index */
@@ -149,7 +149,7 @@ static void nuc900_ac97_warm_reset(struct snd_ac97 *ac97)
149 udelay(100); 149 udelay(100);
150 150
151 val = nuc900_checkready(); 151 val = nuc900_checkready();
152 if (!!val) 152 if (val)
153 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); 153 dev_err(nuc900_audio->dev, "AC97 codec is not ready\n");
154 154
155 mutex_unlock(&ac97_mutex); 155 mutex_unlock(&ac97_mutex);
@@ -263,8 +263,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream,
263 return ret; 263 return ret;
264} 264}
265 265
266static int nuc900_ac97_probe(struct platform_device *pdev, 266static int nuc900_ac97_probe(struct snd_soc_dai *dai)
267 struct snd_soc_dai *dai)
268{ 267{
269 struct nuc900_audio *nuc900_audio = nuc900_ac97_data; 268 struct nuc900_audio *nuc900_audio = nuc900_ac97_data;
270 unsigned long val; 269 unsigned long val;
@@ -284,12 +283,12 @@ static int nuc900_ac97_probe(struct platform_device *pdev,
284 return 0; 283 return 0;
285} 284}
286 285
287static void nuc900_ac97_remove(struct platform_device *pdev, 286static int nuc900_ac97_remove(struct snd_soc_dai *dai)
288 struct snd_soc_dai *dai)
289{ 287{
290 struct nuc900_audio *nuc900_audio = nuc900_ac97_data; 288 struct nuc900_audio *nuc900_audio = nuc900_ac97_data;
291 289
292 clk_disable(nuc900_audio->clk); 290 clk_disable(nuc900_audio->clk);
291 return 0;
293} 292}
294 293
295static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { 294static struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
@@ -313,7 +312,7 @@ static struct snd_soc_dai_driver nuc900_ac97_dai = {
313 .channels_max = 2, 312 .channels_max = 2,
314 }, 313 },
315 .ops = &nuc900_ac97_dai_ops, 314 .ops = &nuc900_ac97_dai_ops,
316} 315};
317 316
318static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) 317static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev)
319{ 318{
diff --git a/sound/soc/nuc900/nuc900-audio.h b/sound/soc/nuc900/nuc900-audio.h
index aeed8ead2b2b..59f7e8ed1a68 100644
--- a/sound/soc/nuc900/nuc900-audio.h
+++ b/sound/soc/nuc900/nuc900-audio.h
@@ -110,4 +110,6 @@ struct nuc900_audio {
110 110
111}; 111};
112 112
113extern struct nuc900_audio *nuc900_ac97_data;
114
113#endif /*end _NUC900_AUDIO_H */ 115#endif /*end _NUC900_AUDIO_H */
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 195d1ac94771..8263f56dc665 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -50,12 +50,12 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
50 unsigned long flags; 50 unsigned long flags;
51 int ret = 0; 51 int ret = 0;
52 52
53 spin_lock_irqsave(&nuc900_audio->lock, flags);
54
55 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); 53 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
56 if (ret < 0) 54 if (ret < 0)
57 return ret; 55 return ret;
58 56
57 spin_lock_irqsave(&nuc900_audio->lock, flags);
58
59 nuc900_audio->substream = substream; 59 nuc900_audio->substream = substream;
60 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr; 60 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
61 nuc900_audio->buffersize[substream->stream] = 61 nuc900_audio->buffersize[substream->stream] =
@@ -169,6 +169,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
169 struct snd_pcm_runtime *runtime = substream->runtime; 169 struct snd_pcm_runtime *runtime = substream->runtime;
170 struct nuc900_audio *nuc900_audio = runtime->private_data; 170 struct nuc900_audio *nuc900_audio = runtime->private_data;
171 unsigned long flags, val; 171 unsigned long flags, val;
172 int ret = 0;
172 173
173 spin_lock_irqsave(&nuc900_audio->lock, flags); 174 spin_lock_irqsave(&nuc900_audio->lock, flags);
174 175
@@ -197,10 +198,10 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
197 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); 198 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val);
198 break; 199 break;
199 default: 200 default:
200 return -EINVAL; 201 ret = -EINVAL;
201 } 202 }
202 spin_unlock_irqrestore(&nuc900_audio->lock, flags); 203 spin_unlock_irqrestore(&nuc900_audio->lock, flags);
203 return 0; 204 return ret;
204} 205}
205 206
206static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd) 207static int nuc900_dma_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -332,7 +333,7 @@ static struct snd_soc_platform_driver nuc900_soc_platform = {
332 .ops = &nuc900_dma_ops, 333 .ops = &nuc900_dma_ops,
333 .pcm_new = nuc900_dma_new, 334 .pcm_new = nuc900_dma_new,
334 .pcm_free = nuc900_dma_free_dma_buffers, 335 .pcm_free = nuc900_dma_free_dma_buffers,
335} 336};
336 337
337static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev) 338static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev)
338{ 339{
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index d542ea2ff6be..a088db6d5091 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -12,8 +12,8 @@ config SND_OMAP_SOC_MCPDM
12config SND_OMAP_SOC_N810 12config SND_OMAP_SOC_N810
13 tristate "SoC Audio support for Nokia N810" 13 tristate "SoC Audio support for Nokia N810"
14 depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C 14 depends on SND_OMAP_SOC && MACH_NOKIA_N810 && I2C
15 depends on OMAP_MUX
15 select SND_OMAP_SOC_MCBSP 16 select SND_OMAP_SOC_MCBSP
16 select OMAP_MUX
17 select SND_SOC_TLV320AIC3X 17 select SND_SOC_TLV320AIC3X
18 help 18 help
19 Say Y if you want to add support for SoC audio on Nokia N810. 19 Say Y if you want to add support for SoC audio on Nokia N810.
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c
index 8778faa174a6..3052f64b2403 100644
--- a/sound/soc/s6000/s6000-i2s.c
+++ b/sound/soc/s6000/s6000-i2s.c
@@ -434,7 +434,7 @@ static struct snd_soc_dai_driver s6000_i2s_dai = {
434 .rate_max = 1562500, 434 .rate_max = 1562500,
435 }, 435 },
436 .ops = &s6000_i2s_dai_ops, 436 .ops = &s6000_i2s_dai_ops,
437} 437};
438 438
439static int __devinit s6000_i2s_probe(struct platform_device *pdev) 439static int __devinit s6000_i2s_probe(struct platform_device *pdev)
440{ 440{
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c
index 271fd222bf19..ab3ccaec72d2 100644
--- a/sound/soc/s6000/s6000-pcm.c
+++ b/sound/soc/s6000/s6000-pcm.c
@@ -473,7 +473,7 @@ static int s6000_pcm_new(struct snd_card *card,
473 } 473 }
474 474
475 res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED, 475 res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED,
476 s6000_soc_platform.name, pcm); 476 "s6000-audio", pcm);
477 if (res) { 477 if (res) {
478 printk(KERN_ERR "s6000-pcm couldn't get IRQ\n"); 478 printk(KERN_ERR "s6000-pcm couldn't get IRQ\n");
479 return res; 479 return res;
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 96c05e137538..c1244c5bc730 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -167,7 +167,7 @@ static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd)
167 167
168 snd_soc_dapm_sync(codec); 168 snd_soc_dapm_sync(codec);
169 169
170 snd_ctl_add(codec->snd_card, snd_ctl_new1(&audio_out_mux, codec)); 170 snd_ctl_add(codec->card->snd_card, snd_ctl_new1(&audio_out_mux, codec));
171 171
172 return 0; 172 return 0;
173} 173}
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e2c2de201eec..564491fa18b2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -197,7 +197,7 @@ static void sig_atexit(void)
197 if (child_pid > 0) 197 if (child_pid > 0)
198 kill(child_pid, SIGTERM); 198 kill(child_pid, SIGTERM);
199 199
200 if (signr == -1) 200 if (signr == -1 || signr == SIGUSR1)
201 return; 201 return;
202 202
203 signal(signr, SIG_DFL); 203 signal(signr, SIG_DFL);
@@ -515,6 +515,7 @@ static int __cmd_record(int argc, const char **argv)
515 atexit(sig_atexit); 515 atexit(sig_atexit);
516 signal(SIGCHLD, sig_handler); 516 signal(SIGCHLD, sig_handler);
517 signal(SIGINT, sig_handler); 517 signal(SIGINT, sig_handler);
518 signal(SIGUSR1, sig_handler);
518 519
519 if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { 520 if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) {
520 perror("failed to create pipes"); 521 perror("failed to create pipes");
@@ -606,6 +607,7 @@ static int __cmd_record(int argc, const char **argv)
606 execvp(argv[0], (char **)argv); 607 execvp(argv[0], (char **)argv);
607 608
608 perror(argv[0]); 609 perror(argv[0]);
610 kill(getppid(), SIGUSR1);
609 exit(-1); 611 exit(-1);
610 } 612 }
611 613
@@ -762,7 +764,7 @@ static int __cmd_record(int argc, const char **argv)
762 } 764 }
763 } 765 }
764 766
765 if (quiet) 767 if (quiet || signr == SIGUSR1)
766 return 0; 768 return 0;
767 769
768 fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); 770 fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d7e67b167ea3..64a85bafde63 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -946,11 +946,16 @@ perf_header__find_attr(u64 id, struct perf_header *header)
946 946
947 /* 947 /*
948 * We set id to -1 if the data file doesn't contain sample 948 * We set id to -1 if the data file doesn't contain sample
949 * ids. Check for this and avoid walking through the entire 949 * ids. This can happen when the data file contains one type
950 * list of ids which may be large. 950 * of event and in that case, the header can still store the
951 * event attribute information. Check for this and avoid
952 * walking through the entire list of ids which may be large.
951 */ 953 */
952 if (id == -1ULL) 954 if (id == -1ULL) {
955 if (header->attrs > 0)
956 return &header->attr[0]->attr;
953 return NULL; 957 return NULL;
958 }
954 959
955 for (i = 0; i < header->attrs; i++) { 960 for (i = 0; i < header->attrs; i++) {
956 struct perf_header_attr *attr = header->attr[i]; 961 struct perf_header_attr *attr = header->attr[i];
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 0500895a45af..d628c8d1cf5e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -532,7 +532,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
532 struct machine *machine = kmaps->machine; 532 struct machine *machine = kmaps->machine;
533 struct map *curr_map = map; 533 struct map *curr_map = map;
534 struct symbol *pos; 534 struct symbol *pos;
535 int count = 0; 535 int count = 0, moved = 0;
536 struct rb_root *root = &self->symbols[map->type]; 536 struct rb_root *root = &self->symbols[map->type];
537 struct rb_node *next = rb_first(root); 537 struct rb_node *next = rb_first(root);
538 int kernel_range = 0; 538 int kernel_range = 0;
@@ -590,6 +590,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
590 char dso_name[PATH_MAX]; 590 char dso_name[PATH_MAX];
591 struct dso *dso; 591 struct dso *dso;
592 592
593 if (count == 0) {
594 curr_map = map;
595 goto filter_symbol;
596 }
597
593 if (self->kernel == DSO_TYPE_GUEST_KERNEL) 598 if (self->kernel == DSO_TYPE_GUEST_KERNEL)
594 snprintf(dso_name, sizeof(dso_name), 599 snprintf(dso_name, sizeof(dso_name),
595 "[guest.kernel].%d", 600 "[guest.kernel].%d",
@@ -615,7 +620,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
615 map_groups__insert(kmaps, curr_map); 620 map_groups__insert(kmaps, curr_map);
616 ++kernel_range; 621 ++kernel_range;
617 } 622 }
618 623filter_symbol:
619 if (filter && filter(curr_map, pos)) { 624 if (filter && filter(curr_map, pos)) {
620discard_symbol: rb_erase(&pos->rb_node, root); 625discard_symbol: rb_erase(&pos->rb_node, root);
621 symbol__delete(pos); 626 symbol__delete(pos);
@@ -623,8 +628,9 @@ discard_symbol: rb_erase(&pos->rb_node, root);
623 if (curr_map != map) { 628 if (curr_map != map) {
624 rb_erase(&pos->rb_node, root); 629 rb_erase(&pos->rb_node, root);
625 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); 630 symbols__insert(&curr_map->dso->symbols[curr_map->type], pos);
626 } 631 ++moved;
627 count++; 632 } else
633 ++count;
628 } 634 }
629 } 635 }
630 636
@@ -634,7 +640,7 @@ discard_symbol: rb_erase(&pos->rb_node, root);
634 dso__set_loaded(curr_map->dso, curr_map->type); 640 dso__set_loaded(curr_map->dso, curr_map->type);
635 } 641 }
636 642
637 return count; 643 return count + moved;
638} 644}
639 645
640int dso__load_kallsyms(struct dso *self, const char *filename, 646int dso__load_kallsyms(struct dso *self, const char *filename,
@@ -2125,14 +2131,55 @@ static struct dso *machine__create_kernel(struct machine *self)
2125 return kernel; 2131 return kernel;
2126} 2132}
2127 2133
2134struct process_args {
2135 u64 start;
2136};
2137
2138static int symbol__in_kernel(void *arg, const char *name,
2139 char type __used, u64 start)
2140{
2141 struct process_args *args = arg;
2142
2143 if (strchr(name, '['))
2144 return 0;
2145
2146 args->start = start;
2147 return 1;
2148}
2149
2150/* Figure out the start address of kernel map from /proc/kallsyms */
2151static u64 machine__get_kernel_start_addr(struct machine *machine)
2152{
2153 const char *filename;
2154 char path[PATH_MAX];
2155 struct process_args args;
2156
2157 if (machine__is_host(machine)) {
2158 filename = "/proc/kallsyms";
2159 } else {
2160 if (machine__is_default_guest(machine))
2161 filename = (char *)symbol_conf.default_guest_kallsyms;
2162 else {
2163 sprintf(path, "%s/proc/kallsyms", machine->root_dir);
2164 filename = path;
2165 }
2166 }
2167
2168 if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0)
2169 return 0;
2170
2171 return args.start;
2172}
2173
2128int __machine__create_kernel_maps(struct machine *self, struct dso *kernel) 2174int __machine__create_kernel_maps(struct machine *self, struct dso *kernel)
2129{ 2175{
2130 enum map_type type; 2176 enum map_type type;
2177 u64 start = machine__get_kernel_start_addr(self);
2131 2178
2132 for (type = 0; type < MAP__NR_TYPES; ++type) { 2179 for (type = 0; type < MAP__NR_TYPES; ++type) {
2133 struct kmap *kmap; 2180 struct kmap *kmap;
2134 2181
2135 self->vmlinux_maps[type] = map__new2(0, kernel, type); 2182 self->vmlinux_maps[type] = map__new2(start, kernel, type);
2136 if (self->vmlinux_maps[type] == NULL) 2183 if (self->vmlinux_maps[type] == NULL)
2137 return -1; 2184 return -1;
2138 2185
diff --git a/usr/initramfs_data.S b/usr/initramfs_data.S
index 792a750d9441..c14322d1c0cf 100644
--- a/usr/initramfs_data.S
+++ b/usr/initramfs_data.S
@@ -22,14 +22,15 @@
22*/ 22*/
23 23
24#include <linux/stringify.h> 24#include <linux/stringify.h>
25#include <asm-generic/vmlinux.lds.h>
25 26
26.section .init.ramfs,"a" 27.section .init.ramfs,"a"
27__irf_start: 28__irf_start:
28.incbin __stringify(INITRAMFS_IMAGE) 29.incbin __stringify(INITRAMFS_IMAGE)
29__irf_end: 30__irf_end:
30.section .init.ramfs.info,"a" 31.section .init.ramfs.info,"a"
31.globl __initramfs_size 32.globl VMLINUX_SYMBOL(__initramfs_size)
32__initramfs_size: 33VMLINUX_SYMBOL(__initramfs_size):
33#ifdef CONFIG_64BIT 34#ifdef CONFIG_64BIT
34 .quad __irf_end - __irf_start 35 .quad __irf_end - __irf_start
35#else 36#else