aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/cavium-octeon/cpu.c2
-rw-r--r--arch/mips/cavium-octeon/crypto/octeon-crypto.c1
-rw-r--r--arch/mips/cavium-octeon/smp.c1
-rw-r--r--arch/mips/include/asm/fpu.h1
-rw-r--r--arch/mips/kernel/smp-bmips.c1
-rw-r--r--arch/mips/kernel/smp-mt.c1
-rw-r--r--arch/mips/loongson64/loongson-3/cop2-ex.c1
-rw-r--r--arch/mips/netlogic/common/smp.c1
-rw-r--r--arch/mips/netlogic/xlp/cop2-ex.c3
-rw-r--r--arch/mips/sgi-ip22/ip28-berr.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-berr.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-berr.c1
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c1
-rw-r--r--arch/x86/pci/xen.c23
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_vsp.c8
-rw-r--r--drivers/media/platform/vsp1/vsp1_drm.c33
-rw-r--r--drivers/media/rc/lirc_dev.c4
-rw-r--r--drivers/media/rc/nuvoton-cir.c5
-rw-r--r--drivers/media/rc/rc-main.c26
-rw-r--r--drivers/media/rc/serial_ir.c123
-rw-r--r--drivers/media/usb/dvb-usb/dw2102.c244
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c1
-rw-r--r--fs/overlayfs/util.c1
-rw-r--r--include/linux/wait.h31
-rw-r--r--include/media/vsp1.h13
-rw-r--r--kernel/sched/wait.c39
-rw-r--r--mm/page_alloc.c3
-rwxr-xr-xtools/testing/ktest/ktest.pl21
29 files changed, 351 insertions, 244 deletions
diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
index a5b427909b5c..036d56cc4591 100644
--- a/arch/mips/cavium-octeon/cpu.c
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -10,7 +10,9 @@
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <linux/notifier.h> 11#include <linux/notifier.h>
12#include <linux/prefetch.h> 12#include <linux/prefetch.h>
13#include <linux/ptrace.h>
13#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/sched/task_stack.h>
14 16
15#include <asm/cop2.h> 17#include <asm/cop2.h>
16#include <asm/current.h> 18#include <asm/current.h>
diff --git a/arch/mips/cavium-octeon/crypto/octeon-crypto.c b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
index 4d22365844af..cfb4a146cf17 100644
--- a/arch/mips/cavium-octeon/crypto/octeon-crypto.c
+++ b/arch/mips/cavium-octeon/crypto/octeon-crypto.c
@@ -9,6 +9,7 @@
9#include <asm/cop2.h> 9#include <asm/cop2.h>
10#include <linux/export.h> 10#include <linux/export.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/sched/task_stack.h>
12 13
13#include "octeon-crypto.h" 14#include "octeon-crypto.h"
14 15
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 4b94b7fbafa3..3de786545ded 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -12,6 +12,7 @@
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/sched/hotplug.h> 14#include <linux/sched/hotplug.h>
15#include <linux/sched/task_stack.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/export.h> 17#include <linux/export.h>
17 18
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 321752bcbab6..f94455f964ec 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/sched/task_stack.h> 14#include <linux/sched/task_stack.h>
15#include <linux/ptrace.h>
15#include <linux/thread_info.h> 16#include <linux/thread_info.h>
16#include <linux/bitops.h> 17#include <linux/bitops.h>
17 18
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 3daa2cae50b0..1b070a76fcdd 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/sched/hotplug.h> 13#include <linux/sched/hotplug.h>
14#include <linux/sched/task_stack.h>
14#include <linux/mm.h> 15#include <linux/mm.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index e077ea3e11fb..e398cbc3d776 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irqchip/mips-gic.h> 24#include <linux/irqchip/mips-gic.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/sched/task_stack.h>
26#include <linux/smp.h> 27#include <linux/smp.h>
27 28
28#include <linux/atomic.h> 29#include <linux/atomic.h>
diff --git a/arch/mips/loongson64/loongson-3/cop2-ex.c b/arch/mips/loongson64/loongson-3/cop2-ex.c
index ea13764d0a03..621d6af5f6eb 100644
--- a/arch/mips/loongson64/loongson-3/cop2-ex.c
+++ b/arch/mips/loongson64/loongson-3/cop2-ex.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/notifier.h> 15#include <linux/notifier.h>
16#include <linux/ptrace.h>
16 17
17#include <asm/fpu.h> 18#include <asm/fpu.h>
18#include <asm/cop2.h> 19#include <asm/cop2.h>
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index 10d86d54880a..bddf1ef553a4 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -35,6 +35,7 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/sched/task_stack.h>
38#include <linux/smp.h> 39#include <linux/smp.h>
39#include <linux/irq.h> 40#include <linux/irq.h>
40 41
diff --git a/arch/mips/netlogic/xlp/cop2-ex.c b/arch/mips/netlogic/xlp/cop2-ex.c
index 52bc5de42005..21e439b3db70 100644
--- a/arch/mips/netlogic/xlp/cop2-ex.c
+++ b/arch/mips/netlogic/xlp/cop2-ex.c
@@ -9,11 +9,14 @@
9 * Copyright (C) 2009 Wind River Systems, 9 * Copyright (C) 2009 Wind River Systems,
10 * written by Ralf Baechle <ralf@linux-mips.org> 10 * written by Ralf Baechle <ralf@linux-mips.org>
11 */ 11 */
12#include <linux/capability.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/irqflags.h> 14#include <linux/irqflags.h>
14#include <linux/notifier.h> 15#include <linux/notifier.h>
15#include <linux/prefetch.h> 16#include <linux/prefetch.h>
17#include <linux/ptrace.h>
16#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/sched/task_stack.h>
17 20
18#include <asm/cop2.h> 21#include <asm/cop2.h>
19#include <asm/current.h> 22#include <asm/current.h>
diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index 1f2a5bc4779e..75460e1e106b 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/sched/debug.h> 11#include <linux/sched/debug.h>
12#include <linux/sched/signal.h>
12#include <linux/seq_file.h> 13#include <linux/seq_file.h>
13 14
14#include <asm/addrspace.h> 15#include <asm/addrspace.h>
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c
index d12879eb2b1f..83efe03d5c60 100644
--- a/arch/mips/sgi-ip27/ip27-berr.c
+++ b/arch/mips/sgi-ip27/ip27-berr.c
@@ -12,7 +12,9 @@
12#include <linux/signal.h> /* for SIGBUS */ 12#include <linux/signal.h> /* for SIGBUS */
13#include <linux/sched.h> /* schow_regs(), force_sig() */ 13#include <linux/sched.h> /* schow_regs(), force_sig() */
14#include <linux/sched/debug.h> 14#include <linux/sched/debug.h>
15#include <linux/sched/signal.h>
15 16
17#include <asm/ptrace.h>
16#include <asm/sn/addrs.h> 18#include <asm/sn/addrs.h>
17#include <asm/sn/arch.h> 19#include <asm/sn/arch.h>
18#include <asm/sn/sn0/hub.h> 20#include <asm/sn/sn0/hub.h>
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index f5ed45e8f442..4cd47d23d81a 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -8,10 +8,13 @@
8 */ 8 */
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/sched/task_stack.h>
11#include <linux/topology.h> 12#include <linux/topology.h>
12#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14
13#include <asm/page.h> 15#include <asm/page.h>
14#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/ptrace.h>
15#include <asm/sn/arch.h> 18#include <asm/sn/arch.h>
16#include <asm/sn/gda.h> 19#include <asm/sn/gda.h>
17#include <asm/sn/intr.h> 20#include <asm/sn/intr.h>
diff --git a/arch/mips/sgi-ip32/ip32-berr.c b/arch/mips/sgi-ip32/ip32-berr.c
index 57d8c7486fe6..c1f12a9cf305 100644
--- a/arch/mips/sgi-ip32/ip32-berr.c
+++ b/arch/mips/sgi-ip32/ip32-berr.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/sched/debug.h> 13#include <linux/sched/debug.h>
14#include <linux/sched/signal.h>
14#include <asm/traps.h> 15#include <asm/traps.h>
15#include <linux/uaccess.h> 16#include <linux/uaccess.h>
16#include <asm/addrspace.h> 17#include <asm/addrspace.h>
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 8bd415c8729f..b3b442def423 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/sched/signal.h>
16#include <linux/notifier.h> 17#include <linux/notifier.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/rtc/ds1685.h> 19#include <linux/rtc/ds1685.h>
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index e1fb269c87af..292ab0364a89 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -234,23 +234,14 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
234 return 1; 234 return 1;
235 235
236 for_each_pci_msi_entry(msidesc, dev) { 236 for_each_pci_msi_entry(msidesc, dev) {
237 __pci_read_msi_msg(msidesc, &msg); 237 pirq = xen_allocate_pirq_msi(dev, msidesc);
238 pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | 238 if (pirq < 0) {
239 ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff); 239 irq = -ENODEV;
240 if (msg.data != XEN_PIRQ_MSI_DATA || 240 goto error;
241 xen_irq_from_pirq(pirq) < 0) {
242 pirq = xen_allocate_pirq_msi(dev, msidesc);
243 if (pirq < 0) {
244 irq = -ENODEV;
245 goto error;
246 }
247 xen_msi_compose_msg(dev, pirq, &msg);
248 __pci_write_msi_msg(msidesc, &msg);
249 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
250 } else {
251 dev_dbg(&dev->dev,
252 "xen: msi already bound to pirq=%d\n", pirq);
253 } 241 }
242 xen_msi_compose_msg(dev, pirq, &msg);
243 __pci_write_msi_msg(msidesc, &msg);
244 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
254 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq, 245 irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
255 (type == PCI_CAP_ID_MSI) ? nvec : 1, 246 (type == PCI_CAP_ID_MSI) ? nvec : 1,
256 (type == PCI_CAP_ID_MSIX) ? 247 (type == PCI_CAP_ID_MSIX) ?
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index b5bfbe50bd87..b0ff304ce3dc 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -32,6 +32,10 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
32{ 32{
33 const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode; 33 const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode;
34 struct rcar_du_device *rcdu = crtc->group->dev; 34 struct rcar_du_device *rcdu = crtc->group->dev;
35 struct vsp1_du_lif_config cfg = {
36 .width = mode->hdisplay,
37 .height = mode->vdisplay,
38 };
35 struct rcar_du_plane_state state = { 39 struct rcar_du_plane_state state = {
36 .state = { 40 .state = {
37 .crtc = &crtc->crtc, 41 .crtc = &crtc->crtc,
@@ -66,12 +70,12 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
66 */ 70 */
67 crtc->group->need_restart = true; 71 crtc->group->need_restart = true;
68 72
69 vsp1_du_setup_lif(crtc->vsp->vsp, mode->hdisplay, mode->vdisplay); 73 vsp1_du_setup_lif(crtc->vsp->vsp, &cfg);
70} 74}
71 75
72void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) 76void rcar_du_vsp_disable(struct rcar_du_crtc *crtc)
73{ 77{
74 vsp1_du_setup_lif(crtc->vsp->vsp, 0, 0); 78 vsp1_du_setup_lif(crtc->vsp->vsp, NULL);
75} 79}
76 80
77void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) 81void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
index b4b583f7137a..b4c0f10fc3b0 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -54,12 +54,11 @@ EXPORT_SYMBOL_GPL(vsp1_du_init);
54/** 54/**
55 * vsp1_du_setup_lif - Setup the output part of the VSP pipeline 55 * vsp1_du_setup_lif - Setup the output part of the VSP pipeline
56 * @dev: the VSP device 56 * @dev: the VSP device
57 * @width: output frame width in pixels 57 * @cfg: the LIF configuration
58 * @height: output frame height in pixels
59 * 58 *
60 * Configure the output part of VSP DRM pipeline for the given frame @width and 59 * Configure the output part of VSP DRM pipeline for the given frame @cfg.width
61 * @height. This sets up formats on the BRU source pad, the WPF0 sink and source 60 * and @cfg.height. This sets up formats on the BRU source pad, the WPF0 sink
62 * pads, and the LIF sink pad. 61 * and source pads, and the LIF sink pad.
63 * 62 *
64 * As the media bus code on the BRU source pad is conditioned by the 63 * As the media bus code on the BRU source pad is conditioned by the
65 * configuration of the BRU sink 0 pad, we also set up the formats on all BRU 64 * configuration of the BRU sink 0 pad, we also set up the formats on all BRU
@@ -69,8 +68,7 @@ EXPORT_SYMBOL_GPL(vsp1_du_init);
69 * 68 *
70 * Return 0 on success or a negative error code on failure. 69 * Return 0 on success or a negative error code on failure.
71 */ 70 */
72int vsp1_du_setup_lif(struct device *dev, unsigned int width, 71int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg)
73 unsigned int height)
74{ 72{
75 struct vsp1_device *vsp1 = dev_get_drvdata(dev); 73 struct vsp1_device *vsp1 = dev_get_drvdata(dev);
76 struct vsp1_pipeline *pipe = &vsp1->drm->pipe; 74 struct vsp1_pipeline *pipe = &vsp1->drm->pipe;
@@ -79,11 +77,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
79 unsigned int i; 77 unsigned int i;
80 int ret; 78 int ret;
81 79
82 dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n", 80 if (!cfg) {
83 __func__, width, height); 81 /* NULL configuration means the CRTC is being disabled, stop
84
85 if (width == 0 || height == 0) {
86 /* Zero width or height means the CRTC is being disabled, stop
87 * the pipeline and turn the light off. 82 * the pipeline and turn the light off.
88 */ 83 */
89 ret = vsp1_pipeline_stop(pipe); 84 ret = vsp1_pipeline_stop(pipe);
@@ -108,6 +103,9 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
108 return 0; 103 return 0;
109 } 104 }
110 105
106 dev_dbg(vsp1->dev, "%s: configuring LIF with format %ux%u\n",
107 __func__, cfg->width, cfg->height);
108
111 /* Configure the format at the BRU sinks and propagate it through the 109 /* Configure the format at the BRU sinks and propagate it through the
112 * pipeline. 110 * pipeline.
113 */ 111 */
@@ -117,8 +115,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
117 for (i = 0; i < bru->entity.source_pad; ++i) { 115 for (i = 0; i < bru->entity.source_pad; ++i) {
118 format.pad = i; 116 format.pad = i;
119 117
120 format.format.width = width; 118 format.format.width = cfg->width;
121 format.format.height = height; 119 format.format.height = cfg->height;
122 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; 120 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
123 format.format.field = V4L2_FIELD_NONE; 121 format.format.field = V4L2_FIELD_NONE;
124 122
@@ -133,8 +131,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
133 } 131 }
134 132
135 format.pad = bru->entity.source_pad; 133 format.pad = bru->entity.source_pad;
136 format.format.width = width; 134 format.format.width = cfg->width;
137 format.format.height = height; 135 format.format.height = cfg->height;
138 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32; 136 format.format.code = MEDIA_BUS_FMT_ARGB8888_1X32;
139 format.format.field = V4L2_FIELD_NONE; 137 format.format.field = V4L2_FIELD_NONE;
140 138
@@ -180,7 +178,8 @@ int vsp1_du_setup_lif(struct device *dev, unsigned int width,
180 /* Verify that the format at the output of the pipeline matches the 178 /* Verify that the format at the output of the pipeline matches the
181 * requested frame size and media bus code. 179 * requested frame size and media bus code.
182 */ 180 */
183 if (format.format.width != width || format.format.height != height || 181 if (format.format.width != cfg->width ||
182 format.format.height != cfg->height ||
184 format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) { 183 format.format.code != MEDIA_BUS_FMT_ARGB8888_1X32) {
185 dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__); 184 dev_dbg(vsp1->dev, "%s: format mismatch\n", __func__);
186 return -EPIPE; 185 return -EPIPE;
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 393dccaabdd0..1688893a65bb 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -436,6 +436,8 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
436 return -ERESTARTSYS; 436 return -ERESTARTSYS;
437 437
438 ir = irctls[iminor(inode)]; 438 ir = irctls[iminor(inode)];
439 mutex_unlock(&lirc_dev_lock);
440
439 if (!ir) { 441 if (!ir) {
440 retval = -ENODEV; 442 retval = -ENODEV;
441 goto error; 443 goto error;
@@ -476,8 +478,6 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
476 } 478 }
477 479
478error: 480error:
479 mutex_unlock(&lirc_dev_lock);
480
481 nonseekable_open(inode, file); 481 nonseekable_open(inode, file);
482 482
483 return retval; 483 return retval;
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index b109f8246b96..ec4b25bd2ec2 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -176,12 +176,13 @@ static void nvt_write_wakeup_codes(struct rc_dev *dev,
176{ 176{
177 u8 tolerance, config; 177 u8 tolerance, config;
178 struct nvt_dev *nvt = dev->priv; 178 struct nvt_dev *nvt = dev->priv;
179 unsigned long flags;
179 int i; 180 int i;
180 181
181 /* hardcode the tolerance to 10% */ 182 /* hardcode the tolerance to 10% */
182 tolerance = DIV_ROUND_UP(count, 10); 183 tolerance = DIV_ROUND_UP(count, 10);
183 184
184 spin_lock(&nvt->lock); 185 spin_lock_irqsave(&nvt->lock, flags);
185 186
186 nvt_clear_cir_wake_fifo(nvt); 187 nvt_clear_cir_wake_fifo(nvt);
187 nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP); 188 nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP);
@@ -203,7 +204,7 @@ static void nvt_write_wakeup_codes(struct rc_dev *dev,
203 204
204 nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON); 205 nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
205 206
206 spin_unlock(&nvt->lock); 207 spin_unlock_irqrestore(&nvt->lock, flags);
207} 208}
208 209
209static ssize_t wakeup_data_show(struct device *dev, 210static ssize_t wakeup_data_show(struct device *dev,
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 2424946740e6..d84533699668 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1663,6 +1663,7 @@ static int rc_setup_rx_device(struct rc_dev *dev)
1663{ 1663{
1664 int rc; 1664 int rc;
1665 struct rc_map *rc_map; 1665 struct rc_map *rc_map;
1666 u64 rc_type;
1666 1667
1667 if (!dev->map_name) 1668 if (!dev->map_name)
1668 return -EINVAL; 1669 return -EINVAL;
@@ -1677,15 +1678,18 @@ static int rc_setup_rx_device(struct rc_dev *dev)
1677 if (rc) 1678 if (rc)
1678 return rc; 1679 return rc;
1679 1680
1680 if (dev->change_protocol) { 1681 rc_type = BIT_ULL(rc_map->rc_type);
1681 u64 rc_type = (1ll << rc_map->rc_type);
1682 1682
1683 if (dev->change_protocol) {
1683 rc = dev->change_protocol(dev, &rc_type); 1684 rc = dev->change_protocol(dev, &rc_type);
1684 if (rc < 0) 1685 if (rc < 0)
1685 goto out_table; 1686 goto out_table;
1686 dev->enabled_protocols = rc_type; 1687 dev->enabled_protocols = rc_type;
1687 } 1688 }
1688 1689
1690 if (dev->driver_type == RC_DRIVER_IR_RAW)
1691 ir_raw_load_modules(&rc_type);
1692
1689 set_bit(EV_KEY, dev->input_dev->evbit); 1693 set_bit(EV_KEY, dev->input_dev->evbit);
1690 set_bit(EV_REP, dev->input_dev->evbit); 1694 set_bit(EV_REP, dev->input_dev->evbit);
1691 set_bit(EV_MSC, dev->input_dev->evbit); 1695 set_bit(EV_MSC, dev->input_dev->evbit);
@@ -1777,12 +1781,6 @@ int rc_register_device(struct rc_dev *dev)
1777 dev->input_name ?: "Unspecified device", path ?: "N/A"); 1781 dev->input_name ?: "Unspecified device", path ?: "N/A");
1778 kfree(path); 1782 kfree(path);
1779 1783
1780 if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
1781 rc = rc_setup_rx_device(dev);
1782 if (rc)
1783 goto out_dev;
1784 }
1785
1786 if (dev->driver_type == RC_DRIVER_IR_RAW || 1784 if (dev->driver_type == RC_DRIVER_IR_RAW ||
1787 dev->driver_type == RC_DRIVER_IR_RAW_TX) { 1785 dev->driver_type == RC_DRIVER_IR_RAW_TX) {
1788 if (!raw_init) { 1786 if (!raw_init) {
@@ -1791,7 +1789,13 @@ int rc_register_device(struct rc_dev *dev)
1791 } 1789 }
1792 rc = ir_raw_event_register(dev); 1790 rc = ir_raw_event_register(dev);
1793 if (rc < 0) 1791 if (rc < 0)
1794 goto out_rx; 1792 goto out_dev;
1793 }
1794
1795 if (dev->driver_type != RC_DRIVER_IR_RAW_TX) {
1796 rc = rc_setup_rx_device(dev);
1797 if (rc)
1798 goto out_raw;
1795 } 1799 }
1796 1800
1797 /* Allow the RC sysfs nodes to be accessible */ 1801 /* Allow the RC sysfs nodes to be accessible */
@@ -1803,8 +1807,8 @@ int rc_register_device(struct rc_dev *dev)
1803 1807
1804 return 0; 1808 return 0;
1805 1809
1806out_rx: 1810out_raw:
1807 rc_free_rx_device(dev); 1811 ir_raw_event_unregister(dev);
1808out_dev: 1812out_dev:
1809 device_del(&dev->dev); 1813 device_del(&dev->dev);
1810out_unlock: 1814out_unlock:
diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index 923fb2299553..41b54e40176c 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -487,10 +487,69 @@ static void serial_ir_timeout(unsigned long arg)
487 ir_raw_event_handle(serial_ir.rcdev); 487 ir_raw_event_handle(serial_ir.rcdev);
488} 488}
489 489
490/* Needed by serial_ir_probe() */
491static int serial_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
492 unsigned int count);
493static int serial_ir_tx_duty_cycle(struct rc_dev *dev, u32 cycle);
494static int serial_ir_tx_carrier(struct rc_dev *dev, u32 carrier);
495static int serial_ir_open(struct rc_dev *rcdev);
496static void serial_ir_close(struct rc_dev *rcdev);
497
490static int serial_ir_probe(struct platform_device *dev) 498static int serial_ir_probe(struct platform_device *dev)
491{ 499{
500 struct rc_dev *rcdev;
492 int i, nlow, nhigh, result; 501 int i, nlow, nhigh, result;
493 502
503 rcdev = devm_rc_allocate_device(&dev->dev, RC_DRIVER_IR_RAW);
504 if (!rcdev)
505 return -ENOMEM;
506
507 if (hardware[type].send_pulse && hardware[type].send_space)
508 rcdev->tx_ir = serial_ir_tx;
509 if (hardware[type].set_send_carrier)
510 rcdev->s_tx_carrier = serial_ir_tx_carrier;
511 if (hardware[type].set_duty_cycle)
512 rcdev->s_tx_duty_cycle = serial_ir_tx_duty_cycle;
513
514 switch (type) {
515 case IR_HOMEBREW:
516 rcdev->input_name = "Serial IR type home-brew";
517 break;
518 case IR_IRDEO:
519 rcdev->input_name = "Serial IR type IRdeo";
520 break;
521 case IR_IRDEO_REMOTE:
522 rcdev->input_name = "Serial IR type IRdeo remote";
523 break;
524 case IR_ANIMAX:
525 rcdev->input_name = "Serial IR type AnimaX";
526 break;
527 case IR_IGOR:
528 rcdev->input_name = "Serial IR type IgorPlug";
529 break;
530 }
531
532 rcdev->input_phys = KBUILD_MODNAME "/input0";
533 rcdev->input_id.bustype = BUS_HOST;
534 rcdev->input_id.vendor = 0x0001;
535 rcdev->input_id.product = 0x0001;
536 rcdev->input_id.version = 0x0100;
537 rcdev->open = serial_ir_open;
538 rcdev->close = serial_ir_close;
539 rcdev->dev.parent = &serial_ir.pdev->dev;
540 rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
541 rcdev->driver_name = KBUILD_MODNAME;
542 rcdev->map_name = RC_MAP_RC6_MCE;
543 rcdev->min_timeout = 1;
544 rcdev->timeout = IR_DEFAULT_TIMEOUT;
545 rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
546 rcdev->rx_resolution = 250000;
547
548 serial_ir.rcdev = rcdev;
549
550 setup_timer(&serial_ir.timeout_timer, serial_ir_timeout,
551 (unsigned long)&serial_ir);
552
494 result = devm_request_irq(&dev->dev, irq, serial_ir_irq_handler, 553 result = devm_request_irq(&dev->dev, irq, serial_ir_irq_handler,
495 share_irq ? IRQF_SHARED : 0, 554 share_irq ? IRQF_SHARED : 0,
496 KBUILD_MODNAME, &hardware); 555 KBUILD_MODNAME, &hardware);
@@ -516,9 +575,6 @@ static int serial_ir_probe(struct platform_device *dev)
516 return -EBUSY; 575 return -EBUSY;
517 } 576 }
518 577
519 setup_timer(&serial_ir.timeout_timer, serial_ir_timeout,
520 (unsigned long)&serial_ir);
521
522 result = hardware_init_port(); 578 result = hardware_init_port();
523 if (result < 0) 579 if (result < 0)
524 return result; 580 return result;
@@ -552,7 +608,8 @@ static int serial_ir_probe(struct platform_device *dev)
552 sense ? "low" : "high"); 608 sense ? "low" : "high");
553 609
554 dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io); 610 dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
555 return 0; 611
612 return devm_rc_register_device(&dev->dev, rcdev);
556} 613}
557 614
558static int serial_ir_open(struct rc_dev *rcdev) 615static int serial_ir_open(struct rc_dev *rcdev)
@@ -723,7 +780,6 @@ static void serial_ir_exit(void)
723 780
724static int __init serial_ir_init_module(void) 781static int __init serial_ir_init_module(void)
725{ 782{
726 struct rc_dev *rcdev;
727 int result; 783 int result;
728 784
729 switch (type) { 785 switch (type) {
@@ -754,63 +810,9 @@ static int __init serial_ir_init_module(void)
754 sense = !!sense; 810 sense = !!sense;
755 811
756 result = serial_ir_init(); 812 result = serial_ir_init();
757 if (result)
758 return result;
759
760 rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev, RC_DRIVER_IR_RAW);
761 if (!rcdev) {
762 result = -ENOMEM;
763 goto serial_cleanup;
764 }
765
766 if (hardware[type].send_pulse && hardware[type].send_space)
767 rcdev->tx_ir = serial_ir_tx;
768 if (hardware[type].set_send_carrier)
769 rcdev->s_tx_carrier = serial_ir_tx_carrier;
770 if (hardware[type].set_duty_cycle)
771 rcdev->s_tx_duty_cycle = serial_ir_tx_duty_cycle;
772
773 switch (type) {
774 case IR_HOMEBREW:
775 rcdev->input_name = "Serial IR type home-brew";
776 break;
777 case IR_IRDEO:
778 rcdev->input_name = "Serial IR type IRdeo";
779 break;
780 case IR_IRDEO_REMOTE:
781 rcdev->input_name = "Serial IR type IRdeo remote";
782 break;
783 case IR_ANIMAX:
784 rcdev->input_name = "Serial IR type AnimaX";
785 break;
786 case IR_IGOR:
787 rcdev->input_name = "Serial IR type IgorPlug";
788 break;
789 }
790
791 rcdev->input_phys = KBUILD_MODNAME "/input0";
792 rcdev->input_id.bustype = BUS_HOST;
793 rcdev->input_id.vendor = 0x0001;
794 rcdev->input_id.product = 0x0001;
795 rcdev->input_id.version = 0x0100;
796 rcdev->open = serial_ir_open;
797 rcdev->close = serial_ir_close;
798 rcdev->dev.parent = &serial_ir.pdev->dev;
799 rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
800 rcdev->driver_name = KBUILD_MODNAME;
801 rcdev->map_name = RC_MAP_RC6_MCE;
802 rcdev->min_timeout = 1;
803 rcdev->timeout = IR_DEFAULT_TIMEOUT;
804 rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
805 rcdev->rx_resolution = 250000;
806
807 serial_ir.rcdev = rcdev;
808
809 result = rc_register_device(rcdev);
810
811 if (!result) 813 if (!result)
812 return 0; 814 return 0;
813serial_cleanup: 815
814 serial_ir_exit(); 816 serial_ir_exit();
815 return result; 817 return result;
816} 818}
@@ -818,7 +820,6 @@ serial_cleanup:
818static void __exit serial_ir_exit_module(void) 820static void __exit serial_ir_exit_module(void)
819{ 821{
820 del_timer_sync(&serial_ir.timeout_timer); 822 del_timer_sync(&serial_ir.timeout_timer);
821 rc_unregister_device(serial_ir.rcdev);
822 serial_ir_exit(); 823 serial_ir_exit();
823} 824}
824 825
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index 6ca502d834b4..4f42d57f81d9 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -68,6 +68,7 @@
68struct dw2102_state { 68struct dw2102_state {
69 u8 initialized; 69 u8 initialized;
70 u8 last_lock; 70 u8 last_lock;
71 u8 data[MAX_XFER_SIZE + 4];
71 struct i2c_client *i2c_client_demod; 72 struct i2c_client *i2c_client_demod;
72 struct i2c_client *i2c_client_tuner; 73 struct i2c_client *i2c_client_tuner;
73 74
@@ -661,62 +662,72 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
661 int num) 662 int num)
662{ 663{
663 struct dvb_usb_device *d = i2c_get_adapdata(adap); 664 struct dvb_usb_device *d = i2c_get_adapdata(adap);
664 u8 obuf[0x40], ibuf[0x40]; 665 struct dw2102_state *state;
665 666
666 if (!d) 667 if (!d)
667 return -ENODEV; 668 return -ENODEV;
669
670 state = d->priv;
671
668 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) 672 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
669 return -EAGAIN; 673 return -EAGAIN;
674 if (mutex_lock_interruptible(&d->data_mutex) < 0) {
675 mutex_unlock(&d->i2c_mutex);
676 return -EAGAIN;
677 }
670 678
671 switch (num) { 679 switch (num) {
672 case 1: 680 case 1:
673 switch (msg[0].addr) { 681 switch (msg[0].addr) {
674 case SU3000_STREAM_CTRL: 682 case SU3000_STREAM_CTRL:
675 obuf[0] = msg[0].buf[0] + 0x36; 683 state->data[0] = msg[0].buf[0] + 0x36;
676 obuf[1] = 3; 684 state->data[1] = 3;
677 obuf[2] = 0; 685 state->data[2] = 0;
678 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0) 686 if (dvb_usb_generic_rw(d, state->data, 3,
687 state->data, 0, 0) < 0)
679 err("i2c transfer failed."); 688 err("i2c transfer failed.");
680 break; 689 break;
681 case DW2102_RC_QUERY: 690 case DW2102_RC_QUERY:
682 obuf[0] = 0x10; 691 state->data[0] = 0x10;
683 if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0) 692 if (dvb_usb_generic_rw(d, state->data, 1,
693 state->data, 2, 0) < 0)
684 err("i2c transfer failed."); 694 err("i2c transfer failed.");
685 msg[0].buf[1] = ibuf[0]; 695 msg[0].buf[1] = state->data[0];
686 msg[0].buf[0] = ibuf[1]; 696 msg[0].buf[0] = state->data[1];
687 break; 697 break;
688 default: 698 default:
689 /* always i2c write*/ 699 /* always i2c write*/
690 obuf[0] = 0x08; 700 state->data[0] = 0x08;
691 obuf[1] = msg[0].addr; 701 state->data[1] = msg[0].addr;
692 obuf[2] = msg[0].len; 702 state->data[2] = msg[0].len;
693 703
694 memcpy(&obuf[3], msg[0].buf, msg[0].len); 704 memcpy(&state->data[3], msg[0].buf, msg[0].len);
695 705
696 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3, 706 if (dvb_usb_generic_rw(d, state->data, msg[0].len + 3,
697 ibuf, 1, 0) < 0) 707 state->data, 1, 0) < 0)
698 err("i2c transfer failed."); 708 err("i2c transfer failed.");
699 709
700 } 710 }
701 break; 711 break;
702 case 2: 712 case 2:
703 /* always i2c read */ 713 /* always i2c read */
704 obuf[0] = 0x09; 714 state->data[0] = 0x09;
705 obuf[1] = msg[0].len; 715 state->data[1] = msg[0].len;
706 obuf[2] = msg[1].len; 716 state->data[2] = msg[1].len;
707 obuf[3] = msg[0].addr; 717 state->data[3] = msg[0].addr;
708 memcpy(&obuf[4], msg[0].buf, msg[0].len); 718 memcpy(&state->data[4], msg[0].buf, msg[0].len);
709 719
710 if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4, 720 if (dvb_usb_generic_rw(d, state->data, msg[0].len + 4,
711 ibuf, msg[1].len + 1, 0) < 0) 721 state->data, msg[1].len + 1, 0) < 0)
712 err("i2c transfer failed."); 722 err("i2c transfer failed.");
713 723
714 memcpy(msg[1].buf, &ibuf[1], msg[1].len); 724 memcpy(msg[1].buf, &state->data[1], msg[1].len);
715 break; 725 break;
716 default: 726 default:
717 warn("more than 2 i2c messages at a time is not handled yet."); 727 warn("more than 2 i2c messages at a time is not handled yet.");
718 break; 728 break;
719 } 729 }
730 mutex_unlock(&d->data_mutex);
720 mutex_unlock(&d->i2c_mutex); 731 mutex_unlock(&d->i2c_mutex);
721 return num; 732 return num;
722} 733}
@@ -844,17 +855,23 @@ static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
844static int su3000_power_ctrl(struct dvb_usb_device *d, int i) 855static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
845{ 856{
846 struct dw2102_state *state = (struct dw2102_state *)d->priv; 857 struct dw2102_state *state = (struct dw2102_state *)d->priv;
847 u8 obuf[] = {0xde, 0}; 858 int ret = 0;
848 859
849 info("%s: %d, initialized %d", __func__, i, state->initialized); 860 info("%s: %d, initialized %d", __func__, i, state->initialized);
850 861
851 if (i && !state->initialized) { 862 if (i && !state->initialized) {
863 mutex_lock(&d->data_mutex);
864
865 state->data[0] = 0xde;
866 state->data[1] = 0;
867
852 state->initialized = 1; 868 state->initialized = 1;
853 /* reset board */ 869 /* reset board */
854 return dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0); 870 ret = dvb_usb_generic_rw(d, state->data, 2, NULL, 0, 0);
871 mutex_unlock(&d->data_mutex);
855 } 872 }
856 873
857 return 0; 874 return ret;
858} 875}
859 876
860static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6]) 877static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
@@ -1309,49 +1326,57 @@ static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
1309 return 0; 1326 return 0;
1310} 1327}
1311 1328
1312static int su3000_frontend_attach(struct dvb_usb_adapter *d) 1329static int su3000_frontend_attach(struct dvb_usb_adapter *adap)
1313{ 1330{
1314 u8 obuf[3] = { 0xe, 0x80, 0 }; 1331 struct dvb_usb_device *d = adap->dev;
1315 u8 ibuf[] = { 0 }; 1332 struct dw2102_state *state = d->priv;
1333
1334 mutex_lock(&d->data_mutex);
1335
1336 state->data[0] = 0xe;
1337 state->data[1] = 0x80;
1338 state->data[2] = 0;
1316 1339
1317 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1340 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1318 err("command 0x0e transfer failed."); 1341 err("command 0x0e transfer failed.");
1319 1342
1320 obuf[0] = 0xe; 1343 state->data[0] = 0xe;
1321 obuf[1] = 0x02; 1344 state->data[1] = 0x02;
1322 obuf[2] = 1; 1345 state->data[2] = 1;
1323 1346
1324 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1347 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1325 err("command 0x0e transfer failed."); 1348 err("command 0x0e transfer failed.");
1326 msleep(300); 1349 msleep(300);
1327 1350
1328 obuf[0] = 0xe; 1351 state->data[0] = 0xe;
1329 obuf[1] = 0x83; 1352 state->data[1] = 0x83;
1330 obuf[2] = 0; 1353 state->data[2] = 0;
1331 1354
1332 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1355 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1333 err("command 0x0e transfer failed."); 1356 err("command 0x0e transfer failed.");
1334 1357
1335 obuf[0] = 0xe; 1358 state->data[0] = 0xe;
1336 obuf[1] = 0x83; 1359 state->data[1] = 0x83;
1337 obuf[2] = 1; 1360 state->data[2] = 1;
1338 1361
1339 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1362 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1340 err("command 0x0e transfer failed."); 1363 err("command 0x0e transfer failed.");
1341 1364
1342 obuf[0] = 0x51; 1365 state->data[0] = 0x51;
1343 1366
1344 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) 1367 if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1345 err("command 0x51 transfer failed."); 1368 err("command 0x51 transfer failed.");
1346 1369
1347 d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config, 1370 mutex_unlock(&d->data_mutex);
1348 &d->dev->i2c_adap); 1371
1349 if (d->fe_adap[0].fe == NULL) 1372 adap->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
1373 &d->i2c_adap);
1374 if (adap->fe_adap[0].fe == NULL)
1350 return -EIO; 1375 return -EIO;
1351 1376
1352 if (dvb_attach(ts2020_attach, d->fe_adap[0].fe, 1377 if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
1353 &dw2104_ts2020_config, 1378 &dw2104_ts2020_config,
1354 &d->dev->i2c_adap)) { 1379 &d->i2c_adap)) {
1355 info("Attached DS3000/TS2020!"); 1380 info("Attached DS3000/TS2020!");
1356 return 0; 1381 return 0;
1357 } 1382 }
@@ -1360,47 +1385,55 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
1360 return -EIO; 1385 return -EIO;
1361} 1386}
1362 1387
1363static int t220_frontend_attach(struct dvb_usb_adapter *d) 1388static int t220_frontend_attach(struct dvb_usb_adapter *adap)
1364{ 1389{
1365 u8 obuf[3] = { 0xe, 0x87, 0 }; 1390 struct dvb_usb_device *d = adap->dev;
1366 u8 ibuf[] = { 0 }; 1391 struct dw2102_state *state = d->priv;
1392
1393 mutex_lock(&d->data_mutex);
1367 1394
1368 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1395 state->data[0] = 0xe;
1396 state->data[1] = 0x87;
1397 state->data[2] = 0x0;
1398
1399 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1369 err("command 0x0e transfer failed."); 1400 err("command 0x0e transfer failed.");
1370 1401
1371 obuf[0] = 0xe; 1402 state->data[0] = 0xe;
1372 obuf[1] = 0x86; 1403 state->data[1] = 0x86;
1373 obuf[2] = 1; 1404 state->data[2] = 1;
1374 1405
1375 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1406 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1376 err("command 0x0e transfer failed."); 1407 err("command 0x0e transfer failed.");
1377 1408
1378 obuf[0] = 0xe; 1409 state->data[0] = 0xe;
1379 obuf[1] = 0x80; 1410 state->data[1] = 0x80;
1380 obuf[2] = 0; 1411 state->data[2] = 0;
1381 1412
1382 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1413 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1383 err("command 0x0e transfer failed."); 1414 err("command 0x0e transfer failed.");
1384 1415
1385 msleep(50); 1416 msleep(50);
1386 1417
1387 obuf[0] = 0xe; 1418 state->data[0] = 0xe;
1388 obuf[1] = 0x80; 1419 state->data[1] = 0x80;
1389 obuf[2] = 1; 1420 state->data[2] = 1;
1390 1421
1391 if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0) 1422 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1392 err("command 0x0e transfer failed."); 1423 err("command 0x0e transfer failed.");
1393 1424
1394 obuf[0] = 0x51; 1425 state->data[0] = 0x51;
1395 1426
1396 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) 1427 if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1397 err("command 0x51 transfer failed."); 1428 err("command 0x51 transfer failed.");
1398 1429
1399 d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config, 1430 mutex_unlock(&d->data_mutex);
1400 &d->dev->i2c_adap, NULL); 1431
1401 if (d->fe_adap[0].fe != NULL) { 1432 adap->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
1402 if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60, 1433 &d->i2c_adap, NULL);
1403 &d->dev->i2c_adap, &tda18271_config)) { 1434 if (adap->fe_adap[0].fe != NULL) {
1435 if (dvb_attach(tda18271_attach, adap->fe_adap[0].fe, 0x60,
1436 &d->i2c_adap, &tda18271_config)) {
1404 info("Attached TDA18271HD/CXD2820R!"); 1437 info("Attached TDA18271HD/CXD2820R!");
1405 return 0; 1438 return 0;
1406 } 1439 }
@@ -1410,23 +1443,30 @@ static int t220_frontend_attach(struct dvb_usb_adapter *d)
1410 return -EIO; 1443 return -EIO;
1411} 1444}
1412 1445
1413static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d) 1446static int m88rs2000_frontend_attach(struct dvb_usb_adapter *adap)
1414{ 1447{
1415 u8 obuf[] = { 0x51 }; 1448 struct dvb_usb_device *d = adap->dev;
1416 u8 ibuf[] = { 0 }; 1449 struct dw2102_state *state = d->priv;
1450
1451 mutex_lock(&d->data_mutex);
1417 1452
1418 if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0) 1453 state->data[0] = 0x51;
1454
1455 if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1419 err("command 0x51 transfer failed."); 1456 err("command 0x51 transfer failed.");
1420 1457
1421 d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config, 1458 mutex_unlock(&d->data_mutex);
1422 &d->dev->i2c_adap);
1423 1459
1424 if (d->fe_adap[0].fe == NULL) 1460 adap->fe_adap[0].fe = dvb_attach(m88rs2000_attach,
1461 &s421_m88rs2000_config,
1462 &d->i2c_adap);
1463
1464 if (adap->fe_adap[0].fe == NULL)
1425 return -EIO; 1465 return -EIO;
1426 1466
1427 if (dvb_attach(ts2020_attach, d->fe_adap[0].fe, 1467 if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
1428 &dw2104_ts2020_config, 1468 &dw2104_ts2020_config,
1429 &d->dev->i2c_adap)) { 1469 &d->i2c_adap)) {
1430 info("Attached RS2000/TS2020!"); 1470 info("Attached RS2000/TS2020!");
1431 return 0; 1471 return 0;
1432 } 1472 }
@@ -1439,44 +1479,50 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
1439{ 1479{
1440 struct dvb_usb_device *d = adap->dev; 1480 struct dvb_usb_device *d = adap->dev;
1441 struct dw2102_state *state = d->priv; 1481 struct dw2102_state *state = d->priv;
1442 u8 obuf[3] = { 0xe, 0x80, 0 };
1443 u8 ibuf[] = { 0 };
1444 struct i2c_adapter *i2c_adapter; 1482 struct i2c_adapter *i2c_adapter;
1445 struct i2c_client *client; 1483 struct i2c_client *client;
1446 struct i2c_board_info board_info; 1484 struct i2c_board_info board_info;
1447 struct m88ds3103_platform_data m88ds3103_pdata = {}; 1485 struct m88ds3103_platform_data m88ds3103_pdata = {};
1448 struct ts2020_config ts2020_config = {}; 1486 struct ts2020_config ts2020_config = {};
1449 1487
1450 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) 1488 mutex_lock(&d->data_mutex);
1489
1490 state->data[0] = 0xe;
1491 state->data[1] = 0x80;
1492 state->data[2] = 0x0;
1493
1494 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1451 err("command 0x0e transfer failed."); 1495 err("command 0x0e transfer failed.");
1452 1496
1453 obuf[0] = 0xe; 1497 state->data[0] = 0xe;
1454 obuf[1] = 0x02; 1498 state->data[1] = 0x02;
1455 obuf[2] = 1; 1499 state->data[2] = 1;
1456 1500
1457 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) 1501 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1458 err("command 0x0e transfer failed."); 1502 err("command 0x0e transfer failed.");
1459 msleep(300); 1503 msleep(300);
1460 1504
1461 obuf[0] = 0xe; 1505 state->data[0] = 0xe;
1462 obuf[1] = 0x83; 1506 state->data[1] = 0x83;
1463 obuf[2] = 0; 1507 state->data[2] = 0;
1464 1508
1465 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) 1509 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1466 err("command 0x0e transfer failed."); 1510 err("command 0x0e transfer failed.");
1467 1511
1468 obuf[0] = 0xe; 1512 state->data[0] = 0xe;
1469 obuf[1] = 0x83; 1513 state->data[1] = 0x83;
1470 obuf[2] = 1; 1514 state->data[2] = 1;
1471 1515
1472 if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0) 1516 if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1473 err("command 0x0e transfer failed."); 1517 err("command 0x0e transfer failed.");
1474 1518
1475 obuf[0] = 0x51; 1519 state->data[0] = 0x51;
1476 1520
1477 if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0) 1521 if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1478 err("command 0x51 transfer failed."); 1522 err("command 0x51 transfer failed.");
1479 1523
1524 mutex_unlock(&d->data_mutex);
1525
1480 /* attach demod */ 1526 /* attach demod */
1481 m88ds3103_pdata.clk = 27000000; 1527 m88ds3103_pdata.clk = 27000000;
1482 m88ds3103_pdata.i2c_wr_max = 33; 1528 m88ds3103_pdata.i2c_wr_max = 33;
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 4d343eed08f5..1f4733b80c87 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -55,7 +55,6 @@
55#include <linux/string.h> 55#include <linux/string.h>
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <linux/miscdevice.h> 57#include <linux/miscdevice.h>
58#include <linux/init.h>
59 58
60#include <xen/xenbus.h> 59#include <xen/xenbus.h>
61#include <xen/xen.h> 60#include <xen/xen.h>
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 1953986ee6bc..6e610a205e15 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -12,7 +12,6 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/cred.h> 13#include <linux/cred.h>
14#include <linux/xattr.h> 14#include <linux/xattr.h>
15#include <linux/sched/signal.h>
16#include "overlayfs.h" 15#include "overlayfs.h"
17#include "ovl_entry.h" 16#include "ovl_entry.h"
18 17
diff --git a/include/linux/wait.h b/include/linux/wait.h
index aacb1282d19a..db076ca7f11d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -620,30 +620,19 @@ do { \
620 __ret; \ 620 __ret; \
621}) 621})
622 622
623extern int do_wait_intr(wait_queue_head_t *, wait_queue_t *);
624extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_t *);
623 625
624#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \ 626#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
625({ \ 627({ \
626 int __ret = 0; \ 628 int __ret; \
627 DEFINE_WAIT(__wait); \ 629 DEFINE_WAIT(__wait); \
628 if (exclusive) \ 630 if (exclusive) \
629 __wait.flags |= WQ_FLAG_EXCLUSIVE; \ 631 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
630 do { \ 632 do { \
631 if (likely(list_empty(&__wait.task_list))) \ 633 __ret = fn(&(wq), &__wait); \
632 __add_wait_queue_tail(&(wq), &__wait); \ 634 if (__ret) \
633 set_current_state(TASK_INTERRUPTIBLE); \
634 if (signal_pending(current)) { \
635 __ret = -ERESTARTSYS; \
636 break; \ 635 break; \
637 } \
638 if (irq) \
639 spin_unlock_irq(&(wq).lock); \
640 else \
641 spin_unlock(&(wq).lock); \
642 schedule(); \
643 if (irq) \
644 spin_lock_irq(&(wq).lock); \
645 else \
646 spin_lock(&(wq).lock); \
647 } while (!(condition)); \ 636 } while (!(condition)); \
648 __remove_wait_queue(&(wq), &__wait); \ 637 __remove_wait_queue(&(wq), &__wait); \
649 __set_current_state(TASK_RUNNING); \ 638 __set_current_state(TASK_RUNNING); \
@@ -676,7 +665,7 @@ do { \
676 */ 665 */
677#define wait_event_interruptible_locked(wq, condition) \ 666#define wait_event_interruptible_locked(wq, condition) \
678 ((condition) \ 667 ((condition) \
679 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0)) 668 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr))
680 669
681/** 670/**
682 * wait_event_interruptible_locked_irq - sleep until a condition gets true 671 * wait_event_interruptible_locked_irq - sleep until a condition gets true
@@ -703,7 +692,7 @@ do { \
703 */ 692 */
704#define wait_event_interruptible_locked_irq(wq, condition) \ 693#define wait_event_interruptible_locked_irq(wq, condition) \
705 ((condition) \ 694 ((condition) \
706 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1)) 695 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq))
707 696
708/** 697/**
709 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true 698 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
@@ -734,7 +723,7 @@ do { \
734 */ 723 */
735#define wait_event_interruptible_exclusive_locked(wq, condition) \ 724#define wait_event_interruptible_exclusive_locked(wq, condition) \
736 ((condition) \ 725 ((condition) \
737 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0)) 726 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
738 727
739/** 728/**
740 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true 729 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
@@ -765,7 +754,7 @@ do { \
765 */ 754 */
766#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \ 755#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
767 ((condition) \ 756 ((condition) \
768 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) 757 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
769 758
770 759
771#define __wait_event_killable(wq, condition) \ 760#define __wait_event_killable(wq, condition) \
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 458b400373d4..38aac554dbba 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -20,8 +20,17 @@ struct device;
20 20
21int vsp1_du_init(struct device *dev); 21int vsp1_du_init(struct device *dev);
22 22
23int vsp1_du_setup_lif(struct device *dev, unsigned int width, 23/**
24 unsigned int height); 24 * struct vsp1_du_lif_config - VSP LIF configuration
25 * @width: output frame width
26 * @height: output frame height
27 */
28struct vsp1_du_lif_config {
29 unsigned int width;
30 unsigned int height;
31};
32
33int vsp1_du_setup_lif(struct device *dev, const struct vsp1_du_lif_config *cfg);
25 34
26struct vsp1_du_atomic_config { 35struct vsp1_du_atomic_config {
27 u32 pixelformat; 36 u32 pixelformat;
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 4d2ea6f25568..b8c84c6dee64 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -242,6 +242,45 @@ long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state)
242} 242}
243EXPORT_SYMBOL(prepare_to_wait_event); 243EXPORT_SYMBOL(prepare_to_wait_event);
244 244
245/*
246 * Note! These two wait functions are entered with the
247 * wait-queue lock held (and interrupts off in the _irq
248 * case), so there is no race with testing the wakeup
249 * condition in the caller before they add the wait
250 * entry to the wake queue.
251 */
252int do_wait_intr(wait_queue_head_t *wq, wait_queue_t *wait)
253{
254 if (likely(list_empty(&wait->task_list)))
255 __add_wait_queue_tail(wq, wait);
256
257 set_current_state(TASK_INTERRUPTIBLE);
258 if (signal_pending(current))
259 return -ERESTARTSYS;
260
261 spin_unlock(&wq->lock);
262 schedule();
263 spin_lock(&wq->lock);
264 return 0;
265}
266EXPORT_SYMBOL(do_wait_intr);
267
268int do_wait_intr_irq(wait_queue_head_t *wq, wait_queue_t *wait)
269{
270 if (likely(list_empty(&wait->task_list)))
271 __add_wait_queue_tail(wq, wait);
272
273 set_current_state(TASK_INTERRUPTIBLE);
274 if (signal_pending(current))
275 return -ERESTARTSYS;
276
277 spin_unlock_irq(&wq->lock);
278 schedule();
279 spin_lock_irq(&wq->lock);
280 return 0;
281}
282EXPORT_SYMBOL(do_wait_intr_irq);
283
245/** 284/**
246 * finish_wait - clean up after waiting in a queue 285 * finish_wait - clean up after waiting in a queue
247 * @q: waitqueue waited on 286 * @q: waitqueue waited on
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eaa64d2ffdc5..6cbde310abed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -873,7 +873,8 @@ done_merging:
873 higher_page = page + (combined_pfn - pfn); 873 higher_page = page + (combined_pfn - pfn);
874 buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1); 874 buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1);
875 higher_buddy = higher_page + (buddy_pfn - combined_pfn); 875 higher_buddy = higher_page + (buddy_pfn - combined_pfn);
876 if (page_is_buddy(higher_page, higher_buddy, order + 1)) { 876 if (pfn_valid_within(buddy_pfn) &&
877 page_is_buddy(higher_page, higher_buddy, order + 1)) {
877 list_add_tail(&page->lru, 878 list_add_tail(&page->lru,
878 &zone->free_area[order].free_list[migratetype]); 879 &zone->free_area[order].free_list[migratetype]);
879 goto out; 880 goto out;
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 6e4eb2fc2d1e..0c8b61f8398e 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1880,6 +1880,7 @@ sub get_grub_index {
1880sub wait_for_input 1880sub wait_for_input
1881{ 1881{
1882 my ($fp, $time) = @_; 1882 my ($fp, $time) = @_;
1883 my $start_time;
1883 my $rin; 1884 my $rin;
1884 my $rout; 1885 my $rout;
1885 my $nr; 1886 my $nr;
@@ -1895,17 +1896,22 @@ sub wait_for_input
1895 vec($rin, fileno($fp), 1) = 1; 1896 vec($rin, fileno($fp), 1) = 1;
1896 vec($rin, fileno(\*STDIN), 1) = 1; 1897 vec($rin, fileno(\*STDIN), 1) = 1;
1897 1898
1899 $start_time = time;
1900
1898 while (1) { 1901 while (1) {
1899 $nr = select($rout=$rin, undef, undef, $time); 1902 $nr = select($rout=$rin, undef, undef, $time);
1900 1903
1901 if ($nr <= 0) { 1904 last if ($nr <= 0);
1902 return undef;
1903 }
1904 1905
1905 # copy data from stdin to the console 1906 # copy data from stdin to the console
1906 if (vec($rout, fileno(\*STDIN), 1) == 1) { 1907 if (vec($rout, fileno(\*STDIN), 1) == 1) {
1907 sysread(\*STDIN, $buf, 1000); 1908 $nr = sysread(\*STDIN, $buf, 1000);
1908 syswrite($fp, $buf, 1000); 1909 syswrite($fp, $buf, $nr) if ($nr > 0);
1910 }
1911
1912 # The timeout is based on time waiting for the fp data
1913 if (vec($rout, fileno($fp), 1) != 1) {
1914 last if (defined($time) && (time - $start_time > $time));
1909 next; 1915 next;
1910 } 1916 }
1911 1917
@@ -1917,12 +1923,11 @@ sub wait_for_input
1917 last if ($ch eq "\n"); 1923 last if ($ch eq "\n");
1918 } 1924 }
1919 1925
1920 if (!length($line)) { 1926 last if (!length($line));
1921 return undef;
1922 }
1923 1927
1924 return $line; 1928 return $line;
1925 } 1929 }
1930 return undef;
1926} 1931}
1927 1932
1928sub reboot_to { 1933sub reboot_to {