aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/compressed/head.S14
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/mips/kernel/setup.c26
-rw-r--r--arch/mips/lib/mips-atomic.c8
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pe.c2
-rw-r--r--arch/powerpc/platforms/pseries/msi.c3
-rw-r--r--drivers/atm/ambassador.c1
-rw-r--r--drivers/media/dvb-frontends/stv0900_core.c6
-rw-r--r--drivers/media/i2c/adv7604.c377
-rw-r--r--drivers/media/i2c/soc_camera/mt9v022.c11
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-core.c6
-rw-r--r--drivers/media/platform/omap3isp/ispccdc.c4
-rw-r--r--drivers/media/platform/omap3isp/ispstat.c4
-rw-r--r--drivers/media/platform/omap3isp/ispstat.h4
-rw-r--r--drivers/media/platform/omap3isp/ispvideo.c2
-rw-r--r--drivers/media/platform/s5p-fimc/Kconfig1
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-capture.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-lite.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-mdevice.c41
-rw-r--r--drivers/media/platform/sh_vou.c3
-rw-r--r--drivers/media/platform/soc_camera/mx1_camera.c9
-rw-r--r--drivers/media/platform/soc_camera/mx2_camera.c13
-rw-r--r--drivers/media/platform/soc_camera/mx3_camera.c5
-rw-r--r--drivers/media/platform/soc_camera/omap1_camera.c4
-rw-r--r--drivers/media/platform/soc_camera/pxa_camera.c4
-rw-r--r--drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c13
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c11
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c4
-rw-r--r--drivers/mfd/arizona-core.c14
-rw-r--r--drivers/mfd/arizona-irq.c1
-rw-r--r--drivers/mfd/twl-core.c2
-rw-r--r--drivers/mfd/twl4030-irq.c3
-rw-r--r--drivers/mfd/wm5102-tables.c519
-rw-r--r--drivers/mtd/mtdcore.c6
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb.c8
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_pro.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c2
-rw-r--r--drivers/net/team/team.c4
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/tty/vt/vt.c8
-rw-r--r--drivers/vhost/vhost.c2
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/inode.c16
-rw-r--r--fs/internal.h1
-rw-r--r--fs/jbd/transaction.c2
-rw-r--r--fs/proc/base.c5
-rw-r--r--include/linux/bug.h1
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/percpu-rwsem.h4
-rw-r--r--include/media/adv7604.h21
-rw-r--r--include/trace/events/gfpflags.h1
-rw-r--r--kernel/futex.c18
-rw-r--r--kernel/watchdog.c4
-rw-r--r--lib/mpi/longlong.h19
-rw-r--r--mm/page_alloc.c7
-rw-r--r--mm/vmscan.c37
-rw-r--r--net/can/bcm.c3
-rw-r--r--net/ipv4/icmp.c3
-rw-r--r--net/ipv4/ipmr.c4
-rw-r--r--net/irda/irttp.c1
-rw-r--r--net/netfilter/ipset/ip_set_hash_netiface.c2
-rw-r--r--net/openvswitch/flow.c14
-rw-r--r--net/openvswitch/vport-netdev.c2
-rw-r--r--net/sctp/chunk.c20
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/sctp/transport.c2
-rw-r--r--scripts/headers_install.pl3
69 files changed, 585 insertions, 786 deletions
diff --git a/Makefile b/Makefile
index 9f6ca124e890..3d2fc460b22f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 7 2PATCHLEVEL = 7
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Terrified Chipmunk 5NAME = Terrified Chipmunk
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 90275f036cd1..49ca86e37b8d 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -652,6 +652,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
652 mov pc, lr 652 mov pc, lr
653ENDPROC(__setup_mmu) 653ENDPROC(__setup_mmu)
654 654
655@ Enable unaligned access on v6, to allow better code generation
656@ for the decompressor C code:
657__armv6_mmu_cache_on:
658 mrc p15, 0, r0, c1, c0, 0 @ read SCTLR
659 bic r0, r0, #2 @ A (no unaligned access fault)
660 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
661 mcr p15, 0, r0, c1, c0, 0 @ write SCTLR
662 b __armv4_mmu_cache_on
663
655__arm926ejs_mmu_cache_on: 664__arm926ejs_mmu_cache_on:
656#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 665#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
657 mov r0, #4 @ put dcache in WT mode 666 mov r0, #4 @ put dcache in WT mode
@@ -694,6 +703,9 @@ __armv7_mmu_cache_on:
694 bic r0, r0, #1 << 28 @ clear SCTLR.TRE 703 bic r0, r0, #1 << 28 @ clear SCTLR.TRE
695 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 704 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
696 orr r0, r0, #0x003c @ write buffer 705 orr r0, r0, #0x003c @ write buffer
706 bic r0, r0, #2 @ A (no unaligned access fault)
707 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
708 @ (needed for ARM1176)
697#ifdef CONFIG_MMU 709#ifdef CONFIG_MMU
698#ifdef CONFIG_CPU_ENDIAN_BE8 710#ifdef CONFIG_CPU_ENDIAN_BE8
699 orr r0, r0, #1 << 25 @ big-endian page tables 711 orr r0, r0, #1 << 25 @ big-endian page tables
@@ -914,7 +926,7 @@ proc_types:
914 926
915 .word 0x0007b000 @ ARMv6 927 .word 0x0007b000 @ ARMv6
916 .word 0x000ff000 928 .word 0x000ff000
917 W(b) __armv4_mmu_cache_on 929 W(b) __armv6_mmu_cache_on
918 W(b) __armv4_mmu_cache_off 930 W(b) __armv4_mmu_cache_off
919 W(b) __armv6_mmu_cache_flush 931 W(b) __armv6_mmu_cache_flush
920 932
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 86b8b480634f..09c5233f4dfc 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -89,7 +89,7 @@ ENTRY(cpu_v6_dcache_clean_area)
89 mov pc, lr 89 mov pc, lr
90 90
91/* 91/*
92 * cpu_arm926_switch_mm(pgd_phys, tsk) 92 * cpu_v6_switch_mm(pgd_phys, tsk)
93 * 93 *
94 * Set the translation table base pointer to be pgd_phys 94 * Set the translation table base pointer to be pgd_phys
95 * 95 *
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a53f8ec37aac..290dc6a1d7a3 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -79,7 +79,7 @@ static struct resource data_resource = { .name = "Kernel data", };
79void __init add_memory_region(phys_t start, phys_t size, long type) 79void __init add_memory_region(phys_t start, phys_t size, long type)
80{ 80{
81 int x = boot_mem_map.nr_map; 81 int x = boot_mem_map.nr_map;
82 struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1; 82 int i;
83 83
84 /* Sanity check */ 84 /* Sanity check */
85 if (start + size < start) { 85 if (start + size < start) {
@@ -88,15 +88,29 @@ void __init add_memory_region(phys_t start, phys_t size, long type)
88 } 88 }
89 89
90 /* 90 /*
91 * Try to merge with previous entry if any. This is far less than 91 * Try to merge with existing entry, if any.
92 * perfect but is sufficient for most real world cases.
93 */ 92 */
94 if (x && prev->addr + prev->size == start && prev->type == type) { 93 for (i = 0; i < boot_mem_map.nr_map; i++) {
95 prev->size += size; 94 struct boot_mem_map_entry *entry = boot_mem_map.map + i;
95 unsigned long top;
96
97 if (entry->type != type)
98 continue;
99
100 if (start + size < entry->addr)
101 continue; /* no overlap */
102
103 if (entry->addr + entry->size < start)
104 continue; /* no overlap */
105
106 top = max(entry->addr + entry->size, start + size);
107 entry->addr = min(entry->addr, start);
108 entry->size = top - entry->addr;
109
96 return; 110 return;
97 } 111 }
98 112
99 if (x == BOOT_MEM_MAP_MAX) { 113 if (boot_mem_map.nr_map == BOOT_MEM_MAP_MAX) {
100 pr_err("Ooops! Too many entries in the memory map!\n"); 114 pr_err("Ooops! Too many entries in the memory map!\n");
101 return; 115 return;
102 } 116 }
diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c
index e091430dbeb1..cd160be3ce4d 100644
--- a/arch/mips/lib/mips-atomic.c
+++ b/arch/mips/lib/mips-atomic.c
@@ -56,7 +56,7 @@ __asm__(
56 " .set pop \n" 56 " .set pop \n"
57 " .endm \n"); 57 " .endm \n");
58 58
59void arch_local_irq_disable(void) 59notrace void arch_local_irq_disable(void)
60{ 60{
61 preempt_disable(); 61 preempt_disable();
62 __asm__ __volatile__( 62 __asm__ __volatile__(
@@ -93,7 +93,7 @@ __asm__(
93 " .set pop \n" 93 " .set pop \n"
94 " .endm \n"); 94 " .endm \n");
95 95
96unsigned long arch_local_irq_save(void) 96notrace unsigned long arch_local_irq_save(void)
97{ 97{
98 unsigned long flags; 98 unsigned long flags;
99 preempt_disable(); 99 preempt_disable();
@@ -135,7 +135,7 @@ __asm__(
135 " .set pop \n" 135 " .set pop \n"
136 " .endm \n"); 136 " .endm \n");
137 137
138void arch_local_irq_restore(unsigned long flags) 138notrace void arch_local_irq_restore(unsigned long flags)
139{ 139{
140 unsigned long __tmp1; 140 unsigned long __tmp1;
141 141
@@ -159,7 +159,7 @@ void arch_local_irq_restore(unsigned long flags)
159EXPORT_SYMBOL(arch_local_irq_restore); 159EXPORT_SYMBOL(arch_local_irq_restore);
160 160
161 161
162void __arch_local_irq_restore(unsigned long flags) 162notrace void __arch_local_irq_restore(unsigned long flags)
163{ 163{
164 unsigned long __tmp1; 164 unsigned long __tmp1;
165 165
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/platforms/pseries/eeh_pe.c
index 797cd181dc3f..d16c8ded1084 100644
--- a/arch/powerpc/platforms/pseries/eeh_pe.c
+++ b/arch/powerpc/platforms/pseries/eeh_pe.c
@@ -449,7 +449,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
449 if (list_empty(&pe->edevs)) { 449 if (list_empty(&pe->edevs)) {
450 cnt = 0; 450 cnt = 0;
451 list_for_each_entry(child, &pe->child_list, child) { 451 list_for_each_entry(child, &pe->child_list, child) {
452 if (!(pe->type & EEH_PE_INVALID)) { 452 if (!(child->type & EEH_PE_INVALID)) {
453 cnt++; 453 cnt++;
454 break; 454 break;
455 } 455 }
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index d19f4977c834..e5b084723131 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -220,7 +220,8 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
220 220
221 /* Get the top level device in the PE */ 221 /* Get the top level device in the PE */
222 edev = of_node_to_eeh_dev(dn); 222 edev = of_node_to_eeh_dev(dn);
223 edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); 223 if (edev->pe)
224 edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list);
224 dn = eeh_dev_to_of_node(edev); 225 dn = eeh_dev_to_of_node(edev);
225 if (!dn) 226 if (!dn)
226 return NULL; 227 return NULL;
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 89b30f32ba68..ff7bb8a42ed6 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1961,6 +1961,7 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
1961 res = loader_verify(lb, dev, rec); 1961 res = loader_verify(lb, dev, rec);
1962 if (res) 1962 if (res)
1963 break; 1963 break;
1964 rec = ihex_next_binrec(rec);
1964 } 1965 }
1965 release_firmware(fw); 1966 release_firmware(fw);
1966 if (!res) 1967 if (!res)
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c
index 262dfa503c2a..b551ca350e00 100644
--- a/drivers/media/dvb-frontends/stv0900_core.c
+++ b/drivers/media/dvb-frontends/stv0900_core.c
@@ -300,15 +300,15 @@ static enum fe_stv0900_error stv0900_set_mclk(struct stv0900_internal *intp, u32
300{ 300{
301 u32 m_div, clk_sel; 301 u32 m_div, clk_sel;
302 302
303 dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
304 intp->quartz);
305
306 if (intp == NULL) 303 if (intp == NULL)
307 return STV0900_INVALID_HANDLE; 304 return STV0900_INVALID_HANDLE;
308 305
309 if (intp->errs) 306 if (intp->errs)
310 return STV0900_I2C_ERROR; 307 return STV0900_I2C_ERROR;
311 308
309 dprintk("%s: Mclk set to %d, Quartz = %d\n", __func__, mclk,
310 intp->quartz);
311
312 clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6); 312 clk_sel = ((stv0900_get_bits(intp, F0900_SELX1RATIO) == 1) ? 4 : 6);
313 m_div = ((clk_sel * mclk) / intp->quartz) - 1; 313 m_div = ((clk_sel * mclk) / intp->quartz) - 1;
314 stv0900_write_bits(intp, F0900_M_DIV, m_div); 314 stv0900_write_bits(intp, F0900_M_DIV, m_div);
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 109bc9b12e74..05f8950f6f91 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -53,8 +53,7 @@ MODULE_LICENSE("GPL");
53/* ADV7604 system clock frequency */ 53/* ADV7604 system clock frequency */
54#define ADV7604_fsc (28636360) 54#define ADV7604_fsc (28636360)
55 55
56#define DIGITAL_INPUT ((state->prim_mode == ADV7604_PRIM_MODE_HDMI_COMP) || \ 56#define DIGITAL_INPUT (state->mode == ADV7604_MODE_HDMI)
57 (state->prim_mode == ADV7604_PRIM_MODE_HDMI_GR))
58 57
59/* 58/*
60 ********************************************************************** 59 **********************************************************************
@@ -68,7 +67,7 @@ struct adv7604_state {
68 struct v4l2_subdev sd; 67 struct v4l2_subdev sd;
69 struct media_pad pad; 68 struct media_pad pad;
70 struct v4l2_ctrl_handler hdl; 69 struct v4l2_ctrl_handler hdl;
71 enum adv7604_prim_mode prim_mode; 70 enum adv7604_mode mode;
72 struct v4l2_dv_timings timings; 71 struct v4l2_dv_timings timings;
73 u8 edid[256]; 72 u8 edid[256];
74 unsigned edid_blocks; 73 unsigned edid_blocks;
@@ -77,6 +76,7 @@ struct adv7604_state {
77 struct workqueue_struct *work_queues; 76 struct workqueue_struct *work_queues;
78 struct delayed_work delayed_work_enable_hotplug; 77 struct delayed_work delayed_work_enable_hotplug;
79 bool connector_hdmi; 78 bool connector_hdmi;
79 bool restart_stdi_once;
80 80
81 /* i2c clients */ 81 /* i2c clients */
82 struct i2c_client *i2c_avlink; 82 struct i2c_client *i2c_avlink;
@@ -106,7 +106,6 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
106 V4L2_DV_BT_CEA_720X576P50, 106 V4L2_DV_BT_CEA_720X576P50,
107 V4L2_DV_BT_CEA_1280X720P24, 107 V4L2_DV_BT_CEA_1280X720P24,
108 V4L2_DV_BT_CEA_1280X720P25, 108 V4L2_DV_BT_CEA_1280X720P25,
109 V4L2_DV_BT_CEA_1280X720P30,
110 V4L2_DV_BT_CEA_1280X720P50, 109 V4L2_DV_BT_CEA_1280X720P50,
111 V4L2_DV_BT_CEA_1280X720P60, 110 V4L2_DV_BT_CEA_1280X720P60,
112 V4L2_DV_BT_CEA_1920X1080P24, 111 V4L2_DV_BT_CEA_1920X1080P24,
@@ -115,6 +114,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
115 V4L2_DV_BT_CEA_1920X1080P50, 114 V4L2_DV_BT_CEA_1920X1080P50,
116 V4L2_DV_BT_CEA_1920X1080P60, 115 V4L2_DV_BT_CEA_1920X1080P60,
117 116
117 /* sorted by DMT ID */
118 V4L2_DV_BT_DMT_640X350P85, 118 V4L2_DV_BT_DMT_640X350P85,
119 V4L2_DV_BT_DMT_640X400P85, 119 V4L2_DV_BT_DMT_640X400P85,
120 V4L2_DV_BT_DMT_720X400P85, 120 V4L2_DV_BT_DMT_720X400P85,
@@ -164,6 +164,89 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
164 { }, 164 { },
165}; 165};
166 166
167struct adv7604_video_standards {
168 struct v4l2_dv_timings timings;
169 u8 vid_std;
170 u8 v_freq;
171};
172
173/* sorted by number of lines */
174static const struct adv7604_video_standards adv7604_prim_mode_comp[] = {
175 /* { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 }, TODO flickering */
176 { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 },
177 { V4L2_DV_BT_CEA_1280X720P50, 0x19, 0x01 },
178 { V4L2_DV_BT_CEA_1280X720P60, 0x19, 0x00 },
179 { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 },
180 { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 },
181 { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 },
182 { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 },
183 { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 },
184 /* TODO add 1920x1080P60_RB (CVT timing) */
185 { },
186};
187
188/* sorted by number of lines */
189static const struct adv7604_video_standards adv7604_prim_mode_gr[] = {
190 { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 },
191 { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 },
192 { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 },
193 { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 },
194 { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 },
195 { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 },
196 { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 },
197 { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 },
198 { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 },
199 { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 },
200 { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 },
201 { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 },
202 { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 },
203 { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 },
204 { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 },
205 { V4L2_DV_BT_DMT_1360X768P60, 0x12, 0x00 },
206 { V4L2_DV_BT_DMT_1366X768P60, 0x13, 0x00 },
207 { V4L2_DV_BT_DMT_1400X1050P60, 0x14, 0x00 },
208 { V4L2_DV_BT_DMT_1400X1050P75, 0x15, 0x00 },
209 { V4L2_DV_BT_DMT_1600X1200P60, 0x16, 0x00 }, /* TODO not tested */
210 /* TODO add 1600X1200P60_RB (not a DMT timing) */
211 { V4L2_DV_BT_DMT_1680X1050P60, 0x18, 0x00 },
212 { V4L2_DV_BT_DMT_1920X1200P60_RB, 0x19, 0x00 }, /* TODO not tested */
213 { },
214};
215
216/* sorted by number of lines */
217static const struct adv7604_video_standards adv7604_prim_mode_hdmi_comp[] = {
218 { V4L2_DV_BT_CEA_720X480P59_94, 0x0a, 0x00 },
219 { V4L2_DV_BT_CEA_720X576P50, 0x0b, 0x00 },
220 { V4L2_DV_BT_CEA_1280X720P50, 0x13, 0x01 },
221 { V4L2_DV_BT_CEA_1280X720P60, 0x13, 0x00 },
222 { V4L2_DV_BT_CEA_1920X1080P24, 0x1e, 0x04 },
223 { V4L2_DV_BT_CEA_1920X1080P25, 0x1e, 0x03 },
224 { V4L2_DV_BT_CEA_1920X1080P30, 0x1e, 0x02 },
225 { V4L2_DV_BT_CEA_1920X1080P50, 0x1e, 0x01 },
226 { V4L2_DV_BT_CEA_1920X1080P60, 0x1e, 0x00 },
227 { },
228};
229
230/* sorted by number of lines */
231static const struct adv7604_video_standards adv7604_prim_mode_hdmi_gr[] = {
232 { V4L2_DV_BT_DMT_640X480P60, 0x08, 0x00 },
233 { V4L2_DV_BT_DMT_640X480P72, 0x09, 0x00 },
234 { V4L2_DV_BT_DMT_640X480P75, 0x0a, 0x00 },
235 { V4L2_DV_BT_DMT_640X480P85, 0x0b, 0x00 },
236 { V4L2_DV_BT_DMT_800X600P56, 0x00, 0x00 },
237 { V4L2_DV_BT_DMT_800X600P60, 0x01, 0x00 },
238 { V4L2_DV_BT_DMT_800X600P72, 0x02, 0x00 },
239 { V4L2_DV_BT_DMT_800X600P75, 0x03, 0x00 },
240 { V4L2_DV_BT_DMT_800X600P85, 0x04, 0x00 },
241 { V4L2_DV_BT_DMT_1024X768P60, 0x0c, 0x00 },
242 { V4L2_DV_BT_DMT_1024X768P70, 0x0d, 0x00 },
243 { V4L2_DV_BT_DMT_1024X768P75, 0x0e, 0x00 },
244 { V4L2_DV_BT_DMT_1024X768P85, 0x0f, 0x00 },
245 { V4L2_DV_BT_DMT_1280X1024P60, 0x05, 0x00 },
246 { V4L2_DV_BT_DMT_1280X1024P75, 0x06, 0x00 },
247 { },
248};
249
167/* ----------------------------------------------------------------------- */ 250/* ----------------------------------------------------------------------- */
168 251
169static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) 252static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -672,64 +755,144 @@ static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd)
672 ((io_read(sd, 0x6f) & 0x10) >> 4)); 755 ((io_read(sd, 0x6f) & 0x10) >> 4));
673} 756}
674 757
675static void configure_free_run(struct v4l2_subdev *sd, const struct v4l2_bt_timings *timings) 758static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd,
759 u8 prim_mode,
760 const struct adv7604_video_standards *predef_vid_timings,
761 const struct v4l2_dv_timings *timings)
762{
763 struct adv7604_state *state = to_state(sd);
764 int i;
765
766 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) {
767 if (!v4l_match_dv_timings(timings, &predef_vid_timings[i].timings,
768 DIGITAL_INPUT ? 250000 : 1000000))
769 continue;
770 io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */
771 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) +
772 prim_mode); /* v_freq and prim mode */
773 return 0;
774 }
775
776 return -1;
777}
778
779static int configure_predefined_video_timings(struct v4l2_subdev *sd,
780 struct v4l2_dv_timings *timings)
676{ 781{
782 struct adv7604_state *state = to_state(sd);
783 int err;
784
785 v4l2_dbg(1, debug, sd, "%s", __func__);
786
787 /* reset to default values */
788 io_write(sd, 0x16, 0x43);
789 io_write(sd, 0x17, 0x5a);
790 /* disable embedded syncs for auto graphics mode */
791 cp_write_and_or(sd, 0x81, 0xef, 0x00);
792 cp_write(sd, 0x8f, 0x00);
793 cp_write(sd, 0x90, 0x00);
794 cp_write(sd, 0xa2, 0x00);
795 cp_write(sd, 0xa3, 0x00);
796 cp_write(sd, 0xa4, 0x00);
797 cp_write(sd, 0xa5, 0x00);
798 cp_write(sd, 0xa6, 0x00);
799 cp_write(sd, 0xa7, 0x00);
800 cp_write(sd, 0xab, 0x00);
801 cp_write(sd, 0xac, 0x00);
802
803 switch (state->mode) {
804 case ADV7604_MODE_COMP:
805 case ADV7604_MODE_GR:
806 err = find_and_set_predefined_video_timings(sd,
807 0x01, adv7604_prim_mode_comp, timings);
808 if (err)
809 err = find_and_set_predefined_video_timings(sd,
810 0x02, adv7604_prim_mode_gr, timings);
811 break;
812 case ADV7604_MODE_HDMI:
813 err = find_and_set_predefined_video_timings(sd,
814 0x05, adv7604_prim_mode_hdmi_comp, timings);
815 if (err)
816 err = find_and_set_predefined_video_timings(sd,
817 0x06, adv7604_prim_mode_hdmi_gr, timings);
818 break;
819 default:
820 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
821 __func__, state->mode);
822 err = -1;
823 break;
824 }
825
826
827 return err;
828}
829
830static void configure_custom_video_timings(struct v4l2_subdev *sd,
831 const struct v4l2_bt_timings *bt)
832{
833 struct adv7604_state *state = to_state(sd);
677 struct i2c_client *client = v4l2_get_subdevdata(sd); 834 struct i2c_client *client = v4l2_get_subdevdata(sd);
678 u32 width = htotal(timings); 835 u32 width = htotal(bt);
679 u32 height = vtotal(timings); 836 u32 height = vtotal(bt);
680 u16 ch1_fr_ll = (((u32)timings->pixelclock / 100) > 0) ? 837 u16 cp_start_sav = bt->hsync + bt->hbackporch - 4;
681 ((width * (ADV7604_fsc / 100)) / ((u32)timings->pixelclock / 100)) : 0; 838 u16 cp_start_eav = width - bt->hfrontporch;
839 u16 cp_start_vbi = height - bt->vfrontporch;
840 u16 cp_end_vbi = bt->vsync + bt->vbackporch;
841 u16 ch1_fr_ll = (((u32)bt->pixelclock / 100) > 0) ?
842 ((width * (ADV7604_fsc / 100)) / ((u32)bt->pixelclock / 100)) : 0;
843 const u8 pll[2] = {
844 0xc0 | ((width >> 8) & 0x1f),
845 width & 0xff
846 };
682 847
683 v4l2_dbg(2, debug, sd, "%s\n", __func__); 848 v4l2_dbg(2, debug, sd, "%s\n", __func__);
684 849
685 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7); /* CH1_FR_LL */ 850 switch (state->mode) {
686 cp_write(sd, 0x90, ch1_fr_ll & 0xff); /* CH1_FR_LL */ 851 case ADV7604_MODE_COMP:
687 cp_write(sd, 0xab, (height >> 4) & 0xff); /* CP_LCOUNT_MAX */ 852 case ADV7604_MODE_GR:
688 cp_write(sd, 0xac, (height & 0x0f) << 4); /* CP_LCOUNT_MAX */ 853 /* auto graphics */
689 /* TODO support interlaced */ 854 io_write(sd, 0x00, 0x07); /* video std */
690 cp_write(sd, 0x91, 0x10); /* INTERLACED */ 855 io_write(sd, 0x01, 0x02); /* prim mode */
691 856 /* enable embedded syncs for auto graphics mode */
692 /* Should only be set in auto-graphics mode [REF_02 p. 91-92] */ 857 cp_write_and_or(sd, 0x81, 0xef, 0x10);
693 if ((io_read(sd, 0x00) == 0x07) && (io_read(sd, 0x01) == 0x02)) {
694 u16 cp_start_sav, cp_start_eav, cp_start_vbi, cp_end_vbi;
695 const u8 pll[2] = {
696 (0xc0 | ((width >> 8) & 0x1f)),
697 (width & 0xff)
698 };
699 858
859 /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */
700 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ 860 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */
701 /* IO-map reg. 0x16 and 0x17 should be written in sequence */ 861 /* IO-map reg. 0x16 and 0x17 should be written in sequence */
702 if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) { 862 if (adv_smbus_write_i2c_block_data(client, 0x16, 2, pll)) {
703 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n"); 863 v4l2_err(sd, "writing to reg 0x16 and 0x17 failed\n");
704 return; 864 break;
705 } 865 }
706 866
707 /* active video - horizontal timing */ 867 /* active video - horizontal timing */
708 cp_start_sav = timings->hsync + timings->hbackporch - 4;
709 cp_start_eav = width - timings->hfrontporch;
710 cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff); 868 cp_write(sd, 0xa2, (cp_start_sav >> 4) & 0xff);
711 cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) | ((cp_start_eav >> 8) & 0x0f)); 869 cp_write(sd, 0xa3, ((cp_start_sav & 0x0f) << 4) |
870 ((cp_start_eav >> 8) & 0x0f));
712 cp_write(sd, 0xa4, cp_start_eav & 0xff); 871 cp_write(sd, 0xa4, cp_start_eav & 0xff);
713 872
714 /* active video - vertical timing */ 873 /* active video - vertical timing */
715 cp_start_vbi = height - timings->vfrontporch;
716 cp_end_vbi = timings->vsync + timings->vbackporch;
717 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff); 874 cp_write(sd, 0xa5, (cp_start_vbi >> 4) & 0xff);
718 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) | ((cp_end_vbi >> 8) & 0xf)); 875 cp_write(sd, 0xa6, ((cp_start_vbi & 0xf) << 4) |
876 ((cp_end_vbi >> 8) & 0xf));
719 cp_write(sd, 0xa7, cp_end_vbi & 0xff); 877 cp_write(sd, 0xa7, cp_end_vbi & 0xff);
720 } else { 878 break;
721 /* reset to default values */ 879 case ADV7604_MODE_HDMI:
722 io_write(sd, 0x16, 0x43); 880 /* set default prim_mode/vid_std for HDMI
723 io_write(sd, 0x17, 0x5a); 881 accoring to [REF_03, c. 4.2] */
724 cp_write(sd, 0xa2, 0x00); 882 io_write(sd, 0x00, 0x02); /* video std */
725 cp_write(sd, 0xa3, 0x00); 883 io_write(sd, 0x01, 0x06); /* prim mode */
726 cp_write(sd, 0xa4, 0x00); 884 break;
727 cp_write(sd, 0xa5, 0x00); 885 default:
728 cp_write(sd, 0xa6, 0x00); 886 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
729 cp_write(sd, 0xa7, 0x00); 887 __func__, state->mode);
888 break;
730 } 889 }
731}
732 890
891 cp_write(sd, 0x8f, (ch1_fr_ll >> 8) & 0x7);
892 cp_write(sd, 0x90, ch1_fr_ll & 0xff);
893 cp_write(sd, 0xab, (height >> 4) & 0xff);
894 cp_write(sd, 0xac, (height & 0x0f) << 4);
895}
733 896
734static void set_rgb_quantization_range(struct v4l2_subdev *sd) 897static void set_rgb_quantization_range(struct v4l2_subdev *sd)
735{ 898{
@@ -738,12 +901,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
738 switch (state->rgb_quantization_range) { 901 switch (state->rgb_quantization_range) {
739 case V4L2_DV_RGB_RANGE_AUTO: 902 case V4L2_DV_RGB_RANGE_AUTO:
740 /* automatic */ 903 /* automatic */
741 if ((hdmi_read(sd, 0x05) & 0x80) || 904 if (DIGITAL_INPUT && !(hdmi_read(sd, 0x05) & 0x80)) {
742 (state->prim_mode == ADV7604_PRIM_MODE_COMP) ||
743 (state->prim_mode == ADV7604_PRIM_MODE_RGB)) {
744 /* receiving HDMI or analog signal */
745 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
746 } else {
747 /* receiving DVI-D signal */ 905 /* receiving DVI-D signal */
748 906
749 /* ADV7604 selects RGB limited range regardless of 907 /* ADV7604 selects RGB limited range regardless of
@@ -756,6 +914,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
756 /* RGB full range (0-255) */ 914 /* RGB full range (0-255) */
757 io_write_and_or(sd, 0x02, 0x0f, 0x10); 915 io_write_and_or(sd, 0x02, 0x0f, 0x10);
758 } 916 }
917 } else {
918 /* receiving HDMI or analog signal, set automode */
919 io_write_and_or(sd, 0x02, 0x0f, 0xf0);
759 } 920 }
760 break; 921 break;
761 case V4L2_DV_RGB_RANGE_LIMITED: 922 case V4L2_DV_RGB_RANGE_LIMITED:
@@ -967,8 +1128,10 @@ static int stdi2dv_timings(struct v4l2_subdev *sd,
967 state->aspect_ratio, timings)) 1128 state->aspect_ratio, timings))
968 return 0; 1129 return 0;
969 1130
970 v4l2_dbg(2, debug, sd, "%s: No format candidate found for lcf=%d, bl = %d\n", 1131 v4l2_dbg(2, debug, sd,
971 __func__, stdi->lcf, stdi->bl); 1132 "%s: No format candidate found for lcvs = %d, lcf=%d, bl = %d, %chsync, %cvsync\n",
1133 __func__, stdi->lcvs, stdi->lcf, stdi->bl,
1134 stdi->hs_pol, stdi->vs_pol);
972 return -1; 1135 return -1;
973} 1136}
974 1137
@@ -1123,7 +1286,7 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd,
1123 adv7604_fill_optional_dv_timings_fields(sd, timings); 1286 adv7604_fill_optional_dv_timings_fields(sd, timings);
1124 } else { 1287 } else {
1125 /* find format 1288 /* find format
1126 * Since LCVS values are inaccurate (REF_03, page 275-276), 1289 * Since LCVS values are inaccurate [REF_03, p. 275-276],
1127 * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails. 1290 * stdi2dv_timings() is called with lcvs +-1 if the first attempt fails.
1128 */ 1291 */
1129 if (!stdi2dv_timings(sd, &stdi, timings)) 1292 if (!stdi2dv_timings(sd, &stdi, timings))
@@ -1135,9 +1298,31 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd,
1135 stdi.lcvs -= 2; 1298 stdi.lcvs -= 2;
1136 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs); 1299 v4l2_dbg(1, debug, sd, "%s: lcvs - 1 = %d\n", __func__, stdi.lcvs);
1137 if (stdi2dv_timings(sd, &stdi, timings)) { 1300 if (stdi2dv_timings(sd, &stdi, timings)) {
1301 /*
1302 * The STDI block may measure wrong values, especially
1303 * for lcvs and lcf. If the driver can not find any
1304 * valid timing, the STDI block is restarted to measure
1305 * the video timings again. The function will return an
1306 * error, but the restart of STDI will generate a new
1307 * STDI interrupt and the format detection process will
1308 * restart.
1309 */
1310 if (state->restart_stdi_once) {
1311 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__);
1312 /* TODO restart STDI for Sync Channel 2 */
1313 /* enter one-shot mode */
1314 cp_write_and_or(sd, 0x86, 0xf9, 0x00);
1315 /* trigger STDI restart */
1316 cp_write_and_or(sd, 0x86, 0xf9, 0x04);
1317 /* reset to continuous mode */
1318 cp_write_and_or(sd, 0x86, 0xf9, 0x02);
1319 state->restart_stdi_once = false;
1320 return -ENOLINK;
1321 }
1138 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__); 1322 v4l2_dbg(1, debug, sd, "%s: format not supported\n", __func__);
1139 return -ERANGE; 1323 return -ERANGE;
1140 } 1324 }
1325 state->restart_stdi_once = true;
1141 } 1326 }
1142found: 1327found:
1143 1328
@@ -1166,6 +1351,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd,
1166{ 1351{
1167 struct adv7604_state *state = to_state(sd); 1352 struct adv7604_state *state = to_state(sd);
1168 struct v4l2_bt_timings *bt; 1353 struct v4l2_bt_timings *bt;
1354 int err;
1169 1355
1170 if (!timings) 1356 if (!timings)
1171 return -EINVAL; 1357 return -EINVAL;
@@ -1178,12 +1364,20 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd,
1178 __func__, (u32)bt->pixelclock); 1364 __func__, (u32)bt->pixelclock);
1179 return -ERANGE; 1365 return -ERANGE;
1180 } 1366 }
1367
1181 adv7604_fill_optional_dv_timings_fields(sd, timings); 1368 adv7604_fill_optional_dv_timings_fields(sd, timings);
1182 1369
1183 state->timings = *timings; 1370 state->timings = *timings;
1184 1371
1185 /* freerun */ 1372 cp_write(sd, 0x91, bt->interlaced ? 0x50 : 0x10);
1186 configure_free_run(sd, bt); 1373
1374 /* Use prim_mode and vid_std when available */
1375 err = configure_predefined_video_timings(sd, timings);
1376 if (err) {
1377 /* custom settings when the video format
1378 does not have prim_mode/vid_std */
1379 configure_custom_video_timings(sd, bt);
1380 }
1187 1381
1188 set_rgb_quantization_range(sd); 1382 set_rgb_quantization_range(sd);
1189 1383
@@ -1203,24 +1397,25 @@ static int adv7604_g_dv_timings(struct v4l2_subdev *sd,
1203 return 0; 1397 return 0;
1204} 1398}
1205 1399
1206static void enable_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) 1400static void enable_input(struct v4l2_subdev *sd)
1207{ 1401{
1208 switch (prim_mode) { 1402 struct adv7604_state *state = to_state(sd);
1209 case ADV7604_PRIM_MODE_COMP: 1403
1210 case ADV7604_PRIM_MODE_RGB: 1404 switch (state->mode) {
1405 case ADV7604_MODE_COMP:
1406 case ADV7604_MODE_GR:
1211 /* enable */ 1407 /* enable */
1212 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ 1408 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */
1213 break; 1409 break;
1214 case ADV7604_PRIM_MODE_HDMI_COMP: 1410 case ADV7604_MODE_HDMI:
1215 case ADV7604_PRIM_MODE_HDMI_GR:
1216 /* enable */ 1411 /* enable */
1217 hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */ 1412 hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */
1218 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ 1413 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */
1219 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ 1414 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */
1220 break; 1415 break;
1221 default: 1416 default:
1222 v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", 1417 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
1223 __func__, prim_mode); 1418 __func__, state->mode);
1224 break; 1419 break;
1225 } 1420 }
1226} 1421}
@@ -1233,17 +1428,13 @@ static void disable_input(struct v4l2_subdev *sd)
1233 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ 1428 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */
1234} 1429}
1235 1430
1236static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mode) 1431static void select_input(struct v4l2_subdev *sd)
1237{ 1432{
1238 switch (prim_mode) { 1433 struct adv7604_state *state = to_state(sd);
1239 case ADV7604_PRIM_MODE_COMP:
1240 case ADV7604_PRIM_MODE_RGB:
1241 /* set mode and select free run resolution */
1242 io_write(sd, 0x00, 0x07); /* video std */
1243 io_write(sd, 0x01, 0x02); /* prim mode */
1244 /* enable embedded syncs for auto graphics mode */
1245 cp_write_and_or(sd, 0x81, 0xef, 0x10);
1246 1434
1435 switch (state->mode) {
1436 case ADV7604_MODE_COMP:
1437 case ADV7604_MODE_GR:
1247 /* reset ADI recommended settings for HDMI: */ 1438 /* reset ADI recommended settings for HDMI: */
1248 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ 1439 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */
1249 hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */ 1440 hdmi_write(sd, 0x0d, 0x04); /* HDMI filter optimization */
@@ -1271,16 +1462,7 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod
1271 cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */ 1462 cp_write(sd, 0x40, 0x5c); /* CP core pre-gain control. Graphics mode */
1272 break; 1463 break;
1273 1464
1274 case ADV7604_PRIM_MODE_HDMI_COMP: 1465 case ADV7604_MODE_HDMI:
1275 case ADV7604_PRIM_MODE_HDMI_GR:
1276 /* set mode and select free run resolution */
1277 /* video std */
1278 io_write(sd, 0x00,
1279 (prim_mode == ADV7604_PRIM_MODE_HDMI_GR) ? 0x02 : 0x1e);
1280 io_write(sd, 0x01, prim_mode); /* prim mode */
1281 /* disable embedded syncs for auto graphics mode */
1282 cp_write_and_or(sd, 0x81, 0xef, 0x00);
1283
1284 /* set ADI recommended settings for HDMI: */ 1466 /* set ADI recommended settings for HDMI: */
1285 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */ 1467 /* "ADV7604 Register Settings Recommendations (rev. 2.5, June 2010)" p. 4. */
1286 hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */ 1468 hdmi_write(sd, 0x0d, 0x84); /* HDMI filter optimization */
@@ -1309,7 +1491,8 @@ static void select_input(struct v4l2_subdev *sd, enum adv7604_prim_mode prim_mod
1309 1491
1310 break; 1492 break;
1311 default: 1493 default:
1312 v4l2_err(sd, "%s: reserved primary mode 0x%0x\n", __func__, prim_mode); 1494 v4l2_dbg(2, debug, sd, "%s: Unknown mode %d\n",
1495 __func__, state->mode);
1313 break; 1496 break;
1314 } 1497 }
1315} 1498}
@@ -1321,26 +1504,13 @@ static int adv7604_s_routing(struct v4l2_subdev *sd,
1321 1504
1322 v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input); 1505 v4l2_dbg(2, debug, sd, "%s: input %d", __func__, input);
1323 1506
1324 switch (input) { 1507 state->mode = input;
1325 case 0:
1326 /* TODO select HDMI_COMP or HDMI_GR */
1327 state->prim_mode = ADV7604_PRIM_MODE_HDMI_COMP;
1328 break;
1329 case 1:
1330 state->prim_mode = ADV7604_PRIM_MODE_RGB;
1331 break;
1332 case 2:
1333 state->prim_mode = ADV7604_PRIM_MODE_COMP;
1334 break;
1335 default:
1336 return -EINVAL;
1337 }
1338 1508
1339 disable_input(sd); 1509 disable_input(sd);
1340 1510
1341 select_input(sd, state->prim_mode); 1511 select_input(sd);
1342 1512
1343 enable_input(sd, state->prim_mode); 1513 enable_input(sd);
1344 1514
1345 return 0; 1515 return 0;
1346} 1516}
@@ -1549,8 +1719,9 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
1549 v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); 1719 v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true");
1550 v4l2_info(sd, "CP free run: %s\n", 1720 v4l2_info(sd, "CP free run: %s\n",
1551 (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); 1721 (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off"));
1552 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x\n", 1722 v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n",
1553 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f); 1723 io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f,
1724 (io_read(sd, 0x01) & 0x70) >> 4);
1554 1725
1555 v4l2_info(sd, "-----Video Timings-----\n"); 1726 v4l2_info(sd, "-----Video Timings-----\n");
1556 if (read_stdi(sd, &stdi)) 1727 if (read_stdi(sd, &stdi))
@@ -1712,9 +1883,9 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
1712 cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */ 1883 cp_write(sd, 0xba, (pdata->hdmi_free_run_mode << 1) | 0x01); /* HDMI free run */
1713 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */ 1884 cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode */
1714 cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold - 1885 cp_write(sd, 0xf9, 0x23); /* STDI ch. 1 - LCVS change threshold -
1715 ADI recommended setting [REF_01 c. 2.3.3] */ 1886 ADI recommended setting [REF_01, c. 2.3.3] */
1716 cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold - 1887 cp_write(sd, 0x45, 0x23); /* STDI ch. 2 - LCVS change threshold -
1717 ADI recommended setting [REF_01 c. 2.3.3] */ 1888 ADI recommended setting [REF_01, c. 2.3.3] */
1718 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution 1889 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution
1719 for digital formats */ 1890 for digital formats */
1720 1891
@@ -1724,11 +1895,6 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
1724 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ 1895 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */
1725 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); 1896 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4);
1726 1897
1727 state->prim_mode = pdata->prim_mode;
1728 select_input(sd, pdata->prim_mode);
1729
1730 enable_input(sd, pdata->prim_mode);
1731
1732 /* interrupts */ 1898 /* interrupts */
1733 io_write(sd, 0x40, 0xc2); /* Configure INT1 */ 1899 io_write(sd, 0x40, 0xc2); /* Configure INT1 */
1734 io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */ 1900 io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */
@@ -1883,6 +2049,7 @@ static int adv7604_probe(struct i2c_client *client,
1883 v4l2_err(sd, "failed to create all i2c clients\n"); 2049 v4l2_err(sd, "failed to create all i2c clients\n");
1884 goto err_i2c; 2050 goto err_i2c;
1885 } 2051 }
2052 state->restart_stdi_once = true;
1886 2053
1887 /* work queues */ 2054 /* work queues */
1888 state->work_queues = create_singlethread_workqueue(client->name); 2055 state->work_queues = create_singlethread_workqueue(client->name);
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
index 13057b966ee9..333ef178d6fb 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -263,9 +263,14 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
263 if (ret & 1) /* Autoexposure */ 263 if (ret & 1) /* Autoexposure */
264 ret = reg_write(client, mt9v022->reg->max_total_shutter_width, 264 ret = reg_write(client, mt9v022->reg->max_total_shutter_width,
265 rect.height + mt9v022->y_skip_top + 43); 265 rect.height + mt9v022->y_skip_top + 43);
266 else 266 /*
267 ret = reg_write(client, MT9V022_TOTAL_SHUTTER_WIDTH, 267 * If autoexposure is off, there is no need to set
268 rect.height + mt9v022->y_skip_top + 43); 268 * MT9V022_TOTAL_SHUTTER_WIDTH here. Autoexposure can be off
269 * only if the user has set exposure manually, using the
270 * V4L2_CID_EXPOSURE_AUTO with the value V4L2_EXPOSURE_MANUAL.
271 * In this case the register MT9V022_TOTAL_SHUTTER_WIDTH
272 * already contains the correct value.
273 */
269 } 274 }
270 /* Setup frame format: defaults apart from width and height */ 275 /* Setup frame format: defaults apart from width and height */
271 if (!ret) 276 if (!ret)
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index bfec9e65aefb..19cbb12a12a2 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -965,8 +965,10 @@ static struct platform_device_id gsc_driver_ids[] = {
965MODULE_DEVICE_TABLE(platform, gsc_driver_ids); 965MODULE_DEVICE_TABLE(platform, gsc_driver_ids);
966 966
967static const struct of_device_id exynos_gsc_match[] = { 967static const struct of_device_id exynos_gsc_match[] = {
968 { .compatible = "samsung,exynos5250-gsc", 968 {
969 .data = &gsc_v_100_drvdata, }, 969 .compatible = "samsung,exynos5-gsc",
970 .data = &gsc_v_100_drvdata,
971 },
970 {}, 972 {},
971}; 973};
972MODULE_DEVICE_TABLE(of, exynos_gsc_match); 974MODULE_DEVICE_TABLE(of, exynos_gsc_match);
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 60181ab96063..aa9df9d71a7b 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -1706,7 +1706,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
1706} 1706}
1707 1707
1708static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, 1708static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1709 const struct v4l2_event_subscription *sub) 1709 struct v4l2_event_subscription *sub)
1710{ 1710{
1711 if (sub->type != V4L2_EVENT_FRAME_SYNC) 1711 if (sub->type != V4L2_EVENT_FRAME_SYNC)
1712 return -EINVAL; 1712 return -EINVAL;
@@ -1719,7 +1719,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1719} 1719}
1720 1720
1721static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, 1721static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
1722 const struct v4l2_event_subscription *sub) 1722 struct v4l2_event_subscription *sub)
1723{ 1723{
1724 return v4l2_event_unsubscribe(fh, sub); 1724 return v4l2_event_unsubscribe(fh, sub);
1725} 1725}
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index d7ac76b5c2ae..b8640be692f1 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -1025,7 +1025,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat)
1025 1025
1026int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, 1026int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
1027 struct v4l2_fh *fh, 1027 struct v4l2_fh *fh,
1028 const struct v4l2_event_subscription *sub) 1028 struct v4l2_event_subscription *sub)
1029{ 1029{
1030 struct ispstat *stat = v4l2_get_subdevdata(subdev); 1030 struct ispstat *stat = v4l2_get_subdevdata(subdev);
1031 1031
@@ -1037,7 +1037,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
1037 1037
1038int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, 1038int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
1039 struct v4l2_fh *fh, 1039 struct v4l2_fh *fh,
1040 const struct v4l2_event_subscription *sub) 1040 struct v4l2_event_subscription *sub)
1041{ 1041{
1042 return v4l2_event_unsubscribe(fh, sub); 1042 return v4l2_event_unsubscribe(fh, sub);
1043} 1043}
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h
index a6fe653eb237..9b7c8654dc8a 100644
--- a/drivers/media/platform/omap3isp/ispstat.h
+++ b/drivers/media/platform/omap3isp/ispstat.h
@@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name,
147void omap3isp_stat_cleanup(struct ispstat *stat); 147void omap3isp_stat_cleanup(struct ispstat *stat);
148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev, 148int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
149 struct v4l2_fh *fh, 149 struct v4l2_fh *fh,
150 const struct v4l2_event_subscription *sub); 150 struct v4l2_event_subscription *sub);
151int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev, 151int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
152 struct v4l2_fh *fh, 152 struct v4l2_fh *fh,
153 const struct v4l2_event_subscription *sub); 153 struct v4l2_event_subscription *sub);
154int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable); 154int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
155 155
156int omap3isp_stat_busy(struct ispstat *stat); 156int omap3isp_stat_busy(struct ispstat *stat);
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index a0b737fecf13..75cd309035f9 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -792,7 +792,7 @@ isp_video_get_crop(struct file *file, void *fh, struct v4l2_crop *crop)
792} 792}
793 793
794static int 794static int
795isp_video_set_crop(struct file *file, void *fh, struct v4l2_crop *crop) 795isp_video_set_crop(struct file *file, void *fh, const struct v4l2_crop *crop)
796{ 796{
797 struct isp_video *video = video_drvdata(file); 797 struct isp_video *video = video_drvdata(file);
798 struct v4l2_subdev *subdev; 798 struct v4l2_subdev *subdev;
diff --git a/drivers/media/platform/s5p-fimc/Kconfig b/drivers/media/platform/s5p-fimc/Kconfig
index 8f090a8f270e..c16b20d86ed2 100644
--- a/drivers/media/platform/s5p-fimc/Kconfig
+++ b/drivers/media/platform/s5p-fimc/Kconfig
@@ -24,6 +24,7 @@ config VIDEO_S5P_FIMC
24config VIDEO_S5P_MIPI_CSIS 24config VIDEO_S5P_MIPI_CSIS
25 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver" 25 tristate "S5P/EXYNOS MIPI-CSI2 receiver (MIPI-CSIS) driver"
26 depends on REGULATOR 26 depends on REGULATOR
27 select S5P_SETUP_MIPIPHY
27 help 28 help
28 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2 29 This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC MIPI-CSI2
29 receiver (MIPI-CSIS) devices. 30 receiver (MIPI-CSIS) devices.
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c
index 367efd164d0f..3d39d97abaa5 100644
--- a/drivers/media/platform/s5p-fimc/fimc-capture.c
+++ b/drivers/media/platform/s5p-fimc/fimc-capture.c
@@ -1736,7 +1736,9 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
1736 q->mem_ops = &vb2_dma_contig_memops; 1736 q->mem_ops = &vb2_dma_contig_memops;
1737 q->buf_struct_size = sizeof(struct fimc_vid_buffer); 1737 q->buf_struct_size = sizeof(struct fimc_vid_buffer);
1738 1738
1739 vb2_queue_init(q); 1739 ret = vb2_queue_init(q);
1740 if (ret)
1741 goto err_ent;
1740 1742
1741 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK; 1743 vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK;
1742 ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0); 1744 ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0);
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 70bcf39de879..9db246bed841 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -1253,7 +1253,9 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
1253 q->buf_struct_size = sizeof(struct flite_buffer); 1253 q->buf_struct_size = sizeof(struct flite_buffer);
1254 q->drv_priv = fimc; 1254 q->drv_priv = fimc;
1255 1255
1256 vb2_queue_init(q); 1256 ret = vb2_queue_init(q);
1257 if (ret < 0)
1258 return ret;
1257 1259
1258 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK; 1260 fimc->vd_pad.flags = MEDIA_PAD_FL_SINK;
1259 ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0); 1261 ret = media_entity_init(&vfd->entity, 1, &fimc->vd_pad, 0);
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 80ada5882f62..38ea4d143a49 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -343,53 +343,50 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
343static int fimc_register_callback(struct device *dev, void *p) 343static int fimc_register_callback(struct device *dev, void *p)
344{ 344{
345 struct fimc_dev *fimc = dev_get_drvdata(dev); 345 struct fimc_dev *fimc = dev_get_drvdata(dev);
346 struct v4l2_subdev *sd = &fimc->vid_cap.subdev; 346 struct v4l2_subdev *sd;
347 struct fimc_md *fmd = p; 347 struct fimc_md *fmd = p;
348 int ret = 0; 348 int ret;
349
350 if (!fimc || !fimc->pdev)
351 return 0;
352 349
353 if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) 350 if (fimc == NULL || fimc->id >= FIMC_MAX_DEVS)
354 return 0; 351 return 0;
355 352
356 fimc->pipeline_ops = &fimc_pipeline_ops; 353 sd = &fimc->vid_cap.subdev;
357 fmd->fimc[fimc->pdev->id] = fimc;
358 sd->grp_id = FIMC_GROUP_ID; 354 sd->grp_id = FIMC_GROUP_ID;
359 355
360 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); 356 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
361 if (ret) { 357 if (ret) {
362 v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n", 358 v4l2_err(&fmd->v4l2_dev, "Failed to register FIMC.%d (%d)\n",
363 fimc->id, ret); 359 fimc->id, ret);
360 return ret;
364 } 361 }
365 362
366 return ret; 363 fimc->pipeline_ops = &fimc_pipeline_ops;
364 fmd->fimc[fimc->id] = fimc;
365 return 0;
367} 366}
368 367
369static int fimc_lite_register_callback(struct device *dev, void *p) 368static int fimc_lite_register_callback(struct device *dev, void *p)
370{ 369{
371 struct fimc_lite *fimc = dev_get_drvdata(dev); 370 struct fimc_lite *fimc = dev_get_drvdata(dev);
372 struct v4l2_subdev *sd = &fimc->subdev;
373 struct fimc_md *fmd = p; 371 struct fimc_md *fmd = p;
374 int ret; 372 int ret;
375 373
376 if (fimc == NULL) 374 if (fimc == NULL || fimc->index >= FIMC_LITE_MAX_DEVS)
377 return 0; 375 return 0;
378 376
379 if (fimc->index >= FIMC_LITE_MAX_DEVS) 377 fimc->subdev.grp_id = FLITE_GROUP_ID;
380 return 0;
381 378
382 fimc->pipeline_ops = &fimc_pipeline_ops; 379 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev);
383 fmd->fimc_lite[fimc->index] = fimc;
384 sd->grp_id = FLITE_GROUP_ID;
385
386 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
387 if (ret) { 380 if (ret) {
388 v4l2_err(&fmd->v4l2_dev, 381 v4l2_err(&fmd->v4l2_dev,
389 "Failed to register FIMC-LITE.%d (%d)\n", 382 "Failed to register FIMC-LITE.%d (%d)\n",
390 fimc->index, ret); 383 fimc->index, ret);
384 return ret;
391 } 385 }
392 return ret; 386
387 fimc->pipeline_ops = &fimc_pipeline_ops;
388 fmd->fimc_lite[fimc->index] = fimc;
389 return 0;
393} 390}
394 391
395static int csis_register_callback(struct device *dev, void *p) 392static int csis_register_callback(struct device *dev, void *p)
@@ -407,10 +404,12 @@ static int csis_register_callback(struct device *dev, void *p)
407 v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name); 404 v4l2_info(sd, "csis%d sd: %s\n", pdev->id, sd->name);
408 405
409 id = pdev->id < 0 ? 0 : pdev->id; 406 id = pdev->id < 0 ? 0 : pdev->id;
410 fmd->csis[id].sd = sd;
411 sd->grp_id = CSIS_GROUP_ID; 407 sd->grp_id = CSIS_GROUP_ID;
408
412 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); 409 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
413 if (ret) 410 if (!ret)
411 fmd->csis[id].sd = sd;
412 else
414 v4l2_err(&fmd->v4l2_dev, 413 v4l2_err(&fmd->v4l2_dev,
415 "Failed to register CSIS subdevice: %d\n", ret); 414 "Failed to register CSIS subdevice: %d\n", ret);
416 return ret; 415 return ret;
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index 85fd312f0a82..a1c87f0ceaab 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -935,9 +935,10 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a)
935/* Assume a dull encoder, do all the work ourselves. */ 935/* Assume a dull encoder, do all the work ourselves. */
936static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) 936static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a)
937{ 937{
938 struct v4l2_crop a_writable = *a;
938 struct video_device *vdev = video_devdata(file); 939 struct video_device *vdev = video_devdata(file);
939 struct sh_vou_device *vou_dev = video_get_drvdata(vdev); 940 struct sh_vou_device *vou_dev = video_get_drvdata(vdev);
940 struct v4l2_rect *rect = &a->c; 941 struct v4l2_rect *rect = &a_writable.c;
941 struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; 942 struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT};
942 struct v4l2_pix_format *pix = &vou_dev->pix; 943 struct v4l2_pix_format *pix = &vou_dev->pix;
943 struct sh_vou_geometry geo; 944 struct sh_vou_geometry geo;
diff --git a/drivers/media/platform/soc_camera/mx1_camera.c b/drivers/media/platform/soc_camera/mx1_camera.c
index bbe70991d30b..032b8c9097f9 100644
--- a/drivers/media/platform/soc_camera/mx1_camera.c
+++ b/drivers/media/platform/soc_camera/mx1_camera.c
@@ -470,14 +470,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
470 pcdev->icd = NULL; 470 pcdev->icd = NULL;
471} 471}
472 472
473static int mx1_camera_set_crop(struct soc_camera_device *icd,
474 struct v4l2_crop *a)
475{
476 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
477
478 return v4l2_subdev_call(sd, video, s_crop, a);
479}
480
481static int mx1_camera_set_bus_param(struct soc_camera_device *icd) 473static int mx1_camera_set_bus_param(struct soc_camera_device *icd)
482{ 474{
483 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 475 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
@@ -689,7 +681,6 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = {
689 .add = mx1_camera_add_device, 681 .add = mx1_camera_add_device,
690 .remove = mx1_camera_remove_device, 682 .remove = mx1_camera_remove_device,
691 .set_bus_param = mx1_camera_set_bus_param, 683 .set_bus_param = mx1_camera_set_bus_param,
692 .set_crop = mx1_camera_set_crop,
693 .set_fmt = mx1_camera_set_fmt, 684 .set_fmt = mx1_camera_set_fmt,
694 .try_fmt = mx1_camera_try_fmt, 685 .try_fmt = mx1_camera_try_fmt,
695 .init_videobuf = mx1_camera_init_videobuf, 686 .init_videobuf = mx1_camera_init_videobuf,
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 9fd9d1c5b218..9a55f4c4c7f4 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -864,8 +864,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
864 864
865 bytesperline = soc_mbus_bytes_per_line(icd->user_width, 865 bytesperline = soc_mbus_bytes_per_line(icd->user_width,
866 icd->current_fmt->host_fmt); 866 icd->current_fmt->host_fmt);
867 if (bytesperline < 0) 867 if (bytesperline < 0) {
868 spin_unlock_irqrestore(&pcdev->lock, flags);
868 return bytesperline; 869 return bytesperline;
870 }
869 871
870 /* 872 /*
871 * I didn't manage to properly enable/disable the prp 873 * I didn't manage to properly enable/disable the prp
@@ -878,8 +880,10 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
878 pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, 880 pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev,
879 pcdev->discard_size, &pcdev->discard_buffer_dma, 881 pcdev->discard_size, &pcdev->discard_buffer_dma,
880 GFP_KERNEL); 882 GFP_KERNEL);
881 if (!pcdev->discard_buffer) 883 if (!pcdev->discard_buffer) {
884 spin_unlock_irqrestore(&pcdev->lock, flags);
882 return -ENOMEM; 885 return -ENOMEM;
886 }
883 887
884 pcdev->buf_discard[0].discard = true; 888 pcdev->buf_discard[0].discard = true;
885 list_add_tail(&pcdev->buf_discard[0].queue, 889 list_add_tail(&pcdev->buf_discard[0].queue,
@@ -1099,9 +1103,10 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd)
1099} 1103}
1100 1104
1101static int mx2_camera_set_crop(struct soc_camera_device *icd, 1105static int mx2_camera_set_crop(struct soc_camera_device *icd,
1102 struct v4l2_crop *a) 1106 const struct v4l2_crop *a)
1103{ 1107{
1104 struct v4l2_rect *rect = &a->c; 1108 struct v4l2_crop a_writable = *a;
1109 struct v4l2_rect *rect = &a_writable.c;
1105 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1110 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1106 struct v4l2_mbus_framefmt mf; 1111 struct v4l2_mbus_framefmt mf;
1107 int ret; 1112 int ret;
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 3557ac97e430..261f6e9e1b17 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -799,9 +799,10 @@ static inline void stride_align(__u32 *width)
799 * default g_crop and cropcap from soc_camera.c 799 * default g_crop and cropcap from soc_camera.c
800 */ 800 */
801static int mx3_camera_set_crop(struct soc_camera_device *icd, 801static int mx3_camera_set_crop(struct soc_camera_device *icd,
802 struct v4l2_crop *a) 802 const struct v4l2_crop *a)
803{ 803{
804 struct v4l2_rect *rect = &a->c; 804 struct v4l2_crop a_writable = *a;
805 struct v4l2_rect *rect = &a_writable.c;
805 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 806 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
806 struct mx3_camera_dev *mx3_cam = ici->priv; 807 struct mx3_camera_dev *mx3_cam = ici->priv;
807 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 808 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
diff --git a/drivers/media/platform/soc_camera/omap1_camera.c b/drivers/media/platform/soc_camera/omap1_camera.c
index fa08c7695ccb..13636a585106 100644
--- a/drivers/media/platform/soc_camera/omap1_camera.c
+++ b/drivers/media/platform/soc_camera/omap1_camera.c
@@ -1215,9 +1215,9 @@ static int set_mbus_format(struct omap1_cam_dev *pcdev, struct device *dev,
1215} 1215}
1216 1216
1217static int omap1_cam_set_crop(struct soc_camera_device *icd, 1217static int omap1_cam_set_crop(struct soc_camera_device *icd,
1218 struct v4l2_crop *crop) 1218 const struct v4l2_crop *crop)
1219{ 1219{
1220 struct v4l2_rect *rect = &crop->c; 1220 const struct v4l2_rect *rect = &crop->c;
1221 const struct soc_camera_format_xlate *xlate = icd->current_fmt; 1221 const struct soc_camera_format_xlate *xlate = icd->current_fmt;
1222 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1222 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1223 struct device *dev = icd->parent; 1223 struct device *dev = icd->parent;
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c
index 1e3776d08dac..3434ffe79c6e 100644
--- a/drivers/media/platform/soc_camera/pxa_camera.c
+++ b/drivers/media/platform/soc_camera/pxa_camera.c
@@ -1337,9 +1337,9 @@ static int pxa_camera_check_frame(u32 width, u32 height)
1337} 1337}
1338 1338
1339static int pxa_camera_set_crop(struct soc_camera_device *icd, 1339static int pxa_camera_set_crop(struct soc_camera_device *icd,
1340 struct v4l2_crop *a) 1340 const struct v4l2_crop *a)
1341{ 1341{
1342 struct v4l2_rect *rect = &a->c; 1342 const struct v4l2_rect *rect = &a->c;
1343 struct device *dev = icd->parent; 1343 struct device *dev = icd->parent;
1344 struct soc_camera_host *ici = to_soc_camera_host(dev); 1344 struct soc_camera_host *ici = to_soc_camera_host(dev);
1345 struct pxa_camera_dev *pcdev = ici->priv; 1345 struct pxa_camera_dev *pcdev = ici->priv;
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
index 0a24253dcda2..2d8861c0e8f2 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
@@ -1182,13 +1182,13 @@ static void sh_mobile_ceu_put_formats(struct soc_camera_device *icd)
1182} 1182}
1183 1183
1184/* Check if any dimension of r1 is smaller than respective one of r2 */ 1184/* Check if any dimension of r1 is smaller than respective one of r2 */
1185static bool is_smaller(struct v4l2_rect *r1, struct v4l2_rect *r2) 1185static bool is_smaller(const struct v4l2_rect *r1, const struct v4l2_rect *r2)
1186{ 1186{
1187 return r1->width < r2->width || r1->height < r2->height; 1187 return r1->width < r2->width || r1->height < r2->height;
1188} 1188}
1189 1189
1190/* Check if r1 fails to cover r2 */ 1190/* Check if r1 fails to cover r2 */
1191static bool is_inside(struct v4l2_rect *r1, struct v4l2_rect *r2) 1191static bool is_inside(const struct v4l2_rect *r1, const struct v4l2_rect *r2)
1192{ 1192{
1193 return r1->left > r2->left || r1->top > r2->top || 1193 return r1->left > r2->left || r1->top > r2->top ||
1194 r1->left + r1->width < r2->left + r2->width || 1194 r1->left + r1->width < r2->left + r2->width ||
@@ -1263,7 +1263,7 @@ static void update_subrect(struct sh_mobile_ceu_cam *cam)
1263 * 3. if (2) failed, try to request the maximum image 1263 * 3. if (2) failed, try to request the maximum image
1264 */ 1264 */
1265static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, 1265static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop,
1266 const struct v4l2_crop *cam_crop) 1266 struct v4l2_crop *cam_crop)
1267{ 1267{
1268 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1268 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1269 struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; 1269 struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c;
@@ -1519,7 +1519,8 @@ static int client_scale(struct soc_camera_device *icd,
1519static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, 1519static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1520 const struct v4l2_crop *a) 1520 const struct v4l2_crop *a)
1521{ 1521{
1522 struct v4l2_rect *rect = &a->c; 1522 struct v4l2_crop a_writable = *a;
1523 const struct v4l2_rect *rect = &a_writable.c;
1523 struct device *dev = icd->parent; 1524 struct device *dev = icd->parent;
1524 struct soc_camera_host *ici = to_soc_camera_host(dev); 1525 struct soc_camera_host *ici = to_soc_camera_host(dev);
1525 struct sh_mobile_ceu_dev *pcdev = ici->priv; 1526 struct sh_mobile_ceu_dev *pcdev = ici->priv;
@@ -1545,7 +1546,7 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
1545 * 1. - 2. Apply iterative camera S_CROP for new input window, read back 1546 * 1. - 2. Apply iterative camera S_CROP for new input window, read back
1546 * actual camera rectangle. 1547 * actual camera rectangle.
1547 */ 1548 */
1548 ret = client_s_crop(icd, a, &cam_crop); 1549 ret = client_s_crop(icd, &a_writable, &cam_crop);
1549 if (ret < 0) 1550 if (ret < 0)
1550 return ret; 1551 return ret;
1551 1552
@@ -1946,7 +1947,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1946} 1947}
1947 1948
1948static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd, 1949static int sh_mobile_ceu_set_livecrop(struct soc_camera_device *icd,
1949 struct v4l2_crop *a) 1950 const struct v4l2_crop *a)
1950{ 1951{
1951 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 1952 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1952 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 1953 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index 9859d2a2449b..ba51f65204de 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -283,14 +283,13 @@ static inline int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed,
283 283
284 /* activate the pid on the device pid filter */ 284 /* activate the pid on the device pid filter */
285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER && 285 if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
286 adap->pid_filtering && 286 adap->pid_filtering && adap->props->pid_filter) {
287 adap->props->pid_filter)
288 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, 287 ret = adap->props->pid_filter(adap, dvbdmxfeed->index,
289 dvbdmxfeed->pid, (count == 1) ? 1 : 0); 288 dvbdmxfeed->pid, (count == 1) ? 1 : 0);
290 if (ret < 0) 289 if (ret < 0)
291 dev_err(&d->udev->dev, "%s: pid_filter() " \ 290 dev_err(&d->udev->dev, "%s: pid_filter() failed=%d\n",
292 "failed=%d\n", KBUILD_MODNAME, 291 KBUILD_MODNAME, ret);
293 ret); 292 }
294 293
295 /* start feeding if it is first pid */ 294 /* start feeding if it is first pid */
296 if (adap->feed_count == 1 && count == 1) { 295 if (adap->feed_count == 1 && count == 1) {
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
index 0431beed0ef4..5716662b4834 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_urb.c
@@ -32,9 +32,7 @@ int dvb_usbv2_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
32 return -EINVAL; 32 return -EINVAL;
33 } 33 }
34 34
35 ret = mutex_lock_interruptible(&d->usb_mutex); 35 mutex_lock(&d->usb_mutex);
36 if (ret < 0)
37 return ret;
38 36
39 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf); 37 dev_dbg(&d->udev->dev, "%s: >>> %*ph\n", __func__, wlen, wbuf);
40 38
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index adabba8d28bc..093f1acce403 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1346,6 +1346,10 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
1346 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) }, 1346 &rtl2832u_props, "DigitalNow Quad DVB-T Receiver", NULL) },
1347 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3, 1347 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d3,
1348 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) }, 1348 &rtl2832u_props, "TerraTec Cinergy T Stick RC (Rev. 3)", NULL) },
1349 { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1102,
1350 &rtl2832u_props, "Dexatek DK mini DVB-T Dongle", NULL) },
1351 { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00d7,
1352 &rtl2832u_props, "TerraTec Cinergy T Stick+", NULL) },
1349 { } 1353 { }
1350}; 1354};
1351MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); 1355MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 1b48f2094806..f4f9bf84bc7b 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -98,9 +98,9 @@ static irqreturn_t arizona_underclocked(int irq, void *data)
98 98
99 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS) 99 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS)
100 dev_err(arizona->dev, "AIF3 underclocked\n"); 100 dev_err(arizona->dev, "AIF3 underclocked\n");
101 if (val & ARIZONA_AIF3_UNDERCLOCKED_STS)
102 dev_err(arizona->dev, "AIF3 underclocked\n");
103 if (val & ARIZONA_AIF2_UNDERCLOCKED_STS) 101 if (val & ARIZONA_AIF2_UNDERCLOCKED_STS)
102 dev_err(arizona->dev, "AIF2 underclocked\n");
103 if (val & ARIZONA_AIF1_UNDERCLOCKED_STS)
104 dev_err(arizona->dev, "AIF1 underclocked\n"); 104 dev_err(arizona->dev, "AIF1 underclocked\n");
105 if (val & ARIZONA_ISRC2_UNDERCLOCKED_STS) 105 if (val & ARIZONA_ISRC2_UNDERCLOCKED_STS)
106 dev_err(arizona->dev, "ISRC2 underclocked\n"); 106 dev_err(arizona->dev, "ISRC2 underclocked\n");
@@ -415,11 +415,19 @@ int __devinit arizona_dev_init(struct arizona *arizona)
415 415
416 /* If we have a /RESET GPIO we'll already be reset */ 416 /* If we have a /RESET GPIO we'll already be reset */
417 if (!arizona->pdata.reset) { 417 if (!arizona->pdata.reset) {
418 regcache_mark_dirty(arizona->regmap);
419
418 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0); 420 ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0);
419 if (ret != 0) { 421 if (ret != 0) {
420 dev_err(dev, "Failed to reset device: %d\n", ret); 422 dev_err(dev, "Failed to reset device: %d\n", ret);
421 goto err_reset; 423 goto err_reset;
422 } 424 }
425
426 ret = regcache_sync(arizona->regmap);
427 if (ret != 0) {
428 dev_err(dev, "Failed to sync device: %d\n", ret);
429 goto err_reset;
430 }
423 } 431 }
424 432
425 ret = arizona_wait_for_boot(arizona); 433 ret = arizona_wait_for_boot(arizona);
@@ -520,7 +528,7 @@ int __devinit arizona_dev_init(struct arizona *arizona)
520 break; 528 break;
521 case WM5110: 529 case WM5110:
522 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, 530 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs,
523 ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 531 ARRAY_SIZE(wm5110_devs), NULL, 0, NULL);
524 break; 532 break;
525 } 533 }
526 534
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index ef0f2d001df2..b1b009177405 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -178,6 +178,7 @@ int arizona_irq_init(struct arizona *arizona)
178 178
179 switch (arizona->rev) { 179 switch (arizona->rev) {
180 case 0: 180 case 0:
181 case 1:
181 ctrlif_error = false; 182 ctrlif_error = false;
182 break; 183 break;
183 default: 184 default:
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 4ae642320205..a071a8643a47 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -671,7 +671,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
671 } 671 }
672 672
673 if (IS_ENABLED(CONFIG_PWM_TWL6030) && twl_class_is_6030()) { 673 if (IS_ENABLED(CONFIG_PWM_TWL6030) && twl_class_is_6030()) {
674 child = add_child(TWL6030_MODULE_ID1, "twl6030-pwm", NULL, 0, 674 child = add_child(SUB_CHIP_ID1, "twl6030-pwm", NULL, 0,
675 false, 0, 0); 675 false, 0, 0);
676 if (IS_ERR(child)) 676 if (IS_ERR(child))
677 return PTR_ERR(child); 677 return PTR_ERR(child);
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index ad733d76207a..cdd1173ed4e9 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -672,7 +672,8 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)
672 irq = sih_mod + twl4030_irq_base; 672 irq = sih_mod + twl4030_irq_base;
673 irq_set_handler_data(irq, agent); 673 irq_set_handler_data(irq, agent);
674 agent->irq_name = kasprintf(GFP_KERNEL, "twl4030_%s", sih->name); 674 agent->irq_name = kasprintf(GFP_KERNEL, "twl4030_%s", sih->name);
675 status = request_threaded_irq(irq, NULL, handle_twl4030_sih, 0, 675 status = request_threaded_irq(irq, NULL, handle_twl4030_sih,
676 IRQF_EARLY_RESUME,
676 agent->irq_name ?: sih->name, NULL); 677 agent->irq_name ?: sih->name, NULL);
677 678
678 dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", sih->name, 679 dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", sih->name,
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index 01b9255ed631..14490cc785d2 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -43,6 +43,7 @@ static const struct reg_default wm5102_reva_patch[] = {
43 { 0x479, 0x0A30 }, 43 { 0x479, 0x0A30 },
44 { 0x47B, 0x0810 }, 44 { 0x47B, 0x0810 },
45 { 0x47D, 0x0510 }, 45 { 0x47D, 0x0510 },
46 { 0x4D1, 0x017F },
46 { 0x500, 0x000D }, 47 { 0x500, 0x000D },
47 { 0x507, 0x1820 }, 48 { 0x507, 0x1820 },
48 { 0x508, 0x1820 }, 49 { 0x508, 0x1820 },
@@ -52,524 +53,6 @@ static const struct reg_default wm5102_reva_patch[] = {
52 { 0x580, 0x000D }, 53 { 0x580, 0x000D },
53 { 0x587, 0x1820 }, 54 { 0x587, 0x1820 },
54 { 0x588, 0x1820 }, 55 { 0x588, 0x1820 },
55 { 0x101, 0x8140 },
56 { 0x3000, 0x2225 },
57 { 0x3001, 0x3a03 },
58 { 0x3002, 0x0225 },
59 { 0x3003, 0x0801 },
60 { 0x3004, 0x6249 },
61 { 0x3005, 0x0c04 },
62 { 0x3006, 0x0225 },
63 { 0x3007, 0x5901 },
64 { 0x3008, 0xe249 },
65 { 0x3009, 0x030d },
66 { 0x300a, 0x0249 },
67 { 0x300b, 0x2c01 },
68 { 0x300c, 0xe249 },
69 { 0x300d, 0x4342 },
70 { 0x300e, 0xe249 },
71 { 0x300f, 0x73c0 },
72 { 0x3010, 0x4249 },
73 { 0x3011, 0x0c00 },
74 { 0x3012, 0x0225 },
75 { 0x3013, 0x1f01 },
76 { 0x3014, 0x0225 },
77 { 0x3015, 0x1e01 },
78 { 0x3016, 0x0225 },
79 { 0x3017, 0xfa00 },
80 { 0x3018, 0x0000 },
81 { 0x3019, 0xf000 },
82 { 0x301a, 0x0000 },
83 { 0x301b, 0xf000 },
84 { 0x301c, 0x0000 },
85 { 0x301d, 0xf000 },
86 { 0x301e, 0x0000 },
87 { 0x301f, 0xf000 },
88 { 0x3020, 0x0000 },
89 { 0x3021, 0xf000 },
90 { 0x3022, 0x0000 },
91 { 0x3023, 0xf000 },
92 { 0x3024, 0x0000 },
93 { 0x3025, 0xf000 },
94 { 0x3026, 0x0000 },
95 { 0x3027, 0xf000 },
96 { 0x3028, 0x0000 },
97 { 0x3029, 0xf000 },
98 { 0x302a, 0x0000 },
99 { 0x302b, 0xf000 },
100 { 0x302c, 0x0000 },
101 { 0x302d, 0xf000 },
102 { 0x302e, 0x0000 },
103 { 0x302f, 0xf000 },
104 { 0x3030, 0x0225 },
105 { 0x3031, 0x1a01 },
106 { 0x3032, 0x0225 },
107 { 0x3033, 0x1e00 },
108 { 0x3034, 0x0225 },
109 { 0x3035, 0x1f00 },
110 { 0x3036, 0x6225 },
111 { 0x3037, 0xf800 },
112 { 0x3038, 0x0000 },
113 { 0x3039, 0xf000 },
114 { 0x303a, 0x0000 },
115 { 0x303b, 0xf000 },
116 { 0x303c, 0x0000 },
117 { 0x303d, 0xf000 },
118 { 0x303e, 0x0000 },
119 { 0x303f, 0xf000 },
120 { 0x3040, 0x2226 },
121 { 0x3041, 0x3a03 },
122 { 0x3042, 0x0226 },
123 { 0x3043, 0x0801 },
124 { 0x3044, 0x6249 },
125 { 0x3045, 0x0c06 },
126 { 0x3046, 0x0226 },
127 { 0x3047, 0x5901 },
128 { 0x3048, 0xe249 },
129 { 0x3049, 0x030d },
130 { 0x304a, 0x0249 },
131 { 0x304b, 0x2c01 },
132 { 0x304c, 0xe249 },
133 { 0x304d, 0x4342 },
134 { 0x304e, 0xe249 },
135 { 0x304f, 0x73c0 },
136 { 0x3050, 0x4249 },
137 { 0x3051, 0x0c00 },
138 { 0x3052, 0x0226 },
139 { 0x3053, 0x1f01 },
140 { 0x3054, 0x0226 },
141 { 0x3055, 0x1e01 },
142 { 0x3056, 0x0226 },
143 { 0x3057, 0xfa00 },
144 { 0x3058, 0x0000 },
145 { 0x3059, 0xf000 },
146 { 0x305a, 0x0000 },
147 { 0x305b, 0xf000 },
148 { 0x305c, 0x0000 },
149 { 0x305d, 0xf000 },
150 { 0x305e, 0x0000 },
151 { 0x305f, 0xf000 },
152 { 0x3060, 0x0000 },
153 { 0x3061, 0xf000 },
154 { 0x3062, 0x0000 },
155 { 0x3063, 0xf000 },
156 { 0x3064, 0x0000 },
157 { 0x3065, 0xf000 },
158 { 0x3066, 0x0000 },
159 { 0x3067, 0xf000 },
160 { 0x3068, 0x0000 },
161 { 0x3069, 0xf000 },
162 { 0x306a, 0x0000 },
163 { 0x306b, 0xf000 },
164 { 0x306c, 0x0000 },
165 { 0x306d, 0xf000 },
166 { 0x306e, 0x0000 },
167 { 0x306f, 0xf000 },
168 { 0x3070, 0x0226 },
169 { 0x3071, 0x1a01 },
170 { 0x3072, 0x0226 },
171 { 0x3073, 0x1e00 },
172 { 0x3074, 0x0226 },
173 { 0x3075, 0x1f00 },
174 { 0x3076, 0x6226 },
175 { 0x3077, 0xf800 },
176 { 0x3078, 0x0000 },
177 { 0x3079, 0xf000 },
178 { 0x307a, 0x0000 },
179 { 0x307b, 0xf000 },
180 { 0x307c, 0x0000 },
181 { 0x307d, 0xf000 },
182 { 0x307e, 0x0000 },
183 { 0x307f, 0xf000 },
184 { 0x3080, 0x2227 },
185 { 0x3081, 0x3a03 },
186 { 0x3082, 0x0227 },
187 { 0x3083, 0x0801 },
188 { 0x3084, 0x6255 },
189 { 0x3085, 0x0c04 },
190 { 0x3086, 0x0227 },
191 { 0x3087, 0x5901 },
192 { 0x3088, 0xe255 },
193 { 0x3089, 0x030d },
194 { 0x308a, 0x0255 },
195 { 0x308b, 0x2c01 },
196 { 0x308c, 0xe255 },
197 { 0x308d, 0x4342 },
198 { 0x308e, 0xe255 },
199 { 0x308f, 0x73c0 },
200 { 0x3090, 0x4255 },
201 { 0x3091, 0x0c00 },
202 { 0x3092, 0x0227 },
203 { 0x3093, 0x1f01 },
204 { 0x3094, 0x0227 },
205 { 0x3095, 0x1e01 },
206 { 0x3096, 0x0227 },
207 { 0x3097, 0xfa00 },
208 { 0x3098, 0x0000 },
209 { 0x3099, 0xf000 },
210 { 0x309a, 0x0000 },
211 { 0x309b, 0xf000 },
212 { 0x309c, 0x0000 },
213 { 0x309d, 0xf000 },
214 { 0x309e, 0x0000 },
215 { 0x309f, 0xf000 },
216 { 0x30a0, 0x0000 },
217 { 0x30a1, 0xf000 },
218 { 0x30a2, 0x0000 },
219 { 0x30a3, 0xf000 },
220 { 0x30a4, 0x0000 },
221 { 0x30a5, 0xf000 },
222 { 0x30a6, 0x0000 },
223 { 0x30a7, 0xf000 },
224 { 0x30a8, 0x0000 },
225 { 0x30a9, 0xf000 },
226 { 0x30aa, 0x0000 },
227 { 0x30ab, 0xf000 },
228 { 0x30ac, 0x0000 },
229 { 0x30ad, 0xf000 },
230 { 0x30ae, 0x0000 },
231 { 0x30af, 0xf000 },
232 { 0x30b0, 0x0227 },
233 { 0x30b1, 0x1a01 },
234 { 0x30b2, 0x0227 },
235 { 0x30b3, 0x1e00 },
236 { 0x30b4, 0x0227 },
237 { 0x30b5, 0x1f00 },
238 { 0x30b6, 0x6227 },
239 { 0x30b7, 0xf800 },
240 { 0x30b8, 0x0000 },
241 { 0x30b9, 0xf000 },
242 { 0x30ba, 0x0000 },
243 { 0x30bb, 0xf000 },
244 { 0x30bc, 0x0000 },
245 { 0x30bd, 0xf000 },
246 { 0x30be, 0x0000 },
247 { 0x30bf, 0xf000 },
248 { 0x30c0, 0x2228 },
249 { 0x30c1, 0x3a03 },
250 { 0x30c2, 0x0228 },
251 { 0x30c3, 0x0801 },
252 { 0x30c4, 0x6255 },
253 { 0x30c5, 0x0c06 },
254 { 0x30c6, 0x0228 },
255 { 0x30c7, 0x5901 },
256 { 0x30c8, 0xe255 },
257 { 0x30c9, 0x030d },
258 { 0x30ca, 0x0255 },
259 { 0x30cb, 0x2c01 },
260 { 0x30cc, 0xe255 },
261 { 0x30cd, 0x4342 },
262 { 0x30ce, 0xe255 },
263 { 0x30cf, 0x73c0 },
264 { 0x30d0, 0x4255 },
265 { 0x30d1, 0x0c00 },
266 { 0x30d2, 0x0228 },
267 { 0x30d3, 0x1f01 },
268 { 0x30d4, 0x0228 },
269 { 0x30d5, 0x1e01 },
270 { 0x30d6, 0x0228 },
271 { 0x30d7, 0xfa00 },
272 { 0x30d8, 0x0000 },
273 { 0x30d9, 0xf000 },
274 { 0x30da, 0x0000 },
275 { 0x30db, 0xf000 },
276 { 0x30dc, 0x0000 },
277 { 0x30dd, 0xf000 },
278 { 0x30de, 0x0000 },
279 { 0x30df, 0xf000 },
280 { 0x30e0, 0x0000 },
281 { 0x30e1, 0xf000 },
282 { 0x30e2, 0x0000 },
283 { 0x30e3, 0xf000 },
284 { 0x30e4, 0x0000 },
285 { 0x30e5, 0xf000 },
286 { 0x30e6, 0x0000 },
287 { 0x30e7, 0xf000 },
288 { 0x30e8, 0x0000 },
289 { 0x30e9, 0xf000 },
290 { 0x30ea, 0x0000 },
291 { 0x30eb, 0xf000 },
292 { 0x30ec, 0x0000 },
293 { 0x30ed, 0xf000 },
294 { 0x30ee, 0x0000 },
295 { 0x30ef, 0xf000 },
296 { 0x30f0, 0x0228 },
297 { 0x30f1, 0x1a01 },
298 { 0x30f2, 0x0228 },
299 { 0x30f3, 0x1e00 },
300 { 0x30f4, 0x0228 },
301 { 0x30f5, 0x1f00 },
302 { 0x30f6, 0x6228 },
303 { 0x30f7, 0xf800 },
304 { 0x30f8, 0x0000 },
305 { 0x30f9, 0xf000 },
306 { 0x30fa, 0x0000 },
307 { 0x30fb, 0xf000 },
308 { 0x30fc, 0x0000 },
309 { 0x30fd, 0xf000 },
310 { 0x30fe, 0x0000 },
311 { 0x30ff, 0xf000 },
312 { 0x3100, 0x222b },
313 { 0x3101, 0x3a03 },
314 { 0x3102, 0x222b },
315 { 0x3103, 0x5803 },
316 { 0x3104, 0xe26f },
317 { 0x3105, 0x030d },
318 { 0x3106, 0x626f },
319 { 0x3107, 0x2c01 },
320 { 0x3108, 0xe26f },
321 { 0x3109, 0x4342 },
322 { 0x310a, 0xe26f },
323 { 0x310b, 0x73c0 },
324 { 0x310c, 0x026f },
325 { 0x310d, 0x0c00 },
326 { 0x310e, 0x022b },
327 { 0x310f, 0x1f01 },
328 { 0x3110, 0x022b },
329 { 0x3111, 0x1e01 },
330 { 0x3112, 0x022b },
331 { 0x3113, 0xfa00 },
332 { 0x3114, 0x0000 },
333 { 0x3115, 0xf000 },
334 { 0x3116, 0x0000 },
335 { 0x3117, 0xf000 },
336 { 0x3118, 0x0000 },
337 { 0x3119, 0xf000 },
338 { 0x311a, 0x0000 },
339 { 0x311b, 0xf000 },
340 { 0x311c, 0x0000 },
341 { 0x311d, 0xf000 },
342 { 0x311e, 0x0000 },
343 { 0x311f, 0xf000 },
344 { 0x3120, 0x022b },
345 { 0x3121, 0x0a01 },
346 { 0x3122, 0x022b },
347 { 0x3123, 0x1e00 },
348 { 0x3124, 0x022b },
349 { 0x3125, 0x1f00 },
350 { 0x3126, 0x622b },
351 { 0x3127, 0xf800 },
352 { 0x3128, 0x0000 },
353 { 0x3129, 0xf000 },
354 { 0x312a, 0x0000 },
355 { 0x312b, 0xf000 },
356 { 0x312c, 0x0000 },
357 { 0x312d, 0xf000 },
358 { 0x312e, 0x0000 },
359 { 0x312f, 0xf000 },
360 { 0x3130, 0x0000 },
361 { 0x3131, 0xf000 },
362 { 0x3132, 0x0000 },
363 { 0x3133, 0xf000 },
364 { 0x3134, 0x0000 },
365 { 0x3135, 0xf000 },
366 { 0x3136, 0x0000 },
367 { 0x3137, 0xf000 },
368 { 0x3138, 0x0000 },
369 { 0x3139, 0xf000 },
370 { 0x313a, 0x0000 },
371 { 0x313b, 0xf000 },
372 { 0x313c, 0x0000 },
373 { 0x313d, 0xf000 },
374 { 0x313e, 0x0000 },
375 { 0x313f, 0xf000 },
376 { 0x3140, 0x0000 },
377 { 0x3141, 0xf000 },
378 { 0x3142, 0x0000 },
379 { 0x3143, 0xf000 },
380 { 0x3144, 0x0000 },
381 { 0x3145, 0xf000 },
382 { 0x3146, 0x0000 },
383 { 0x3147, 0xf000 },
384 { 0x3148, 0x0000 },
385 { 0x3149, 0xf000 },
386 { 0x314a, 0x0000 },
387 { 0x314b, 0xf000 },
388 { 0x314c, 0x0000 },
389 { 0x314d, 0xf000 },
390 { 0x314e, 0x0000 },
391 { 0x314f, 0xf000 },
392 { 0x3150, 0x0000 },
393 { 0x3151, 0xf000 },
394 { 0x3152, 0x0000 },
395 { 0x3153, 0xf000 },
396 { 0x3154, 0x0000 },
397 { 0x3155, 0xf000 },
398 { 0x3156, 0x0000 },
399 { 0x3157, 0xf000 },
400 { 0x3158, 0x0000 },
401 { 0x3159, 0xf000 },
402 { 0x315a, 0x0000 },
403 { 0x315b, 0xf000 },
404 { 0x315c, 0x0000 },
405 { 0x315d, 0xf000 },
406 { 0x315e, 0x0000 },
407 { 0x315f, 0xf000 },
408 { 0x3160, 0x0000 },
409 { 0x3161, 0xf000 },
410 { 0x3162, 0x0000 },
411 { 0x3163, 0xf000 },
412 { 0x3164, 0x0000 },
413 { 0x3165, 0xf000 },
414 { 0x3166, 0x0000 },
415 { 0x3167, 0xf000 },
416 { 0x3168, 0x0000 },
417 { 0x3169, 0xf000 },
418 { 0x316a, 0x0000 },
419 { 0x316b, 0xf000 },
420 { 0x316c, 0x0000 },
421 { 0x316d, 0xf000 },
422 { 0x316e, 0x0000 },
423 { 0x316f, 0xf000 },
424 { 0x3170, 0x0000 },
425 { 0x3171, 0xf000 },
426 { 0x3172, 0x0000 },
427 { 0x3173, 0xf000 },
428 { 0x3174, 0x0000 },
429 { 0x3175, 0xf000 },
430 { 0x3176, 0x0000 },
431 { 0x3177, 0xf000 },
432 { 0x3178, 0x0000 },
433 { 0x3179, 0xf000 },
434 { 0x317a, 0x0000 },
435 { 0x317b, 0xf000 },
436 { 0x317c, 0x0000 },
437 { 0x317d, 0xf000 },
438 { 0x317e, 0x0000 },
439 { 0x317f, 0xf000 },
440 { 0x3180, 0x2001 },
441 { 0x3181, 0xf101 },
442 { 0x3182, 0x0000 },
443 { 0x3183, 0xf000 },
444 { 0x3184, 0x0000 },
445 { 0x3185, 0xf000 },
446 { 0x3186, 0x0000 },
447 { 0x3187, 0xf000 },
448 { 0x3188, 0x0000 },
449 { 0x3189, 0xf000 },
450 { 0x318a, 0x0000 },
451 { 0x318b, 0xf000 },
452 { 0x318c, 0x0000 },
453 { 0x318d, 0xf000 },
454 { 0x318e, 0x0000 },
455 { 0x318f, 0xf000 },
456 { 0x3190, 0x0000 },
457 { 0x3191, 0xf000 },
458 { 0x3192, 0x0000 },
459 { 0x3193, 0xf000 },
460 { 0x3194, 0x0000 },
461 { 0x3195, 0xf000 },
462 { 0x3196, 0x0000 },
463 { 0x3197, 0xf000 },
464 { 0x3198, 0x0000 },
465 { 0x3199, 0xf000 },
466 { 0x319a, 0x0000 },
467 { 0x319b, 0xf000 },
468 { 0x319c, 0x0000 },
469 { 0x319d, 0xf000 },
470 { 0x319e, 0x0000 },
471 { 0x319f, 0xf000 },
472 { 0x31a0, 0x0000 },
473 { 0x31a1, 0xf000 },
474 { 0x31a2, 0x0000 },
475 { 0x31a3, 0xf000 },
476 { 0x31a4, 0x0000 },
477 { 0x31a5, 0xf000 },
478 { 0x31a6, 0x0000 },
479 { 0x31a7, 0xf000 },
480 { 0x31a8, 0x0000 },
481 { 0x31a9, 0xf000 },
482 { 0x31aa, 0x0000 },
483 { 0x31ab, 0xf000 },
484 { 0x31ac, 0x0000 },
485 { 0x31ad, 0xf000 },
486 { 0x31ae, 0x0000 },
487 { 0x31af, 0xf000 },
488 { 0x31b0, 0x0000 },
489 { 0x31b1, 0xf000 },
490 { 0x31b2, 0x0000 },
491 { 0x31b3, 0xf000 },
492 { 0x31b4, 0x0000 },
493 { 0x31b5, 0xf000 },
494 { 0x31b6, 0x0000 },
495 { 0x31b7, 0xf000 },
496 { 0x31b8, 0x0000 },
497 { 0x31b9, 0xf000 },
498 { 0x31ba, 0x0000 },
499 { 0x31bb, 0xf000 },
500 { 0x31bc, 0x0000 },
501 { 0x31bd, 0xf000 },
502 { 0x31be, 0x0000 },
503 { 0x31bf, 0xf000 },
504 { 0x31c0, 0x0000 },
505 { 0x31c1, 0xf000 },
506 { 0x31c2, 0x0000 },
507 { 0x31c3, 0xf000 },
508 { 0x31c4, 0x0000 },
509 { 0x31c5, 0xf000 },
510 { 0x31c6, 0x0000 },
511 { 0x31c7, 0xf000 },
512 { 0x31c8, 0x0000 },
513 { 0x31c9, 0xf000 },
514 { 0x31ca, 0x0000 },
515 { 0x31cb, 0xf000 },
516 { 0x31cc, 0x0000 },
517 { 0x31cd, 0xf000 },
518 { 0x31ce, 0x0000 },
519 { 0x31cf, 0xf000 },
520 { 0x31d0, 0x0000 },
521 { 0x31d1, 0xf000 },
522 { 0x31d2, 0x0000 },
523 { 0x31d3, 0xf000 },
524 { 0x31d4, 0x0000 },
525 { 0x31d5, 0xf000 },
526 { 0x31d6, 0x0000 },
527 { 0x31d7, 0xf000 },
528 { 0x31d8, 0x0000 },
529 { 0x31d9, 0xf000 },
530 { 0x31da, 0x0000 },
531 { 0x31db, 0xf000 },
532 { 0x31dc, 0x0000 },
533 { 0x31dd, 0xf000 },
534 { 0x31de, 0x0000 },
535 { 0x31df, 0xf000 },
536 { 0x31e0, 0x0000 },
537 { 0x31e1, 0xf000 },
538 { 0x31e2, 0x0000 },
539 { 0x31e3, 0xf000 },
540 { 0x31e4, 0x0000 },
541 { 0x31e5, 0xf000 },
542 { 0x31e6, 0x0000 },
543 { 0x31e7, 0xf000 },
544 { 0x31e8, 0x0000 },
545 { 0x31e9, 0xf000 },
546 { 0x31ea, 0x0000 },
547 { 0x31eb, 0xf000 },
548 { 0x31ec, 0x0000 },
549 { 0x31ed, 0xf000 },
550 { 0x31ee, 0x0000 },
551 { 0x31ef, 0xf000 },
552 { 0x31f0, 0x0000 },
553 { 0x31f1, 0xf000 },
554 { 0x31f2, 0x0000 },
555 { 0x31f3, 0xf000 },
556 { 0x31f4, 0x0000 },
557 { 0x31f5, 0xf000 },
558 { 0x31f6, 0x0000 },
559 { 0x31f7, 0xf000 },
560 { 0x31f8, 0x0000 },
561 { 0x31f9, 0xf000 },
562 { 0x31fa, 0x0000 },
563 { 0x31fb, 0xf000 },
564 { 0x31fc, 0x0000 },
565 { 0x31fd, 0xf000 },
566 { 0x31fe, 0x0000 },
567 { 0x31ff, 0xf000 },
568 { 0x024d, 0xff50 },
569 { 0x0252, 0xff50 },
570 { 0x0259, 0x0112 },
571 { 0x025e, 0x0112 },
572 { 0x101, 0x0304 },
573 { 0x80, 0x0000 }, 56 { 0x80, 0x0000 },
574}; 57};
575 58
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 374c46dff7dd..ec794a72975d 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1077,7 +1077,8 @@ EXPORT_SYMBOL_GPL(mtd_writev);
1077 * until the request succeeds or until the allocation size falls below 1077 * until the request succeeds or until the allocation size falls below
1078 * the system page size. This attempts to make sure it does not adversely 1078 * the system page size. This attempts to make sure it does not adversely
1079 * impact system performance, so when allocating more than one page, we 1079 * impact system performance, so when allocating more than one page, we
1080 * ask the memory allocator to avoid re-trying. 1080 * ask the memory allocator to avoid re-trying, swapping, writing back
1081 * or performing I/O.
1081 * 1082 *
1082 * Note, this function also makes sure that the allocated buffer is aligned to 1083 * Note, this function also makes sure that the allocated buffer is aligned to
1083 * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value. 1084 * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value.
@@ -1091,7 +1092,8 @@ EXPORT_SYMBOL_GPL(mtd_writev);
1091 */ 1092 */
1092void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size) 1093void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size)
1093{ 1094{
1094 gfp_t flags = __GFP_NOWARN | __GFP_WAIT | __GFP_NORETRY; 1095 gfp_t flags = __GFP_NOWARN | __GFP_WAIT |
1096 __GFP_NORETRY | __GFP_NO_KSWAPD;
1095 size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); 1097 size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE);
1096 void *kbuf; 1098 void *kbuf;
1097 1099
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 86f26a1ede4c..25723d8ee201 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -519,8 +519,10 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
519 mc->pdev->dev.can.state = new_state; 519 mc->pdev->dev.can.state = new_state;
520 520
521 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) { 521 if (status_len & PCAN_USB_STATUSLEN_TIMESTAMP) {
522 struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
523
522 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv); 524 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
523 skb->tstamp = timeval_to_ktime(tv); 525 hwts->hwtstamp = timeval_to_ktime(tv);
524 } 526 }
525 527
526 netif_rx(skb); 528 netif_rx(skb);
@@ -605,6 +607,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
605 struct sk_buff *skb; 607 struct sk_buff *skb;
606 struct can_frame *cf; 608 struct can_frame *cf;
607 struct timeval tv; 609 struct timeval tv;
610 struct skb_shared_hwtstamps *hwts;
608 611
609 skb = alloc_can_skb(mc->netdev, &cf); 612 skb = alloc_can_skb(mc->netdev, &cf);
610 if (!skb) 613 if (!skb)
@@ -652,7 +655,8 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)
652 655
653 /* convert timestamp into kernel time */ 656 /* convert timestamp into kernel time */
654 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv); 657 peak_usb_get_ts_tv(&mc->pdev->time_ref, mc->ts16, &tv);
655 skb->tstamp = timeval_to_ktime(tv); 658 hwts = skb_hwtstamps(skb);
659 hwts->hwtstamp = timeval_to_ktime(tv);
656 660
657 /* push the skb */ 661 /* push the skb */
658 netif_rx(skb); 662 netif_rx(skb);
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
index e1626d92511a..30d79bfa5b10 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c
@@ -532,6 +532,7 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
532 struct can_frame *can_frame; 532 struct can_frame *can_frame;
533 struct sk_buff *skb; 533 struct sk_buff *skb;
534 struct timeval tv; 534 struct timeval tv;
535 struct skb_shared_hwtstamps *hwts;
535 536
536 skb = alloc_can_skb(netdev, &can_frame); 537 skb = alloc_can_skb(netdev, &can_frame);
537 if (!skb) 538 if (!skb)
@@ -549,7 +550,8 @@ static int pcan_usb_pro_handle_canmsg(struct pcan_usb_pro_interface *usb_if,
549 memcpy(can_frame->data, rx->data, can_frame->can_dlc); 550 memcpy(can_frame->data, rx->data, can_frame->can_dlc);
550 551
551 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(rx->ts32), &tv); 552 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(rx->ts32), &tv);
552 skb->tstamp = timeval_to_ktime(tv); 553 hwts = skb_hwtstamps(skb);
554 hwts->hwtstamp = timeval_to_ktime(tv);
553 555
554 netif_rx(skb); 556 netif_rx(skb);
555 netdev->stats.rx_packets++; 557 netdev->stats.rx_packets++;
@@ -570,6 +572,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
570 u8 err_mask = 0; 572 u8 err_mask = 0;
571 struct sk_buff *skb; 573 struct sk_buff *skb;
572 struct timeval tv; 574 struct timeval tv;
575 struct skb_shared_hwtstamps *hwts;
573 576
574 /* nothing should be sent while in BUS_OFF state */ 577 /* nothing should be sent while in BUS_OFF state */
575 if (dev->can.state == CAN_STATE_BUS_OFF) 578 if (dev->can.state == CAN_STATE_BUS_OFF)
@@ -664,7 +667,8 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
664 dev->can.state = new_state; 667 dev->can.state = new_state;
665 668
666 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv); 669 peak_usb_get_ts_tv(&usb_if->time_ref, le32_to_cpu(er->ts32), &tv);
667 skb->tstamp = timeval_to_ktime(tv); 670 hwts = skb_hwtstamps(skb);
671 hwts->hwtstamp = timeval_to_ktime(tv);
668 netif_rx(skb); 672 netif_rx(skb);
669 netdev->stats.rx_packets++; 673 netdev->stats.rx_packets++;
670 netdev->stats.rx_bytes += can_frame->can_dlc; 674 netdev->stats.rx_bytes += can_frame->can_dlc;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
index 5d36795877cb..b799ab12a291 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c
@@ -237,7 +237,7 @@ static int mlx4_en_dcbnl_ieee_setmaxrate(struct net_device *dev,
237 if (err) 237 if (err)
238 return err; 238 return err;
239 239
240 memcpy(priv->maxrate, tmp, sizeof(*priv->maxrate)); 240 memcpy(priv->maxrate, tmp, sizeof(priv->maxrate));
241 241
242 return 0; 242 return 0;
243} 243}
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index d44cca327588..ad86660fb8f9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1794,10 +1794,12 @@ static void team_setup(struct net_device *dev)
1794 1794
1795 dev->features |= NETIF_F_LLTX; 1795 dev->features |= NETIF_F_LLTX;
1796 dev->features |= NETIF_F_GRO; 1796 dev->features |= NETIF_F_GRO;
1797 dev->hw_features = NETIF_F_HW_VLAN_TX | 1797 dev->hw_features = TEAM_VLAN_FEATURES |
1798 NETIF_F_HW_VLAN_TX |
1798 NETIF_F_HW_VLAN_RX | 1799 NETIF_F_HW_VLAN_RX |
1799 NETIF_F_HW_VLAN_FILTER; 1800 NETIF_F_HW_VLAN_FILTER;
1800 1801
1802 dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
1801 dev->features |= dev->hw_features; 1803 dev->features |= dev->hw_features;
1802} 1804}
1803 1805
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 3b566fa0f8e6..1ea91f4237f0 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -385,6 +385,7 @@ static const struct usb_device_id products[] = {
385 }, 385 },
386 386
387 /* 3. Combined interface devices matching on interface number */ 387 /* 3. Combined interface devices matching on interface number */
388 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
388 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, 389 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
389 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, 390 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
390 {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, 391 {QMI_FIXED_INTF(0x19d2, 0x0017, 3)},
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index f87d7e8964bf..4e0d0c3734b3 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -539,25 +539,25 @@ static void insert_char(struct vc_data *vc, unsigned int nr)
539{ 539{
540 unsigned short *p = (unsigned short *) vc->vc_pos; 540 unsigned short *p = (unsigned short *) vc->vc_pos;
541 541
542 scr_memmovew(p + nr, p, vc->vc_cols - vc->vc_x); 542 scr_memmovew(p + nr, p, (vc->vc_cols - vc->vc_x) * 2);
543 scr_memsetw(p, vc->vc_video_erase_char, nr * 2); 543 scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
544 vc->vc_need_wrap = 0; 544 vc->vc_need_wrap = 0;
545 if (DO_UPDATE(vc)) 545 if (DO_UPDATE(vc))
546 do_update_region(vc, (unsigned long) p, 546 do_update_region(vc, (unsigned long) p,
547 (vc->vc_cols - vc->vc_x) / 2 + 1); 547 vc->vc_cols - vc->vc_x);
548} 548}
549 549
550static void delete_char(struct vc_data *vc, unsigned int nr) 550static void delete_char(struct vc_data *vc, unsigned int nr)
551{ 551{
552 unsigned short *p = (unsigned short *) vc->vc_pos; 552 unsigned short *p = (unsigned short *) vc->vc_pos;
553 553
554 scr_memcpyw(p, p + nr, vc->vc_cols - vc->vc_x - nr); 554 scr_memcpyw(p, p + nr, (vc->vc_cols - vc->vc_x - nr) * 2);
555 scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char, 555 scr_memsetw(p + vc->vc_cols - vc->vc_x - nr, vc->vc_video_erase_char,
556 nr * 2); 556 nr * 2);
557 vc->vc_need_wrap = 0; 557 vc->vc_need_wrap = 0;
558 if (DO_UPDATE(vc)) 558 if (DO_UPDATE(vc))
559 do_update_region(vc, (unsigned long) p, 559 do_update_region(vc, (unsigned long) p,
560 (vc->vc_cols - vc->vc_x) / 2); 560 vc->vc_cols - vc->vc_x);
561} 561}
562 562
563static int softcursor_original; 563static int softcursor_original;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ef8f5988f855..5a3d0f1eaf94 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1049,7 +1049,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
1049 } 1049 }
1050 _iov = iov + ret; 1050 _iov = iov + ret;
1051 size = reg->memory_size - addr + reg->guest_phys_addr; 1051 size = reg->memory_size - addr + reg->guest_phys_addr;
1052 _iov->iov_len = min((u64)len, size); 1052 _iov->iov_len = min((u64)len - s, size);
1053 _iov->iov_base = (void __user *)(unsigned long) 1053 _iov->iov_base = (void __user *)(unsigned long)
1054 (reg->userspace_addr + addr - reg->guest_phys_addr); 1054 (reg->userspace_addr + addr - reg->guest_phys_addr);
1055 s += size; 1055 s += size;
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 51ea267d444c..3e3422f7f0a4 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -228,6 +228,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
228static void inode_sync_complete(struct inode *inode) 228static void inode_sync_complete(struct inode *inode)
229{ 229{
230 inode->i_state &= ~I_SYNC; 230 inode->i_state &= ~I_SYNC;
231 /* If inode is clean an unused, put it into LRU now... */
232 inode_add_lru(inode);
231 /* Waiters must see I_SYNC cleared before being woken up */ 233 /* Waiters must see I_SYNC cleared before being woken up */
232 smp_mb(); 234 smp_mb();
233 wake_up_bit(&inode->i_state, __I_SYNC); 235 wake_up_bit(&inode->i_state, __I_SYNC);
diff --git a/fs/inode.c b/fs/inode.c
index b03c71957246..64999f144153 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -408,6 +408,19 @@ static void inode_lru_list_add(struct inode *inode)
408 spin_unlock(&inode->i_sb->s_inode_lru_lock); 408 spin_unlock(&inode->i_sb->s_inode_lru_lock);
409} 409}
410 410
411/*
412 * Add inode to LRU if needed (inode is unused and clean).
413 *
414 * Needs inode->i_lock held.
415 */
416void inode_add_lru(struct inode *inode)
417{
418 if (!(inode->i_state & (I_DIRTY | I_SYNC | I_FREEING | I_WILL_FREE)) &&
419 !atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE)
420 inode_lru_list_add(inode);
421}
422
423
411static void inode_lru_list_del(struct inode *inode) 424static void inode_lru_list_del(struct inode *inode)
412{ 425{
413 spin_lock(&inode->i_sb->s_inode_lru_lock); 426 spin_lock(&inode->i_sb->s_inode_lru_lock);
@@ -1390,8 +1403,7 @@ static void iput_final(struct inode *inode)
1390 1403
1391 if (!drop && (sb->s_flags & MS_ACTIVE)) { 1404 if (!drop && (sb->s_flags & MS_ACTIVE)) {
1392 inode->i_state |= I_REFERENCED; 1405 inode->i_state |= I_REFERENCED;
1393 if (!(inode->i_state & (I_DIRTY|I_SYNC))) 1406 inode_add_lru(inode);
1394 inode_lru_list_add(inode);
1395 spin_unlock(&inode->i_lock); 1407 spin_unlock(&inode->i_lock);
1396 return; 1408 return;
1397 } 1409 }
diff --git a/fs/internal.h b/fs/internal.h
index 916b7cbf3e3e..2f6af7f645eb 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -110,6 +110,7 @@ extern int open_check_o_direct(struct file *f);
110 * inode.c 110 * inode.c
111 */ 111 */
112extern spinlock_t inode_sb_list_lock; 112extern spinlock_t inode_sb_list_lock;
113extern void inode_add_lru(struct inode *inode);
113 114
114/* 115/*
115 * fs-writeback.c 116 * fs-writeback.c
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 78b7f84241d4..7f5120bf0ec2 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -1961,7 +1961,9 @@ retry:
1961 spin_unlock(&journal->j_list_lock); 1961 spin_unlock(&journal->j_list_lock);
1962 jbd_unlock_bh_state(bh); 1962 jbd_unlock_bh_state(bh);
1963 spin_unlock(&journal->j_state_lock); 1963 spin_unlock(&journal->j_state_lock);
1964 unlock_buffer(bh);
1964 log_wait_commit(journal, tid); 1965 log_wait_commit(journal, tid);
1966 lock_buffer(bh);
1965 goto retry; 1967 goto retry;
1966 } 1968 }
1967 /* 1969 /*
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3c231adf8450..9e28356a959a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1877,8 +1877,9 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
1877 if (!vma) 1877 if (!vma)
1878 goto out_no_vma; 1878 goto out_no_vma;
1879 1879
1880 result = proc_map_files_instantiate(dir, dentry, task, 1880 if (vma->vm_file)
1881 (void *)(unsigned long)vma->vm_file->f_mode); 1881 result = proc_map_files_instantiate(dir, dentry, task,
1882 (void *)(unsigned long)vma->vm_file->f_mode);
1882 1883
1883out_no_vma: 1884out_no_vma:
1884 up_read(&mm->mmap_sem); 1885 up_read(&mm->mmap_sem);
diff --git a/include/linux/bug.h b/include/linux/bug.h
index aaac4bba6f5c..b1cf40de847e 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -15,6 +15,7 @@ struct pt_regs;
15#define BUILD_BUG_ON_NOT_POWER_OF_2(n) 15#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
16#define BUILD_BUG_ON_ZERO(e) (0) 16#define BUILD_BUG_ON_ZERO(e) (0)
17#define BUILD_BUG_ON_NULL(e) ((void*)0) 17#define BUILD_BUG_ON_NULL(e) ((void*)0)
18#define BUILD_BUG_ON_INVALID(e) (0)
18#define BUILD_BUG_ON(condition) 19#define BUILD_BUG_ON(condition)
19#define BUILD_BUG() (0) 20#define BUILD_BUG() (0)
20#else /* __CHECKER__ */ 21#else /* __CHECKER__ */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 02c1c9710be0..d0a79678f169 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -31,6 +31,7 @@ struct vm_area_struct;
31#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
32#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
33#define ___GFP_NOTRACK 0x200000u 33#define ___GFP_NOTRACK 0x200000u
34#define ___GFP_NO_KSWAPD 0x400000u
34#define ___GFP_OTHER_NODE 0x800000u 35#define ___GFP_OTHER_NODE 0x800000u
35#define ___GFP_WRITE 0x1000000u 36#define ___GFP_WRITE 0x1000000u
36 37
@@ -85,6 +86,7 @@ struct vm_area_struct;
85#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 86#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
86#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 87#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
87 88
89#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 90#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 91#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
90 92
@@ -114,7 +116,8 @@ struct vm_area_struct;
114 __GFP_MOVABLE) 116 __GFP_MOVABLE)
115#define GFP_IOFS (__GFP_IO | __GFP_FS) 117#define GFP_IOFS (__GFP_IO | __GFP_FS)
116#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 118#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) 119 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \
120 __GFP_NO_KSWAPD)
118 121
119#ifdef CONFIG_NUMA 122#ifdef CONFIG_NUMA
120#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 123#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
index 250a4acddb2b..bd1e86071e57 100644
--- a/include/linux/percpu-rwsem.h
+++ b/include/linux/percpu-rwsem.h
@@ -13,7 +13,7 @@ struct percpu_rw_semaphore {
13}; 13};
14 14
15#define light_mb() barrier() 15#define light_mb() barrier()
16#define heavy_mb() synchronize_sched() 16#define heavy_mb() synchronize_sched_expedited()
17 17
18static inline void percpu_down_read(struct percpu_rw_semaphore *p) 18static inline void percpu_down_read(struct percpu_rw_semaphore *p)
19{ 19{
@@ -51,7 +51,7 @@ static inline void percpu_down_write(struct percpu_rw_semaphore *p)
51{ 51{
52 mutex_lock(&p->mtx); 52 mutex_lock(&p->mtx);
53 p->locked = true; 53 p->locked = true;
54 synchronize_sched(); /* make sure that all readers exit the rcu_read_lock_sched region */ 54 synchronize_sched_expedited(); /* make sure that all readers exit the rcu_read_lock_sched region */
55 while (__percpu_count(p->counters)) 55 while (__percpu_count(p->counters))
56 msleep(1); 56 msleep(1);
57 heavy_mb(); /* C, between read of p->counter and write to data, paired with B */ 57 heavy_mb(); /* C, between read of p->counter and write to data, paired with B */
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 171b957db743..dc004bc926c9 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -40,14 +40,6 @@ enum adv7604_op_ch_sel {
40 ADV7604_OP_CH_SEL_RBG = 5, 40 ADV7604_OP_CH_SEL_RBG = 5,
41}; 41};
42 42
43/* Primary mode (IO register 0x01, [3:0]) */
44enum adv7604_prim_mode {
45 ADV7604_PRIM_MODE_COMP = 1,
46 ADV7604_PRIM_MODE_RGB = 2,
47 ADV7604_PRIM_MODE_HDMI_COMP = 5,
48 ADV7604_PRIM_MODE_HDMI_GR = 6,
49};
50
51/* Input Color Space (IO register 0x02, [7:4]) */ 43/* Input Color Space (IO register 0x02, [7:4]) */
52enum adv7604_inp_color_space { 44enum adv7604_inp_color_space {
53 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0, 45 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
@@ -103,9 +95,6 @@ struct adv7604_platform_data {
103 /* Bus rotation and reordering */ 95 /* Bus rotation and reordering */
104 enum adv7604_op_ch_sel op_ch_sel; 96 enum adv7604_op_ch_sel op_ch_sel;
105 97
106 /* Primary mode */
107 enum adv7604_prim_mode prim_mode;
108
109 /* Select output format */ 98 /* Select output format */
110 enum adv7604_op_format_sel op_format_sel; 99 enum adv7604_op_format_sel op_format_sel;
111 100
@@ -142,6 +131,16 @@ struct adv7604_platform_data {
142 u8 i2c_vdp; 131 u8 i2c_vdp;
143}; 132};
144 133
134/*
135 * Mode of operation.
136 * This is used as the input argument of the s_routing video op.
137 */
138enum adv7604_mode {
139 ADV7604_MODE_COMP,
140 ADV7604_MODE_GR,
141 ADV7604_MODE_HDMI,
142};
143
145#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000) 144#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001) 145#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
147#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002) 146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index 9391706e9254..d6fd8e5b14b7 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -36,6 +36,7 @@
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
39 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
39 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 40 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \
40 ) : "GFP_NOWAIT" 41 ) : "GFP_NOWAIT"
41 42
diff --git a/kernel/futex.c b/kernel/futex.c
index 20ef219bbe9b..19eb089ca003 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -843,6 +843,9 @@ static void wake_futex(struct futex_q *q)
843{ 843{
844 struct task_struct *p = q->task; 844 struct task_struct *p = q->task;
845 845
846 if (WARN(q->pi_state || q->rt_waiter, "refusing to wake PI futex\n"))
847 return;
848
846 /* 849 /*
847 * We set q->lock_ptr = NULL _before_ we wake up the task. If 850 * We set q->lock_ptr = NULL _before_ we wake up the task. If
848 * a non-futex wake up happens on another CPU then the task 851 * a non-futex wake up happens on another CPU then the task
@@ -1078,6 +1081,10 @@ retry_private:
1078 1081
1079 plist_for_each_entry_safe(this, next, head, list) { 1082 plist_for_each_entry_safe(this, next, head, list) {
1080 if (match_futex (&this->key, &key1)) { 1083 if (match_futex (&this->key, &key1)) {
1084 if (this->pi_state || this->rt_waiter) {
1085 ret = -EINVAL;
1086 goto out_unlock;
1087 }
1081 wake_futex(this); 1088 wake_futex(this);
1082 if (++ret >= nr_wake) 1089 if (++ret >= nr_wake)
1083 break; 1090 break;
@@ -1090,6 +1097,10 @@ retry_private:
1090 op_ret = 0; 1097 op_ret = 0;
1091 plist_for_each_entry_safe(this, next, head, list) { 1098 plist_for_each_entry_safe(this, next, head, list) {
1092 if (match_futex (&this->key, &key2)) { 1099 if (match_futex (&this->key, &key2)) {
1100 if (this->pi_state || this->rt_waiter) {
1101 ret = -EINVAL;
1102 goto out_unlock;
1103 }
1093 wake_futex(this); 1104 wake_futex(this);
1094 if (++op_ret >= nr_wake2) 1105 if (++op_ret >= nr_wake2)
1095 break; 1106 break;
@@ -1098,6 +1109,7 @@ retry_private:
1098 ret += op_ret; 1109 ret += op_ret;
1099 } 1110 }
1100 1111
1112out_unlock:
1101 double_unlock_hb(hb1, hb2); 1113 double_unlock_hb(hb1, hb2);
1102out_put_keys: 1114out_put_keys:
1103 put_futex_key(&key2); 1115 put_futex_key(&key2);
@@ -1387,9 +1399,13 @@ retry_private:
1387 /* 1399 /*
1388 * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always 1400 * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always
1389 * be paired with each other and no other futex ops. 1401 * be paired with each other and no other futex ops.
1402 *
1403 * We should never be requeueing a futex_q with a pi_state,
1404 * which is awaiting a futex_unlock_pi().
1390 */ 1405 */
1391 if ((requeue_pi && !this->rt_waiter) || 1406 if ((requeue_pi && !this->rt_waiter) ||
1392 (!requeue_pi && this->rt_waiter)) { 1407 (!requeue_pi && this->rt_waiter) ||
1408 this->pi_state) {
1393 ret = -EINVAL; 1409 ret = -EINVAL;
1394 break; 1410 break;
1395 } 1411 }
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 9d4c8d5a1f53..dd4b80a9f1a9 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -116,7 +116,7 @@ static unsigned long get_timestamp(int this_cpu)
116 return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */ 116 return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
117} 117}
118 118
119static unsigned long get_sample_period(void) 119static u64 get_sample_period(void)
120{ 120{
121 /* 121 /*
122 * convert watchdog_thresh from seconds to ns 122 * convert watchdog_thresh from seconds to ns
@@ -125,7 +125,7 @@ static unsigned long get_sample_period(void)
125 * and hard thresholds) to increment before the 125 * and hard thresholds) to increment before the
126 * hardlockup detector generates a warning 126 * hardlockup detector generates a warning
127 */ 127 */
128 return get_softlockup_thresh() * (NSEC_PER_SEC / 5); 128 return get_softlockup_thresh() * ((u64)NSEC_PER_SEC / 5);
129} 129}
130 130
131/* Commands for resetting the watchdog */ 131/* Commands for resetting the watchdog */
diff --git a/lib/mpi/longlong.h b/lib/mpi/longlong.h
index 678ce4f1e124..095ab157a521 100644
--- a/lib/mpi/longlong.h
+++ b/lib/mpi/longlong.h
@@ -641,7 +641,14 @@ do { \
641 ************** MIPS ***************** 641 ************** MIPS *****************
642 ***************************************/ 642 ***************************************/
643#if defined(__mips__) && W_TYPE_SIZE == 32 643#if defined(__mips__) && W_TYPE_SIZE == 32
644#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 644#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
645#define umul_ppmm(w1, w0, u, v) \
646do { \
647 UDItype __ll = (UDItype)(u) * (v); \
648 w1 = __ll >> 32; \
649 w0 = __ll; \
650} while (0)
651#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
645#define umul_ppmm(w1, w0, u, v) \ 652#define umul_ppmm(w1, w0, u, v) \
646 __asm__ ("multu %2,%3" \ 653 __asm__ ("multu %2,%3" \
647 : "=l" ((USItype)(w0)), \ 654 : "=l" ((USItype)(w0)), \
@@ -666,7 +673,15 @@ do { \
666 ************** MIPS/64 ************** 673 ************** MIPS/64 **************
667 ***************************************/ 674 ***************************************/
668#if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 675#if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64
669#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 676#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4
677#define umul_ppmm(w1, w0, u, v) \
678do { \
679 typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
680 __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \
681 w1 = __ll >> 64; \
682 w0 = __ll; \
683} while (0)
684#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
670#define umul_ppmm(w1, w0, u, v) \ 685#define umul_ppmm(w1, w0, u, v) \
671 __asm__ ("dmultu %2,%3" \ 686 __asm__ ("dmultu %2,%3" \
672 : "=l" ((UDItype)(w0)), \ 687 : "=l" ((UDItype)(w0)), \
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bcb72c6e2b2d..92871579cbee 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2416,8 +2416,9 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
2416 goto nopage; 2416 goto nopage;
2417 2417
2418restart: 2418restart:
2419 wake_all_kswapd(order, zonelist, high_zoneidx, 2419 if (!(gfp_mask & __GFP_NO_KSWAPD))
2420 zone_idx(preferred_zone)); 2420 wake_all_kswapd(order, zonelist, high_zoneidx,
2421 zone_idx(preferred_zone));
2421 2422
2422 /* 2423 /*
2423 * OK, we're below the kswapd watermark and have kicked background 2424 * OK, we're below the kswapd watermark and have kicked background
@@ -2494,7 +2495,7 @@ rebalance:
2494 * system then fail the allocation instead of entering direct reclaim. 2495 * system then fail the allocation instead of entering direct reclaim.
2495 */ 2496 */
2496 if ((deferred_compaction || contended_compaction) && 2497 if ((deferred_compaction || contended_compaction) &&
2497 (gfp_mask & (__GFP_MOVABLE|__GFP_REPEAT)) == __GFP_MOVABLE) 2498 (gfp_mask & __GFP_NO_KSWAPD))
2498 goto nopage; 2499 goto nopage;
2499 2500
2500 /* Try direct reclaim and then allocating */ 2501 /* Try direct reclaim and then allocating */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 48550c66f1f2..cbf84e152f04 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2207,9 +2207,12 @@ static bool pfmemalloc_watermark_ok(pg_data_t *pgdat)
2207 * Throttle direct reclaimers if backing storage is backed by the network 2207 * Throttle direct reclaimers if backing storage is backed by the network
2208 * and the PFMEMALLOC reserve for the preferred node is getting dangerously 2208 * and the PFMEMALLOC reserve for the preferred node is getting dangerously
2209 * depleted. kswapd will continue to make progress and wake the processes 2209 * depleted. kswapd will continue to make progress and wake the processes
2210 * when the low watermark is reached 2210 * when the low watermark is reached.
2211 *
2212 * Returns true if a fatal signal was delivered during throttling. If this
2213 * happens, the page allocator should not consider triggering the OOM killer.
2211 */ 2214 */
2212static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist, 2215static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
2213 nodemask_t *nodemask) 2216 nodemask_t *nodemask)
2214{ 2217{
2215 struct zone *zone; 2218 struct zone *zone;
@@ -2224,13 +2227,20 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
2224 * processes to block on log_wait_commit(). 2227 * processes to block on log_wait_commit().
2225 */ 2228 */
2226 if (current->flags & PF_KTHREAD) 2229 if (current->flags & PF_KTHREAD)
2227 return; 2230 goto out;
2231
2232 /*
2233 * If a fatal signal is pending, this process should not throttle.
2234 * It should return quickly so it can exit and free its memory
2235 */
2236 if (fatal_signal_pending(current))
2237 goto out;
2228 2238
2229 /* Check if the pfmemalloc reserves are ok */ 2239 /* Check if the pfmemalloc reserves are ok */
2230 first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone); 2240 first_zones_zonelist(zonelist, high_zoneidx, NULL, &zone);
2231 pgdat = zone->zone_pgdat; 2241 pgdat = zone->zone_pgdat;
2232 if (pfmemalloc_watermark_ok(pgdat)) 2242 if (pfmemalloc_watermark_ok(pgdat))
2233 return; 2243 goto out;
2234 2244
2235 /* Account for the throttling */ 2245 /* Account for the throttling */
2236 count_vm_event(PGSCAN_DIRECT_THROTTLE); 2246 count_vm_event(PGSCAN_DIRECT_THROTTLE);
@@ -2246,12 +2256,20 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
2246 if (!(gfp_mask & __GFP_FS)) { 2256 if (!(gfp_mask & __GFP_FS)) {
2247 wait_event_interruptible_timeout(pgdat->pfmemalloc_wait, 2257 wait_event_interruptible_timeout(pgdat->pfmemalloc_wait,
2248 pfmemalloc_watermark_ok(pgdat), HZ); 2258 pfmemalloc_watermark_ok(pgdat), HZ);
2249 return; 2259
2260 goto check_pending;
2250 } 2261 }
2251 2262
2252 /* Throttle until kswapd wakes the process */ 2263 /* Throttle until kswapd wakes the process */
2253 wait_event_killable(zone->zone_pgdat->pfmemalloc_wait, 2264 wait_event_killable(zone->zone_pgdat->pfmemalloc_wait,
2254 pfmemalloc_watermark_ok(pgdat)); 2265 pfmemalloc_watermark_ok(pgdat));
2266
2267check_pending:
2268 if (fatal_signal_pending(current))
2269 return true;
2270
2271out:
2272 return false;
2255} 2273}
2256 2274
2257unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 2275unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
@@ -2273,13 +2291,12 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
2273 .gfp_mask = sc.gfp_mask, 2291 .gfp_mask = sc.gfp_mask,
2274 }; 2292 };
2275 2293
2276 throttle_direct_reclaim(gfp_mask, zonelist, nodemask);
2277
2278 /* 2294 /*
2279 * Do not enter reclaim if fatal signal is pending. 1 is returned so 2295 * Do not enter reclaim if fatal signal was delivered while throttled.
2280 * that the page allocator does not consider triggering OOM 2296 * 1 is returned so that the page allocator does not OOM kill at this
2297 * point.
2281 */ 2298 */
2282 if (fatal_signal_pending(current)) 2299 if (throttle_direct_reclaim(gfp_mask, zonelist, nodemask))
2283 return 1; 2300 return 1;
2284 2301
2285 trace_mm_vmscan_direct_reclaim_begin(order, 2302 trace_mm_vmscan_direct_reclaim_begin(order,
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 6f747582718e..969b7cdff59d 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1084,6 +1084,9 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1084 op->sk = sk; 1084 op->sk = sk;
1085 op->ifindex = ifindex; 1085 op->ifindex = ifindex;
1086 1086
1087 /* ifindex for timeout events w/o previous frame reception */
1088 op->rx_ifindex = ifindex;
1089
1087 /* initialize uninitialized (kzalloc) structure */ 1090 /* initialize uninitialized (kzalloc) structure */
1088 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1091 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1089 op->timer.function = bcm_rx_timeout_handler; 1092 op->timer.function = bcm_rx_timeout_handler;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index f2eccd531746..17ff9fd7cdda 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -257,7 +257,8 @@ static inline bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt,
257 struct inet_peer *peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, 1); 257 struct inet_peer *peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, 1);
258 rc = inet_peer_xrlim_allow(peer, 258 rc = inet_peer_xrlim_allow(peer,
259 net->ipv4.sysctl_icmp_ratelimit); 259 net->ipv4.sysctl_icmp_ratelimit);
260 inet_putpeer(peer); 260 if (peer)
261 inet_putpeer(peer);
261 } 262 }
262out: 263out:
263 return rc; 264 return rc;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index fc09ef936636..58e4160fdcee 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1323,6 +1323,10 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
1323 if (get_user(v, (u32 __user *)optval)) 1323 if (get_user(v, (u32 __user *)optval))
1324 return -EFAULT; 1324 return -EFAULT;
1325 1325
1326 /* "pimreg%u" should not exceed 16 bytes (IFNAMSIZ) */
1327 if (v != RT_TABLE_DEFAULT && v >= 1000000000)
1328 return -EINVAL;
1329
1326 rtnl_lock(); 1330 rtnl_lock();
1327 ret = 0; 1331 ret = 0;
1328 if (sk == rtnl_dereference(mrt->mroute_sk)) { 1332 if (sk == rtnl_dereference(mrt->mroute_sk)) {
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 1002e3396f72..ae43c62f9045 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -441,6 +441,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
441 lsap = irlmp_open_lsap(stsap_sel, &ttp_notify, 0); 441 lsap = irlmp_open_lsap(stsap_sel, &ttp_notify, 0);
442 if (lsap == NULL) { 442 if (lsap == NULL) {
443 IRDA_DEBUG(0, "%s: unable to allocate LSAP!!\n", __func__); 443 IRDA_DEBUG(0, "%s: unable to allocate LSAP!!\n", __func__);
444 __irttp_close_tsap(self);
444 return NULL; 445 return NULL;
445 } 446 }
446 447
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
index b9a63381e349..45a101439bc5 100644
--- a/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -793,7 +793,7 @@ static struct ip_set_type hash_netiface_type __read_mostly = {
793 [IPSET_ATTR_IP] = { .type = NLA_NESTED }, 793 [IPSET_ATTR_IP] = { .type = NLA_NESTED },
794 [IPSET_ATTR_IP_TO] = { .type = NLA_NESTED }, 794 [IPSET_ATTR_IP_TO] = { .type = NLA_NESTED },
795 [IPSET_ATTR_IFACE] = { .type = NLA_NUL_STRING, 795 [IPSET_ATTR_IFACE] = { .type = NLA_NUL_STRING,
796 .len = IPSET_MAXNAMELEN - 1 }, 796 .len = IFNAMSIZ - 1 },
797 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 }, 797 [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 },
798 [IPSET_ATTR_CIDR] = { .type = NLA_U8 }, 798 [IPSET_ATTR_CIDR] = { .type = NLA_U8 },
799 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 }, 799 [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 },
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 98c70630ad06..733cbf49ed1f 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -702,15 +702,11 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key,
702 /* We only match on the lower 8 bits of the opcode. */ 702 /* We only match on the lower 8 bits of the opcode. */
703 if (ntohs(arp->ar_op) <= 0xff) 703 if (ntohs(arp->ar_op) <= 0xff)
704 key->ip.proto = ntohs(arp->ar_op); 704 key->ip.proto = ntohs(arp->ar_op);
705 705 memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src));
706 if (key->ip.proto == ARPOP_REQUEST 706 memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst));
707 || key->ip.proto == ARPOP_REPLY) { 707 memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN);
708 memcpy(&key->ipv4.addr.src, arp->ar_sip, sizeof(key->ipv4.addr.src)); 708 memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN);
709 memcpy(&key->ipv4.addr.dst, arp->ar_tip, sizeof(key->ipv4.addr.dst)); 709 key_len = SW_FLOW_KEY_OFFSET(ipv4.arp);
710 memcpy(key->ipv4.arp.sha, arp->ar_sha, ETH_ALEN);
711 memcpy(key->ipv4.arp.tha, arp->ar_tha, ETH_ALEN);
712 key_len = SW_FLOW_KEY_OFFSET(ipv4.arp);
713 }
714 } 710 }
715 } else if (key->eth.type == htons(ETH_P_IPV6)) { 711 } else if (key->eth.type == htons(ETH_P_IPV6)) {
716 int nh_len; /* IPv6 Header + Extensions */ 712 int nh_len; /* IPv6 Header + Extensions */
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 3c1e58ba714b..a9033481fa5e 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -158,7 +158,7 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
158 158
159 if (unlikely(packet_length(skb) > mtu && !skb_is_gso(skb))) { 159 if (unlikely(packet_length(skb) > mtu && !skb_is_gso(skb))) {
160 net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n", 160 net_warn_ratelimited("%s: dropped over-mtu packet: %d > %d\n",
161 ovs_dp_name(vport->dp), 161 netdev_vport->dev->name,
162 packet_length(skb), mtu); 162 packet_length(skb), mtu);
163 goto error; 163 goto error;
164 } 164 }
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c
index 7c2df9c33df3..69ce21e3716f 100644
--- a/net/sctp/chunk.c
+++ b/net/sctp/chunk.c
@@ -183,7 +183,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
183 183
184 msg = sctp_datamsg_new(GFP_KERNEL); 184 msg = sctp_datamsg_new(GFP_KERNEL);
185 if (!msg) 185 if (!msg)
186 return NULL; 186 return ERR_PTR(-ENOMEM);
187 187
188 /* Note: Calculate this outside of the loop, so that all fragments 188 /* Note: Calculate this outside of the loop, so that all fragments
189 * have the same expiration. 189 * have the same expiration.
@@ -280,11 +280,14 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
280 280
281 chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0); 281 chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, 0);
282 282
283 if (!chunk) 283 if (!chunk) {
284 err = -ENOMEM;
284 goto errout; 285 goto errout;
286 }
287
285 err = sctp_user_addto_chunk(chunk, offset, len, msgh->msg_iov); 288 err = sctp_user_addto_chunk(chunk, offset, len, msgh->msg_iov);
286 if (err < 0) 289 if (err < 0)
287 goto errout; 290 goto errout_chunk_free;
288 291
289 offset += len; 292 offset += len;
290 293
@@ -315,8 +318,10 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
315 318
316 chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0); 319 chunk = sctp_make_datafrag_empty(asoc, sinfo, over, frag, 0);
317 320
318 if (!chunk) 321 if (!chunk) {
322 err = -ENOMEM;
319 goto errout; 323 goto errout;
324 }
320 325
321 err = sctp_user_addto_chunk(chunk, offset, over,msgh->msg_iov); 326 err = sctp_user_addto_chunk(chunk, offset, over,msgh->msg_iov);
322 327
@@ -324,7 +329,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
324 __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr 329 __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr
325 - (__u8 *)chunk->skb->data); 330 - (__u8 *)chunk->skb->data);
326 if (err < 0) 331 if (err < 0)
327 goto errout; 332 goto errout_chunk_free;
328 333
329 sctp_datamsg_assign(msg, chunk); 334 sctp_datamsg_assign(msg, chunk);
330 list_add_tail(&chunk->frag_list, &msg->chunks); 335 list_add_tail(&chunk->frag_list, &msg->chunks);
@@ -332,6 +337,9 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
332 337
333 return msg; 338 return msg;
334 339
340errout_chunk_free:
341 sctp_chunk_free(chunk);
342
335errout: 343errout:
336 list_for_each_safe(pos, temp, &msg->chunks) { 344 list_for_each_safe(pos, temp, &msg->chunks) {
337 list_del_init(pos); 345 list_del_init(pos);
@@ -339,7 +347,7 @@ errout:
339 sctp_chunk_free(chunk); 347 sctp_chunk_free(chunk);
340 } 348 }
341 sctp_datamsg_put(msg); 349 sctp_datamsg_put(msg);
342 return NULL; 350 return ERR_PTR(err);
343} 351}
344 352
345/* Check whether this message has expired. */ 353/* Check whether this message has expired. */
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 2e897069310a..bc1624913c42 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1916,8 +1916,8 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1916 1916
1917 /* Break the message into multiple chunks of maximum size. */ 1917 /* Break the message into multiple chunks of maximum size. */
1918 datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len); 1918 datamsg = sctp_datamsg_from_user(asoc, sinfo, msg, msg_len);
1919 if (!datamsg) { 1919 if (IS_ERR(datamsg)) {
1920 err = -ENOMEM; 1920 err = PTR_ERR(datamsg);
1921 goto out_free; 1921 goto out_free;
1922 } 1922 }
1923 1923
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 953c21e4af97..206cf5238fd3 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -331,7 +331,7 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
331 * 1/8, rto_alpha would be expressed as 3. 331 * 1/8, rto_alpha would be expressed as 3.
332 */ 332 */
333 tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta) 333 tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta)
334 + ((abs(tp->srtt - rtt)) >> net->sctp.rto_beta); 334 + (((__u32)abs64((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta);
335 tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha) 335 tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha)
336 + (rtt >> net->sctp.rto_alpha); 336 + (rtt >> net->sctp.rto_alpha);
337 } else { 337 } else {
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 239d22d4207b..6c353ae8a451 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -42,6 +42,9 @@ foreach my $filename (@files) {
42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g; 42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; 43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; 44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
45 $line =~ s/#ifndef _UAPI/#ifndef /;
46 $line =~ s/#define _UAPI/#define /;
47 $line =~ s!#endif /[*] _UAPI!#endif /* !;
45 printf {$out} "%s", $line; 48 printf {$out} "%s", $line;
46 } 49 }
47 close $out; 50 close $out;