aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/mach-omap2/clockdomain.h4
-rw-r--r--arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c32
-rw-r--r--arch/arm/mach-shmobile/platsmp.c5
-rw-r--r--arch/arm/mach-ux500/board-mop500.c12
-rw-r--r--arch/arm/mach-ux500/timer.c2
-rw-r--r--arch/mips/pci/pci-lantiq.c4
-rw-r--r--arch/mn10300/include/asm/thread_info.h2
-rw-r--r--arch/powerpc/include/asm/hw_irq.h6
-rw-r--r--arch/powerpc/kernel/irq.c48
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c11
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c17
-rw-r--r--arch/tile/kernel/backtrace.c9
-rw-r--r--drivers/acpi/acpica/hwsleep.c22
-rw-r--r--drivers/gpio/Kconfig2
-rw-r--r--drivers/gpio/devres.c1
-rw-r--r--drivers/gpio/gpio-mxc.c10
-rw-r--r--drivers/gpio/gpio-omap.c14
-rw-r--r--drivers/gpio/gpio-sta2x11.c5
-rw-r--r--drivers/gpio/gpio-tps65910.c3
-rw-r--r--drivers/gpio/gpio-wm8994.c5
-rw-r--r--drivers/hwspinlock/hwspinlock_core.c4
-rw-r--r--drivers/iommu/amd_iommu.c11
-rw-r--r--drivers/iommu/amd_iommu_init.c6
-rw-r--r--drivers/iommu/amd_iommu_types.h2
-rw-r--r--drivers/iommu/tegra-smmu.c4
-rw-r--r--drivers/media/video/gspca/sn9c20x.c13
-rw-r--r--drivers/media/video/mx2_camera.c27
-rw-r--r--drivers/misc/mei/main.c2
-rw-r--r--drivers/of/base.c30
-rw-r--r--drivers/of/platform.c7
-rw-r--r--drivers/pci/pci-driver.c12
-rw-r--r--drivers/pci/pci.c5
-rw-r--r--drivers/pci/quirks.c26
-rw-r--r--drivers/regulator/core.c10
-rw-r--r--drivers/remoteproc/Kconfig2
-rw-r--r--drivers/rpmsg/virtio_rpmsg_bus.c55
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i.h1
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c3
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c10
-rw-r--r--drivers/scsi/libsas/sas_ata.c12
-rw-r--r--drivers/tty/hvc/hvc_opal.c2
-rw-r--r--drivers/usb/class/cdc-wdm.c2
-rw-r--r--drivers/usb/core/hub.c18
-rw-r--r--drivers/usb/host/xhci-hub.c44
-rw-r--r--drivers/usb/host/xhci-ring.c11
-rw-r--r--drivers/usb/host/xhci.h6
-rw-r--r--drivers/usb/serial/metro-usb.c8
-rw-r--r--drivers/usb/serial/option.c26
-rw-r--r--drivers/virtio/virtio_balloon.c24
-rw-r--r--include/linux/gpio.h4
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/rpmsg.h6
-rw-r--r--include/scsi/libsas.h6
-rw-r--r--include/scsi/scsi_cmnd.h8
-rw-r--r--kernel/cgroup.c23
-rw-r--r--kernel/printk.c202
-rw-r--r--lib/dma-debug.c4
62 files changed, 550 insertions, 310 deletions
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 9854ff4279e0..11828e632532 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -176,7 +176,6 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
176CONFIG_USB_DEVICEFS=y 176CONFIG_USB_DEVICEFS=y
177CONFIG_USB_SUSPEND=y 177CONFIG_USB_SUSPEND=y
178CONFIG_USB_MON=y 178CONFIG_USB_MON=y
179CONFIG_USB_EHCI_HCD=y
180CONFIG_USB_WDM=y 179CONFIG_USB_WDM=y
181CONFIG_USB_STORAGE=y 180CONFIG_USB_STORAGE=y
182CONFIG_USB_LIBUSUAL=y 181CONFIG_USB_LIBUSUAL=y
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index f7b58609bad8..6227e9505c2d 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -31,12 +31,16 @@
31 * 31 *
32 * CLKDM_NO_AUTODEPS: Prevent "autodeps" from being added/removed from this 32 * CLKDM_NO_AUTODEPS: Prevent "autodeps" from being added/removed from this
33 * clockdomain. (Currently, this applies to OMAP3 clockdomains only.) 33 * clockdomain. (Currently, this applies to OMAP3 clockdomains only.)
34 * CLKDM_ACTIVE_WITH_MPU: The PRCM guarantees that this clockdomain is
35 * active whenever the MPU is active. True for interconnects and
36 * the WKUP clockdomains.
34 */ 37 */
35#define CLKDM_CAN_FORCE_SLEEP (1 << 0) 38#define CLKDM_CAN_FORCE_SLEEP (1 << 0)
36#define CLKDM_CAN_FORCE_WAKEUP (1 << 1) 39#define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
37#define CLKDM_CAN_ENABLE_AUTO (1 << 2) 40#define CLKDM_CAN_ENABLE_AUTO (1 << 2)
38#define CLKDM_CAN_DISABLE_AUTO (1 << 3) 41#define CLKDM_CAN_DISABLE_AUTO (1 << 3)
39#define CLKDM_NO_AUTODEPS (1 << 4) 42#define CLKDM_NO_AUTODEPS (1 << 4)
43#define CLKDM_ACTIVE_WITH_MPU (1 << 5)
40 44
41#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO) 45#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
42#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP) 46#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index 839145e1cfbe..4972219653ce 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -88,4 +88,5 @@ struct clockdomain wkup_common_clkdm = {
88 .name = "wkup_clkdm", 88 .name = "wkup_clkdm",
89 .pwrdm = { .name = "wkup_pwrdm" }, 89 .pwrdm = { .name = "wkup_pwrdm" },
90 .dep_bit = OMAP_EN_WKUP_SHIFT, 90 .dep_bit = OMAP_EN_WKUP_SHIFT,
91 .flags = CLKDM_ACTIVE_WITH_MPU,
91}; 92};
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index c53425847493..7f2133abe7d3 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -381,7 +381,7 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
381 .cm_inst = OMAP4430_PRM_WKUP_CM_INST, 381 .cm_inst = OMAP4430_PRM_WKUP_CM_INST,
382 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS, 382 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
383 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT, 383 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT,
384 .flags = CLKDM_CAN_HWSUP, 384 .flags = CLKDM_CAN_HWSUP | CLKDM_ACTIVE_WITH_MPU,
385}; 385};
386 386
387static struct clockdomain emu_sys_44xx_clkdm = { 387static struct clockdomain emu_sys_44xx_clkdm = {
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 773193670ea2..2d710f50fca2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1124,15 +1124,18 @@ static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap
1124 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG 1124 * _enable_sysc - try to bring a module out of idle via OCP_SYSCONFIG
1125 * @oh: struct omap_hwmod * 1125 * @oh: struct omap_hwmod *
1126 * 1126 *
1127 * If module is marked as SWSUP_SIDLE, force the module out of slave 1127 * Ensure that the OCP_SYSCONFIG register for the IP block represented
1128 * idle; otherwise, configure it for smart-idle. If module is marked 1128 * by @oh is set to indicate to the PRCM that the IP block is active.
1129 * as SWSUP_MSUSPEND, force the module out of master standby; 1129 * Usually this means placing the module into smart-idle mode and
1130 * otherwise, configure it for smart-standby. No return value. 1130 * smart-standby, but if there is a bug in the automatic idle handling
1131 * for the IP block, it may need to be placed into the force-idle or
1132 * no-idle variants of these modes. No return value.
1131 */ 1133 */
1132static void _enable_sysc(struct omap_hwmod *oh) 1134static void _enable_sysc(struct omap_hwmod *oh)
1133{ 1135{
1134 u8 idlemode, sf; 1136 u8 idlemode, sf;
1135 u32 v; 1137 u32 v;
1138 bool clkdm_act;
1136 1139
1137 if (!oh->class->sysc) 1140 if (!oh->class->sysc)
1138 return; 1141 return;
@@ -1141,8 +1144,16 @@ static void _enable_sysc(struct omap_hwmod *oh)
1141 sf = oh->class->sysc->sysc_flags; 1144 sf = oh->class->sysc->sysc_flags;
1142 1145
1143 if (sf & SYSC_HAS_SIDLEMODE) { 1146 if (sf & SYSC_HAS_SIDLEMODE) {
1144 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ? 1147 clkdm_act = ((oh->clkdm &&
1145 HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART; 1148 oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
1149 (oh->_clk && oh->_clk->clkdm &&
1150 oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
1151 if (clkdm_act && !(oh->class->sysc->idlemodes &
1152 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1153 idlemode = HWMOD_IDLEMODE_FORCE;
1154 else
1155 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ?
1156 HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART;
1146 _set_slave_idlemode(oh, idlemode, &v); 1157 _set_slave_idlemode(oh, idlemode, &v);
1147 } 1158 }
1148 1159
@@ -1208,8 +1219,13 @@ static void _idle_sysc(struct omap_hwmod *oh)
1208 sf = oh->class->sysc->sysc_flags; 1219 sf = oh->class->sysc->sysc_flags;
1209 1220
1210 if (sf & SYSC_HAS_SIDLEMODE) { 1221 if (sf & SYSC_HAS_SIDLEMODE) {
1211 idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ? 1222 /* XXX What about HWMOD_IDLEMODE_SMART_WKUP? */
1212 HWMOD_IDLEMODE_FORCE : HWMOD_IDLEMODE_SMART; 1223 if (oh->flags & HWMOD_SWSUP_SIDLE ||
1224 !(oh->class->sysc->idlemodes &
1225 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1226 idlemode = HWMOD_IDLEMODE_FORCE;
1227 else
1228 idlemode = HWMOD_IDLEMODE_SMART;
1213 _set_slave_idlemode(oh, idlemode, &v); 1229 _set_slave_idlemode(oh, idlemode, &v);
1214 } 1230 }
1215 1231
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index e859fcdb3d58..fde0d23121dc 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -22,8 +22,13 @@
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/emev2.h> 23#include <mach/emev2.h>
24 24
25#ifdef CONFIG_ARCH_SH73A0
25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \ 26#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \
26 of_machine_is_compatible("renesas,sh73a0")) 27 of_machine_is_compatible("renesas,sh73a0"))
28#else
29#define is_sh73a0() (0)
30#endif
31
27#define is_r8a7779() machine_is_marzen() 32#define is_r8a7779() machine_is_marzen()
28 33
29#ifdef CONFIG_ARCH_EMEV2 34#ifdef CONFIG_ARCH_EMEV2
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 1509a3cb5833..4fd93f5c49ec 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -625,11 +625,6 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
625 &ab8500_device, 625 &ab8500_device,
626}; 626};
627 627
628static struct platform_device *snowball_of_platform_devs[] __initdata = {
629 &snowball_led_dev,
630 &snowball_key_dev,
631};
632
633static void __init mop500_init_machine(void) 628static void __init mop500_init_machine(void)
634{ 629{
635 struct device *parent = NULL; 630 struct device *parent = NULL;
@@ -769,6 +764,11 @@ MACHINE_END
769 764
770#ifdef CONFIG_MACH_UX500_DT 765#ifdef CONFIG_MACH_UX500_DT
771 766
767static struct platform_device *snowball_of_platform_devs[] __initdata = {
768 &snowball_led_dev,
769 &snowball_key_dev,
770};
771
772struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 772struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
773 /* Requires DMA and call-back bindings. */ 773 /* Requires DMA and call-back bindings. */
774 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), 774 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
@@ -786,6 +786,8 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
786 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL), 786 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
787 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL), 787 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
788 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL), 788 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
789 /* Requires device name bindings. */
790 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL),
789 {}, 791 {},
790}; 792};
791 793
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index 741e71feca78..66e7f00884ab 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -63,8 +63,10 @@ static void __init ux500_timer_init(void)
63 63
64 /* TODO: Once MTU has been DT:ed place code above into else. */ 64 /* TODO: Once MTU has been DT:ed place code above into else. */
65 if (of_have_populated_dt()) { 65 if (of_have_populated_dt()) {
66#ifdef CONFIG_OF
66 np = of_find_matching_node(NULL, prcmu_timer_of_match); 67 np = of_find_matching_node(NULL, prcmu_timer_of_match);
67 if (!np) 68 if (!np)
69#endif
68 goto dt_fail; 70 goto dt_fail;
69 71
70 tmp_base = of_iomap(np, 0); 72 tmp_base = of_iomap(np, 0);
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index ea453532a33c..075d87acd12a 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -129,7 +129,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev)
129 129
130 /* setup reset gpio used by pci */ 130 /* setup reset gpio used by pci */
131 reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); 131 reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
132 if (reset_gpio > 0) 132 if (gpio_is_valid(reset_gpio))
133 devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset"); 133 devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset");
134 134
135 /* enable auto-switching between PCI and EBU */ 135 /* enable auto-switching between PCI and EBU */
@@ -192,7 +192,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev)
192 ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN); 192 ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN);
193 193
194 /* toggle reset pin */ 194 /* toggle reset pin */
195 if (reset_gpio > 0) { 195 if (gpio_is_valid(reset_gpio)) {
196 __gpio_set_value(reset_gpio, 0); 196 __gpio_set_value(reset_gpio, 0);
197 wmb(); 197 wmb();
198 mdelay(1); 198 mdelay(1);
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index 08251d6f6b11..ac519bbd42ff 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -123,7 +123,7 @@ static inline unsigned long current_stack_pointer(void)
123} 123}
124 124
125#ifndef CONFIG_KGDB 125#ifndef CONFIG_KGDB
126void arch_release_thread_info(struct thread_info *ti) 126void arch_release_thread_info(struct thread_info *ti);
127#endif 127#endif
128#define get_thread_info(ti) get_task_struct((ti)->task) 128#define get_thread_info(ti) get_task_struct((ti)->task)
129#define put_thread_info(ti) put_task_struct((ti)->task) 129#define put_thread_info(ti) put_task_struct((ti)->task)
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 6eb75b80488c..0554ab062bdc 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -86,8 +86,8 @@ static inline bool arch_irqs_disabled(void)
86} 86}
87 87
88#ifdef CONFIG_PPC_BOOK3E 88#ifdef CONFIG_PPC_BOOK3E
89#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); 89#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory")
90#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); 90#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory")
91#else 91#else
92#define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1) 92#define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1)
93#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) 93#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1)
@@ -125,6 +125,8 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
125 return !regs->softe; 125 return !regs->softe;
126} 126}
127 127
128extern bool prep_irq_for_idle(void);
129
128#else /* CONFIG_PPC64 */ 130#else /* CONFIG_PPC64 */
129 131
130#define SET_MSR_EE(x) mtmsr(x) 132#define SET_MSR_EE(x) mtmsr(x)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1b415027ec0e..1f017bb7a7ce 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -229,7 +229,7 @@ notrace void arch_local_irq_restore(unsigned long en)
229 */ 229 */
230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) 230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
231 __hard_irq_disable(); 231 __hard_irq_disable();
232#ifdef CONFIG_TRACE_IRQFLAG 232#ifdef CONFIG_TRACE_IRQFLAGS
233 else { 233 else {
234 /* 234 /*
235 * We should already be hard disabled here. We had bugs 235 * We should already be hard disabled here. We had bugs
@@ -286,6 +286,52 @@ void notrace restore_interrupts(void)
286 __hard_irq_enable(); 286 __hard_irq_enable();
287} 287}
288 288
289/*
290 * This is a helper to use when about to go into idle low-power
291 * when the latter has the side effect of re-enabling interrupts
292 * (such as calling H_CEDE under pHyp).
293 *
294 * You call this function with interrupts soft-disabled (this is
295 * already the case when ppc_md.power_save is called). The function
296 * will return whether to enter power save or just return.
297 *
298 * In the former case, it will have notified lockdep of interrupts
299 * being re-enabled and generally sanitized the lazy irq state,
300 * and in the latter case it will leave with interrupts hard
301 * disabled and marked as such, so the local_irq_enable() call
302 * in cpu_idle() will properly re-enable everything.
303 */
304bool prep_irq_for_idle(void)
305{
306 /*
307 * First we need to hard disable to ensure no interrupt
308 * occurs before we effectively enter the low power state
309 */
310 hard_irq_disable();
311
312 /*
313 * If anything happened while we were soft-disabled,
314 * we return now and do not enter the low power state.
315 */
316 if (lazy_irq_pending())
317 return false;
318
319 /* Tell lockdep we are about to re-enable */
320 trace_hardirqs_on();
321
322 /*
323 * Mark interrupts as soft-enabled and clear the
324 * PACA_IRQ_HARD_DIS from the pending mask since we
325 * are about to hard enable as well as a side effect
326 * of entering the low power state.
327 */
328 local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
329 local_paca->soft_enabled = 1;
330
331 /* Tell the caller to enter the low power state */
332 return true;
333}
334
289#endif /* CONFIG_PPC64 */ 335#endif /* CONFIG_PPC64 */
290 336
291int arch_show_interrupts(struct seq_file *p, int prec) 337int arch_show_interrupts(struct seq_file *p, int prec)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 6e8f677f5646..1e95556dc692 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -639,7 +639,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
639 unsigned int n, rc, ranges, is_kexec_kdump = 0; 639 unsigned int n, rc, ranges, is_kexec_kdump = 0;
640 unsigned long lmb_size, base, size, sz; 640 unsigned long lmb_size, base, size, sz;
641 int nid; 641 int nid;
642 struct assoc_arrays aa; 642 struct assoc_arrays aa = { .arrays = NULL };
643 643
644 n = of_get_drconf_memory(memory, &dm); 644 n = of_get_drconf_memory(memory, &dm);
645 if (!n) 645 if (!n)
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index efdacc829576..d17e98bc0c10 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -42,11 +42,9 @@ static void cbe_power_save(void)
42{ 42{
43 unsigned long ctrl, thread_switch_control; 43 unsigned long ctrl, thread_switch_control;
44 44
45 /* 45 /* Ensure our interrupt state is properly tracked */
46 * We need to hard disable interrupts, the local_irq_enable() done by 46 if (!prep_irq_for_idle())
47 * our caller upon return will hard re-enable. 47 return;
48 */
49 hard_irq_disable();
50 48
51 ctrl = mfspr(SPRN_CTRLF); 49 ctrl = mfspr(SPRN_CTRLF);
52 50
@@ -81,6 +79,9 @@ static void cbe_power_save(void)
81 */ 79 */
82 ctrl &= ~(CTRL_RUNLATCH | CTRL_TE); 80 ctrl &= ~(CTRL_RUNLATCH | CTRL_TE);
83 mtspr(SPRN_CTRLT, ctrl); 81 mtspr(SPRN_CTRLT, ctrl);
82
83 /* Re-enable interrupts in MSR */
84 __hard_irq_enable();
84} 85}
85 86
86static int cbe_system_reset_exception(struct pt_regs *regs) 87static int cbe_system_reset_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index e61483e8e960..c71be66bd5dc 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -99,15 +99,18 @@ out:
99static void check_and_cede_processor(void) 99static void check_and_cede_processor(void)
100{ 100{
101 /* 101 /*
102 * Interrupts are soft-disabled at this point, 102 * Ensure our interrupt state is properly tracked,
103 * but not hard disabled. So an interrupt might have 103 * also checks if no interrupt has occurred while we
104 * occurred before entering NAP, and would be potentially 104 * were soft-disabled
105 * lost (edge events, decrementer events, etc...) unless
106 * we first hard disable then check.
107 */ 105 */
108 hard_irq_disable(); 106 if (prep_irq_for_idle()) {
109 if (!lazy_irq_pending())
110 cede_processor(); 107 cede_processor();
108#ifdef CONFIG_TRACE_IRQFLAGS
109 /* Ensure that H_CEDE returns with IRQs on */
110 if (WARN_ON(!(mfmsr() & MSR_EE)))
111 __hard_irq_enable();
112#endif
113 }
111} 114}
112 115
113static int dedicated_cede_loop(struct cpuidle_device *dev, 116static int dedicated_cede_loop(struct cpuidle_device *dev,
diff --git a/arch/tile/kernel/backtrace.c b/arch/tile/kernel/backtrace.c
index 9092ce8aa6b4..f8b74ca83b92 100644
--- a/arch/tile/kernel/backtrace.c
+++ b/arch/tile/kernel/backtrace.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <asm/byteorder.h>
17#include <asm/backtrace.h> 18#include <asm/backtrace.h>
18#include <asm/tile-desc.h> 19#include <asm/tile-desc.h>
19#include <arch/abi.h> 20#include <arch/abi.h>
@@ -336,8 +337,12 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location,
336 bytes_to_prefetch / sizeof(tile_bundle_bits); 337 bytes_to_prefetch / sizeof(tile_bundle_bits);
337 } 338 }
338 339
339 /* Decode the next bundle. */ 340 /*
340 bundle.bits = prefetched_bundles[next_bundle++]; 341 * Decode the next bundle.
342 * TILE always stores instruction bundles in little-endian
343 * mode, even when the chip is running in big-endian mode.
344 */
345 bundle.bits = le64_to_cpu(prefetched_bundles[next_bundle++]);
341 bundle.num_insns = 346 bundle.num_insns =
342 parse_insn_tile(bundle.bits, pc, bundle.insns); 347 parse_insn_tile(bundle.bits, pc, bundle.insns);
343 num_info_ops = bt_get_info_ops(&bundle, info_operands); 348 num_info_ops = bt_get_info_ops(&bundle, info_operands);
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 0ed85cac3231..615996a36bed 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -95,18 +95,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
95 return_ACPI_STATUS(status); 95 return_ACPI_STATUS(status);
96 } 96 }
97 97
98 if (sleep_state != ACPI_STATE_S5) {
99 /*
100 * Disable BM arbitration. This feature is contained within an
101 * optional register (PM2 Control), so ignore a BAD_ADDRESS
102 * exception.
103 */
104 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
105 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
106 return_ACPI_STATUS(status);
107 }
108 }
109
110 /* 98 /*
111 * 1) Disable/Clear all GPEs 99 * 1) Disable/Clear all GPEs
112 * 2) Enable all wakeup GPEs 100 * 2) Enable all wakeup GPEs
@@ -364,16 +352,6 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags)
364 [ACPI_EVENT_POWER_BUTTON]. 352 [ACPI_EVENT_POWER_BUTTON].
365 status_register_id, ACPI_CLEAR_STATUS); 353 status_register_id, ACPI_CLEAR_STATUS);
366 354
367 /*
368 * Enable BM arbitration. This feature is contained within an
369 * optional register (PM2 Control), so ignore a BAD_ADDRESS
370 * exception.
371 */
372 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
373 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
374 return_ACPI_STATUS(status);
375 }
376
377 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); 355 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
378 return_ACPI_STATUS(status); 356 return_ACPI_STATUS(status);
379} 357}
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c4067d0141f7..542f0c04b695 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -136,7 +136,7 @@ config GPIO_MPC8XXX
136 136
137config GPIO_MSM_V1 137config GPIO_MSM_V1
138 tristate "Qualcomm MSM GPIO v1" 138 tristate "Qualcomm MSM GPIO v1"
139 depends on GPIOLIB && ARCH_MSM 139 depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50)
140 help 140 help
141 Say yes here to support the GPIO interface on ARM v6 based 141 Say yes here to support the GPIO interface on ARM v6 based
142 Qualcomm MSM chips. Most of the pins on the MSM can be 142 Qualcomm MSM chips. Most of the pins on the MSM can be
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
index 9e9947cb86a3..1077754f8289 100644
--- a/drivers/gpio/devres.c
+++ b/drivers/gpio/devres.c
@@ -98,6 +98,7 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
98 98
99 return 0; 99 return 0;
100} 100}
101EXPORT_SYMBOL(devm_gpio_request_one);
101 102
102/** 103/**
103 * devm_gpio_free - free an interrupt 104 * devm_gpio_free - free an interrupt
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index c337143b18f8..c89c4c1e668d 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -398,10 +398,12 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
398 writel(~0, port->base + GPIO_ISR); 398 writel(~0, port->base + GPIO_ISR);
399 399
400 if (mxc_gpio_hwtype == IMX21_GPIO) { 400 if (mxc_gpio_hwtype == IMX21_GPIO) {
401 /* setup one handler for all GPIO interrupts */ 401 /*
402 if (pdev->id == 0) 402 * Setup one handler for all GPIO interrupts. Actually setting
403 irq_set_chained_handler(port->irq, 403 * the handler is needed only once, but doing it for every port
404 mx2_gpio_irq_handler); 404 * is more robust and easier.
405 */
406 irq_set_chained_handler(port->irq, mx2_gpio_irq_handler);
405 } else { 407 } else {
406 /* setup one handler for each entry */ 408 /* setup one handler for each entry */
407 irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); 409 irq_set_chained_handler(port->irq, mx3_gpio_irq_handler);
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index c4ed1722734c..4fbc208c32cf 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank)
174 if (bank->dbck_enable_mask && !bank->dbck_enabled) { 174 if (bank->dbck_enable_mask && !bank->dbck_enabled) {
175 clk_enable(bank->dbck); 175 clk_enable(bank->dbck);
176 bank->dbck_enabled = true; 176 bank->dbck_enabled = true;
177
178 __raw_writel(bank->dbck_enable_mask,
179 bank->base + bank->regs->debounce_en);
177 } 180 }
178} 181}
179 182
180static inline void _gpio_dbck_disable(struct gpio_bank *bank) 183static inline void _gpio_dbck_disable(struct gpio_bank *bank)
181{ 184{
182 if (bank->dbck_enable_mask && bank->dbck_enabled) { 185 if (bank->dbck_enable_mask && bank->dbck_enabled) {
186 /*
187 * Disable debounce before cutting it's clock. If debounce is
188 * enabled but the clock is not, GPIO module seems to be unable
189 * to detect events and generate interrupts at least on OMAP3.
190 */
191 __raw_writel(0, bank->base + bank->regs->debounce_en);
192
183 clk_disable(bank->dbck); 193 clk_disable(bank->dbck);
184 bank->dbck_enabled = false; 194 bank->dbck_enabled = false;
185 } 195 }
@@ -1081,7 +1091,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1081 bank->is_mpuio = pdata->is_mpuio; 1091 bank->is_mpuio = pdata->is_mpuio;
1082 bank->non_wakeup_gpios = pdata->non_wakeup_gpios; 1092 bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
1083 bank->loses_context = pdata->loses_context; 1093 bank->loses_context = pdata->loses_context;
1084 bank->get_context_loss_count = pdata->get_context_loss_count;
1085 bank->regs = pdata->regs; 1094 bank->regs = pdata->regs;
1086#ifdef CONFIG_OF_GPIO 1095#ifdef CONFIG_OF_GPIO
1087 bank->chip.of_node = of_node_get(node); 1096 bank->chip.of_node = of_node_get(node);
@@ -1135,6 +1144,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
1135 omap_gpio_chip_init(bank); 1144 omap_gpio_chip_init(bank);
1136 omap_gpio_show_rev(bank); 1145 omap_gpio_show_rev(bank);
1137 1146
1147 if (bank->loses_context)
1148 bank->get_context_loss_count = pdata->get_context_loss_count;
1149
1138 pm_runtime_put(bank->dev); 1150 pm_runtime_put(bank->dev);
1139 1151
1140 list_add_tail(&bank->node, &omap_gpio_list); 1152 list_add_tail(&bank->node, &omap_gpio_list);
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c
index 38416be8ba11..6064fb376e11 100644
--- a/drivers/gpio/gpio-sta2x11.c
+++ b/drivers/gpio/gpio-sta2x11.c
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev)
383 } 383 }
384 spin_lock_init(&chip->lock); 384 spin_lock_init(&chip->lock);
385 gsta_gpio_setup(chip); 385 gsta_gpio_setup(chip);
386 for (i = 0; i < GSTA_NR_GPIO; i++) 386 if (gpio_pdata)
387 gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); 387 for (i = 0; i < GSTA_NR_GPIO; i++)
388 gsta_set_config(chip, i, gpio_pdata->pinconfig[i]);
388 389
389 /* 384 was used in previous code: be compatible for other drivers */ 390 /* 384 was used in previous code: be compatible for other drivers */
390 err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); 391 err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE);
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
index c1ad2884f2ed..11f29c82253c 100644
--- a/drivers/gpio/gpio-tps65910.c
+++ b/drivers/gpio/gpio-tps65910.c
@@ -149,6 +149,9 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
149 tps65910_gpio->gpio_chip.set = tps65910_gpio_set; 149 tps65910_gpio->gpio_chip.set = tps65910_gpio_set;
150 tps65910_gpio->gpio_chip.get = tps65910_gpio_get; 150 tps65910_gpio->gpio_chip.get = tps65910_gpio_get;
151 tps65910_gpio->gpio_chip.dev = &pdev->dev; 151 tps65910_gpio->gpio_chip.dev = &pdev->dev;
152#ifdef CONFIG_OF_GPIO
153 tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node;
154#endif
152 if (pdata && pdata->gpio_base) 155 if (pdata && pdata->gpio_base)
153 tps65910_gpio->gpio_chip.base = pdata->gpio_base; 156 tps65910_gpio->gpio_chip.base = pdata->gpio_base;
154 else 157 else
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index 92ea5350dfe9..aa61ad2fcaaa 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip,
89 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); 89 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
90 struct wm8994 *wm8994 = wm8994_gpio->wm8994; 90 struct wm8994 *wm8994 = wm8994_gpio->wm8994;
91 91
92 if (value)
93 value = WM8994_GPN_LVL;
94
92 return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, 95 return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset,
93 WM8994_GPN_DIR, 0); 96 WM8994_GPN_DIR | WM8994_GPN_LVL, value);
94} 97}
95 98
96static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 99static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 61c9cf15fa52..1201a15784c3 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
345 spin_lock_init(&hwlock->lock); 345 spin_lock_init(&hwlock->lock);
346 hwlock->bank = bank; 346 hwlock->bank = bank;
347 347
348 ret = hwspin_lock_register_single(hwlock, i); 348 ret = hwspin_lock_register_single(hwlock, base_id + i);
349 if (ret) 349 if (ret)
350 goto reg_failed; 350 goto reg_failed;
351 } 351 }
@@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
354 354
355reg_failed: 355reg_failed:
356 while (--i >= 0) 356 while (--i >= 0)
357 hwspin_lock_unregister_single(i); 357 hwspin_lock_unregister_single(base_id + i);
358 return ret; 358 return ret;
359} 359}
360EXPORT_SYMBOL_GPL(hwspin_lock_register); 360EXPORT_SYMBOL_GPL(hwspin_lock_register);
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a2e418cba0ff..625626391f2d 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops;
83static ATOMIC_NOTIFIER_HEAD(ppr_notifier); 83static ATOMIC_NOTIFIER_HEAD(ppr_notifier);
84int amd_iommu_max_glx_val = -1; 84int amd_iommu_max_glx_val = -1;
85 85
86static struct dma_map_ops amd_iommu_dma_ops;
87
86/* 88/*
87 * general struct to manage commands send to an IOMMU 89 * general struct to manage commands send to an IOMMU
88 */ 90 */
@@ -402,7 +404,7 @@ static void amd_iommu_stats_init(void)
402 return; 404 return;
403 405
404 de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, 406 de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir,
405 (u32 *)&amd_iommu_unmap_flush); 407 &amd_iommu_unmap_flush);
406 408
407 amd_iommu_stats_add(&compl_wait); 409 amd_iommu_stats_add(&compl_wait);
408 amd_iommu_stats_add(&cnt_map_single); 410 amd_iommu_stats_add(&cnt_map_single);
@@ -2267,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb,
2267 list_add_tail(&dma_domain->list, &iommu_pd_list); 2269 list_add_tail(&dma_domain->list, &iommu_pd_list);
2268 spin_unlock_irqrestore(&iommu_pd_list_lock, flags); 2270 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
2269 2271
2272 dev_data = get_dev_data(dev);
2273
2274 if (!dev_data->passthrough)
2275 dev->archdata.dma_ops = &amd_iommu_dma_ops;
2276 else
2277 dev->archdata.dma_ops = &nommu_dma_ops;
2278
2270 break; 2279 break;
2271 case BUS_NOTIFY_DEL_DEVICE: 2280 case BUS_NOTIFY_DEL_DEVICE:
2272 2281
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 542024ba6dba..a33612f3206f 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
129 to handle */ 129 to handle */
130LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings 130LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
131 we find in ACPI */ 131 we find in ACPI */
132bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ 132u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */
133 133
134LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the 134LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
135 system */ 135 system */
@@ -1641,6 +1641,8 @@ static int __init amd_iommu_init(void)
1641 1641
1642 amd_iommu_init_api(); 1642 amd_iommu_init_api();
1643 1643
1644 x86_platform.iommu_shutdown = disable_iommus;
1645
1644 if (iommu_pass_through) 1646 if (iommu_pass_through)
1645 goto out; 1647 goto out;
1646 1648
@@ -1649,8 +1651,6 @@ static int __init amd_iommu_init(void)
1649 else 1651 else
1650 printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); 1652 printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n");
1651 1653
1652 x86_platform.iommu_shutdown = disable_iommus;
1653
1654out: 1654out:
1655 return ret; 1655 return ret;
1656 1656
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
index 24355559a2ad..c1b1d489817e 100644
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -652,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap;
652 * If true, the addresses will be flushed on unmap time, not when 652 * If true, the addresses will be flushed on unmap time, not when
653 * they are reused 653 * they are reused
654 */ 654 */
655extern bool amd_iommu_unmap_flush; 655extern u32 amd_iommu_unmap_flush;
656 656
657/* Smallest number of PASIDs supported by any IOMMU in the system */ 657/* Smallest number of PASIDs supported by any IOMMU in the system */
658extern u32 amd_iommu_max_pasids; 658extern u32 amd_iommu_max_pasids;
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index ecd679043d77..3f3d09d560ea 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as)
550 return 0; 550 return 0;
551 551
552 as->pte_count = devm_kzalloc(smmu->dev, 552 as->pte_count = devm_kzalloc(smmu->dev,
553 sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL); 553 sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC);
554 if (!as->pte_count) { 554 if (!as->pte_count) {
555 dev_err(smmu->dev, 555 dev_err(smmu->dev,
556 "failed to allocate smmu_device PTE cunters\n"); 556 "failed to allocate smmu_device PTE cunters\n");
557 return -ENOMEM; 557 return -ENOMEM;
558 } 558 }
559 as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA); 559 as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA);
560 if (!as->pdir_page) { 560 if (!as->pdir_page) {
561 dev_err(smmu->dev, 561 dev_err(smmu->dev,
562 "failed to allocate smmu_device page directory\n"); 562 "failed to allocate smmu_device page directory\n");
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 6c31e46a1fd2..b9c6f17eabb2 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2070,10 +2070,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
2070 set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); 2070 set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma));
2071 set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), 2071 set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue),
2072 v4l2_ctrl_g_ctrl(sd->red)); 2072 v4l2_ctrl_g_ctrl(sd->red));
2073 set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); 2073 if (sd->gain)
2074 set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); 2074 set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain));
2075 set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), 2075 if (sd->exposure)
2076 v4l2_ctrl_g_ctrl(sd->vflip)); 2076 set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure));
2077 if (sd->hflip)
2078 set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip),
2079 v4l2_ctrl_g_ctrl(sd->vflip));
2077 2080
2078 reg_w1(gspca_dev, 0x1007, 0x20); 2081 reg_w1(gspca_dev, 0x1007, 0x20);
2079 reg_w1(gspca_dev, 0x1061, 0x03); 2082 reg_w1(gspca_dev, 0x1061, 0x03);
@@ -2176,7 +2179,7 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev)
2176 struct sd *sd = (struct sd *) gspca_dev; 2179 struct sd *sd = (struct sd *) gspca_dev;
2177 int avg_lum; 2180 int avg_lum;
2178 2181
2179 if (!v4l2_ctrl_g_ctrl(sd->autogain)) 2182 if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain))
2180 return; 2183 return;
2181 2184
2182 avg_lum = atomic_read(&sd->avg_lum); 2185 avg_lum = atomic_read(&sd->avg_lum);
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 41f9a254b245..637bde8aca28 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -83,6 +83,7 @@
83#define CSICR1_INV_DATA (1 << 3) 83#define CSICR1_INV_DATA (1 << 3)
84#define CSICR1_INV_PCLK (1 << 2) 84#define CSICR1_INV_PCLK (1 << 2)
85#define CSICR1_REDGE (1 << 1) 85#define CSICR1_REDGE (1 << 1)
86#define CSICR1_FMT_MASK (CSICR1_PACK_DIR | CSICR1_SWAP16_EN)
86 87
87#define SHIFT_STATFF_LEVEL 22 88#define SHIFT_STATFF_LEVEL 22
88#define SHIFT_RXFF_LEVEL 19 89#define SHIFT_RXFF_LEVEL 19
@@ -230,6 +231,7 @@ struct mx2_prp_cfg {
230 u32 src_pixel; 231 u32 src_pixel;
231 u32 ch1_pixel; 232 u32 ch1_pixel;
232 u32 irq_flags; 233 u32 irq_flags;
234 u32 csicr1;
233}; 235};
234 236
235/* prp resizing parameters */ 237/* prp resizing parameters */
@@ -330,6 +332,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
330 .ch1_pixel = 0x2ca00565, /* RGB565 */ 332 .ch1_pixel = 0x2ca00565, /* RGB565 */
331 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | 333 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR |
332 PRP_INTR_CH1FC | PRP_INTR_LBOVF, 334 PRP_INTR_CH1FC | PRP_INTR_LBOVF,
335 .csicr1 = 0,
333 } 336 }
334 }, 337 },
335 { 338 {
@@ -343,6 +346,21 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
343 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | 346 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR |
344 PRP_INTR_CH2FC | PRP_INTR_LBOVF | 347 PRP_INTR_CH2FC | PRP_INTR_LBOVF |
345 PRP_INTR_CH2OVF, 348 PRP_INTR_CH2OVF,
349 .csicr1 = CSICR1_PACK_DIR,
350 }
351 },
352 {
353 .in_fmt = V4L2_MBUS_FMT_UYVY8_2X8,
354 .out_fmt = V4L2_PIX_FMT_YUV420,
355 .cfg = {
356 .channel = 2,
357 .in_fmt = PRP_CNTL_DATA_IN_YUV422,
358 .out_fmt = PRP_CNTL_CH2_OUT_YUV420,
359 .src_pixel = 0x22000888, /* YUV422 (YUYV) */
360 .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR |
361 PRP_INTR_CH2FC | PRP_INTR_LBOVF |
362 PRP_INTR_CH2OVF,
363 .csicr1 = CSICR1_SWAP16_EN,
346 } 364 }
347 }, 365 },
348}; 366};
@@ -1015,14 +1033,14 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1015 return ret; 1033 return ret;
1016 } 1034 }
1017 1035
1036 csicr1 = (csicr1 & ~CSICR1_FMT_MASK) | pcdev->emma_prp->cfg.csicr1;
1037
1018 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) 1038 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
1019 csicr1 |= CSICR1_REDGE; 1039 csicr1 |= CSICR1_REDGE;
1020 if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) 1040 if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
1021 csicr1 |= CSICR1_SOF_POL; 1041 csicr1 |= CSICR1_SOF_POL;
1022 if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) 1042 if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
1023 csicr1 |= CSICR1_HSYNC_POL; 1043 csicr1 |= CSICR1_HSYNC_POL;
1024 if (pcdev->platform_flags & MX2_CAMERA_SWAP16)
1025 csicr1 |= CSICR1_SWAP16_EN;
1026 if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) 1044 if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC)
1027 csicr1 |= CSICR1_EXT_VSYNC; 1045 csicr1 |= CSICR1_EXT_VSYNC;
1028 if (pcdev->platform_flags & MX2_CAMERA_CCIR) 1046 if (pcdev->platform_flags & MX2_CAMERA_CCIR)
@@ -1033,8 +1051,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1033 csicr1 |= CSICR1_GCLK_MODE; 1051 csicr1 |= CSICR1_GCLK_MODE;
1034 if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) 1052 if (pcdev->platform_flags & MX2_CAMERA_INV_DATA)
1035 csicr1 |= CSICR1_INV_DATA; 1053 csicr1 |= CSICR1_INV_DATA;
1036 if (pcdev->platform_flags & MX2_CAMERA_PACK_DIR_MSB)
1037 csicr1 |= CSICR1_PACK_DIR;
1038 1054
1039 pcdev->csicr1 = csicr1; 1055 pcdev->csicr1 = csicr1;
1040 1056
@@ -1109,7 +1125,8 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
1109 return 0; 1125 return 0;
1110 } 1126 }
1111 1127
1112 if (code == V4L2_MBUS_FMT_YUYV8_2X8) { 1128 if (code == V4L2_MBUS_FMT_YUYV8_2X8 ||
1129 code == V4L2_MBUS_FMT_UYVY8_2X8) {
1113 formats++; 1130 formats++;
1114 if (xlate) { 1131 if (xlate) {
1115 /* 1132 /*
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 7de13891e49e..783fcd7365bc 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -1147,7 +1147,7 @@ static int mei_pci_resume(struct device *device)
1147 err = request_threaded_irq(pdev->irq, 1147 err = request_threaded_irq(pdev->irq,
1148 NULL, 1148 NULL,
1149 mei_interrupt_thread_handler, 1149 mei_interrupt_thread_handler,
1150 0, mei_driver_name, dev); 1150 IRQF_ONESHOT, mei_driver_name, dev);
1151 else 1151 else
1152 err = request_threaded_irq(pdev->irq, 1152 err = request_threaded_irq(pdev->irq,
1153 mei_interrupt_quick_handler, 1153 mei_interrupt_quick_handler,
diff --git a/drivers/of/base.c b/drivers/of/base.c
index eada3f4ef801..d9bfd49b1935 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -511,22 +511,6 @@ out:
511} 511}
512EXPORT_SYMBOL(of_find_node_with_property); 512EXPORT_SYMBOL(of_find_node_with_property);
513 513
514static const struct of_device_id *of_match_compat(const struct of_device_id *matches,
515 const char *compat)
516{
517 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
518 const char *cp = matches->compatible;
519 int len = strlen(cp);
520
521 if (len > 0 && of_compat_cmp(compat, cp, len) == 0)
522 return matches;
523
524 matches++;
525 }
526
527 return NULL;
528}
529
530/** 514/**
531 * of_match_node - Tell if an device_node has a matching of_match structure 515 * of_match_node - Tell if an device_node has a matching of_match structure
532 * @matches: array of of device match structures to search in 516 * @matches: array of of device match structures to search in
@@ -537,18 +521,9 @@ static const struct of_device_id *of_match_compat(const struct of_device_id *mat
537const struct of_device_id *of_match_node(const struct of_device_id *matches, 521const struct of_device_id *of_match_node(const struct of_device_id *matches,
538 const struct device_node *node) 522 const struct device_node *node)
539{ 523{
540 struct property *prop;
541 const char *cp;
542
543 if (!matches) 524 if (!matches)
544 return NULL; 525 return NULL;
545 526
546 of_property_for_each_string(node, "compatible", prop, cp) {
547 const struct of_device_id *match = of_match_compat(matches, cp);
548 if (match)
549 return match;
550 }
551
552 while (matches->name[0] || matches->type[0] || matches->compatible[0]) { 527 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
553 int match = 1; 528 int match = 1;
554 if (matches->name[0]) 529 if (matches->name[0])
@@ -557,7 +532,10 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
557 if (matches->type[0]) 532 if (matches->type[0])
558 match &= node->type 533 match &= node->type
559 && !strcmp(matches->type, node->type); 534 && !strcmp(matches->type, node->type);
560 if (match && !matches->compatible[0]) 535 if (matches->compatible[0])
536 match &= of_device_is_compatible(node,
537 matches->compatible);
538 if (match)
561 return matches; 539 return matches;
562 matches++; 540 matches++;
563 } 541 }
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3132ea068d95..e44f8c2d239d 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -317,10 +317,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
317 for(; lookup->compatible != NULL; lookup++) { 317 for(; lookup->compatible != NULL; lookup++) {
318 if (!of_device_is_compatible(np, lookup->compatible)) 318 if (!of_device_is_compatible(np, lookup->compatible))
319 continue; 319 continue;
320 if (of_address_to_resource(np, 0, &res)) 320 if (!of_address_to_resource(np, 0, &res))
321 continue; 321 if (res.start != lookup->phys_addr)
322 if (res.start != lookup->phys_addr) 322 continue;
323 continue;
324 pr_debug("%s: devname=%s\n", np->full_name, lookup->name); 323 pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
325 return lookup; 324 return lookup;
326 } 325 }
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index bf0cee629b60..099f46cd8e87 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -748,6 +748,18 @@ static int pci_pm_suspend_noirq(struct device *dev)
748 748
749 pci_pm_set_unknown_state(pci_dev); 749 pci_pm_set_unknown_state(pci_dev);
750 750
751 /*
752 * Some BIOSes from ASUS have a bug: If a USB EHCI host controller's
753 * PCI COMMAND register isn't 0, the BIOS assumes that the controller
754 * hasn't been quiesced and tries to turn it off. If the controller
755 * is already in D3, this can hang or cause memory corruption.
756 *
757 * Since the value of the COMMAND register doesn't matter once the
758 * device has been suspended, we can safely set it to 0 here.
759 */
760 if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI)
761 pci_write_config_word(pci_dev, PCI_COMMAND, 0);
762
751 return 0; 763 return 0;
752} 764}
753 765
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 77cb54a65cde..447e83472c01 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1744,11 +1744,6 @@ int pci_prepare_to_sleep(struct pci_dev *dev)
1744 if (target_state == PCI_POWER_ERROR) 1744 if (target_state == PCI_POWER_ERROR)
1745 return -EIO; 1745 return -EIO;
1746 1746
1747 /* Some devices mustn't be in D3 during system sleep */
1748 if (target_state == PCI_D3hot &&
1749 (dev->dev_flags & PCI_DEV_FLAGS_NO_D3_DURING_SLEEP))
1750 return 0;
1751
1752 pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev)); 1747 pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev));
1753 1748
1754 error = pci_set_power_state(dev, target_state); 1749 error = pci_set_power_state(dev, target_state);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 194b243a2817..2a7521677541 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2929,32 +2929,6 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
2929DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); 2929DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
2930DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); 2930DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
2931 2931
2932/*
2933 * The Intel 6 Series/C200 Series chipset's EHCI controllers on many
2934 * ASUS motherboards will cause memory corruption or a system crash
2935 * if they are in D3 while the system is put into S3 sleep.
2936 */
2937static void __devinit asus_ehci_no_d3(struct pci_dev *dev)
2938{
2939 const char *sys_info;
2940 static const char good_Asus_board[] = "P8Z68-V";
2941
2942 if (dev->dev_flags & PCI_DEV_FLAGS_NO_D3_DURING_SLEEP)
2943 return;
2944 if (dev->subsystem_vendor != PCI_VENDOR_ID_ASUSTEK)
2945 return;
2946 sys_info = dmi_get_system_info(DMI_BOARD_NAME);
2947 if (sys_info && memcmp(sys_info, good_Asus_board,
2948 sizeof(good_Asus_board) - 1) == 0)
2949 return;
2950
2951 dev_info(&dev->dev, "broken D3 during system sleep on ASUS\n");
2952 dev->dev_flags |= PCI_DEV_FLAGS_NO_D3_DURING_SLEEP;
2953 device_set_wakeup_capable(&dev->dev, false);
2954}
2955DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c26, asus_ehci_no_d3);
2956DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c2d, asus_ehci_no_d3);
2957
2958static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, 2932static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2959 struct pci_fixup *end) 2933 struct pci_fixup *end)
2960{ 2934{
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 09a737c868b5..8b4b3829d9e7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2519,9 +2519,12 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
2519{ 2519{
2520 struct regulator_dev *rdev = regulator->rdev; 2520 struct regulator_dev *rdev = regulator->rdev;
2521 struct regulator *consumer; 2521 struct regulator *consumer;
2522 int ret, output_uV, input_uV, total_uA_load = 0; 2522 int ret, output_uV, input_uV = 0, total_uA_load = 0;
2523 unsigned int mode; 2523 unsigned int mode;
2524 2524
2525 if (rdev->supply)
2526 input_uV = regulator_get_voltage(rdev->supply);
2527
2525 mutex_lock(&rdev->mutex); 2528 mutex_lock(&rdev->mutex);
2526 2529
2527 /* 2530 /*
@@ -2554,10 +2557,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
2554 goto out; 2557 goto out;
2555 } 2558 }
2556 2559
2557 /* get input voltage */ 2560 /* No supply? Use constraint voltage */
2558 input_uV = 0;
2559 if (rdev->supply)
2560 input_uV = regulator_get_voltage(rdev->supply);
2561 if (input_uV <= 0) 2561 if (input_uV <= 0)
2562 input_uV = rdev->constraints->input_uV; 2562 input_uV = rdev->constraints->input_uV;
2563 if (input_uV <= 0) { 2563 if (input_uV <= 0) {
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 24d880e78ec6..f8d818abf98c 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -4,9 +4,11 @@ menu "Remoteproc drivers (EXPERIMENTAL)"
4config REMOTEPROC 4config REMOTEPROC
5 tristate 5 tristate
6 depends on EXPERIMENTAL 6 depends on EXPERIMENTAL
7 select FW_CONFIG
7 8
8config OMAP_REMOTEPROC 9config OMAP_REMOTEPROC
9 tristate "OMAP remoteproc support" 10 tristate "OMAP remoteproc support"
11 depends on EXPERIMENTAL
10 depends on ARCH_OMAP4 12 depends on ARCH_OMAP4
11 depends on OMAP_IOMMU 13 depends on OMAP_IOMMU
12 select REMOTEPROC 14 select REMOTEPROC
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 75506ec2840e..39d3aa41adda 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -188,6 +188,26 @@ static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)
188 rpdev->id.name); 188 rpdev->id.name);
189} 189}
190 190
191/**
192 * __ept_release() - deallocate an rpmsg endpoint
193 * @kref: the ept's reference count
194 *
195 * This function deallocates an ept, and is invoked when its @kref refcount
196 * drops to zero.
197 *
198 * Never invoke this function directly!
199 */
200static void __ept_release(struct kref *kref)
201{
202 struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint,
203 refcount);
204 /*
205 * At this point no one holds a reference to ept anymore,
206 * so we can directly free it
207 */
208 kfree(ept);
209}
210
191/* for more info, see below documentation of rpmsg_create_ept() */ 211/* for more info, see below documentation of rpmsg_create_ept() */
192static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, 212static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp,
193 struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, 213 struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb,
@@ -206,6 +226,9 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp,
206 return NULL; 226 return NULL;
207 } 227 }
208 228
229 kref_init(&ept->refcount);
230 mutex_init(&ept->cb_lock);
231
209 ept->rpdev = rpdev; 232 ept->rpdev = rpdev;
210 ept->cb = cb; 233 ept->cb = cb;
211 ept->priv = priv; 234 ept->priv = priv;
@@ -238,7 +261,7 @@ rem_idr:
238 idr_remove(&vrp->endpoints, request); 261 idr_remove(&vrp->endpoints, request);
239free_ept: 262free_ept:
240 mutex_unlock(&vrp->endpoints_lock); 263 mutex_unlock(&vrp->endpoints_lock);
241 kfree(ept); 264 kref_put(&ept->refcount, __ept_release);
242 return NULL; 265 return NULL;
243} 266}
244 267
@@ -302,11 +325,17 @@ EXPORT_SYMBOL(rpmsg_create_ept);
302static void 325static void
303__rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) 326__rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept)
304{ 327{
328 /* make sure new inbound messages can't find this ept anymore */
305 mutex_lock(&vrp->endpoints_lock); 329 mutex_lock(&vrp->endpoints_lock);
306 idr_remove(&vrp->endpoints, ept->addr); 330 idr_remove(&vrp->endpoints, ept->addr);
307 mutex_unlock(&vrp->endpoints_lock); 331 mutex_unlock(&vrp->endpoints_lock);
308 332
309 kfree(ept); 333 /* make sure in-flight inbound messages won't invoke cb anymore */
334 mutex_lock(&ept->cb_lock);
335 ept->cb = NULL;
336 mutex_unlock(&ept->cb_lock);
337
338 kref_put(&ept->refcount, __ept_release);
310} 339}
311 340
312/** 341/**
@@ -790,12 +819,28 @@ static void rpmsg_recv_done(struct virtqueue *rvq)
790 819
791 /* use the dst addr to fetch the callback of the appropriate user */ 820 /* use the dst addr to fetch the callback of the appropriate user */
792 mutex_lock(&vrp->endpoints_lock); 821 mutex_lock(&vrp->endpoints_lock);
822
793 ept = idr_find(&vrp->endpoints, msg->dst); 823 ept = idr_find(&vrp->endpoints, msg->dst);
824
825 /* let's make sure no one deallocates ept while we use it */
826 if (ept)
827 kref_get(&ept->refcount);
828
794 mutex_unlock(&vrp->endpoints_lock); 829 mutex_unlock(&vrp->endpoints_lock);
795 830
796 if (ept && ept->cb) 831 if (ept) {
797 ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, msg->src); 832 /* make sure ept->cb doesn't go away while we use it */
798 else 833 mutex_lock(&ept->cb_lock);
834
835 if (ept->cb)
836 ept->cb(ept->rpdev, msg->data, msg->len, ept->priv,
837 msg->src);
838
839 mutex_unlock(&ept->cb_lock);
840
841 /* farewell, ept, we don't need you anymore */
842 kref_put(&ept->refcount, __ept_release);
843 } else
799 dev_warn(dev, "msg received with no recepient\n"); 844 dev_warn(dev, "msg received with no recepient\n");
800 845
801 /* publish the real size of the buffer */ 846 /* publish the real size of the buffer */
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index 532d212b6b2c..393e7ce8e95a 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -201,7 +201,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb,
201 201
202 if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) { 202 if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) {
203 resp->frame_len = le16_to_cpu(*(__le16 *)(r+6)); 203 resp->frame_len = le16_to_cpu(*(__le16 *)(r+6));
204 memcpy(&resp->ending_fis[0], r+16, 24); 204 memcpy(&resp->ending_fis[0], r+16, ATA_RESP_FIS_SIZE);
205 ts->buf_valid_size = sizeof(*resp); 205 ts->buf_valid_size = sizeof(*resp);
206 } 206 }
207 } 207 }
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h
index 0c53c28dc3d3..7e77cf620291 100644
--- a/drivers/scsi/bnx2i/bnx2i.h
+++ b/drivers/scsi/bnx2i/bnx2i.h
@@ -350,6 +350,7 @@ struct bnx2i_hba {
350 struct pci_dev *pcidev; 350 struct pci_dev *pcidev;
351 struct net_device *netdev; 351 struct net_device *netdev;
352 void __iomem *regview; 352 void __iomem *regview;
353 resource_size_t reg_base;
353 354
354 u32 age; 355 u32 age;
355 unsigned long cnic_dev_type; 356 unsigned long cnic_dev_type;
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index ece47e502282..86a12b48e477 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
2724 goto arm_cq; 2724 goto arm_cq;
2725 } 2725 }
2726 2726
2727 reg_base = ep->hba->netdev->base_addr;
2728 if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && 2727 if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) &&
2729 (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { 2728 (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) {
2730 config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); 2729 config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2);
@@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep)
2740 /* 5709 device in normal node and 5706/5708 devices */ 2739 /* 5709 device in normal node and 5706/5708 devices */
2741 reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); 2740 reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num);
2742 2741
2743 ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 2742 ep->qp.ctx_base = ioremap_nocache(ep->hba->reg_base + reg_off,
2744 MB_KERNEL_CTX_SIZE); 2743 MB_KERNEL_CTX_SIZE);
2745 if (!ep->qp.ctx_base) 2744 if (!ep->qp.ctx_base)
2746 return -ENOMEM; 2745 return -ENOMEM;
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index f8d516b53161..621538b8b544 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)
811 bnx2i_identify_device(hba); 811 bnx2i_identify_device(hba);
812 bnx2i_setup_host_queue_size(hba, shost); 812 bnx2i_setup_host_queue_size(hba, shost);
813 813
814 hba->reg_base = pci_resource_start(hba->pcidev, 0);
814 if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { 815 if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) {
815 hba->regview = ioremap_nocache(hba->netdev->base_addr, 816 hba->regview = pci_iomap(hba->pcidev, 0, BNX2_MQ_CONFIG2);
816 BNX2_MQ_CONFIG2);
817 if (!hba->regview) 817 if (!hba->regview)
818 goto ioreg_map_err; 818 goto ioreg_map_err;
819 } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) { 819 } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) {
820 hba->regview = ioremap_nocache(hba->netdev->base_addr, 4096); 820 hba->regview = pci_iomap(hba->pcidev, 0, 4096);
821 if (!hba->regview) 821 if (!hba->regview)
822 goto ioreg_map_err; 822 goto ioreg_map_err;
823 } 823 }
@@ -884,7 +884,7 @@ cid_que_err:
884 bnx2i_free_mp_bdt(hba); 884 bnx2i_free_mp_bdt(hba);
885mp_bdt_mem_err: 885mp_bdt_mem_err:
886 if (hba->regview) { 886 if (hba->regview) {
887 iounmap(hba->regview); 887 pci_iounmap(hba->pcidev, hba->regview);
888 hba->regview = NULL; 888 hba->regview = NULL;
889 } 889 }
890ioreg_map_err: 890ioreg_map_err:
@@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba)
910 pci_dev_put(hba->pcidev); 910 pci_dev_put(hba->pcidev);
911 911
912 if (hba->regview) { 912 if (hba->regview) {
913 iounmap(hba->regview); 913 pci_iounmap(hba->pcidev, hba->regview);
914 hba->regview = NULL; 914 hba->regview = NULL;
915 } 915 }
916 bnx2i_free_mp_bdt(hba); 916 bnx2i_free_mp_bdt(hba);
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 441d88ad99a7..d109cc3a17b6 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -139,12 +139,12 @@ static void sas_ata_task_done(struct sas_task *task)
139 if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || 139 if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD ||
140 ((stat->stat == SAM_STAT_CHECK_CONDITION && 140 ((stat->stat == SAM_STAT_CHECK_CONDITION &&
141 dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { 141 dev->sata_dev.command_set == ATAPI_COMMAND_SET))) {
142 ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); 142 memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE);
143 143
144 if (!link->sactive) { 144 if (!link->sactive) {
145 qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); 145 qc->err_mask |= ac_err_mask(dev->sata_dev.fis[2]);
146 } else { 146 } else {
147 link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.tf.command); 147 link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.fis[2]);
148 if (unlikely(link->eh_info.err_mask)) 148 if (unlikely(link->eh_info.err_mask))
149 qc->flags |= ATA_QCFLAG_FAILED; 149 qc->flags |= ATA_QCFLAG_FAILED;
150 } 150 }
@@ -161,8 +161,8 @@ static void sas_ata_task_done(struct sas_task *task)
161 qc->flags |= ATA_QCFLAG_FAILED; 161 qc->flags |= ATA_QCFLAG_FAILED;
162 } 162 }
163 163
164 dev->sata_dev.tf.feature = 0x04; /* status err */ 164 dev->sata_dev.fis[3] = 0x04; /* status err */
165 dev->sata_dev.tf.command = ATA_ERR; 165 dev->sata_dev.fis[2] = ATA_ERR;
166 } 166 }
167 } 167 }
168 168
@@ -269,7 +269,7 @@ static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc)
269{ 269{
270 struct domain_device *dev = qc->ap->private_data; 270 struct domain_device *dev = qc->ap->private_data;
271 271
272 memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf)); 272 ata_tf_from_fis(dev->sata_dev.fis, &qc->result_tf);
273 return true; 273 return true;
274} 274}
275 275
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c
index ced26c8ccd57..0d2ea0c224c3 100644
--- a/drivers/tty/hvc/hvc_opal.c
+++ b/drivers/tty/hvc/hvc_opal.c
@@ -401,7 +401,7 @@ out:
401} 401}
402 402
403#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW 403#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW
404void __init udbg_init_debug_opal(void) 404void __init udbg_init_debug_opal_raw(void)
405{ 405{
406 u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; 406 u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO;
407 hvc_opal_privs[index] = &hvc_opal_boot_priv; 407 hvc_opal_privs[index] = &hvc_opal_boot_priv;
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 8fd398dffced..ee469274a3fe 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -500,6 +500,8 @@ retry:
500 goto retry; 500 goto retry;
501 } 501 }
502 if (!desc->reslength) { /* zero length read */ 502 if (!desc->reslength) { /* zero length read */
503 dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__);
504 clear_bit(WDM_READ, &desc->flags);
503 spin_unlock_irq(&desc->iuspin); 505 spin_unlock_irq(&desc->iuspin);
504 goto retry; 506 goto retry;
505 } 507 }
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 25a7422ee657..8fb484984c86 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2324,12 +2324,16 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
2324static int hub_port_reset(struct usb_hub *hub, int port1, 2324static int hub_port_reset(struct usb_hub *hub, int port1,
2325 struct usb_device *udev, unsigned int delay, bool warm); 2325 struct usb_device *udev, unsigned int delay, bool warm);
2326 2326
2327/* Is a USB 3.0 port in the Inactive state? */ 2327/* Is a USB 3.0 port in the Inactive or Complinance Mode state?
2328static bool hub_port_inactive(struct usb_hub *hub, u16 portstatus) 2328 * Port worm reset is required to recover
2329 */
2330static bool hub_port_warm_reset_required(struct usb_hub *hub, u16 portstatus)
2329{ 2331{
2330 return hub_is_superspeed(hub->hdev) && 2332 return hub_is_superspeed(hub->hdev) &&
2331 (portstatus & USB_PORT_STAT_LINK_STATE) == 2333 (((portstatus & USB_PORT_STAT_LINK_STATE) ==
2332 USB_SS_PORT_LS_SS_INACTIVE; 2334 USB_SS_PORT_LS_SS_INACTIVE) ||
2335 ((portstatus & USB_PORT_STAT_LINK_STATE) ==
2336 USB_SS_PORT_LS_COMP_MOD)) ;
2333} 2337}
2334 2338
2335static int hub_port_wait_reset(struct usb_hub *hub, int port1, 2339static int hub_port_wait_reset(struct usb_hub *hub, int port1,
@@ -2365,7 +2369,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
2365 * 2369 *
2366 * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 2370 * See https://bugzilla.kernel.org/show_bug.cgi?id=41752
2367 */ 2371 */
2368 if (hub_port_inactive(hub, portstatus)) { 2372 if (hub_port_warm_reset_required(hub, portstatus)) {
2369 int ret; 2373 int ret;
2370 2374
2371 if ((portchange & USB_PORT_STAT_C_CONNECTION)) 2375 if ((portchange & USB_PORT_STAT_C_CONNECTION))
@@ -4408,9 +4412,7 @@ static void hub_events(void)
4408 /* Warm reset a USB3 protocol port if it's in 4412 /* Warm reset a USB3 protocol port if it's in
4409 * SS.Inactive state. 4413 * SS.Inactive state.
4410 */ 4414 */
4411 if (hub_is_superspeed(hub->hdev) && 4415 if (hub_port_warm_reset_required(hub, portstatus)) {
4412 (portstatus & USB_PORT_STAT_LINK_STATE)
4413 == USB_SS_PORT_LS_SS_INACTIVE) {
4414 dev_dbg(hub_dev, "warm reset port %d\n", i); 4416 dev_dbg(hub_dev, "warm reset port %d\n", i);
4415 hub_port_reset(hub, i, NULL, 4417 hub_port_reset(hub, i, NULL,
4416 HUB_BH_RESET_TIME, true); 4418 HUB_BH_RESET_TIME, true);
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 2732ef660c5c..7b01094d7993 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -462,6 +462,42 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array,
462 } 462 }
463} 463}
464 464
465/* Updates Link Status for super Speed port */
466static void xhci_hub_report_link_state(u32 *status, u32 status_reg)
467{
468 u32 pls = status_reg & PORT_PLS_MASK;
469
470 /* resume state is a xHCI internal state.
471 * Do not report it to usb core.
472 */
473 if (pls == XDEV_RESUME)
474 return;
475
476 /* When the CAS bit is set then warm reset
477 * should be performed on port
478 */
479 if (status_reg & PORT_CAS) {
480 /* The CAS bit can be set while the port is
481 * in any link state.
482 * Only roothubs have CAS bit, so we
483 * pretend to be in compliance mode
484 * unless we're already in compliance
485 * or the inactive state.
486 */
487 if (pls != USB_SS_PORT_LS_COMP_MOD &&
488 pls != USB_SS_PORT_LS_SS_INACTIVE) {
489 pls = USB_SS_PORT_LS_COMP_MOD;
490 }
491 /* Return also connection bit -
492 * hub state machine resets port
493 * when this bit is set.
494 */
495 pls |= USB_PORT_STAT_CONNECTION;
496 }
497 /* update status field */
498 *status |= pls;
499}
500
465int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, 501int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
466 u16 wIndex, char *buf, u16 wLength) 502 u16 wIndex, char *buf, u16 wLength)
467{ 503{
@@ -606,13 +642,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
606 else 642 else
607 status |= USB_PORT_STAT_POWER; 643 status |= USB_PORT_STAT_POWER;
608 } 644 }
609 /* Port Link State */ 645 /* Update Port Link State for super speed ports*/
610 if (hcd->speed == HCD_USB3) { 646 if (hcd->speed == HCD_USB3) {
611 /* resume state is a xHCI internal state. 647 xhci_hub_report_link_state(&status, temp);
612 * Do not report it to usb core.
613 */
614 if ((temp & PORT_PLS_MASK) != XDEV_RESUME)
615 status |= (temp & PORT_PLS_MASK);
616 } 648 }
617 if (bus_state->port_c_suspend & (1 << wIndex)) 649 if (bus_state->port_c_suspend & (1 << wIndex))
618 status |= 1 << USB_PORT_FEAT_C_SUSPEND; 650 status |= 1 << USB_PORT_FEAT_C_SUSPEND;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 23b4aefd1036..8275645889da 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -885,6 +885,17 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci,
885 num_trbs_free_temp = ep_ring->num_trbs_free; 885 num_trbs_free_temp = ep_ring->num_trbs_free;
886 dequeue_temp = ep_ring->dequeue; 886 dequeue_temp = ep_ring->dequeue;
887 887
888 /* If we get two back-to-back stalls, and the first stalled transfer
889 * ends just before a link TRB, the dequeue pointer will be left on
890 * the link TRB by the code in the while loop. So we have to update
891 * the dequeue pointer one segment further, or we'll jump off
892 * the segment into la-la-land.
893 */
894 if (last_trb(xhci, ep_ring, ep_ring->deq_seg, ep_ring->dequeue)) {
895 ep_ring->deq_seg = ep_ring->deq_seg->next;
896 ep_ring->dequeue = ep_ring->deq_seg->trbs;
897 }
898
888 while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) { 899 while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) {
889 /* We have more usable TRBs */ 900 /* We have more usable TRBs */
890 ep_ring->num_trbs_free++; 901 ep_ring->num_trbs_free++;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index de3d6e3e57be..55c0785810c9 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -341,7 +341,11 @@ struct xhci_op_regs {
341#define PORT_PLC (1 << 22) 341#define PORT_PLC (1 << 22)
342/* port configure error change - port failed to configure its link partner */ 342/* port configure error change - port failed to configure its link partner */
343#define PORT_CEC (1 << 23) 343#define PORT_CEC (1 << 23)
344/* bit 24 reserved */ 344/* Cold Attach Status - xHC can set this bit to report device attached during
345 * Sx state. Warm port reset should be perfomed to clear this bit and move port
346 * to connected state.
347 */
348#define PORT_CAS (1 << 24)
345/* wake on connect (enable) */ 349/* wake on connect (enable) */
346#define PORT_WKCONN_E (1 << 25) 350#define PORT_WKCONN_E (1 << 25)
347/* wake on disconnect (enable) */ 351/* wake on disconnect (enable) */
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index 81423f7361db..d47eb06fe463 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -222,14 +222,6 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
222 metro_priv->throttled = 0; 222 metro_priv->throttled = 0;
223 spin_unlock_irqrestore(&metro_priv->lock, flags); 223 spin_unlock_irqrestore(&metro_priv->lock, flags);
224 224
225 /*
226 * Force low_latency on so that our tty_push actually forces the data
227 * through, otherwise it is scheduled, and with high data rates (like
228 * with OHCI) data can get lost.
229 */
230 if (tty)
231 tty->low_latency = 1;
232
233 /* Clear the urb pipe. */ 225 /* Clear the urb pipe. */
234 usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe); 226 usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe);
235 227
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index adf8ce72be50..417ab1b0aa30 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -497,6 +497,15 @@ static void option_instat_callback(struct urb *urb);
497 497
498/* MediaTek products */ 498/* MediaTek products */
499#define MEDIATEK_VENDOR_ID 0x0e8d 499#define MEDIATEK_VENDOR_ID 0x0e8d
500#define MEDIATEK_PRODUCT_DC_1COM 0x00a0
501#define MEDIATEK_PRODUCT_DC_4COM 0x00a5
502#define MEDIATEK_PRODUCT_DC_5COM 0x00a4
503#define MEDIATEK_PRODUCT_7208_1COM 0x7101
504#define MEDIATEK_PRODUCT_7208_2COM 0x7102
505#define MEDIATEK_PRODUCT_FP_1COM 0x0003
506#define MEDIATEK_PRODUCT_FP_2COM 0x0023
507#define MEDIATEK_PRODUCT_FPDC_1COM 0x0043
508#define MEDIATEK_PRODUCT_FPDC_2COM 0x0033
500 509
501/* Cellient products */ 510/* Cellient products */
502#define CELLIENT_VENDOR_ID 0x2692 511#define CELLIENT_VENDOR_ID 0x2692
@@ -554,6 +563,10 @@ static const struct option_blacklist_info net_intf1_blacklist = {
554 .reserved = BIT(1), 563 .reserved = BIT(1),
555}; 564};
556 565
566static const struct option_blacklist_info net_intf2_blacklist = {
567 .reserved = BIT(2),
568};
569
557static const struct option_blacklist_info net_intf3_blacklist = { 570static const struct option_blacklist_info net_intf3_blacklist = {
558 .reserved = BIT(3), 571 .reserved = BIT(3),
559}; 572};
@@ -1099,6 +1112,8 @@ static const struct usb_device_id option_ids[] = {
1099 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, 1112 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1100 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, 1113 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1101 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, 1114 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1115 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff),
1116 .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1102 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 1117 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1103 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, 1118 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1104 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, 1119 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
@@ -1240,6 +1255,17 @@ static const struct usb_device_id option_ids[] = {
1240 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, 1255 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) },
1241 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, 1256 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) },
1242 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ 1257 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */
1258 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_1COM, 0x0a, 0x00, 0x00) },
1259 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x02, 0x01) },
1260 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x00, 0x00) },
1261 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x02, 0x01) },
1262 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x00, 0x00) },
1263 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_1COM, 0x02, 0x00, 0x00) },
1264 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_2COM, 0x02, 0x02, 0x01) },
1265 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_1COM, 0x0a, 0x00, 0x00) },
1266 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) },
1267 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) },
1268 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) },
1243 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, 1269 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
1244 { } /* Terminating entry */ 1270 { } /* Terminating entry */
1245}; 1271};
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index bfbc15ca38dd..0908e6044333 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -47,7 +47,7 @@ struct virtio_balloon
47 struct task_struct *thread; 47 struct task_struct *thread;
48 48
49 /* Waiting for host to ack the pages we released. */ 49 /* Waiting for host to ack the pages we released. */
50 struct completion acked; 50 wait_queue_head_t acked;
51 51
52 /* Number of balloon pages we've told the Host we're not using. */ 52 /* Number of balloon pages we've told the Host we're not using. */
53 unsigned int num_pages; 53 unsigned int num_pages;
@@ -89,29 +89,25 @@ static struct page *balloon_pfn_to_page(u32 pfn)
89 89
90static void balloon_ack(struct virtqueue *vq) 90static void balloon_ack(struct virtqueue *vq)
91{ 91{
92 struct virtio_balloon *vb; 92 struct virtio_balloon *vb = vq->vdev->priv;
93 unsigned int len;
94 93
95 vb = virtqueue_get_buf(vq, &len); 94 wake_up(&vb->acked);
96 if (vb)
97 complete(&vb->acked);
98} 95}
99 96
100static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) 97static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
101{ 98{
102 struct scatterlist sg; 99 struct scatterlist sg;
100 unsigned int len;
103 101
104 sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); 102 sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns);
105 103
106 init_completion(&vb->acked);
107
108 /* We should always be able to add one buffer to an empty queue. */ 104 /* We should always be able to add one buffer to an empty queue. */
109 if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) 105 if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0)
110 BUG(); 106 BUG();
111 virtqueue_kick(vq); 107 virtqueue_kick(vq);
112 108
113 /* When host has read buffer, this completes via balloon_ack */ 109 /* When host has read buffer, this completes via balloon_ack */
114 wait_for_completion(&vb->acked); 110 wait_event(vb->acked, virtqueue_get_buf(vq, &len));
115} 111}
116 112
117static void set_page_pfns(u32 pfns[], struct page *page) 113static void set_page_pfns(u32 pfns[], struct page *page)
@@ -231,12 +227,8 @@ static void update_balloon_stats(struct virtio_balloon *vb)
231 */ 227 */
232static void stats_request(struct virtqueue *vq) 228static void stats_request(struct virtqueue *vq)
233{ 229{
234 struct virtio_balloon *vb; 230 struct virtio_balloon *vb = vq->vdev->priv;
235 unsigned int len;
236 231
237 vb = virtqueue_get_buf(vq, &len);
238 if (!vb)
239 return;
240 vb->need_stats_update = 1; 232 vb->need_stats_update = 1;
241 wake_up(&vb->config_change); 233 wake_up(&vb->config_change);
242} 234}
@@ -245,11 +237,14 @@ static void stats_handle_request(struct virtio_balloon *vb)
245{ 237{
246 struct virtqueue *vq; 238 struct virtqueue *vq;
247 struct scatterlist sg; 239 struct scatterlist sg;
240 unsigned int len;
248 241
249 vb->need_stats_update = 0; 242 vb->need_stats_update = 0;
250 update_balloon_stats(vb); 243 update_balloon_stats(vb);
251 244
252 vq = vb->stats_vq; 245 vq = vb->stats_vq;
246 if (!virtqueue_get_buf(vq, &len))
247 return;
253 sg_init_one(&sg, vb->stats, sizeof(vb->stats)); 248 sg_init_one(&sg, vb->stats, sizeof(vb->stats));
254 if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) 249 if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0)
255 BUG(); 250 BUG();
@@ -358,6 +353,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
358 INIT_LIST_HEAD(&vb->pages); 353 INIT_LIST_HEAD(&vb->pages);
359 vb->num_pages = 0; 354 vb->num_pages = 0;
360 init_waitqueue_head(&vb->config_change); 355 init_waitqueue_head(&vb->config_change);
356 init_waitqueue_head(&vb->acked);
361 vb->vdev = vdev; 357 vb->vdev = vdev;
362 vb->need_stats_update = 0; 358 vb->need_stats_update = 0;
363 359
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index f07fc2d08159..2e31e8b3a190 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -22,8 +22,8 @@
22/* Gpio pin is open source */ 22/* Gpio pin is open source */
23#define GPIOF_OPEN_SOURCE (1 << 3) 23#define GPIOF_OPEN_SOURCE (1 << 3)
24 24
25#define GPIOF_EXPORT (1 << 2) 25#define GPIOF_EXPORT (1 << 4)
26#define GPIOF_EXPORT_CHANGEABLE (1 << 3) 26#define GPIOF_EXPORT_CHANGEABLE (1 << 5)
27#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) 27#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
28#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) 28#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
29 29
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fefb4e19bf6a..d8c379dba6ad 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -176,8 +176,6 @@ enum pci_dev_flags {
176 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 176 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
177 /* Provide indication device is assigned by a Virtual Machine Manager */ 177 /* Provide indication device is assigned by a Virtual Machine Manager */
178 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 178 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
179 /* Device causes system crash if in D3 during S3 sleep */
180 PCI_DEV_FLAGS_NO_D3_DURING_SLEEP = (__force pci_dev_flags_t) 8,
181}; 179};
182 180
183enum pci_irq_reroute_variant { 181enum pci_irq_reroute_variant {
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index a8e50e44203c..82a673905edb 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -38,6 +38,8 @@
38#include <linux/types.h> 38#include <linux/types.h>
39#include <linux/device.h> 39#include <linux/device.h>
40#include <linux/mod_devicetable.h> 40#include <linux/mod_devicetable.h>
41#include <linux/kref.h>
42#include <linux/mutex.h>
41 43
42/* The feature bitmap for virtio rpmsg */ 44/* The feature bitmap for virtio rpmsg */
43#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ 45#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
@@ -120,7 +122,9 @@ typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32);
120/** 122/**
121 * struct rpmsg_endpoint - binds a local rpmsg address to its user 123 * struct rpmsg_endpoint - binds a local rpmsg address to its user
122 * @rpdev: rpmsg channel device 124 * @rpdev: rpmsg channel device
125 * @refcount: when this drops to zero, the ept is deallocated
123 * @cb: rx callback handler 126 * @cb: rx callback handler
127 * @cb_lock: must be taken before accessing/changing @cb
124 * @addr: local rpmsg address 128 * @addr: local rpmsg address
125 * @priv: private data for the driver's use 129 * @priv: private data for the driver's use
126 * 130 *
@@ -140,7 +144,9 @@ typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32);
140 */ 144 */
141struct rpmsg_endpoint { 145struct rpmsg_endpoint {
142 struct rpmsg_channel *rpdev; 146 struct rpmsg_channel *rpdev;
147 struct kref refcount;
143 rpmsg_rx_cb_t cb; 148 rpmsg_rx_cb_t cb;
149 struct mutex cb_lock;
144 u32 addr; 150 u32 addr;
145 void *priv; 151 void *priv;
146}; 152};
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index f4f1c96dca72..10ce74f589c5 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -163,6 +163,8 @@ enum ata_command_set {
163 ATAPI_COMMAND_SET = 1, 163 ATAPI_COMMAND_SET = 1,
164}; 164};
165 165
166#define ATA_RESP_FIS_SIZE 24
167
166struct sata_device { 168struct sata_device {
167 enum ata_command_set command_set; 169 enum ata_command_set command_set;
168 struct smp_resp rps_resp; /* report_phy_sata_resp */ 170 struct smp_resp rps_resp; /* report_phy_sata_resp */
@@ -171,7 +173,7 @@ struct sata_device {
171 173
172 struct ata_port *ap; 174 struct ata_port *ap;
173 struct ata_host ata_host; 175 struct ata_host ata_host;
174 struct ata_taskfile tf; 176 u8 fis[ATA_RESP_FIS_SIZE];
175}; 177};
176 178
177enum { 179enum {
@@ -537,7 +539,7 @@ enum exec_status {
537 */ 539 */
538struct ata_task_resp { 540struct ata_task_resp {
539 u16 frame_len; 541 u16 frame_len;
540 u8 ending_fis[24]; /* dev to host or data-in */ 542 u8 ending_fis[ATA_RESP_FIS_SIZE]; /* dev to host or data-in */
541}; 543};
542 544
543#define SAS_STATUS_BUF_SIZE 96 545#define SAS_STATUS_BUF_SIZE 96
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 1e1198546c72..ac06cc595890 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -134,10 +134,16 @@ struct scsi_cmnd {
134 134
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{ 136{
137 struct scsi_driver **sdp;
138
137 if (!cmd->request->rq_disk) 139 if (!cmd->request->rq_disk)
138 return NULL; 140 return NULL;
139 141
140 return *(struct scsi_driver **)cmd->request->rq_disk->private_data; 142 sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data;
143 if (!sdp)
144 return NULL;
145
146 return *sdp;
141} 147}
142 148
143extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 149extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2097684cf194..b303dfc7dce0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -901,13 +901,10 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
901 mutex_unlock(&cgroup_mutex); 901 mutex_unlock(&cgroup_mutex);
902 902
903 /* 903 /*
904 * We want to drop the active superblock reference from the 904 * Drop the active superblock reference that we took when we
905 * cgroup creation after all the dentry refs are gone - 905 * created the cgroup
906 * kill_sb gets mighty unhappy otherwise. Mark
907 * dentry->d_fsdata with cgroup_diput() to tell
908 * cgroup_d_release() to call deactivate_super().
909 */ 906 */
910 dentry->d_fsdata = cgroup_diput; 907 deactivate_super(cgrp->root->sb);
911 908
912 /* 909 /*
913 * if we're getting rid of the cgroup, refcount should ensure 910 * if we're getting rid of the cgroup, refcount should ensure
@@ -933,13 +930,6 @@ static int cgroup_delete(const struct dentry *d)
933 return 1; 930 return 1;
934} 931}
935 932
936static void cgroup_d_release(struct dentry *dentry)
937{
938 /* did cgroup_diput() tell me to deactivate super? */
939 if (dentry->d_fsdata == cgroup_diput)
940 deactivate_super(dentry->d_sb);
941}
942
943static void remove_dir(struct dentry *d) 933static void remove_dir(struct dentry *d)
944{ 934{
945 struct dentry *parent = dget(d->d_parent); 935 struct dentry *parent = dget(d->d_parent);
@@ -1547,7 +1537,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
1547 static const struct dentry_operations cgroup_dops = { 1537 static const struct dentry_operations cgroup_dops = {
1548 .d_iput = cgroup_diput, 1538 .d_iput = cgroup_diput,
1549 .d_delete = cgroup_delete, 1539 .d_delete = cgroup_delete,
1550 .d_release = cgroup_d_release,
1551 }; 1540 };
1552 1541
1553 struct inode *inode = 1542 struct inode *inode =
@@ -3894,8 +3883,12 @@ static void css_dput_fn(struct work_struct *work)
3894{ 3883{
3895 struct cgroup_subsys_state *css = 3884 struct cgroup_subsys_state *css =
3896 container_of(work, struct cgroup_subsys_state, dput_work); 3885 container_of(work, struct cgroup_subsys_state, dput_work);
3886 struct dentry *dentry = css->cgroup->dentry;
3887 struct super_block *sb = dentry->d_sb;
3897 3888
3898 dput(css->cgroup->dentry); 3889 atomic_inc(&sb->s_active);
3890 dput(dentry);
3891 deactivate_super(sb);
3899} 3892}
3900 3893
3901static void init_cgroup_css(struct cgroup_subsys_state *css, 3894static void init_cgroup_css(struct cgroup_subsys_state *css,
diff --git a/kernel/printk.c b/kernel/printk.c
index dba18211685e..177fa49357a5 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -194,8 +194,10 @@ static int console_may_schedule;
194 */ 194 */
195 195
196enum log_flags { 196enum log_flags {
197 LOG_DEFAULT = 0, 197 LOG_NOCONS = 1, /* already flushed, do not print to console */
198 LOG_NOCONS = 1, /* already flushed, do not print to console */ 198 LOG_NEWLINE = 2, /* text ended with a newline */
199 LOG_PREFIX = 4, /* text started with a prefix */
200 LOG_CONT = 8, /* text is a fragment of a continuation line */
199}; 201};
200 202
201struct log { 203struct log {
@@ -217,6 +219,8 @@ static DEFINE_RAW_SPINLOCK(logbuf_lock);
217/* the next printk record to read by syslog(READ) or /proc/kmsg */ 219/* the next printk record to read by syslog(READ) or /proc/kmsg */
218static u64 syslog_seq; 220static u64 syslog_seq;
219static u32 syslog_idx; 221static u32 syslog_idx;
222static enum log_flags syslog_prev;
223static size_t syslog_partial;
220 224
221/* index and sequence number of the first record stored in the buffer */ 225/* index and sequence number of the first record stored in the buffer */
222static u64 log_first_seq; 226static u64 log_first_seq;
@@ -430,20 +434,20 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
430 ret = mutex_lock_interruptible(&user->lock); 434 ret = mutex_lock_interruptible(&user->lock);
431 if (ret) 435 if (ret)
432 return ret; 436 return ret;
433 raw_spin_lock(&logbuf_lock); 437 raw_spin_lock_irq(&logbuf_lock);
434 while (user->seq == log_next_seq) { 438 while (user->seq == log_next_seq) {
435 if (file->f_flags & O_NONBLOCK) { 439 if (file->f_flags & O_NONBLOCK) {
436 ret = -EAGAIN; 440 ret = -EAGAIN;
437 raw_spin_unlock(&logbuf_lock); 441 raw_spin_unlock_irq(&logbuf_lock);
438 goto out; 442 goto out;
439 } 443 }
440 444
441 raw_spin_unlock(&logbuf_lock); 445 raw_spin_unlock_irq(&logbuf_lock);
442 ret = wait_event_interruptible(log_wait, 446 ret = wait_event_interruptible(log_wait,
443 user->seq != log_next_seq); 447 user->seq != log_next_seq);
444 if (ret) 448 if (ret)
445 goto out; 449 goto out;
446 raw_spin_lock(&logbuf_lock); 450 raw_spin_lock_irq(&logbuf_lock);
447 } 451 }
448 452
449 if (user->seq < log_first_seq) { 453 if (user->seq < log_first_seq) {
@@ -451,7 +455,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
451 user->idx = log_first_idx; 455 user->idx = log_first_idx;
452 user->seq = log_first_seq; 456 user->seq = log_first_seq;
453 ret = -EPIPE; 457 ret = -EPIPE;
454 raw_spin_unlock(&logbuf_lock); 458 raw_spin_unlock_irq(&logbuf_lock);
455 goto out; 459 goto out;
456 } 460 }
457 461
@@ -465,7 +469,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
465 for (i = 0; i < msg->text_len; i++) { 469 for (i = 0; i < msg->text_len; i++) {
466 unsigned char c = log_text(msg)[i]; 470 unsigned char c = log_text(msg)[i];
467 471
468 if (c < ' ' || c >= 128) 472 if (c < ' ' || c >= 127 || c == '\\')
469 len += sprintf(user->buf + len, "\\x%02x", c); 473 len += sprintf(user->buf + len, "\\x%02x", c);
470 else 474 else
471 user->buf[len++] = c; 475 user->buf[len++] = c;
@@ -489,7 +493,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
489 continue; 493 continue;
490 } 494 }
491 495
492 if (c < ' ' || c >= 128) { 496 if (c < ' ' || c >= 127 || c == '\\') {
493 len += sprintf(user->buf + len, "\\x%02x", c); 497 len += sprintf(user->buf + len, "\\x%02x", c);
494 continue; 498 continue;
495 } 499 }
@@ -501,7 +505,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
501 505
502 user->idx = log_next(user->idx); 506 user->idx = log_next(user->idx);
503 user->seq++; 507 user->seq++;
504 raw_spin_unlock(&logbuf_lock); 508 raw_spin_unlock_irq(&logbuf_lock);
505 509
506 if (len > count) { 510 if (len > count) {
507 ret = -EINVAL; 511 ret = -EINVAL;
@@ -528,7 +532,7 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
528 if (offset) 532 if (offset)
529 return -ESPIPE; 533 return -ESPIPE;
530 534
531 raw_spin_lock(&logbuf_lock); 535 raw_spin_lock_irq(&logbuf_lock);
532 switch (whence) { 536 switch (whence) {
533 case SEEK_SET: 537 case SEEK_SET:
534 /* the first record */ 538 /* the first record */
@@ -552,7 +556,7 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
552 default: 556 default:
553 ret = -EINVAL; 557 ret = -EINVAL;
554 } 558 }
555 raw_spin_unlock(&logbuf_lock); 559 raw_spin_unlock_irq(&logbuf_lock);
556 return ret; 560 return ret;
557} 561}
558 562
@@ -566,14 +570,14 @@ static unsigned int devkmsg_poll(struct file *file, poll_table *wait)
566 570
567 poll_wait(file, &log_wait, wait); 571 poll_wait(file, &log_wait, wait);
568 572
569 raw_spin_lock(&logbuf_lock); 573 raw_spin_lock_irq(&logbuf_lock);
570 if (user->seq < log_next_seq) { 574 if (user->seq < log_next_seq) {
571 /* return error when data has vanished underneath us */ 575 /* return error when data has vanished underneath us */
572 if (user->seq < log_first_seq) 576 if (user->seq < log_first_seq)
573 ret = POLLIN|POLLRDNORM|POLLERR|POLLPRI; 577 ret = POLLIN|POLLRDNORM|POLLERR|POLLPRI;
574 ret = POLLIN|POLLRDNORM; 578 ret = POLLIN|POLLRDNORM;
575 } 579 }
576 raw_spin_unlock(&logbuf_lock); 580 raw_spin_unlock_irq(&logbuf_lock);
577 581
578 return ret; 582 return ret;
579} 583}
@@ -597,10 +601,10 @@ static int devkmsg_open(struct inode *inode, struct file *file)
597 601
598 mutex_init(&user->lock); 602 mutex_init(&user->lock);
599 603
600 raw_spin_lock(&logbuf_lock); 604 raw_spin_lock_irq(&logbuf_lock);
601 user->idx = log_first_idx; 605 user->idx = log_first_idx;
602 user->seq = log_first_seq; 606 user->seq = log_first_seq;
603 raw_spin_unlock(&logbuf_lock); 607 raw_spin_unlock_irq(&logbuf_lock);
604 608
605 file->private_data = user; 609 file->private_data = user;
606 return 0; 610 return 0;
@@ -818,15 +822,18 @@ static size_t print_time(u64 ts, char *buf)
818static size_t print_prefix(const struct log *msg, bool syslog, char *buf) 822static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
819{ 823{
820 size_t len = 0; 824 size_t len = 0;
825 unsigned int prefix = (msg->facility << 3) | msg->level;
821 826
822 if (syslog) { 827 if (syslog) {
823 if (buf) { 828 if (buf) {
824 len += sprintf(buf, "<%u>", msg->level); 829 len += sprintf(buf, "<%u>", prefix);
825 } else { 830 } else {
826 len += 3; 831 len += 3;
827 if (msg->level > 9) 832 if (prefix > 999)
828 len++; 833 len += 3;
829 if (msg->level > 99) 834 else if (prefix > 99)
835 len += 2;
836 else if (prefix > 9)
830 len++; 837 len++;
831 } 838 }
832 } 839 }
@@ -835,13 +842,26 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
835 return len; 842 return len;
836} 843}
837 844
838static size_t msg_print_text(const struct log *msg, bool syslog, 845static size_t msg_print_text(const struct log *msg, enum log_flags prev,
839 char *buf, size_t size) 846 bool syslog, char *buf, size_t size)
840{ 847{
841 const char *text = log_text(msg); 848 const char *text = log_text(msg);
842 size_t text_size = msg->text_len; 849 size_t text_size = msg->text_len;
850 bool prefix = true;
851 bool newline = true;
843 size_t len = 0; 852 size_t len = 0;
844 853
854 if ((prev & LOG_CONT) && !(msg->flags & LOG_PREFIX))
855 prefix = false;
856
857 if (msg->flags & LOG_CONT) {
858 if ((prev & LOG_CONT) && !(prev & LOG_NEWLINE))
859 prefix = false;
860
861 if (!(msg->flags & LOG_NEWLINE))
862 newline = false;
863 }
864
845 do { 865 do {
846 const char *next = memchr(text, '\n', text_size); 866 const char *next = memchr(text, '\n', text_size);
847 size_t text_len; 867 size_t text_len;
@@ -859,16 +879,22 @@ static size_t msg_print_text(const struct log *msg, bool syslog,
859 text_len + 1>= size - len) 879 text_len + 1>= size - len)
860 break; 880 break;
861 881
862 len += print_prefix(msg, syslog, buf + len); 882 if (prefix)
883 len += print_prefix(msg, syslog, buf + len);
863 memcpy(buf + len, text, text_len); 884 memcpy(buf + len, text, text_len);
864 len += text_len; 885 len += text_len;
865 buf[len++] = '\n'; 886 if (next || newline)
887 buf[len++] = '\n';
866 } else { 888 } else {
867 /* SYSLOG_ACTION_* buffer size only calculation */ 889 /* SYSLOG_ACTION_* buffer size only calculation */
868 len += print_prefix(msg, syslog, NULL); 890 if (prefix)
869 len += text_len + 1; 891 len += print_prefix(msg, syslog, NULL);
892 len += text_len;
893 if (next || newline)
894 len++;
870 } 895 }
871 896
897 prefix = true;
872 text = next; 898 text = next;
873 } while (text); 899 } while (text);
874 900
@@ -887,22 +913,35 @@ static int syslog_print(char __user *buf, int size)
887 913
888 while (size > 0) { 914 while (size > 0) {
889 size_t n; 915 size_t n;
916 size_t skip;
890 917
891 raw_spin_lock_irq(&logbuf_lock); 918 raw_spin_lock_irq(&logbuf_lock);
892 if (syslog_seq < log_first_seq) { 919 if (syslog_seq < log_first_seq) {
893 /* messages are gone, move to first one */ 920 /* messages are gone, move to first one */
894 syslog_seq = log_first_seq; 921 syslog_seq = log_first_seq;
895 syslog_idx = log_first_idx; 922 syslog_idx = log_first_idx;
923 syslog_prev = 0;
924 syslog_partial = 0;
896 } 925 }
897 if (syslog_seq == log_next_seq) { 926 if (syslog_seq == log_next_seq) {
898 raw_spin_unlock_irq(&logbuf_lock); 927 raw_spin_unlock_irq(&logbuf_lock);
899 break; 928 break;
900 } 929 }
930
931 skip = syslog_partial;
901 msg = log_from_idx(syslog_idx); 932 msg = log_from_idx(syslog_idx);
902 n = msg_print_text(msg, true, text, LOG_LINE_MAX); 933 n = msg_print_text(msg, syslog_prev, true, text, LOG_LINE_MAX);
903 if (n <= size) { 934 if (n - syslog_partial <= size) {
935 /* message fits into buffer, move forward */
904 syslog_idx = log_next(syslog_idx); 936 syslog_idx = log_next(syslog_idx);
905 syslog_seq++; 937 syslog_seq++;
938 syslog_prev = msg->flags;
939 n -= syslog_partial;
940 syslog_partial = 0;
941 } else if (!len){
942 /* partial read(), remember position */
943 n = size;
944 syslog_partial += n;
906 } else 945 } else
907 n = 0; 946 n = 0;
908 raw_spin_unlock_irq(&logbuf_lock); 947 raw_spin_unlock_irq(&logbuf_lock);
@@ -910,17 +949,15 @@ static int syslog_print(char __user *buf, int size)
910 if (!n) 949 if (!n)
911 break; 950 break;
912 951
913 len += n; 952 if (copy_to_user(buf, text + skip, n)) {
914 size -= n;
915 buf += n;
916 n = copy_to_user(buf - n, text, n);
917
918 if (n) {
919 len -= n;
920 if (!len) 953 if (!len)
921 len = -EFAULT; 954 len = -EFAULT;
922 break; 955 break;
923 } 956 }
957
958 len += n;
959 size -= n;
960 buf += n;
924 } 961 }
925 962
926 kfree(text); 963 kfree(text);
@@ -941,6 +978,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
941 u64 next_seq; 978 u64 next_seq;
942 u64 seq; 979 u64 seq;
943 u32 idx; 980 u32 idx;
981 enum log_flags prev;
944 982
945 if (clear_seq < log_first_seq) { 983 if (clear_seq < log_first_seq) {
946 /* messages are gone, move to first available one */ 984 /* messages are gone, move to first available one */
@@ -954,10 +992,11 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
954 */ 992 */
955 seq = clear_seq; 993 seq = clear_seq;
956 idx = clear_idx; 994 idx = clear_idx;
995 prev = 0;
957 while (seq < log_next_seq) { 996 while (seq < log_next_seq) {
958 struct log *msg = log_from_idx(idx); 997 struct log *msg = log_from_idx(idx);
959 998
960 len += msg_print_text(msg, true, NULL, 0); 999 len += msg_print_text(msg, prev, true, NULL, 0);
961 idx = log_next(idx); 1000 idx = log_next(idx);
962 seq++; 1001 seq++;
963 } 1002 }
@@ -965,10 +1004,11 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
965 /* move first record forward until length fits into the buffer */ 1004 /* move first record forward until length fits into the buffer */
966 seq = clear_seq; 1005 seq = clear_seq;
967 idx = clear_idx; 1006 idx = clear_idx;
1007 prev = 0;
968 while (len > size && seq < log_next_seq) { 1008 while (len > size && seq < log_next_seq) {
969 struct log *msg = log_from_idx(idx); 1009 struct log *msg = log_from_idx(idx);
970 1010
971 len -= msg_print_text(msg, true, NULL, 0); 1011 len -= msg_print_text(msg, prev, true, NULL, 0);
972 idx = log_next(idx); 1012 idx = log_next(idx);
973 seq++; 1013 seq++;
974 } 1014 }
@@ -977,17 +1017,19 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
977 next_seq = log_next_seq; 1017 next_seq = log_next_seq;
978 1018
979 len = 0; 1019 len = 0;
1020 prev = 0;
980 while (len >= 0 && seq < next_seq) { 1021 while (len >= 0 && seq < next_seq) {
981 struct log *msg = log_from_idx(idx); 1022 struct log *msg = log_from_idx(idx);
982 int textlen; 1023 int textlen;
983 1024
984 textlen = msg_print_text(msg, true, text, LOG_LINE_MAX); 1025 textlen = msg_print_text(msg, prev, true, text, LOG_LINE_MAX);
985 if (textlen < 0) { 1026 if (textlen < 0) {
986 len = textlen; 1027 len = textlen;
987 break; 1028 break;
988 } 1029 }
989 idx = log_next(idx); 1030 idx = log_next(idx);
990 seq++; 1031 seq++;
1032 prev = msg->flags;
991 1033
992 raw_spin_unlock_irq(&logbuf_lock); 1034 raw_spin_unlock_irq(&logbuf_lock);
993 if (copy_to_user(buf + len, text, textlen)) 1035 if (copy_to_user(buf + len, text, textlen))
@@ -1000,6 +1042,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
1000 /* messages are gone, move to next one */ 1042 /* messages are gone, move to next one */
1001 seq = log_first_seq; 1043 seq = log_first_seq;
1002 idx = log_first_idx; 1044 idx = log_first_idx;
1045 prev = 0;
1003 } 1046 }
1004 } 1047 }
1005 } 1048 }
@@ -1018,7 +1061,6 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1018{ 1061{
1019 bool clear = false; 1062 bool clear = false;
1020 static int saved_console_loglevel = -1; 1063 static int saved_console_loglevel = -1;
1021 static DEFINE_MUTEX(syslog_mutex);
1022 int error; 1064 int error;
1023 1065
1024 error = check_syslog_permissions(type, from_file); 1066 error = check_syslog_permissions(type, from_file);
@@ -1045,17 +1087,11 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1045 error = -EFAULT; 1087 error = -EFAULT;
1046 goto out; 1088 goto out;
1047 } 1089 }
1048 error = mutex_lock_interruptible(&syslog_mutex);
1049 if (error)
1050 goto out;
1051 error = wait_event_interruptible(log_wait, 1090 error = wait_event_interruptible(log_wait,
1052 syslog_seq != log_next_seq); 1091 syslog_seq != log_next_seq);
1053 if (error) { 1092 if (error)
1054 mutex_unlock(&syslog_mutex);
1055 goto out; 1093 goto out;
1056 }
1057 error = syslog_print(buf, len); 1094 error = syslog_print(buf, len);
1058 mutex_unlock(&syslog_mutex);
1059 break; 1095 break;
1060 /* Read/clear last kernel messages */ 1096 /* Read/clear last kernel messages */
1061 case SYSLOG_ACTION_READ_CLEAR: 1097 case SYSLOG_ACTION_READ_CLEAR:
@@ -1111,6 +1147,8 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1111 /* messages are gone, move to first one */ 1147 /* messages are gone, move to first one */
1112 syslog_seq = log_first_seq; 1148 syslog_seq = log_first_seq;
1113 syslog_idx = log_first_idx; 1149 syslog_idx = log_first_idx;
1150 syslog_prev = 0;
1151 syslog_partial = 0;
1114 } 1152 }
1115 if (from_file) { 1153 if (from_file) {
1116 /* 1154 /*
@@ -1120,19 +1158,20 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
1120 */ 1158 */
1121 error = log_next_idx - syslog_idx; 1159 error = log_next_idx - syslog_idx;
1122 } else { 1160 } else {
1123 u64 seq; 1161 u64 seq = syslog_seq;
1124 u32 idx; 1162 u32 idx = syslog_idx;
1163 enum log_flags prev = syslog_prev;
1125 1164
1126 error = 0; 1165 error = 0;
1127 seq = syslog_seq;
1128 idx = syslog_idx;
1129 while (seq < log_next_seq) { 1166 while (seq < log_next_seq) {
1130 struct log *msg = log_from_idx(idx); 1167 struct log *msg = log_from_idx(idx);
1131 1168
1132 error += msg_print_text(msg, true, NULL, 0); 1169 error += msg_print_text(msg, prev, true, NULL, 0);
1133 idx = log_next(idx); 1170 idx = log_next(idx);
1134 seq++; 1171 seq++;
1172 prev = msg->flags;
1135 } 1173 }
1174 error -= syslog_partial;
1136 } 1175 }
1137 raw_spin_unlock_irq(&logbuf_lock); 1176 raw_spin_unlock_irq(&logbuf_lock);
1138 break; 1177 break;
@@ -1400,10 +1439,9 @@ asmlinkage int vprintk_emit(int facility, int level,
1400 static char textbuf[LOG_LINE_MAX]; 1439 static char textbuf[LOG_LINE_MAX];
1401 char *text = textbuf; 1440 char *text = textbuf;
1402 size_t text_len; 1441 size_t text_len;
1442 enum log_flags lflags = 0;
1403 unsigned long flags; 1443 unsigned long flags;
1404 int this_cpu; 1444 int this_cpu;
1405 bool newline = false;
1406 bool prefix = false;
1407 int printed_len = 0; 1445 int printed_len = 0;
1408 1446
1409 boot_delay_msec(); 1447 boot_delay_msec();
@@ -1442,7 +1480,7 @@ asmlinkage int vprintk_emit(int facility, int level,
1442 recursion_bug = 0; 1480 recursion_bug = 0;
1443 printed_len += strlen(recursion_msg); 1481 printed_len += strlen(recursion_msg);
1444 /* emit KERN_CRIT message */ 1482 /* emit KERN_CRIT message */
1445 log_store(0, 2, LOG_DEFAULT, 0, 1483 log_store(0, 2, LOG_PREFIX|LOG_NEWLINE, 0,
1446 NULL, 0, recursion_msg, printed_len); 1484 NULL, 0, recursion_msg, printed_len);
1447 } 1485 }
1448 1486
@@ -1455,7 +1493,7 @@ asmlinkage int vprintk_emit(int facility, int level,
1455 /* mark and strip a trailing newline */ 1493 /* mark and strip a trailing newline */
1456 if (text_len && text[text_len-1] == '\n') { 1494 if (text_len && text[text_len-1] == '\n') {
1457 text_len--; 1495 text_len--;
1458 newline = true; 1496 lflags |= LOG_NEWLINE;
1459 } 1497 }
1460 1498
1461 /* strip syslog prefix and extract log level or control flags */ 1499 /* strip syslog prefix and extract log level or control flags */
@@ -1465,7 +1503,7 @@ asmlinkage int vprintk_emit(int facility, int level,
1465 if (level == -1) 1503 if (level == -1)
1466 level = text[1] - '0'; 1504 level = text[1] - '0';
1467 case 'd': /* KERN_DEFAULT */ 1505 case 'd': /* KERN_DEFAULT */
1468 prefix = true; 1506 lflags |= LOG_PREFIX;
1469 case 'c': /* KERN_CONT */ 1507 case 'c': /* KERN_CONT */
1470 text += 3; 1508 text += 3;
1471 text_len -= 3; 1509 text_len -= 3;
@@ -1475,22 +1513,20 @@ asmlinkage int vprintk_emit(int facility, int level,
1475 if (level == -1) 1513 if (level == -1)
1476 level = default_message_loglevel; 1514 level = default_message_loglevel;
1477 1515
1478 if (dict) { 1516 if (dict)
1479 prefix = true; 1517 lflags |= LOG_PREFIX|LOG_NEWLINE;
1480 newline = true;
1481 }
1482 1518
1483 if (!newline) { 1519 if (!(lflags & LOG_NEWLINE)) {
1484 /* 1520 /*
1485 * Flush the conflicting buffer. An earlier newline was missing, 1521 * Flush the conflicting buffer. An earlier newline was missing,
1486 * or another task also prints continuation lines. 1522 * or another task also prints continuation lines.
1487 */ 1523 */
1488 if (cont.len && (prefix || cont.owner != current)) 1524 if (cont.len && (lflags & LOG_PREFIX || cont.owner != current))
1489 cont_flush(); 1525 cont_flush();
1490 1526
1491 /* buffer line if possible, otherwise store it right away */ 1527 /* buffer line if possible, otherwise store it right away */
1492 if (!cont_add(facility, level, text, text_len)) 1528 if (!cont_add(facility, level, text, text_len))
1493 log_store(facility, level, LOG_DEFAULT, 0, 1529 log_store(facility, level, lflags | LOG_CONT, 0,
1494 dict, dictlen, text, text_len); 1530 dict, dictlen, text, text_len);
1495 } else { 1531 } else {
1496 bool stored = false; 1532 bool stored = false;
@@ -1502,13 +1538,13 @@ asmlinkage int vprintk_emit(int facility, int level,
1502 * flush it out and store this line separately. 1538 * flush it out and store this line separately.
1503 */ 1539 */
1504 if (cont.len && cont.owner == current) { 1540 if (cont.len && cont.owner == current) {
1505 if (!prefix) 1541 if (!(lflags & LOG_PREFIX))
1506 stored = cont_add(facility, level, text, text_len); 1542 stored = cont_add(facility, level, text, text_len);
1507 cont_flush(); 1543 cont_flush();
1508 } 1544 }
1509 1545
1510 if (!stored) 1546 if (!stored)
1511 log_store(facility, level, LOG_DEFAULT, 0, 1547 log_store(facility, level, lflags, 0,
1512 dict, dictlen, text, text_len); 1548 dict, dictlen, text, text_len);
1513 } 1549 }
1514 printed_len += text_len; 1550 printed_len += text_len;
@@ -1607,8 +1643,8 @@ static struct cont {
1607static struct log *log_from_idx(u32 idx) { return NULL; } 1643static struct log *log_from_idx(u32 idx) { return NULL; }
1608static u32 log_next(u32 idx) { return 0; } 1644static u32 log_next(u32 idx) { return 0; }
1609static void call_console_drivers(int level, const char *text, size_t len) {} 1645static void call_console_drivers(int level, const char *text, size_t len) {}
1610static size_t msg_print_text(const struct log *msg, bool syslog, 1646static size_t msg_print_text(const struct log *msg, enum log_flags prev,
1611 char *buf, size_t size) { return 0; } 1647 bool syslog, char *buf, size_t size) { return 0; }
1612static size_t cont_print_text(char *text, size_t size) { return 0; } 1648static size_t cont_print_text(char *text, size_t size) { return 0; }
1613 1649
1614#endif /* CONFIG_PRINTK */ 1650#endif /* CONFIG_PRINTK */
@@ -1884,6 +1920,7 @@ void wake_up_klogd(void)
1884/* the next printk record to write to the console */ 1920/* the next printk record to write to the console */
1885static u64 console_seq; 1921static u64 console_seq;
1886static u32 console_idx; 1922static u32 console_idx;
1923static enum log_flags console_prev;
1887 1924
1888/** 1925/**
1889 * console_unlock - unlock the console system 1926 * console_unlock - unlock the console system
@@ -1944,6 +1981,7 @@ again:
1944 /* messages are gone, move to first one */ 1981 /* messages are gone, move to first one */
1945 console_seq = log_first_seq; 1982 console_seq = log_first_seq;
1946 console_idx = log_first_idx; 1983 console_idx = log_first_idx;
1984 console_prev = 0;
1947 } 1985 }
1948skip: 1986skip:
1949 if (console_seq == log_next_seq) 1987 if (console_seq == log_next_seq)
@@ -1957,14 +1995,21 @@ skip:
1957 */ 1995 */
1958 console_idx = log_next(console_idx); 1996 console_idx = log_next(console_idx);
1959 console_seq++; 1997 console_seq++;
1998 /*
1999 * We will get here again when we register a new
2000 * CON_PRINTBUFFER console. Clear the flag so we
2001 * will properly dump everything later.
2002 */
2003 msg->flags &= ~LOG_NOCONS;
1960 goto skip; 2004 goto skip;
1961 } 2005 }
1962 2006
1963 level = msg->level; 2007 level = msg->level;
1964 len = msg_print_text(msg, false, text, sizeof(text)); 2008 len = msg_print_text(msg, console_prev, false,
1965 2009 text, sizeof(text));
1966 console_idx = log_next(console_idx); 2010 console_idx = log_next(console_idx);
1967 console_seq++; 2011 console_seq++;
2012 console_prev = msg->flags;
1968 raw_spin_unlock(&logbuf_lock); 2013 raw_spin_unlock(&logbuf_lock);
1969 2014
1970 stop_critical_timings(); /* don't trace print latency */ 2015 stop_critical_timings(); /* don't trace print latency */
@@ -2227,6 +2272,7 @@ void register_console(struct console *newcon)
2227 raw_spin_lock_irqsave(&logbuf_lock, flags); 2272 raw_spin_lock_irqsave(&logbuf_lock, flags);
2228 console_seq = syslog_seq; 2273 console_seq = syslog_seq;
2229 console_idx = syslog_idx; 2274 console_idx = syslog_idx;
2275 console_prev = syslog_prev;
2230 raw_spin_unlock_irqrestore(&logbuf_lock, flags); 2276 raw_spin_unlock_irqrestore(&logbuf_lock, flags);
2231 /* 2277 /*
2232 * We're about to replay the log buffer. Only do this to the 2278 * We're about to replay the log buffer. Only do this to the
@@ -2520,8 +2566,7 @@ bool kmsg_dump_get_line(struct kmsg_dumper *dumper, bool syslog,
2520 } 2566 }
2521 2567
2522 msg = log_from_idx(dumper->cur_idx); 2568 msg = log_from_idx(dumper->cur_idx);
2523 l = msg_print_text(msg, syslog, 2569 l = msg_print_text(msg, 0, syslog, line, size);
2524 line, size);
2525 2570
2526 dumper->cur_idx = log_next(dumper->cur_idx); 2571 dumper->cur_idx = log_next(dumper->cur_idx);
2527 dumper->cur_seq++; 2572 dumper->cur_seq++;
@@ -2561,6 +2606,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
2561 u32 idx; 2606 u32 idx;
2562 u64 next_seq; 2607 u64 next_seq;
2563 u32 next_idx; 2608 u32 next_idx;
2609 enum log_flags prev;
2564 size_t l = 0; 2610 size_t l = 0;
2565 bool ret = false; 2611 bool ret = false;
2566 2612
@@ -2583,23 +2629,27 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
2583 /* calculate length of entire buffer */ 2629 /* calculate length of entire buffer */
2584 seq = dumper->cur_seq; 2630 seq = dumper->cur_seq;
2585 idx = dumper->cur_idx; 2631 idx = dumper->cur_idx;
2632 prev = 0;
2586 while (seq < dumper->next_seq) { 2633 while (seq < dumper->next_seq) {
2587 struct log *msg = log_from_idx(idx); 2634 struct log *msg = log_from_idx(idx);
2588 2635
2589 l += msg_print_text(msg, true, NULL, 0); 2636 l += msg_print_text(msg, prev, true, NULL, 0);
2590 idx = log_next(idx); 2637 idx = log_next(idx);
2591 seq++; 2638 seq++;
2639 prev = msg->flags;
2592 } 2640 }
2593 2641
2594 /* move first record forward until length fits into the buffer */ 2642 /* move first record forward until length fits into the buffer */
2595 seq = dumper->cur_seq; 2643 seq = dumper->cur_seq;
2596 idx = dumper->cur_idx; 2644 idx = dumper->cur_idx;
2645 prev = 0;
2597 while (l > size && seq < dumper->next_seq) { 2646 while (l > size && seq < dumper->next_seq) {
2598 struct log *msg = log_from_idx(idx); 2647 struct log *msg = log_from_idx(idx);
2599 2648
2600 l -= msg_print_text(msg, true, NULL, 0); 2649 l -= msg_print_text(msg, prev, true, NULL, 0);
2601 idx = log_next(idx); 2650 idx = log_next(idx);
2602 seq++; 2651 seq++;
2652 prev = msg->flags;
2603 } 2653 }
2604 2654
2605 /* last message in next interation */ 2655 /* last message in next interation */
@@ -2607,14 +2657,14 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
2607 next_idx = idx; 2657 next_idx = idx;
2608 2658
2609 l = 0; 2659 l = 0;
2660 prev = 0;
2610 while (seq < dumper->next_seq) { 2661 while (seq < dumper->next_seq) {
2611 struct log *msg = log_from_idx(idx); 2662 struct log *msg = log_from_idx(idx);
2612 2663
2613 l += msg_print_text(msg, syslog, 2664 l += msg_print_text(msg, prev, syslog, buf + l, size - l);
2614 buf + l, size - l);
2615
2616 idx = log_next(idx); 2665 idx = log_next(idx);
2617 seq++; 2666 seq++;
2667 prev = msg->flags;
2618 } 2668 }
2619 2669
2620 dumper->next_seq = next_seq; 2670 dumper->next_seq = next_seq;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 518aea714d21..66ce41489133 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -78,7 +78,7 @@ static LIST_HEAD(free_entries);
78static DEFINE_SPINLOCK(free_entries_lock); 78static DEFINE_SPINLOCK(free_entries_lock);
79 79
80/* Global disable flag - will be set in case of an error */ 80/* Global disable flag - will be set in case of an error */
81static bool global_disable __read_mostly; 81static u32 global_disable __read_mostly;
82 82
83/* Global error count */ 83/* Global error count */
84static u32 error_count; 84static u32 error_count;
@@ -657,7 +657,7 @@ static int dma_debug_fs_init(void)
657 657
658 global_disable_dent = debugfs_create_bool("disabled", 0444, 658 global_disable_dent = debugfs_create_bool("disabled", 0444,
659 dma_debug_dent, 659 dma_debug_dent,
660 (u32 *)&global_disable); 660 &global_disable);
661 if (!global_disable_dent) 661 if (!global_disable_dent)
662 goto out_err; 662 goto out_err;
663 663